#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 *, char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int accountNumber = 0;
  float beginningBalance = 0.0;
  float finalBalance;
  float totalCharges = 0.0;
  float totalCredits = 0.0;
  float creditLimit = 0.0;
  printf("%s", "Enter account number (-1 to end): ");
  scanf("%d", &accountNumber);
  while (accountNumber != -1) {
    printf("%s", "Enter beginning balance: ");
    scanf("%f", &beginningBalance);
    printf("%s", "Enter total charges: ");
    scanf("%f", &totalCharges);
    printf("%s", "Enter total credits: ");
    scanf("%f", &totalCredits);
    printf("%s", "Enter credit limit: ");
    scanf("%f", &creditLimit);
    finalBalance = (beginningBalance + totalCharges) - totalCredits;
    if (finalBalance > creditLimit) {
      printf("%s %d\n", "Account:      ", accountNumber);
      printf("%s %0.2f\n", "Credit limit: ", creditLimit);
      printf("%s %0.2f\n", "Balance:      ", finalBalance);
      printf("%s\n\n", "Credit Limit Exceeded.\n");
    }
    printf("\n%s", "Enter account number (-1 to end): ");
    scanf("%d", &accountNumber);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xf83(%rip),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
je     12db <main+0x1bb>
lea    0xf52(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xf2b(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe76(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xf04(%rip),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    12af <main+0x18f>
mov    -0x8(%rbp),%edx
lea    0xe34(%rip),%rdi
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2c(%rip),%rdi
lea    0xe2f(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0e(%rip),%rdi
lea    0xe20(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe21(%rip),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe29(%rip),%rdi
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd58(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    117d <main+0x5d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xf84(%rip),%rdi
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     12ff <main+0x1df>
lea    0xf54(%rip),%r15
lea    0xead(%rip),%r13
lea    0xf45(%rip),%rbp
lea    0xe5f(%rip),%rbx
lea    0xe7b(%rip),%r12
mov    %rsp,%r14
jmp    11d4 <main+0xb4>
nopl   (%rax)
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     12ff <main+0x1df>
mov    %r15,%rdi
lea    0xe48(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
lea    0xe45(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
lea    0xe3b(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
lea    0xe31(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
ucomiss 0x4(%rsp),%xmm0
jbe    11b0 <main+0x90>
mov    (%rsp),%edx
lea    0xe09(%rip),%rdi
lea    0xe09(%rip),%rsi
xor    %eax,%eax
movss  %xmm0,0x14(%rsp)
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%r13
mov    %r14,%r15
mov    %r12,%r14
lea    0xdf1(%rip),%r12
mov    %r12,%rdi
lea    0xdf1(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    %r14,%r12
mov    %r15,%r14
mov    %r13,%r15
lea    0xd69(%rip),%r13
lea    0xdd5(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdd6(%rip),%rdi
lea    0xdd4(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [35 x i8] c"Enter account number (-1 to end): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Enter beginning balance: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [22 x i8] c"Enter total charges: \00"
@.str.6 = [22 x i8] c"Enter total credits: \00"
@.str.7 = [21 x i8] c"Enter credit limit: \00"
@.str.8 = [7 x i8] c"%s %d\0A\00"
@.str.9 = [15 x i8] c"Account: \00"
@.str.10 = [10 x i8] c"%s %0.2f\0A\00"
@.str.11 = [15 x i8] c"Credit limit: \00"
@.str.12 = [15 x i8] c"Balance: \00"
@.str.13 = [5 x i8] c"%s\0A\0A\00"
@.str.14 = [24 x i8] c"Credit Limit Exceeded.\0A\00"
@.str.15 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %40, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %43
13: ; preds = %10
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %6)
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %7)
%22 = load float, float* %3
%23 = load float, float* %5
%24 = fadd float %22, %23
%25 = load float, float* %6
%26 = fsub float %24, %25
store float %26, float* %4
%27 = load float, float* %4
%28 = load float, float* %7
%29 = fcmp ogt float %27, %28
br i1 %29, label %30, label %40
30: ; preds = %13
%31 = load i32, i32* %2
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i32 %31)
%33 = load float, float* %7
%34 = fpext float %33 to double
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), double %34)
%36 = load float, float* %4
%37 = fpext float %36 to double
%38 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), double %37)
%39 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0))
br label %40
40: ; preds = %30, %13
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %10
43: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [35 x i8] c"Enter account number (-1 to end): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Enter beginning balance: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [22 x i8] c"Enter total charges: \00"
@.str.6 = [22 x i8] c"Enter total credits: \00"
@.str.7 = [21 x i8] c"Enter credit limit: \00"
@.str.8 = [7 x i8] c"%s %d\0A\00"
@.str.9 = [15 x i8] c"Account: \00"
@.str.10 = [10 x i8] c"%s %0.2f\0A\00"
@.str.11 = [15 x i8] c"Credit limit: \00"
@.str.12 = [15 x i8] c"Balance: \00"
@.str.13 = [5 x i8] c"%s\0A\0A\00"
@.str.14 = [24 x i8] c"Credit Limit Exceeded.\0A\00"
@.str.15 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%7 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%8 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%9 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%10 = bitcast float* %5 to i8*
store float 0.000000e+00, float* %5
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, -1
br i1 %14, label %45, label %15
15: ; preds = %0, %40
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%24 = load float, float* %2
%25 = load float, float* %3
%26 = fadd float %24, %25
%27 = load float, float* %4
%28 = fsub float %26, %27
%29 = load float, float* %5
%30 = fcmp ogt float %28, %29
br i1 %30, label %31, label %40
31: ; preds = %15
%32 = load i32, i32* %1
%33 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i32 %32)
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), double %35)
%37 = fpext float %28 to double
%38 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), double %37)
%39 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0))
br label %40
40: ; preds = %31, %15
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%43 = load i32, i32* %1
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %15
45: ; preds = %40, %0
ret i32 0
}