// File: tenup-coin[P]seeder/dns.c
// Function: dnshandle
ssize_t static dnshandle(dns_opt_t *opt, const unsigned char *inbuf, size_t insize, unsigned char* outbuf) {
  int error = 0;
  if (insize < 12) // DNS header
    return -1;
  // copy id
  outbuf[0] = inbuf[0];
  outbuf[1] = inbuf[1];
  // copy flags;
  outbuf[2] = inbuf[2];
  outbuf[3] = inbuf[3];
  // clear error
  outbuf[3] &= ~15;
  // check qr
  if (inbuf[2] & 128) { /* printf("Got response?\n"); */ error = 1; goto error; }
  // check opcode
  if (((inbuf[2] & 120) >> 3) != 0) { /* printf("Opcode nonzero?\n"); */ error = 4; goto error; }
  // unset TC
  outbuf[2] &= ~2;
  // unset RA
  outbuf[3] &= ~128;
  // check questions
  int nquestion = (inbuf[4] << 8) + inbuf[5];
  if (nquestion == 0) { /* printf("No questions?\n"); */ error = 0; goto error; }
  if (nquestion > 1) { /* printf("Multiple questions %i?\n", nquestion); */ error = 4; goto error; }
  const unsigned char *inpos = inbuf + 12;
  const unsigned char *inend = inbuf + insize;
  char name[256];
  int offset = inpos - inbuf;
  int ret = parse_name(&inpos, inend, inbuf, name, 256);
  if (ret == -1) { error = 1; goto error; }
  if (ret == -2) { error = 5; goto error; }
  int namel = strlen(name), hostl = strlen(opt->host);
  if (strcasecmp(name, opt->host) && (namel<hostl+2 || name[namel-hostl-1]!='.' || strcasecmp(name+namel-hostl,opt->host))) { error = 5; goto error; }
  if (inend - inpos < 4) { error = 1; goto error; }
  // copy question to output
  memcpy(outbuf+12, inbuf+12, inpos+4 - (inbuf+12));
  // set counts
  outbuf[4] = 0;  outbuf[5] = 1;
  outbuf[6] = 0;  outbuf[7] = 0;
  outbuf[8] = 0;  outbuf[9] = 0;
  outbuf[10] = 0; outbuf[11] = 0;
  // set qr
  outbuf[2] |= 128;
  
  int typ = (inpos[0] << 8) + inpos[1];
  int cls = (inpos[2] << 8) + inpos[3];
  inpos += 4;
  
  unsigned char *outpos = outbuf+(inpos-inbuf);
  unsigned char *outend = outbuf + BUFLEN;
  
   //printf("DNS: Request host='%s' type=%i class=%i\n", name, typ, cls);
  
  // calculate max size of authority section
  
  int max_auth_size = 0;
  
  if (!((typ == TYPE_NS || typ == QTYPE_ANY) && (cls == CLASS_IN || cls == QCLASS_ANY))) {
    // authority section will be necessary, either NS or SOA
    unsigned char *newpos = outpos;
    write_record_ns(&newpos, outend, "", offset, CLASS_IN, 0, opt->ns);
    max_auth_size = newpos - outpos;

    newpos = outpos;
    write_record_soa(&newpos, outend, "", offset, CLASS_IN, opt->nsttl, opt->ns, opt->mbox, time(NULL), 604800, 86400, 2592000, 604800);
    if (max_auth_size < newpos - outpos)
        max_auth_size = newpos - outpos;
    //printf("Authority section will claim %i bytes max\n", max_auth_size);
  }
  
  // Answer section

  int have_ns = 0;

  // NS records
  if ((typ == TYPE_NS || typ == QTYPE_ANY) && (cls == CLASS_IN || cls == QCLASS_ANY)) {
    int ret2 = write_record_ns(&outpos, outend - max_auth_size, "", offset, CLASS_IN, opt->nsttl, opt->ns);
    //printf("wrote NS record: %i\n", ret2);
    if (!ret2) { outbuf[7]++; have_ns++; }
  }

  // SOA records
  if ((typ == TYPE_SOA || typ == QTYPE_ANY) && (cls == CLASS_IN || cls == QCLASS_ANY) && opt->mbox) {
    int ret2 = write_record_soa(&outpos, outend - max_auth_size, "", offset, CLASS_IN, opt->nsttl, opt->ns, opt->mbox, time(NULL), 604800, 86400, 2592000, 604800);
    //printf("wrote SOA record: %i\n", ret2);
    if (!ret2) { outbuf[7]++; }
  }
  
  // A/AAAA records
  if ((typ == TYPE_A || typ == TYPE_AAAA || typ == QTYPE_ANY) && (cls == CLASS_IN || cls == QCLASS_ANY)) {
    addr_t addr[32];
    int naddr = opt->cb((void*)opt, name, addr, 32, typ == TYPE_A || typ == QTYPE_ANY, typ == TYPE_AAAA || typ == QTYPE_ANY);
    int n = 0;
    while (n < naddr) {
      int ret = 1;
      if (addr[n].v == 4)
         ret = write_record_a(&outpos, outend - max_auth_size, "", offset, CLASS_IN, opt->datattl, &addr[n]);
      else if (addr[n].v == 6)
         ret = write_record_aaaa(&outpos, outend - max_auth_size, "", offset, CLASS_IN, opt->datattl, &addr[n]);
      //printf("wrote A record: %i\n", ret);
      if (!ret) {
        n++;
        outbuf[7]++;
      } else
        break;
    }
  }
  
  // Authority section
  if (!have_ns && outbuf[7]) {
    int ret2 = write_record_ns(&outpos, outend, "", offset, CLASS_IN, opt->nsttl, opt->ns);
    //printf("wrote NS record: %i\n", ret2);
    if (!ret2) {
      outbuf[9]++;
    }
  }
  else if (!outbuf[7]) {
    // Didn't include any answers, so reply with SOA as this is a negative
    // response. If we replied with NS above we'd create a bad horizontal
    // referral loop, as the NS response indicates where the resolver should
    // try next.
    int ret2 = write_record_soa(&outpos, outend, "", offset, CLASS_IN, opt->nsttl, opt->ns, opt->mbox, time(NULL), 604800, 86400, 2592000, 604800);
    //printf("wrote SOA record: %i\n", ret2);
    if (!ret2) { outbuf[9]++; }
  }
  
  // set AA
  outbuf[2] |= 4;
  
  return outpos - outbuf;
error:
  // set error
  outbuf[3] |= error & 0xF;
  // set counts
  outbuf[4] = 0;  outbuf[5] = 0;
  outbuf[6] = 0;  outbuf[7] = 0;
  outbuf[8] = 0;  outbuf[9] = 0;
  outbuf[10] = 0; outbuf[11] = 0;
  return 12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0xc, -0x20(%rbp)
jae 0x5166
movq $-0x1, -0x8(%rbp)
jmp 0x5be8
movq -0x18(%rbp), %rax
movb (%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movb 0x1(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x18(%rbp), %rax
movb 0x2(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x18(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x28(%rbp), %rax
movzbl 0x3(%rax), %ecx
andl $-0x10, %ecx
movb %cl, 0x3(%rax)
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x51c8
movl $0x1, -0x2c(%rbp)
jmp 0x5b8d
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x78, %eax
sarl $0x3, %eax
cmpl $0x0, %eax
je 0x51e7
movl $0x4, -0x2c(%rbp)
jmp 0x5b8d
movq -0x28(%rbp), %rax
movzbl 0x2(%rax), %ecx
andl $-0x3, %ecx
movb %cl, 0x2(%rax)
movq -0x28(%rbp), %rax
movzbl 0x3(%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movb %cl, 0x3(%rax)
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x8, %eax
movq -0x18(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x5230
movl $0x0, -0x2c(%rbp)
jmp 0x5b8d
cmpl $0x1, -0x30(%rbp)
jle 0x5242
movl $0x4, -0x2c(%rbp)
jmp 0x5b8d
movq -0x18(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x144(%rbp)
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x140(%rbp), %rcx
leaq -0x38(%rbp), %rdi
movl $0x100, %r8d            # imm = 0x100
callq 0x5c00
movl %eax, -0x148(%rbp)
cmpl $-0x1, -0x148(%rbp)
jne 0x52a4
movl $0x1, -0x2c(%rbp)
jmp 0x5b8d
cmpl $-0x2, -0x148(%rbp)
jne 0x52b9
movl $0x5, -0x2c(%rbp)
jmp 0x5b8d
leaq -0x140(%rbp), %rdi
callq 0x4210
movl %eax, -0x14c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4210
movl %eax, -0x150(%rbp)
leaq -0x140(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4540
cmpl $0x0, %eax
je 0x5366
movl -0x14c(%rbp), %eax
movl -0x150(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jl 0x535a
movl -0x14c(%rbp), %eax
subl -0x150(%rbp), %eax
subl $0x1, %eax
cltq
movsbl -0x140(%rbp,%rax), %eax
cmpl $0x2e, %eax
jne 0x535a
leaq -0x140(%rbp), %rdi
movslq -0x14c(%rbp), %rax
addq %rax, %rdi
movslq -0x150(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4540
cmpl $0x0, %eax
je 0x5366
movl $0x5, -0x2c(%rbp)
jmp 0x5b8d
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x4, %rax
jge 0x5383
movl $0x1, -0x2c(%rbp)
jmp 0x5b8d
movq -0x28(%rbp), %rdi
addq $0xc, %rdi
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
movq -0x38(%rbp), %rdx
addq $0x4, %rdx
movq -0x18(%rbp), %rax
addq $0xc, %rax
subq %rax, %rdx
callq 0x4420
movq -0x28(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x28(%rbp), %rax
movb $0x1, 0x5(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x6(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x7(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x9(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0xa(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0xb(%rax)
movq -0x28(%rbp), %rax
movzbl 0x2(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x2(%rax)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movq -0x38(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x154(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
movq -0x38(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x158(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
movq -0x28(%rbp), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x168(%rbp)
movl $0x0, -0x16c(%rbp)
cmpl $0x2, -0x154(%rbp)
je 0x5486
cmpl $0xff, -0x154(%rbp)
jne 0x54a3
cmpl $0x1, -0x158(%rbp)
je 0x55f7
cmpl $0xff, -0x158(%rbp)
je 0x55f7
movq -0x160(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x168(%rbp), %rsi
movl -0x144(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
leaq -0x178(%rbp), %rdi
leaq 0x2e251(%rip), %rdx     # 0x33725
movl $0x1, %r8d
xorl %r9d, %r9d
movq %rax, (%rsp)
callq 0x5e30
movq -0x178(%rbp), %rax
movq -0x160(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x16c(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x448(%rbp)
movl -0x144(%rbp), %eax
movl %eax, -0x440(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x43c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x438(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x430(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq -0x448(%rbp), %rsi
movl -0x440(%rbp), %ecx
movl -0x43c(%rbp), %r9d
movq -0x438(%rbp), %r11
movq -0x430(%rbp), %r10
leaq -0x178(%rbp), %rdi
leaq 0x2e19c(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x93a80, 0x18(%rsp)    # imm = 0x93A80
movl $0x15180, 0x20(%rsp)    # imm = 0x15180
movl $0x278d00, 0x28(%rsp)   # imm = 0x278D00
movl $0x93a80, 0x30(%rsp)    # imm = 0x93A80
callq 0x5f60
movslq -0x16c(%rbp), %rax
movq -0x178(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jge 0x55f5
movq -0x178(%rbp), %rax
movq -0x160(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x16c(%rbp)
jmp 0x55f7
movl $0x0, -0x17c(%rbp)
cmpl $0x2, -0x154(%rbp)
je 0x561a
cmpl $0xff, -0x154(%rbp)
jne 0x56a5
cmpl $0x1, -0x158(%rbp)
je 0x562f
cmpl $0xff, -0x158(%rbp)
jne 0x56a5
movq -0x168(%rbp), %rsi
movslq -0x16c(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movl -0x144(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r9d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
leaq -0x160(%rbp), %rdi
leaq 0x2e0bc(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x5e30
movl %eax, -0x180(%rbp)
cmpl $0x0, -0x180(%rbp)
jne 0x56a3
movq -0x28(%rbp), %rax
movb 0x7(%rax), %cl
addb $0x1, %cl
movb %cl, 0x7(%rax)
movl -0x17c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
jmp 0x56a5
cmpl $0x6, -0x154(%rbp)
je 0x56be
cmpl $0xff, -0x154(%rbp)
jne 0x57c9
cmpl $0x1, -0x158(%rbp)
je 0x56d7
cmpl $0xff, -0x158(%rbp)
jne 0x57c9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x57c9
movq -0x168(%rbp), %rax
movslq -0x16c(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x468(%rbp)
movl -0x144(%rbp), %eax
movl %eax, -0x460(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x45c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x458(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x450(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq -0x468(%rbp), %rsi
movl -0x460(%rbp), %ecx
movl -0x45c(%rbp), %r9d
movq -0x458(%rbp), %r11
movq -0x450(%rbp), %r10
leaq -0x160(%rbp), %rdi
leaq 0x2dfb2(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x93a80, 0x18(%rsp)    # imm = 0x93A80
movl $0x15180, 0x20(%rsp)    # imm = 0x15180
movl $0x278d00, 0x28(%rsp)   # imm = 0x278D00
movl $0x93a80, 0x30(%rsp)    # imm = 0x93A80
callq 0x5f60
movl %eax, -0x184(%rbp)
cmpl $0x0, -0x184(%rbp)
jne 0x57c7
movq -0x28(%rbp), %rax
movb 0x7(%rax), %cl
addb $0x1, %cl
movb %cl, 0x7(%rax)
jmp 0x57c9
cmpl $0x1, -0x154(%rbp)
je 0x57eb
cmpl $0x1c, -0x154(%rbp)
je 0x57eb
cmpl $0xff, -0x154(%rbp)
jne 0x5a16
cmpl $0x1, -0x158(%rbp)
je 0x5804
cmpl $0xff, -0x158(%rbp)
jne 0x5a16
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x490(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x488(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0x480(%rbp)
leaq -0x410(%rbp), %rax
movq %rax, -0x478(%rbp)
movb $0x1, %al
cmpl $0x1, -0x154(%rbp)
movb %al, -0x469(%rbp)
je 0x585e
cmpl $0xff, -0x154(%rbp)
sete %al
movb %al, -0x469(%rbp)
movb -0x469(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x498(%rbp)
movb $0x1, %al
cmpl $0x1c, -0x154(%rbp)
movb %al, -0x491(%rbp)
je 0x5893
cmpl $0xff, -0x154(%rbp)
sete %al
movb %al, -0x491(%rbp)
movq -0x490(%rbp), %rax
movl -0x498(%rbp), %r8d
movq -0x478(%rbp), %rdx
movq -0x480(%rbp), %rsi
movq -0x488(%rbp), %rdi
movb -0x491(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %r9d
movl $0x20, %ecx
callq *%rax
movl %eax, -0x414(%rbp)
movl $0x0, -0x418(%rbp)
movl -0x418(%rbp), %eax
cmpl -0x414(%rbp), %eax
jge 0x5a14
movl $0x1, -0x41c(%rbp)
movslq -0x418(%rbp), %rcx
leaq -0x410(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x4, (%rax)
jne 0x596e
movq -0x168(%rbp), %rsi
movslq -0x16c(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movl -0x144(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r9d
movslq -0x418(%rbp), %rdx
leaq -0x410(%rbp), %rax
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
leaq -0x160(%rbp), %rdi
leaq 0x2ddce(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x6360
movl %eax, -0x41c(%rbp)
jmp 0x59e6
movslq -0x418(%rbp), %rcx
leaq -0x410(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x6, (%rax)
jne 0x59e4
movq -0x168(%rbp), %rsi
movslq -0x16c(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movl -0x144(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r9d
movslq -0x418(%rbp), %rdx
leaq -0x410(%rbp), %rax
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
leaq -0x160(%rbp), %rdi
leaq 0x2dd56(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x6490
movl %eax, -0x41c(%rbp)
jmp 0x59e6
cmpl $0x0, -0x41c(%rbp)
jne 0x5a0d
movl -0x418(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x418(%rbp)
movq -0x28(%rbp), %rax
movb 0x7(%rax), %cl
addb $0x1, %cl
movb %cl, 0x7(%rax)
jmp 0x5a0f
jmp 0x5a14
jmp 0x58da
jmp 0x5a16
cmpl $0x0, -0x17c(%rbp)
jne 0x5a87
movq -0x28(%rbp), %rax
movzbl 0x7(%rax), %eax
cmpl $0x0, %eax
je 0x5a87
movq -0x168(%rbp), %rsi
movl -0x144(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r9d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
leaq -0x160(%rbp), %rdi
leaq 0x2dcce(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x5e30
movl %eax, -0x420(%rbp)
cmpl $0x0, -0x420(%rbp)
jne 0x5a82
movq -0x28(%rbp), %rax
movb 0x9(%rax), %cl
addb $0x1, %cl
movb %cl, 0x9(%rax)
jmp 0x5b6b
movq -0x28(%rbp), %rax
cmpb $0x0, 0x7(%rax)
jne 0x5b69
movq -0x168(%rbp), %rax
movq %rax, -0x4b8(%rbp)
movl -0x144(%rbp), %eax
movl %eax, -0x4b0(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4ac(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x4a8(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x4a0(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq -0x4b8(%rbp), %rsi
movl -0x4b0(%rbp), %ecx
movl -0x4ac(%rbp), %r9d
movq -0x4a8(%rbp), %r11
movq -0x4a0(%rbp), %r10
leaq -0x160(%rbp), %rdi
leaq 0x2dc12(%rip), %rdx     # 0x33725
movl $0x1, %r8d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x93a80, 0x18(%rsp)    # imm = 0x93A80
movl $0x15180, 0x20(%rsp)    # imm = 0x15180
movl $0x278d00, 0x28(%rsp)   # imm = 0x278D00
movl $0x93a80, 0x30(%rsp)    # imm = 0x93A80
callq 0x5f60
movl %eax, -0x424(%rbp)
cmpl $0x0, -0x424(%rbp)
jne 0x5b67
movq -0x28(%rbp), %rax
movb 0x9(%rax), %cl
addb $0x1, %cl
movb %cl, 0x9(%rax)
jmp 0x5b69
jmp 0x5b6b
movq -0x28(%rbp), %rax
movzbl 0x2(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x2(%rax)
movq -0x160(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x5be8
movl -0x2c(%rbp), %edx
andl $0xf, %edx
movq -0x28(%rbp), %rax
movzbl 0x3(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x3(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x5(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x6(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x7(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x9(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0xa(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0xb(%rax)
movq $0xc, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
nopw %cs:(%rax,%rax)