// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_hexdump_connection
void mg_hexdump_connection(struct mg_connection *nc, const char *path,
                           const void *buf, int num_bytes, int ev) {
  FILE *fp = NULL;
  char src[60], dst[60];
  const char *tag = NULL;
  switch (ev) {
    case MG_EV_RECV:
      tag = "<-";
      break;
    case MG_EV_SEND:
      tag = "->";
      break;
    case MG_EV_ACCEPT:
      tag = "<A";
      break;
    case MG_EV_CONNECT:
      tag = "C>";
      break;
    case MG_EV_CLOSE:
      tag = "XX";
      break;
  }
  if (tag == NULL) return; /* Don't log MG_EV_TIMER, etc */

  if (strcmp(path, "-") == 0) {
    fp = stdout;
  } else if (strcmp(path, "--") == 0) {
    fp = stderr;
#if MG_ENABLE_FILESYSTEM
  } else {
    fp = mg_fopen(path, "a");
#endif
  }
  if (fp == NULL) return;

  mg_conn_addr_to_str(nc, src, sizeof(src),
                      MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
  mg_conn_addr_to_str(nc, dst, sizeof(dst), MG_SOCK_STRINGIFY_IP |
                                                MG_SOCK_STRINGIFY_PORT |
                                                MG_SOCK_STRINGIFY_REMOTE);
  fprintf(fp, "%lu %p %s %s %s %d\n", (unsigned long) mg_time(), (void *) nc,
          src, tag, dst, (int) num_bytes);
  if (num_bytes > 0) {
    mg_hexdumpf(fp, buf, num_bytes);
  }
  if (fp != stdout && fp != stderr) fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
decl %r8d
cmpl $0x4, %r8d
ja 0x84a1
leaq 0xcf60(%rip), %rax      # 0x15380
movslq (%rax,%r8,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xdc89(%rip), %r12      # 0x160b9
jmp 0x8454
leaq 0xdc86(%rip), %r12      # 0x160bf
jmp 0x8454
leaq 0xdc71(%rip), %r12      # 0x160b3
jmp 0x8454
leaq 0xdc6b(%rip), %r12      # 0x160b6
jmp 0x8454
leaq 0xdc68(%rip), %r12      # 0x160bc
xorl %eax, %eax
testb %al, %al
jne 0x85b0
leaq 0xdc5e(%rip), %rsi      # 0x160c3
movq %r13, %rdi
callq 0x3310
testl %eax, %eax
je 0x8498
leaq 0xdc4a(%rip), %rsi      # 0x160c2
movq %r13, %rdi
callq 0x3310
testl %eax, %eax
je 0x84a8
leaq 0xef11(%rip), %rsi      # 0x1739c
movq %r13, %rdi
callq 0x3370
movq %rax, %r13
jmp 0x84b2
movq 0x15b31(%rip), %rax     # 0x1dfd0
jmp 0x84af
movb $0x1, %al
xorl %r12d, %r12d
jmp 0x8456
movq 0x15b41(%rip), %rax     # 0x1dff0
movq (%rax), %r13
testq %r13, %r13
je 0x85b0
movq %r14, 0x8(%rsp)
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %rbp
movapd %xmm0, (%rbp)
movq 0xc0(%r15), %rax
movq 0x10(%rax), %rax
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq *0x78(%rax)
leaq 0x20(%rsp), %rsi
movl $0x3c, %edx
movq %rbp, %rdi
movl $0x3, %ecx
callq 0xaa56
leaq 0x10(%rsp), %r14
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq 0xc0(%r15), %rax
movq 0x10(%rax), %rax
movq %r15, %rdi
movl $0x4, %esi
movq %r14, %rdx
callq *0x78(%rax)
movl $0x3c, %edx
movq %r14, %rdi
movq %rbp, %rsi
movl $0x7, %ecx
callq 0xaa56
callq 0x4b23
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xcdb8(%rip), %xmm0     # 0x15308
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0xdb63(%rip), %rsi      # 0x160c5
movq %r13, %rdi
movq %r15, %rcx
leaq 0x20(%rsp), %r8
movq %r12, %r9
xorl %eax, %eax
pushq %rbx
pushq %rbp
callq 0x3340
addq $0x10, %rsp
testl %ebx, %ebx
jle 0x8590
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movl %ebx, %edx
callq 0x10e00
movq 0x15a39(%rip), %rax     # 0x1dfd0
cmpq (%rax), %r13
je 0x85b0
movq 0x15a4d(%rip), %rax     # 0x1dff0
cmpq (%rax), %r13
je 0x85b0
movq %r13, %rdi
callq 0x3160
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq