// File: /workspace/github_c_makefile_star2_O3/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:
decl %r8d
cmpl $0x4, %r8d
ja 0x8485
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %ebx
movq %rdx, %rbp
movq %rdi, %r15
movl %r8d, %eax
leaq 0xd23b(%rip), %r13      # 0x15568
movslq (%r13,%rax,4), %r14
cmpb $0x2d, (%rsi)
jne 0x8349
cmpb $0x0, 0x1(%rsi)
je 0x8360
cmpb $0x2d, 0x1(%rsi)
jne 0x8349
cmpb $0x0, 0x2(%rsi)
je 0x8369
leaq 0xf06a(%rip), %rax      # 0x173ba
movq %rsi, %rdi
movq %rax, %rsi
callq 0x3370
movq %rax, %r12
jmp 0x8373
movq 0x15c69(%rip), %rax     # 0x1dfd0
jmp 0x8370
movq 0x15c80(%rip), %rax     # 0x1dff0
movq (%rax), %r12
testq %r12, %r12
je 0x8474
movq %rbp, 0x8(%rsp)
addq %r14, %r13
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 0xa911
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 0xa911
callq 0x4aab
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xcef4(%rip), %xmm0     # 0x15308
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0xdcbd(%rip), %rsi      # 0x160e3
movq %r12, %rdi
movq %r15, %rcx
leaq 0x20(%rsp), %r8
movq %r13, %r9
xorl %eax, %eax
pushq %rbx
pushq %rbp
callq 0x3340
addq $0x10, %rsp
testl %ebx, %ebx
jle 0x8454
movq %r12, %rdi
movq 0x8(%rsp), %rsi
movl %ebx, %edx
callq 0x10e0a
movq 0x15b75(%rip), %rax     # 0x1dfd0
cmpq (%rax), %r12
je 0x8474
movq 0x15b89(%rip), %rax     # 0x1dff0
cmpq (%rax), %r12
je 0x8474
movq %r12, %rdi
callq 0x3160
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq