#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(double, int);
void withdrawMenu() {
  printf("\tenter passworld>");
  int pass = 0;
  scanf("%d", &pass);
  printf("\tenter balance>");
  double balance = 0;
  scanf("%lf", &balance);
  long ret = withdraw(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>
movl   $0x0,-0x4(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xead(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
mov    -0x4(%rbp),%edi
call   1030 <withdraw@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    -0x18(%rbp),%rax
jne    11ce <withdrawMenu+0x9e>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
jmp    11f2 <withdrawMenu+0xc2>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3c(%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>
movl   $0x0,0xc(%rsp)
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,0x10(%rsp)
lea    0xe9b(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x10(%rsp),%xmm0
mov    0xc(%rsp),%edi
call   1030 <withdraw@plt>
cmp    $0xffffffffffffffff,%rax
lea    0xeb5(%rip),%r14
lea    0xe86(%rip),%rax
lea    0xe6b(%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 = [18 x i8] c"\09enter passworld>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"\09enter balance>\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [29 x i8] c"===========================\0A\00"
@.str.5 = [41 x i8] c"passworld is invalid or no enough money\0A\00"
@.str.6 = [21 x i8] c"witdraw successful!\0A\00"
define void @withdrawMenu() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i64
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store double 0.000000e+00, double* %2
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%8 = load double, double* %2
%9 = load i32, i32* %1
%10 = call i64 @withdraw(double %8, i32 %9)
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = icmp eq i64 -1, %11
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %21
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %17, %13
ret void
}

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