#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 circle_area(double);
double circle_column_volume(double, double);
double circle_length(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
double sphere_area(double);
double sphere_volume(double);
int main() {
  double length, area, volume, r, h;
  printf("input circle radius\n");
  scanf("%lf", &r);
  length = circle_length(r);
  printf("length: %.2f\n", length);
  area = circle_area(r);
  printf("circle_area: %.2f\n", area);
  area = sphere_area(r);
  printf("sphere_area: %.2f\n", area);
  volume = sphere_volume(r);
  printf("sphere_volume: %.2f\n", volume);
  printf("input height\n");
  scanf("%lf", &h);
  volume = circle_column_volume(r, h);
  printf("circle_column_volume: %.2f\n", volume);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
call   1060 <circle_length@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
call   1080 <circle_area@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
call   1050 <sphere_area@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe45(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
call   1070 <sphere_volume@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe36(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde2(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <circle_column_volume@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe14(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
movsd  (%rsp),%xmm0
call   1070 <circle_length@plt>
lea    0xe50(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
call   1090 <circle_area@plt>
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
call   1060 <sphere_area@plt>
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
call   1080 <sphere_volume@plt>
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <circle_column_volume@plt>
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"input circle radius\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [14 x i8] c"length: %.2f\0A\00"
@.str.3 = [19 x i8] c"circle_area: %.2f\0A\00"
@.str.4 = [19 x i8] c"sphere_area: %.2f\0A\00"
@.str.5 = [21 x i8] c"sphere_volume: %.2f\0A\00"
@.str.6 = [14 x i8] c"input height\0A\00"
@.str.7 = [28 x i8] c"circle_column_volume: %.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%8 = load double, double* %4
%9 = call double @circle_length(double %8)
store double %9, double* %1
%10 = load double, double* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = load double, double* %4
%13 = call double @circle_area(double %12)
store double %13, double* %2
%14 = load double, double* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %14)
%16 = load double, double* %4
%17 = call double @sphere_area(double %16)
store double %17, double* %2
%18 = load double, double* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = load double, double* %4
%21 = call double @sphere_volume(double %20)
store double %21, double* %3
%22 = load double, double* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%26 = load double, double* %4
%27 = load double, double* %5
%28 = call double @circle_column_volume(double %26, double %27)
store double %28, double* %3
%29 = load double, double* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %29)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [14 x i8] c"length: %.2f\0A\00"
@.str.3 = [19 x i8] c"circle_area: %.2f\0A\00"
@.str.4 = [19 x i8] c"sphere_area: %.2f\0A\00"
@.str.5 = [21 x i8] c"sphere_volume: %.2f\0A\00"
@.str.7 = [28 x i8] c"circle_column_volume: %.2f\0A\00"
@str = [20 x i8] c"input circle radius\00"
@str.8 = [13 x i8] c"input height\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%7 = load double, double* %1
%8 = call double @circle_length(double %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %8)
%10 = load double, double* %1
%11 = call double @circle_area(double %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = load double, double* %1
%14 = call double @sphere_area(double %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %14)
%16 = load double, double* %1
%17 = call double @sphere_volume(double %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %17)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%21 = load double, double* %1
%22 = load double, double* %2
%23 = call double @circle_column_volume(double %21, double %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %23)
ret i32 0
}