#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*/ decimal_to_hex();
char getchar();
int /*<<< orphan*/ hexadecimal_to_dec();
int /*<<< orphan*/ printf(char *);
int main() {
  char inputLetter;
  inputLetter = getchar();
  getchar();
  switch (inputLetter) {
  case 'h':
    hexadecimal_to_dec();
    break;
  case 'd':
    decimal_to_hex();
    break;
  default:
    printf("Only h or d is correct\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0xd(%rbp)
call   1050 <getchar@plt>
mov    %al,%cl
mov    -0xd(%rbp),%al
mov    %cl,-0x5(%rbp)
call   1050 <getchar@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x64,%eax
je     1198 <main+0x58>
jmp    117b <main+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x68,%eax
jne    11a4 <main+0x64>
jmp    118c <main+0x4c>
mov    $0x0,%al
call   1030 <hexadecimal_to_dec@plt>
jmp    11b0 <main+0x70>
mov    $0x0,%al
call   1060 <decimal_to_hex@plt>
jmp    11b0 <main+0x70>
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl %bl,%eax
cmp    $0x64,%eax
je     1167 <main+0x27>
cmp    $0x68,%eax
jne    1170 <main+0x30>
xor    %eax,%eax
call   1040 <hexadecimal_to_dec@plt>
jmp    117c <main+0x3c>
xor    %eax,%eax
call   1060 <decimal_to_hex@plt>
jmp    117c <main+0x3c>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Only h or d is correct\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
%4 = call signext i8 (...) @getchar()
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %11 [
i32 104, label %7
i32 100, label %9
]
7: ; preds = %0
%8 = call i32 (...) @hexadecimal_to_dec()
br label %13
9: ; preds = %0
%10 = call i32 (...) @decimal_to_hex()
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7
ret i32 0
}

LLVM IR (-O2):
@str = [23 x i8] c"Only h or d is correct\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call signext i8 (...) @getchar()
%3 = sext i8 %1 to i32
switch i32 %3, label %8 [
i32 104, label %4
i32 100, label %6
]
4: ; preds = %0
%5 = tail call i32 (...) @hexadecimal_to_dec()
br label %10
6: ; preds = %0
%7 = tail call i32 (...) @decimal_to_hex()
br label %10
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6, %4
ret i32 0
}