#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 */
double asin(double);
double atan(double);
double cos(double);
double sin(double);
double sqrt(double);
void gcproj(float *xf, float *yf, float *rlon, float *rlat, float *ref_rad,
            double *g0, double *b0, double *amat, double *ainv, int gflag) {
  double xp, yp, zp;
  double xg, yg, zg;
  double arg;
  double cosG, sinG;
  double cosB, sinB;
  double rperd = 0.017453292;
  if (gflag == 0) {
    arg = (*xf) / (*ref_rad) - (*b0);
    cosB = cos(arg);
    sinB = sin(arg);
    arg = (*yf) / (*ref_rad) - (*g0);
    cosG = cos(arg);
    sinG = sin(arg);
    arg = sqrt(1.0 + sinB * sinB * sinG * sinG);
    xp = sinG * cosB * arg;
    yp = sinB * cosG * arg;
    zp = sqrt(1.0 - xp * xp - yp * yp);
    xg = xp * amat[0] + yp * amat[1] + zp * amat[2];
    yg = xp * amat[3] + yp * amat[4] + zp * amat[5];
    zg = xp * amat[6] + yp * amat[7] + zp * amat[8];
    if (zg != (double)(0.0)) {
      arg = sqrt(xg * xg + yg * yg) / zg;
      (*rlat) = 90.0 - atan(arg) / rperd;
      if (zg < (double)(0.0))
        (*rlat) = (*rlat) - 180.0;
    } else
      (*rlat) = 0.0;
    if (xg != (double)(0.0)) {
      arg = yg / xg;
      (*rlon) = atan(arg) / rperd;
    } else
      (*rlon) = 0.0;
    if (xg < (double)(0.0))
      (*rlon) = (*rlon) - 180.0;
    while ((*rlon) < (double)(-180.0))
      (*rlon) = (*rlon) + 360.0;
  } else {
    arg = (*rlon) * rperd;
    cosG = cos(arg);
    sinG = sin(arg);
    arg = (90.0 - (*rlat)) * rperd;
    cosB = cos(arg);
    sinB = sin(arg);
    xg = sinB * cosG;
    yg = sinB * sinG;
    zg = cosB;
    xp = xg * ainv[0] + yg * ainv[1] + zg * ainv[2];
    yp = xg * ainv[3] + yg * ainv[4] + zg * ainv[5];
    zp = xg * ainv[6] + yg * ainv[7] + zg * ainv[8];
    sinG = xp / sqrt(1.0 - yp * yp);
    sinB = yp / sqrt(1.0 - xp * xp);
    *xf = (double)(*ref_rad) * (asin(sinB) + (*b0));
    *yf = (double)(*ref_rad) * (asin(sinG) + (*g0));
  }
}


