OpenShadingLanguage 1.00
# Compiled by oslc 1.5.10
shader node_normal_map
param	normal	NormalIn	0 0 0 		 %read{1,83} %write{0,0}
param	float	Strength	1 		 %read{78,81} %write{2147483647,-1}
param	color	Color	0.5 0.5 1 		 %read{2,6} %write{2147483647,-1}
param	string	space	"Tangent" 		 %read{10,68} %write{2147483647,-1}
param	string	attr_name	"geom:tangent" 		 %read{17,17} %write{2147483647,-1}
param	string	attr_sign_name	"geom:tangent_sign" 		 %read{20,20} %write{2147483647,-1}
oparam	normal	Normal	0 0 0 		 %read{45,80} %write{1,84}
global	normal	N	 %read{0,0} %write{2147483647,-1}
global	normal	Ng	 %read{15,15} %write{2147483647,-1}
local	color	mcolor	 %read{36,76} %write{9,75}
local	vector	___626_tangent	 %read{34,37} %write{17,17}
local	vector	___626_ninterp	 %read{34,42} %write{16,28}
local	float	___626_tangent_sign	 %read{35,35} %write{20,20}
local	float	___626_is_smooth	 %read{13,25} %write{12,12}
local	vector	___627_B	 %read{39,39} %write{35,35}
const	float	$const1	2		 %read{9,9} %write{2147483647,-1}
temp	color	$tmp1	 %read{9,9} %write{8,8}
const	int	$const2	0		 %read{2,36} %write{2147483647,-1}
temp	float	$tmp2	 %read{3,3} %write{2,2}
const	float	$const3	0.5		 %read{3,7} %write{2147483647,-1}
temp	float	$tmp3	 %read{8,8} %write{3,3}
const	int	$const4	1		 %read{4,72} %write{2147483647,-1}
temp	float	$tmp4	 %read{5,5} %write{4,4}
temp	float	$tmp5	 %read{8,8} %write{5,5}
const	int	$const5	2		 %read{6,75} %write{2147483647,-1}
temp	float	$tmp6	 %read{7,7} %write{6,6}
temp	float	$tmp7	 %read{8,8} %write{7,7}
const	string	$const6	"Tangent"		 %read{10,10} %write{2147483647,-1}
temp	int	$tmp8	 %read{11,11} %write{10,10}
temp	int	$tmp9	 %read{2147483647,-1} %write{12,12}
const	string	$const7	"geom:is_smooth"		 %read{12,12} %write{2147483647,-1}
temp	int	$tmp10	 %read{14,14} %write{13,13}
const	float	$const8	0		 %read{13,81} %write{2147483647,-1}
temp	normal	$tmp11	 %read{16,16} %write{15,15}
const	string	$const9	"world"		 %read{15,66} %write{2147483647,-1}
const	string	$const10	"object"		 %read{15,66} %write{2147483647,-1}
temp	int	$tmp12	 %read{18,18} %write{17,17}
temp	int	$tmp13	 %read{19,23} %write{18,22}
temp	int	$tmp14	 %read{21,21} %write{20,20}
temp	int	$tmp15	 %read{22,22} %write{21,21}
temp	int	$tmp16	 %read{24,33} %write{23,32}
temp	int	$tmp17	 %read{26,26} %write{25,25}
temp	int	$tmp18	 %read{27,31} %write{26,30}
temp	int	$tmp19	 %read{29,29} %write{28,28}
const	string	$const11	"geom:N"		 %read{28,28} %write{2147483647,-1}
temp	int	$tmp20	 %read{30,30} %write{29,29}
temp	int	$tmp21	 %read{32,32} %write{31,31}
temp	vector	$tmp22	 %read{35,35} %write{34,34}
temp	float	$tmp23	 %read{37,37} %write{36,36}
temp	vector	$tmp24	 %read{40,40} %write{37,37}
temp	float	$tmp25	 %read{39,39} %write{38,38}
temp	vector	$tmp26	 %read{40,40} %write{39,39}
temp	vector	$tmp27	 %read{43,43} %write{40,40}
temp	float	$tmp28	 %read{42,42} %write{41,41}
temp	vector	$tmp29	 %read{43,43} %write{42,42}
temp	vector	$tmp30	 %read{44,44} %write{43,43}
temp	normal	$tmp31	 %read{46,46} %write{45,45}
const	normal	$const12	0 0 0		 %read{47,47} %write{2147483647,-1}
const	string	$const13	"Object"		 %read{48,48} %write{2147483647,-1}
temp	int	$tmp32	 %read{49,49} %write{48,48}
temp	vector	$tmp33	 %read{52,52} %write{51,51}
temp	vector	$tmp34	 %read{51,51} %write{50,50}
const	string	$const14	"World"		 %read{53,53} %write{2147483647,-1}
temp	int	$tmp35	 %read{54,54} %write{53,53}
temp	vector	$tmp36	 %read{56,56} %write{55,55}
const	string	$const15	"Blender Object"		 %read{57,57} %write{2147483647,-1}
temp	int	$tmp37	 %read{58,58} %write{57,57}
temp	float	$tmp38	 %read{60,60} %write{59,59}
temp	float	$tmp39	 %read{61,61} %write{60,60}
temp	float	$tmp40	 %read{63,63} %write{62,62}
temp	float	$tmp41	 %read{64,64} %write{63,63}
temp	vector	$tmp42	 %read{67,67} %write{66,66}
temp	vector	$tmp43	 %read{66,66} %write{65,65}
const	string	$const16	"Blender World"		 %read{68,68} %write{2147483647,-1}
temp	int	$tmp44	 %read{69,69} %write{68,68}
temp	float	$tmp45	 %read{71,71} %write{70,70}
temp	float	$tmp46	 %read{72,72} %write{71,71}
temp	float	$tmp47	 %read{74,74} %write{73,73}
temp	float	$tmp48	 %read{75,75} %write{74,74}
temp	vector	$tmp49	 %read{77,77} %write{76,76}
const	float	$const17	1		 %read{78,78} %write{2147483647,-1}
temp	int	$tmp50	 %read{79,79} %write{78,78}
temp	normal	$tmp51	 %read{82,82} %write{80,80}
temp	float	$tmp52	 %read{82,82} %write{81,81}
temp	normal	$tmp53	 %read{83,83} %write{82,82}
temp	normal	$tmp54	 %read{84,84} %write{83,83}
code NormalIn
# intern/cycles/kernel/shaders/node_normal_map.osl:20
# 	normal NormalIn = N,
	assign		NormalIn N 	%filename{"intern/cycles/kernel/shaders/node_normal_map.osl"} %line{20} %argrw{"wr"}
code Normal
# intern/cycles/kernel/shaders/node_normal_map.osl:26
# 	output normal Normal = NormalIn)
	assign		Normal NormalIn 	%filename{"intern/cycles/kernel/shaders/node_normal_map.osl"} %line{26} %argrw{"wr"}
code ___main___
# intern/cycles/kernel/shaders/node_normal_map.osl:28
# 	color mcolor = 2.0 * color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5);
	compref		$tmp2 Color $const2 	%filename{"intern/cycles/kernel/shaders/node_normal_map.osl"} %line{28} %argrw{"wrr"}
	sub		$tmp3 $tmp2 $const3 	%argrw{"wrr"}
	compref		$tmp4 Color $const4 	%argrw{"wrr"}
	sub		$tmp5 $tmp4 $const3 	%argrw{"wrr"}
	compref		$tmp6 Color $const5 	%argrw{"wrr"}
	sub		$tmp7 $tmp6 $const3 	%argrw{"wrr"}
	color		$tmp1 $tmp3 $tmp5 $tmp7 	%argrw{"wrrr"}
	mul		mcolor $const1 $tmp1 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:30
# 	if (space == "Tangent") {
	eq		$tmp8 space $const6 	%line{30} %argrw{"wrr"}
	if		$tmp8 48 78 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:36
# 		getattribute("geom:is_smooth", is_smooth);
	getattribute	$tmp9 $const7 ___626_is_smooth 	%line{36} %argrw{"wrw"}
# intern/cycles/kernel/shaders/node_normal_map.osl:37
# 		if (!is_smooth)
	eq		$tmp10 ___626_is_smooth $const8 	%line{37} %argrw{"wrr"}
	if		$tmp10 17 17 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:38
# 			ninterp = normalize(transform("world", "object", Ng));
	transformn	$tmp11 $const9 $const10 Ng 	%line{38} %argrw{"wrrr"}
	normalize	___626_ninterp $tmp11 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:41
# 		if (getattribute(attr_name, tangent) &&
	getattribute	$tmp12 attr_name ___626_tangent 	%line{41} %argrw{"wrw"}
	neq		$tmp13 $tmp12 $const2 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:42
# 		    getattribute(attr_sign_name, tangent_sign) &&
	if		$tmp13 23 23 	%line{42} %argrw{"r"}
	getattribute	$tmp14 attr_sign_name ___626_tangent_sign 	%argrw{"wrw"}
	neq		$tmp15 $tmp14 $const2 	%argrw{"wrr"}
	assign		$tmp13 $tmp15 	%argrw{"wr"}
	neq		$tmp16 $tmp13 $const2 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:43
# 		    (!is_smooth || getattribute("geom:N", ninterp)))
	if		$tmp16 33 33 	%line{43} %argrw{"r"}
	eq		$tmp17 ___626_is_smooth $const8 	%argrw{"wrr"}
	neq		$tmp18 $tmp17 $const2 	%argrw{"wrr"}
	if		$tmp18 28 31 	%argrw{"r"}
	getattribute	$tmp19 $const11 ___626_ninterp 	%argrw{"wrw"}
	neq		$tmp20 $tmp19 $const2 	%argrw{"wrr"}
	assign		$tmp18 $tmp20 	%argrw{"wr"}
	neq		$tmp21 $tmp18 $const2 	%argrw{"wrr"}
	assign		$tmp16 $tmp21 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:41
# 		if (getattribute(attr_name, tangent) &&
	if		$tmp16 47 48 	%line{41} %argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:46
# 			vector B = tangent_sign * cross(ninterp, tangent);
	cross		$tmp22 ___626_ninterp ___626_tangent 	%line{46} %argrw{"wrr"}
	mul		___627_B ___626_tangent_sign $tmp22 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:47
# 			Normal = normalize(mcolor[0] * tangent + mcolor[1] * B + mcolor[2] * ninterp);
	compref		$tmp23 mcolor $const2 	%line{47} %argrw{"wrr"}
	mul		$tmp24 $tmp23 ___626_tangent 	%argrw{"wrr"}
	compref		$tmp25 mcolor $const4 	%argrw{"wrr"}
	mul		$tmp26 $tmp25 ___627_B 	%argrw{"wrr"}
	add		$tmp27 $tmp24 $tmp26 	%argrw{"wrr"}
	compref		$tmp28 mcolor $const5 	%argrw{"wrr"}
	mul		$tmp29 $tmp28 ___626_ninterp 	%argrw{"wrr"}
	add		$tmp30 $tmp27 $tmp29 	%argrw{"wrr"}
	normalize	Normal $tmp30 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:50
# 			Normal = normalize(transform("object", "world", Normal));
	transformn	$tmp31 $const10 $const9 Normal 	%line{50} %argrw{"wrrr"}
	normalize	Normal $tmp31 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:53
# 			Normal = normal(0, 0, 0);
	assign		Normal $const12 	%line{53} %argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:56
# 	else if (space == "Object") {
	eq		$tmp32 space $const13 	%line{56} %argrw{"wrr"}
	if		$tmp32 53 78 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:57
# 		Normal = normalize(transform("object", "world", vector(mcolor)));
	assign		$tmp34 mcolor 	%line{57} %argrw{"wr"}
	transformv	$tmp33 $const10 $const9 $tmp34 	%argrw{"wrrr"}
	normalize	Normal $tmp33 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:59
# 	else if (space == "World") {
	eq		$tmp35 space $const14 	%line{59} %argrw{"wrr"}
	if		$tmp35 57 78 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:60
# 		Normal = normalize(vector(mcolor));
	assign		$tmp36 mcolor 	%line{60} %argrw{"wr"}
	normalize	Normal $tmp36 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:62
# 	else if (space == "Blender Object") {
	eq		$tmp37 space $const15 	%line{62} %argrw{"wrr"}
	if		$tmp37 68 78 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:64
# 		mcolor[1] = -mcolor[1];
	compref		$tmp38 mcolor $const4 	%line{64} %argrw{"wrr"}
	neg		$tmp39 $tmp38 	%argrw{"wr"}
	compassign	mcolor $const4 $tmp39 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:65
# 		mcolor[2] = -mcolor[2];
	compref		$tmp40 mcolor $const5 	%line{65} %argrw{"wrr"}
	neg		$tmp41 $tmp40 	%argrw{"wr"}
	compassign	mcolor $const5 $tmp41 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:67
# 		Normal = normalize(transform("object", "world", vector(mcolor)));
	assign		$tmp43 mcolor 	%line{67} %argrw{"wr"}
	transformv	$tmp42 $const10 $const9 $tmp43 	%argrw{"wrrr"}
	normalize	Normal $tmp42 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:69
# 	else if (space == "Blender World") {
	eq		$tmp44 space $const16 	%line{69} %argrw{"wrr"}
	if		$tmp44 78 78 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:71
# 		mcolor[1] = -mcolor[1];
	compref		$tmp45 mcolor $const4 	%line{71} %argrw{"wrr"}
	neg		$tmp46 $tmp45 	%argrw{"wr"}
	compassign	mcolor $const4 $tmp46 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:72
# 		mcolor[2] = -mcolor[2];
	compref		$tmp47 mcolor $const5 	%line{72} %argrw{"wrr"}
	neg		$tmp48 $tmp47 	%argrw{"wr"}
	compassign	mcolor $const5 $tmp48 	%argrw{"wrr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:74
# 		Normal = normalize(vector(mcolor));
	assign		$tmp49 mcolor 	%line{74} %argrw{"wr"}
	normalize	Normal $tmp49 	%argrw{"wr"}
# intern/cycles/kernel/shaders/node_normal_map.osl:77
# 	if (Strength != 1.0)
	neq		$tmp50 Strength $const17 	%line{77} %argrw{"wrr"}
	if		$tmp50 85 85 	%argrw{"r"}
# intern/cycles/kernel/shaders/node_normal_map.osl:78
# 		Normal = normalize(NormalIn + (Normal - NormalIn) * max(Strength, 0.0));
	sub		$tmp51 Normal NormalIn 	%line{78} %argrw{"wrr"}
	max		$tmp52 Strength $const8 	%argrw{"wrr"}
	mul		$tmp53 $tmp51 $tmp52 	%argrw{"wrr"}
	add		$tmp54 NormalIn $tmp53 	%argrw{"wrr"}
	normalize	Normal $tmp54 	%argrw{"wr"}
	end
