#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float atan2(float, int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(float);
float texelSolidAngle(float u, float v, float invSize) {
  float x0 = u - invSize;
  float x1 = u + invSize;
  float y0 = v - invSize;
  float y1 = v + invSize;
  float x00sq = x0 * x0;
  float x11sq = x1 * x1;
  float y00sq = y0 * y0;
  float y11sq = y1 * y1;
  return atan2(x0 * y0, sqrt(x00sq + y00sq + 1.0)) -
         atan2(x0 * y1, sqrt(x00sq + y11sq + 1.0)) -
         atan2(x1 * y0, sqrt(x11sq + y00sq + 1.0)) +
         atan2(x1 * y1, sqrt(x11sq + y11sq + 1.0));
}


x86 assembly (clang, -O0):
<texelSolidAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  -0x48(%rbp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  -0x44(%rbp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd9a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  -0x3c(%rbp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd4b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  -0x34(%rbp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
addss  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<texelSolidAngle>:
sub    $0x28,%rsp
movaps %xmm0,%xmm4
subss  %xmm2,%xmm4
movss  %xmm4,0xc(%rsp)
addss  %xmm2,%xmm0
movss  %xmm0,0x18(%rsp)
movaps %xmm1,%xmm3
subss  %xmm2,%xmm3
movss  %xmm3,0x10(%rsp)
addss  %xmm2,%xmm1
movss  %xmm1,0x8(%rsp)
movaps %xmm4,%xmm5
mulss  %xmm4,%xmm5
movss  %xmm5,0x20(%rsp)
movaps %xmm0,%xmm2
mulss  %xmm0,%xmm2
movss  %xmm2,0x1c(%rsp)
movaps %xmm3,%xmm2
mulss  %xmm3,%xmm2
movss  %xmm2,0x24(%rsp)
mulss  %xmm1,%xmm1
movss  %xmm1,0x14(%rsp)
mulss  %xmm3,%xmm4
movss  %xmm4,0x4(%rsp)
movaps %xmm5,%xmm0
addss  %xmm2,%xmm0
addss  0xe64(%rip),%xmm0
call   1040 <sqrt@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movss  %xmm0,0x4(%rsp)
movss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x20(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
addss  0xe26(%rip),%xmm0
call   1040 <sqrt@plt>
movss  0xc(%rsp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x10(%rsp),%xmm0
mulss  0x18(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x24(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
addss  0xdde(%rip),%xmm0
call   1040 <sqrt@plt>
movss  0x10(%rsp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x8(%rsp),%xmm0
mulss  0x18(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x14(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
addss  0xd96(%rip),%xmm0
call   1040 <sqrt@plt>
movss  0x8(%rsp),%xmm0
mov    %eax,%edi
call   1030 <atan2@plt>
addss  0x4(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @texelSolidAngle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%15 = load float, float* %4
%16 = load float, float* %6
%17 = fsub float %15, %16
store float %17, float* %7
%18 = load float, float* %4
%19 = load float, float* %6
%20 = fadd float %18, %19
store float %20, float* %8
%21 = load float, float* %5
%22 = load float, float* %6
%23 = fsub float %21, %22
store float %23, float* %9
%24 = load float, float* %5
%25 = load float, float* %6
%26 = fadd float %24, %25
store float %26, float* %10
%27 = load float, float* %7
%28 = load float, float* %7
%29 = fmul float %27, %28
store float %29, float* %11
%30 = load float, float* %8
%31 = load float, float* %8
%32 = fmul float %30, %31
store float %32, float* %12
%33 = load float, float* %9
%34 = load float, float* %9
%35 = fmul float %33, %34
store float %35, float* %13
%36 = load float, float* %10
%37 = load float, float* %10
%38 = fmul float %36, %37
store float %38, float* %14
%39 = load float, float* %7
%40 = load float, float* %9
%41 = fmul float %39, %40
%42 = load float, float* %11
%43 = load float, float* %13
%44 = fadd float %42, %43
%45 = fpext float %44 to double
%46 = fadd double %45, 1.000000e+00
%47 = fptrunc double %46 to float
%48 = call i32 @sqrt(float %47)
%49 = call float @atan2(float %41, i32 %48)
%50 = load float, float* %7
%51 = load float, float* %10
%52 = fmul float %50, %51
%53 = load float, float* %11
%54 = load float, float* %14
%55 = fadd float %53, %54
%56 = fpext float %55 to double
%57 = fadd double %56, 1.000000e+00
%58 = fptrunc double %57 to float
%59 = call i32 @sqrt(float %58)
%60 = call float @atan2(float %52, i32 %59)
%61 = fsub float %49, %60
%62 = load float, float* %8
%63 = load float, float* %9
%64 = fmul float %62, %63
%65 = load float, float* %12
%66 = load float, float* %13
%67 = fadd float %65, %66
%68 = fpext float %67 to double
%69 = fadd double %68, 1.000000e+00
%70 = fptrunc double %69 to float
%71 = call i32 @sqrt(float %70)
%72 = call float @atan2(float %64, i32 %71)
%73 = fsub float %61, %72
%74 = load float, float* %8
%75 = load float, float* %10
%76 = fmul float %74, %75
%77 = load float, float* %12
%78 = load float, float* %14
%79 = fadd float %77, %78
%80 = fpext float %79 to double
%81 = fadd double %80, 1.000000e+00
%82 = fptrunc double %81 to float
%83 = call i32 @sqrt(float %82)
%84 = call float @atan2(float %76, i32 %83)
%85 = fadd float %73, %84
ret float %85
}

LLVM IR (-O2):
define float @texelSolidAngle(float %0, float %1, float %2) {
%4 = fsub float %0, %2
%5 = fadd float %0, %2
%6 = fsub float %1, %2
%7 = fadd float %1, %2
%8 = fmul float %4, %4
%9 = fmul float %5, %5
%10 = fmul float %6, %6
%11 = fmul float %7, %7
%12 = fmul float %4, %6
%13 = fadd float %8, %10
%14 = fadd float %13, 1.000000e+00
%15 = tail call i32 @sqrt(float %14)
%16 = tail call float @atan2(float %12, i32 %15)
%17 = fmul float %4, %7
%18 = fadd float %8, %11
%19 = fadd float %18, 1.000000e+00
%20 = tail call i32 @sqrt(float %19)
%21 = tail call float @atan2(float %17, i32 %20)
%22 = fsub float %16, %21
%23 = fmul float %5, %6
%24 = fadd float %9, %10
%25 = fadd float %24, 1.000000e+00
%26 = tail call i32 @sqrt(float %25)
%27 = tail call float @atan2(float %23, i32 %26)
%28 = fsub float %22, %27
%29 = fmul float %5, %7
%30 = fadd float %9, %11
%31 = fadd float %30, 1.000000e+00
%32 = tail call i32 @sqrt(float %31)
%33 = tail call float @atan2(float %29, i32 %32)
%34 = fadd float %28, %33
ret float %34
}