// File: /workspace/github_c_makefile_star2_O0/goghcrow[P]dubbo_ab/dubbo_hessian.c
// Function: internal_decode_string
static bool internal_decode_string(const uint8_t *buf, size_t buf_length, uint8_t *out_str, size_t *out_length, short *is_last_chunk)
{
    uint8_t code = buf[0];
    size_t delta_length;
    short result;
    int sz;

    switch (code)
    {
    case 0x00:
    case 0x01:
    case 0x02:
    case 0x03:
    case 0x04:
    case 0x05:
    case 0x06:
    case 0x07:
    case 0x08:
    case 0x09:
    case 0x0a:
    case 0x0b:
    case 0x0c:
    case 0x0d:
    case 0x0e:
    case 0x0f:

    case 0x10:
    case 0x11:
    case 0x12:
    case 0x13:
    case 0x14:
    case 0x15:
    case 0x16:
    case 0x17:
    case 0x18:
    case 0x19:
    case 0x1a:
    case 0x1b:
    case 0x1c:
    case 0x1d:
    case 0x1e:
    case 0x1f:
        *is_last_chunk = 1;
        delta_length = code - 0x00;
        if (buf_length < 1 + delta_length)
        {
            return false;
        }
        sz = utf8cpy(out_str + *out_length, buf + 1, delta_length);
        if (sz == -1)
        {
            return false;
        }
        *out_length = *out_length + sz;
        return true;

    case 0x30:
    case 0x31:
    case 0x32:
    case 0x33:
        *is_last_chunk = 1;
        if (buf_length < 2)
        {
            return false;
        }
        delta_length = (code - 0x30) * 256 + buf[1];
        if (buf_length < 2 + delta_length)
        {
            return false;
        }
        sz = utf8cpy(out_str + *out_length, buf + 2, delta_length);
        if (sz == -1)
        {
            return false;
        }
        *out_length = *out_length + sz;
        return true;

    case 0x53:
        *is_last_chunk = 1;
        if (buf_length < 3)
        {
            return false;
        }
        delta_length = be16toh(*(uint16_t *)(buf + 1));
        if (buf_length < 3 + delta_length)
        {
            return false;
        }
        sz = utf8cpy(out_str + *out_length, buf + 3, delta_length);
        if (sz == -1)
        {
            return false;
        }
        *out_length = *out_length + sz;
        return true;

    case 0x52:
        *is_last_chunk = 0;
        if (buf_length < 3)
        {
            return false;
        }
        delta_length = be16toh(*(uint16_t *)(buf + 1));
        if (buf_length < 3 + delta_length)
        {
            return false;
        }
        sz = utf8cpy(out_str + *out_length, buf + 3, delta_length);
        if (sz == -1)
        {
            return false;
        }
        *out_length = *out_length + sz;
        while (!*is_last_chunk)
        {
            result = internal_decode_string(buf, buf_length, out_str, out_length, is_last_chunk);
            if (!result)
            {
                return false;
            }
        }
        break;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
movq %rax, -0x50(%rbp)
subq $0x53, %rax
ja 0xb700
movq -0x50(%rbp), %rax
leaq 0x47be(%rip), %rcx      # 0xfc40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movw $0x1, (%rax)
movzbl -0x31(%rbp), %eax
subl $0x0, %eax
cltq
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0xb4bb
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movq -0x40(%rbp), %rdx
callq 0xae80
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0xb4e9
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movslq -0x48(%rbp), %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xb704
movq -0x30(%rbp), %rax
movw $0x1, (%rax)
cmpq $0x2, -0x18(%rbp)
jae 0xb520
movb $0x0, -0x1(%rbp)
jmp 0xb704
movzbl -0x31(%rbp), %eax
subl $0x30, %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x2, %rcx
cmpq %rcx, %rax
jae 0xb554
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x2, %rsi
movq -0x40(%rbp), %rdx
callq 0xae80
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0xb582
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movslq -0x48(%rbp), %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xb704
movq -0x30(%rbp), %rax
movw $0x1, (%rax)
cmpq $0x3, -0x18(%rbp)
jae 0xb5b9
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x10(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0xb0c0
movzwl %ax, %eax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x3, %rcx
cmpq %rcx, %rax
jae 0xb5e7
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x3, %rsi
movq -0x40(%rbp), %rdx
callq 0xae80
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0xb615
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movslq -0x48(%rbp), %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xb704
movq -0x30(%rbp), %rax
movw $0x0, (%rax)
cmpq $0x3, -0x18(%rbp)
jae 0xb64c
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x10(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0xb0c0
movzwl %ax, %eax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x3, %rcx
cmpq %rcx, %rax
jae 0xb67a
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x3, %rsi
movq -0x40(%rbp), %rdx
callq 0xae80
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0xb6a5
movb $0x0, -0x1(%rbp)
jmp 0xb704
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movslq -0x48(%rbp), %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpw $0x0, (%rax)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xb6cd
jmp 0xb6fe
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0xb440
andb $0x1, %al
movzbl %al, %eax
movw %ax, -0x42(%rbp)
cmpw $0x0, -0x42(%rbp)
jne 0xb6fc
movb $0x0, -0x1(%rbp)
jmp 0xb704
jmp 0xb6ba
jmp 0xb700
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nop