// File: /workspace/github_c_makefile_star2_O2/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 0x6514
movq %rcx, %r12
movq %rdi, %r13
leaq 0x40f9(%rip), %rax      # 0xa4f8
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x7b91(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6426
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x6426
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x7b3b(%rip), %rax      # 0xdf68
andq $0x0, (%rax)
jmp 0x6514
movq 0x7b63(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6454
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x6454
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x7b0d(%rip), %rax      # 0xdf68
andq $0x0, (%rax)
xorl %eax, %eax
callq 0x4330
pushq $-0x1
popq %rbx
jmp 0x6514
movq 0x7b2b(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x6514
movq (%rax), %rcx
testq %rcx, %rcx
je 0x6514
movq 0x8(%rax), %rdi
callq *%rcx
jmp 0x6514
movq %r8, %r15
movq %rdx, %r14
movq %r13, %rdi
callq 0x4060
movl %eax, -0x2c(%rbp)
movq 0x8(%r14), %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0x6525
movslq %eax, %rsi
addq 0x8(%r14), %rsi
movq %rsi, 0x8(%r14)
cmpl $0x0, -0x2c(%rbp)
je 0x6514
movq 0x7acd(%rip), %rax      # 0xdfa0
movq (%rax), %rax
testq %rax, %rax
je 0x64ed
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x64ed
movq (%r14), %rdi
movq 0x28(%rax), %rdx
callq *%rcx
movq (%r14), %rdi
testq %rdi, %rdi
je 0x64fe
callq 0x4750
andq $0x0, (%r14)
andq $0x0, 0x8(%r14)
jmp 0x6514
movq 0x7aa4(%rip), %rdi      # 0xdfb0
movq %r13, %rsi
callq 0x4510
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq