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

```asm
<unpack_c>:
  endbr64
  push   %r15
  mov    %rdx,%rax
  lea    -0x1(%r9),%r15d
  mov    $0xffffffff,%r9d
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,-0x4(%rsp)
  mov    $0x80000000,%esi
  test   %edi,%edi
  jne    L128
L354:
  lea    0x4(%rax),%rdi
  mov    (%rax),%eax
  lea    0x4(%r13),%rdx
  sub    $0x1,%r15d
  mov    %eax,0x0(%r13)
L345:
  test   %r15d,%r15d
  js     L347
  mov    -0x4(%rsp),%eax
  mov    %rdx,%r13
  mov    %esi,%ecx
  mov    $0xffffffff,%edx
  lea    -0x1(%rax),%r12d
  xchg   %ax,%ax
L189:
  test   $0x7fffffff,%ecx
  je     L2
  lea    (%rcx,%rcx,1),%esi
  mov    %rdi,%rbx
  test   %ecx,%ecx
  jns    L291
L77:
  cmp    $0xffffffff,%edx
  jne    L149
  test   $0x7fffffff,%esi
  je     L313
  mov    %esi,%eax
  add    %esi,%esi
L41:
  test   %eax,%eax
  js     L149
  mov    %r13,%rax
  mov    $0x1,%r11d
  sub    %r8,%rax
  sar    $0x2,%rax
  mov    %eax,%edx
  test   $0x7fffffff,%esi
  je     L167
L143:
  lea    (%rsi,%rsi,1),%eax
  test   %esi,%esi
  js     L61
L272:
  test   $0x7fffffff,%eax
  je     L65
  lea    (%rax,%rax,1),%ecx
  mov    %rbx,%rdi
L377:
  sar    $0x1f,%eax
  lea    (%rax,%r11,1),%r10d
L166:
  lea    (%r9,%rdx,1),%eax
  sub    %r10d,%r15d
  mov    %r13,%rsi
  lea    (%r10,%rax,1),%r11d
  nopw   0x0(%rax,%rax,1)
L137:
  mov    %eax,%edx
  add    $0x1,%eax
  add    $0x4,%rsi
  and    %r12d,%edx
  movslq %edx,%rdx
  mov    (%r8,%rdx,4),%edx
  mov    %edx,-0x4(%rsi)
  cmp    %r11d,%eax
  jne    L137
  lea    -0x1(%r10),%eax
  xor    %edx,%edx
  lea    0x4(%r13,%rax,4),%r13
  test   %r15d,%r15d
  jns    L189
L347:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L149:
  mov    %r13,%r10
  movslq (%rbx),%rdi
  lea    0x4(%rbx),%r14
  sub    %r8,%r10
  sar    $0x2,%r10
  mov    %r10d,%edx
  add    %ebp,%r10d
  cmp    $0x61a80,%r10d
  jg     L418
  cmp    $0x1c4,%r10d
  jle    L349
  mov    $0x3c,%eax
L76:
  mov    $0x200,%r9d
  xor    %r11d,%r11d
L173:
  mov    %esi,%ecx
  movslq %eax,%rbx
  and    $0x7fffffff,%ecx
  cmp    %rdi,%rbx
  jg     L98
L123:
  sub    %eax,%r11d
  add    %eax,%r10d
  lea    (%rax,%rax,1),%ebx
  test   %ecx,%ecx
  je     L105
  mov    %esi,%ecx
  add    %esi,%esi
L184:
  sar    $0x1f,%ecx
  cmp    $0x1,%ecx
  mov    %rdi,%rcx
  adc    $0xffffffffffffffff,%rcx
  add    %r9d,%r9d
  add    %rcx,%rdi
  lea    (%r10,%rbx,1),%ecx
  cmp    %r9d,%ecx
  jle    L251
  test   $0x5ffc00,%r9d
  je     L124
  lea    (%rax,%rax,8),%eax
  mov    %esi,%ecx
  add    %eax,%eax
  and    $0x7fffffff,%ecx
  sar    $0x3,%eax
  movslq %eax,%rbx
  cmp    %rdi,%rbx
  jle    L123
L98:
  mov    %r14,%rbx
L226:
  lea    (%r11,%rdi,1),%r9d
  mov    $0x2,%r11d
  lea    0x1(%r9),%eax
  cmp    $0x1517,%eax
  jle    L309
  xor    %r11d,%r11d
  cmp    $0x60000,%eax
  setge  %r11b
  add    $0x3,%r11d
L309:
  not    %r9d
  test   $0x7fffffff,%esi
  jne    L143
L167:
  mov    (%rbx),%esi
  add    $0x10,%rbx
  lea    0x1(%rsi,%rsi,1),%eax
  test   %esi,%esi
  jns    L272
L61:
  mov    %eax,%ecx
  add    $0x2,%r11d
  mov    %rbx,%rdi
  xor    %eax,%eax
  jmp    L205
  nop
L380:
  lea    (%rcx,%rcx,1),%esi
  mov    %rdi,%r10
L114:
  sar    $0x1f,%ecx
  cmp    $0x1,%ecx
  mov    %rax,%rcx
  adc    $0xffffffffffffffff,%rcx
  add    %rcx,%rax
  test   $0x7fffffff,%esi
  je     L336
  lea    (%rsi,%rsi,1),%ecx
  mov    %r10,%rdi
  test   %esi,%esi
  jns    L206
L329:
  add    $0x1,%rax
L205:
  test   $0x7fffffff,%ecx
  jne    L380
  mov    (%rdi),%ecx
  lea    0x10(%rdi),%r10
  lea    0x1(%rcx,%rcx,1),%esi
  jmp    L114
L105:
  mov    (%r14),%ecx
  add    $0x10,%r14
  lea    0x1(%rcx,%rcx,1),%esi
  jmp    L184
L124:
  mov    %ebx,%eax
  jmp    L173
  nopw   0x0(%rax,%rax,1)
L2:
  mov    (%rdi),%ecx
  lea    0x10(%rdi),%rbx
  lea    0x1(%rcx,%rcx,1),%esi
  test   %ecx,%ecx
  js     L77
L291:
  mov    %rbx,%rax
  jmp    L354
  nopw   0x0(%rax,%rax,1)
L65:
  mov    (%rbx),%eax
  lea    0x10(%rbx),%rdi
  lea    0x1(%rax,%rax,1),%ecx
  jmp    L377
  nop
L336:
  mov    (%r10),%esi
  lea    0x10(%r10),%rdi
  lea    0x1(%rsi,%rsi,1),%ecx
  test   %esi,%esi
  js     L329
L206:
  lea    (%r11,%rax,1),%r10d
  jmp    L166
  nopl   0x0(%rax,%rax,1)
L418:
  mov    $0x32,%eax
  jmp    L76
  nopw   0x0(%rax,%rax,1)
L313:
  mov    (%rbx),%eax
  add    $0x10,%rbx
  lea    0x1(%rax,%rax,1),%esi
  jmp    L41
  nop
L251:
  mov    %r14,%rbx
L207:
  sub    %r10d,%r9d
  movslq %r9d,%r9
  cmp    %rdi,%r9
  jg     L226
  test   $0x7fffffff,%esi
  je     L116
  mov    %esi,%eax
  add    %esi,%esi
L32:
  sar    $0x1f,%eax
  cmp    $0x1,%eax
  mov    %rdi,%rax
  adc    $0xffffffffffffffff,%rax
  add    %rdi,%rax
  sub    %r9,%rax
  mov    %rax,%rdi
  jmp    L226
  nopl   0x0(%rax)
L128:
  mov    %rcx,%rdx
  mov    %rax,%rdi
  sub    %r8,%rdx
  sar    $0x2,%rdx
  sub    %edx,%ebp
  mov    %rcx,%rdx
  jmp    L345
L116:
  mov    (%r14),%eax
  lea    0x10(%r14),%rbx
  lea    0x1(%rax,%rax,1),%esi
  jmp    L32
L349:
  mov    %r14,%rbx
  xor    %r11d,%r11d
  mov    $0x200,%r9d
  jmp    L207
```

