// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x9, %eax
ja 0x713e
movq -0x40(%rbp), %rax
leaq 0x75ae(%rip), %rcx      # 0xe500
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xb03e(%rip), %rax      # 0x11fa0
cmpq $0x0, (%rax)
je 0x6f95
movq 0xb031(%rip), %rax      # 0x11fa0
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0x6f95
movq 0xb021(%rip), %rax      # 0x11fa0
movq (%rax), %rax
movq (%rax), %rax
movq 0xb014(%rip), %rcx      # 0x11fa0
movq (%rcx), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
jmp 0x7140
movq -0x10(%rbp), %rsi
movq 0xb00b(%rip), %rdi      # 0x11fb0
callq 0x4540
jmp 0x7140
movq -0x10(%rbp), %rdi
callq 0x4060
cmpl $0x0, %eax
je 0x7067
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %r8
callq 0x7150
movslq %eax, %rcx
movq -0x38(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0xafac(%rip), %rax      # 0x11fa0
cmpq $0x0, (%rax)
je 0x7038
movq 0xaf9f(%rip), %rax      # 0x11fa0
movq (%rax), %rax
cmpq $0x0, 0x20(%rax)
je 0x7038
movq 0xaf8e(%rip), %rax      # 0x11fa0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rdi
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rsi
movq 0xaf71(%rip), %rcx      # 0x11fa0
movq (%rcx), %rcx
movq 0x28(%rcx), %rdx
callq *%rax
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x7059
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x4790
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x7093
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %r8
callq 0x7150
movslq %eax, %rcx
movq -0x38(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
jmp 0x7140
movq 0xaf01(%rip), %rax      # 0x11fa0
cmpq $0x0, (%rax)
je 0x70d4
movq 0xaef4(%rip), %rax      # 0x11fa0
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x70d4
movq 0xaee3(%rip), %rax      # 0x11fa0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq 0xaed5(%rip), %rcx      # 0x11fa0
movq (%rcx), %rcx
movq 0x18(%rcx), %rdi
callq *%rax
movq 0xae8d(%rip), %rax      # 0x11f68
movq $0x0, (%rax)
jmp 0x7140
movq 0xaeb5(%rip), %rax      # 0x11fa0
cmpq $0x0, (%rax)
je 0x7120
movq 0xaea8(%rip), %rax      # 0x11fa0
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x7120
movq 0xae97(%rip), %rax      # 0x11fa0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq 0xae89(%rip), %rcx      # 0x11fa0
movq (%rcx), %rcx
movq 0x18(%rcx), %rdi
callq *%rax
movq 0xae41(%rip), %rax      # 0x11f68
movq $0x0, (%rax)
movb $0x0, %al
callq 0x4350
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7147
jmp 0x7140
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq