// File: IlyaSamoylov45[P]MapReduce-Project/main.cpp
// Function: main
int main(int argc, char* argv[]){

  if(argc != 13){
    std::cout << "\n" << "Usage is --app [wordcount, sort] --impl [procs, threads] --maps num_maps --reduces num_reduces --input infile --output outfile" << "\n" <<std::endl;
    exit(EXIT_FAILURE);
  }

  parse_cmdline(argc - 1, argv + 1);
  std::string app = argv[2];
  std::string impl = argv[4];
  int maps = std::stoi(argv[6]);
  int reduces = std::stoi(argv[8]);
  std::string infile = argv[10];
  std::string outfile = argv[12];
  ThreadData thread_data[maps];
  ProcData proc_data[maps];

  std::cout << "\nCurrent arguments are " << argv[1] << " " << app << " "
                                     << argv[3] << " " << impl << " "
                                     << argv[5] << " " << maps << " "
                                     << argv[7] << " " << reduces << " "
					<< argv[9] << " " << infile << " "
                                     << argv[11] << " " << outfile << "\n" <<std::endl;

  std::vector<std::string> sorted_ary = split_input(infile, maps);
  if(impl.compare("threads") == 0){
    map_threads(sorted_ary, maps, thread_data);
    std::cout << "Finished mapping Threads" << std::endl;
    //std::cout << thread_data[0].line_array << std::endl;
    std::map<std::string, int> result = reduce_threads(reduces, maps, thread_data);
    if(app.compare("wordcount") == 0){
      wordCountPrint(result, outfile);
    } else { // sort
      sortPrint(result, outfile);
    }
  }
  if(impl.compare("procs") == 0){

    
    map_proc(sorted_ary, maps, proc_data);
		//std::string result = proc_data[0].line_array;
		//if(app.compare("wordcount") == 0)
		//{
		//	wordCountPrint(result, outfile);
		//} else {
		//	sortPrint(result, outfile);	
		//}
	  
    std::cout << "Finished mapping Processes" << std::endl;
    map_threads(sorted_ary, maps, thread_data);
    std::map<std::string, int> result = reduce_threads(reduces, maps, thread_data);
    if(app.compare("wordcount") == 0){
     wordCountPrint(result, outfile);
    }else {
      sortPrint(result, outfile);
      
    }
    //std::cout << proc_data[0].line_array << std::endl;
    //std::map<std::string, int> result = reduce_threads(reduces, maps, thread_data);
    //std::cout << "Process" << std::endl;
    //if(app.compare("wordcount") == 0){
    //  wordCountPrint(result, outfile);
    //} else { // sort
    //  sortPrint(result, outfile);
    //}
	  
  }
  //print for error checking
  //for (std::vector<std::string>::const_iterator i = sorted_ary.begin(); i != sorted_ary.end(); i++){
  //  std::cout << *i << '\n';
  //}
  //
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0xd, -0x8(%rbp)
je 0x4899
movq 0x3b76a(%rip), %rdi     # 0x3ffc0
leaq 0x2398f(%rip), %rsi     # 0x281ec
callq 0x4340
movq %rax, %rdi
leaq 0x237ac(%rip), %rsi     # 0x28018
callq 0x4340
movq %rax, %rdi
leaq 0x23971(%rip), %rsi     # 0x281ec
callq 0x4340
movq %rax, %rdi
movq 0x3b71e(%rip), %rsi     # 0x3ffa8
callq 0x4370
movl $0x1, %edi
callq 0x43c0
movl -0x8(%rbp), %edi
decl %edi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x5680
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x358(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x45d0
movq -0x358(%rbp), %rsi
movq -0x350(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x4430
jmp 0x48e3
leaq -0x31(%rbp), %rdi
callq 0x4380
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x368(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x45d0
movq -0x368(%rbp), %rsi
movq -0x360(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x4430
jmp 0x4924
leaq -0x69(%rbp), %rdi
callq 0x4380
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x378(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x45d0
movq -0x378(%rbp), %rsi
movq -0x370(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x4430
jmp 0x496b
xorl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdi
movl $0xa, %edx
callq 0x9650
movl %eax, -0x37c(%rbp)
jmp 0x4988
leaq -0x90(%rbp), %rdi
callq 0x41f0
leaq -0x91(%rbp), %rdi
callq 0x4380
movl -0x37c(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x390(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x45d0
movq -0x390(%rbp), %rsi
movq -0x388(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x4430
jmp 0x49e7
xorl %eax, %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
movl $0xa, %edx
callq 0x9650
movl %eax, -0x394(%rbp)
jmp 0x4a04
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0xb9(%rbp), %rdi
callq 0x4380
movl -0x394(%rbp), %eax
movl %eax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x3a8(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x45d0
movq -0x3a8(%rbp), %rsi
movq -0x3a0(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
callq 0x4430
jmp 0x4a66
leaq -0xe1(%rbp), %rdi
callq 0x4380
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x45d0
movq -0x3b8(%rbp), %rsi
movq -0x3b0(%rbp), %rdx
leaq -0x108(%rbp), %rdi
callq 0x4430
jmp 0x4ab0
leaq -0x109(%rbp), %rdi
callq 0x4380
movl -0x70(%rbp), %eax
movq %rax, -0x3c8(%rbp)
movq %rsp, %rcx
movq %rcx, -0x118(%rbp)
imulq $0x58, %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x3c0(%rbp)
movq %rcx, %rsp
movq %rax, -0x120(%rbp)
cmpq $0x0, %rax
je 0x4b50
movq -0x3c0(%rbp), %rax
movq -0x3c8(%rbp), %rcx
imulq $0x58, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x3d8(%rbp)
movq %rax, -0x3d0(%rbp)
movq -0x3d0(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x9690
movq -0x3e0(%rbp), %rax
movq -0x3d8(%rbp), %rcx
addq $0x58, %rax
cmpq %rcx, %rax
movq %rax, -0x3d0(%rbp)
jne 0x4b1f
movl -0x70(%rbp), %eax
movq %rax, -0x3f0(%rbp)
imulq $0x58, %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x3e8(%rbp)
movq %rcx, %rsp
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x4bda
movq -0x3e8(%rbp), %rax
movq -0x3f0(%rbp), %rcx
imulq $0x58, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x400(%rbp)
movq %rax, -0x3f8(%rbp)
movq -0x3f8(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x96c0
movq -0x408(%rbp), %rax
movq -0x400(%rbp), %rcx
addq $0x58, %rax
cmpq %rcx, %rax
movq %rax, -0x3f8(%rbp)
jne 0x4ba9
movq 0x3b3df(%rip), %rdi     # 0x3ffc0
leaq 0x234af(%rip), %rsi     # 0x28097
callq 0x4340
movq %rax, -0x410(%rbp)
jmp 0x4bf6
movq -0x410(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x4340
movq %rax, -0x418(%rbp)
jmp 0x4c13
movq -0x418(%rbp), %rdi
leaq 0x23509(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x420(%rbp)
jmp 0x4c2f
movq -0x420(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x42c0
movq %rax, -0x428(%rbp)
jmp 0x4c48
movq -0x428(%rbp), %rdi
leaq 0x234d4(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x430(%rbp)
jmp 0x4c64
movq -0x430(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x4340
movq %rax, -0x438(%rbp)
jmp 0x4c81
movq -0x438(%rbp), %rdi
leaq 0x2349b(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x440(%rbp)
jmp 0x4c9d
movq -0x440(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x42c0
movq %rax, -0x448(%rbp)
jmp 0x4cb6
movq -0x448(%rbp), %rdi
leaq 0x23466(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x450(%rbp)
jmp 0x4cd2
movq -0x450(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x4340
movq %rax, -0x458(%rbp)
jmp 0x4cef
movq -0x458(%rbp), %rdi
leaq 0x2342d(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x460(%rbp)
jmp 0x4d0b
movq -0x460(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x45b0
movq %rax, -0x468(%rbp)
jmp 0x4d23
movq -0x468(%rbp), %rdi
leaq 0x233f9(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x470(%rbp)
jmp 0x4d3f
movq -0x470(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x4340
movq %rax, -0x478(%rbp)
jmp 0x4d5c
movq -0x478(%rbp), %rdi
leaq 0x233c0(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x480(%rbp)
jmp 0x4d78
movq -0x480(%rbp), %rdi
movl -0x98(%rbp), %esi
callq 0x45b0
movq %rax, -0x488(%rbp)
jmp 0x4d93
movq -0x488(%rbp), %rdi
leaq 0x23389(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x490(%rbp)
jmp 0x4daf
movq -0x490(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x4340
movq %rax, -0x498(%rbp)
jmp 0x4dcc
movq -0x498(%rbp), %rdi
leaq 0x23350(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x4a0(%rbp)
jmp 0x4de8
movq -0x4a0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x42c0
movq %rax, -0x4a8(%rbp)
jmp 0x4e04
movq -0x4a8(%rbp), %rdi
leaq 0x23318(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x4b0(%rbp)
jmp 0x4e20
movq -0x4b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
callq 0x4340
movq %rax, -0x4b8(%rbp)
jmp 0x4e3d
movq -0x4b8(%rbp), %rdi
leaq 0x232df(%rip), %rsi     # 0x2812a
callq 0x4340
movq %rax, -0x4c0(%rbp)
jmp 0x4e59
movq -0x4c0(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42c0
movq %rax, -0x4c8(%rbp)
jmp 0x4e75
movq -0x4c8(%rbp), %rdi
leaq 0x23369(%rip), %rsi     # 0x281ec
callq 0x4340
movq %rax, -0x4d0(%rbp)
jmp 0x4e91
movq -0x4d0(%rbp), %rdi
movq 0x3b109(%rip), %rsi     # 0x3ffa8
callq 0x4370
jmp 0x4ea6
leaq -0x160(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x4120
jmp 0x4ebb
movl -0x70(%rbp), %edx
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x6400
jmp 0x4ed3
leaq -0x160(%rbp), %rdi
callq 0x41f0
leaq -0x68(%rbp), %rdi
leaq 0x231c5(%rip), %rsi     # 0x280af
callq 0x40c0
cmpl $0x0, %eax
jne 0x5221
leaq -0x178(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x96f0
jmp 0x4f0d
movq -0x3c0(%rbp), %rdx
movl -0x70(%rbp), %esi
leaq -0x178(%rbp), %rdi
callq 0x65a0
jmp 0x4f25
leaq -0x178(%rbp), %rdi
callq 0x97e0
movq 0x3b088(%rip), %rdi     # 0x3ffc0
leaq 0x23178(%rip), %rsi     # 0x280b7
callq 0x4340
movq %rax, -0x4d8(%rbp)
jmp 0x4f4d
movq -0x4d8(%rbp), %rdi
movq 0x3b04d(%rip), %rsi     # 0x3ffa8
callq 0x4370
jmp 0x4f62
movq -0x3c0(%rbp), %rcx
movl -0x98(%rbp), %esi
movl -0x70(%rbp), %edx
leaq -0x1a8(%rbp), %rdi
callq 0x6730
jmp 0x4f80
leaq -0x30(%rbp), %rdi
leaq 0x23145(%rip), %rsi     # 0x280d0
callq 0x40c0
cmpl $0x0, %eax
jne 0x5175
leaq -0x1d8(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x9840
jmp 0x4fae
leaq -0x1f8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4120
jmp 0x4fc3
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x6c20
jmp 0x4fd8
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
leaq -0x1d8(%rbp), %rdi
callq 0x9870
jmp 0x5202
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x4380
jmp 0x5670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x4380
jmp 0x5667
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x504f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x41f0
leaq -0x91(%rbp), %rdi
callq 0x4380
jmp 0x565e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5086
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0xb9(%rbp), %rdi
callq 0x4380
jmp 0x565e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe1(%rbp), %rdi
callq 0x4380
jmp 0x565e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x109(%rbp), %rdi
callq 0x4380
jmp 0x5652
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x559c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x41f0
jmp 0x559c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x97e0
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5210
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5164
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
leaq -0x1d8(%rbp), %rdi
callq 0x9870
jmp 0x5210
leaq -0x228(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x9840
jmp 0x518a
leaq -0x248(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4120
jmp 0x519f
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x70a0
jmp 0x51b4
leaq -0x248(%rbp), %rdi
callq 0x41f0
leaq -0x228(%rbp), %rdi
callq 0x9870
jmp 0x5202
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x51f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x41f0
leaq -0x228(%rbp), %rdi
callq 0x9870
jmp 0x5210
leaq -0x1a8(%rbp), %rdi
callq 0x9870
jmp 0x5221
leaq -0x1a8(%rbp), %rdi
callq 0x9870
jmp 0x5590
leaq -0x68(%rbp), %rdi
leaq 0x22eae(%rip), %rsi     # 0x280da
callq 0x40c0
cmpl $0x0, %eax
jne 0x549e
leaq -0x260(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x96f0
jmp 0x524f
movq -0x3e8(%rbp), %rdx
movl -0x70(%rbp), %esi
leaq -0x260(%rbp), %rdi
callq 0x7330
jmp 0x5267
leaq -0x260(%rbp), %rdi
callq 0x97e0
movq 0x3ad46(%rip), %rdi     # 0x3ffc0
leaq 0x22e5f(%rip), %rsi     # 0x280e0
callq 0x4340
movq %rax, -0x4e0(%rbp)
jmp 0x528f
movq -0x4e0(%rbp), %rdi
movq 0x3ad0b(%rip), %rsi     # 0x3ffa8
callq 0x4370
jmp 0x52a4
leaq -0x278(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x96f0
jmp 0x52b9
movq -0x3c0(%rbp), %rdx
movl -0x70(%rbp), %esi
leaq -0x278(%rbp), %rdi
callq 0x65a0
jmp 0x52d1
leaq -0x278(%rbp), %rdi
callq 0x97e0
movq -0x3c0(%rbp), %rcx
movl -0x98(%rbp), %esi
movl -0x70(%rbp), %edx
leaq -0x2a8(%rbp), %rdi
callq 0x6730
jmp 0x52fb
leaq -0x30(%rbp), %rdi
leaq 0x22dca(%rip), %rsi     # 0x280d0
callq 0x40c0
cmpl $0x0, %eax
jne 0x53f2
leaq -0x2d8(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x9840
jmp 0x5329
leaq -0x2f8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4120
jmp 0x533e
leaq -0x2d8(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0x6c20
jmp 0x5353
leaq -0x2f8(%rbp), %rdi
callq 0x41f0
leaq -0x2d8(%rbp), %rdi
callq 0x9870
jmp 0x547f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x97e0
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x97e0
jmp 0x5590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x548d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x53e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x41f0
leaq -0x2d8(%rbp), %rdi
callq 0x9870
jmp 0x548d
leaq -0x328(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x9840
jmp 0x5407
leaq -0x348(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4120
jmp 0x541c
leaq -0x328(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x70a0
jmp 0x5431
leaq -0x348(%rbp), %rdi
callq 0x41f0
leaq -0x328(%rbp), %rdi
callq 0x9870
jmp 0x547f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5471
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x41f0
leaq -0x328(%rbp), %rdi
callq 0x9870
jmp 0x548d
leaq -0x2a8(%rbp), %rdi
callq 0x9870
jmp 0x549e
leaq -0x2a8(%rbp), %rdi
callq 0x9870
jmp 0x5590
leaq -0x140(%rbp), %rdi
callq 0x97e0
movq -0x3f0(%rbp), %rax
movq -0x3e8(%rbp), %rcx
imulq $0x58, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x4e8(%rbp)
je 0x54ff
movq -0x4e8(%rbp), %rdi
addq $-0x58, %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x9890
movq -0x3e8(%rbp), %rcx
movq -0x4f0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4e8(%rbp)
jne 0x54ce
movq -0x3c0(%rbp), %rcx
movq -0x3c8(%rbp), %rax
imulq $0x58, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x4f8(%rbp)
je 0x5554
movq -0x4f8(%rbp), %rdi
addq $-0x58, %rdi
movq %rdi, -0x500(%rbp)
callq 0x98c0
movq -0x3c0(%rbp), %rcx
movq -0x500(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4f8(%rbp)
jne 0x5523
movq -0x118(%rbp), %rax
movq %rax, %rsp
leaq -0x108(%rbp), %rdi
callq 0x41f0
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0x68(%rbp), %rdi
callq 0x41f0
leaq -0x30(%rbp), %rdi
callq 0x41f0
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
leaq -0x140(%rbp), %rdi
callq 0x97e0
movq -0x3e8(%rbp), %rcx
movq -0x3f0(%rbp), %rax
imulq $0x58, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x508(%rbp)
je 0x55f1
movq -0x508(%rbp), %rdi
addq $-0x58, %rdi
movq %rdi, -0x510(%rbp)
callq 0x9890
movq -0x3e8(%rbp), %rcx
movq -0x510(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x508(%rbp)
jne 0x55c0
movq -0x3c0(%rbp), %rcx
movq -0x3c8(%rbp), %rax
imulq $0x58, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x518(%rbp)
je 0x5646
movq -0x518(%rbp), %rdi
addq $-0x58, %rdi
movq %rdi, -0x520(%rbp)
callq 0x98c0
movq -0x3c0(%rbp), %rcx
movq -0x520(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x518(%rbp)
jne 0x5615
leaq -0x108(%rbp), %rdi
callq 0x41f0
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0x68(%rbp), %rdi
callq 0x41f0
leaq -0x30(%rbp), %rdi
callq 0x41f0
movq -0x40(%rbp), %rdi
callq 0x45c0
nopl (%rax)