#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 scanf(char *, ...);
int showMenu() {
  printf("create account---------->1\n");
  printf("save          ---------->2\n");
  printf("withdraw      ---------->3\n");
  printf("query         ---------->4\n");
  printf("exit          ---------->0\n");
  printf("\tenter your choice:");
  int c;
  while (scanf("%d", &c) != 1) {
    scanf("%*[^\n]");
    printf("\tenter your choice>");
  }
  return c;
}


x86 assembly (clang, -O0):
<showMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     11aa <showMenu+0x8a>
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xf0a(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <showMenu+0x50>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showMenu>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11e4 <showMenu+0xb4>
lea    0xe78(%rip),%r14
lea    0xe78(%rip),%r15
lea    0xe67(%rip),%r12
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11c0 <showMenu+0x90>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"create account---------->1\0A\00"
@.str.1 = [28 x i8] c"save ---------->2\0A\00"
@.str.2 = [28 x i8] c"withdraw ---------->3\0A\00"
@.str.3 = [28 x i8] c"query ---------->4\0A\00"
@.str.4 = [28 x i8] c"exit ---------->0\0A\00"
@.str.5 = [20 x i8] c"\09enter your choice:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [7 x i8] c"%*[^\0A]\00"
@.str.8 = [20 x i8] c"\09enter your choice>\00"
define i32 @showMenu() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %8
8: ; preds = %11, %0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %8
14: ; preds = %8
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str.5 = [20 x i8] c"\09enter your choice:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [7 x i8] c"%*[^\0A]\00"
@.str.8 = [20 x i8] c"\09enter your choice>\00"
@str = [27 x i8] c"create account---------->1\00"
@str.9 = [27 x i8] c"save ---------->2\00"
@str.10 = [27 x i8] c"withdraw ---------->3\00"
@str.11 = [27 x i8] c"query ---------->4\00"
@str.12 = [27 x i8] c"exit ---------->0\00"
define i32 @showMenu() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%8 = bitcast i32* %1 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = icmp eq i32 %9, 1
br i1 %10, label %16, label %11
11: ; preds = %0, %11
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %11
16: ; preds = %11, %0
%17 = load i32, i32* %1
ret i32 %17
}