LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_rsp_set_properties
int leda_rsp_set_properties(char *pk, char *dn, int msg_id, leda_device_data_t *data, int data_cnt)
{
    int ret = LE_ERROR_UNKNOWN;

    if (g_devs_cb.set_properties_cb) {
        ret = g_devs_cb.set_properties_cb(pk, dn, data, data_cnt, g_devs_cb.set_properties_cb);
    } else {
        log_e(LOG_TAG, "callback set_properties_cb unregistered!\n");
    }

    return leda_send_rsp(ret, msg_id, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edx, %ebx
movq 0x8b55(%rip), %rax      # 0xe4a8
testq %rax, %rax
je 0x5967
movq %rcx, %rdx
movl %r8d, %ecx
movq %rax, %r8
callq *%rax
movl %eax, %edi
jmp 0x59a5
leaq 0x49a2(%rip), %rax      # 0xa310
movq %rax, (%rsp)
leaq 0x4717(%rip), %rsi      # 0xa090
leaq 0x4716(%rip), %rdx      # 0xa096
leaq 0x4714(%rip), %rcx      # 0xa09b
leaq 0x496a(%rip), %r8       # 0xa2f8
movl $0x3, %edi
movl $0x265, %r9d            # imm = 0x265
xorl %eax, %eax
callq 0x4260
movl $0x186a0, %edi          # imm = 0x186A0
movl %ebx, %esi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4390
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: cb_ws_estab
static void cb_ws_estab(void *user)
{
    g_conn_state = LEDA_WS_CONNECTED;
    log_i(LOG_TAG, "connection establish.\n");

    if (g_conn_cb.conn_state_change_cb) {
        g_conn_cb.conn_state_change_cb(LEDA_WS_CONNECTED, g_conn_cb.usr_data);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, 0x8423(%rip)      # 0xe398
leaq 0x449a(%rip), %rax      # 0xa416
movq %rax, (%rsp)
leaq 0x42bb(%rip), %rsi      # 0xa242
leaq 0x4108(%rip), %rdx      # 0xa096
leaq 0x4106(%rip), %rcx      # 0xa09b
leaq 0x446e(%rip), %r8       # 0xa40a
movl $0x1, %edi
movl $0x329, %r9d            # imm = 0x329
xorl %eax, %eax
callq 0x4260
movq 0x851b(%rip), %rax      # 0xe4d0
testq %rax, %rax
je 0x5fca
movq 0x8517(%rip), %rsi      # 0xe4d8
xorl %edi, %edi
addq $0x10, %rsp
popq %rbp
jmpq *%rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: cb_ws_close
static void cb_ws_close(void *user)
{
    g_conn_state = LEDA_WS_DISCONNECTED;
    log_i(LOG_TAG, "connection closed.\n");

    if (g_conn_cb.conn_state_change_cb) {
        g_conn_cb.conn_state_change_cb(LEDA_WS_DISCONNECTED, g_conn_cb.usr_data);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, 0x83b6(%rip)      # 0xe398
leaq 0x4450(%rip), %rax      # 0xa439
movq %rax, (%rsp)
leaq 0x424e(%rip), %rsi      # 0xa242
leaq 0x409b(%rip), %rdx      # 0xa096
leaq 0x4099(%rip), %rcx      # 0xa09b
leaq 0x4424(%rip), %r8       # 0xa42d
movl $0x1, %edi
movl $0x31f, %r9d            # imm = 0x31F
xorl %eax, %eax
callq 0x4260
movq 0x84ae(%rip), %rax      # 0xe4d0
testq %rax, %rax
je 0x603a
movq 0x84aa(%rip), %rsi      # 0xe4d8
movl $0x1, %edi
addq $0x10, %rsp
popq %rbp
jmpq *%rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_wsc_exit
int leda_wsc_exit()
{
    g_is_init = 0;
    force_exit = 1;
    
    if (g_threadpool_recv_proc) {
        threadpool_destroy(g_threadpool_recv_proc, threadpool_graceful);
    }
    if (context) {
        lws_cancel_service(context);
        context = NULL;
    }

    return ws_client_destroy();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movb $0x0, 0x82c7(%rip)      # 0xe4cc
movq 0x7de4(%rip), %rax      # 0xdff0
movl $0x1, (%rax)
movq 0x7d6f(%rip), %rax      # 0xdf88
movq (%rax), %rdi
testq %rdi, %rdi
je 0x622b
movl $0x1, %esi
callq 0x45b0
movq 0x7d96(%rip), %rbx      # 0xdfc8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x6246
callq 0x4340
movq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x40f0
nop
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client.c
// Function: wsc_init
int wsc_init(p_wsc_param_conn pc, p_wsc_param_cb cb)
{
    int ret = 0;
    if (!pc || !cb || !pc->url) {
        printf("wsc init failed, param should not be NULL.\n");
        return LE_ERROR_INVAILD_PARAM;
    }

    if (!strncmp(pc->url, "wss", 3) && !pc->ca_path) {
        printf("ca path must not be NULL when use ssl\n");
    }

    g_cbs = malloc(sizeof(wsc_param_cb));
    if (!g_cbs) {
        printf("malloc error.\n");
        return LE_ERROR_ALLOCATING_MEM;
    }

    memset(g_cbs, 0, sizeof(wsc_param_cb));
    memcpy(g_cbs, cb, sizeof(wsc_param_cb));
    
    force_exit = 0;

    ret = client_buf_mgmt_init(1024 * 2, 1024);
    if (ret != LE_SUCCESS) {
        free(g_cbs);
        g_cbs = NULL;
        return ret;
    }

    pthread_t id;
    ret = pthread_create(&id, NULL, thread_wsc_network, pc);
    if (ret == 0) {
        printf("wsc init ok\n");
    } else {
        free(g_cbs);
        g_cbs = NULL;
#ifndef _WIN32
        printf("wsc init faild, %s.\n", strerror(errno));
#else
        char buffer[64] = { 0 };
        strerror_s(buffer, sizeof(buffer), errno);
        printf("wsc init faild, %s.\n", buffer);
#endif
        client_buf_mgmt_destroy();

        return LE_ERROR_UNKNOWN;
    }
    pthread_detach(id);

    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x630e
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x630e
movq %rsi, %r14
cmpb $0x77, (%rax)
jne 0x62a8
cmpb $0x73, 0x1(%rax)
jne 0x62a8
cmpb $0x73, 0x2(%rax)
jne 0x62a8
cmpq $0x0, 0x10(%rbx)
jne 0x62a8
leaq 0x4212(%rip), %rdi      # 0xa4b5
callq 0x40d0
movl $0x30, %edi
callq 0x46d8
movq 0x7ce7(%rip), %r15      # 0xdfa0
movq %rax, (%r15)
testq %rax, %rax
je 0x632e
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x7d0f(%rip), %rax      # 0xdff0
movl $0x0, (%rax)
movl $0x800, %edi            # imm = 0x800
movl $0x400, %esi            # imm = 0x400
callq 0x44d0
testl %eax, %eax
je 0x6342
movl %eax, %r14d
movq (%r15), %rdi
callq 0x46d0
movq $0x0, (%r15)
jmp 0x6320
leaq 0x4175(%rip), %rdi      # 0xa48a
callq 0x40d0
movl $0x186a1, %r14d         # imm = 0x186A1
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41a6(%rip), %rdi      # 0xa4db
callq 0x40d0
movl $0x186a2, %r14d         # imm = 0x186A2
jmp 0x6320
movq 0x7c8f(%rip), %rdx      # 0xdfd8
xorl %r14d, %r14d
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x4500
testl %eax, %eax
je 0x6397
movq (%r15), %rdi
callq 0x46d0
movq $0x0, (%r15)
callq 0x4070
movl (%rax), %edi
callq 0x4640
leaq 0x40f5(%rip), %rdi      # 0xa475
movq %rax, %rsi
xorl %eax, %eax
callq 0x4240
callq 0x4220
movl $0x186a0, %r14d         # imm = 0x186A0
jmp 0x6320
leaq 0x414b(%rip), %rdi      # 0xa4e9
callq 0x40d0
movq -0x20(%rbp), %rdi
callq 0x4450
jmp 0x6320
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client.c
// Function: ws_client_destroy
int ws_client_destroy()
{
    force_exit = 1;
#ifndef _WIN32
    usleep(1000*1000);
#else
    Sleep(1000);
#endif
    if (g_cbs) {
        free(g_cbs);
        g_cbs = NULL;
    }

    return client_buf_mgmt_destroy();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x7c09(%rip), %rax      # 0xdff0
movl $0x1, (%rax)
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x46c0
movq 0x7ba2(%rip), %rbx      # 0xdfa0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x6412
callq 0x46d0
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4220
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client_callback.c
// Function: recvframeAppend
static int recvframeAppend(struct lws *wsi, void **appendBuffer, void *in, size_t preLen, size_t len)
{
    char *tmp = NULL;
    
    if (*appendBuffer == NULL){
        tmp = malloc(preLen + len + 1);
    } else {
        tmp = realloc((void *)*appendBuffer,preLen + len + 1);
    } 

    if(!tmp)
    {
        lwsl_notice("recv malloc error:  %p\n", wsi);
        return 0;
    }

    memcpy(tmp + preLen, (void *)in, len);
    *(tmp + preLen +len) = 0;
    *appendBuffer = tmp;
    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
movq (%rsi), %rdi
leaq (%rcx,%r8), %rsi
incq %rsi
testq %rdi, %rdi
je 0x65d6
callq 0x46e0
jmp 0x65de
movq %rsi, %rdi
callq 0x46d8
movq %rax, %r12
testq %rax, %rax
je 0x6601
addq %r12, %r14
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x43c0
movb $0x0, (%rbx,%r14)
movq %r12, (%r15)
jmp 0x661a
leaq 0x3f18(%rip), %rsi      # 0xa520
xorl %ebx, %ebx
movl $0x4, %edi
movq -0x30(%rbp), %rdx
xorl %eax, %eax
callq 0x4230
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/wsc_buffer_mgmt.c
// Function: client_buf_mgmt_init
int client_buf_mgmt_init(int single_buf_size, int max_buf_cnt)
{
	int i = 0;
    int ret = 0;

    memset(&g_ws_buf_state, 0, sizeof(msg_buf_status));
    ret = pthread_mutex_init(&g_ws_buf_state.locker, NULL);
    if(ret != 0){
        printf("failed to init buffer locker.\n");
        return LE_ERROR_CREATING_MUTEX; 
    }
    g_ws_buf_state.rd_index = 0;
	g_ws_buf_state.wr_index = 0;
    g_ws_buf_state.single_buf_size = single_buf_size;
    g_ws_buf_state.max_buf_cnt = max_buf_cnt;

    g_ws_buf = malloc(max_buf_cnt * sizeof(msg_buf_item));
    if(!g_ws_buf){
        printf("failed to malloc memory for client buffer mgmt\n");
        pthread_mutex_destroy(&g_ws_buf_state.locker);
        return LE_ERROR_ALLOCATING_MEM;
    }
    memset(g_ws_buf, 0, sizeof(msg_buf_item) * max_buf_cnt);
	for (i = 0; i < max_buf_cnt; i++) {
        g_ws_buf[i].buf = malloc(single_buf_size);
        if(!g_ws_buf[i].buf)
            goto _failed;
		memset(g_ws_buf[i].buf, 0, single_buf_size);
	}

    return 0;
_failed:
    for(i = 0; i < max_buf_cnt; i++){
        if(g_ws_buf[i].buf){
            free(g_ws_buf[i].buf);
            g_ws_buf[i].buf = NULL;
        }else
            break;
    }
    
    free(g_ws_buf);
    g_ws_buf = NULL;
    pthread_mutex_destroy(&g_ws_buf_state.locker);

	return LE_ERROR_ALLOCATING_MEM;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r14d
movl %edi, %r15d
xorps %xmm0, %xmm0
movups %xmm0, 0x7c15(%rip)     # 0xe558
movups %xmm0, 0x7bfe(%rip)     # 0xe548
movups %xmm0, 0x7be7(%rip)     # 0xe538
movq $0x0, 0x7c0c(%rip) # 0xe568
leaq 0x7bd5(%rip), %rdi      # 0xe538
xorl %esi, %esi
callq 0x4680
testl %eax, %eax
je 0x6984
leaq 0x3cfd(%rip), %rdi      # 0xa672
callq 0x40d0
movl $0x186a3, %eax          # imm = 0x186A3
jmp 0x6a4e
movq $0x0, 0x7bd1(%rip) # 0xe560
movl %r15d, 0x7bd2(%rip)     # 0xe568
movl %r14d, 0x7bcf(%rip)     # 0xe56c
movslq %r14d, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
movl $0x1, %edi
callq 0x4370
movq %rax, 0x7bb7(%rip)      # 0xe570
testq %rax, %rax
je 0x69fa
testl %r14d, %r14d
jle 0x69f6
movq %rax, %rbx
movslq %r15d, %r15
movl %r14d, %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %r14
xorl %r12d, %r12d
movl $0x1, %edi
movq %r15, %rsi
callq 0x4370
movq %rax, (%rbx,%r12)
testq %rax, %rax
je 0x6a08
addq $0x18, %r12
cmpq %r12, %r14
jne 0x69d7
xorl %eax, %eax
jmp 0x6a4e
leaq 0x3c42(%rip), %rdi      # 0xa643
callq 0x40d0
jmp 0x6a3d
xorl %r15d, %r15d
movq (%rbx,%r15), %rdi
testq %rdi, %rdi
je 0x6a2a
callq 0x46d0
movq $0x0, (%rbx,%r15)
addq $0x18, %r15
cmpq %r15, %r14
jne 0x6a0b
movq %rbx, %rdi
callq 0x46d0
movq $0x0, 0x7b33(%rip) # 0xe570
leaq 0x7af4(%rip), %rdi      # 0xe538
callq 0x4270
movl $0x186a2, %eax          # imm = 0x186A2
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/wsc_buffer_mgmt.c
// Function: client_buf_mgmt_push
int client_buf_mgmt_push(const char *buf, size_t len, int msg_type)
{
	msg_buf_item *p_new_msg = NULL;
    char         *tmp = NULL;
    int           windex = 0;

    if(!buf || !g_ws_buf)
        return LE_ERROR_INVAILD_PARAM;

	pthread_mutex_lock(&g_ws_buf_state.locker);
    
    windex = g_ws_buf_state.wr_index;
	if (windex >= g_ws_buf_state.max_buf_cnt){
		g_ws_buf_state.wr_index = 0;
        windex = 0;
    }
    ++len;
    if(len > g_ws_buf_state.single_buf_size - LWS_PRE){
        tmp = realloc(g_ws_buf[windex].buf, len + LWS_PRE);    
        if(!tmp){
            printf("failed to alloc more memory to store msg\n");
            pthread_mutex_unlock(&g_ws_buf_state.locker);
            return LE_ERROR_ALLOCATING_MEM;
        }
        memset(tmp, 0, len + LWS_PRE);
        g_ws_buf[windex].buf = tmp;
    }

	memset(g_ws_buf[windex].buf, 0, g_ws_buf[windex].buf_len);
	memcpy(g_ws_buf[windex].buf + LWS_PRE, buf, len - 1);
	g_ws_buf[windex].buf[LWS_PRE + len - 1] = '\0';
	g_ws_buf[windex].buf_len = len;
	g_ws_buf[windex].type = msg_type;

	g_ws_buf_state.wr_index++;

	pthread_mutex_unlock(&g_ws_buf_state.locker);

    notify_network();
	return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0x186a1, %r12d         # imm = 0x186A1
testq %rdi, %rdi
je 0x6b6f
cmpq $0x0, 0x7af1(%rip)      # 0xe570
je 0x6b6f
movq %rsi, %r14
movq %rdi, -0x48(%rbp)
movl %edx, -0x2c(%rbp)
leaq 0x7aa2(%rip), %rdi      # 0xe538
callq 0x46a0
movl 0x7ac3(%rip), %eax      # 0xe564
cmpl 0x7ac5(%rip), %eax      # 0xe56c
jl 0x6ab5
movl $0x0, 0x7ab1(%rip)      # 0xe564
xorl %eax, %eax
leaq 0x1(%r14), %rdx
movslq 0x7aa8(%rip), %rcx      # 0xe568
addq $-0x10, %rcx
movq 0x7aa5(%rip), %rbx      # 0xe570
cltq
leaq (%rax,%rax,2), %r15
movq (%rbx,%r15,8), %r13
movq %rdx, -0x40(%rbp)
cmpq %rcx, %rdx
jbe 0x6b15
leaq 0x11(%r14), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x46e0
testq %rax, %rax
je 0x6b81
movq %rax, %r13
leaq (%rbx,%r15,8), %rax
movq %rax, -0x38(%rbp)
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x42b0
movq -0x38(%rbp), %rax
movq %r13, (%rax)
movq 0x8(%rbx,%r15,8), %rdx
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
callq 0x42b0
movq (%rbx,%r15,8), %rdi
addq $0x10, %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0x43c0
movq (%rbx,%r15,8), %rax
movb $0x0, 0x10(%rax,%r14)
movq -0x40(%rbp), %rax
movq %rax, 0x8(%rbx,%r15,8)
movl -0x2c(%rbp), %eax
movl %eax, 0x10(%rbx,%r15,8)
leaq 0x79db(%rip), %rdi      # 0xe538
incl 0x7a01(%rip)            # 0xe564
callq 0x4410
xorl %eax, %eax
callq 0x4040
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b08(%rip), %rdi      # 0xa690
callq 0x40d0
leaq 0x79a4(%rip), %rdi      # 0xe538
callq 0x4410
movl $0x186a2, %r12d         # imm = 0x186A2
jmp 0x6b6f
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/wsc_buffer_mgmt.c
// Function: client_buf_mgmt_pop
int client_buf_mgmt_pop(cb_del cb, void *usr)
{
	int ret = 0;
    int rindex = 0;

	pthread_mutex_lock(&g_ws_buf_state.locker);
    
    rindex = g_ws_buf_state.rd_index;
	if (rindex >= g_ws_buf_state.max_buf_cnt){
		g_ws_buf_state.rd_index = 0;
        rindex = 0; 
    }

	if (g_ws_buf[rindex].buf_len == 0) {
		pthread_mutex_unlock(&g_ws_buf_state.locker);
		return LE_SUCCESS;
	}
    
    ret = cb(g_ws_buf[rindex].buf + LWS_PRE, 
                        g_ws_buf[rindex].buf_len, g_ws_buf[rindex].type, usr);
    
    if(ret < g_ws_buf[rindex].buf_len){
        pthread_mutex_unlock(&g_ws_buf_state.locker);
        printf("failed to post msg to server.\n"); 
        return LE_ERROR_UNKNOWN;
    }
    g_ws_buf[rindex].buf_len = 0;
	g_ws_buf_state.rd_index++;
	pthread_mutex_unlock(&g_ws_buf_state.locker);
	
	notify_network();
	return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x7980(%rip), %rdi      # 0xe538
callq 0x46a0
movl 0x799d(%rip), %eax      # 0xe560
cmpl 0x79a3(%rip), %eax      # 0xe56c
jl 0x6bd7
movl $0x0, 0x798b(%rip)      # 0xe560
xorl %eax, %eax
movq 0x7992(%rip), %rcx      # 0xe570
cltq
leaq (%rax,%rax,2), %r15
movq 0x8(%rcx,%r15,8), %rsi
testq %rsi, %rsi
je 0x6c31
leaq (%rcx,%r15,8), %rax
movq (%rax), %rdi
addq $0x10, %rdi
movl 0x10(%rax), %edx
movq %r14, %rcx
callq *%rbx
movslq %eax, %rcx
movq 0x7965(%rip), %rax      # 0xe570
cmpq %rcx, 0x8(%rax,%r15,8)
jbe 0x6c41
leaq 0x791f(%rip), %rdi      # 0xe538
callq 0x4410
leaq 0x3a94(%rip), %rdi      # 0xa6b9
callq 0x40d0
movl $0x186a0, %ebx          # imm = 0x186A0
jmp 0x6c6b
leaq 0x7900(%rip), %rdi      # 0xe538
callq 0x4410
xorl %ebx, %ebx
jmp 0x6c6b
leaq (%rax,%r15,8), %rax
addq $0x8, %rax
movq $0x0, (%rax)
leaq 0x78e1(%rip), %rdi      # 0xe538
incl 0x7903(%rip)            # 0xe560
callq 0x4410
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4040
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/wsc_buffer_mgmt.c
// Function: buf_mgmt_client_clear_msg
void buf_mgmt_client_clear_msg()
{
	int i = 0;
	pthread_mutex_lock(&g_ws_buf_state.locker);

	g_ws_buf_state.wr_index = 0;
	g_ws_buf_state.rd_index = 0;

	for (i = 0; i < MAX_MSG_BUF_COUNT; i++) {
		g_ws_buf[i].buf_len = 0;
	}
	pthread_mutex_unlock(&g_ws_buf_state.locker);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x78b5(%rip), %rdi      # 0xe538
callq 0x46a0
movq $0x0, 0x78cd(%rip) # 0xe560
movl $0x8, %eax
movq 0x78d1(%rip), %rcx      # 0xe570
movq $0x0, (%rcx,%rax)
addq $0x18, %rax
cmpq $0xc8, %rax
jne 0x6c9f
leaq 0x787e(%rip), %rdi      # 0xe538
popq %rbp
jmp 0x4410
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/wsc_buffer_mgmt.c
// Function: client_buf_mgmt_destroy
int client_buf_mgmt_destroy(void)
{
	int i = 0;
    
    if(!g_ws_buf)
        return 0;

	pthread_mutex_lock(&g_ws_buf_state.locker);
	for (i = 0; i < g_ws_buf_state.max_buf_cnt; i++) {
		if (NULL != g_ws_buf[i].buf)
			free(g_ws_buf[i].buf);
	}
    free(g_ws_buf);
    g_ws_buf = NULL;
	pthread_mutex_unlock(&g_ws_buf_state.locker);

	pthread_mutex_destroy(&g_ws_buf_state.locker);
    memset(&g_ws_buf_state, 0, sizeof(msg_buf_status));

    return LE_SUCCESS;
}

// Assembly:
cmpq $0x0, 0x78a8(%rip)      # 0xe570
je 0x6d6f
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x7859(%rip), %rdi      # 0xe538
callq 0x46a0
movl 0x7882(%rip), %eax      # 0xe56c
movq 0x787f(%rip), %rbx      # 0xe570
testl %eax, %eax
jle 0x6d1d
xorl %r14d, %r14d
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x6d0e
callq 0x46d0
movl 0x785e(%rip), %eax      # 0xe56c
incq %r14
movslq %eax, %rcx
addq $0x18, %r15
cmpq %rcx, %r14
jl 0x6cfb
movq %rbx, %rdi
callq 0x46d0
xorl %r14d, %r14d
movq %r14, 0x7841(%rip)      # 0xe570
leaq 0x7802(%rip), %rbx      # 0xe538
movq %rbx, %rdi
callq 0x4410
movq %rbx, %rdi
callq 0x4270
xorps %xmm0, %xmm0
movups %xmm0, 0x77e8(%rip)     # 0xe538
movups %xmm0, 0x77f1(%rip)     # 0xe548
movups %xmm0, 0x77fa(%rip)     # 0xe558
movq %r14, 0x7803(%rip)      # 0xe568
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/json/cJSON.c
// Function: cJSON_InitHooks
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks)
{
    if (hooks == NULL)
    {
        /* Reset hooks */
        global_hooks.allocate = malloc;
        global_hooks.deallocate = free;
        global_hooks.reallocate = realloc;
        return;
    }

    global_hooks.allocate = malloc;
    if (hooks->malloc_fn != NULL)
    {
        global_hooks.allocate = hooks->malloc_fn;
    }

    global_hooks.deallocate = free;
    if (hooks->free_fn != NULL)
    {
        global_hooks.deallocate = hooks->free_fn;
    }

    /* use realloc only if both free and malloc are used */
    global_hooks.reallocate = NULL;
    if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free))
    {
        global_hooks.reallocate = realloc;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x6e3b
movq 0x71bb(%rip), %rdx      # 0xdfb8
movq %rdx, 0x760c(%rip)      # 0xe410
movq (%rdi), %rax
testq %rax, %rax
cmoveq %rdx, %rax
movq 0x715b(%rip), %rsi      # 0xdf70
movq %rsi, 0x75fc(%rip)      # 0xe418
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
cmoveq %rsi, %rcx
xorq %rax, %rdx
xorq %rcx, %rsi
orq %rdx, %rsi
jne 0x6e52
movq 0x7187(%rip), %rdx      # 0xdfc0
jmp 0x6e54
movq 0x717e(%rip), %rdx      # 0xdfc0
movq 0x7127(%rip), %rcx      # 0xdf70
movq 0x7168(%rip), %rax      # 0xdfb8
jmp 0x6e54
xorl %edx, %edx
movq %rax, 0x75b5(%rip)      # 0xe410
movq %rcx, 0x75b6(%rip)      # 0xe418
movq %rdx, 0x75b7(%rip)      # 0xe420
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/json/cJSON.c
// Function: cJSON_ReplaceItemViaPointer
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement)
{
    if ((parent == NULL) || (replacement == NULL) || (item == NULL))
    {
        return false;
    }

    if (replacement == item)
    {
        return true;
    }

    replacement->next = item->next;
    replacement->prev = item->prev;

    if (replacement->next != NULL)
    {
        replacement->next->prev = replacement;
    }
    if (replacement->prev != NULL)
    {
        replacement->prev->next = replacement;
    }
    if (parent->child == item)
    {
        parent->child = replacement;
    }

    item->next = NULL;
    item->prev = NULL;
    cJSON_Delete(item);

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x8761
testq %rdi, %rdi
je 0x8761
testq %rdx, %rdx
je 0x8761
movl $0x1, %ebx
cmpq %rsi, %rdx
je 0x8761
movq (%rsi), %rcx
movq %rcx, (%rdx)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdx)
testq %rcx, %rcx
je 0x8741
movq %rdx, 0x8(%rcx)
movq 0x8(%rdx), %rax
testq %rax, %rax
je 0x8749
movq %rdx, (%rax)
cmpq %rsi, 0x10(%rdi)
jne 0x8753
movq %rdx, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
movq %rsi, %rdi
callq 0x41a0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/json/cJSON.c
// Function: cJSON_Minify
CJSON_PUBLIC(void) cJSON_Minify(char *json)
{
    unsigned char *into = (unsigned char*)json;

    if (json == NULL)
    {
        return;
    }

    while (*json)
    {
        if (*json == ' ')
        {
            json++;
        }
        else if (*json == '\t')
        {
            /* Whitespace characters. */
            json++;
        }
        else if (*json == '\r')
        {
            json++;
        }
        else if (*json=='\n')
        {
            json++;
        }
        else if ((*json == '/') && (json[1] == '/'))
        {
            /* double-slash comments, to end of line. */
            while (*json && (*json != '\n'))
            {
                json++;
            }
        }
        else if ((*json == '/') && (json[1] == '*'))
        {
            /* multiline comments. */
            while (*json && !((*json == '*') && (json[1] == '/')))
            {
                json++;
            }
            json += 2;
        }
        else if (*json == '\"')
        {
            /* string literals, which are \" sensitive. */
            *into++ = (unsigned char)*json++;
            while (*json && (*json != '\"'))
            {
                if (*json == '\\')
                {
                    *into++ = (unsigned char)*json++;
                }
                *into++ = (unsigned char)*json++;
            }
            *into++ = (unsigned char)*json++;
        }
        else
        {
            /* All other characters. */
            *into++ = (unsigned char)*json++;
        }
    }

    /* and null-terminate. */
    *into = '\0';
}

// Assembly:
testq %rdi, %rdi
je 0x8f2b
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
movb (%rdi), %cl
movzbl %cl, %edx
cmpl $0x1f, %edx
jg 0x8e6e
cmpl $0x9, %edx
jle 0x8e82
cmpl $0xa, %edx
je 0x8e88
cmpl $0xd, %edx
je 0x8e88
jmp 0x8f1a
cmpl $0x2f, %edx
je 0x8e8d
cmpl $0x22, %edx
je 0x8ed6
cmpl $0x20, %edx
je 0x8e88
jmp 0x8f1a
jne 0x8f16
incq %rdi
jmp 0x8e50
movzbl 0x1(%rdi), %edx
cmpl $0x2f, %edx
je 0x8ec5
cmpl $0x2a, %edx
jne 0x8f1a
addq $0x2, %rdi
movb $0x2f, %cl
cmpb $0x2a, %cl
je 0x8eb2
movzbl %cl, %ecx
testl %ecx, %ecx
je 0x8e50
movb -0x1(%rdi), %cl
jmp 0x8eba
movb -0x1(%rdi), %cl
cmpb $0x2f, %cl
je 0x8e50
incq %rdi
jmp 0x8ea1
movb 0x1(%rdi), %dl
incq %rdi
testb %dl, %dl
je 0x8e50
movzbl %dl, %ecx
cmpl $0xa, %ecx
jne 0x8ebf
jmp 0x8e50
movb $0x22, (%rax)
movzbl 0x1(%rdi), %ecx
cmpl $0x5c, %ecx
je 0x8ef3
testl %ecx, %ecx
je 0x8f06
cmpl $0x22, %ecx
je 0x8f06
incq %rax
incq %rdi
jmp 0x8f02
movb $0x5c, 0x1(%rax)
addq $0x2, %rax
movb 0x2(%rdi), %cl
addq $0x2, %rdi
movb %cl, (%rax)
jmp 0x8ed9
addq $0x2, %rdi
movb %cl, 0x1(%rax)
addq $0x2, %rax
jmp 0x8e50
testl %edx, %edx
je 0x8f27
incq %rdi
movb %cl, (%rax)
incq %rax
jmp 0x8e50
movb $0x0, (%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/log/log.c
// Function: log_print
void log_print(LOG_LEVEL lvl, cchar *color, cchar *t, cchar *f, cchar *func, int l, cchar *fmt, ...)
{
    if (lvl < g_log_lvl) {
        return;
    }

    va_list ap;
    va_start(ap, fmt);

    char *tmp = NULL;
    char buf_date[20] = {0};
    time_t cur_time = time(NULL);

    t = !t ? "\b" : t;
    f = !f ? "\b" : f;
    func = !func ? "\b" : func;

    tmp = strrchr(f, '/');
    if (tmp) {
        f = tmp + 1;
    }

    //add color support
    if (color) {
        puts(color);
    }

    printf(LOG_FMT, get_timestamp(buf_date, 20, cur_time), g_log_desc[lvl], t, f, func, l);

    vprintf(fmt, ap);

    if (color) {
        puts(COL_DEF);
    }

    va_end(ap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
testb %al, %al
je 0x99bf
movaps %xmm0, -0xf0(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm2, -0xd0(%rbp)
movaps %xmm3, -0xc0(%rbp)
movaps %xmm4, -0xb0(%rbp)
movaps %xmm5, -0xa0(%rbp)
movaps %xmm6, -0x90(%rbp)
movaps %xmm7, -0x80(%rbp)
cmpl %edi, 0x4a63(%rip)      # 0xe428
ja 0x9afd
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r15
movl %edi, %r13d
movl %r9d, -0x2c(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movabsq $0x3000000030, %rax     # imm = 0x3000000030
movq %rax, -0x50(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movl $0x0, -0x60(%rbp)
xorl %edi, %edi
movq %rsi, %rbx
callq 0x43e0
testq %r15, %r15
leaq 0xd6f(%rip), %rcx       # 0xa78d
cmoveq %rcx, %r15
testq %r12, %r12
cmoveq %rcx, %r12
movq %rax, -0x38(%rbp)
testq %r14, %r14
cmoveq %rcx, %r14
movq %r12, %rdi
movl $0x2f, %esi
callq 0x4290
movq %rbx, %rdi
leaq 0x1(%rax), %rbx
testq %rax, %rax
cmoveq %r12, %rbx
testq %rdi, %rdi
je 0x9ab2
callq 0x40d0
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x9b0f
movl %r13d, %eax
leaq 0x430d(%rip), %rcx      # 0xdd80
movq (%rcx,%rax,8), %rdx
movl -0x2c(%rbp), %eax
movl %eax, (%rsp)
leaq 0xd0b(%rip), %rdi       # 0xa78f
movq %r12, %rsi
movq %r15, %rcx
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x4240
leaq -0x50(%rbp), %rsi
movq 0x10(%rbp), %rdi
callq 0x4480
leaq 0xcfb(%rip), %rdi       # 0xa7a6
callq 0x40d0
jmp 0x9afd
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x9b0f
movl %r13d, %eax
leaq 0x42b4(%rip), %rcx      # 0xdd80
movq (%rcx,%rax,8), %rdx
movl -0x2c(%rbp), %eax
movl %eax, (%rsp)
leaq 0xcb2(%rip), %rdi       # 0xa78f
movq %r12, %rsi
movq %r15, %rcx
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x4240
leaq -0x50(%rbp), %rsi
movq 0x10(%rbp), %rdi
callq 0x4480
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/log/log.c
// Function: get_timestamp
static char *get_timestamp(char *buf, int len, time_t cur_time)
{
    struct tm tm_time;

#ifndef _WIN32
    localtime_r(&cur_time, &tm_time);
#else
    localtime_s(&tm_time, &cur_time);
#endif

    snprintf(buf, len, "%d-%d-%d %d:%d:%d",
             1900 + tm_time.tm_year, 1 + tm_time.tm_mon,
             tm_time.tm_mday, tm_time.tm_hour,
             tm_time.tm_min, tm_time.tm_sec);
    return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq -0x18(%rbp), %rdi
movq %rsi, (%rdi)
leaq -0x50(%rbp), %r14
movq %r14, %rsi
callq 0x4090
movl $0x76c, %ecx            # imm = 0x76C
addl 0x14(%r14), %ecx
movl 0x10(%r14), %r8d
incl %r8d
movl 0xc(%r14), %r9d
movl 0x8(%r14), %r10d
movl (%r14), %r11d
movl 0x4(%r14), %r14d
subq $0x8, %rsp
leaq 0xc51(%rip), %rdx       # 0xa7ab
movl $0x14, %esi
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r14
pushq %r10
callq 0x4280
addq $0x20, %rsp
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/threadpool/threadpool.c
// Function: threadpool_create
threadpool_t *threadpool_create(int thread_count, int queue_size, int flags)
{
    threadpool_t *pool;
    int i;
    (void) flags;

    if(thread_count <= 0 || thread_count > MAX_THREADS || queue_size <= 0 || queue_size > MAX_QUEUE) {
        return NULL;
    }

    if((pool = (threadpool_t *)malloc(sizeof(threadpool_t))) == NULL) {
        goto err;
    }

    /* Initialize */
    pool->thread_count = 0;
    pool->queue_size = queue_size;
    pool->head = pool->tail = pool->count = 0;
    pool->shutdown = pool->started = 0;

    /* Allocate thread and task queue */
    pool->threads = (pthread_t *)malloc(sizeof(pthread_t) * thread_count);
    pool->queue = (threadpool_task_t *)malloc
        (sizeof(threadpool_task_t) * queue_size);

    /* Initialize mutex and conditional variable first */
    if((pthread_mutex_init(&(pool->lock), NULL) != 0) ||
       (pthread_cond_init(&(pool->notify), NULL) != 0) ||
       (pool->threads == NULL) ||
       (pool->queue == NULL)) {
        goto err;
    }

    /* Start worker threads */
    for(i = 0; i < thread_count; i++) {
        if(pthread_create(&(pool->threads[i]), NULL,
                          threadpool_thread, (void*)pool) != 0) {
            threadpool_destroy(pool, 0);
            return NULL;
        }
        pool->thread_count++;
        pool->started++;
    }

    return pool;

 err:
    if(pool) {
        threadpool_free(pool);
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movl %edi, %r14d
leal -0x41(%r14), %eax
cmpl $-0x40, %eax
setb %al
leal -0x10001(%r15), %ecx
cmpl $0xffff0000, %ecx       # imm = 0xFFFF0000
setb %cl
orb %al, %cl
jne 0x9c23
movl $0x88, %edi
callq 0x46d8
xorl %r12d, %r12d
testq %rax, %rax
je 0x9c23
movq %rax, %rbx
movl %r12d, 0x68(%rax)
movl %r15d, 0x6c(%rax)
leal (,%r14,8), %edi
callq 0x46d8
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rbx)
movl %r12d, 0x80(%rbx)
movq %rax, 0x58(%rbx)
shll $0x4, %r15d
movq %r15, %rdi
callq 0x46d8
movq %rax, 0x60(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4680
testl %eax, %eax
jne 0x9c1b
movq %rbx, %rdi
addq $0x28, %rdi
xorl %esi, %esi
callq 0x4400
testl %eax, %eax
je 0x9c31
movq %rbx, %rdi
callq 0x43d0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x58(%rbx)
je 0x9c1b
cmpq $0x0, 0x60(%rbx)
je 0x9c1b
movl %r14d, %r15d
shlq $0x3, %r15
xorl %r12d, %r12d
leaq 0x38(%rip), %r14        # 0x9c88
movq 0x58(%rbx), %rdi
addq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x4500
testl %eax, %eax
jne 0x9c7c
incl 0x68(%rbx)
incl 0x80(%rbx)
addq $0x8, %r12
cmpq %r12, %r15
jne 0x9c50
jmp 0x9c25
movq %rbx, %rdi
xorl %esi, %esi
callq 0x45b0
jmp 0x9c23
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/threadpool/threadpool.c
// Function: threadpool_thread
static void *threadpool_thread(void *threadpool)
{
    threadpool_t *pool = (threadpool_t *)threadpool;
    threadpool_task_t task;

    for(;;) {
        /* Lock must be taken to wait on conditional variable */
        pthread_mutex_lock(&(pool->lock));

        /* Wait on condition variable, check for spurious wakeups.
           When returning from pthread_cond_wait(), we own the lock. */
        while((pool->count == 0) && (!pool->shutdown)) {
            pthread_cond_wait(&(pool->notify), &(pool->lock));
        }

        if((pool->shutdown == immediate_shutdown) ||
           ((pool->shutdown == graceful_shutdown) &&
            (pool->count == 0))) {
            break;
        }

        /* Grab our task */
        task.function = pool->queue[pool->head].function;
        task.argument = pool->queue[pool->head].argument;
        pool->head = (pool->head + 1) % pool->queue_size;
        pool->count -= 1;

        /* Unlock */
        pthread_mutex_unlock(&(pool->lock));

        /* Get to work */
        (*(task.function))(task.argument);
    }

    pool->started--;

    pthread_mutex_unlock(&(pool->lock));
    pthread_exit(NULL);
    return(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %rbx, %rdi
callq 0x46a0
movl 0x78(%rbx), %ecx
testl %ecx, %ecx
jne 0x9cbd
movl 0x7c(%rbx), %eax
testl %eax, %eax
jne 0x9d06
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4190
jmp 0x9ca2
movl 0x7c(%rbx), %eax
decl %ecx
xorl %edx, %edx
cmpl $0x2, %eax
je 0x9cd0
cmpl $0x1, %eax
jne 0x9cd4
jmp 0x9d0f
testb %dl, %dl
jne 0x9d0f
movq 0x60(%rbx), %rdx
movslq 0x70(%rbx), %rsi
leal 0x1(%rsi), %eax
shlq $0x4, %rsi
movq (%rdx,%rsi), %r12
movq 0x8(%rdx,%rsi), %r15
cltd
idivl 0x6c(%rbx)
movl %edx, 0x70(%rbx)
movl %ecx, 0x78(%rbx)
movq %rbx, %rdi
callq 0x4410
movq %r15, %rdi
callq *%r12
jmp 0x9c9a
movb $0x1, %dl
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x9cc4
decl 0x80(%rbx)
movq %rbx, %rdi
callq 0x4410
xorl %edi, %edi
callq 0x4440
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/threadpool/threadpool.c
// Function: threadpool_destroy
int threadpool_destroy(threadpool_t *pool, int flags)
{
    int i, err = 0;

    if(pool == NULL) {
        return threadpool_invalid;
    }

    if(pthread_mutex_lock(&(pool->lock)) != 0) {
        return threadpool_lock_failure;
    }

    do {
        /* Already shutting down */
        if(pool->shutdown) {
            err = threadpool_shutdown;
            pthread_mutex_unlock(&(pool->lock));
            break;
        }

        pool->shutdown = (flags & threadpool_graceful) ?
            graceful_shutdown : immediate_shutdown;

        /* Wake up all worker threads */
        if(pthread_cond_broadcast(&(pool->notify)) != 0) {
            err = threadpool_lock_failure;
            pthread_mutex_unlock(&(pool->lock));
            break;
        }

        pthread_mutex_unlock(&(pool->lock));
        
        /* Join all worker thread */
        for(i = 0; i < pool->thread_count; i++) {
            if(pthread_join(pool->threads[i], NULL) != 0) {
                err = threadpool_thread_failure;
            }
        }
    } while(0);

    /* Only if everything went well do we deallocate the pool */
    if(!err) {
        threadpool_free(pool);
    }
    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x9d5f
movl %esi, %r15d
movq %rdi, %rbx
callq 0x46a0
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
testl %eax, %eax
jne 0x9d65
cmpl $0x0, 0x7c(%rbx)
je 0x9d71
movq %rbx, %rdi
callq 0x4410
movl $0xfffffffc, %r14d      # imm = 0xFFFFFFFC
jmp 0x9d65
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
andl $0x1, %r15d
incl %r15d
movl %r15d, 0x7c(%rbx)
leaq 0x28(%rbx), %rdi
callq 0x40c0
movl %eax, %r15d
movq %rbx, %rdi
callq 0x4410
testl %r15d, %r15d
jne 0x9d65
cmpl $0x0, 0x68(%rbx)
jle 0x9dcd
xorl %r15d, %r15d
movl $0xfffffffb, %r12d      # imm = 0xFFFFFFFB
xorl %r14d, %r14d
movq 0x58(%rbx), %rax
movq (%rax,%r15,8), %rdi
xorl %esi, %esi
callq 0x4620
testl %eax, %eax
cmovnel %r12d, %r14d
incq %r15
movslq 0x68(%rbx), %rax
cmpq %rax, %r15
jl 0x9da7
testl %r14d, %r14d
jne 0x9d65
movq %rbx, %rdi
callq 0x43d0
xorl %r14d, %r14d
jmp 0x9d65
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/threadpool/threadpool.c
// Function: threadpool_free
int threadpool_free(threadpool_t *pool)
{
    if(pool == NULL || pool->started > 0) {
        return -1;
    }

    /* Did we manage to allocate ? */
    if(pool->threads) {
        free(pool->threads);
        free(pool->queue);

#if 0   /* reth code  */ 
        /* Because we allocate pool->threads after initializing the
           mutex and condition variable, we're sure they're
           initialized. Let's lock the mutex just in case. */
        pthread_mutex_lock(&(pool->lock));
#endif
        pthread_mutex_destroy(&(pool->lock));
        pthread_cond_destroy(&(pool->notify));
    }
    free(pool);    
    return 0;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x9e2e
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x80(%rdi)
jg 0x9e28
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x9e1e
callq 0x46d0
movq 0x60(%rbx), %rdi
callq 0x46d0
movq %rbx, %rdi
callq 0x4270
leaq 0x28(%rbx), %rdi
callq 0x4560
movq %rbx, %rdi
callq 0x46d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/threadpool/threadpool.c
// Function: threadpool_add
int threadpool_add(threadpool_t *pool, void (*function)(void *),
                   void *argument, int flags)
{
    int err = 0;
    int next;
    (void) flags;

    if(pool == NULL || function == NULL) {
        return threadpool_invalid;
    }

    if(pthread_mutex_lock(&(pool->lock)) != 0) {
        return threadpool_lock_failure;
    }

    next = (pool->tail + 1) % pool->queue_size;

    do {
        /* Are we full ? */
        if(pool->count == pool->queue_size) {
            err = threadpool_queue_full;
            break;
        }

        /* Are we shutting down ? */
        if(pool->shutdown) {
            err = threadpool_shutdown;
            break;
        }

        /* Add task to queue */
        pool->queue[pool->tail].function = function;
        pool->queue[pool->tail].argument = argument;
        pool->tail = next;
        pool->count += 1;

        /* pthread_cond_broadcast */
        if(pthread_cond_signal(&(pool->notify)) != 0) {
            err = threadpool_lock_failure;
            break;
        }
    } while(0);

    if(pthread_mutex_unlock(&pool->lock) != 0) {
        err = threadpool_lock_failure;
    }

    return err;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x9ede
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x46a0
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
jne 0x9ed6
movslq 0x74(%rbx), %rcx
leal 0x1(%rcx), %eax
movl 0x6c(%rbx), %edi
movl 0x78(%rbx), %esi
cltd
idivl %edi
movl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
cmpl %edi, %esi
je 0x9ec3
movl $0xfffffffc, %r12d      # imm = 0xFFFFFFFC
cmpl $0x0, 0x7c(%rbx)
jne 0x9ec3
movq 0x60(%rbx), %rax
shlq $0x4, %rcx
movq %r15, (%rax,%rcx)
movq %r14, 0x8(%rax,%rcx)
movl %edx, 0x74(%rbx)
incl %esi
movl %esi, 0x78(%rbx)
leaq 0x28(%rbx), %rdi
callq 0x4350
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leal -0x2(,%rcx,2), %r12d
movq %rbx, %rdi
callq 0x4410
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovel %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/erplag.c
// Function: main
int main(int argc, char **argv)
{
	FILE *fpIn ;
	char *outputFile ;
	checkCommand (argc, argv, &outputFile) ;
 
 	if (!(fpIn = fopen (argv[1], "r")))
 	{
 		errFatal () ;
		#if defined __linux__ || defined __MACH__
 			printf ("Source file " ANSI_BOLD "%s" ANSI_RESET " does not exist\n", argv[1]) ;
		#endif
		#ifdef _WIN64
			printf ("Source file %s does not exist\n", argv[1]) ;
		#endif
 		exit (1) ;
 	}


	treeNode *root = parse (fpIn) ;
	if (root->syntax_error)
		exit (1) ;

	astNode *astRoot ;
	astRoot = applyASTRule (root) ;
	deletePT (root) ;
	
	realBase = fillSymbolTable (astRoot,0);

	if (!realBase->semanticError)
	{
		if (realPresent)
		{
			errCodegen () ;
			#if defined __linux__ || defined __MACH__
				printf ("Variables or static values of type " ANSI_BOLD ANSI_GREEN "real" ANSI_RESET " found in source file, which is not handled by the present version of the compiler.\n") ;
			#endif
			#ifdef _WIN64
				printf ("Variables or static values of type \"real\" found in source file, which is not handled by the present version of the compiler.\n") ;
			#endif
			exit (1) ;
		}

		int len ;
		if (!(fpOut = fopen (outputFile, "w")))
		{
			errFatal () ;
			#if defined __linux__ || defined __MACH__
				printf ("Error creating asm file " ANSI_BOLD "%s" ANSI_RESET "\n", outputFile) ;
			#endif
			#ifdef _WIN64
				printf ("Error creating asm file %s\n", outputFile) ;
			#endif
			exit (1) ;
		}

		preamble () ;
		codeGeneration (astRoot) ;
		postamble () ;
	}
	else
		exit (1) ;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
leaq -0x18(%rbp), %rdx
callq 0x128c
movq 0x8(%rbx), %rdi
leaq 0xffd4(%rip), %rsi      # 0x113f5
callq 0x1130
testq %rax, %rax
je 0x14c4
movq %rax, %rdi
callq 0xad19
cmpl $0x0, 0x24(%rax)
jne 0x1505
movq %rax, %r14
movq %rax, %rdi
callq 0x5f21
movq %rax, %rbx
movq %r14, %rdi
callq 0xb1d1
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd97a
leaq 0x2fbc0(%rip), %rcx     # 0x31028
movq %rax, (%rcx)
cmpl $0x0, 0xd8(%rax)
jne 0x1505
leaq 0x2fba5(%rip), %rax     # 0x31024
cmpl $0x0, (%rax)
jne 0x14d8
movq -0x18(%rbp), %r14
leaq 0x100a5(%rip), %rsi     # 0x11534
movq %r14, %rdi
callq 0x1130
movq %rax, 0x15eaa(%rip)     # 0x17348
testq %rax, %rax
je 0x14ed
xorl %eax, %eax
callq 0x3e6e
movq %rbx, %rdi
callq 0x3d10
xorl %eax, %eax
callq 0x435c
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
callq 0xe903
movq 0x8(%rbx), %rsi
leaq 0xdb2e(%rip), %rdi      # 0xf004
jmp 0x14fe
xorl %eax, %eax
callq 0xe9e7
leaq 0xdc0c(%rip), %rdi      # 0xf0f2
callq 0x1070
jmp 0x1505
xorl %eax, %eax
callq 0xe903
leaq 0xdb30(%rip), %rdi      # 0xf02b
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0x1, %edi
callq 0x1160
nop
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/codegen.c
// Function: codeComment
void codeComment (int tabCount, char *comment)
{
	int i ;
	for (i = 0 ; i < tabCount ; i++)
		codePrint ("\t") ;

	codePrint ("; %s\n", comment) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
testl %edi, %edi
jle 0x155b
movl %edi, %r14d
leaq 0x15dff(%rip), %r15     # 0x17348
movq (%r15), %rsi
movl $0x9, %edi
callq 0x10e0
decl %r14d
jne 0x1549
leaq 0x15de6(%rip), %rax     # 0x17348
movq (%rax), %rdi
leaq 0xdcb8(%rip), %rsi      # 0xf224
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/codegen.c
// Function: getOffsetStr
char* getOffsetStr (int offset)
{	
	if (offset > 0)
		sprintf (offsetStr, " - %d", offset) ;
	else if (offset < 0)
		sprintf (offsetStr, " + %d", -offset) ;
	else
		memset (offsetStr, 0, 10) ;

	return offsetStr ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %edx
testl %edi, %edi
jle 0x15a1
leaq 0x15ddf(%rip), %rdi     # 0x17370
leaq 0xdc92(%rip), %rsi      # 0xf22a
xorl %eax, %eax
callq 0x1150
jmp 0x15b7
js 0x15c0
movw $0x0, 0x15dcc(%rip)     # 0x17378
movq $0x0, 0x15db9(%rip) # 0x17370
leaq 0x15db2(%rip), %rax     # 0x17370
popq %rbp
retq
negl %edx
leaq 0x15da7(%rip), %rdi     # 0x17370
leaq 0xdc60(%rip), %rsi      # 0xf230
jmp 0x1598
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/codegen.c
// Function: loadRegLeftLim
void loadRegLeftLim (varST *vst, char *reg)
{
	if (isLeftLimStatic (vst))
		codePrint ("\t\tMOV %s, %s\n", reg, vst->arrayIndices->tokLeft->lexeme) ;
	else
		codePrint ("\t\tMOV %s, [RBP%s]\n", reg, getOffsetStr(vst->offset-10)) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
callq 0xdfb8
leaq 0x15d29(%rip), %rcx     # 0x17348
movq (%rcx), %r14
testl %eax, %eax
je 0x163b
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
leaq 0xdbfd(%rip), %rsi      # 0xf236
jmp 0x1655
movl 0x1c(%r15), %edi
addl $-0xa, %edi
callq 0x1580
leaq 0xe3ee(%rip), %rsi      # 0xfa3c
leaq 0x15d1b(%rip), %rcx     # 0x17370
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/codegen.c
// Function: loadRegRightLim
void loadRegRightLim (varST *vst, char *reg)
{
	if (isRightLimStatic (vst))
		codePrint ("\t\tMOV %s, %s\n", reg, vst->arrayIndices->tokRight->lexeme) ;		
	else
		codePrint ("\t\tMOV %s, [RBP%s]\n", reg, getOffsetStr(vst->offset-8)) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
callq 0xdfe9
leaq 0x15cc0(%rip), %rcx     # 0x17348
movq (%rcx), %r14
testl %eax, %eax
je 0x16a4
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rcx
leaq 0xdb94(%rip), %rsi      # 0xf236
jmp 0x16be
movl 0x1c(%r15), %edi
addl $-0x8, %edi
callq 0x1580
leaq 0xe385(%rip), %rsi      # 0xfa3c
leaq 0x15cb2(%rip), %rcx     # 0x17370
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/codegen.c
// Function: loadArrBase
void loadArrBase (varST *vst, char *reg)
{
	if (isVarStaticArr (vst))
	{
		if (vst->varType == VAR_LOCAL)
		{
			codePrint ("\t\tMOV %s, RBP\n", reg) ;
			codePrint ("\t\tSUB %s, %d\n", reg, vst->offset) ;			
		}
		else
			codePrint ("\t\tMOV %s, [RBP%s]\n", reg, getOffsetStr (vst->offset)) ;
	}
	else
		codePrint ("\t\tMOV %s, [RBP%s]\n", reg, getOffsetStr(vst->offset)) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0xe01a
testl %eax, %eax
je 0x1736
cmpl $0x3, 0x30(%r14)
leaq 0x15c4d(%rip), %r12     # 0x17348
movq (%r12), %r15
jne 0x1740
leaq 0xdb3c(%rip), %rsi      # 0xf244
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1100
movq (%r12), %rdi
movl 0x1c(%r14), %ecx
leaq 0xdb2f(%rip), %rsi      # 0xf253
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1100
leaq 0x15c0b(%rip), %rax     # 0x17348
movq (%rax), %r15
movl 0x1c(%r14), %edi
callq 0x1580
leaq 0xe2ec(%rip), %rsi      # 0xfa3c
leaq 0x15c19(%rip), %rcx     # 0x17370
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1100