#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*/ free(char *);
double getAmount(int);
int getQuery(int);
int getUserName(int, char **);
char *returnBalance(char *);
int showInSuffBal(int);
double strtod(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ updateUserTransFile(char *, int, double, double);
void processAdminRequests(int clientFD) {
  while (1) {
    char *userName;
    int ret = getUserName(clientFD, &userName);
    if (ret < 0)
      return;
    ret = getQuery(clientFD);
    if (ret < 0)
      return;
    int toCorD = ret;
    double amount = getAmount(clientFD);
    if (amount < 0.0)
      return;
    char *bal = returnBalance(userName);
    double curBal = strtod(bal, NULL);
    free(bal);
    bal = NULL;
    if (curBal < amount && toCorD == 11) {
      ret = showInSuffBal(clientFD);
      if (ret < 0)
        return;
      else
        continue;
    }
    updateUserTransFile(userName, toCorD, amount, curBal);
  }
}


x86 assembly (clang, -O0):
<processAdminRequests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1090 <getUserName@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11a9 <processAdminRequests+0x29>
jmp    1271 <processAdminRequests+0xf1>
mov    -0x4(%rbp),%edi
call   1060 <getQuery@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11c3 <processAdminRequests+0x43>
jmp    1271 <processAdminRequests+0xf1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <getAmount@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11e9 <processAdminRequests+0x69>
jmp    1271 <processAdminRequests+0xf1>
mov    -0x10(%rbp),%rdi
call   1080 <returnBalance@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1256 <processAdminRequests+0xd6>
cmpl   $0xb,-0x18(%rbp)
jne    1256 <processAdminRequests+0xd6>
mov    -0x4(%rbp),%edi
call   10a0 <showInSuffBal@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1251 <processAdminRequests+0xd1>
jmp    1271 <processAdminRequests+0xf1>
jmp    118b <processAdminRequests+0xb>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1070 <updateUserTransFile@plt>
jmp    118b <processAdminRequests+0xb>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processAdminRequests>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r15d
mov    %rsp,%rsi
call   1090 <getUserName@plt>
test   %eax,%eax
js     123b <processAdminRequests+0xbb>
mov    %rsp,%r14
jmp    11ca <processAdminRequests+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp),%rdi
mov    %ebp,%esi
call   1070 <updateUserTransFile@plt>
mov    %r15d,%edi
mov    %r14,%rsi
call   1090 <getUserName@plt>
test   %eax,%eax
js     123b <processAdminRequests+0xbb>
mov    %r15d,%edi
call   1060 <getQuery@plt>
test   %eax,%eax
js     123b <processAdminRequests+0xbb>
mov    %eax,%ebp
mov    %r15d,%edi
call   1050 <getAmount@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     123b <processAdminRequests+0xbb>
mov    (%rsp),%rdi
movsd  %xmm1,0x10(%rsp)
call   1080 <returnBalance@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b0 <processAdminRequests+0x30>
cmp    $0xb,%ebp
jne    11b0 <processAdminRequests+0x30>
mov    %r15d,%edi
call   10a0 <showInSuffBal@plt>
test   %eax,%eax
jns    11bb <processAdminRequests+0x3b>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @processAdminRequests(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i8*
%8 = alloca double
store i32 %0, i32* %2
br label %9
9: ; preds = %1, %47, %48
%10 = load i32, i32* %2
%11 = call i32 @getUserName(i32 %10, i8** %3)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
br label %54
15: ; preds = %9
%16 = load i32, i32* %2
%17 = call i32 @getQuery(i32 %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
br label %54
21: ; preds = %15
%22 = load i32, i32* %4
store i32 %22, i32* %5
%23 = load i32, i32* %2
%24 = call double @getAmount(i32 %23)
store double %24, double* %6
%25 = load double, double* %6
%26 = fcmp olt double %25, 0.000000e+00
br i1 %26, label %27, label %28
27: ; preds = %21
br label %54
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = call i8* @returnBalance(i8* %29)
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = call double @strtod(i8* %31, i32* null)
store double %32, double* %8
%33 = load i8*, i8** %7
%34 = call i32 @free(i8* %33)
store i8* null, i8** %7
%35 = load double, double* %8
%36 = load double, double* %6
%37 = fcmp olt double %35, %36
br i1 %37, label %38, label %48
38: ; preds = %28
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 11
br i1 %40, label %41, label %48
41: ; preds = %38
%42 = load i32, i32* %2
%43 = call i32 @showInSuffBal(i32 %42)
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %41
br label %54
47: ; preds = %41
br label %9
48: ; preds = %38, %28
%49 = load i8*, i8** %3
%50 = load i32, i32* %5
%51 = load double, double* %6
%52 = load double, double* %8
%53 = call i32 @updateUserTransFile(i8* %49, i32 %50, double %51, double %52)
br label %9
54: ; preds = %46, %27, %20, %14
ret void
}

LLVM IR (-O2):
define void @processAdminRequests(i32 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @getUserName(i32 %0, i8** %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %26, label %6
6: ; preds = %1, %27
%7 = call i32 @getQuery(i32 %0)
%8 = icmp slt i32 %7, 0
br i1 %8, label %26, label %9
9: ; preds = %6
%10 = call double @getAmount(i32 %0)
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %26, label %12
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = call i8* @returnBalance(i8* %13)
%15 = call double @strtod(i8* nocapture %14, i32* null)
%16 = call i32 @free(i8* %14)
%17 = fcmp olt double %15, %10
%18 = icmp eq i32 %7, 11
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = call i32 @showInSuffBal(i32 %0)
%22 = icmp slt i32 %21, 0
br i1 %22, label %30, label %27
23: ; preds = %12
%24 = load i8*, i8** %2
%25 = call i32 @updateUserTransFile(i8* %24, i32 %7, double %10, double %15)
br label %27
26: ; preds = %9, %6, %27, %1
br label %31
27: ; preds = %20, %23
%28 = call i32 @getUserName(i32 %0, i8** %2)
%29 = icmp slt i32 %28, 0
br i1 %29, label %26, label %6
30: ; preds = %20
br label %31
31: ; preds = %30, %26
ret void
}