#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 cd(char **);
int exit_(char **);
scalar_t__ strcmp(char *, char *);
int run_internal(char **command) {
  if ((strcmp(command[0], "cd") == 0))
    return cd(command);
  else if ((strcmp(command[0], "exit") == 0))
    return exit_(command);
  else
    return -1;
}


x86 assembly (clang, -O0):
<run_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    116a <run_internal+0x3a>
mov    -0x10(%rbp),%rdi
call   1030 <cd@plt>
mov    %eax,-0x4(%rbp)
jmp    119f <run_internal+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe8b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <run_internal+0x68>
mov    -0x10(%rbp),%rdi
call   1050 <exit_@plt>
mov    %eax,-0x4(%rbp)
jmp    119f <run_internal+0x6f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_internal>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1163 <run_internal+0x33>
mov    (%rbx),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     116c <run_internal+0x3c>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <cd@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <exit_@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"cd\00"
@.str.1 = [5 x i8] c"exit\00"
define i32 @run_internal(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 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = call i32 @cd(i8** %10)
store i32 %11, i32* %2
br label %22
12: ; preds = %1
%13 = load i8**, i8*** %3
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i8**, i8*** %3
%20 = call i32 @exit_(i8** %19)
store i32 %20, i32* %2
br label %22
21: ; preds = %12
store i32 -1, i32* %2
br label %22
22: ; preds = %21, %18, %9
%23 = load i32, i32* %2
ret i32 %23
}

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