#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);
int floor(double);
double sin(double);
int tankVol(int h, int d, int vt) {
  double height = h;
  double radius = d / 2.0;
  double velocity = vt;
  double sector_angle = 2.0 * acos((1.0 - (height / radius)));
  double segment_area =
      (radius * radius * (sector_angle - sin(sector_angle))) / 2.0;
  double cylinder_length = velocity / (radius * radius * M_PI);
  return floor(segment_area * cylinder_length);
}


x86 assembly (clang, -O0):
<tankVol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  0xe8b(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1030 <acos@plt>
movaps %xmm0,%xmm1
movsd  0xe6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe26(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mov    0x2def(%rip),%rax
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1050 <floor@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tankVol>:
sub    $0x18,%rsp
cvtsi2sd %edi,%xmm1
cvtsi2sd %esi,%xmm3
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0xeb2(%rip),%xmm3
movsd  %xmm3,(%rsp)
divsd  %xmm3,%xmm1
movsd  0xea9(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1030 <acos@plt>
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  0xe58(%rip),%xmm1
movapd %xmm1,%xmm2
mov    0x2e35(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
jmp    1050 <floor@plt>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @tankVol(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
store double %14, double* %7
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, 2.000000e+00
store double %17, double* %8
%18 = load i32, i32* %6
%19 = sitofp i32 %18 to double
store double %19, double* %9
%20 = load double, double* %7
%21 = load double, double* %8
%22 = fdiv double %20, %21
%23 = fsub double 1.000000e+00, %22
%24 = call double @acos(double %23)
%25 = fmul double 2.000000e+00, %24
store double %25, double* %10
%26 = load double, double* %8
%27 = load double, double* %8
%28 = fmul double %26, %27
%29 = load double, double* %10
%30 = load double, double* %10
%31 = call double @sin(double %30)
%32 = fsub double %29, %31
%33 = fmul double %28, %32
%34 = fdiv double %33, 2.000000e+00
store double %34, double* %11
%35 = load double, double* %9
%36 = load double, double* %8
%37 = load double, double* %8
%38 = fmul double %36, %37
%39 = load double, double* @M_PI
%40 = fmul double %38, %39
%41 = fdiv double %35, %40
store double %41, double* %12
%42 = load double, double* %11
%43 = load double, double* %12
%44 = fmul double %42, %43
%45 = call i32 @floor(double %44)
ret i32 %45
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @tankVol(i32 %0, i32 %1, i32 %2) {
%4 = sitofp i32 %0 to double
%5 = sitofp i32 %1 to double
%6 = fmul double %5, 5.000000e-01
%7 = sitofp i32 %2 to double
%8 = fdiv double %4, %6
%9 = fsub double 1.000000e+00, %8
%10 = tail call double @acos(double %9)
%11 = fmul double %10, 2.000000e+00
%12 = fmul double %6, %6
%13 = tail call double @sin(double %11)
%14 = fsub double %11, %13
%15 = fmul double %12, %14
%16 = fmul double %15, 5.000000e-01
%17 = load double, double* @M_PI
%18 = fmul double %12, %17
%19 = fdiv double %7, %18
%20 = fmul double %16, %19
%21 = tail call i32 @floor(double %20)
ret i32 %21
}