#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*/ getLine(char *, int);
int /*<<< orphan*/ printLetter1(char *, char *, char *, double, int);
int /*<<< orphan*/ printLetter2(char *, char *, char *, double, int);
int /*<<< orphan*/ printLetter3(char *, char *, char *, double, int);
int /*<<< orphan*/ printLetter4(char *, char *, char *, double, int);
int /*<<< orphan*/ printLetter5(char *, char *, char *, double, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int main() {
  char input[10];
  char name[80];
  char address[80];
  char accountReference[10];
  double amountOwed;
  int ageOfAmountOwed = 0;
  printf("Enter debtor's name: ");
  getLine(name, 80);
  printf("Enter debtor's address: ");
  getLine(address, 80);
  printf("Enter debtor's account reference: ");
  getLine(accountReference, 80);
  printf("Enter amount owed: ");
  getLine(input, 80);
  sscanf(input, "%lf", &amountOwed);
  printf("Enter months amount overdue: ");
  getLine(input, 80);
  sscanf(input, "%d", &ageOfAmountOwed);
  printf("\n\n\n\n\n");
  if (ageOfAmountOwed >= 5)
    printLetter5(name, address, accountReference, amountOwed, ageOfAmountOwed);
  else if (ageOfAmountOwed >= 4)
    printLetter4(name, address, accountReference, amountOwed, ageOfAmountOwed);
  else if (ageOfAmountOwed >= 3)
    printLetter3(name, address, accountReference, amountOwed, ageOfAmountOwed);
  else if (ageOfAmountOwed >= 2)
    printLetter2(name, address, accountReference, amountOwed, ageOfAmountOwed);
  else
    printLetter1(name, address, accountReference, amountOwed, ageOfAmountOwed);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xcc(%rbp)
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1080 <getLine@plt>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x50,%esi
call   1080 <getLine@plt>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
lea    -0xba(%rbp),%rdi
mov    $0x50,%esi
call   1080 <getLine@plt>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    $0x50,%esi
call   1080 <getLine@plt>
lea    -0xe(%rbp),%rdi
lea    0xe51(%rip),%rsi
lea    -0xc8(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    $0x50,%esi
call   1080 <getLine@plt>
lea    -0xe(%rbp),%rdi
lea    0xe40(%rip),%rsi
lea    -0xcc(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5,-0xcc(%rbp)
jl     1299 <main+0x119>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xba(%rbp),%rdx
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%ecx
call   1060 <printLetter5@plt>
jmp    1372 <main+0x1f2>
cmpl   $0x4,-0xcc(%rbp)
jl     12d0 <main+0x150>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xba(%rbp),%rdx
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%ecx
call   10a0 <printLetter4@plt>
jmp    136d <main+0x1ed>
cmpl   $0x3,-0xcc(%rbp)
jl     1307 <main+0x187>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xba(%rbp),%rdx
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%ecx
call   1050 <printLetter3@plt>
jmp    1368 <main+0x1e8>
cmpl   $0x2,-0xcc(%rbp)
jl     133e <main+0x1be>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xba(%rbp),%rdx
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%ecx
call   1090 <printLetter2@plt>
jmp    1363 <main+0x1e3>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xba(%rbp),%rdx
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%ecx
call   1040 <printLetter1@plt>
jmp    1368 <main+0x1e8>
jmp    136d <main+0x1ed>
jmp    1372 <main+0x1f2>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
lea    0x80(%rsp),%rdi
mov    $0x50,%esi
call   1090 <getLine@plt>
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   1090 <getLine@plt>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
lea    0x1c(%rsp),%rdi
mov    $0x50,%esi
call   1090 <getLine@plt>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
lea    0x26(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1090 <getLine@plt>
lea    0xe4d(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
call   1090 <getLine@plt>
lea    0xe40(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%ecx
cmp    $0x5,%ecx
jl     128e <main+0xfe>
movsd  0x10(%rsp),%xmm0
lea    0x80(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x1c(%rsp),%rdx
call   1070 <printLetter5@plt>
jmp    130e <main+0x17e>
cmp    $0x4,%ecx
jne    12b7 <main+0x127>
movsd  0x10(%rsp),%xmm0
lea    0x80(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x1c(%rsp),%rdx
mov    $0x4,%ecx
call   10b0 <printLetter4@plt>
jmp    130e <main+0x17e>
cmp    $0x3,%ecx
jl     12e0 <main+0x150>
movsd  0x10(%rsp),%xmm0
lea    0x80(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x1c(%rsp),%rdx
mov    $0x3,%ecx
call   1060 <printLetter3@plt>
jmp    130e <main+0x17e>
movsd  0x10(%rsp),%xmm0
lea    0x80(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x1c(%rsp),%rdx
cmp    $0x2,%ecx
jne    1309 <main+0x179>
mov    $0x2,%ecx
call   10a0 <printLetter2@plt>
jmp    130e <main+0x17e>
call   1050 <printLetter1@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter debtor's name: \00"
@.str.1 = [25 x i8] c"Enter debtor's address: \00"
@.str.2 = [35 x i8] c"Enter debtor's account reference: \00"
@.str.3 = [20 x i8] c"Enter amount owed: \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [30 x i8] c"Enter months amount overdue: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [6 x i8] c"\0A\0A\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca [10 x i8]
%6 = alloca double
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = call i32 @getLine(i8* %9, i32 80)
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%13 = call i32 @getLine(i8* %12, i32 80)
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%16 = call i32 @getLine(i8* %15, i32 80)
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%19 = call i32 @getLine(i8* %18, i32 80)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %6)
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%24 = call i32 @getLine(i8* %23, i32 80)
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, i8*, ...) @sscanf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%28 = load i32, i32* %7
%29 = icmp sge i32 %28, 5
br i1 %29, label %30, label %37
30: ; preds = %0
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%34 = load double, double* %6
%35 = load i32, i32* %7
%36 = call i32 @printLetter5(i8* %31, i8* %32, i8* %33, double %34, i32 %35)
br label %77
37: ; preds = %0
%38 = load i32, i32* %7
%39 = icmp sge i32 %38, 4
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%44 = load double, double* %6
%45 = load i32, i32* %7
%46 = call i32 @printLetter4(i8* %41, i8* %42, i8* %43, double %44, i32 %45)
br label %76
47: ; preds = %37
%48 = load i32, i32* %7
%49 = icmp sge i32 %48, 3
br i1 %49, label %50, label %57
50: ; preds = %47
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%54 = load double, double* %6
%55 = load i32, i32* %7
%56 = call i32 @printLetter3(i8* %51, i8* %52, i8* %53, double %54, i32 %55)
br label %75
57: ; preds = %47
%58 = load i32, i32* %7
%59 = icmp sge i32 %58, 2
br i1 %59, label %60, label %67
60: ; preds = %57
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%64 = load double, double* %6
%65 = load i32, i32* %7
%66 = call i32 @printLetter2(i8* %61, i8* %62, i8* %63, double %64, i32 %65)
br label %74
67: ; preds = %57
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%70 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%71 = load double, double* %6
%72 = load i32, i32* %7
%73 = call i32 @printLetter1(i8* %68, i8* %69, i8* %70, double %71, i32 %72)
br label %74
74: ; preds = %67, %60
br label %75
75: ; preds = %74, %50
br label %76
76: ; preds = %75, %40
br label %77
77: ; preds = %76, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter debtor's name: \00"
@.str.1 = [25 x i8] c"Enter debtor's address: \00"
@.str.2 = [35 x i8] c"Enter debtor's account reference: \00"
@.str.3 = [20 x i8] c"Enter amount owed: \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [30 x i8] c"Enter months amount overdue: \00"
@.str.6 = [3 x i8] c"%d\00"
@str = [5 x i8] c"\0A\0A\0A\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca [10 x i8]
%5 = alloca double
%6 = alloca i32
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%11 = bitcast double* %5 to i8*
%12 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @getLine(i8* %8, i32 80)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @getLine(i8* %9, i32 80)
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @getLine(i8* %10, i32 80)
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @getLine(i8* %7, i32 80)
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %5)
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @getLine(i8* %7, i32 80)
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 4
br i1 %27, label %28, label %31
28: ; preds = %0
%29 = load double, double* %5
%30 = call i32 @printLetter5(i8* %8, i8* %9, i8* %10, double %29, i32 %26)
br label %48
31: ; preds = %0
%32 = icmp eq i32 %26, 4
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = load double, double* %5
%35 = call i32 @printLetter4(i8* %8, i8* %9, i8* %10, double %34, i32 4)
br label %48
36: ; preds = %31
%37 = icmp sgt i32 %26, 2
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = load double, double* %5
%40 = call i32 @printLetter3(i8* %8, i8* %9, i8* %10, double %39, i32 3)
br label %48
41: ; preds = %36
%42 = icmp eq i32 %26, 2
%43 = load double, double* %5
br i1 %42, label %44, label %46
44: ; preds = %41
%45 = call i32 @printLetter2(i8* %8, i8* %9, i8* %10, double %43, i32 2)
br label %48
46: ; preds = %41
%47 = call i32 @printLetter1(i8* %8, i8* %9, i8* %10, double %43, i32 %26)
br label %48
48: ; preds = %33, %44, %46, %38, %28
ret i32 0
}