#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 *, ...);
int main() {
  printf("\n        ITS240 May 1st 2017 Final Project \n        Daniel Kuckuck "
         "& Mack Moore \n        Our Project is a curency exchange rate "
         "converter: \n        We take the amount in USD and convert it to \n  "
         "      Pounds, Euros, Canadian Dollars, Mexican Pesos, or Japanese "
         "Yen. \n        We also display the highest and lowest conversion "
         "rates: \n        the Kuwati Dinar and the Iraqi Rial.\n\n");
  void convert(int, float);
  int typeNum = 0;
  int again = 1;
  float usAmt = 0;
  do {
    printf("Enter the number corresponding to the desired currency.\n 1 for "
           "Pounds. 2 for Euros. 3 for Canadian Dollars. 4 for Pesos. 5 for "
           "Yen.\n   >");
    scanf("%d", &typeNum);
    printf("Enter the amout of USD you wish to convert:\n   >");
    scanf("%f", &usAmt);
    printf("\n");
    convert(typeNum, usAmt);
    printf("\nEnter 1 to perform another conversion. Enter any other number to "
           "exit\n");
    scanf("%d", &again);
  } while (again == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0x1014(%rip),%rdi
call   1040 <printf@plt>
lea    0x1091(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0x1082(%rip),%rdi
call   1040 <printf@plt>
lea    0x10a7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xfd6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
movss  -0x10(%rbp),%xmm0
call   1030 <convert@plt>
lea    0x107f(%rip),%rdi
call   1040 <printf@plt>
lea    0x103c(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
je     1161 <main+0x31>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf5b(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,0x14(%rsp)
movl   $0x1,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xf00(%rip),%rbx
lea    0xefc(%rip),%r12
lea    0xf26(%rip),%r13
lea    0xc(%rsp),%rbp
lea    0x1098(%rip),%r14
lea    0x10(%rsp),%r15
nopl   0x0(%rax,%rax,1)
lea    0xe49(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
movss  0xc(%rsp),%xmm0
call   1040 <convert@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
je     11b0 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [380 x i8] c"\0A ITS240 May 1st 2017 Final Project \0A Daniel Kuckuck & Mack Moore \0A Our Project is a curency exchange rate converter: \0A We take the amount in USD and convert it to \0A Pounds, Euros, Canadian Dollars, Mexican Pesos, or Japanese Yen. \0A We also display the highest and lowest conversion rates: \0A the Kuwati Dinar and the Iraqi Rial.\0A\0A\00"
@.str.1 = [137 x i8] c"Enter the number corresponding to the desired currency.\0A 1 for Pounds. 2 for Euros. 3 for Canadian Dollars. 4 for Pesos. 5 for Yen.\0A >\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [49 x i8] c"Enter the amout of USD you wish to convert:\0A >\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [72 x i8] c"\0AEnter 1 to perform another conversion. Enter any other number to exit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([380 x i8], [380 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
store i32 1, i32* %3
store float 0.000000e+00, float* %4
br label %6
6: ; preds = %16, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = load float, float* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %16
16: ; preds = %6
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %6, label %19
19: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [137 x i8] c"Enter the number corresponding to the desired currency.\0A 1 for Pounds. 2 for Euros. 3 for Canadian Dollars. 4 for Pesos. 5 for Yen.\0A >\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [49 x i8] c"Enter the amout of USD you wish to convert:\0A >\00"
@.str.4 = [3 x i8] c"%f\00"
@str = [379 x i8] c"\0A ITS240 May 1st 2017 Final Project \0A Daniel Kuckuck & Mack Moore \0A Our Project is a curency exchange rate converter: \0A We take the amount in USD and convert it to \0A Pounds, Euros, Canadian Dollars, Mexican Pesos, or Japanese Yen. \0A We also display the highest and lowest conversion rates: \0A the Kuwati Dinar and the Iraqi Rial.\0A\00"
@str.7 = [71 x i8] c"\0AEnter 1 to perform another conversion. Enter any other number to exit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([379 x i8], [379 x i8]* @str, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%7 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
br label %8
8: ; preds = %8, %0
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%13 = call i32 @putchar(i32 10)
%14 = load i32, i32* %1
%15 = load float, float* %3
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.7, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 1
br i1 %19, label %8, label %20
20: ; preds = %8
ret i32 0
}