// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq $0x0, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
testq %rdi, %rdi
je 0x5bfc
movq %rdi, %rbx
movl (%rdi), %eax
cmpl $0x1, %eax
je 0x5b5c
testl %eax, %eax
jne 0x5bcc
movq 0x20(%rbx), %rdi
callq 0x40b0
movq %rax, %r14
movl 0x4(%rbx), %edi
movl 0x8(%rbx), %esi
movq %rax, %rdx
callq 0x41b0
testq %r14, %r14
je 0x5bcc
movq %r14, %rdi
callq 0x46b0
jmp 0x5bcc
movq 0x20(%rbx), %rdi
leaq 0x569f(%rip), %rsi      # 0xb206
callq 0x40a0
testq %rax, %rax
je 0x5bcc
movq 0x20(%rax), %r14
movq 0x20(%rbx), %rdi
leaq 0x5691(%rip), %rsi      # 0xb211
callq 0x40a0
testq %rax, %rax
je 0x5bcc
movq 0x20(%rax), %r15
movq 0x20(%rbx), %rdi
leaq 0x572a(%rip), %rsi      # 0xb2c3
callq 0x40a0
testq %rax, %rax
jne 0x5bb3
movq 0x20(%rbx), %rdi
leaq 0x57ca(%rip), %rsi      # 0xb378
callq 0x40a0
testq %rax, %rax
je 0x5bcc
leaq -0x30(%rbp), %rsi
leaq -0x24(%rbp), %rdx
movq %rax, %rdi
callq 0x4150
testl %eax, %eax
je 0x5c09
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x5bda
callq 0x41a0
movq %rbx, %rdi
callq 0x46b0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x5bfc
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x46b0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc(%rbx), %r12
leaq 0x576e(%rip), %rsi      # 0xb382
movq %r12, %rdi
callq 0x4360
testl %eax, %eax
je 0x5c7e
leaq 0x5767(%rip), %rsi      # 0xb38e
movq %r12, %rdi
callq 0x4360
testl %eax, %eax
je 0x5c99
leaq 0x5760(%rip), %rsi      # 0xb39a
movq %r12, %rdi
callq 0x4360
testl %eax, %eax
jne 0x5bcc
movq 0x20(%rbx), %rdi
leaq 0x5429(%rip), %rsi      # 0xb07a
callq 0x40a0
testq %rax, %rax
je 0x5bcc
movl 0x4(%rbx), %edx
movq 0x20(%rax), %rcx
movq -0x30(%rbp), %r8
movl -0x24(%rbp), %r9d
movq %r14, %rdi
movq %r15, %rsi
callq 0x4100
jmp 0x5bcc
movl 0x4(%rbx), %edx
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %r8d
movq %r14, %rdi
movq %r15, %rsi
callq 0x4520
jmp 0x5bcc
movl 0x4(%rbx), %edx
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %r8d
movq %r14, %rdi
movq %r15, %rsi
callq 0x42a0
jmp 0x5bcc