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

```asm
<outhalves>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsi,%r13
  shr    $0x2,%r13
  je     L151
  and    $0xfffffffffffffffc,%rsi
  lea    -0x4(%rdi,%rsi,1),%rdx
L48:
  cmpl   $0x0,(%rdx)
  jne    L76
  add    $0x1,%rax
  sub    $0x4,%rdx
  cmp    %rax,%r13
  jne    L48
L6:
  lea    D47(%rip),%rdi
  call   <out@plt>
  jmp    L38
L76:
  cmp    %rax,%r13
  je     L6
  cmp    $0xfe,%rax
  jle    L147
  lea    0x0(,%rax,4),%rdx
  cmp    %r13,%rdx
  mov    $0x0,%edx
  cmovl  %rdx,%rax
L152:
  and    $0xfffffffffffffffc,%rax
  mov    %rax,%rbx
  sub    %rax,%r13
  test   %r13,%r13
  jle    L134
  mov    %r12,%rax
  lea    (%r12,%r13,4),%rsi
  mov    $0x0,%edx
L53:
  mov    (%rax),%ecx
  cmp    %ecx,%edx
  cmovb  %ecx,%edx
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L53
  cmp    $0xff,%edx
  jbe    L142
  mov    $0x1,%edi
  call   <beginblock@plt>
  lea    D7(%rip),%r14
L164:
  mov    $0x0,%ebp
L1:
  mov    (%r12,%rbp,4),%esi
  mov    %r14,%rdi
  call   <outf@plt>
  add    $0x1,%rbp
  cmp    %rbp,%r13
  jg     L1
L17:
  test   %rbx,%rbx
  jne    L10
L170:
  mov    $0x0,%eax
  call   <endblock@plt>
L38:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L50
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L147:
  mov    $0x0,%eax
  jmp    L152
L142:
  cmp    $0x63,%edx
  lea    D45(%rip),%r14
  lea    D28(%rip),%rax
  cmovbe %rax,%r14
  mov    $0x1,%edi
  call   <beginblock@plt>
  jmp    L164
L10:
  mov    %rsp,%rbp
  mov    %r14,%rdx
  lea    D38(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <strf@plt>
  mov    %eax,%edi
  call   <outcomment@plt>
  jmp    L170
L134:
  mov    $0x1,%edi
  call   <beginblock@plt>
  lea    D28(%rip),%r14
  jmp    L17
L151:
  test   %r13,%r13
  je     L6
  mov    $0x0,%eax
  jmp    L152
L50:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D47
type_infered: string
name: parse_data
arguments: label: D7
type_infered: string
name: parse_data
arguments: label: D45
type_infered: string
name: parse_data
arguments: label: D28
type_infered: string
name: parse_data
arguments: label: D38
type_infered: string

tool: D47: { 0 }

tool: D7: 0x%04X

tool: D45: 0x%02X

tool: D28: %u

tool: D38: %s x %%ld

assistant: ```c
void outhalves(void const *ptr, long size, int ndx) {
  Elf64_Half const *halves = ptr;
  long count = size / sizeof *halves;
  char fmtbuf[16];
  char const *fmt = NULL;
  unsigned int max;
  long zeroes, i;
  (void)ndx;
  for (zeroes = 0; zeroes < count; ++zeroes)
    if (halves[count - zeroes - 1])
      break;
  if (zeroes == count) {
    out("{ 0 }");
    return;
  }
  if (zeroes < 255 || zeroes * 4 < count)
    zeroes = 0;
  zeroes &= ~3;
  count -= zeroes;
  max = 0;
  for (i = 0; i < count; ++i) {
    if (max < halves[i])
      max = halves[i];
  }
  fmt = max > 0xFF ? "0x%04X" : max > 99 ? "0x%02X" : "%u";
  beginblock(1);
  for (i = 0; i < count; ++i)
    outf(fmt, halves[i]);
  if (zeroes) {
    sprintf(fmtbuf, "%s x %%ld", fmt);
    outcomment(strf(fmtbuf, 0, zeroes));
  }
  endblock();
}
```