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

```asm
<test_bio_new_mem_buf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x34(%rbp)
  mov    $0xc,%esi
  lea    D338(%rip),%rax
  mov    %rax,%rdi
  call   <BIO_new_mem_buf@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rcx
  lea    D68(%rip),%rax
  mov    %rax,%rdx
  mov    $0x4f,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_ptr@plt>
  test   %eax,%eax
  je     L201
  lea    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x5,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <BIO_read@plt>
  mov    $0x5,%r9d
  mov    %eax,%r8d
  lea    D61(%rip),%rax
  mov    %rax,%rcx
  lea    D75(%rip),%rax
  mov    %rax,%rdx
  mov    $0x51,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_eq@plt>
  test   %eax,%eax
  je     L127
  lea    -0x20(%rbp),%rdx
  push   $0x5
  lea    D72(%rip),%rax
  push   %rax
  mov    $0x5,%r9d
  mov    %rdx,%r8
  lea    D80(%rip),%rax
  mov    %rax,%rcx
  lea    D258(%rip),%rax
  mov    %rax,%rdx
  mov    $0x53,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_mem_eq@plt>
  add    $0x10,%rsp
  test   %eax,%eax
  je     L198
  lea    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <BIO_get_mem_ptr@plt>
  mov    $0x0,%r9d
  mov    %eax,%r8d
  lea    D238(%rip),%rax
  mov    %rax,%rcx
  lea    D261(%rip),%rax
  mov    %rax,%rdx
  mov    $0x55,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_gt@plt>
  test   %eax,%eax
  je     L82
  mov    -0x28(%rbp),%rax
  mov    $0x4,%edx
  lea    D195(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <BIO_write@plt>
  mov    $0x0,%r9d
  mov    %eax,%r8d
  lea    D238(%rip),%rax
  mov    %rax,%rcx
  lea    D118(%rip),%rax
  mov    %rax,%rdx
  mov    $0x57,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_lt@plt>
  test   %eax,%eax
  je     L16
  lea    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x10,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <BIO_read@plt>
  mov    $0x7,%r9d
  mov    %eax,%r8d
  lea    D76(%rip),%rax
  mov    %rax,%rcx
  lea    D94(%rip),%rax
  mov    %rax,%rdx
  mov    $0x59,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_eq@plt>
  test   %eax,%eax
  je     L148
  lea    -0x20(%rbp),%rdx
  push   $0x7
  lea    D203(%rip),%rax
  push   %rax
  mov    $0x7,%r9d
  mov    %rdx,%r8
  lea    D39(%rip),%rax
  mov    %rax,%rcx
  lea    D258(%rip),%rax
  mov    %rax,%rdx
  mov    $0x5b,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_mem_eq@plt>
  add    $0x10,%rsp
  test   %eax,%eax
  je     L1
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <BIO_reset@plt>
  mov    $0x0,%r9d
  mov    %eax,%r8d
  lea    D238(%rip),%rax
  mov    %rax,%rcx
  lea    D145(%rip),%rax
  mov    %rax,%rdx
  mov    $0x5d,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_gt@plt>
  test   %eax,%eax
  je     L178
  lea    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x10,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <BIO_read@plt>
  mov    $0xc,%r9d
  mov    %eax,%r8d
  lea    D336(%rip),%rax
  mov    %rax,%rcx
  lea    D94(%rip),%rax
  mov    %rax,%rdx
  mov    $0x5f,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_int_eq@plt>
  test   %eax,%eax
  je     L51
  lea    -0x20(%rbp),%rdx
  push   $0xc
  lea    D338(%rip),%rax
  push   %rax
  mov    $0xc,%r9d
  mov    %rdx,%r8
  lea    D198(%rip),%rax
  mov    %rax,%rcx
  lea    D258(%rip),%rax
  mov    %rax,%rdx
  mov    $0x61,%esi
  lea    D312(%rip),%rax
  mov    %rax,%rdi
  call   <test_mem_eq@plt>
  add    $0x10,%rsp
  test   %eax,%eax
  je     L23
  movl   $0x1,-0x34(%rbp)
  jmp    L2
L201:
  nop
  jmp    L2
L127:
  nop
  jmp    L2
L198:
  nop
  jmp    L2
L82:
  nop
  jmp    L2
L16:
  nop
  jmp    L2
L148:
  nop
  jmp    L2
L1:
  nop
  jmp    L2
L178:
  nop
  jmp    L2
L51:
  nop
  jmp    L2
L23:
  nop
L2:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <BIO_free@plt>
  mov    -0x34(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L68
  call   <__stack_chk_fail@plt>
L68:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D338
data_type: string
name: unpack_data
arguments: data_label: D68
data_type: string
name: unpack_data
arguments: data_label: D312
data_type: string
name: unpack_data
arguments: data_label: D61
data_type: string
name: unpack_data
arguments: data_label: D75
data_type: string
name: unpack_data
arguments: data_label: D72
data_type: string
name: unpack_data
arguments: data_label: D80
data_type: string
name: unpack_data
arguments: data_label: D258
data_type: string
name: unpack_data
arguments: data_label: D238
data_type: string
name: unpack_data
arguments: data_label: D261
data_type: string
name: unpack_data
arguments: data_label: D195
data_type: string
name: unpack_data
arguments: data_label: D118
data_type: string
name: unpack_data
arguments: data_label: D76
data_type: string
name: unpack_data
arguments: data_label: D94
data_type: string
name: unpack_data
arguments: data_label: D203
data_type: string
name: unpack_data
arguments: data_label: D39
data_type: string
name: unpack_data
arguments: data_label: D145
data_type: string
name: unpack_data
arguments: data_label: D336
data_type: string
name: unpack_data
arguments: data_label: D198
data_type: string

tool: D338: Hello World


tool: D68: bio

tool: D312: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c

tool: D61: 5

tool: D75: BIO_read(bio, data, 5)

tool: D72: Hello

tool: D80: "Hello"

tool: D258: data

tool: D238: 0

tool: D261: BIO_get_mem_ptr(bio, &bufmem)

tool: D195: test

tool: D118: BIO_write(bio, "test", 4)

tool: D76: 7

tool: D94: BIO_read(bio, data, 16)

tool: D203:  World


tool: D39: " World\n"

tool: D145: BIO_reset(bio)

tool: D336: 12

tool: D198: "Hello World\n"

assistant: ```c
int test_bio_new_mem_buf(void) {
  int ok = 0;
  BIO *bio;
  BUF_MEM *bufmem;
  char data[16];
  bio = BIO_new_mem_buf("Hello World\n", 12);
  if (!test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 79, "bio", bio))
    goto finish;
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 81, "BIO_read(bio, data, 5)", "5", BIO_read(bio, data, 5), 5))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 83, "data", "\"Hello\"", data, 5, "Hello", 5))
    goto finish;
  if (!test_int_gt("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 85, "BIO_get_mem_ptr(bio, &bufmem)", "0", BIO_get_mem_ptr(bio, &bufmem), 0))
    goto finish;
  if (!test_int_lt("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 87, "BIO_write(bio, \"test\", 4)", "0", BIO_write(bio, "test", 4), 0))
    goto finish;
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 89, "BIO_read(bio, data, 16)", "7", BIO_read(bio, data, 16), 7))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 91, "data", "\" World\\n\"", data, 7, " World\n", 7))
    goto finish;
  if (!test_int_gt("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 93, "BIO_reset(bio)", "0", BIO_reset(bio), 0))
    goto finish;
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 95, "BIO_read(bio, data, 16)", "12", BIO_read(bio, data, 16), 12))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c", 97, "data", "\"Hello World\\n\"", data, 12, "Hello World\n", 12))
    goto finish;
  ok = 1;
finish:
  BIO_free(bio);
  return ok;
}
```