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

```asm
<test_smallprime>:
  endbr64
  push   %r13
  xor    %eax,%eax
  lea    D40(%rip),%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  call   <BN_new@plt>
  lea    D55(%rip),%rdx
  mov    $0x880,%esi
  mov    %r13,%rdi
  mov    %rax,%rcx
  mov    %rax,%rbp
  call   <test_ptr@plt>
  test   %eax,%eax
  je     L0
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  cmp    $0x1,%r12d
  jle    L5
  call   <BN_generate_prime_ex@plt>
  xor    %ecx,%ecx
  mov    $0x888,%esi
  mov    %r13,%rdi
  test   %rax,%rax
  lea    D17(%rip),%rdx
  setne  %cl
  call   <test_true@plt>
  test   %eax,%eax
  jne    L11
L0:
  xor    %r12d,%r12d
L31:
  mov    %rbp,%rdi
  call   <BN_free@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L5:
  call   <BN_generate_prime_ex@plt>
  xor    %ecx,%ecx
  mov    $0x884,%esi
  mov    %r13,%rdi
  test   %rax,%rax
  lea    D17(%rip),%rdx
  setne  %cl
  xor    %r12d,%r12d
  call   <test_false@plt>
  test   %eax,%eax
  setne  %r12b
  jmp    L31
  nopl   0x0(%rax)
L11:
  mov    %rbp,%rdi
  call   <BN_num_bits@plt>
  mov    %r12d,%r9d
  mov    $0x88a,%esi
  mov    %r13,%rdi
  mov    %eax,%r8d
  lea    D53(%rip),%rcx
  lea    D8(%rip),%rdx
  xor    %r12d,%r12d
  call   <test_int_eq@plt>
  test   %eax,%eax
  setne  %r12b
  jmp    L31
```

tool_calls: name: retrieve_data
arguments: data_label: D40
type_guessed: string
name: retrieve_data
arguments: data_label: D55
type_guessed: string
name: retrieve_data
arguments: data_label: D17
type_guessed: string
name: retrieve_data
arguments: data_label: D53
type_guessed: string
name: retrieve_data
arguments: data_label: D8
type_guessed: string

tool: D40: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/bntest.c

tool: D55: r = BN_new()

tool: D17: BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)

tool: D53: kBits

tool: D8: BN_num_bits(r)

assistant: ```c
int test_smallprime(int kBits) {
  BIGNUM *r;
  int st = 0;
  if (!test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/bntest.c", 2176, "r = BN_new()", r = BN_new()))
    goto err;
  if (kBits <= 1) {
    if (!test_false("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/bntest.c", 2180, "BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)", (BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)) != 0))
      goto err;
  } else {
    if (!test_true("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/bntest.c", 2184, "BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)", (BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)) != 0) || !test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/bntest.c", 2186, "BN_num_bits(r)", "kBits", BN_num_bits(r), kBits))
      goto err;
  }
  st = 1;
err:
  BN_free(r);
  return st;
}
```