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

```asm
<lznt1_block>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    %rsi,%rdx
  je     L96
  mov    %rdx,%rsi
  mov    %rcx,%r9
  mov    %rdi,%r12
  xor    %r10d,%r10d
  xor    %r8d,%r8d
  mov    $0x10,%edx
  mov    $0xc,%ecx
  xor    %eax,%eax
  mov    $0x1,%r14d
  nop
L46:
  test   %r8d,%r8d
  jne    L15
  mov    (%r12,%rsi,1),%r10d
  add    $0x1,%rsi
  cmp    %rsi,%rbp
  je     L71
L15:
  test   $0x1,%r10b
  je     L95
  lea    0x4(%rsi),%rbx
  cmp    %rbp,%rbx
  ja     L122
  mov    %r14d,%r15d
  mov    (%r12,%rsi,1),%edi
  mov    %rbx,%rsi
  shl    %cl,%r15d
  sub    $0x1,%r15d
  and    %edi,%r15d
  lea    0x3(%r15),%r11d
  movslq %r11d,%r11
  add    %r11,%rax
  test   %r9,%r9
  jne    L44
L105:
  mov    %edx,%edi
  cmp    %rdi,%rax
  jbe    L69
  nop
L28:
  lea    (%rdx,%rdx,1),%edi
  sub    $0x1,%ecx
  mov    %rdi,%rdx
  cmp    %rax,%rdi
  jb     L28
L69:
  add    $0x1,%r8d
  shr    %r10d
  and    $0x7,%r8d
  cmp    %rsi,%rbp
  jne    L46
L71:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L95:
  test   %r9,%r9
  je     L130
  mov    (%r12,%rsi,1),%edi
  add    $0x4,%r9
  mov    %edi,-0x4(%r9)
L130:
  add    $0x1,%rsi
  add    $0x1,%rax
  jmp    L105
  nopl   0x0(%rax,%rax,1)
L44:
  sar    %cl,%edi
  mov    $0xfffffffffffffffc,%r13
  movslq %edi,%rdi
  shl    $0x2,%rdi
  sub    %rdi,%r13
  add    %r9,%r13
  test   %r11,%r11
  je     L105
  movslq %r15d,%r15
  xor    %esi,%esi
  add    $0x3,%r15
  nopl   0x0(%rax)
L123:
  mov    0x0(%r13,%rsi,4),%edi
  mov    %edi,(%r9,%rsi,4)
  add    $0x1,%rsi
  cmp    %r15,%rsi
  jne    L123
  lea    (%r9,%r11,4),%r9
  mov    %rbx,%rsi
  jmp    L105
L122:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L96:
  xor    %eax,%eax
  jmp    L71
```

tool_calls: name: unpack_data
arguments: tag: D2
data_type: string

tool: D2: LZNT1 compressed value overrun at %#zx


assistant: ```c
ssize_t lznt1_block(const void *data, size_t limit, size_t offset, void *block) {
  const uint16_t *tuple;
  const uint8_t *copy_src;
  uint8_t *copy_dest = block;
  size_t copy_len;
  size_t block_out_len = 0;
  unsigned int split = 12;
  unsigned int next_threshold = 16;
  unsigned int tag_bit = 0;
  unsigned int tag = 0;
  while (offset != limit) {
    if (tag_bit == 0) {
      tag = *((uint8_t *)(data + offset));
      offset++;
      if (offset == limit)
        break;
    }
    if (tag & 1) {
      if (offset + sizeof(*tuple) > limit) {
        do {
          if (1 & 1) {
            printf("LZNT1 compressed value overrun at "
                   "%#zx\n",
                   offset);
          }
        } while (0);
        return -1;
      }
      tuple = (data + offset);
      offset += sizeof(*tuple);
      copy_len = (((*tuple) & ((1 << (split)) - 1)) + 3);
      block_out_len += copy_len;
      if (copy_dest) {
        copy_src = (copy_dest - (((*tuple) >> split) + 1));
        while (copy_len--)
          *(copy_dest++) = *(copy_src++);
      }
    } else {
      copy_src = (data + offset);
      if (copy_dest)
        *(copy_dest++) = *copy_src;
      offset++;
      block_out_len++;
    }
    while (block_out_len > next_threshold) {
      split--;
      next_threshold <<= 1;
    }
    tag >>= 1;
    tag_bit = ((tag_bit + 1) % 8);
  }
  return block_out_len;
}
```