user: Please show me the C implementation that matches the assembly code listed below:

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rsi
  movq   $0x8,-0x80(%rbp)
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x78(%rbp)
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0xb0(%rbp)
  movq   $0x0,-0xa8(%rbp)
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rcx
  mov    $0x0,%ebx
  mov    -0x80(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L92:
  cmp    %rdx,%rsp
  je     L44
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L92
L44:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L13
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L13:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x70(%rbp)
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  mov    -0x80(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L82:
  cmp    %rdx,%rsp
  je     L1
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L82
L1:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L174
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L174:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%r10
  mov    $0x0,%r11d
  mov    -0x80(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%r8
  mov    $0x0,%r9d
  mov    -0x80(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L43:
  cmp    %rdx,%rsp
  je     L4
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L43
L4:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L142
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L142:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x70(%rbp),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x60(%rbp),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x50(%rbp),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpq   $0x10,-0x80(%rbp)
  jg     L24
  mov    -0x70(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x90(%rbp)
  movb   $0x30,-0x92(%rbp)
  mov    -0x80(%rbp),%rax
  cmp    $0x10,%eax
  je     L154
  cmp    $0x10,%eax
  ja     L24
  test   %eax,%eax
  je     L113
  cmp    $0xc,%eax
  je     L171
  jmp    L24
L154:
  movzbl -0x92(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x90(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x90(%rbp)
L171:
  movzbl -0x92(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x90(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x90(%rbp)
L113:
  nop
L24:
  cmpq   $0x10,-0x80(%rbp)
  jg     L29
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x88(%rbp)
  movb   $0x30,-0x91(%rbp)
  mov    -0x80(%rbp),%rax
  cmp    $0x10,%eax
  ja     L29
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D0(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D0(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  movzbl -0x91(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x88(%rbp)
  movzbl -0x91(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x88(%rbp)
  movzbl -0x91(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x88(%rbp)
  movzbl -0x91(%rbp),%eax
  imul   $0x1010101,%eax,%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  mov    %edx,(%rax)
  nop
L29:
  mov    %rsi,%rsp
  nop
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L17
  call   <__stack_chk_fail@plt>
L17:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
void foo() {
  long maplength;
  int type;
  {
    const long nibbles = 8;
    char buf1[nibbles + 1];
    char buf2[nibbles + 1];
    char buf3[nibbles + 1];
    buf1[nibbles] = '\0';
    buf2[nibbles] = '\0';
    buf3[nibbles] = '\0';
    ((nibbles) <= 16 ? (({
      void *__s = (buf1);
      union {
        unsigned int __ui;
        unsigned short int __usi;
        unsigned char __uc;
      } *__u = __s;
      unsigned char __c = (unsigned char)('0');
      switch ((unsigned int)(nibbles)) {
      case 16:
        __u->__ui = __c * 0x01010101;
        __u = __extension__((void *)__u + 4);
      case 12:
        __u->__ui = __c * 0x01010101;
        __u = __extension__((void *)__u + 4);
      case 0:
        break;
      }
      __s;
    }))
                     : 0);
    ((nibbles) <= 16 ? (({
      void *__s = (buf2);
      union {
        unsigned int __ui;
        unsigned short int __usi;
        unsigned char __uc;
      } *__u = __s;
      unsigned char __c = (unsigned char)('0');
      switch ((unsigned int)(nibbles)) {
      case 16:
        __u->__ui = __c * 0x01010101;
        __u = __extension__((void *)__u + 4);
      case 12:
        __u->__ui = __c * 0x01010101;
        __u = __extension__((void *)__u + 4);
      case 8:
        __u->__ui = __c * 0x01010101;
        __u = __extension__((void *)__u + 4);
      case 4:
        __u->__ui = __c * 0x01010101;
      case 0:
        break;
      }
      __s;
    }))
                     : 0);
  }
}
```