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

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x110,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D463(%rip),%rdx
  mov    $0x80,%esi
  call   <ulz_snprintf@plt>
  cmp    $0x13,%eax
  jne    L11
L152:
  mov    %rsp,%rdi
  lea    D450(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L8
L154:
  lea    0x80(%rsp),%rbx
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D463(%rip),%rdx
  mov    $0x80,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %rsp,%rdi
  mov    %rbx,%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L130
L125:
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D463(%rip),%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x13,%eax
  jne    L73
L29:
  mov    %rsp,%rdi
  sub    $0x8,%rsp
  push   $0xffffffffffffffff
  mov    $0xffffffffffffffff,%r9
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D480(%rip),%rdx
  mov    $0x80,%esi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  add    $0x10,%rsp
  cmp    $0x29,%eax
  jne    L46
L10:
  mov    %rsp,%rdi
  lea    D444(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L169
L43:
  lea    0x80(%rsp),%rbx
  sub    $0x8,%rsp
  push   $0xffffffffffffffff
  mov    $0xffffffffffffffff,%r9
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D480(%rip),%rdx
  mov    $0x80,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  lea    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strcmp@plt>
  add    $0x10,%rsp
  test   %eax,%eax
  jne    L132
L116:
  mov    %rsp,%rdi
  sub    $0x8,%rsp
  push   $0xffffffffffffffff
  mov    $0xffffffffffffffff,%r9
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D386(%rip),%rdx
  mov    $0x80,%esi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  add    $0x10,%rsp
  cmp    $0xffffffff,%eax
  jne    L91
L84:
  lea    D301(%rip),%r8
  mov    $0xd,%ecx
  lea    D463(%rip),%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x13,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    %rsp,%rbx
  mov    $0x539,%ecx
  lea    D82(%rip),%rbp
  mov    %rbp,%rdx
  mov    $0x4,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x3,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D387(%rip),%r12
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x7,%edx
  lea    D460(%rip),%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    $0x539,%ecx
  mov    %rbp,%rdx
  mov    $0x4,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  cmp    $0x4,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x4,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x539,%ecx
  mov    %rbp,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x4,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    %rbx,%rcx
  lea    D241(%rip),%rdx
  mov    $0x80,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  mov    $0xa,%ecx
  lea    D431(%rip),%r12
  mov    %r12,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x1,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  lea    D85(%rip),%rbp
  mov    %rbp,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x1,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  mov    %r12,%rdx
  mov    $0xa,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x1,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D401(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  mov    %rbp,%rdx
  mov    $0xa,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x1,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D423(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  lea    D435(%rip),%r12
  mov    %r12,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x2,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  lea    D400(%rip),%rbp
  mov    %rbp,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x2,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  mov    %r12,%rdx
  mov    $0xa,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x2,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D80(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0xa,%ecx
  mov    %rbp,%rdx
  mov    $0xa,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ulz_snprintf@plt>
  cmp    $0x2,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D429(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L59
  mov    $0x0,%eax
  add    $0x110,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L11:
  mov    %eax,%ecx
  lea    D393(%rip),%rdx
  mov    $0x16,%esi
  lea    D406(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L152
L8:
  lea    D463(%rip),%rcx
  lea    D252(%rip),%rdx
  mov    $0x16,%esi
  lea    D264(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L154
L130:
  lea    D463(%rip),%rcx
  lea    D258(%rip),%rdx
  mov    $0x16,%esi
  lea    D264(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L125
L73:
  lea    D472(%rip),%rcx
  lea    D393(%rip),%rdx
  mov    $0x19,%esi
  lea    D264(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L29
L46:
  mov    %eax,%ecx
  lea    D15(%rip),%rdx
  mov    $0x1b,%esi
  lea    D406(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L10
L169:
  lea    D480(%rip),%rcx
  lea    D9(%rip),%rdx
  mov    $0x1b,%esi
  lea    D264(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L43
L132:
  lea    D480(%rip),%rcx
  lea    D258(%rip),%rdx
  mov    $0x1b,%esi
  lea    D264(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L116
L91:
  mov    %eax,%ecx
  lea    D246(%rip),%rdx
  mov    $0x1d,%esi
  lea    D406(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L84
L59:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D301
type_guessed: string
name: read_data
arguments: data_label: D463
type_guessed: string
name: read_data
arguments: data_label: D450
type_guessed: string
name: read_data
arguments: data_label: D480
type_guessed: string
name: read_data
arguments: data_label: D444
type_guessed: string
name: read_data
arguments: data_label: D386
type_guessed: string
name: read_data
arguments: data_label: D82
type_guessed: string
name: read_data
arguments: data_label: D387
type_guessed: string
name: read_data
arguments: data_label: D460
type_guessed: string
name: read_data
arguments: data_label: D241
type_guessed: string
name: read_data
arguments: data_label: D431
type_guessed: string
name: read_data
arguments: data_label: D85
type_guessed: string
name: read_data
arguments: data_label: D401
type_guessed: string
name: read_data
arguments: data_label: D423
type_guessed: string
name: read_data
arguments: data_label: D435
type_guessed: string
name: read_data
arguments: data_label: D400
type_guessed: string
name: read_data
arguments: data_label: D80
type_guessed: string
name: read_data
arguments: data_label: D429
type_guessed: string
name: read_data
arguments: data_label: D393
type_guessed: string
name: read_data
arguments: data_label: D406
type_guessed: string
name: read_data
arguments: data_label: D252
type_guessed: string
name: read_data
arguments: data_label: D264
type_guessed: string
name: read_data
arguments: data_label: D258
type_guessed: string
name: read_data
arguments: data_label: D472
type_guessed: string
name: read_data
arguments: data_label: D15
type_guessed: string
name: read_data
arguments: data_label: D9
type_guessed: string
name: read_data
arguments: data_label: D246
type_guessed: string

tool: D301: baz

tool: D463: [%.4d] foo bar %s


tool: D450: [0013] foo bar baz


tool: D480: [%d] foo bar %s%%%zu,%lld


tool: D444: [13] foo bar baz%18446744073709551615,-1


tool: D386: [%d] foo bar %s%%%zu,%lld
%

tool: D82: %d

tool: D387: 133

tool: D460: AAAAAA

tool: D241: %p

tool: D431: %x

tool: D85: %X

tool: D401: a

tool: D423: A

tool: D435: %.2x

tool: D400: %.2X

tool: D80: 0a

tool: D429: 0A

tool: D393: ret == 19

tool: D406: line %d: test failed. %s. want %d


tool: D252: !strcmp(buf, "[0013] foo bar baz\n")

tool: D264: line %d: test failed. %s <%s


tool: D258: !strcmp(buf, buf2)

tool: 

tool: D15: ret == 41

tool: D9: !strcmp(buf, "[13] foo bar baz%18446744073709551615,-1\n")

tool: D246: ret == -1

assistant: ```c
int main() {
  char buf[128], buf2[128];
  ssize_t ret;
  {
    ret = ulz_snprintf(buf, sizeof(buf), "[%.4d] foo bar %s\n", 13, "baz");
    {
      if (!(ret == 19))
        printf("line %d: test failed. %s. want %d\n", 22, "ret == 19", (int)ret);
    };
    if (!(19 == -1)) {
      {
        if (!(!strcmp(buf, "[0013] foo bar baz\n")))
          printf("line %d: test failed. %s <%s\n", 22, "!strcmp(buf, \"[0013] foo bar baz\\n\")", "[%.4d] foo bar %s\n");
      };
      ret = snprintf(buf2, sizeof(buf), "[%.4d] foo bar %s\n", 13, "baz");
      {
        if (!(!strcmp(buf, buf2)))
          printf("line %d: test failed. %s <%s\n", 22, "!strcmp(buf, buf2)", "[%.4d] foo bar %s\n");
      };
    }
  };
  ret = ulz_snprintf(NULL, 0, "[%.4d] foo bar %s\n", 13, "baz");
  {
    if (!(ret == 19))
      printf("line %d: test failed. %s <%s\n", 25, "ret == 19", "");
  };
  {
    ret = ulz_snprintf(buf, sizeof(buf), "[%d] foo bar %s%%%zu,%lld\n", 13, "baz", (size_t)0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFFFFFLL);
    {
      if (!(ret == 41))
        printf("line %d: test failed. %s. want %d\n", 27, "ret == 41", (int)ret);
    };
    if (!(41 == -1)) {
      {
        if (!(!strcmp(buf, "[13] foo bar baz%18446744073709551615,-1\n")))
          printf("line %d: test failed. %s <%s\n", 27, "!strcmp(buf, \"[13] foo bar baz%18446744073709551615,-1\\n\")", "[%d] foo bar %s%%%zu,%lld\n");
      };
      ret = snprintf(buf2, sizeof(buf), "[%d] foo bar %s%%%zu,%lld\n", 13, "baz", (size_t)0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFFFFFLL);
      {
        if (!(!strcmp(buf, buf2)))
          printf("line %d: test failed. %s <%s\n", 27, "!strcmp(buf, buf2)", "[%d] foo bar %s%%%zu,%lld\n");
      };
    }
  };
  {
    ret = ulz_snprintf(buf, sizeof(buf), "[%d] foo bar %s%%%zu,%lld\n%", 13, "baz", (size_t)0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFFFFFLL);
    {
      if (!(ret == -1))
        printf("line %d: test failed. %s. want %d\n", 29, "ret == -1", (int)ret);
    };
    if (!(-1 == -1)) {
      {
        if (!(!strcmp(buf, "")))
          printf("line %d: test failed. %s <%s\n", 29, "!strcmp(buf, \"\")", "[%d] foo bar %s%%%zu,%lld\n%");
      };
      ret = snprintf(buf2, sizeof(buf), "[%d] foo bar %s%%%zu,%lld\n%", 13, "baz", (size_t)0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFFFFFLL);
      {
        if (!(!strcmp(buf, buf2)))
          printf("line %d: test failed. %s <%s\n", 29, "!strcmp(buf, buf2)", "[%d] foo bar %s%%%zu,%lld\n%");
      };
    }
  };
  ret = ulz_snprintf(NULL, 0, "[%.4d] foo bar %s\n", 13, "baz");
  assert(ret == 19);
  ret = ulz_snprintf(buf, 4, "%d", 1337);
  assert(ret == 3);
  assert(!strcmp(buf, "133"));
  memcpy(buf, "AAAAAA", 6 + 1);
  ret = snprintf(buf, 4, "%d", 1337);
  assert(ret == 4);
  assert(!memcmp(buf, "133", 4));
  ret = ulz_snprintf(NULL, 0, "%d", 1337);
  assert(ret == 4);
  ret = ulz_snprintf(buf, sizeof(buf), "%p", buf);
  ret = ulz_snprintf(NULL, 0, "%x", 0xa);
  assert(ret == 1);
  ret = ulz_snprintf(NULL, 0, "%X", 0xa);
  assert(ret == 1);
  ret = ulz_snprintf(buf, 10, "%x", 0xa);
  assert(ret == 1);
  assert(!strcmp(buf, "a"));
  ret = ulz_snprintf(buf, 10, "%X", 0xa);
  assert(ret == 1);
  assert(!strcmp(buf, "A"));
  ret = ulz_snprintf(NULL, 0, "%.2x", 0xa);
  assert(ret == 2);
  ret = ulz_snprintf(NULL, 0, "%.2X", 0xa);
  assert(ret == 2);
  ret = ulz_snprintf(buf, 10, "%.2x", 0xa);
  assert(ret == 2);
  assert(!strcmp(buf, "0a"));
  ret = ulz_snprintf(buf, 10, "%.2X", 0xa);
  assert(ret == 2);
  assert(!strcmp(buf, "0A"));
  return 0;
}
```