// File: 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
movq %rsp, %rbp
subq $0x720, %rsp            # imm = 0x720
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2230
leaq -0x420(%rbp), %rdi
callq 0x2230
jmp 0x4dbc
leaq -0x630(%rbp), %rdi
callq 0x2310
jmp 0x4dca
cmpl $0x4, -0x4(%rbp)
jge 0x4e26
callq 0x51b0
jmp 0x4dd7
movl $0x1, %edi
callq 0x2250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x518f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x5183
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x5177
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x20f0
jmp 0x4e41
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x420(%rbp), %rdi
movl $0x8, %edx
callq 0x20f0
jmp 0x4e5c
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x630(%rbp), %rdi
movl $0x1, %edx
callq 0x2060
jmp 0x4e77
jmp 0x4e79
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x711(%rbp)
jmp 0x4e99
movb -0x711(%rbp), %al
testb $0x1, %al
jne 0x4efd
jmp 0x4ea5
movq -0x420(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x420(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x712(%rbp)
jmp 0x4ec5
movb -0x712(%rbp), %al
testb $0x1, %al
jne 0x4efd
jmp 0x4ed1
movq -0x630(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x630(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x713(%rbp)
jmp 0x4ef1
movb -0x713(%rbp), %al
testb $0x1, %al
jne 0x4efd
jmp 0x4f23
movq 0x40ec(%rip), %rdi      # 0x8ff0
leaq 0x1249(%rip), %rsi      # 0x6154
callq 0x21b0
jmp 0x4f12
callq 0x51b0
jmp 0x4f19
movl $0x1, %edi
callq 0x2250
leaq -0x650(%rbp), %rdi
movq %rdi, -0x720(%rbp)
callq 0x22a0
leaq -0x670(%rbp), %rdi
callq 0x22a0
movq -0x720(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x2270
jmp 0x4f57
leaq -0x420(%rbp), %rdi
leaq -0x670(%rbp), %rsi
callq 0x2270
jmp 0x4f6c
leaq -0x650(%rbp), %rdi
callq 0x2300
testb $0x1, %al
jne 0x4f8e
leaq -0x670(%rbp), %rdi
callq 0x2300
testb $0x1, %al
jne 0x4f8e
jmp 0x4fcb
movq 0x405b(%rip), %rdi      # 0x8ff0
leaq 0x11d5(%rip), %rsi      # 0x6171
callq 0x21b0
jmp 0x4fa3
callq 0x51b0
jmp 0x4faa
movl $0x1, %edi
callq 0x2250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x515f
leaq -0x6a8(%rbp), %rdi
leaq -0x650(%rbp), %rsi
callq 0x2660
jmp 0x4fe0
leaq -0x6e0(%rbp), %rdi
leaq -0x670(%rbp), %rsi
callq 0x2660
jmp 0x4ff5
movq 0x3fd4(%rip), %rdi      # 0x8fd0
leaq 0x1184(%rip), %rsi      # 0x6187
callq 0x21b0
jmp 0x500a
leaq -0x6a8(%rbp), %rdi
callq 0x29a0
jmp 0x5018
movq 0x3fb1(%rip), %rdi      # 0x8fd0
leaq 0x116f(%rip), %rsi      # 0x6195
callq 0x21b0
jmp 0x502d
leaq -0x6e0(%rbp), %rdi
callq 0x29a0
jmp 0x503b
leaq -0x710(%rbp), %rdi
callq 0x3f10
jmp 0x5049
leaq -0x710(%rbp), %rdi
leaq -0x6a8(%rbp), %rsi
leaq -0x6e0(%rbp), %rdx
callq 0x4110
jmp 0x5065
leaq -0x710(%rbp), %rdi
callq 0x4a40
jmp 0x5073
leaq -0x630(%rbp), %rdi
callq 0x51e0
jmp 0x5081
leaq -0x710(%rbp), %rdi
leaq -0x630(%rbp), %rsi
callq 0x4a70
jmp 0x5096
leaq -0x710(%rbp), %rdi
callq 0x40a0
leaq -0x6e0(%rbp), %rdi
callq 0x4cc0
leaq -0x6a8(%rbp), %rdi
callq 0x4cc0
leaq -0x670(%rbp), %rdi
callq 0x20e0
leaq -0x650(%rbp), %rdi
callq 0x20e0
leaq -0x630(%rbp), %rdi
callq 0x22c0
leaq -0x420(%rbp), %rdi
callq 0x2080
leaq -0x218(%rbp), %rdi
callq 0x2080
xorl %eax, %eax
addq $0x720, %rsp            # imm = 0x720
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x5153
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x5147
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
leaq -0x710(%rbp), %rdi
callq 0x40a0
leaq -0x6e0(%rbp), %rdi
callq 0x4cc0
leaq -0x6a8(%rbp), %rdi
callq 0x4cc0
leaq -0x670(%rbp), %rdi
callq 0x20e0
leaq -0x650(%rbp), %rdi
callq 0x20e0
leaq -0x630(%rbp), %rdi
callq 0x22c0
leaq -0x420(%rbp), %rdi
callq 0x2080
leaq -0x218(%rbp), %rdi
callq 0x2080
movq -0x428(%rbp), %rdi
callq 0x2330
nopw (%rax,%rax)