#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 /*<<< orphan*/ scanf(char *, ...);
long withdraw(long, double, long);
void withdrawMenu() {
  printf("\t enter Id>");
  long Id = 0;
  scanf("%ld", &Id);
  printf("\tenter passworld>");
  long pass = 0;
  scanf("%ld", &pass);
  printf("\tenter balance>");
  double balance = 0;
  scanf("%lf", &balance);
  long ret = withdraw(Id, balance, pass);
  if (-1 == ret) {
    printf("===========================\n");
    printf("passworld is invalid or no enough money\n");
    printf("===========================\n");
  } else {
    printf("===========================\n");
    printf("witdraw successful!\n");
    printf("===========================\n");
  }
}


x86 assembly (clang, -O0):
<withdrawMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x8(%rbp)
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
call   1030 <withdraw@plt>
mov    %rax,-0x20(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    -0x20(%rbp),%rax
jne    11fa <withdrawMenu+0xca>
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    121e <withdrawMenu+0xee>
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<withdrawMenu>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,0x10(%rsp)
lea    0xea9(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe85(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,(%rsp)
lea    0xe81(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%rdi
movsd  (%rsp),%xmm0
mov    0x8(%rsp),%rsi
call   1030 <withdraw@plt>
cmp    $0xffffffffffffffff,%rax
lea    0xe98(%rip),%r14
lea    0xe69(%rip),%rax
lea    0xe4e(%rip),%rbx
cmove  %rax,%rbx
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"\09 enter Id>\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [18 x i8] c"\09enter passworld>\00"
@.str.3 = [16 x i8] c"\09enter balance>\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [29 x i8] c"===========================\0A\00"
@.str.6 = [41 x i8] c"passworld is invalid or no enough money\0A\00"
@.str.7 = [21 x i8] c"witdraw successful!\0A\00"
define void @withdrawMenu() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca double
%4 = alloca i64
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* %2
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store double 0.000000e+00, double* %3
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
%11 = load i64, i64* %1
%12 = load double, double* %3
%13 = load i64, i64* %2
%14 = call i64 @withdraw(i64 %11, double %12, i64 %13)
store i64 %14, i64* %4
%15 = load i64, i64* %4
%16 = icmp eq i64 -1, %15
br i1 %16, label %17, label %21
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %25
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"\09 enter Id>\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [18 x i8] c"\09enter passworld>\00"
@.str.3 = [16 x i8] c"\09enter balance>\00"
@.str.4 = [4 x i8] c"%lf\00"
@str.8 = [20 x i8] c"witdraw successful!\00"
@str.11 = [40 x i8] c"passworld is invalid or no enough money\00"
@str.12 = [28 x i8] c"===========================\00"
define void @withdrawMenu() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca double
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%8 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%11 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
%13 = load i64, i64* %1
%14 = load double, double* %3
%15 = load i64, i64* %2
%16 = call i64 @withdraw(i64 %13, double %14, i64 %15)
%17 = icmp eq i64 %16, -1
%18 = select i1 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0)
%19 = select i1 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0)
%20 = select i1 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %18)
%22 = call i32 @puts(i8* dereferenceable(1) %19)
%23 = call i32 @puts(i8* dereferenceable(1) %20)
ret void
}