// File: tenup-coin[P]seeder/dns.c
// Function: write_record_soa
int static write_record_soa(unsigned char** outpos, const unsigned char *outend, char *name, int offset, dns_class cls, int ttl, const char* mname, const char *rname,
                     uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum) {
  unsigned char *oldpos = *outpos;
  int ret = write_record(outpos, outend, name, offset, TYPE_SOA, cls, ttl);
  if (ret) return ret;
  int error = 0;
  if (outend - *outpos < 2) { error = -5; goto error; }
  (*outpos) += 2;
  unsigned char *curpos = *outpos;
  ret = write_name(outpos, outend, mname, -1);
  if (ret) { error = ret; goto error; }
  ret = write_name(outpos, outend, rname, -1);
  if (ret) { error = ret; goto error; }
  if (outend - *outpos < 20) { error = -5; goto error; }
  *((*outpos)++) = (serial  >> 24) & 0xFF; *((*outpos)++) = (serial  >> 16) & 0xFF; *((*outpos)++) = (serial  >> 8) & 0xFF; *((*outpos)++) = serial  & 0xFF;
  *((*outpos)++) = (refresh >> 24) & 0xFF; *((*outpos)++) = (refresh >> 16) & 0xFF; *((*outpos)++) = (refresh >> 8) & 0xFF; *((*outpos)++) = refresh & 0xFF;
  *((*outpos)++) = (retry   >> 24) & 0xFF; *((*outpos)++) = (retry   >> 16) & 0xFF; *((*outpos)++) = (retry   >> 8) & 0xFF; *((*outpos)++) = retry   & 0xFF;
  *((*outpos)++) = (expire  >> 24) & 0xFF; *((*outpos)++) = (expire  >> 16) & 0xFF; *((*outpos)++) = (expire  >> 8) & 0xFF; *((*outpos)++) = expire  & 0xFF;
  *((*outpos)++) = (minimum >> 24) & 0xFF; *((*outpos)++) = (minimum >> 16) & 0xFF; *((*outpos)++) = (minimum >> 8) & 0xFF; *((*outpos)++) = minimum & 0xFF;
  curpos[-2] = (*outpos - curpos) >> 8;
  curpos[-1] = (*outpos - curpos) & 0xFF;
  return 0;
error:
  *outpos = oldpos;
  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r9d
movl -0x2c(%rbp), %eax
movl $0x6, %r8d
movl %eax, (%rsp)
callq 0x65c0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x5fd9
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6350
movl $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jge 0x6000
movl $0xfffffffb, -0x40(%rbp) # imm = 0xFFFFFFFB
jmp 0x633f
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x2, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rbp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x6750
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x6043
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x633f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x18(%rbp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x6750
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x606d
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x633f
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
cmpq $0x14, %rax
jge 0x608d
movl $0xfffffffb, -0x40(%rbp) # imm = 0xFFFFFFFB
jmp 0x633f
movl 0x20(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x20(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x20(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x20(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x28(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x28(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x28(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x28(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x30(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x30(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x30(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x30(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x38(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x38(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x38(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x38(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x40(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x40(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x40(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movl 0x40(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
sarq $0x8, %rax
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, -0x2(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, -0x1(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6350
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)