#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 getchar();
int /*<<< orphan*/ parse_innermost(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char ch;
  char buffer[80];
  int char_count;
  int exit_flag = 0;
  if (argc > 0) {
    strcpy(buffer, argv[1]);
    parse_innermost(buffer);
    printf("%s\n", buffer);
  } else {
    while (exit_flag == 0) {
      printf("puny> ");
      ch = getchar();
      char_count = 0;
      while ((ch != '\n') && (char_count < 80)) {
        buffer[char_count++] = ch;
        ch = getchar();
      }
      buffer[char_count] = 0x00;
      if (strcmp(buffer, "exit") == 0 || strcmp(buffer, "q") == 0) {
        exit_flag = 1;
      } else {
        parse_innermost(buffer);
        printf("%s\n", buffer);
      }
    }
    printf("Goodbye!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11ab <main+0x5b>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
call   1040 <parse_innermost@plt>
lea    -0x70(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    129f <main+0x14f>
jmp    11b0 <main+0x60>
cmpl   $0x0,-0x78(%rbp)
jne    1291 <main+0x141>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x11(%rbp)
movl   $0x0,-0x74(%rbp)
movsbl -0x11(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x79(%rbp)
je     11f5 <main+0xa5>
cmpl   $0x50,-0x74(%rbp)
setl   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    1205 <main+0xb5>
jmp    1228 <main+0xd8>
mov    -0x11(%rbp),%cl
mov    -0x74(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x74(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x11(%rbp)
jmp    11d9 <main+0x89>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1265 <main+0x115>
lea    -0x70(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <main+0x121>
movl   $0x1,-0x78(%rbp)
jmp    128c <main+0x13c>
lea    -0x70(%rbp),%rdi
call   1040 <parse_innermost@plt>
lea    -0x70(%rbp),%rsi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11b0 <main+0x60>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
test   %edi,%edi
jle    1196 <main+0x36>
mov    0x8(%rsi),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <parse_innermost@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
jmp    1242 <main+0xe2>
lea    0xe63(%rip),%r14
lea    0xe63(%rip),%r15
mov    %rsp,%r13
lea    0xe5e(%rip),%r12
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0xa,%al
jne    11d0 <main+0x70>
xor    %ebx,%ebx
jmp    11fb <main+0x9b>
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbp),%rbx
mov    %al,(%rsp,%rbp,1)
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0xa,%al
je     11fb <main+0x9b>
cmp    $0x4f,%rbp
mov    %rbx,%rbp
jb     11e0 <main+0x80>
movb   $0x0,(%rsp,%rbx,1)
mov    %r13,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1234 <main+0xd4>
mov    %r13,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1234 <main+0xd4>
mov    %r13,%rdi
call   1050 <parse_innermost@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
jmp    11b0 <main+0x50>
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [7 x i8] c"puny> \00"
@.str.2 = [5 x i8] c"exit\00"
@.str.3 = [2 x i8] c"q\00"
@.str.4 = [9 x i8] c"Goodbye!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%19 = call i32 @parse_innermost(i8* %18)
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %65
22: ; preds = %2
br label %23
23: ; preds = %62, %22
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %63
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%28 = call signext i8 (...) @getchar()
store i8 %28, i8* %6
store i32 0, i32* %8
br label %29
29: ; preds = %38, %26
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 10
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 80
br label %36
36: ; preds = %33, %29
%37 = phi i1 [ false, %29 ], [ %35, %33 ]
br i1 %37, label %38, label %45
38: ; preds = %36
%39 = load i8, i8* %6
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 %42
store i8 %39, i8* %43
%44 = call signext i8 (...) @getchar()
store i8 %44, i8* %6
br label %29
45: ; preds = %36
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 %47
store i8 0, i8* %48
%49 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %45
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52, %45
store i32 1, i32* %9
br label %62
57: ; preds = %52
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%59 = call i32 @parse_innermost(i8* %58)
%60 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %57, %56
br label %23
63: ; preds = %23
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %65
65: ; preds = %63, %12
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"puny> \00"
@.str.2 = [5 x i8] c"exit\00"
@.str.3 = [2 x i8] c"q\00"
@.str.4 = [9 x i8] c"Goodbye!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strcpy(i8* %4, i8* %8)
%10 = call i32 @parse_innermost(i8* %4)
%11 = call i32 @puts(i8* %4)
br label %38
12: ; preds = %2, %33
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 10
br i1 %15, label %25, label %16
16: ; preds = %12, %16
%17 = phi i64 [ %19, %16 ], [ 0, %12 ]
%18 = phi i8 [ %21, %16 ], [ %14, %12 ]
%19 = add nuw nsw i64 %17, 1
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 %17
store i8 %18, i8* %20
%21 = call signext i8 (...) @getchar()
%22 = icmp ne i8 %21, 10
%23 = icmp ult i64 %17, 79
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %16, label %25
25: ; preds = %16, %12
%26 = phi i64 [ 0, %12 ], [ %19, %16 ]
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 %26
store i8 0, i8* %27
%28 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %25
%31 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = call i32 @parse_innermost(i8* %4)
%35 = call i32 @puts(i8* %4)
br label %12
36: ; preds = %25, %30
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %6
ret i32 0
}