#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 M_PI;
double cos(double);
double fabs(double);
scalar_t__ floor(int);
scalar_t__ fmod(int, int);
int /*<<< orphan*/ mk_xy2pix(int *, int *);
int pow(long const, int);
double sqrt(int);
void ang2pix_nest(const long nside, double theta, double phi, long *ipix) {
  double z, za, z0, tt, tp, tmp;
  int face_num, jp, jm;
  long ifp, ifm;
  int ix, iy, ix_low, ix_hi, iy_low, iy_hi, ipf, ntt;
  double piover2 = 0.5 * M_PI, twopi = 2.0 * M_PI;
  int ns_max = 8192;
  static int x2pix[128], y2pix[128];
  static char setup_done = 0;
  if (!setup_done) {
    mk_xy2pix(x2pix, y2pix);
    setup_done = 1;
  }
  z = cos(theta);
  za = fabs(z);
  z0 = 2. / 3.;
  if (phi >= twopi)
    phi = phi - twopi;
  if (phi < 0.)
    phi = phi + twopi;
  tt = phi / piover2;
  if (za <= z0) {
    jp = (int)floor(ns_max * (0.5 + tt - z * 0.75));
    jm = (int)floor(ns_max * (0.5 + tt + z * 0.75));
    ifp = jp / ns_max;
    ifm = jm / ns_max;
    if (ifp == ifm)
      face_num = (int)fmod(ifp, 4) + 4;
    else if (ifp < ifm)
      face_num = (int)fmod(ifp, 4);
    else
      face_num = (int)fmod(ifm, 4) + 8;
    ix = (int)fmod(jm, ns_max);
    iy = ns_max - (int)fmod(jp, ns_max) - 1;
  } else {
    ntt = (int)floor(tt);
    if (ntt >= 4)
      ntt = 3;
    tp = tt - ntt;
    tmp = sqrt(3. * (1. - za));
    jp = (int)floor(ns_max * tp * tmp);
    jm = (int)floor(ns_max * (1. - tp) * tmp);
    jp = (int)(jp < ns_max - 1 ? jp : ns_max - 1);
    jm = (int)(jm < ns_max - 1 ? jm : ns_max - 1);
    if (z >= 0) {
      face_num = ntt;
      ix = ns_max - jm - 1;
      iy = ns_max - jp - 1;
    } else {
      face_num = ntt + 8;
      ix = jp;
      iy = jm;
    }
  }
  ix_low = (int)fmod(ix, 128);
  ix_hi = ix / 128;
  iy_low = (int)fmod(iy, 128);
  iy_hi = iy / 128;
  ipf = (x2pix[ix_hi] + y2pix[iy_hi]) * (128 * 128) +
        (x2pix[ix_low] + y2pix[iy_low]);
  ipf = (long)(ipf / pow(ns_max / nside, 2));
  *ipix = (long)(ipf + face_num * pow(nside, 2));
}


