#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 atan(double);
double tan(double);
double cone_volume(double r, double r2, double h) {
  double angle, h2;
  if (r - r2 == 0) {
    return 3.1415927 * r * r * h;
  }
  angle = atan(h / (r - r2));
  h2 = r2 * tan(angle);
  return (0.3 * 3.1415927 * r * r * (h + h2)) - (0.3 * 3.1415927 * r * r * h2);
}


x86 assembly (clang, -O0):
<cone_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1175 <cone_volume+0x55>
jp     1175 <cone_volume+0x55>
movsd  0xeac(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    120e <cone_volume+0xee>
movsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <atan@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe41(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
addsd  -0x30(%rbp),%xmm2
movsd  0xe25(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cone_volume>:
sub    $0x18,%rsp
movapd %xmm0,%xmm3
movapd %xmm0,%xmm4
subsd  %xmm1,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jne    1155 <cone_volume+0x35>
jp     1155 <cone_volume+0x35>
movsd  0xec4(%rip),%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
add    $0x18,%rsp
ret
movapd %xmm2,%xmm0
divsd  %xmm4,%xmm0
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <atan@plt>
call   1040 <tan@plt>
mulsd  (%rsp),%xmm0
movsd  0xe7b(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @cone_volume(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %5
%11 = load double, double* %6
%12 = fsub double %10, %11
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %14, label %21
14: ; preds = %3
%15 = load double, double* %5
%16 = fmul double 0x400921FB5A7ED197, %15
%17 = load double, double* %5
%18 = fmul double %16, %17
%19 = load double, double* %7
%20 = fmul double %18, %19
store double %20, double* %4
br label %47
21: ; preds = %3
%22 = load double, double* %7
%23 = load double, double* %5
%24 = load double, double* %6
%25 = fsub double %23, %24
%26 = fdiv double %22, %25
%27 = call double @atan(double %26)
store double %27, double* %8
%28 = load double, double* %6
%29 = load double, double* %8
%30 = call double @tan(double %29)
%31 = fmul double %28, %30
store double %31, double* %9
%32 = load double, double* %5
%33 = fmul double 0x3FEE28C73964FB82, %32
%34 = load double, double* %5
%35 = fmul double %33, %34
%36 = load double, double* %7
%37 = load double, double* %9
%38 = fadd double %36, %37
%39 = load double, double* %5
%40 = fmul double 0x3FEE28C73964FB82, %39
%41 = load double, double* %5
%42 = fmul double %40, %41
%43 = load double, double* %9
%44 = fmul double %42, %43
%45 = fneg double %44
%46 = call double @llvm.fmuladd.f64(double %35, double %38, double %45)
store double %46, double* %4
br label %47
47: ; preds = %21, %14
%48 = load double, double* %4
ret double %48
}

LLVM IR (-O2):
define double @cone_volume(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fcmp oeq double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = fmul double %0, 0x400921FB5A7ED197
%8 = fmul double %7, %0
%9 = fmul double %8, %2
br label %21
10: ; preds = %3
%11 = fdiv double %2, %4
%12 = tail call double @atan(double %11)
%13 = tail call double @tan(double %12)
%14 = fmul double %13, %1
%15 = fmul double %0, 0x3FEE28C73964FB82
%16 = fmul double %15, %0
%17 = fadd double %14, %2
%18 = fneg double %16
%19 = fmul double %14, %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %19)
br label %21
21: ; preds = %10, %6
%22 = phi double [ %9, %6 ], [ %20, %10 ]
ret double %22
}