// File: /workspace/github_c_makefile_star2_O3/stfwi[P]duktape-cc/build/duktape/mod/ext/app_attachment/././app_attachment.hh
// Function: int sw::util::detail::basic_executable_attachment<void>::patch_application<void>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
static inline int patch_application(std::string path, bool verbose=false, std::string attachment_contents="")
    {
      using namespace std;

      // hexdump
      auto hexdump = [](const vector<char>& data, std::ostream& os) {
        size_t n = 0;
        for(auto e:data) {
          if(!(n & 63)) os << "\n" << hex << setw(8) << setfill('0') << n << ": ";
          os << hex << setw(2) << setfill('0') << ((int)(e&0xff));
          ++n;
        }
        os << dec << "\n";
      };

      // file size using stat to double check later read
      size_t filesize = 0;
      {
        struct ::stat st;
        if(::stat(path.c_str(), &st) != 0) {
          cerr << "stat failed for " << path << "\n";
          return 1;
        } else {
          filesize = st.st_size;
          if(verbose) {
            cerr << "File size: " << dec << ((long)filesize) << " (0x" << hex << ((long)filesize) << ")\n";
          }
        }
      }

      // same placeholder as in the application
      vector<char> reverse_boundary_key(256);
      std::copy_n(
        basic_executable_attachment<void>::boundary_marker,
        sizeof(basic_executable_attachment<void>::boundary_marker),
        reverse_boundary_key.begin()
      );

      if(verbose) {
        cerr << "----------------------\n";
        cerr << "reverse_boundary_key:\n";
        hexdump(reverse_boundary_key, cerr);
        cerr << "----------------------\n";
      }

      // Read whole application
      vector<char> contents;
      {
        std::ifstream fis(path.c_str(), std::ios::in|std::ios::binary);
        contents.assign((std::istreambuf_iterator<char>(fis)), std::istreambuf_iterator<char>());
        if(contents.size() != filesize) {
          cerr << "file size mismatch\n"
              << "- file size : " << filesize << "\n"
              << "- file size read: " << contents.size() << "\n";
          return 1;
        }
      }

      if(verbose) {
        std::ofstream fos((path+".unpatched.tmp").c_str(), std::ios::out|std::ios::binary);
        hexdump(contents, fos);
        fos.close();
      }

      // Fill up the file until it has 4k size (app checks the start of each read 4k block to save time).
      while((contents.size() & (4095u)) != 0) contents.push_back(0);
      if(verbose) cerr << "File size after alignment fill: " << dec << ((long)contents.size()) << " (0x" << hex << ((long)contents.size()) << ")\n";

      // Find placeholder
      auto key_patch_position_it = std::search(contents.begin(), contents.end(), reverse_boundary_key.begin(), reverse_boundary_key.end());
      {
        if(key_patch_position_it == contents.end()) {
          cerr << "reverse boundary placeholder not found\n";
          return 1;
        }
        if(verbose) {
          size_t pos = static_cast<size_t>(key_patch_position_it - contents.begin()) / sizeof(decltype(contents)::iterator::difference_type);
          cerr << "Boundary placeholder at: " << pos << "\n";
        }
      }

      // Make random boundary key, check that it is unique in the whole file.
      vector<char> patch_key;
      {
        int retries = 10;
        const std::string ofs = std::string("[<") + std::to_string(long(contents.size())) + ">]";
        while(--retries) {
          patch_key.clear();
          patch_key.reserve(reverse_boundary_key.size());
          default_random_engine rd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
          mt19937 mt(rd());
          uniform_int_distribution<char> db(33, 124);
          while(patch_key.size() < reverse_boundary_key.size()) patch_key.push_back(char(db(mt)));
          reverse(patch_key.begin(), patch_key.end());
          std::copy(ofs.begin(), ofs.end(), patch_key.begin());
          auto check_it = std::search(contents.begin(), contents.end(), patch_key.begin(), patch_key.end());
          auto check_sym = patch_key;
          reverse(check_sym.begin(), check_sym.end());
          if((check_it == contents.end()) && (check_sym != patch_key)) break;
        }
        if(!retries) {
          cerr << "failed to generate collisionless boundary\n";
          return 1;
        }
        if(verbose) {
          cerr << "----------------------\n";
          cerr << "patch key:'" << ofs << "'\n";
          hexdump(patch_key, cerr);
          cerr << "----------------------\n";
        }
      }
      // Patch the placeholder position with the generated key.
      std::copy_n(patch_key.begin(), patch_key.size(), key_patch_position_it);
      // Reverse the key and write it at the end.
      reverse(patch_key.begin(), patch_key.end());
      for(auto e:patch_key) contents.push_back(e);
      if(verbose) cerr << "File size after adding the boundary: " << dec << ((long)contents.size()) << " (0x" << hex << ((long)contents.size()) << ")\n";
      std::ofstream fos(path.c_str(), ofstream::out|ofstream::binary);
      if(!fos.write(contents.data(), contents.size())) { cerr << "failed to write file\n" ; return 1; }
      if(verbose) {
        std::ofstream dump_fos((path+".patched.tmp").c_str(), std::ios::out|std::ios::binary);
        hexdump(contents, dump_fos);
        dump_fos.close();
      }
      if(!attachment_contents.empty()) {
        if(verbose) cerr << "[verb] Attaching " << long(attachment_contents.size()>>10) << "kb data ...\n";
        reverse(patch_key.begin(), patch_key.end());
        const auto wdata = basic_executable_attachment<void>::serialize<vector<char>, string>(attachment_contents, patch_key.data());
        copy(wdata.begin(), wdata.end(), ostreambuf_iterator<char>(fos));
      }
      return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1668, %rsp           # imm = 0x1668
movq %rdx, %r15
movl %esi, %r13d
movq %rdi, %r12
movq (%rdi), %rdi
leaq -0x1688(%rbp), %rsi
callq 0x2140
testl %eax, %eax
je 0x2be6
movq 0x644d(%rip), %rbx      # 0x8ff0
leaq 0x352b(%rip), %rsi      # 0x60d5
movl $0x10, %edx
movq %rbx, %rdi
callq 0x21c0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x21c0
leaq 0x3493(%rip), %rsi      # 0x6062
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
movl $0x1, %ebx
jmp 0x3b02
movq -0x1658(%rbp), %rbx
testb %r13b, %r13b
je 0x2c80
movq 0x63f3(%rip), %r14      # 0x8ff0
leaq 0x34e2(%rip), %rsi      # 0x60e6
movl $0xb, %edx
movq %r14, %rdi
callq 0x21c0
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2150
movq %rax, %r14
leaq 0x34b5(%rip), %rsi      # 0x60f2
movl $0x4, %edx
movq %rax, %rdi
callq 0x21c0
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2150
leaq 0x3484(%rip), %rsi      # 0x60f7
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
movl $0x100, %edi            # imm = 0x100
callq 0x2170
movq %rax, -0xa8(%rbp)
leaq 0x100(%rax), %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, -0xa0(%rbp)
leaq 0x3613(%rip), %rsi      # 0x62c0
movl $0x100, %edx            # imm = 0x100
movq %rax, %rdi
callq 0x2110
testb %r13b, %r13b
je 0x2d1e
movq 0x632a(%rip), %rdi      # 0x8ff0
leaq 0x342d(%rip), %rsi      # 0x60fa
movl $0x17, %edx
callq 0x21c0
movq 0x6312(%rip), %rdi      # 0x8ff0
leaq 0x342d(%rip), %rsi      # 0x6112
movl $0x16, %edx
callq 0x21c0
movq 0x62fa(%rip), %rdx      # 0x8ff0
leaq -0x29(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x48fa
movq 0x62e3(%rip), %rdi      # 0x8ff0
leaq 0x33e6(%rip), %rsi      # 0x60fa
movl $0x17, %edx
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq (%r12), %rsi
leaq -0x1688(%rbp), %rdi
movl $0xc, %edx
callq 0x2290
movq -0x1688(%rbp), %rax
movq -0x18(%rax), %rax
movq -0x15a0(%rbp,%rax), %rsi
leaq -0x50(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x4b00
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
cmpq %rbx, %rax
jne 0x3076
leaq -0x1688(%rbp), %rdi
callq 0x2050
testb %r13b, %r13b
je 0x2e56
leaq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
movq %rax, (%rdi)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
callq 0x3ece
leaq 0x33a5(%rip), %rsi      # 0x615f
leaq -0x300(%rbp), %rdi
callq 0x22a0
movq -0x300(%rbp), %rsi
leaq -0x1688(%rbp), %rdi
movl $0x14, %edx
callq 0x21a0
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x2e00
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x29(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x1688(%rbp), %rdx
callq 0x48fa
leaq -0x1688(%rbp), %rdi
callq 0x21f0
movq 0x61a9(%rip), %rax      # 0x8fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x1680(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x1688(%rbp,%rcx)
callq 0x2120
leaq -0x1590(%rbp), %rdi
callq 0x2090
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl %esi, %eax
subl %edi, %eax
testl $0xfff, %eax            # imm = 0xFFF
je 0x2eaf
leaq -0x50(%rbp), %rbx
leaq -0x1688(%rbp), %r14
movb $0x0, -0x1688(%rbp)
cmpq -0x40(%rbp), %rsi
je 0x2e91
movb $0x0, (%rsi)
movq -0x48(%rbp), %rsi
incq %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2ea0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x50b2
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdi
movl %esi, %eax
subl %edi, %eax
testl $0xfff, %eax            # imm = 0xFFF
jne 0x2e74
testb %r13b, %r13b
je 0x2f50
movq 0x6131(%rip), %rbx      # 0x8ff0
leaq 0x32a8(%rip), %rsi      # 0x616e
movl $0x20, %edx
movq %rbx, %rdi
callq 0x21c0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x31f0(%rip), %rsi      # 0x60f2
movl $0x4, %edx
movq %rax, %rdi
callq 0x21c0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2150
leaq 0x31bc(%rip), %rsi      # 0x60f7
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xa0(%rbp), %rcx
callq 0x5556
movq %rax, %r14
cmpq -0x48(%rbp), %rax
je 0x311a
testb %r13b, %r13b
je 0x2fbb
movq -0x50(%rbp), %rbx
movq 0x6070(%rip), %rdi      # 0x8ff0
leaq 0x3230(%rip), %rsi      # 0x61b7
movl $0x19, %edx
callq 0x21c0
movq %r14, %rsi
subq %rbx, %rsi
shrq $0x3, %rsi
movq 0x604e(%rip), %rdi      # 0x8ff0
callq 0x20e0
leaq 0x30b4(%rip), %rsi      # 0x6062
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
movq %r14, -0xe8(%rbp)
movq %r15, -0xb0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x31ea(%rip), %rsi      # 0x61d1
leaq 0x31e5(%rip), %rdx      # 0x61d3
leaq -0x90(%rbp), %rdi
callq 0x3f6c
movq -0x48(%rbp), %rbx
subq -0x50(%rbp), %rbx
movq %rbx, %r14
negq %r14
cmovsq %rbx, %r14
movl $0x1, %r15d
cmpq $0xa, %r14
jb 0x3145
movl $0x4, %r15d
movabsq $0x346dc5d63886594b, %rsi # imm = 0x346DC5D63886594B
movq %r14, %rcx
cmpq $0x63, %rcx
jbe 0x313c
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x3142
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x3145
movq %rcx, %rax
mulq %rsi
shrq $0xb, %rdx
addl $0x4, %r15d
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x302f
addl $-0x3, %r15d
jmp 0x3145
movq 0x5f73(%rip), %rdi      # 0x8ff0
leaq 0x30a5(%rip), %rsi      # 0x6129
movl $0x13, %edx
callq 0x21c0
movq 0x5f5b(%rip), %rdi      # 0x8ff0
leaq 0x30a1(%rip), %rsi      # 0x613d
movl $0xe, %edx
callq 0x21c0
movq 0x5f43(%rip), %rdi      # 0x8ff0
movq %rbx, %rsi
callq 0x20e0
movq %rax, %rbx
leaq 0x2fa3(%rip), %rsi      # 0x6062
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
leaq 0x3079(%rip), %rsi      # 0x614c
movl $0x12, %edx
movq %rbx, %rdi
callq 0x21c0
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x20e0
leaq 0x2f6b(%rip), %rsi      # 0x6062
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
leaq -0x1688(%rbp), %rdi
callq 0x2050
movl $0x1, %ebx
jmp 0x3ad2
movl $0x1, %ebx
movq 0x5eca(%rip), %rdi      # 0x8ff0
leaq 0x3062(%rip), %rsi      # 0x618f
movl $0x27, %edx
callq 0x21c0
jmp 0x3ad2
addl $-0x2, %r15d
jmp 0x3145
decl %r15d
movq %r12, -0xf0(%rbp)
shrq $0x3f, %rbx
leal (%rbx,%r15), %esi
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq -0xd8(%rbp), %rdi
movl $0x2d, %edx
callq 0x21d0
addq -0xd8(%rbp), %rbx
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x567f
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %r8
movq -0xd0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
leaq -0x80(%rbp), %rsi
cmpq %rsi, %rcx
je 0x31b1
movq -0x80(%rbp), %rdi
movq -0xd8(%rbp), %rsi
cmpq %rdi, %rax
jbe 0x31d3
movl $0xf, %edi
cmpq %r12, %rsi
je 0x31ce
movq -0xc8(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x31e1
leaq -0x90(%rbp), %rdi
callq 0x2080
jmp 0x31f1
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21b0
leaq -0x1678(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x321b
movq %rsi, -0x1688(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x1678(%rbp)
jmp 0x3221
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x1680(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x2f8d(%rip), %rsi      # 0x61d4
leaq -0x1688(%rbp), %rdi
callq 0x22a0
leaq -0x2f0(%rbp), %rsi
movq %rsi, -0x300(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3283
movq %rdx, -0x300(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x2f0(%rbp)
jmp 0x3289
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x2f8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x1678(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x32c2
movq -0x1678(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x32dd
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x32f9
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
movl $0xa, %r12d
leaq 0x2ed1(%rip), %rax      # 0x61d7
movq %rax, -0xe0(%rbp)
leaq -0x70(%rbp), %r14
leaq -0x90(%rbp), %rbx
movl %r13d, -0xb4(%rbp)
decl %r12d
je 0x35bb
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0x3336
movq %rax, -0x68(%rbp)
movq -0xa0(%rbp), %rsi
subq -0xa8(%rbp), %rsi
movq %r14, %rdi
callq 0x4a5c
callq 0x2030
movq %rax, %rcx
movabsq $0x200000005, %rdx      # imm = 0x200000005
mulq %rdx
movq %rcx, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x1e, %rax
movq %rax, %rdx
shlq $0x1f, %rdx
subq %rdx, %rax
leaq (%rcx,%rax), %rdx
cmpq $0x1, %rdx
adcq %rcx, %rax
imulq $0x41a7, %rax, %rcx     # imm = 0x41A7
movq %rcx, %rax
movabsq $0x400000008001, %rdx   # imm = 0x400000008001
mulq %rdx
shrl $0xd, %edx
movq %rdx, %rax
shlq $0x1f, %rax
subq %rax, %rdx
addq %rcx, %rdx
movq %rdx, -0x1688(%rbp)
movl $0x1, %eax
movq %rdx, %rcx
shrq $0x1e, %rcx
xorl %edx, %ecx
imull $0x6c078965, %ecx, %edx # imm = 0x6C078965
addl %eax, %edx
movq %rdx, -0x1688(%rbp,%rax,8)
incq %rax
cmpq $0x270, %rax            # imm = 0x270
jne 0x33b9
movq $0x270, -0x308(%rbp) # imm = 0x270
movw $0x7c21, -0x90(%rbp)    # imm = 0x7C21
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rax
movq %rax, %rcx
subq %rdx, %rcx
movq -0xa0(%rbp), %rsi
subq -0xa8(%rbp), %rsi
cmpq %rsi, %rcx
jae 0x345c
movq %rbx, %rdi
leaq -0x1688(%rbp), %rsi
movq %rbx, %rdx
callq 0x5700
movb %al, -0xd8(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x3443
movb %al, (%rsi)
movq -0x68(%rbp), %rax
incq %rax
movq %rax, -0x68(%rbp)
jmp 0x3456
movq %r14, %rdi
leaq -0xd8(%rbp), %rdx
callq 0x50b2
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rdx
jmp 0x33f9
cmpq %rax, %rdx
setne %cl
decq %rax
cmpq %rdx, %rax
seta %sil
andb %cl, %sil
cmpb $0x1, %sil
jne 0x3497
incq %rdx
movb -0x1(%rdx), %cl
movb (%rax), %sil
movb %sil, -0x1(%rdx)
movb %cl, (%rax)
decq %rax
leaq 0x1(%rdx), %rcx
cmpq %rax, %rdx
movq %rcx, %rdx
jb 0x3478
movq -0x70(%rbp), %rdx
movq -0x2f8(%rbp), %rax
testq %rax, %rax
je 0x34b9
movq -0x300(%rbp), %rsi
movq %rdx, %rdi
movq %rax, %rdx
callq 0x2240
movq -0x70(%rbp), %rdx
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x68(%rbp), %rcx
callq 0x5556
movq %rax, -0x100(%rbp)
movq -0x70(%rbp), %r13
movq -0x68(%rbp), %r14
movq %r14, %rdi
subq %r13, %rdi
movl %r12d, -0xb8(%rbp)
movq %rdi, -0xf8(%rbp)
je 0x350d
js 0x3b16
callq 0x2170
movq %rax, %r15
movq -0x70(%rbp), %r13
movq -0x68(%rbp), %r14
movq %r14, %r12
subq %r13, %r12
jmp 0x3513
movq %rdi, %r12
xorl %r15d, %r15d
cmpq %r13, %r14
je 0x3526
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2240
cmpq %r13, %r14
je 0x3556
leaq (%r15,%r12), %rax
decq %rax
cmpq %r15, %rax
jbe 0x3556
leaq 0x1(%r15), %rcx
movb -0x1(%rcx), %dl
movb (%rax), %sil
movb %sil, -0x1(%rcx)
movb %dl, (%rax)
decq %rax
leaq 0x1(%rcx), %rdx
cmpq %rax, %rcx
movq %rdx, %rcx
jb 0x353b
movq -0x100(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x3568
movb $0x1, %r14b
jmp 0x3574
movq -0x70(%rbp), %rsi
cmpq %r13, %rsi
je 0x35a5
xorl %r14d, %r14d
testq %r15, %r15
movl -0xb4(%rbp), %r13d
movl -0xb8(%rbp), %r12d
je 0x3596
movq %r15, %rdi
movq -0xf8(%rbp), %rsi
callq 0x2180
testb %r14b, %r14b
leaq -0x70(%rbp), %r14
jne 0x331f
jmp 0x35c5
cmpq %r13, %r14
je 0x3563
movq %r15, %rdi
movq %r12, %rdx
callq 0x2190
testl %eax, %eax
jne 0x3571
jmp 0x3563
movl $0x2a, %ebx
jmp 0x364c
testb %r13b, %r13b
je 0x3662
movq 0x5a1b(%rip), %rdi      # 0x8ff0
leaq 0x2b1e(%rip), %rsi      # 0x60fa
movl $0x17, %edx
movq %rsi, -0xe0(%rbp)
callq 0x21c0
movq 0x59fc(%rip), %rdi      # 0x8ff0
leaq 0x2c07(%rip), %rsi      # 0x6202
movl $0xb, %edx
callq 0x21c0
movq -0x300(%rbp), %rsi
movq -0x2f8(%rbp), %rdx
movq 0x59d6(%rip), %rdi      # 0x8ff0
callq 0x21c0
leaq 0x2a3b(%rip), %rsi      # 0x6061
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
movl $0x17, %ebx
movq 0x59b1(%rip), %rdx      # 0x8ff0
leaq -0x29(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x48fa
movq 0x599d(%rip), %rdi      # 0x8ff0
movq -0xe0(%rbp), %rsi
movq %rbx, %rdx
callq 0x21c0
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x3684
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x70(%rbp), %r14
testl %r12d, %r12d
je 0x382b
movq -0x68(%rbp), %r12
movq %r12, %rdx
subq %r14, %rdx
je 0x36b4
movq -0xe8(%rbp), %rdi
movq %r14, %rsi
callq 0x2240
movq -0x70(%rbp), %r14
movq -0x68(%rbp), %r12
cmpq %r12, %r14
setne %cl
leaq -0x1(%r12), %rax
cmpq %r14, %rax
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x36f2
incq %r14
movb -0x1(%r14), %cl
movb (%rax), %dl
movb %dl, -0x1(%r14)
movb %cl, (%rax)
decq %rax
leaq 0x1(%r14), %rcx
cmpq %rax, %r14
movq %rcx, %r14
jb 0x36cf
movq -0x70(%rbp), %r14
movq -0x68(%rbp), %r12
cmpq %r12, %r14
je 0x3730
leaq -0x50(%rbp), %rbx
leaq -0x1688(%rbp), %r15
movb (%r14), %al
movb %al, -0x1688(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x371d
movb %al, (%rsi)
incq -0x48(%rbp)
jmp 0x3728
movq %rbx, %rdi
movq %r15, %rdx
callq 0x593c
incq %r14
cmpq %r12, %r14
jne 0x3702
testb %r13b, %r13b
je 0x37c9
movq 0x58b0(%rip), %rbx      # 0x8ff0
leaq 0x2ac7(%rip), %rsi      # 0x620e
movl $0x25, %edx
movq %rbx, %rdi
callq 0x21c0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x296f(%rip), %rsi      # 0x60f2
movl $0x4, %edx
movq %rax, %rdi
callq 0x21c0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2150
leaq 0x293b(%rip), %rsi      # 0x60f7
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
movq -0xf0(%rbp), %rbx
movq (%rbx), %rsi
leaq -0x1688(%rbp), %rdi
movl $0x14, %edx
callq 0x21a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
subq %rsi, %rdx
leaq -0x1688(%rbp), %rdi
callq 0x21e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x3835
movl $0x1, %ebx
movq 0x57db(%rip), %rdi      # 0x8ff0
leaq 0x2a18(%rip), %rsi      # 0x6234
movl $0x15, %edx
callq 0x21c0
jmp 0x3a84
movl $0x1, %ebx
jmp 0x3abe
testb %r13b, %r13b
je 0x3956
leaq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
movq %rax, (%rdi)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
callq 0x3ece
movq -0xb0(%rbp), %rbx
leaq 0x29e1(%rip), %rsi      # 0x624a
leaq -0x90(%rbp), %rdi
callq 0x22a0
movq -0x90(%rbp), %rsi
leaq -0x300(%rbp), %rdi
movl $0x14, %edx
callq 0x21a0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x38a9
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x29(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x300(%rbp), %rdx
callq 0x48fa
leaq -0x300(%rbp), %rdi
callq 0x21f0
movq 0x5700(%rip), %rax      # 0x8fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2f8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x300(%rbp,%rcx)
callq 0x2120
leaq -0x208(%rbp), %rdi
callq 0x2090
cmpq $0x0, 0x8(%rbx)
je 0x3a82
movq 0x56df(%rip), %rdi      # 0x8ff0
leaq 0x293f(%rip), %rsi      # 0x6257
movl $0x11, %edx
callq 0x21c0
movq -0xb0(%rbp), %rax
leaq 0x8(%rax), %r15
movq (%r15), %rsi
shrq $0xa, %rsi
movq 0x56b5(%rip), %rdi      # 0x8ff0
callq 0x2150
leaq 0x2922(%rip), %rsi      # 0x6269
movl $0xc, %edx
movq %rax, %rdi
callq 0x21c0
jmp 0x396c
movq -0xb0(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3a82
leaq 0x8(%rax), %r15
movq -0x70(%rbp), %r12
movq -0x68(%rbp), %rax
cmpq %rax, %r12
setne %cl
decq %rax
cmpq %r12, %rax
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x39af
incq %r12
movb -0x1(%r12), %cl
movb (%rax), %dl
movb %dl, -0x1(%r12)
movb %cl, (%rax)
decq %rax
leaq 0x1(%r12), %rcx
cmpq %rax, %r12
movq %rcx, %r12
jb 0x398d
movq -0x70(%rbp), %r12
xorps %xmm0, %xmm0
leaq -0x300(%rbp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%r15), %rsi
callq 0x4a5c
cmpq $0x0, (%r15)
je 0x3a2d
xorl %r13d, %r13d
leaq -0x300(%rbp), %rbx
leaq -0x90(%rbp), %r14
movzbl %r13b, %eax
movb (%r12,%rax), %al
movq -0xb0(%rbp), %rcx
movq (%rcx), %rcx
xorb (%rcx,%r13), %al
movb %al, -0x90(%rbp)
movq -0x2f8(%rbp), %rsi
cmpq -0x2f0(%rbp), %rsi
je 0x3a1a
movb %al, (%rsi)
incq -0x2f8(%rbp)
jmp 0x3a25
movq %rbx, %rdi
movq %r14, %rdx
callq 0x50b2
incq %r13
cmpq (%r15), %r13
jb 0x39e3
movq -0x300(%rbp), %rax
movq -0x2f8(%rbp), %rdx
subq %rax, %rdx
testq %rdx, %rdx
jle 0x3a6b
movq -0x1688(%rbp), %rcx
movq -0x18(%rcx), %rcx
movq -0x15a0(%rbp,%rcx), %rdi
testq %rdi, %rdi
je 0x3a6b
movq (%rdi), %rcx
movq %rax, %rsi
callq *0x60(%rcx)
movq -0x300(%rbp), %rax
testq %rax, %rax
je 0x3a82
movq -0x2f0(%rbp), %rsi
subq %rax, %rsi
movq %rax, %rdi
callq 0x2180
xorl %ebx, %ebx
movq 0x5545(%rip), %rax      # 0x8fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x1680(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x1688(%rbp,%rcx)
callq 0x2120
leaq -0x1590(%rbp), %rdi
callq 0x2090
movq -0x70(%rbp), %r14
testq %r14, %r14
je 0x3ad2
movq -0x60(%rbp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3ae7
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x3b02
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movl %ebx, %eax
addq $0x1668, %rsp           # imm = 0x1668
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x20a0
jmp 0x3bfe
jmp 0x3b22
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x3c21
movq -0x80(%rbp), %rsi
incq %rsi
jmp 0x3c17
jmp 0x3c1e
jmp 0x3bfe
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x2210
jmp 0x3c21
jmp 0x3c4c
jmp 0x3b6a
movq %rax, %rbx
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x3cae
movq -0x2f0(%rbp), %rsi
incq %rsi
jmp 0x3ca9
jmp 0x3c58
movq %rax, %rbx
leaq -0x1678(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bbf
movq -0x1678(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x3bbf
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x3bdf
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x3bdf
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x3c99
movq -0x80(%rbp), %rsi
jmp 0x3c91
jmp 0x3c4c
movq %rax, %rbx
movq -0x300(%rbp), %rdi
testq %rdi, %rdi
je 0x3c21
movq -0x2f0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0x3c21
movq %rax, %rbx
leaq -0x1688(%rbp), %rdi
callq 0x2210
jmp 0x3c99
jmp 0x3c58
jmp 0x3c4c
movq %rax, %rbx
leaq -0x1688(%rbp), %rdi
callq 0x2210
jmp 0x3cae
jmp 0x3c74
jmp 0x3c58
jmp 0x3c58
jmp 0x3c58
movq %rax, %rbx
jmp 0x3c99
movq %rax, %rbx
jmp 0x3cc3
jmp 0x3c74
movq %rax, %rbx
jmp 0x3cae
movq %rax, %rbx
leaq -0x1688(%rbp), %rdi
callq 0x2050
jmp 0x3cae
jmp 0x3c74
jmp 0x3c74
jmp 0x3c74
movq %rax, %rbx
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x3c99
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x3cae
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3cc3
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x3cde
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq %rbx, %rdi
callq 0x2270