#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 EXIT_FAILURE;
int join_list_wrapper(char **);
int join_wrapper(char **);
scalar_t__ strcmp(char *, char *);
int main(int ac, char **av) {
  (void)(ac);
  if (strcmp(av[1], "join") == 0) {
    return join_wrapper(av);
  } else if (strcmp(av[1], "join_list") == 0) {
    return join_list_wrapper(av);
  } else {
    return EXIT_FAILURE;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeab(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1175 <main+0x45>
mov    -0x10(%rbp),%rdi
call   1050 <join_wrapper@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x80>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a4 <main+0x74>
mov    -0x10(%rbp),%rdi
call   1040 <join_list_wrapper@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x80>
mov    0x2e35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1169 <main+0x39>
mov    0x8(%rbx),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1172 <main+0x42>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <join_wrapper@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <join_list_wrapper@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"join\00"
@.str.1 = [10 x i8] c"join_list\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @join_wrapper(i8** %1)
br label %17
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @join_list_wrapper(i8** %1)
br label %17
15: ; preds = %9
%16 = load i32, i32* @EXIT_FAILURE
br label %17
17: ; preds = %15, %13, %7
%18 = phi i32 [ %8, %7 ], [ %14, %13 ], [ %16, %15 ]
ret i32 %18
}