#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*/ execute(char **);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
char *makestring(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main() {
  char *arglist[20 + 1];
  int numargs = 0;
  char argbuf[100];
  while (numargs < 20) {
    printf("arg[%d]? ", numargs);
    if (fgets(argbuf, 100, stdin) && *argbuf != '\n')
      arglist[numargs++] = makestring(argbuf);
    else {
      if (numargs > 0) {
        arglist[numargs] = NULL;
        execute(arglist);
        numargs = 0;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xb4(%rbp)
cmpl   $0x14,-0xb4(%rbp)
jge    121e <main+0xde>
mov    -0xb4(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    0x2e5f(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11de <main+0x9e>
movsbl -0x120(%rbp),%eax
cmp    $0xa,%eax
je     11de <main+0x9e>
lea    -0x120(%rbp),%rdi
call   1060 <makestring@plt>
mov    %rax,%rcx
mov    -0xb4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xb4(%rbp)
cltq
mov    %rcx,-0xb0(%rbp,%rax,8)
ff
jmp    1219 <main+0xd9>
cmpl   $0x0,-0xb4(%rbp)
jle    1214 <main+0xd4>
movslq -0xb4(%rbp),%rax
movq   $0x0,-0xb0(%rbp,%rax,8)
lea    -0xb0(%rbp),%rdi
call   1040 <execute@plt>
movl   $0x0,-0xb4(%rbp)
jmp    1219 <main+0xd9>
jmp    115c <main+0x1c>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x120,%rsp
xor    %ebp,%ebp
lea    0xea8(%rip),%r14
mov    0x2e89(%rip),%r12
mov    %rsp,%rbx
lea    0x70(%rsp),%r15
jmp    1188 <main+0x48>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <makestring@plt>
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %rax,0x70(%rsp,%rcx,8)
cmp    $0x14,%ebp
jge    11c9 <main+0x89>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11ae <main+0x6e>
cmpb   $0xa,(%rsp)
jne    1170 <main+0x30>
test   %ebp,%ebp
jle    1183 <main+0x43>
mov    %ebp,%eax
movq   $0x0,0x70(%rsp,%rax,8)
mov    %r15,%rdi
call   1040 <execute@plt>
xor    %ebp,%ebp
jmp    1183 <main+0x43>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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