assistant: ```c
void unpack_c(int current_history_size, int history_size, uint8_t *src, uint8_t *dst, uint8_t *start, int left) {
  int ofs = -1;
  int len;
  uint32_t bits = 0x80000000;
  uint32_t resbits;
  left--;
  history_size--;
  if (current_history_size) {
    current_history_size -= dst - start;
    goto nextblock;
  }
copyletter:
  *dst++ = *src++;
  left--;
nextblock:
  len = -1;
get_bit:
  if (left < 0)
    return;
  if (((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31) == 0)
    goto copyletter;
  if (len < 0) {
    len = 1;
    if (!((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31)) {
      goto uselastofs;
    }
  }
  len = 2;
  {
    int total = (dst - start + current_history_size);
    ofs = 0;
    long int res = 0;
    int x = 256;
    int top = 0;
    top = ((total <= 400000) ? 60 : 50);
    res = *src++;
    while (1) {
      x += x;
      if (x >= total + top)
        break;
      if (x & 0x002FFe00 * 2)
        top = ((9 * top) >> 3);
      if (res < top) {
        goto getcode_doneit;
      }
      ofs -= top;
      total += top;
      top += top;
      res += res + ((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31);
    }
    x -= total;
    if (res >= x) {
      res += res + ((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31);
      res -= x;
    }
  getcode_doneit:
    ofs += res;
  };
  ofs++;
  if (ofs >= 5400)
    len++;
  if (ofs >= 0x060000)
    len++;
  ofs = -ofs;
uselastofs : {
  long int res = 0;
  if (((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31) == 0) {
    len += ((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31);
    goto getlen_0bit;
  }
  len += 2;
  while (1) {
    res += res + ((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31);
    if (((bits = bits & 0x7fffffff ? (resbits = bits, bits + bits) : (src += 4, resbits = *((uint32_t *)(src - 4)), (resbits << 1) + 1)), resbits >> 31) == 0)
      break;
    res++;
  }
  len += res;
getlen_0bit:;
};
  left -= len;
  int ptr = dst - start + ofs;
  do {
    *dst = start[ptr & (history_size)];
    ptr++;
    dst++;
  } while (--len);
  goto get_bit;
}
```