user: What would the C source look like for the assembly code provided here?

```asm
<outhalves>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  shr    $0x2,%rsi
  je     L140
  mov    %rdi,%r13
  mov    %rsi,%rbp
  lea    -0x4(%rdi,%rsi,4),%rdx
  jmp    L89
  nopw   0x0(%rax,%rax,1)
L106:
  add    $0x1,%rax
  sub    $0x4,%rdx
  cmp    %rax,%rsi
  je     L140
L89:
  mov    (%rdx),%ecx
  test   %ecx,%ecx
  je     L106
  cmp    $0xfe,%rax
  jle    L46
  lea    0x0(,%rax,4),%rdx
  cmp    %rsi,%rdx
  jl     L46
  and    $0xfffffffffffffffc,%rax
  sub    %rax,%rsi
  mov    %rax,%r12
  mov    %rsi,%rbp
  test   %rsi,%rsi
  jg     L159
  mov    $0x1,%edi
  lea    D27(%rip),%r14
  call   <beginblock@plt>
L20:
  mov    %rsp,%rbp
  mov    %r14,%rdx
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  mov    %r12,%rdx
  xor    %esi,%esi
  call   <strf@plt>
  mov    %eax,%edi
  call   <outcomment@plt>
  jmp    L77
  nopw   0x0(%rax,%rax,1)
L46:
  xor    %r12d,%r12d
L159:
  xor    %eax,%eax
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L45:
  mov    0x0(%r13,%rax,4),%ecx
  cmp    %ecx,%edx
  cmovb  %ecx,%edx
  add    $0x1,%rax
  cmp    %rbp,%rax
  jl     L45
  cmp    $0xff,%edx
  jbe    L71
  lea    D18(%rip),%r14
L68:
  mov    $0x1,%edi
  call   <beginblock@plt>
L39:
  xor    %ebx,%ebx
  xchg   %ax,%ax
L70:
  mov    0x0(%r13,%rbx,4),%esi
  mov    %r14,%rdi
  add    $0x1,%rbx
  call   <outf@plt>
  cmp    %rbp,%rbx
  jl     L70
  test   %r12,%r12
  jne    L20
L77:
  xor    %eax,%eax
  call   <endblock@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L123
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L71:
  lea    D33(%rip),%r14
  cmp    $0x63,%edx
  ja     L68
  mov    $0x1,%edi
  lea    D27(%rip),%r14
  call   <beginblock@plt>
  jmp    L39
  nopw   0x0(%rax,%rax,1)
L140:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L123
  add    $0x20,%rsp
  lea    D19(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1130 <out@plt>
L123:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D27
type: string
name: extract_symbolic_data
arguments: tag: D34
type: string
name: extract_symbolic_data
arguments: tag: D18
type: string
name: extract_symbolic_data
arguments: tag: D33
type: string
name: extract_symbolic_data
arguments: tag: D19
type: string

tool: D27: %u

tool: D34: %s x %%ld

tool: D18: 0x%04X

tool: D33: 0x%02X

tool: D19: { 0 }

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