#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 acos(double);
double cos(double);
double pow(double, double);
double sqrt(double);
double tan(double);
double Phi(double alpha, double beta, double z) {
  double C = (1.5e8 - z) / cos(alpha);
  double B = C * tan(beta);
  double E = sqrt(pow(B, 2.0) + pow(C, 2.0));
  double D1 = pow(1.5e8, 2.0) + pow(C, 2.0);
  double D2 = 2.0 * 1.5e8 * C * cos(alpha);
  double D = sqrt(D1 - D2);
  double G = C + D;
  double r = sqrt(pow(B, 2.0) + pow(D, 2.0));
  if (D2 > D1)
    return 1.570796327;
  if (B == 0.0)
    return 0.0;
  else
    return acos((pow(G, 2.0) + pow(r, 2.0) - pow(E, 2.0)) / (2.0 * G * r));
}


x86 assembly (clang, -O0):
<Phi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xe9e(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1040 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe14(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xe01(%rip),%xmm0
movsd  0xde9(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdd2(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdbc(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xd5f(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xd48(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12f5 <Phi+0x1a5>
movsd  0xd2d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    139e <Phi+0x24e>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    131a <Phi+0x1ca>
jp     131a <Phi+0x1ca>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    139e <Phi+0x24e>
movsd  -0x58(%rbp),%xmm0
movsd  0xcd9(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  0xcbf(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  0xc96(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  0xc7a(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Phi>:
sub    $0x38,%rsp
movsd  %xmm1,(%rsp)
movsd  0xeaf(%rip),%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
call   1050 <cos@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <tan@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
addsd  %xmm1,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
movsd  %xmm1,0x10(%rsp)
jb     11bf <Phi+0x7f>
sqrtsd %xmm0,%xmm0
jmp    11c4 <Phi+0x84>
call   1060 <sqrt@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe31(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe2c(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movapd %xmm0,%xmm1
mulsd  0x30(%rsp),%xmm1
movsd  (%rsp),%xmm0
movsd  %xmm1,0x18(%rsp)
subsd  %xmm1,%xmm0
ucomisd 0xe04(%rip),%xmm0
jb     1224 <Phi+0xe4>
sqrtsd %xmm0,%xmm4
jmp    122d <Phi+0xed>
call   1060 <sqrt@plt>
movapd %xmm0,%xmm4
movsd  0x10(%rsp),%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     124f <Phi+0x10f>
sqrtsd %xmm0,%xmm0
jmp    1260 <Phi+0x120>
movsd  %xmm4,0x10(%rsp)
call   1060 <sqrt@plt>
movsd  0x10(%rsp),%xmm4
movsd  0x18(%rsp),%xmm1
ucomisd (%rsp),%xmm1
jbe    1277 <Phi+0x137>
movsd  0xda3(%rip),%xmm1
jmp    1289 <Phi+0x149>
xorpd  %xmm1,%xmm1
movsd  0x28(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jne    1292 <Phi+0x152>
jp     1292 <Phi+0x152>
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret
movsd  0x8(%rsp),%xmm3
addsd  %xmm4,%xmm3
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
addsd  %xmm3,%xmm3
mulsd  %xmm0,%xmm3
divsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
jmp    1030 <acos@plt>

LLVM IR (-O0):
define double @Phi(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%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* %5
store double %1, double* %6
store double %2, double* %7
%16 = load double, double* %7
%17 = fsub double 1.500000e+08, %16
%18 = load double, double* %5
%19 = call double @cos(double %18)
%20 = fdiv double %17, %19
store double %20, double* %8
%21 = load double, double* %8
%22 = load double, double* %6
%23 = call double @tan(double %22)
%24 = fmul double %21, %23
store double %24, double* %9
%25 = load double, double* %9
%26 = call double @pow(double %25, double 2.000000e+00)
%27 = load double, double* %8
%28 = call double @pow(double %27, double 2.000000e+00)
%29 = fadd double %26, %28
%30 = call double @sqrt(double %29)
store double %30, double* %10
%31 = call double @pow(double 1.500000e+08, double 2.000000e+00)
%32 = load double, double* %8
%33 = call double @pow(double %32, double 2.000000e+00)
%34 = fadd double %31, %33
store double %34, double* %11
%35 = load double, double* %8
%36 = fmul double 3.000000e+08, %35
%37 = load double, double* %5
%38 = call double @cos(double %37)
%39 = fmul double %36, %38
store double %39, double* %12
%40 = load double, double* %11
%41 = load double, double* %12
%42 = fsub double %40, %41
%43 = call double @sqrt(double %42)
store double %43, double* %13
%44 = load double, double* %8
%45 = load double, double* %13
%46 = fadd double %44, %45
store double %46, double* %14
%47 = load double, double* %9
%48 = call double @pow(double %47, double 2.000000e+00)
%49 = load double, double* %13
%50 = call double @pow(double %49, double 2.000000e+00)
%51 = fadd double %48, %50
%52 = call double @sqrt(double %51)
store double %52, double* %15
%53 = load double, double* %12
%54 = load double, double* %11
%55 = fcmp ogt double %53, %54
br i1 %55, label %56, label %57
56: ; preds = %3
store double 0x3FF921FB54524550, double* %4
br label %76
57: ; preds = %3
%58 = load double, double* %9
%59 = fcmp oeq double %58, 0.000000e+00
br i1 %59, label %60, label %61
60: ; preds = %57
store double 0.000000e+00, double* %4
br label %76
61: ; preds = %57
%62 = load double, double* %14
%63 = call double @pow(double %62, double 2.000000e+00)
%64 = load double, double* %15
%65 = call double @pow(double %64, double 2.000000e+00)
%66 = fadd double %63, %65
%67 = load double, double* %10
%68 = call double @pow(double %67, double 2.000000e+00)
%69 = fsub double %66, %68
%70 = load double, double* %14
%71 = fmul double 2.000000e+00, %70
%72 = load double, double* %15
%73 = fmul double %71, %72
%74 = fdiv double %69, %73
%75 = call double @acos(double %74)
store double %75, double* %4
br label %76
76: ; preds = %61, %60, %56
%77 = load double, double* %4
ret double %77
}

LLVM IR (-O2):
define double @Phi(double %0, double %1, double %2) {
%4 = fsub double 1.500000e+08, %2
%5 = tail call double @cos(double %0)
%6 = fdiv double %4, %5
%7 = tail call double @tan(double %1)
%8 = fmul double %6, %7
%9 = fmul double %8, %8
%10 = fmul double %6, %6
%11 = fadd double %10, %9
%12 = tail call double @sqrt(double %11)
%13 = fadd double %10, 2.250000e+16
%14 = fmul double %6, 3.000000e+08
%15 = tail call double @cos(double %0)
%16 = fmul double %14, %15
%17 = fsub double %13, %16
%18 = tail call double @sqrt(double %17)
%19 = fadd double %6, %18
%20 = fmul double %18, %18
%21 = fadd double %9, %20
%22 = tail call double @sqrt(double %21)
%23 = fcmp ogt double %16, %13
br i1 %23, label %36, label %24
24: ; preds = %3
%25 = fcmp oeq double %8, 0.000000e+00
br i1 %25, label %36, label %26
26: ; preds = %24
%27 = fmul double %19, %19
%28 = fmul double %22, %22
%29 = fadd double %27, %28
%30 = fmul double %12, %12
%31 = fsub double %29, %30
%32 = fmul double %19, 2.000000e+00
%33 = fmul double %22, %32
%34 = fdiv double %31, %33
%35 = tail call double @acos(double %34)
br label %36
36: ; preds = %24, %3, %26
%37 = phi double [ %35, %26 ], [ 0x3FF921FB54524550, %3 ], [ 0.000000e+00, %24 ]
ret double %37
}