#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 *);
void evaluate(char option) {
  switch (option) {
  case 'b':
    printf("Buy the stock now\n");
    break;
  case 'h':
    printf("Hold current stock\n");
    break;
  case 's':
    printf("Time to sell that stock\n");
    break;
  default:
    printf("Invalid stock value \n");
  }
}


x86 assembly (clang, -O0):
<evaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x62,%eax
je     1155 <evaluate+0x45>
jmp    1133 <evaluate+0x23>
mov    -0x8(%rbp),%eax
sub    $0x68,%eax
je     1166 <evaluate+0x56>
jmp    1144 <evaluate+0x34>
mov    -0x8(%rbp),%eax
sub    $0x73,%eax
je     1177 <evaluate+0x67>
jmp    1188 <evaluate+0x78>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <evaluate+0x84>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <evaluate+0x84>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <evaluate+0x84>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate>:
cmp    $0x62,%edi
je     112b <evaluate+0x1b>
cmp    $0x73,%edi
je     1137 <evaluate+0x27>
cmp    $0x68,%edi
jne    1143 <evaluate+0x33>
lea    0xef2(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xef9(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xec2(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xef3(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Buy the stock now\0A\00"
@.str.1 = [20 x i8] c"Hold current stock\0A\00"
@.str.2 = [25 x i8] c"Time to sell that stock\0A\00"
@.str.3 = [22 x i8] c"Invalid stock value \0A\00"
define void @evaluate(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
switch i32 %4, label %11 [
i32 98, label %5
i32 104, label %7
i32 115, label %9
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %13
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Time to sell that stock\00"
@str.4 = [19 x i8] c"Hold current stock\00"
@str.5 = [18 x i8] c"Buy the stock now\00"
@str.6 = [21 x i8] c"Invalid stock value \00"
define void @evaluate(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %5 [
i32 98, label %6
i32 104, label %3
i32 115, label %4
]
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3
%7 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0), %5 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0), %3 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0), %1 ]
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret void
}