#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 getlet(char *);
int move_or_shoot() {
  int c;
badin:
  c = getlet("\033[0;1;33m(\033[31ms\033[33m)\033[32mhoot \033[34mOR "
             "\033[33m(\033[31mm\033[33m)\033[32move \033[34mOR "
             "\033[33m(\033[31mq\033[33m)\033[32muit, Huh");
  if (c == 'S')
    return (1);
  else if (c == 'M')
    return (0);
  else if (c == 'Q')
    return (2);
  else
    goto badin;
}


x86 assembly (clang, -O0):
<move_or_shoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getlet@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x53,-0x8(%rbp)
jne    113d <move_or_shoot+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    116e <move_or_shoot+0x5e>
cmpl   $0x4d,-0x8(%rbp)
jne    1153 <move_or_shoot+0x43>
movl   $0x0,-0x4(%rbp)
jmp    116e <move_or_shoot+0x5e>
cmpl   $0x51,-0x8(%rbp)
jne    1169 <move_or_shoot+0x59>
movl   $0x2,-0x4(%rbp)
jmp    116e <move_or_shoot+0x5e>
jmp    1118 <move_or_shoot+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_or_shoot>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <getlet@plt>
cmp    $0x4d,%eax
je     113e <move_or_shoot+0x2e>
cmp    $0x51,%eax
je     1142 <move_or_shoot+0x32>
cmp    $0x53,%eax
jne    1120 <move_or_shoot+0x10>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [107 x i8] c"\1B[0;1;33m(\1B[31ms\1B[33m)\1B[32mhoot \1B[34mOR \1B[33m(\1B[31mm\1B[33m)\1B[32move \1B[34mOR \1B[33m(\1B[31mq\1B[33m)\1B[32muit, Huh\00"
define i32 @move_or_shoot() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %16, %0
%4 = call i32 @getlet(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 83
br i1 %6, label %7, label %8
7: ; preds = %3
store i32 1, i32* %1
br label %17
8: ; preds = %3
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 77
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %1
br label %17
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 81
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 2, i32* %1
br label %17
16: ; preds = %12
br label %3
17: ; preds = %15, %11, %7
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [107 x i8] c"\1B[0;1;33m(\1B[31ms\1B[33m)\1B[32mhoot \1B[34mOR \1B[33m(\1B[31mm\1B[33m)\1B[32move \1B[34mOR \1B[33m(\1B[31mq\1B[33m)\1B[32muit, Huh\00"
define i32 @move_or_shoot() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @getlet(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
switch i32 %2, label %1 [
i32 83, label %3
i32 77, label %4
i32 81, label %5
]
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3
%6 = phi i32 [ 1, %3 ], [ 0, %4 ], [ 2, %1 ]
ret i32 %6
}