#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() {
  char c;
  float yen;
  float answer;
  float cy;
  printf(" How many yen?  ");
  scanf("%f", &yen);
  printf(" Which currency?  ");
  scanf("%*c %c", &c);
  if (c == 'u') {
    cy = 90.66;
    printf("USD = ");
  } else if (c == 'g') {
    cy = 149.00;
    printf("GBP = ");
  } else if (c == 'e') {
    cy = 135.43;
    printf("EUR = ");
  } else if (c == 'k') {
    cy = 0.08;
    printf("KRW = ");
  } else {
    printf(" Unknown.\n");
    return 0;
  }
  answer = (yen / cy);
  printf("%.2f\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x75,%eax
jne    119c <main+0x7c>
movss  0xe88(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124c <main+0x12c>
movsbl -0x5(%rbp),%eax
cmp    $0x67,%eax
jne    11c9 <main+0xa9>
movss  0xe57(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1247 <main+0x127>
movsbl -0x5(%rbp),%eax
cmp    $0x65,%eax
jne    11f6 <main+0xd6>
movss  0xe26(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
movsbl -0x5(%rbp),%eax
cmp    $0x6b,%eax
jne    1223 <main+0x103>
movss  0xdf5(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x11d>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1279 <main+0x159>
jmp    1242 <main+0x122>
jmp    1247 <main+0x127>
jmp    124c <main+0x12c>
movss  -0xc(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x3(%rsp),%al
add    $0x9b,%al
ror    %al
cmp    $0x9,%al
jae    118f <main+0x5f>
movzbl %al,%ecx
mov    $0x10b,%edx
bt     %ecx,%edx
jb     119d <main+0x6d>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
jmp    11db <main+0xab>
movsbq %al,%rbx
lea    0xeb4(%rip),%rax
movslq (%rax,%rbx,4),%rdi
add    %rax,%rdi
lea    0xeca(%rip),%r14
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
divss  (%r14,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c" How many yen? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c" Which currency? \00"
@.str.3 = [7 x i8] c"%*c %c\00"
@.str.4 = [7 x i8] c"USD = \00"
@.str.5 = [7 x i8] c"GBP = \00"
@.str.6 = [7 x i8] c"EUR = \00"
@.str.7 = [7 x i8] c"KRW = \00"
@.str.8 = [11 x i8] c" Unknown.\0A\00"
@.str.9 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 117
br i1 %12, label %13, label %15
13: ; preds = %0
store float 0x4056AA3D80000000, float* %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %38
15: ; preds = %0
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 103
br i1 %18, label %19, label %21
19: ; preds = %15
store float 1.490000e+02, float* %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %37
21: ; preds = %15
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 101
br i1 %24, label %25, label %27
25: ; preds = %21
store float 0x4060EDC280000000, float* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %36
27: ; preds = %21
%28 = load i8, i8* %2
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 107
br i1 %30, label %31, label %33
31: ; preds = %27
store float 0x3FB47AE140000000, float* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %35
33: ; preds = %27
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %45
35: ; preds = %31
br label %36
36: ; preds = %35, %25
br label %37
37: ; preds = %36, %19
br label %38
38: ; preds = %37, %13
%39 = load float, float* %3
%40 = load float, float* %5
%41 = fdiv float %39, %40
store float %41, float* %4
%42 = load float, float* %4
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %43)
store i32 0, i32* %1
br label %45
45: ; preds = %38, %33
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [17 x i8] c" How many yen? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c" Which currency? \00"
@.str.3 = [7 x i8] c"%*c %c\00"
@.str.4 = [7 x i8] c"USD = \00"
@.str.5 = [7 x i8] c"GBP = \00"
@.str.6 = [7 x i8] c"EUR = \00"
@.str.7 = [7 x i8] c"KRW = \00"
@.str.9 = [6 x i8] c"%.2f\0A\00"
@str = [10 x i8] c" Unknown.\00"
@reltable.main = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32)]
@switch.table.main.10 = [9 x float] [float 0x4060EDC280000000, float 1.490000e+02, float 0x4056AA3D80000000, float 0x3FB47AE140000000, float 0x4056AA3D80000000, float 0x4056AA3D80000000, float 0x4056AA3D80000000, float 0x4056AA3D80000000, float 0x4056AA3D80000000]
define i32 @main() {
%1 = alloca i8
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%8 = load i8, i8* %1
%9 = add i8 %8, -101
%10 = call i8 @llvm.fshl.i8(i8 %9, i8 %9, i8 7)
%11 = icmp ult i8 %10, 9
br i1 %11, label %14, label %12
12: ; preds = %14, %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %31
14: ; preds = %0
%15 = zext i8 %10 to i16
%16 = lshr i16 267, %15
%17 = and i16 %16, 1
%18 = icmp eq i16 %17, 0
br i1 %18, label %12, label %19
19: ; preds = %14
%20 = sext i8 %10 to i64
%21 = shl i64 %20, 2
%22 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.main to i8*), i64 %21)
%23 = sext i8 %10 to i64
%24 = getelementptr inbounds [9 x float], [9 x float]* @switch.table.main.10, i64 0, i64 %23
%25 = load float, float* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %22)
%27 = load float, float* %2
%28 = fdiv float %27, %25
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %29)
br label %31
31: ; preds = %19, %12
ret i32 0
}