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

```asm
<compress_location_positions>:
  endbr64
  movzbl (%rsi),%eax
  test   %al,%al
  js     L99
  ret
  nopl   0x0(%rax)
L99:
  push   %r15
  or     $0x10,%eax
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  mov    (%rdi),%r8
  mov    %al,(%rsi)
  lea    -0x1(%rdx),%eax
  mov    %eax,0xc(%rsp)
  test   %eax,%eax
  jle    L43
  movslq 0xc(%rsp),%rax
  shl    $0x2,%rax
  lea    -0x4(%rcx,%rax,1),%rdi
  lea    (%rcx,%rax,1),%rdx
  lea    -0x2(%rbx),%eax
  shl    $0x2,%rax
  sub    %rax,%rdi
  nopl   0x0(%rax,%rax,1)
L107:
  mov    (%rdx),%ecx
  mov    -0x4(%rdx),%esi
  mov    %ecx,%eax
  shr    $0x8,%esi
  movzbl %cl,%ecx
  shr    $0x8,%eax
  sub    %esi,%eax
  shl    $0x8,%eax
  or     %ecx,%eax
  mov    %eax,(%rdx)
  cmp    $0xfff,%eax
  jbe    L4
  andb   $0xef,0x0(%r13)
L4:
  sub    $0x4,%rdx
  cmp    %rdx,%rdi
  jne    L107
L43:
  mov    (%r14),%edi
  mov    %r8,%rsi
  shr    $0x8,%edi
  call   <compress3@plt>
  mov    %rax,%rsi
  movzbl 0x0(%r13),%eax
  test   $0x10,%al
  je     L55
  cmp    $0x1,%ebx
  jle    L58
  mov    0xc(%rsp),%r8d
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L137:
  mov    0x4(%r14,%rdx,4),%ecx
  mov    %edx,%eax
  sar    %eax
  shr    $0x8,%ecx
  cltq
  mov    %ecx,%edi
  add    %rsi,%rax
  shl    $0x4,%edi
  test   $0x1,%dl
  je     L149
  movzbl (%rax),%edi
  or     %ecx,%edi
L149:
  add    $0x1,%rdx
  mov    %dil,(%rax)
  cmp    %rdx,%r8
  jne    L137
  mov    %ebx,%eax
  sar    %eax
  cltq
  add    %rax,%rsi
  movzbl 0x0(%r13),%eax
L58:
  test   $0x60,%al
  jne    L87
  test   %ebx,%ebx
  jle    L87
L132:
  xor    %eax,%eax
  nopl   0x0(%rax)
L71:
  mov    (%r14,%rax,4),%edx
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%ebx
  jg     L71
  mov    0xc(%rsp),%r12d
  mov    $0x1,%eax
  add    $0x1,%r12
  test   %ebx,%ebx
  cmovle %rax,%r12
  add    %r12,%rsi
L87:
  mov    %rsi,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L55:
  cmp    $0x1,%ebx
  jle    L58
  lea    -0x2(%rbx),%eax
  lea    0x4(%r14),%r12
  lea    0x8(%r14,%rax,4),%r15
  nopl   0x0(%rax)
L5:
  mov    (%r12),%edi
  add    $0x4,%r12
  shr    $0x8,%edi
  call   <compress3@plt>
  mov    %rax,%rsi
  cmp    %r12,%r15
  jne    L5
  testb  $0x60,0x0(%r13)
  je     L132
  jmp    L87
```

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;
  }
}
```