// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0x6, %edx
callq 0x4a33
testl %eax, %eax
jne 0x48e8
movq %r12, 0x10(%rsp)
movq %r15, (%rsp)
movq (%rbx), %rcx
movq %r14, %rsi
subq %rcx, %rsi
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
cmpq $0x2, %rsi
jl 0x48e1
leaq 0x2(%rcx), %r15
movq %r15, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rcx, %r12
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x4ae7
testl %eax, %eax
jne 0x48e1
movq %r15, 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x4ae7
testl %eax, %eax
je 0x48f7
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 $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jl 0x48e5
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), %ecx
movq 0x8(%rsp), %rdx
subl %edx, %ecx
movq %r12, %rsi
movb %ch, (%rsi)
movl (%rbx), %ecx
subl %edx, %ecx
movb %cl, 0x1(%r12)
jmp 0x48e8