// File: /workspace/github_c_makefile_star2_O0/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: threadpool_recv_proc
void threadpool_recv_proc(void *arg)
{
    parsed_msg_t *parsed_msg;
    char *payload_str = NULL, *pk, *dn;
    cJSON *item, *service_name;
    leda_device_data_t *data = NULL;
    int data_cnt = 0;

    if (!arg) {
        return;
    }
    parsed_msg = (parsed_msg_t *)arg;

    if (parsed_msg->msg_type == MSG_RSP) {
        payload_str = cJSON_Print(parsed_msg->payload);
        if (wsa_set_reply_result(parsed_msg->msg_id, parsed_msg->code, payload_str) < 0) {
            if (g_devs_cb.report_reply_cb) {
                g_devs_cb.report_reply_cb(parsed_msg->msg_id, parsed_msg->code, g_devs_cb.usr_data_report_reply);
            }
        }
        if (payload_str) {
            free(payload_str);
        }
        goto end;
    } else if (parsed_msg->msg_type == MSG_METHOD) {
        item = cJSON_GetObjectItem(parsed_msg->payload, "productKey");
        if (!item) {
            goto end;
        }
        pk = item->valuestring;
        item = cJSON_GetObjectItem(parsed_msg->payload, "deviceName");
        if (!item) {
            goto end;
        }
        dn = item->valuestring;
        item = cJSON_GetObjectItem(parsed_msg->payload, "properties");
        if (!item) {
            item = cJSON_GetObjectItem(parsed_msg->payload, "inputData");
        }
        if (!item) {
            goto end;
        }
        
        if (LE_SUCCESS != json_data_to_struct_data(item, &data, &data_cnt)) {
            goto end;
        }
        if (0 == strcmp(parsed_msg->method, METHOD_GET_PROPERTY)) {
            leda_rsp_get_properties(pk, dn, parsed_msg->msg_id, data, data_cnt);
        } else if (0 == strcmp(parsed_msg->method, METHOD_SET_PROPERTY)) {
            leda_rsp_set_properties(pk, dn, parsed_msg->msg_id, data, data_cnt);
        } else if (0 == strcmp(parsed_msg->method, METHOD_CALL_SERVICE)) {
            service_name = cJSON_GetObjectItem(parsed_msg->payload, "identifier");
            if (!service_name) {
                goto end;
            }
            leda_rsp_call_service(pk, dn, parsed_msg->msg_id, service_name->valuestring, data, data_cnt);
        } else {
            goto end;
        }
    } else {
        goto end;
    }

end:
    if (parsed_msg) {
        if (parsed_msg->payload) {
            cJSON_Delete(parsed_msg->payload);
        }
        free(parsed_msg);
    }
    if (data) {
        free(data);
    }
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x61ff
jmp 0x646c
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x627c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x40f0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x18(%rbp), %rdx
callq 0x41f0
cmpl $0x0, %eax
jge 0x6267
cmpq $0x0, 0xc37b(%rip)      # 0x125c0
je 0x6265
movq 0xc372(%rip), %rax      # 0x125c0
movq -0x10(%rbp), %rcx
movl 0x4(%rcx), %edi
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %esi
movq 0xc365(%rip), %rdx      # 0x125c8
callq *%rax
jmp 0x6267
cmpq $0x0, -0x18(%rbp)
je 0x6277
movq -0x18(%rbp), %rdi
callq 0x4790
jmp 0x6432
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x642c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x7f6e(%rip), %rsi      # 0xe206
callq 0x40d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x62ad
jmp 0x6432
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x7f49(%rip), %rsi      # 0xe211
callq 0x40d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x62dd
jmp 0x6432
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x7fcb(%rip), %rsi      # 0xe2c3
callq 0x40d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x6320
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x8061(%rip), %rsi      # 0xe378
callq 0x40d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x632c
jmp 0x6432
movq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x4190
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x634a
jmp 0x6432
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
leaq 0x8029(%rip), %rsi      # 0xe382
callq 0x43c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x6387
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x40(%rbp), %rcx
movl -0x44(%rbp), %r8d
callq 0x45e0
jmp 0x642a
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
leaq 0x7ff8(%rip), %rsi      # 0xe38e
callq 0x43c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x63c1
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x40(%rbp), %rcx
movl -0x44(%rbp), %r8d
callq 0x42f0
jmp 0x6428
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
leaq 0x7fca(%rip), %rsi      # 0xe39a
callq 0x43c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x6424
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x7c8e(%rip), %rsi      # 0xe07a
callq 0x40d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x63fe
jmp 0x6432
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x40(%rbp), %r8
movl -0x44(%rbp), %r9d
callq 0x4140
jmp 0x6426
jmp 0x6432
jmp 0x6428
jmp 0x642a
jmp 0x642e
jmp 0x6432
jmp 0x6430
jmp 0x6432
cmpq $0x0, -0x10(%rbp)
je 0x645a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x6451
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x41e0
movq -0x10(%rbp), %rdi
callq 0x4790
cmpq $0x0, -0x40(%rbp)
je 0x646a
movq -0x40(%rbp), %rdi
callq 0x4790
jmp 0x646c
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)