#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__ isspace(char);
scalar_t__ read(int /*<<< orphan*/, char *, int);
char **afl_init_argv(int *argc) {
  static char in_buf[100000];
  static char *ret[1000];
  char *ptr = in_buf;
  int rc = 1;
  if (read(0, in_buf, 100000 - 2) < 0)
    ;
  while (*ptr) {
    ret[rc] = ptr;
    while (*ptr && !isspace(*ptr))
      ptr++;
    *ptr = '\0';
    ptr++;
    while (*ptr && isspace(*ptr))
      ptr++;
    rc++;
  }
  *argc = rc;
  return ret;
}


x86 assembly (clang, -O0):
<afl_init_argv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f0d(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
xor    %edi,%edi
lea    0x2ef9(%rip),%rsi
mov    $0x1869e,%edx
call   1040 <read@plt>
cmp    $0x0,%rax
jge    1160 <afl_init_argv+0x40>
jmp    1160 <afl_init_argv+0x40>
jmp    1165 <afl_init_argv+0x45>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1240 <afl_init_argv+0x120>
mov    -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rcx
lea    0x1b55f(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     11b2 <afl_init_argv+0x92>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11c2 <afl_init_argv+0xa2>
jmp    11d3 <afl_init_argv+0xb3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1185 <afl_init_argv+0x65>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x16(%rbp)
je     1211 <afl_init_argv+0xf1>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    1221 <afl_init_argv+0x101>
jmp    1232 <afl_init_argv+0x112>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11e6 <afl_init_argv+0xc6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <afl_init_argv+0x45>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
lea    0x1b490(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afl_init_argv>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x2f0e(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1869e,%edx
call   1040 <read@plt>
cmpb   $0x0,0x2ef8(%rip)
je     11ba <afl_init_argv+0x9a>
mov    $0x1,%r15d
lea    0x1b589(%rip),%r12
mov    %rbx,(%r12,%r15,8)
mov    (%rbx),%al
test   %al,%al
je     1189 <afl_init_argv+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1189 <afl_init_argv+0x69>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <afl_init_argv+0x50>
movb   $0x0,(%rbx)
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
test   %al,%al
je     11b4 <afl_init_argv+0x94>
add    $0x1,%rbx
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1190 <afl_init_argv+0x70>
add    $0x1,%r15
cmpb   $0x0,(%rbx)
jne    1157 <afl_init_argv+0x37>
jmp    11c0 <afl_init_argv+0xa0>
add    $0x1,%r15
jmp    11c0 <afl_init_argv+0xa0>
mov    $0x1,%r15d
mov    %r15d,(%r14)
lea    0x1b516(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@afl_init_argv.in_buf = internal global [100000 x i8] zeroinitializer
@afl_init_argv.ret = internal global [1000 x i8*] zeroinitializer
define i8** @afl_init_argv(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32
store i32* %0, i32** %2
store i8* getelementptr inbounds ([100000 x i8], [100000 x i8]* @afl_init_argv.in_buf, i64 0, i64 0), i8** %3
store i32 1, i32* %4
%5 = call i64 @read(i32 0, i8* getelementptr inbounds ([100000 x i8], [100000 x i8]* @afl_init_argv.in_buf, i64 0, i64 0), i32 99998)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %1
br label %9
9: ; preds = %53, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %56
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* @afl_init_argv.ret, i64 0, i64 %16
store i8* %14, i8** %17
br label %18
18: ; preds = %31, %13
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = call i64 @isspace(i8 signext %25)
%27 = icmp ne i64 %26, 0
%28 = xor i1 %27, true
br label %29
29: ; preds = %23, %18
%30 = phi i1 [ false, %18 ], [ %28, %23 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
br label %18
34: ; preds = %29
%35 = load i8*, i8** %3
store i8 0, i8* %35
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %3
br label %38
38: ; preds = %50, %34
%39 = load i8*, i8** %3
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = load i8*, i8** %3
%45 = load i8, i8* %44
%46 = call i64 @isspace(i8 signext %45)
%47 = icmp ne i64 %46, 0
br label %48
48: ; preds = %43, %38
%49 = phi i1 [ false, %38 ], [ %47, %43 ]
br i1 %49, label %50, label %53
50: ; preds = %48
%51 = load i8*, i8** %3
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %3
br label %38
53: ; preds = %48
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %9
56: ; preds = %9
%57 = load i32, i32* %4
%58 = load i32*, i32** %2
store i32 %57, i32* %58
ret i8** getelementptr inbounds ([1000 x i8*], [1000 x i8*]* @afl_init_argv.ret, i64 0, i64 0)
}

LLVM IR (-O2):
@afl_init_argv.in_buf = internal global [100000 x i8] zeroinitializer
@afl_init_argv.ret = internal global [1000 x i8*] zeroinitializer
define i8** @afl_init_argv(i32* nocapture writeonly %0) {
%2 = tail call i64 @read(i32 0, i8* getelementptr inbounds ([100000 x i8], [100000 x i8]* @afl_init_argv.in_buf, i64 0, i64 0), i32 99998)
%3 = load i8, i8* getelementptr inbounds ([100000 x i8], [100000 x i8]* @afl_init_argv.in_buf, i64 0, i64 0)
%4 = icmp eq i8 %3, 0
br i1 %4, label %39, label %5
5: ; preds = %1, %32
%6 = phi i64 [ %34, %32 ], [ 1, %1 ]
%7 = phi i8* [ %24, %32 ], [ getelementptr inbounds ([100000 x i8], [100000 x i8]* @afl_init_argv.in_buf, i64 0, i64 0), %1 ]
%8 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* @afl_init_argv.ret, i64 0, i64 %6
store i8* %7, i8** %8
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %5, %16
%12 = phi i8 [ %18, %16 ], [ %9, %5 ]
%13 = phi i8* [ %17, %16 ], [ %7, %5 ]
%14 = tail call i64 @isspace(i8 signext %12)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = getelementptr inbounds i8, i8* %13, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11, %16, %5
%21 = phi i8* [ %7, %5 ], [ %17, %16 ], [ %13, %11 ]
store i8 0, i8* %21
br label %22
22: ; preds = %29, %20
%23 = phi i8* [ %21, %20 ], [ %24, %29 ]
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = add nuw i64 %6, 1
br label %36
29: ; preds = %22
%30 = tail call i64 @isspace(i8 signext %25)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %22
32: ; preds = %29
%33 = load i8, i8* %24
%34 = add nuw i64 %6, 1
%35 = icmp eq i8 %33, 0
br i1 %35, label %36, label %5
36: ; preds = %32, %27
%37 = phi i64 [ %28, %27 ], [ %34, %32 ]
%38 = trunc i64 %37 to i32
br label %39
39: ; preds = %36, %1
%40 = phi i32 [ 1, %1 ], [ %38, %36 ]
store i32 %40, i32* %0
ret i8** getelementptr inbounds ([1000 x i8*], [1000 x i8*]* @afl_init_argv.ret, i64 0, i64 0)
}