user: 请将以下的汇编代码转换成C语言代码:

```asm
<test_smallprime>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r12d
  mov    $0x0,%eax
  call   <BN_new@plt>
  mov    %rax,%rbp
  mov    %rax,%rcx
  lea    D7(%rip),%rdx
  mov    $0x880,%esi
  lea    D52(%rip),%rdi
  call   <test_ptr@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L5
  cmp    $0x1,%r12d
  jle    L18
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <BN_generate_prime_ex@plt>
  test   %rax,%rax
  setne  %cl
  movzbl %cl,%ecx
  lea    D42(%rip),%rdx
  mov    $0x888,%esi
  lea    D52(%rip),%rdi
  call   <test_true@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L5
  mov    %rbp,%rdi
  call   <BN_num_bits@plt>
  mov    %eax,%r8d
  mov    %r12d,%r9d
  lea    D84(%rip),%rcx
  lea    D66(%rip),%rdx
  mov    $0x88a,%esi
  lea    D52(%rip),%rdi
  call   <test_int_eq@plt>
  test   %eax,%eax
  setne  %bl
  movzbl %bl,%ebx
  jmp    L5
L18:
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <BN_generate_prime_ex@plt>
  test   %rax,%rax
  setne  %cl
  movzbl %cl,%ecx
  lea    D42(%rip),%rdx
  mov    $0x884,%esi
  lea    D52(%rip),%rdi
  call   <test_false@plt>
  test   %eax,%eax
  setne  %bl
  movzbl %bl,%ebx
L5:
  mov    %rbp,%rdi
  call   <BN_free@plt>
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: label: D7
type_infered: string
name: unpack_data
arguments: label: D52
type_infered: string
name: unpack_data
arguments: label: D42
type_infered: string
name: unpack_data
arguments: label: D84
type_infered: string
name: unpack_data
arguments: label: D66
type_infered: string

tool: D7: r = BN_new()

tool: D52: /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: D42: BN_generate_prime_ex(r, kBits, 0, NULL, NULL, NULL)

tool: D84: kBits

tool: D66: 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;
}
```