user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0xc,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  mov    -0x14(%rbp),%esi
  mov    -0x10(%rbp),%ecx
  mov    %eax,%edx
  mov    %ecx,%edi
  call   <mpz_fib2_ui@plt>
L50:
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%ecx
  mov    -0xc(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
  mov    -0xc(%rbp),%eax
  mov    $0xa,%esi
  mov    %eax,%edi
  call   <mpz_sizeinbase@plt>
  cmp    $0x3e7,%eax
  jle    L6
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    $0xa,%esi
  mov    $0x0,%edi
  call   <mpz_get_str@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x3e8,%eax
  jne    L35
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L31
L35:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L6:
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
  mov    -0x14(%rbp),%eax
  mov    $0xa,%esi
  mov    %eax,%edi
  call   <mpz_sizeinbase@plt>
  cmp    $0x3e7,%eax
  jle    L90
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    $0xa,%esi
  mov    $0x0,%edi
  call   <mpz_get_str@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x3e8,%eax
  jne    L75
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L31
L75:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L90:
  mov    -0x14(%rbp),%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x10(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
  mov    -0x10(%rbp),%eax
  mov    $0xa,%esi
  mov    %eax,%edi
  call   <mpz_sizeinbase@plt>
  cmp    $0x3e7,%eax
  jle    L34
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    $0xa,%esi
  mov    $0x0,%edi
  call   <mpz_get_str@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x3e8,%eax
  jne    L22
  mov    -0x18(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L31
L22:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L34:
  addl   $0x3,-0x18(%rbp)
  jmp    L50
L31:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D18
datatype: string

tool: D18: %d


assistant: ```c
int main(int argc, char **argv) {
  int n = 12;
  char *s = NULL;
  mpz_t f1, f2, f3;
  mpz_init(f1);
  mpz_init(f2);
  mpz_init(f3);
  mpz_fib2_ui(f2, f1, n++);
  while (1) {
    mpz_add(f3, f1, f2);
    if (mpz_sizeinbase(f3, 10) >= 1000) {
      s = mpz_get_str(NULL, 10, f3);
      if (strlen(s) == 1000) {
        printf("%d\n", n);
        break;
      }
      free(s);
    }
    mpz_add(f1, f2, f3);
    if (mpz_sizeinbase(f1, 10) >= 1000) {
      s = mpz_get_str(NULL, 10, f2);
      if (strlen(s) == 1000) {
        printf("%d\n", n + 1);
        break;
      }
      free(s);
    }
    mpz_add(f2, f3, f1);
    if (mpz_sizeinbase(f2, 10) >= 1000) {
      s = mpz_get_str(NULL, 10, f2);
      if (strlen(s) == 1000) {
        printf("%d\n", n + 2);
        break;
      }
      free(s);
    }
    n += 3;
  }
  free(s);
  return 0;
}
```