#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ const member_1;
};
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ evalExpr(char *, int, int, int, int, int *, int *, int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
scalar_t__ noExpr(char *);
#define no_argument 129
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
#define required_argument 128
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strchr(char *, char const);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok(char *, char *);
int main(int argc, char **argv) {
  char str[8192];
  int rc, val;
  int debug = 0;
  int interactive = 0;
  int exprPassed = 0;
  char exprGiven[8192];
  int c;
  int doExpressions = 1;
  printf("FlexSchool EXPR version %s\n", "0.1");
  static struct option long_options[] = {
      {"interactive", no_argument, NULL, 'i'},
      {"debug", no_argument, NULL, 'd'},
      {"expression", required_argument, NULL, 'e'},
      {0, 0, 0, 0}};
  while ((c = getopt_long(argc, argv, "ide:", long_options, NULL)) != -1) {
    switch (c) {
    case 'i':
      interactive = 1;
      printf("Interactive is set.\n");
      break;
    case 'd':
      debug = 1;
      printf("Debug is set.\n");
      break;
    case 'e':
      exprPassed = 1;
      strcpy(exprGiven, optarg);
      printf("Expression given is %s\n", exprGiven);
    }
  }
  int erc = 0;
  int eval = 0;
  int testOk = 0;
  int testFail = 0;
  int testCount = 0;
  int isTest = 0;
  if (exprPassed) {
    exit(evalExpr(exprGiven, debug, isTest, erc, eval, &testOk, &testFail,
                  &testCount));
  }
  if (interactive) {
    printf("expr> ");
  }
  const char ch = ';';
  char expr[8192];
  while (fgets(str, sizeof(str), stdin) != NULL) {
    int s = 0;
    isTest = 0;
    char *p;
    p = strtok(str, ":");
    while (p != NULL) {
      switch (s) {
      case 0:
        s++;
        strcpy(expr, p);
        break;
      case 1:
        s++;
        isTest = 1;
        erc = atoi(p);
        break;
      case 2:
        s++;
        eval = atoi(p);
        break;
      default:
        fprintf(stderr, "You've given too many test arguments!");
        break;
      }
      p = strtok(NULL, ":");
    }
    strcpy(str, expr);
    doExpressions = 1;
    char *ret;
    ret = strchr(str, ch);
    if (ret != NULL) {
      *ret = '\000';
    }
    if (noExpr(str)) {
      doExpressions = 0;
    }
    str[strlen(str) - 1] = '\000';
    if (!strcmp(str, "quit")) {
      break;
    } else if (!strcmp(str, "?")) {
      printf("Help is not here yet. Deal with it.\n");
      doExpressions = 0;
    }
    if (doExpressions) {
      printf("Input: %s\n", str);
      evalExpr(str, debug, isTest, erc, eval, &testOk, &testFail, &testCount);
    }
    puts("-----");
    if (interactive) {
      printf("expr> ");
    }
  }
  if (testCount != 0) {
    printf("Test Count: %d\nTests Ok: %d\nTests Failed: %d\n", testCount,
           testOk, testFail);
    if (testFail != 0) {
      return 1;
    }
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x201c(%rbp)
movl   $0x0,-0x2020(%rbp)
movl   $0x0,-0x2024(%rbp)
movl   $0x1,-0x4038(%rbp)
lea    0xdd8(%rip),%rdi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf9(%rip),%rdx
lea    0x2e55(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <getopt_long@plt>
mov    %eax,-0x4034(%rbp)
cmp    $0xffffffff,%eax
je     131a <main+0x13a>
mov    -0x4034(%rbp),%eax
mov    %eax,-0x607c(%rbp)
sub    $0x64,%eax
je     12c3 <main+0xe3>
jmp    127e <main+0x9e>
mov    -0x607c(%rbp),%eax
sub    $0x65,%eax
je     12e0 <main+0x100>
jmp    1292 <main+0xb2>
mov    -0x607c(%rbp),%eax
sub    $0x69,%eax
jne    1315 <main+0x135>
jmp    12a6 <main+0xc6>
movl   $0x1,-0x2020(%rbp)
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1315 <main+0x135>
movl   $0x1,-0x201c(%rbp)
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1315 <main+0x135>
movl   $0x1,-0x2024(%rbp)
lea    -0x4030(%rbp),%rdi
mov    0x2d00(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x4030(%rbp),%rsi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1236 <main+0x56>
movl   $0x0,-0x403c(%rbp)
movl   $0x0,-0x4040(%rbp)
movl   $0x0,-0x4044(%rbp)
movl   $0x0,-0x4048(%rbp)
movl   $0x0,-0x404c(%rbp)
movl   $0x0,-0x4050(%rbp)
cmpl   $0x0,-0x2024(%rbp)
je     13ad <main+0x1cd>
lea    -0x4030(%rbp),%rdi
mov    -0x201c(%rbp),%esi
mov    -0x4050(%rbp),%edx
mov    -0x403c(%rbp),%ecx
mov    -0x4040(%rbp),%r8d
lea    -0x4044(%rbp),%r9
lea    -0x4048(%rbp),%r10
lea    -0x404c(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1090 <evalExpr@plt>
mov    %eax,%edi
call   1100 <exit@plt>
cmpl   $0x0,-0x2020(%rbp)
je     13c8 <main+0x1e8>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movb   $0x3b,-0x4051(%rbp)
lea    -0x2010(%rbp),%rdi
mov    0x2c03(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     168f <main+0x4af>
movl   $0x0,-0x6064(%rbp)
movl   $0x0,-0x4050(%rbp)
lea    -0x2010(%rbp),%rdi
lea    0xc2b(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x6070(%rbp)
cmpq   $0x0,-0x6070(%rbp)
je     151e <main+0x33e>
mov    -0x6064(%rbp),%eax
mov    %eax,-0x6080(%rbp)
test   %eax,%eax
je     1470 <main+0x290>
jmp    1448 <main+0x268>
mov    -0x6080(%rbp),%eax
sub    $0x1,%eax
je     1497 <main+0x2b7>
jmp    145c <main+0x27c>
mov    -0x6080(%rbp),%eax
sub    $0x2,%eax
je     14c7 <main+0x2e7>
jmp    14ed <main+0x30d>
mov    -0x6064(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6064(%rbp)
lea    -0x6060(%rbp),%rdi
mov    -0x6070(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1502 <main+0x322>
mov    -0x6064(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6064(%rbp)
movl   $0x1,-0x4050(%rbp)
mov    -0x6070(%rbp),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x403c(%rbp)
jmp    1502 <main+0x322>
mov    -0x6064(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6064(%rbp)
mov    -0x6070(%rbp),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x4040(%rbp)
jmp    1502 <main+0x322>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
lea    0xb88(%rip),%rsi
call   10d0 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xb33(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x6070(%rbp)
jmp    1421 <main+0x241>
lea    -0x2010(%rbp),%rdi
lea    -0x6060(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4038(%rbp)
lea    -0x2010(%rbp),%rdi
mov    $0x3b,%esi
call   1070 <strchr@plt>
mov    %rax,-0x6078(%rbp)
cmpq   $0x0,-0x6078(%rbp)
je     156b <main+0x38b>
mov    -0x6078(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x2010(%rbp),%rdi
call   10b0 <noExpr@plt>
cmp    $0x0,%rax
je     158b <main+0x3ab>
movl   $0x0,-0x4038(%rbp)
lea    -0x2010(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x2010(%rbp,%rax,1)
lea    -0x2010(%rbp),%rdi
lea    0xaf9(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    15c5 <main+0x3e5>
jmp    168f <main+0x4af>
lea    -0x2010(%rbp),%rdi
lea    0xadd(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    15f9 <main+0x419>
lea    0xaca(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x4038(%rbp)
jmp    15fe <main+0x41e>
cmpl   $0x0,-0x4038(%rbp)
je     1663 <main+0x483>
lea    -0x2010(%rbp),%rsi
lea    0xabe(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x2010(%rbp),%rdi
mov    -0x201c(%rbp),%esi
mov    -0x4050(%rbp),%edx
mov    -0x403c(%rbp),%ecx
mov    -0x4040(%rbp),%r8d
lea    -0x4044(%rbp),%r9
lea    -0x4048(%rbp),%r10
lea    -0x404c(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1090 <evalExpr@plt>
lea    0xa78(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,-0x2020(%rbp)
je     168a <main+0x4aa>
lea    0x9fb(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    13cf <main+0x1ef>
cmpl   $0x0,-0x404c(%rbp)
je     16da <main+0x4fa>
mov    -0x404c(%rbp),%esi
mov    -0x4044(%rbp),%edx
mov    -0x4048(%rbp),%ecx
lea    0xa33(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpl   $0x0,-0x4048(%rbp)
je     16d5 <main+0x4f5>
movl   $0x1,-0x4(%rbp)
jmp    16e6 <main+0x506>
jmp    16da <main+0x4fa>
mov    0x28e7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x6090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6028,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe13(%rip),%rdi
lea    0xe28(%rip),%rsi
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r12b
lea    0xe31(%rip),%r14
lea    0x2e7d(%rip),%r15
lea    0x4020(%rsp),%r13
movl   $0x0,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1060 <getopt_long@plt>
cmp    $0x64,%eax
jg     1270 <main+0xa0>
cmp    $0xffffffff,%eax
je     12bd <main+0xed>
cmp    $0x64,%eax
jne    1230 <main+0x60>
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,0xc(%rsp)
jmp    1230 <main+0x60>
nopl   0x0(%rax,%rax,1)
cmp    $0x65,%eax
je     1292 <main+0xc2>
cmp    $0x69,%eax
jne    1230 <main+0x60>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
jmp    1230 <main+0x60>
mov    0x2d5f(%rip),%rax
mov    (%rax),%rsi
mov    %r13,%rdi
call   1030 <strcpy@plt>
xor    %r12d,%r12d
lea    0xd94(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1230 <main+0x60>
movl   $0x0,0x14(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
test   $0x1,%r12b
je     152f <main+0x35f>
cmpl   $0x0,0x18(%rsp)
je     12f4 <main+0x124>
lea    0xd6d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2000,%esi
call   10a0 <fgets@plt>
test   %rax,%rax
je     1514 <main+0x344>
lea    0xd21(%rip),%rbp
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    134f <main+0x17f>
nopw   0x0(%rax,%rax,1)
mov    0x2ca9(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x2000,%esi
call   10a0 <fgets@plt>
test   %rax,%rax
je     14ea <main+0x31a>
mov    %rbx,%r15
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10d0 <strtok@plt>
test   %rax,%rax
je     1400 <main+0x230>
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    138f <main+0x1bf>
nopl   (%rax)
mov    %rax,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r14d
mov    $0x3,%ebx
xor    %edi,%edi
mov    %rbp,%rsi
call   10d0 <strtok@plt>
test   %rax,%rax
je     1403 <main+0x233>
cmp    $0x2,%ebx
je     1370 <main+0x1a0>
cmp    $0x1,%ebx
je     13c0 <main+0x1f0>
test   %ebx,%ebx
jne    13e0 <main+0x210>
lea    0x2020(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0x1,%ebx
jmp    1380 <main+0x1b0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r13d
mov    $0x2,%ebx
mov    $0x1,%r12d
jmp    1380 <main+0x1b0>
nopl   0x0(%rax,%rax,1)
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
lea    0xc71(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1380 <main+0x1b0>
nopw   0x0(%rax,%rax,1)
xor    %r12d,%r12d
mov    %r15,%rbx
mov    %r15,%rdi
lea    0x2020(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    $0x3b,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     142b <main+0x25b>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   10b0 <noExpr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    0x20(%rsp),%eax
mov    $0x74697571,%ecx
xor    %ecx,%eax
movzbl 0x24(%rsp),%ecx
or     %eax,%ecx
je     14ea <main+0x31a>
cmpw   $0x3f,0x20(%rsp)
jne    1480 <main+0x2b0>
lea    0xc5f(%rip),%rdi
call   1040 <puts@plt>
jmp    14c0 <main+0x2f0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %r15,%r15
jne    14c0 <main+0x2f0>
lea    0xc00(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
lea    0x14(%rsp),%r9
lea    0x10(%rsp),%rax
push   %rax
lea    0x10(%rsp),%rax
push   %rax
call   1090 <evalExpr@plt>
add    $0x10,%rsp
lea    0xbd0(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x18(%rsp)
je     1330 <main+0x160>
lea    0xb7c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1330 <main+0x160>
mov    0x10(%rsp),%esi
test   %esi,%esi
je     1514 <main+0x344>
mov    0x14(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xb9c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%eax
cmpl   $0x0,0x8(%rsp)
jne    151d <main+0x34d>
mov    0x2aad(%rip),%rax
mov    (%rax),%eax
add    $0x6028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rax
lea    0x8(%rsp),%rbp
lea    0x4020(%rsp),%rdi
lea    0x14(%rsp),%r9
mov    0xc(%rsp),%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
push   %rax
push   %rbp
call   1090 <evalExpr@plt>
add    $0x10,%rsp
mov    %eax,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [28 x i8] c"FlexSchool EXPR version %s\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
@main.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 101 }, %struct.option zeroinitializer]
@.str.2 = [12 x i8] c"interactive\00"
@.str.3 = [6 x i8] c"debug\00"
@.str.4 = [11 x i8] c"expression\00"
@.str.5 = [5 x i8] c"ide:\00"
@.str.6 = [21 x i8] c"Interactive is set.\0A\00"
@.str.7 = [15 x i8] c"Debug is set.\0A\00"
@optarg = global i8* null
@.str.8 = [24 x i8] c"Expression given is %s\0A\00"
@.str.9 = [7 x i8] c"expr> \00"
@stdin = global i32 0
@.str.10 = [2 x i8] c":\00"
@stderr = global i32 0
@.str.11 = [38 x i8] c"You've given too many test arguments!\00"
@.str.12 = [5 x i8] c"quit\00"
@.str.13 = [2 x i8] c"?\00"
@.str.14 = [37 x i8] c"Help is not here yet. Deal with it.\0A\00"
@.str.15 = [11 x i8] c"Input: %s\0A\00"
@.str.16 = [6 x i8] c"-----\00"
@.str.17 = [46 x i8] c"Test Count: %d\0ATests Ok: %d\0ATests Failed: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8192 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [8192 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8
%22 = alloca [8192 x i8]
%23 = alloca i32
%24 = alloca i8*
%25 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 1, i32* %14
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %44, %2
%28 = load i32, i32* %4
%29 = load i8**, i8*** %5
%30 = call i32 @getopt_long(i32 %28, i8** %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
store i32 %30, i32* %13
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %45
32: ; preds = %27
%33 = load i32, i32* %13
switch i32 %33, label %44 [
i32 105, label %34
i32 100, label %36
i32 101, label %38
]
34: ; preds = %32
store i32 1, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %44
36: ; preds = %32
store i32 1, i32* %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %44
38: ; preds = %32
store i32 1, i32* %11
%39 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%40 = load i8*, i8** @optarg
%41 = call i32 @strcpy(i8* %39, i8* %40)
%42 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %38, %32, %36, %34
br label %27
45: ; preds = %27
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
%46 = load i32, i32* %11
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %56
48: ; preds = %45
%49 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%50 = load i32, i32* %9
%51 = load i32, i32* %20
%52 = load i32, i32* %15
%53 = load i32, i32* %16
%54 = call i32 @evalExpr(i8* %49, i32 %50, i32 %51, i32 %52, i32 %53, i32* %17, i32* %18, i32* %19)
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %45
%57 = load i32, i32* %10
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
store i8 59, i8* %21
br label %62
62: ; preds = %146, %61
%63 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%64 = load i32, i32* @stdin
%65 = call i32* @fgets(i8* %63, i32 8192, i32 %64)
%66 = icmp ne i32* %65, null
br i1 %66, label %67, label %147
67: ; preds = %62
store i32 0, i32* %23
store i32 0, i32* %20
%68 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%69 = call i8* @strtok(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i8* %69, i8** %24
br label %70
70: ; preds = %94, %67
%71 = load i8*, i8** %24
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %96
73: ; preds = %70
%74 = load i32, i32* %23
switch i32 %74, label %91 [
i32 0, label %75
i32 1, label %81
i32 2, label %86
]
75: ; preds = %73
%76 = load i32, i32* %23
%77 = add nsw i32 %76, 1
store i32 %77, i32* %23
%78 = getelementptr inbounds [8192 x i8], [8192 x i8]* %22, i64 0, i64 0
%79 = load i8*, i8** %24
%80 = call i32 @strcpy(i8* %78, i8* %79)
br label %94
81: ; preds = %73
%82 = load i32, i32* %23
%83 = add nsw i32 %82, 1
store i32 %83, i32* %23
store i32 1, i32* %20
%84 = load i8*, i8** %24
%85 = call i32 @atoi(i8* %84)
store i32 %85, i32* %15
br label %94
86: ; preds = %73
%87 = load i32, i32* %23
%88 = add nsw i32 %87, 1
store i32 %88, i32* %23
%89 = load i8*, i8** %24
%90 = call i32 @atoi(i8* %89)
store i32 %90, i32* %16
br label %94
91: ; preds = %73
%92 = load i32, i32* @stderr
%93 = call i32 @fprintf(i32 %92, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %94
94: ; preds = %91, %86, %81, %75
%95 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i8* %95, i8** %24
br label %70
96: ; preds = %70
%97 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%98 = getelementptr inbounds [8192 x i8], [8192 x i8]* %22, i64 0, i64 0
%99 = call i32 @strcpy(i8* %97, i8* %98)
store i32 1, i32* %14
%100 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%101 = call i8* @strchr(i8* %100, i8 signext 59)
store i8* %101, i8** %25
%102 = load i8*, i8** %25
%103 = icmp ne i8* %102, null
br i1 %103, label %104, label %106
104: ; preds = %96
%105 = load i8*, i8** %25
store i8 0, i8* %105
br label %106
106: ; preds = %104, %96
%107 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%108 = call i64 @noExpr(i8* %107)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %111
110: ; preds = %106
store i32 0, i32* %14
br label %111
111: ; preds = %110, %106
%112 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%113 = call i32 @strlen(i8* %112)
%114 = sub nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %115
store i8 0, i8* %116
%117 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%118 = call i32 @strcmp(i8* %117, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%119 = icmp ne i32 %118, 0
br i1 %119, label %121, label %120
120: ; preds = %111
br label %147
121: ; preds = %111
%122 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%123 = call i32 @strcmp(i8* %122, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%124 = icmp ne i32 %123, 0
br i1 %124, label %127, label %125
125: ; preds = %121
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %14
br label %127
127: ; preds = %125, %121
br label %128
128: ; preds = %127
%129 = load i32, i32* %14
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %140
131: ; preds = %128
%132 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %132)
%134 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%135 = load i32, i32* %9
%136 = load i32, i32* %20
%137 = load i32, i32* %15
%138 = load i32, i32* %16
%139 = call i32 @evalExpr(i8* %134, i32 %135, i32 %136, i32 %137, i32 %138, i32* %17, i32* %18, i32* %19)
br label %140
140: ; preds = %131, %128
%141 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0))
%142 = load i32, i32* %10
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %146
144: ; preds = %140
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %146
146: ; preds = %144, %140
br label %62
147: ; preds = %120, %62
%148 = load i32, i32* %19
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %159
150: ; preds = %147
%151 = load i32, i32* %19
%152 = load i32, i32* %17
%153 = load i32, i32* %18
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.17, i64 0, i64 0), i32 %151, i32 %152, i32 %153)
%155 = load i32, i32* %18
%156 = icmp ne i32 %155, 0
br i1 %156, label %157, label %158
157: ; preds = %150
store i32 1, i32* %3
br label %161
158: ; preds = %150
br label %159
159: ; preds = %158, %147
%160 = load i32, i32* @EXIT_SUCCESS
store i32 %160, i32* %3
br label %161
161: ; preds = %159, %157
%162 = load i32, i32* %3
ret i32 %162
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [28 x i8] c"FlexSchool EXPR version %s\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
@main.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 101 }, %struct.option zeroinitializer]
@.str.2 = [12 x i8] c"interactive\00"
@.str.3 = [6 x i8] c"debug\00"
@.str.4 = [11 x i8] c"expression\00"
@.str.5 = [5 x i8] c"ide:\00"
@optarg = global i8* null
@.str.8 = [24 x i8] c"Expression given is %s\0A\00"
@.str.9 = [7 x i8] c"expr> \00"
@stdin = global i32 0
@.str.10 = [2 x i8] c":\00"
@stderr = global i32 0
@.str.11 = [38 x i8] c"You've given too many test arguments!\00"
@.str.12 = [5 x i8] c"quit\00"
@.str.15 = [11 x i8] c"Input: %s\0A\00"
@.str.16 = [6 x i8] c"-----\00"
@.str.17 = [46 x i8] c"Test Count: %d\0ATests Ok: %d\0ATests Failed: %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [36 x i8] c"Help is not here yet. Deal with it.\00"
@str.18 = [14 x i8] c"Debug is set.\00"
@str.19 = [20 x i8] c"Interactive is set.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [8192 x i8]
%4 = alloca [8192 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [8192 x i8]
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %27, %2
%13 = phi i1 [ false, %27 ], [ true, %2 ]
%14 = phi i32 [ %17, %27 ], [ 0, %2 ]
%15 = phi i32 [ %20, %27 ], [ 0, %2 ]
br label %16
16: ; preds = %12, %23
%17 = phi i32 [ %14, %12 ], [ 1, %23 ]
%18 = phi i32 [ %15, %12 ], [ %20, %23 ]
br label %19
19: ; preds = %16, %25
%20 = phi i32 [ %18, %16 ], [ 1, %25 ]
br label %21
21: ; preds = %19, %21
%22 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
switch i32 %22, label %21 [
i32 -1, label %31
i32 105, label %23
i32 100, label %25
i32 101, label %27
]
23: ; preds = %21
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.19, i64 0, i64 0))
br label %16
25: ; preds = %21
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.18, i64 0, i64 0))
br label %19
27: ; preds = %21
%28 = load i8*, i8** @optarg
%29 = call i32 @strcpy(i8* %10, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* %10)
br label %12
31: ; preds = %21
%32 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%33 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%34 = bitcast i32* %7 to i8*
store i32 0, i32* %7
br i1 %13, label %38, label %35
35: ; preds = %31
%36 = call i32 @evalExpr(i8* %10, i32 %20, i32 0, i32 0, i32 0, i32* %5, i32* %6, i32* %7)
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %31
%39 = icmp eq i32 %17, 0
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%44 = load i32, i32* @stdin
%45 = call i32* @fgets(i8* %9, i32 8192, i32 %44)
%46 = icmp eq i32* %45, null
br i1 %46, label %119, label %47
47: ; preds = %42
%48 = bitcast [8192 x i8]* %3 to i16*
br label %49
49: ; preds = %47, %106
%50 = phi i32 [ 0, %47 ], [ %78, %106 ]
%51 = phi i32 [ 0, %47 ], [ %77, %106 ]
%52 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%53 = icmp eq i8* %52, null
br i1 %53, label %76, label %54
54: ; preds = %49, %69
%55 = phi i8* [ %74, %69 ], [ %52, %49 ]
%56 = phi i32 [ %73, %69 ], [ 0, %49 ]
%57 = phi i32 [ %72, %69 ], [ 0, %49 ]
%58 = phi i32 [ %71, %69 ], [ %50, %49 ]
%59 = phi i32 [ %70, %69 ], [ %51, %49 ]
switch i32 %56, label %66 [
i32 0, label %60
i32 1, label %62
i32 2, label %64
]
60: ; preds = %54
%61 = call i32 @strcpy(i8* %43, i8* %55)
br label %69
62: ; preds = %54
%63 = call i32 @atoi(i8* %55)
br label %69
64: ; preds = %54
%65 = call i32 @atoi(i8* %55)
br label %69
66: ; preds = %54
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %69
69: ; preds = %66, %64, %62, %60
%70 = phi i32 [ %59, %66 ], [ %59, %64 ], [ %63, %62 ], [ %59, %60 ]
%71 = phi i32 [ %58, %66 ], [ %65, %64 ], [ %58, %62 ], [ %58, %60 ]
%72 = phi i32 [ %57, %66 ], [ %57, %64 ], [ 1, %62 ], [ %57, %60 ]
%73 = phi i32 [ %56, %66 ], [ 3, %64 ], [ 2, %62 ], [ 1, %60 ]
%74 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%75 = icmp eq i8* %74, null
br i1 %75, label %76, label %54
76: ; preds = %69, %49
%77 = phi i32 [ %51, %49 ], [ %70, %69 ]
%78 = phi i32 [ %50, %49 ], [ %71, %69 ]
%79 = phi i32 [ 0, %49 ], [ %72, %69 ]
%80 = call i32 @strcpy(i8* %9, i8* %43)
%81 = call i8* @strchr(i8* %9, i8 signext 59)
%82 = icmp eq i8* %81, null
br i1 %82, label %84, label %83
83: ; preds = %76
store i8 0, i8* %81
br label %84
84: ; preds = %83, %76
%85 = call i64 @noExpr(i8* %9)
%86 = icmp eq i64 %85, 0
%87 = call i32 @strlen(i8* %9)
%88 = add nsw i32 %87, -1
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 %89
store i8 0, i8* %90
%91 = call i32 @bcmp(i8* dereferenceable(5) %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i64 5)
%92 = icmp eq i32 %91, 0
br i1 %92, label %110, label %93
93: ; preds = %84
%94 = load i16, i16* %48
%95 = icmp eq i16 %94, 63
br i1 %95, label %96, label %98
96: ; preds = %93
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %102
98: ; preds = %93
br i1 %86, label %99, label %102
99: ; preds = %98
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %9)
%101 = call i32 @evalExpr(i8* %9, i32 %20, i32 %79, i32 %77, i32 %78, i32* %5, i32* %6, i32* %7)
br label %102
102: ; preds = %96, %99, %98
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0))
br i1 %39, label %106, label %104
104: ; preds = %102
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %106
106: ; preds = %102, %104
%107 = load i32, i32* @stdin
%108 = call i32* @fgets(i8* %9, i32 8192, i32 %107)
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %49
110: ; preds = %106, %84
%111 = load i32, i32* %7
%112 = icmp eq i32 %111, 0
br i1 %112, label %119, label %113
113: ; preds = %110
%114 = load i32, i32* %5
%115 = load i32, i32* %6
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.17, i64 0, i64 0), i32 %111, i32 %114, i32 %115)
%117 = load i32, i32* %6
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %42, %113, %110
%120 = load i32, i32* @EXIT_SUCCESS
br label %121
121: ; preds = %113, %119
%122 = phi i32 [ %120, %119 ], [ 1, %113 ]
ret i32 %122
}