#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 /*<<< orphan*/ echoargs(int, char **);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ splitargs(char *);
int main(int argc, char *argv[5]) {
  echoargs(argc, argv);
  for (; *argv != NULL; argv++) {
    printf("Split \"%s\"\n", *argv);
    splitargs(*argv);
  }
}


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <echoargs@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1190 <main+0x60>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <splitargs@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <main+0x22>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <echoargs@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     116d <main+0x3d>
add    $0x8,%rbx
lea    0xeb1(%rip),%r14
nop
mov    %r14,%rdi
call   1030 <printf@plt>
mov    -0x8(%rbx),%rdi
call   1040 <splitargs@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Split \22%s\22\0A\00"
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 = call i32 @echoargs(i32 %6, i8** %7)
br label %9
9: ; preds = %20, %2
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32 @splitargs(i8* %18)
br label %20
20: ; preds = %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %5
br label %9
23: ; preds = %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [12 x i8] c"Split \22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @echoargs(i32 %0, i8** %1)
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %13, %6 ], [ %4, %2 ]
%8 = phi i8** [ %12, %6 ], [ %1, %2 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = load i8*, i8** %8
%11 = tail call i32 @splitargs(i8* %10)
%12 = getelementptr inbounds i8*, i8** %8, i64 1
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret i32 0
}