#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*/ change_to_Dollar(float *);
int /*<<< orphan*/ change_to_Euro(float *);
int /*<<< orphan*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ system(char *);
main() {
  float money[3];
  int menu;
  int i;
  do {
    printf("\t\tThis is a Currency Converter!\n");
    printf("\t\t\tMain Menu\n\n");
    printf("Please choose the currency you would like to convert your money "
           "into:\n");
    printf("1 =\tConvert to Euros\n");
    printf("2 =\tConvert to Dollar\n");
    printf("\n3 =\tExit\n");
    scanf("%d", &menu);
    if (menu == 1) {
      system("cls");
      printf("Please enter 3 values to be converted:\n");
      for (i = 0; i < 3; i++) {
        scanf("%f", &money[i]);
      }
      change_to_Euro(money);
      menu = 0;
    } else if (menu == 2) {
      system("cls");
      printf("Please enter 3 values to be converted:\n");
      for (i = 0; i < 3; i++) {
        scanf("%f", &money[i]);
        flushall();
      }
      change_to_Dollar(money);
      menu = 0;
    } else if (menu == 3) {
      system("cls");
      printf("Thank you, Goodbye!");
    } else {
      system("cls");
      printf("Not a valid choice please enter again\n\n");
    }
  } while (menu != 3);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
lea    0xecd(%rip),%rdi
call   1050 <printf@plt>
lea    0xed7(%rip),%rdi
call   1050 <printf@plt>
lea    0xee2(%rip),%rdi
call   1050 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    124c <main+0xdc>
lea    0xec8(%rip),%rdi
call   1040 <system@plt>
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1237 <main+0xc7>
movslq -0x18(%rbp),%rax
lea    -0x10(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1202 <main+0x92>
lea    -0x10(%rbp),%rdi
call   1030 <change_to_Euro@plt>
movl   $0x0,-0x14(%rbp)
jmp    130f <main+0x19f>
cmpl   $0x2,-0x14(%rbp)
jne    12c6 <main+0x156>
lea    0xe55(%rip),%rdi
call   1040 <system@plt>
lea    0xe4d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12b1 <main+0x141>
movslq -0x18(%rbp),%rax
lea    -0x10(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    $0x0,%al
call   1070 <flushall@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1275 <main+0x105>
lea    -0x10(%rbp),%rdi
call   1060 <change_to_Dollar@plt>
movl   $0x0,-0x14(%rbp)
jmp    130a <main+0x19a>
cmpl   $0x3,-0x14(%rbp)
jne    12ed <main+0x17d>
lea    0xddb(%rip),%rdi
call   1040 <system@plt>
lea    0xdfe(%rip),%rdi
call   1050 <printf@plt>
jmp    1305 <main+0x195>
lea    0xdbe(%rip),%rdi
call   1040 <system@plt>
lea    0xdf5(%rip),%rdi
call   1050 <printf@plt>
jmp    130a <main+0x19a>
jmp    130f <main+0x19f>
jmp    1314 <main+0x1a4>
cmpl   $0x3,-0x14(%rbp)
jne    117f <main+0xf>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    -0x4(%rbp),%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
lea    0xe6b(%rip),%r12
lea    0x8(%rsp),%r13
lea    0xe62(%rip),%rbx
lea    0xe5f(%rip),%rbp
lea    0xc(%rsp),%r14
jmp    11d0 <main+0x50>
nop
call   1050 <system@plt>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%r15d
cmp    $0x3,%r15d
je     1326 <main+0x1a6>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %rbx,%rdi
cmp    $0x3,%eax
je     1310 <main+0x190>
cmp    $0x2,%eax
je     12a0 <main+0x120>
cmp    $0x1,%eax
jne    11b0 <main+0x30>
call   1050 <system@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %r15d,%r15d
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %rbp,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %r14,%rdi
call   1040 <change_to_Euro@plt>
movl   $0x0,0x8(%rsp)
jmp    11c6 <main+0x46>
nopw   0x0(%rax,%rax,1)
call   1050 <system@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
xor    %r15d,%r15d
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1080 <flushall@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1080 <flushall@plt>
mov    %rbp,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1080 <flushall@plt>
mov    %r14,%rdi
call   1070 <change_to_Dollar@plt>
movl   $0x0,0x8(%rsp)
jmp    11c6 <main+0x46>
nopl   0x0(%rax)
call   1050 <system@plt>
lea    0xcee(%rip),%rdi
call   1060 <printf@plt>
jmp    11c1 <main+0x41>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\09\09This is a Currency Converter!\0A\00"
@.str.1 = [15 x i8] c"\09\09\09Main Menu\0A\0A\00"
@.str.2 = [71 x i8] c"Please choose the currency you would like to convert your money into:\0A\00"
@.str.3 = [22 x i8] c"1 =\09Convert to Euros\0A\00"
@.str.4 = [23 x i8] c"2 =\09Convert to Dollar\0A\00"
@.str.5 = [11 x i8] c"\0A3 =\09Exit\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"cls\00"
@.str.8 = [40 x i8] c"Please enter 3 values to be converted:\0A\00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [20 x i8] c"Thank you, Goodbye!\00"
@.str.11 = [40 x i8] c"Not a valid choice please enter again\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x float]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %65, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %32
15: ; preds = %5
%16 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %4
br label %18
18: ; preds = %26, %15
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 %23
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %24)
br label %26
26: ; preds = %21
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %18
29: ; preds = %18
%30 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%31 = call i32 @change_to_Euro(float* %30)
store i32 0, i32* %3
br label %64
32: ; preds = %5
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %53
35: ; preds = %32
%36 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %4
br label %38
38: ; preds = %47, %35
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 %43
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %44)
%46 = call i32 (...) @flushall()
br label %47
47: ; preds = %41
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %38
50: ; preds = %38
%51 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%52 = call i32 @change_to_Dollar(float* %51)
store i32 0, i32* %3
br label %63
53: ; preds = %32
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 3
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%58 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %62
59: ; preds = %53
%60 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%61 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0))
br label %62
62: ; preds = %59, %56
br label %63
63: ; preds = %62, %50
br label %64
64: ; preds = %63, %29
br label %65
65: ; preds = %64
%66 = load i32, i32* %3
%67 = icmp ne i32 %66, 3
br i1 %67, label %5, label %68
68: ; preds = %65
%69 = call i32 (...) @getchar()
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"cls\00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [20 x i8] c"Thank you, Goodbye!\00"
@str = [32 x i8] c"\09\09This is a Currency Converter!\00"
@str.12 = [14 x i8] c"\09\09\09Main Menu\0A\00"
@str.13 = [70 x i8] c"Please choose the currency you would like to convert your money into:\00"
@str.14 = [21 x i8] c"1 =\09Convert to Euros\00"
@str.15 = [22 x i8] c"2 =\09Convert to Dollar\00"
@str.16 = [10 x i8] c"\0A3 =\09Exit\00"
@str.17 = [39 x i8] c"Not a valid choice please enter again\0A\00"
@str.19 = [39 x i8] c"Please enter 3 values to be converted:\00"
define i32 @main() {
%1 = alloca [3 x float]
%2 = alloca i32
%3 = bitcast [3 x float]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
%7 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 2
%8 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
%9 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 2
br label %10
10: ; preds = %44, %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.12, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.13, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.14, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.16, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
switch i32 %18, label %39 [
i32 1, label %19
i32 2, label %26
i32 3, label %36
]
19: ; preds = %10
%20 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.19, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %5)
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %8)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %9)
%25 = call i32 @change_to_Euro(float* %5)
store i32 0, i32* %2
br label %44
26: ; preds = %10
%27 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.19, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %5)
%30 = call i32 (...) @flushall()
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %6)
%32 = call i32 (...) @flushall()
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %7)
%34 = call i32 (...) @flushall()
%35 = call i32 @change_to_Dollar(float* %5)
store i32 0, i32* %2
br label %44
36: ; preds = %10
%37 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %42
39: ; preds = %10
%40 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0))
br label %42
42: ; preds = %39, %36
%43 = load i32, i32* %2
br label %44
44: ; preds = %42, %19, %26
%45 = phi i32 [ %43, %42 ], [ 0, %19 ], [ 0, %26 ]
%46 = icmp eq i32 %45, 3
br i1 %46, label %47, label %10
47: ; preds = %44
%48 = call i32 (...) @getchar()
ret i32 0
}