// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/pack.c
// Function: main_pack
int main_pack(int argc, char *argv[]) {

  conf_pack_t conf = {0};
  conf.nan = -1.0;
  
  int c;
  if (argc<2) return usage(&conf);
  uint64_t dtype = DT_NA;
  char *idx_path = NULL;
  char msg[HDR_EXTRA] = {0};
  uint64_t max_str_length = 64;
  while ((c = getopt(argc, argv, "s:x:m:n:h"))>=0) {
    switch (c) {
    case 's':
      if (strcmp(optarg, "int1") == 0)             dtype = DT_INT1;
      else if (strcmp(optarg, "int2") == 0)        dtype = DT_INT2;
      else if (strcmp(optarg, "int32") == 0)       dtype = DT_INT32;
      else if (strcmp(optarg, "int") == 0)         dtype = DT_INT32;
      else if (strcmp(optarg, "float") == 0)       dtype = DT_FLOAT;
      else if (strcmp(optarg, "double") == 0)      dtype = DT_DOUBLE;
      else if (strcmp(optarg, "string") == 0)      dtype = DT_STRINGD;
      else if (strcmp(optarg, "stringd") == 0)     dtype = DT_STRINGD; /* fixed size string */
      else if (strcmp(optarg, "stringf") == 0)     dtype = DT_STRINGF;
      else if (strcmp(optarg, "ones") == 0)        dtype = DT_ONES;
      else if (strcmp(optarg, "float.int") == 0)   dtype = DT_FLOAT_INT;
      else if (strcmp(optarg, "float.float") == 0) dtype = DT_FLOAT_FLOAT;
      else wzfatal("Unrecognized data type: %s.\n", optarg);
      break;
    case 'x': idx_path = strdup(optarg); break;
    case 'n': conf.nan = atof(optarg); break;
    case 'i': max_str_length = atol(optarg); break;
    case 'm': {
      if (strlen(optarg) > HDR_EXTRA - 1) wzfatal("Message cannot be over %d in length.", HDR_EXTRA);
      strcpy(msg, optarg);
      break;
    }
    case 'h': return usage(&conf); break;
    default: usage(&conf); wzfatal("Unrecognized option: %c.\n", c);
    }
  }

  if (dtype == DT_STRINGF) {
    dtype |= (max_str_length << 8);
  }

  if (optind + 2 > argc) { 
    usage(&conf); 
    wzfatal("Please supply input and output file.\n"); 
  }

  bed_file_t *bed = init_bed_file(argv[optind++]);
  FILE *tbk_out = NULL;
  if (optind < argc) tbk_out = fopen(argv[optind], "wb");

  char *tmp_fname = NULL;       /* temporary file holding variable length strings */
  FILE *tmp_out = NULL;
  uint64_t tmp_out_offset = 0;
  if (dtype == DT_STRINGD) {
    tmp_fname = calloc(strlen(argv[optind])+10, 1);
    strcpy(tmp_fname, argv[optind]);
    strcat(tmp_fname, "_tmp_");
    tmp_out = fopen(tmp_fname, "wb");
  }

  bed1_t *b;
  if (dtype == DT_FLOAT_FLOAT || dtype == DT_FLOAT_INT) {
    b = init_bed1(init_data, (void*) 2);
  } else {
    b = init_bed1(init_data, (void*) 1);
  }

  FILE *idx = NULL;
  if (idx_path) {
    if (strcmp(idx_path, "stdout") == 0) {
      idx = stdout;
    } else if (strcmp(idx_path, "stderr") == 0) {
      idx = stderr;
    } else {
      idx = fopen(idx_path, "w");
    }
  }

  int64_t n = 0;
  beddata_t samples[1000] = {0};
  int64_t i;
  uint8_t aux;                  /* sub-byte encoding */
  while (bed_read1(bed, b, parse_data)) {

    if (idx) {
      fprintf(idx, "%s\t%"PRId64"\t%"PRId64"\t%"PRId64"\n", b->seqname, b->beg, b->end, n);
    }
    
    if (n < 1000) {
      samples[n++] = *((beddata_t*) b->data);
      continue;
    }

    if (n == 1000) {
      if (dtype == DT_NA) dtype = data_type(samples, n);
      if (tbk_out) tbk_write_hdr(1, dtype, n, msg, tbk_out);
      for(i=0; i<n; ++i) {
        if (tbk_out) tbk_write(&samples[i], dtype, tbk_out, i, &aux, tmp_out, &tmp_out_offset, &conf);
        free_data(&samples[i]);
      }
    }
    if (tbk_out) tbk_write(b->data, dtype, tbk_out, n, &aux, tmp_out, &tmp_out_offset, &conf);
    free_data(b->data);
    n++;
  }

  /* if no more than 1000 records */
  if (n <= 1000) {
    if (dtype == DT_NA) dtype = data_type(samples, n);
    if (tbk_out) tbk_write_hdr(1, dtype, n, msg, tbk_out);
    for(i=0; i<n; ++i) {
      if (tbk_out) tbk_write(&samples[i], dtype, tbk_out, i, &aux, tmp_out, &tmp_out_offset, &conf);
      free_data(&samples[i]);
    }
  }

  if (dtype == DT_INT2) { if (tbk_out) fwrite(&aux, 1, 1, tbk_out); aux=0; }
  
  free_bed1(b, free_data);
  free_bed_file(bed);
  if (idx) {
    fclose(idx);
    free(idx_path);
  }

  /* the actual size */
  fseek(tbk_out, HDR_NMAX0, SEEK_SET);
  fwrite(&n,     HDR_NMAX, 1, tbk_out);

  if (tmp_out) {
    fclose(tmp_out);

    /* exit(1); */
    tmp_out = fopen(tmp_fname, "rb");
    fseek(tbk_out, 0, SEEK_END);
    char data;
    unsigned j;
    for (j=0; j<tmp_out_offset; ++j) {
      fread(&data, 1, 1, tmp_out);
      fwrite(&data, 1, 1, tbk_out);
    }
    fclose(tmp_out);
    unlink(tmp_fname);
    free(tmp_fname);
  }

  if (tbk_out) fclose(tbk_out);
  
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xdc08, %rsp           # imm = 0xDC08
movl $0xbf800000, 0xc(%rsp)  # imm = 0xBF800000
cmpl $0x1, %edi
jle 0xa52d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x90(%rsp), %rdi
movl $0x1fe9, %edx           # imm = 0x1FE9
xorl %esi, %esi
callq 0x3090
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x18(%rsp)
leaq 0x442e7(%rip), %rdx     # 0x4db27
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3200
testl %eax, %eax
js 0x9a93
movl %eax, %r13d
movl $0x63, %eax
movq %rax, 0x10(%rsp)
movl $0x40, %eax
movq %rax, 0x20(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x54767(%rip), %r15     # 0x5dfe0
leaq 0x442a7(%rip), %r14     # 0x4db27
leaq 0x441fd(%rip), %r12     # 0x4da84
leal -0x68(%r13), %eax
cmpl $0xb, %eax
ja 0x98ab
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq (%r15), %rdi
callq 0x3490
movq %rax, 0x20(%rsp)
jmp 0x9a42
cmpl $0x78, %r13d
jne 0xa591
movq (%r15), %rdi
callq 0x35f0
movq %rax, 0x40(%rsp)
jmp 0x9a42
movq (%r15), %rdi
callq 0x32f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
jmp 0x9a42
movq (%r15), %rdi
callq 0x3380
cmpq $0x1fe9, %rax           # imm = 0x1FE9
jae 0xa5b1
movq (%r15), %rsi
leaq 0x90(%rsp), %rdi
callq 0x3650
jmp 0x9a42
movq (%r15), %r13
movq %r13, %rdi
leaq 0x4421d(%rip), %rsi     # 0x4db31
callq 0x3620
testl %eax, %eax
je 0x9a31
movq %r13, %rdi
leaq 0x4420b(%rip), %rsi     # 0x4db36
callq 0x3620
testl %eax, %eax
je 0x9a38
movq %r13, %rdi
leaq 0x441f9(%rip), %rsi     # 0x4db3b
callq 0x3620
movl $0x3, %ecx
movq %rcx, 0x10(%rsp)
testl %eax, %eax
je 0x9a42
movq %r13, %rdi
leaq 0x44207(%rip), %rsi     # 0x4db6a
callq 0x3620
testl %eax, %eax
je 0x9a42
movq %r13, %rdi
leaq 0x441fa(%rip), %rsi     # 0x4db74
callq 0x3620
testl %eax, %eax
je 0x9a5c
movq %r13, %rdi
leaq 0x441b0(%rip), %rsi     # 0x4db41
callq 0x3620
testl %eax, %eax
je 0x9a63
movq %r13, %rdi
leaq 0x441a0(%rip), %rsi     # 0x4db48
callq 0x3620
movl $0x6, %ecx
movq %rcx, 0x10(%rsp)
testl %eax, %eax
je 0x9a42
movq %r13, %rdi
leaq 0x44186(%rip), %rsi     # 0x4db4f
callq 0x3620
testl %eax, %eax
je 0x9a42
movq %r13, %rdi
leaq 0x4417b(%rip), %rsi     # 0x4db57
callq 0x3620
testl %eax, %eax
je 0x9a6a
movq %r13, %rdi
leaq 0x4416c(%rip), %rsi     # 0x4db5f
callq 0x3620
testl %eax, %eax
je 0x9a71
movq %r13, %rdi
leaq 0x4415e(%rip), %rsi     # 0x4db64
callq 0x3620
testl %eax, %eax
je 0x9a78
movq %r13, %rdi
leaq 0x44155(%rip), %rsi     # 0x4db6e
callq 0x3620
movl $0x20, %ecx
movq %rcx, 0x10(%rsp)
testl %eax, %eax
je 0x9a42
jmp 0xa5e8
movl $0x1, %eax
jmp 0x9a3d
movl $0x2, %eax
movq %rax, 0x10(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3200
movl %eax, %r13d
testl %eax, %eax
jns 0x9887
jmp 0x9a7f
movl $0x4, %eax
jmp 0x9a3d
movl $0x5, %eax
jmp 0x9a3d
movl $0x7, %eax
jmp 0x9a3d
movl $0x1e, %eax
jmp 0x9a3d
movl $0x1f, %eax
jmp 0x9a3d
movq 0x20(%rsp), %rax
shlq $0x8, %rax
orq $0x7, %rax
movq 0x10(%rsp), %rcx
jmp 0x9aa6
movq $0x0, 0x40(%rsp)
movl $0x4007, %eax           # imm = 0x4007
movl $0x63, %ecx
movss 0x18(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
cmpq $0x7, %rcx
cmovneq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x544fa(%rip), %r15     # 0x5dfc0
movl (%r15), %eax
addl $0x2, %eax
cmpl %ebp, %eax
movq 0x40(%rsp), %r13
jg 0xa5d0
movslq (%r15), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
movq (%rbx,%rax,8), %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x36a0
movq %rax, %r12
movq %r14, %rdi
callq 0x35f0
movq %rax, %r14
movq %r12, 0x18(%rsp)
movq %rax, (%r12)
leaq 0x43d27(%rip), %rsi     # 0x4d83a
movq %rax, %rdi
callq 0x3620
testl %eax, %eax
je 0x9b3b
leaq 0x47537(%rip), %rsi     # 0x5105d
movq %r14, %rdi
callq 0x3160
testq %rax, %rax
jne 0x9b58
movq %r14, %rdi
callq 0x3e44
movq 0x54496(%rip), %rax     # 0x5dfd8
movq (%rax), %rdi
callq 0x3040
leaq 0x4750c(%rip), %rsi     # 0x5105d
movl %eax, %edi
callq 0x3420
movq 0x18(%rsp), %rcx
movq %rax, 0x8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movq $0x0, 0x20(%rcx)
movslq (%r15), %rax
cmpl %ebp, %eax
jge 0x9b8e
movq (%rbx,%rax,8), %rdi
leaq 0x44060(%rip), %rsi     # 0x4dbe2
callq 0x3250
movq %rax, 0x38(%rsp)
jmp 0x9b97
movq $0x0, 0x38(%rsp)
movq $0x0, 0x70(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x20(%rsp), %rax
cmpq $0x6, %rax
movq 0x18(%rsp), %r12
jne 0x9c1f
movslq (%r15), %rax
movq (%rbx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x3380
leaq 0xa(%rax), %rdi
movl $0x1, %esi
callq 0x36a0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3650
movq %r14, %rdi
callq 0x3380
movl $0x706d745f, (%r14,%rax) # imm = 0x706D745F
movw $0x5f, 0x4(%r14,%rax)
leaq 0x43fdf(%rip), %rsi     # 0x4dbe2
movq %r14, 0x88(%rsp)
movq %r14, %rdi
callq 0x3250
movq %rax, 0x50(%rsp)
movq 0x20(%rsp), %rax
jmp 0x9c34
movq $0x0, 0x88(%rsp)
movq $0x0, 0x50(%rsp)
leaq -0x1f(%rax), %rbx
movl $0x1, %edi
movl $0x20, %esi
callq 0x36a0
movq %rax, %r14
movl $0x30, %edi
movl $0x1, %esi
callq 0x36a0
cmpq $0x2, %rbx
movq %rax, 0x18(%r14)
movl $0x0, %ecx
adcl $0x1, %ecx
movl %ecx, 0x28(%rax)
testq %r13, %r13
je 0x9cc0
leaq 0x43f73(%rip), %rsi     # 0x4dbeb
movq %r13, %rdi
callq 0x3620
testl %eax, %eax
je 0x9ca8
leaq 0x43f67(%rip), %rsi     # 0x4dbf2
movq %r13, %rdi
callq 0x3620
testl %eax, %eax
je 0x9cb1
leaq 0x4341a(%rip), %rsi     # 0x4d0b8
movq %r13, %rdi
callq 0x3250
jmp 0x9cbb
movq 0x54349(%rip), %rax     # 0x5dff8
jmp 0x9cb8
movq 0x54330(%rip), %rax     # 0x5dfe8
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x60(%rsp)
leaq 0x2080(%rsp), %rdi
movl $0xbb80, %edx           # imm = 0xBB80
xorl %esi, %esi
callq 0x3090
movq 0x8(%r12), %r15
testq %r15, %r15
movq %r14, 0x58(%rsp)
je 0xa202
movq %r12, %rax
addq $0x10, %rax
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %r13
movl $0xa, %esi
movq %r13, %rdi
callq 0x37b0
movq %rax, %r13
xorl %r14d, %r14d
movl $0xa, %ebx
movl (%r15), %eax
testl %eax, %eax
je 0x9d43
decl %eax
movl %eax, (%r15)
incq 0x10(%r15)
movq 0x8(%r15), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r15)
movzbl (%rax), %r12d
jmp 0x9d4e
movq %r15, %rdi
callq 0x3730
movl %eax, %r12d
leal -0x2(%rbx), %eax
cmpl %eax, %r14d
jle 0x9d66
addl %ebx, %ebx
movslq %ebx, %rsi
movq %r13, %rdi
callq 0x37b0
movq %rax, %r13
cmpl $0xa, %r12d
je 0x9d7c
cmpl $-0x1, %r12d
jne 0x9d8b
xorl %r12d, %r12d
movl %r14d, %eax
xorl %ebp, %ebp
jmp 0x9d87
movl $0x1, %ebp
xorl %r12d, %r12d
movl %r14d, %eax
xorl %ecx, %ecx
jmp 0x9d91
leal 0x1(%r14), %eax
movb $0x1, %cl
movslq %r14d, %rdx
movb %r12b, (%r13,%rdx)
movl %eax, %r14d
testb %cl, %cl
jne 0x9d21
testl %ebp, %ebp
movq 0x18(%rsp), %r12
je 0xa1f5
movq %r13, %rdi
movl $0x9, %esi
callq 0x3580
movl $0x1, %r15d
leaq 0x45ba1(%rip), %rbp     # 0x4f968
testq %rax, %rax
je 0x9de1
incl %r15d
incq %rax
movq %rax, %rdi
movl $0x9, %esi
callq 0x3580
jmp 0x9dc7
movslq %r15d, %rdi
movl $0x8, %esi
callq 0x36a0
movq %rax, %r12
movq %r13, %rdi
callq 0x3380
leaq 0x1(%rax), %rdi
movl $0x1, %esi
callq 0x36a0
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x3650
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3660
testq %rax, %rax
je 0x9e46
movq %r12, %r14
movq %rax, %rdi
callq 0x35f0
movq %rax, (%r14)
xorl %edi, %edi
movq %rbp, %rsi
callq 0x3660
addq $0x8, %r14
testq %rax, %rax
jne 0x9e28
movq %rbx, %rdi
callq 0x3370
cmpl $0x2, %r15d
jle 0xa56f
movq 0x18(%rsp), %rbp
movq 0x18(%rbp), %rbx
testq %rbx, %rbx
movq 0x58(%rsp), %r14
je 0x9e7b
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x3620
testl %eax, %eax
je 0x9e90
movq %rbx, %rdi
callq 0x3370
movq (%r12), %rdi
callq 0x35f0
movq %rax, 0x18(%rbp)
movq 0x18(%rbp), %rax
movq %rax, (%r14)
movq 0x8(%r12), %rbx
movb (%rbx), %bpl
testb %bpl, %bpl
je 0x9ed5
callq 0x3410
movq (%rax), %rax
leaq 0x1(%rbx), %rcx
cmpb $0x2e, %bpl
je 0x9eca
movsbq %bpl, %rdx
movzwl (%rax,%rdx,2), %edx
andl $0x800, %edx            # imm = 0x800
je 0xa54f
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x9eb0
movq %rbx, %rdi
callq 0x3550
cltq
movq %rax, 0x8(%r14)
movq 0x10(%r12), %rbx
movb (%rbx), %bpl
testb %bpl, %bpl
je 0x9f21
callq 0x3410
movq (%rax), %rax
leaq 0x1(%rbx), %rcx
cmpb $0x2e, %bpl
je 0x9f16
movsbq %bpl, %rdx
movzwl (%rax,%rdx,2), %edx
andl $0x800, %edx            # imm = 0x800
je 0xa55f
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x9efc
movq %rbx, %rdi
callq 0x3550
cltq
movq %rax, 0x10(%r14)
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x9345
movl %r15d, %ebx
xorl %r14d, %r14d
movq (%r12,%r14,8), %rdi
callq 0x3370
incq %r14
cmpq %r14, %rbx
jne 0x9f43
movq %r12, %rdi
callq 0x3370
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
movq 0x18(%rsp), %r12
movq 0x58(%rsp), %rbx
movq 0x10(%rsp), %r15
je 0x9f91
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %r8
leaq 0x43c72(%rip), %rsi     # 0x4dbf9
movq %r15, %r9
xorl %eax, %eax
callq 0x37e0
cmpq $0x3e7, %r15            # imm = 0x3E7
jg 0x9fea
leaq (%r15,%r15,2), %rax
leaq 0x1(%r15), %rcx
movq %rcx, 0x60(%rsp)
shlq $0x4, %rax
movq 0x18(%rbx), %rdx
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups %xmm2, 0x20a0(%rsp,%rax)
movups %xmm1, 0x2090(%rsp,%rax)
movups %xmm0, 0x2080(%rsp,%rax)
movq 0x8(%r12), %r15
movq %rcx, 0x10(%rsp)
testq %r15, %r15
jne 0x9d09
jmp 0xa1f5
movq 0x48(%rsp), %rax
movq %r13, (%rax)
cmpq $0x3e8, %r15            # imm = 0x3E8
jne 0xa16f
movq 0x20(%rsp), %rax
cmpq $0x63, %rax
movq 0x40(%rsp), %r13
leaq 0xc(%rsp), %rbp
jne 0xa028
leaq 0x2080(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0xa605
cltq
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rbx
testq %rbx, %rbx
je 0xa0da
movl $0x1, 0x6c(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r15, 0x80(%rsp)
movb $0x6b, 0x2e(%rsp)
movw $0x6274, 0x2c(%rsp)     # imm = 0x6274
movl $0x3, %esi
movl $0x1, %edx
leaq 0x2c(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
movl $0x4, %esi
movl $0x1, %edx
leaq 0x6c(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
movl $0x8, %esi
movl $0x1, %edx
leaq 0x78(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
movl $0x8, %esi
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
movl $0x1fe9, %esi           # imm = 0x1FE9
movl $0x1, %edx
leaq 0x90(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
leaq 0x2080(%rsp), %rbx
xorl %r15d, %r15d
movq 0x38(%rsp), %rdx
testq %rdx, %rdx
je 0xa124
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x2080, %rdi           # imm = 0x2080
movq 0x20(%rsp), %rsi
movl %r15d, %ecx
leaq 0xb(%rsp), %r8
movq 0x50(%rsp), %r9
pushq %rbp
leaq 0x78(%rsp), %rax
pushq %rax
callq 0x9438
addq $0x10, %rsp
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
movslq 0x20a8(%rsp,%rax), %r14
testq %r14, %r14
jle 0xa155
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
callq 0x3370
movq $0x0, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r14
jne 0xa13c
incq %r15
addq $0x30, %rbx
cmpq 0x10(%rsp), %r15
jne 0xa0e5
movq 0x58(%rsp), %rbx
movq 0x10(%rsp), %r15
jmp 0xa179
movq 0x40(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq 0x38(%rsp), %rdx
testq %rdx, %rdx
je 0xa1a9
movq 0x18(%rbx), %rdi
movq 0x20(%rsp), %rsi
movl %r15d, %ecx
leaq 0xb(%rsp), %r8
movq 0x50(%rsp), %r9
pushq %rbp
leaq 0x78(%rsp), %rax
pushq %rax
callq 0x9438
addq $0x10, %rsp
movq 0x18(%rbx), %rbx
cmpl $0x0, 0x28(%rbx)
jle 0xa1d3
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x3370
movq $0x0, (%rbx,%r14,8)
incq %r14
movslq 0x28(%rbx), %rax
cmpq %rax, %r14
jl 0xa1b6
incq %r15
movq %r15, 0x60(%rsp)
movq 0x18(%rsp), %r12
movq 0x8(%r12), %r15
testq %r15, %r15
movq 0x48(%rsp), %rax
jne 0x9cfc
jmp 0xa202
movq 0x48(%rsp), %rax
movq %r13, (%rax)
movq 0x40(%rsp), %r13
movq 0x60(%rsp), %r14
cmpq $0x3e8, %r14            # imm = 0x3E8
jg 0xa396
movq 0x20(%rsp), %rax
cmpq $0x63, %rax
movq 0x30(%rsp), %r15
jne 0xa236
leaq 0x2080(%rsp), %rdi
movl %r14d, %esi
callq 0xa605
cltq
movq 0x38(%rsp), %rbx
testq %rbx, %rbx
je 0xa2f2
leaq 0x6c(%rsp), %r15
movl $0x1, (%r15)
leaq 0x78(%rsp), %r12
movq %rax, (%r12)
leaq 0x80(%rsp), %rcx
movq %r14, (%rcx)
leaq 0x2c(%rsp), %rdi
movb $0x6b, 0x2(%rdi)
movw $0x6274, (%rdi)         # imm = 0x6274
movl $0x3, %esi
movl $0x1, %edx
movq %rbx, %rcx
movq %rax, %rbp
callq 0x3770
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq 0x30(%rsp), %r15
movq %rbx, %rcx
callq 0x3770
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x3770
movl $0x8, %esi
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
movq %rbx, %rcx
callq 0x3770
leaq 0x90(%rsp), %rdi
movl $0x1fe9, %esi           # imm = 0x1FE9
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3770
movq %rbp, %rax
movq 0x18(%rsp), %r12
testq %r14, %r14
jle 0xa3a0
movq %rax, %r12
leaq 0x2080(%rsp), %rbx
xorl %r15d, %r15d
movq 0x38(%rsp), %rdx
testq %rdx, %rdx
je 0xa34b
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
leaq (%rsp,%rax), %rdi
addq $0x2080, %rdi           # imm = 0x2080
movq %r12, %rsi
movl %r15d, %ecx
leaq 0xb(%rsp), %r8
movq 0x50(%rsp), %r9
leaq 0xc(%rsp), %rax
pushq %rax
leaq 0x78(%rsp), %rax
pushq %rax
callq 0x9438
addq $0x10, %rsp
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
movslq 0x20a8(%rsp,%rax), %r13
testq %r13, %r13
jle 0xa37b
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %rdi
callq 0x3370
movq $0x0, (%rbx,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0xa362
incq %r15
addq $0x30, %rbx
cmpq %r14, %r15
jne 0xa309
movq 0x40(%rsp), %r13
movq %r12, %rax
movq 0x18(%rsp), %r12
jmp 0xa39b
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %r15
cmpq $0x2, %rax
movq 0x58(%rsp), %rbx
jne 0xa3c4
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0xa3bf
movsbl 0xb(%rsp), %edi
callq 0x3350
movb $0x0, 0xb(%rsp)
movq 0x18(%rbx), %rbx
cmpl $0x0, 0x28(%rbx)
jle 0xa3ee
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x3370
movq $0x0, (%rbx,%r14,8)
incq %r14
movslq 0x28(%rbx), %rax
cmpq %rax, %r14
jl 0xa3d1
movq 0x58(%rsp), %rdi
callq 0x3370
movq 0x8(%r12), %rdi
callq 0x31a0
movq 0x20(%r12), %rax
testq %rax, %rax
je 0xa414
movq (%rax), %rdi
callq 0xbf84
movq (%r12), %rdi
callq 0x3370
movq 0x10(%r12), %rdi
callq 0x3370
movq 0x18(%r12), %rdi
callq 0x3370
movq %r12, %rdi
callq 0x3370
testq %r15, %r15
je 0xa44e
movq %r15, %rdi
callq 0x36c0
movq %r13, %rdi
callq 0x3370
movl $0xf, %esi
movq 0x38(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
callq 0x3120
leaq 0x60(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x3770
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa50c
callq 0x36c0
leaq 0x4336b(%rip), %rsi     # 0x4d7fe
movq 0x88(%rsp), %r13
movq %r13, %rdi
callq 0x3250
movq %rax, %rbx
movq %r12, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x3120
movq 0x70(%rsp), %r15
testq %r15, %r15
je 0xa4f4
movl $0x1, %ebp
leaq 0x78(%rsp), %r14
movl $0x1, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x35b0
movsbl 0x78(%rsp), %edi
movq %r12, %rsi
callq 0x3350
movl %ebp, %eax
incl %ebp
cmpq %rax, %r15
ja 0xa4c9
movq %rbx, %rdi
callq 0x36c0
movq %r13, %rdi
callq 0x3270
movq %r13, %rdi
callq 0x3370
testq %r12, %r12
je 0xa519
movq %r12, %rdi
callq 0x36c0
xorl %eax, %eax
addq $0xdc08, %rsp           # imm = 0xDC08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc(%rsp), %rdi
callq 0x3d43
movl $0x1, %eax
jmp 0xa51b
leaq 0xc(%rsp), %rdi
movss 0x18(%rsp), %xmm0
movss %xmm0, (%rdi)
jmp 0xa532
movq %r13, %rdi
movq 0x48(%rsp), %rsi
movq %rbx, %rdx
callq 0x3e7a
movq %r13, %rdi
movq 0x48(%rsp), %rsi
movq %rbx, %rdx
callq 0x3eb3
movq 0x48(%rsp), %rax
movq %r13, (%rax)
leaq 0x43354(%rip), %rdi     # 0x4d8d2
leaq 0x43843(%rip), %rsi     # 0x4ddc8
movl $0x6f, %edx
xorl %eax, %eax
callq 0x9395
leaq 0xc(%rsp), %rdi
movss 0x18(%rsp), %xmm0
movss %xmm0, (%rdi)
callq 0x3d43
leaq 0x42dcf(%rip), %rdi     # 0x4d37b
movl %r13d, %esi
jmp 0xa5c9
movss 0x18(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x435d3(%rip), %rdi     # 0x4db97
movl $0x1fe9, %esi           # imm = 0x1FE9
xorl %eax, %eax
callq 0x9395
leaq 0xc(%rsp), %rdi
callq 0x3d43
leaq 0x435db(%rip), %rdi     # 0x4dbbc
xorl %eax, %eax
callq 0x9395
movss 0x18(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x4357f(%rip), %rdi     # 0x4db7a
movq %r13, %rsi
xorl %eax, %eax
callq 0x9395