// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_link
void xlink_binary_link(xlink_binary *bin, unsigned int flags) {
  int bss_idx;
  xlink_segment *start;
  xlink_segment *main;
  xlink_segment *prog;
  int s;
  /* Stage -1: Load all modules */
  xlink_binary_load_modules(bin);
  /* Stage 0: Find the entry point segment */
  main = xlink_binary_find_segment_by_public(bin, bin->entry, OMF_SEGMENT_CODE);
  bin->is_32bit = main->attrib.proc == OMF_SEGMENT_USE32;
  /* Stage 0a: Set the 16-bit starting segment */
  if (!bin->is_32bit) {
    start = main;
    XLINK_ERROR(bin->init != NULL,
     ("Cannot set 16-bit initializer function when linking 16-bit COM file"));
    /* TODO: Support packing 16-bit programs */
    XLINK_ERROR(flags & MOD_PACK,
     ("Only 32-bit programs can be packed, %s is 16-bit", bin->entry));
  }
  else {
    char *stub;
    if (flags & MOD_PACK) {
      if (flags & MOD_CLAMP) {
        if (flags & MOD_LOW) {
          if (flags & MOD_BASE) {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pcfbi" : "stub32pcfb";
          }
          else {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pcfi" : "stub32pcf";
          }
        }
        else {
          if (flags & MOD_BASE) {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pcbi" : "stub32pcb";
          }
          else {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pci" : "stub32pc";
          }
        }
      }
      else {
        if (flags & MOD_LOW) {
          if (flags & MOD_BASE) {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pfbi" : "stub32pfb";
          }
          else {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pfi" : "stub32pf";
          }
        }
        else {
          if (flags & MOD_BASE) {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pbi" : "stub32pb";
          }
          else {
            /* Load the 32-bit unpacking stub */
            stub = bin->init ? "stub32pi" : "stub32p";
          }
        }
      }
    }
    else {
      if (flags & MOD_EXIT) {
        if (flags & MOD_BASE) {
          stub = bin->init ? "stub32ebi" : "stub32eb";
        }
        else {
          stub = bin->init ? "stub32ei" : "stub32e";
        }
      }
      else {
        if (flags & MOD_BASE) {
          stub = bin->init ? "stub32bi" : "stub32b";
        }
        else {
          /* If there is a 16-bit initialization function, use STUB32I */
          stub = bin->init ? "stub32i" : "stub32";
        }
      }
    }
    printf("Using %s\n", stub);
    /* Load the stub segment */
    xlink_binary_load_stub(bin, stub);
    /* Find the stub segment */
    start = xlink_binary_find_segment_by_public(bin, stub, OMF_SEGMENT_CODE);
    /* If there is an external init_ function, find and rewrite it */
    if (bin->init) {
      strcpy(xlink_module_find_extern(start->module, "init_")->name, bin->init);
    }
    if (flags & MOD_PACK) {
      prog =
       xlink_binary_find_segment_by_public(bin, "ec_bits", OMF_SEGMENT_BSS);
    }
    else {
      /* The stub code calls an external main_ function, find and rewrite it */
      strcpy(xlink_module_find_extern(start->module, "main_")->name, bin->entry);
    }
  }
  /* Stage 1: Resolve all symbol references, starting from start */
  xlink_binary_link_root_segment(bin, start);
  /* Stage 1a: Link main segment when MOD_EXIT, as start missing main_ extern */
  if (flags & MOD_EXIT) {
    xlink_binary_link_root_segment(bin, main);
  }
  /* Stage 2: Sort segments by class (CODE, DATA, BSS) */
  xlink_sort_segments(bin->segments, bin->nsegments, NULL, &bss_idx);
  /* Stage 2a: Set _MAIN as the first CODE segment */
  xlink_set_first_segment(&bin->segments[0], start);
  /* Stage 2b: Set main as the second CODE segment when MOD_EXIT */
  if (flags & MOD_EXIT) {
    xlink_set_first_segment(&bin->segments[1], main);
  }
  if (flags & MOD_PACK) {
    XLINK_ERROR(bss_idx == bin->nsegments,
     ("Error no BSS segment contained in stub32p"));
    /* Stage 2b: Set _PROG as the first BSS segment */
    xlink_set_first_segment(&bin->segments[bss_idx], prog);
  }
  /* Stage 3: Lay segments in memory with proper alignment starting at 100h */
  xlink_binary_layout_segments(bin, 0, 0x100);
  s = bin->nsegments;
  /* Stage 4: Apply relocations to the program segments */
  xlink_apply_relocations(bin->segments, s);
  if (flags & MOD_PACK) {
    int data_idx;
    int offset;
    xlink_ec_segment code;
    xlink_ec_segment data;
    unsigned char byte;
    xlink_bitstream bs;
    int size;
    if (flags & MOD_BASE) {
      xlink_segment *base;
      base =
       xlink_binary_find_segment_by_public(bin, "_XLINK_base", OMF_SEGMENT_BSS);
      XLINK_ERROR(xlink_binary_has_segment(bin, base),
       ("Error, XLINK_base in 16-bit BSS, but set by 32-bit packing stub"));
    }
    /* Stage 4: Resolve all symbol references, starting from 32-bit entry */
    xlink_binary_link_root_segment(bin, main);
    /* Stage 5: Sort segments by class (CODE, DATA, BSS) */
    xlink_sort_segments(bin->segments + s, bin->nsegments - s, &data_idx, NULL);
    /* Stage 5a: Set main as the first CODE segment */
    xlink_set_first_segment(&bin->segments[s], main);
    if (flags & MOD_BASE) {
      xlink_segment *base;
      base =
       xlink_binary_find_segment_by_public(bin, "_XLINK_base", OMF_SEGMENT_BSS);
      xlink_binary_link_root_segment(bin, base);
      xlink_set_first_segment(&bin->segments[s], base);
      base->start = 0x10000;
      s++;
    }
    /* Stage 6: Lay segments in memory with alignment starting at 10010h */
    xlink_binary_layout_segments(bin, s, 0x10010);
    /* Stage 7: Apply relocations to the payload program segments */
    xlink_apply_relocations(bin->segments + s, bin->nsegments - s);
    /* Stage 8: Extract the CODE and DATA segments */
    xlink_ec_segment_init(&code);
    xlink_ec_segment_init(&data);
    offset = xlink_binary_extract_class(bin, s + 0, 0x10010, OMF_SEGMENT_CODE,
     &code.bytes);
    offset = xlink_binary_extract_class(bin, s + data_idx, offset,
     OMF_SEGMENT_DATA, &data.bytes);
    if (flags & MOD_ONE) {
      /* If only one EC segment, append the data.bytes to code.bytes */
      xlink_list_append(&code.bytes, &data.bytes);
      xlink_list_empty(&data.bytes);
    }
    printf("code bytes = %i\n", xlink_list_length(&code.bytes));
    printf("data bytes = %i\n", xlink_list_length(&data.bytes));
    /* Stage 9: Search for the best context to use for CODE segment bytes */
    xlink_model_search(&code.models, &code.bytes);
    code.header_size = xlink_header_length(&code.models);
    code.state = xlink_model_compute_packed_weights(&code.models);
    if (xlink_list_length(&data.bytes) > 0) {
      /* State 9a: Search for the best context to use for DATA segment bytes */
      xlink_model_search(&data.models, &data.bytes);
      data.header_size = xlink_header_length(&data.models);
      data.state = xlink_model_compute_packed_weights(&data.models);
    }
    byte = xlink_binary_get_relative_byte(bin, prog, -code.header_size);
    /* Set the parity of the CODE and DATA state based on byte */
    if (xlink_list_length(&data.bytes) == 0) {
      if (xlink_parity(byte) == xlink_parity(code.state & 0xff)) {
        code.state ^= 1;
      }
    }
    else {
      if (xlink_parity(byte) != xlink_parity(code.state & 0xff)) {
        code.state ^= 1;
      }
      if (xlink_parity(byte) == xlink_parity(data.state & 0xff)) {
        data.state ^= 1;
      }
    }
    /* Update the model states based on the segment states */
    xlink_model_set_state(&code.models, code.state);
    xlink_model_set_state(&data.models, data.state);
    /* Stage 10: Compress the CODE and DATA segments with perfect hashing */
    xlink_bitstream_from_segments(&bs, &code, &data, 0, flags & MOD_LOW,
     flags & MOD_CLAMP);
    size = code.header_size + data.header_size + (bs.bits + 7)/8;
    printf("Perfect hashing: %i bits, %i bytes\n", bs.bits, (bs.bits + 7)/8);
    printf("Compressed size: %i bytes -> %2.3lf%% smaller\n", size,
     XLINK_RATIO(size, code.bytes.length + data.bytes.length));
    xlink_bitstream_clear(&bs);
    /* Stage 10: Compress the CODE and DATA segments with replacement hashing */
    xlink_bitstream_from_segments(&bs, &code, &data, bin->hash_table_memory/2,
     flags & MOD_LOW, flags & MOD_CLAMP);
    size = code.header_size + data.header_size + (bs.bits + 7)/8;
    printf("Replacement hashing: %i bits, %i bytes\n", bs.bits, (bs.bits + 7)/8);
    printf("Compressed size: %i bytes -> %2.3lf%% smaller\n", size,
     XLINK_RATIO(size, code.bytes.length + data.bytes.length));
    /* Write payload into the prog segment data */
    {
      int i;
      xlink_binary_set_public_offset(bin, "ec_bits",
       code.header_size + data.header_size);
      /* Need to allocate space for the ec_segs header and ec_bits data */
      XLINK_ERROR(size > prog->length,
       ("Compressed binary data %i larger than reserved PROG space %i", size,
       prog->length));
      prog->length = code.header_size + data.header_size + (bs.bits + 7)/8;
      printf("prog->length = %i\n", prog->length);
      prog->data = xlink_malloc(prog->length);
      prog->info |= SEG_HAS_DATA;
      ((unsigned int *)prog->data)[0] =
       0xFFFEFFF0 - code.bytes.length;
      ((unsigned int *)prog->data)[1] = code.state;
      for (i = 0; i < xlink_list_length(&code.models); i++) {
        xlink_model *model;
        model = xlink_list_get(&code.models, i);
        prog->data[8 + i] = model->mask;
      }
      if (xlink_list_length(&data.bytes) > 0) {
        ((unsigned int *)&prog->data[code.header_size])[0] =
         0xFFFEFFF0 - code.bytes.length - data.bytes.length;
        ((unsigned int *)&prog->data[code.header_size])[1] = data.state;
        for (i = 0; i < xlink_list_length(&data.models); i++) {
          xlink_model *model;
          model = xlink_list_get(&data.models, i);
          prog->data[code.header_size + 8 + i] = model->mask;
        }
      }
      xlink_bitstream_copy_bits(&bs, prog->data,
       (code.header_size + data.header_size)*8);
      printf("ec_bits->offset = %i\n", code.header_size + data.header_size);
    }
    xlink_bitstream_clear(&bs);
    /* Fix up the compressing stub */
    {
      xlink_reloc *ec_segs;
      xlink_public *header;
      xlink_binary_set_public_offset(bin, "hash_table_segs",
       (bin->hash_table_memory + 65535)/65536);
      xlink_binary_set_public_offset(bin, "hash_table_words",
       bin->hash_table_memory/2);
      ec_segs = xlink_segment_find_reloc(start, "ec_segs");
      ec_segs->addend.offset = -code.header_size;
      /* Apply relocations again to put the fixups into effect */
      xlink_apply_relocations(bin->segments, s);
      if (!bin->init) {
        xlink_public *heap;
        heap = xlink_binary_find_public(bin, "XLINK_heap_offset");
        start->data[heap->offset] += code.header_size;
      }
      header = xlink_binary_find_public(bin, "XLINK_header_size");
      start->data[header->offset] = code.header_size;
      XLINK_ERROR(
       byte != xlink_binary_get_relative_byte(bin, prog, -code.header_size),
       ("Parity byte %i modified after relocation, %02X != %02X",
       code.header_size, byte,
       xlink_binary_get_relative_byte(bin, prog, -code.header_size)));
      if (!xlink_parity(byte)) {
        /* Flip the direction of branch after segment done */
        start->data[header->offset + 1] ^= 1;
      }
    }
    xlink_ec_segment_clear(&code);
    xlink_ec_segment_clear(&data);
  }
  /* Optionally write the map file. */
  if (bin->map != NULL) {
    xlink_binary_write_map(bin);
  }
  /* Stage 5: Write the COM file to disk a segment at a time */
  xlink_binary_write_com(bin, s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %esi, %ebp
movq %rdi, %r12
callq 0x6720
movq 0x8(%r12), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x68a3
movq %rax, %r13
movzbl 0x10(%rax), %eax
andl $0x1, %eax
movl %eax, 0x64(%r12)
je 0x6c27
testb $0x10, %bpl
jne 0x6c58
btl $0x8, %ebp
movq 0x10(%r12), %rax
jb 0x6c88
btl $0x9, %ebp
jb 0x6cca
testq %rax, %rax
leaq 0x41ca(%rip), %rax      # 0xade5
leaq 0x4451(%rip), %r14      # 0xb073
jmp 0x6d6f
cmpq $0x0, 0x10(%r12)
jne 0x77c1
movq %r13, %r14
testb $0x10, %bpl
je 0x6e02
movq 0x8(%r12), %rsi
leaq 0x4329(%rip), %rdi      # 0xaf75
xorl %eax, %eax
callq 0x22ef
jmp 0x776d
movq 0x10(%r12), %rax
testb %bpl, %bpl
js 0x6ca4
testb $0x40, %bpl
jne 0x6ce0
btl $0x9, %ebp
jb 0x6d25
testq %rax, %rax
leaq 0x4439(%rip), %rax      # 0xb0b5
leaq 0x43b2(%rip), %r14      # 0xb035
jmp 0x6d6f
btl $0x9, %ebp
jb 0x6cf9
testq %rax, %rax
leaq 0x43c2(%rip), %rax      # 0xb05a
leaq 0x43b2(%rip), %r14      # 0xb051
jmp 0x6d6f
testb $0x40, %bpl
jne 0x6d0c
btl $0x9, %ebp
jb 0x6d38
testq %rax, %rax
leaq 0x4333(%rip), %rax      # 0xaff1
leaq 0x4322(%rip), %r14      # 0xafe7
jmp 0x6d6f
testq %rax, %rax
leaq 0x4397(%rip), %rax      # 0xb06b
leaq 0x4387(%rip), %r14      # 0xb062
jmp 0x6d6f
btl $0x9, %ebp
jb 0x6d4b
testq %rax, %rax
leaq 0x4329(%rip), %rax      # 0xb019
leaq 0x4318(%rip), %r14      # 0xb00f
jmp 0x6d6f
testq %rax, %rax
leaq 0x4345(%rip), %rax      # 0xb048
leaq 0x4334(%rip), %r14      # 0xb03e
jmp 0x6d6f
btl $0x9, %ebp
jb 0x6d5e
testq %rax, %rax
leaq 0x42ac(%rip), %rax      # 0xafc8
leaq 0x429a(%rip), %r14      # 0xafbd
jmp 0x6d6f
testq %rax, %rax
leaq 0x42fd(%rip), %rax      # 0xb02c
leaq 0x42ec(%rip), %r14      # 0xb022
jmp 0x6d6f
testq %rax, %rax
leaq 0x429b(%rip), %rax      # 0xafdd
leaq 0x4289(%rip), %r14      # 0xafd2
jmp 0x6d6f
testq %rax, %rax
leaq 0x42b0(%rip), %rax      # 0xb005
leaq 0x429e(%rip), %r14      # 0xaffa
jmp 0x6d6f
testq %rax, %rax
leaq 0x424a(%rip), %rax      # 0xafb2
leaq 0x4237(%rip), %r14      # 0xafa6
cmoveq %rax, %r14
leaq 0x4301(%rip), %rdi      # 0xb07b
movq %r14, %rsi
xorl %eax, %eax
callq 0x20c0
movq %r12, %rdi
movq %r14, %rsi
callq 0x67cb
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x68a3
movq %rax, %r14
cmpq $0x0, 0x10(%r12)
je 0x6dc5
movq 0x8(%r14), %rdi
leaq 0x42d3(%rip), %rsi      # 0xb085
callq 0x331a
leaq 0x10(%rax), %rdi
movq 0x10(%r12), %rsi
callq 0x2050
testb $0x10, %bpl
jne 0x6deb
movq 0x8(%r14), %rdi
leaq 0x37be(%rip), %rsi      # 0xa594
callq 0x331a
leaq 0x10(%rax), %rdi
movq 0x8(%r12), %rsi
callq 0x2050
jmp 0x6e02
leaq 0x4299(%rip), %rsi      # 0xb08b
movq %r12, %rdi
movl $0x2, %edx
callq 0x68a3
movq %rax, %r15
movq %r12, %rdi
movq %r14, %rsi
callq 0x607d
btl $0x8, %ebp
jae 0x6e1e
movq %r12, %rdi
movq %r13, %rsi
callq 0x607d
movq 0x48(%r12), %rdi
movl 0x50(%r12), %esi
leaq 0x5c(%rsp), %rcx
xorl %edx, %edx
callq 0x60ec
movq 0x48(%r12), %rbx
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %r14, 0x8(%rbx,%rax)
jne 0x6e40
leaq 0x8(%rbx), %rdi
movq %rbx, %rsi
callq 0x21a0
btl $0x8, %ebp
movq %r14, (%rbx)
jae 0x6e8e
movq 0x48(%r12), %rbx
leaq 0x8(%rbx), %rsi
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %r13, 0x8(%rsi,%rax)
jne 0x6e73
leaq 0x10(%rbx), %rdi
callq 0x21a0
movq %r13, 0x8(%rbx)
testb $0x10, %bpl
je 0x6ed1
movslq 0x5c(%rsp), %rbx
cmpl 0x50(%r12), %ebx
je 0x7777
shlq $0x3, %rbx
addq 0x48(%r12), %rbx
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %r15, 0x8(%rbx,%rax)
jne 0x6eb4
leaq 0x8(%rbx), %rdi
movq %rbx, %rsi
callq 0x21a0
movq %r15, (%rbx)
movl %ebp, 0xc(%rsp)
movq %r14, 0xa0(%rsp)
movq %r12, %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x6208
movslq 0x50(%r12), %r14
testq %r14, %r14
jle 0x6f0e
movq 0x48(%r12), %rbx
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %rdi
callq 0x3b0d
incq %rbp
cmpq %rbp, %r14
jne 0x6efd
movq %r14, 0x10(%rsp)
movl 0xc(%rsp), %eax
testb $0x10, %al
je 0x772e
btl $0x9, %eax
jae 0x6f5c
leaq 0x4191(%rip), %rsi      # 0xb0bd
movq %r12, %rdi
movl $0x2, %edx
callq 0x68a3
movslq 0x50(%r12), %rcx
testq %rcx, %rcx
jle 0x6f5c
movq 0x48(%r12), %rdx
xorl %esi, %esi
cmpq %rax, (%rdx,%rsi,8)
je 0x775f
incq %rsi
cmpq %rsi, %rcx
jne 0x6f4a
movq %r12, %rdi
movq %r13, %rsi
callq 0x607d
movq 0x10(%rsp), %rax
leaq (,%rax,8), %rbp
movq 0x48(%r12), %rdi
addq %rbp, %rdi
movl 0x50(%r12), %esi
subl %eax, %esi
leaq 0x58(%rsp), %rdx
xorl %ecx, %ecx
callq 0x60ec
movq 0x48(%r12), %rbx
addq %rbp, %rbx
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %r13, 0x8(%rbx,%rax)
jne 0x6f9e
leaq 0x8(%rbx), %rdi
movq %rbx, %rsi
callq 0x21a0
btl $0x9, 0xc(%rsp)
movq %r13, (%rbx)
jae 0x701b
leaq 0x40f3(%rip), %rsi      # 0xb0bd
movq %r12, %rdi
movl $0x2, %edx
callq 0x68a3
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
callq 0x607d
addq 0x48(%r12), %rbp
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %rbx, 0x8(%rbp,%rax)
jne 0x6ff1
leaq 0x8(%rbp), %rdi
movq %rbp, %rsi
callq 0x21a0
movq %rbx, (%rbp)
movl $0x10000, 0x7c(%rbx)    # imm = 0x10000
incq 0x10(%rsp)
movq %r12, %rdi
movq 0x10(%rsp), %rbx
movl %ebx, %esi
movl $0x10010, %edx          # imm = 0x10010
callq 0x6208
movl 0x50(%r12), %eax
subl %ebx, %eax
jle 0x705c
movq 0x10(%rsp), %rbx
shlq $0x3, %rbx
addq 0x48(%r12), %rbx
movl %eax, %r13d
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %rdi
callq 0x3b0d
incq %rbp
cmpq %rbp, %r13
jne 0x704b
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r13
movaps %xmm0, 0x20(%r13)
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
movq %r12, 0x18(%rsp)
xorl %r12d, %r12d
movq %r12, 0x30(%r13)
movl $0x1, %esi
movq %r13, %rdi
xorl %edx, %edx
callq 0x948c
leaq 0x38(%rsp), %rdi
movl $0xc, %esi
xorl %edx, %edx
callq 0x948c
leaq 0x60(%rsp), %rbx
movq %r12, 0x30(%rbx)
movq 0x18(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
movl $0x1, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x948c
leaq 0x78(%rsp), %rdi
movl $0xc, %esi
xorl %edx, %edx
callq 0x948c
movq %r12, %rdi
movq 0x10(%rsp), %rbp
movl %ebp, %esi
movl $0x10010, %edx          # imm = 0x10010
xorl %ecx, %ecx
movq %r13, %r8
callq 0x631b
movl 0x58(%rsp), %esi
addl %ebp, %esi
movq %r12, %rdi
movl %eax, %edx
movl $0x1, %ecx
movq %rbx, %r8
callq 0x631b
testb $0x20, 0xc(%rsp)
je 0x712d
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rbx
movq %rbx, %rsi
callq 0x95f9
movq %rbx, %rdi
callq 0x94c2
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x94be
leaq 0x3fc8(%rip), %rdi      # 0xb109
xorl %ebp, %ebp
movl %eax, %esi
xorl %eax, %eax
callq 0x20c0
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x94be
leaq 0x3fba(%rip), %rdi      # 0xb11a
movl %eax, %esi
xorl %eax, %eax
callq 0x20c0
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x63f6
movq %r12, %rdi
callq 0x6b75
movl %eax, 0x34(%r13)
movq %r12, %rdi
callq 0x86b8
movl %eax, 0x30(%r13)
movq %rbx, %rdi
callq 0x94be
testl %eax, %eax
leaq 0x78(%rsp), %r12
jle 0x71c8
leaq 0x60(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x63f6
movq %r12, %rdi
callq 0x6b75
movl %eax, 0x34(%rbx)
movq %r12, %rdi
callq 0x86b8
movl %eax, 0x30(%rbx)
subl 0x54(%rsp), %ebp
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x6ad7
movl %eax, %ebp
leaq 0x60(%rsp), %rdi
callq 0x94be
testl %eax, %eax
je 0x729e
xorl %eax, %eax
movl $0x0, %ecx
testb %bpl, %bpl
leaq 0x38(%rsp), %rdi
je 0x7216
xorl %ecx, %ecx
movl %ebp, %edx
movzbl %dl, %esi
addl %esi, %ecx
movl %esi, %edx
shrb %dl
cmpb $0x1, %sil
ja 0x7204
andl $0x1, %ecx
movl 0x50(%rsp), %esi
testb %sil, %sil
je 0x7238
xorl %eax, %eax
movl %esi, %edx
movzbl %dl, %r8d
addl %r8d, %eax
movl %r8d, %edx
shrb %dl
cmpb $0x1, %r8b
ja 0x7223
andl $0x1, %eax
cmpl %eax, %ecx
je 0x7243
xorl $0x1, %esi
movl %esi, 0x50(%rsp)
xorl %eax, %eax
movl $0x0, %ecx
testb %bpl, %bpl
je 0x7268
xorl %ecx, %ecx
movl %ebp, %edx
movzbl %dl, %r8d
addl %r8d, %ecx
movl %r8d, %edx
shrb %dl
cmpb $0x1, %r8b
ja 0x7253
andl $0x1, %ecx
movl 0x90(%rsp), %edx
testb %dl, %dl
je 0x728e
xorl %eax, %eax
movl %edx, %r9d
movzbl %r9b, %r8d
addl %r8d, %eax
movl %r8d, %r9d
shrb %r9b
cmpb $0x1, %r8b
ja 0x7278
andl $0x1, %eax
cmpl %eax, %ecx
jne 0x72f2
xorl $0x1, %edx
movl %edx, 0x90(%rsp)
jmp 0x72f2
xorl %eax, %eax
movl $0x0, %ecx
testb %bpl, %bpl
leaq 0x38(%rsp), %rdi
je 0x72c5
xorl %ecx, %ecx
movl %ebp, %edx
movzbl %dl, %esi
addl %esi, %ecx
movl %esi, %edx
shrb %dl
cmpb $0x1, %sil
ja 0x72b3
andl $0x1, %ecx
movl 0x50(%rsp), %esi
testb %sil, %sil
je 0x72e7
xorl %eax, %eax
movl %esi, %edx
movzbl %dl, %r8d
addl %r8d, %eax
movl %r8d, %edx
shrb %dl
cmpb $0x1, %r8b
ja 0x72d2
andl $0x1, %eax
cmpl %eax, %ecx
jne 0x72f2
xorl $0x1, %esi
movl %esi, 0x50(%rsp)
callq 0x8759
leaq 0x60(%rsp), %rbx
movl 0x30(%rbx), %esi
movq %r12, %rdi
callq 0x8759
movl 0xc(%rsp), %r13d
movl %r13d, %r14d
andl $0x40, %r14d
andl $0x80, %r13d
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
movl %r14d, %r8d
movl %r13d, %r9d
callq 0x65c2
movl 0x34(%rbx), %ebx
addl 0x34(%r12), %ebx
leaq 0xa8(%rsp), %rax
movl 0x18(%rax), %esi
leal 0x7(%rsi), %eax
leal 0xe(%rsi), %edx
testl %eax, %eax
cmovnsl %eax, %edx
sarl $0x3, %edx
addl %edx, %ebx
leaq 0x3dc7(%rip), %rdi      # 0xb12b
xorl %eax, %eax
callq 0x20c0
cvtsi2sd %ebx, %xmm1
leaq 0x60(%rsp), %rax
movl 0x10(%rax), %eax
addl 0x10(%r12), %eax
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd 0x2f44(%rip), %xmm0     # 0xa2d0
subsd %xmm1, %xmm0
mulsd 0x2f40(%rip), %xmm0     # 0xa2d8
leaq 0x3db0(%rip), %rdi      # 0xb14f
movl %ebx, %esi
movb $0x1, %al
callq 0x20c0
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
callq 0x7e76
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdx
movl %r14d, %r8d
movl %r13d, %r9d
callq 0x65c2
movl 0x34(%rbx), %r13d
addl 0x34(%r12), %r13d
leaq 0xa8(%rsp), %rax
movl 0x18(%rax), %esi
leal 0x7(%rsi), %eax
leal 0xe(%rsi), %edx
testl %eax, %eax
cmovnsl %eax, %edx
sarl $0x3, %edx
addl %edx, %r13d
leaq 0x3d70(%rip), %rdi      # 0xb17e
xorl %eax, %eax
callq 0x20c0
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movl 0x10(%rbx), %eax
addl 0x10(%r12), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd 0x2e98(%rip), %xmm1     # 0xa2d0
subsd %xmm0, %xmm1
mulsd 0x2e94(%rip), %xmm1     # 0xa2d8
movapd %xmm1, %xmm0
leaq 0x3d00(%rip), %rdi      # 0xb14f
movl %r13d, %esi
movb $0x1, %al
callq 0x20c0
movl 0x34(%rbx), %ebx
addl 0x34(%r12), %ebx
leaq 0x3c23(%rip), %rsi      # 0xb08b
movq 0x18(%rsp), %rdi
callq 0x3568
movl %ebx, 0x124(%rax)
movl 0x1c(%r15), %edx
cmpl %edx, %r13d
jg 0x7780
movl 0x94(%rsp), %eax
addl 0x54(%rsp), %eax
movl 0xc0(%rsp), %esi
leal 0x7(%rsi), %ecx
addl $0xe, %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
sarl $0x3, %esi
addl %eax, %esi
movl %esi, 0x1c(%r15)
leaq 0x3d31(%rip), %rdi      # 0xb1e3
xorl %eax, %eax
callq 0x20c0
movslq 0x1c(%r15), %rdi
callq 0x8520
movq %rax, 0x38(%r15)
orb $0x1, 0x30(%r15)
movl $0xfffefff0, %ecx       # imm = 0xFFFEFFF0
subl 0x30(%rsp), %ecx
movl %ecx, (%rax)
movl 0x50(%rsp), %ecx
movl %ecx, 0x4(%rax)
leaq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x94be
testl %eax, %eax
movq 0xa0(%rsp), %r14
jle 0x751e
xorl %ebx, %ebx
movq %r12, %rdi
movl %ebx, %esi
callq 0x9507
movb (%rax), %al
movq 0x38(%r15), %rcx
movb %al, 0x8(%rcx,%rbx)
incq %rbx
movq %r12, %rdi
callq 0x94be
cltq
cmpq %rax, %rbx
jl 0x74f8
leaq 0x60(%rsp), %rdi
callq 0x94be
testl %eax, %eax
leaq 0x78(%rsp), %r12
jle 0x7592
movl 0x30(%rsp), %eax
addl 0x70(%rsp), %eax
movl 0x54(%rsp), %ecx
movl $0xfffefff0, %edx       # imm = 0xFFFEFFF0
subl %eax, %edx
movq 0x38(%r15), %rax
movl %edx, (%rax,%rcx)
movl 0x90(%rsp), %ecx
movl 0x54(%rsp), %edx
movl %ecx, 0x4(%rax,%rdx)
movq %r12, %rdi
callq 0x94be
testl %eax, %eax
jle 0x7592
xorl %ebx, %ebx
movq %r12, %rdi
movl %ebx, %esi
callq 0x9507
movb (%rax), %al
movq 0x38(%r15), %rcx
movl 0x54(%rsp), %edx
addl %ebx, %edx
addl $0x8, %edx
movb %al, (%rcx,%rdx)
incl %ebx
movq %r12, %rdi
callq 0x94be
cmpl %eax, %ebx
jl 0x7568
movq 0x38(%r15), %rsi
movl 0x94(%rsp), %edx
addl 0x54(%rsp), %edx
shll $0x3, %edx
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
callq 0x7e8e
movl 0x94(%rsp), %esi
addl 0x54(%rsp), %esi
leaq 0x3c30(%rip), %rdi      # 0xb1f6
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x20c0
movq %rbx, %rdi
callq 0x7e76
movq 0x18(%rsp), %r12
movl 0x18(%r12), %ebx
leal 0xffff(%rbx), %eax
addl $0x1fffe, %ebx          # imm = 0x1FFFE
testl %eax, %eax
cmovnsl %eax, %ebx
sarl $0x10, %ebx
leaq 0x3c0f(%rip), %rsi      # 0xb20c
movq %r12, %rdi
callq 0x3568
movl %ebx, 0x124(%rax)
movl 0x18(%r12), %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
leaq 0x3bfc(%rip), %rsi      # 0xb21c
movq %r12, %rdi
callq 0x3568
movl %ebx, 0x124(%rax)
leaq 0x3bf8(%rip), %rsi      # 0xb22d
movq %r14, %rdi
callq 0x6a62
subl 0x54(%rsp), %r13d
movl %r13d, 0x3c(%rax)
cmpl $0x0, 0x10(%rsp)
jle 0x766f
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rbx
movl 0x10(%rsp), %r13d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
callq 0x3b0d
incq %r12
cmpq %r12, %r13
jne 0x765e
movq 0x18(%rsp), %r12
cmpq $0x0, 0x10(%r12)
jne 0x769d
leaq 0x3bb2(%rip), %rsi      # 0xb235
movq %r12, %rdi
callq 0x3568
movb 0x54(%rsp), %cl
movq 0x38(%r14), %rdx
movslq 0x124(%rax), %rax
addb %cl, (%rdx,%rax)
leaq 0x3ba3(%rip), %rsi      # 0xb247
movq %r12, %rdi
callq 0x3568
movq %rax, %r13
movb 0x54(%rsp), %al
movq 0x38(%r14), %rcx
movslq 0x124(%r13), %rdx
movb %al, (%rcx,%rdx)
xorl %edx, %edx
subl 0x54(%rsp), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x6ad7
cmpb %al, %bpl
jne 0x7793
testb %bpl, %bpl
je 0x76f6
xorl %eax, %eax
movzbl %bpl, %ecx
addl %ecx, %eax
movl %ecx, %ebp
shrb %bpl
cmpb $0x1, %cl
ja 0x76e2
testb $0x1, %al
jne 0x7706
movq 0x38(%r14), %rax
movslq 0x124(%r13), %rcx
xorb $0x1, 0x1(%rax,%rcx)
leaq 0x20(%rsp), %rdi
callq 0x94b6
leaq 0x38(%rsp), %rdi
callq 0x94b6
leaq 0x60(%rsp), %rdi
callq 0x94b6
leaq 0x78(%rsp), %rdi
callq 0x94b6
cmpq $0x0, 0x20(%r12)
movq 0x10(%rsp), %rbx
je 0x7743
movq %r12, %rdi
callq 0x6934
movq %r12, %rdi
movl %ebx, %esi
callq 0x6968
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3963(%rip), %rdi      # 0xb0c9
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
leaq 0x3915(%rip), %rdi      # 0xb093
jmp 0x7766
leaq 0x3a1f(%rip), %rdi      # 0xb1a6
movl %r13d, %esi
xorl %eax, %eax
callq 0x22ef
jmp 0x776d
movzbl %bpl, %ebx
movl 0x54(%rsp), %ebp
movl %ebp, %edx
negl %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x6ad7
movzbl %al, %ecx
leaq 0x3aa5(%rip), %rdi      # 0xb259
movl %ebp, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x22ef
jmp 0x776d
leaq 0x3769(%rip), %rdi      # 0xaf31
jmp 0x7766