#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(int argc, const char *argv[]) {
  float r = 0.0, h = 0.0;
  printf("Please input R and H:\n");
  printf("r=");
  scanf("%f", &r);
  printf("h=");
  scanf("%f", &h);
  printf("\nCalculate result:\n");
  printf("C(circle)=%.2f\n", 2 * 3.1415927 * r);
  printf("S(circle)=%.2f\n", 3.1415927 * r * r);
  printf("S(sphere)=%.2f\n", 4 * 3.1415927 * r * r);
  printf("V(sphere)=%.2f\n", 3.1415927 * r * r * r / 3.0);
  printf("V(cylinder)=%.2f\n", 3.1415927 * r * r * h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe69(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
lea    0xe7a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe0e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdce(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdb0(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd85(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
lea    0xdf4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe54(%rip),%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movaps %xmm1,%xmm0
mulsd  0xe39(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xe1a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xe44(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movaps %xmm1,%xmm0
mulsd  0xde4(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
divsd  0xde4(%rip),%xmm0
lea    0xe1e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb4(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
lea    0xdf8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Please input R and H:\0A\00"
@.str.1 = [3 x i8] c"r=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"h=\00"
@.str.4 = [20 x i8] c"\0ACalculate result:\0A\00"
@.str.5 = [16 x i8] c"C(circle)=%.2f\0A\00"
@.str.6 = [16 x i8] c"S(circle)=%.2f\0A\00"
@.str.7 = [16 x i8] c"S(sphere)=%.2f\0A\00"
@.str.8 = [16 x i8] c"V(sphere)=%.2f\0A\00"
@.str.9 = [18 x i8] c"V(cylinder)=%.2f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %7)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%14 = load float, float* %6
%15 = fpext float %14 to double
%16 = fmul double 0x401921FB5A7ED197, %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %16)
%18 = load float, float* %6
%19 = fpext float %18 to double
%20 = fmul double 0x400921FB5A7ED197, %19
%21 = load float, float* %6
%22 = fpext float %21 to double
%23 = fmul double %20, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %23)
%25 = load float, float* %6
%26 = fpext float %25 to double
%27 = fmul double 0x402921FB5A7ED197, %26
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = fmul double %27, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), double %30)
%32 = load float, float* %6
%33 = fpext float %32 to double
%34 = fmul double 0x400921FB5A7ED197, %33
%35 = load float, float* %6
%36 = fpext float %35 to double
%37 = fmul double %34, %36
%38 = load float, float* %6
%39 = fpext float %38 to double
%40 = fmul double %37, %39
%41 = fdiv double %40, 3.000000e+00
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), double %41)
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = fmul double 0x400921FB5A7ED197, %44
%46 = load float, float* %6
%47 = fpext float %46 to double
%48 = fmul double %45, %47
%49 = load float, float* %7
%50 = fpext float %49 to double
%51 = fmul double %48, %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), double %51)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"r=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"h=\00"
@.str.5 = [16 x i8] c"C(circle)=%.2f\0A\00"
@.str.6 = [16 x i8] c"S(circle)=%.2f\0A\00"
@.str.7 = [16 x i8] c"S(sphere)=%.2f\0A\00"
@.str.8 = [16 x i8] c"V(sphere)=%.2f\0A\00"
@.str.9 = [18 x i8] c"V(cylinder)=%.2f\0A\00"
@str = [22 x i8] c"Please input R and H:\00"
@str.10 = [19 x i8] c"\0ACalculate result:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%6 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = fmul double %14, 0x401921FB5A7ED197
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %15)
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = fmul double %18, 0x400921FB5A7ED197
%20 = fmul double %19, %18
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %20)
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = fmul double %23, 0x402921FB5A7ED197
%25 = fmul double %24, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), double %25)
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = fmul double %28, 0x400921FB5A7ED197
%30 = fmul double %29, %28
%31 = fmul double %30, %28
%32 = fdiv double %31, 3.000000e+00
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), double %32)
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = fmul double %35, 0x400921FB5A7ED197
%37 = fmul double %36, %35
%38 = load float, float* %4
%39 = fpext float %38 to double
%40 = fmul double %37, %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), double %40)
ret i32 0
}