x86 assembly (clang, -O0):
<gcproj>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  0xe76(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cmpl   $0x0,0x28(%rbp)
jne    1530 <gcproj+0x3e0>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
divss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
divss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdc5(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xd5f(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm0
mov    0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
movsd  -0x40(%rbp),%xmm0
mov    0x18(%rbp),%rax
mulsd  0x20(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  0x28(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    0x18(%rbp),%rax
movsd  0x30(%rax),%xmm2
movsd  -0x40(%rbp),%xmm0
mov    0x18(%rbp),%rax
mulsd  0x38(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  0x40(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13b9 <gcproj+0x269>
jp     13b9 <gcproj+0x269>
jmp    1448 <gcproj+0x2f8>
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
divsd  -0x90(%rbp),%xmm1
ff
movsd  0xc0f(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1443 <gcproj+0x2f3>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbe5(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1453 <gcproj+0x303>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1470 <gcproj+0x320>
jp     1470 <gcproj+0x320>
jmp    14a2 <gcproj+0x352>
movsd  -0x58(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1040 <atan@plt>
divsd  -0x90(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    14ad <gcproj+0x35d>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    14df <gcproj+0x38f>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb49(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    14e4 <gcproj+0x394>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb28(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    152b <gcproj+0x3db>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb12(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    14e4 <gcproj+0x394>
jmp    17cd <gcproj+0x67d>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xa95(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm1
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x50(%rbp),%xmm1
mov    0x20(%rbp),%rax
movsd  0x18(%rax),%xmm2
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
mulsd  0x20(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  0x28(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm1
mov    0x20(%rbp),%rax
movsd  0x30(%rax),%xmm2
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
mulsd  0x38(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  0x40(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x937(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x8e0(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1050 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
addsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1050 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
addsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcproj>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rsi,%r13
mov    %rdi,%rbp
mov    0x60(%rsp),%rax
cmpl   $0x0,0x78(%rsp)
je     1283 <gcproj+0x133>
mov    0x70(%rsp),%r14
movss  (%rdx),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe6e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movss  (%r15),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  0xe2f(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm3
mulsd  %xmm0,%xmm3
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%r14),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
movsd  (%r14),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%r14),%xmm4
movsd  0x8(%rsp),%xmm5
mulsd  %xmm5,%xmm4
addsd  %xmm1,%xmm4
mulsd  0x20(%r14),%xmm2
movapd %xmm3,%xmm0
mulsd  0x18(%r14),%xmm0
movapd %xmm5,%xmm1
mulsd  0x28(%r14),%xmm1
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm1,%xmm1
movsd  0xdac(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jb     1325 <gcproj+0x1d5>
sqrtsd %xmm0,%xmm0
jmp    1342 <gcproj+0x1f2>
mov    %rdx,%r14
movss  0x0(%rbp),%xmm0
divss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movss  0x0(%r13),%xmm1
divss  (%rbx),%xmm1
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
subsd  (%r12),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm4
movapd %xmm0,%xmm5
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm5,%xmm0
addsd  0xd02(%rip),%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jb     13dd <gcproj+0x28d>
sqrtsd %xmm0,%xmm0
jmp    13f8 <gcproj+0x2a8>
movsd  %xmm4,0x10(%rsp)
call   1070 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0xcd4(%rip),%xmm2
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm4,%xmm4
subsd  %xmm4,%xmm2
ucomisd %xmm3,%xmm2
jb     1367 <gcproj+0x217>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    1370 <gcproj+0x220>
movapd %xmm2,%xmm0
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
call   1050 <asin@plt>
mov    0x60(%rsp),%rax
addsd  (%rax),%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x0(%rbp)
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <asin@plt>
addsd  (%r12),%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x0(%r13)
jmp    15be <gcproj+0x46e>
movsd  %xmm5,0x18(%rsp)
call   1070 <sqrt@plt>
movsd  0x18(%rsp),%xmm5
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mov    0x68(%rsp),%rbx
mulsd  %xmm5,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xbe7(%rip),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
subsd  %xmm1,%xmm0
ucomisd %xmm3,%xmm0
jb     1448 <gcproj+0x2f8>
xorps  %xmm5,%xmm5
sqrtsd %xmm0,%xmm5
jmp    1469 <gcproj+0x319>
movsd  %xmm2,0x10(%rsp)
movsd  %xmm4,0x8(%rsp)
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm5
movsd  0x8(%rbx),%xmm0
mulsd  %xmm4,%xmm0
movsd  (%rbx),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rbx),%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm1,%xmm3
movsd  0x20(%rbx),%xmm0
mulsd  %xmm4,%xmm0
movsd  0x18(%rbx),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x28(%rbx),%xmm6
mulsd  %xmm5,%xmm6
mulsd  0x38(%rbx),%xmm4
mulsd  0x30(%rbx),%xmm2
addsd  %xmm1,%xmm6
addsd  %xmm4,%xmm2
mulsd  0x40(%rbx),%xmm5
addsd  %xmm2,%xmm5
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm5
movsd  %xmm3,0x8(%rsp)
jne    14d7 <gcproj+0x387>
jnp    1503 <gcproj+0x3b3>
movapd %xmm6,%xmm2
mulsd  %xmm6,%xmm2
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
movsd  %xmm5,0x10(%rsp)
movsd  %xmm6,0x18(%rsp)
jb     1509 <gcproj+0x3b9>
sqrtsd %xmm0,%xmm0
jmp    1514 <gcproj+0x3c4>
xorpd  %xmm0,%xmm0
jmp    1556 <gcproj+0x406>
call   1070 <sqrt@plt>
movsd  0x10(%rsp),%xmm5
divsd  %xmm5,%xmm0
call   1040 <atan@plt>
divsd  0xaf3(%rip),%xmm0
addsd  0xadb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15)
xorpd  %xmm1,%xmm1
ucomisd 0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm3
movsd  0x18(%rsp),%xmm6
jbe    155b <gcproj+0x40b>
addss  0xaca(%rip),%xmm0
movss  %xmm0,(%r15)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jne    1567 <gcproj+0x417>
jnp    158c <gcproj+0x43c>
divsd  %xmm3,%xmm6
movapd %xmm6,%xmm0
call   1040 <atan@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm3
divsd  0xa7a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
jmp    158f <gcproj+0x43f>
xorps  %xmm0,%xmm0
ucomisd %xmm3,%xmm1
movss  0xa85(%rip),%xmm1
jbe    15a1 <gcproj+0x451>
addss  %xmm1,%xmm0
ucomiss %xmm0,%xmm1
jbe    15b9 <gcproj+0x469>
movss  0xa76(%rip),%xmm2
xchg   %ax,%ax
addss  %xmm2,%xmm0
ucomiss %xmm0,%xmm1
ja     15b0 <gcproj+0x460>
movss  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @gcproj(float* %0, float* %1, float* %2, float* %3, float* %4, double* %5, double* %6, double* %7, double* %8, i32 %9) {
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store float* %0, float** %11
store float* %1, float** %12
store float* %2, float** %13
store float* %3, float** %14
store float* %4, float** %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store i32 %9, i32* %20
store double 0x3F91DF469963E11D, double* %32
%33 = load i32, i32* %20
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %204
35: ; preds = %10
%36 = load float*, float** %11
%37 = load float, float* %36
%38 = load float*, float** %15
%39 = load float, float* %38
%40 = fdiv float %37, %39
%41 = fpext float %40 to double
%42 = load double*, double** %17
%43 = load double, double* %42
%44 = fsub double %41, %43
store double %44, double* %27
%45 = load double, double* %27
%46 = call double @cos(double %45)
store double %46, double* %30
%47 = load double, double* %27
%48 = call double @sin(double %47)
store double %48, double* %31
%49 = load float*, float** %12
%50 = load float, float* %49
%51 = load float*, float** %15
%52 = load float, float* %51
%53 = fdiv float %50, %52
%54 = fpext float %53 to double
%55 = load double*, double** %16
%56 = load double, double* %55
%57 = fsub double %54, %56
store double %57, double* %27
%58 = load double, double* %27
%59 = call double @cos(double %58)
store double %59, double* %28
%60 = load double, double* %27
%61 = call double @sin(double %60)
store double %61, double* %29
%62 = load double, double* %31
%63 = load double, double* %31
%64 = fmul double %62, %63
%65 = load double, double* %29
%66 = fmul double %64, %65
%67 = load double, double* %29
%68 = call double @llvm.fmuladd.f64(double %66, double %67, double 1.000000e+00)
%69 = call double @sqrt(double %68)
store double %69, double* %27
%70 = load double, double* %29
%71 = load double, double* %30
%72 = fmul double %70, %71
%73 = load double, double* %27
%74 = fmul double %72, %73
store double %74, double* %21
%75 = load double, double* %31
%76 = load double, double* %28
%77 = fmul double %75, %76
%78 = load double, double* %27
%79 = fmul double %77, %78
store double %79, double* %22
%80 = load double, double* %21
%81 = load double, double* %21
%82 = fneg double %80
%83 = call double @llvm.fmuladd.f64(double %82, double %81, double 1.000000e+00)
%84 = load double, double* %22
%85 = load double, double* %22
%86 = fneg double %84
%87 = call double @llvm.fmuladd.f64(double %86, double %85, double %83)
%88 = call double @sqrt(double %87)
store double %88, double* %23
%89 = load double, double* %21
%90 = load double*, double** %18
%91 = getelementptr inbounds double, double* %90, i64 0
%92 = load double, double* %91
%93 = load double, double* %22
%94 = load double*, double** %18
%95 = getelementptr inbounds double, double* %94, i64 1
%96 = load double, double* %95
%97 = fmul double %93, %96
%98 = call double @llvm.fmuladd.f64(double %89, double %92, double %97)
%99 = load double, double* %23
%100 = load double*, double** %18
%101 = getelementptr inbounds double, double* %100, i64 2
%102 = load double, double* %101
%103 = call double @llvm.fmuladd.f64(double %99, double %102, double %98)
store double %103, double* %24
%104 = load double, double* %21
%105 = load double*, double** %18
%106 = getelementptr inbounds double, double* %105, i64 3
%107 = load double, double* %106
%108 = load double, double* %22
%109 = load double*, double** %18
%110 = getelementptr inbounds double, double* %109, i64 4
%111 = load double, double* %110
%112 = fmul double %108, %111
%113 = call double @llvm.fmuladd.f64(double %104, double %107, double %112)
%114 = load double, double* %23
%115 = load double*, double** %18
%116 = getelementptr inbounds double, double* %115, i64 5
%117 = load double, double* %116
%118 = call double @llvm.fmuladd.f64(double %114, double %117, double %113)
store double %118, double* %25
%119 = load double, double* %21
%120 = load double*, double** %18
%121 = getelementptr inbounds double, double* %120, i64 6
%122 = load double, double* %121
%123 = load double, double* %22
%124 = load double*, double** %18
%125 = getelementptr inbounds double, double* %124, i64 7
%126 = load double, double* %125
%127 = fmul double %123, %126
%128 = call double @llvm.fmuladd.f64(double %119, double %122, double %127)
%129 = load double, double* %23
%130 = load double*, double** %18
%131 = getelementptr inbounds double, double* %130, i64 8
%132 = load double, double* %131
%133 = call double @llvm.fmuladd.f64(double %129, double %132, double %128)
store double %133, double* %26
%134 = load double, double* %26
%135 = fcmp une double %134, 0.000000e+00
br i1 %135, label %136, label %163
136: ; preds = %35
%137 = load double, double* %24
%138 = load double, double* %24
%139 = load double, double* %25
%140 = load double, double* %25
%141 = fmul double %139, %140
%142 = call double @llvm.fmuladd.f64(double %137, double %138, double %141)
%143 = call double @sqrt(double %142)
%144 = load double, double* %26
%145 = fdiv double %143, %144
store double %145, double* %27
%146 = load double, double* %27
%147 = call double @atan(double %146)
%148 = load double, double* %32
%149 = fdiv double %147, %148
%150 = fsub double 9.000000e+01, %149
%151 = fptrunc double %150 to float
%152 = load float*, float** %14
store float %151, float* %152
%153 = load double, double* %26
%154 = fcmp olt double %153, 0.000000e+00
br i1 %154, label %155, label %162
155: ; preds = %136
%156 = load float*, float** %14
%157 = load float, float* %156
%158 = fpext float %157 to double
%159 = fsub double %158, 1.800000e+02
%160 = fptrunc double %159 to float
%161 = load float*, float** %14
store float %160, float* %161
br label %162
162: ; preds = %155, %136
br label %165
163: ; preds = %35
%164 = load float*, float** %14
store float 0.000000e+00, float* %164
br label %165
165: ; preds = %163, %162
%166 = load double, double* %24
%167 = fcmp une double %166, 0.000000e+00
br i1 %167, label %168, label %178
168: ; preds = %165
%169 = load double, double* %25
%170 = load double, double* %24
%171 = fdiv double %169, %170
store double %171, double* %27
%172 = load double, double* %27
%173 = call double @atan(double %172)
%174 = load double, double* %32
%175 = fdiv double %173, %174
%176 = fptrunc double %175 to float
%177 = load float*, float** %13
store float %176, float* %177
br label %180
178: ; preds = %165
%179 = load float*, float** %13
store float 0.000000e+00, float* %179
br label %180
180: ; preds = %178, %168
%181 = load double, double* %24
%182 = fcmp olt double %181, 0.000000e+00
br i1 %182, label %183, label %190
183: ; preds = %180
%184 = load float*, float** %13
%185 = load float, float* %184
%186 = fpext float %185 to double
%187 = fsub double %186, 1.800000e+02
%188 = fptrunc double %187 to float
%189 = load float*, float** %13
store float %188, float* %189
br label %190
190: ; preds = %183, %180
br label %191
191: ; preds = %196, %190
%192 = load float*, float** %13
%193 = load float, float* %192
%194 = fpext float %193 to double
%195 = fcmp olt double %194, -1.800000e+02
br i1 %195, label %196, label %203
196: ; preds = %191
%197 = load float*, float** %13
%198 = load float, float* %197
%199 = fpext float %198 to double
%200 = fadd double %199, 3.600000e+02
%201 = fptrunc double %200 to float
%202 = load float*, float** %13
store float %201, float* %202
br label %191
203: ; preds = %191
br label %312
204: ; preds = %10
%205 = load float*, float** %13
%206 = load float, float* %205
%207 = fpext float %206 to double
%208 = load double, double* %32
%209 = fmul double %207, %208
store double %209, double* %27
%210 = load double, double* %27
%211 = call double @cos(double %210)
store double %211, double* %28
%212 = load double, double* %27
%213 = call double @sin(double %212)
store double %213, double* %29
%214 = load float*, float** %14
%215 = load float, float* %214
%216 = fpext float %215 to double
%217 = fsub double 9.000000e+01, %216
%218 = load double, double* %32
%219 = fmul double %217, %218
store double %219, double* %27
%220 = load double, double* %27
%221 = call double @cos(double %220)
store double %221, double* %30
%222 = load double, double* %27
%223 = call double @sin(double %222)
store double %223, double* %31
%224 = load double, double* %31
%225 = load double, double* %28
%226 = fmul double %224, %225
store double %226, double* %24
%227 = load double, double* %31
%228 = load double, double* %29
%229 = fmul double %227, %228
store double %229, double* %25
%230 = load double, double* %30
store double %230, double* %26
%231 = load double, double* %24
%232 = load double*, double** %19
%233 = getelementptr inbounds double, double* %232, i64 0
%234 = load double, double* %233
%235 = load double, double* %25
%236 = load double*, double** %19
%237 = getelementptr inbounds double, double* %236, i64 1
%238 = load double, double* %237
%239 = fmul double %235, %238
%240 = call double @llvm.fmuladd.f64(double %231, double %234, double %239)
%241 = load double, double* %26
%242 = load double*, double** %19
%243 = getelementptr inbounds double, double* %242, i64 2
%244 = load double, double* %243
%245 = call double @llvm.fmuladd.f64(double %241, double %244, double %240)
store double %245, double* %21
%246 = load double, double* %24
%247 = load double*, double** %19
%248 = getelementptr inbounds double, double* %247, i64 3
%249 = load double, double* %248
%250 = load double, double* %25
%251 = load double*, double** %19
%252 = getelementptr inbounds double, double* %251, i64 4
%253 = load double, double* %252
%254 = fmul double %250, %253
%255 = call double @llvm.fmuladd.f64(double %246, double %249, double %254)
%256 = load double, double* %26
%257 = load double*, double** %19
%258 = getelementptr inbounds double, double* %257, i64 5
%259 = load double, double* %258
%260 = call double @llvm.fmuladd.f64(double %256, double %259, double %255)
store double %260, double* %22
%261 = load double, double* %24
%262 = load double*, double** %19
%263 = getelementptr inbounds double, double* %262, i64 6
%264 = load double, double* %263
%265 = load double, double* %25
%266 = load double*, double** %19
%267 = getelementptr inbounds double, double* %266, i64 7
%268 = load double, double* %267
%269 = fmul double %265, %268
%270 = call double @llvm.fmuladd.f64(double %261, double %264, double %269)
%271 = load double, double* %26
%272 = load double*, double** %19
%273 = getelementptr inbounds double, double* %272, i64 8
%274 = load double, double* %273
%275 = call double @llvm.fmuladd.f64(double %271, double %274, double %270)
store double %275, double* %23
%276 = load double, double* %21
%277 = load double, double* %22
%278 = load double, double* %22
%279 = fneg double %277
%280 = call double @llvm.fmuladd.f64(double %279, double %278, double 1.000000e+00)
%281 = call double @sqrt(double %280)
%282 = fdiv double %276, %281
store double %282, double* %29
%283 = load double, double* %22
%284 = load double, double* %21
%285 = load double, double* %21
%286 = fneg double %284
%287 = call double @llvm.fmuladd.f64(double %286, double %285, double 1.000000e+00)
%288 = call double @sqrt(double %287)
%289 = fdiv double %283, %288
store double %289, double* %31
%290 = load float*, float** %15
%291 = load float, float* %290
%292 = fpext float %291 to double
%293 = load double, double* %31
%294 = call double @asin(double %293)
%295 = load double*, double** %17
%296 = load double, double* %295
%297 = fadd double %294, %296
%298 = fmul double %292, %297
%299 = fptrunc double %298 to float
%300 = load float*, float** %11
store float %299, float* %300
%301 = load float*, float** %15
%302 = load float, float* %301
%303 = fpext float %302 to double
%304 = load double, double* %29
%305 = call double @asin(double %304)
%306 = load double*, double** %16
%307 = load double, double* %306
%308 = fadd double %305, %307
%309 = fmul double %303, %308
%310 = fptrunc double %309 to float
%311 = load float*, float** %12
store float %310, float* %311
br label %312
312: ; preds = %204, %203
ret void
}

LLVM IR (-O2):
define void @gcproj(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, i32 %9) {
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %100
12: ; preds = %10
%13 = load float, float* %0
%14 = load float, float* %4
%15 = fdiv float %13, %14
%16 = fpext float %15 to double
%17 = load double, double* %6
%18 = fsub double %16, %17
%19 = tail call double @cos(double %18)
%20 = tail call double @sin(double %18)
%21 = load float, float* %1
%22 = load float, float* %4
%23 = fdiv float %21, %22
%24 = fpext float %23 to double
%25 = load double, double* %5
%26 = fsub double %24, %25
%27 = tail call double @cos(double %26)
%28 = tail call double @sin(double %26)
%29 = fmul double %20, %20
%30 = fmul double %29, %28
%31 = tail call double @llvm.fmuladd.f64(double %30, double %28, double 1.000000e+00)
%32 = tail call double @sqrt(double %31)
%33 = fmul double %19, %28
%34 = fmul double %33, %32
%35 = fmul double %20, %27
%36 = fmul double %35, %32
%37 = fneg double %34
%38 = tail call double @llvm.fmuladd.f64(double %37, double %34, double 1.000000e+00)
%39 = fneg double %36
%40 = tail call double @llvm.fmuladd.f64(double %39, double %36, double %38)
%41 = tail call double @sqrt(double %40)
%42 = load double, double* %7
%43 = getelementptr inbounds double, double* %7, i64 1
%44 = load double, double* %43
%45 = fmul double %36, %44
%46 = tail call double @llvm.fmuladd.f64(double %34, double %42, double %45)
%47 = getelementptr inbounds double, double* %7, i64 2
%48 = load double, double* %47
%49 = tail call double @llvm.fmuladd.f64(double %41, double %48, double %46)
%50 = getelementptr inbounds double, double* %7, i64 3
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %7, i64 4
%53 = load double, double* %52
%54 = fmul double %36, %53
%55 = tail call double @llvm.fmuladd.f64(double %34, double %51, double %54)
%56 = getelementptr inbounds double, double* %7, i64 5
%57 = load double, double* %56
%58 = tail call double @llvm.fmuladd.f64(double %41, double %57, double %55)
%59 = getelementptr inbounds double, double* %7, i64 6
%60 = load double, double* %59
%61 = getelementptr inbounds double, double* %7, i64 7
%62 = load double, double* %61
%63 = fmul double %36, %62
%64 = tail call double @llvm.fmuladd.f64(double %34, double %60, double %63)
%65 = getelementptr inbounds double, double* %7, i64 8
%66 = load double, double* %65
%67 = tail call double @llvm.fmuladd.f64(double %41, double %66, double %64)
%68 = fcmp une double %67, 0.000000e+00
br i1 %68, label %69, label %81
69: ; preds = %12
%70 = fmul double %58, %58
%71 = tail call double @llvm.fmuladd.f64(double %49, double %49, double %70)
%72 = tail call double @sqrt(double %71)
%73 = fdiv double %72, %67
%74 = tail call double @atan(double %73)
%75 = fdiv double %74, 0x3F91DF469963E11D
%76 = fsub double 9.000000e+01, %75
%77 = fptrunc double %76 to float
store float %77, float* %3
%78 = fcmp olt double %67, 0.000000e+00
br i1 %78, label %79, label %83
79: ; preds = %69
%80 = fadd float %77, -1.800000e+02
br label %81
81: ; preds = %12, %79
%82 = phi float [ %80, %79 ], [ 0.000000e+00, %12 ]
store float %82, float* %3
br label %83
83: ; preds = %81, %69
%84 = fcmp une double %49, 0.000000e+00
br i1 %84, label %85, label %90
85: ; preds = %83
%86 = fdiv double %58, %49
%87 = tail call double @atan(double %86)
%88 = fdiv double %87, 0x3F91DF469963E11D
%89 = fptrunc double %88 to float
br label %90
90: ; preds = %83, %85
%91 = phi float [ %89, %85 ], [ 0.000000e+00, %83 ]
%92 = fcmp olt double %49, 0.000000e+00
%93 = fadd float %91, -1.800000e+02
%94 = select i1 %92, float %93, float %91
%95 = fcmp olt float %94, -1.800000e+02
br i1 %95, label %96, label %153
96: ; preds = %90, %96
%97 = phi float [ %98, %96 ], [ %94, %90 ]
%98 = fadd float %97, 3.600000e+02
%99 = fcmp olt float %98, -1.800000e+02
br i1 %99, label %96, label %153
100: ; preds = %10
%101 = load float, float* %2
%102 = fpext float %101 to double
%103 = fmul double %102, 0x3F91DF469963E11D
%104 = tail call double @cos(double %103)
%105 = tail call double @sin(double %103)
%106 = load float, float* %3
%107 = fpext float %106 to double
%108 = fsub double 9.000000e+01, %107
%109 = fmul double %108, 0x3F91DF469963E11D
%110 = tail call double @cos(double %109)
%111 = tail call double @sin(double %109)
%112 = fmul double %104, %111
%113 = fmul double %105, %111
%114 = load double, double* %8
%115 = getelementptr inbounds double, double* %8, i64 1
%116 = load double, double* %115
%117 = fmul double %113, %116
%118 = tail call double @llvm.fmuladd.f64(double %112, double %114, double %117)
%119 = getelementptr inbounds double, double* %8, i64 2
%120 = load double, double* %119
%121 = tail call double @llvm.fmuladd.f64(double %110, double %120, double %118)
%122 = getelementptr inbounds double, double* %8, i64 3
%123 = load double, double* %122
%124 = getelementptr inbounds double, double* %8, i64 4
%125 = load double, double* %124
%126 = fmul double %113, %125
%127 = tail call double @llvm.fmuladd.f64(double %112, double %123, double %126)
%128 = getelementptr inbounds double, double* %8, i64 5
%129 = load double, double* %128
%130 = tail call double @llvm.fmuladd.f64(double %110, double %129, double %127)
%131 = fneg double %130
%132 = tail call double @llvm.fmuladd.f64(double %131, double %130, double 1.000000e+00)
%133 = tail call double @sqrt(double %132)
%134 = fdiv double %121, %133
%135 = fneg double %121
%136 = tail call double @llvm.fmuladd.f64(double %135, double %121, double 1.000000e+00)
%137 = tail call double @sqrt(double %136)
%138 = fdiv double %130, %137
%139 = load float, float* %4
%140 = fpext float %139 to double
%141 = tail call double @asin(double %138)
%142 = load double, double* %6
%143 = fadd double %141, %142
%144 = fmul double %143, %140
%145 = fptrunc double %144 to float
store float %145, float* %0
%146 = load float, float* %4
%147 = fpext float %146 to double
%148 = tail call double @asin(double %134)
%149 = load double, double* %5
%150 = fadd double %148, %149
%151 = fmul double %150, %147
%152 = fptrunc double %151 to float
store float %152, float* %1
br label %155
153: ; preds = %96, %90
%154 = phi float [ %94, %90 ], [ %98, %96 ]
store float %154, float* %2
br label %155
155: ; preds = %153, %100
ret void
}