#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*/ abort();
int /*<<< orphan*/ ang2pix_ring(long, double, double, long *);
long nside2npix(long);
int /*<<< orphan*/ pix2ang_ring(long, long, double *, double *);
int /*<<< orphan*/ pix2vec_ring(long, long, double *);
int /*<<< orphan*/ printf(char *, long, long, long);
int /*<<< orphan*/ vec2pix_ring(long, double *, long *);
void test1_helper2(long nside, long dpix) {
  double theta, phi;
  double vec[3];
  long ipix, npix, ip1;
  npix = nside2npix(nside);
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2ang_ring(nside, ipix, &theta, &phi);
    ang2pix_ring(nside, theta, phi, &ip1);
    if (ip1 != ipix) {
      printf("Error1: %ld %ld %ld\n", nside, ipix, ip1);
      abort();
    }
  }
  for (ipix = 0; ipix < npix; ipix += dpix) {
    pix2vec_ring(nside, ipix, vec);
    vec2pix_ring(nside, vec, &ip1);
    if (ip1 != ipix) {
      printf("Error1: %ld %ld %ld\n", nside, ipix, ip1);
      abort();
    }
  }
}


x86 assembly (clang, -O0):
<test1_helper2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <nside2npix@plt>
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jge    1212 <test1_helper2+0xa2>
mov    -0x8(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <pix2ang_ring@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    -0x58(%rbp),%rsi
call   1080 <ang2pix_ring@plt>
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     11fc <test1_helper2+0x8c>
mov    -0x8(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x58(%rbp),%rcx
lea    0xe10(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1201 <test1_helper2+0x91>
mov    -0x10(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    1195 <test1_helper2+0x25>
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jge    128d <test1_helper2+0x11d>
mov    -0x8(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1090 <pix2vec_ring@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1040 <vec2pix_ring@plt>
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     1277 <test1_helper2+0x107>
mov    -0x8(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x58(%rbp),%rcx
lea    0xd95(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    127c <test1_helper2+0x10c>
mov    -0x10(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    121a <test1_helper2+0xaa>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1_helper2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
call   1070 <nside2npix@plt>
test   %rax,%rax
jle    122e <test1_helper2+0xbe>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0x10(%rsp),%rbp
lea    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
lea    0x18(%rsp),%rdx
mov    %rbp,%rcx
call   1050 <pix2ang_ring@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r12,%rdi
mov    %r13,%rsi
call   1080 <ang2pix_ring@plt>
mov    0x8(%rsp),%rcx
cmp    %rcx,%rbx
jne    123d <test1_helper2+0xcd>
add    %r14,%rbx
cmp    %r15,%rbx
jl     11b0 <test1_helper2+0x40>
test   %r15,%r15
jle    122e <test1_helper2+0xbe>
xor    %ebx,%ebx
lea    0x20(%rsp),%rbp
lea    0x8(%rsp),%r13
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <pix2vec_ring@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
call   1040 <vec2pix_ring@plt>
mov    0x8(%rsp),%rcx
cmp    %rcx,%rbx
jne    123d <test1_helper2+0xcd>
add    %r14,%rbx
cmp    %r15,%rbx
jl     1200 <test1_helper2+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdbc(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error1: %ld %ld %ld\0A\00"
define void @test1_helper2(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca double
%6 = alloca double
%7 = alloca [3 x double]
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%11 = load i64, i64* %3
%12 = call i64 @nside2npix(i64 %11)
store i64 %12, i64* %9
store i64 0, i64* %8
br label %13
13: ; preds = %35, %2
%14 = load i64, i64* %8
%15 = load i64, i64* %9
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i64, i64* %3
%19 = load i64, i64* %8
%20 = call i32 @pix2ang_ring(i64 %18, i64 %19, double* %5, double* %6)
%21 = load i64, i64* %3
%22 = load double, double* %5
%23 = load double, double* %6
%24 = call i32 @ang2pix_ring(i64 %21, double %22, double %23, i64* %10)
%25 = load i64, i64* %10
%26 = load i64, i64* %8
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %34
28: ; preds = %17
%29 = load i64, i64* %3
%30 = load i64, i64* %8
%31 = load i64, i64* %10
%32 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %29, i64 %30, i64 %31)
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %17
br label %35
35: ; preds = %34
%36 = load i64, i64* %4
%37 = load i64, i64* %8
%38 = add nsw i64 %37, %36
store i64 %38, i64* %8
br label %13
39: ; preds = %13
store i64 0, i64* %8
br label %40
40: ; preds = %62, %39
%41 = load i64, i64* %8
%42 = load i64, i64* %9
%43 = icmp slt i64 %41, %42
br i1 %43, label %44, label %66
44: ; preds = %40
%45 = load i64, i64* %3
%46 = load i64, i64* %8
%47 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%48 = call i32 @pix2vec_ring(i64 %45, i64 %46, double* %47)
%49 = load i64, i64* %3
%50 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%51 = call i32 @vec2pix_ring(i64 %49, double* %50, i64* %10)
%52 = load i64, i64* %10
%53 = load i64, i64* %8
%54 = icmp ne i64 %52, %53
br i1 %54, label %55, label %61
55: ; preds = %44
%56 = load i64, i64* %3
%57 = load i64, i64* %8
%58 = load i64, i64* %10
%59 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %56, i64 %57, i64 %58)
%60 = call i32 (...) @abort()
unreachable
61: ; preds = %44
br label %62
62: ; preds = %61
%63 = load i64, i64* %4
%64 = load i64, i64* %8
%65 = add nsw i64 %64, %63
store i64 %65, i64* %8
br label %40
66: ; preds = %40
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error1: %ld %ld %ld\0A\00"
define void @test1_helper2(i64 %0, i64 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca [3 x double]
%6 = alloca i64
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = tail call i64 @nside2npix(i64 %0)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %16, label %42
13: ; preds = %27
br i1 %12, label %14, label %42
14: ; preds = %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
br label %30
16: ; preds = %2, %27
%17 = phi i64 [ %28, %27 ], [ 0, %2 ]
%18 = call i32 @pix2ang_ring(i64 %0, i64 %17, double* %3, double* %4)
%19 = load double, double* %3
%20 = load double, double* %4
%21 = call i32 @ang2pix_ring(i64 %0, double %19, double %20, i64* %6)
%22 = load i64, i64* %6
%23 = icmp eq i64 %22, %17
br i1 %23, label %27, label %24
24: ; preds = %16
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %17, i64 %22)
%26 = call i32 (...) @abort()
unreachable
27: ; preds = %16
%28 = add nsw i64 %17, %1
%29 = icmp slt i64 %28, %11
br i1 %29, label %16, label %13
30: ; preds = %14, %39
%31 = phi i64 [ 0, %14 ], [ %40, %39 ]
%32 = call i32 @pix2vec_ring(i64 %0, i64 %31, double* %15)
%33 = call i32 @vec2pix_ring(i64 %0, double* %15, i64* %6)
%34 = load i64, i64* %6
%35 = icmp eq i64 %34, %31
br i1 %35, label %39, label %36
36: ; preds = %30
%37 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %31, i64 %34)
%38 = call i32 (...) @abort()
unreachable
39: ; preds = %30
%40 = add nsw i64 %31, %1
%41 = icmp slt i64 %40, %11
br i1 %41, label %30, label %42
42: ; preds = %39, %2, %13
ret void
}