#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 Node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int LINE_MAX;
short atoi(char *);
long double calculate_parse_tree(struct Node *);
int /*<<< orphan*/ delete_tree(struct Node *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char getopt(int, char **, char *);
char *optarg;
struct Node *parse(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reduce(struct Node *);
int /*<<< orphan*/ replace_variables(struct Node **);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  struct Node *parse_tree;
  long double result;
  int i;
  short precision;
  char fromfile, just_print, skip, c;
  char read[LINE_MAX];
  char *term, *filename;
  FILE *file;
  filename = term = NULL;
  fromfile = just_print = skip = 0;
  i = 1;
  precision = 5;
  if (argc == 1) {
    print_usage();
    return (0);
  }
  while ((c = getopt(argc, argv, "f:p:hn0123456789E^*/+-.?:()")) != -1) {
    switch (c) {
    case 'f':
      filename = optarg;
      fromfile = 1;
      break;
    case 'n':
      just_print = 1;
      skip++;
      break;
    case 'p':
      precision = atoi(optarg);
      if (precision < 0)
        precision = 0;
      if (precision > 65)
        precision = 65;
      i = 3;
      break;
    case 'h':
      print_usage();
      return (1);
      break;
    }
  }
  if (fromfile) {
    if ((file = fopen(filename, "r")) == NULL) {
      perror("fopen");
      exit(EXIT_FAILURE);
    }
    if (fgets(read, LINE_MAX - 1, file) == NULL) {
      fclose(file);
      return (0);
    }
  }
  do {
    if (fromfile) {
      term = read;
      term[strlen(term) - 1] = '\0';
    } else
      term = argv[i + skip];
    if (term == NULL)
      break;
    if (strlen(term) == 0) {
      i++;
      continue;
    }
    if ((parse_tree = parse(term)) == NULL) {
      fprintf(stderr, "cannot create parse tree for %s\n", term);
      i++;
      continue;
    } else {
      reduce(parse_tree);
      replace_variables(&parse_tree);
      reduce(parse_tree);
      result = calculate_parse_tree(parse_tree);
      if ((argc == 2 && !fromfile) || just_print)
        printf("%.*Lf\n", precision, result);
      else
        printf("%s = %.*Lf\n", term, precision, result);
      delete_tree(parse_tree);
    }
    i++;
  } while (fromfile ? (fgets(read, LINE_MAX - 1, file) != NULL)
                    : (argv[i] != NULL));
  if (fromfile)
    fclose(file);
  return (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)
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movb   $0x0,-0x39(%rbp)
movb   $0x0,-0x38(%rbp)
movb   $0x0,-0x37(%rbp)
movl   $0x1,-0x34(%rbp)
movw   $0x5,-0x36(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1292 <main+0x92>
mov    $0x0,%al
call   1120 <print_usage@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    15ed <main+0x3ed>
jmp    1297 <main+0x97>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd87(%rip),%rdx
call   10e0 <getopt@plt>
mov    %al,-0x3a(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     136f <main+0x16f>
movsbl -0x3a(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x80(%rbp)
sub    $0xa,%eax
ja     136a <main+0x16a>
mov    -0x80(%rbp),%rax
lea    0xd26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d0e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
movb   $0x1,-0x37(%rbp)
jmp    136a <main+0x16a>
movb   $0x1,-0x38(%rbp)
mov    -0x39(%rbp),%al
add    $0x1,%al
mov    %al,-0x39(%rbp)
jmp    136a <main+0x16a>
mov    0x2ce6(%rip),%rax
mov    (%rax),%rdi
call   10f0 <atoi@plt>
mov    %ax,-0x36(%rbp)
movswl -0x36(%rbp),%eax
cmp    $0x0,%eax
jge    1331 <main+0x131>
movw   $0x0,-0x36(%rbp)
movswl -0x36(%rbp),%eax
cmp    $0x41,%eax
jle    1344 <main+0x144>
movw   $0x41,-0x36(%rbp)
movl   $0x3,-0x34(%rbp)
jmp    136a <main+0x16a>
mov    $0x0,%al
call   1120 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    15ed <main+0x3ed>
jmp    1297 <main+0x97>
cmpb   $0x0,-0x37(%rbp)
je     13f5 <main+0x1f5>
mov    -0x60(%rbp),%rdi
lea    0xcc4(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmp    $0x0,%rax
jne    13b1 <main+0x1b1>
lea    0xcac(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x78(%rbp),%rdi
mov    0x2c24(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    -0x68(%rbp),%rdx
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    13f0 <main+0x1f0>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    15ed <main+0x3ed>
jmp    13f5 <main+0x1f5>
jmp    13fa <main+0x1fa>
cmpb   $0x0,-0x37(%rbp)
je     1438 <main+0x238>
mov    -0x78(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x58(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1450 <main+0x250>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
movsbl -0x39(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1460 <main+0x260>
jmp    15cc <main+0x3cc>
mov    -0x58(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%eax
jne    1480 <main+0x280>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1565 <main+0x365>
mov    -0x58(%rbp),%rdi
call   1100 <parse@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    14be <main+0x2be>
mov    0x2b32(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rdx
lea    0xba5(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1565 <main+0x365>
mov    -0x18(%rbp),%rdi
call   1050 <reduce@plt>
lea    -0x18(%rbp),%rdi
call   10b0 <replace_variables@plt>
mov    -0x18(%rbp),%rdi
call   1050 <reduce@plt>
mov    -0x18(%rbp),%rdi
call   1030 <calculate_parse_tree@plt>
fstpt  -0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    14f9 <main+0x2f9>
cmpb   $0x0,-0x37(%rbp)
je     1506 <main+0x306>
movsbl -0x38(%rbp),%eax
cmp    $0x0,%eax
je     152d <main+0x32d>
movswl -0x36(%rbp),%esi
fldt   -0x30(%rbp)
sub    $0x10,%rsp
mov    %rsp,%rax
fstpt  (%rax)
lea    0xb59(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x10,%rsp
jmp    1553 <main+0x353>
mov    -0x58(%rbp),%rsi
movswl -0x36(%rbp),%edx
fldt   -0x30(%rbp)
sub    $0x10,%rsp
mov    %rsp,%rax
fstpt  (%rax)
lea    0xb29(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x10,%rsp
mov    -0x18(%rbp),%rdi
call   10a0 <delete_tree@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movsbl -0x37(%rbp),%eax
cmp    $0x0,%eax
je     15a2 <main+0x3a2>
mov    -0x78(%rbp),%rdi
mov    0x2a63(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    -0x68(%rbp),%rdx
call   1080 <fgets@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8c(%rbp)
jmp    15bd <main+0x3bd>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    $0x0,%eax
jne    13fa <main+0x1fa>
cmpb   $0x0,-0x37(%rbp)
je     15df <main+0x3df>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsp,%rbx
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmp    $0x1,%edi
jne    1242 <main+0x42>
xor    %r14d,%r14d
xor    %eax,%eax
call   1120 <print_usage@plt>
jmp    150e <main+0x30e>
mov    %rsi,%r15
mov    %edi,%r12d
mov    %rbx,-0x48(%rbp)
lea    0xdc5(%rip),%rdx
call   10e0 <getopt@plt>
mov    $0x1,%cl
mov    %ecx,-0x54(%rbp)
xor    %edx,%edx
mov    $0x5,%r13w
cmp    $0xff,%al
je     1389 <main+0x189>
movl   $0x1,-0x2c(%rbp)
lea    0xd86(%rip),%rbx
xor    %ecx,%ecx
mov    %rcx,-0x68(%rbp)
xor    %ecx,%ecx
mov    %rcx,-0x40(%rbp)
xor    %ecx,%ecx
mov    %rcx,-0x38(%rbp)
xor    %ecx,%ecx
mov    %rcx,-0x50(%rbp)
jmp    12ca <main+0xca>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2d51(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    $0x1,%al
mov    %rax,-0x50(%rbp)
mov    %r12d,%edi
mov    %r15,%rsi
lea    0xd57(%rip),%rdx
call   10e0 <getopt@plt>
cmp    $0xff,%al
je     1338 <main+0x138>
movsbl %al,%eax
add    $0xffffff9a,%eax
ror    %eax
cmp    $0x5,%eax
ja     12b4 <main+0xb4>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    -0x40(%rbp),%rax
add    $0x1,%al
mov    %rax,-0x40(%rbp)
mov    $0x1,%al
mov    %rax,-0x38(%rbp)
jmp    12b4 <main+0xb4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2cf1(%rip),%rax
mov    (%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%r13d
test   %ax,%ax
mov    $0x0,%eax
cmovs  %eax,%r13d
cmp    $0x41,%r13w
mov    $0x41,%eax
cmovae %eax,%r13d
movl   $0x3,-0x2c(%rbp)
jmp    12b4 <main+0xb4>
cmpb   $0x0,-0x50(%rbp)
je     1394 <main+0x194>
lea    0xcef(%rip),%rsi
mov    -0x68(%rbp),%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1534 <main+0x334>
mov    %rax,%rbx
mov    0x2c7f(%rip),%rax
mov    (%rax),%esi
add    $0xffffffff,%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <fgets@plt>
movl   $0x0,-0x54(%rbp)
test   %rax,%rax
je     1523 <main+0x323>
mov    %rbx,-0x50(%rbp)
mov    $0x1,%dl
jmp    1396 <main+0x196>
mov    $0x1,%edi
xor    %esi,%esi
xor    %ebx,%ebx
jmp    13a1 <main+0x1a1>
xor    %edx,%edx
mov    -0x40(%rbp),%rsi
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%rbx
cmp    $0x2,%r12d
sete   %al
mov    %edx,%ecx
xor    $0x1,%cl
and    %al,%cl
test   %bl,%bl
setne  %al
or     %cl,%al
mov    %al,-0x2c(%rbp)
movswl %r13w,%eax
mov    %eax,-0x38(%rbp)
mov    %edi,%ecx
movsbq %sil,%r12
mov    %rcx,%rax
mov    %rcx,-0x40(%rbp)
add    %rcx,%r12
mov    %rdx,%r13
test   %dl,%dl
je     13f0 <main+0x1f0>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
mov    %r14,%rbx
jmp    13fd <main+0x1fd>
nopl   0x0(%rax)
mov    (%r15,%r12,8),%rbx
test   %rbx,%rbx
je     14f8 <main+0x2f8>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
je     1478 <main+0x278>
mov    %rbx,%rdi
call   1100 <parse@plt>
mov    %rax,-0x60(%rbp)
test   %rax,%rax
je     1460 <main+0x260>
mov    %rax,%rdi
call   1050 <reduce@plt>
lea    -0x60(%rbp),%rdi
call   10b0 <replace_variables@plt>
mov    -0x60(%rbp),%rdi
call   1050 <reduce@plt>
mov    -0x60(%rbp),%rdi
call   1030 <calculate_parse_tree@plt>
cmpb   $0x0,-0x2c(%rbp)
je     148f <main+0x28f>
sub    $0x10,%rsp
fstpt  (%rsp)
lea    0xc11(%rip),%rdi
mov    -0x38(%rbp),%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    14aa <main+0x2aa>
nopl   (%rax)
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
lea    0xbcc(%rip),%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
cmpb   $0x0,-0x54(%rbp)
je     14bd <main+0x2bd>
mov    -0x40(%rbp),%rax
cmpq   $0x0,0x8(%r15,%rax,8)
mov    %r13,%rdx
jne    14dd <main+0x2dd>
jmp    14e6 <main+0x2e6>
sub    $0x10,%rsp
fstpt  (%rsp)
lea    0xbc0(%rip),%rdi
mov    %rbx,%rsi
mov    -0x38(%rbp),%edx
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x10,%rsp
mov    -0x60(%rbp),%rdi
call   10a0 <delete_tree@plt>
cmpb   $0x0,-0x54(%rbp)
jne    147e <main+0x27e>
mov    0x2b1c(%rip),%rax
mov    (%rax),%esi
add    $0xffffffff,%esi
mov    %r14,%rdi
mov    -0x50(%rbp),%rdx
call   1080 <fgets@plt>
test   %rax,%rax
mov    %r13,%rdx
je     14e6 <main+0x2e6>
add    $0x8,%r15
jmp    13d0 <main+0x1d0>
xor    %r14d,%r14d
test   %dl,%dl
je     150a <main+0x30a>
mov    -0x50(%rbp),%rdi
call   1040 <fclose@plt>
jmp    150a <main+0x30a>
xor    %r14d,%r14d
jmp    150a <main+0x30a>
xor    %eax,%eax
call   1120 <print_usage@plt>
mov    $0x1,%r14d
mov    -0x48(%rbp),%rbx
mov    %rbx,%rsp
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    -0x48(%rbp),%rbx
xor    %r14d,%r14d
jmp    150e <main+0x30e>
lea    0xafb(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2a81(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.Node = type { i32 }
@LINE_MAX = global i32 0
@.str = [28 x i8] c"f:p:hn0123456789E^*/+-.?:()\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"fopen\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.3 = [33 x i8] c"cannot create parse tree for %s\0A\00"
@.str.4 = [7 x i8] c"%.*Lf\0A\00"
@.str.5 = [12 x i8] c"%s = %.*Lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.Node*
%7 = alloca x86_fp80
%8 = alloca i32
%9 = alloca i16
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32*
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* @LINE_MAX
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %14
%23 = alloca i8, i64 %21
store i64 %21, i64* %15
store i8* null, i8** %16
store i8* null, i8** %17
store i8 0, i8* %12
store i8 0, i8* %11
store i8 0, i8* %10
store i32 1, i32* %8
store i16 5, i16* %9
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %2
%27 = call i32 (...) @print_usage()
store i32 0, i32* %3
store i32 1, i32* %19
br label %184
28: ; preds = %2
br label %29
29: ; preds = %58, %28
%30 = load i32, i32* %4
%31 = load i8**, i8*** %5
%32 = call signext i8 @getopt(i32 %30, i8** %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i8 %32, i8* %13
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, -1
br i1 %34, label %35, label %59
35: ; preds = %29
%36 = load i8, i8* %13
%37 = sext i8 %36 to i32
switch i32 %37, label %58 [
i32 102, label %38
i32 110, label %40
i32 112, label %43
i32 104, label %56
]
38: ; preds = %35
%39 = load i8*, i8** @optarg
store i8* %39, i8** %17
store i8 1, i8* %10
br label %58
40: ; preds = %35
store i8 1, i8* %11
%41 = load i8, i8* %12
%42 = add i8 %41, 1
store i8 %42, i8* %12
br label %58
43: ; preds = %35
%44 = load i8*, i8** @optarg
%45 = call signext i16 @atoi(i8* %44)
store i16 %45, i16* %9
%46 = load i16, i16* %9
%47 = sext i16 %46 to i32
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %43
store i16 0, i16* %9
br label %50
50: ; preds = %49, %43
%51 = load i16, i16* %9
%52 = sext i16 %51 to i32
%53 = icmp sgt i32 %52, 65
br i1 %53, label %54, label %55
54: ; preds = %50
store i16 65, i16* %9
br label %55
55: ; preds = %54, %50
store i32 3, i32* %8
br label %58
56: ; preds = %35
%57 = call i32 (...) @print_usage()
store i32 1, i32* %3
store i32 1, i32* %19
br label %184
58: ; preds = %35, %55, %40, %38
br label %29
59: ; preds = %29
%60 = load i8, i8* %10
%61 = icmp ne i8 %60, 0
br i1 %61, label %62, label %80
62: ; preds = %59
%63 = load i8*, i8** %17
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %64, i32** %18
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %62
%71 = load i32, i32* @LINE_MAX
%72 = sub nsw i32 %71, 1
%73 = load i32*, i32** %18
%74 = call i32* @fgets(i8* %23, i32 %72, i32* %73)
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %79
76: ; preds = %70
%77 = load i32*, i32** %18
%78 = call i32 @fclose(i32* %77)
store i32 0, i32* %3
store i32 1, i32* %19
br label %184
79: ; preds = %70
br label %80
80: ; preds = %79, %59
br label %81
81: ; preds = %174, %80
%82 = load i8, i8* %10
%83 = icmp ne i8 %82, 0
br i1 %83, label %84, label %91
84: ; preds = %81
store i8* %23, i8** %16
%85 = load i8*, i8** %16
%86 = load i8*, i8** %16
%87 = call i32 @strlen(i8* %86)
%88 = sub nsw i32 %87, 1
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %85, i64 %89
store i8 0, i8* %90
br label %100
91: ; preds = %81
%92 = load i8**, i8*** %5
%93 = load i32, i32* %8
%94 = load i8, i8* %12
%95 = sext i8 %94 to i32
%96 = add nsw i32 %93, %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %92, i64 %97
%99 = load i8*, i8** %98
store i8* %99, i8** %16
br label %100
100: ; preds = %91, %84
%101 = load i8*, i8** %16
%102 = icmp eq i8* %101, null
br i1 %102, label %103, label %104
103: ; preds = %100
br label %177
104: ; preds = %100
%105 = load i8*, i8** %16
%106 = call i32 @strlen(i8* %105)
%107 = icmp eq i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %104
%109 = load i32, i32* %8
%110 = add nsw i32 %109, 1
store i32 %110, i32* %8
br label %155
111: ; preds = %104
%112 = load i8*, i8** %16
%113 = call %struct.Node* @parse(i8* %112)
store %struct.Node* %113, %struct.Node** %6
%114 = icmp eq %struct.Node* %113, null
br i1 %114, label %115, label %121
115: ; preds = %111
%116 = load i32, i32* @stderr
%117 = load i8*, i8** %16
%118 = call i32 @fprintf(i32 %116, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %117)
%119 = load i32, i32* %8
%120 = add nsw i32 %119, 1
store i32 %120, i32* %8
br label %155
121: ; preds = %111
%122 = load %struct.Node*, %struct.Node** %6
%123 = call i32 @reduce(%struct.Node* %122)
%124 = call i32 @replace_variables(%struct.Node** %6)
%125 = load %struct.Node*, %struct.Node** %6
%126 = call i32 @reduce(%struct.Node* %125)
%127 = load %struct.Node*, %struct.Node** %6
%128 = call x86_fp80 @calculate_parse_tree(%struct.Node* %127)
store x86_fp80 %128, x86_fp80* %7
%129 = load i32, i32* %4
%130 = icmp eq i32 %129, 2
br i1 %130, label %131, label %134
131: ; preds = %121
%132 = load i8, i8* %10
%133 = icmp ne i8 %132, 0
br i1 %133, label %134, label %138
134: ; preds = %131, %121
%135 = load i8, i8* %11
%136 = sext i8 %135 to i32
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %134, %131
%139 = load i16, i16* %9
%140 = sext i16 %139 to i32
%141 = load x86_fp80, x86_fp80* %7
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %140, x86_fp80 %141)
br label %149
143: ; preds = %134
%144 = load i8*, i8** %16
%145 = load i16, i16* %9
%146 = sext i16 %145 to i32
%147 = load x86_fp80, x86_fp80* %7
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %144, i32 %146, x86_fp80 %147)
br label %149
149: ; preds = %143, %138
%150 = load %struct.Node*, %struct.Node** %6
%151 = call i32 @delete_tree(%struct.Node* %150)
br label %152
152: ; preds = %149
%153 = load i32, i32* %8
%154 = add nsw i32 %153, 1
store i32 %154, i32* %8
br label %155
155: ; preds = %152, %115, %108
%156 = load i8, i8* %10
%157 = sext i8 %156 to i32
%158 = icmp ne i32 %157, 0
br i1 %158, label %159, label %166
159: ; preds = %155
%160 = load i32, i32* @LINE_MAX
%161 = sub nsw i32 %160, 1
%162 = load i32*, i32** %18
%163 = call i32* @fgets(i8* %23, i32 %161, i32* %162)
%164 = icmp ne i32* %163, null
%165 = zext i1 %164 to i32
br label %174
166: ; preds = %155
%167 = load i8**, i8*** %5
%168 = load i32, i32* %8
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i8*, i8** %167, i64 %169
%171 = load i8*, i8** %170
%172 = icmp ne i8* %171, null
%173 = zext i1 %172 to i32
br label %174
174: ; preds = %166, %159
%175 = phi i32 [ %165, %159 ], [ %173, %166 ]
%176 = icmp ne i32 %175, 0
br i1 %176, label %81, label %177
177: ; preds = %174, %103
%178 = load i8, i8* %10
%179 = icmp ne i8 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %177
%181 = load i32*, i32** %18
%182 = call i32 @fclose(i32* %181)
br label %183
183: ; preds = %180, %177
store i32 0, i32* %3
store i32 1, i32* %19
br label %184
184: ; preds = %183, %76, %56, %26
%185 = load i8*, i8** %14
%186 = load i32, i32* %3
ret i32 %186
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@LINE_MAX = global i32 0
@.str = [28 x i8] c"f:p:hn0123456789E^*/+-.?:()\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"fopen\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.3 = [33 x i8] c"cannot create parse tree for %s\0A\00"
@.str.4 = [7 x i8] c"%.*Lf\0A\00"
@.str.5 = [12 x i8] c"%s = %.*Lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.Node*
%4 = bitcast %struct.Node** %3 to i8*
%5 = load i32, i32* @LINE_MAX
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = icmp eq i32 %0, 1
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8 %11, -1
br i1 %12, label %64, label %15
13: ; preds = %2
%14 = tail call i32 (...) @print_usage()
br label %131
15: ; preds = %10, %39
%16 = phi i8 [ %46, %39 ], [ %11, %10 ]
%17 = phi i8* [ %45, %39 ], [ null, %10 ]
%18 = phi i32 [ %44, %39 ], [ 1, %10 ]
%19 = phi i16 [ %43, %39 ], [ 5, %10 ]
%20 = phi i8 [ %42, %39 ], [ 0, %10 ]
%21 = phi i8 [ %41, %39 ], [ 0, %10 ]
%22 = phi i8 [ %40, %39 ], [ 0, %10 ]
%23 = sext i8 %16 to i32
%24 = add nsw i32 %23, -102
%25 = tail call i32 @llvm.fshl.i32(i32 %24, i32 %24, i32 31)
switch i32 %25, label %39 [
i32 0, label %26
i32 4, label %28
i32 5, label %30
i32 1, label %37
]
26: ; preds = %15
%27 = load i8*, i8** @optarg
br label %39
28: ; preds = %15
%29 = add i8 %20, 1
br label %39
30: ; preds = %15
%31 = load i8*, i8** @optarg
%32 = tail call signext i16 @atoi(i8* %31)
%33 = icmp sgt i16 %32, 0
%34 = select i1 %33, i16 %32, i16 0
%35 = icmp ult i16 %34, 65
%36 = select i1 %35, i16 %34, i16 65
br label %39
37: ; preds = %15
%38 = tail call i32 (...) @print_usage()
br label %131
39: ; preds = %15, %30, %28, %26
%40 = phi i8 [ %22, %15 ], [ %22, %30 ], [ %22, %28 ], [ 1, %26 ]
%41 = phi i8 [ %21, %15 ], [ %21, %30 ], [ 1, %28 ], [ %21, %26 ]
%42 = phi i8 [ %20, %15 ], [ %20, %30 ], [ %29, %28 ], [ %20, %26 ]
%43 = phi i16 [ %19, %15 ], [ %36, %30 ], [ %19, %28 ], [ %19, %26 ]
%44 = phi i32 [ %18, %15 ], [ 3, %30 ], [ %18, %28 ], [ %18, %26 ]
%45 = phi i8* [ %17, %15 ], [ %17, %30 ], [ %17, %28 ], [ %27, %26 ]
%46 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%47 = icmp eq i8 %46, -1
br i1 %47, label %48, label %15
48: ; preds = %39
%49 = icmp eq i8 %40, 0
br i1 %49, label %64, label %50
50: ; preds = %48
%51 = tail call i32* @fopen(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* @EXIT_FAILURE
%56 = tail call i32 @exit(i32 %55)
unreachable
57: ; preds = %50
%58 = load i32, i32* @LINE_MAX
%59 = add nsw i32 %58, -1
%60 = call i32* @fgets(i8* %8, i32 %59, i32* %51)
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = call i32 @fclose(i32* %51)
br label %131
64: ; preds = %10, %57, %48
%65 = phi i1 [ true, %57 ], [ false, %48 ], [ false, %10 ]
%66 = phi i32 [ %44, %57 ], [ %44, %48 ], [ 1, %10 ]
%67 = phi i16 [ %43, %57 ], [ %43, %48 ], [ 5, %10 ]
%68 = phi i8 [ %42, %57 ], [ %42, %48 ], [ 0, %10 ]
%69 = phi i8 [ %41, %57 ], [ %41, %48 ], [ 0, %10 ]
%70 = phi i1 [ false, %57 ], [ true, %48 ], [ true, %10 ]
%71 = phi i32* [ %51, %57 ], [ undef, %48 ], [ undef, %10 ]
%72 = icmp ne i32 %0, 2
%73 = or i1 %72, %65
%74 = xor i1 %73, true
%75 = icmp ne i8 %69, 0
%76 = select i1 %74, i1 true, i1 %75
%77 = sext i16 %67 to i32
%78 = zext i32 %66 to i64
%79 = sext i8 %68 to i64
br label %80
80: ; preds = %127, %64
%81 = phi i64 [ %78, %64 ], [ %117, %127 ]
br i1 %65, label %82, label %87
82: ; preds = %80
%83 = call i32 @strlen(i8* %8)
%84 = add nsw i32 %83, -1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %8, i64 %85
store i8 0, i8* %86
br label %92
87: ; preds = %80
%88 = add nsw i64 %81, %79
%89 = getelementptr inbounds i8*, i8** %1, i64 %88
%90 = load i8*, i8** %89
%91 = icmp eq i8* %90, null
br i1 %91, label %131, label %92
92: ; preds = %82, %87
%93 = phi i8* [ %8, %82 ], [ %90, %87 ]
%94 = call i32 @strlen(i8* %93)
%95 = icmp eq i32 %94, 0
br i1 %95, label %116, label %96
96: ; preds = %92
%97 = call %struct.Node* @parse(i8* %93)
store %struct.Node* %97, %struct.Node** %3
%98 = icmp eq %struct.Node* %97, null
br i1 %98, label %99, label %102
99: ; preds = %96
%100 = load i32, i32* @stderr
%101 = call i32 @fprintf(i32 %100, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %93)
br label %116
102: ; preds = %96
%103 = call i32 @reduce(%struct.Node* %97)
%104 = call i32 @replace_variables(%struct.Node** %3)
%105 = load %struct.Node*, %struct.Node** %3
%106 = call i32 @reduce(%struct.Node* %105)
%107 = load %struct.Node*, %struct.Node** %3
%108 = call x86_fp80 @calculate_parse_tree(%struct.Node* %107)
br i1 %76, label %109, label %111
109: ; preds = %102
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %77, x86_fp80 %108)
br label %113
111: ; preds = %102
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %93, i32 %77, x86_fp80 %108)
br label %113
113: ; preds = %111, %109
%114 = load %struct.Node*, %struct.Node** %3
%115 = call i32 @delete_tree(%struct.Node* %114)
br label %116
116: ; preds = %92, %113, %99
%117 = add i64 %81, 1
br i1 %70, label %123, label %118
118: ; preds = %116
%119 = load i32, i32* @LINE_MAX
%120 = add nsw i32 %119, -1
%121 = call i32* @fgets(i8* %8, i32 %120, i32* %71)
%122 = icmp eq i32* %121, null
br i1 %122, label %128, label %127
123: ; preds = %116
%124 = getelementptr inbounds i8*, i8** %1, i64 %117
%125 = load i8*, i8** %124
%126 = icmp eq i8* %125, null
br i1 %126, label %128, label %127
127: ; preds = %123, %118
br label %80
128: ; preds = %118, %123
br i1 %65, label %129, label %131
129: ; preds = %128
%130 = call i32 @fclose(i32* %71)
br label %131
131: ; preds = %87, %128, %129, %62, %37, %13
%132 = phi i32 [ 0, %13 ], [ 1, %37 ], [ 0, %62 ], [ 0, %129 ], [ 0, %128 ], [ 0, %87 ]
ret i32 %132
}