#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ infixTopostfix(char *);
int /*<<< orphan*/ printFile(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  extern char *optarg;
  int c, err = 0;
  char *filename;
  static char usage[] = "usage: %s [-b filename]\n";
  while ((c = getopt(argc, argv, "b:")) != -1) {
    switch (c) {
    case 'b':
      filename = optarg;
      printf("infix expression: ");
      printFile(filename);
      printf("postfix expression: ");
      infixTopostfix(filename);
      break;
    case '?':
      err = 1;
      break;
    }
  }
  if (err) {
    fprintf(stderr, usage, argv[0]);
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     120a <main+0xaa>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     11fe <main+0x9e>
jmp    11b0 <main+0x50>
mov    -0x24(%rbp),%eax
sub    $0x62,%eax
jne    1205 <main+0xa5>
jmp    11c1 <main+0x61>
mov    0x2e18(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <printFile@plt>
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1080 <infixTopostfix@plt>
jmp    1205 <main+0xa5>
movl   $0x1,-0x18(%rbp)
jmp    117d <main+0x1d>
cmpl   $0x0,-0x18(%rbp)
je     123a <main+0xda>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0x2e35(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%ebp
mov    $0x1,%al
mov    %eax,0x4(%rsp)
lea    0xe83(%rip),%r14
lea    0xe7f(%rip),%r15
lea    0xe8b(%rip),%r12
jmp    11a0 <main+0x40>
movl   $0x0,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0x62,%eax
je     11c0 <main+0x60>
cmp    $0x3f,%eax
je     118d <main+0x2d>
cmp    $0xffffffff,%eax
jne    11a0 <main+0x40>
jmp    11ec <main+0x8c>
xchg   %ax,%ax
mov    0x2e19(%rip),%rax
mov    (%rax),%rbx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <printFile@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1080 <infixTopostfix@plt>
jmp    11a0 <main+0x40>
testb  $0x1,0x4(%rsp)
je     11fa <main+0x9a>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0x2e52(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@main.usage = internal global [25 x i8] c"usage: %s [-b filename]\0A\00"
@.str = [3 x i8] c"b:\00"
@optarg = external global i8*
@.str.1 = [19 x i8] c"infix expression: \00"
@.str.2 = [21 x i8] c"postfix expression: \00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %25 [
i32 98, label %16
i32 63, label %24
]
16: ; preds = %14
%17 = load i8*, i8** @optarg
store i8* %17, i8** %8
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%19 = load i8*, i8** %8
%20 = call i32 @printFile(i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%22 = load i8*, i8** %8
%23 = call i32 @infixTopostfix(i8* %22)
br label %25
24: ; preds = %14
store i32 1, i32* %7
br label %25
25: ; preds = %14, %24, %16
br label %9
26: ; preds = %9
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @main.usage, i64 0, i64 0), i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %26
%37 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.usage = internal global [25 x i8] c"usage: %s [-b filename]\0A\00"
@.str = [3 x i8] c"b:\00"
@optarg = external global i8*
@.str.1 = [19 x i8] c"infix expression: \00"
@.str.2 = [21 x i8] c"postfix expression: \00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i1 [ true, %2 ], [ false, %5 ]
br label %5
5: ; preds = %7, %3
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %7 [
i32 -1, label %14
i32 98, label %8
i32 63, label %3
]
7: ; preds = %5, %8
br label %5
8: ; preds = %5
%9 = load i8*, i8** @optarg
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @printFile(i8* %9)
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @infixTopostfix(i8* %9)
br label %7
14: ; preds = %5
br i1 %4, label %20, label %15
15: ; preds = %14
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @main.usage, i64 0, i64 0), i8* %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %14
%21 = tail call i32 @exit(i32 0)
unreachable
}