// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_hexdump_n
static int mg_hexdump_n(const void *buf, int len, char *dst, int dst_len,
                        int offset) {
  const unsigned char *p = (const unsigned char *) buf;
  char ascii[17] = "";
  int i, idx, n = 0;

  for (i = 0; i < len; i++) {
    idx = i % 16;
    if (idx == 0) {
      if (i > 0) n += snprintf(dst + n, MAX(dst_len - n, 0), "  %s\n", ascii);
      n += snprintf(dst + n, MAX(dst_len - n, 0), "%04x ", i + offset);
    }
    if (dst_len - n < 0) {
      return n;
    }
    n += snprintf(dst + n, MAX(dst_len - n, 0), " %02x", p[i]);
    ascii[idx] = p[i] < 0x20 || p[i] > 0x7e ? '.' : p[i];
    ascii[idx + 1] = '\0';
  }

  while (i++ % 16) n += snprintf(dst + n, MAX(dst_len - n, 0), "%s", "   ");
  n += snprintf(dst + n, MAX(dst_len - n, 0), "  %s\n", ascii);

  return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebx
movq %rdx, 0x8(%rsp)
movl %esi, %r15d
movq %rdi, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movb $0x0, 0x20(%rsp)
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %r15d
movl %r8d, %eax
movq %rax, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %rdi, 0x40(%rsp)
movq %rbx, 0x30(%rsp)
cmpq %rbp, %r15
je 0x10235
movq %rbp, %r14
andq $0xf, %r14
jne 0x101db
testq %rbp, %rbp
je 0x1019f
movq %rbx, %rax
movslq %r13d, %r12
movq 0x8(%rsp), %rbx
leaq (%rbx,%r12), %rdi
movq %rax, %rsi
subl %r12d, %esi
testl %esi, %esi
cmovlel %ecx, %esi
leaq 0x6470(%rip), %rdx      # 0x165f9
leaq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x31e0
xorl %ecx, %ecx
movl %eax, %r13d
addl %r12d, %r13d
jmp 0x101a4
movq 0x8(%rsp), %rbx
movslq %r13d, %r12
leaq (%rbx,%r12), %rdi
movq 0x30(%rsp), %rbx
movl %ebx, %esi
subl %r12d, %esi
testl %esi, %esi
cmovlel %ecx, %esi
movq 0x38(%rsp), %rax
leal (%rax,%rbp), %ecx
leaq 0x6436(%rip), %rdx      # 0x165ff
xorl %eax, %eax
callq 0x31e0
movl %eax, %r13d
addl %r12d, %r13d
movq 0x40(%rsp), %r12
movl %ebx, %eax
subl %r13d, %eax
js 0x102aa
movslq %r13d, %rdi
addq 0x8(%rsp), %rdi
movl %eax, %esi
movzbl (%r12,%rbp), %ecx
leaq 0x6409(%rip), %rdx      # 0x16605
xorl %eax, %eax
callq 0x31e0
addl %eax, %r13d
movzbl (%r12,%rbp), %eax
leal -0x7f(%rax), %ecx
cmpb $-0x5f, %cl
pushq $0x2e
popq %rcx
cmovbl %ecx, %eax
movl %ebp, %ecx
andl $0xf, %ecx
movb %al, 0x10(%rsp,%rcx)
xorl %ecx, %ecx
leaq 0x10(%rsp), %rax
movb $0x0, 0x1(%r14,%rax)
incq %rbp
jmp 0x10151
leaq 0x4dba(%rip), %r12      # 0x14ff6
leaq 0x63c8(%rip), %rbp      # 0x1660b
movslq %r13d, %r14
testb $0xf, %r15b
je 0x1027c
incl %r15d
movq 0x8(%rsp), %rax
leaq (%rax,%r14), %rdi
movl %ebx, %esi
subl %r14d, %esi
testl %esi, %esi
movl $0x0, %eax
cmovlel %eax, %esi
movq %r12, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x31e0
movl %eax, %r13d
addl %r14d, %r13d
jmp 0x10243
movq 0x8(%rsp), %rdi
addq %r14, %rdi
subl %r14d, %ebx
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
leaq 0x6364(%rip), %rdx      # 0x165f9
leaq 0x10(%rsp), %rcx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x31e0
movl %eax, %r13d
addl %r14d, %r13d
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq