#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*/ abort();
char **buildargv(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char **args;
  char input[256];
  int i;
  strcpy(input, " a b");
  args = buildargv(input);
  if (strcmp(args[0], "a"))
    abort();
  if (strcmp(args[1], "b"))
    abort();
  if (args[2] != NULL)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strcpy@plt>
lea    -0x110(%rbp),%rdi
call   1040 <buildargv@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe72(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11a9 <main+0x59>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11ce <main+0x7e>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11e4 <main+0x94>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xea1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <buildargv@plt>
mov    %rax,%rbx
mov    (%rax),%rdi
lea    0xe86(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ac <main+0x5c>
mov    0x8(%rbx),%rdi
lea    0xe6f(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ac <main+0x5c>
cmpq   $0x0,0x10(%rbx)
jne    11ac <main+0x5c>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" a b\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [2 x i8] c"b\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8**
%3 = alloca [256 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i8** @buildargv(i8* %7)
store i8** %8, i8*** %2
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %0
%17 = load i8**, i8*** %2
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %16
%25 = load i8**, i8*** %2
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %24
%32 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c" a b\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [2 x i8] c"b\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = call i8** @buildargv(i8* %2)
%5 = load i8*, i8** %4
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = getelementptr inbounds i8*, i8** %4, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %10
%18 = getelementptr inbounds i8*, i8** %4, i64 2
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = call i32 (...) @abort()
unreachable
23: ; preds = %17
%24 = call i32 @exit(i32 0)
unreachable
}