#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 */
double asciiToDouble(char *);
int /*<<< orphan*/ getLine(char *, int);
int /*<<< orphan*/ printNumberInWords(double);
int /*<<< orphan*/ printf(char *);
int main() {
  char amount[9 + 1];
  double toPay;
  printf("Enter amount to be paid: ");
  getLine(amount, 9 + 1);
  toPay = asciiToDouble(amount);
  toPay += 0.0000000001;
  if (toPay > 999999.99) {
    printf("\n!!!!! Invalid Amount - Notifying security !!!!!\n");
    return -1;
  }
  printNumberInWords(toPay);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    $0xa,%esi
call   1060 <getLine@plt>
lea    -0xe(%rbp),%rdi
call   1030 <asciiToDouble@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe89(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b8 <main+0x78>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <main+0x89>
movsd  -0x18(%rbp),%xmm0
call   1050 <printNumberInWords@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <getLine@plt>
mov    %rbx,%rdi
call   1040 <asciiToDouble@plt>
addsd  0xe7d(%rip),%xmm0
ucomisd 0xe7d(%rip),%xmm0
jbe    11a0 <main+0x50>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11a7 <main+0x57>
call   1060 <printNumberInWords@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Enter amount to be paid: \00"
@.str.1 = [50 x i8] c"\0A!!!!! Invalid Amount - Notifying security !!!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @getLine(i8* %5, i32 10)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call double @asciiToDouble(i8* %7)
store double %8, double* %3
%9 = load double, double* %3
%10 = fadd double %9, 1.000000e-10
store double %10, double* %3
%11 = load double, double* %3
%12 = fcmp ogt double %11, 0x412E847FFAE147AE
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %18
15: ; preds = %0
%16 = load double, double* %3
%17 = call i32 @printNumberInWords(double %16)
store i32 0, i32* %1
br label %18
18: ; preds = %15, %13
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [26 x i8] c"Enter amount to be paid: \00"
@str = [49 x i8] c"\0A!!!!! Invalid Amount - Notifying security !!!!!\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @getLine(i8* %2, i32 10)
%5 = call double @asciiToDouble(i8* %2)
%6 = fadd double %5, 1.000000e-10
%7 = fcmp ogt double %6, 0x412E847FFAE147AE
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printNumberInWords(double %6)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ -1, %8 ], [ 0, %10 ]
ret i32 %13
}