#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*/ parse_to_stdout(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (1 == argc) {
    int exit = 0;
    while (!exit) {
      int input_correct;
      char input_buffer[42];
      char eoln;
      printf("Enter expression:\n");
      scanf("%256[^\n]%c", input_buffer, &eoln);
      if ('\n' != eoln) {
        printf("Input too long\n");
        continue;
      }
      parse_to_stdout(input_buffer);
      input_correct = 0;
      do {
        printf("Would you like to try again? (y/n)\n");
        scanf("%256[^\n]%c", input_buffer, &eoln);
        if ('\n' != eoln) {
          printf("Input too long\n");
          continue;
        }
        if (0 == strcmp(input_buffer, "y") ||
            0 == strcmp(input_buffer, "yes")) {
          input_correct = 1;
        } else if (0 == strcmp(input_buffer, "n") ||
                   0 == strcmp(input_buffer, "no")) {
          input_correct = exit = 1;
        } else {
          printf("Incorrect answer\n");
        }
      } while (!input_correct);
    }
  } else {
    int i;
    for (i = 1; i < argc; ++i) {
      parse_to_stdout(argv[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    12dd <main+0x19d>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1181 <main+0x41>
jmp    12d8 <main+0x198>
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe7b(%rip),%rdi
lea    -0x51(%rbp),%rdx
call   1060 <scanf@plt>
movsbl -0x51(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     11c3 <main+0x83>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
jmp    116b <main+0x2b>
lea    -0x50(%rbp),%rdi
call   1030 <parse_to_stdout@plt>
movl   $0x0,-0x18(%rbp)
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe29(%rip),%rdi
lea    -0x51(%rbp),%rdx
call   1060 <scanf@plt>
movsbl -0x51(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     1215 <main+0xd5>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
jmp    12c2 <main+0x182>
lea    -0x50(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1251 <main+0x111>
lea    -0x50(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    125d <main+0x11d>
movl   $0x1,-0x18(%rbp)
jmp    12bd <main+0x17d>
lea    -0x50(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1299 <main+0x159>
lea    -0x50(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    12ac <main+0x16c>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    12b8 <main+0x178>
lea    0xdaa(%rip),%rdi
call   1040 <printf@plt>
jmp    12bd <main+0x17d>
jmp    12c2 <main+0x182>
cmpl   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d3 <main+0x93>
jmp    116b <main+0x2b>
jmp    1314 <main+0x1d4>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    130f <main+0x1cf>
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <parse_to_stdout@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    12e4 <main+0x1a4>
jmp    1314 <main+0x1d4>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x1,%edi
jne    123e <main+0xfe>
lea    0xea2(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0xf(%rsp),%r12
lea    0xeb9(%rip),%r13
lea    0xee6(%rip),%rbp
lea    0xe8e(%rip),%r14
jmp    1188 <main+0x48>
nop
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <scanf@plt>
cmpb   $0xa,0xf(%rsp)
jne    1180 <main+0x40>
mov    %rbx,%rdi
call   1040 <parse_to_stdout@plt>
jmp    11c5 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <scanf@plt>
cmpb   $0xa,0xf(%rsp)
mov    %rbp,%rdi
jne    11c0 <main+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1188 <main+0x48>
mov    %rbx,%rdi
lea    0xe0e(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1188 <main+0x48>
mov    %rbx,%rdi
lea    0xdfa(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1262 <main+0x122>
mov    %rbx,%rdi
lea    0xde8(%rip),%rsi
call   1050 <strcmp@plt>
lea    0xe14(%rip),%rdi
test   %rax,%rax
jne    11c0 <main+0x80>
jmp    1262 <main+0x122>
jle    1262 <main+0x122>
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1040 <parse_to_stdout@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1250 <main+0x110>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter expression:\0A\00"
@.str.1 = [11 x i8] c"%256[^\0A]%c\00"
@.str.2 = [16 x i8] c"Input too long\0A\00"
@.str.3 = [36 x i8] c"Would you like to try again? (y/n)\0A\00"
@.str.4 = [2 x i8] c"y\00"
@.str.5 = [4 x i8] c"yes\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [3 x i8] c"no\00"
@.str.8 = [18 x i8] c"Incorrect answer\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [42 x i8]
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp eq i32 1, %11
br i1 %12, label %13, label %67
13: ; preds = %2
store i32 0, i32* %6
br label %14
14: ; preds = %65, %25, %13
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %66
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%21 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %9)
%22 = load i8, i8* %9
%23 = sext i8 %22 to i32
%24 = icmp ne i32 10, %23
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %14
27: ; preds = %18
%28 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%29 = call i32 @parse_to_stdout(i8* %28)
store i32 0, i32* %7
br label %30
30: ; preds = %61, %27
%31 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%32 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%33 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %32, i8* %9)
%34 = load i8, i8* %9
%35 = sext i8 %34 to i32
%36 = icmp ne i32 10, %35
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %61
39: ; preds = %30
%40 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp eq i64 0, %41
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i64 0, %45
br i1 %46, label %47, label %48
47: ; preds = %43, %39
store i32 1, i32* %7
br label %60
48: ; preds = %43
%49 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 0, %50
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = getelementptr inbounds [42 x i8], [42 x i8]* %8, i64 0, i64 0
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i64 0, %54
br i1 %55, label %56, label %57
56: ; preds = %52, %48
store i32 1, i32* %6
store i32 1, i32* %7
br label %59
57: ; preds = %52
%58 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %59
59: ; preds = %57, %56
br label %60
60: ; preds = %59, %47
br label %61
61: ; preds = %60, %37
%62 = load i32, i32* %7
%63 = icmp ne i32 %62, 0
%64 = xor i1 %63, true
br i1 %64, label %30, label %65
65: ; preds = %61
br label %14
66: ; preds = %14
br label %83
67: ; preds = %2
store i32 1, i32* %10
br label %68
68: ; preds = %79, %67
%69 = load i32, i32* %10
%70 = load i32, i32* %4
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %82
72: ; preds = %68
%73 = load i8**, i8*** %5
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @parse_to_stdout(i8* %77)
br label %79
79: ; preds = %72
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 1
store i32 %81, i32* %10
br label %68
82: ; preds = %68
br label %83
83: ; preds = %82, %66
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"%256[^\0A]%c\00"
@.str.4 = [2 x i8] c"y\00"
@.str.5 = [4 x i8] c"yes\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [3 x i8] c"no\00"
@str = [18 x i8] c"Enter expression:\00"
@str.9 = [35 x i8] c"Would you like to try again? (y/n)\00"
@str.10 = [17 x i8] c"Incorrect answer\00"
@str.12 = [15 x i8] c"Input too long\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [42 x i8]
%4 = alloca i8
%5 = icmp eq i32 %0, 1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %50
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %42
10: ; preds = %2
%11 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
br label %12
12: ; preds = %41, %10
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %4)
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 10
br i1 %16, label %19, label %17
17: ; preds = %12
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
br label %41
19: ; preds = %12
%20 = call i32 @parse_to_stdout(i8* %11)
br label %21
21: ; preds = %38, %19
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.9, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %4)
%24 = load i8, i8* %4
%25 = icmp eq i8 %24, 10
br i1 %25, label %26, label %38
26: ; preds = %21
%27 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %26
%30 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %41, label %32
32: ; preds = %29
%33 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %49, label %35
35: ; preds = %32
%36 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %49, label %38
38: ; preds = %35, %21
%39 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0), %21 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0), %35 ]
%40 = call i32 @puts(i8* dereferenceable(1) %39)
br label %21
41: ; preds = %26, %29, %17
br label %12
42: ; preds = %8, %42
%43 = phi i64 [ 1, %8 ], [ %47, %42 ]
%44 = getelementptr inbounds i8*, i8** %1, i64 %43
%45 = load i8*, i8** %44
%46 = tail call i32 @parse_to_stdout(i8* %45)
%47 = add nuw nsw i64 %43, 1
%48 = icmp eq i64 %47, %9
br i1 %48, label %50, label %42
49: ; preds = %35, %32
br label %50
50: ; preds = %42, %49, %6
ret i32 0
}