#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 */
scalar_t__ __getanum(int, int);
__attribute__((no)) const char *iamalsoareffunc(char opt) {
  opt += __getanum(opt, 2);
  opt += __getanum(opt, 3);
  char *msg;
  switch (opt) {
  case 'a':
    msg = "Got a";
    break;
  case 'b':
    msg = "Got b";
    break;
  case '\0':
    msg = "For serious?";
    break;
  default:
    msg = "Unknown command";
  }
  for (int i = 0; i < 5; i++) {
    if (opt == 'a') {
      opt += __getanum(i, 4);
    } else if (opt == 'b') {
      opt += __getanum(i, 5);
    } else {
      opt += __getanum(i, 6);
    }
  }
  msg[0] = opt;
  return msg;
}


x86 assembly (clang, -O0):
<iamalsoareffunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
mov    $0x2,%esi
call   1030 <__getanum@plt>
mov    %rax,%rcx
movzbl -0x1(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
mov    $0x3,%esi
call   1030 <__getanum@plt>
mov    %rax,%rcx
movzbl -0x1(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     11a8 <iamalsoareffunc+0x98>
jmp    1166 <iamalsoareffunc+0x56>
mov    -0x18(%rbp),%eax
sub    $0x61,%eax
je     1188 <iamalsoareffunc+0x78>
jmp    1177 <iamalsoareffunc+0x67>
mov    -0x18(%rbp),%eax
sub    $0x62,%eax
je     1198 <iamalsoareffunc+0x88>
jmp    11b8 <iamalsoareffunc+0xa8>
lea    0xe71(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11c3 <iamalsoareffunc+0xb3>
lea    0xe67(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11c3 <iamalsoareffunc+0xb3>
lea    0xe5d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11c3 <iamalsoareffunc+0xb3>
lea    0xe5a(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1261 <iamalsoareffunc+0x151>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jne    1201 <iamalsoareffunc+0xf1>
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1030 <__getanum@plt>
mov    %rax,%rcx
movsbq -0x1(%rbp),%rax
add    %rcx,%rax
mov    %al,-0x1(%rbp)
jmp    124e <iamalsoareffunc+0x13e>
movsbl -0x1(%rbp),%eax
cmp    $0x62,%eax
jne    122e <iamalsoareffunc+0x11e>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1030 <__getanum@plt>
mov    %rax,%rcx
movsbq -0x1(%rbp),%rax
add    %rcx,%rax
mov    %al,-0x1(%rbp)
jmp    1249 <iamalsoareffunc+0x139>
mov    -0x14(%rbp),%edi
mov    $0x6,%esi
call   1030 <__getanum@plt>
mov    %rax,%rcx
movsbq -0x1(%rbp),%rax
add    %rcx,%rax
mov    %al,-0x1(%rbp)
jmp    124e <iamalsoareffunc+0x13e>
jmp    1253 <iamalsoareffunc+0x143>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ca <iamalsoareffunc+0xba>
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iamalsoareffunc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebx
mov    $0x2,%esi
call   1030 <__getanum@plt>
add    %bl,%al
movsbl %al,%ebx
mov    %ebx,%edi
mov    $0x3,%esi
call   1030 <__getanum@plt>
add    %al,%bl
movsbl %bl,%eax
test   %eax,%eax
je     1151 <iamalsoareffunc+0x41>
cmp    $0x61,%eax
je     115a <iamalsoareffunc+0x4a>
cmp    $0x62,%eax
jne    1163 <iamalsoareffunc+0x53>
lea    0xeb7(%rip),%r14
jmp    116a <iamalsoareffunc+0x5a>
lea    0xeb4(%rip),%r14
jmp    116a <iamalsoareffunc+0x5a>
lea    0xe9f(%rip),%r14
jmp    116a <iamalsoareffunc+0x5a>
lea    0xeaf(%rip),%r14
xor    %eax,%eax
cmp    $0x62,%bl
sete   %al
mov    $0x6,%r15d
mov    $0x6,%esi
sub    %eax,%esi
cmp    $0x61,%bl
mov    $0x4,%r12d
cmove  %r12d,%esi
xor    %edi,%edi
call   1030 <__getanum@plt>
mov    %rax,%rbp
add    %bl,%bpl
xor    %eax,%eax
cmp    $0x62,%bpl
sete   %al
mov    $0x6,%esi
sub    %eax,%esi
cmp    $0x61,%bpl
cmove  %r12d,%esi
mov    $0x1,%edi
call   1030 <__getanum@plt>
mov    %rax,%rbx
add    %bpl,%bl
xor    %eax,%eax
cmp    $0x62,%bl
sete   %al
mov    $0x6,%esi
sub    %eax,%esi
cmp    $0x61,%bl
cmove  %r12d,%esi
mov    $0x2,%edi
call   1030 <__getanum@plt>
mov    %rax,%rbp
add    %bl,%bpl
xor    %eax,%eax
cmp    $0x62,%bpl
sete   %al
mov    $0x6,%esi
sub    %eax,%esi
cmp    $0x61,%bpl
cmove  %r12d,%esi
mov    $0x3,%edi
call   1030 <__getanum@plt>
add    %bpl,%al
xor    %ecx,%ecx
cmp    $0x62,%al
sete   %cl
sub    %ecx,%r15d
cmp    $0x61,%al
cmove  %r12d,%r15d
mov    $0x4,%edi
mov    %r15d,%esi
call   1030 <__getanum@plt>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Got a\00"
@.str.1 = [6 x i8] c"Got b\00"
@.str.2 = [13 x i8] c"For serious?\00"
@.str.3 = [16 x i8] c"Unknown command\00"
define i8* @iamalsoareffunc(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = call i64 @__getanum(i32 %6, i32 2)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i8
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = call i64 @__getanum(i32 %13, i32 3)
%15 = load i8, i8* %2
%16 = sext i8 %15 to i64
%17 = add nsw i64 %16, %14
%18 = trunc i64 %17 to i8
store i8 %18, i8* %2
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
switch i32 %20, label %24 [
i32 97, label %21
i32 98, label %22
i32 0, label %23
]
21: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
br label %25
22: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %25
23: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %25
24: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %25
25: ; preds = %24, %23, %22, %21
store i32 0, i32* %4
br label %26
26: ; preds = %60, %25
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %63
29: ; preds = %26
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 97
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i32, i32* %4
%35 = call i64 @__getanum(i32 %34, i32 4)
%36 = load i8, i8* %2
%37 = sext i8 %36 to i64
%38 = add nsw i64 %37, %35
%39 = trunc i64 %38 to i8
store i8 %39, i8* %2
br label %59
40: ; preds = %29
%41 = load i8, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 98
br i1 %43, label %44, label %51
44: ; preds = %40
%45 = load i32, i32* %4
%46 = call i64 @__getanum(i32 %45, i32 5)
%47 = load i8, i8* %2
%48 = sext i8 %47 to i64
%49 = add nsw i64 %48, %46
%50 = trunc i64 %49 to i8
store i8 %50, i8* %2
br label %58
51: ; preds = %40
%52 = load i32, i32* %4
%53 = call i64 @__getanum(i32 %52, i32 6)
%54 = load i8, i8* %2
%55 = sext i8 %54 to i64
%56 = add nsw i64 %55, %53
%57 = trunc i64 %56 to i8
store i8 %57, i8* %2
br label %58
58: ; preds = %51, %44
br label %59
59: ; preds = %58, %33
br label %60
60: ; preds = %59
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %26
63: ; preds = %26
%64 = load i8, i8* %2
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i64 0
store i8 %64, i8* %66
%67 = load i8*, i8** %3
ret i8* %67
}

LLVM IR (-O2):
@.str = [6 x i8] c"Got a\00"
@.str.1 = [6 x i8] c"Got b\00"
@.str.2 = [13 x i8] c"For serious?\00"
@.str.3 = [16 x i8] c"Unknown command\00"
define i8* @iamalsoareffunc(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = tail call i64 @__getanum(i32 %2, i32 2)
%4 = trunc i64 %3 to i8
%5 = add i8 %4, %0
%6 = sext i8 %5 to i32
%7 = tail call i64 @__getanum(i32 %6, i32 3)
%8 = trunc i64 %7 to i8
%9 = add i8 %5, %8
%10 = sext i8 %9 to i32
switch i32 %10, label %13 [
i32 97, label %14
i32 98, label %11
i32 0, label %12
]
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11
%15 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %13 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ]
%16 = icmp eq i8 %9, 98
%17 = select i1 %16, i32 5, i32 6
%18 = icmp eq i8 %9, 97
%19 = select i1 %18, i32 4, i32 %17
%20 = tail call i64 @__getanum(i32 0, i32 %19)
%21 = trunc i64 %20 to i8
%22 = add i8 %9, %21
%23 = icmp eq i8 %22, 98
%24 = select i1 %23, i32 5, i32 6
%25 = icmp eq i8 %22, 97
%26 = select i1 %25, i32 4, i32 %24
%27 = tail call i64 @__getanum(i32 1, i32 %26)
%28 = trunc i64 %27 to i8
%29 = add i8 %22, %28
%30 = icmp eq i8 %29, 98
%31 = select i1 %30, i32 5, i32 6
%32 = icmp eq i8 %29, 97
%33 = select i1 %32, i32 4, i32 %31
%34 = tail call i64 @__getanum(i32 2, i32 %33)
%35 = trunc i64 %34 to i8
%36 = add i8 %29, %35
%37 = icmp eq i8 %36, 98
%38 = select i1 %37, i32 5, i32 6
%39 = icmp eq i8 %36, 97
%40 = select i1 %39, i32 4, i32 %38
%41 = tail call i64 @__getanum(i32 3, i32 %40)
%42 = trunc i64 %41 to i8
%43 = add i8 %36, %42
%44 = icmp eq i8 %43, 98
%45 = select i1 %44, i32 5, i32 6
%46 = icmp eq i8 %43, 97
%47 = select i1 %46, i32 4, i32 %45
%48 = tail call i64 @__getanum(i32 4, i32 %47)
ret i8* %15
}