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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpl   $0x4,-0x24(%rbp)
  jg     L28
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L52
L28:
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rcx
  mov    -0x10(%rbp),%eax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <mpz_init_set_str@plt>
  mov    -0xc(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_init_set_ui@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  jmp    L14
L39:
  mov    -0xc(%rbp),%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x8(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mul@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x8(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mul_ui@plt>
  mov    -0x18(%rbp),%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mul_ui@plt>
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x8(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x8(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add_ui@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <isprime@plt>
  test   %rax,%rax
  je     L5
  mov    -0x8(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <gmp_printf@plt>
  jmp    L42
L5:
  mov    -0x8(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <gmp_printf@plt>
L42:
  mov    -0xc(%rbp),%ecx
  mov    -0xc(%rbp),%eax
  mov    $0x1,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add_ui@plt>
L14:
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_cmp@plt>
  test   %rax,%rax
  jle    L39
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    $0x0,%eax
L52:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D16
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D18
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D27
type_infered: string

tool: D16: usage : primegen a b c max_n


tool: D18: %Zd %Zd OK


tool: D27: %Zd %Zd NG


assistant: ```c
int main(int ac, char *av[]) {
  int a, b, c;
  mpz_t n, n2, max_n, tmp;
  if (ac < 5) {
    printf("usage : primegen a b c max_n\n");
    return (1);
  }
  a = strtol(av[1], NULL, 10);
  b = strtol(av[2], NULL, 10);
  c = strtol(av[3], NULL, 10);
  mpz_init_set_str(max_n, av[4], 10);
  mpz_init_set_ui(n, 0);
  mpz_init(n2);
  mpz_init(tmp);
  while (mpz_cmp(n, max_n) <= 0) {
    mpz_mul(n2, n, n);
    mpz_mul_ui(n2, n2, a);
    mpz_mul_ui(tmp, n, b);
    mpz_add(n2, n2, tmp);
    mpz_add_ui(n2, n2, c);
    if (isprime(n2))
      gmp_printf("%Zd %Zd OK\n", n, n2);
    else
      gmp_printf("%Zd %Zd NG\n", n, n2);
    mpz_add_ui(n, n, 1);
  }
  mpz_clear(n);
  mpz_clear(n2);
  mpz_clear(max_n);
  mpz_clear(tmp);
  return (0);
}
```