// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_ws_handler
MG_INTERNAL void mg_ws_handler(struct mg_connection *nc, int ev,
                               void *ev_data MG_UD_ARG(void *user_data)) {
  mg_call(nc, nc->handler, nc->user_data, ev, ev_data);

  switch (ev) {
    case MG_EV_RECV:
      do {
      } while (mg_deliver_websocket_data(nc));
      break;
    case MG_EV_POLL:
      /* Ping idle websocket connections */
      {
        time_t now = *(time_t *) ev_data;
        if (nc->flags & MG_F_IS_WEBSOCKET &&
            now > nc->last_io_time + MG_WEBSOCKET_PING_INTERVAL_SECONDS) {
          mg_send_websocket_frame(nc, WEBSOCKET_OP_PING, "", 0);
        }
      }
      break;
    default:
      break;
  }
#if MG_ENABLE_CALLBACK_USERDATA
  (void) user_data;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x98(%rdi), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x7a51
testl %ebp, %ebp
je 0xc94c
cmpl $0x3, %ebp
jne 0xc986
leaq 0x40(%rbx), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rbx), %r14
movq 0x48(%rbx), %r12
cmpq $0x0, 0x88(%rbx)
jne 0xc71b
movl $0x1, %edi
movl $0x58, %esi
callq 0x3300
movq %rax, 0x88(%rbx)
leaq 0x650d(%rip), %rax      # 0x12c21
movq %rax, 0x90(%rbx)
movq 0x88(%rbx), %rax
leaq 0x28(%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
testq %r12, %r12
je 0xc743
movb (%r14), %al
testb %al, %al
sets %cl
testb $0xf, %al
setne %al
testb %al, %cl
je 0xc748
xorl %r15d, %r15d
jmp 0xc753
testb $0x10, 0xc9(%rbx)
sete %r15b
movq %r12, %rcx
movq %r14, %r13
testb %r15b, %r15b
je 0xc79d
movb (%r14), %al
testb %al, %al
sets %cl
testb $0xf, %al
sete %al
orb %cl, %al
testq %r12, %r12
setne %dl
andb %al, %dl
movq %r12, %rcx
movq %r14, %r13
cmpb $0x1, %dl
jne 0xc79d
movq (%rdi), %rax
incq %rax
movq %r12, %rdx
movq %r12, %rcx
movq %r14, %r13
subq %rax, %rdx
jb 0xc79d
addq %r14, %rax
movq %rdx, %rcx
movq %rax, %r13
cmpq $0x2, %rcx
movq %rdi, 0x28(%rsp)
jb 0xc7d3
movzbl 0x1(%r13), %eax
movl %eax, %edx
andl $0x7f, %edx
shrl $0x5, %eax
andl $-0x4, %eax
cmpb $0x7d, %dl
ja 0xc911
cmpq %rax, %rcx
jb 0xc911
movq %rax, %rsi
orq $0x2, %rsi
jmp 0xc7d9
xorl %eax, %eax
xorl %esi, %esi
xorl %edx, %edx
movq %rdx, %rbp
addq %rsi, %rbp
jae 0xc7ec
orb $0x8, 0xc9(%rbx)
movb $0x1, %cl
jmp 0xc7f6
leaq -0x1(%rbp), %rdi
cmpq %rcx, %rdi
setae %cl
testb %cl, %cl
jne 0xc986
movb %cl, 0xf(%rsp)
movq %rdx, 0x18(%rsp)
addq %r13, %rsi
movq %rsi, 0x10(%rsp)
movb (%r13), %cl
movb %cl, 0x20(%rsp)
testq %rax, %rax
je 0xc83e
testq %rdx, %rdx
je 0xc83e
movq %rsi, %rcx
subq %rax, %rcx
xorl %eax, %eax
movl %eax, %edi
andl $0x3, %edi
movb (%rcx,%rdi), %dil
xorb %dil, (%rsi,%rax)
incq %rax
cmpq %rax, %rdx
jne 0xc829
testb %r15b, %r15b
je 0xc8c7
movb 0x20(%rsp), %al
testb %al, %al
sets %cl
testb $0xf, %al
sete %al
orb %cl, %al
movq 0x28(%rsp), %rbp
jne 0xc86e
andb $-0x10, (%r14)
leaq 0x1(%r14), %r13
movq $0x0, (%rbp)
addq %r14, %r12
movq 0x10(%rsp), %rsi
subq %rsi, %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x3500
movq (%rbp), %rax
addq 0x18(%rsp), %rax
movq %rax, (%rbp)
movq %r13, %rcx
subq 0x10(%rsp), %rcx
addq %rcx, 0x48(%rbx)
cmpb $0x0, 0x20(%rsp)
jns 0xc8ed
incq %r14
movq %r14, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x13f7a
movq (%rbp), %rbp
incq %rbp
jmp 0xc8d4
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x13f7a
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x6bb8
movq 0x28(%rsp), %rax
movq $0x0, (%rax)
testb %r15b, %r15b
movb 0xf(%rsp), %cl
jne 0xc907
movb (%r13), %al
andb $0xf, %al
cmpb $0x8, %al
jne 0xc907
orb $0x4, 0xc9(%rbx)
testb %cl, %cl
je 0xc6e5
jmp 0xc986
cmpb $0x7e, %dl
jne 0xc91f
leaq 0x4(%rax), %rsi
cmpq %rsi, %rcx
jae 0xc93b
movq %rax, %rsi
orq $0xa, %rsi
cmpq %rsi, %rcx
jb 0xc7d5
movq 0x2(%r13), %rdx
bswapq %rdx
jmp 0xc7d9
movzwl 0x2(%r13), %edx
rolw $0x8, %dx
movzwl %dx, %edx
jmp 0xc7d9
testb $0x1, 0xc9(%rbx)
je 0xc986
movq 0x70(%rbx), %rax
addq $0x5, %rax
cmpq %rax, (%r14)
jle 0xc986
leaq 0x9e66(%rip), %rdx      # 0x167cf
movq %rbx, %rdi
movl $0x9, %esi
xorl %ecx, %ecx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10451
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq