LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/sa.c
// Function: sa_toip
void sa_toip(union sockaddr_all *u, char *buf, int size)
{
    // 使用 static变量做成不需要buf与size参数的函数?
    // static __thread char buf[INET6_ADDRSTRLEN];
    assert(size >= INET6_ADDRSTRLEN);
    if (u->s.sa_family == AF_INET)
    {
        inet_ntop(AF_INET, &(u->v4.sin_addr), buf, INET_ADDRSTRLEN);
    }
    else if (u->s.sa_family == AF_INET6)
    {
        inet_ntop(AF_INET6, &(u->v6.sin6_addr), buf, INET6_ADDRSTRLEN);
    }
}

// Assembly:
cmpl $0x2d, %edx
jle 0x67dc
movq %rsi, %rax
movq %rdi, %rsi
movzwl (%rdi), %ecx
cmpl $0xa, %ecx
je 0x67c9
cmpl $0x2, %ecx
jne 0x67db
addq $0x4, %rsi
pushq $0x2
popq %rdi
pushq $0x10
jmp 0x67d2
addq $0x8, %rsi
pushq $0xa
popq %rdi
pushq $0x2e
popq %rcx
movq %rax, %rdx
jmp 0x2030
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x3087(%rip), %rdi      # 0x986e
leaq 0x3099(%rip), %rsi      # 0x9887
leaq 0x3097(%rip), %rcx      # 0x988c
pushq $0x43
popq %rdx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/sa.c
// Function: sa_toipport
void sa_toipport(union sockaddr_all *u, char *buf, int size)
{
    assert(size >= INET6_ADDRSTRLEN);
    sa_toip(u, buf, size);
    size_t end = strlen(buf);
    uint16_t port = ntohs(u->v4.sin_port);
    assert(size > end);
    snprintf(buf + end, size - end, ":%u", port);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2d, %edx
jle 0x6854
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
callq 0x67a6
movq %rbx, %rdi
callq 0x20d0
movl %r15d, %esi
subq %rax, %rsi
jbe 0x686d
movzwl 0x2(%r14), %ecx
rolw $0x8, %cx
addq %rax, %rbx
movzwl %cx, %ecx
leaq 0x30bb(%rip), %rdx      # 0x98fb
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2110
leaq 0x3013(%rip), %rdi      # 0x986e
leaq 0x3025(%rip), %rsi      # 0x9887
leaq 0x3053(%rip), %rcx      # 0x98bc
pushq $0x50
jmp 0x6884
leaq 0x307c(%rip), %rdi      # 0x98f0
leaq 0x300c(%rip), %rsi      # 0x9887
leaq 0x303a(%rip), %rcx      # 0x98bc
pushq $0x54
popq %rdx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/sa.c
// Function: sa_resolve
bool sa_resolve(char *hostname, union sockaddr_all *u)
{
    assert(u);
    struct addrinfo hints;
    struct addrinfo *res;
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = PF_INET;
    hints.ai_socktype = SOCK_STREAM;

    int status = getaddrinfo(hostname, NULL, &hints, &res);
    if (status != 0)
    {
        fprintf(stderr, "ERROR getaddrinfo: %s\n", gai_strerror(status));
        return false;
    }

    // FIXME 遍历检测可用??
    // 只获取链表第一个元素 struct addrinfo *p; for(p = res; p != NULL; p = p->ai_next) { }
    if (res == NULL)
    {
        freeaddrinfo(res);
        false;
    }

    u->v4.sin_family = res->ai_family;
    u->v4.sin_addr = ((struct sockaddr_in *)res->ai_addr)->sin_addr;
    #ifdef __APPLE__ 
    u->v4.sin_len = res->ai_addrlen;
    #endif
    freeaddrinfo(res);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
testq %rsi, %rsi
je 0x6977
movq %rsi, %r14
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x4(%rdx)
leaq -0x18(%rbp), %rcx
xorl %esi, %esi
callq 0x2330
movl %eax, %ebx
testl %eax, %eax
jne 0x6950
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
jne 0x692a
xorl %edi, %edi
callq 0x2380
movq -0x18(%rbp), %rdi
movzwl 0x4(%rdi), %eax
movw %ax, (%r14)
movq 0x18(%rdi), %rax
movl 0x4(%rax), %eax
movl %eax, 0x4(%r14)
callq 0x2380
testl %ebx, %ebx
sete %al
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x86a1(%rip), %rax      # 0xeff8
movq (%rax), %r14
movl %ebx, %edi
callq 0x2120
leaq 0x2e36(%rip), %rsi      # 0x979e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21e0
jmp 0x6942
leaq 0x2f7f(%rip), %rdi      # 0x98fd
leaq 0x2f02(%rip), %rsi      # 0x9887
leaq 0x2fb6(%rip), %rcx      # 0x9942
pushq $0x6a
popq %rdx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: utf8len
size_t utf8len(const char *s, size_t sz)
{
    size_t len = 0;
    size_t i = 0;
    for (; i < sz; i++)
    {
        if ((*s & 0xC0) != 0x80)
        {
            ++len;
        }
    }
    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
subq $0x1, %rsi
jb 0x6ba9
movb (%rdi), %cl
andb $-0x40, %cl
xorl %edx, %edx
negb %cl
setno %dl
addq %rdx, %rax
jmp 0x6b92
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: utf8cpy
int utf8cpy(uint8_t *dst, const uint8_t *src, size_t sz)
{
    int i = 0;
    uint8_t c;

    while (sz--)
    {
        c = src[i];
        if (c <= 0x80)
        {
            i += 1;
        }
        else if ((c & 0xE0) == 0xC0)
        {
            i += 2;
        }
        else if ((c & 0xF0) == 0xE0)
        {
            i += 3;
        }
        else if ((c & 0xF8) == 0xF0)
        {
            i += 4;
        }
        else
        {
            // invalid utf8
            return -1;
        }
    }

    if (i)
    {
        memcpy(dst, src, i);
    }

    return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
pushq $0x1
popq %rcx
pushq $0x2
popq %r8
pushq $0x3
popq %r10
pushq $-0x1
popq %r9
pushq $0x4
popq %r11
movl %ebx, %eax
subq $0x1, %rdx
jb 0x6c18
movzbl (%rsi,%rax), %eax
movl %ecx, %r14d
cmpl $0x81, %eax
jb 0x6c13
movl %eax, %r15d
andl $-0x20, %r15d
movl %r8d, %r14d
cmpl $0xc0, %r15d
je 0x6c13
movl %eax, %r15d
andl $-0x10, %r15d
movl %r10d, %r14d
cmpl $0xe0, %r15d
je 0x6c13
andl $-0x8, %eax
movl %r11d, %r14d
cmpl $0xf0, %eax
jne 0x6c2a
addl %r14d, %ebx
jmp 0x6bca
testl %ebx, %ebx
je 0x6c26
movq %rax, %rdx
callq 0x2200
jmp 0x6c2d
xorl %ebx, %ebx
jmp 0x6c2d
movl %r9d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_encode_int
int hs_encode_int(int32_t val, uint8_t *out)
{
    if (-0x10 <= val && val <= 0x2f)
    {
        out[0] = val + 0x90;
        return 1;
    }
    else if (-0x800 <= val + 0xc8 && val <= 0x7ff)
    {
        out[1] = val & 0xff;
        out[0] = (val >> 8) + 0xc8;
        return 2;
    }
    else if (-0x40000 <= val && val <= 0x3ffff)
    {
        out[0] = (val >> 16) + 0xd4;
        *(uint16_t *)(out + 1) = htobe16(val & 0xffff);
        return 3;
    }
    else
    {
        out[0] = 'I';
        *(int32_t *)(out + 1) = htobe32(val);
        return 5;
    }
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal 0x10(%rdi), %eax
cmpl $0x3f, %eax
ja 0x6c78
addb $-0x70, %dil
movb %dil, (%rsi)
movl $0x1, %eax
jmp 0x6ccc
leal 0x8c8(%rdi), %eax
cmpl $0x10c7, %eax           # imm = 0x10C7
ja 0x6c9a
movb %dil, 0x1(%rsi)
shrl $0x8, %edi
addb $-0x38, %dil
movb %dil, (%rsi)
movl $0x2, %eax
jmp 0x6ccc
leal 0x40000(%rdi), %eax
cmpl $0x7ffff, %eax          # imm = 0x7FFFF
ja 0x6cbf
movl %edi, %eax
shrl $0x10, %eax
addb $-0x2c, %al
movb %al, (%rsi)
rolw $0x8, %di
movw %di, 0x1(%rsi)
movl $0x3, %eax
jmp 0x6ccc
movb $0x49, (%rsi)
bswapl %edi
movl %edi, 0x1(%rsi)
movl $0x5, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_decode_int
bool hs_decode_int(const uint8_t *buf, size_t sz, int32_t *out)
{
    bool r = true;
    uint8_t code = buf[0];
    if (sz >= 1 && code >= 0x80 && code <= 0xbf)
    {
        *out = code - 0x90;
    }
    else if (sz >= 2 && code >= 0xc0 && code <= 0xcf)
    {
        *out = ((code - 0xc8) << 8) + buf[1];
    }
    else if (sz >= 3 && code >= 0xd0 && code <= 0xd7)
    {
        *out = ((code - 0xd4) << 16) + (buf[1] << 8) + buf[2];
    }
    else if (sz >= 5 && code == 'I')
    {
        *out = be32toh(*(uint32_t *)&buf[1]);
    }
    else
    {
        r = false;
    }
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb (%rdi), %al
testq %rsi, %rsi
setne %cl
movzbl %al, %eax
cmpb $-0x40, %al
setl %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x6cf3
addl $0xffffff70, %eax       # imm = 0xFFFFFF70
jmp 0x6d71
cmpq $0x2, %rsi
setae %cl
movl %eax, %r8d
andb $-0x10, %r8b
cmpb $-0x40, %r8b
sete %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x6d22
shll $0x8, %eax
movzbl 0x1(%rdi), %ecx
addl %ecx, %eax
addl $0xffff3800, %eax       # imm = 0xFFFF3800
jmp 0x6d71
cmpq $0x3, %rsi
setae %cl
movl %eax, %r8d
andb $-0x8, %r8b
cmpb $-0x30, %r8b
sete %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x6d5a
shll $0x10, %eax
movzbl 0x1(%rdi), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0x2(%rdi), %eax
addl %ecx, %eax
addl $0xff2c0000, %eax       # imm = 0xFF2C0000
jmp 0x6d71
cmpq $0x5, %rsi
setae %cl
cmpb $0x49, %al
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x6d77
movl 0x1(%rdi), %eax
bswapl %eax
movl %eax, (%rdx)
movb $0x1, %al
popq %rbp
retq
xorl %eax, %eax
jmp 0x6d75
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_encode_string
int hs_encode_string(const char *str, uint8_t *out)
{
    size_t index = 0;
    int length = strlen(str);

    // TODO
    if (length > 0x8000)
    {
        return -1;
    }

    if (length <= 31)
    {
        out[index++] = (uint8_t)(length);
    }
    else if (length <= 1023)
    {
        out[index++] = (uint8_t)(48 + (length >> 8));
        // Integer overflow and wrapping assumed
        out[index++] = (uint8_t)(length);
    }
    else
    {
        out[index++] = 'S';
        out[index++] = (uint8_t)((length >> 8));
        // Integer overflow and wrapping assumed
        out[index++] = (uint8_t)(length);
    }

    memcpy(out + index, str, length);
    return index + length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x20d0
cmpl $0x8000, %eax           # imm = 0x8000
jle 0x6d9e
pushq $-0x1
popq %r15
jmp 0x6de5
cmpl $0x1f, %eax
jg 0x6da9
movb %al, (%rbx)
pushq $0x1
jmp 0x6dcc
cmpl $0x3ff, %eax            # imm = 0x3FF
ja 0x6dc1
movl %eax, %ecx
shrl $0x8, %ecx
orb $0x30, %cl
movb %cl, (%rbx)
movb %al, 0x1(%rbx)
pushq $0x2
jmp 0x6dcc
movb $0x53, (%rbx)
movb %ah, 0x1(%rbx)
movb %al, 0x2(%rbx)
pushq $0x3
popq %r12
addq %r12, %rbx
movslq %eax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2200
addl %r12d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_decode_string
bool hs_decode_string(const uint8_t *buf, size_t sz, char **out, size_t *out_sz)
{
    short is_last_chunk = 0;
    size_t out_length = 0;
    uint8_t *out_str = (uint8_t *)malloc(sz);
    if (NULL == out_str)
    {
        return false;
    }

    if (internal_decode_string(buf, sz, out_str, &out_length, &is_last_chunk))
    {
        uint8_t *new_out = (uint8_t *)realloc(out_str, out_length);
        if (NULL != new_out)
        {
            out_str = new_out;
        }
        *out = (char *)out_str;
        *out_sz = out_length;
        return true;
    }
    else
    {
        free(out_str);
        return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r12
andw $0x0, -0x2a(%rbp)
movq %rdi, %r13
andq $0x0, -0x38(%rbp)
movq %rsi, %rdi
callq 0x23a8
testq %rax, %rax
je 0x6e6a
movq %rax, %r15
leaq -0x38(%rbp), %rcx
leaq -0x2a(%rbp), %r8
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x6e7b
testb %al, %al
je 0x6e62
movq -0x38(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x23b0
testq %rax, %rax
cmovneq %rax, %r15
movq %r15, (%r14)
movq %r12, (%rbx)
movb $0x1, %al
jmp 0x6e6c
movq %r15, %rdi
callq 0x23a0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_encode_binary
void hs_encode_binary(const char *bin, size_t sz, struct buffer *out_buf)
{
    // 不做判断, 最后一块体积填0 ?!
    // int just_right = sz % chunk_max == 0;
    while (sz > BIN_CHUNK_MAX)
    {
        buf_appendInt8(out_buf, 'b');
        buf_appendInt16(out_buf, (uint16_t)BIN_CHUNK_MAX);
        buf_append(out_buf, bin, BIN_CHUNK_MAX);
        bin += BIN_CHUNK_MAX;
        sz -= BIN_CHUNK_MAX;
    }
    buf_appendInt8(out_buf, 'B');
    buf_appendInt16(out_buf, sz);
    if (sz)
    {
        buf_append(out_buf, bin, sz);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
pushq $0x62
popq %r12
cmpq $0x10001, %rbx          # imm = 0x10001
jb 0x701e
movq %r14, %rdi
movl %r12d, %esi
callq 0x585c
movq %r14, %rdi
xorl %esi, %esi
callq 0x5838
movl $0x10000, %edx          # imm = 0x10000
movq %r14, %rdi
movq %r15, %rsi
callq 0x565b
addq $0x10000, %r15          # imm = 0x10000
addq $-0x10000, %rbx         # imm = 0xFFFF0000
jmp 0x6fe0
pushq $0x42
popq %rsi
movq %r14, %rdi
callq 0x585c
movswl %bx, %esi
movq %r14, %rdi
callq 0x5838
testq %rbx, %rbx
je 0x704f
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x565b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_decode_binary
bool hs_decode_binary(struct buffer *buf, char **out, size_t *out_sz)
{
    uint16_t tag = buf_peekInt8(buf);
    uint16_t sz = 0;
    if (tag >= 0x20 && tag <= 0x2f)
    {
        sz = tag - 0x20;
        buf_retrieveInt8(buf);
        
        small:
        *out_sz = sz;
        *out = malloc(sz + 1);
        if (*out == NULL)
        {
            return false;
        }
        memcpy(*out, buf_peek(buf), sz);
        buf_retrieve(buf, sz);
        return true;
    }
    else if (tag >= 0x34 && tag <= 0x37)
    {
        sz = buf_readInt16(buf);
        sz = sz & 1023; // 10 bit number !!!
        goto small;
    }
    else
    {
        buf_retrieveInt8(buf);

        size_t left = BIN_CHUNK_MAX;
        *out_sz = 0;
        *out = malloc(BIN_CHUNK_MAX + 1);
        if (*out == NULL)
        {
            return false;
        }

        while (tag == 0x41)
        {
            if (!hs_decode_binary_chunk(buf, out, out_sz, &left))
            {
                free(*out);
                *out = NULL;
                return false;
            }
            tag = buf_readInt8(buf);
        }

        assert(tag == 'B');
        if (!hs_decode_binary_chunk(buf, out, out_sz, &left))
        {
            free(*out);
            *out = NULL;
            return false;
        }
    }
    (*out)[*out_sz] = '\0';
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
callq 0x5a7e
movsbl %al, %r13d
movl %r13d, %eax
andb $-0x10, %al
cmpb $0x20, %al
jne 0x7093
movswl %r13w, %r12d
addl $-0x20, %r12d
movq %r14, %rdi
callq 0x554e
jmp 0x70ae
movl %r13d, %eax
andb $-0x4, %al
movq %r14, %rdi
cmpb $0x34, %al
jne 0x70f6
callq 0x5bef
movl %eax, %r12d
andl $0x3ff, %r12d           # imm = 0x3FF
movzwl %r12w, %r12d
movq %r12, (%r15)
leaq 0x1(%r12), %rdi
callq 0x23a8
movq %rax, (%rbx)
testq %rax, %rax
je 0x7181
movq %rax, %r15
movq %r14, %rdi
callq 0x5283
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x2200
movq %r14, %rdi
movq %r12, %rsi
callq 0x5459
movb $0x1, %al
jmp 0x7183
callq 0x554e
movq $0x10000, -0x30(%rbp)   # imm = 0x10000
andq $0x0, (%r15)
movl $0x10001, %edi          # imm = 0x10001
callq 0x23a8
movq %rax, (%rbx)
testq %rax, %rax
je 0x7181
leaq -0x30(%rbp), %r12
cmpw $0x41, %r13w
jne 0x7147
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x71b1
testb %al, %al
je 0x7175
movq %r14, %rdi
callq 0x5c11
movsbl %al, %r13d
jmp 0x711d
movzwl %r13w, %eax
cmpl $0x42, %eax
jne 0x7192
leaq -0x30(%rbp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x71b1
testb %al, %al
je 0x7175
movq (%rbx), %rax
movq (%r15), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x70ef
movq (%rbx), %rdi
callq 0x23a0
andq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x295b(%rip), %rdi      # 0x9af4
leaq 0x292b(%rip), %rsi      # 0x9acb
leaq 0x2958(%rip), %rcx      # 0x9aff
movl $0x245, %edx            # imm = 0x245
callq 0x2150
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: hs_decode_binary_chunk
static bool hs_decode_binary_chunk(struct buffer *buf, char **out, size_t *out_sz, size_t *left)
{
    int sz = buf_readInt16(buf);
    if (*left < sz)
    {
        char *new_out = realloc(*out, *out_sz + BIN_CHUNK_MAX + 1);
        if (new_out == NULL)
        {
            return false;
        }
        *out = new_out;
        *left = BIN_CHUNK_MAX;
    }

    memcpy(*out + *out_sz, buf_peek(buf), sz);
    *out_sz += sz;
    *left -= sz;
    buf_retrieve(buf, sz);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
callq 0x5bef
movswq %ax, %r12
movq %r13, -0x38(%rbp)
movq (%r13), %r13
movq %r15, -0x30(%rbp)
cmpq %r12, (%r15)
jae 0x7214
movl $0x10001, %esi          # imm = 0x10001
addq (%rbx), %rsi
movq %r13, %rdi
callq 0x23b0
testq %rax, %rax
je 0x7253
movq %rax, %r13
movq -0x38(%rbp), %rax
movq %r13, (%rax)
movq -0x30(%rbp), %r15
movq $0x10000, (%r15)        # imm = 0x10000
jmp 0x7218
movq -0x30(%rbp), %r15
addq (%rbx), %r13
movq %r14, %rdi
callq 0x5283
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x2200
addq %r12, (%rbx)
subq %r12, (%r15)
movq %r14, %rdi
movq %r12, %rsi
callq 0x5459
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x7244
nop
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_codec.c
// Function: dubbo_res_release
void dubbo_res_release(struct dubbo_res *res)
{
    if (res->desc)
    {
        free(res->desc);
    }
    if (res->data)
    {
        free(res->data);
    }
    if (res->attach)
    {
        free(res->attach);
    }
    free(res);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x23a0
movq 0x18(%rbx), %rdi
callq 0x23a0
movq 0x28(%rbx), %rdi
callq 0x23a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_codec.c
// Function: dubbo_req_release
void dubbo_req_release(struct dubbo_req *req)
{
    free(req->argv[DUBBO_GENERIC_METHOD_ARGV_METHOD_IDX]);
    // free(req->argv[DUBBO_GENERIC_METHOD_ARGV_TYPES_IDX]);
    free(req->argv[DUBBO_GENERIC_METHOD_ARGV_ARGS_IDX]);
    free(req->argv);
    if (req->attach)
    {
        free(req->attach);
    }
    free(req);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movq (%rax), %rdi
callq 0x23a0
movq 0x20(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x23a0
movq 0x20(%rbx), %rdi
callq 0x23a0
movq 0x30(%rbx), %rdi
callq 0x23a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_codec.c
// Function: dubbo_encode
struct buffer *dubbo_encode(const struct dubbo_req *req)
{
    struct buffer *buf = buf_create_ex(DUBBO_BUF_LEN, DUBBO_HDR_LEN);
    if (encode_req(buf, req))
    {
        return buf;
    }
    else
    {
        buf_release(buf);
        return NULL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
pushq $0x10
popq %rsi
movl $0x2000, %edi           # imm = 0x2000
callq 0x5164
movq %rax, %rbx
movq (%r15), %r14
movb 0x8(%r15), %r13b
shlb $0x6, %r13b
orb $-0x7e, %r13b
cmpb $0x1, 0x9(%r15)
jne 0x750c
orb $0x20, %r13b
movq 0x38(%r15), %rsi
movq 0x40(%r15), %rdx
movq %rbx, %rdi
callq 0x565b
jmp 0x7665
movq %rbx, %rdi
callq 0x5290
leaq 0x286d(%rip), %rdi      # 0x9d88
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq 0x10(%r15), %r12
movq %rbx, %rdi
callq 0x5290
movq %r12, %rdi
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq %rbx, %rdi
callq 0x5290
leaq 0x2825(%rip), %rdi      # 0x9d96
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq %rbx, %rdi
callq 0x5290
leaq 0x2800(%rip), %rdi      # 0x9d9c
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq %rbx, %rdi
callq 0x5290
leaq 0x27e9(%rip), %rdi      # 0x9db0
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq 0x20(%r15), %rax
movq (%rax), %r12
movq %rbx, %rdi
callq 0x5290
movq %r12, %rdi
movq %rax, %rsi
callq 0x6d7b
cmpl $-0x1, %eax
je 0x76b9
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq %rbx, %rdi
callq 0x5290
movq %rax, %rdi
callq 0x6c3a
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq 0x20(%r15), %rax
movq 0x10(%rax), %r15
movq %r15, %rdi
callq 0x20d0
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x6fc8
movq %rbx, %rdi
callq 0x5290
movq %rax, %rdi
callq 0x6c3a
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x529e
movq %rbx, %rdi
callq 0x5255
movq %rax, %r15
movq %rbx, %rdi
callq 0x527a
cmpq $0xf, %rax
jbe 0x76e0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x58fe
movq %rbx, %rdi
movq %r14, %rsi
callq 0x58db
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5943
movsbl %r13b, %esi
movq %rbx, %rdi
callq 0x5943
movq %rbx, %rdi
movl $0xffffdabb, %esi       # imm = 0xFFFFDABB
callq 0x591f
jmp 0x7716
movq 0x7938(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x262e(%rip), %rsi      # 0x9cf8
leaq 0x266a(%rip), %rdx      # 0x9d3b
leaq 0x2479(%rip), %rcx      # 0x9b51
movl $0x14d, %r8d            # imm = 0x14D
jmp 0x7705
movq 0x7911(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2655(%rip), %rsi      # 0x9d46
leaq 0x2643(%rip), %rdx      # 0x9d3b
leaq 0x2452(%rip), %rcx      # 0x9b51
movl $0x155, %r8d            # imm = 0x155
xorl %eax, %eax
callq 0x21e0
movq %rbx, %rdi
callq 0x51e9
xorl %ebx, %ebx
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_O2/goghcrow[P]dubbo_ab/dubbo_codec.c
// Function: is_completed_dubbo_pkt
bool is_completed_dubbo_pkt(const struct buffer *buf, int *remaining)
{
    if (!is_dubbo_pkt(buf))
    {
        return false;
    }

    int32_t body_sz = 0;
    memcpy(&body_sz, buf_peek(buf) + DUBBO_HDR_LEN - sizeof(int32_t), sizeof(int32_t));
    body_sz = be32toh(body_sz);
    if (body_sz <= 0 || body_sz > DUBBO_MAX_PKT_SZ)
    {
        LOG_ERROR("invalid dubbo pkt body size %d", body_sz);
        return false;
    }

    if (remaining)
    {
        *remaining = body_sz + DUBBO_HDR_LEN - buf_readable(buf);
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r12
callq 0x7b49
testb %al, %al
je 0x7bc7
movq %r12, %rdi
callq 0x5283
movl 0xc(%rax), %r15d
bswapl %r15d
leal -0x1(%r15), %eax
cmpl $0x400000, %eax         # imm = 0x400000
jae 0x7bd6
movb $0x1, %r14b
testq %rbx, %rbx
je 0x7bca
movq %r12, %rdi
callq 0x5255
subl %eax, %r15d
addl $0x10, %r15d
movl %r15d, (%rbx)
jmp 0x7bca
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x741b(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x20b2(%rip), %rsi      # 0x9c99
leaq 0x20f3(%rip), %rcx      # 0x9ce1
leaq 0x1f5c(%rip), %r8       # 0x9b51
xorl %r14d, %r14d
movl %r15d, %edx
movl $0x1f4, %r9d            # imm = 0x1F4
xorl %eax, %eax
callq 0x21e0
jmp 0x7bca
nop
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_reconnect
static void cli_reconnect(struct dubbo_client *cli)
{
    LOG_INFO("重新连接...");
    cli_close(cli);
    if (!cli_connect(cli))
    {
        LOG_ERROR("重连失败");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x7394(%rip), %r14      # 0xeff8
movq (%r14), %rdi
leaq 0x294a(%rip), %rsi      # 0xa5b8
leaq 0x297b(%rip), %rdx      # 0xa5f0
leaq 0x2476(%rip), %rcx      # 0xa0f2
movl $0x113, %r8d            # imm = 0x113
xorl %eax, %eax
callq 0x21e0
movq %rbx, %rdi
callq 0x89f8
movq %rbx, %rdi
callq 0x7ccb
testb %al, %al
je 0x7ca2
popq %rbx
popq %r14
popq %rbp
retq
movq (%r14), %rdi
leaq 0x2952(%rip), %rsi      # 0xa5fe
leaq 0x293d(%rip), %rdx      # 0xa5f0
leaq 0x2438(%rip), %rcx      # 0xa0f2
movl $0x117, %r8d            # imm = 0x117
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x21e0
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_connect
bool cli_connect(struct dubbo_client *cli)
{
    int fd = socket_create();
    if (fd < 0)
    {
        return false;
    }
    cli->fd = fd;

    int status = socket_connect(fd, &cli->addr, sizeof(cli->addr.s));
    if (status == 0)
    {
        if (!cli_connected(cli))
        {
            goto close;
        }
    }
    else
    {
        if (errno == EINPROGRESS)
        {
            // 这里 貌似应该 read + write
            if (AE_ERR == aeCreateFileEvent(cli->el, fd, AE_WRITABLE, cli_on_connect, cli))
            {
                goto close;
            }
            cli->timerid = aeCreateTimeEvent(cli->el, cli->timeout_ms, cli_connect_timeout, cli, NULL);
            if (AE_ERR == cli->timerid)
            {
                cli->timerid = AE_NOMORE;
                goto close;
            }
        }
        else
        {
            goto close;
        }
    }
    return true;

close:
    close(fd);
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x6319
testl %eax, %eax
js 0x7d6e
movl %eax, %ebx
movl %eax, 0x68(%r14)
leaq 0x10(%r14), %rsi
pushq $0x10
popq %rdx
movl %eax, %edi
callq 0x64e2
testl %eax, %eax
je 0x7d55
callq 0x2050
cmpl $0x73, (%rax)
jne 0x7d64
movq (%r14), %rdi
leaq 0xad(%rip), %rcx        # 0x7dc3
pushq $0x2
popq %rdx
movl %ebx, %esi
movq %r14, %r8
callq 0x26bb
cmpl $-0x1, %eax
je 0x7d64
movq (%r14), %rdi
movq 0x30(%r14), %rsi
leaq -0x12a(%rip), %rdx      # 0x7c0c
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x286d
movq %rax, 0x38(%r14)
movb $0x1, %r15b
cmpq $-0x1, %rax
jne 0x7d6e
orq $-0x1, 0x38(%r14)
jmp 0x7d64
movq %r14, %rdi
callq 0x7d7c
movb $0x1, %r15b
testb %al, %al
jne 0x7d6e
movl %ebx, %edi
callq 0x2160
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_connected
static bool cli_connected(struct dubbo_client *cli)
{
    cli->connected = true;
    cli_clear_timer(cli);
    if (AE_ERR == aeCreateFileEvent(cli->el, cli->fd, AE_READABLE, cli_on_read, cli))
    {
        return false;
    }
    cli_pipe_send(cli);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x6c(%rdi)
callq 0x83d5
movq (%rbx), %rdi
movl 0x68(%rbx), %esi
leaq 0x660(%rip), %rcx       # 0x83fc
pushq $0x1
popq %rdx
movq %rbx, %r8
callq 0x26bb
movl %eax, %r14d
cmpl $-0x1, %eax
je 0x7db7
movq %rbx, %rdi
callq 0x8742
cmpl $-0x1, %r14d
setne %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_on_connect
static void cli_on_connect(struct aeEventLoop *el, int fd, void *ud, int mask)
{
    struct dubbo_client *cli = (struct dubbo_client *)ud;
    // 注意: ae 将 err 与 hup 转换成 write 事件
    if ((mask & AE_WRITABLE) /* && !(mask & AE_READABLE)*/)
    {
        aeDeleteFileEvent(el, fd, AE_WRITABLE /* | AE_READABLE*/);
        // 所以, 可能出错 !!!
        cli_connected(cli);
    }
    else
    {
        LOG_ERROR("连接失败: %s", strerror(errno));
        cli_reconnect(cli);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
testb $0x2, %cl
je 0x7de3
pushq $0x2
popq %rdx
callq 0x2782
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x7d7c
movq 0x720e(%rip), %rax      # 0xeff8
movq (%rax), %r14
callq 0x2050
movl (%rax), %edi
callq 0x2350
leaq 0x2834(%rip), %rsi      # 0xa634
leaq 0x2867(%rip), %rcx      # 0xa66e
leaq 0x22e4(%rip), %r8       # 0xa0f2
movq %r14, %rdi
movq %rax, %rdx
movl $0x172, %r9d            # imm = 0x172
xorl %eax, %eax
callq 0x21e0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x7c53
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_end
static void cli_end(struct dubbo_client *cli)
{
    if (cli->run)
    {
        cli_close(cli);
        cli_clear_timer(cli);

        gettimeofday(&cli->end, NULL);
        g_cli = NULL;
        cli->run = false;
        aeStop(cli->el);

        double elapsed_sec = ((double)cli->end.tv_sec + 1.0e-6 * cli->end.tv_usec) -
                             ((double)cli->start.tv_sec + 1.0e-6 * cli->start.tv_usec);
        int reqs = cli->req_n - cli->req_left;
        double qps = elapsed_sec < 0.001 ? 0 : reqs / elapsed_sec;
        fprintf(stderr, "\x1B[1;32m[SUMMARY]\x1B[0m COST %.2fs, REQ %d, SUCC %d, FAIL %d, QPS %.f\n", elapsed_sec, reqs, cli->ok_n, cli->ko_n, qps);

        cli_release(cli);
    }
}

// Assembly:
cmpb $0x1, 0x6d(%rdi)
je 0x7e4f
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x89f8
movq %rbx, %rdi
callq 0x83d5
leaq 0x80(%rbx), %rdi
xorl %esi, %esi
callq 0x2140
andq $0x0, 0x73cd(%rip)      # 0xf248
movb $0x0, 0x6d(%rbx)
movq (%rbx), %rdi
callq 0x26ae
cvtsi2sdq 0x80(%rbx), %xmm1
cvtsi2sdq 0x88(%rbx), %xmm0
movsd 0x21f7(%rip), %xmm2     # 0xa098
mulsd %xmm2, %xmm0
cvtsi2sdq 0x70(%rbx), %xmm3
addsd %xmm1, %xmm0
cvtsi2sdq 0x78(%rbx), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm3, %xmm1
subsd %xmm1, %xmm0
movl 0x58(%rbx), %edx
movl 0x60(%rbx), %ecx
subl 0x5c(%rbx), %edx
cvtsi2sd %edx, %xmm2
divsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x21c1(%rip), %xmm1     # 0xa0a0
andnpd %xmm2, %xmm1
movq 0x710e(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movl 0x64(%rbx), %r8d
leaq 0x267c(%rip), %rsi      # 0xa574
movb $0x2, %al
callq 0x21e0
movq 0x40(%rbx), %rdi
callq 0x51e9
movq 0x48(%rbx), %rdi
callq 0x51e9
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: dubbo_bench_async
bool dubbo_bench_async(struct dubbo_args *args, struct dubbo_async_args *async_args)
{
    struct dubbo_client *cli = cli_create(args, async_args);
    if (cli == NULL)
    {
        return false;
    }
    return cli_start(cli);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x90, %esi
callq 0x21b0
testq %rax, %rax
je 0x8065
movq %rax, %rbx
movq (%r15), %rax
movq %rax, (%rbx)
movb 0x10(%r15), %al
movb %al, 0x6e(%rbx)
pushq $0x8
popq %r12
movl $0x400, %edi            # imm = 0x400
movq %r12, %rsi
callq 0x5164
movq %rax, 0x40(%rbx)
movl $0x400, %edi            # imm = 0x400
movq %r12, %rsi
callq 0x5164
movq %rax, 0x48(%rbx)
movl 0xc(%r15), %eax
movl %eax, 0x58(%rbx)
movl %eax, 0x5c(%rbx)
movl 0x8(%r15), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
movl %eax, 0x50(%rbx)
movl %ecx, 0x54(%rbx)
imulq $0x3e8, 0x30(%r14), %rax # imm = 0x3E8
movq %rax, 0x30(%rbx)
orq $-0x1, 0x38(%rbx)
movq %r14, 0x8(%rbx)
movq %rbx, %rdi
callq 0x8a22
movq 0x8(%rbx), %rax
movq (%rax), %rdi
leaq 0x10(%rbx), %rsi
callq 0x68ce
testb %al, %al
je 0x8082
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x22d0
rolw $0x8, %ax
movw %ax, 0x12(%rbx)
cmpb $0x0, 0x6d(%rbx)
je 0x8013
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq -0x1ed(%rip), %rdi      # 0x7e2d
callq 0x8ec0
leaq -0x107(%rip), %r14      # 0x7f1f
pushq $0x2
popq %rdi
movq %r14, %rsi
callq 0x21d0
pushq $0xf
popq %rdi
movq %r14, %rsi
callq 0x21d0
movq %rbx, %rdi
addq $0x70, %rdi
xorl %esi, %esi
callq 0x2140
movq %rbx, 0x71f7(%rip)      # 0xf248
movb $0x1, 0x6d(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7ccb
leaq 0x2611(%rip), %rdi      # 0xa67d
leaq 0x207f(%rip), %rsi      # 0xa0f2
leaq 0x2607(%rip), %rcx      # 0xa681
pushq $0x64
popq %rdx
callq 0x2150
movq 0x6f6f(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0x8(%rbx), %rax
movq (%rax), %rdx
leaq 0x2637(%rip), %rsi      # 0xa6d1
leaq 0x266c(%rip), %rcx      # 0xa70d
leaq 0x204a(%rip), %r8       # 0xa0f2
movl $0x82, %r9d
xorl %eax, %eax
callq 0x21e0
pushq $0x1
popq %rdi
callq 0x2300
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_write
static bool cli_write(struct dubbo_client *cli)
{
    struct buffer *buf = cli->snd_buf;
    if (!buf_readable(buf))
    {
        aeDeleteFileEvent(cli->el, cli->fd, AE_WRITABLE);
        return true;
    }

    int nwritten = 0;
    while (buf_readable(buf))
    {
        nwritten = write(cli->fd, buf_peek(buf), buf_readable(buf));
        if (nwritten <= 0)
        {
            if (errno == EINTR)
            {
                continue;
            }
            break;
        }
        buf_retrieve(buf, nwritten);
    }

    if (nwritten <= 0)
    {
        if (errno == EAGAIN)
        {
            if (AE_ERR == aeCreateFileEvent(cli->el, cli->fd, AE_WRITABLE, cli_on_write, cli))
            {
                LOG_ERROR("Dubbo 请求失败: 创建可写事件失败");
                return false;
            }
            return true;
        }
        else
        {
            LOG_ERROR("Dubbo 发送数据失败: %s", strerror(errno));
            return false;
        }
    }

    if (!buf_readable(buf))
    {
        aeDeleteFileEvent(cli->el, cli->fd, AE_WRITABLE);
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %r14
movq %r14, %rdi
callq 0x5255
testq %rax, %rax
je 0x8930
movb $0x1, %r15b
movq %r14, %rdi
callq 0x5255
testq %rax, %rax
je 0x88c5
movl 0x68(%rbx), %r15d
movq %r14, %rdi
callq 0x5283
movq %rax, %r12
movq %r14, %rdi
callq 0x5255
movl %r15d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x20b0
testl %eax, %eax
setle %r15b
jle 0x88b7
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %r14, %rdi
movq %rax, %rsi
callq 0x5459
jmp 0x886b
callq 0x2050
movl (%rax), %edi
cmpl $0x4, %edi
je 0x886b
jmp 0x88d2
testb $0x1, %r15b
je 0x8943
callq 0x2050
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x8963
movq (%rbx), %rdi
movl 0x68(%rbx), %esi
leaq 0xc1(%rip), %rcx        # 0x89a9
pushq $0x2
popq %rdx
movq %rbx, %r8
callq 0x26bb
movb $0x1, %r14b
cmpl $-0x1, %eax
jne 0x899d
movq 0x66f2(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x1b84(%rip), %rsi      # 0xa494
leaq 0x1bd3(%rip), %rdx      # 0xa4ea
leaq 0x17d4(%rip), %rcx      # 0xa0f2
xorl %r14d, %r14d
movl $0x139, %r8d            # imm = 0x139
xorl %eax, %eax
callq 0x21e0
jmp 0x899d
movq (%rbx), %rdi
movl 0x68(%rbx), %esi
pushq $0x2
popq %rdx
callq 0x2782
movb $0x1, %r14b
jmp 0x899d
movq %r14, %rdi
callq 0x5255
movb $0x1, %r14b
testq %rax, %rax
jne 0x899d
movq (%rbx), %rdi
movl 0x68(%rbx), %esi
pushq $0x2
popq %rdx
callq 0x2782
jmp 0x899d
movq 0x668e(%rip), %rax      # 0xeff8
movq (%rax), %rbx
callq 0x2350
leaq 0x1b7b(%rip), %rsi      # 0xa4f4
leaq 0x1b6a(%rip), %rcx      # 0xa4ea
leaq 0x176b(%rip), %r8       # 0xa0f2
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rdx
movl $0x140, %r9d            # imm = 0x140
xorl %eax, %eax
callq 0x21e0
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_on_write
static void cli_on_write(struct aeEventLoop *el, int fd, void *ud, int mask)
{
    UNUSED(el);
    UNUSED(fd);
    UNUSED(mask);

    struct dubbo_client *cli = (struct dubbo_client *)ud;
    assert(cli->connected);

    if (!cli_write(cli))
    {
        cli_reconnect(cli);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpb $0x0, 0x6c(%rdx)
je 0x89d9
movq %rdx, %rbx
movq %rdx, %rdi
callq 0x8845
testb %al, %al
je 0x89cb
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x7c53
leaq 0x17e1(%rip), %rdi      # 0xa1c1
leaq 0x170b(%rip), %rsi      # 0xa0f2
leaq 0x1b4c(%rip), %rcx      # 0xa53a
movl $0x17e, %edx            # imm = 0x17E
callq 0x2150
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_reset
static void cli_reset(struct dubbo_client *cli)
{
    cli->connected = false;
    cli_clear_timer(cli);
    cli->fd = -1;
    cli->pipe_left = cli->pipe_n;
    buf_retrieveAll(cli->rcv_buf);
    buf_retrieveAll(cli->snd_buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x6c(%rdi)
callq 0x83d5
orl $-0x1, 0x68(%rbx)
movl 0x50(%rbx), %eax
movl %eax, 0x54(%rbx)
movq 0x40(%rbx), %rdi
callq 0x549e
movq 0x48(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x549e
nop
// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo.c
// Function: trim_opt
static char *trim_opt(char *opt)
{
    char *end;
    if (opt == 0)
    {
        return 0;
    }

    while (isspace((int)*opt) || *opt == '=')
        opt++;

    if (*opt == 0)
    {
        return opt;
    }

    end = opt + strlen(opt) - 1;
    while (end > opt && isspace((int)*end))
        end--;

    *(end + 1) = 0;

    return opt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x8e8f
movq %rdi, %rbx
callq 0x2370
movq (%rax), %r14
decq %rbx
movsbq 0x1(%rbx), %rax
incq %rbx
cmpq $0x3d, %rax
je 0x8e43
movzwl (%r14,%rax,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x8e43
testb %al, %al
je 0x8e91
movq %rbx, %rdi
callq 0x20d0
leaq (%rbx,%rax), %rcx
decq %rcx
movq %rcx, %rax
cmpq %rbx, %rcx
jbe 0x8e89
movsbq (%rax), %rdx
leaq -0x1(%rax), %rcx
testb $0x20, 0x1(%r14,%rdx,2)
jne 0x8e71
movb $0x0, 0x1(%rax)
jmp 0x8e91
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/abe.c
// Function: test_pre
void
test_pre()
{
/*	char tmp_buf[256]; */

	DBUG_ENTER("test_pre");

	DBUG_PRINT("", ("sizeof(int)=%d", sizeof(int)));
	DBUG_PRINT("", ("sizeof(CONS*)=%d", sizeof(CONS*)));
	DBUG_PRINT("", ("sizeof(BEH)=%d", sizeof(BEH)));
	assert(sizeof(int) == sizeof(CONS*));
	assert(sizeof(BEH) == sizeof(CONS*));

	DBUG_PRINT("", ("NIL=16#%08lx (%p)", NIL, NIL));
	assert(nilp(NIL));
	assert(nilp(NIL) == _nilp(NIL));

	DBUG_PRINT("", ("sizeof(BOOL)=%d", sizeof(BOOL)));
	assert(sizeof(BOOL) == sizeof(CONS*));
	DBUG_PRINT("", ("TRUE=16#%08lx (%p)", TRUE, TRUE));
	DBUG_PRINT("", ("FALSE=16#%08lx (%p)", FALSE, FALSE));
	assert(TRUE);
	assert(!FALSE);
	assert(TRUE == ((BOOL)(0 == 0)));
	assert(FALSE == ((BOOL)(0 != 0)));

#if TYPETAG_USES_3MSB
	DBUG_PRINT("", ("Type tag in MSB[31:29]"));
#endif /* TYPETAG_USES_3MSB */
#if TYPETAG_USES_2LSB
	DBUG_PRINT("", ("Type tag in LSB[1:0]"));
#endif /* TYPETAG_USES_2LSB */
#if TYPETAG_USES_3LSB
	DBUG_PRINT("", ("Type tag in LSB[2/1:0]"));
#endif /* TYPETAG_USES_3LSB */
#if TYPETAG_USES_1LSB_2MSB
	DBUG_PRINT("", ("Type tag in LSB[0]+MSB[31:30]"));
#endif /* TYPETAG_USES_1LSB_2MSB */
	DBUG_PRINT("", ("_Program[]=16#%08lx (%p)", _Program, _Program));
	assert(_Program == MK_PTR(MK_REF(_Program)));

/* FIXME: enable this test when stack allocation is allowed
	DBUG_PRINT("", ("tmp_buf[]=%p", tmp_buf));
	assert(tmp_buf == MK_PTR(MK_REF(tmp_buf)));
*/

	DBUG_PRINT("", ("test_pre()=16#%08lx (%p)", test_pre, test_pre));
	assert(test_pre == MK_BEH(MK_FUNC(test_pre)));

	DBUG_RETURN;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
leaq 0xbca8(%rip), %rax      # 0xe004
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x11fb5(%rip), %r14     # 0x14320
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x1c, 0xc(%rdi)
leaq 0xdb02(%rip), %rbx      # 0xfe88
movq %rbx, 0x10(%rdi)
leaq 0x11daf(%rip), %rcx     # 0x14140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xd0b9
leaq 0x1252b(%rip), %r15     # 0x148d0
cmpl $0x0, (%r15)
je 0x245d
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbx, 0x10(%rax)
movq %rbx, %rdi
callq 0xc834
testl %eax, %eax
je 0x23e5
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x1e, 0xc(%rax)
leaq 0xbc32(%rip), %rdi      # 0xe00d
pushq $0x4
popq %rsi
xorl %eax, %eax
callq 0xd130
cmpl $0x0, (%r15)
je 0x245d
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbx, 0x10(%rax)
movq %rbx, %rdi
callq 0xc834
testl %eax, %eax
je 0x2421
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x1f, 0xc(%rax)
leaq 0xbc05(%rip), %rdi      # 0xe01c
pushq $0x8
popq %rsi
xorl %eax, %eax
callq 0xd130
cmpl $0x0, (%r15)
je 0x245d
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbx, 0x10(%rax)
movq %rbx, %rdi
callq 0xc834
testl %eax, %eax
je 0x245d
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x20, 0xc(%rax)
leaq 0xbbda(%rip), %rdi      # 0xe02d
pushq $0x8
popq %rsi
xorl %eax, %eax
callq 0xd130
leaq 0xbbd8(%rip), %rdi      # 0xe03c
leaq 0xbbee(%rip), %rsi      # 0xe059
leaq 0xbbed(%rip), %rcx      # 0xe05f
pushq $0x21
popq %rdx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/sample.c
// Function: tick_init
void
tick_init()
{
	time_t t0;
	time_t t1;

	DBUG_ENTER("tick_init");
	time(&t0);
	do {				/* synchronize timer at boundry */
		time(&t1);
	} while (t0 == t1);
	DBUG_PRINT("", ("t0=%d t1=%d", t0, t1));
	time_base = t0;
	DBUG_RETURN;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0xb8ec(%rip), %rax      # 0xe194
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x11a69(%rip), %r15     # 0x14320
movq (%r15), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x15, 0xc(%rdi)
leaq 0xd5b6(%rip), %rbx      # 0xfe88
movq %rbx, 0x10(%rdi)
leaq 0x118ab(%rip), %rcx     # 0x14188
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xd0b9
leaq 0x8(%rsp), %rdi
callq 0x2180
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x2180
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x28f9
leaq 0x11fbc(%rip), %rax     # 0x148d0
cmpl $0x0, (%rax)
je 0x295b
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbx, 0x10(%rax)
movq %rbx, %rdi
callq 0xc834
movq 0x8(%rsp), %rsi
testl %eax, %eax
je 0x295b
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1a, 0xc(%rax)
movq 0x10(%rsp), %rdx
leaq 0xb84f(%rip), %rdi      # 0xe19e
xorl %eax, %eax
callq 0xd130
movq 0x8(%rsp), %rsi
movq %rsi, 0x11a1e(%rip)     # 0x14380
leaq 0x18(%rsp), %rdi
movl $0x1c, 0xc(%rdi)
callq 0xd232
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/sample.c
// Function: print_text
BEH_DECL(print_text)
{
	CONS* text;

	DBUG_ENTER("print_text");
	text = map_get(WHAT, ATOM("text"));
	printf("%s", (atomp(text) ? atom_str(text) : cons_to_str(text)));
	DBUG_RETURN;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0xb79f(%rip), %rax      # 0xe1b4
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x118fc(%rip), %rax     # 0x14320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x2d, 0xc(%rdi)
leaq 0xd449(%rip), %rcx      # 0xfe88
movq %rcx, 0x10(%rdi)
leaq 0x1173e(%rip), %rcx     # 0x14188
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xd0b9
movq 0x30(%rbx), %rdi
callq 0xb346
movq %rax, %rbx
leaq 0xb750(%rip), %rdi      # 0xe1ba
callq 0x895f
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb7c7
movl %eax, %ecx
andl $0x3, %ecx
movq %rax, %rdi
cmpl $0x2, %ecx
jne 0x2a90
callq 0x89be
jmp 0x2a95
callq 0x5748
leaq 0xc1d4(%rip), %rdi      # 0xec70
movq %rax, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x8(%rsp), %rdi
movl $0x30, 0xc(%rdi)
callq 0xd232
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/sample.c
// Function: print_line
BEH_DECL(print_line)
{
	CONS* text;

	DBUG_ENTER("print_line");
	text = map_get(WHAT, ATOM("text"));
	printf("%s", (atomp(text) ? atom_str(text) : cons_to_str(text)));
	putchar('\n');
	DBUG_RETURN;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0xb6f3(%rip), %rax      # 0xe1bf
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x11845(%rip), %rax     # 0x14320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x37, 0xc(%rdi)
leaq 0xd392(%rip), %rcx      # 0xfe88
movq %rcx, 0x10(%rdi)
leaq 0x11687(%rip), %rcx     # 0x14188
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xd0b9
movq 0x30(%rbx), %rdi
callq 0xb346
movq %rax, %rbx
leaq 0xb699(%rip), %rdi      # 0xe1ba
callq 0x895f
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb7c7
movl %eax, %ecx
andl $0x3, %ecx
movq %rax, %rdi
cmpl $0x2, %ecx
jne 0x2b47
callq 0x89be
jmp 0x2b4c
callq 0x5748
leaq 0xc11d(%rip), %rdi      # 0xec70
movq %rax, %rsi
xorl %eax, %eax
callq 0x20f0
pushq $0xa
popq %rdi
callq 0x2040
leaq 0x8(%rsp), %rdi
movl $0x3b, 0xc(%rdi)
callq 0xd232
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/sample.c
// Function: start_ticker
void
start_ticker(CONFIG* cfg, int count)
{
	CONS* actor;
	CONS* state;
	CONS* msg;
	
	DBUG_ENTER("start_ticker");
	DBUG_PRINT("", ("count=%d", count));
	state = map_put(NIL, ATOM("count"), NUMBER(count));
	actor = CFG_ACTOR(cfg, each_second, state);
	
	state = map_put(NIL, ATOM("sec"), actor);
	msg = map_put(NIL, ATOM("time"), tick_time());
	CFG_SEND(cfg, CFG_ACTOR(cfg, time_ticker, state), msg);
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xaf32(%rip), %rax      # 0xe28e
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x10fb5(%rip), %r15     # 0x14320
movq (%r15), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x8a, 0xc(%rdi)
leaq 0xcb02(%rip), %r14      # 0xfe88
movq %r14, 0x10(%rdi)
leaq 0x10df7(%rip), %rcx     # 0x14188
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xd0b9
leaq 0x1152b(%rip), %rax     # 0x148d0
cmpl $0x0, (%rax)
je 0x33df
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %r14, 0x10(%rax)
movq %r14, %rdi
callq 0xc834
testl %eax, %eax
je 0x33df
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x8b, 0xc(%rax)
leaq 0xb34d(%rip), %rdi      # 0xe723
movl %ebp, %esi
xorl %eax, %eax
callq 0xd130
leaq 0xb352(%rip), %rdi      # 0xe738
callq 0x895f
movslq %ebp, %rcx
leaq 0x3(,%rcx,4), %rdx
leaq 0x10e93(%rip), %r14     # 0x14290
movq %r14, %rdi
movq %rax, %rsi
callq 0xb839
leaq -0x893(%rip), %rsi      # 0x2b7c
movq %rbx, %rdi
movq %rax, %rdx
callq 0x43f7
movq %rax, %r15
leaq 0xadcd(%rip), %rdi      # 0xe1f1
callq 0x895f
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xb839
movq %rax, %r15
leaq 0xad6e(%rip), %rdi      # 0xe1af
callq 0x895f
movq %rax, %r12
callq 0x297d
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xb839
movq %rax, %r14
leaq -0x641(%rip), %rsi      # 0x2e25
movq %rbx, %rdi
movq %r15, %rdx
callq 0x43f7
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x44d4
leaq 0x8(%rsp), %rdi
movl $0x92, 0xc(%rdi)
callq 0xd232
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq