/* File generated with Shader Minifier 1.2
 * http://www.ctrl-alt-test.fr
 */
#ifndef POST_CAS_H_
# define POST_CAS_H_

const char *post_cas_glsl =
 "#version 300 es\n"
 "#define A_GPU 1\n"
 "#define A_GLSL 1\n"
 "precision highp float;\n"
 "precision highp int;\n"
 "#define A_2PI 6.28318530718\n"
 "#if defined(A_GLSL)&&defined(A_GPU)\n"
 "#ifndef A_SKIP_EXT\n"
 "#ifdef A_HALF\n"
 "#extension GL_EXT_shader_16bit_storage:require\n"
 "#extension GL_EXT_shader_explicit_arithmetic_types:require\n"
 "#endif\n"
 "#ifdef A_LONG\n"
 "#extension GL_ARB_gpu_shader_int64:require\n"
 "#extension GL_NV_shader_atomic_int64:require\n"
 "#endif\n"
 "#ifdef A_WAVE\n"
 "#extension GL_KHR_shader_subgroup_arithmetic:require\n"
 "#extension GL_KHR_shader_subgroup_ballot:require\n"
 "#extension GL_KHR_shader_subgroup_quad:require\n"
 "#extension GL_KHR_shader_subgroup_shuffle:require\n"
 "#endif\n"
 "#endif\n"
 "#define AP1 bool\n"
 "#define AP2 bvec2\n"
 "#define AP3 bvec3\n"
 "#define AP4 bvec4\n"
 "#define AF1 float\n"
 "#define AF2 vec2\n"
 "#define AF3 vec3\n"
 "#define AF4 vec4\n"
 "#define AU1 uint\n"
 "#define AU2 uvec2\n"
 "#define AU3 uvec3\n"
 "#define AU4 uvec4\n"
 "#define ASU1 int\n"
 "#define ASU2 ivec2\n"
 "#define ASU3 ivec3\n"
 "#define ASU4 ivec4\n"
 "#define AF1_AU1(x)uintBitsToFloat(AU1(x))\n"
 "#define AF2_AU2(x)uintBitsToFloat(AU2(x))\n"
 "#define AF3_AU3(x)uintBitsToFloat(AU3(x))\n"
 "#define AF4_AU4(x)uintBitsToFloat(AU4(x))\n"
 "#define AU1_AF1(x)floatBitsToUint(AF1(x))\n"
 "#define AU2_AF2(x)floatBitsToUint(AF2(x))\n"
 "#define AU3_AF3(x)floatBitsToUint(AF3(x))\n"
 "#define AU4_AF4(x)floatBitsToUint(AF4(x))\n"
 "#define AU1_AH2_AF2 packHalf2x16\n"
 "#define AU1_AW2Unorm_AF2 packUnorm2x16\n"
 "#define AU1_AB4Unorm_AF4 packUnorm4x8\n"
 "#define AF2_AH2_AU1 unpackHalf2x16\n"
 "#define AF2_AW2Unorm_AU1 unpackUnorm2x16\n"
 "#define AF4_AB4Unorm_AU1 unpackUnorm4x8\n"
 "AF1 AF1_x(AF1 a)"
 "{"
   "return AF1(a);"
 "}"
 "AF2 AF2_x(AF1 a)"
 "{"
   "return AF2(a,a);"
 "}"
 "AF3 AF3_x(AF1 a)"
 "{"
   "return AF3(a,a,a);"
 "}"
 "AF4 AF4_x(AF1 a)"
 "{"
   "return AF4(a,a,a,a);"
 "}\n"
 "#define AF1_(a)AF1_x(AF1(a))\n"
 "#define AF2_(a)AF2_x(AF1(a))\n"
 "#define AF3_(a)AF3_x(AF1(a))\n"
 "#define AF4_(a)AF4_x(AF1(a))\n"
 "AU1 AU1_x(AU1 a)"
 "{"
   "return AU1(a);"
 "}"
 "AU2 AU2_x(AU1 a)"
 "{"
   "return AU2(a,a);"
 "}"
 "AU3 AU3_x(AU1 a)"
 "{"
   "return AU3(a,a,a);"
 "}"
 "AU4 AU4_x(AU1 a)"
 "{"
   "return AU4(a,a,a,a);"
 "}\n"
 "#define AU1_(a)AU1_x(AU1(a))\n"
 "#define AU2_(a)AU2_x(AU1(a))\n"
 "#define AU3_(a)AU3_x(AU1(a))\n"
 "#define AU4_(a)AU4_x(AU1(a))\n"
 "AU1 AAbsSU1(AU1 a)"
 "{"
   "return AU1(abs(ASU1(a)));"
 "}"
 "AU2 AAbsSU2(AU2 a)"
 "{"
   "return AU2(abs(ASU2(a)));"
 "}"
 "AU3 AAbsSU3(AU3 a)"
 "{"
   "return AU3(abs(ASU3(a)));"
 "}"
 "AU4 AAbsSU4(AU4 a)"
 "{"
   "return AU4(abs(ASU4(a)));"
 "}"
 "AU1 ABfi(AU1 src,AU1 ins,AU1 mask)"
 "{"
   "return ins&mask|src&~mask;"
 "}"
 "AF1 AFractF1(AF1 x)"
 "{"
   "return fract(x);"
 "}"
 "AF2 AFractF2(AF2 x)"
 "{"
   "return fract(x);"
 "}"
 "AF3 AFractF3(AF3 x)"
 "{"
   "return fract(x);"
 "}"
 "AF4 AFractF4(AF4 x)"
 "{"
   "return fract(x);"
 "}"
 "AF1 ALerpF1(AF1 x,AF1 y,AF1 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AF2 ALerpF2(AF2 x,AF2 y,AF2 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AF3 ALerpF3(AF3 x,AF3 y,AF3 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AF4 ALerpF4(AF4 x,AF4 y,AF4 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AF1 AMax3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF2 AMax3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF3 AMax3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF4 AMax3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU1 AMax3SU1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return AU1(max(ASU1(x),max(ASU1(y),ASU1(z))));"
 "}"
 "AU2 AMax3SU2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return AU2(max(ASU2(x),max(ASU2(y),ASU2(z))));"
 "}"
 "AU3 AMax3SU3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return AU3(max(ASU3(x),max(ASU3(y),ASU3(z))));"
 "}"
 "AU4 AMax3SU4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return AU4(max(ASU4(x),max(ASU4(y),ASU4(z))));"
 "}"
 "AU1 AMax3U1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU2 AMax3U2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU3 AMax3U3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU4 AMax3U4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU1 AMaxSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(max(ASU1(a),ASU1(b)));"
 "}"
 "AU2 AMaxSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(max(ASU2(a),ASU2(b)));"
 "}"
 "AU3 AMaxSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(max(ASU3(a),ASU3(b)));"
 "}"
 "AU4 AMaxSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(max(ASU4(a),ASU4(b)));"
 "}"
 "AF1 AMed3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF2 AMed3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF3 AMed3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF4 AMed3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF1 AMin3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF2 AMin3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF3 AMin3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF4 AMin3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU1 AMin3SU1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return AU1(min(ASU1(x),min(ASU1(y),ASU1(z))));"
 "}"
 "AU2 AMin3SU2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return AU2(min(ASU2(x),min(ASU2(y),ASU2(z))));"
 "}"
 "AU3 AMin3SU3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return AU3(min(ASU3(x),min(ASU3(y),ASU3(z))));"
 "}"
 "AU4 AMin3SU4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return AU4(min(ASU4(x),min(ASU4(y),ASU4(z))));"
 "}"
 "AU1 AMin3U1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU2 AMin3U2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU3 AMin3U3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU4 AMin3U4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU1 AMinSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(min(ASU1(a),ASU1(b)));"
 "}"
 "AU2 AMinSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(min(ASU2(a),ASU2(b)));"
 "}"
 "AU3 AMinSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(min(ASU3(a),ASU3(b)));"
 "}"
 "AU4 AMinSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(min(ASU4(a),ASU4(b)));"
 "}"
 "AF1 ANCosF1(AF1 x)"
 "{"
   "return cos(x*AF1_(A_2PI));"
 "}"
 "AF2 ANCosF2(AF2 x)"
 "{"
   "return cos(x*AF2_(A_2PI));"
 "}"
 "AF3 ANCosF3(AF3 x)"
 "{"
   "return cos(x*AF3_(A_2PI));"
 "}"
 "AF4 ANCosF4(AF4 x)"
 "{"
   "return cos(x*AF4_(A_2PI));"
 "}"
 "AF1 ANSinF1(AF1 x)"
 "{"
   "return sin(x*AF1_(A_2PI));"
 "}"
 "AF2 ANSinF2(AF2 x)"
 "{"
   "return sin(x*AF2_(A_2PI));"
 "}"
 "AF3 ANSinF3(AF3 x)"
 "{"
   "return sin(x*AF3_(A_2PI));"
 "}"
 "AF4 ANSinF4(AF4 x)"
 "{"
   "return sin(x*AF4_(A_2PI));"
 "}"
 "AF1 ARcpF1(AF1 x)"
 "{"
   "return AF1_(1.)/x;"
 "}"
 "AF2 ARcpF2(AF2 x)"
 "{"
   "return AF2_(1.)/x;"
 "}"
 "AF3 ARcpF3(AF3 x)"
 "{"
   "return AF3_(1.)/x;"
 "}"
 "AF4 ARcpF4(AF4 x)"
 "{"
   "return AF4_(1.)/x;"
 "}"
 "AF1 ARsqF1(AF1 x)"
 "{"
   "return AF1_(1.)/sqrt(x);"
 "}"
 "AF2 ARsqF2(AF2 x)"
 "{"
   "return AF2_(1.)/sqrt(x);"
 "}"
 "AF3 ARsqF3(AF3 x)"
 "{"
   "return AF3_(1.)/sqrt(x);"
 "}"
 "AF4 ARsqF4(AF4 x)"
 "{"
   "return AF4_(1.)/sqrt(x);"
 "}"
 "AF1 ASatF1(AF1 x)"
 "{"
   "return clamp(x,AF1_(0.),AF1_(1.));"
 "}"
 "AF2 ASatF2(AF2 x)"
 "{"
   "return clamp(x,AF2_(0.),AF2_(1.));"
 "}"
 "AF3 ASatF3(AF3 x)"
 "{"
   "return clamp(x,AF3_(0.),AF3_(1.));"
 "}"
 "AF4 ASatF4(AF4 x)"
 "{"
   "return clamp(x,AF4_(0.),AF4_(1.));"
 "}"
 "AU1 AShrSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(ASU1(a)>>ASU1(b));"
 "}"
 "AU2 AShrSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(ASU2(a)>>ASU2(b));"
 "}"
 "AU3 AShrSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(ASU3(a)>>ASU3(b));"
 "}"
 "AU4 AShrSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(ASU4(a)>>ASU4(b));"
 "}\n"
 "#ifdef A_BYTE\n"
 "#define AB1 uint8_t\n"
 "#define AB2 u8vec2\n"
 "#define AB3 u8vec3\n"
 "#define AB4 u8vec4\n"
 "#define ASB1 int8_t\n"
 "#define ASB2 i8vec2\n"
 "#define ASB3 i8vec3\n"
 "#define ASB4 i8vec4\n"
 "AB1 AB1_x(AB1 a)"
 "{"
   "return AB1(a);"
 "}"
 "AB2 AB2_x(AB1 a)"
 "{"
   "return AB2(a,a);"
 "}"
 "AB3 AB3_x(AB1 a)"
 "{"
   "return AB3(a,a,a);"
 "}"
 "AB4 AB4_x(AB1 a)"
 "{"
   "return AB4(a,a,a,a);"
 "}\n"
 "#define AB1_(a)AB1_x(AB1(a))\n"
 "#define AB2_(a)AB2_x(AB1(a))\n"
 "#define AB3_(a)AB3_x(AB1(a))\n"
 "#define AB4_(a)AB4_x(AB1(a))\n"
 "#endif\n"
 "#ifdef A_HALF\n"
 "#define AH1 float16_t\n"
 "#define AH2 f16vec2\n"
 "#define AH3 f16vec3\n"
 "#define AH4 f16vec4\n"
 "#define AW1 uint16_t\n"
 "#define AW2 u16vec2\n"
 "#define AW3 u16vec3\n"
 "#define AW4 u16vec4\n"
 "#define ASW1 int16_t\n"
 "#define ASW2 i16vec2\n"
 "#define ASW3 i16vec3\n"
 "#define ASW4 i16vec4\n"
 "#define AH2_AU1(x)unpackFloat2x16(AU1(x))\n"
 "AH4 AH4_AU2_x(AU2 x)"
 "{"
   "return AH4(unpackFloat2x16(x.x),unpackFloat2x16(x.y));"
 "}\n"
 "#define AH4_AU2(x)AH4_AU2_x(AU2(x))\n"
 "#define AW2_AU1(x)unpackUint2x16(AU1(x))\n"
 "#define AW4_AU2(x)unpackUint4x16(pack64(AU2(x)))\n"
 "#define AU1_AH2(x)packFloat2x16(AH2(x))\n"
 "AU2 AU2_AH4_x(AH4 x)"
 "{"
   "return AU2(packFloat2x16(x.xy),packFloat2x16(x.zw));"
 "}\n"
 "#define AU2_AH4(x)AU2_AH4_x(AH4(x))\n"
 "#define AU1_AW2(x)packUint2x16(AW2(x))\n"
 "#define AU2_AW4(x)unpack32(packUint4x16(AW4(x)))\n"
 "#define AW1_AH1(x)halfBitsToUint16(AH1(x))\n"
 "#define AW2_AH2(x)halfBitsToUint16(AH2(x))\n"
 "#define AW3_AH3(x)halfBitsToUint16(AH3(x))\n"
 "#define AW4_AH4(x)halfBitsToUint16(AH4(x))\n"
 "#define AH1_AW1(x)uint16BitsToHalf(AW1(x))\n"
 "#define AH2_AW2(x)uint16BitsToHalf(AW2(x))\n"
 "#define AH3_AW3(x)uint16BitsToHalf(AW3(x))\n"
 "#define AH4_AW4(x)uint16BitsToHalf(AW4(x))\n"
 "AH1 AH1_x(AH1 a)"
 "{"
   "return AH1(a);"
 "}"
 "AH2 AH2_x(AH1 a)"
 "{"
   "return AH2(a,a);"
 "}"
 "AH3 AH3_x(AH1 a)"
 "{"
   "return AH3(a,a,a);"
 "}"
 "AH4 AH4_x(AH1 a)"
 "{"
   "return AH4(a,a,a,a);"
 "}\n"
 "#define AH1_(a)AH1_x(AH1(a))\n"
 "#define AH2_(a)AH2_x(AH1(a))\n"
 "#define AH3_(a)AH3_x(AH1(a))\n"
 "#define AH4_(a)AH4_x(AH1(a))\n"
 "AW1 AW1_x(AW1 a)"
 "{"
   "return AW1(a);"
 "}"
 "AW2 AW2_x(AW1 a)"
 "{"
   "return AW2(a,a);"
 "}"
 "AW3 AW3_x(AW1 a)"
 "{"
   "return AW3(a,a,a);"
 "}"
 "AW4 AW4_x(AW1 a)"
 "{"
   "return AW4(a,a,a,a);"
 "}\n"
 "#define AW1_(a)AW1_x(AW1(a))\n"
 "#define AW2_(a)AW2_x(AW1(a))\n"
 "#define AW3_(a)AW3_x(AW1(a))\n"
 "#define AW4_(a)AW4_x(AW1(a))\n"
 "AW1 AAbsSW1(AW1 a)"
 "{"
   "return AW1(abs(ASW1(a)));"
 "}"
 "AW2 AAbsSW2(AW2 a)"
 "{"
   "return AW2(abs(ASW2(a)));"
 "}"
 "AW3 AAbsSW3(AW3 a)"
 "{"
   "return AW3(abs(ASW3(a)));"
 "}"
 "AW4 AAbsSW4(AW4 a)"
 "{"
   "return AW4(abs(ASW4(a)));"
 "}"
 "AH1 AFractH1(AH1 x)"
 "{"
   "return fract(x);"
 "}"
 "AH2 AFractH2(AH2 x)"
 "{"
   "return fract(x);"
 "}"
 "AH3 AFractH3(AH3 x)"
 "{"
   "return fract(x);"
 "}"
 "AH4 AFractH4(AH4 x)"
 "{"
   "return fract(x);"
 "}"
 "AH1 ALerpH1(AH1 x,AH1 y,AH1 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AH2 ALerpH2(AH2 x,AH2 y,AH2 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AH3 ALerpH3(AH3 x,AH3 y,AH3 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AH4 ALerpH4(AH4 x,AH4 y,AH4 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AH1 AMax3H1(AH1 x,AH1 y,AH1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH2 AMax3H2(AH2 x,AH2 y,AH2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH3 AMax3H3(AH3 x,AH3 y,AH3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH4 AMax3H4(AH4 x,AH4 y,AH4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AW1 AMaxSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(max(ASU1(a),ASU1(b)));"
 "}"
 "AW2 AMaxSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(max(ASU2(a),ASU2(b)));"
 "}"
 "AW3 AMaxSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(max(ASU3(a),ASU3(b)));"
 "}"
 "AW4 AMaxSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(max(ASU4(a),ASU4(b)));"
 "}"
 "AH1 AMin3H1(AH1 x,AH1 y,AH1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH2 AMin3H2(AH2 x,AH2 y,AH2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH3 AMin3H3(AH3 x,AH3 y,AH3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH4 AMin3H4(AH4 x,AH4 y,AH4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AW1 AMinSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(min(ASU1(a),ASU1(b)));"
 "}"
 "AW2 AMinSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(min(ASU2(a),ASU2(b)));"
 "}"
 "AW3 AMinSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(min(ASU3(a),ASU3(b)));"
 "}"
 "AW4 AMinSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(min(ASU4(a),ASU4(b)));"
 "}"
 "AH1 ARcpH1(AH1 x)"
 "{"
   "return AH1_(1.)/x;"
 "}"
 "AH2 ARcpH2(AH2 x)"
 "{"
   "return AH2_(1.)/x;"
 "}"
 "AH3 ARcpH3(AH3 x)"
 "{"
   "return AH3_(1.)/x;"
 "}"
 "AH4 ARcpH4(AH4 x)"
 "{"
   "return AH4_(1.)/x;"
 "}"
 "AH1 ARsqH1(AH1 x)"
 "{"
   "return AH1_(1.)/sqrt(x);"
 "}"
 "AH2 ARsqH2(AH2 x)"
 "{"
   "return AH2_(1.)/sqrt(x);"
 "}"
 "AH3 ARsqH3(AH3 x)"
 "{"
   "return AH3_(1.)/sqrt(x);"
 "}"
 "AH4 ARsqH4(AH4 x)"
 "{"
   "return AH4_(1.)/sqrt(x);"
 "}"
 "AH1 ASatH1(AH1 x)"
 "{"
   "return clamp(x,AH1_(0.),AH1_(1.));"
 "}"
 "AH2 ASatH2(AH2 x)"
 "{"
   "return clamp(x,AH2_(0.),AH2_(1.));"
 "}"
 "AH3 ASatH3(AH3 x)"
 "{"
   "return clamp(x,AH3_(0.),AH3_(1.));"
 "}"
 "AH4 ASatH4(AH4 x)"
 "{"
   "return clamp(x,AH4_(0.),AH4_(1.));"
 "}"
 "AW1 AShrSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(ASW1(a)>>ASW1(b));"
 "}"
 "AW2 AShrSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(ASW2(a)>>ASW2(b));"
 "}"
 "AW3 AShrSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(ASW3(a)>>ASW3(b));"
 "}"
 "AW4 AShrSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(ASW4(a)>>ASW4(b));"
 "}\n"
 "#endif\n"
 "#ifdef A_DUBL\n"
 "#define AD1 double\n"
 "#define AD2 dvec2\n"
 "#define AD3 dvec3\n"
 "#define AD4 dvec4\n"
 "AD1 AD1_x(AD1 a)"
 "{"
   "return AD1(a);"
 "}"
 "AD2 AD2_x(AD1 a)"
 "{"
   "return AD2(a,a);"
 "}"
 "AD3 AD3_x(AD1 a)"
 "{"
   "return AD3(a,a,a);"
 "}"
 "AD4 AD4_x(AD1 a)"
 "{"
   "return AD4(a,a,a,a);"
 "}\n"
 "#define AD1_(a)AD1_x(AD1(a))\n"
 "#define AD2_(a)AD2_x(AD1(a))\n"
 "#define AD3_(a)AD3_x(AD1(a))\n"
 "#define AD4_(a)AD4_x(AD1(a))\n"
 "AD1 AFractD1(AD1 x)"
 "{"
   "return fract(x);"
 "}"
 "AD2 AFractD2(AD2 x)"
 "{"
   "return fract(x);"
 "}"
 "AD3 AFractD3(AD3 x)"
 "{"
   "return fract(x);"
 "}"
 "AD4 AFractD4(AD4 x)"
 "{"
   "return fract(x);"
 "}"
 "AD1 ALerpD1(AD1 x,AD1 y,AD1 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AD2 ALerpD2(AD2 x,AD2 y,AD2 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AD3 ALerpD3(AD3 x,AD3 y,AD3 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AD4 ALerpD4(AD4 x,AD4 y,AD4 a)"
 "{"
   "return mix(x,y,a);"
 "}"
 "AD1 ARcpD1(AD1 x)"
 "{"
   "return AD1_(1.)/x;"
 "}"
 "AD2 ARcpD2(AD2 x)"
 "{"
   "return AD2_(1.)/x;"
 "}"
 "AD3 ARcpD3(AD3 x)"
 "{"
   "return AD3_(1.)/x;"
 "}"
 "AD4 ARcpD4(AD4 x)"
 "{"
   "return AD4_(1.)/x;"
 "}"
 "AD1 ARsqD1(AD1 x)"
 "{"
   "return AD1_(1.)/sqrt(x);"
 "}"
 "AD2 ARsqD2(AD2 x)"
 "{"
   "return AD2_(1.)/sqrt(x);"
 "}"
 "AD3 ARsqD3(AD3 x)"
 "{"
   "return AD3_(1.)/sqrt(x);"
 "}"
 "AD4 ARsqD4(AD4 x)"
 "{"
   "return AD4_(1.)/sqrt(x);"
 "}"
 "AD1 ASatD1(AD1 x)"
 "{"
   "return clamp(x,AD1_(0.),AD1_(1.));"
 "}"
 "AD2 ASatD2(AD2 x)"
 "{"
   "return clamp(x,AD2_(0.),AD2_(1.));"
 "}"
 "AD3 ASatD3(AD3 x)"
 "{"
   "return clamp(x,AD3_(0.),AD3_(1.));"
 "}"
 "AD4 ASatD4(AD4 x)"
 "{"
   "return clamp(x,AD4_(0.),AD4_(1.));"
 "}\n"
 "#endif\n"
 "#ifdef A_LONG\n"
 "#define AL1 uint64_t\n"
 "#define AL2 u64vec2\n"
 "#define AL3 u64vec3\n"
 "#define AL4 u64vec4\n"
 "#define ASL1 int64_t\n"
 "#define ASL2 i64vec2\n"
 "#define ASL3 i64vec3\n"
 "#define ASL4 i64vec4\n"
 "#define AL1_AU2(x)packUint2x32(AU2(x))\n"
 "#define AU2_AL1(x)unpackUint2x32(AL1(x))\n"
 "AL1 AL1_x(AL1 a)"
 "{"
   "return AL1(a);"
 "}"
 "AL2 AL2_x(AL1 a)"
 "{"
   "return AL2(a,a);"
 "}"
 "AL3 AL3_x(AL1 a)"
 "{"
   "return AL3(a,a,a);"
 "}"
 "AL4 AL4_x(AL1 a)"
 "{"
   "return AL4(a,a,a,a);"
 "}\n"
 "#define AL1_(a)AL1_x(AL1(a))\n"
 "#define AL2_(a)AL2_x(AL1(a))\n"
 "#define AL3_(a)AL3_x(AL1(a))\n"
 "#define AL4_(a)AL4_x(AL1(a))\n"
 "AL1 AAbsSL1(AL1 a)"
 "{"
   "return AL1(abs(ASL1(a)));"
 "}"
 "AL2 AAbsSL2(AL2 a)"
 "{"
   "return AL2(abs(ASL2(a)));"
 "}"
 "AL3 AAbsSL3(AL3 a)"
 "{"
   "return AL3(abs(ASL3(a)));"
 "}"
 "AL4 AAbsSL4(AL4 a)"
 "{"
   "return AL4(abs(ASL4(a)));"
 "}"
 "AL1 AMaxSL1(AL1 a,AL1 b)"
 "{"
   "return AL1(max(ASU1(a),ASU1(b)));"
 "}"
 "AL2 AMaxSL2(AL2 a,AL2 b)"
 "{"
   "return AL2(max(ASU2(a),ASU2(b)));"
 "}"
 "AL3 AMaxSL3(AL3 a,AL3 b)"
 "{"
   "return AL3(max(ASU3(a),ASU3(b)));"
 "}"
 "AL4 AMaxSL4(AL4 a,AL4 b)"
 "{"
   "return AL4(max(ASU4(a),ASU4(b)));"
 "}"
 "AL1 AMinSL1(AL1 a,AL1 b)"
 "{"
   "return AL1(min(ASU1(a),ASU1(b)));"
 "}"
 "AL2 AMinSL2(AL2 a,AL2 b)"
 "{"
   "return AL2(min(ASU2(a),ASU2(b)));"
 "}"
 "AL3 AMinSL3(AL3 a,AL3 b)"
 "{"
   "return AL3(min(ASU3(a),ASU3(b)));"
 "}"
 "AL4 AMinSL4(AL4 a,AL4 b)"
 "{"
   "return AL4(min(ASU4(a),ASU4(b)));"
 "}\n"
 "#endif\n"
 "#ifdef A_WAVE\n"
 "AF1 AWaveAdd(AF1 v)"
 "{"
   "return subgroupAdd(v);"
 "}"
 "AF2 AWaveAdd(AF2 v)"
 "{"
   "return subgroupAdd(v);"
 "}"
 "AF3 AWaveAdd(AF3 v)"
 "{"
   "return subgroupAdd(v);"
 "}"
 "AF4 AWaveAdd(AF4 v)"
 "{"
   "return subgroupAdd(v);"
 "}\n"
 "#endif\n"
 "#endif\n"
 "#if defined(A_HLSL)&&defined(A_GPU)\n"
 "#define AP1 bool\n"
 "#define AP2 bool2\n"
 "#define AP3 bool3\n"
 "#define AP4 bool4\n"
 "#define AF1 float\n"
 "#define AF2 float2\n"
 "#define AF3 float3\n"
 "#define AF4 float4\n"
 "#define AU1 uint\n"
 "#define AU2 uint2\n"
 "#define AU3 uint3\n"
 "#define AU4 uint4\n"
 "#define ASU1 int\n"
 "#define ASU2 int2\n"
 "#define ASU3 int3\n"
 "#define ASU4 int4\n"
 "#define AF1_AU1(x)asfloat(AU1(x))\n"
 "#define AF2_AU2(x)asfloat(AU2(x))\n"
 "#define AF3_AU3(x)asfloat(AU3(x))\n"
 "#define AF4_AU4(x)asfloat(AU4(x))\n"
 "#define AU1_AF1(x)asuint(AF1(x))\n"
 "#define AU2_AF2(x)asuint(AF2(x))\n"
 "#define AU3_AF3(x)asuint(AF3(x))\n"
 "#define AU4_AF4(x)asuint(AF4(x))\n"
 "AU1 AU1_AH2_AF2_x(AF2 a)"
 "{"
   "return f32tof16(a.x)|f32tof16(a.y)<<16;"
 "}\n"
 "#define AU1_AH2_AF2(a)AU1_AH2_AF2_x(AF2(a))\n"
 "#define AU1_AB4Unorm_AF4(x)D3DCOLORtoUBYTE4(AF4(x))\n"
 "AF2 AF2_AH2_AU1_x(AU1 x)"
 "{"
   "return AF2(f16tof32(x&65535),f16tof32(x>>16));"
 "}\n"
 "#define AF2_AH2_AU1(x)AF2_AH2_AU1_x(AU1(x))\n"
 "AF1 AF1_x(AF1 a)"
 "{"
   "return AF1(a);"
 "}"
 "AF2 AF2_x(AF1 a)"
 "{"
   "return AF2(a,a);"
 "}"
 "AF3 AF3_x(AF1 a)"
 "{"
   "return AF3(a,a,a);"
 "}"
 "AF4 AF4_x(AF1 a)"
 "{"
   "return AF4(a,a,a,a);"
 "}\n"
 "#define AF1_(a)AF1_x(AF1(a))\n"
 "#define AF2_(a)AF2_x(AF1(a))\n"
 "#define AF3_(a)AF3_x(AF1(a))\n"
 "#define AF4_(a)AF4_x(AF1(a))\n"
 "AU1 AU1_x(AU1 a)"
 "{"
   "return AU1(a);"
 "}"
 "AU2 AU2_x(AU1 a)"
 "{"
   "return AU2(a,a);"
 "}"
 "AU3 AU3_x(AU1 a)"
 "{"
   "return AU3(a,a,a);"
 "}"
 "AU4 AU4_x(AU1 a)"
 "{"
   "return AU4(a,a,a,a);"
 "}\n"
 "#define AU1_(a)AU1_x(AU1(a))\n"
 "#define AU2_(a)AU2_x(AU1(a))\n"
 "#define AU3_(a)AU3_x(AU1(a))\n"
 "#define AU4_(a)AU4_x(AU1(a))\n"
 "AU1 AAbsSU1(AU1 a)"
 "{"
   "return AU1(abs(ASU1(a)));"
 "}"
 "AU2 AAbsSU2(AU2 a)"
 "{"
   "return AU2(abs(ASU2(a)));"
 "}"
 "AU3 AAbsSU3(AU3 a)"
 "{"
   "return AU3(abs(ASU3(a)));"
 "}"
 "AU4 AAbsSU4(AU4 a)"
 "{"
   "return AU4(abs(ASU4(a)));"
 "}"
 "AU1 ABfe(AU1 src,AU1 off,AU1 bits)"
 "{"
   "AU1 mask=(1<<bits)-1;"
   "return src>>off&mask;"
 "}"
 "AU1 ABfi(AU1 src,AU1 ins,AU1 mask)"
 "{"
   "return ins&mask|src&~mask;"
 "}"
 "AU1 ABfiM(AU1 src,AU1 ins,AU1 bits)"
 "{"
   "AU1 mask=(1<<bits)-1;"
   "return ins&mask|src&~mask;"
 "}"
 "AF1 AFractF1(AF1 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AF2 AFractF2(AF2 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AF3 AFractF3(AF3 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AF4 AFractF4(AF4 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AF1 ALerpF1(AF1 x,AF1 y,AF1 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AF2 ALerpF2(AF2 x,AF2 y,AF2 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AF3 ALerpF3(AF3 x,AF3 y,AF3 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AF4 ALerpF4(AF4 x,AF4 y,AF4 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AF1 AMax3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF2 AMax3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF3 AMax3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AF4 AMax3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU1 AMax3SU1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return AU1(max(ASU1(x),max(ASU1(y),ASU1(z))));"
 "}"
 "AU2 AMax3SU2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return AU2(max(ASU2(x),max(ASU2(y),ASU2(z))));"
 "}"
 "AU3 AMax3SU3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return AU3(max(ASU3(x),max(ASU3(y),ASU3(z))));"
 "}"
 "AU4 AMax3SU4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return AU4(max(ASU4(x),max(ASU4(y),ASU4(z))));"
 "}"
 "AU1 AMax3U1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU2 AMax3U2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU3 AMax3U3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU4 AMax3U4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AU1 AMaxSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(max(ASU1(a),ASU1(b)));"
 "}"
 "AU2 AMaxSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(max(ASU2(a),ASU2(b)));"
 "}"
 "AU3 AMaxSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(max(ASU3(a),ASU3(b)));"
 "}"
 "AU4 AMaxSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(max(ASU4(a),ASU4(b)));"
 "}"
 "AF1 AMed3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF2 AMed3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF3 AMed3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF4 AMed3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return max(min(x,y),min(max(x,y),z));"
 "}"
 "AF1 AMin3F1(AF1 x,AF1 y,AF1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF2 AMin3F2(AF2 x,AF2 y,AF2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF3 AMin3F3(AF3 x,AF3 y,AF3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AF4 AMin3F4(AF4 x,AF4 y,AF4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU1 AMin3SU1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return AU1(min(ASU1(x),min(ASU1(y),ASU1(z))));"
 "}"
 "AU2 AMin3SU2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return AU2(min(ASU2(x),min(ASU2(y),ASU2(z))));"
 "}"
 "AU3 AMin3SU3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return AU3(min(ASU3(x),min(ASU3(y),ASU3(z))));"
 "}"
 "AU4 AMin3SU4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return AU4(min(ASU4(x),min(ASU4(y),ASU4(z))));"
 "}"
 "AU1 AMin3U1(AU1 x,AU1 y,AU1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU2 AMin3U2(AU2 x,AU2 y,AU2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU3 AMin3U3(AU3 x,AU3 y,AU3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU4 AMin3U4(AU4 x,AU4 y,AU4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AU1 AMinSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(min(ASU1(a),ASU1(b)));"
 "}"
 "AU2 AMinSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(min(ASU2(a),ASU2(b)));"
 "}"
 "AU3 AMinSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(min(ASU3(a),ASU3(b)));"
 "}"
 "AU4 AMinSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(min(ASU4(a),ASU4(b)));"
 "}"
 "AF1 ANCosF1(AF1 x)"
 "{"
   "return cos(x*AF1_(A_2PI));"
 "}"
 "AF2 ANCosF2(AF2 x)"
 "{"
   "return cos(x*AF2_(A_2PI));"
 "}"
 "AF3 ANCosF3(AF3 x)"
 "{"
   "return cos(x*AF3_(A_2PI));"
 "}"
 "AF4 ANCosF4(AF4 x)"
 "{"
   "return cos(x*AF4_(A_2PI));"
 "}"
 "AF1 ANSinF1(AF1 x)"
 "{"
   "return sin(x*AF1_(A_2PI));"
 "}"
 "AF2 ANSinF2(AF2 x)"
 "{"
   "return sin(x*AF2_(A_2PI));"
 "}"
 "AF3 ANSinF3(AF3 x)"
 "{"
   "return sin(x*AF3_(A_2PI));"
 "}"
 "AF4 ANSinF4(AF4 x)"
 "{"
   "return sin(x*AF4_(A_2PI));"
 "}"
 "AF1 ARcpF1(AF1 x)"
 "{"
   "return rcp(x);"
 "}"
 "AF2 ARcpF2(AF2 x)"
 "{"
   "return rcp(x);"
 "}"
 "AF3 ARcpF3(AF3 x)"
 "{"
   "return rcp(x);"
 "}"
 "AF4 ARcpF4(AF4 x)"
 "{"
   "return rcp(x);"
 "}"
 "AF1 ARsqF1(AF1 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AF2 ARsqF2(AF2 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AF3 ARsqF3(AF3 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AF4 ARsqF4(AF4 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AF1 ASatF1(AF1 x)"
 "{"
   "return saturate(x);"
 "}"
 "AF2 ASatF2(AF2 x)"
 "{"
   "return saturate(x);"
 "}"
 "AF3 ASatF3(AF3 x)"
 "{"
   "return saturate(x);"
 "}"
 "AF4 ASatF4(AF4 x)"
 "{"
   "return saturate(x);"
 "}"
 "AU1 AShrSU1(AU1 a,AU1 b)"
 "{"
   "return AU1(ASU1(a)>>ASU1(b));"
 "}"
 "AU2 AShrSU2(AU2 a,AU2 b)"
 "{"
   "return AU2(ASU2(a)>>ASU2(b));"
 "}"
 "AU3 AShrSU3(AU3 a,AU3 b)"
 "{"
   "return AU3(ASU3(a)>>ASU3(b));"
 "}"
 "AU4 AShrSU4(AU4 a,AU4 b)"
 "{"
   "return AU4(ASU4(a)>>ASU4(b));"
 "}\n"
 "#ifdef A_BYTE\n"
 "#endif\n"
 "#ifdef A_HALF\n"
 "#define AH1 min16float\n"
 "#define AH2 min16float2\n"
 "#define AH3 min16float3\n"
 "#define AH4 min16float4\n"
 "#define AW1 min16uint\n"
 "#define AW2 min16uint2\n"
 "#define AW3 min16uint3\n"
 "#define AW4 min16uint4\n"
 "#define ASW1 min16int\n"
 "#define ASW2 min16int2\n"
 "#define ASW3 min16int3\n"
 "#define ASW4 min16int4\n"
 "AH2 AH2_AU1_x(AU1 x)"
 "{"
   "AF2 t=f16tof32(AU2(x&65535,x>>16));"
   "return AH2(t);"
 "}"
 "AH4 AH4_AU2_x(AU2 x)"
 "{"
   "return AH4(AH2_AU1_x(x.x),AH2_AU1_x(x.y));"
 "}"
 "AW2 AW2_AU1_x(AU1 x)"
 "{"
   "AU2 t=AU2(x&65535,x>>16);"
   "return AW2(t);"
 "}"
 "AW4 AW4_AU2_x(AU2 x)"
 "{"
   "return AW4(AW2_AU1_x(x.x),AW2_AU1_x(x.y));"
 "}\n"
 "#define AH2_AU1(x)AH2_AU1_x(AU1(x))\n"
 "#define AH4_AU2(x)AH4_AU2_x(AU2(x))\n"
 "#define AW2_AU1(x)AW2_AU1_x(AU1(x))\n"
 "#define AW4_AU2(x)AW4_AU2_x(AU2(x))\n"
 "AU1 AU1_AH2_x(AH2 x)"
 "{"
   "return f32tof16(x.x)+(f32tof16(x.y)<<16);"
 "}"
 "AU2 AU2_AH4_x(AH4 x)"
 "{"
   "return AU2(AU1_AH2_x(x.xy),AU1_AH2_x(x.zw));"
 "}"
 "AU1 AU1_AW2_x(AW2 x)"
 "{"
   "return AU1(x.x)+(AU1(x.y)<<16);"
 "}"
 "AU2 AU2_AW4_x(AW4 x)"
 "{"
   "return AU2(AU1_AW2_x(x.xy),AU1_AW2_x(x.zw));"
 "}\n"
 "#define AU1_AH2(x)AU1_AH2_x(AH2(x))\n"
 "#define AU2_AH4(x)AU2_AH4_x(AH4(x))\n"
 "#define AU1_AW2(x)AU1_AW2_x(AW2(x))\n"
 "#define AU2_AW4(x)AU2_AW4_x(AW4(x))\n"
 "#define AW1_AH1(x)AW1(asuint(AF1(x)))\n"
 "#define AW2_AH2(x)AW2(asuint(AF2(x)))\n"
 "#define AW3_AH3(x)AW3(asuint(AF3(x)))\n"
 "#define AW4_AH4(x)AW4(asuint(AF4(x)))\n"
 "#define AH1_AW1(x)AH1(asfloat(AU1(x)))\n"
 "#define AH2_AW2(x)AH2(asfloat(AU2(x)))\n"
 "#define AH3_AW3(x)AH3(asfloat(AU3(x)))\n"
 "#define AH4_AW4(x)AH4(asfloat(AU4(x)))\n"
 "AH1 AH1_x(AH1 a)"
 "{"
   "return AH1(a);"
 "}"
 "AH2 AH2_x(AH1 a)"
 "{"
   "return AH2(a,a);"
 "}"
 "AH3 AH3_x(AH1 a)"
 "{"
   "return AH3(a,a,a);"
 "}"
 "AH4 AH4_x(AH1 a)"
 "{"
   "return AH4(a,a,a,a);"
 "}\n"
 "#define AH1_(a)AH1_x(AH1(a))\n"
 "#define AH2_(a)AH2_x(AH1(a))\n"
 "#define AH3_(a)AH3_x(AH1(a))\n"
 "#define AH4_(a)AH4_x(AH1(a))\n"
 "AW1 AW1_x(AW1 a)"
 "{"
   "return AW1(a);"
 "}"
 "AW2 AW2_x(AW1 a)"
 "{"
   "return AW2(a,a);"
 "}"
 "AW3 AW3_x(AW1 a)"
 "{"
   "return AW3(a,a,a);"
 "}"
 "AW4 AW4_x(AW1 a)"
 "{"
   "return AW4(a,a,a,a);"
 "}\n"
 "#define AW1_(a)AW1_x(AW1(a))\n"
 "#define AW2_(a)AW2_x(AW1(a))\n"
 "#define AW3_(a)AW3_x(AW1(a))\n"
 "#define AW4_(a)AW4_x(AW1(a))\n"
 "AW1 AAbsSW1(AW1 a)"
 "{"
   "return AW1(abs(ASW1(a)));"
 "}"
 "AW2 AAbsSW2(AW2 a)"
 "{"
   "return AW2(abs(ASW2(a)));"
 "}"
 "AW3 AAbsSW3(AW3 a)"
 "{"
   "return AW3(abs(ASW3(a)));"
 "}"
 "AW4 AAbsSW4(AW4 a)"
 "{"
   "return AW4(abs(ASW4(a)));"
 "}"
 "AH1 AFractH1(AH1 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AH2 AFractH2(AH2 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AH3 AFractH3(AH3 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AH4 AFractH4(AH4 x)"
 "{"
   "return x-floor(x);"
 "}"
 "AH1 ALerpH1(AH1 x,AH1 y,AH1 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AH2 ALerpH2(AH2 x,AH2 y,AH2 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AH3 ALerpH3(AH3 x,AH3 y,AH3 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AH4 ALerpH4(AH4 x,AH4 y,AH4 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AH1 AMax3H1(AH1 x,AH1 y,AH1 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH2 AMax3H2(AH2 x,AH2 y,AH2 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH3 AMax3H3(AH3 x,AH3 y,AH3 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AH4 AMax3H4(AH4 x,AH4 y,AH4 z)"
 "{"
   "return max(x,max(y,z));"
 "}"
 "AW1 AMaxSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(max(ASU1(a),ASU1(b)));"
 "}"
 "AW2 AMaxSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(max(ASU2(a),ASU2(b)));"
 "}"
 "AW3 AMaxSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(max(ASU3(a),ASU3(b)));"
 "}"
 "AW4 AMaxSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(max(ASU4(a),ASU4(b)));"
 "}"
 "AH1 AMin3H1(AH1 x,AH1 y,AH1 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH2 AMin3H2(AH2 x,AH2 y,AH2 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH3 AMin3H3(AH3 x,AH3 y,AH3 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AH4 AMin3H4(AH4 x,AH4 y,AH4 z)"
 "{"
   "return min(x,min(y,z));"
 "}"
 "AW1 AMinSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(min(ASU1(a),ASU1(b)));"
 "}"
 "AW2 AMinSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(min(ASU2(a),ASU2(b)));"
 "}"
 "AW3 AMinSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(min(ASU3(a),ASU3(b)));"
 "}"
 "AW4 AMinSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(min(ASU4(a),ASU4(b)));"
 "}"
 "AH1 ARcpH1(AH1 x)"
 "{"
   "return rcp(x);"
 "}"
 "AH2 ARcpH2(AH2 x)"
 "{"
   "return rcp(x);"
 "}"
 "AH3 ARcpH3(AH3 x)"
 "{"
   "return rcp(x);"
 "}"
 "AH4 ARcpH4(AH4 x)"
 "{"
   "return rcp(x);"
 "}"
 "AH1 ARsqH1(AH1 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AH2 ARsqH2(AH2 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AH3 ARsqH3(AH3 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AH4 ARsqH4(AH4 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AH1 ASatH1(AH1 x)"
 "{"
   "return saturate(x);"
 "}"
 "AH2 ASatH2(AH2 x)"
 "{"
   "return saturate(x);"
 "}"
 "AH3 ASatH3(AH3 x)"
 "{"
   "return saturate(x);"
 "}"
 "AH4 ASatH4(AH4 x)"
 "{"
   "return saturate(x);"
 "}"
 "AW1 AShrSW1(AW1 a,AW1 b)"
 "{"
   "return AW1(ASW1(a)>>ASW1(b));"
 "}"
 "AW2 AShrSW2(AW2 a,AW2 b)"
 "{"
   "return AW2(ASW2(a)>>ASW2(b));"
 "}"
 "AW3 AShrSW3(AW3 a,AW3 b)"
 "{"
   "return AW3(ASW3(a)>>ASW3(b));"
 "}"
 "AW4 AShrSW4(AW4 a,AW4 b)"
 "{"
   "return AW4(ASW4(a)>>ASW4(b));"
 "}\n"
 "#endif\n"
 "#ifdef A_DUBL\n"
 "#define AD1 double\n"
 "#define AD2 double2\n"
 "#define AD3 double3\n"
 "#define AD4 double4\n"
 "AD1 AD1_x(AD1 a)"
 "{"
   "return AD1(a);"
 "}"
 "AD2 AD2_x(AD1 a)"
 "{"
   "return AD2(a,a);"
 "}"
 "AD3 AD3_x(AD1 a)"
 "{"
   "return AD3(a,a,a);"
 "}"
 "AD4 AD4_x(AD1 a)"
 "{"
   "return AD4(a,a,a,a);"
 "}\n"
 "#define AD1_(a)AD1_x(AD1(a))\n"
 "#define AD2_(a)AD2_x(AD1(a))\n"
 "#define AD3_(a)AD3_x(AD1(a))\n"
 "#define AD4_(a)AD4_x(AD1(a))\n"
 "AD1 AFractD1(AD1 a)"
 "{"
   "return a-floor(a);"
 "}"
 "AD2 AFractD2(AD2 a)"
 "{"
   "return a-floor(a);"
 "}"
 "AD3 AFractD3(AD3 a)"
 "{"
   "return a-floor(a);"
 "}"
 "AD4 AFractD4(AD4 a)"
 "{"
   "return a-floor(a);"
 "}"
 "AD1 ALerpD1(AD1 x,AD1 y,AD1 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AD2 ALerpD2(AD2 x,AD2 y,AD2 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AD3 ALerpD3(AD3 x,AD3 y,AD3 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AD4 ALerpD4(AD4 x,AD4 y,AD4 a)"
 "{"
   "return lerp(x,y,a);"
 "}"
 "AD1 ARcpD1(AD1 x)"
 "{"
   "return rcp(x);"
 "}"
 "AD2 ARcpD2(AD2 x)"
 "{"
   "return rcp(x);"
 "}"
 "AD3 ARcpD3(AD3 x)"
 "{"
   "return rcp(x);"
 "}"
 "AD4 ARcpD4(AD4 x)"
 "{"
   "return rcp(x);"
 "}"
 "AD1 ARsqD1(AD1 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AD2 ARsqD2(AD2 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AD3 ARsqD3(AD3 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AD4 ARsqD4(AD4 x)"
 "{"
   "return rsqrt(x);"
 "}"
 "AD1 ASatD1(AD1 x)"
 "{"
   "return saturate(x);"
 "}"
 "AD2 ASatD2(AD2 x)"
 "{"
   "return saturate(x);"
 "}"
 "AD3 ASatD3(AD3 x)"
 "{"
   "return saturate(x);"
 "}"
 "AD4 ASatD4(AD4 x)"
 "{"
   "return saturate(x);"
 "}\n"
 "#endif\n"
 "#ifdef A_LONG\n"
 "#endif\n"
 "#endif\n"
 "#ifdef A_GPU\n"
 "#define A_INFN_F AF1_AU1(0x7f800000u)\n"
 "#define A_INFP_F AF1_AU1(0xff800000u)\n"
 "AF1 ACpySgnF1(AF1 d,AF1 s)"
 "{"
   "return AF1_AU1(AU1_AF1(d)|AU1_AF1(s)&AU1_(-2147483648u));"
 "}"
 "AF2 ACpySgnF2(AF2 d,AF2 s)"
 "{"
   "return AF2_AU2(AU2_AF2(d)|AU2_AF2(s)&AU2_(-2147483648u));"
 "}"
 "AF3 ACpySgnF3(AF3 d,AF3 s)"
 "{"
   "return AF3_AU3(AU3_AF3(d)|AU3_AF3(s)&AU3_(-2147483648u));"
 "}"
 "AF4 ACpySgnF4(AF4 d,AF4 s)"
 "{"
   "return AF4_AU4(AU4_AF4(d)|AU4_AF4(s)&AU4_(-2147483648u));"
 "}"
 "AF1 ASignedF1(AF1 m)"
 "{"
   "return ASatF1(m*AF1_(A_INFN_F));"
 "}"
 "AF2 ASignedF2(AF2 m)"
 "{"
   "return ASatF2(m*AF2_(A_INFN_F));"
 "}"
 "AF3 ASignedF3(AF3 m)"
 "{"
   "return ASatF3(m*AF3_(A_INFN_F));"
 "}"
 "AF4 ASignedF4(AF4 m)"
 "{"
   "return ASatF4(m*AF4_(A_INFN_F));"
 "}\n"
 "#ifdef A_HALF\n"
 "#define A_INFN_H AH1_AW1(0x7c00u)\n"
 "#define A_INFP_H AH1_AW1(0xfc00u)\n"
 "AH1 ACpySgnH1(AH1 d,AH1 s)"
 "{"
   "return AH1_AW1(AW1_AH1(d)|AW1_AH1(s)&AW1_(32768u));"
 "}"
 "AH2 ACpySgnH2(AH2 d,AH2 s)"
 "{"
   "return AH2_AW2(AW2_AH2(d)|AW2_AH2(s)&AW2_(32768u));"
 "}"
 "AH3 ACpySgnH3(AH3 d,AH3 s)"
 "{"
   "return AH3_AW3(AW3_AH3(d)|AW3_AH3(s)&AW3_(32768u));"
 "}"
 "AH4 ACpySgnH4(AH4 d,AH4 s)"
 "{"
   "return AH4_AW4(AW4_AH4(d)|AW4_AH4(s)&AW4_(32768u));"
 "}"
 "AH1 ASignedH1(AH1 m)"
 "{"
   "return ASatH1(m*AH1_(A_INFN_H));"
 "}"
 "AH2 ASignedH2(AH2 m)"
 "{"
   "return ASatH2(m*AH2_(A_INFN_H));"
 "}"
 "AH3 ASignedH3(AH3 m)"
 "{"
   "return ASatH3(m*AH3_(A_INFN_H));"
 "}"
 "AH4 ASignedH4(AH4 m)"
 "{"
   "return ASatH4(m*AH4_(A_INFN_H));"
 "}\n"
 "#endif\n"
 "#ifdef A_HALF\n"
 "AH1 APrxLoSqrtH1(AH1 a)"
 "{"
   "return AH1_AW1((AW1_AH1(a)>>AW1_(1))+AW1_(7650));"
 "}"
 "AH2 APrxLoSqrtH2(AH2 a)"
 "{"
   "return AH2_AW2((AW2_AH2(a)>>AW2_(1))+AW2_(7650));"
 "}"
 "AH1 APrxLoRcpH1(AH1 a)"
 "{"
   "return AH1_AW1(AW1_(30596)-AW1_AH1(a));"
 "}"
 "AH2 APrxLoRcpH2(AH2 a)"
 "{"
   "return AH2_AW2(AW2_(30596)-AW2_AH2(a));"
 "}"
 "AH1 APrxMedRcpH1(AH1 a)"
 "{"
   "AH1 b=AH1_AW1(AW1_(30605)-AW1_AH1(a));"
   "return b*(-b*a+AH1_(2.));"
 "}"
 "AH2 APrxMedRcpH2(AH2 a)"
 "{"
   "AH2 b=AH2_AW2(AW2_(30605)-AW2_AH2(a));"
   "return b*(-b*a+AH2_(2.));"
 "}"
 "AH1 APrxLoRsqH1(AH1 a)"
 "{"
   "return AH1_AW1(AW1_(22947)-(AW1_AH1(a)>>AW1_(1)));"
 "}"
 "AH2 APrxLoRsqH2(AH2 a)"
 "{"
   "return AH2_AW2(AW2_(22947)-(AW2_AH2(a)>>AW2_(1)));"
 "}\n"
 "#endif\n"
 "AF1 APrxLoSqrtF1(AF1 a)"
 "{"
   "return AF1_AU1((AU1_AF1(a)>>AU1_(1))+AU1_(532432441));"
 "}"
 "AF1 APrxLoRcpF1(AF1 a)"
 "{"
   "return AF1_AU1(AU1_(2129690299)-AU1_AF1(a));"
 "}"
 "AF1 APrxMedRcpF1(AF1 a)"
 "{"
   "AF1 b=AF1_AU1(AU1_(2129764351)-AU1_AF1(a));"
   "return b*(-b*a+AF1_(2.));"
 "}"
 "AF1 APrxLoRsqF1(AF1 a)"
 "{"
   "return AF1_AU1(AU1_(1597275508)-(AU1_AF1(a)>>AU1_(1)));"
 "}"
 "AF1 APSinF1(AF1 x)"
 "{"
   "return x*abs(x)-x;"
 "}"
 "AF1 APCosF1(AF1 x)"
 "{"
   "return x=AFractF1(x*AF1_(.5)+AF1_(.75)),x=x*AF1_(2.)-AF1_(1.),APSinF1(x);"
 "}\n"
 "#ifdef A_HALF\n"
 "AH2 APSinH2(AH2 x)"
 "{"
   "return x*abs(x)-x;"
 "}"
 "AH2 APCosH2(AH2 x)"
 "{"
   "return x=AFractH2(x*AH2_(.5)+AH2_(.75)),x=x*AH2_(2.)-AH2_(1.),APSinH2(x);"
 "}\n"
 "#endif\n"
 "AF1 ATo709F1(AF1 c)"
 "{"
   "return max(min(c*AF1_(4.5),AF1_(.018)),AF1_(1.099)*pow(c,AF1_(.45))-AF1_(.099));"
 "}"
 "AF1 AToGammaF1(AF1 c,AF1 rcpX)"
 "{"
   "return pow(c,rcpX);"
 "}"
 "AF1 AToPqF1(AF1 x)"
 "{"
   "AF1 p=pow(x,AF1_(.159302));"
   "return pow((AF1_(.835938)+AF1_(18.8516)*p)/(AF1_(1.)+AF1_(18.6875)*p),AF1_(78.8438));"
 "}"
 "AF1 AToSrgbF1(AF1 c)"
 "{"
   "return max(min(c*AF1_(12.92),AF1_(.0031308)),AF1_(1.055)*pow(c,AF1_(.41666))-AF1_(.055));"
 "}"
 "AF1 AToTwoF1(AF1 c)"
 "{"
   "return sqrt(c);"
 "}"
 "AF1 AFrom709F1(AF1 c)"
 "{"
   "return max(min(c*AF1_(1./4.5),AF1_(.081)),pow((c+AF1_(.099))*(AF1_(1.)/AF1_(1.099)),AF1_(1./.45)));"
 "}"
 "AF1 AFromGammaF1(AF1 c,AF1 x)"
 "{"
   "return pow(c,x);"
 "}"
 "AF1 AFromPqF1(AF1 x)"
 "{"
   "AF1 p=pow(x,AF1_(.0126833));"
   "return pow(ASatF1(p-AF1_(.835938))/(AF1_(18.8516)-AF1_(18.6875)*p),AF1_(6.27739));"
 "}"
 "AF1 AFromSrgbF1(AF1 c)"
 "{"
   "return max(min(c*AF1_(1./12.92),AF1_(.04045)),pow((c+AF1_(.055))*(AF1_(1.)/AF1_(1.055)),AF1_(2.4)));"
 "}"
 "AF1 AFromTwoF1(AF1 c)"
 "{"
   "return c*c;"
 "}\n"
 "#ifdef A_HALF\n"
 "AH2 ATo709H2(AH2 c)"
 "{"
   "return max(min(c*AH2_(4.5),AH2_(.018)),AH2_(1.099)*pow(c,AH2_(.45))-AH2_(.099));"
 "}"
 "AH2 AToGammaH2(AH2 c,AH1 rcpX)"
 "{"
   "return pow(c,AH2_(rcpX));"
 "}"
 "AH2 AToSrgbH2(AH2 c)"
 "{"
   "return max(min(c*AH2_(12.92),AH2_(.0031308)),AH2_(1.055)*pow(c,AH2_(.41666))-AH2_(.055));"
 "}"
 "AH2 AToTwoH2(AH2 c)"
 "{"
   "return sqrt(c);"
 "}\n"
 "#endif\n"
 "#ifdef A_HALF\n"
 "AH2 AFrom709H2(AH2 c)"
 "{"
   "return max(min(c*AH2_(1./4.5),AH2_(.081)),pow((c+AH2_(.099))*(AH2_(1.)/AH2_(1.099)),AH2_(1./.45)));"
 "}"
 "AH2 AFromGammaH2(AH2 c,AH1 x)"
 "{"
   "return pow(c,AH2_(x));"
 "}"
 "AH2 AFromSrgbH2(AH2 c)"
 "{"
   "return max(min(c*AH2_(1./12.92),AH2_(.04045)),pow((c+AH2_(.055))*(AH2_(1.)/AH2_(1.055)),AH2_(2.4)));"
 "}"
 "AH2 AFromTwoH2(AH2 c)"
 "{"
   "return c*c;"
 "}\n"
 "#endif\n"
 "#endif\n"
 "#ifdef A_GPU\n"
 "#define A_TRUE true\n"
 "#define A_FALSE false\n"
 "#define A_STATIC\n"
 "#define retAD2 AD2\n"
 "#define retAD3 AD3\n"
 "#define retAD4 AD4\n"
 "#define retAF2 AF2\n"
 "#define retAF3 AF3\n"
 "#define retAF4 AF4\n"
 "#define retAL2 AL2\n"
 "#define retAL3 AL3\n"
 "#define retAL4 AL4\n"
 "#define retAU2 AU2\n"
 "#define retAU3 AU3\n"
 "#define retAU4 AU4\n"
 "#define inAD2 in AD2\n"
 "#define inAD3 in AD3\n"
 "#define inAD4 in AD4\n"
 "#define inAF2 in AF2\n"
 "#define inAF3 in AF3\n"
 "#define inAF4 in AF4\n"
 "#define inAL2 in AL2\n"
 "#define inAL3 in AL3\n"
 "#define inAL4 in AL4\n"
 "#define inAU2 in AU2\n"
 "#define inAU3 in AU3\n"
 "#define inAU4 in AU4\n"
 "#define inoutAD2 inout AD2\n"
 "#define inoutAD3 inout AD3\n"
 "#define inoutAD4 inout AD4\n"
 "#define inoutAF2 inout AF2\n"
 "#define inoutAF3 inout AF3\n"
 "#define inoutAF4 inout AF4\n"
 "#define inoutAL2 inout AL2\n"
 "#define inoutAL3 inout AL3\n"
 "#define inoutAL4 inout AL4\n"
 "#define inoutAU2 inout AU2\n"
 "#define inoutAU3 inout AU3\n"
 "#define inoutAU4 inout AU4\n"
 "#define outAD2 out AD2\n"
 "#define outAD3 out AD3\n"
 "#define outAD4 out AD4\n"
 "#define outAF2 out AF2\n"
 "#define outAF3 out AF3\n"
 "#define outAF4 out AF4\n"
 "#define outAL2 out AL2\n"
 "#define outAL3 out AL3\n"
 "#define outAL4 out AL4\n"
 "#define outAU2 out AU2\n"
 "#define outAU3 out AU3\n"
 "#define outAU4 out AU4\n"
 "#define varAD2(x)AD2 x\n"
 "#define varAD3(x)AD3 x\n"
 "#define varAD4(x)AD4 x\n"
 "#define varAF2(x)AF2 x\n"
 "#define varAF3(x)AF3 x\n"
 "#define varAF4(x)AF4 x\n"
 "#define varAL2(x)AL2 x\n"
 "#define varAL3(x)AL3 x\n"
 "#define varAL4(x)AL4 x\n"
 "#define varAU2(x)AU2 x\n"
 "#define varAU3(x)AU3 x\n"
 "#define varAU4(x)AU4 x\n"
 "#define initAD2(x,y)AD2(x,y)\n"
 "#define initAD3(x,y,z)AD3(x,y,z)\n"
 "#define initAD4(x,y,z,w)AD4(x,y,z,w)\n"
 "#define initAF2(x,y)AF2(x,y)\n"
 "#define initAF3(x,y,z)AF3(x,y,z)\n"
 "#define initAF4(x,y,z,w)AF4(x,y,z,w)\n"
 "#define initAL2(x,y)AL2(x,y)\n"
 "#define initAL3(x,y,z)AL3(x,y,z)\n"
 "#define initAL4(x,y,z,w)AL4(x,y,z,w)\n"
 "#define initAU2(x,y)AU2(x,y)\n"
 "#define initAU3(x,y,z)AU3(x,y,z)\n"
 "#define initAU4(x,y,z,w)AU4(x,y,z,w)\n"
 "#define AAbsD1(a)abs(AD1(a))\n"
 "#define AAbsF1(a)abs(AF1(a))\n"
 "#define ACosD1(a)cos(AD1(a))\n"
 "#define ACosF1(a)cos(AF1(a))\n"
 "#define ADotD2(a,b)dot(AD2(a),AD2(b))\n"
 "#define ADotD3(a,b)dot(AD3(a),AD3(b))\n"
 "#define ADotD4(a,b)dot(AD4(a),AD4(b))\n"
 "#define ADotF2(a,b)dot(AF2(a),AF2(b))\n"
 "#define ADotF3(a,b)dot(AF3(a),AF3(b))\n"
 "#define ADotF4(a,b)dot(AF4(a),AF4(b))\n"
 "#define AExp2D1(a)exp2(AD1(a))\n"
 "#define AExp2F1(a)exp2(AF1(a))\n"
 "#define AFloorD1(a)floor(AD1(a))\n"
 "#define AFloorF1(a)floor(AF1(a))\n"
 "#define ALog2D1(a)log2(AD1(a))\n"
 "#define ALog2F1(a)log2(AF1(a))\n"
 "#define AMaxD1(a,b)min(a,b)\n"
 "#define AMaxF1(a,b)min(a,b)\n"
 "#define AMaxL1(a,b)min(a,b)\n"
 "#define AMaxU1(a,b)min(a,b)\n"
 "#define AMinD1(a,b)min(a,b)\n"
 "#define AMinF1(a,b)min(a,b)\n"
 "#define AMinL1(a,b)min(a,b)\n"
 "#define AMinU1(a,b)min(a,b)\n"
 "#define ASinD1(a)sin(AD1(a))\n"
 "#define ASinF1(a)sin(AF1(a))\n"
 "#define ASqrtD1(a)sqrt(AD1(a))\n"
 "#define ASqrtF1(a)sqrt(AF1(a))\n"
 "#define APowD1(a,b)pow(AD1(a),AF1(b))\n"
 "#define APowF1(a,b)pow(AF1(a),AF1(b))\n"
 "#ifdef A_DUBL\n"
 "AD2 opAAbsD2(outAD2 d,inAD2 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AD3 opAAbsD3(outAD3 d,inAD3 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AD4 opAAbsD4(outAD4 d,inAD4 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AD2 opAAddD2(outAD2 d,inAD2 a,inAD2 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AD3 opAAddD3(outAD3 d,inAD3 a,inAD3 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AD4 opAAddD4(outAD4 d,inAD4 a,inAD4 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AD2 opACpyD2(outAD2 d,inAD2 a)"
 "{"
   "return d=a,d;"
 "}"
 "AD3 opACpyD3(outAD3 d,inAD3 a)"
 "{"
   "return d=a,d;"
 "}"
 "AD4 opACpyD4(outAD4 d,inAD4 a)"
 "{"
   "return d=a,d;"
 "}"
 "AD2 opALerpD2(outAD2 d,inAD2 a,inAD2 b,inAD2 c)"
 "{"
   "return d=ALerpD2(a,b,c),d;"
 "}"
 "AD3 opALerpD3(outAD3 d,inAD3 a,inAD3 b,inAD3 c)"
 "{"
   "return d=ALerpD3(a,b,c),d;"
 "}"
 "AD4 opALerpD4(outAD4 d,inAD4 a,inAD4 b,inAD4 c)"
 "{"
   "return d=ALerpD4(a,b,c),d;"
 "}"
 "AD2 opALerpOneD2(outAD2 d,inAD2 a,inAD2 b,AD1 c)"
 "{"
   "return d=ALerpD2(a,b,AD2_(c)),d;"
 "}"
 "AD3 opALerpOneD3(outAD3 d,inAD3 a,inAD3 b,AD1 c)"
 "{"
   "return d=ALerpD3(a,b,AD3_(c)),d;"
 "}"
 "AD4 opALerpOneD4(outAD4 d,inAD4 a,inAD4 b,AD1 c)"
 "{"
   "return d=ALerpD4(a,b,AD4_(c)),d;"
 "}"
 "AD2 opAMaxD2(outAD2 d,inAD2 a,inAD2 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AD3 opAMaxD3(outAD3 d,inAD3 a,inAD3 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AD4 opAMaxD4(outAD4 d,inAD4 a,inAD4 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AD2 opAMinD2(outAD2 d,inAD2 a,inAD2 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AD3 opAMinD3(outAD3 d,inAD3 a,inAD3 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AD4 opAMinD4(outAD4 d,inAD4 a,inAD4 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AD2 opAMulD2(outAD2 d,inAD2 a,inAD2 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AD3 opAMulD3(outAD3 d,inAD3 a,inAD3 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AD4 opAMulD4(outAD4 d,inAD4 a,inAD4 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AD2 opAMulOneD2(outAD2 d,inAD2 a,AD1 b)"
 "{"
   "return d=a*AD2_(b),d;"
 "}"
 "AD3 opAMulOneD3(outAD3 d,inAD3 a,AD1 b)"
 "{"
   "return d=a*AD3_(b),d;"
 "}"
 "AD4 opAMulOneD4(outAD4 d,inAD4 a,AD1 b)"
 "{"
   "return d=a*AD4_(b),d;"
 "}"
 "AD2 opANegD2(outAD2 d,inAD2 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AD3 opANegD3(outAD3 d,inAD3 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AD4 opANegD4(outAD4 d,inAD4 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AD2 opARcpD2(outAD2 d,inAD2 a)"
 "{"
   "return d=ARcpD2(a),d;"
 "}"
 "AD3 opARcpD3(outAD3 d,inAD3 a)"
 "{"
   "return d=ARcpD3(a),d;"
 "}"
 "AD4 opARcpD4(outAD4 d,inAD4 a)"
 "{"
   "return d=ARcpD4(a),d;"
 "}\n"
 "#endif\n"
 "AF2 opAAbsF2(outAF2 d,inAF2 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AF3 opAAbsF3(outAF3 d,inAF3 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AF4 opAAbsF4(outAF4 d,inAF4 a)"
 "{"
   "return d=abs(a),d;"
 "}"
 "AF2 opAAddF2(outAF2 d,inAF2 a,inAF2 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AF3 opAAddF3(outAF3 d,inAF3 a,inAF3 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AF4 opAAddF4(outAF4 d,inAF4 a,inAF4 b)"
 "{"
   "return d=a+b,d;"
 "}"
 "AF2 opACpyF2(outAF2 d,inAF2 a)"
 "{"
   "return d=a,d;"
 "}"
 "AF3 opACpyF3(outAF3 d,inAF3 a)"
 "{"
   "return d=a,d;"
 "}"
 "AF4 opACpyF4(outAF4 d,inAF4 a)"
 "{"
   "return d=a,d;"
 "}"
 "AF2 opALerpF2(outAF2 d,inAF2 a,inAF2 b,inAF2 c)"
 "{"
   "return d=ALerpF2(a,b,c),d;"
 "}"
 "AF3 opALerpF3(outAF3 d,inAF3 a,inAF3 b,inAF3 c)"
 "{"
   "return d=ALerpF3(a,b,c),d;"
 "}"
 "AF4 opALerpF4(outAF4 d,inAF4 a,inAF4 b,inAF4 c)"
 "{"
   "return d=ALerpF4(a,b,c),d;"
 "}"
 "AF2 opALerpOneF2(outAF2 d,inAF2 a,inAF2 b,AF1 c)"
 "{"
   "return d=ALerpF2(a,b,AF2_(c)),d;"
 "}"
 "AF3 opALerpOneF3(outAF3 d,inAF3 a,inAF3 b,AF1 c)"
 "{"
   "return d=ALerpF3(a,b,AF3_(c)),d;"
 "}"
 "AF4 opALerpOneF4(outAF4 d,inAF4 a,inAF4 b,AF1 c)"
 "{"
   "return d=ALerpF4(a,b,AF4_(c)),d;"
 "}"
 "AF2 opAMaxF2(outAF2 d,inAF2 a,inAF2 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AF3 opAMaxF3(outAF3 d,inAF3 a,inAF3 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AF4 opAMaxF4(outAF4 d,inAF4 a,inAF4 b)"
 "{"
   "return d=max(a,b),d;"
 "}"
 "AF2 opAMinF2(outAF2 d,inAF2 a,inAF2 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AF3 opAMinF3(outAF3 d,inAF3 a,inAF3 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AF4 opAMinF4(outAF4 d,inAF4 a,inAF4 b)"
 "{"
   "return d=min(a,b),d;"
 "}"
 "AF2 opAMulF2(outAF2 d,inAF2 a,inAF2 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AF3 opAMulF3(outAF3 d,inAF3 a,inAF3 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AF4 opAMulF4(outAF4 d,inAF4 a,inAF4 b)"
 "{"
   "return d=a*b,d;"
 "}"
 "AF2 opAMulOneF2(outAF2 d,inAF2 a,AF1 b)"
 "{"
   "return d=a*AF2_(b),d;"
 "}"
 "AF3 opAMulOneF3(outAF3 d,inAF3 a,AF1 b)"
 "{"
   "return d=a*AF3_(b),d;"
 "}"
 "AF4 opAMulOneF4(outAF4 d,inAF4 a,AF1 b)"
 "{"
   "return d=a*AF4_(b),d;"
 "}"
 "AF2 opANegF2(outAF2 d,inAF2 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AF3 opANegF3(outAF3 d,inAF3 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AF4 opANegF4(outAF4 d,inAF4 a)"
 "{"
   "return d=-a,d;"
 "}"
 "AF2 opARcpF2(outAF2 d,inAF2 a)"
 "{"
   "return d=ARcpF2(a),d;"
 "}"
 "AF3 opARcpF3(outAF3 d,inAF3 a)"
 "{"
   "return d=ARcpF3(a),d;"
 "}"
 "AF4 opARcpF4(outAF4 d,inAF4 a)"
 "{"
   "return d=ARcpF4(a),d;"
 "}\n"
 "#endif\n"
 "uniform vec4 Const0,Const1,Const2;"
 "uniform sampler2D u_texture;"
 "out vec4 color;"
 "AF3 CasLoad(ASU2 p)"
 "{"
   "return texelFetch(u_texture,ivec2(p.x,int(Const1.w)-p.y),0).zyx;"
 "}"
 "void CasInput(inout AF1 r,inout AF1 g,inout AF1 b)"
 "{}\n"
 "#define CAS_AREA_LIMIT 4.0\n"
 "AP1 CasSupportScaling(AF1 outX,AF1 outY,AF1 inX,AF1 inY)"
 "{"
   "return outX*outY*ARcpF1(inX*inY)<=CAS_AREA_LIMIT;"
 "}\n"
 "#ifdef A_GPU\n"
 "#ifdef CAS_PACKED_ONLY\n"
 "AF3 CasLoad(ASU2 p)"
 "{"
   "return AF3(0.,0.,0.);"
 "}"
 "void CasInput(inout AF1 r,inout AF1 g,inout AF1 b)"
 "{}\n"
 "#endif\n"
 "void CasFilter(out AF1 pixR,out AF1 pixG,out AF1 pixB,AU2 ip,AF4 const0,AF4 const1,AP1 noScaling)"
 "{"
   "\n#ifdef CAS_DEBUG_CHECKER\n"
   "if(((ip.x^ip.y)>>8u&1u)==0u)"
     "{"
       "AF3 pix0=CasLoad(ASU2(ip));"
       "pixR=pix0.x;"
       "pixG=pix0.y;"
       "pixB=pix0.z;"
       "CasInput(pixR,pixG,pixB);"
       "return;"
     "}"
   "\n#endif\n"
   "if(noScaling)"
     "{"
       "ASU2 sp=ASU2(ip);"
       "AF3 a=CasLoad(sp+ASU2(-1,-1)),b=CasLoad(sp+ASU2(0,-1)),c=CasLoad(sp+ASU2(1,-1)),d=CasLoad(sp+ASU2(-1,0)),e=CasLoad(sp),f=CasLoad(sp+ASU2(1,0)),g=CasLoad(sp+ASU2(-1,1)),h=CasLoad(sp+ASU2(0,1)),i=CasLoad(sp+ASU2(1,1));"
       "CasInput(a.x,a.y,a.z);"
       "CasInput(b.x,b.y,b.z);"
       "CasInput(c.x,c.y,c.z);"
       "CasInput(d.x,d.y,d.z);"
       "CasInput(e.x,e.y,e.z);"
       "CasInput(f.x,f.y,f.z);"
       "CasInput(g.x,g.y,g.z);"
       "CasInput(h.x,h.y,h.z);"
       "CasInput(i.x,i.y,i.z);"
       "AF1 mnR=AMin3F1(AMin3F1(d.x,e.x,f.x),b.x,h.x),mnG=AMin3F1(AMin3F1(d.y,e.y,f.y),b.y,h.y),mnB=AMin3F1(AMin3F1(d.z,e.z,f.z),b.z,h.z);"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AF1 mnR2=AMin3F1(AMin3F1(mnR,a.x,c.x),g.x,i.x),mnG2=AMin3F1(AMin3F1(mnG,a.y,c.y),g.y,i.y),mnB2=AMin3F1(AMin3F1(mnB,a.z,c.z),g.z,i.z);"
       "mnR=mnR+mnR2;"
       "mnG=mnG+mnG2;"
       "mnB=mnB+mnB2;"
       "\n#endif\n"
       "AF1 mxR=AMax3F1(AMax3F1(d.x,e.x,f.x),b.x,h.x),mxG=AMax3F1(AMax3F1(d.y,e.y,f.y),b.y,h.y),mxB=AMax3F1(AMax3F1(d.z,e.z,f.z),b.z,h.z);"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AF1 mxR2=AMax3F1(AMax3F1(mxR,a.x,c.x),g.x,i.x),mxG2=AMax3F1(AMax3F1(mxG,a.y,c.y),g.y,i.y),mxB2=AMax3F1(AMax3F1(mxB,a.z,c.z),g.z,i.z);"
       "mxR=mxR+mxR2;"
       "mxG=mxG+mxG2;"
       "mxB=mxB+mxB2;"
       "\n#endif\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AF1 rcpMR=ARcpF1(mxR),rcpMG=ARcpF1(mxG),rcpMB=ARcpF1(mxB);"
       "\n#else\n"
       "AF1 rcpMR=APrxLoRcpF1(mxR),rcpMG=APrxLoRcpF1(mxG),rcpMB=APrxLoRcpF1(mxB);"
       "\n#endif\n"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AF1 ampR=ASatF1(min(mnR,AF1_(2.)-mxR)*rcpMR),ampG=ASatF1(min(mnG,AF1_(2.)-mxG)*rcpMG),ampB=ASatF1(min(mnB,AF1_(2.)-mxB)*rcpMB);"
       "\n#else\n"
       "AF1 ampR=ASatF1(min(mnR,AF1_(1.)-mxR)*rcpMR),ampG=ASatF1(min(mnG,AF1_(1.)-mxG)*rcpMG),ampB=ASatF1(min(mnB,AF1_(1.)-mxB)*rcpMB);"
       "\n#endif\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "ampR=sqrt(ampR);"
       "ampG=sqrt(ampG);"
       "ampB=sqrt(ampB);"
       "\n#else\n"
       "ampR=APrxLoSqrtF1(ampR);"
       "ampG=APrxLoSqrtF1(ampG);"
       "ampB=APrxLoSqrtF1(ampB);"
       "\n#endif\n"
       "AF1 peak=AF1_AU1(const1.x),wR=ampR*peak,wG=ampG*peak,wB=ampB*peak;"
       "\n#ifndef CAS_SLOW\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AF1 rcpWeight=ARcpF1(AF1_(1.)+AF1_(4.)*wG);"
       "\n#else\n"
       "AF1 rcpWeight=APrxMedRcpF1(AF1_(1.)+AF1_(4.)*wG);"
       "\n#endif\n"
       "pixR=ASatF1((b.x*wG+d.x*wG+f.x*wG+h.x*wG+e.x)*rcpWeight);"
       "pixG=ASatF1((b.y*wG+d.y*wG+f.y*wG+h.y*wG+e.y)*rcpWeight);"
       "pixB=ASatF1((b.z*wG+d.z*wG+f.z*wG+h.z*wG+e.z)*rcpWeight);"
       "\n#else\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AF1 rcpWeightR=ARcpF1(AF1_(1.)+AF1_(4.)*wR),rcpWeightG=ARcpF1(AF1_(1.)+AF1_(4.)*wG),rcpWeightB=ARcpF1(AF1_(1.)+AF1_(4.)*wB);"
       "\n#else\n"
       "AF1 rcpWeightR=APrxMedRcpF1(AF1_(1.)+AF1_(4.)*wR),rcpWeightG=APrxMedRcpF1(AF1_(1.)+AF1_(4.)*wG),rcpWeightB=APrxMedRcpF1(AF1_(1.)+AF1_(4.)*wB);"
       "\n#endif\n"
       "pixR=ASatF1((b.x*wR+d.x*wR+f.x*wR+h.x*wR+e.x)*rcpWeightR);"
       "pixG=ASatF1((b.y*wG+d.y*wG+f.y*wG+h.y*wG+e.y)*rcpWeightG);"
       "pixB=ASatF1((b.z*wB+d.z*wB+f.z*wB+h.z*wB+e.z)*rcpWeightB);"
       "\n#endif\n"
       "return;"
     "}"
   "AF2 pp=AF2(ip)*const0.xy+const0.zw,fp=floor(pp);"
   "pp-=fp;"
   "ASU2 sp=ASU2(fp);"
   "AF3 a=CasLoad(sp+ASU2(-1,-1)),b=CasLoad(sp+ASU2(0,-1)),e=CasLoad(sp+ASU2(-1,0)),f=CasLoad(sp),c=CasLoad(sp+ASU2(1,-1)),d=CasLoad(sp+ASU2(2,-1)),g=CasLoad(sp+ASU2(1,0)),h=CasLoad(sp+ASU2(2,0)),i=CasLoad(sp+ASU2(-1,1)),j=CasLoad(sp+ASU2(0,1)),m=CasLoad(sp+ASU2(-1,2)),n=CasLoad(sp+ASU2(0,2)),k=CasLoad(sp+ASU2(1,1)),l=CasLoad(sp+ASU2(2,1)),o=CasLoad(sp+ASU2(1,2)),p=CasLoad(sp+ASU2(2,2));"
   "CasInput(a.x,a.y,a.z);"
   "CasInput(b.x,b.y,b.z);"
   "CasInput(c.x,c.y,c.z);"
   "CasInput(d.x,d.y,d.z);"
   "CasInput(e.x,e.y,e.z);"
   "CasInput(f.x,f.y,f.z);"
   "CasInput(g.x,g.y,g.z);"
   "CasInput(h.x,h.y,h.z);"
   "CasInput(i.x,i.y,i.z);"
   "CasInput(j.x,j.y,j.z);"
   "CasInput(k.x,k.y,k.z);"
   "CasInput(l.x,l.y,l.z);"
   "CasInput(m.x,m.y,m.z);"
   "CasInput(n.x,n.y,n.z);"
   "CasInput(o.x,o.y,o.z);"
   "CasInput(p.x,p.y,p.z);"
   "AF1 mnfR=AMin3F1(AMin3F1(b.x,e.x,f.x),g.x,j.x),mnfG=AMin3F1(AMin3F1(b.y,e.y,f.y),g.y,j.y),mnfB=AMin3F1(AMin3F1(b.z,e.z,f.z),g.z,j.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mnfR2=AMin3F1(AMin3F1(mnfR,a.x,c.x),i.x,k.x),mnfG2=AMin3F1(AMin3F1(mnfG,a.y,c.y),i.y,k.y),mnfB2=AMin3F1(AMin3F1(mnfB,a.z,c.z),i.z,k.z);"
   "mnfR=mnfR+mnfR2;"
   "mnfG=mnfG+mnfG2;"
   "mnfB=mnfB+mnfB2;"
   "\n#endif\n"
   "AF1 mxfR=AMax3F1(AMax3F1(b.x,e.x,f.x),g.x,j.x),mxfG=AMax3F1(AMax3F1(b.y,e.y,f.y),g.y,j.y),mxfB=AMax3F1(AMax3F1(b.z,e.z,f.z),g.z,j.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mxfR2=AMax3F1(AMax3F1(mxfR,a.x,c.x),i.x,k.x),mxfG2=AMax3F1(AMax3F1(mxfG,a.y,c.y),i.y,k.y),mxfB2=AMax3F1(AMax3F1(mxfB,a.z,c.z),i.z,k.z);"
   "mxfR=mxfR+mxfR2;"
   "mxfG=mxfG+mxfG2;"
   "mxfB=mxfB+mxfB2;"
   "\n#endif\n"
   "AF1 mngR=AMin3F1(AMin3F1(c.x,f.x,g.x),h.x,k.x),mngG=AMin3F1(AMin3F1(c.y,f.y,g.y),h.y,k.y),mngB=AMin3F1(AMin3F1(c.z,f.z,g.z),h.z,k.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mngR2=AMin3F1(AMin3F1(mngR,b.x,d.x),j.x,l.x),mngG2=AMin3F1(AMin3F1(mngG,b.y,d.y),j.y,l.y),mngB2=AMin3F1(AMin3F1(mngB,b.z,d.z),j.z,l.z);"
   "mngR=mngR+mngR2;"
   "mngG=mngG+mngG2;"
   "mngB=mngB+mngB2;"
   "\n#endif\n"
   "AF1 mxgR=AMax3F1(AMax3F1(c.x,f.x,g.x),h.x,k.x),mxgG=AMax3F1(AMax3F1(c.y,f.y,g.y),h.y,k.y),mxgB=AMax3F1(AMax3F1(c.z,f.z,g.z),h.z,k.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mxgR2=AMax3F1(AMax3F1(mxgR,b.x,d.x),j.x,l.x),mxgG2=AMax3F1(AMax3F1(mxgG,b.y,d.y),j.y,l.y),mxgB2=AMax3F1(AMax3F1(mxgB,b.z,d.z),j.z,l.z);"
   "mxgR=mxgR+mxgR2;"
   "mxgG=mxgG+mxgG2;"
   "mxgB=mxgB+mxgB2;"
   "\n#endif\n"
   "AF1 mnjR=AMin3F1(AMin3F1(f.x,i.x,j.x),k.x,n.x),mnjG=AMin3F1(AMin3F1(f.y,i.y,j.y),k.y,n.y),mnjB=AMin3F1(AMin3F1(f.z,i.z,j.z),k.z,n.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mnjR2=AMin3F1(AMin3F1(mnjR,e.x,g.x),m.x,o.x),mnjG2=AMin3F1(AMin3F1(mnjG,e.y,g.y),m.y,o.y),mnjB2=AMin3F1(AMin3F1(mnjB,e.z,g.z),m.z,o.z);"
   "mnjR=mnjR+mnjR2;"
   "mnjG=mnjG+mnjG2;"
   "mnjB=mnjB+mnjB2;"
   "\n#endif\n"
   "AF1 mxjR=AMax3F1(AMax3F1(f.x,i.x,j.x),k.x,n.x),mxjG=AMax3F1(AMax3F1(f.y,i.y,j.y),k.y,n.y),mxjB=AMax3F1(AMax3F1(f.z,i.z,j.z),k.z,n.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mxjR2=AMax3F1(AMax3F1(mxjR,e.x,g.x),m.x,o.x),mxjG2=AMax3F1(AMax3F1(mxjG,e.y,g.y),m.y,o.y),mxjB2=AMax3F1(AMax3F1(mxjB,e.z,g.z),m.z,o.z);"
   "mxjR=mxjR+mxjR2;"
   "mxjG=mxjG+mxjG2;"
   "mxjB=mxjB+mxjB2;"
   "\n#endif\n"
   "AF1 mnkR=AMin3F1(AMin3F1(g.x,j.x,k.x),l.x,o.x),mnkG=AMin3F1(AMin3F1(g.y,j.y,k.y),l.y,o.y),mnkB=AMin3F1(AMin3F1(g.z,j.z,k.z),l.z,o.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mnkR2=AMin3F1(AMin3F1(mnkR,f.x,h.x),n.x,p.x),mnkG2=AMin3F1(AMin3F1(mnkG,f.y,h.y),n.y,p.y),mnkB2=AMin3F1(AMin3F1(mnkB,f.z,h.z),n.z,p.z);"
   "mnkR=mnkR+mnkR2;"
   "mnkG=mnkG+mnkG2;"
   "mnkB=mnkB+mnkB2;"
   "\n#endif\n"
   "AF1 mxkR=AMax3F1(AMax3F1(g.x,j.x,k.x),l.x,o.x),mxkG=AMax3F1(AMax3F1(g.y,j.y,k.y),l.y,o.y),mxkB=AMax3F1(AMax3F1(g.z,j.z,k.z),l.z,o.z);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 mxkR2=AMax3F1(AMax3F1(mxkR,f.x,h.x),n.x,p.x),mxkG2=AMax3F1(AMax3F1(mxkG,f.y,h.y),n.y,p.y),mxkB2=AMax3F1(AMax3F1(mxkB,f.z,h.z),n.z,p.z);"
   "mxkR=mxkR+mxkR2;"
   "mxkG=mxkG+mxkG2;"
   "mxkB=mxkB+mxkB2;"
   "\n#endif\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AF1 rcpMfR=ARcpF1(mxfR),rcpMfG=ARcpF1(mxfG),rcpMfB=ARcpF1(mxfB),rcpMgR=ARcpF1(mxgR),rcpMgG=ARcpF1(mxgG),rcpMgB=ARcpF1(mxgB),rcpMjR=ARcpF1(mxjR),rcpMjG=ARcpF1(mxjG),rcpMjB=ARcpF1(mxjB),rcpMkR=ARcpF1(mxkR),rcpMkG=ARcpF1(mxkG),rcpMkB=ARcpF1(mxkB);"
   "\n#else\n"
   "AF1 rcpMfR=APrxLoRcpF1(mxfR),rcpMfG=APrxLoRcpF1(mxfG),rcpMfB=APrxLoRcpF1(mxfB),rcpMgR=APrxLoRcpF1(mxgR),rcpMgG=APrxLoRcpF1(mxgG),rcpMgB=APrxLoRcpF1(mxgB),rcpMjR=APrxLoRcpF1(mxjR),rcpMjG=APrxLoRcpF1(mxjG),rcpMjB=APrxLoRcpF1(mxjB),rcpMkR=APrxLoRcpF1(mxkR),rcpMkG=APrxLoRcpF1(mxkG),rcpMkB=APrxLoRcpF1(mxkB);"
   "\n#endif\n"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AF1 ampfR=ASatF1(min(mnfR,AF1_(2.)-mxfR)*rcpMfR),ampfG=ASatF1(min(mnfG,AF1_(2.)-mxfG)*rcpMfG),ampfB=ASatF1(min(mnfB,AF1_(2.)-mxfB)*rcpMfB),ampgR=ASatF1(min(mngR,AF1_(2.)-mxgR)*rcpMgR),ampgG=ASatF1(min(mngG,AF1_(2.)-mxgG)*rcpMgG),ampgB=ASatF1(min(mngB,AF1_(2.)-mxgB)*rcpMgB),ampjR=ASatF1(min(mnjR,AF1_(2.)-mxjR)*rcpMjR),ampjG=ASatF1(min(mnjG,AF1_(2.)-mxjG)*rcpMjG),ampjB=ASatF1(min(mnjB,AF1_(2.)-mxjB)*rcpMjB),ampkR=ASatF1(min(mnkR,AF1_(2.)-mxkR)*rcpMkR),ampkG=ASatF1(min(mnkG,AF1_(2.)-mxkG)*rcpMkG),ampkB=ASatF1(min(mnkB,AF1_(2.)-mxkB)*rcpMkB);"
   "\n#else\n"
   "AF1 ampfR=ASatF1(min(mnfR,AF1_(1.)-mxfR)*rcpMfR),ampfG=ASatF1(min(mnfG,AF1_(1.)-mxfG)*rcpMfG),ampfB=ASatF1(min(mnfB,AF1_(1.)-mxfB)*rcpMfB),ampgR=ASatF1(min(mngR,AF1_(1.)-mxgR)*rcpMgR),ampgG=ASatF1(min(mngG,AF1_(1.)-mxgG)*rcpMgG),ampgB=ASatF1(min(mngB,AF1_(1.)-mxgB)*rcpMgB),ampjR=ASatF1(min(mnjR,AF1_(1.)-mxjR)*rcpMjR),ampjG=ASatF1(min(mnjG,AF1_(1.)-mxjG)*rcpMjG),ampjB=ASatF1(min(mnjB,AF1_(1.)-mxjB)*rcpMjB),ampkR=ASatF1(min(mnkR,AF1_(1.)-mxkR)*rcpMkR),ampkG=ASatF1(min(mnkG,AF1_(1.)-mxkG)*rcpMkG),ampkB=ASatF1(min(mnkB,AF1_(1.)-mxkB)*rcpMkB);"
   "\n#endif\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "ampfR=sqrt(ampfR);"
   "ampfG=sqrt(ampfG);"
   "ampfB=sqrt(ampfB);"
   "ampgR=sqrt(ampgR);"
   "ampgG=sqrt(ampgG);"
   "ampgB=sqrt(ampgB);"
   "ampjR=sqrt(ampjR);"
   "ampjG=sqrt(ampjG);"
   "ampjB=sqrt(ampjB);"
   "ampkR=sqrt(ampkR);"
   "ampkG=sqrt(ampkG);"
   "ampkB=sqrt(ampkB);"
   "\n#else\n"
   "ampfR=APrxLoSqrtF1(ampfR);"
   "ampfG=APrxLoSqrtF1(ampfG);"
   "ampfB=APrxLoSqrtF1(ampfB);"
   "ampgR=APrxLoSqrtF1(ampgR);"
   "ampgG=APrxLoSqrtF1(ampgG);"
   "ampgB=APrxLoSqrtF1(ampgB);"
   "ampjR=APrxLoSqrtF1(ampjR);"
   "ampjG=APrxLoSqrtF1(ampjG);"
   "ampjB=APrxLoSqrtF1(ampjB);"
   "ampkR=APrxLoSqrtF1(ampkR);"
   "ampkG=APrxLoSqrtF1(ampkG);"
   "ampkB=APrxLoSqrtF1(ampkB);"
   "\n#endif\n"
   "AF1 peak=const1.x,wfR=ampfR*peak,wfG=ampfG*peak,wfB=ampfB*peak,wgR=ampgR*peak,wgG=ampgG*peak,wgB=ampgB*peak,wjR=ampjR*peak,wjG=ampjG*peak,wjB=ampjB*peak,wkR=ampkR*peak,wkG=ampkG*peak,wkB=ampkB*peak,s=(AF1_(1.)-pp.x)*(AF1_(1.)-pp.y),t=pp.x*(AF1_(1.)-pp.y),u=(AF1_(1.)-pp.x)*pp.y,v=pp.x*pp.y,thinB=1./32.;"
   "\n#ifdef CAS_GO_SLOWER\n"
   "s*=ARcpF1(thinB+(mxfG-mnfG));"
   "t*=ARcpF1(thinB+(mxgG-mngG));"
   "u*=ARcpF1(thinB+(mxjG-mnjG));"
   "v*=ARcpF1(thinB+(mxkG-mnkG));"
   "\n#else\n"
   "s*=APrxLoRcpF1(thinB+(mxfG-mnfG));"
   "t*=APrxLoRcpF1(thinB+(mxgG-mngG));"
   "u*=APrxLoRcpF1(thinB+(mxjG-mnjG));"
   "v*=APrxLoRcpF1(thinB+(mxkG-mnkG));"
   "\n#endif\n"
   "AF1 qbeR=wfR*s,qbeG=wfG*s,qbeB=wfB*s,qchR=wgR*t,qchG=wgG*t,qchB=wgB*t,qfR=wgR*t+wjR*u+s,qfG=wgG*t+wjG*u+s,qfB=wgB*t+wjB*u+s,qgR=wfR*s+wkR*v+t,qgG=wfG*s+wkG*v+t,qgB=wfB*s+wkB*v+t,qjR=wfR*s+wkR*v+u,qjG=wfG*s+wkG*v+u,qjB=wfB*s+wkB*v+u,qkR=wgR*t+wjR*u+v,qkG=wgG*t+wjG*u+v,qkB=wgB*t+wjB*u+v,qinR=wjR*u,qinG=wjG*u,qinB=wjB*u,qloR=wkR*v,qloG=wkG*v,qloB=wkB*v;"
   "\n#ifndef CAS_SLOW\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AF1 rcpWG=ARcpF1(AF1_(2.)*qbeG+AF1_(2.)*qchG+AF1_(2.)*qinG+AF1_(2.)*qloG+qfG+qgG+qjG+qkG);"
   "\n#else\n"
   "AF1 rcpWG=APrxMedRcpF1(AF1_(2.)*qbeG+AF1_(2.)*qchG+AF1_(2.)*qinG+AF1_(2.)*qloG+qfG+qgG+qjG+qkG);"
   "\n#endif\n"
   "pixR=ASatF1((b.x*qbeG+e.x*qbeG+c.x*qchG+h.x*qchG+i.x*qinG+n.x*qinG+l.x*qloG+o.x*qloG+f.x*qfG+g.x*qgG+j.x*qjG+k.x*qkG)*rcpWG);"
   "pixG=ASatF1((b.y*qbeG+e.y*qbeG+c.y*qchG+h.y*qchG+i.y*qinG+n.y*qinG+l.y*qloG+o.y*qloG+f.y*qfG+g.y*qgG+j.y*qjG+k.y*qkG)*rcpWG);"
   "pixB=ASatF1((b.z*qbeG+e.z*qbeG+c.z*qchG+h.z*qchG+i.z*qinG+n.z*qinG+l.z*qloG+o.z*qloG+f.z*qfG+g.z*qgG+j.z*qjG+k.z*qkG)*rcpWG);"
   "\n#else\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AF1 rcpWR=ARcpF1(AF1_(2.)*qbeR+AF1_(2.)*qchR+AF1_(2.)*qinR+AF1_(2.)*qloR+qfR+qgR+qjR+qkR),rcpWG=ARcpF1(AF1_(2.)*qbeG+AF1_(2.)*qchG+AF1_(2.)*qinG+AF1_(2.)*qloG+qfG+qgG+qjG+qkG),rcpWB=ARcpF1(AF1_(2.)*qbeB+AF1_(2.)*qchB+AF1_(2.)*qinB+AF1_(2.)*qloB+qfB+qgB+qjB+qkB);"
   "\n#else\n"
   "AF1 rcpWR=APrxMedRcpF1(AF1_(2.)*qbeR+AF1_(2.)*qchR+AF1_(2.)*qinR+AF1_(2.)*qloR+qfR+qgR+qjR+qkR),rcpWG=APrxMedRcpF1(AF1_(2.)*qbeG+AF1_(2.)*qchG+AF1_(2.)*qinG+AF1_(2.)*qloG+qfG+qgG+qjG+qkG),rcpWB=APrxMedRcpF1(AF1_(2.)*qbeB+AF1_(2.)*qchB+AF1_(2.)*qinB+AF1_(2.)*qloB+qfB+qgB+qjB+qkB);"
   "\n#endif\n"
   "pixR=ASatF1((b.x*qbeR+e.x*qbeR+c.x*qchR+h.x*qchR+i.x*qinR+n.x*qinR+l.x*qloR+o.x*qloR+f.x*qfR+g.x*qgR+j.x*qjR+k.x*qkR)*rcpWR);"
   "pixG=ASatF1((b.y*qbeG+e.y*qbeG+c.y*qchG+h.y*qchG+i.y*qinG+n.y*qinG+l.y*qloG+o.y*qloG+f.y*qfG+g.y*qgG+j.y*qjG+k.y*qkG)*rcpWG);"
   "pixB=ASatF1((b.z*qbeB+e.z*qbeB+c.z*qchB+h.z*qchB+i.z*qinB+n.z*qinB+l.z*qloB+o.z*qloB+f.z*qfB+g.z*qgB+j.z*qjB+k.z*qkB)*rcpWB);"
   "\n#endif\n"
 "}\n"
 "#endif\n"
 "#if defined(A_GPU)&&defined(A_HALF)\n"
 "#ifdef A_HLSL\n"
 "#ifndef CAS_GO_SLOWER\n"
 "#define CAS_GO_SLOWER 1\n"
 "#endif\n"
 "#endif\n"
 "void CasDepack(out AH4 pix0,out AH4 pix1,AH2 pixR,AH2 pixG,AH2 pixB)"
 "{"
   "\n#ifdef A_HLSL\n"
   "pix0.w=pix1.w=0.;"
   "\n#endif\n"
   "pix0.xyz=AH3(pixR.x,pixG.x,pixB.x);"
   "pix1.xyz=AH3(pixR.y,pixG.y,pixB.y);"
 "}"
 "void CasFilterH(out AH2 pixR,out AH2 pixG,out AH2 pixB,AU2 ip,AU4 const0,AU4 const1,AP1 noScaling)"
 "{"
   "\n#ifdef CAS_DEBUG_CHECKER\n"
   "if(((ip.x^ip.y)>>8u&1u)==0u)"
     "{"
       "AH3 pix0=CasLoadH(ASW2(ip)),pix1=CasLoadH(ASW2(ip)+ASW2(8,0));"
       "pixR=AH2(pix0.x,pix1.x);"
       "pixG=AH2(pix0.y,pix1.y);"
       "pixB=AH2(pix0.z,pix1.z);"
       "CasInputH(pixR,pixG,pixB);"
       "return;"
     "}"
   "\n#endif\n"
   "if(noScaling)"
     "{"
       "ASW2 sp0=ASW2(ip);"
       "AH3 a0=CasLoadH(sp0+ASW2(-1,-1)),b0=CasLoadH(sp0+ASW2(0,-1)),c0=CasLoadH(sp0+ASW2(1,-1)),d0=CasLoadH(sp0+ASW2(-1,0)),e0=CasLoadH(sp0),f0=CasLoadH(sp0+ASW2(1,0)),g0=CasLoadH(sp0+ASW2(-1,1)),h0=CasLoadH(sp0+ASW2(0,1)),i0=CasLoadH(sp0+ASW2(1,1));"
       "ASW2 sp1=sp0+ASW2(8,0);"
       "AH3 a1=CasLoadH(sp1+ASW2(-1,-1)),b1=CasLoadH(sp1+ASW2(0,-1)),c1=CasLoadH(sp1+ASW2(1,-1)),d1=CasLoadH(sp1+ASW2(-1,0)),e1=CasLoadH(sp1),f1=CasLoadH(sp1+ASW2(1,0)),g1=CasLoadH(sp1+ASW2(-1,1)),h1=CasLoadH(sp1+ASW2(0,1)),i1=CasLoadH(sp1+ASW2(1,1));"
       "AH2 aR=AH2(a0.x,a1.x),aG=AH2(a0.y,a1.y),aB=AH2(a0.z,a1.z),bR=AH2(b0.x,b1.x),bG=AH2(b0.y,b1.y),bB=AH2(b0.z,b1.z),cR=AH2(c0.x,c1.x),cG=AH2(c0.y,c1.y),cB=AH2(c0.z,c1.z),dR=AH2(d0.x,d1.x),dG=AH2(d0.y,d1.y),dB=AH2(d0.z,d1.z),eR=AH2(e0.x,e1.x),eG=AH2(e0.y,e1.y),eB=AH2(e0.z,e1.z),fR=AH2(f0.x,f1.x),fG=AH2(f0.y,f1.y),fB=AH2(f0.z,f1.z),gR=AH2(g0.x,g1.x),gG=AH2(g0.y,g1.y),gB=AH2(g0.z,g1.z),hR=AH2(h0.x,h1.x),hG=AH2(h0.y,h1.y),hB=AH2(h0.z,h1.z),iR=AH2(i0.x,i1.x),iG=AH2(i0.y,i1.y),iB=AH2(i0.z,i1.z);"
       "CasInputH(aR,aG,aB);"
       "CasInputH(bR,bG,bB);"
       "CasInputH(cR,cG,cB);"
       "CasInputH(dR,dG,dB);"
       "CasInputH(eR,eG,eB);"
       "CasInputH(fR,fG,fB);"
       "CasInputH(gR,gG,gB);"
       "CasInputH(hR,hG,hB);"
       "CasInputH(iR,iG,iB);"
       "AH2 mnR=min(min(fR,hR),min(min(bR,dR),eR)),mnG=min(min(fG,hG),min(min(bG,dG),eG)),mnB=min(min(fB,hB),min(min(bB,dB),eB));"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AH2 mnR2=min(min(gR,iR),min(min(aR,cR),mnR)),mnG2=min(min(gG,iG),min(min(aG,cG),mnG)),mnB2=min(min(gB,iB),min(min(aB,cB),mnB));"
       "mnR=mnR+mnR2;"
       "mnG=mnG+mnG2;"
       "mnB=mnB+mnB2;"
       "\n#endif\n"
       "AH2 mxR=max(max(fR,hR),max(max(bR,dR),eR)),mxG=max(max(fG,hG),max(max(bG,dG),eG)),mxB=max(max(fB,hB),max(max(bB,dB),eB));"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AH2 mxR2=max(max(gR,iR),max(max(aR,cR),mxR)),mxG2=max(max(gG,iG),max(max(aG,cG),mxG)),mxB2=max(max(gB,iB),max(max(aB,cB),mxB));"
       "mxR=mxR+mxR2;"
       "mxG=mxG+mxG2;"
       "mxB=mxB+mxB2;"
       "\n#endif\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AH2 rcpMR=ARcpH2(mxR),rcpMG=ARcpH2(mxG),rcpMB=ARcpH2(mxB);"
       "\n#else\n"
       "AH2 rcpMR=APrxLoRcpH2(mxR),rcpMG=APrxLoRcpH2(mxG),rcpMB=APrxLoRcpH2(mxB);"
       "\n#endif\n"
       "\n#ifdef CAS_BETTER_DIAGONALS\n"
       "AH2 ampR=ASatH2(min(mnR,AH2_(2.)-mxR)*rcpMR),ampG=ASatH2(min(mnG,AH2_(2.)-mxG)*rcpMG),ampB=ASatH2(min(mnB,AH2_(2.)-mxB)*rcpMB);"
       "\n#else\n"
       "AH2 ampR=ASatH2(min(mnR,AH2_(1.)-mxR)*rcpMR),ampG=ASatH2(min(mnG,AH2_(1.)-mxG)*rcpMG),ampB=ASatH2(min(mnB,AH2_(1.)-mxB)*rcpMB);"
       "\n#endif\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "ampR=sqrt(ampR);"
       "ampG=sqrt(ampG);"
       "ampB=sqrt(ampB);"
       "\n#else\n"
       "ampR=APrxLoSqrtH2(ampR);"
       "ampG=APrxLoSqrtH2(ampG);"
       "ampB=APrxLoSqrtH2(ampB);"
       "\n#endif\n"
       "AH1 peak=AH2_AU1(const1.y).x;"
       "AH2 wR=ampR*AH2_(peak),wG=ampG*AH2_(peak),wB=ampB*AH2_(peak);"
       "\n#ifndef CAS_SLOW\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AH2 rcpWeight=ARcpH2(AH2_(1.)+AH2_(4.)*wG);"
       "\n#else\n"
       "AH2 rcpWeight=APrxMedRcpH2(AH2_(1.)+AH2_(4.)*wG);"
       "\n#endif\n"
       "pixR=ASatH2((bR*wG+dR*wG+fR*wG+hR*wG+eR)*rcpWeight);"
       "pixG=ASatH2((bG*wG+dG*wG+fG*wG+hG*wG+eG)*rcpWeight);"
       "pixB=ASatH2((bB*wG+dB*wG+fB*wG+hB*wG+eB)*rcpWeight);"
       "\n#else\n"
       "\n#ifdef CAS_GO_SLOWER\n"
       "AH2 rcpWeightR=ARcpH2(AH2_(1.)+AH2_(4.)*wR),rcpWeightG=ARcpH2(AH2_(1.)+AH2_(4.)*wG),rcpWeightB=ARcpH2(AH2_(1.)+AH2_(4.)*wB);"
       "\n#else\n"
       "AH2 rcpWeightR=APrxMedRcpH2(AH2_(1.)+AH2_(4.)*wR),rcpWeightG=APrxMedRcpH2(AH2_(1.)+AH2_(4.)*wG),rcpWeightB=APrxMedRcpH2(AH2_(1.)+AH2_(4.)*wB);"
       "\n#endif\n"
       "pixR=ASatH2((bR*wR+dR*wR+fR*wR+hR*wR+eR)*rcpWeightR);"
       "pixG=ASatH2((bG*wG+dG*wG+fG*wG+hG*wG+eG)*rcpWeightG);"
       "pixB=ASatH2((bB*wB+dB*wB+fB*wB+hB*wB+eB)*rcpWeightB);"
       "\n#endif\n"
       "return;"
     "}"
   "AF2 pp=AF2(ip)*AF2_AU2(const0.xy)+AF2_AU2(const0.zw),fp0=floor(pp);"
   "AH2 ppX;"
   "ppX.x=AH1(pp.x-fp0.x);"
   "AH1 ppY=AH1(pp.y-fp0.y);"
   "ASW2 sp0=ASW2(fp0);"
   "AH3 a0=CasLoadH(sp0+ASW2(-1,-1)),b0=CasLoadH(sp0+ASW2(0,-1)),e0=CasLoadH(sp0+ASW2(-1,0)),f0=CasLoadH(sp0),c0=CasLoadH(sp0+ASW2(1,-1)),d0=CasLoadH(sp0+ASW2(2,-1)),g0=CasLoadH(sp0+ASW2(1,0)),h0=CasLoadH(sp0+ASW2(2,0)),i0=CasLoadH(sp0+ASW2(-1,1)),j0=CasLoadH(sp0+ASW2(0,1)),m0=CasLoadH(sp0+ASW2(-1,2)),n0=CasLoadH(sp0+ASW2(0,2)),k0=CasLoadH(sp0+ASW2(1,1)),l0=CasLoadH(sp0+ASW2(2,1)),o0=CasLoadH(sp0+ASW2(1,2)),p0=CasLoadH(sp0+ASW2(2,2));"
   "AF1 pp1=pp.x+AF1_AU1(const1.z),fp1=floor(pp1);"
   "ppX.y=AH1(pp1-fp1);"
   "ASW2 sp1=ASW2(fp1,sp0.y);"
   "AH3 a1=CasLoadH(sp1+ASW2(-1,-1)),b1=CasLoadH(sp1+ASW2(0,-1)),e1=CasLoadH(sp1+ASW2(-1,0)),f1=CasLoadH(sp1),c1=CasLoadH(sp1+ASW2(1,-1)),d1=CasLoadH(sp1+ASW2(2,-1)),g1=CasLoadH(sp1+ASW2(1,0)),h1=CasLoadH(sp1+ASW2(2,0)),i1=CasLoadH(sp1+ASW2(-1,1)),j1=CasLoadH(sp1+ASW2(0,1)),m1=CasLoadH(sp1+ASW2(-1,2)),n1=CasLoadH(sp1+ASW2(0,2)),k1=CasLoadH(sp1+ASW2(1,1)),l1=CasLoadH(sp1+ASW2(2,1)),o1=CasLoadH(sp1+ASW2(1,2)),p1=CasLoadH(sp1+ASW2(2,2));"
   "AH2 aR=AH2(a0.x,a1.x),aG=AH2(a0.y,a1.y),aB=AH2(a0.z,a1.z),bR=AH2(b0.x,b1.x),bG=AH2(b0.y,b1.y),bB=AH2(b0.z,b1.z),cR=AH2(c0.x,c1.x),cG=AH2(c0.y,c1.y),cB=AH2(c0.z,c1.z),dR=AH2(d0.x,d1.x),dG=AH2(d0.y,d1.y),dB=AH2(d0.z,d1.z),eR=AH2(e0.x,e1.x),eG=AH2(e0.y,e1.y),eB=AH2(e0.z,e1.z),fR=AH2(f0.x,f1.x),fG=AH2(f0.y,f1.y),fB=AH2(f0.z,f1.z),gR=AH2(g0.x,g1.x),gG=AH2(g0.y,g1.y),gB=AH2(g0.z,g1.z),hR=AH2(h0.x,h1.x),hG=AH2(h0.y,h1.y),hB=AH2(h0.z,h1.z),iR=AH2(i0.x,i1.x),iG=AH2(i0.y,i1.y),iB=AH2(i0.z,i1.z),jR=AH2(j0.x,j1.x),jG=AH2(j0.y,j1.y),jB=AH2(j0.z,j1.z),kR=AH2(k0.x,k1.x),kG=AH2(k0.y,k1.y),kB=AH2(k0.z,k1.z),lR=AH2(l0.x,l1.x),lG=AH2(l0.y,l1.y),lB=AH2(l0.z,l1.z),mR=AH2(m0.x,m1.x),mG=AH2(m0.y,m1.y),mB=AH2(m0.z,m1.z),nR=AH2(n0.x,n1.x),nG=AH2(n0.y,n1.y),nB=AH2(n0.z,n1.z),oR=AH2(o0.x,o1.x),oG=AH2(o0.y,o1.y),oB=AH2(o0.z,o1.z),pR=AH2(p0.x,p1.x),pG=AH2(p0.y,p1.y),pB=AH2(p0.z,p1.z);"
   "CasInputH(aR,aG,aB);"
   "CasInputH(bR,bG,bB);"
   "CasInputH(cR,cG,cB);"
   "CasInputH(dR,dG,dB);"
   "CasInputH(eR,eG,eB);"
   "CasInputH(fR,fG,fB);"
   "CasInputH(gR,gG,gB);"
   "CasInputH(hR,hG,hB);"
   "CasInputH(iR,iG,iB);"
   "CasInputH(jR,jG,jB);"
   "CasInputH(kR,kG,kB);"
   "CasInputH(lR,lG,lB);"
   "CasInputH(mR,mG,mB);"
   "CasInputH(nR,nG,nB);"
   "CasInputH(oR,oG,oB);"
   "CasInputH(pR,pG,pB);"
   "AH2 mnfR=AMin3H2(AMin3H2(bR,eR,fR),gR,jR),mnfG=AMin3H2(AMin3H2(bG,eG,fG),gG,jG),mnfB=AMin3H2(AMin3H2(bB,eB,fB),gB,jB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mnfR2=AMin3H2(AMin3H2(mnfR,aR,cR),iR,kR),mnfG2=AMin3H2(AMin3H2(mnfG,aG,cG),iG,kG),mnfB2=AMin3H2(AMin3H2(mnfB,aB,cB),iB,kB);"
   "mnfR=mnfR+mnfR2;"
   "mnfG=mnfG+mnfG2;"
   "mnfB=mnfB+mnfB2;"
   "\n#endif\n"
   "AH2 mxfR=AMax3H2(AMax3H2(bR,eR,fR),gR,jR),mxfG=AMax3H2(AMax3H2(bG,eG,fG),gG,jG),mxfB=AMax3H2(AMax3H2(bB,eB,fB),gB,jB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mxfR2=AMax3H2(AMax3H2(mxfR,aR,cR),iR,kR),mxfG2=AMax3H2(AMax3H2(mxfG,aG,cG),iG,kG),mxfB2=AMax3H2(AMax3H2(mxfB,aB,cB),iB,kB);"
   "mxfR=mxfR+mxfR2;"
   "mxfG=mxfG+mxfG2;"
   "mxfB=mxfB+mxfB2;"
   "\n#endif\n"
   "AH2 mngR=AMin3H2(AMin3H2(cR,fR,gR),hR,kR),mngG=AMin3H2(AMin3H2(cG,fG,gG),hG,kG),mngB=AMin3H2(AMin3H2(cB,fB,gB),hB,kB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mngR2=AMin3H2(AMin3H2(mngR,bR,dR),jR,lR),mngG2=AMin3H2(AMin3H2(mngG,bG,dG),jG,lG),mngB2=AMin3H2(AMin3H2(mngB,bB,dB),jB,lB);"
   "mngR=mngR+mngR2;"
   "mngG=mngG+mngG2;"
   "mngB=mngB+mngB2;"
   "\n#endif\n"
   "AH2 mxgR=AMax3H2(AMax3H2(cR,fR,gR),hR,kR),mxgG=AMax3H2(AMax3H2(cG,fG,gG),hG,kG),mxgB=AMax3H2(AMax3H2(cB,fB,gB),hB,kB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mxgR2=AMax3H2(AMax3H2(mxgR,bR,dR),jR,lR),mxgG2=AMax3H2(AMax3H2(mxgG,bG,dG),jG,lG),mxgB2=AMax3H2(AMax3H2(mxgB,bB,dB),jB,lB);"
   "mxgR=mxgR+mxgR2;"
   "mxgG=mxgG+mxgG2;"
   "mxgB=mxgB+mxgB2;"
   "\n#endif\n"
   "AH2 mnjR=AMin3H2(AMin3H2(fR,iR,jR),kR,nR),mnjG=AMin3H2(AMin3H2(fG,iG,jG),kG,nG),mnjB=AMin3H2(AMin3H2(fB,iB,jB),kB,nB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mnjR2=AMin3H2(AMin3H2(mnjR,eR,gR),mR,oR),mnjG2=AMin3H2(AMin3H2(mnjG,eG,gG),mG,oG),mnjB2=AMin3H2(AMin3H2(mnjB,eB,gB),mB,oB);"
   "mnjR=mnjR+mnjR2;"
   "mnjG=mnjG+mnjG2;"
   "mnjB=mnjB+mnjB2;"
   "\n#endif\n"
   "AH2 mxjR=AMax3H2(AMax3H2(fR,iR,jR),kR,nR),mxjG=AMax3H2(AMax3H2(fG,iG,jG),kG,nG),mxjB=AMax3H2(AMax3H2(fB,iB,jB),kB,nB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mxjR2=AMax3H2(AMax3H2(mxjR,eR,gR),mR,oR),mxjG2=AMax3H2(AMax3H2(mxjG,eG,gG),mG,oG),mxjB2=AMax3H2(AMax3H2(mxjB,eB,gB),mB,oB);"
   "mxjR=mxjR+mxjR2;"
   "mxjG=mxjG+mxjG2;"
   "mxjB=mxjB+mxjB2;"
   "\n#endif\n"
   "AH2 mnkR=AMin3H2(AMin3H2(gR,jR,kR),lR,oR),mnkG=AMin3H2(AMin3H2(gG,jG,kG),lG,oG),mnkB=AMin3H2(AMin3H2(gB,jB,kB),lB,oB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mnkR2=AMin3H2(AMin3H2(mnkR,fR,hR),nR,pR),mnkG2=AMin3H2(AMin3H2(mnkG,fG,hG),nG,pG),mnkB2=AMin3H2(AMin3H2(mnkB,fB,hB),nB,pB);"
   "mnkR=mnkR+mnkR2;"
   "mnkG=mnkG+mnkG2;"
   "mnkB=mnkB+mnkB2;"
   "\n#endif\n"
   "AH2 mxkR=AMax3H2(AMax3H2(gR,jR,kR),lR,oR),mxkG=AMax3H2(AMax3H2(gG,jG,kG),lG,oG),mxkB=AMax3H2(AMax3H2(gB,jB,kB),lB,oB);"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 mxkR2=AMax3H2(AMax3H2(mxkR,fR,hR),nR,pR),mxkG2=AMax3H2(AMax3H2(mxkG,fG,hG),nG,pG),mxkB2=AMax3H2(AMax3H2(mxkB,fB,hB),nB,pB);"
   "mxkR=mxkR+mxkR2;"
   "mxkG=mxkG+mxkG2;"
   "mxkB=mxkB+mxkB2;"
   "\n#endif\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AH2 rcpMfR=ARcpH2(mxfR),rcpMfG=ARcpH2(mxfG),rcpMfB=ARcpH2(mxfB),rcpMgR=ARcpH2(mxgR),rcpMgG=ARcpH2(mxgG),rcpMgB=ARcpH2(mxgB),rcpMjR=ARcpH2(mxjR),rcpMjG=ARcpH2(mxjG),rcpMjB=ARcpH2(mxjB),rcpMkR=ARcpH2(mxkR),rcpMkG=ARcpH2(mxkG),rcpMkB=ARcpH2(mxkB);"
   "\n#else\n"
   "AH2 rcpMfR=APrxLoRcpH2(mxfR),rcpMfG=APrxLoRcpH2(mxfG),rcpMfB=APrxLoRcpH2(mxfB),rcpMgR=APrxLoRcpH2(mxgR),rcpMgG=APrxLoRcpH2(mxgG),rcpMgB=APrxLoRcpH2(mxgB),rcpMjR=APrxLoRcpH2(mxjR),rcpMjG=APrxLoRcpH2(mxjG),rcpMjB=APrxLoRcpH2(mxjB),rcpMkR=APrxLoRcpH2(mxkR),rcpMkG=APrxLoRcpH2(mxkG),rcpMkB=APrxLoRcpH2(mxkB);"
   "\n#endif\n"
   "\n#ifdef CAS_BETTER_DIAGONALS\n"
   "AH2 ampfR=ASatH2(min(mnfR,AH2_(2.)-mxfR)*rcpMfR),ampfG=ASatH2(min(mnfG,AH2_(2.)-mxfG)*rcpMfG),ampfB=ASatH2(min(mnfB,AH2_(2.)-mxfB)*rcpMfB),ampgR=ASatH2(min(mngR,AH2_(2.)-mxgR)*rcpMgR),ampgG=ASatH2(min(mngG,AH2_(2.)-mxgG)*rcpMgG),ampgB=ASatH2(min(mngB,AH2_(2.)-mxgB)*rcpMgB),ampjR=ASatH2(min(mnjR,AH2_(2.)-mxjR)*rcpMjR),ampjG=ASatH2(min(mnjG,AH2_(2.)-mxjG)*rcpMjG),ampjB=ASatH2(min(mnjB,AH2_(2.)-mxjB)*rcpMjB),ampkR=ASatH2(min(mnkR,AH2_(2.)-mxkR)*rcpMkR),ampkG=ASatH2(min(mnkG,AH2_(2.)-mxkG)*rcpMkG),ampkB=ASatH2(min(mnkB,AH2_(2.)-mxkB)*rcpMkB);"
   "\n#else\n"
   "AH2 ampfR=ASatH2(min(mnfR,AH2_(1.)-mxfR)*rcpMfR),ampfG=ASatH2(min(mnfG,AH2_(1.)-mxfG)*rcpMfG),ampfB=ASatH2(min(mnfB,AH2_(1.)-mxfB)*rcpMfB),ampgR=ASatH2(min(mngR,AH2_(1.)-mxgR)*rcpMgR),ampgG=ASatH2(min(mngG,AH2_(1.)-mxgG)*rcpMgG),ampgB=ASatH2(min(mngB,AH2_(1.)-mxgB)*rcpMgB),ampjR=ASatH2(min(mnjR,AH2_(1.)-mxjR)*rcpMjR),ampjG=ASatH2(min(mnjG,AH2_(1.)-mxjG)*rcpMjG),ampjB=ASatH2(min(mnjB,AH2_(1.)-mxjB)*rcpMjB),ampkR=ASatH2(min(mnkR,AH2_(1.)-mxkR)*rcpMkR),ampkG=ASatH2(min(mnkG,AH2_(1.)-mxkG)*rcpMkG),ampkB=ASatH2(min(mnkB,AH2_(1.)-mxkB)*rcpMkB);"
   "\n#endif\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "ampfR=sqrt(ampfR);"
   "ampfG=sqrt(ampfG);"
   "ampfB=sqrt(ampfB);"
   "ampgR=sqrt(ampgR);"
   "ampgG=sqrt(ampgG);"
   "ampgB=sqrt(ampgB);"
   "ampjR=sqrt(ampjR);"
   "ampjG=sqrt(ampjG);"
   "ampjB=sqrt(ampjB);"
   "ampkR=sqrt(ampkR);"
   "ampkG=sqrt(ampkG);"
   "ampkB=sqrt(ampkB);"
   "\n#else\n"
   "ampfR=APrxLoSqrtH2(ampfR);"
   "ampfG=APrxLoSqrtH2(ampfG);"
   "ampfB=APrxLoSqrtH2(ampfB);"
   "ampgR=APrxLoSqrtH2(ampgR);"
   "ampgG=APrxLoSqrtH2(ampgG);"
   "ampgB=APrxLoSqrtH2(ampgB);"
   "ampjR=APrxLoSqrtH2(ampjR);"
   "ampjG=APrxLoSqrtH2(ampjG);"
   "ampjB=APrxLoSqrtH2(ampjB);"
   "ampkR=APrxLoSqrtH2(ampkR);"
   "ampkG=APrxLoSqrtH2(ampkG);"
   "ampkB=APrxLoSqrtH2(ampkB);"
   "\n#endif\n"
   "AH1 peak=AH2_AU1(const1.y).x;"
   "AH2 wfR=ampfR*AH2_(peak),wfG=ampfG*AH2_(peak),wfB=ampfB*AH2_(peak),wgR=ampgR*AH2_(peak),wgG=ampgG*AH2_(peak),wgB=ampgB*AH2_(peak),wjR=ampjR*AH2_(peak),wjG=ampjG*AH2_(peak),wjB=ampjB*AH2_(peak),wkR=ampkR*AH2_(peak),wkG=ampkG*AH2_(peak),wkB=ampkB*AH2_(peak),s=(AH2_(1.)-ppX)*(AH2_(1.)-AH2_(ppY)),t=ppX*(AH2_(1.)-AH2_(ppY)),u=(AH2_(1.)-ppX)*AH2_(ppY),v=ppX*AH2_(ppY),thinB=AH2_(1./32.);"
   "\n#ifdef CAS_GO_SLOWER\n"
   "s*=ARcpH2(thinB+(mxfG-mnfG));"
   "t*=ARcpH2(thinB+(mxgG-mngG));"
   "u*=ARcpH2(thinB+(mxjG-mnjG));"
   "v*=ARcpH2(thinB+(mxkG-mnkG));"
   "\n#else\n"
   "s*=APrxLoRcpH2(thinB+(mxfG-mnfG));"
   "t*=APrxLoRcpH2(thinB+(mxgG-mngG));"
   "u*=APrxLoRcpH2(thinB+(mxjG-mnjG));"
   "v*=APrxLoRcpH2(thinB+(mxkG-mnkG));"
   "\n#endif\n"
   "AH2 qbeR=wfR*s,qbeG=wfG*s,qbeB=wfB*s,qchR=wgR*t,qchG=wgG*t,qchB=wgB*t,qfR=wgR*t+wjR*u+s,qfG=wgG*t+wjG*u+s,qfB=wgB*t+wjB*u+s,qgR=wfR*s+wkR*v+t,qgG=wfG*s+wkG*v+t,qgB=wfB*s+wkB*v+t,qjR=wfR*s+wkR*v+u,qjG=wfG*s+wkG*v+u,qjB=wfB*s+wkB*v+u,qkR=wgR*t+wjR*u+v,qkG=wgG*t+wjG*u+v,qkB=wgB*t+wjB*u+v,qinR=wjR*u,qinG=wjG*u,qinB=wjB*u,qloR=wkR*v,qloG=wkG*v,qloB=wkB*v;"
   "\n#ifndef CAS_SLOW\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AH2 rcpWG=ARcpH2(AH2_(2.)*qbeG+AH2_(2.)*qchG+AH2_(2.)*qinG+AH2_(2.)*qloG+qfG+qgG+qjG+qkG);"
   "\n#else\n"
   "AH2 rcpWG=APrxMedRcpH2(AH2_(2.)*qbeG+AH2_(2.)*qchG+AH2_(2.)*qinG+AH2_(2.)*qloG+qfG+qgG+qjG+qkG);"
   "\n#endif\n"
   "pixR=ASatH2((bR*qbeG+eR*qbeG+cR*qchG+hR*qchG+iR*qinG+nR*qinG+lR*qloG+oR*qloG+fR*qfG+gR*qgG+jR*qjG+kR*qkG)*rcpWG);"
   "pixG=ASatH2((bG*qbeG+eG*qbeG+cG*qchG+hG*qchG+iG*qinG+nG*qinG+lG*qloG+oG*qloG+fG*qfG+gG*qgG+jG*qjG+kG*qkG)*rcpWG);"
   "pixB=ASatH2((bB*qbeG+eB*qbeG+cB*qchG+hB*qchG+iB*qinG+nB*qinG+lB*qloG+oB*qloG+fB*qfG+gB*qgG+jB*qjG+kB*qkG)*rcpWG);"
   "\n#else\n"
   "\n#ifdef CAS_GO_SLOWER\n"
   "AH2 rcpWR=ARcpH2(AH2_(2.)*qbeR+AH2_(2.)*qchR+AH2_(2.)*qinR+AH2_(2.)*qloR+qfR+qgR+qjR+qkR),rcpWG=ARcpH2(AH2_(2.)*qbeG+AH2_(2.)*qchG+AH2_(2.)*qinG+AH2_(2.)*qloG+qfG+qgG+qjG+qkG),rcpWB=ARcpH2(AH2_(2.)*qbeB+AH2_(2.)*qchB+AH2_(2.)*qinB+AH2_(2.)*qloB+qfB+qgB+qjB+qkB);"
   "\n#else\n"
   "AH2 rcpWR=APrxMedRcpH2(AH2_(2.)*qbeR+AH2_(2.)*qchR+AH2_(2.)*qinR+AH2_(2.)*qloR+qfR+qgR+qjR+qkR),rcpWG=APrxMedRcpH2(AH2_(2.)*qbeG+AH2_(2.)*qchG+AH2_(2.)*qinG+AH2_(2.)*qloG+qfG+qgG+qjG+qkG),rcpWB=APrxMedRcpH2(AH2_(2.)*qbeB+AH2_(2.)*qchB+AH2_(2.)*qinB+AH2_(2.)*qloB+qfB+qgB+qjB+qkB);"
   "\n#endif\n"
   "pixR=ASatH2((bR*qbeR+eR*qbeR+cR*qchR+hR*qchR+iR*qinR+nR*qinR+lR*qloR+oR*qloR+fR*qfR+gR*qgR+jR*qjR+kR*qkR)*rcpWR);"
   "pixG=ASatH2((bG*qbeG+eG*qbeG+cG*qchG+hG*qchG+iG*qinG+nG*qinG+lG*qloG+oG*qloG+fG*qfG+gG*qgG+jG*qjG+kG*qkG)*rcpWG);"
   "pixB=ASatH2((bB*qbeB+eB*qbeB+cB*qchB+hB*qchB+iB*qinB+nB*qinB+lB*qloB+oB*qloB+fB*qfB+gB*qgB+jB*qjB+kB*qkB)*rcpWB);"
   "\n#endif\n"
 "}\n"
 "#endif\n"
 "void main()"
 "{"
   "AF3 c;"
   "CasFilter(c.x,c.y,c.z,uvec2(gl_FragCoord.xy+vec2(-Const2.x,Const2.y)),Const0,Const1,false);"
   "color=vec4(c,1.);"
 "}";

#endif // POST_CAS_H_
