user: 请将以下的汇编代码转换成C语言代码:

```asm
<pmt_decode_group>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdx,(%rsp)
  mov    %ecx,0xc(%rsp)
  movslq %esi,%rbp
  test   %rbp,%rbp
  jle    L114
  mov    %rdi,%r12
  mov    %rdx,%rdi
  mov    %r12,%rbx
  movslq %ecx,%r15
  jmp    L32
L130:
  lea    D48(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L51
L119:
  lea    D28(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L51
L148:
  lea    0x4(%rbx),%r13
  mov    %r13,%rax
  sub    %r12,%rax
  sar    $0x2,%rax
  cmp    %rbp,%rax
  jg     L29
  movslq %edx,%rbx
  shl    $0x2,%rbx
  lea    (%rdi,%rbx,1),%r14
  mov    %r14,%rax
  sub    (%rsp),%rax
  sar    $0x2,%rax
  cmp    %r15,%rax
  jg     L97
  mov    %r13,%rsi
  call   <memcpy@plt>
  add    %r13,%rbx
  mov    %r14,%rdi
L125:
  mov    %rbx,%rax
  sub    %r12,%rax
  sar    $0x2,%rax
  cmp    %rbp,%rax
  jge    L104
L32:
  mov    (%rbx),%edx
  test   $0x80,%dl
  je     L148
  and    $0x7f,%edx
  lea    0x4(%rbx),%rax
  sub    %r12,%rax
  sar    $0x2,%rax
  cmp    %rbp,%rax
  jg     L130
  movslq %edx,%rax
  lea    (%rdi,%rax,4),%r13
  mov    %r13,%rax
  sub    (%rsp),%rax
  sar    $0x2,%rax
  cmp    %r15,%rax
  jg     L119
  mov    0x4(%rbx),%esi
  call   <memset@plt>
  add    $0x8,%rbx
  mov    %r13,%rdi
  jmp    L125
L29:
  lea    D48(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L51
L97:
  lea    D28(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L51
L114:
  mov    (%rsp),%rdi
L104:
  sub    (%rsp),%rdi
  sar    $0x2,%rdi
  mov    %edi,%esi
  cmp    0xc(%rsp),%edi
  jne    L140
  mov    0xc(%rsp),%eax
L51:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L140:
  mov    0xc(%rsp),%edx
  lea    D27(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L51
```

tool_calls: name: parse_data
arguments: label: D48
type_infered: string
name: parse_data
arguments: label: D28
type_infered: string
name: parse_data
arguments: label: D27
type_infered: string

tool: D48: ERROR: attempted to read past end of input data.

tool: D28: ERROR: attempted to write past end of output buffer.

tool: D27: ERROR: decoded %d bytes, expected %d


assistant: ```c
int pmt_decode_group(uint8_t *raw_group_buf, int raw_group_size, uint8_t *decoded_group_buf, int decoded_group_buf_size) {
  uint8_t *src = raw_group_buf;
  uint8_t *dst = decoded_group_buf;
  while ((src - raw_group_buf) < raw_group_size) {
    if (*src & 0x80) {
      uint8_t run_length = *src & 0x7f;
      src++;
      if ((src - raw_group_buf) > raw_group_size) {
        printf("ERROR: attempted to read past end of input data.\n");
        return -1;
      }
      if ((dst + run_length - decoded_group_buf) > decoded_group_buf_size) {
        printf("ERROR: attempted to write past end of output buffer.\n");
        return -1;
      }
      memset(dst, *src, run_length);
      src++;
      dst += run_length;
    } else {
      uint8_t copy_count = *src;
      src++;
      if ((src - raw_group_buf) > raw_group_size) {
        printf("ERROR: attempted to read past end of input data.\n");
        return -1;
      }
      if ((dst + copy_count - decoded_group_buf) > decoded_group_buf_size) {
        printf("ERROR: attempted to write past end of output buffer.\n");
        return -1;
      }
      memcpy(dst, src, copy_count);
      src += copy_count;
      dst += copy_count;
    }
  }
  int decoded_bytes = dst - decoded_group_buf;
  if (decoded_bytes != decoded_group_buf_size) {
    printf("ERROR: decoded %d bytes, expected %d\n", decoded_bytes, decoded_group_buf_size);
    return -1;
  } else {
    return decoded_bytes;
  }
}
```