#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 cos(double);
double pow(double, double);
int /*<<< orphan*/ printf(char *, double, double);
double sqrt(double);
double tan(double);
double Z_A(double alpha, double beta) {
  double K1 =
      (pow(tan(beta), 2.0) / pow(cos(alpha), 2.0)) + pow(tan(alpha), 2.0);
  double A1 = pow(2.0 * K1 * 1.5e8, 2.0) -
              4.0 * (K1 + 1.0) * (K1 * 1.5e8 * 1.5e8 - 6.96e5 * 6.96e5);
  double pre = 0.0;
  if (A1 < 0.0) {
    printf("Error on %le %le\n", alpha, beta);
    return -1.0;
  }
  pre = (2.0 * K1 * 1.5e8 + sqrt(A1)) / (2.0 * (K1 + 1.0));
  if (pre >= 0.0)
    return pre;
  printf("Error on %le %le\n", alpha, beta);
  return -1.0;
}


x86 assembly (clang, -O0):
<Z_A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <tan@plt>
movsd  0xeac(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  0xe90(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <tan@plt>
movsd  0xe68(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe4a(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe31(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe19(%rip),%xmm2
addsd  -0x20(%rbp),%xmm2
movsd  0xe04(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xde8(%rip),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xddb(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xdd7(%rip),%xmm3
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1297 <Z_A+0x147>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xdb0(%rip),%rdi
call   1030 <printf@plt>
movsd  0xd9b(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1331 <Z_A+0x1e1>
movsd  0xd81(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xd3d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd45(%rip),%xmm2
addsd  -0x20(%rbp),%xmm2
movsd  0xd40(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     130e <Z_A+0x1be>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1331 <Z_A+0x1e1>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xd11(%rip),%rdi
call   1030 <printf@plt>
movsd  0xcfc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Z_A>:
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
call   1040 <tan@plt>
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <tan@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm3
addsd  %xmm1,%xmm3
movsd  0xe55(%rip),%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe4d(%rip),%xmm4
addsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe41(%rip),%xmm1
mulsd  %xmm2,%xmm2
movsd  0xe3d(%rip),%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1238 <Z_A+0xf8>
ucomisd %xmm1,%xmm0
jb     11fd <Z_A+0xbd>
sqrtsd %xmm0,%xmm0
jmp    121a <Z_A+0xda>
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x18(%rsp)
call   1060 <sqrt@plt>
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
mulsd  0xdde(%rip),%xmm3
addsd  %xmm0,%xmm3
addsd  %xmm4,%xmm4
divsd  %xmm4,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jae    1258 <Z_A+0x118>
lea    0xde9(%rip),%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <printf@plt>
movsd  0xdc8(%rip),%xmm3
movapd %xmm3,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Error on %le %le\0A\00"
define double @Z_A(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
%9 = load double, double* %5
%10 = call double @tan(double %9)
%11 = call double @pow(double %10, double 2.000000e+00)
%12 = load double, double* %4
%13 = call double @cos(double %12)
%14 = call double @pow(double %13, double 2.000000e+00)
%15 = fdiv double %11, %14
%16 = load double, double* %4
%17 = call double @tan(double %16)
%18 = call double @pow(double %17, double 2.000000e+00)
%19 = fadd double %15, %18
store double %19, double* %6
%20 = load double, double* %6
%21 = fmul double 2.000000e+00, %20
%22 = fmul double %21, 1.500000e+08
%23 = call double @pow(double %22, double 2.000000e+00)
%24 = load double, double* %6
%25 = fadd double %24, 1.000000e+00
%26 = fmul double 4.000000e+00, %25
%27 = load double, double* %6
%28 = fmul double %27, 1.500000e+08
%29 = call double @llvm.fmuladd.f64(double %28, double 1.500000e+08, double -4.844160e+11)
%30 = fneg double %26
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %23)
store double %31, double* %7
store double 0.000000e+00, double* %8
%32 = load double, double* %7
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %38
34: ; preds = %2
%35 = load double, double* %4
%36 = load double, double* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %35, double %36)
store double -1.000000e+00, double* %3
br label %56
38: ; preds = %2
%39 = load double, double* %6
%40 = fmul double 2.000000e+00, %39
%41 = load double, double* %7
%42 = call double @sqrt(double %41)
%43 = call double @llvm.fmuladd.f64(double %40, double 1.500000e+08, double %42)
%44 = load double, double* %6
%45 = fadd double %44, 1.000000e+00
%46 = fmul double 2.000000e+00, %45
%47 = fdiv double %43, %46
store double %47, double* %8
%48 = load double, double* %8
%49 = fcmp oge double %48, 0.000000e+00
br i1 %49, label %50, label %52
50: ; preds = %38
%51 = load double, double* %8
store double %51, double* %3
br label %56
52: ; preds = %38
%53 = load double, double* %4
%54 = load double, double* %5
%55 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %53, double %54)
store double -1.000000e+00, double* %3
br label %56
56: ; preds = %52, %50, %34
%57 = load double, double* %3
ret double %57
}

LLVM IR (-O2):
@.str = [18 x i8] c"Error on %le %le\0A\00"
define double @Z_A(double %0, double %1) {
%3 = tail call double @tan(double %1)
%4 = fmul double %3, %3
%5 = tail call double @cos(double %0)
%6 = fmul double %5, %5
%7 = fdiv double %4, %6
%8 = tail call double @tan(double %0)
%9 = fmul double %8, %8
%10 = fadd double %7, %9
%11 = fmul double %10, 2.000000e+00
%12 = fmul double %11, 1.500000e+08
%13 = fmul double %12, %12
%14 = fadd double %10, 1.000000e+00
%15 = fmul double %10, 1.500000e+08
%16 = tail call double @llvm.fmuladd.f64(double %15, double 1.500000e+08, double -4.844160e+11)
%17 = fmul double %14, -4.000000e+00
%18 = tail call double @llvm.fmuladd.f64(double %17, double %16, double %13)
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %26, label %20
20: ; preds = %2
%21 = tail call double @sqrt(double %18)
%22 = tail call double @llvm.fmuladd.f64(double %11, double 1.500000e+08, double %21)
%23 = fmul double %14, 2.000000e+00
%24 = fdiv double %22, %23
%25 = fcmp ult double %24, 0.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %20, %2
%27 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %0, double %1)
br label %28
28: ; preds = %26, %20
%29 = phi double [ %24, %20 ], [ -1.000000e+00, %26 ]
ret double %29
}