// File: CoinXu[P]reviser-compiler/src/command_line_interface.cpp
// Function: reviser::CommandLineInterface::Run(int, char const* const*)
int CommandLineInterface::Run(int argc, const char* const argv[]) {
    if (!ParseArguments(argc, argv)) {
      return -1;
    }

    for (int i = 0; i < input_files.size(); i++) {
      for (int j = 0; j < output_directives.size(); j++) {
        OutputDirective directive = output_directives.at(j);
        GeneratorMap::const_iterator iter = generators.find(directive.name);
        Printer* printer;


        if (printer_name == "fs") {
          string output = io::absolute(directive.output_location)
            ? directive.output_location
            : io::join(string(getenv("PWD")), directive.output_location);
          string file_name = io::basename(input_files.at(i)) + "." + iter->second.output_file_suffix;
          printer = new PrinterFile(io::join(output, file_name));
        } else if (printer_name == "terminal") {
          printer = new PrinterTerminal();
        } else {
          cerr << "unkown printer type name: " << printer_name << endl;
          return -1;
        }

        Tokenizer tokenizer(MakeSourceCodeInputs(input_files.at(i)));
        Parser parse(&tokenizer, iter->second.generator, printer);
        parse.Program();
        delete printer;
      }
    }

    return 0;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x318(%rbp)
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x9fe40
testb $0x1, %al
jne 0x9f78d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9fe19
movl $0x0, -0x24(%rbp)
movq -0x318(%rbp), %rdi
movslq -0x24(%rbp), %rax
movq %rax, -0x320(%rbp)
addq $0x48, %rdi
callq 0xa0ef0
movq %rax, %rcx
movq -0x320(%rbp), %rax
cmpq %rcx, %rax
jae 0x9fe12
movl $0x0, -0x28(%rbp)
movq -0x318(%rbp), %rdi
movslq -0x28(%rbp), %rax
movq %rax, -0x328(%rbp)
addq $0x30, %rdi
callq 0xa0f10
movq %rax, %rcx
movq -0x328(%rbp), %rax
cmpq %rcx, %rax
jae 0x9fe02
movq -0x318(%rbp), %rdi
addq $0x30, %rdi
movslq -0x28(%rbp), %rsi
callq 0xa0f40
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0xa0f80
movq -0x318(%rbp), %rdi
movq -0x338(%rbp), %rsi
callq 0xa0ff0
movq %rax, -0x330(%rbp)
jmp 0x9f83a
movq -0x330(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xa1020
movq -0x318(%rbp), %rdi
subq $-0x80, %rdi
leaq 0x5f7a9(%rip), %rsi     # 0xff00d
callq 0xa1040
movb %al, -0x339(%rbp)
jmp 0x9f871
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0x9f880
jmp 0x9fbb1
leaq -0x48(%rbp), %rdi
movb $0x0, -0xda(%rbp)
movb $0x0, -0xdb(%rbp)
callq 0xc22b0
movb %al, -0x33a(%rbp)
jmp 0x9f89f
movb -0x33a(%rbp), %al
testb $0x1, %al
jne 0x9f8ab
jmp 0x9f8bf
leaq -0x48(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x991c0
jmp 0x9f8bd
jmp 0x9f92a
leaq 0x5f74a(%rip), %rdi     # 0xff010
callq 0x99580
movq %rax, -0x350(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x99850
movq -0x350(%rbp), %rsi
movq -0x348(%rbp), %rdx
movb $0x1, -0xda(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x99640
jmp 0x9f908
movb $0x1, -0xdb(%rbp)
leaq -0x48(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xc2020
jmp 0x9f928
jmp 0x9f92a
testb $0x1, -0xdb(%rbp)
jne 0x9f935
jmp 0x9f941
leaq -0xd8(%rbp), %rdi
callq 0x992c0
testb $0x1, -0xda(%rbp)
jne 0x9f94c
jmp 0x9f958
leaq -0xd9(%rbp), %rdi
callq 0x994f0
movq -0x318(%rbp), %rdi
addq $0x48, %rdi
movslq -0x24(%rbp), %rsi
callq 0xa1110
movq %rax, -0x358(%rbp)
jmp 0x9f975
movq -0x358(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0xc2300
jmp 0x9f98a
leaq 0x5f7bb(%rip), %rdx     # 0xff14c
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa10c0
jmp 0x9f9a6
leaq -0x78(%rbp), %rdi
callq 0xa1150
movq %rax, %rdx
addq $0x48, %rdx
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xa1070
jmp 0x9f9cb
leaq -0x120(%rbp), %rdi
callq 0x992c0
leaq -0x140(%rbp), %rdi
callq 0x992c0
movl $0x228, %edi            # imm = 0x228
callq 0x99480
movq %rax, -0x360(%rbp)
jmp 0x9f9f6
movb $0x1, -0x161(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0xc2020
jmp 0x9fa19
movq -0x360(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xeaf40
jmp 0x9fa2e
movq -0x360(%rbp), %rax
movb $0x0, -0x161(%rbp)
movq %rax, -0x98(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x992c0
leaq -0x100(%rbp), %rdi
callq 0x992c0
leaq -0xb8(%rbp), %rdi
callq 0x992c0
jmp 0x9fc9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fdf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
testb $0x1, -0xdb(%rbp)
jne 0x9fab4
jmp 0x9fac0
leaq -0xd8(%rbp), %rdi
callq 0x992c0
jmp 0x9fac2
testb $0x1, -0xda(%rbp)
jne 0x9facd
jmp 0x9fad9
leaq -0xd9(%rbp), %rdi
callq 0x994f0
jmp 0x9fdf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fba0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fb27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x992c0
leaq -0x140(%rbp), %rdi
callq 0x992c0
jmp 0x9fba0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fb94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fb7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x992c0
testb $0x1, -0x161(%rbp)
jne 0x9fb86
jmp 0x9fb92
movq -0x360(%rbp), %rdi
callq 0x99440
jmp 0x9fb94
leaq -0x100(%rbp), %rdi
callq 0x992c0
leaq -0xb8(%rbp), %rdi
callq 0x992c0
jmp 0x9fdf7
movq -0x318(%rbp), %rdi
subq $-0x80, %rdi
leaq 0x5f441(%rip), %rsi     # 0xff004
callq 0xa1040
movb %al, -0x361(%rbp)
jmp 0x9fbd0
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x9fbdc
jmp 0x9fc33
movl $0x8, %edi
callq 0x99480
movq %rax, -0x370(%rbp)
jmp 0x9fbef
movq -0x370(%rbp), %rdi
callq 0xeb220
jmp 0x9fbfd
movq -0x370(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x9fc9a
movq -0x370(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x99440
jmp 0x9fdf7
movq 0x903a6(%rip), %rdi     # 0x12ffe0
leaq 0x5f3d3(%rip), %rsi     # 0xff014
callq 0x99470
movq %rax, -0x378(%rbp)
jmp 0x9fc4f
movq -0x378(%rbp), %rdi
movq -0x318(%rbp), %rsi
subq $-0x80, %rsi
callq 0x99410
movq %rax, -0x380(%rbp)
jmp 0x9fc6f
movq -0x380(%rbp), %rdi
movq 0x902eb(%rip), %rsi     # 0x12ff68
callq 0x994c0
jmp 0x9fc84
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x168(%rbp)
jmp 0x9fd6f
jmp 0x9fc9c
movq -0x318(%rbp), %rdi
addq $0x48, %rdi
movslq -0x24(%rbp), %rsi
callq 0xa1110
movq %rax, -0x388(%rbp)
jmp 0x9fcb9
movq -0x388(%rbp), %rdx
movq -0x318(%rbp), %rsi
leaq -0x290(%rbp), %rdi
callq 0xa00a0
jmp 0x9fcd5
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xadc00
jmp 0x9fcea
leaq -0x290(%rbp), %rdi
callq 0x992c0
leaq -0x78(%rbp), %rdi
callq 0xa1150
movq 0x20(%rax), %rdx
movq -0x98(%rbp), %rcx
leaq -0x310(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xa7260
jmp 0x9fd1f
leaq -0x310(%rbp), %rdi
callq 0xa7380
jmp 0x9fd2d
movq -0x98(%rbp), %rax
movq %rax, -0x390(%rbp)
cmpq $0x0, %rax
je 0x9fd4d
movq -0x390(%rbp), %rdi
callq 0x99440
leaq -0x310(%rbp), %rdi
callq 0xa7350
leaq -0x270(%rbp), %rdi
callq 0xae230
movl $0x0, -0x168(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xa1170
movl -0x168(%rbp), %eax
testl %eax, %eax
je 0x9fd89
jmp 0x9fd84
jmp 0x9fe19
jmp 0x9fd8b
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9f7c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x992c0
jmp 0x9fdf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9fdeb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0xa7350
leaq -0x270(%rbp), %rdi
callq 0xae230
leaq -0x70(%rbp), %rdi
callq 0xa1170
jmp 0x9fe25
jmp 0x9fe04
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x9f794
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x99840
nopw %cs:(%rax,%rax)