#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int ans;
  do {
    system("cls");
    printf("0-exit\n");
    printf("1-area\n");
    printf("2-gold price\n");
    printf("3-help\n");
    printf("please choose one ");
    scanf("%d", &ans);
    switch (ans) {
    case 0:
      printf("exiting....");
      exit(0);
      break;
    case 1:
      printf("area\n");
      break;
    case 2:
      printf("gold price\n");
      break;
    case 3:
      printf("help\n");
      break;
    }
    printf("\n");
    system("pause");
  } while (ans != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     120d <main+0xcd>
mov    -0x10(%rbp),%rax
lea    0xe3d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
jmp    120d <main+0xcd>
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
jmp    120d <main+0xcd>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
lea    0xe9b(%rip),%rbp
lea    0xea7(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xeaa(%rip),%r12
lea    0xe6d(%rip),%r13
jmp    11c5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
call   1050 <system@plt>
cmpl   $0x0,0x4(%rsp)
je     1237 <main+0xd7>
lea    0xe44(%rip),%rdi
call   1050 <system@plt>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5a(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%rax
ja     11ac <main+0x4c>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
lea    0xe1c(%rip),%rdi
jmp    *%rax
lea    0xe27(%rip),%rdi
jmp    11a7 <main+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xddb(%rip),%rdi
call   1060 <printf@plt>
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 = [14 x i8] c"2-gold price\0A\00"
@.str.4 = [8 x i8] c"3-help\0A\00"
@.str.5 = [19 x i8] c"please choose one \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [12 x i8] c"exiting....\00"
@.str.8 = [6 x i8] c"area\0A\00"
@.str.9 = [12 x i8] c"gold price\0A\00"
@.str.10 = [6 x i8] c"help\0A\00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %24, %0
%4 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %21 [
i32 0, label %12
i32 1, label %15
i32 2, label %17
i32 3, label %19
]
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %3
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %21
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %21
19: ; preds = %3
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
br label %21
21: ; preds = %3, %19, %17, %15
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
br i1 %26, label %3, label %27
27: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.5 = [19 x i8] c"please choose one \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [12 x i8] c"exiting....\00"
@.str.12 = [6 x i8] c"pause\00"
@str = [7 x i8] c"0-exit\00"
@str.13 = [7 x i8] c"1-area\00"
@str.14 = [13 x i8] c"2-gold price\00"
@str.15 = [7 x i8] c"3-help\00"
@str.16 = [5 x i8] c"help\00"
@str.17 = [11 x i8] c"gold price\00"
@str.18 = [5 x i8] c"area\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %20, %0
%4 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %20 [
i32 0, label %12
i32 1, label %17
i32 2, label %15
i32 3, label %16
]
12: ; preds = %3
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %3
br label %17
16: ; preds = %3
br label %17
17: ; preds = %3, %15, %16
%18 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.16, i64 0, i64 0), %16 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.17, i64 0, i64 0), %15 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0), %3 ]
%19 = call i32 @puts(i8* dereferenceable(1) %18)
br label %20
20: ; preds = %17, %3
%21 = call i32 @putchar(i32 10)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %3
25: ; preds = %20
ret i32 0
}