#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__ strlen(char *);
char *strsep(char **, char *);
void parse_ln(char *str, int *argc, char *argv[]) {
  *argc = 0;
  if (str) {
    while ((argv[*argc] = strsep(&str, " \n")) && *argc < 16) {
      if (strlen(argv[*argc])) {
        *argc += 1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<parse_ln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x8(%rbp)
je     11cf <parse_ln+0xaf>
jmp    114e <parse_ln+0x2e>
lea    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rdx
movslq (%rdx),%rdx
mov    %rcx,(%rax,%rdx,8)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
je     118c <parse_ln+0x6c>
mov    -0x10(%rbp),%rax
cmpl   $0x10,(%rax)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119c <parse_ln+0x7c>
jmp    11ca <parse_ln+0xaa>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     11c5 <parse_ln+0xa5>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    114e <parse_ln+0x2e>
jmp    11cf <parse_ln+0xaf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_ln>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
movl   $0x0,(%rsi)
test   %rdi,%rdi
je     1186 <parse_ln+0x76>
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xecc(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strsep@plt>
movslq (%rbx),%rcx
mov    %rax,(%r14,%rcx,8)
test   %rax,%rax
je     1186 <parse_ln+0x76>
cmp    $0xf,%ecx
jg     1186 <parse_ln+0x76>
lea    0xeac(%rip),%r15
mov    %rsp,%r12
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rax)
je     116a <parse_ln+0x5a>
add    $0x1,%ecx
mov    %ecx,(%rbx)
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strsep@plt>
movslq (%rbx),%rcx
mov    %rax,(%r14,%rcx,8)
test   %rax,%rax
je     1186 <parse_ln+0x76>
cmp    $0x10,%ecx
jl     1160 <parse_ln+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \0A\00"
define void @parse_ln(i8* %0, i32* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8**
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8** %2, i8*** %6
%7 = load i32*, i32** %5
store i32 0, i32* %7
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %40
10: ; preds = %3
br label %11
11: ; preds = %38, %10
%12 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = load i8**, i8*** %6
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %13, i64 %16
store i8* %12, i8** %17
%18 = icmp ne i8* %12, null
br i1 %18, label %19, label %23
19: ; preds = %11
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = icmp slt i32 %21, 16
br label %23
23: ; preds = %19, %11
%24 = phi i1 [ false, %11 ], [ %22, %19 ]
br i1 %24, label %25, label %39
25: ; preds = %23
%26 = load i8**, i8*** %6
%27 = load i32*, i32** %5
%28 = load i32, i32* %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %26, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strlen(i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %25
%35 = load i32*, i32** %5
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 1
store i32 %37, i32* %35
br label %38
38: ; preds = %34, %25
br label %11
39: ; preds = %23
br label %40
40: ; preds = %39, %3
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c" \0A\00"
define void @parse_ln(i8* %0, i32* nocapture %1, i8** nocapture %2) {
%4 = alloca i8*
store i8* %0, i8** %4
store i32 0, i32* %1
%5 = icmp eq i8* %0, null
br i1 %5, label %29, label %6
6: ; preds = %3
%7 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
store i8* %7, i8** %10
%11 = icmp ne i8* %7, null
%12 = icmp slt i32 %8, 16
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %14, label %29
14: ; preds = %6, %21
%15 = phi i32 [ %23, %21 ], [ %8, %6 ]
%16 = phi i8* [ %22, %21 ], [ %7, %6 ]
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = add nsw i32 %15, 1
store i32 %20, i32* %1
br label %21
21: ; preds = %19, %14
%22 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %2, i64 %24
store i8* %22, i8** %25
%26 = icmp ne i8* %22, null
%27 = icmp slt i32 %23, 16
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %14, label %29
29: ; preds = %21, %6, %3
ret void
}