// File: /workspace/github_cpp_makefile_star2_O1/jBlinden[P]private-codis/ProtocolClient.cpp
// Function: RunClientProtocol(CSocket*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void RunClientProtocol(CSocket *socket, string pArgsFile, string clientDataDir)
{
  ClientLog("starting client protocol");

#if !OPTIMAL
  ClientLog("Reading in protocol arguments");
#endif

  ifstream in;
  in.open(pArgsFile, ios::in | ios::binary);
  struct ProtocolArgs pArgs(in);

  in.close();

#if !OPTIMAL
  ClientLog("Reading in receiver OTs");
#endif

  ifstream rOTFile1;
  rOTFile1.open(clientDataDir + "rOT.txt", ios::in | ios::binary);

  ReceiverOTCorrelation **FSM1_RC = ReadInReceiverOTsFSM1(rOTFile1, pArgs);
  ReceiverOTCorrelation **FSM2_RC = ReadInReceiverOTsFSM2(rOTFile1, pArgs);

  rOTFile1.close();

#if !OPTIMAL
  ClientLog("Finished Reading in OTs");
#endif

  uint32_t N = pArgs.N;
  uint32_t C = pArgs.C;
  uint8_t* bits_per_component = pArgs.bits_per_component;

#if !OPTIMAL
  cout << "N: " << N << " C: " << C << endl;
#endif

  ifstream queryFile;
  queryFile.open(clientDataDir + "query.txt");
  uint32_t *query = ReadInEntry(queryFile, C);
  queryFile.close();

#if VERBOSE
  cout << "Query: ";
  for (int i = 0; i < C; i++)
  {
    cout << query[i] << " ";
  }
  cout << endl;
#endif

#if !OPTIMAL
  ClientLog("Creating clients states");
#endif

  uint8_t **client_states = new uint8_t *[N];
  for (int i = 0; i < N; i++)
  {
    client_states[i] = new uint8_t[C];
    for (int j = 0; j < C; j++)
    {
      client_states[i][j] = 0; //Default state is 0
    }
  }

#if !OPTIMAL
  ClientLog("Starting first FSM");

  cout << pArgs.FSM1_rounds << endl;
  for (int i = 0; i < pArgs.FSM1_rounds; i++)
  {
    cout << i << " : " << (uint32_t)pArgs.FSM1_steps[i] << endl;
  }
#endif

  int l = 0;
  int smallest_number_of_bits = 0;
  for (int round = 0; round < pArgs.FSM1_rounds; round++)
  {
    uint8_t concurrent_iterations = pArgs.FSM1_steps[round];
    uint8_t all_ones_string = (uint8_t)((1 << concurrent_iterations) - 1);
    uint8_t pow_iterations = (uint8_t)((1 << concurrent_iterations));
    uint8_t pos_states = 2 * pow_iterations;

    if (l >= bits_per_component[smallest_number_of_bits])
    {
      while(l >= bits_per_component[smallest_number_of_bits])
        smallest_number_of_bits ++;
    }
    uint8_t number_of_higher_bit_entries = C - smallest_number_of_bits;
    uint8_t *choices = new uint8_t[N * number_of_higher_bit_entries * concurrent_iterations];
    
    for (int i = 0; i < N; i++)
    {
      for (int j = 0; j < number_of_higher_bit_entries; j++)
      {
          
        uint8_t postImageJ = j + C - number_of_higher_bit_entries;
        uint8_t query_bits = (query[postImageJ] >> l) & all_ones_string;
        choices[number_of_higher_bit_entries * i + j] = pow_iterations * client_states[i][postImageJ] + query_bits;
      }
    }

#if !OPTIMAL
      ClientLog("Created Choice bits");
#endif
  
      
    uint8_t *rMsg = new uint8_t[N * number_of_higher_bit_entries];
    ConstructOTReceiverMsg(rMsg, *(FSM1_RC[round]), choices, N * number_of_higher_bit_entries);

      
    SendLargePacked(socket, 1 + concurrent_iterations, N * number_of_higher_bit_entries, rMsg);

   
    uint8_t *sMsg = new uint8_t[N * number_of_higher_bit_entries * pos_states];
    ReceiveLargePacked(socket, 1, N * number_of_higher_bit_entries * pos_states, sMsg);

      
    uint8_t *msgs2 = new uint8_t[N * number_of_higher_bit_entries];
    RecoverReceiverMsg(msgs2, *(FSM1_RC[round]), choices, sMsg, N * number_of_higher_bit_entries, 1, bits_FSM1);

#if !OPTIMAL
      ClientLog("Finished One Round");
#endif
    for (int i = 0; i < N; i++)
    {
      for (int j = 0; j < number_of_higher_bit_entries; j++)
      {
        client_states[i][j + C - number_of_higher_bit_entries] = msgs2[number_of_higher_bit_entries * i + j];
      }
    }
    delete[] choices;
    delete[] msgs2;
    delete[] rMsg;
    delete[] sMsg;

    l += concurrent_iterations;
  }

#if !OPTIMAL
  ClientLog("Finished first FSM");
#endif

#if VERBOSE
  for (int i = 0; i < N; i++)
  {
    cout << "Database entry: " << i << endl;
    cout << "DB   : ";
    for (int j = 0; j < C; j++)
    {
      cout << 0 << ", ";
    }
    cout << endl;
    cout << "Query: ";
    for (int j = 0; j < C; j++)
    {
      cout << query[j] << ", ";
    }
    cout << endl;
    cout << "Equal: ";
    for (int j = 0; j < C; j++)
    {
      cout << (uint32_t)client_states[i][j] << ", ";
    }
    cout << endl;
    cout << "Actual: ";
    for (int j = 0; j < C; j++)
    {
      uint32_t value = (uint32_t)client_states[i][j];
      uint8_t accept_state = 0;

      if (accept_state == 1)
      {
        cout << value << ", ";
      }
      if (accept_state == 0)
      {
        cout << !value << ", ";
      }
    }
    cout << endl;
  }
#endif
#if !OPTIMAL
  ClientLog("Starting Second FSM");

  cout << "Finished with 1st part of OT correlation calculations" << endl;
  cout << "Setting up second FSM to compute k matches" << endl;

#endif

  uint8_t *client_k_state = new uint8_t[N];
  for (int i = 0; i < N; i++)
  {
    client_k_state[i] = 2; // default state
  }
  uint32_t c = 0;
  for (int round = 0; round < pArgs.FSM2_rounds; round++)
  {
    uint8_t round_step = pArgs.FSM2_steps[round];
    uint8_t round_factor = 1 << round_step;
    uint8_t *choices = new uint8_t[N];
    for (int i = 0; i < N; i++)
    {
      // (client state, components equal)
      uint8_t client_state_value = 0;
      for (int j = 0; j < round_step; j++)
      {
        client_state_value += client_states[i][c + j] * (1 << j);
      }
      choices[i] = round_factor * client_k_state[i] + client_state_value;

    }

#if !OPTIMAL
    ClientLog("One one rounds");
#endif


    uint8_t *rMsg = new uint8_t[N];
    ConstructOTReceiverMsg(rMsg, *(FSM2_RC[round]), choices, N);

    SendLargePacked(socket, 2 + round_step, N, rMsg);
    
#if !OPTIMAL
    cout << "Sending: " << N << endl;
#endif

    uint8_t *sMsg = new uint8_t[N * 3 * round_factor];

    ReceiveLargePacked(socket, 2, N * 3 * round_factor, sMsg);
    

    uint8_t *msgs2 = new uint8_t[N];
    RecoverReceiverMsg(msgs2, *(FSM2_RC[round]), choices, sMsg, N, 2, bits_FSM2);

    for (int i = 0; i < N; i++)
    {
      client_k_state[i] = msgs2[i];
    }

    c += round_step;

    delete[] choices;
    delete[] msgs2;
    delete[] rMsg;
    delete[] sMsg;
  }
#if !OPTIMAL
  ClientLog("Finished second FSM");
#endif
  for (int i = 0; i < N; i++)
  {
    if (client_k_state[i] > 0)
      ClientLog("found a match at index " + to_string(i));
  }

#if !OPTIMAL
  cout << "Memory clean up" << endl;
#endif

  delete[] query;
  for (int i = 0; i < N; i++)
  {
    delete[] client_states[i];
  }
  delete[] client_states;
  delete[] client_k_state;

  for (int i = 0; i < pArgs.FSM1_rounds; i++)
  {
    delete FSM1_RC[i];
  }
  delete[] FSM1_RC;

  for (int i = 0; i < pArgs.FSM2_rounds; i++)
  {
    delete FSM2_RC[i];
  }
  delete[] FSM2_RC;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x768, %rsp            # imm = 0x768
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, 0x50(%rsp)
leaq 0x368(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x39ed(%rip), %rsi      # 0x6008
leaq 0x39fe(%rip), %rdx      # 0x6020
leaq 0x358(%rsp), %rdi
callq 0x3822
leaq 0x358(%rsp), %rdi
callq 0x3064
movq 0x358(%rsp), %rdi
cmpq %r15, %rdi
je 0x264e
callq 0x2210
leaq 0x358(%rsp), %r15
movq %r15, %rdi
callq 0x22a0
movq %r15, %rdi
movq %rbx, %rsi
movl $0xc, %edx
callq 0x21d0
leaq 0x90(%rsp), %rdi
leaq 0x358(%rsp), %rsi
callq 0x48ec
leaq 0x358(%rsp), %rdi
callq 0x2080
leaq 0x560(%rsp), %rdi
callq 0x22a0
leaq 0x160(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x150(%rsp), %rdi
callq 0x3792
leaq 0x395a(%rip), %rsi      # 0x6021
leaq 0x150(%rsp), %rdi
callq 0x2450
leaq 0x560(%rsp), %rdi
leaq 0x150(%rsp), %rsi
movl $0xc, %edx
callq 0x21d0
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x2700
callq 0x2210
vmovups 0x90(%rsp), %ymm0
vmovups 0xa0(%rsp), %ymm1
leaq 0x120(%rsp), %rsi
vmovups %ymm0, (%rsi)
vmovups %ymm1, 0x10(%rsi)
leaq 0x560(%rsp), %rdi
vzeroupper
callq 0x4d54
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x49ec
vmovups 0x90(%rsp), %ymm0
vmovups 0xa0(%rsp), %ymm1
leaq 0xf0(%rsp), %rsi
vmovups %ymm1, 0x10(%rsi)
vmovups %ymm0, (%rsi)
leaq 0x560(%rsp), %rdi
vzeroupper
callq 0x4dcf
movq %rax, %r15
leaq 0xf0(%rsp), %rdi
callq 0x49ec
leaq 0x560(%rsp), %rdi
callq 0x2080
movl 0x90(%rsp), %r12d
movl 0x94(%rsp), %eax
movq %rax, 0x78(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x22a0
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %rdi
callq 0x3792
leaq 0x3841(%rip), %rsi      # 0x6029
leaq 0x58(%rsp), %rdi
callq 0x2450
movq 0x78(%rsp), %r14
leaq 0x150(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x8, %edx
callq 0x21d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2822
callq 0x2210
movq %rbx, 0x88(%rsp)
leaq 0x150(%rsp), %rdi
movl %r14d, %esi
callq 0x4e60
movq %rax, %rbp
leaq 0x150(%rsp), %rdi
callq 0x2080
leaq (,%r12,8), %rdi
callq 0x2030
movq %rax, %r13
testq %r12, %r12
je 0x288e
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x2030
movq %rax, (%r13,%rbx,8)
testq %r14, %r14
je 0x2886
xorl %eax, %eax
movq (%r13,%rbx,8), %rcx
movb $0x0, (%rcx,%rax)
incq %rax
cmpq %rax, %r14
jne 0x2875
incq %rbx
cmpq %r12, %rbx
jne 0x2861
movq %r15, 0x80(%rsp)
cmpl $0x0, 0x98(%rsp)
movq %r12, 0x28(%rsp)
je 0x2aeb
xorl %esi, %esi
xorl %r14d, %r14d
xorl %edx, %edx
movslq %edx, %rax
movq 0xc0(%rsp), %rcx
movzbl (%rcx,%rax), %ecx
cmpl %ecx, %r14d
jb 0x28dc
leal -0x1(%rax), %edx
addq 0xc0(%rsp), %rax
movzbl (%rax), %ecx
incl %edx
incq %rax
cmpl %ecx, %r14d
jae 0x28cf
movq 0xa0(%rsp), %rax
movq %rsi, 0x38(%rsp)
movzbl (%rax,%rsi), %r15d
movq 0x78(%rsp), %rax
movl %edx, 0x44(%rsp)
subl %edx, %eax
movzbl %al, %ebx
movl %ebx, %eax
imull %r12d, %eax
movl %eax, 0x18(%rsp)
movl %eax, %edi
imull %r15d, %edi
callq 0x2030
movq %rax, 0x10(%rsp)
movq %r12, %rax
movl %ebx, 0x20(%rsp)
movl %ebx, %r12d
testq %rax, %rax
je 0x2986
movl $0x1, %eax
shlxl %r15d, %eax, %eax
addl $0xff, %eax
movl 0x44(%rsp), %ecx
movq 0x10(%rsp), %rdx
xorl %esi, %esi
cmpl $0x0, 0x20(%rsp)
je 0x2979
movq (%r13,%rsi,8), %rdi
xorl %r8d, %r8d
leal (%rcx,%r8), %r9d
movzbl %r9b, %r9d
shrxl %r14d, (%rbp,%r9,4), %r10d
andl %eax, %r10d
movzbl (%rdi,%r9), %r9d
shlxl %r15d, %r9d, %r9d
addl %r10d, %r9d
movb %r9b, (%rdx,%r8)
incq %r8
cmpq %r8, %r12
jne 0x294e
incq %rsi
addq %r12, %rdx
cmpq 0x28(%rsp), %rsi
jne 0x293f
movl 0x18(%rsp), %edi
movq %rdi, 0x30(%rsp)
callq 0x2030
movq %rax, %rbx
movq 0x88(%rsp), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq %rbx, %rdi
movq 0x10(%rsp), %rdx
movl 0x18(%rsp), %ecx
callq 0x3f22
leal 0x1(%r15), %eax
movzbl %al, %esi
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x4fff
movq %rbx, 0xc8(%rsp)
movl $0x2, %eax
shlxl %r15d, %eax, %ebx
andl $0xfe, %ebx
imull 0x18(%rsp), %ebx
movq %rbx, %rdi
callq 0x2030
movq 0x50(%rsp), %rdi
movl $0x1, %esi
movq %rbx, %rdx
movq %rax, %rcx
movq %rax, %rbx
callq 0x50d9
movq %rbx, %rax
movq %rax, 0x48(%rsp)
movq 0x30(%rsp), %rdi
callq 0x2030
movq %rax, %rbx
movq 0x88(%rsp), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x4, (%rsp)
movq %rbx, %rdi
movq 0x10(%rsp), %rdx
movq 0x48(%rsp), %rcx
movl 0x18(%rsp), %r8d
movl $0x1, %r9d
callq 0x4055
cmpq $0x0, 0x28(%rsp)
je 0x2a9e
movq 0x78(%rsp), %rax
subl 0x20(%rsp), %eax
movq %rbx, %rcx
xorl %edx, %edx
cmpl $0x0, 0x20(%rsp)
je 0x2a91
xorl %esi, %esi
movb (%rcx,%rsi), %dil
movq (%r13,%rdx,8), %r8
leal (%rax,%rsi), %r9d
movb %dil, (%r8,%r9)
incq %rsi
cmpq %rsi, %r12
jne 0x2a78
incq %rdx
addq %r12, %rcx
cmpq 0x28(%rsp), %rdx
jne 0x2a6f
movq 0x10(%rsp), %rdi
callq 0x2300
movq %rbx, %rdi
callq 0x2300
movq 0xc8(%rsp), %rdi
callq 0x2300
movq 0x48(%rsp), %rdi
callq 0x2300
addl %r15d, %r14d
movq 0x38(%rsp), %rsi
incq %rsi
movl 0x98(%rsp), %eax
cmpq %rax, %rsi
movq 0x28(%rsp), %r12
movl 0x44(%rsp), %edx
jb 0x28b0
movq %r12, %rdi
callq 0x2030
movq %rax, %rbx
testq %r12, %r12
je 0x2b0b
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x2140
cmpl $0x0, 0x9c(%rsp)
movq %rbx, 0x10(%rsp)
je 0x2cb8
leal (%r12,%r12,2), %eax
movl %eax, 0x48(%rsp)
xorl %ecx, %ecx
movl $0x0, 0x30(%rsp)
movq 0xa8(%rsp), %rax
movq %rcx, 0x20(%rsp)
movzbl (%rax,%rcx), %r15d
movq %r12, %rdi
callq 0x2030
movq %rax, %r14
testq %r12, %r12
je 0x2b9f
movl %r15d, %eax
movl 0x30(%rsp), %ecx
xorl %edx, %edx
testl %r15d, %r15d
je 0x2b85
movq (%r13,%rdx,8), %rdi
xorl %r8d, %r8d
xorl %esi, %esi
leal (%rcx,%r8), %r9d
movzbl (%rdi,%r9), %r9d
shlxl %r8d, %r9d, %r9d
addb %r9b, %sil
incq %r8
cmpq %r8, %rax
jne 0x2b6a
jmp 0x2b87
xorl %esi, %esi
movzbl (%rbx,%rdx), %edi
shlxl %r15d, %edi, %edi
addb %sil, %dil
movb %dil, (%r14,%rdx)
incq %rdx
cmpq %r12, %rdx
jne 0x2b5b
movq %r12, %rdi
callq 0x2030
movq %rax, %rbx
movq 0x80(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl %r12d, %ecx
callq 0x3f22
leal 0x2(%r15), %eax
movzbl %al, %esi
movq 0x50(%rsp), %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x4fff
movq %rbx, 0x38(%rsp)
movl $0x1, %eax
shlxl %r15d, %eax, %eax
movzbl %al, %ebx
imull 0x48(%rsp), %ebx
movq %rbx, %rdi
callq 0x2030
movq %rax, %r12
movq 0x50(%rsp), %rdi
movl $0x2, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x50d9
movq %r12, 0x18(%rsp)
movq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %rbx
movq 0x80(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x6, (%rsp)
movq %rbx, %rdi
movq %r14, %rdx
movq 0x18(%rsp), %rcx
movl %r12d, %r8d
movl $0x2, %r9d
callq 0x4055
testq %r12, %r12
je 0x2c72
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x21b0
addl %r15d, 0x30(%rsp)
movq %r14, %rdi
callq 0x2300
movq %rbx, %rdi
callq 0x2300
movq 0x38(%rsp), %rdi
callq 0x2300
movq 0x18(%rsp), %rdi
callq 0x2300
movq 0x20(%rsp), %rcx
incq %rcx
movl 0x9c(%rsp), %eax
cmpq %rax, %rcx
movq 0x10(%rsp), %rbx
jb 0x2b30
testq %r12, %r12
je 0x2e17
xorl %r14d, %r14d
leaq 0xd0(%rsp), %r15
movl $0xd1b71759, %edx       # imm = 0xD1B71759
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax,%r14)
je 0x2e0b
movl $0x1, %r12d
cmpq $0xa, %r14
jb 0x2d2f
movl $0x4, %r12d
movl %r14d, %eax
cmpl $0x63, %eax
jbe 0x2d26
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2d2c
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2d2f
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2cf6
addl $-0x3, %r12d
jmp 0x2d2f
addl $-0x2, %r12d
jmp 0x2d2f
decl %r12d
movl %r12d, %esi
leaq 0xe0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq %r15, %rdi
movl $0x2d, %edx
callq 0x22d0
movq 0xd0(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x3724
movl $0x17, %r8d
movq %r15, %rbx
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x32ba(%rip), %rcx      # 0x6033
callq 0x2290
leaq 0x68(%rsp), %rsi
movq %rsi, 0x58(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq 0x28(%rsp), %r12
je 0x2dab
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x2db3
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x58(%rsp), %rdi
callq 0x3064
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2de9
callq 0x2210
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x2e03
callq 0x2210
movq %rbx, %r15
movl $0xd1b71759, %edx       # imm = 0xD1B71759
incq %r14
cmpq %r12, %r14
jne 0x2cd1
testq %rbp, %rbp
je 0x2e24
movq %rbp, %rdi
callq 0x2300
testq %r12, %r12
movq 0x80(%rsp), %r15
je 0x2e4a
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2e42
callq 0x2300
incq %rbx
cmpq %rbx, %r12
jne 0x2e33
movq %r13, %rdi
callq 0x2300
movq 0x10(%rsp), %rdi
callq 0x2300
cmpl $0x0, 0x98(%rsp)
movq 0x88(%rsp), %r12
je 0x2e99
xorl %r14d, %r14d
movq (%r12,%r14,8), %rbx
testq %rbx, %rbx
je 0x2e8a
movq %rbx, %rdi
callq 0x3d42
movq %rbx, %rdi
callq 0x2210
incq %r14
movl 0x98(%rsp), %eax
cmpq %rax, %r14
jb 0x2e71
testq %r12, %r12
je 0x2ea6
movq %r12, %rdi
callq 0x2300
cmpl $0x0, 0x9c(%rsp)
je 0x2edb
xorl %r14d, %r14d
movq (%r15,%r14,8), %rbx
testq %rbx, %rbx
je 0x2ecc
movq %rbx, %rdi
callq 0x3d42
movq %rbx, %rdi
callq 0x2210
incq %r14
movl 0x9c(%rsp), %eax
cmpq %rax, %r14
jb 0x2eb3
testq %r15, %r15
je 0x2ee8
movq %r15, %rdi
callq 0x2300
leaq 0x150(%rsp), %rdi
callq 0x20a0
leaq 0x560(%rsp), %rdi
callq 0x20a0
leaq 0x90(%rsp), %rdi
callq 0x49ec
leaq 0x358(%rsp), %rdi
callq 0x20a0
addq $0x768, %rsp            # imm = 0x768
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3025
jmp 0x3025
jmp 0x2f3a
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
jmp 0x3009
jmp 0x3025
jmp 0x2f97
jmp 0x2f97
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x2f6d
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x49ec
jmp 0x3035
jmp 0x2f79
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x3035
callq 0x2210
jmp 0x3035
movq %rax, %rbx
jmp 0x3035
jmp 0x2fa1
movq %rax, %rbx
jmp 0x3042
jmp 0x2fab
movq %rax, %rbx
jmp 0x304f
movq %rax, %rbx
movq 0x358(%rsp), %rdi
cmpq %r15, %rdi
je 0x305c
callq 0x2210
jmp 0x305c
movq %rax, %rbx
jmp 0x305c
jmp 0x3025
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2ff9
callq 0x2210
jmp 0x2ff9
jmp 0x3025
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x3028
callq 0x2210
jmp 0x3028
jmp 0x3025
jmp 0x3025
jmp 0x3025
jmp 0x3025
jmp 0x3025
jmp 0x3025
jmp 0x3025
jmp 0x3025
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x20a0
leaq 0x560(%rsp), %rdi
callq 0x20a0
leaq 0x90(%rsp), %rdi
callq 0x49ec
leaq 0x358(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2400