#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*/ deposit(int);
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int showBalance();
int /*<<< orphan*/ withdraw(int);
int main() {
  int choice, balance;
  do {
    menu();
    printf("\tEnter your choice: ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      printf("\tEnter Amount: ");
      scanf("%d", &balance);
      deposit(balance);
      break;
    case 2:
      printf("\tEnter Amount: ");
      scanf("%d", &balance);
      withdraw(balance);
      break;
    case 3:
      printf("\tCurrent Balance:  %d\n", showBalance());
      break;
    case 4:
      break;
    default:
      printf("\tWrong Choice\n");
    }
  } while (choice != 4);
  printf("\tThank you for visiting.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <menu@plt>
mov    -0x19(%rbp),%al
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1238 <main+0xd8>
mov    -0x18(%rbp),%rax
lea    0xe48(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <deposit@plt>
jmp    1246 <main+0xe6>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe24(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1030 <withdraw@plt>
jmp    1246 <main+0xe6>
mov    $0x0,%al
call   1080 <showBalance@plt>
mov    %eax,%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1246 <main+0xe6>
jmp    1246 <main+0xe6>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    124b <main+0xeb>
cmpl   $0x4,-0x8(%rbp)
jne    116f <main+0xf>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%r14
lea    0xe9c(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xe6b(%rip),%r12
lea    0xe8c(%rip),%r13
mov    %rsp,%rbp
jmp    11c7 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x4,0x4(%rsp)
je     126c <main+0xfc>
xor    %eax,%eax
call   1050 <menu@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11b0 <main+0x40>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1070 <deposit@plt>
jmp    11bc <main+0x4c>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1030 <withdraw@plt>
jmp    11bc <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1090 <showBalance@plt>
lea    0xdda(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11bc <main+0x4c>
lea    0xddc(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\09Enter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"\09Enter Amount: \00"
@.str.3 = [23 x i8] c"\09Current Balance: %d\0A\00"
@.str.4 = [15 x i8] c"\09Wrong Choice\0A\00"
@.str.5 = [26 x i8] c"\09Thank you for visiting.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %26, %0
%5 = call i32 (...) @menu()
%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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
switch i32 %8, label %23 [
i32 1, label %9
i32 2, label %14
i32 3, label %19
i32 4, label %22
]
9: ; preds = %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 @deposit(i32 %12)
br label %25
14: ; preds = %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = call i32 @withdraw(i32 %17)
br label %25
19: ; preds = %4
%20 = call i32 (...) @showBalance()
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %25
22: ; preds = %4
br label %25
23: ; preds = %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %22, %19, %14, %9
br label %26
26: ; preds = %25
%27 = load i32, i32* %2
%28 = icmp ne i32 %27, 4
br i1 %28, label %4, label %29
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [21 x i8] c"\09Enter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"\09Enter Amount: \00"
@.str.3 = [23 x i8] c"\09Current Balance: %d\0A\00"
@str = [25 x i8] c"\09Thank you for visiting.\00"
@str.6 = [14 x i8] c"\09Wrong Choice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %25, %0
%6 = call i32 (...) @menu()
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %23 [
i32 1, label %10
i32 2, label %15
i32 3, label %20
i32 4, label %28
]
10: ; preds = %5
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = call i32 @deposit(i32 %13)
br label %25
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = call i32 @withdraw(i32 %18)
br label %25
20: ; preds = %5
%21 = call i32 (...) @showBalance()
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %5
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
br label %25
25: ; preds = %10, %15, %20, %23
%26 = load i32, i32* %1
%27 = icmp eq i32 %26, 4
br i1 %27, label %28, label %5
28: ; preds = %5, %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret i32 0
}