// File: /workspace/github_c_makefile_star2_O0/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_decode_resp
static bool cli_decode_resp(struct dubbo_client *cli)
{
    struct buffer *buf = cli->rcv_buf;
    struct dubbo_res *res = dubbo_decode(buf);
    if (res == NULL)
    {
        return false;
    }

    if (res->ok)
    {
        cli->ok_n++;
    }
    else
    {
        cli->ok_n++;
    }

    if (cli->verbos)
    {
        if (res->is_evt)
        {
            printf("<res seq=%" PRId64 "> [EVT]", res->reqid);
        }
        else if (res->data_sz)
        {
            // 返回 json, 不应该有 NULL 存在, 且非 NULL 结尾
            char *json = malloc(res->data_sz + 1);
            assert(json);
            memcpy(json, res->data, res->data_sz);
            json[res->data_sz] = '\0';

            cJSON *resp = NULL;
            if ((json[0] == '[' || json[0] == '{') && (resp = cJSON_Parse(json)))
            {
                if (res->ok)
                {
                    printf("<res seq=%" PRId64 "> [\x1B[1;32mSUCC\x1B[0m] %s\n", res->reqid, cJSON_Print(resp));
                }
                else
                {
                    printf("<res seq=%" PRId64 "> [\x1B[1;31mFAIL\x1B[0m] [\x1B[1;31m%s\x1B[0m] %s\n", res->reqid, res->desc, cJSON_Print(resp));
                }
                cJSON_Delete(resp);
            }
            else
            {
                if (res->ok)
                {
                    printf("<res seq=%" PRId64 "> [\x1B[1;32mSUCC\x1B[0m] %s\n", res->reqid, json);
                }
                else
                {
                    printf("<res seq=%" PRId64 "> [\x1B[1;31mFAIL\x1B[0m] %s\n", res->reqid, json);
                }
            }
            free(json);
        }
        else if (res->data_sz == 0)
        {
            printf("<res seq=%" PRId64 "> [\x1B[1;32mSUCC\x1B[0m] NULL\n", res->reqid);
        }
    }

    dubbo_res_release(res);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc000
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xd8d5
movb $0x0, -0x1(%rbp)
jmp 0xdad0
movq -0x20(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0xd8ee
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
jmp 0xd8fb
movq -0x10(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rax
testb $0x1, 0x6e(%rax)
je 0xdac3
movq -0x20(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0xd92d
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x2e11(%rip), %rdi      # 0x10732
movb $0x0, %al
callq 0x2120
jmp 0xdac1
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xda9d
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
addq $0x1, %rdi
callq 0x23f8
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xd95a
jmp 0xd979
leaq 0x2bf8(%rip), %rdi      # 0x10559
leaq 0x2b72(%rip), %rsi      # 0x104da
movl $0x1f4, %edx            # imm = 0x1F4
leaq 0x2dd2(%rip), %rcx      # 0x10746
callq 0x2170
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
je 0xd9c6
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0xda52
movq -0x28(%rbp), %rdi
callq 0x4210
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xda52
movq -0x20(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0xda0e
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4240
movq -0x38(%rbp), %rsi
movq %rax, %rdx
leaq 0x2d6e(%rip), %rdi      # 0x10773
movb $0x0, %al
callq 0x2120
jmp 0xda47
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4240
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rax, %rcx
leaq 0x2d57(%rip), %rdi      # 0x10797
movb $0x0, %al
callq 0x2120
movq -0x30(%rbp), %rdi
callq 0x3b30
jmp 0xda92
movq -0x20(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0xda77
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rdx
leaq 0x2d05(%rip), %rdi      # 0x10773
movb $0x0, %al
callq 0x2120
jmp 0xda90
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rdx
leaq 0x2d42(%rip), %rdi      # 0x107cb
movb $0x0, %al
callq 0x2120
jmp 0xda92
movq -0x28(%rbp), %rdi
callq 0x23f0
jmp 0xdabf
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xdabd
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x2d39(%rip), %rdi      # 0x107ef
movb $0x0, %al
callq 0x2120
jmp 0xdabf
jmp 0xdac1
jmp 0xdac3
movq -0x20(%rbp), %rdi
callq 0xbac0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)