#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ process_line(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  char instring[100], *stringp;
  if (argc > 1) {
    strcpy(instring, argv[1]);
    for (i = 2; i < argc; i++) {
      strcat(instring, " ");
      strcat(instring, argv[i]);
    }
    process_line(instring);
  } else {
    while (fgets(instring, 100, stdin) != NULL) {
      stringp = instring;
      while (*stringp++ != '\n')
        ;
      *--stringp = '\0';
      process_line(instring);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d8 <main+0x88>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ca <main+0x7a>
lea    -0x80(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <main+0x3b>
lea    -0x80(%rbp),%rdi
call   1070 <process_line@plt>
jmp    125b <main+0x10b>
jmp    11dd <main+0x8d>
lea    -0x80(%rbp),%rdi
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1256 <main+0x106>
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x88(%rbp)
movsbl (%rax),%eax
cmp    $0xa,%eax
je     122f <main+0xdf>
jmp    1209 <main+0xb9>
mov    -0x88(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x88(%rbp)
movb   $0x0,-0x1(%rax)
lea    -0x80(%rbp),%rdi
call   1070 <process_line@plt>
jmp    11dd <main+0x8d>
jmp    125b <main+0x10b>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
cmp    $0x1,%edi
jle    11ba <main+0x6a>
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x8(%rsi),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
cmp    $0x2,%ebx
je     11b0 <main+0x60>
mov    %ebx,%r12d
mov    $0x2,%ebx
lea    0xe79(%rip),%r14
mov    %rsp,%r13
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    (%r15,%rbx,8),%rsi
mov    %r13,%rdi
call   1050 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1190 <main+0x40>
mov    %rsp,%rdi
call   1070 <process_line@plt>
jmp    120f <main+0xbf>
mov    0x2e27(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     120f <main+0xbf>
mov    %rbx,%rcx
nopl   0x0(%rax)
mov    %rcx,%rax
add    $0x1,%rcx
cmpb   $0xa,(%rax)
jne    11e0 <main+0x90>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1070 <process_line@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    %rbx,%rcx
test   %rax,%rax
jne    11e0 <main+0x90>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %37
11: ; preds = %2
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcpy(i8* %12, i8* %15)
store i32 2, i32* %6
br label %17
17: ; preds = %31, %11
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %34
21: ; preds = %17
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @strcat(i8* %24, i8* %29)
br label %31
31: ; preds = %21
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %17
34: ; preds = %17
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%36 = call i32 @process_line(i8* %35)
br label %58
37: ; preds = %2
br label %38
38: ; preds = %52, %37
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%40 = load i32, i32* @stdin
%41 = call i32* @fgets(i8* %39, i32 100, i32 %40)
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %57
43: ; preds = %38
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
store i8* %44, i8** %8
br label %45
45: ; preds = %51, %43
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %8
%48 = load i8, i8* %46
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 10
br i1 %50, label %51, label %52
51: ; preds = %45
br label %45
52: ; preds = %45
%53 = load i8*, i8** %8
%54 = getelementptr inbounds i8, i8* %53, i32 -1
store i8* %54, i8** %8
store i8 0, i8* %54
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%56 = call i32 @process_line(i8* %55)
br label %38
57: ; preds = %38
br label %58
58: ; preds = %57, %34
%59 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %4, i32 100, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %39, label %27
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcpy(i8* %4, i8* %12)
%14 = icmp eq i32 %0, 2
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 2, %15 ], [ %23, %17 ]
%19 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds i8*, i8** %1, i64 %18
%21 = load i8*, i8** %20
%22 = call i32 @strcat(i8* %4, i8* %21)
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, %16
br i1 %24, label %25, label %17
25: ; preds = %17, %10
%26 = call i32 @process_line(i8* %4)
br label %39
27: ; preds = %6, %32
%28 = phi i8* [ %33, %32 ], [ %4, %6 ]
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %28
%31 = icmp eq i8 %30, 10
br i1 %31, label %34, label %32
32: ; preds = %27, %34
%33 = phi i8* [ %29, %27 ], [ %4, %34 ]
br label %27
34: ; preds = %27
store i8 0, i8* %28
%35 = call i32 @process_line(i8* %4)
%36 = load i32, i32* @stdin
%37 = call i32* @fgets(i8* %4, i32 100, i32 %36)
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %32
39: ; preds = %34, %6, %25
%40 = call i32 @exit(i32 0)
unreachable
}