#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 cos(double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
double fabs(double);
double floor(long const);
int fmod(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, long const);
double sqrt(int);
int /*<<< orphan*/ stderr;
void ang2pix_ring(const long nside, double theta, double phi, long *ipix) {
  int nl2, nl4, ncap, npix, jp, jm, ipix1;
  double z, za, tt, tp, tmp;
  int ir, ip, kshift;
  double piover2 = 0.5 * 3.14159265358979323846;
  double PI = 3.14159265358979323846;
  double twopi = 2.0 * 3.14159265358979323846;
  double z0 = 2.0 / 3.0;
  long ns_max = 8192;
  if (nside < 1 || nside > ns_max) {
    fprintf(stderr, "%s (%d): nside out of range: %ld\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/ezralanglois/arachnid/refs/heads/master/"
            "arachnid/core/orient/core/healpix/ang2pix_ring.c",
            60, nside);
    exit(0);
  }
  if (theta < 0. || theta > PI) {
    fprintf(stderr, "%s (%d): theta out of range: %f\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/ezralanglois/arachnid/refs/heads/master/"
            "arachnid/core/orient/core/healpix/ang2pix_ring.c",
            65, theta);
    exit(0);
  }
  z = cos(theta);
  za = fabs(z);
  if (phi >= twopi)
    phi = phi - twopi;
  if (phi < 0.)
    phi = phi + twopi;
  tt = phi / piover2;
  nl2 = 2 * nside;
  nl4 = 4 * nside;
  ncap = nl2 * (nside - 1);
  npix = 12 * nside * nside;
  if (za <= z0) {
    jp = (int)floor(nside * (0.5 + tt - z * 0.75));
    jm = (int)floor(nside * (0.5 + tt + z * 0.75));
    ir = nside + 1 + jp - jm;
    kshift = 0;
    if (fmod(ir, 2) == 0.)
      kshift = 1;
    ip = (int)floor((jp + jm - nside + kshift + 1) / 2) + 1;
    if (ip > nl4)
      ip = ip - nl4;
    ipix1 = ncap + nl4 * (ir - 1) + ip;
  } else {
    tp = tt - floor(tt);
    tmp = sqrt(3. * (1. - za));
    jp = (int)floor(nside * tp * tmp);
    jm = (int)floor(nside * (1. - tp) * tmp);
    ir = jp + jm + 1;
    ip = (int)floor(tt * ir) + 1;
    if (ip > 4 * ir)
      ip = ip - 4 * ir;
    ipix1 = 2 * ir * (ir - 1) + ip;
    if (z <= 0.) {
      ipix1 = npix - 2 * ir * (ir + 1) + ip;
    }
  }
  *ipix = ipix1 - 1;
}


