// File: /workspace/github_c_makefile_star2_O2/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 0x75bd
testl %ebp, %ebp
je 0xbd54
cmpl $0x3, %ebp
jne 0xbd93
leaq 0x40(%rbx), %rax
movq %rax, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq 0x40(%rbx), %r14
movq 0x48(%rbx), %r12
movq %rbx, %rdi
callq 0xb106
leaq 0x28(%rax), %r15
testq %rax, %rax
cmoveq %rax, %r15
testq %r12, %r12
je 0xbd93
movb (%r14), %al
testb %al, %al
sets %cl
testb $0xf, %al
setne %dl
testb %dl, %cl
jne 0xbbc6
testb $0x10, 0xc9(%rbx)
jne 0xbbc6
testb %al, %al
setns %cl
testb $0xf, %al
setne %dl
movb $0x1, %al
testb %dl, %cl
jne 0xbbc8
movq (%r15), %r13
incq %r13
movq %r12, %rcx
subq %r13, %rcx
jb 0xbbc8
addq %r14, %r13
jmp 0xbbce
xorl %eax, %eax
movq %r12, %rcx
movq %r14, %r13
cmpq $0x2, %rcx
jb 0xbbf8
movzbl 0x1(%r13), %edx
movl %edx, %esi
andl $0x7f, %esi
shrl $0x5, %edx
andl $-0x4, %edx
cmpb $0x7d, %sil
ja 0xbc02
cmpq %rdx, %rcx
jb 0xbc02
movq %rdx, %rdi
orq $0x2, %rdi
jmp 0xbc3a
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
xorl %edx, %edx
jmp 0xbc46
cmpb $0x7e, %sil
jne 0xbc11
leaq 0x4(%rdx), %rdi
cmpq %rdi, %rcx
jae 0xbc2e
movq %rdx, %rdi
orq $0xa, %rdi
cmpq %rdi, %rcx
jae 0xbc25
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
jmp 0xbc46
movq 0x2(%r13), %rsi
bswapq %rsi
jmp 0xbc3a
movzwl 0x2(%r13), %esi
rolw $0x8, %si
movzwl %si, %esi
movq %rsi, %rbp
addq %rdi, %rbp
jb 0xbd8c
leaq -0x1(%rbp), %r8
cmpq %rcx, %r8
jae 0xbd93
movq %rsi, 0x8(%rsp)
addq %r13, %rdi
movq %rdi, (%rsp)
movb (%r13), %cl
movb %cl, 0x10(%rsp)
testq %rdx, %rdx
je 0xbc8d
movq %rdi, %rcx
subq %rdx, %rcx
xorl %edx, %edx
cmpq %rdx, %rsi
je 0xbc8d
movl %edx, %r8d
andl $0x3, %r8d
movb (%rcx,%r8), %r8b
xorb %r8b, (%rdi,%rdx)
incq %rdx
jmp 0xbc74
testb %al, %al
je 0xbd1e
movb 0x10(%rsp), %bl
testb %bl, %bl
sets %al
testb $0xf, %bl
sete %cl
orb %al, %cl
jne 0xbcb4
andb $-0x10, (%r14)
leaq 0x1(%r14), %r13
andq $0x0, (%r15)
addq %r14, %r12
movq (%rsp), %rbp
subq %rbp, %r12
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3500
movq (%r15), %rax
addq 0x8(%rsp), %rax
movq %rax, (%r15)
subq %rbp, %r13
movq 0x20(%rsp), %rcx
addq %r13, 0x48(%rcx)
testb %bl, %bl
movq %rcx, %rbx
jns 0xbb65
incq %r14
movq %r14, (%rsp)
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x128d1
movq (%r15), %rsi
incq %rsi
movq 0x18(%rsp), %rdi
callq 0x6845
andq $0x0, (%r15)
jmp 0xbb65
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x128d1
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x6845
andq $0x0, (%r15)
movb (%r13), %al
andb $0xf, %al
cmpb $0x8, %al
jne 0xbb65
orb $0x4, 0xc9(%rbx)
jmp 0xbb65
testb $0x1, 0xc9(%rbx)
je 0xbd93
movq 0x70(%rbx), %rax
addq $0x5, %rax
cmpq %rax, (%r14)
jle 0xbd93
leaq 0x9a5f(%rip), %rdx      # 0x157d0
pushq $0x9
popq %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf925
orb $0x8, 0xc9(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq