LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/connectivity/ws_nopoll.c
// Function: ws_nopoll_set_on_ready
int ws_nopoll_set_on_ready(void *handle, noPollActionHandler on_ready)
{
    noPollConn *conn = (noPollConn *)handle;
    noPollCtx *ctx = NULL;

    if (NULL == conn) {
        log_debug("ERROR: conn is NULL ");
        return -1;
    }

    ctx = nopoll_conn_ctx(conn);
    if (NULL == ctx) {
        log_debug("ERROR: ctx is NULL ");
        return -1;
    }

    /* set on connect ready */
	if (NULL != on_ready) {
    	nopoll_ctx_set_on_ready (ctx, on_ready, NULL);
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x30f6
movq %rsi, %rbx
callq 0x2040
testq %rax, %rax
je 0x3114
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x313d
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2070
jmp 0x313d
leaq 0x5f07(%rip), %rsi      # 0x9004
leaq 0x5f3c(%rip), %rdx      # 0x9040
leaq 0x61c5(%rip), %r8       # 0x92d0
xorl %edi, %edi
movl $0xec, %ecx
jmp 0x3130
leaq 0x5ee9(%rip), %rsi      # 0x9004
leaq 0x5f1e(%rip), %rdx      # 0x9040
leaq 0x61bc(%rip), %r8       # 0x92e5
xorl %edi, %edi
movl $0xf2, %ecx
xorl %eax, %eax
callq 0x42c5
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/connectivity/ws_nopoll.c
// Function: ws_nopoll_set_on_msg
int ws_nopoll_set_on_msg(void *handle, noPollOnMessageHandler on_message)
{
    noPollConn *conn = (noPollConn *)handle;
    noPollCtx *ctx = NULL;

    if (NULL == conn) {
        log_debug("ERROR: conn is NULL ");
        return -1;
    }

    ctx = nopoll_conn_ctx(conn);
    if (NULL == ctx) {
        log_debug("ERROR: ctx is NULL ");
        return -1;
    }

	/* set on message received */
	if (NULL != on_message) {
    	nopoll_ctx_set_on_msg (ctx, on_message, NULL);
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3175
movq %rsi, %rbx
callq 0x2040
testq %rax, %rax
je 0x3193
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x31bc
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2490
jmp 0x31bc
leaq 0x5e88(%rip), %rsi      # 0x9004
leaq 0x5ebd(%rip), %rdx      # 0x9040
leaq 0x6146(%rip), %r8       # 0x92d0
xorl %edi, %edi
movl $0x104, %ecx            # imm = 0x104
jmp 0x31af
leaq 0x5e6a(%rip), %rsi      # 0x9004
leaq 0x5e9f(%rip), %rdx      # 0x9040
leaq 0x613d(%rip), %r8       # 0x92e5
xorl %edi, %edi
movl $0x10a, %ecx            # imm = 0x10A
xorl %eax, %eax
callq 0x42c5
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/connectivity/ws_nopoll.c
// Function: ws_nopoll_accept
noPollConn *ws_nopoll_accept(void *handle)
{
    noPollConn *master = (noPollConn *)handle;
    noPollConn *conn = NULL;
    noPollCtx *ctx = NULL;

    if (NULL == master) {
        log_debug("ERROR: master conn is NULL ");
        return NULL;
    }

    ctx = nopoll_conn_ctx(master);
    if (NULL == ctx) {
        log_debug("ERROR: ctx is NULL ");
        return NULL;
    }

    conn = nopoll_conn_accept(ctx, master);
	if (!nopoll_conn_is_ok (conn)) {
		log_debug("ERROR: expected to find proper listener status (connection accepted), but found failure.. ");
		return NULL;
	}

	return conn;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x3214
movq %rdi, %rbx
callq 0x2040
testq %rax, %rax
je 0x3234
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2280
movq %rax, %rbx
movq %rax, %rdi
callq 0x2320
testl %eax, %eax
jne 0x3259
leaq 0x5e09(%rip), %rsi      # 0x9004
leaq 0x5e3e(%rip), %rdx      # 0x9040
leaq 0x610c(%rip), %r8       # 0x9315
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x129, %ecx            # imm = 0x129
jmp 0x3252
leaq 0x5de9(%rip), %rsi      # 0x9004
leaq 0x5e1e(%rip), %rdx      # 0x9040
leaq 0x60d0(%rip), %r8       # 0x92f9
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x11d, %ecx            # imm = 0x11D
jmp 0x3252
leaq 0x5dc9(%rip), %rsi      # 0x9004
leaq 0x5dfe(%rip), %rdx      # 0x9040
leaq 0x609c(%rip), %r8       # 0x92e5
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x123, %ecx            # imm = 0x123
xorl %eax, %eax
callq 0x42c5
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/connectivity/ws_nopoll.c
// Function: ws_nopoll_get_conn_info
int ws_nopoll_get_conn_info(void *handle, ConnectInfo_t *connInfo)
{
    if (NULL == connInfo) {
        log_debug("ERROR: connInfo is NULL ");
        return -1;
    }

    noPollConn *conn = (noPollConn *)handle;
    if (NULL != conn) {
        connInfo->sockfd = (int) nopoll_conn_socket(conn);
        connInfo->host = nopoll_conn_host(conn);
        connInfo->port = nopoll_conn_port(conn);
        connInfo->origin = nopoll_conn_get_origin(conn);
        //printf("----> origin:  %s\n", connInfo->origin);
        connInfo->get_url = nopoll_conn_get_requested_url(conn);
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x32b2
movq %rdi, %r15
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x32da
movq %rsi, %r14
movq %r15, %rdi
callq 0x2430
movl %eax, (%r14)
movq %r15, %rdi
callq 0x2290
movq %rax, 0x8(%r14)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x10(%r14)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x18(%r14)
movq %r15, %rdi
callq 0x22c0
movq %rax, 0x20(%r14)
jmp 0x32da
leaq 0x5d4b(%rip), %rsi      # 0x9004
leaq 0x5d80(%rip), %rdx      # 0x9040
leaq 0x60a9(%rip), %r8       # 0x9370
xorl %edi, %edi
movl $0x133, %ecx            # imm = 0x133
xorl %eax, %eax
callq 0x42c5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/json/json_parser.c
// Function: json_get_object
char* json_get_object(int type, char* str) {
    char* pos = 0;
    char ch = (type == JOBJECT) ? '{' : '[';
    while (str != 0 && *str != 0) {
        if (*str == ' ') {
            str++;
            continue;
        }
        pos = (*str == ch) ? str : 0;
        break;
    }
    return pos;
}

// Assembly:
testq %rsi, %rsi
jne 0x32ee
jmp 0x32fa
incq %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x32eb
testl %eax, %eax
jne 0x32fd
xorl %eax, %eax
retq
movsbl %al, %ecx
xorl %edx, %edx
cmpl $0x1, %edi
sete %dl
shll $0x5, %edx
orl $0x5b, %edx
xorl %eax, %eax
cmpl %ecx, %edx
cmoveq %rsi, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/json/json_parser.c
// Function: json_parse_name_value
int json_parse_name_value(char *p_cJsonStr, int iStrLen, json_parse_cb pfnCB, void *p_CBData)
{
    char *pos=0, *key=0, *val=0;
    int klen=0, vlen=0, vtype=0;
    char last_char=0;
    int ret = JSON_RESULT_ERR;

    if (p_cJsonStr==NULL || iStrLen==0 || pfnCB==NULL)
        return ret;

    backup_json_str_last_char(p_cJsonStr, iStrLen, last_char);

    json_object_for_each_kv(p_cJsonStr, pos, key, klen, val, vlen, vtype) {
        if (key && klen && val && vlen) {
            ret = JSON_RESULT_OK;
            if (JSON_PARSE_FINISH == pfnCB(key, klen, val, vlen, vtype, p_CBData)) {	//catch the ball
                break;
            }
        }
    }

    restore_json_str_last_char(p_cJsonStr, iStrLen, last_char);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x18(%rsp)
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
testq %rdi, %rdi
sete %al
testl %esi, %esi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
orb %cl, %al
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0x37d5
movq %rdx, %r15
movq %rdi, %rbx
movslq %esi, %rax
movb (%rdi,%rax), %cl
movb %cl, 0xb(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, (%rdi,%rax)
movq %rdi, %r12
movzbl (%r12), %eax
cmpl $0x20, %eax
jne 0x372b
incq %r12
jmp 0x371c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7b, %eax
jne 0x37c9
leaq 0x18(%rsp), %r13
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, %edi
movq %r12, %rsi
leaq 0x20(%rsp), %rdx
leaq 0x14(%rsp), %rcx
movq %r13, %r8
movq %r14, %r9
callq 0x3317
testq %rax, %rax
je 0x37c9
movq %rax, %r12
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
setne %al
movl 0x14(%rsp), %esi
testl %esi, %esi
setne %r8b
andb %al, %r8b
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
setne %al
movl 0x10(%rsp), %ecx
testl %ecx, %ecx
setne %r9b
andb %al, %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x37be
movl 0xc(%rsp), %r8d
movq 0x30(%rsp), %r9
callq *%r15
xorl %ebp, %ebp
cmpl $0x2, %eax
je 0x37c9
cmpb $0x0, (%r12)
jne 0x3743
movq 0x28(%rsp), %rax
movb 0xb(%rsp), %cl
movb %cl, (%rbx,%rax)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/json/json_parser.c
// Function: json_get_value_by_name
char *json_get_value_by_name(char *p_cJsonStr, int iStrLen, char *p_cName, int *p_iValueLen, int *p_iValueType)
{
    JSON_NV stNV = { 0, 0, 0, 0 };
    stNV.pN = p_cName;
    stNV.nLen = strlen(p_cName);
    if (JSON_RESULT_OK == json_parse_name_value(p_cJsonStr, iStrLen, json_get_value_by_name_cb, (void *)&stNV)) {
        if (p_iValueLen)
            *p_iValueLen = stNV.vLen;
        if (p_iValueType)
            *p_iValueType = stNV.vType;
    }
    return stNV.pV;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %rbx
movq %rcx, %r14
movl %esi, %ebp
movq %rdi, %r15
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %rdx, 0x10(%r12)
movq %rdx, %rdi
callq 0x2270
movl %eax, (%r12)
leaq -0x85(%rip), %rdx       # 0x37e6
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rcx
callq 0x36b5
testl %eax, %eax
jne 0x3893
testq %r14, %r14
je 0x3888
movl 0x4(%rsp), %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x3893
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
movq 0x18(%rsp), %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/json/json_parser.c
// Function: json_get_array_size
int json_get_array_size(char *json_str, int str_len)
{
    char *pos, *entry;

    char last_char = 0;
    backup_json_str_last_char(json_str, str_len, last_char);

    int len, type, size = 0;
    json_array_for_each_entry(json_str, pos, entry, len, type){
        size++;
    }
    restore_json_str_last_char(json_str, str_len, last_char);

    return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movslq %esi, %r13
movb (%rdi,%r13), %al
movb %al, 0x17(%rsp)
movb $0x0, (%rdi,%r13)
movq %rdi, %rax
movzbl (%rax), %ecx
cmpl $0x20, %ecx
jne 0x38d6
incq %rax
jmp 0x38c9
xorl %r14d, %r14d
cmpl $0x5b, %ecx
jne 0x3918
leaq 0x18(%rsp), %rbp
leaq 0x20(%rsp), %r15
leaq 0x1c(%rsp), %r12
incq %rax
movq %rbp, (%rsp)
movl $0x2, %edi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %r9
callq 0x3317
testq %rax, %rax
je 0x3918
incl %r14d
cmpb $0x0, (%rax)
jne 0x38ed
movb 0x17(%rsp), %al
movb %al, (%rbx,%r13)
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/misc/misc.c
// Function: dump_hex
void dump_hex(char *p , int len)
{
    int i = 0;

    for(i = 0; i < len; i++){
        printf("0x%x ",(unsigned char)p[i]) ; 
        if(i != 0 && i % 10 == 0)
            printf("\n");
    }
    printf("\n");
}

// Assembly:
testl %esi, %esi
jle 0x399d
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl %esi, %r15d
movl $0xcccccccd, %r12d      # imm = 0xCCCCCCCD
leaq 0x5a55(%rip), %r14      # 0x93a9
xorl %r13d, %r13d
movzbl (%rbx,%r13), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2080
testq %r13, %r13
je 0x398c
movl %r13d, %eax
imulq %r12, %rax
shrq $0x23, %rax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movl %r13d, %ecx
subl %eax, %ecx
jne 0x398c
movl $0xa, %edi
callq 0x2120
incq %r13
cmpq %r13, %r15
jne 0x3957
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
movl $0xa, %edi
jmp 0x2120
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/misc/misc.c
// Function: get_dev_ip
int get_dev_ip(char *buf, int size)
{
    FILE *fp = NULL;
    char bufTmp[256];
    int len = 0, j = 0, i = 0;

    if (NULL == buf || size < 256) {
        return 0;
    }
    
    fp = popen(SHELL_GET_IP, "r");
    if(fp == NULL)
        return 0;

    memset(buf, 0x0, size);
    memset(bufTmp, 0x0, sizeof(bufTmp));
    fgets(bufTmp, sizeof(bufTmp), fp);

    for(i = 0; i < strlen(bufTmp); i++) {
        if (bufTmp[i] != '[' && bufTmp[i] != ']') {
            buf[j] = bufTmp[i];
            j++;
        }
    }
    len = strlen(buf);
    if(len > 0) {
        if (buf[len - 1] == '\n' || buf[len - 1] == '\r') {
            buf[len - 1] = '\0';
        }
    }

    pclose(fp);

    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
testq %rdi, %rdi
sete %al
cmpl $0x100, %esi            # imm = 0x100
setl %cl
xorl %r15d, %r15d
orb %al, %cl
jne 0x3a83
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x59d3(%rip), %rdi      # 0x93af
leaq 0x5edf(%rip), %rsi      # 0x98c2
callq 0x2560
testq %rax, %rax
je 0x3a83
movq %rax, %r14
movl %ebp, %edx
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2090
movq %rsp, %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x2090
movq %r15, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdx
callq 0x21e0
movq %r15, %rdi
callq 0x2270
testq %rax, %rax
je 0x3a54
xorl %ecx, %ecx
movzbl (%rsp,%rcx), %edx
cmpl $0x5b, %edx
je 0x3a4c
cmpl $0x5d, %edx
je 0x3a4c
movslq %r12d, %r12
movb %dl, (%rbx,%r12)
incl %r12d
incq %rcx
cmpq %rcx, %rax
jne 0x3a34
movq %rbx, %rdi
callq 0x2270
movq %rax, %r15
testl %r15d, %r15d
jle 0x3a7b
movl %r15d, %eax
decl %eax
movzbl (%rbx,%rax), %ecx
cmpl $0xd, %ecx
je 0x3a77
cmpl $0xa, %ecx
jne 0x3a7b
movb $0x0, (%rbx,%rax)
movq %r14, %rdi
callq 0x22a0
movl %r15d, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/misc/misc.c
// Function: rand_string_alloc
char* rand_string_alloc(size_t size)
{
    char *s = malloc(size + 1);
    if (s) {
        _rand_string(s, size);
    }
    return s;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
incq %rdi
callq 0x2150
movq %rax, %r14
testq %rax, %rax
je 0x3ab8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ac3
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/misc/misc.c
// Function: rand_string
static char *_rand_string(char *str, size_t size)
{
    const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    if (size) {
        --size;
        size_t n = 0;
        for (n = 0; n < size; n++) {
            int key = rand() % (int) (sizeof charset - 1);
            str[n] = charset[key];
        }
        str[size] = '\0';
    }
    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x3b26
movq %rsi, %r14
decq %r14
je 0x3b21
xorl %r15d, %r15d
leaq 0x58fb(%rip), %r12      # 0x93e0
callq 0x2520
cltq
imulq $-0x7bdef7bd, %rax, %rcx # imm = 0x84210843
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x5, %ecx
addl %edx, %ecx
movl %ecx, %edx
shll $0x6, %edx
addl %ecx, %ecx
subl %edx, %ecx
addl %eax, %ecx
movslq %ecx, %rax
movb (%rax,%r12), %al
movb %al, (%rbx,%r15)
incq %r15
cmpq %r15, %r14
jne 0x3ae5
movb $0x0, (%rbx,%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_init
void *ht_init(int max_cnt)
{
    ht_t *p = NULL;
    int len = max_cnt * sizeof(ht_item_t);

    if (max_cnt <= 0) {
        return NULL;
    }

    p = malloc(sizeof(ht_t));
    if (NULL == p) {
        return NULL;
    }
    memset(p, 0, sizeof(ht_t));

    p->item = malloc(len);
    if (NULL == p->item) {
        free(p);
        return NULL;
    }
    memset(p->item, 0, len);
    pthread_mutex_init(&p->locker , NULL);

    p->cnt = max_cnt;
    return p;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testl %edi, %edi
jle 0x3c01
movl %edi, %ebp
movl $0x1, %edi
movl $0x38, %esi
callq 0x24a0
testq %rax, %rax
je 0x3c01
movq %rax, %rbx
movl %ebp, %eax
shll $0x5, %eax
movslq %eax, %rsi
movl $0x1, %edi
callq 0x24a0
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x3bf9
movq %rbx, %rdi
addq $0x8, %rdi
xorl %esi, %esi
callq 0x21d0
movl %ebp, (%rbx)
jmp 0x3c03
movq %rbx, %rdi
callq 0x2250
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_find_lockless
void *ht_find_lockless(void *ht, const void *key, unsigned int key_len, void *val, int *size_val)
{
    ht_item_t *p = _ht_find_lockless(ht, key, key_len);
    void *ret = NULL;

    while (p) {
        if (p->key && !memcmp(p->key, key, key_len)) {
            ret = p->val;
            break;
        }
        p = p->next;
    }

    if (ret && val && size_val) {
        memcpy(val, ret, p->size_val > *size_val ? *size_val : p->size_val);
        *size_val = p->size_val;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movl %edx, %ebx
movq %rsi, %r13
callq 0x3cc3
testq %rax, %rax
je 0x3c76
movq %rax, %r12
movl %ebx, %ebp
xorl %ebx, %ebx
movq (%r12), %rdi
testq %rdi, %rdi
je 0x3c6a
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2350
testl %eax, %eax
je 0x3c7a
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0x3c52
jmp 0x3cb1
xorl %ebx, %ebx
jmp 0x3cb1
movq 0x8(%r12), %rbx
testq %r14, %r14
je 0x3cb1
testq %r15, %r15
je 0x3cb1
testq %rbx, %rbx
je 0x3cb1
movl 0x10(%r12), %eax
movl (%r14), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movslq %ecx, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2580
movl 0x10(%r12), %eax
movl %eax, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_find_lockless
static ht_item_t *_ht_find_lockless(void *ht, const void *key, unsigned int key_len)
{
    unsigned int pos = 0;
    ht_t *pt = (ht_t *)ht;

    if (!ht || !key || key_len <= 0) {
        return NULL;
    }

    pos = _hash_func((const unsigned char *)key, key_len) % pt->cnt;

    return (pt->item + pos);//users should check the pointer to get all the values.
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
sete %r8b
xorl %eax, %eax
orb %cl, %r8b
jne 0x3d24
movl %edx, %ecx
xorl %edx, %edx
movzbl (%rsi,%rdx), %r8d
incq %rdx
addl %eax, %r8d
movl %r8d, %r9d
shll $0xa, %r9d
addl %r8d, %r9d
movl %r9d, %eax
shrl $0x6, %eax
xorl %r9d, %eax
cmpq %rdx, %rcx
jne 0x3ce2
leal (%rax,%rax,8), %eax
movl %eax, %ecx
shrl $0xb, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xf, %eax
addl %ecx, %eax
xorl %edx, %edx
divl (%rdi)
movl %edx, %eax
shlq $0x5, %rax
addq 0x30(%rdi), %rax
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_find
void *ht_find(void *ht, const void *key, unsigned int key_len, void *val, int *size_val)
{
    void *ret = NULL;

    ht_lock(ht);
    ret = ht_find_lockless(ht, key, key_len, val, size_val);
    ht_unlock(ht);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
testq %rdi, %rdi
je 0x3d7f
movq %rdi, %r12
leaq 0x8(%rdi), %r13
movq %r13, %rdi
callq 0x2510
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
movq %rbx, %r8
callq 0x3c2b
movq %rax, %rbx
movq %r13, %rdi
callq 0x2570
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
movq %rbx, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c2b
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_add
int ht_add(void *ht, const void *key, unsigned int len_key, const void *val, unsigned int size_val)
{
    int ret = 0;
    ht_lock(ht);
    ret = ht_add_lockless(ht, key, len_key, val, size_val);
    ht_unlock(ht);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
testq %rdi, %rdi
je 0x3fdb
movq %rdi, %r12
leaq 0x8(%rdi), %r13
movq %r13, %rdi
callq 0x2510
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
movl %ebx, %r8d
callq 0x3d9f
movl %eax, %ebx
movq %r13, %rdi
callq 0x2570
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
movl %ebx, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d9f
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_del_node
static int _ht_del_node(void *ht_item, const void *key, unsigned int len_key)
{
    ht_item_t *p_tmp = NULL;
    ht_item_t *next = NULL;
    ht_item_t *parent = NULL; // the root node or previous node
    int flag = 0;
    int ret = -1;

    if (!ht_item) {
        return ret;
    }

    parent = (ht_item_t *)ht_item;
    while (parent) {
        if (parent->key && parent->val &&
                (!key || !memcmp(parent->key, key, len_key))) {
            next = parent->next;//store its next item befroe free.

            free(parent->key);
            parent->key = NULL;
            free(parent->val);
            parent->val = NULL;
            ret = 0;
            if (1 == flag) {//just free the added item not the root item.
                free(parent);
                p_tmp->next = next;
            } else {
                p_tmp = parent;
            }

            if (key) {
                break;
            }
            parent = next;
        } else {
            p_tmp = parent;
            parent = parent->next;
        }
        flag = 1;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
testq %rdi, %rdi
je 0x40cc
movq %rdi, %r15
movl %edx, %eax
movq %rax, 0x10(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
xorl %r13d, %r13d
movq (%r15), %r12
testq %r12, %r12
je 0x4078
cmpq $0x0, 0x8(%r15)
je 0x4078
cmpq $0x0, 0x8(%rsp)
je 0x407e
movq %r12, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x2350
testl %eax, %eax
je 0x407e
movq 0x18(%r15), %rbx
jmp 0x40bc
movq 0x18(%r15), %rbx
movq %r12, %rdi
callq 0x2250
xorl %r12d, %r12d
movq %r12, (%r15)
movq 0x8(%r15), %rdi
callq 0x2250
movq %r12, 0x8(%r15)
testb $0x1, %r14b
je 0x40b2
movq %r15, %rdi
callq 0x2250
movq %rbx, 0x18(%r13)
movq %r13, %r15
xorl %ebp, %ebp
cmpq $0x0, 0x8(%rsp)
jne 0x40d1
movq %r15, %r13
movb $0x1, %r14b
movq %rbx, %r15
testq %rbx, %rbx
jne 0x404b
jmp 0x40d1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_del
int ht_del(void *ht, const void *key, unsigned int len_key)
{
    int ret = 0;
    ht_lock(ht);
    ret = ht_del_lockless(ht, key, len_key);
    ht_unlock(ht);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
testq %rdi, %rdi
je 0x40fc
leaq 0x8(%rbx), %rdi
callq 0x2510
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x3cc3
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x401a
movl %eax, %ebp
testq %rbx, %rbx
je 0x4129
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x2570
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_iterator_lockless
void *ht_iterator_lockless(void *ht, iter_func func, void *usr)
{
    int i = 0;
    ht_t *pt = ht;
    ht_item_t *item = NULL;

    if (!pt || !func) {
        return NULL;
    }

    for (i = 0; i < pt->cnt; i++) {
        item = pt->item + i;

        while (item) {
            if (!item->key || !item->val) {
                item = item->next;
            } else {
                if(0 == func(item->key, item->val, usr))
                    return item->key;
                else
                    item = item->next;
            }
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x41a9
movq %rdi, %r12
movl (%rdi), %eax
testl %eax, %eax
jle 0x41a9
movq %rdx, %r14
movq %rsi, %r15
xorl %ebx, %ebx
xorl %r13d, %r13d
movq 0x30(%r12), %rbp
testq %rbp, %rbp
je 0x419c
movq %r13, %rax
shlq $0x5, %rax
addq %rax, %rbp
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x418f
movq 0x8(%rbp), %rsi
testq %rsi, %rsi
je 0x418f
movq %r14, %rdx
callq *%r15
testl %eax, %eax
je 0x41ad
movq 0x18(%rbp), %rbp
testq %rbp, %rbp
jne 0x4173
movl (%r12), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x415f
jmp 0x41b1
xorl %ebx, %ebx
jmp 0x41b1
movq (%rbp), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_clear_lockless
int ht_clear_lockless(void *ht)
{
    ht_t *pt = ht;
    int i = 0;
    if (!ht) {
        return -1;
    }

    for (i = 0; i < pt->cnt; i++) {
        _ht_del_node(pt->item + i, NULL, 0);
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4201
movq %rdi, %r14
cmpl $0x0, (%rdi)
jle 0x4208
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x30(%r14), %rdi
addq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x401a
incq %r12
movslq (%r14), %rax
addq $0x20, %r15
cmpq %rax, %r12
jl 0x41e0
jmp 0x420a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x420a
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_clear
int ht_clear(void *ht)
{
    int ret = 0;
    ht_lock(ht);
    ret = ht_clear_lockless(ht);
    ht_unlock(ht);

    return ret;
}

// Assembly:
testq %rdi, %rdi
je 0x424c
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2510
movq %rbx, %rdi
callq 0x41c3
movl %eax, %ebx
movq %r14, %rdi
callq 0x2570
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %edi, %edi
jmp 0x41c3
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/hash_table/hash_table.c
// Function: ht_destroy
int ht_destroy(void *ht)
{
    ht_t *pt = (ht_t *)ht;
    if (!pt) {
        return -1;
    }

    ht_lock(pt);

    ht_clear_lockless(pt);
    free(pt->item);

    ht_unlock(pt);

    pthread_mutex_destroy(&pt->locker);
    free(pt);

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x429e
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2510
movq %rbx, %rdi
callq 0x41c3
movq 0x30(%rbx), %rdi
callq 0x2250
movq %r14, %rdi
callq 0x2570
movq %r14, %rdi
callq 0x2540
movq %rbx, %rdi
callq 0x2250
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/log/simple_log.c
// Function: log_print
void log_print(LOG_LEVEL lvl, cchar *color, cchar *f, 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);

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

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

    //add color support
    if (color) 
        printf("%s", color);
    
    printf(LOG_FMT,get_timestamp(buf_date, 20, cur_time), g_log_desc[lvl], f, l);

    vprintf(fmt, ap);

    if (color) 
        printf("%s\n", COL_DEF);

    va_end(ap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
testb %al, %al
je 0x431a
movaps %xmm0, 0x80(%rsp)
movaps %xmm1, 0x90(%rsp)
movaps %xmm2, 0xa0(%rsp)
movaps %xmm3, 0xb0(%rsp)
movaps %xmm4, 0xc0(%rsp)
movaps %xmm5, 0xd0(%rsp)
movaps %xmm6, 0xe0(%rsp)
movaps %xmm7, 0xf0(%rsp)
movq %r9, 0x78(%rsp)
cmpl %edi, 0x902b(%rip)      # 0xd350
ja 0x444d
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %r14d
movq %r8, 0x8(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x140(%rsp), %rax
movq %rax, 0x18(%rsp)
movabsq $0x3000000028, %rax     # imm = 0x3000000028
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x0, 0x40(%rsp)
xorl %edi, %edi
callq 0x25c0
movq %rax, %r13
testq %r15, %r15
leaq 0x50af(%rip), %rbx      # 0x9434
cmovneq %r15, %rbx
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x22f0
leaq 0x1(%rax), %r15
testq %rax, %rax
cmoveq %rbx, %r15
testq %r12, %r12
je 0x4409
leaq 0x5a72(%rip), %rdi      # 0x9e1f
movq %r12, %rsi
xorl %eax, %eax
callq 0x2080
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x445f
movl %r14d, %eax
leaq 0x89bf(%rip), %rcx      # 0xcd90
movq (%rcx,%rax,8), %rdx
leaq 0x505a(%rip), %rdi      # 0x9436
movq %rbx, %rsi
movq %r15, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2080
leaq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x2360
leaq 0x5044(%rip), %rdi      # 0x9446
callq 0x20d0
jmp 0x444d
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x445f
movl %r14d, %eax
leaq 0x896d(%rip), %rcx      # 0xcd90
movq (%rcx,%rax,8), %rdx
leaq 0x5008(%rip), %rdi      # 0x9436
movq %rbx, %rsi
movq %r15, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2080
leaq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x2360
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/xiaowenhuyuehu[P]remote_access/src/utility/log/simple_log.c
// Function: get_timestamp
static char *get_timestamp(char *buf, int len, time_t cur_time)
{
    struct tm tm_time;

    localtime_r(&cur_time, &tm_time);

    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 %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movq %rsi, (%rdi)
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x24d0
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 0x4fa3(%rip), %rdx      # 0x944b
movl $0x14, %esi
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r14
pushq %r10
callq 0x20b0
addq $0x20, %rsp
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/sha256/sha256.c
// Function: sha256_hash
void
sha256_hash(unsigned char *buf, const unsigned char *data, size_t size)
{
  sha256_t hash;
  sha256_init(&hash);
  sha256_update(&hash, data, size);
  sha256_final(&hash, buf);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movaps 0x4e6d(%rip), %xmm0     # 0x94e0
movq %rsp, %r14
movaps %xmm0, (%r14)
movaps 0x4e6f(%rip), %xmm0     # 0x94f0
movaps %xmm0, 0x10(%r14)
movq $0x0, 0x20(%r14)
movq %r14, %rdi
callq 0x46a9
movq %r14, %rdi
movq %rbx, %rsi
callq 0x46fc
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/sha256/sha256.c
// Function: sha256_update
void
sha256_update(sha256_t *p, const unsigned char *data, size_t size)
{
  uint32_t curBufferPos = (uint32_t)p->count & 0x3F;
  while (size > 0)
  {
    p->buffer[curBufferPos++] = *data++;
    p->count++;
    size--;
    if (curBufferPos == 64)
    {
      curBufferPos = 0;
      sha256_write_byte_block(p);
    }
  }
}

// Assembly:
testq %rdx, %rdx
je 0x46fb
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x20(%rdi), %eax
andl $0x3f, %eax
xorl %r12d, %r12d
movb (%r14,%r12), %cl
movl %eax, %edx
incl %eax
movb %cl, 0x28(%r15,%rdx)
incq 0x20(%r15)
cmpl $0x40, %eax
jne 0x46e8
movq %r15, %rdi
callq 0x47b8
xorl %eax, %eax
incq %r12
cmpq %r12, %rbx
jne 0x46c8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/utility/sha256/sha256.c
// Function: sha256_final
void
sha256_final(sha256_t *p, unsigned char *digest)
{
  uint64_t lenInBits = (p->count << 3);
  uint32_t curBufferPos = (uint32_t)p->count & 0x3F;
  unsigned i;
  p->buffer[curBufferPos++] = 0x80;
  while (curBufferPos != (64 - 8))
  {
    curBufferPos &= 0x3F;
    if (curBufferPos == 0)
      sha256_write_byte_block(p);
    p->buffer[curBufferPos++] = 0;
  }
  for (i = 0; i < 8; i++)
  {
    p->buffer[curBufferPos++] = (unsigned char)(lenInBits >> 56);
    lenInBits <<= 8;
  }
  sha256_write_byte_block(p);

  for (i = 0; i < 8; i++)
  {
    *digest++ = (unsigned char)(p->state[i] >> 24);
    *digest++ = (unsigned char)(p->state[i] >> 16);
    *digest++ = (unsigned char)(p->state[i] >> 8);
    *digest++ = (unsigned char)(p->state[i]);
  }
  sha256_init(p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %r15
movl %r15d, %r12d
andl $0x3f, %r12d
movb $-0x80, 0x28(%rdi,%r12)
incl %r12d
cmpl $0x38, %r12d
je 0x473a
andl $0x3f, %r12d
jne 0x4732
movq %rbx, %rdi
callq 0x47b8
movb $0x0, 0x28(%rbx,%r12)
jmp 0x471b
shlq $0x3, %r15
movl $0x60, %eax
movq %r15, %rcx
shrq $0x38, %rcx
movb %cl, (%rbx,%rax)
shlq $0x8, %r15
incq %rax
cmpq $0x68, %rax
jne 0x4743
movq %rbx, %rdi
callq 0x47b8
xorl %eax, %eax
movb 0x3(%rbx,%rax,4), %cl
movb %cl, (%r14,%rax,4)
movb 0x2(%rbx,%rax,4), %cl
movb %cl, 0x1(%r14,%rax,4)
movb 0x1(%rbx,%rax,4), %cl
movb %cl, 0x2(%r14,%rax,4)
movb (%rbx,%rax,4), %cl
movb %cl, 0x3(%r14,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0x4764
movaps 0x4d4a(%rip), %xmm0     # 0x94e0
movups %xmm0, (%rbx)
movaps 0x4d50(%rip), %xmm0     # 0x94f0
movups %xmm0, 0x10(%rbx)
movq $0x0, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/remote_terminal.c
// Function: timeval_substract
int _timeval_substract (struct timeval * a,
                           struct timeval * b,
                           struct timeval * result)
{
    /* Perform the carry for the later subtraction by updating
     * y. */
    if (a->tv_usec < b->tv_usec) {
        int nsec = (b->tv_usec - a->tv_usec) / 1000000 + 1;
        b->tv_usec -= 1000000 * nsec;
        b->tv_sec += nsec;
    }

    if (a->tv_usec - b->tv_usec > 1000000) {
        int nsec = (a->tv_usec - b->tv_usec) / 1000000;
        b->tv_usec += 1000000 * nsec;
        b->tv_sec -= nsec;
    }

    /* get the result */
    result->tv_sec = a->tv_sec - b->tv_sec;
    result->tv_usec = a->tv_usec - b->tv_usec;

       /* return 1 if result is negative. */
       return a->tv_sec < b->tv_sec;
}

// Assembly:
movq %rdx, %rcx
movq 0x8(%rdi), %rax
movq (%rsi), %r8
movq 0x8(%rsi), %r9
movq %r9, %rdx
movabsq $0x431bde82d7b634db, %r10 # imm = 0x431BDE82D7B634DB
subq %rax, %rdx
jle 0x571d
movq %rdx, %rax
imulq %r10
movq %rdx, %rax
shrq $0x12, %rax
shrq $0x3f, %rdx
addl %edx, %eax
incl %eax
imull $0xf4240, %eax, %edx    # imm = 0xF4240
movslq %edx, %rdx
subq %rdx, %r9
movq %r9, 0x8(%rsi)
cltq
addq %rax, %r8
movq %r8, (%rsi)
movq 0x8(%rdi), %rax
subq %r9, %rax
cmpq $0xf4241, %rax          # imm = 0xF4241
jl 0x5758
mulq %r10
shrq $0x12, %rdx
movabsq $0xf424000000000, %r10  # imm = 0xF424000000000
imulq %rdx, %r10
sarq $0x20, %r10
addq %r9, %r10
movq %r10, 0x8(%rsi)
movslq %edx, %rax
subq %rax, %r8
movq %r8, (%rsi)
movq 0x8(%rdi), %rax
subq %r10, %rax
movq (%rdi), %rdx
subq %r8, %rdx
movq %rdx, (%rcx)
movq %rax, 0x8(%rcx)
movq (%rdi), %rcx
xorl %eax, %eax
cmpq (%rsi), %rcx
setl %al
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/remote_terminal.c
// Function: send_error_resp
static void _send_error_resp(int code, char *msg, char *msg_id, char *session_id, char *send_buf)
{
    char *tmp_buf = NULL;
    char *buf_hdr = NULL;

    tmp_buf  = sda_gen_payload_msg(code, NULL, msg);
    buf_hdr = sda_gen_msg_header(MSG_RESP_OK , strlen(tmp_buf), msg_id, session_id);
    
    memset(send_buf, 0, DEFAULT_MSG_BUFFER_LEN);
    snprintf(send_buf, DEFAULT_MSG_BUFFER_LEN, "%s%s", buf_hdr, tmp_buf); 
    rd_net_write(&g_network, NULL, send_buf, strlen(send_buf), 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rdx
xorl %esi, %esi
callq 0x7104
movq %rax, %r14
movq %rax, %rdi
callq 0x2270
xorl %edi, %edi
movl %eax, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x7058
movq %rax, %r15
movl $0x2000, %edx           # imm = 0x2000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2090
leaq 0x2c3e(%rip), %rdx      # 0x992e
movl $0x2000, %esi           # imm = 0x2000
movq %rbx, %rdi
movq %r15, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x20b0
movq %rbx, %rdi
callq 0x2270
leaq 0x6644(%rip), %rdi      # 0xd358
xorl %esi, %esi
movq %rbx, %rdx
movl %eax, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x285a
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/remote_terminal.c
// Function: sig_int_handler
static void _sig_int_handler(int sig)
{
    if (SIGINT == sig) {
        if(g_is_running == 0){
            log_info("force exit !\r\n");
            exit(0); 
        }
        g_is_running = 0; 
        log_info( "Caught signal: %s, exiting..., %d\r\n", strsignal(sig), sig);
    }
}

// Assembly:
pushq %rax
cmpl $0x2, %edi
jne 0x7026
cmpb $0x1, 0x63b5(%rip)      # 0xd398
je 0x7028
movb $0x1, 0x63ac(%rip)      # 0xd398
movl $0x2, %edi
callq 0x2130
movl $0x2, (%rsp)
leaq 0x2675(%rip), %rsi      # 0x9679
leaq 0x261b(%rip), %rdx      # 0x9626
leaq 0x2ce3(%rip), %r8       # 0x9cf5
movl $0x1, %edi
movl $0x21, %ecx
movq %rax, %r9
xorl %eax, %eax
callq 0x42c5
popq %rax
retq
leaq 0x264a(%rip), %rsi      # 0x9679
leaq 0x25f0(%rip), %rdx      # 0x9626
leaq 0x2ca9(%rip), %r8       # 0x9ce6
movl $0x1, %edi
movl $0x1d, %ecx
xorl %eax, %eax
callq 0x42c5
xorl %edi, %edi
callq 0x2100
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/net_protocol.c
// Function: sda_gen_msg_header
char *sda_gen_msg_header(int msg_type, int payload_len, char *msg_id, char *token)
{
    static char msg[DEFAULT_MSG_HDR_LEN] = {0};

    memset(msg, 0, sizeof(msg));
    snprintf(msg, sizeof(msg) - 1, MSG_HEAD_FMT,
                    msg_type, payload_len, msg_id == NULL ? rand_string_static() : msg_id,
                    time(NULL), token == NULL ? "" : token);

    log_debug("send msg : %s\n", msg);
    return msg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebx
movl %edi, %ebp
leaq 0x6340(%rip), %rdi      # 0xd3b0
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2090
testq %r14, %r14
jne 0x708b
xorl %eax, %eax
callq 0x3b35
movq %rax, %r14
xorl %edi, %edi
callq 0x25c0
movq %rax, %r10
testq %r15, %r15
leaq 0x2396(%rip), %r11      # 0x9435
cmovneq %r15, %r11
leaq 0x6306(%rip), %r15      # 0xd3b0
leaq 0x2cd3(%rip), %rdx      # 0x9d84
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdi
movl %ebp, %ecx
movl %ebx, %r8d
movq %r14, %r9
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x20b0
addq $0x10, %rsp
leaq 0x1f2d(%rip), %rsi      # 0x9004
leaq 0x2cf9(%rip), %rdx      # 0x9dd7
leaq 0x2d0a(%rip), %r8       # 0x9def
xorl %edi, %edi
movl $0x11, %ecx
movq %r15, %r9
xorl %eax, %eax
callq 0x42c5
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/net_protocol.c
// Function: sda_gen_handshake_msg
char *sda_gen_handshake_msg(char *pk, char *dn, char *ds)
{
    static char msg[DEFAULT_MSG_HDR_LEN] = {0};
    char ipaddr[256] = {0};

    //FIXME
    //get_dev_ip(ipaddr, sizeof(ipaddr));

    memset(msg,0,sizeof(msg));
    snprintf(msg, sizeof(msg), MSG_HDSK_FMT, 
                    g_uuid, pk, dn, "v2.0", 
                    ipaddr, "", "", calc_sign(g_uuid, dn, pk, ds));

    return msg; 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x2090
leaq 0x6a14(%rip), %rdi      # 0xdbb0
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2090
leaq 0x6e01(%rip), %rbp      # 0xdfb0
movl $0x400, %edx            # imm = 0x400
movq %rbp, %rdi
xorl %esi, %esi
callq 0x2090
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rbx
movaps %xmm0, (%rbx)
movaps %xmm0, 0x10(%rbx)
leaq 0x71dc(%rip), %r12      # 0xe3b0
movl $0x400, %edx            # imm = 0x400
movq %r12, %rdi
xorl %esi, %esi
callq 0x2090
xorl %edi, %edi
callq 0x25c0
movq %rax, %r10
subq $0x8, %rsp
leaq 0x2ce8(%rip), %rdx      # 0x9ee0
leaq 0x2cd5(%rip), %rcx      # 0x9ed4
movl $0x400, %esi            # imm = 0x400
movq %rbp, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %r8
movq %r15, 0x8(%rsp)
movq %r15, %r9
xorl %eax, %eax
pushq %r10
callq 0x20b0
addq $0x10, %rsp
leaq 0x1dd9(%rip), %rsi      # 0x9004
leaq 0x2ba5(%rip), %rdx      # 0x9dd7
leaq 0x2cd6(%rip), %r8       # 0x9f0f
xorl %edi, %edi
movl $0x2c, %ecx
movq %rbp, %r9
xorl %eax, %eax
callq 0x42c5
movq %rbp, %rdi
callq 0x2270
movq %rax, %r14
movq %r13, %rdi
callq 0x2270
leaq 0x1(%rax), %r8
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r13, %rcx
callq 0x44cc
leaq 0x2cab(%rip), %rbx      # 0x9f24
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2270
leaq (%rax,%r12), %rdi
movzbl 0x10(%rsp,%r14), %edx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22d0
incq %r14
cmpq $0x20, %r14
jne 0x727c
subq $0x8, %rsp
leaq 0x2189(%rip), %r10      # 0x9435
leaq 0x2c1c(%rip), %r11      # 0x9ecf
leaq 0x68f6(%rip), %rbx      # 0xdbb0
leaq 0x2b61(%rip), %rdx      # 0x9e22
leaq 0x2c0c(%rip), %rcx      # 0x9ed4
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq 0x8(%rsp), %r8
movq 0x10(%rsp), %r9
xorl %eax, %eax
pushq %r12
pushq %r10
pushq %r10
leaq 0x50(%rsp), %r10
pushq %r10
pushq %r11
callq 0x20b0
addq $0x30, %rsp
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/config_manager.c
// Function: deinit_cfg
void deinit_cfg()
{
	if(g_cfg == NULL)
		return;

	free(g_cfg->cloud_ip);
	free(g_cfg->cloud_port);
	free(g_cfg->cert_path);
	if(g_cfg->pk)
		free(g_cfg->pk);
	if(g_cfg->dn)
		free(g_cfg->dn);
	if(g_cfg->ds)
		free(g_cfg->ds);

    free(g_cfg);
    g_cfg = NULL;
	log_info("deinit cfg ok.");
}

// Assembly:
pushq %rbx
movq 0x6a9a(%rip), %rbx      # 0xe7b0
testq %rbx, %rbx
je 0x7d99
movq (%rbx), %rdi
callq 0x2250
movq 0x8(%rbx), %rdi
callq 0x2250
movq 0x10(%rbx), %rdi
callq 0x2250
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x7d43
callq 0x2250
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x7d51
callq 0x2250
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x7d5f
callq 0x2250
movq %rbx, %rdi
callq 0x2250
movq $0x0, 0x6a3e(%rip) # 0xe7b0
leaq 0x1900(%rip), %rsi      # 0x9679
leaq 0x21af(%rip), %rdx      # 0x9f2f
leaq 0x22b7(%rip), %r8       # 0xa03e
movl $0x1, %edi
movl $0xdd, %ecx
xorl %eax, %eax
popq %rbx
jmp 0x42c5
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: init_session_system
int init_session_system()
{
    if(g_ht != NULL)
        return 0;

    g_ht = ht_init(DEFAULT_SESSION_COUNT * 3);
    if(g_ht == NULL){
        log_error("failed to init session system: %s", strerror(errno)); 
        return -1;
    }
    g_session_count = 0;
    return 0;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
cmpq $0x0, 0x6a11(%rip)      # 0xe7b8
jne 0x7e05
movl $0x60, %edi
callq 0x3bac
movq %rax, 0x69fe(%rip)      # 0xe7b8
testq %rax, %rax
je 0x7dcb
movl $0x0, 0x69f7(%rip)      # 0xe7c0
jmp 0x7e05
callq 0x2400
movl (%rax), %edi
callq 0x2330
leaq 0x1842(%rip), %rsi      # 0x9620
leaq 0x23f8(%rip), %rdx      # 0xa1dd
leaq 0x2408(%rip), %r8       # 0xa1f4
movl $0x3, %edi
movl $0x1b, %ecx
movq %rax, %r9
xorl %eax, %eax
callq 0x42c5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: deinit_session_system
void deinit_session_system()
{
    if(g_ht == NULL)
        return;
    ht_destroy(g_ht);
    g_session_count = 0;
    g_ht = NULL;
}

// Assembly:
movq 0x69a8(%rip), %rdi      # 0xe7b8
testq %rdi, %rdi
je 0x7e34
pushq %rax
callq 0x4253
movl $0x0, 0x699b(%rip)      # 0xe7c0
movq $0x0, 0x6988(%rip) # 0xe7b8
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: is_session_avalibe
int is_session_avalibe()
{
    if(g_session_count >=  DEFAULT_SESSION_COUNT){
        //clear timeout session 
        return clear_timeout_session();
    }    

    return 1;
}

// Assembly:
movl $0x1, %eax
cmpl $0x20, 0x697f(%rip)     # 0xe7c0
jl 0x7ea4
pushq %rbx
subq $0x10, %rsp
movl $0x0, 0xc(%rsp)
movq 0x6961(%rip), %rdi      # 0xe7b8
testq %rdi, %rdi
jne 0x7e89
leaq 0x17bd(%rip), %rsi      # 0x9620
leaq 0x2373(%rip), %rdx      # 0xa1dd
leaq 0x23b6(%rip), %r8       # 0xa227
movl $0x3, %edi
movl $0x3e, %ecx
xorl %eax, %eax
callq 0x42c5
movq 0x692f(%rip), %rdi      # 0xe7b8
leaq 0x45b(%rip), %rsi       # 0x82eb
leaq 0xc(%rsp), %rbx
movq %rbx, %rdx
callq 0x4130
movl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: get_timestamp_by_session_id
int _get_timestamp_by_session_id(char *session_id)
{
    SESSION_ITEM  *item = NULL; 
    
    if(g_ht == NULL || session_id == NULL){
        log_error("session system is not ready, please retry ");
        return -1;
    }

    item = ht_find(g_ht, session_id, DEFAULT_SESSION_LEN, NULL, NULL);
    if(item == NULL){
        log_error("could not find socketfd for session: %s ", session_id);
        return -1;
    }
    
    return item->last_modify_time;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x6767(%rip), %rdi      # 0xe7b8
testq %rdi, %rdi
setne %al
testq %rbx, %rbx
setne %cl
testb %al, %cl
jne 0x8089
leaq 0x15b8(%rip), %rsi      # 0x9620
leaq 0x216e(%rip), %rdx      # 0xa1dd
leaq 0x21b1(%rip), %r8       # 0xa227
movl $0x3, %edi
movl $0x81, %ecx
xorl %eax, %eax
callq 0x42c5
jmp 0x80ce
movq %rbx, %rsi
movl $0x40, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3d25
testq %rax, %rax
je 0x80a5
movl 0x8(%rax), %eax
jmp 0x80d3
leaq 0x1574(%rip), %rsi      # 0x9620
leaq 0x212a(%rip), %rdx      # 0xa1dd
leaq 0x223c(%rip), %r8       # 0xa2f6
movl $0x3, %edi
movl $0x87, %ecx
movq %rbx, %r9
xorl %eax, %eax
callq 0x42c5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq