OpenShadingLanguage 1.00
# Compiled by oslc 1.11.17
# options: -q -O2 -I/build/blender/src/blender/intern/cycles/kernel/osl/shaders -I/usr/share/OSL/shaders -o /build/blender/src/blender/build/intern/cycles/kernel/osl/shaders/node_layer_weight.oso
shader node_layer_weight
param	float	Blend	0.5		%read{1,3} %write{2147483647,-1}
param	normal	Normal	0 0 0		%read{2,2} %write{0,0} %initexpr
oparam	float	Fresnel	0		%read{2147483647,-1} %write{33,33}
oparam	float	Facing	0		%read{46,47} %write{34,47}
global	vector	I	%read{2,2} %write{2147483647,-1}
global	normal	N	%read{0,0} %write{2147483647,-1}
local	float	___330_c	%read{12,24} %write{9,9}
local	float	___330_g	%read{14,23} %write{13,16}
local	float	___330_result	%read{33,33} %write{31,32}
local	float	___331_A	%read{27,28} %write{19,19}
local	float	___331_B	%read{29,29} %write{26,26}
local	float	blend	%read{35,46} %write{1,45}
local	float	cosi	%read{9,34} %write{2,2}
local	float	eta	%read{7,10} %write{4,7}
const	float	$const1	1		%read{3,47} %write{2147483647,-1}
temp	float	$tmp1	%read{4,4} %write{3,3}
const	float	$const2	9.99999975e-06		%read{4,37} %write{2147483647,-1}
temp	int	$tmp2	%read{6,6} %write{5,5}
const	string	$const3	"fresnel_dielectric_cos"		%read{8,8} %write{2147483647,-1}
temp	float	$tmp3	%read{11,11} %write{10,10}
temp	float	$tmp4	%read{13,13} %write{11,11}
temp	float	$tmp5	%read{13,13} %write{12,12}
const	int	$const5	0		%read{14,14} %write{2147483647,-1}
temp	int	$tmp6	%read{15,15} %write{14,14}
temp	float	$tmp7	%read{19,19} %write{17,17}
temp	float	$tmp8	%read{19,19} %write{18,18}
temp	float	$tmp9	%read{21,21} %write{20,20}
temp	float	$tmp10	%read{22,22} %write{21,21}
temp	float	$tmp11	%read{26,26} %write{22,22}
temp	float	$tmp12	%read{24,24} %write{23,23}
temp	float	$tmp13	%read{25,25} %write{24,24}
temp	float	$tmp14	%read{26,26} %write{25,25}
const	float	$const6	0.5		%read{27,45} %write{2147483647,-1}
temp	float	$tmp15	%read{28,28} %write{27,27}
temp	float	$tmp16	%read{31,31} %write{28,28}
temp	float	$tmp17	%read{30,30} %write{29,29}
temp	float	$tmp18	%read{31,31} %write{30,30}
temp	int	$tmp19	%read{36,36} %write{35,35}
const	float	$const7	0		%read{40,40} %write{2147483647,-1}
temp	float	$tmp20	%read{39,39} %write{37,37}
const	string	$const8	"clamp"		%read{38,38} %write{2147483647,-1}
temp	float	$tmp21	%read{40,40} %write{39,39}
temp	int	$tmp22	%read{42,42} %write{41,41}
const	float	$const9	2		%read{43,43} %write{2147483647,-1}
temp	float	$tmp23	%read{45,45} %write{44,44}
code Normal
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:8
#                          normal Normal = N,
	assign		Normal N 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl"} %line{8} %argrw{"wr"}
code ___main___
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:12
#   float blend = Blend;
	assign		blend Blend 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl"} %line{12} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:13
#   float cosi = dot(I, Normal);
	dot		cosi I Normal 	%line{13} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:16
#   float eta = max(1.0 - Blend, 1e-5);
	sub		$tmp1 $const1 Blend 	%line{16} %argrw{"wrr"}
	max		eta $tmp1 $const2 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:17
#   eta = backfacing() ? eta : 1.0 / eta;
	backfacing	$tmp2 	%line{17} %argrw{"w"}
	if		$tmp2 7 8 	%argrw{"r"}
	div		eta $const1 eta 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:18
#   Fresnel = fresnel_dielectric_cos(cosi, eta);
	functioncall	$const3 34 	%line{18} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:13
#   float c = fabs(cosi);
	fabs		___330_c cosi 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h"} %line{13} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:14
#   float g = eta * eta - 1 + c * c;
	mul		$tmp3 eta eta 	%line{14} %argrw{"wrr"}
	sub		$tmp4 $tmp3 $const1 	%argrw{"wrr"}
	mul		$tmp5 ___330_c ___330_c 	%argrw{"wrr"}
	add		___330_g $tmp4 $tmp5 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:17
#   if (g > 0) {
	gt		$tmp6 ___330_g $const5 	%line{17} %argrw{"wrr"}
	if		$tmp6 32 33 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:18
#     g = sqrt(g);
	sqrt		___330_g ___330_g 	%line{18} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:19
#     float A = (g - c) / (g + c);
	sub		$tmp7 ___330_g ___330_c 	%line{19} %argrw{"wrr"}
	add		$tmp8 ___330_g ___330_c 	%argrw{"wrr"}
	div		___331_A $tmp7 $tmp8 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:20
#     float B = (c * (g + c) - 1) / (c * (g - c) + 1);
	add		$tmp9 ___330_g ___330_c 	%line{20} %argrw{"wrr"}
	mul		$tmp10 ___330_c $tmp9 	%argrw{"wrr"}
	sub		$tmp11 $tmp10 $const1 	%argrw{"wrr"}
	sub		$tmp12 ___330_g ___330_c 	%argrw{"wrr"}
	mul		$tmp13 ___330_c $tmp12 	%argrw{"wrr"}
	add		$tmp14 $tmp13 $const1 	%argrw{"wrr"}
	div		___331_B $tmp11 $tmp14 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:21
#     result = 0.5 * A * A * (1 + B * B);
	mul		$tmp15 $const6 ___331_A 	%line{21} %argrw{"wrr"}
	mul		$tmp16 $tmp15 ___331_A 	%argrw{"wrr"}
	mul		$tmp17 ___331_B ___331_B 	%argrw{"wrr"}
	add		$tmp18 $const1 $tmp17 	%argrw{"wrr"}
	mul		___330_result $tmp16 $tmp18 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:24
#     result = 1.0; /* TIR (no refracted component) */
	assign		___330_result $const1 	%line{24} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:26
#   return result;
	assign		Fresnel ___330_result 	%line{26} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:21
#   Facing = fabs(cosi);
	fabs		Facing cosi 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl"} %line{21} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:23
#   if (blend != 0.5) {
	neq		$tmp19 blend $const6 	%line{23} %argrw{"wrr"}
	if		$tmp19 47 47 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:24
#     blend = clamp(blend, 0.0, 1.0 - 1e-5);
	sub		$tmp20 $const1 $const2 	%line{24} %argrw{"wrr"}
	functioncall	$const8 41 	%argrw{"r"}
# /usr/share/OSL/shaders/stdosl.h:141
# float  clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); }
	min		$tmp21 blend $tmp20 	%filename{"/usr/share/OSL/shaders/stdosl.h"} %line{141} %argrw{"wrr"}
	max		blend $tmp21 $const7 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:25
#     blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend);
	lt		$tmp22 blend $const6 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl"} %line{25} %argrw{"wrr"}
	if		$tmp22 44 46 	%argrw{"r"}
	mul		blend $const9 blend 	%argrw{"wrr"}
	sub		$tmp23 $const1 blend 	%argrw{"wrr"}
	div		blend $const6 $tmp23 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:27
#     Facing = pow(Facing, blend);
	pow		Facing Facing blend 	%line{27} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_layer_weight.osl:30
#   Facing = 1.0 - Facing;
	sub		Facing $const1 Facing 	%line{30} %argrw{"wrr"}
	end
