#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*/ _getch();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ system(char *);
int main() {
  int iAns = 0;
  float a, r;
  float tf, tc;
  do {
    system("cls");
    printf("0-Exit\n");
    printf("1-Area\n");
    printf("2-Temp\n");
    printf("please choose : ");
    scanf("%d", &iAns);
    switch (iAns) {
    case 0:
      exit(0);
    case 1:
      printf("enter r ");
      scanf("%f", &r);
      a = 3.14 * r * r;
      printf("\nArea is %f ", a);
      break;
    case 2:
      printf("enter tf ");
      scanf("%f", &tf);
      tc = (5 * (tf - 32)) / 9;
      printf("\ntc is %f ", tc);
      break;
    default:
      printf("error\n");
      break;
    }
    _getch();
  } while (iAns != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeab(%rip),%rdi
call   1030 <system@plt>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x1d(%rbp)
call   1040 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xe8b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     11f8 <main+0xa8>
jmp    11d6 <main+0x86>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     11ff <main+0xaf>
jmp    11e7 <main+0x97>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     1266 <main+0x116>
jmp    12d0 <main+0x180>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xde0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfa(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    12de <main+0x18e>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd6(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movss  -0x14(%rbp),%xmm1
movss  0xd75(%rip),%xmm0
subss  %xmm0,%xmm1
movss  0xd65(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xd55(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    12de <main+0x18e>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <_getch@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1166 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
lea    0xee1(%rip),%r15
lea    0xee1(%rip),%r12
lea    0xee1(%rip),%r13
lea    0xe8a(%rip),%rbx
lea    0xe94(%rip),%rbp
lea    0xc(%rsp),%r14
jmp    1205 <main+0xa5>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movaps %xmm0,%xmm1
mulsd  0xe3a(%rip),%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe50(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <_getch@plt>
cmpl   $0x0,0xc(%rsp)
je     12bf <main+0x15f>
lea    0xe0c(%rip),%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11a0 <main+0x40>
cmp    $0x2,%eax
je     1270 <main+0x110>
test   %eax,%eax
je     12d0 <main+0x170>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
jmp    11f3 <main+0x93>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xdd2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdb4(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xd61(%rip),%xmm0
mulss  0xd5d(%rip),%xmm0
divss  0xd59(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd99(%rip),%rdi
jmp    11ec <main+0x8c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [8 x i8] c"0-Exit\0A\00"
@.str.2 = [8 x i8] c"1-Area\0A\00"
@.str.3 = [8 x i8] c"2-Temp\0A\00"
@.str.4 = [17 x i8] c"please choose : \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [9 x i8] c"enter r \00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [13 x i8] c"\0AArea is %f \00"
@.str.9 = [10 x i8] c"enter tf \00"
@.str.10 = [11 x i8] c"\0Atc is %f \00"
@.str.11 = [7 x i8] c"error\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %44, %0
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %40 [
i32 0, label %15
i32 1, label %17
i32 2, label %30
]
15: ; preds = %7
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %4)
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = fmul double 3.140000e+00, %21
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = fmul double %22, %24
%26 = fptrunc double %25 to float
store float %26, float* %3
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %28)
br label %42
30: ; preds = %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %5)
%33 = load float, float* %5
%34 = fsub float %33, 3.200000e+01
%35 = fmul float 5.000000e+00, %34
%36 = fdiv float %35, 9.000000e+00
store float %36, float* %6
%37 = load float, float* %6
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), double %38)
br label %42
40: ; preds = %7
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %42
42: ; preds = %40, %30, %17
%43 = call i32 (...) @_getch()
br label %44
44: ; preds = %42
%45 = load i32, i32* %2
%46 = icmp ne i32 %45, 0
br i1 %46, label %7, label %47
47: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.4 = [17 x i8] c"please choose : \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [9 x i8] c"enter r \00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [13 x i8] c"\0AArea is %f \00"
@.str.9 = [10 x i8] c"enter tf \00"
@.str.10 = [11 x i8] c"\0Atc is %f \00"
@str = [7 x i8] c"0-Exit\00"
@str.12 = [7 x i8] c"1-Area\00"
@str.13 = [7 x i8] c"2-Temp\00"
@str.14 = [6 x i8] c"error\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
br label %7
7: ; preds = %38, %0
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %36 [
i32 0, label %15
i32 1, label %17
i32 2, label %27
]
15: ; preds = %7
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %7
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %2)
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = fmul double %21, 3.140000e+00
%23 = fmul double %22, %21
%24 = fptrunc double %23 to float
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %25)
br label %38
27: ; preds = %7
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %3)
%30 = load float, float* %3
%31 = fadd float %30, -3.200000e+01
%32 = fmul float %31, 5.000000e+00
%33 = fdiv float %32, 9.000000e+00
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), double %34)
br label %38
36: ; preds = %7
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.14, i64 0, i64 0))
br label %38
38: ; preds = %36, %27, %17
%39 = call i32 (...) @_getch()
%40 = load i32, i32* %1
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %7
42: ; preds = %38
ret i32 0
}