#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 */
char **buildargv(char *input) {
  static char *arglist[256];
  int numargs = 0;
  while (1) {
    while (*input == ' ')
      input++;
    if (*input == 0)
      break;
    arglist[numargs++] = input;
    while (*input != ' ' && *input != 0)
      input++;
    if (*input == 0)
      break;
    *(input++) = 0;
  }
  arglist[numargs] = NULL;
  return arglist;
}


x86 assembly (clang, -O0):
<buildargv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1114 <buildargv+0x14>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1135 <buildargv+0x35>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <buildargv+0x14>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114a <buildargv+0x4a>
jmp    11d9 <buildargv+0xd9>
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %eax,%rcx
lea    0x2ecd(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xd(%rbp)
je     118c <buildargv+0x8c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    119c <buildargv+0x9c>
jmp    11ad <buildargv+0xad>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1167 <buildargv+0x67>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11c2 <buildargv+0xc2>
jmp    11d9 <buildargv+0xd9>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    110f <buildargv+0xf>
movslq -0xc(%rbp),%rcx
lea    0x2e4c(%rip),%rax
movq   $0x0,(%rax,%rcx,8)
lea    0x2e3d(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildargv>:
xor    %esi,%esi
lea    0x2f27(%rip),%rax
mov    %rdi,%rdx
add    $0x1,%rdi
movzbl (%rdx),%ecx
cmp    $0x20,%cl
jne    1130 <buildargv+0x30>
add    $0x1,%rdx
add    $0x1,%rdi
jmp    1110 <buildargv+0x10>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %cl,%cl
je     1166 <buildargv+0x66>
mov    %rdx,(%rax,%rsi,8)
add    $0x1,%rsi
nopl   0x0(%rax)
movzbl -0x1(%rdi),%ecx
test   %cl,%cl
je     1166 <buildargv+0x66>
cmp    $0x20,%cl
je     1160 <buildargv+0x60>
add    $0x1,%rdi
jmp    1140 <buildargv+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movb   $0x0,-0x1(%rdi)
jmp    1109 <buildargv+0x9>
movslq %esi,%rcx
movq   $0x0,(%rax,%rcx,8)
ret

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

LLVM IR (-O2):
@buildargv.arglist = internal global [256 x i8*] zeroinitializer
define i8** @buildargv(i8* %0) {
br label %2
2: ; preds = %18, %1
%3 = phi i64 [ %11, %18 ], [ 0, %1 ]
%4 = phi i8* [ %19, %18 ], [ %0, %1 ]
br label %5
5: ; preds = %8, %2
%6 = phi i8* [ %4, %2 ], [ %9, %8 ]
%7 = load i8, i8* %6
switch i8 %7, label %10 [
i8 32, label %8
i8 0, label %20
]
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
10: ; preds = %5
%11 = add nuw i64 %3, 1
%12 = getelementptr inbounds [256 x i8*], [256 x i8*]* @buildargv.arglist, i64 0, i64 %3
store i8* %6, i8** %12
br label %13
13: ; preds = %16, %10
%14 = phi i8* [ %6, %10 ], [ %17, %16 ]
%15 = load i8, i8* %14
switch i8 %15, label %16 [
i8 0, label %20
i8 32, label %18
]
16: ; preds = %13
%17 = getelementptr inbounds i8, i8* %14, i64 1
br label %13
18: ; preds = %13
%19 = getelementptr inbounds i8, i8* %14, i64 1
store i8 0, i8* %14
br label %2
20: ; preds = %5, %13
%21 = phi i64 [ %11, %13 ], [ %3, %5 ]
%22 = shl i64 %21, 32
%23 = ashr exact i64 %22, 32
%24 = getelementptr inbounds [256 x i8*], [256 x i8*]* @buildargv.arglist, i64 0, i64 %23
store i8* null, i8** %24
ret i8** getelementptr inbounds ([256 x i8*], [256 x i8*]* @buildargv.arglist, i64 0, i64 0)
}