#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 */
int /*<<< orphan*/ ang2pix_nest(long, double, double, long *);
int /*<<< orphan*/ ang2pix_ring(long, double, double, long *);
int /*<<< orphan*/ ang2vec(double, double, double *);
int /*<<< orphan*/ nest2ring(long, long, long *);
long nside2npix(long);
int /*<<< orphan*/ pix2ang_nest(long, long, double *, double *);
int /*<<< orphan*/ pix2ang_ring(long, long, double *, double *);
int /*<<< orphan*/ pix2vec_nest(long, long, double *);
int /*<<< orphan*/ pix2vec_ring(long, long, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ ring2nest(long, long, long *);
int /*<<< orphan*/ vec2ang(double *, double *, double *);
int /*<<< orphan*/ vec2pix_nest(long, double *, long *);
int /*<<< orphan*/ vec2pix_ring(long, double *, long *);
int main(void) {
  double theta, phi;
  double vec[3];
  long nside;
  long ipix, npix, dpix, ip2, ip1;
  printf("Starting C Healpix pixel routines test\n");
  nside = 1024;
  dpix = 23;
  npix = nside2npix(nside);
  printf("Number of pixels in full map: %ld\n", npix);
  printf("dpix: %ld\n", dpix);
  printf("Nest -> ang -> vec -> ang -> Ring -> Nest\n");
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2ang_nest(nside, ipix, &theta, &phi);
    ang2vec(theta, phi, vec);
    vec2ang(vec, &theta, &phi);
    ang2pix_ring(nside, theta, phi, &ip2);
    ring2nest(nside, ip2, &ip1);
    if (ip1 != ipix) {
      printf("Error: %ld %ld %ld %ld\n", nside, ipix, ip2, ip1);
    }
  }
  printf("Ring -> ang -> Nest -> Ring\n");
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2ang_ring(nside, ipix, &theta, &phi);
    ang2pix_nest(nside, theta, phi, &ip2);
    nest2ring(nside, ip2, &ip1);
    if (ip1 != ipix) {
      printf("Error: %ld %ld %ld %ld\n", nside, ipix, ip2, ip1);
    }
  }
  printf("Nest -> vec -> Ring -> Nest\n");
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2vec_nest(nside, ipix, vec);
    vec2pix_ring(nside, vec, &ip2);
    ring2nest(nside, ip2, &ip1);
    if (ip1 != ipix) {
      printf("Error: %ld %ld %ld %ld\n", nside, ipix, ip2, ip1);
    }
  }
  printf("Ring -> vec -> Nest -> Ring\n");
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2vec_ring(nside, ipix, vec);
    vec2pix_nest(nside, vec, &ip2);
    nest2ring(nside, ip2, &ip1);
    if (ip1 != ipix) {
      printf("Error: %ld %ld %ld %ld\n", nside, ipix, ip2, ip1);
    }
  }
  printf("%ld\n", nside);
  printf("test completed\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x400,-0x38(%rbp)
movq   $0x17,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
call   10a0 <nside2npix@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    1305 <main+0x125>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1060 <pix2ang_nest@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x30(%rbp),%rdi
call   10d0 <ang2vec@plt>
lea    -0x30(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <vec2ang@plt>
mov    -0x38(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x58(%rbp),%rsi
call   10b0 <ang2pix_ring@plt>
mov    -0x38(%rbp),%rdi
mov    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1080 <ring2nest@plt>
mov    -0x60(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     12ef <main+0x10f>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%r8
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12f4 <main+0x114>
mov    -0x50(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1254 <main+0x74>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    13a8 <main+0x1c8>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <pix2ang_ring@plt>
mov    -0x38(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x58(%rbp),%rsi
call   1100 <ang2pix_nest@plt>
mov    -0x38(%rbp),%rdi
mov    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1090 <nest2ring@plt>
mov    -0x60(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     1392 <main+0x1b2>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%r8
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1397 <main+0x1b7>
mov    -0x50(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    131b <main+0x13b>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    1441 <main+0x261>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   10c0 <pix2vec_nest@plt>
mov    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1030 <vec2pix_ring@plt>
mov    -0x38(%rbp),%rdi
mov    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1080 <ring2nest@plt>
mov    -0x60(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     142b <main+0x24b>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%r8
lea    0xc5d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1430 <main+0x250>
mov    -0x50(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    13be <main+0x1de>
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    14da <main+0x2fa>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   10e0 <pix2vec_ring@plt>
mov    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   10f0 <vec2pix_nest@plt>
mov    -0x38(%rbp),%rdi
mov    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1090 <nest2ring@plt>
mov    -0x60(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     14c4 <main+0x2e4>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%r8
lea    0xbc4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    14c9 <main+0x2e9>
mov    -0x50(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1457 <main+0x277>
mov    -0x38(%rbp),%rsi
lea    0xb61(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe41(%rip),%rdi
call   1040 <puts@plt>
mov    $0x400,%edi
call   10b0 <nside2npix@plt>
mov    %rax,%r14
lea    0xde2(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    $0x17,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe2b(%rip),%rdi
call   1040 <puts@plt>
test   %r14,%r14
jle    1440 <main+0x250>
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0x20(%rsp),%rbx
lea    0x8(%rsp),%rbp
xor    %r13d,%r13d
jmp    127d <main+0x8d>
nopl   0x0(%rax)
add    $0x17,%r13
cmp    %r14,%r13
jge    1305 <main+0x115>
mov    $0x400,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1070 <pix2ang_nest@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %rbx,%rdi
call   10e0 <ang2vec@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <vec2ang@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x400,%edi
mov    %rsp,%rsi
call   10c0 <ang2pix_ring@plt>
mov    (%rsp),%rsi
mov    $0x400,%edi
mov    %rbp,%rdx
call   1090 <ring2nest@plt>
mov    0x8(%rsp),%r8
cmp    %r8,%r13
je     1270 <main+0x80>
mov    (%rsp),%rcx
mov    $0x400,%esi
lea    0xd38(%rip),%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1270 <main+0x80>
lea    0xd8b(%rip),%rdi
call   1040 <puts@plt>
test   %r14,%r14
jle    144c <main+0x25c>
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
mov    %rsp,%rbx
lea    0x8(%rsp),%rbp
xor    %r13d,%r13d
jmp    1349 <main+0x159>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x17,%r13
cmp    %r14,%r13
jge    13ac <main+0x1bc>
mov    $0x400,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1060 <pix2ang_ring@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x400,%edi
mov    %rbx,%rsi
call   1110 <ang2pix_nest@plt>
mov    (%rsp),%rsi
mov    $0x400,%edi
mov    %rbp,%rdx
call   10a0 <nest2ring@plt>
mov    0x8(%rsp),%r8
cmp    %r8,%r13
je     1340 <main+0x150>
mov    (%rsp),%rcx
mov    $0x400,%esi
lea    0xc8e(%rip),%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1340 <main+0x150>
lea    0xd00(%rip),%rdi
call   1040 <puts@plt>
test   %r14,%r14
jle    1458 <main+0x268>
lea    0x20(%rsp),%rbx
mov    %rsp,%r15
lea    0x8(%rsp),%r13
lea    0xc59(%rip),%r12
xor    %ebp,%ebp
jmp    13ed <main+0x1fd>
nopl   0x0(%rax)
add    $0x17,%rbp
cmp    %r14,%rbp
jge    1494 <main+0x2a4>
mov    $0x400,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   10d0 <pix2vec_nest@plt>
mov    $0x400,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <vec2pix_ring@plt>
mov    (%rsp),%rsi
mov    $0x400,%edi
mov    %r13,%rdx
call   1090 <ring2nest@plt>
mov    0x8(%rsp),%r8
cmp    %r8,%rbp
je     13e0 <main+0x1f0>
mov    (%rsp),%rcx
mov    $0x400,%esi
mov    %r12,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
jmp    13e0 <main+0x1f0>
lea    0xc50(%rip),%rdi
call   1040 <puts@plt>
lea    0xc60(%rip),%rdi
call   1040 <puts@plt>
lea    0xc70(%rip),%rdi
call   1040 <puts@plt>
lea    0xbb3(%rip),%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc6d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc34(%rip),%rdi
call   1040 <puts@plt>
test   %r14,%r14
jle    1464 <main+0x274>
lea    0x20(%rsp),%rbx
mov    %rsp,%r15
lea    0x8(%rsp),%r13
lea    0xb75(%rip),%r12
xor    %ebp,%ebp
jmp    14c9 <main+0x2d9>
nopl   (%rax)
add    $0x17,%rbp
cmp    %r14,%rbp
jge    1464 <main+0x274>
mov    $0x400,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   10f0 <pix2vec_ring@plt>
mov    $0x400,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1100 <vec2pix_nest@plt>
mov    (%rsp),%rsi
mov    $0x400,%edi
mov    %r13,%rdx
call   10a0 <nest2ring@plt>
mov    0x8(%rsp),%r8
cmp    %r8,%rbp
je     14c0 <main+0x2d0>
mov    (%rsp),%rcx
mov    $0x400,%esi
mov    %r12,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
jmp    14c0 <main+0x2d0>

LLVM IR (-O0):
@.str = [40 x i8] c"Starting C Healpix pixel routines test\0A\00"
@.str.1 = [35 x i8] c"Number of pixels in full map: %ld\0A\00"
@.str.2 = [11 x i8] c"dpix: %ld\0A\00"
@.str.3 = [43 x i8] c"Nest -> ang -> vec -> ang -> Ring -> Nest\0A\00"
@.str.4 = [24 x i8] c"Error: %ld %ld %ld %ld\0A\00"
@.str.5 = [29 x i8] c"Ring -> ang -> Nest -> Ring\0A\00"
@.str.6 = [29 x i8] c"Nest -> vec -> Ring -> Nest\0A\00"
@.str.7 = [29 x i8] c"Ring -> vec -> Nest -> Ring\0A\00"
@.str.8 = [5 x i8] c"%ld\0A\00"
@.str.9 = [17 x i8] c"test completed\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca [3 x double]
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i64 1024, i64* %5
store i64 23, i64* %8
%12 = load i64, i64* %5
%13 = call i64 @nside2npix(i64 %12)
store i64 %13, i64* %7
%14 = load i64, i64* %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
store i64 0, i64* %6
br label %19
19: ; preds = %50, %0
%20 = load i64, i64* %6
%21 = load i64, i64* %7
%22 = icmp slt i64 %20, %21
br i1 %22, label %23, label %54
23: ; preds = %19
%24 = load i64, i64* %5
%25 = load i64, i64* %6
%26 = call i32 @pix2ang_nest(i64 %24, i64 %25, double* %2, double* %3)
%27 = load double, double* %2
%28 = load double, double* %3
%29 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%30 = call i32 @ang2vec(double %27, double %28, double* %29)
%31 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%32 = call i32 @vec2ang(double* %31, double* %2, double* %3)
%33 = load i64, i64* %5
%34 = load double, double* %2
%35 = load double, double* %3
%36 = call i32 @ang2pix_ring(i64 %33, double %34, double %35, i64* %9)
%37 = load i64, i64* %5
%38 = load i64, i64* %9
%39 = call i32 @ring2nest(i64 %37, i64 %38, i64* %10)
%40 = load i64, i64* %10
%41 = load i64, i64* %6
%42 = icmp ne i64 %40, %41
br i1 %42, label %43, label %49
43: ; preds = %23
%44 = load i64, i64* %5
%45 = load i64, i64* %6
%46 = load i64, i64* %9
%47 = load i64, i64* %10
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %44, i64 %45, i64 %46, i64 %47)
br label %49
49: ; preds = %43, %23
br label %50
50: ; preds = %49
%51 = load i64, i64* %8
%52 = load i64, i64* %6
%53 = add nsw i64 %52, %51
store i64 %53, i64* %6
br label %19
54: ; preds = %19
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i64 0, i64* %6
br label %56
56: ; preds = %81, %54
%57 = load i64, i64* %6
%58 = load i64, i64* %7
%59 = icmp slt i64 %57, %58
br i1 %59, label %60, label %85
60: ; preds = %56
%61 = load i64, i64* %5
%62 = load i64, i64* %6
%63 = call i32 @pix2ang_ring(i64 %61, i64 %62, double* %2, double* %3)
%64 = load i64, i64* %5
%65 = load double, double* %2
%66 = load double, double* %3
%67 = call i32 @ang2pix_nest(i64 %64, double %65, double %66, i64* %9)
%68 = load i64, i64* %5
%69 = load i64, i64* %9
%70 = call i32 @nest2ring(i64 %68, i64 %69, i64* %10)
%71 = load i64, i64* %10
%72 = load i64, i64* %6
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %80
74: ; preds = %60
%75 = load i64, i64* %5
%76 = load i64, i64* %6
%77 = load i64, i64* %9
%78 = load i64, i64* %10
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %75, i64 %76, i64 %77, i64 %78)
br label %80
80: ; preds = %74, %60
br label %81
81: ; preds = %80
%82 = load i64, i64* %8
%83 = load i64, i64* %6
%84 = add nsw i64 %83, %82
store i64 %84, i64* %6
br label %56
85: ; preds = %56
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
store i64 0, i64* %6
br label %87
87: ; preds = %112, %85
%88 = load i64, i64* %6
%89 = load i64, i64* %7
%90 = icmp slt i64 %88, %89
br i1 %90, label %91, label %116
91: ; preds = %87
%92 = load i64, i64* %5
%93 = load i64, i64* %6
%94 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%95 = call i32 @pix2vec_nest(i64 %92, i64 %93, double* %94)
%96 = load i64, i64* %5
%97 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%98 = call i32 @vec2pix_ring(i64 %96, double* %97, i64* %9)
%99 = load i64, i64* %5
%100 = load i64, i64* %9
%101 = call i32 @ring2nest(i64 %99, i64 %100, i64* %10)
%102 = load i64, i64* %10
%103 = load i64, i64* %6
%104 = icmp ne i64 %102, %103
br i1 %104, label %105, label %111
105: ; preds = %91
%106 = load i64, i64* %5
%107 = load i64, i64* %6
%108 = load i64, i64* %9
%109 = load i64, i64* %10
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %106, i64 %107, i64 %108, i64 %109)
br label %111
111: ; preds = %105, %91
br label %112
112: ; preds = %111
%113 = load i64, i64* %8
%114 = load i64, i64* %6
%115 = add nsw i64 %114, %113
store i64 %115, i64* %6
br label %87
116: ; preds = %87
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
store i64 0, i64* %6
br label %118
118: ; preds = %143, %116
%119 = load i64, i64* %6
%120 = load i64, i64* %7
%121 = icmp slt i64 %119, %120
br i1 %121, label %122, label %147
122: ; preds = %118
%123 = load i64, i64* %5
%124 = load i64, i64* %6
%125 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%126 = call i32 @pix2vec_ring(i64 %123, i64 %124, double* %125)
%127 = load i64, i64* %5
%128 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%129 = call i32 @vec2pix_nest(i64 %127, double* %128, i64* %9)
%130 = load i64, i64* %5
%131 = load i64, i64* %9
%132 = call i32 @nest2ring(i64 %130, i64 %131, i64* %10)
%133 = load i64, i64* %10
%134 = load i64, i64* %6
%135 = icmp ne i64 %133, %134
br i1 %135, label %136, label %142
136: ; preds = %122
%137 = load i64, i64* %5
%138 = load i64, i64* %6
%139 = load i64, i64* %9
%140 = load i64, i64* %10
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %137, i64 %138, i64 %139, i64 %140)
br label %142
142: ; preds = %136, %122
br label %143
143: ; preds = %142
%144 = load i64, i64* %8
%145 = load i64, i64* %6
%146 = add nsw i64 %145, %144
store i64 %146, i64* %6
br label %118
147: ; preds = %118
%148 = load i64, i64* %5
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 %148)
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"Number of pixels in full map: %ld\0A\00"
@.str.2 = [11 x i8] c"dpix: %ld\0A\00"
@.str.4 = [24 x i8] c"Error: %ld %ld %ld %ld\0A\00"
@.str.8 = [5 x i8] c"%ld\0A\00"
@str = [39 x i8] c"Starting C Healpix pixel routines test\00"
@str.10 = [42 x i8] c"Nest -> ang -> vec -> ang -> Ring -> Nest\00"
@str.11 = [28 x i8] c"Ring -> ang -> Nest -> Ring\00"
@str.12 = [28 x i8] c"Nest -> vec -> Ring -> Nest\00"
@str.13 = [28 x i8] c"Ring -> vec -> Nest -> Ring\00"
@str.14 = [16 x i8] c"test completed\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca [3 x double]
%4 = alloca i64
%5 = alloca i64
%6 = bitcast double* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast [3 x double]* %3 to i8*
%9 = bitcast i64* %4 to i8*
%10 = bitcast i64* %5 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%12 = tail call i64 @nside2npix(i64 1024)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 23)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.10, i64 0, i64 0))
%16 = icmp sgt i64 %12, 0
br i1 %16, label %19, label %17
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
br label %59
19: ; preds = %0
%20 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
br label %21
21: ; preds = %19, %38
%22 = phi i64 [ 0, %19 ], [ %39, %38 ]
%23 = call i32 @pix2ang_nest(i64 1024, i64 %22, double* %1, double* %2)
%24 = load double, double* %1
%25 = load double, double* %2
%26 = call i32 @ang2vec(double %24, double %25, double* %20)
%27 = call i32 @vec2ang(double* %20, double* %1, double* %2)
%28 = load double, double* %1
%29 = load double, double* %2
%30 = call i32 @ang2pix_ring(i64 1024, double %28, double %29, i64* %4)
%31 = load i64, i64* %4
%32 = call i32 @ring2nest(i64 1024, i64 %31, i64* %5)
%33 = load i64, i64* %5
%34 = icmp eq i64 %33, %22
br i1 %34, label %38, label %35
35: ; preds = %21
%36 = load i64, i64* %4
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 1024, i64 %22, i64 %36, i64 %33)
br label %38
38: ; preds = %21, %35
%39 = add nuw nsw i64 %22, 23
%40 = icmp slt i64 %39, %12
br i1 %40, label %21, label %41
41: ; preds = %38
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
br i1 %16, label %43, label %59
43: ; preds = %41, %56
%44 = phi i64 [ %57, %56 ], [ 0, %41 ]
%45 = call i32 @pix2ang_ring(i64 1024, i64 %44, double* %1, double* %2)
%46 = load double, double* %1
%47 = load double, double* %2
%48 = call i32 @ang2pix_nest(i64 1024, double %46, double %47, i64* %4)
%49 = load i64, i64* %4
%50 = call i32 @nest2ring(i64 1024, i64 %49, i64* %5)
%51 = load i64, i64* %5
%52 = icmp eq i64 %51, %44
br i1 %52, label %56, label %53
53: ; preds = %43
%54 = load i64, i64* %4
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 1024, i64 %44, i64 %54, i64 %51)
br label %56
56: ; preds = %43, %53
%57 = add nuw nsw i64 %44, 23
%58 = icmp slt i64 %57, %12
br i1 %58, label %43, label %61
59: ; preds = %17, %41
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0))
br label %79
61: ; preds = %56
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0))
br i1 %16, label %63, label %79
63: ; preds = %61
%64 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
br label %65
65: ; preds = %63, %76
%66 = phi i64 [ 0, %63 ], [ %77, %76 ]
%67 = call i32 @pix2vec_nest(i64 1024, i64 %66, double* %64)
%68 = call i32 @vec2pix_ring(i64 1024, double* %64, i64* %4)
%69 = load i64, i64* %4
%70 = call i32 @ring2nest(i64 1024, i64 %69, i64* %5)
%71 = load i64, i64* %5
%72 = icmp eq i64 %71, %66
br i1 %72, label %76, label %73
73: ; preds = %65
%74 = load i64, i64* %4
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 1024, i64 %66, i64 %74, i64 %71)
br label %76
76: ; preds = %65, %73
%77 = add nuw nsw i64 %66, 23
%78 = icmp slt i64 %77, %12
br i1 %78, label %65, label %81
79: ; preds = %59, %61
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.13, i64 0, i64 0))
br label %99
81: ; preds = %76
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.13, i64 0, i64 0))
br i1 %16, label %83, label %99
83: ; preds = %81
%84 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
br label %85
85: ; preds = %83, %96
%86 = phi i64 [ 0, %83 ], [ %97, %96 ]
%87 = call i32 @pix2vec_ring(i64 1024, i64 %86, double* %84)
%88 = call i32 @vec2pix_nest(i64 1024, double* %84, i64* %4)
%89 = load i64, i64* %4
%90 = call i32 @nest2ring(i64 1024, i64 %89, i64* %5)
%91 = load i64, i64* %5
%92 = icmp eq i64 %91, %86
br i1 %92, label %96, label %93
93: ; preds = %85
%94 = load i64, i64* %4
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 1024, i64 %86, i64 %94, i64 %91)
br label %96
96: ; preds = %85, %93
%97 = add nuw nsw i64 %86, 23
%98 = icmp slt i64 %97, %12
br i1 %98, label %85, label %99
99: ; preds = %96, %79, %81
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 1024)
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}