#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 abs(int);
double exp(double);
double calcTemp(double height) {
  double temp = 0.0;
  int iHeight = (int)height;
  int check = (iHeight - 29) + abs(iHeight - 29);
  check = (check + 2) % (check + 1);
  temp = (273.15 * exp(-0.07 * (height - 30)) - 273.15) * check;
  check = ((iHeight - 9) + abs(iHeight - 9)) * (int)(30.01 / (iHeight + 1));
  check = (check + 2) % (check + 1);
  temp += (-2.5 * (height - 10) + 50) * check;
  check = (int)(10.01 / (iHeight + 1));
  check = (check + 2) % (check + 1);
  temp += ((0.6 * height * height) - 10) * check;
  return temp;
}


x86 assembly (clang, -O0):
<calcTemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1d,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
sub    $0x1d,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  0xea1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
sub    $0x9,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cvtsi2sd %ecx,%xmm1
movsd  0xe4e(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
imul   %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe19(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdfd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xdbc(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
movsd  0xd8f(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd71(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcTemp>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cvttsd2si %xmm0,%ebx
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
lea    -0x9(%rbx),%eax
lea    -0x9(%rbx),%ebp
neg    %ebp
cmp    $0x9,%ebx
cmovge %eax,%ebp
lea    -0x1d(%rbx),%eax
lea    -0x1d(%rbx),%ecx
neg    %ecx
cmp    $0x1d,%ebx
cmovge %eax,%ecx
lea    (%rcx,%rbx,1),%eax
add    $0xffffffe5,%eax
lea    -0x1c(%rcx,%rbx,1),%ecx
movsd  0xeac(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xea8(%rip),%xmm0
cltd
idiv   %ecx
mov    %edx,%r14d
call   1030 <exp@plt>
mulsd  0xe9d(%rip),%xmm0
addsd  0xe9d(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
lea    (%rbx,%rbp,1),%eax
add    $0xfffffff7,%eax
add    $0x1,%ebx
cvtsi2sd %ebx,%xmm2
movsd  0xe88(%rip),%xmm3
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%ecx
mulsd  %xmm1,%xmm0
imul   %eax,%ecx
lea    0x2(%rcx),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
movsd  0xe70(%rip),%xmm1
movsd  0x8(%rsp),%xmm5
movapd %xmm5,%xmm3
addsd  %xmm1,%xmm3
mulsd  0xe62(%rip),%xmm3
addsd  0xe62(%rip),%xmm3
cvtsi2sd %edx,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm4,%xmm0
movsd  0xe56(%rip),%xmm3
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%ecx
lea    0x2(%rcx),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
movsd  0xe45(%rip),%xmm2
mulsd  %xmm5,%xmm2
mulsd  %xmm5,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @calcTemp(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store double %0, double* %2
store double 0.000000e+00, double* %3
%6 = load double, double* %2
%7 = fptosi double %6 to i32
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 29
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 29
%12 = call i32 @abs(i32 %11)
%13 = add nsw i32 %9, %12
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 2
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
%18 = srem i32 %15, %17
store i32 %18, i32* %5
%19 = load double, double* %2
%20 = fsub double %19, 3.000000e+01
%21 = fmul double -7.000000e-02, %20
%22 = call double @exp(double %21)
%23 = call double @llvm.fmuladd.f64(double 2.731500e+02, double %22, double -2.731500e+02)
%24 = load i32, i32* %5
%25 = sitofp i32 %24 to double
%26 = fmul double %23, %25
store double %26, double* %3
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 9
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 9
%31 = call i32 @abs(i32 %30)
%32 = add nsw i32 %28, %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
%35 = sitofp i32 %34 to double
%36 = fdiv double 3.001000e+01, %35
%37 = fptosi double %36 to i32
%38 = mul nsw i32 %32, %37
store i32 %38, i32* %5
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 2
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = srem i32 %40, %42
store i32 %43, i32* %5
%44 = load double, double* %2
%45 = fsub double %44, 1.000000e+01
%46 = call double @llvm.fmuladd.f64(double -2.500000e+00, double %45, double 5.000000e+01)
%47 = load i32, i32* %5
%48 = sitofp i32 %47 to double
%49 = load double, double* %3
%50 = call double @llvm.fmuladd.f64(double %46, double %48, double %49)
store double %50, double* %3
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
%53 = sitofp i32 %52 to double
%54 = fdiv double 1.001000e+01, %53
%55 = fptosi double %54 to i32
store i32 %55, i32* %5
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 2
%58 = load i32, i32* %5
%59 = add nsw i32 %58, 1
%60 = srem i32 %57, %59
store i32 %60, i32* %5
%61 = load double, double* %2
%62 = fmul double 6.000000e-01, %61
%63 = load double, double* %2
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double -1.000000e+01)
%65 = load i32, i32* %5
%66 = sitofp i32 %65 to double
%67 = load double, double* %3
%68 = call double @llvm.fmuladd.f64(double %64, double %66, double %67)
store double %68, double* %3
%69 = load double, double* %3
ret double %69
}

LLVM IR (-O2):
define double @calcTemp(double %0) {
%2 = fptosi double %0 to i32
%3 = add nsw i32 %2, -29
%4 = icmp slt i32 %2, 29
%5 = sub i32 29, %2
%6 = select i1 %4, i32 %5, i32 %3
%7 = add nsw i32 %6, %3
%8 = add nsw i32 %7, 2
%9 = add nsw i32 %7, 1
%10 = srem i32 %8, %9
%11 = fadd double %0, -3.000000e+01
%12 = fmul double %11, -7.000000e-02
%13 = tail call double @exp(double %12)
%14 = tail call double @llvm.fmuladd.f64(double %13, double 2.731500e+02, double -2.731500e+02)
%15 = sitofp i32 %10 to double
%16 = fmul double %14, %15
%17 = add nsw i32 %2, -9
%18 = icmp slt i32 %2, 9
%19 = sub i32 9, %2
%20 = select i1 %18, i32 %19, i32 %17
%21 = add nsw i32 %20, %17
%22 = add nsw i32 %2, 1
%23 = sitofp i32 %22 to double
%24 = fdiv double 3.001000e+01, %23
%25 = fptosi double %24 to i32
%26 = mul nsw i32 %21, %25
%27 = add nsw i32 %26, 2
%28 = add nsw i32 %26, 1
%29 = srem i32 %27, %28
%30 = fadd double %0, -1.000000e+01
%31 = tail call double @llvm.fmuladd.f64(double %30, double -2.500000e+00, double 5.000000e+01)
%32 = sitofp i32 %29 to double
%33 = tail call double @llvm.fmuladd.f64(double %31, double %32, double %16)
%34 = fdiv double 1.001000e+01, %23
%35 = fptosi double %34 to i32
%36 = add nsw i32 %35, 2
%37 = add nsw i32 %35, 1
%38 = srem i32 %36, %37
%39 = fmul double %0, 6.000000e-01
%40 = tail call double @llvm.fmuladd.f64(double %39, double %0, double -1.000000e+01)
%41 = sitofp i32 %38 to double
%42 = tail call double @llvm.fmuladd.f64(double %40, double %41, double %33)
ret double %42
}