// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client_callback.c
// Function: callback_dumb_increment
int callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
			void *user, void *in, size_t len)
{
    wsc_recv_tmpInfo* tmp = (wsc_recv_tmpInfo*)user;
    
    switch (reason) {
        case LWS_CALLBACK_CLIENT_ESTABLISHED:
            if(g_cbs && g_cbs->p_cb_establish)
                g_cbs->p_cb_establish(g_cbs->usr_cb_establish);
            break;
        case LWS_CALLBACK_CLIENT_WRITEABLE:
            client_buf_mgmt_pop(cb_pop_msg, (void *)wsi);
            break;
        case LWS_CALLBACK_CLIENT_RECEIVE:
           if (lws_is_final_fragment(wsi))
            {
                tmp->totalLen += recvframeAppend(wsi,(void **)&tmp->appendBuffer,in,tmp->totalLen,len);
                        
                if(g_cbs && g_cbs->p_cb_recv)
                {
                    g_cbs->p_cb_recv(tmp->appendBuffer, tmp->totalLen, g_cbs->usr_cb_recv);
                }
                if(tmp->appendBuffer != NULL){
                    free(tmp->appendBuffer);
                    tmp->appendBuffer = NULL;
                } 
                tmp->totalLen = 0;
            }
            else
            {
                tmp->totalLen += recvframeAppend(wsi,(void **)&tmp->appendBuffer,in,tmp->totalLen,len);
            }
            break;
        case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
            if(g_cbs && g_cbs->p_cb_close)
                g_cbs->p_cb_close(g_cbs->usr_cb_close);
            g_wsi = NULL;
            break;
        case LWS_CALLBACK_CLOSED:
            if(g_cbs && g_cbs->p_cb_close)
                g_cbs->p_cb_close(g_cbs->usr_cb_close);
            g_wsi = NULL; 
            buf_mgmt_client_clear_msg();
            return -1;
        default:
            break;
    }

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
decl %esi
cmpl $0x9, %esi
ja 0x6591
movq %rcx, %r12
movq %rdi, %r13
leaq 0x408d(%rip), %rax      # 0xa4f8
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x7b25(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6492
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x6492
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x7acf(%rip), %rax      # 0xdf68
movq $0x0, (%rax)
jmp 0x6591
movq 0x7af4(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x64c3
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x64c3
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x7a9e(%rip), %rax      # 0xdf68
movq $0x0, (%rax)
xorl %eax, %eax
callq 0x4300
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6591
movq 0x7ab7(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6591
movq (%rax), %rcx
testq %rcx, %rcx
je 0x6591
movq 0x8(%rax), %rdi
callq *%rcx
jmp 0x6591
movq %r8, %r15
movq %rdx, %r14
movq %r13, %rdi
callq 0x4050
movl %eax, -0x2c(%rbp)
movq 0x8(%r14), %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0x65a2
movslq %eax, %rsi
addq 0x8(%r14), %rsi
movq %rsi, 0x8(%r14)
cmpl $0x0, -0x2c(%rbp)
je 0x6591
movq 0x7a56(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6564
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x6564
movq (%r14), %rdi
movq 0x28(%rax), %rdx
callq *%rcx
movq (%r14), %rdi
testq %rdi, %rdi
je 0x6578
callq 0x46d0
movq $0x0, (%r14)
movq $0x0, 0x8(%r14)
jmp 0x6591
movq 0x7a27(%rip), %rdi      # 0xdfb0
movq %r13, %rsi
callq 0x44b0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq