#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;
  int n;
  int price;
  int up;
  printf(" banana? apple? orange? ");
  scanf("%c", &c);
  if (c == 'a')
    up = 125;
  else if (c == 'b')
    up = 60;
  else if (c == 'o')
    up = 82;
  else {
    printf(" Unknown.\n");
    return 0;
  }
  printf(" how many? ");
  scanf("%d", &n);
  price = (up * n);
  printf("price %d\n", price);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1168 <main+0x48>
movl   $0x7d,-0x14(%rbp)
jmp    11be <main+0x9e>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    1181 <main+0x61>
movl   $0x3c,-0x14(%rbp)
jmp    11b9 <main+0x99>
movsbl -0x5(%rbp),%eax
cmp    $0x6f,%eax
jne    119a <main+0x7a>
movl   $0x52,-0x14(%rbp)
jmp    11b4 <main+0x94>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1200 <main+0xe0>
jmp    11b9 <main+0x99>
jmp    11be <main+0x9e>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe60(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%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   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xb(%rsp),%al
cmp    $0x61,%al
je     116d <main+0x3d>
cmp    $0x6f,%al
je     1174 <main+0x44>
cmp    $0x62,%al
jne    11b1 <main+0x81>
mov    $0x3c,%ebx
jmp    1179 <main+0x49>
mov    $0x7d,%ebx
jmp    1179 <main+0x49>
mov    $0x52,%ebx
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
imul   0xc(%rsp),%ebx
lea    0xe85(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11bd <main+0x8d>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c" banana? apple? orange? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [11 x i8] c" Unknown.\0A\00"
@.str.3 = [12 x i8] c" how many? \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [10 x i8] c"price %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 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), i8* %2)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 97
br i1 %10, label %11, label %12
11: ; preds = %0
store i32 125, i32* %5
br label %26
12: ; preds = %0
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 98
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 60, i32* %5
br label %25
17: ; preds = %12
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 111
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 82, i32* %5
br label %24
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %34
24: ; preds = %21
br label %25
25: ; preds = %24, %16
br label %26
26: ; preds = %25, %11
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%29 = load i32, i32* %5
%30 = load i32, i32* %3
%31 = mul nsw i32 %29, %30
store i32 %31, i32* %4
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %32)
store i32 0, i32* %1
br label %34
34: ; preds = %26, %22
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [25 x i8] c" banana? apple? orange? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.3 = [12 x i8] c" how many? \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [10 x i8] c"price %d\0A\00"
@str = [10 x i8] c" Unknown.\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 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), i8* %1)
%6 = load i8, i8* %1
switch i8 %6, label %9 [
i8 97, label %11
i8 98, label %7
i8 111, label %8
]
7: ; preds = %0
br label %11
8: ; preds = %0
br label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %18
11: ; preds = %0, %7, %8
%12 = phi i32 [ 60, %7 ], [ 82, %8 ], [ 125, %0 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %11, %9
ret i32 0
}