x86 assembly (clang, -O0):
<ang2pix_nest>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  0xe83(%rip),%xmm0
mov    0x2e5c(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe60(%rip),%xmm0
mov    0x2e41(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x2000,-0xa4(%rbp)
cmpb   $0x0,0x32ac(%rip)
jne    11e4 <ang2pix_nest+0x84>
lea    0x2e9f(%rip),%rdi
lea    0x3098(%rip),%rsi
call   1040 <mk_xy2pix@plt>
movb   $0x1,0x328c(%rip)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xe31(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe00(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jb     123a <ang2pix_nest+0xda>
movsd  -0x18(%rbp),%xmm0
subsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    125a <ang2pix_nest+0xfa>
movsd  -0x18(%rbp),%xmm0
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     13d6 <ang2pix_nest+0x276>
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
movsd  0xd78(%rip),%xmm2
addsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd6f(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
mov    %eax,-0x58(%rbp)
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
movsd  0xd27(%rip),%xmm2
addsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  0xd35(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
cltd
idivl  -0xa4(%rbp)
cltq
mov    %rax,-0x68(%rbp)
mov    -0x5c(%rbp),%eax
cltd
idivl  -0xa4(%rbp)
cltq
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x70(%rbp),%rax
jne    1354 <ang2pix_nest+0x1f4>
mov    -0x68(%rbp),%rax
mov    %eax,%edi
mov    $0x4,%esi
call   1030 <fmod@plt>
add    $0x4,%eax
mov    %eax,-0x54(%rbp)
jmp    1395 <ang2pix_nest+0x235>
mov    -0x68(%rbp),%rax
cmp    -0x70(%rbp),%rax
jge    137a <ang2pix_nest+0x21a>
mov    -0x68(%rbp),%rax
mov    %eax,%edi
mov    $0x4,%esi
call   1030 <fmod@plt>
mov    %eax,-0x54(%rbp)
jmp    1390 <ang2pix_nest+0x230>
mov    -0x70(%rbp),%rax
mov    %eax,%edi
mov    $0x4,%esi
call   1030 <fmod@plt>
add    $0x8,%eax
mov    %eax,-0x54(%rbp)
jmp    1395 <ang2pix_nest+0x235>
mov    -0x5c(%rbp),%edi
mov    -0xa4(%rbp),%esi
call   1030 <fmod@plt>
mov    %eax,-0x74(%rbp)
mov    -0xa4(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x58(%rbp),%edi
mov    -0xa4(%rbp),%esi
call   1030 <fmod@plt>
mov    %rax,%rcx
mov    -0xa8(%rbp),%eax
sub    %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1551 <ang2pix_nest+0x3f1>
cvttsd2si -0x40(%rbp),%edi
call   1080 <floor@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0x4,-0x90(%rbp)
jl     13fd <ang2pix_nest+0x29d>
movl   $0x3,-0x90(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x90(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xbfd(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xbf8(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
mov    %eax,-0x58(%rbp)
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
movsd  0xbb0(%rip),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x50(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
mov    -0xa4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14a4 <ang2pix_nest+0x344>
mov    -0x58(%rbp),%eax
mov    %eax,-0xac(%rbp)
jmp    14b3 <ang2pix_nest+0x353>
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xac(%rbp)
mov    -0xac(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0xa4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14de <ang2pix_nest+0x37e>
mov    -0x5c(%rbp),%eax
mov    %eax,-0xb0(%rbp)
jmp    14ed <ang2pix_nest+0x38d>
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1534 <ang2pix_nest+0x3d4>
mov    -0x90(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0xa4(%rbp),%eax
sub    -0x5c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0xa4(%rbp),%eax
sub    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    154c <ang2pix_nest+0x3ec>
mov    -0x90(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x54(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    1551 <ang2pix_nest+0x3f1>
mov    -0x74(%rbp),%edi
mov    $0x80,%esi
call   1030 <fmod@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x78(%rbp),%edi
mov    $0x80,%esi
call   1030 <fmod@plt>
mov    %eax,-0x84(%rbp)
mov    -0x78(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
movslq -0x80(%rbp),%rcx
lea    0x2ad2(%rip),%rax
mov    (%rax,%rcx,4),%eax
movslq -0x88(%rbp),%rdx
lea    0x2cc1(%rip),%rcx
add    (%rcx,%rdx,4),%eax
shl    $0xe,%eax
movslq -0x7c(%rbp),%rdx
lea    0x2ab0(%rip),%rcx
mov    (%rcx,%rdx,4),%ecx
movslq -0x84(%rbp),%rsi
lea    0x2c9f(%rip),%rdx
add    (%rdx,%rsi,4),%ecx
add    %ecx,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0xbc(%rbp)
movslq -0xa4(%rbp),%rax
cqto
idivq  -0x8(%rbp)
mov    %rax,%rdi
mov    $0x2,%esi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
cltd
idiv   %ecx
cltq
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <pow@plt>
mov    -0xb8(%rbp),%ecx
mov    %eax,%edx
mov    -0xb4(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
movslq %eax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ang2pix_nest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,0x40(%rsp)
movsd  %xmm1,(%rsp)
mov    %rdi,%r15
mov    0x2e66(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xe72(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%rsp)
addsd  %xmm1,%xmm1
movapd %xmm1,0x10(%rsp)
cmpb   $0x0,0x32c7(%rip)
jne    11d1 <ang2pix_nest+0x71>
lea    0x2ebe(%rip),%rdi
lea    0x30b7(%rip),%rsi
movsd  %xmm0,0x38(%rsp)
call   1040 <mk_xy2pix@plt>
movsd  0x38(%rsp),%xmm0
movb   $0x1,0x329f(%rip)
call   1050 <cos@plt>
movapd 0xe62(%rip),%xmm4
andpd  %xmm0,%xmm4
movapd 0x10(%rsp),%xmm5
movapd %xmm5,%xmm1
movsd  (%rsp),%xmm3
cmpnlesd %xmm3,%xmm1
andnpd %xmm5,%xmm1
subsd  %xmm1,%xmm3
xorpd  %xmm1,%xmm1
movapd %xmm3,%xmm2
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm5
movsd  0xdf1(%rip),%xmm1
andnpd %xmm1,%xmm2
orpd   %xmm5,%xmm2
addsd  %xmm3,%xmm2
divsd  0x20(%rsp),%xmm2
movsd  0xddf(%rip),%xmm1
ucomisd %xmm4,%xmm1
jae    1315 <ang2pix_nest+0x1b5>
cvttsd2si %xmm2,%edi
movapd %xmm0,0x20(%rsp)
movapd %xmm2,(%rsp)
movapd %xmm4,0x10(%rsp)
call   1080 <floor@plt>
cmp    $0x3,%eax
mov    $0x3,%r12d
cmovl  %eax,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0xda8(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0xda2(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movapd (%rsp),%xmm1
mulsd  0xd76(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1080 <floor@plt>
mov    %rax,%rbp
movsd  0xd66(%rip),%xmm0
subsd  (%rsp),%xmm0
mulsd  0xd51(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
mov    %rax,%rbx
cmp    $0x1fff,%ebp
mov    $0x1fff,%eax
cmovge %eax,%ebp
cmp    $0x1fff,%ebx
cmovge %eax,%ebx
movapd 0x20(%rsp),%xmm0
ucomisd 0xd32(%rip),%xmm0
jae    13a0 <ang2pix_nest+0x240>
add    $0x8,%r12d
jmp    13f6 <ang2pix_nest+0x296>
addsd  0xce3(%rip),%xmm2
movapd %xmm2,(%rsp)
mulsd  0xcee(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  0xce0(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1080 <floor@plt>
mov    %rax,%r13
movapd 0x20(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xcc1(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
lea    0x1fff(%r13),%edi
test   %r13d,%r13d
cmovns %r13d,%edi
mov    %rax,%rbx
sar    $0xd,%edi
add    $0x1fff,%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0xd,%eax
cmp    %eax,%edi
jne    13af <ang2pix_nest+0x24f>
mov    $0x4,%esi
call   1030 <fmod@plt>
mov    %rax,%r12
add    $0x4,%r12d
jmp    13d3 <ang2pix_nest+0x273>
sub    %ebp,%eax
mov    $0x1fff,%ecx
sub    %ebx,%ecx
mov    %eax,%ebx
mov    %ecx,%ebp
jmp    13f6 <ang2pix_nest+0x296>
jge    13c0 <ang2pix_nest+0x260>
mov    $0x4,%esi
call   1030 <fmod@plt>
mov    %rax,%r12
jmp    13d3 <ang2pix_nest+0x273>
mov    %eax,%edi
mov    $0x4,%esi
call   1030 <fmod@plt>
mov    %rax,%r12
add    $0x8,%r12d
mov    %ebx,%edi
mov    $0x2000,%esi
call   1030 <fmod@plt>
mov    %rax,%rbp
mov    %r13d,%edi
mov    $0x2000,%esi
call   1030 <fmod@plt>
mov    $0x1fff,%ebx
sub    %eax,%ebx
mov    %ebp,%edi
mov    $0x80,%esi
call   1030 <fmod@plt>
mov    %rax,%r13
lea    0x7f(%rbp),%r14d
test   %ebp,%ebp
cmovns %ebp,%r14d
sar    $0x7,%r14d
mov    %ebx,%edi
mov    $0x80,%esi
call   1030 <fmod@plt>
lea    0x7f(%rbx),%ecx
test   %ebx,%ebx
cmovns %ebx,%ecx
sar    $0x7,%ecx
movslq %r14d,%rdx
lea    0x2c3c(%rip),%rsi
movslq %ecx,%rcx
lea    0x2e32(%rip),%rdi
mov    (%rdi,%rcx,4),%ecx
add    (%rsi,%rdx,4),%ecx
shl    $0xe,%ecx
movslq %r13d,%rdx
cltq
mov    (%rdi,%rax,4),%ebx
add    (%rsi,%rdx,4),%ebx
add    %ecx,%ebx
mov    %r15,%rax
shr    $0x20,%rax
je     1469 <ang2pix_nest+0x309>
mov    $0x2000,%eax
xor    %edx,%edx
idiv   %r15
jmp    1473 <ang2pix_nest+0x313>
mov    $0x2000,%eax
xor    %edx,%edx
div    %r15d
mov    %rax,%rdi
mov    $0x2,%esi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
mov    %r15,%rdi
mov    $0x2,%esi
call   1060 <pow@plt>
imul   %r12d,%eax
add    %ebx,%eax
cltq
mov    0x40(%rsp),%rcx
mov    %rax,(%rcx)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@ang2pix_nest.x2pix = internal global [128 x i32] zeroinitializer
@ang2pix_nest.y2pix = internal global [128 x i32] zeroinitializer
@ang2pix_nest.setup_done = internal global i8 0
define void @ang2pix_nest(i64 %0, double %1, double %2, i64* %3) {
%5 = alloca i64
%6 = alloca double
%7 = alloca double
%8 = alloca i64*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca double
%29 = alloca double
%30 = alloca i32
store i64 %0, i64* %5
store double %1, double* %6
store double %2, double* %7
store i64* %3, i64** %8
%31 = load double, double* @M_PI
%32 = fmul double 5.000000e-01, %31
store double %32, double* %28
%33 = load double, double* @M_PI
%34 = fmul double 2.000000e+00, %33
store double %34, double* %29
store i32 8192, i32* %30
%35 = load i8, i8* @ang2pix_nest.setup_done
%36 = icmp ne i8 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %4
%38 = call i32 @mk_xy2pix(i32* getelementptr inbounds ([128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 0), i32* getelementptr inbounds ([128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 0))
store i8 1, i8* @ang2pix_nest.setup_done
br label %39
39: ; preds = %37, %4
%40 = load double, double* %6
%41 = call double @cos(double %40)
store double %41, double* %9
%42 = load double, double* %9
%43 = call double @llvm.fabs.f64(double %42)
store double %43, double* %10
store double 0x3FE5555555555555, double* %11
%44 = load double, double* %7
%45 = load double, double* %29
%46 = fcmp oge double %44, %45
br i1 %46, label %47, label %51
47: ; preds = %39
%48 = load double, double* %7
%49 = load double, double* %29
%50 = fsub double %48, %49
store double %50, double* %7
br label %51
51: ; preds = %47, %39
%52 = load double, double* %7
%53 = fcmp olt double %52, 0.000000e+00
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = load double, double* %7
%56 = load double, double* %29
%57 = fadd double %55, %56
store double %57, double* %7
br label %58
58: ; preds = %54, %51
%59 = load double, double* %7
%60 = load double, double* %28
%61 = fdiv double %59, %60
store double %61, double* %12
%62 = load double, double* %10
%63 = load double, double* %11
%64 = fcmp ole double %62, %63
br i1 %64, label %65, label %132
65: ; preds = %58
%66 = load i32, i32* %30
%67 = sitofp i32 %66 to double
%68 = load double, double* %12
%69 = fadd double 5.000000e-01, %68
%70 = load double, double* %9
%71 = fneg double %70
%72 = call double @llvm.fmuladd.f64(double %71, double 7.500000e-01, double %69)
%73 = fmul double %67, %72
%74 = fptosi double %73 to i32
%75 = call i64 @floor(i32 %74)
%76 = trunc i64 %75 to i32
store i32 %76, i32* %16
%77 = load i32, i32* %30
%78 = sitofp i32 %77 to double
%79 = load double, double* %12
%80 = fadd double 5.000000e-01, %79
%81 = load double, double* %9
%82 = call double @llvm.fmuladd.f64(double %81, double 7.500000e-01, double %80)
%83 = fmul double %78, %82
%84 = fptosi double %83 to i32
%85 = call i64 @floor(i32 %84)
%86 = trunc i64 %85 to i32
store i32 %86, i32* %17
%87 = load i32, i32* %16
%88 = load i32, i32* %30
%89 = sdiv i32 %87, %88
%90 = sext i32 %89 to i64
store i64 %90, i64* %18
%91 = load i32, i32* %17
%92 = load i32, i32* %30
%93 = sdiv i32 %91, %92
%94 = sext i32 %93 to i64
store i64 %94, i64* %19
%95 = load i64, i64* %18
%96 = load i64, i64* %19
%97 = icmp eq i64 %95, %96
br i1 %97, label %98, label %104
98: ; preds = %65
%99 = load i64, i64* %18
%100 = trunc i64 %99 to i32
%101 = call i64 @fmod(i32 %100, i32 4)
%102 = trunc i64 %101 to i32
%103 = add nsw i32 %102, 4
store i32 %103, i32* %15
br label %120
104: ; preds = %65
%105 = load i64, i64* %18
%106 = load i64, i64* %19
%107 = icmp slt i64 %105, %106
br i1 %107, label %108, label %113
108: ; preds = %104
%109 = load i64, i64* %18
%110 = trunc i64 %109 to i32
%111 = call i64 @fmod(i32 %110, i32 4)
%112 = trunc i64 %111 to i32
store i32 %112, i32* %15
br label %119
113: ; preds = %104
%114 = load i64, i64* %19
%115 = trunc i64 %114 to i32
%116 = call i64 @fmod(i32 %115, i32 4)
%117 = trunc i64 %116 to i32
%118 = add nsw i32 %117, 8
store i32 %118, i32* %15
br label %119
119: ; preds = %113, %108
br label %120
120: ; preds = %119, %98
%121 = load i32, i32* %17
%122 = load i32, i32* %30
%123 = call i64 @fmod(i32 %121, i32 %122)
%124 = trunc i64 %123 to i32
store i32 %124, i32* %20
%125 = load i32, i32* %30
%126 = load i32, i32* %16
%127 = load i32, i32* %30
%128 = call i64 @fmod(i32 %126, i32 %127)
%129 = trunc i64 %128 to i32
%130 = sub nsw i32 %125, %129
%131 = sub nsw i32 %130, 1
store i32 %131, i32* %21
br label %209
132: ; preds = %58
%133 = load double, double* %12
%134 = fptosi double %133 to i32
%135 = call i64 @floor(i32 %134)
%136 = trunc i64 %135 to i32
store i32 %136, i32* %27
%137 = load i32, i32* %27
%138 = icmp sge i32 %137, 4
br i1 %138, label %139, label %140
139: ; preds = %132
store i32 3, i32* %27
br label %140
140: ; preds = %139, %132
%141 = load double, double* %12
%142 = load i32, i32* %27
%143 = sitofp i32 %142 to double
%144 = fsub double %141, %143
store double %144, double* %13
%145 = load double, double* %10
%146 = fsub double 1.000000e+00, %145
%147 = fmul double 3.000000e+00, %146
%148 = fptosi double %147 to i32
%149 = call double @sqrt(i32 %148)
store double %149, double* %14
%150 = load i32, i32* %30
%151 = sitofp i32 %150 to double
%152 = load double, double* %13
%153 = fmul double %151, %152
%154 = load double, double* %14
%155 = fmul double %153, %154
%156 = fptosi double %155 to i32
%157 = call i64 @floor(i32 %156)
%158 = trunc i64 %157 to i32
store i32 %158, i32* %16
%159 = load i32, i32* %30
%160 = sitofp i32 %159 to double
%161 = load double, double* %13
%162 = fsub double 1.000000e+00, %161
%163 = fmul double %160, %162
%164 = load double, double* %14
%165 = fmul double %163, %164
%166 = fptosi double %165 to i32
%167 = call i64 @floor(i32 %166)
%168 = trunc i64 %167 to i32
store i32 %168, i32* %17
%169 = load i32, i32* %16
%170 = load i32, i32* %30
%171 = sub nsw i32 %170, 1
%172 = icmp slt i32 %169, %171
br i1 %172, label %173, label %175
173: ; preds = %140
%174 = load i32, i32* %16
br label %178
175: ; preds = %140
%176 = load i32, i32* %30
%177 = sub nsw i32 %176, 1
br label %178
178: ; preds = %175, %173
%179 = phi i32 [ %174, %173 ], [ %177, %175 ]
store i32 %179, i32* %16
%180 = load i32, i32* %17
%181 = load i32, i32* %30
%182 = sub nsw i32 %181, 1
%183 = icmp slt i32 %180, %182
br i1 %183, label %184, label %186
184: ; preds = %178
%185 = load i32, i32* %17
br label %189
186: ; preds = %178
%187 = load i32, i32* %30
%188 = sub nsw i32 %187, 1
br label %189
189: ; preds = %186, %184
%190 = phi i32 [ %185, %184 ], [ %188, %186 ]
store i32 %190, i32* %17
%191 = load double, double* %9
%192 = fcmp oge double %191, 0.000000e+00
br i1 %192, label %193, label %203
193: ; preds = %189
%194 = load i32, i32* %27
store i32 %194, i32* %15
%195 = load i32, i32* %30
%196 = load i32, i32* %17
%197 = sub nsw i32 %195, %196
%198 = sub nsw i32 %197, 1
store i32 %198, i32* %20
%199 = load i32, i32* %30
%200 = load i32, i32* %16
%201 = sub nsw i32 %199, %200
%202 = sub nsw i32 %201, 1
store i32 %202, i32* %21
br label %208
203: ; preds = %189
%204 = load i32, i32* %27
%205 = add nsw i32 %204, 8
store i32 %205, i32* %15
%206 = load i32, i32* %16
store i32 %206, i32* %20
%207 = load i32, i32* %17
store i32 %207, i32* %21
br label %208
208: ; preds = %203, %193
br label %209
209: ; preds = %208, %120
%210 = load i32, i32* %20
%211 = call i64 @fmod(i32 %210, i32 128)
%212 = trunc i64 %211 to i32
store i32 %212, i32* %22
%213 = load i32, i32* %20
%214 = sdiv i32 %213, 128
store i32 %214, i32* %23
%215 = load i32, i32* %21
%216 = call i64 @fmod(i32 %215, i32 128)
%217 = trunc i64 %216 to i32
store i32 %217, i32* %24
%218 = load i32, i32* %21
%219 = sdiv i32 %218, 128
store i32 %219, i32* %25
%220 = load i32, i32* %23
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 %221
%223 = load i32, i32* %222
%224 = load i32, i32* %25
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 %225
%227 = load i32, i32* %226
%228 = add nsw i32 %223, %227
%229 = mul nsw i32 %228, 16384
%230 = load i32, i32* %22
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 %231
%233 = load i32, i32* %232
%234 = load i32, i32* %24
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 %235
%237 = load i32, i32* %236
%238 = add nsw i32 %233, %237
%239 = add nsw i32 %229, %238
store i32 %239, i32* %26
%240 = load i32, i32* %26
%241 = load i32, i32* %30
%242 = sext i32 %241 to i64
%243 = load i64, i64* %5
%244 = sdiv i64 %242, %243
%245 = call i32 @pow(i64 %244, i32 2)
%246 = sdiv i32 %240, %245
%247 = sext i32 %246 to i64
%248 = trunc i64 %247 to i32
store i32 %248, i32* %26
%249 = load i32, i32* %26
%250 = load i32, i32* %15
%251 = load i64, i64* %5
%252 = call i32 @pow(i64 %251, i32 2)
%253 = mul nsw i32 %250, %252
%254 = add nsw i32 %249, %253
%255 = sext i32 %254 to i64
%256 = load i64*, i64** %8
store i64 %255, i64* %256
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@ang2pix_nest.x2pix = internal global [128 x i32] zeroinitializer
@ang2pix_nest.y2pix = internal global [128 x i32] zeroinitializer
@ang2pix_nest.setup_done = internal unnamed_addr global i1 false
define void @ang2pix_nest(i64 %0, double %1, double %2, i64* nocapture writeonly %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, 5.000000e-01
%7 = fmul double %5, 2.000000e+00
%8 = load i1, i1* @ang2pix_nest.setup_done
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 @mk_xy2pix(i32* getelementptr inbounds ([128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 0), i32* getelementptr inbounds ([128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 0))
store i1 true, i1* @ang2pix_nest.setup_done
br label %11
11: ; preds = %9, %4
%12 = tail call double @cos(double %1)
%13 = tail call double @llvm.fabs.f64(double %12)
%14 = fcmp ugt double %7, %2
%15 = select i1 %14, double 0.000000e+00, double %7
%16 = fsub double %2, %15
%17 = fcmp olt double %16, 0.000000e+00
%18 = select i1 %17, double %7, double -0.000000e+00
%19 = fadd double %16, %18
%20 = fdiv double %19, %6
%21 = fcmp ugt double %13, 0x3FE5555555555555
br i1 %21, label %58, label %22
22: ; preds = %11
%23 = fadd double %20, 5.000000e-01
%24 = fneg double %12
%25 = tail call double @llvm.fmuladd.f64(double %24, double 7.500000e-01, double %23)
%26 = fmul double %25, 8.192000e+03
%27 = fptosi double %26 to i32
%28 = tail call i64 @floor(i32 %27)
%29 = trunc i64 %28 to i32
%30 = tail call double @llvm.fmuladd.f64(double %12, double 7.500000e-01, double %23)
%31 = fmul double %30, 8.192000e+03
%32 = fptosi double %31 to i32
%33 = tail call i64 @floor(i32 %32)
%34 = trunc i64 %33 to i32
%35 = sdiv i32 %29, 8192
%36 = sdiv i32 %34, 8192
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %22
%39 = tail call i64 @fmod(i32 %35, i32 4)
%40 = trunc i64 %39 to i32
%41 = add nsw i32 %40, 4
br label %51
42: ; preds = %22
%43 = icmp slt i32 %35, %36
br i1 %43, label %44, label %47
44: ; preds = %42
%45 = tail call i64 @fmod(i32 %35, i32 4)
%46 = trunc i64 %45 to i32
br label %51
47: ; preds = %42
%48 = tail call i64 @fmod(i32 %36, i32 4)
%49 = trunc i64 %48 to i32
%50 = add nsw i32 %49, 8
br label %51
51: ; preds = %44, %47, %38
%52 = phi i32 [ %41, %38 ], [ %46, %44 ], [ %50, %47 ]
%53 = tail call i64 @fmod(i32 %34, i32 8192)
%54 = trunc i64 %53 to i32
%55 = tail call i64 @fmod(i32 %29, i32 8192)
%56 = trunc i64 %55 to i32
%57 = sub i32 8191, %56
br label %91
58: ; preds = %11
%59 = fptosi double %20 to i32
%60 = tail call i64 @floor(i32 %59)
%61 = trunc i64 %60 to i32
%62 = icmp slt i32 %61, 3
%63 = select i1 %62, i32 %61, i32 3
%64 = sitofp i32 %63 to double
%65 = fsub double %20, %64
%66 = fsub double 1.000000e+00, %13
%67 = fmul double %66, 3.000000e+00
%68 = fptosi double %67 to i32
%69 = tail call double @sqrt(i32 %68)
%70 = fmul double %65, 8.192000e+03
%71 = fmul double %69, %70
%72 = fptosi double %71 to i32
%73 = tail call i64 @floor(i32 %72)
%74 = trunc i64 %73 to i32
%75 = fsub double 1.000000e+00, %65
%76 = fmul double %75, 8.192000e+03
%77 = fmul double %69, %76
%78 = fptosi double %77 to i32
%79 = tail call i64 @floor(i32 %78)
%80 = trunc i64 %79 to i32
%81 = icmp slt i32 %74, 8191
%82 = select i1 %81, i32 %74, i32 8191
%83 = icmp slt i32 %80, 8191
%84 = select i1 %83, i32 %80, i32 8191
%85 = fcmp ult double %12, 0.000000e+00
br i1 %85, label %89, label %86
86: ; preds = %58
%87 = sub i32 8191, %84
%88 = sub i32 8191, %82
br label %91
89: ; preds = %58
%90 = add nsw i32 %63, 8
br label %91
91: ; preds = %86, %89, %51
%92 = phi i32 [ %57, %51 ], [ %88, %86 ], [ %84, %89 ]
%93 = phi i32 [ %54, %51 ], [ %87, %86 ], [ %82, %89 ]
%94 = phi i32 [ %52, %51 ], [ %63, %86 ], [ %90, %89 ]
%95 = tail call i64 @fmod(i32 %93, i32 128)
%96 = sdiv i32 %93, 128
%97 = tail call i64 @fmod(i32 %92, i32 128)
%98 = sdiv i32 %92, 128
%99 = sext i32 %96 to i64
%100 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = sext i32 %98 to i64
%103 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 %102
%104 = load i32, i32* %103
%105 = add nsw i32 %104, %101
%106 = shl nsw i32 %105, 14
%107 = shl i64 %95, 32
%108 = ashr exact i64 %107, 32
%109 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.x2pix, i64 0, i64 %108
%110 = load i32, i32* %109
%111 = shl i64 %97, 32
%112 = ashr exact i64 %111, 32
%113 = getelementptr inbounds [128 x i32], [128 x i32]* @ang2pix_nest.y2pix, i64 0, i64 %112
%114 = load i32, i32* %113
%115 = add nsw i32 %114, %110
%116 = add nsw i32 %115, %106
%117 = sdiv i64 8192, %0
%118 = tail call i32 @pow(i64 %117, i32 2)
%119 = sdiv i32 %116, %118
%120 = tail call i32 @pow(i64 %0, i32 2)
%121 = mul nsw i32 %120, %94
%122 = add nsw i32 %121, %119
%123 = sext i32 %122 to i64
store i64 %123, i64* %3
ret void
}