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

```asm
<compress_location_positions>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L25
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  or     $0x10,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L87
L36:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movzbl %al,%edx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x30(%rbp),%rax
  add    %rsi,%rax
  or     %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  cmp    $0xf,%eax
  jle    L49
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  and    $0xffffffef,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
L49:
  subl   $0x1,-0x10(%rbp)
L87:
  cmpl   $0x0,-0x10(%rbp)
  jg     L36
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <compress3@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x10,%eax
  test   %eax,%eax
  je     L85
  movl   $0x1,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L39
L111:
  mov    -0xc(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L121
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%ecx
  mov    -0x10(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rsi
  mov    -0x30(%rbp),%rdx
  add    %rsi,%rdx
  mov    (%rdx),%edx
  shr    $0x8,%edx
  mov    %edx,%esi
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  or     %esi,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L69
L121:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  mov    %eax,%ecx
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  shl    $0x4,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
L69:
  addl   $0x1,-0x10(%rbp)
  addl   $0x1,-0xc(%rbp)
L39:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L111
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  add    %rax,-0x8(%rbp)
  jmp    L20
L85:
  movl   $0x1,-0x10(%rbp)
  jmp    L6
L70:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shr    $0x8,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <compress3@plt>
  mov    %rax,-0x8(%rbp)
  addl   $0x1,-0x10(%rbp)
L6:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L70
L20:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x60,%eax
  test   %eax,%eax
  jne    L79
  movl   $0x0,-0x10(%rbp)
  jmp    L146
L0:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x10(%rbp)
L146:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L0
L79:
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
L25:
  nop
  leave
  ret
```

assistant: ```c
void compress_location_positions(unsigned char **buf, unsigned char *flag, int frequency, unsigned int *posdata) {
  unsigned char *p = *buf;
  int i, j;
  if ((*flag) & 0x80) {
    (*flag) |= 0x10;
    for (i = frequency - 1; i > 0; i--) {
      posdata[i] = ((unsigned int)((unsigned int)(((int)((unsigned int)(posdata[i]) >> (unsigned int)8)) - ((int)((unsigned int)(posdata[i - 1]) >> (unsigned int)8))) << (unsigned int)8 | (unsigned int)(((int)((unsigned int)(posdata[i]) & (unsigned int)0xff)))));
      if (((int)((unsigned int)(posdata[i]) >> (unsigned int)8)) >= 16)
        (*flag) &= ~0x10;
    }
    p = compress3(((int)((unsigned int)(posdata[0]) >> (unsigned int)8)), p);
    if ((*flag) & 0x10) {
      for (i = 1, j = 0; i < frequency; i++, j++) {
        if (j % 2)
          p[j / 2] |= (unsigned char)((int)((unsigned int)(posdata[i]) >> (unsigned int)8));
        else
          p[j / 2] = (unsigned char)((int)((unsigned int)(posdata[i]) >> (unsigned int)8)) << 4;
      }
      p += ((j + 1) / 2);
    } else {
      for (i = 1; i < frequency; i++)
        p = compress3(((int)((unsigned int)(posdata[i]) >> (unsigned int)8)), p);
    }
    if (!(*flag & 0x60))
      for (i = 0; i < frequency; i++)
        *p++ = (unsigned char)((int)((unsigned int)(posdata[i]) & (unsigned int)0xff));
    *buf = p;
  }
}
```