#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 */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ create_order();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ update_order();
int /*<<< orphan*/ view_order();
uint64_t interpret_input(char *input) {
  switch (input[0]) {
  case '1':
    view_order();
    break;
  case '2':
    create_order();
    break;
  case '3':
    update_order();
    break;
  case '4':
    return 1;
  default:
    puts("\nInvalid option.\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<interpret_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11a9 <interpret_input+0x69>
mov    -0x18(%rbp),%rax
lea    0xe90(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <view_order@plt>
jmp    11b5 <interpret_input+0x75>
mov    $0x0,%al
call   1030 <create_order@plt>
jmp    11b5 <interpret_input+0x75>
mov    $0x0,%al
call   1060 <update_order@plt>
jmp    11b5 <interpret_input+0x75>
movl   $0x1,-0x4(%rbp)
jmp    11bc <interpret_input+0x7c>
lea    0xe60(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpret_input>:
push   %rbx
movsbl (%rdi),%eax
add    $0xffffffcf,%eax
cmp    $0x3,%eax
ja     116c <interpret_input+0x2c>
mov    $0x1,%ebx
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <view_order@plt>
jmp    1190 <interpret_input+0x50>
lea    0xe9d(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
jmp    1190 <interpret_input+0x50>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <create_order@plt>
jmp    1190 <interpret_input+0x50>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <update_order@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0AInvalid option.\0A\00"
define i32 @interpret_input(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %15 [
i32 49, label %8
i32 50, label %10
i32 51, label %12
i32 52, label %14
]
8: ; preds = %1
%9 = call i32 (...) @view_order()
br label %17
10: ; preds = %1
%11 = call i32 (...) @create_order()
br label %17
12: ; preds = %1
%13 = call i32 (...) @update_order()
br label %17
14: ; preds = %1
store i32 1, i32* %2
br label %18
15: ; preds = %1
%16 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %12, %10, %8
store i32 0, i32* %2
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0AInvalid option.\0A\00"
define i32 @interpret_input(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %10 [
i32 49, label %4
i32 50, label %6
i32 51, label %8
i32 52, label %12
]
4: ; preds = %1
%5 = tail call i32 (...) @view_order()
br label %12
6: ; preds = %1
%7 = tail call i32 (...) @create_order()
br label %12
8: ; preds = %1
%9 = tail call i32 (...) @update_order()
br label %12
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %4, %6, %8, %10, %1
%13 = phi i32 [ 1, %1 ], [ 0, %10 ], [ 0, %8 ], [ 0, %6 ], [ 0, %4 ]
ret i32 %13
}