// File: /workspace/github_c_makefile_star2_O2/goghcrow[P]dubbo_ab/dubbo_codec.c
// Function: dubbo_decode
struct dubbo_res *dubbo_decode(struct buffer *buf)
{
    struct dubbo_hdr hdr;
    memset(&hdr, 0, sizeof(hdr));

    if (!decode_res_hdr(buf, &hdr))
    {
        LOG_ERROR("failed to decode dubbo response");
        return NULL;
    }

    // 读取所有 body+attach
    // struct buffer *body_buf = buf_create(hdr.body_sz);
    // buf_append(body_buf, buf_peek(buf), hdr.body_sz);

    struct buffer *body_buf = buf_readonlyView(buf, hdr.body_sz);
    buf_retrieve(buf, hdr.body_sz);

    struct dubbo_res *res = calloc(1, sizeof(*res));
    assert(res);
    res->type = -1;
    res->reqid = hdr.reqid;

    bool ok = decode_res(body_buf, &hdr, res);
    buf_release(body_buf);

    if (ok)
    {
        return res;
    }
    else
    {
        free(res);
        return NULL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x7b49
testb %al, %al
je 0x79f8
movq %rbx, %rdi
callq 0x5bef
movq %rbx, %rdi
callq 0x5c11
movl %eax, %r15d
movq %rbx, %rdi
callq 0x5c11
movb %al, -0x29(%rbp)
movq %rbx, %rdi
callq 0x5bab
movq %rax, %r12
movq %rbx, %rdi
callq 0x5bcd
movl %eax, %r14d
cmpl $0x400001, %eax         # imm = 0x400001
jge 0x7971
movl %r15d, %eax
andb $0x1f, %al
cmpb $0x2, %al
jne 0x799b
testb %r15b, %r15b
js 0x79cc
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5f82
movq %rax, %r13
movslq %r14d, %rsi
movq %rbx, %rdi
callq 0x5459
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x21b0
testq %rax, %rax
je 0x7b2a
movq %rax, %rbx
orl $-0x1, 0xc(%rax)
movq %r12, (%rax)
shrb $0x5, %r15b
movl %r15d, %eax
andb $0x1, %al
movb %al, 0x8(%rbx)
movb -0x29(%rbp), %r14b
cmpb $0x14, %r14b
je 0x7838
movzbl %r14b, %eax
cmpl $0x5a, %eax
je 0x785c
cmpl $0x1f, %eax
je 0x7853
cmpl $0x28, %eax
je 0x781d
cmpl $0x32, %eax
je 0x782f
cmpl $0x3c, %eax
je 0x784a
cmpl $0x46, %eax
je 0x7841
cmpl $0x50, %eax
je 0x7826
cmpl $0x1e, %eax
jne 0x7865
leaq 0x2751(%rip), %rdi      # 0x9f6c
jmp 0x786c
leaq 0x2766(%rip), %rdi      # 0x9f8a
jmp 0x786c
leaq 0x2796(%rip), %rdi      # 0x9fc3
jmp 0x786c
leaq 0x2760(%rip), %rdi      # 0x9f96
jmp 0x786c
leaq 0x272a(%rip), %rdi      # 0x9f69
jmp 0x786c
leaq 0x276d(%rip), %rdi      # 0x9fb5
jmp 0x786c
leaq 0x2752(%rip), %rdi      # 0x9fa3
jmp 0x786c
leaq 0x2721(%rip), %rdi      # 0x9f7b
jmp 0x786c
leaq 0x276d(%rip), %rdi      # 0x9fd0
jmp 0x786c
leaq 0x2771(%rip), %rdi      # 0x9fdd
callq 0x2340
movq %rax, 0x10(%rbx)
cmpb $0x14, %r14b
jne 0x7905
movb $0x1, 0x9(%rbx)
testb $0x1, %r15b
jne 0x7964
movq %r13, %rdi
callq 0x5c11
movl %eax, %r15d
cmpb $-0x40, %al
jge 0x7a5f
cmpb $-0x6e, %r15b
je 0x7959
movzbl %r15b, %eax
cmpl $0x91, %eax
je 0x7946
cmpl $0x90, %eax
jne 0x7a8a
movq %r13, %rdi
callq 0x5283
movq %rax, %r12
movq %r13, %rdi
callq 0x5255
leaq 0x18(%rbx), %rdx
movq %rbx, %r14
addq $0x20, %r14
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rcx
callq 0x6df1
testb %al, %al
je 0x7afc
movq (%r14), %rsi
movq %r13, %rdi
callq 0x5459
jmp 0x7959
movq %r13, %rdi
callq 0x5283
movq %rax, %r15
movq %r13, %rdi
callq 0x5255
leaq 0x18(%rbx), %rdx
movq %rbx, %r14
addq $0x20, %r14
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rcx
callq 0x6df1
testb %al, %al
je 0x7a38
movq (%r14), %rsi
movq %r13, %rdi
callq 0x5459
jmp 0x7964
leaq 0x18(%rbx), %rsi
movq %rbx, %rdx
addq $0x20, %rdx
movq %r13, %rdi
callq 0x7058
addb $0x70, %r15b
movzbl %r15b, %eax
movl %eax, 0xc(%rbx)
movq %r13, %rdi
callq 0x51e9
jmp 0x7a26
movq 0x7680(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2457(%rip), %rsi      # 0x9dd9
leaq 0x2499(%rip), %rcx      # 0x9e22
leaq 0x21c1(%rip), %r8       # 0x9b51
movl %r14d, %edx
movl $0xbf, %r9d
jmp 0x79c3
movzbl %al, %edx
movq 0x7653(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2482(%rip), %rsi      # 0x9e31
leaq 0x246c(%rip), %rcx      # 0x9e22
leaq 0x2194(%rip), %r8       # 0x9b51
movl $0xc6, %r9d
xorl %eax, %eax
callq 0x21e0
jmp 0x79f8
movq 0x7625(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x24a1(%rip), %rsi      # 0x9e7e
leaq 0x243e(%rip), %rdx      # 0x9e22
leaq 0x2166(%rip), %rcx      # 0x9b51
movl $0xd2, %r8d
xorl %eax, %eax
callq 0x21e0
movq 0x75f9(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x220a(%rip), %rsi      # 0x9c13
leaq 0x224c(%rip), %rdx      # 0x9c5c
leaq 0x213a(%rip), %rcx      # 0x9b51
xorl %ebx, %ebx
movl $0x1c4, %r8d            # imm = 0x1C4
xorl %eax, %eax
callq 0x21e0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x75b9(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x24d7(%rip), %rsi      # 0x9f20
leaq 0x24c5(%rip), %rdx      # 0x9f15
leaq 0x20fa(%rip), %rcx      # 0x9b51
movl $0x174, %r8d            # imm = 0x174
jmp 0x7ade
movzbl %r15b, %edx
movq 0x758e(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2571(%rip), %rsi      # 0x9fe5
leaq 0x25b2(%rip), %rcx      # 0xa02d
leaq 0x20cf(%rip), %r8       # 0x9b51
movl $0x107, %r9d            # imm = 0x107
jmp 0x7ab2
movq 0x7567(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movl 0xc(%rbx), %edx
leaq 0x259f(%rip), %rsi      # 0xa03d
leaq 0x2588(%rip), %rcx      # 0xa02d
leaq 0x20a5(%rip), %r8       # 0x9b51
movl $0x11b, %r9d            # imm = 0x11B
xorl %eax, %eax
callq 0x21e0
movq 0x7538(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2403(%rip), %rsi      # 0x9ecd
leaq 0x2444(%rip), %rdx      # 0x9f15
leaq 0x2079(%rip), %rcx      # 0x9b51
movl $0x16c, %r8d            # imm = 0x16C
xorl %eax, %eax
callq 0x21e0
movq %r13, %rdi
callq 0x51e9
movq %rbx, %rdi
callq 0x23a0
xorl %ebx, %ebx
jmp 0x7a26
movq 0x74f5(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x2413(%rip), %rsi      # 0x9f20
leaq 0x2519(%rip), %rdx      # 0xa02d
leaq 0x2036(%rip), %rcx      # 0x9b51
movl $0x111, %r8d            # imm = 0x111
xorl %eax, %eax
callq 0x21e0
jmp 0x7ab9
leaq 0x23eb(%rip), %rdi      # 0x9f1c
leaq 0x2019(%rip), %rsi      # 0x9b51
leaq 0x212a(%rip), %rcx      # 0x9c69
movl $0x1d0, %edx            # imm = 0x1D0
callq 0x2150