// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x98(%rdi), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x7979
testl %ebp, %ebp
je 0xc6b3
cmpl $0x3, %ebp
jne 0xc6f4
leaq 0x40(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rbx), %r9
movq 0x48(%rbx), %r12
movq 0x88(%rbx), %rax
testq %rax, %rax
jne 0xc48b
movl $0x1, %edi
movl $0x58, %esi
movq %r9, %r14
callq 0x3300
movq %r14, %r9
movq %rax, 0x88(%rbx)
leaq 0x6c7a(%rip), %rcx      # 0x130fe
movq %rcx, 0x90(%rbx)
leaq 0x28(%rax), %r15
testq %rax, %rax
cmoveq %rax, %r15
testq %r12, %r12
je 0xc6f4
movb (%r9), %al
testb %al, %al
sets %cl
testb $0xf, %al
setne %dl
testb %dl, %cl
jne 0xc4dc
testb $0x10, 0xc9(%rbx)
jne 0xc4dc
testb %al, %al
setns %cl
testb $0xf, %al
setne %dl
movb $0x1, %al
testb %dl, %cl
jne 0xc4de
movq (%r15), %r13
incq %r13
movq %r12, %rcx
subq %r13, %rcx
jb 0xc4de
addq %r9, %r13
jmp 0xc4e4
xorl %eax, %eax
movq %r12, %rcx
movq %r9, %r13
cmpq $0x2, %rcx
jb 0xc50e
movzbl 0x1(%r13), %edx
movl %edx, %esi
andl $0x7f, %esi
shrl $0x5, %edx
andl $-0x4, %edx
cmpb $0x7d, %sil
ja 0xc518
cmpq %rdx, %rcx
jb 0xc518
movq %rdx, %rdi
orq $0x2, %rdi
jmp 0xc550
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
xorl %edx, %edx
jmp 0xc55c
cmpb $0x7e, %sil
jne 0xc527
leaq 0x4(%rdx), %rdi
cmpq %rdi, %rcx
jae 0xc544
movq %rdx, %rdi
orq $0xa, %rdi
cmpq %rdi, %rcx
jae 0xc53b
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
jmp 0xc55c
movq 0x2(%r13), %rsi
bswapq %rsi
jmp 0xc550
movzwl 0x2(%r13), %esi
rolw $0x8, %si
movzwl %si, %esi
movq %rsi, %rbp
addq %rdi, %rbp
jb 0xc6ed
leaq -0x1(%rbp), %r8
cmpq %rcx, %r8
jae 0xc6f4
movq %rsi, 0x10(%rsp)
addq %r13, %rdi
movq %rdi, 0x8(%rsp)
movb (%r13), %r14b
movb %r14b, 0x18(%rsp)
testq %rdx, %rdx
sete %cl
testq %rsi, %rsi
sete %r8b
orb %cl, %r8b
jne 0xc5b5
movq %rdi, %rcx
subq %rdx, %rcx
xorl %edx, %edx
movl %edx, %r8d
andl $0x3, %r8d
movb (%rcx,%r8), %r8b
xorb %r8b, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rsi
jne 0xc599
movb 0x18(%rsp), %r14b
testb %al, %al
je 0xc661
testb %r14b, %r14b
sets %al
testb $0xf, %r14b
sete %cl
orb %al, %cl
jne 0xc5dd
andb $-0x10, (%r9)
leaq 0x1(%r9), %r13
movq $0x0, (%r15)
addq %r9, %r12
movq 0x8(%rsp), %rbp
subq %rbp, %r12
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r9, %r12
callq 0x3500
movq (%r15), %rax
addq 0x10(%rsp), %rax
movq %rax, (%r15)
subq %rbp, %r13
addq %r13, 0x48(%rbx)
testb %r14b, %r14b
jns 0xc44d
incq %r12
movq %r12, 0x8(%rsp)
movq %rax, 0x10(%rsp)
andb $0x8, %r14b
movq 0x98(%rbx), %rsi
cmpb $0x1, %r14b
movl $0x72, %edx
sbbl $0x0, %edx
movq %rbx, %rdi
leaq 0x8(%rsp), %rcx
callq 0x7979
movq (%r15), %rsi
incq %rsi
movq 0x20(%rsp), %rdi
callq 0x6af6
movq $0x0, (%r15)
jmp 0xc44d
andb $0x8, %r14b
movq 0x98(%rbx), %rsi
cmpb $0x1, %r14b
movl $0x72, %edx
sbbl $0x0, %edx
movq %rbx, %rdi
leaq 0x8(%rsp), %rcx
callq 0x7979
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x6af6
movq $0x0, (%r15)
movb (%r13), %al
andb $0xf, %al
cmpb $0x8, %al
jne 0xc44d
orb $0x4, 0xc9(%rbx)
jmp 0xc44d
testb $0x1, 0xc9(%rbx)
je 0xc6f4
movq 0x70(%rbx), %rax
addq $0x5, %rax
cmpq %rax, (%r14)
jle 0xc6f4
leaq 0xa11d(%rip), %rdx      # 0x167ed
movq %rbx, %rdi
movl $0x9, %esi
xorl %ecx, %ecx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1034d
orb $0x8, 0xc9(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq