LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/lib/cJSON.c
// Function: cJSON_AddItemToObjectCS
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
{
    if ((item == NULL) || (string == NULL))
    {
        return;
    }
    if (!(item->type & cJSON_StringIsConst) && item->string)
    {
        global_hooks.deallocate(item->string);
    }
    item->string = (char*)string;
    item->type |= cJSON_StringIsConst;
    cJSON_AddItemToArray(object, item);
}

// Assembly:
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x4b00
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testb $0x2, 0x19(%rdx)
jne 0x4ac8
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x4ac8
callq *0xb720(%rip)           # 0x101e8
movq %r15, 0x38(%rbx)
orb $0x2, 0x19(%rbx)
testq %r14, %r14
je 0x4af6
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x4af2
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x4ade
movq %rbx, (%rcx)
movq %rcx, 0x8(%rbx)
jmp 0x4af6
movq %rbx, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_create_ex
struct buffer *buf_create_ex(size_t size, size_t prepend_size)
{
    assert(size > 0);
    assert(prepend_size >= 0);

    size_t sz = size + prepend_size;
    struct buffer *buf = calloc(1, sizeof(*buf));
    if (buf == NULL)
    {
        return NULL;
    }
    buf->buf = calloc(1, sz);
    if (buf->buf == NULL)
    {
        free(buf);
        return NULL;
    }
    buf->sz = sz;
    buf->read_idx = prepend_size;
    buf->write_idx = prepend_size;
    buf->p_sz = prepend_size;
    buf->refcount = 0;
    buf->src = NULL;
    return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x639d
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x40, %esi
callq 0x21b0
testq %rax, %rax
je 0x638d
movq %rax, %rbx
addq %r14, %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0x21b0
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x6385
movq %r15, 0x10(%rbx)
movq %r14, (%rbx)
movq %r14, 0x8(%rbx)
movq %r14, 0x18(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rbx)
jmp 0x638f
movq %rbx, %rdi
callq 0x23a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3d0c(%rip), %rdi      # 0xa0b0
leaq 0x3d0e(%rip), %rsi      # 0xa0b9
leaq 0x3d10(%rip), %rcx      # 0xa0c2
movl $0x20, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_release
void buf_release(struct buffer *buf)
{
    // 可以嵌套创建readonlyView, 都要检查 refcount
    assert(buf->refcount == 0);

    if (buf->src)
    {
        // 只读视图
        buf->src->refcount--;

        // 缓存 只读视图, 为 mysql 协议解析做的优化
        if (!buf->src->cache)
        {
            buf->src->cache = buf;
        }
        else
        {
            free(buf);
        }
    }
    else
    {
        // 常规 buffer
        free(buf->buf);
        if (buf->cache)
        {
            free(buf->cache);
        }
        free(buf);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x28(%rdi)
jne 0x6410
movq %rdi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x63eb
decq 0x28(%rax)
cmpq $0x0, 0x38(%rax)
jne 0x6402
movq %rbx, 0x38(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x20(%rbx), %rdi
callq 0x23a0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x6402
callq 0x23a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0
leaq 0x3cd8(%rip), %rdi      # 0xa0ef
leaq 0x3c9b(%rip), %rsi      # 0xa0b9
leaq 0x3cdd(%rip), %rcx      # 0xa102
movl $0x3b, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_retrieveAsString
void buf_retrieveAsString(struct buffer *buf, size_t len, char *str)
{
    assert(str != NULL);
    memcpy(str, buf_peek(buf), len);
    str[len] = 0;
    buf_retrieve(buf, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x6619
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x20(%rdi), %rsi
addq (%rdi), %rsi
movq %rdx, %rdi
movq %rbx, %rdx
callq 0x2200
movb $0x0, (%r14,%rbx)
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6638
leaq 0x3ba7(%rip), %rdi      # 0xa1c7
leaq 0x3a92(%rip), %rsi      # 0xa0b9
leaq 0x3ba5(%rip), %rcx      # 0xa1d3
movl $0x99, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_retrieve
void buf_retrieve(struct buffer *buf, size_t len)
{
    assert(len <= buf_readable(buf));
    if (len < buf_readable(buf))
    {
        buf->read_idx += len;
    }
    else
    {
        buf_retrieveAll(buf);
    }
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq %rsi, %rcx
jb 0x665c
jbe 0x6650
addq %rsi, %rax
movq %rax, (%rdi)
retq
movq 0x18(%rdi), %rax
movq %rax, (%rdi)
movq %rax, 0x8(%rdi)
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x3b44(%rip), %rdi      # 0xa1ab
leaq 0x3a4b(%rip), %rsi      # 0xa0b9
leaq 0x3b99(%rip), %rcx      # 0xa20e
movl $0xa7, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_ensureWritable
void buf_ensureWritable(struct buffer *buf, size_t len)
{
    ASSERT_WRITE(buf);
    if (buf_writable(buf) < len)
    {
        buf_makeSpace(buf, len);
    }
    assert(buf_writable(buf) >= len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x30(%rdi)
jne 0x67cc
movq %rdi, %r14
cmpq $0x0, 0x28(%rdi)
jne 0x67cc
movq %rsi, %rbx
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rcx
movq %rcx, %rax
subq %rsi, %rax
cmpq %rbx, %rax
jae 0x67b4
movq (%r14), %rax
movq 0x18(%r14), %rdi
movq %rsi, %r15
subq %rax, %r15
addq %rax, %rcx
subq %rsi, %rcx
subq %rdi, %rcx
cmpq %rbx, %rcx
jae 0x678c
addq %rbx, %rsi
movq %r14, %rdi
callq 0x6940
jmp 0x67a6
cmpq %rax, %rdi
jae 0x680a
movq 0x20(%r14), %rcx
addq %rcx, %rdi
addq %rcx, %rax
movq %rax, %rsi
movq %r15, %rdx
callq 0x2290
movq 0x18(%r14), %rax
movq %rax, (%r14)
addq %rax, %r15
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rax
subq 0x8(%r14), %rax
cmpq %rbx, %rax
jb 0x67eb
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3998(%rip), %rdi      # 0xa16b
leaq 0x38df(%rip), %rsi      # 0xa0b9
leaq 0x3abe(%rip), %rcx      # 0xa29f
movl $0xee, %edx
callq 0x2150
leaq 0x3ade(%rip), %rdi      # 0xa2d0
leaq 0x38c0(%rip), %rsi      # 0xa0b9
leaq 0x3a9f(%rip), %rcx      # 0xa29f
movl $0xf3, %edx
callq 0x2150
leaq 0x3e75(%rip), %rdi      # 0xa686
leaq 0x38a1(%rip), %rsi      # 0xa0b9
leaq 0x3e81(%rip), %rcx      # 0xa6a0
movl $0xe3, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_append
void buf_append(struct buffer *buf, const char *data, size_t len)
{
    ASSERT_WRITE(buf);
    buf_ensureWritable(buf, len);
    memcpy(buf_beginWrite(buf), data, len);
    buf_has_written(buf, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x30(%rdi)
jne 0x688a
movq %rdi, %r14
cmpq $0x0, 0x28(%rdi)
jne 0x688a
movq %rdx, %rbx
movq %rsi, %r15
movq %r14, %rdi
movq %rdx, %rsi
callq 0x672f
movq 0x20(%r14), %rdi
addq 0x8(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2200
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
subq %rax, %rcx
cmpq %rbx, %rcx
jb 0x68a9
addq %rbx, %rax
movq %rax, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38da(%rip), %rdi      # 0xa16b
leaq 0x3821(%rip), %rsi      # 0xa0b9
leaq 0x3a4a(%rip), %rcx      # 0xa2e9
movl $0xf8, %edx
callq 0x2150
leaq 0x3874(%rip), %rdi      # 0xa124
leaq 0x3802(%rip), %rsi      # 0xa0b9
leaq 0x387f(%rip), %rcx      # 0xa13d
movl $0x78, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_swap
static void buf_swap(struct buffer *buf, size_t nsz)
{
    // TODO nsz > buf->size realloc ?
    assert(nsz >= buf_readable(buf));
    void *nbuf = calloc(1, nsz);
    assert(nbuf);
    memcpy(nbuf + buf->p_sz, buf_peek(buf), buf_readable(buf));
    free(buf->buf);
    buf->buf = nbuf;
    buf->sz = nsz;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r15
movq 0x8(%rdi), %r12
subq %r15, %r12
cmpq %rsi, %r12
ja 0x69b2
movq %rdi, %r14
movl $0x1, %edi
movq %rsi, -0x30(%rbp)
callq 0x21b0
testq %rax, %rax
je 0x69d1
movq %rax, %r13
movq 0x18(%r14), %rdi
addq %rax, %rdi
movq 0x20(%r14), %rbx
addq %rbx, %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0x2200
movq %rbx, %rdi
callq 0x23a0
movq %r13, 0x20(%r14)
movq -0x30(%rbp), %rax
movq %rax, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3d13(%rip), %rdi      # 0xa6cc
leaq 0x36f9(%rip), %rsi      # 0xa0b9
leaq 0x3d1e(%rip), %rcx      # 0xa6e5
movl $0xd0, %edx
callq 0x2150
leaq 0x3d34(%rip), %rdi      # 0xa70c
leaq 0x36da(%rip), %rsi      # 0xa0b9
leaq 0x3cff(%rip), %rcx      # 0xa6e5
movl $0xd2, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt64
int64_t buf_peekInt64(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int64_t));
    int64_t be64 = 0;
    memcpy(&be64, buf_peek(buf), sizeof(int64_t));
    return be64toh(be64);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x7, %rcx
jbe 0x6cb2
movq 0x20(%rdi), %rcx
movq (%rcx,%rax), %rax
bswapq %rax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x36e0(%rip), %rdi      # 0xa39d
leaq 0x33f5(%rip), %rsi      # 0xa0b9
leaq 0x36f7(%rip), %rcx      # 0xa3c2
movl $0x15f, %edx            # imm = 0x15F
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt32
int32_t buf_peekInt32(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int32_t));
    int32_t be32 = 0;
    memcpy(&be32, buf_peek(buf), sizeof(int32_t));
    return be32toh(be32);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x3, %rcx
jbe 0x6cef
movq 0x20(%rdi), %rcx
movl (%rcx,%rax), %eax
bswapl %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x36f5(%rip), %rdi      # 0xa3ef
leaq 0x33b8(%rip), %rsi      # 0xa0b9
leaq 0x370c(%rip), %rcx      # 0xa414
movl $0x167, %edx            # imm = 0x167
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt16
int16_t buf_peekInt16(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int16_t));
    int16_t be16 = 0;
    memcpy(&be16, buf_peek(buf), sizeof(int16_t));
    return be16toh(be16);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x1, %rcx
jbe 0x6d2f
movq 0x20(%rdi), %rcx
movzwl (%rcx,%rax), %eax
rolw $0x8, %ax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x3707(%rip), %rdi      # 0xa441
leaq 0x3378(%rip), %rsi      # 0xa0b9
leaq 0x371e(%rip), %rcx      # 0xa466
movl $0x16f, %edx            # imm = 0x16F
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt64LE
int64_t buf_peekInt64LE(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int64_t));
    int64_t le64 = 0;
    memcpy(&le64, buf_peek(buf), sizeof(int64_t));
    return le64toh(le64);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x7, %rcx
jbe 0x6d9f
movq 0x20(%rdi), %rcx
movq (%rcx,%rax), %rax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x35f3(%rip), %rdi      # 0xa39d
leaq 0x3308(%rip), %rsi      # 0xa0b9
leaq 0x372a(%rip), %rcx      # 0xa4e2
movl $0x17d, %edx            # imm = 0x17D
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt32LE
int32_t buf_peekInt32LE(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int32_t));
    int32_t le32 = 0;
    memcpy(&le32, buf_peek(buf), sizeof(int32_t));
    return le32toh(le32);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x3, %rcx
jbe 0x6dda
movq 0x20(%rdi), %rcx
movl (%rcx,%rax), %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x360a(%rip), %rdi      # 0xa3ef
leaq 0x32cd(%rip), %rsi      # 0xa0b9
leaq 0x371e(%rip), %rcx      # 0xa511
movl $0x185, %edx            # imm = 0x185
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt32LE24
int32_t buf_peekInt32LE24(const struct buffer *buf)
{
    assert(buf_readable(buf) >= 3);
    int32_t le32 = 0x00000000; /* 0x000000{00 小端高位未使用} */
    memcpy(&le32, buf_peek(buf), 3);
    return le32toh(le32);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x2, %rcx
jbe 0x6e20
movq 0x20(%rdi), %rcx
movzwl (%rcx,%rax), %edx
movzbl 0x2(%rcx,%rax), %eax
shll $0x10, %eax
orl %edx, %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x3715(%rip), %rdi      # 0xa540
leaq 0x3287(%rip), %rsi      # 0xa0b9
leaq 0x371e(%rip), %rcx      # 0xa557
movl $0x18d, %edx            # imm = 0x18D
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_peekInt16LE
int16_t buf_peekInt16LE(const struct buffer *buf)
{
    assert(buf_readable(buf) >= sizeof(int16_t));
    int16_t le16 = 0;
    memcpy(&le16, buf_peek(buf), sizeof(int16_t));
    return le16toh(le16);
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x1, %rcx
jbe 0x6e5c
movq 0x20(%rdi), %rcx
movzwl (%rcx,%rax), %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x35da(%rip), %rdi      # 0xa441
leaq 0x324b(%rip), %rsi      # 0xa0b9
leaq 0x3713(%rip), %rcx      # 0xa588
movl $0x195, %edx            # imm = 0x195
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_readCStr
char *buf_readCStr(struct buffer *buf, char *str, int sz)
{
    int sz1;
    const char *eos = buf_findChar(buf, '\0');

    if (eos == NULL)
    {
        sz1 = buf_readable(buf) + 1;
    }
    else
    {
        sz1 = eos - buf_peek(buf) + 1;
    }

    if (sz < sz1)
    {
        return NULL;
    }

    memcpy(str, buf_peek(buf), sz);
    if (eos == NULL)
    {
        buf_retrieve(buf, sz1 - 1);
    }
    else
    {
        buf_retrieve(buf, sz1);
    }
    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, -0x30(%rbp)
movq %rdi, %r14
movq (%rdi), %rax
movq 0x8(%rdi), %rbx
movq 0x20(%rdi), %r12
addq %rax, %r12
subq %rax, %rbx
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2180
movl %r15d, %ecx
movq %rax, %r13
subq %r12, %r13
testq %rax, %rax
cmoveq %rbx, %r13
leal 0x1(%r13), %ebx
cmpl %r15d, %ebx
jle 0x702b
xorl %eax, %eax
jmp 0x7056
movq %rax, %r15
movslq %ecx, %rdx
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x2200
testq %r15, %r15
movslq %r13d, %rax
movslq %ebx, %rsi
cmoveq %rax, %rsi
movq %r14, %rdi
callq 0x6638
movq -0x30(%rbp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_readStr
char *buf_readStr(struct buffer *buf, char *str, int sz)
{
    if (buf_readable(buf) < sz)
    {
        sz = buf_readable(buf);
    }

    memcpy(str, buf_peek(buf), sz);
    str[sz] = '\0';

    buf_retrieve(buf, sz);
    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
movslq %edx, %rdx
cmpq %rdx, %rcx
cmovbl %ecx, %edx
movq %rsi, %r14
addq 0x20(%rdi), %rax
movslq %edx, %r15
movq %rsi, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x2200
movb $0x0, (%r14,%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6638
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_dupCStr
char *buf_dupCStr(struct buffer *buf)
{
    int sz;
    const char *eos = buf_findChar(buf, '\0');

    if (eos == NULL)
    {
        sz = buf_readable(buf) + 1;
    }
    else
    {
        sz = eos - buf_peek(buf) + 1;
    }

    char *str = calloc(sz, 1);
    if (str == NULL)
    {
        return NULL;
    }

    memcpy(str, buf_peek(buf), sz);
    if (eos == NULL)
    {
        buf_retrieve(buf, sz - 1);
    }
    else
    {
        buf_retrieve(buf, sz);
    }
    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %rbx
movq %rdi, -0x30(%rbp)
movq 0x20(%rdi), %r14
addq %rax, %r14
subq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2180
movq %rax, %r13
movl %r13d, %r12d
subl %r14d, %r12d
testq %rax, %rax
cmoveq %rbx, %r12
shlq $0x20, %r12
movabsq $0x100000000, %r15      # imm = 0x100000000
addq %r12, %r15
sarq $0x20, %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x21b0
testq %rax, %rax
je 0x714f
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2200
sarq $0x20, %r12
testq %r13, %r13
cmovneq %r15, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x6638
movq %rbx, %rax
jmp 0x7151
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_dupStr
char *buf_dupStr(struct buffer *buf, int sz)
{
    if (buf_readable(buf) < sz)
    {
        sz = buf_readable(buf);
    }
    char *str = malloc(sz + 1);
    if (str == NULL)
    {
        return NULL;
    }

    memcpy(str, buf_peek(buf), sz);
    str[sz] = '\0';

    buf_retrieve(buf, sz);
    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x8(%rdi), %rax
subq %r14, %rax
movslq %esi, %r12
cmpq %r12, %rax
cmovbl %eax, %r12d
leal 0x1(%r12), %eax
movslq %eax, %rdi
callq 0x23a8
testq %rax, %rax
je 0x71be
movq %rax, %r15
addq 0x20(%rbx), %r14
movslq %r12d, %r12
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2200
movb $0x0, (%r15,%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6638
jmp 0x71c1
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_readFd
ssize_t buf_readFd(struct buffer *buf, int fd, int *errno_)
{
    ASSERT_WRITE(buf);
    char extrabuf[65535];
    struct iovec vec[2];
    size_t writable = buf_writable(buf);
    vec[0].iov_base = buf_beginWrite(buf);
    vec[0].iov_len = writable;
    vec[1].iov_base = extrabuf;
    vec[1].iov_len = sizeof(extrabuf);

    int iovcnt = writable < sizeof(extrabuf) ? 2 : 1;
    ssize_t n = readv(fd, vec, iovcnt);
    if (n < 0)
    {
        *errno_ = n;
    }
    else if (n <= writable)
    {
        buf->write_idx += n;
    }
    else
    {
        buf->write_idx = buf->sz;
        buf_append(buf, (char *)(&extrabuf[0]), n - writable);
    }

    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10020, %rsp          # imm = 0x10020
cmpq $0x0, 0x30(%rdi)
jne 0x7280
movq %rdi, %rbx
cmpq $0x0, 0x28(%rdi)
jne 0x7280
movq %rdx, %r14
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %r12
subq %rcx, %r12
addq 0x20(%rbx), %rcx
leaq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq %r12, 0x8(%rax)
leaq -0x10040(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl $0xffff, %ecx           # imm = 0xFFFF
movq %rcx, 0x18(%rax)
xorl %edx, %edx
cmpq %rcx, %r12
adcl $0x1, %edx
movl %esi, %edi
movq %rax, %rsi
callq 0x2280
movq %rax, %r15
testq %rax, %rax
js 0x7264
movq %r15, %rdx
subq %r12, %rdx
jbe 0x7269
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
leaq -0x10040(%rbp), %rsi
movq %rbx, %rdi
callq 0x6829
jmp 0x726d
movl %r15d, (%r14)
jmp 0x726d
addq %r15, 0x8(%rbx)
movq %r15, %rax
addq $0x10020, %rsp          # imm = 0x10020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ee4(%rip), %rdi      # 0xa16b
leaq 0x2e2b(%rip), %rsi      # 0xa0b9
leaq 0x3322(%rip), %rcx      # 0xa5b7
movl $0x235, %edx            # imm = 0x235
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/buffer.c
// Function: buf_readonlyView
struct buffer *buf_readonlyView(struct buffer *buf, int sz)
{
    assert(sz > 0);
    if (sz > buf_readable(buf))
    {
        sz = buf_readable(buf);
    }

    struct buffer *rbuf;

    if (buf->cache)
    {
        memset(buf->cache, 0, sizeof(*(buf->cache)));
        rbuf = buf->cache;
        buf->cache = NULL;
    }
    else
    {
        rbuf = calloc(1, sizeof(*buf));
        if (rbuf == NULL)
        {
            return NULL;
        }
    }

    rbuf->buf = buf->buf + buf->read_idx; // buf_peek(buf)
    rbuf->sz = sz;
    rbuf->read_idx = 0;
    rbuf->write_idx = sz;
    rbuf->p_sz = 0;
    rbuf->refcount = 0;
    rbuf->src = buf;
    buf->refcount++;
    return rbuf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
jle 0x7340
movq %rdi, %rbx
movl %esi, %ecx
movq 0x8(%rdi), %r14
movq 0x38(%rdi), %rax
subq (%rdi), %r14
cmpq %rcx, %r14
cmovael %esi, %r14d
testq %rax, %rax
je 0x72f8
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x38(%rbx), %rax
movq $0x0, 0x38(%rbx)
jmp 0x730c
movl $0x1, %edi
movl $0x40, %esi
callq 0x21b0
testq %rax, %rax
je 0x733c
movq 0x20(%rbx), %rcx
addq (%rbx), %rcx
movq %rcx, 0x20(%rax)
movslq %r14d, %rcx
movq %rcx, 0x10(%rax)
xorl %edx, %edx
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rdx, 0x18(%rax)
movq %rdx, 0x28(%rax)
movq %rbx, 0x30(%rax)
incq 0x28(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
jmp 0x7337
leaq 0x32a0(%rip), %rdi      # 0xa5e7
leaq 0x2d6b(%rip), %rsi      # 0xa0b9
leaq 0x3299(%rip), %rcx      # 0xa5ee
movl $0x25d, %edx            # imm = 0x25D
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/socket.c
// Function: socket_create_
static int socket_create_(bool nonblock)
{
#ifdef __APPLE__
    int sockfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
#else
    int sockfd = socket(PF_INET, SOCK_STREAM | (nonblock ? SOCK_NONBLOCK : 0) | SOCK_CLOEXEC, IPPROTO_TCP);
#endif

    if (sockfd < 0)
    {
        perror("ERROR socket");
        return -1;
    }

#ifdef __APPLE__
    if (nonblock)
    {
        socket_setNonblock(sockfd);
    }
#endif

    int yes = 1;
    setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes));
    setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
#ifdef SO_REUSEPORT
    setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes));
#endif
    setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes));

    // !! for server
    signal(SIGPIPE, SIG_IGN);
    return sockfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
shll $0xb, %edi
leal 0x80001(%rdi), %esi
movl $0x2, %edi
movl $0x6, %edx
callq 0x2390
testl %eax, %eax
js 0x7712
movl %eax, %ebx
leaq -0x14(%rbp), %r14
movl $0x1, (%r14)
movl %eax, %edi
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x2090
movl %ebx, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x2090
movl %ebx, %edi
movl $0x1, %esi
movl $0xf, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x2090
movl %ebx, %edi
movl $0x1, %esi
movl $0x9, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x2090
movl $0x1, %esi
movl $0xd, %edi
callq 0x21d0
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3041(%rip), %rdi      # 0xa75a
callq 0x22a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7707
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/socket.c
// Function: socket_sendAllSync
size_t socket_sendAllSync(int sockfd, const char *buf, size_t size)
{
    size_t sent = 0;
    while (sent < size)
    {
        ssize_t n = send(sockfd, buf + sent, size - sent, 0);
        if (n == -1)
        {
            if (errno == EINTR)
            {
                continue;
            }
            else
            {
                perror("ERROR send");
                break;
            }
        }
        sent += n;
    }

    return sent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %r12d
xorl %ebx, %ebx
leaq 0x2e8e(%rip), %r13      # 0xa744
movq %r14, %rdx
subq %rbx, %rdx
jbe 0x78f5
leaq (%r15,%rbx), %rsi
movl %r12d, %edi
xorl %ecx, %ecx
callq 0x20f0
cmpq $-0x1, %rax
je 0x78d7
addq %rax, %rbx
jmp 0x78e1
callq 0x2050
cmpl $0x4, (%rax)
jne 0x78e9
xorl %eax, %eax
testb %al, %al
je 0x78b6
jmp 0x78f5
movq %r13, %rdi
callq 0x22a0
movb $0x1, %al
jmp 0x78e3
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_O1/goghcrow[P]dubbo_ab/socket.c
// Function: socket_recvAllSync
size_t socket_recvAllSync(int sockfd, char *buf, size_t size)
{
    size_t recved = 0;
    while (recved < size)
    {
        ssize_t n = recv(sockfd, buf + recved, size - recved, 0);
        if (n == -1)
        {
            if (errno == EINTR)
            {
                continue;
            }
            else
            {
                perror("ERROR recv");
                recved = -1;
                break;
            }
        }
        else if (n == 0)
        {
            break; // EOF
        }
        else
        {
            recved += n;
        }
    }

    return recved;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
xorl %r12d, %r12d
movq %rbx, %rdx
subq %r12, %rdx
jbe 0x796f
leaq (%r14,%r12), %rsi
movl %r15d, %edi
xorl %ecx, %ecx
callq 0x2040
movb $0x1, %r13b
testq %rax, %rax
je 0x796a
cmpq $-0x1, %rax
jne 0x7964
callq 0x2050
cmpl $0x4, (%rax)
je 0x7967
leaq 0x2df9(%rip), %rdi      # 0xa74f
callq 0x22a0
movq $-0x1, %r12
jmp 0x796a
addq %rax, %r12
xorl %r13d, %r13d
testb %r13b, %r13b
je 0x7921
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/sa.c
// Function: sa_create
union sockaddr_all
sa_create(uint16_t port, bool loopback_only)
{
    union sockaddr_all u;
    memset(&u, 0, sizeof(u));
    u.v4.sin_family = AF_INET;
    in_addr_t addr = loopback_only ? INADDR_LOOPBACK : INADDR_ANY;
    u.v4.sin_addr.s_addr = htonl(addr);
    u.v4.sin_port = htons(port);
    return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0xc(%rdi)
movw $0x2, (%rdi)
testl %edx, %edx
movl $0x7f000001, %ecx       # imm = 0x7F000001
cmovel %edx, %ecx
bswapl %ecx
movl %ecx, 0x4(%rdi)
rolw $0x8, %si
movw %si, 0x2(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/sa.c
// Function: sa_createV6
union sockaddr_all
sa_createV6(uint16_t port, bool loopback_only)
{
    union sockaddr_all u;
    memset(&u, 0, sizeof(u));
    u.v6.sin6_family = AF_INET6;
    u.v6.sin6_addr = loopback_only ? in6addr_loopback : in6addr_any;
    u.v6.sin6_port = htons(port);
    return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0xc(%rdi)
movw $0xa, (%rdi)
leaq 0x8(%rdi), %rcx
testl %edx, %edx
je 0x7a16
movq 0x85ac(%rip), %rdx      # 0xffc0
jmp 0x7a1d
movq 0x859b(%rip), %rdx      # 0xffb8
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
rolw $0x8, %si
movw %si, 0x2(%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/sa.c
// Function: sa_fromip
union sockaddr_all
sa_fromip(const char *ip, uint16_t port)
{
    union sockaddr_all u;
    memset(&u, 0, sizeof(u));
    u.v4.sin_family = AF_INET;
    if (inet_pton(AF_INET, ip, &(u.v4.sin_addr)) <= 0)
    {
        fprintf(stderr, "ERROR inet_pton %s", ip);
    }
    u.v4.sin_port = htons(port);
    return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0xc(%rdi)
movw $0x2, (%rdi)
leaq 0x4(%rdi), %rdx
movl $0x2, %edi
callq 0x2210
testl %eax, %eax
jle 0x7a77
rolw $0x8, %bx
movw %bx, 0x2(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x857a(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2dd7(%rip), %rsi      # 0xa85f
movq %r15, %rdx
xorl %eax, %eax
callq 0x21e0
jmp 0x7a60
// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/sa.c
// Function: sa_fromipV6
union sockaddr_all
sa_fromipV6(const char *ip, uint16_t port)
{
    union sockaddr_all u;
    memset(&u, 0, sizeof(u));
    u.v6.sin6_family = AF_INET6;
    if (inet_pton(AF_INET6, ip, &(u.v6.sin6_addr)) <= 0)
    {
        fprintf(stderr, "ERROR inet_pton %s", ip);
    }
    u.v6.sin6_port = htons(port);
    return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0xc(%rdi)
movw $0xa, (%rdi)
leaq 0x8(%rdi), %rdx
movl $0xa, %edi
callq 0x2210
testl %eax, %eax
jle 0x7ade
rolw $0x8, %bx
movw %bx, 0x2(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8513(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2d70(%rip), %rsi      # 0xa85f
movq %r15, %rdx
xorl %eax, %eax
callq 0x21e0
jmp 0x7ac7
// File: /workspace/github_c_makefile_star2_O1/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 0x7b40
movq %rsi, %rax
movq %rdi, %rsi
movzwl (%rdi), %ecx
cmpl $0xa, %ecx
je 0x7b29
cmpl $0x2, %ecx
jne 0x7b3f
addq $0x4, %rsi
movl $0x2, %edi
movq %rax, %rdx
movl $0x10, %ecx
jmp 0x2030
addq $0x8, %rsi
movl $0xa, %edi
movq %rax, %rdx
movl $0x2e, %ecx
jmp 0x2030
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x2d27(%rip), %rdi      # 0xa872
leaq 0x2d39(%rip), %rsi      # 0xa88b
leaq 0x2d37(%rip), %rcx      # 0xa890
movl $0x43, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/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 0x7bba
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
callq 0x7afb
movq %rbx, %rdi
callq 0x20d0
movl %r15d, %esi
subq %rax, %rsi
jbe 0x7bd9
movzwl 0x2(%r14), %ecx
rolw $0x8, %cx
addq %rax, %rbx
movzwl %cx, %ecx
leaq 0x2d59(%rip), %rdx      # 0xa8ff
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2110
leaq 0x2cb1(%rip), %rdi      # 0xa872
leaq 0x2cc3(%rip), %rsi      # 0xa88b
leaq 0x2cf1(%rip), %rcx      # 0xa8c0
movl $0x50, %edx
callq 0x2150
leaq 0x2d14(%rip), %rdi      # 0xa8f4
leaq 0x2ca4(%rip), %rsi      # 0xa88b
leaq 0x2cd2(%rip), %rcx      # 0xa8c0
movl $0x54, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/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 0x7cc4
movq %rsi, %rbx
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, %r14d
testl %eax, %eax
jne 0x7cba
cmpq $0x0, -0x18(%rbp)
jne 0x7c91
xorl %edi, %edi
callq 0x2380
movq -0x18(%rbp), %rdi
movzwl 0x4(%rdi), %eax
movw %ax, (%rbx)
movq 0x18(%rdi), %rax
movl 0x4(%rax), %eax
movl %eax, 0x4(%rbx)
callq 0x2380
testl %r14d, %r14d
sete %al
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %r14d, %edi
callq 0x244e
jmp 0x7cab
leaq 0x2c36(%rip), %rdi      # 0xa901
leaq 0x2bb9(%rip), %rsi      # 0xa88b
leaq 0x2c6d(%rip), %rcx      # 0xa946
movl $0x6a, %edx
callq 0x2150
nop
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
xorl %ebx, %ebx
testq %rdx, %rdx
je 0x7f58
movl %ebx, %eax
movzbl (%rsi,%rax), %eax
movl $0x1, %ecx
cmpl $0x81, %eax
jb 0x7f51
movl %eax, %r8d
andl $-0x20, %r8d
movl $0x2, %ecx
cmpl $0xc0, %r8d
je 0x7f51
movl %eax, %r8d
andl $-0x10, %r8d
movl $0x3, %ecx
cmpl $0xe0, %r8d
je 0x7f51
andl $-0x8, %eax
movl $0x4, %ecx
cmpl $0xf0, %eax
jne 0x7f6d
decq %rdx
addl %ecx, %ebx
jmp 0x7f01
testl %ebx, %ebx
je 0x7f64
movslq %ebx, %rdx
callq 0x2200
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7f64
// File: /workspace/github_c_makefile_star2_O1/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 0x7fb2
addb $-0x70, %dil
movb %dil, (%rsi)
movl $0x1, %eax
jmp 0x8006
leal 0x8c8(%rdi), %eax
cmpl $0x10c7, %eax           # imm = 0x10C7
ja 0x7fd4
movb %dil, 0x1(%rsi)
shrl $0x8, %edi
addb $-0x38, %dil
movb %dil, (%rsi)
movl $0x2, %eax
jmp 0x8006
leal 0x40000(%rdi), %eax
cmpl $0x7ffff, %eax          # imm = 0x7FFFF
ja 0x7ff9
movl %edi, %eax
shrl $0x10, %eax
addb $-0x2c, %al
movb %al, (%rsi)
rolw $0x8, %di
movw %di, 0x1(%rsi)
movl $0x3, %eax
jmp 0x8006
movb $0x49, (%rsi)
bswapl %edi
movl %edi, 0x1(%rsi)
movl $0x5, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x802d
addl $0xffffff70, %eax       # imm = 0xFFFFFF70
jmp 0x80ab
cmpq $0x2, %rsi
setae %cl
movl %eax, %r8d
andb $-0x10, %r8b
cmpb $-0x40, %r8b
sete %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x805c
shll $0x8, %eax
movzbl 0x1(%rdi), %ecx
addl %ecx, %eax
addl $0xffff3800, %eax       # imm = 0xFFFF3800
jmp 0x80ab
cmpq $0x3, %rsi
setae %cl
movl %eax, %r8d
andb $-0x8, %r8b
cmpb $-0x30, %r8b
sete %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x8094
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 0x80ab
cmpq $0x5, %rsi
setae %cl
cmpb $0x49, %al
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x80b1
movl 0x1(%rdi), %eax
bswapl %eax
movl %eax, (%rdx)
movb $0x1, %al
popq %rbp
retq
xorl %eax, %eax
jmp 0x80af
// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x8000, %eax           # imm = 0x8000
jg 0x8129
cmpl $0x1f, %eax
jg 0x80e7
movb %al, (%rbx)
movl $0x1, %r12d
jmp 0x8112
cmpl $0x3ff, %eax            # imm = 0x3FF
jg 0x8103
movl %eax, %ecx
shrl $0x8, %ecx
addb $0x30, %cl
movb %cl, (%rbx)
movb %al, 0x1(%rbx)
movl $0x2, %r12d
jmp 0x8112
movb $0x53, (%rbx)
movb %ah, 0x1(%rbx)
movb %al, 0x2(%rbx)
movl $0x3, %r12d
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_O1/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
movq %rdi, %r13
movw $0x0, -0x2a(%rbp)
movq $0x0, -0x38(%rbp)
movq %rsi, %rdi
callq 0x23a8
testq %rax, %rax
je 0x81b2
movq %rax, %r15
leaq -0x38(%rbp), %rcx
leaq -0x2a(%rbp), %r8
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x81c3
testb %al, %al
je 0x81aa
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 0x81b4
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_O1/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
cmpq $0x10001, %rsi          # imm = 0x10001
jb 0x8374
movl $0x10000, %r12d         # imm = 0x10000
movq %r14, %rdi
movl $0x62, %esi
callq 0x6a5e
movq %r14, %rdi
xorl %esi, %esi
callq 0x6a38
movl $0x10000, %edx          # imm = 0x10000
movq %r14, %rdi
movq %r15, %rsi
callq 0x6829
addq %r12, %r15
addq $-0x10000, %rbx         # imm = 0xFFFF0000
cmpq %r12, %rbx
ja 0x833e
movq %r14, %rdi
movl $0x42, %esi
callq 0x6a5e
movswl %bx, %esi
movq %r14, %rdi
callq 0x6a38
testq %rbx, %rbx
je 0x83a7
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6829
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6d52
movsbl %al, %r13d
movl %r13d, %eax
andb $-0x10, %al
cmpb $0x20, %al
jne 0x83eb
movswl %r13w, %r12d
addl $-0x20, %r12d
movq %r14, %rdi
callq 0x6720
jmp 0x8406
movl %r13d, %eax
andb $-0x4, %al
movq %r14, %rdi
cmpb $0x34, %al
jne 0x844e
callq 0x6ecd
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 0x84df
movq %rax, %r15
movq %r14, %rdi
callq 0x645d
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x2200
movq %r14, %rdi
movq %r12, %rsi
callq 0x6638
movb $0x1, %al
jmp 0x84e1
callq 0x6720
movq $0x10000, -0x30(%rbp)   # imm = 0x10000
movq $0x0, (%r15)
movl $0x10001, %edi          # imm = 0x10001
callq 0x23a8
movq %rax, (%rbx)
testq %rax, %rax
je 0x84df
leaq -0x30(%rbp), %r12
cmpw $0x41, %r13w
jne 0x84a2
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x850f
testb %al, %al
je 0x84d0
movq %r14, %rdi
callq 0x6ef4
movsbl %al, %r13d
jmp 0x8478
movzwl %r13w, %eax
cmpl $0x42, %eax
jne 0x84f0
leaq -0x30(%rbp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x850f
testb %al, %al
je 0x84d0
movq (%rbx), %rax
movq (%r15), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x8447
movq (%rbx), %rdi
callq 0x23a0
movq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24ae(%rip), %rdi      # 0xa9a5
leaq 0x247e(%rip), %rsi      # 0xa97c
leaq 0x24ab(%rip), %rcx      # 0xa9b0
movl $0x245, %edx            # imm = 0x245
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
callq 0x6ecd
movswq %ax, %r12
cmpq %r12, (%rbx)
jae 0x8558
movq (%r13), %rdi
movl $0x10001, %esi          # imm = 0x10001
addq (%r15), %rsi
callq 0x23b0
testq %rax, %rax
je 0x8597
movq %rax, (%r13)
movq $0x10000, (%rbx)        # imm = 0x10000
movq (%r13), %r13
addq (%r15), %r13
movq %r14, %rdi
callq 0x645d
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x2200
addq %r12, (%r15)
subq %r12, (%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x6638
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x8588
nop
// File: /workspace/github_c_makefile_star2_O1/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
testq %rdi, %rdi
je 0x85b3
callq 0x23a0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x85c1
callq 0x23a0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x85cf
callq 0x23a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0
// File: /workspace/github_c_makefile_star2_O1/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
testq %rdi, %rdi
je 0x87fd
callq 0x23a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23a0