// File: /workspace/github_cpp_makefile_star2_O1/kmiya[P]Needleman-Wunsch/src/main.cpp
// Function: main
int main(int argc, char **argv)
{
  // --- open files ---
  ifstream inputFile1, inputFile2;
  ofstream outputFile;
  if (argc < 4) {
    usage();
    exit(EXIT_FAILURE);
  } else {
    inputFile1.open(argv[1]);
    inputFile2.open(argv[2]);
    outputFile.open(argv[3], ios::app);
  }
  if (inputFile1.fail() || inputFile2.fail() || outputFile.fail()) {
    cerr << "Error: Could not open files\n";
    usage();
    exit(EXIT_FAILURE);
  }
  // --- read sequences from files ---
  string input1, input2;
  inputFile1 >> input1;
  inputFile2 >> input2;
  if (input1.empty() || input2.empty()) {
    cerr << "Error: invalid files\n";
    usage();
    exit(EXIT_FAILURE);
  }
  // translate input_files into Base-type
  Base seq1(input1), seq2(input2);
  cout << "input file1:\n";
  seq1.PrintString();              // print input_file1
  cout << "input file2:\n";
  seq2.PrintString();              // print input_file2
  BaseAlgorithms tmp;              // create an instance for alignment
  tmp.Alignment(seq1, seq2);       // DO alignment
  tmp.PrintAlignment();            // print alignment result
  printDate(&outputFile);          // save time stamp to output_file
  tmp.SaveAlignment(&outputFile);  // save result to output_file
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x6f8, %rsp            # imm = 0x6F8
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4f0(%rsp), %rdi
callq 0x21a0
leaq 0x2e8(%rsp), %rdi
callq 0x21a0
leaq 0xe8(%rsp), %rdi
callq 0x2230
cmpl $0x3, %ebp
jle 0x394e
movq 0x8(%rbx), %rsi
leaq 0x4f0(%rsp), %rdi
movl $0x8, %edx
callq 0x20b0
movq 0x10(%rbx), %rsi
leaq 0x2e8(%rsp), %rdi
movl $0x8, %edx
callq 0x20b0
movq 0x18(%rbx), %rsi
leaq 0xe8(%rsp), %rdi
movl $0x1, %edx
callq 0x2050
movq 0x4f0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x510(%rsp,%rax)
jne 0x392f
movq 0x2e8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x308(%rsp,%rax)
jne 0x392f
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x108(%rsp,%rax)
jne 0x392f
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
xorl %eax, %eax
movq %rax, -0x8(%r14)
movb %al, (%r14)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x4f0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x21d0
leaq 0x2e8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21d0
cmpq $0x0, 0x30(%rsp)
je 0x3955
cmpq $0x0, 0x10(%rsp)
je 0x3955
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2506
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2506
movq 0x2844(%rip), %rdi      # 0x5fd0
leaq 0xa0c(%rip), %rsi       # 0x419f
movl $0xd, %edx
callq 0x21b0
leaq 0x80(%rsp), %rdi
callq 0x273a
movq 0x281f(%rip), %rdi      # 0x5fd0
leaq 0x9f5(%rip), %rsi       # 0x41ad
movl $0xd, %edx
callq 0x21b0
leaq 0x48(%rsp), %rdi
callq 0x273a
leaq 0xb8(%rsp), %rdi
callq 0x2b88
leaq 0xb8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x2d02
leaq 0xb8(%rsp), %rdi
callq 0x3418
leaq 0xe8(%rsp), %rdi
callq 0x3a66
leaq 0xb8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x3424
leaq 0xb8(%rsp), %rdi
callq 0x2c68
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x3846
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3861
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x387e
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x389f
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x38b6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x38cd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x26f4(%rip), %rax      # 0x5fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0xf0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0xe8(%rsp,%rcx)
callq 0x2130
leaq 0x1e0(%rsp), %rdi
callq 0x2070
leaq 0x2e8(%rsp), %rdi
callq 0x2060
leaq 0x4f0(%rsp), %rdi
callq 0x2060
xorl %eax, %eax
addq $0x6f8, %rsp            # imm = 0x6F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x26ba(%rip), %rdi      # 0x5ff0
leaq 0x82f(%rip), %rsi       # 0x416c
movl $0x1c, %edx
callq 0x21b0
callq 0x3a22
jmp 0x3972
callq 0x3a22
jmp 0x3972
movq 0x2694(%rip), %rdi      # 0x5ff0
leaq 0x826(%rip), %rsi       # 0x4189
movl $0x15, %edx
callq 0x21b0
callq 0x3a22
movl $0x1, %edi
callq 0x21c0
jmp 0x39a6
movq %rax, %rbx
jmp 0x39b3
jmp 0x398f
movq %rax, %rbx
jmp 0x3a00
movq %rax, %rbx
jmp 0x3a0d
movq %rax, %rbx
jmp 0x39c0
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x2c68
jmp 0x39a9
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3b78
leaq 0x80(%rsp), %rdi
callq 0x3b78
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x39d7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x39f3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x39f3
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x21f0
leaq 0x2e8(%rsp), %rdi
callq 0x2060
leaq 0x4f0(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2250