#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 */
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ convertLine(char *);
int createTables(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ initTables(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *file;
  char buffer[BUFSIZ];
  int error;
  int yen = 0;
  if (argc > 1 && !strcmp(argv[1], "-y")) {
    yen = 1;
    ++argv;
    --argc;
  }
  if (argc != 3) {
    fprintf(stderr, "Usage: mb2tab input output\n");
    return 1;
  }
  initTables(yen);
  if ((file = fopen(argv[1], "r")) == NULL) {
    perror(argv[1]);
    return 1;
  }
  while (fgets(buffer, sizeof(buffer), file)) {
    if (buffer[0] == '0' && buffer[1] == 'x') {
      convertLine(buffer);
    }
  }
  fclose(file);
  error = createTables(argv[2]);
  return error;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x48(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1220 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1220 <main+0x90>
movl   $0x1,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1252 <main+0xc2>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
lea    0xdc9(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    1313 <main+0x183>
mov    -0x30(%rbp),%edi
call   10b0 <initTables@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    129c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    1313 <main+0x183>
jmp    12a1 <main+0x111>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     12ed <main+0x15d>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    12e8 <main+0x158>
mov    -0x40(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    12e8 <main+0x158>
mov    -0x40(%rbp),%rdi
call   1090 <convertLine@plt>
jmp    12a1 <main+0x111>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <createTables@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x20(%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
push   %rax
mov    0x2e33(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%rbx
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%edi
jl     1248 <main+0xb8>
mov    %rsi,%r12
mov    %edi,%r15d
lea    0x8(%rsi),%r13
mov    0x8(%rsi),%rdi
lea    0xe29(%rip),%rsi
call   1050 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
cmovne %r12,%r13
sub    %ecx,%r15d
cmp    $0x3,%r15d
jne    1248 <main+0xb8>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10b0 <initTables@plt>
mov    0x8(%r13),%rdi
lea    0xe17(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1284 <main+0xf4>
mov    %rax,%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1264 <main+0xd4>
cmpb   $0x30,(%rbx)
jne    1220 <main+0x90>
cmpb   $0x78,0x1(%rbx)
jne    1220 <main+0x90>
mov    %rbx,%rdi
call   1090 <convertLine@plt>
jmp    1220 <main+0x90>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
lea    0xdab(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    1275 <main+0xe5>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    0x10(%r13),%rdi
call   10a0 <createTables@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%r13),%rdi
call   1080 <perror@plt>
mov    $0x1,%eax
jmp    1275 <main+0xe5>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [3 x i8] c"-y\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Usage: mb2tab input output\0A\00"
@.str.2 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @BUFSIZ
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %7
%15 = alloca i8, i64 %13
store i64 %13, i64* %8
store i32 0, i32* %10
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 1
br i1 %17, label %18, label %29
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %18
store i32 1, i32* %10
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %29
29: ; preds = %24, %18, %2
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 3
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %11
br label %75
35: ; preds = %29
%36 = load i32, i32* %10
%37 = call i32 @initTables(i32 %36)
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %41, i32** %6
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %48
43: ; preds = %35
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @perror(i8* %46)
store i32 1, i32* %3
store i32 1, i32* %11
br label %75
48: ; preds = %35
br label %49
49: ; preds = %66, %48
%50 = trunc i64 %13 to i32
%51 = load i32*, i32** %6
%52 = call i64 @fgets(i8* %15, i32 %50, i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %67
54: ; preds = %49
%55 = getelementptr inbounds i8, i8* %15, i64 0
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 48
br i1 %58, label %59, label %66
59: ; preds = %54
%60 = getelementptr inbounds i8, i8* %15, i64 1
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 120
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = call i32 @convertLine(i8* %15)
br label %66
66: ; preds = %64, %59, %54
br label %49
67: ; preds = %49
%68 = load i32*, i32** %6
%69 = call i32 @fclose(i32* %68)
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = call i32 @createTables(i8* %72)
store i32 %73, i32* %9
%74 = load i32, i32* %9
store i32 %74, i32* %3
store i32 1, i32* %11
br label %75
75: ; preds = %67, %43, %32
%76 = load i8*, i8** %7
%77 = load i32, i32* %3
ret i32 %77
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [3 x i8] c"-y\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Usage: mb2tab input output\0A\00"
@.str.2 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8** %8, i8** %1
%13 = sext i1 %11 to i32
%14 = add nsw i32 %13, %0
%15 = icmp eq i32 %14, 3
br i1 %15, label %19, label %16
16: ; preds = %2, %7
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %50
19: ; preds = %7
%20 = zext i1 %11 to i32
%21 = tail call i32 @initTables(i32 %20)
%22 = getelementptr inbounds i8*, i8** %12, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %31, label %26
26: ; preds = %19
%27 = call i64 @fgets(i8* %5, i32 %3, i32* %24)
%28 = icmp eq i64 %27, 0
br i1 %28, label %45, label %29
29: ; preds = %26
%30 = getelementptr inbounds i8, i8* %5, i64 1
br label %34
31: ; preds = %19
%32 = load i8*, i8** %22
%33 = tail call i32 @perror(i8* %32)
br label %50
34: ; preds = %29, %42
%35 = load i8, i8* %5
%36 = icmp eq i8 %35, 48
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i8, i8* %30
%39 = icmp eq i8 %38, 120
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @convertLine(i8* %5)
br label %42
42: ; preds = %40, %37, %34
%43 = call i64 @fgets(i8* %5, i32 %3, i32* %24)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %34
45: ; preds = %42, %26
%46 = call i32 @fclose(i32* %24)
%47 = getelementptr inbounds i8*, i8** %12, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @createTables(i8* %48)
br label %50
50: ; preds = %45, %31, %16
%51 = phi i32 [ 1, %16 ], [ 1, %31 ], [ %49, %45 ]
ret i32 %51
}