// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r13d
movq %r8, %r12
movq %rcx, %rbp
movl %edx, %ecx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
pushq $0x6
popq %rdx
callq 0x4528
testl %eax, %eax
jne 0x43e3
movq %r12, 0x10(%rsp)
movq %r15, (%rsp)
movq (%rbx), %rcx
movq %r14, %rsi
subq %rcx, %rsi
pushq $-0x5
popq %rax
cmpq $0x2, %rsi
jl 0x43dc
movq %rbp, %rdx
movl %eax, %ebp
leaq 0x2(%rcx), %r12
movq %r12, (%rbx)
movq %rcx, %r15
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x45df
testl %eax, %eax
jne 0x43dc
movq %r15, 0x8(%rsp)
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq 0x45df
testl %eax, %eax
je 0x43f2
movq (%rsp), %rcx
movq %rcx, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rsi
subq %rsi, %r14
cmpq $0x14, %r14
movq (%rsp), %rcx
movl %ebp, %eax
jl 0x43e0
movl %r13d, %ecx
shrl $0x18, %ecx
leaq 0x1(%rsi), %rdx
movq %rdx, (%rbx)
movb %cl, (%rsi)
movl %r13d, %eax
shrl $0x10, %eax
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb %al, (%rcx)
movq (%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%rbx)
movl %r13d, %edx
movb %dh, (%rax)
movq (%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%rbx)
movb %dl, (%rax)
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, (%rbx)
xorl %eax, %eax
movb %al, (%rdx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb $0x9, %r8b
movb %r8b, (%rcx)
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, (%rbx)
movb $0x3a, %cl
movb %cl, (%rdx)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdx
movq %rdx, (%rbx)
movb $-0x80, %dl
movb %dl, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %al, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb $0x1, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb $0x51, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %dl, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %al, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb $0x27, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb $-0x73, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %al, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %al, (%rsi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, (%rbx)
movb %r8b, (%rsi)
movq (%rbx), %rdi
leaq 0x1(%rdi), %rsi
movq %rsi, (%rbx)
movb %cl, (%rdi)
movq (%rbx), %rsi
leaq 0x1(%rsi), %rcx
movq %rcx, (%rbx)
movb %dl, (%rsi)
movl (%rbx), %edx
subl %r12d, %edx
movq 0x8(%rsp), %rcx
movb %dh, (%rcx)
movl (%rbx), %edx
subl %r12d, %edx
movb %dl, 0x1(%rcx)
jmp 0x43e3