x86 assembly (clang, -O0):
<ang2pix_ring>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  0xe93(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe4e(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movq   $0x2000,-0xa0(%rbp)
cmpq   $0x1,-0x8(%rbp)
jl     11e1 <ang2pix_ring+0x81>
mov    -0x8(%rbp),%rax
cmp    -0xa0(%rbp),%rax
jle    120d <ang2pix_ring+0xad>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%r8
lea    0xe5b(%rip),%rsi
lea    0xe76(%rip),%rdx
mov    $0x3c,%ecx
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     122e <ang2pix_ring+0xce>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    125c <ang2pix_ring+0xfc>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
cvttsd2si -0x10(%rbp),%r8
lea    0xee1(%rip),%rsi
lea    0xe27(%rip),%rdx
mov    $0x41,%ecx
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movaps 0xdc9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x90(%rbp),%xmm0
ff
jb     12a5 <ang2pix_ring+0x145>
movsd  -0x18(%rbp),%xmm0
subsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12c5 <ang2pix_ring+0x165>
movsd  -0x18(%rbp),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,-0x28(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
imul   %rcx,%rax
mov    %eax,-0x2c(%rbp)
imul   $0xc,-0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %eax,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x98(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jb     1461 <ang2pix_ring+0x301>
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xd09(%rip),%xmm2
addsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xcd8(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xcb5(%rip),%xmm2
addsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movsd  0xc9b(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
movslq -0x34(%rbp),%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x6c(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x6c(%rbp),%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13fd <ang2pix_ring+0x29d>
jp     13fd <ang2pix_ring+0x29d>
movl   $0x1,-0x74(%rbp)
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
cltq
sub    -0x8(%rbp),%rax
movslq -0x74(%rbp),%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    1445 <ang2pix_ring+0x2e5>
mov    -0x70(%rbp),%eax
sub    -0x28(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x28(%rbp),%ecx
mov    -0x6c(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
add    -0x70(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1591 <ang2pix_ring+0x431>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
cvttsd2si -0x58(%rbp),%rdi
call   1080 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xb8b(%rip),%xmm1
subsd  -0x50(%rbp),%xmm1
movsd  0xb86(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xb3d(%rip),%xmm1
subsd  -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
movsd  -0x58(%rbp),%xmm0
cvtsi2sdl -0x6c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    -0x6c(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    154f <ang2pix_ring+0x3ef>
mov    -0x70(%rbp),%eax
mov    -0x6c(%rbp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%eax
shl    $0x1,%eax
mov    -0x6c(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
add    -0x70(%rbp),%eax
mov    %eax,-0x3c(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     158c <ang2pix_ring+0x42c>
mov    -0x30(%rbp),%eax
mov    -0x6c(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x6c(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
sub    %ecx,%eax
add    -0x70(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1591 <ang2pix_ring+0x431>
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ang2pix_ring>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
lea    -0x2001(%rdi),%rax
cmp    $0xffffffffffffdfff,%rax
jbe    141c <ang2pix_ring+0x2bc>
movapd %xmm1,(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     143d <ang2pix_ring+0x2dd>
ucomisd 0xe61(%rip),%xmm0
ja     143d <ang2pix_ring+0x2dd>
mov    %rsi,0x50(%rsp)
call   1050 <cos@plt>
movapd 0xe99(%rip),%xmm5
movsd  0xe49(%rip),%xmm3
movapd (%rsp),%xmm4
addsd  %xmm4,%xmm3
movsd  0xe40(%rip),%xmm1
movapd %xmm1,%xmm2
cmpnlesd %xmm4,%xmm2
andpd  %xmm2,%xmm4
andnpd %xmm3,%xmm2
orpd   %xmm4,%xmm2
addsd  %xmm2,%xmm1
xorpd  %xmm4,%xmm4
movapd %xmm2,%xmm3
cmpltsd %xmm4,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm3
orpd   %xmm1,%xmm3
divsd  0xe0e(%rip),%xmm3
andpd  %xmm0,%xmm5
movsd  0xe0a(%rip),%xmm1
ucomisd %xmm5,%xmm1
jae    1314 <ang2pix_ring+0x1b4>
cvttsd2si %xmm3,%rdi
movapd %xmm0,0x30(%rsp)
movapd %xmm3,(%rsp)
movapd %xmm5,0x20(%rsp)
call   1080 <floor@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0xde6(%rip),%xmm0
subsd  0x20(%rsp),%xmm0
mulsd  0xde0(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x20(%rsp)
xorps  %xmm2,%xmm2
cvtsi2sd %rbx,%xmm2
movsd  %xmm2,0x48(%rsp)
movapd 0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%ebp
movsd  0xd97(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0x48(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
lea    (%rax,%rbp,1),%ecx
add    $0x1,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    %eax,%ebp
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
lea    0x4(,%rbp,4),%ecx
xor    %edx,%edx
cmp    %eax,%ecx
cmovle %ecx,%edx
lea    0x2(%rbp,%rbp,1),%ecx
xorpd  %xmm0,%xmm0
ucomisd 0x30(%rsp),%xmm0
jae    13e2 <ang2pix_ring+0x282>
sub    %edx,%eax
imul   %ebp,%ecx
add    %ecx,%eax
add    $0x1,%eax
jmp    1400 <ang2pix_ring+0x2a0>
lea    0x0(,%rbx,4),%r12d
lea    -0x1(%rbx),%r15d
imul   %ebx,%r15d
xorps  %xmm2,%xmm2
cvtsi2sd %rbx,%xmm2
movsd  %xmm2,0x10(%rsp)
addsd  0xcee(%rip),%xmm3
movapd %xmm3,(%rsp)
mulsd  0xce9(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%r13d
movapd 0x30(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%r14d
lea    (%rbx,%r13,1),%ebp
sub    %r14d,%ebp
lea    0x1(%rbp),%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
add    %r13d,%r14d
movslq %r14d,%rcx
sub    %rbx,%rcx
cmp    $0x1,%eax
adc    $0x0,%rcx
lea    0x1(%rcx),%rax
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%rdi
add    $0x1,%rdi
sar    %rdi
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
xor    %ecx,%ecx
cmp    %eax,%r12d
cmovle %r12d,%ecx
imul   %r12d,%ebp
lea    (%rax,%r15,2),%eax
add    %ebp,%eax
sub    %ecx,%eax
add    $0x1,%eax
jmp    1400 <ang2pix_ring+0x2a0>
imul   %ebx,%ebx
shl    $0x2,%ebx
lea    (%rbx,%rbx,2),%esi
neg    %edx
add    %eax,%edx
add    $0x1,%edx
mov    $0xfffffffe,%eax
sub    %ebp,%eax
imul   %ecx,%eax
add    %esi,%eax
add    %edx,%eax
add    $0xffffffff,%eax
cltq
mov    0x50(%rsp),%rcx
mov    %rax,(%rcx)
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
lea    0xc34(%rip),%rsi
lea    0xc4f(%rip),%rdx
mov    $0x3c,%ecx
mov    %rbx,%r8
jmp    145e <ang2pix_ring+0x2fe>
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
cvttsd2si %xmm0,%r8
lea    0xce3(%rip),%rsi
lea    0xc29(%rip),%rdx
mov    $0x41,%ecx
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"%s (%d): nside out of range: %ld\0A\00"
@.str.1 = [179 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ezralanglois/arachnid/refs/heads/master/arachnid/core/orient/core/healpix/ang2pix_ring.c\00"
@.str.2 = [33 x i8] c"%s (%d): theta out of range: %f\0A\00"
define void @ang2pix_ring(i64 %0, double %1, double %2, i64* nocapture writeonly %3) {
%5 = add i64 %0, -8193
%6 = icmp ult i64 %5, -8192
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str.1, i64 0, i64 0), i32 60, i64 %0)
%10 = tail call i32 @exit(i32 0)
unreachable
11: ; preds = %4
%12 = fcmp olt double %1, 0.000000e+00
%13 = fcmp ogt double %1, 0x400921FB54442D18
%14 = or i1 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = fptosi double %1 to i64
%18 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str.1, i64 0, i64 0), i32 65, i64 %17)
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %11
%21 = tail call double @cos(double %1)
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp ult double %2, 0x401921FB54442D18
%24 = fadd double %2, 0xC01921FB54442D18
%25 = select i1 %23, double %2, double %24
%26 = fcmp olt double %25, 0.000000e+00
%27 = fadd double %25, 0x401921FB54442D18
%28 = select i1 %26, double %27, double %25
%29 = fdiv double %28, 0x3FF921FB54442D18
%30 = trunc i64 %0 to i32
%31 = shl nuw nsw i32 %30, 2
%32 = mul nuw nsw i64 %0, 12
%33 = mul nuw nsw i64 %32, %0
%34 = trunc i64 %33 to i32
%35 = fcmp ugt double %22, 0x3FE5555555555555
br i1 %35, label %77, label %36
36: ; preds = %20
%37 = shl nuw nsw i64 %0, 1
%38 = and i64 %37, 4294967294
%39 = add nsw i64 %0, -1
%40 = mul nuw nsw i64 %38, %39
%41 = trunc i64 %40 to i32
%42 = sitofp i64 %0 to double
%43 = fadd double %29, 5.000000e-01
%44 = fneg double %21
%45 = tail call double @llvm.fmuladd.f64(double %44, double 7.500000e-01, double %43)
%46 = fmul double %45, %42
%47 = fptosi double %46 to i64
%48 = tail call double @floor(i64 %47)
%49 = fptosi double %48 to i32
%50 = tail call double @llvm.fmuladd.f64(double %21, double 7.500000e-01, double %43)
%51 = fmul double %50, %42
%52 = fptosi double %51 to i64
%53 = tail call double @floor(i64 %52)
%54 = fptosi double %53 to i32
%55 = add nuw nsw i32 %30, 1
%56 = add i32 %55, %49
%57 = sub i32 %56, %54
%58 = tail call i32 @fmod(i32 %57, i32 2)
%59 = icmp eq i32 %58, 0
%60 = zext i1 %59 to i64
%61 = add nsw i32 %54, %49
%62 = sext i32 %61 to i64
%63 = sub nsw i64 1, %0
%64 = add nsw i64 %63, %62
%65 = add nsw i64 %64, %60
%66 = sdiv i64 %65, 2
%67 = tail call double @floor(i64 %66)
%68 = fptosi double %67 to i32
%69 = icmp sgt i32 %31, %68
%70 = select i1 %69, i32 0, i32 %31
%71 = add nsw i32 %57, -1
%72 = mul nsw i32 %71, %31
%73 = or i32 %41, 1
%74 = add i32 %73, %68
%75 = add i32 %74, %72
%76 = sub i32 %75, %70
br label %118
77: ; preds = %20
%78 = fptosi double %29 to i64
%79 = tail call double @floor(i64 %78)
%80 = fsub double %29, %79
%81 = fsub double 1.000000e+00, %22
%82 = fmul double %81, 3.000000e+00
%83 = fptosi double %82 to i32
%84 = tail call double @sqrt(i32 %83)
%85 = sitofp i64 %0 to double
%86 = fmul double %80, %85
%87 = fmul double %84, %86
%88 = fptosi double %87 to i64
%89 = tail call double @floor(i64 %88)
%90 = fptosi double %89 to i32
%91 = fsub double 1.000000e+00, %80
%92 = fmul double %91, %85
%93 = fmul double %84, %92
%94 = fptosi double %93 to i64
%95 = tail call double @floor(i64 %94)
%96 = fptosi double %95 to i32
%97 = add nsw i32 %96, %90
%98 = add nsw i32 %97, 1
%99 = sitofp i32 %98 to double
%100 = fmul double %29, %99
%101 = fptosi double %100 to i64
%102 = tail call double @floor(i64 %101)
%103 = fptosi double %102 to i32
%104 = add nsw i32 %103, 1
%105 = shl nsw i32 %98, 2
%106 = icmp sgt i32 %105, %103
%107 = select i1 %106, i32 0, i32 %105
%108 = sub i32 %104, %107
%109 = shl nsw i32 %98, 1
%110 = mul nsw i32 %109, %97
%111 = add nsw i32 %108, %110
%112 = fcmp ugt double %21, 0.000000e+00
br i1 %112, label %118, label %113
113: ; preds = %77
%114 = sub i32 -2, %97
%115 = mul i32 %114, %109
%116 = add i32 %115, %34
%117 = add nsw i32 %116, %108
br label %118
118: ; preds = %77, %113, %36
%119 = phi i32 [ %76, %36 ], [ %117, %113 ], [ %111, %77 ]
%120 = add nsw i32 %119, -1
%121 = sext i32 %120 to i64
store i64 %121, i64* %3
ret void
}