// File: /workspace/github_c_makefile_star2_O1/negge[P]xlink/src/xlink.c
// Function: xlink_file_load_omf_module
xlink_module *xlink_file_load_omf_module(xlink_file *file, unsigned int flags) {
  xlink_module *mod;
  xlink_omf omf;
  xlink_data *dat;
  int done;
  int i, j;
  mod = xlink_malloc(sizeof(xlink_module));
  mod->filename = file->name;
  xlink_omf_init(&omf);
  dat = NULL;
  done = 0;
  while (file->size > 0 && !done) {
    xlink_omf_record rec;
    int i;
    xlink_file_load_omf_record(file, &rec);
    xlink_omf_add_record(&omf, &rec);
    switch (rec.type & ~1) {
      case OMF_THEADR :
      case OMF_LHEADR : {
        strcpy(mod->source, xlink_omf_record_read_string(&rec));
        break;
      }
      case OMF_MODEND : {
        done = 1;
        break;
      }
      case OMF_LNAMES :
      case OMF_LLNAMES : {
        while (xlink_omf_record_has_data(&rec)) {
          xlink_name *name;
          name = xlink_malloc(sizeof(xlink_name));
          strcpy(name->str, xlink_omf_record_read_string(&rec));
          XLINK_LIST_ADD(module, name, mod, name);
        }
        break;
      }
      case OMF_SEGDEF : {
        xlink_segment *seg;
        seg = xlink_malloc(sizeof(xlink_segment));
        seg->attrib.b = xlink_omf_record_read_byte(&rec);
        if (seg->attrib.align == 0) {
          seg->frame = xlink_omf_record_read_word(&rec);
          seg->offset = xlink_omf_record_read_byte(&rec);
        }
        else {
          seg->frame = seg->offset = 0;
        }
        seg->length = xlink_omf_record_read_numeric(&rec);
        XLINK_ERROR(seg->attrib.big && seg->length != 0,
         ("Invalid length for 'big' segment, expected 0 got %i", seg->length));
        seg->name =
         xlink_module_get_name(mod, xlink_omf_record_read_index(&rec));
        seg->class =
         xlink_module_get_name(mod, xlink_omf_record_read_index(&rec));
        /* Read and ignore Overlay Name Index */
        xlink_omf_record_read_index(&rec);
        seg->info = 0;
        seg->data = xlink_malloc(seg->length);
        seg->mask = xlink_malloc(CEIL2(seg->length, 3));
        xlink_segment_reset_mask(seg);
        XLINK_LIST_ADD(module, segment, mod, seg);
        break;
      }
      case OMF_GRPDEF : {
        xlink_group *grp;
        grp = xlink_malloc(sizeof(xlink_group));
        grp->name =
         xlink_module_get_name(mod, xlink_omf_record_read_index(&rec));
        grp->nsegments = 0;
        while (xlink_omf_record_has_data(&rec)) {
          unsigned char index;
          xlink_segment *s;
          index = xlink_omf_record_read_byte(&rec);
          XLINK_ERROR(index != 0xFF, ("Invalid segment index %i", index));
          s = xlink_module_get_segment(mod, xlink_omf_record_read_index(&rec));
          XLINK_ERROR(s->group != NULL,
           ("Cannot add segment %s to group %s, already added to group %s:%i",
           xlink_segment_get_name(s), xlink_group_get_name(grp), s->group->name,
           s->group->index));
          s->group = grp;
          xlink_group_add_segment(grp, s);
        }
        XLINK_LIST_ADD(module, group, mod, grp);
        break;
      }
      case OMF_PUBDEF :
      case OMF_LPUBDEF : {
        int group_idx;
        int segment_idx;
        xlink_public base;
        group_idx = xlink_omf_record_read_index(&rec);
        segment_idx = xlink_omf_record_read_index(&rec);
        base.group = group_idx ? xlink_module_get_group(mod, group_idx) : NULL;
        base.segment =
         segment_idx ? xlink_module_get_segment(mod, segment_idx) : NULL;
        base.base_frame =
         base.segment == NULL ? xlink_omf_record_read_word(&rec) : 0;
        base.is_local = ((rec.type & ~1) == OMF_LPUBDEF);
        while (xlink_omf_record_has_data(&rec)) {
          xlink_public *pub;
          pub = xlink_malloc(sizeof(xlink_public));
          *pub = base;
          strcpy(pub->name, xlink_omf_record_read_string(&rec));
          pub->offset = xlink_omf_record_read_numeric(&rec);
          pub->type_idx = xlink_omf_record_read_index(&rec);
          XLINK_LIST_ADD(module, public, mod, pub);
          if (pub->segment) {
            xlink_segment_add_public(pub->segment, pub);
          }
        }
        break;
      }
      case OMF_EXTDEF :
      case OMF_LEXTDEF : {
        xlink_extern base;
        base.is_local = (rec.type == OMF_LEXTDEF);
        while (xlink_omf_record_has_data(&rec)) {
          xlink_extern *ext;
          ext = xlink_malloc(sizeof(xlink_extern));
          *ext = base;
          strcpy(ext->name, xlink_omf_record_read_string(&rec));
          ext->type_idx = xlink_omf_record_read_index(&rec);
          XLINK_LIST_ADD(module, extern, mod, ext);
        }
        break;
      }
      case OMF_LEDATA :
      case OMF_LIDATA : {
        xlink_segment *seg;
        seg = xlink_module_get_segment(mod, xlink_omf_record_read_index(&rec));
        seg->info |= SEG_HAS_DATA;
        dat = xlink_malloc(sizeof(xlink_data));
        dat->segment = seg;
        dat->offset = xlink_omf_record_read_numeric(&rec);
        dat->is_iterated = rec.type & 0x2;
        dat->length = xlink_omf_record_data_left(&rec);
        dat->data = xlink_malloc(dat->length);
        dat->mask = xlink_malloc(CEIL2(dat->length, 3));
        memcpy(dat->data, &rec.buf[rec.idx], dat->length);
        xlink_data_reset_mask(dat);
        if (!dat->is_iterated) {
          XLINK_ERROR(dat->offset + dat->length > seg->length,
           ("LEDATA wrote past end of segment %s, offset = %i but length = %i",
           xlink_segment_get_name(seg), dat->offset + dat->length,
           seg->length));
          memcpy(&seg->data[dat->offset], &rec.buf[rec.idx], dat->length);
          for (i = 0; i < dat->length; i++) {
            XLINK_ERROR(XLINK_GET_BIT(seg->mask, dat->offset + i),
             ("LEDATA overwrote existing data in segment %s, offset = %i",
             xlink_segment_get_name(seg), dat->offset + i));
            XLINK_SET_BIT(seg->mask, dat->offset + i, 1);
          }
        }
        else {
          int size;
          size = xlink_omf_record_load_iterated(&rec, &seg->data[dat->offset],
           seg->length - dat->offset);
          for (i = 0; i < size; i++) {
            XLINK_ERROR(XLINK_GET_BIT(seg->mask, dat->offset + i),
             ("LIDATA overwrote existing data in segment %s, offset = %i",
             xlink_segment_get_name(seg), dat->offset + i));
            XLINK_SET_BIT(seg->mask, dat->offset + i, 1);
          }
        }
        XLINK_LIST_ADD(module, data, mod, dat);
        xlink_segment_add_data(dat->segment, dat);
        break;
      }
      case OMF_FIXUPP : {
        while (xlink_omf_record_has_data(&rec)) {
          unsigned char byte;
          byte = xlink_omf_record_read_byte(&rec);
          if (byte & 0x80) {
            xlink_segment *seg;
            xlink_reloc *rel;
            xlink_omf_fixup_locat locat;
            xlink_omf_fixup_fixdata fixdata;
            const unsigned char *data;
            XLINK_ERROR(dat == NULL, ("Got FIXUP before LxDATA record"));
            XLINK_ERROR(dat->is_iterated,
             ("FIXUP records for LIDATA not yet supported"));
            seg = dat->segment;
            rel = xlink_malloc(sizeof(xlink_reloc));
            rel->segment = seg;
            locat.b0 = byte;
            locat.b1 = xlink_omf_record_read_byte(&rec);
            XLINK_ERROR(locat.high != 1, ("Expecting FIXUP subrecord"));
            rel->offset = dat->offset + locat.offset;
            rel->mode = locat.mode;
            rel->location = locat.location;
            XLINK_ERROR(
             seg->length < rel->offset + OMF_FIXUP_SIZE[rel->location],
             ("FIXUP offset %i past segment end %i", rel->offset, seg->length));
            for (i = 0; i < OMF_FIXUP_SIZE[rel->location]; i++) {
              XLINK_ERROR(XLINK_GET_BIT(seg->mask, rel->offset + i) == 0,
               ("FIXUP modifies uninitialized data, location %i",
               rel->offset + i));
            }
            fixdata.b = xlink_omf_record_read_byte(&rec);
            if (!fixdata.th_frame) {
              rel->frame = fixdata.frame;
              rel->frame_idx = 0;
              if (fixdata.frame < OMF_FRAME_LOC) {
                rel->frame_idx = xlink_omf_record_read_index(&rec);
                switch (rel->frame) {
                  case OMF_FRAME_SEG : {
                    xlink_module_get_segment(mod, rel->frame_idx);
                    break;
                  }
                  case OMF_FRAME_GRP : {
                    xlink_module_get_group(mod, rel->frame_idx);
                    break;
                  }
                  case OMF_FRAME_EXT : {
                    xlink_module_get_extern(mod, rel->frame_idx);
                    break;
                  }
                }
              }
            }
            else {
              // TODO: Get frame info from thread in xlink_omf struct
            }
            if (!fixdata.th_target) {
              rel->target = (fixdata.no_disp << 2) + fixdata.target;
              rel->target_idx = xlink_omf_record_read_index(&rec);
              switch (rel->target) {
                case OMF_TARGET_SEG :
                case OMF_TARGET_SEG_DISP : {
                  xlink_module_get_segment(mod, rel->target_idx);
                  break;
                }
                case OMF_TARGET_GRP :
                case OMF_TARGET_GRP_DISP : {
                  xlink_module_get_group(mod, rel->target_idx);
                  break;
                }
                case OMF_TARGET_EXT :
                case OMF_TARGET_EXT_DISP : {
                  xlink_module_get_extern(mod, rel->target_idx);
                  break;
                }
              }
            }
            else {
              // TODO: Get target info from thread in xlink_omf struct
            }
            if (!fixdata.no_disp) {
              rel->disp = xlink_omf_record_read_numeric(&rec);
            }
            data = seg->data + rel->offset;
            switch (rel->location) {
              case OMF_LOCATION_8BIT :
              case OMF_LOCATION_8BIT_HIGH : {
                rel->addend.offset = *(int8_t *)data;
                break;
              }
              case OMF_LOCATION_16BIT :
              case OMF_LOCATION_SEGMENT :
              case OMF_LOCATION_16BIT_LOADER : {
                rel->addend.offset = *(int16_t *)data;
                break;
              }
              case OMF_LOCATION_FAR : {
                rel->addend.segment = *(uint16_t *)(data + 2),
                rel->addend.offset = *(int16_t *)data;
                break;
              }
              case OMF_LOCATION_32BIT :
              case OMF_LOCATION_32BIT_LOADER : {
                rel->addend.offset = *(int32_t *)data;
                break;
              }
              case OMF_LOCATION_48BIT :
              case OMF_LOCATION_48BIT_PHARLAP : {
                rel->addend.segment = *(uint16_t *)(data + 4),
                rel->addend.offset = *(int32_t *)data;
                break;
              }
              default : {
                XLINK_ERROR(1, ("Unsupported location %i", rel->location));
              }
            }
            XLINK_LIST_ADD(module, reloc, mod, rel);
            xlink_segment_add_reloc(rel->segment, rel);
          }
          else {
            xlink_omf_fixup_thread th;
            int index;
            XLINK_ERROR(th.high != 0, ("Expecting THREAD subrecord"));
            index = 0;
            if (th.method < OMF_FRAME_LOC) {
              index = xlink_omf_record_read_index(&rec);
            }
          }
        }
      }
    }
  }
  XLINK_ERROR(!done, ("Got EOF before reading MODEND in %s", file->name));
  for (i = 1; i <= mod->nsegments; i++) {
    xlink_segment *seg;
    seg = xlink_module_get_segment(mod, i);
    /* Check that all segments are either fully populated or uninitialized */
    if (seg->info & SEG_HAS_DATA) {
      for (j = 0; j < seg->length; j++) {
        XLINK_ERROR(XLINK_GET_BIT(seg->mask, j) == 0,
         ("Missing data for segment %s, offset = %i",
         xlink_segment_get_name(seg), j));
      }
    }
    else {
      free(seg->data);
      free(seg->mask);
      seg->data = seg->mask = NULL;
    }
    /* Sort the PUBDEF and FIXUPP records by their offset into segment */
    qsort(seg->publics, seg->npublics, sizeof(xlink_public *), pub_comp);
    qsort(seg->relocs, seg->nrelocs, sizeof(xlink_reloc *), rel_comp);
    if ((seg->info & SEG_HAS_DATA) == 0) {
      XLINK_ERROR(seg->nrelocs != 0,
       ("Uninitialized segment %s has %i relocations, should have none",
       xlink_segment_get_name(seg), seg->nrelocs));
    }
  }
  if (flags & MOD_SPLIT) {
    xlink_module_split_segments(mod);
  }
  if (flags & MOD_DUMP) {
    printf("Module: %s\n", mod->filename);
    xlink_omf_dump_records(&omf);
    xlink_module_dump_names(mod);
    xlink_module_dump_symbols(mod);
    xlink_module_dump_segments(mod);
    xlink_omf_dump_lxdata(&omf, mod);
    xlink_module_dump_relocations(mod);
  }
  xlink_omf_clear(&omf);
  return mod;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, 0x18(%rsp)
movq %rdi, %r14
movl $0x188, %edi            # imm = 0x188
callq 0x8508
movq %rax, %rbx
movq (%r14), %rax
movq %rax, (%rbx)
movq %r14, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
cmpl $0x0, 0x8(%r14)
je 0x5c83
movq %rbx, %rax
addq $0x18, %rax
movq %rax, 0x58(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0xe872(%rip), %rbp      # 0x13530
movl $0x0, 0x14(%rsp)
movq %rdi, 0x60(%rsp)
movq %rbx, 0x38(%rsp)
movq %rsp, %r14
movq %r14, %rsi
callq 0x5cd0
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x2caa
movzbl 0xc(%rsp), %ecx
movl %ecx, %eax
andl $-0x2, %eax
cmpl $0x95, %eax
jle 0x50ae
cmpl $0xb3, %eax
jg 0x50df
addl $0xffffff6a, %eax       # imm = 0xFFFFFF6A
cmpl $0xc, %eax
ja 0x5a16
leaq 0x532b(%rip), %rcx      # 0xa048
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rsp), %rax
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %esi
testb %sil, %sil
jns 0x4d53
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %eax
orl %eax, %esi
movq %rbx, %rdi
callq 0x2e3e
movq %rax, %r13
orb $0x1, 0x30(%rax)
movl $0x38, %edi
callq 0x8508
movq %rax, %r15
movq %r13, 0x10(%rax)
movzbl 0xc(%rsp), %eax
movq (%rsp), %rcx
movslq 0x8(%rsp), %rdx
testb $0x1, %al
jne 0x538d
movzwl (%rcx,%rdx), %ecx
addl $0x2, %edx
jmp 0x5393
movq (%rsp), %rcx
movslq %eax, %rsi
leaq 0x1(%rsi), %rdx
movl %edx, 0x8(%rsp)
movzbl (%rcx,%rsi), %r15d
testb %r15b, %r15b
js 0x4dcb
leal 0x2(%rax), %esi
movl %esi, 0x8(%rsp)
cmpb $0x0, (%rcx,%rdx)
jns 0x5093
addl $0x3, %eax
movl %eax, 0x8(%rsp)
jmp 0x5093
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0x5c4b
cmpl $0x0, 0x1c(%r12)
jne 0x5c42
movq 0x10(%r12), %r14
movl $0x40, %edi
callq 0x8508
movq %rax, %r13
movq %r14, 0x10(%rax)
movq (%rsp), %rax
movslq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rdi
movl %edi, 0x8(%rsp)
movzbl (%rax,%rcx), %edx
movl %r15d, %esi
andl $0x3, %esi
shll $0x8, %esi
orl %edx, %esi
addl 0x18(%r12), %esi
movl %esi, 0x18(%r13)
movl %r15d, %edx
shrl $0x6, %edx
andl $0x1, %edx
movl %edx, 0x1c(%r13)
shrl $0x2, %r15d
andl $0xf, %r15d
movl %r15d, 0x20(%r13)
movl 0x1c(%r14), %edx
leaq 0x52e8(%rip), %r8       # 0xa130
movl (%r8,%r15,4), %r8d
addl %esi, %r8d
cmpl %r8d, %edx
jb 0x5c32
movl $0x2a7f, %edx           # imm = 0x2A7F
btl %r15d, %edx
jae 0x4ea6
movzwl %r15w, %edx
leaq 0x52c2(%rip), %r8       # 0xa130
movl (%r8,%rdx,4), %edx
movq 0x40(%r14), %r8
cmpl $0x2, %edx
movl $0x1, %r9d
cmovll %r9d, %edx
movl %esi, %r9d
shrl $0x3, %r9d
movzbl (%r8,%r9), %r9d
movl %esi, %r10d
andl $0x7, %r10d
btl %r10d, %r9d
jae 0x5b80
incl %esi
decl %edx
jne 0x4e83
leaq 0x2(%rcx), %rsi
movl %esi, 0x8(%rsp)
movzbl (%rax,%rdi), %ebp
testb %bpl, %bpl
js 0x4f23
movl %ebp, %edx
shrl $0x4, %edx
movl %edx, 0x24(%r13)
movl $0x0, 0x2c(%r13)
cmpb $0x3f, %bpl
ja 0x4f23
leaq 0x3(%rcx), %rdi
movl %edi, 0x8(%rsp)
movzbl (%rax,%rsi), %esi
testb %sil, %sil
jns 0x4ef2
andl $0x7f, %esi
shll $0x8, %esi
addl $0x4, %ecx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdi), %eax
orl %eax, %esi
movl %esi, 0x2c(%r13)
cmpb $0x2, %dl
je 0x4f1b
movzbl %dl, %eax
cmpl $0x1, %eax
je 0x4f11
testl %eax, %eax
jne 0x4f23
movq %rbx, %rdi
callq 0x2e3e
jmp 0x4f23
movq %rbx, %rdi
callq 0x2ef0
jmp 0x4f23
movq %rbx, %rdi
callq 0x3106
testb $0x8, %bpl
jne 0x4fa4
movl %ebp, %eax
andl $0x7, %eax
movl %eax, 0x28(%r13)
movq (%rsp), %rcx
movslq 0x8(%rsp), %rdi
leaq 0x1(%rdi), %rdx
movl %edx, 0x8(%rsp)
movzbl (%rcx,%rdi), %esi
testb %sil, %sil
jns 0x4f5f
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edi
movl %edi, 0x8(%rsp)
movzbl (%rcx,%rdx), %ecx
orl %ecx, %esi
movl %esi, 0x30(%r13)
cmpb $0x6, %al
ja 0x4fa4
movzbl %al, %eax
movl $0x11, %ecx
btl %eax, %ecx
jb 0x4f9c
movl $0x22, %ecx
btl %eax, %ecx
jb 0x4f92
movl $0x44, %ecx
btl %eax, %ecx
jae 0x4fa4
movq %rbx, %rdi
callq 0x3106
jmp 0x4fa4
movq %rbx, %rdi
callq 0x2ef0
jmp 0x4fa4
movq %rbx, %rdi
callq 0x2e3e
testb $0x4, %bpl
jne 0x4fd1
testb $0x1, 0xc(%rsp)
movq (%rsp), %rax
movslq 0x8(%rsp), %rcx
jne 0x4fc3
movzwl (%rax,%rcx), %eax
addl $0x2, %ecx
jmp 0x4fc9
movl (%rax,%rcx), %eax
addl $0x4, %ecx
movl %ecx, 0x8(%rsp)
movl %eax, 0x34(%r13)
movl 0x20(%r13), %esi
cmpq $0xd, %rsi
ja 0x5c96
movq 0x38(%r14), %rax
movl 0x18(%r13), %ecx
leaq 0x508e(%rip), %rdi      # 0xa07c
movslq (%rdi,%rsi,4), %rdx
addq %rdi, %rdx
jmpq *%rdx
movsbl (%rax,%rcx), %eax
jmp 0x501a
movzwl 0x4(%rax,%rcx), %edx
movw %dx, 0x38(%r13)
movl (%rax,%rcx), %eax
jmp 0x501a
movzwl 0x2(%rax,%rcx), %edx
movw %dx, 0x38(%r13)
movswl (%rax,%rcx), %eax
movl %eax, 0x3c(%r13)
movslq 0x180(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r13)
movq %rbx, 0x8(%r13)
movl %ecx, 0x180(%rbx)
movq 0x178(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x178(%rbx)
movslq 0x180(%rbx), %rcx
movq %r13, -0x8(%rax,%rcx,8)
movq 0x10(%r13), %r14
movslq 0x78(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x78(%r14)
movq 0x70(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x70(%r14)
movslq 0x78(%r14), %rcx
movq %r13, -0x8(%rax,%rcx,8)
leaq 0xe49d(%rip), %rbp      # 0x13530
movzwl 0xe(%rsp), %ecx
movl 0x8(%rsp), %eax
subl %eax, %ecx
addl $0x2, %ecx
testl %ecx, %ecx
jg 0x4d95
jmp 0x5a16
cmpl $0x89, %eax
jle 0x51b0
cmpl $0x8a, %eax
je 0x5604
cmpl $0x8c, %eax
je 0x520b
cmpl $0x90, %eax
je 0x5319
jmp 0x5a16
cmpl $0xb4, %eax
je 0x520b
cmpl $0xb6, %eax
je 0x5319
cmpl $0xca, %eax
je 0x5197
jmp 0x5a16
movl $0x110, %edi            # imm = 0x110
callq 0x8508
movq %rax, %r14
movq (%rsp), %rsi
movslq 0x8(%rsp), %rax
leaq 0x1(%rax), %r15
movl %r15d, 0x8(%rsp)
movzbl (%rsi,%rax), %r12d
testq %r12, %r12
je 0x513c
addq %r15, %rsi
movq %rbp, %rdi
movq %r12, %rdx
callq 0x2130
movq %r14, %rdi
addq $0x10, %rdi
movb $0x0, (%r12,%rbp)
leal (%r15,%r12), %eax
movl %eax, 0x8(%rsp)
movq %rbp, %rsi
callq 0x2050
movslq 0x120(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r14)
movq %rbx, 0x8(%r14)
movl %ecx, 0x120(%rbx)
movq 0x118(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x118(%rbx)
movslq 0x120(%rbx), %rcx
movq %r14, -0x8(%rax,%rcx,8)
movzwl 0xe(%rsp), %eax
subl 0x8(%rsp), %eax
addl $0x2, %eax
testl %eax, %eax
jg 0x5105
jmp 0x5a16
cmpl $0x80, %eax
je 0x51c2
cmpl $0x82, %eax
jne 0x5a16
movq (%rsp), %rsi
movslq 0x8(%rsp), %rax
leaq 0x1(%rax), %r15
movl %r15d, 0x8(%rsp)
movzbl (%rsi,%rax), %r14d
testq %r14, %r14
je 0x51ec
addq %r15, %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x2130
movb $0x0, (%r14,%rbp)
leal (%r15,%r14), %eax
movl %eax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x2050
jmp 0x5a16
xorl %r15d, %r15d
cmpb $-0x4c, %cl
sete %al
movzwl 0xe(%rsp), %ecx
subl 0x8(%rsp), %ecx
addl $0x2, %ecx
testl %ecx, %ecx
jle 0x5a16
movb %al, %r15b
movl $0x120, %edi            # imm = 0x120
callq 0x8508
movq %rax, %r14
movl %r15d, %ebx
movl %r15d, 0x114(%rax)
movq (%rsp), %r12
movslq 0x8(%rsp), %rax
leaq 0x1(%rax), %r13
movl %r13d, 0x8(%rsp)
movzbl (%r12,%rax), %r15d
testq %r15, %r15
je 0x526f
movq %r13, %rsi
addq %r12, %rsi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x2130
leaq 0x10(%r14), %rdi
movb $0x0, (%r15,%rbp)
addl %r13d, %r15d
movl %r15d, 0x8(%rsp)
movq %rbp, %rsi
callq 0x2050
movslq %r15d, %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%r12,%rax), %eax
testb %al, %al
jns 0x52b2
andl $0x7f, %eax
shll $0x8, %eax
addl $0x2, %r15d
movl %r15d, 0x8(%rsp)
movzbl (%r12,%rcx), %ecx
orl %ecx, %eax
movl %ebx, %r15d
movl %eax, 0x110(%r14)
movq 0x38(%rsp), %rbx
movslq 0x160(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r14)
movq %rbx, 0x8(%r14)
movl %ecx, 0x160(%rbx)
movq 0x158(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x158(%rbx)
movslq 0x160(%rbx), %rcx
movq %r14, -0x8(%rax,%rcx,8)
movzwl 0xe(%rsp), %eax
subl 0x8(%rsp), %eax
addl $0x2, %eax
testl %eax, %eax
jg 0x522b
jmp 0x5a16
movq (%rsp), %rax
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %esi
testb %sil, %sil
jns 0x5346
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %ecx
orl %ecx, %esi
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %r14d
testb %r14b, %r14b
jns 0x5373
andl $0x7f, %r14d
shll $0x8, %r14d
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %eax
orl %eax, %r14d
testl %esi, %esi
je 0x56f5
movq %rbx, %rdi
callq 0x2ef0
movq %rax, 0x30(%rsp)
jmp 0x56fe
movl (%rcx,%rdx), %ecx
addl $0x4, %edx
movl %edx, 0x8(%rsp)
movl %ecx, 0x18(%r15)
andl $0x2, %eax
movl %eax, 0x1c(%r15)
movzwl 0xe(%rsp), %eax
subl 0x8(%rsp), %eax
addl $0x2, %eax
movl %eax, 0x20(%r15)
movslq %eax, %rdi
callq 0x8508
movq %rax, 0x28(%r15)
movl 0x20(%r15), %eax
addl $0x7, %eax
sarl $0x3, %eax
movslq %eax, %rdi
callq 0x8508
movq %rax, 0x30(%r15)
movq 0x28(%r15), %rdi
movslq 0x8(%rsp), %rsi
addq (%rsp), %rsi
movslq 0x20(%r15), %rdx
callq 0x2130
movq 0x30(%r15), %rdi
movl 0x20(%r15), %eax
addl $0x7, %eax
sarl $0x3, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x20d0
cmpl $0x0, 0x1c(%r15)
je 0x5611
movl 0x18(%r15), %esi
movl 0x1c(%r13), %edx
subl %esi, %edx
addq 0x38(%r13), %rsi
movq %rsp, %rdi
callq 0x4b69
testl %eax, %eax
jle 0x567e
xorl %r14d, %r14d
movq 0x40(%r13), %rdx
movl 0x18(%r15), %r8d
addl %r14d, %r8d
movl %r8d, %esi
movl %r8d, %ecx
andb $0x7, %cl
movl $0x1, %edi
shll %cl, %edi
shrl $0x3, %esi
movzbl (%rdx,%rsi), %ecx
andl $0x7, %r8d
btl %r8d, %ecx
jb 0x5bad
orb %cl, %dil
movb %dil, (%rdx,%rsi)
incl %r14d
cmpl %r14d, %eax
jne 0x542e
jmp 0x567e
movl $0x28, %edi
callq 0x8508
movq %rax, %r12
movq (%rsp), %rax
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %esi
testb %sil, %sil
jns 0x54ac
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %eax
orl %eax, %esi
movq %rbx, %rdi
callq 0x2d8c
movq %rax, 0x10(%r12)
movl $0x0, 0x20(%r12)
movzwl 0xe(%rsp), %ecx
movl 0x8(%rsp), %eax
subl %eax, %ecx
addl $0x2, %ecx
testl %ecx, %ecx
jle 0x55be
movq (%rsp), %rcx
movslq %eax, %rdx
leaq 0x1(%rdx), %rdi
movl %edi, 0x8(%rsp)
movzbl (%rcx,%rdx), %esi
cmpl $0xff, %esi
jne 0x5bfb
addq $0x2, %rdx
movl %edx, 0x8(%rsp)
movzbl (%rcx,%rdi), %esi
testb %sil, %sil
jns 0x551b
andl $0x7f, %esi
shll $0x8, %esi
addl $0x3, %eax
movl %eax, 0x8(%rsp)
movzbl (%rcx,%rdx), %eax
orl %eax, %esi
movq %rbx, %rdi
callq 0x2e3e
movq %rax, %r14
cmpq $0x0, 0x48(%rax)
jne 0x5bc2
movq %r12, 0x48(%r14)
movslq 0x20(%r12), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r12)
movq 0x18(%r12), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x18(%r12)
movslq 0x20(%r12), %rcx
movq %r14, -0x8(%rax,%rcx,8)
jmp 0x54c2
movl $0x80, %edi
callq 0x8508
movq %rax, %r13
movq (%rsp), %rax
movslq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movl %edx, 0x8(%rsp)
movb (%rax,%rcx), %sil
movb %sil, 0x10(%r13)
cmpb $0x1f, %sil
ja 0x58c8
movzwl (%rax,%rdx), %edx
leaq 0x3(%rcx), %rsi
movl %esi, 0x8(%rsp)
movl %edx, 0x14(%r13)
leal 0x4(%rcx), %edx
movl %edx, 0x8(%rsp)
movzbl 0x3(%rax,%rcx), %ecx
movl %ecx, 0x18(%r13)
jmp 0x58d0
movslq 0x140(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r12)
movq %rbx, 0x8(%r12)
movl %ecx, 0x140(%rbx)
movq 0x138(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x138(%rbx)
movslq 0x140(%rbx), %rcx
movq %r12, -0x8(%rax,%rcx,8)
jmp 0x5a16
movl $0x1, 0x14(%rsp)
jmp 0x5a16
movl 0x18(%r15), %edi
movslq 0x20(%r15), %rdx
leal (%rdx,%rdi), %eax
cmpl 0x1c(%r13), %eax
ja 0x5ca2
addq 0x38(%r13), %rdi
movslq 0x8(%rsp), %rsi
addq (%rsp), %rsi
callq 0x2130
cmpl $0x0, 0x20(%r15)
jle 0x567e
xorl %r14d, %r14d
movq 0x40(%r13), %rax
movl 0x18(%r15), %edi
addl %r14d, %edi
movl %edi, %edx
movl %edi, %ecx
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
shrl $0x3, %edx
movzbl (%rax,%rdx), %ecx
andl $0x7, %edi
btl %edi, %ecx
jb 0x5c04
orb %cl, %sil
movb %sil, (%rax,%rdx)
incl %r14d
cmpl 0x20(%r15), %r14d
jl 0x5642
movslq 0x170(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r15)
movq %rbx, 0x8(%r15)
movl %ecx, 0x170(%rbx)
movq 0x168(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x168(%rbx)
movslq 0x170(%rbx), %rcx
movq %r15, -0x8(%rax,%rcx,8)
movq 0x10(%r15), %r14
movslq 0x68(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x68(%r14)
movq 0x60(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x60(%r14)
movslq 0x68(%r14), %rcx
movq %r15, 0x20(%rsp)
movq %r15, -0x8(%rax,%rcx,8)
jmp 0x5a0f
movq $0x0, 0x30(%rsp)
testl %r14d, %r14d
je 0x5713
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2e3e
movq %rax, %r12
jmp 0x5716
xorl %r12d, %r12d
movl $0x0, 0x1c(%rsp)
testq %r12, %r12
jne 0x573b
movq (%rsp), %rax
movslq 0x8(%rsp), %rcx
movzwl (%rax,%rcx), %eax
movl %eax, 0x1c(%rsp)
leal 0x2(%rcx), %eax
movl %eax, 0x8(%rsp)
movb 0xc(%rsp), %al
andb $-0x2, %al
xorl %ebp, %ebp
cmpb $-0x4a, %al
sete %al
movzwl 0xe(%rsp), %ecx
subl 0x8(%rsp), %ecx
addl $0x2, %ecx
testl %ecx, %ecx
jle 0x5a0f
movb %al, %bpl
movq %r12, 0x28(%rsp)
movl $0x130, %edi            # imm = 0x130
callq 0x8508
movq %rax, %r14
movq 0x30(%rsp), %rax
movq %rax, 0x10(%r14)
movq %r12, 0x18(%r14)
movl 0x1c(%rsp), %eax
movl %eax, 0x20(%r14)
movl %ebp, %ebx
movl %ebp, 0x12c(%r14)
movq (%rsp), %r12
movslq 0x8(%rsp), %rax
leaq 0x1(%rax), %rbp
movl %ebp, 0x8(%rsp)
movzbl (%r12,%rax), %r15d
testq %r15, %r15
leaq 0xdd81(%rip), %r13      # 0x13530
je 0x57c2
movq %rbp, %rsi
addq %r12, %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x2130
leaq 0x24(%r14), %rdi
movb $0x0, (%r15,%r13)
addl %r15d, %ebp
movl %ebp, 0x8(%rsp)
movq %r13, %rsi
callq 0x2050
testb $0x1, 0xc(%rsp)
movslq %ebp, %rcx
jne 0x57ee
movzwl (%r12,%rcx), %eax
addl $0x2, %ecx
jmp 0x57f5
movl (%r12,%rcx), %eax
addl $0x4, %ecx
movl %ecx, 0x8(%rsp)
movl %ebx, %ebp
movl %eax, 0x124(%r14)
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%r12,%rdx), %eax
testb %al, %al
jns 0x582c
andl $0x7f, %eax
shll $0x8, %eax
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%r12,%rcx), %ecx
orl %ecx, %eax
movq 0x28(%rsp), %r12
movl %eax, 0x128(%r14)
movq 0x38(%rsp), %rbx
movslq 0x150(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r14)
movq %rbx, 0x8(%r14)
movl %ecx, 0x150(%rbx)
movq 0x148(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x148(%rbx)
movslq 0x150(%rbx), %rcx
movq %r14, -0x8(%rax,%rcx,8)
movq 0x18(%r14), %r15
testq %r15, %r15
je 0x58af
movslq 0x58(%r15), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x58(%r15)
movq 0x50(%r15), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x50(%r15)
movslq 0x58(%r15), %rcx
movq %r14, -0x8(%rax,%rcx,8)
movzwl 0xe(%rsp), %eax
subl 0x8(%rsp), %eax
addl $0x2, %eax
testl %eax, %eax
jg 0x5764
jmp 0x5a0f
movq $0x0, 0x14(%r13)
testb $0x1, 0xc(%rsp)
movslq 0x8(%rsp), %rcx
jne 0x58e5
movzwl (%rax,%rcx), %esi
addl $0x2, %ecx
jmp 0x58eb
movl (%rax,%rcx), %esi
addl $0x4, %ecx
movl %ecx, 0x8(%rsp)
movl %esi, 0x1c(%r13)
testb $0x2, 0x10(%r13)
je 0x5902
testl %esi, %esi
jne 0x5c77
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %esi
testb %sil, %sil
jns 0x592b
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %eax
orl %eax, %esi
movq %rbx, %rdi
callq 0x2d8c
movq %rax, 0x20(%r13)
movq (%rsp), %rax
movslq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rcx
movl %ecx, 0x8(%rsp)
movzbl (%rax,%rdx), %esi
testb %sil, %sil
jns 0x5964
andl $0x7f, %esi
shll $0x8, %esi
addl $0x2, %edx
movl %edx, 0x8(%rsp)
movzbl (%rax,%rcx), %eax
orl %eax, %esi
movq %rbx, %rdi
callq 0x2d8c
movq %rax, 0x28(%r13)
movq (%rsp), %rcx
movslq 0x8(%rsp), %rax
leal 0x1(%rax), %edx
movl %edx, 0x8(%rsp)
cmpb $0x0, (%rcx,%rax)
jns 0x598d
addl $0x2, %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0x30(%r13)
movslq 0x1c(%r13), %rdi
callq 0x8508
movq %rax, 0x38(%r13)
movl 0x1c(%r13), %eax
addl $0x7, %eax
sarl $0x3, %eax
movslq %eax, %rdi
callq 0x8508
movq %rax, 0x40(%r13)
movl 0x1c(%r13), %ecx
addl $0x7, %ecx
sarl $0x3, %ecx
movslq %ecx, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20d0
movslq 0x130(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, (%r13)
movq %rbx, 0x8(%r13)
movl %ecx, 0x130(%rbx)
movq 0x128(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x852c
movq %rax, 0x128(%rbx)
movslq 0x130(%rbx), %rcx
movq %r13, -0x8(%rax,%rcx,8)
leaq 0xdb1a(%rip), %rbp      # 0x13530
movq 0x60(%rsp), %rdi
cmpl $0x0, 0x8(%rdi)
je 0x5a2c
cmpl $0x0, 0x14(%rsp)
je 0x4cd0
cmpl $0x0, 0x14(%rsp)
je 0x5c83
cmpl $0x0, 0x130(%rbx)
jle 0x5b03
movl $0x1, %r14d
leaq -0xf08(%rip), %r15      # 0x4b49
leaq -0xefc(%rip), %r12      # 0x4b5c
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2e3e
movq %rax, %r13
testb $0x1, 0x30(%rax)
jne 0x5a88
movq 0x38(%r13), %rdi
callq 0x2030
movq 0x40(%r13), %rdi
callq 0x2030
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r13)
jmp 0x5ab3
movl 0x1c(%r13), %eax
testl %eax, %eax
jle 0x5ab3
movq 0x40(%r13), %rcx
xorl %ebp, %ebp
movl %ebp, %edx
shrl $0x3, %edx
movzbl (%rcx,%rdx), %edx
movl %ebp, %esi
andl $0x7, %esi
btl %esi, %edx
jae 0x5b93
incl %ebp
cmpl %ebp, %eax
jne 0x5a96
movq 0x50(%r13), %rdi
movslq 0x58(%r13), %rsi
movl $0x8, %edx
movq %r15, %rcx
callq 0x2070
movq 0x70(%r13), %rdi
movslq 0x78(%r13), %rsi
movl $0x8, %edx
movq %r12, %rcx
callq 0x2070
testb $0x1, 0x30(%r13)
jne 0x5aef
cmpl $0x0, 0x78(%r13)
jne 0x5c5b
leal 0x1(%r14), %eax
cmpl 0x130(%rbx), %r14d
movl %eax, %r14d
jl 0x5a58
movl 0x18(%rsp), %eax
testb $0x4, %al
je 0x5b17
movq %rbx, %rdi
callq 0x4634
movl 0x18(%rsp), %eax
testb $0x1, %al
je 0x5b64
movq (%rbx), %rsi
leaq 0x51fa(%rip), %rdi      # 0xad1f
xorl %eax, %eax
callq 0x20c0
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x3e0b
movq %rbx, %rdi
callq 0x4053
movq %rbx, %rdi
callq 0x40da
movq %rbx, %rdi
callq 0x4296
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3eb8
movq %rbx, %rdi
callq 0x4453
movq 0x40(%rsp), %rdi
callq 0x2030
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x50de(%rip), %rdi      # 0xac65
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28
movq %r13, %rdi
callq 0x26fc
leaq 0x5116(%rip), %rdi      # 0xacb8
leaq 0xd487(%rip), %rsi      # 0x13030
movl %ebp, %edx
jmp 0x5c21
movq %r13, %rdi
callq 0x26fc
addl 0x18(%r15), %r14d
leaq 0x5021(%rip), %rdi      # 0xabe1
jmp 0x5c17
movq %r14, %rdi
callq 0x26fc
movq %r12, %rdi
callq 0x2874
movq 0x48(%r14), %rax
movq 0x10(%rax), %rcx
movl (%rax), %r8d
leaq 0x4f42(%rip), %rdi      # 0xab26
leaq 0xd445(%rip), %rsi      # 0x13030
leaq 0xd63e(%rip), %rdx      # 0x13230
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28
leaq 0x4f0b(%rip), %rdi      # 0xab0d
jmp 0x5b87
movq %r13, %rdi
callq 0x26fc
addl 0x18(%r15), %r14d
leaq 0x4f90(%rip), %rdi      # 0xaba7
leaq 0xd412(%rip), %rsi      # 0x13030
movl %r14d, %edx
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
leaq 0x4e15(%rip), %rdi      # 0xaa4e
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28
leaq 0x4ff1(%rip), %rdi      # 0xac3a
jmp 0x5c52
leaq 0x4fc9(%rip), %rdi      # 0xac1b
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28
movq %r13, %rdi
callq 0x26fc
movl 0x78(%r13), %edx
leaq 0x5073(%rip), %rdi      # 0xace1
leaq 0xd3bb(%rip), %rsi      # 0x13030
jmp 0x5c21
leaq 0x4e5b(%rip), %rdi      # 0xaad9
jmp 0x5b87
movq (%rdi), %rsi
leaq 0x5007(%rip), %rdi      # 0xac94
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28
leaq 0x48df(%rip), %rdi      # 0xa57c
jmp 0x5b87
movq %r13, %rdi
callq 0x26fc
movl 0x20(%r15), %edx
addl 0x18(%r15), %edx
movl 0x1c(%r13), %ecx
leaq 0x4ea9(%rip), %rdi      # 0xab66
leaq 0xd36c(%rip), %rsi      # 0x13030
xorl %eax, %eax
callq 0x22ef
jmp 0x5c28