// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: hexdump
static void hexdump(struct ns_connection *nc, const char *path,
                    int num_bytes, int ev) {
  const struct iobuf *io = ev == NS_SEND ? &nc->send_iobuf : &nc->recv_iobuf;
  FILE *fp;
  char *buf, src[60], dst[60];
  int buf_size = num_bytes * 5 + 100;

  if ((fp = fopen(path, "a")) != NULL) {
    ns_sock_to_str(nc->sock, src, sizeof(src), 3);
    ns_sock_to_str(nc->sock, dst, sizeof(dst), 7);
    fprintf(fp, "%lu %p %s %s %s %d\n", (unsigned long) time(NULL),
            nc->user_data, src,
            ev == NS_RECV ? "<-" : ev == NS_SEND ? "->" :
            ev == NS_ACCEPT ? "<A" : ev == NS_CONNECT ? "C>" : "XX",
            dst, num_bytes);
    if (num_bytes > 0 && (buf = (char *) NS_MALLOC(buf_size)) != NULL) {
      ns_hexdump(io->buf + (ev == NS_SEND ? 0 : io->len) -
        (ev == NS_SEND ? 0 : num_bytes), num_bytes, buf, buf_size);
      fprintf(fp, "%s", buf);
      NS_FREE(buf);
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
cmpl $0x4, -0x18(%rbp)
jne 0xb5fb0
movq -0x8(%rbp), %rax
addq $0x58, %rax
movq %rax, -0xc0(%rbp)
jmp 0xb5fbf
movq -0x8(%rbp), %rax
addq $0x40, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x20(%rbp)
imull $0x5, -0x14(%rbp), %eax
addl $0x64, %eax
movl %eax, -0xb4(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x9acf(%rip), %rsi      # 0xbfab1
callq 0xdd20
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xb61f9
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edi
leaq -0x70(%rbp), %rsi
movl $0x3c, %edx
movl $0x3, %ecx
callq 0xaf9d0
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edi
leaq -0xb0(%rbp), %rsi
movl $0x3c, %edx
movl $0x7, %ecx
callq 0xaf9d0
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0xd980
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpl $0x3, -0x18(%rbp)
jne 0xb607a
leaq 0x10d38(%rip), %rax     # 0xc6da9
movq %rax, -0xe8(%rbp)
jmp 0xb60e1
cmpl $0x4, -0x18(%rbp)
jne 0xb6090
leaq 0x10d25(%rip), %rax     # 0xc6dac
movq %rax, -0xf0(%rbp)
jmp 0xb60d3
cmpl $0x1, -0x18(%rbp)
jne 0xb60a6
leaq 0x10d12(%rip), %rax     # 0xc6daf
movq %rax, -0xf8(%rbp)
jmp 0xb60c5
movl -0x18(%rbp), %edx
leaq 0x10d05(%rip), %rax     # 0xc6db5
leaq 0x10cfb(%rip), %rcx     # 0xc6db2
cmpl $0x2, %edx
cmoveq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xc8(%rbp), %r8
movq -0xd0(%rbp), %rcx
movq -0xd8(%rbp), %rdx
movq -0xe0(%rbp), %rdi
movq -0xe8(%rbp), %r9
leaq -0xb0(%rbp), %r10
movl -0x14(%rbp), %eax
leaq 0x10c80(%rip), %rsi     # 0xc6d95
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0xd2d0
cmpl $0x0, -0x14(%rbp)
jle 0xb61f0
movslq -0xb4(%rbp), %rdi
callq 0xdb70
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xb61f0
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x100(%rbp)
cmpl $0x4, -0x18(%rbp)
jne 0xb6167
xorl %eax, %eax
movq %rax, -0x108(%rbp)
jmp 0xb6176
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rax
movq -0x108(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x110(%rbp)
cmpl $0x4, -0x18(%rbp)
jne 0xb619e
xorl %eax, %eax
movl %eax, -0x114(%rbp)
jmp 0xb61a7
movl -0x14(%rbp), %eax
movl %eax, -0x114(%rbp)
movq -0x110(%rbp), %rdi
movl -0x114(%rbp), %eax
movslq %eax, %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
movq -0x30(%rbp), %rdx
movl -0xb4(%rbp), %ecx
callq 0xafb10
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xe650(%rip), %rsi      # 0xc4830
movb $0x0, %al
callq 0xd2d0
movq -0x30(%rbp), %rdi
callq 0xd2c0
movq -0x28(%rbp), %rdi
callq 0xd5b0
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)