#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__ strcmp(char *, char *);
const char *get_scenario(int argc, char *argv[]) {
  if (argc < 2) {
    return "peterson";
  } else if (strcmp(argv[1], "dummy") == 0) {
    return "dummy_process";
  } else if (strcmp(argv[1], "peterson") == 0) {
    return "peterson";
  }
}


x86 assembly (clang, -O0):
<get_scenario>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1139 <get_scenario+0x29>
lea    0xed0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <get_scenario+0x8f>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1167 <get_scenario+0x57>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <get_scenario+0x8f>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1195 <get_scenario+0x85>
lea    0xe74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <get_scenario+0x8f>
jmp    119a <get_scenario+0x8a>
jmp    119f <get_scenario+0x8f>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_scenario>:
push   %rbx
cmp    $0x2,%edi
jge    111f <get_scenario+0xf>
lea    0xee3(%rip),%rbx
jmp    1153 <get_scenario+0x43>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xedc(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114c <get_scenario+0x3c>
mov    0x8(%rbx),%rdi
lea    0xebe(%rip),%rbx
mov    %rbx,%rsi
call   1030 <strcmp@plt>
jmp    1153 <get_scenario+0x43>
lea    0xebc(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"peterson\00"
@.str.1 = [6 x i8] c"dummy\00"
@.str.2 = [14 x i8] c"dummy_process\00"
define i8* @get_scenario(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
br label %25
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %9
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %25
16: ; preds = %9
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
br label %25
23: ; preds = %16
br label %24
24: ; preds = %23
br label %25
25: ; preds = %8, %15, %22, %24
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
@.str = [9 x i8] c"peterson\00"
@.str.1 = [6 x i8] c"dummy\00"
@.str.2 = [14 x i8] c"dummy_process\00"
define i8* @get_scenario(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %4, %2
%13 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %9 ]
ret i8* %13
}