user: Converte this assembly snippet into its equivalent C code:

```asm
<ber_string_test>:
  endbr64
  push   %r15
  lea    D21(%rip),%rcx
  lea    D46(%rip),%rdi
  push   %r14
  movq   %rcx,%xmm0
  lea    D23(%rip),%rcx
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  lea    0x4(%rbx),%r13
  sub    $0x98,%rsp
  mov    %rsi,0x10(%rsp)
  lea    0x50(%rsp),%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  lea    D6(%rip),%rax
  movq   %rax,%xmm1
  lea    D43(%rip),%rax
  punpcklqdq %xmm1,%xmm0
  movq   %rax,%xmm2
  movaps %xmm0,0x60(%rsp)
  movq   %rcx,%xmm0
  punpcklqdq %xmm2,%xmm0
  movaps %xmm0,0x70(%rsp)
  call   <puts@plt>
  lea    0x60(%rsp),%rax
  mov    %rax,(%rsp)
  lea    0x80(%rsp),%rax
  mov    %rax,0x38(%rsp)
  lea    0x4c(%rsp),%rax
  mov    %rax,0x28(%rsp)
  lea    0x58(%rsp),%rax
  mov    %rax,0x30(%rsp)
  lea    0x48(%rsp),%rax
  mov    %rax,0x20(%rsp)
L35:
  mov    (%rsp),%rax
  lea    D68(%rip),%rdi
  mov    (%rax),%rbx
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <printf@plt>
  mov    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  movl   $0x0,0xc(%rsp)
  call   <ber_encode_string@plt>
  mov    %rax,%r8
L31:
  lea    0x4(%r8),%r15
  mov    0x28(%rsp),%rdx
  mov    %r14,%rsi
  mov    %r8,0x18(%rsp)
  mov    %r15,%rdi
  call   <ber_decode_string_len_buffer@plt>
  mov    %rbx,%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  movslq 0x4c(%rsp),%rdx
  xor    %edi,%edi
  cmp    %rax,%rdx
  sete   %dil
  call   <assert@plt>
  mov    0x4c(%rsp),%edx
  mov    0x50(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strncmp@plt>
  xor    %edi,%edi
  test   %rax,%rax
  sete   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %rbp,%r13
  sete   %dil
  call   <assert@plt>
  mov    0x30(%rsp),%rsi
  mov    $0x80,%edx
  mov    %r15,%rdi
  call   <ber_decode_string_alloc@plt>
  mov    0x58(%rsp),%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  mov    %rbx,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  xor    %edi,%edi
  cmp    %rax,%r12
  sete   %dil
  call   <assert@plt>
  mov    0x4c(%rsp),%edx
  mov    0x50(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strncmp@plt>
  xor    %edi,%edi
  test   %rax,%rax
  sete   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %rbp,%r13
  sete   %dil
  call   <assert@plt>
  mov    0x58(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rcx
  mov    %r14,%rsi
  mov    %r15,%rdi
  mov    $0x80,%edx
  call   <ber_decode_string_buffer@plt>
  mov    0x50(%rsp),%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  mov    %rbx,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  xor    %edi,%edi
  cmp    %rax,%r12
  sete   %dil
  call   <assert@plt>
  mov    0x4c(%rsp),%edx
  mov    0x50(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strncmp@plt>
  xor    %edi,%edi
  test   %rax,%rax
  sete   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %rbp,%r13
  sete   %dil
  call   <assert@plt>
  cmpl   $0x1,0xc(%rsp)
  jne    L8
  mov    0x18(%rsp),%r9
  mov    0x10(%rsp),%rdx
  mov    %r15,%rsi
  lea    D19(%rip),%rdi
  sub    %r9,%rdx
  sar    $0x2,%rdx
  call   <hexdump@plt>
  addq   $0x8,(%rsp)
  mov    (%rsp),%rax
  cmp    0x38(%rsp),%rax
  jne    L35
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L34
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L8:
  mov    %rbx,%rdi
  movl   $0x1,0xc(%rsp)
  call   <strlen@plt>
  mov    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  mov    %rax,%rdx
  call   <ber_encode_string_len@plt>
  mov    %rax,%r8
  jmp    L31
L34:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D21
type_guessed: string
name: retrieve_data
arguments: data_label: D46
type_guessed: string
name: retrieve_data
arguments: data_label: D23
type_guessed: string
name: retrieve_data
arguments: data_label: D6
type_guessed: string
name: retrieve_data
arguments: data_label: D43
type_guessed: string
name: retrieve_data
arguments: data_label: D68
type_guessed: string
name: retrieve_data
arguments: data_label: D19
type_guessed: string

tool: D21: a

tool: D46: # Testing BER string coding

tool: D23: test123

tool: D6: ab

tool: D43: testing_longer_name

tool: D68: ber_encode_string("%s")

tool: 

assistant: ```c
void ber_string_test(uint8_t *buf, uint8_t *buf_end) {
  uint8_t *enc_out, *dec_out;
  const char *values[] = {"a", "ab", "test123", "testing_longer_name"};
  const char *str;
  char *astr;
  uint8_t next;
  uint32_t i, enc_method, str_len;
  printf("# Testing BER string coding\n");
  for (i = 0; i < sizeof(values) / sizeof(values[0]); ++i) {
    printf("ber_encode_string(\"%s\")", values[i]);
    for (enc_method = 0; enc_method < 2; ++enc_method) {
      if (enc_method == 0) {
        enc_out = ber_encode_string(buf_end, values[i]);
      } else {
        enc_out = ber_encode_string_len(buf_end, values[i], strlen(values[i]));
      }
      dec_out = ber_decode_string_len_buffer(enc_out + 1, &str, &str_len);
      assert(str_len == strlen(values[i]));
      assert(strncmp(str, values[i], str_len) == 0);
      assert(dec_out == buf_end + 1);
      dec_out = ber_decode_string_alloc(enc_out + 1, &astr, 128);
      assert(strlen(astr) == strlen(values[i]));
      assert(strncmp(str, values[i], str_len) == 0);
      assert(dec_out == buf_end + 1);
      free(astr);
      dec_out = ber_decode_string_buffer(enc_out + 1, &str, 128, &next);
      assert(strlen(str) == strlen(values[i]));
      assert(strncmp(str, values[i], str_len) == 0);
      assert(dec_out == buf_end + 1);
    }
    hexdump("", enc_out + 1, buf_end - enc_out);
  }
  printf("\n");
}
```