#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 */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
double acos(double);
double atan2(double, double);
int /*<<< orphan*/ pix2ang_nest_z_phi64(int /*<<< orphan*/, int /*<<< orphan*/,
                                        double *, double *, double *);
void pix2ang_nest64(int64_t nside, int64_t ipix, double *theta, double *phi) {
  double z, s;
  pix2ang_nest_z_phi64(nside, ipix, &z, &s, phi);
  *theta = (s < -2) ? acos(z) : atan2(s, z);
}


x86 assembly (clang, -O0):
<pix2ang_nest64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%r8
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1050 <pix2ang_nest_z_phi64@plt>
movsd  0xe9b(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1184 <pix2ang_nest64+0x54>
movsd  -0x20(%rbp),%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    1198 <pix2ang_nest64+0x68>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pix2ang_nest64>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r8
mov    %rdx,%rbx
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1050 <pix2ang_nest_z_phi64@plt>
movsd  (%rsp),%xmm0
movsd  0xeab(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm1
jbe    116c <pix2ang_nest64+0x3c>
movapd %xmm1,%xmm0
call   1040 <acos@plt>
jmp    1171 <pix2ang_nest64+0x41>
call   1030 <atan2@plt>
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @pix2ang_nest64(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load double*, double** %8
%14 = call i32 @pix2ang_nest_z_phi64(i32 %11, i32 %12, double* %9, double* %10, double* %13)
%15 = load double, double* %10
%16 = fcmp olt double %15, -2.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = load double, double* %9
%19 = call double @acos(double %18)
br label %24
20: ; preds = %4
%21 = load double, double* %10
%22 = load double, double* %9
%23 = call double @atan2(double %21, double %22)
br label %24
24: ; preds = %20, %17
%25 = phi double [ %19, %17 ], [ %23, %20 ]
%26 = load double*, double** %7
store double %25, double* %26
ret void
}

LLVM IR (-O2):
define void @pix2ang_nest64(i32 %0, i32 %1, double* nocapture writeonly %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %5 to i8*
%8 = bitcast double* %6 to i8*
%9 = call i32 @pix2ang_nest_z_phi64(i32 %0, i32 %1, double* %5, double* %6, double* %3)
%10 = load double, double* %6
%11 = fcmp olt double %10, -2.000000e+00
%12 = load double, double* %5
br i1 %11, label %13, label %15
13: ; preds = %4
%14 = call double @acos(double %12)
br label %17
15: ; preds = %4
%16 = call double @atan2(double %10, double %12)
br label %17
17: ; preds = %15, %13
%18 = phi double [ %14, %13 ], [ %16, %15 ]
store double %18, double* %2
ret void
}