#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__ DubTruncStrCmp(int, scalar_t__, char *, char *);
scalar_t__ len(char *);
int RunWhat(char *str, int n) {
  if (DubTruncStrCmp((n + 1), len(str), str, "mission") > 0) {
    if (len(str) == (len("mission") + n))
      return 0;
  } else if (DubTruncStrCmp((n + 1), len(str), str, "random") > 0) {
    if (len(str) == (len("random") + n))
      return 1;
  } else if (DubTruncStrCmp((n + 1), len(str), str, "init") > 0) {
    if (len(str) == (len("init") + n))
      return 2;
  }
  return 3;
}


x86 assembly (clang, -O0):
<RunWhat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
lea    0xeae(%rip),%rcx
call   1040 <DubTruncStrCmp@plt>
cmp    $0x0,%rax
jle    11a2 <RunWhat+0x82>
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    %rax,-0x20(%rbp)
lea    0xe8b(%rip),%rdi
call   1030 <len@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jne    119d <RunWhat+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    1299 <RunWhat+0x179>
jmp    1292 <RunWhat+0x172>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
lea    0xe43(%rip),%rcx
call   1040 <DubTruncStrCmp@plt>
cmp    $0x0,%rax
jle    1215 <RunWhat+0xf5>
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    %rax,-0x30(%rbp)
lea    0xe20(%rip),%rdi
call   1030 <len@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jne    1210 <RunWhat+0xf0>
movl   $0x1,-0x4(%rbp)
jmp    1299 <RunWhat+0x179>
jmp    128d <RunWhat+0x16d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    -0x34(%rbp),%edi
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
lea    0xdd7(%rip),%rcx
call   1040 <DubTruncStrCmp@plt>
cmp    $0x0,%rax
jle    1288 <RunWhat+0x168>
mov    -0x10(%rbp),%rdi
call   1030 <len@plt>
mov    %rax,-0x40(%rbp)
lea    0xdb4(%rip),%rdi
call   1030 <len@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jne    1283 <RunWhat+0x163>
movl   $0x2,-0x4(%rbp)
jmp    1299 <RunWhat+0x179>
jmp    1288 <RunWhat+0x168>
jmp    128d <RunWhat+0x16d>
jmp    1292 <RunWhat+0x172>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RunWhat>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0x1(%r14),%r15d
call   1030 <len@plt>
lea    0xec2(%rip),%rcx
mov    %r15d,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1040 <DubTruncStrCmp@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <len@plt>
mov    %rax,%r12
test   %rbp,%rbp
jle    1175 <RunWhat+0x55>
lea    0xe9a(%rip),%rdi
call   1030 <len@plt>
movslq %r14d,%rcx
add    %rax,%rcx
xor    %eax,%eax
jmp    11b4 <RunWhat+0x94>
lea    0xe8c(%rip),%rcx
mov    %r15d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <DubTruncStrCmp@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <len@plt>
mov    %rax,%r12
test   %rbp,%rbp
jle    11c7 <RunWhat+0xa7>
lea    0xe64(%rip),%rdi
call   1030 <len@plt>
movslq %r14d,%rcx
add    %rax,%rcx
mov    $0x1,%eax
cmp    %rcx,%r12
je     11be <RunWhat+0x9e>
mov    $0x3,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe41(%rip),%rcx
mov    %r15d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <DubTruncStrCmp@plt>
test   %rax,%rax
jle    11b9 <RunWhat+0x99>
mov    %rbx,%rdi
call   1030 <len@plt>
mov    %rax,%rbx
lea    0xe1c(%rip),%rdi
call   1030 <len@plt>
movslq %r14d,%rcx
add    %rax,%rcx
mov    $0x2,%eax
cmp    %rcx,%rbx
jne    11b9 <RunWhat+0x99>
jmp    11be <RunWhat+0x9e>

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

LLVM IR (-O2):
@.str = [8 x i8] c"mission\00"
@.str.1 = [7 x i8] c"random\00"
@.str.2 = [5 x i8] c"init\00"
define i32 @RunWhat(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @len(i8* %0)
%5 = tail call i64 @DubTruncStrCmp(i32 %3, i64 %4, i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i64 %5, 0
%7 = tail call i64 @len(i8* %0)
br i1 %6, label %8, label %13
8: ; preds = %2
%9 = tail call i64 @len(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = sext i32 %1 to i64
%11 = add nsw i64 %9, %10
%12 = icmp eq i64 %7, %11
br i1 %12, label %32, label %31
13: ; preds = %2
%14 = tail call i64 @DubTruncStrCmp(i32 %3, i64 %7, i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp sgt i64 %14, 0
%16 = tail call i64 @len(i8* %0)
br i1 %15, label %17, label %22
17: ; preds = %13
%18 = tail call i64 @len(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%19 = sext i32 %1 to i64
%20 = add nsw i64 %18, %19
%21 = icmp eq i64 %16, %20
br i1 %21, label %32, label %31
22: ; preds = %13
%23 = tail call i64 @DubTruncStrCmp(i32 %3, i64 %16, i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = tail call i64 @len(i8* %0)
%27 = tail call i64 @len(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = sext i32 %1 to i64
%29 = add nsw i64 %27, %28
%30 = icmp eq i64 %26, %29
br i1 %30, label %32, label %31
31: ; preds = %17, %25, %22, %8
br label %32
32: ; preds = %25, %17, %8, %31
%33 = phi i32 [ 3, %31 ], [ 0, %8 ], [ 1, %17 ], [ 2, %25 ]
ret i32 %33
}