#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 acos(double);
double atan(double);
double fabs(double);
void hcc2sphere(double helio_west, double helio_north, double observer,
                double *theta, double *phi) {
  double f, g;
  double x, y, z;
  z = helio_north;
  y = helio_west;
  x = observer;
  g = z / 696000000.0;
  f = fabs(y / x);
  if ((x > 0) && (y > 0)) {
    *phi = atan(f);
  }
  if ((x > 0) && (y < 0)) {
    *phi = 2.0 * M_PI - atan(f);
  }
  if ((x < 0) && (y > 0)) {
    *phi = M_PI - atan(f);
  }
  if ((x < 0) && (y < 0)) {
    *phi = M_PI + atan(f);
  }
  if ((x == 0) && (y == 0)) {
    *phi = 0;
  }
  if ((x > 0) && (y == 0)) {
    *phi = 0;
  }
  if ((x == 0) && (y > 0)) {
    *phi = M_PI / 2.0;
  }
  if ((x < 0) && (y == 0)) {
    *phi = M_PI;
  }
  if ((x == 0) && (y < 0)) {
    *phi = (3.0 / 2.0) * M_PI;
  }
  *theta = acos(g);
  return;
}


x86 assembly (clang, -O0):
<hcc2sphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movaps 0xe7c(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c3 <hcc2sphere+0xa3>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c3 <hcc2sphere+0xa3>
movsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    122c <hcc2sphere+0x10c>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    122c <hcc2sphere+0x10c>
mov    0x2dfe(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    127a <hcc2sphere+0x15a>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    127a <hcc2sphere+0x15a>
mov    0x2d95(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12c4 <hcc2sphere+0x1a4>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    12c4 <hcc2sphere+0x1a4>
mov    0x2d4b(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12ff <hcc2sphere+0x1df>
jp     12ff <hcc2sphere+0x1df>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12ff <hcc2sphere+0x1df>
jp     12ff <hcc2sphere+0x1df>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1334 <hcc2sphere+0x214>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1334 <hcc2sphere+0x214>
jp     1334 <hcc2sphere+0x214>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    137d <hcc2sphere+0x25d>
jp     137d <hcc2sphere+0x25d>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    137d <hcc2sphere+0x25d>
mov    0x2c83(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xca7(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    13b6 <hcc2sphere+0x296>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13b6 <hcc2sphere+0x296>
jp     13b6 <hcc2sphere+0x296>
mov    0x2c3e(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13f7 <hcc2sphere+0x2d7>
jp     13f7 <hcc2sphere+0x2d7>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    13f7 <hcc2sphere+0x2d7>
movsd  0xc3c(%rip),%xmm0
mov    0x2bfd(%rip),%rax
mulsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
call   1030 <acos@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hcc2sphere>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movapd %xmm0,%xmm3
divsd  %xmm2,%xmm0
andpd  0xec9(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  %xmm1,0x30(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
movsd  %xmm2,0x18(%rsp)
movsd  %xmm3,0x10(%rsp)
jbe    1184 <hcc2sphere+0x64>
ucomisd %xmm0,%xmm2
jbe    1184 <hcc2sphere+0x64>
movapd 0x20(%rsp),%xmm0
call   1040 <atan@plt>
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
movsd  %xmm0,(%rbx)
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
jbe    11ce <hcc2sphere+0xae>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    11ce <hcc2sphere+0xae>
mov    0x2e4d(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <atan@plt>
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    1218 <hcc2sphere+0xf8>
ucomisd %xmm2,%xmm0
jbe    1218 <hcc2sphere+0xf8>
mov    0x2e03(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <atan@plt>
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm1,(%rbx)
ucomisd %xmm3,%xmm0
jbe    125a <hcc2sphere+0x13a>
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    125a <hcc2sphere+0x13a>
mov    0x2db9(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <atan@plt>
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    1273 <hcc2sphere+0x153>
jp     1273 <hcc2sphere+0x153>
ucomisd %xmm0,%xmm2
jb     1273 <hcc2sphere+0x153>
movq   $0x0,(%rbx)
ucomisd %xmm0,%xmm3
jbe    129c <hcc2sphere+0x17c>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    129c <hcc2sphere+0x17c>
jp     129c <hcc2sphere+0x17c>
mov    0x2d5c(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd78(%rip),%xmm0
movsd  %xmm0,(%rbx)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    12bd <hcc2sphere+0x19d>
jp     12bd <hcc2sphere+0x19d>
ucomisd %xmm2,%xmm0
jbe    12bd <hcc2sphere+0x19d>
mov    0x2d33(%rip),%rax
movsd  (%rax),%xmm1
movsd  %xmm1,(%rbx)
ucomisd %xmm3,%xmm0
jbe    12e6 <hcc2sphere+0x1c6>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    12e6 <hcc2sphere+0x1c6>
jp     12e6 <hcc2sphere+0x1c6>
mov    0x2d12(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd36(%rip),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x30(%rsp),%xmm0
divsd  0xd2c(%rip),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @hcc2sphere(double %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store double* %4, double** %10
%16 = load double, double* %7
store double %16, double* %15
%17 = load double, double* %6
store double %17, double* %14
%18 = load double, double* %8
store double %18, double* %13
%19 = load double, double* %15
%20 = fdiv double %19, 6.960000e+08
store double %20, double* %12
%21 = load double, double* %14
%22 = load double, double* %13
%23 = fdiv double %21, %22
%24 = call double @llvm.fabs.f64(double %23)
store double %24, double* %11
%25 = load double, double* %13
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %27, label %34
27: ; preds = %5
%28 = load double, double* %14
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load double, double* %11
%32 = call double @atan(double %31)
%33 = load double*, double** %10
store double %32, double* %33
br label %34
34: ; preds = %30, %27, %5
%35 = load double, double* %13
%36 = fcmp ogt double %35, 0.000000e+00
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load double, double* %14
%39 = fcmp olt double %38, 0.000000e+00
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load double, double* @M_PI
%42 = load double, double* %11
%43 = call double @atan(double %42)
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %41, double %44)
%46 = load double*, double** %10
store double %45, double* %46
br label %47
47: ; preds = %40, %37, %34
%48 = load double, double* %13
%49 = fcmp olt double %48, 0.000000e+00
br i1 %49, label %50, label %59
50: ; preds = %47
%51 = load double, double* %14
%52 = fcmp ogt double %51, 0.000000e+00
br i1 %52, label %53, label %59
53: ; preds = %50
%54 = load double, double* @M_PI
%55 = load double, double* %11
%56 = call double @atan(double %55)
%57 = fsub double %54, %56
%58 = load double*, double** %10
store double %57, double* %58
br label %59
59: ; preds = %53, %50, %47
%60 = load double, double* %13
%61 = fcmp olt double %60, 0.000000e+00
br i1 %61, label %62, label %71
62: ; preds = %59
%63 = load double, double* %14
%64 = fcmp olt double %63, 0.000000e+00
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load double, double* @M_PI
%67 = load double, double* %11
%68 = call double @atan(double %67)
%69 = fadd double %66, %68
%70 = load double*, double** %10
store double %69, double* %70
br label %71
71: ; preds = %65, %62, %59
%72 = load double, double* %13
%73 = fcmp oeq double %72, 0.000000e+00
br i1 %73, label %74, label %79
74: ; preds = %71
%75 = load double, double* %14
%76 = fcmp oeq double %75, 0.000000e+00
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = load double*, double** %10
store double 0.000000e+00, double* %78
br label %79
79: ; preds = %77, %74, %71
%80 = load double, double* %13
%81 = fcmp ogt double %80, 0.000000e+00
br i1 %81, label %82, label %87
82: ; preds = %79
%83 = load double, double* %14
%84 = fcmp oeq double %83, 0.000000e+00
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = load double*, double** %10
store double 0.000000e+00, double* %86
br label %87
87: ; preds = %85, %82, %79
%88 = load double, double* %13
%89 = fcmp oeq double %88, 0.000000e+00
br i1 %89, label %90, label %97
90: ; preds = %87
%91 = load double, double* %14
%92 = fcmp ogt double %91, 0.000000e+00
br i1 %92, label %93, label %97
93: ; preds = %90
%94 = load double, double* @M_PI
%95 = fdiv double %94, 2.000000e+00
%96 = load double*, double** %10
store double %95, double* %96
br label %97
97: ; preds = %93, %90, %87
%98 = load double, double* %13
%99 = fcmp olt double %98, 0.000000e+00
br i1 %99, label %100, label %106
100: ; preds = %97
%101 = load double, double* %14
%102 = fcmp oeq double %101, 0.000000e+00
br i1 %102, label %103, label %106
103: ; preds = %100
%104 = load double, double* @M_PI
%105 = load double*, double** %10
store double %104, double* %105
br label %106
106: ; preds = %103, %100, %97
%107 = load double, double* %13
%108 = fcmp oeq double %107, 0.000000e+00
br i1 %108, label %109, label %116
109: ; preds = %106
%110 = load double, double* %14
%111 = fcmp olt double %110, 0.000000e+00
br i1 %111, label %112, label %116
112: ; preds = %109
%113 = load double, double* @M_PI
%114 = fmul double 1.500000e+00, %113
%115 = load double*, double** %10
store double %114, double* %115
br label %116
116: ; preds = %112, %109, %106
%117 = load double, double* %12
%118 = call double @acos(double %117)
%119 = load double*, double** %9
store double %118, double* %119
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @hcc2sphere(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = fdiv double %0, %2
%7 = tail call double @llvm.fabs.f64(double %6)
%8 = fcmp ogt double %2, 0.000000e+00
%9 = fcmp ogt double %0, 0.000000e+00
%10 = and i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call double @atan(double %7)
store double %12, double* %4
br label %13
13: ; preds = %11, %5
%14 = fcmp olt double %0, 0.000000e+00
%15 = and i1 %14, %8
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load double, double* @M_PI
%18 = tail call double @atan(double %7)
%19 = fneg double %18
%20 = tail call double @llvm.fmuladd.f64(double %17, double 2.000000e+00, double %19)
store double %20, double* %4
br label %21
21: ; preds = %16, %13
%22 = fcmp olt double %2, 0.000000e+00
%23 = and i1 %9, %22
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load double, double* @M_PI
%26 = tail call double @atan(double %7)
%27 = fsub double %25, %26
store double %27, double* %4
br label %28
28: ; preds = %24, %21
%29 = and i1 %14, %22
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = load double, double* @M_PI
%32 = tail call double @atan(double %7)
%33 = fadd double %31, %32
store double %33, double* %4
br label %34
34: ; preds = %30, %28
%35 = fcmp oeq double %2, 0.000000e+00
%36 = fcmp oeq double %0, 0.000000e+00
%37 = fcmp oge double %2, 0.000000e+00
%38 = and i1 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %34
store double 0.000000e+00, double* %4
br label %40
40: ; preds = %34, %39
%41 = and i1 %9, %35
br i1 %41, label %42, label %45
42: ; preds = %40
%43 = load double, double* @M_PI
%44 = fmul double %43, 5.000000e-01
store double %44, double* %4
br label %45
45: ; preds = %42, %40
%46 = and i1 %36, %22
br i1 %46, label %47, label %49
47: ; preds = %45
%48 = load double, double* @M_PI
store double %48, double* %4
br label %49
49: ; preds = %47, %45
%50 = and i1 %14, %35
br i1 %50, label %51, label %54
51: ; preds = %49
%52 = load double, double* @M_PI
%53 = fmul double %52, 1.500000e+00
store double %53, double* %4
br label %54
54: ; preds = %51, %49
%55 = fdiv double %1, 6.960000e+08
%56 = tail call double @acos(double %55)
store double %56, double* %3
ret void
}