int main(void) {
  char help[] = "\nArea calc v 0.01:\n\t1: use rectangular math.\n\t2: use "
                "boxish math.\n\t3: use circular math.\n\t4: use triangular "
                "math.\n\t5: be helpful\n";
  float l, h, r, b;
  int opType;
  l = 0;
  h = 0;
  r = 0;
  b = 0;
  opType = 0;
  printf("Enter object: ");
  scanf("%d", &opType);
  if (opType == 1) {
    printf("Enter length, height: ");
    scanf("%f, %f", &l, &h);
    printf("Area = %f\n", calcRectArea(l, h));
    return 0;
  } else if (opType == 2) {
    printf("Enter length: ");
    scanf("%f", &l);
    printf("Area = %f\n", calcBoxArea(l));
    return 0;
  } else if (opType == 3) {
    printf("Enter radius: ");
    scanf("%f", &r);
    printf("Area = %f\n", calcCirArea(r));
    return 0;
  } else if (opType == 4) {
    printf("Enter base, height: ");
    scanf("%f, %f", &b, &h);
    printf("Area = %f\n", calcTriArea(b, h));
    return 0;
  } else if (opType == 5) {
    printf("%s\n", help);
    return 0;
  } else {
    printf("%s\n", help);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x82,%edx
call   1070 <memcpy@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x94(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0xa4(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0xa4(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
cmpl   $0x1,-0xa4(%rbp)
jne    1265 <main+0xf5>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x94(%rbp),%rsi
lea    -0x98(%rbp),%rdx
mov    $0x0,%al
call   1080 <scanf@plt>
movss  -0x94(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x98(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <calcRectArea@plt>
mov    %eax,%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13df <main+0x26f>
cmpl   $0x2,-0xa4(%rbp)
jne    12c4 <main+0x154>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe28(%rip),%rdi
lea    -0x94(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movss  -0x94(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1090 <calcBoxArea@plt>
mov    %eax,%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13df <main+0x26f>
cmpl   $0x3,-0xa4(%rbp)
jne    1323 <main+0x1b3>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdc9(%rip),%rdi
lea    -0x9c(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <calcCirArea@plt>
mov    %eax,%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13df <main+0x26f>
cmpl   $0x4,-0xa4(%rbp)
jne    1395 <main+0x225>
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd66(%rip),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0x98(%rbp),%rdx
mov    $0x0,%al
call   1080 <scanf@plt>
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x98(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1040 <calcTriArea@plt>
mov    %eax,%esi
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13df <main+0x26f>
cmpl   $0x5,-0xa4(%rbp)
jne    13c3 <main+0x253>
lea    -0x90(%rbp),%rsi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13df <main+0x26f>
lea    -0x90(%rbp),%rsi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xa8,%rsp
lea    0xe92(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    $0x82,%edx
call   1080 <memcpy@plt>
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1248 <main+0xc8>
lea    0xe07(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1060 <calcRectArea@plt>
jmp    1300 <main+0x180>
lea    0x20(%rsp),%rdi
call   1040 <puts@plt>
jmp    1310 <main+0x190>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe63(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   10a0 <calcBoxArea@plt>
jmp    1300 <main+0x180>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2f(%rip),%rdi
lea    0x1c(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <calcCirArea@plt>
jmp    1300 <main+0x180>
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdf7(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <calcTriArea@plt>
lea    0xdcb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
ret

LLVM IR (-O0):
@__const.main.help = [130 x i8] c"\0AArea calc v 0.01:\0A\091: use rectangular math.\0A\092: use boxish math.\0A\093: use circular math.\0A\094: use triangular math.\0A\095: be helpful\0A\00"
@.str = [15 x i8] c"Enter object: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter length, height: \00"
@.str.3 = [7 x i8] c"%f, %f\00"
@.str.4 = [11 x i8] c"Area = %f\0A\00"
@.str.5 = [15 x i8] c"Enter length: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [15 x i8] c"Enter radius: \00"
@.str.8 = [21 x i8] c"Enter base, height: \00"
@.str.9 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [130 x i8]
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [130 x i8]* %2 to i8*
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %3, float* %4)
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = call i32 (double, double, ...) bitcast (i32 (...)* @calcRectArea to i32 (double, double, ...)*)(double %17, double %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %20)
store i32 0, i32* %1
br label %63
22: ; preds = %0
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %3)
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = call i32 (double, ...) bitcast (i32 (...)* @calcBoxArea to i32 (double, ...)*)(double %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %30)
store i32 0, i32* %1
br label %63
32: ; preds = %22
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %42
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %5)
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = call i32 (double, ...) bitcast (i32 (...)* @calcCirArea to i32 (double, ...)*)(double %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %40)
store i32 0, i32* %1
br label %63
42: ; preds = %32
%43 = load i32, i32* %7
%44 = icmp eq i32 %43, 4
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %6, float* %4)
%48 = load float, float* %6
%49 = fpext float %48 to double
%50 = load float, float* %4
%51 = fpext float %50 to double
%52 = call i32 (double, double, ...) bitcast (i32 (...)* @calcTriArea to i32 (double, double, ...)*)(double %49, double %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %52)
store i32 0, i32* %1
br label %63
54: ; preds = %42
%55 = load i32, i32* %7
%56 = icmp eq i32 %55, 5
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = getelementptr inbounds [130 x i8], [130 x i8]* %2, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %58)
store i32 0, i32* %1
br label %63
60: ; preds = %54
%61 = getelementptr inbounds [130 x i8], [130 x i8]* %2, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %61)
store i32 0, i32* %1
br label %63
63: ; preds = %60, %57, %45, %35, %25, %13
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@__const.main.help = [130 x i8] c"\0AArea calc v 0.01:\0A\091: use rectangular math.\0A\092: use boxish math.\0A\093: use circular math.\0A\094: use triangular math.\0A\095: be helpful\0A\00"
@.str = [15 x i8] c"Enter object: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter length, height: \00"
@.str.3 = [7 x i8] c"%f, %f\00"
@.str.4 = [11 x i8] c"Area = %f\0A\00"
@.str.5 = [15 x i8] c"Enter length: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [15 x i8] c"Enter radius: \00"
@.str.8 = [21 x i8] c"Enter base, height: \00"
define i32 @main() {
%1 = alloca [130 x i8]
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = getelementptr inbounds [130 x i8], [130 x i8]* %1, i64 0, i64 0
%8 = bitcast float* %2 to i8*
%9 = bitcast float* %3 to i8*
%10 = bitcast float* %4 to i8*
%11 = bitcast float* %5 to i8*
%12 = bitcast i32* %6 to i8*
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store i32 0, i32* %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
switch i32 %15, label %50 [
i32 1, label %16
i32 2, label %25
i32 3, label %32
i32 4, label %39
i32 5, label %48
]
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %2, float* %3)
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = load float, float* %3
%22 = fpext float %21 to double
%23 = call i32 (double, double, ...) bitcast (i32 (...)* @calcRectArea to i32 (double, double, ...)*)(double %20, double %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br label %52
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %2)
%28 = load float, float* %2
%29 = fpext float %28 to double
%30 = call i32 (double, ...) bitcast (i32 (...)* @calcBoxArea to i32 (double, ...)*)(double %29)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %52
32: ; preds = %0
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %4)
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = call i32 (double, ...) bitcast (i32 (...)* @calcCirArea to i32 (double, ...)*)(double %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %52
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float* %5, float* %3)
%42 = load float, float* %5
%43 = fpext float %42 to double
%44 = load float, float* %3
%45 = fpext float %44 to double
%46 = call i32 (double, double, ...) bitcast (i32 (...)* @calcTriArea to i32 (double, double, ...)*)(double %43, double %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %52
48: ; preds = %0
%49 = call i32 @puts(i8* %7)
br label %52
50: ; preds = %0
%51 = call i32 @puts(i8* %7)
br label %52
52: ; preds = %50, %48, %39, %32, %25, %16
ret i32 0
}