#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() {
  int nOperation;
  float fInput, fResult, fConversionRate = 1.1045;
  printf("Please input the operation that you wish to perform\n");
  printf("1. GBP to Euro      2. Euro to GBP:\n");
  scanf("%d", &nOperation);
  printf("\nPlease input the value you wish to convert from:\n");
  scanf("%f", &fInput);
  if (nOperation == 1) {
    fResult = fInput * fConversionRate;
    printf("\nThe conversion result is: %8.2f Euros\n", fResult);
  } else if (nOperation == 2) {
    fResult = fInput / fConversionRate;
    printf("\nThe conversion result is: %8.2f GBP\n", fResult);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11bf <main+0x9f>
movss  -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xd4>
cmpl   $0x2,-0x8(%rbp)
jne    11ef <main+0xcf>
movss  -0xc(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xd4>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     119d <main+0x6d>
cmp    $0x1,%eax
jne    11bc <main+0x8c>
movss  (%rsp),%xmm0
mulss  0xe6c(%rip),%xmm0
lea    0xe6f(%rip),%rdi
jmp    11b1 <main+0x81>
movss  (%rsp),%xmm0
divss  0xe56(%rip),%xmm0
lea    0xe81(%rip),%rdi
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Please input the operation that you wish to perform\0A\00"
@.str.1 = [37 x i8] c"1. GBP to Euro 2. Euro to GBP:\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [51 x i8] c"\0APlease input the value you wish to convert from:\0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [40 x i8] c"\0AThe conversion result is: %8.2f Euros\0A\00"
@.str.6 = [38 x i8] c"\0AThe conversion result is: %8.2f GBP\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 0x3FF1AC0840000000, float* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 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 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 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* %3)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %20
13: ; preds = %0
%14 = load float, float* %3
%15 = load float, float* %5
%16 = fmul float %14, %15
store float %16, float* %4
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %18)
br label %31
20: ; preds = %0
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load float, float* %3
%25 = load float, float* %5
%26 = fdiv float %24, %25
store float %26, float* %4
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), double %28)
br label %30
30: ; preds = %23, %20
br label %31
31: ; preds = %30, %13
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [40 x i8] c"\0AThe conversion result is: %8.2f Euros\0A\00"
@.str.6 = [38 x i8] c"\0AThe conversion result is: %8.2f GBP\0A\00"
@str = [52 x i8] c"Please input the operation that you wish to perform\00"
@str.7 = [36 x i8] c"1. GBP to Euro 2. Euro to GBP:\00"
@str.8 = [50 x i8] c"\0APlease input the value you wish to convert from:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.7, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.8, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%10 = load i32, i32* %1
switch i32 %10, label %22 [
i32 1, label %11
i32 2, label %14
]
11: ; preds = %0
%12 = load float, float* %2
%13 = fmul float %12, 0x3FF1AC0840000000
br label %17
14: ; preds = %0
%15 = load float, float* %2
%16 = fdiv float %15, 0x3FF1AC0840000000
br label %17
17: ; preds = %11, %14
%18 = phi float [ %16, %14 ], [ %13, %11 ]
%19 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), %14 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), %11 ]
%20 = fpext float %18 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %19, double %20)
br label %22
22: ; preds = %17, %0
ret i32 0
}