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

```asm
<point_math_inversemod>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  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    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_init@plt>
  jmp    L0
L68:
  mov    -0x4c(%rbp),%edx
  mov    -0x48(%rbp),%ecx
  mov    -0x48(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
L0:
  mov    -0x48(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  js     L68
  mov    -0x48(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  js     L79
  mov    -0x48(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_cmp@plt>
  test   %rax,%rax
  jg     L10
L79:
  mov    -0x4c(%rbp),%edx
  mov    -0x48(%rbp),%ecx
  mov    -0x48(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mod@plt>
L10:
  mov    -0x48(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x4c(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x2c(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <mpz_set_ui@plt>
  mov    -0x28(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_set_ui@plt>
  mov    -0x24(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_set_ui@plt>
  mov    -0x20(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <mpz_set_ui@plt>
  jmp    L62
L29:
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%ecx
  mov    -0x18(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_tdiv_q@plt>
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%ecx
  mov    -0x1c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mod@plt>
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x2c(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x28(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x24(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x20(%rbp),%edx
  mov    -0x8(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mul@plt>
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x2c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_sub@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x18(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_mul@plt>
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x28(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_sub@plt>
  mov    -0x14(%rbp),%edx
  mov    -0x24(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
L62:
  mov    -0x34(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  jne    L29
  mov    -0x24(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  jle    L44
  mov    -0x24(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <mpz_set@plt>
  jmp    L70
L44:
  mov    -0x4c(%rbp),%edx
  mov    -0x24(%rbp),%ecx
  mov    -0x44(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mpz_add@plt>
L70:
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <mpz_clear@plt>
  nop
  leave
  ret
```

assistant: ```c
void point_math_inversemod(mpz_t r, mpz_t a, mpz_t m) {
  mpz_t c, d, uc, vc, ud, vd, rem, q, uct, vct, udt, vdt, temp;
  mpz_init(c);
  mpz_init(d);
  mpz_init(uc);
  mpz_init(vc);
  mpz_init(ud);
  mpz_init(vd);
  mpz_init(rem);
  mpz_init(q);
  mpz_init(uct);
  mpz_init(vct);
  mpz_init(udt);
  mpz_init(vdt);
  mpz_init(temp);
  while (mpz_cmp_ui(a, 0) < 0) {
    mpz_add(a, a, m);
  }
  if (mpz_cmp_ui(a, 0) < 0 || mpz_cmp(m, a) <= 0) {
    mpz_mod(a, a, m);
  }
  mpz_set(c, a);
  mpz_set(d, m);
  mpz_set_ui(uc, 1);
  mpz_set_ui(vc, 0);
  mpz_set_ui(ud, 0);
  mpz_set_ui(vd, 1);
  while (mpz_cmp_ui(c, 0) != 0) {
    mpz_tdiv_q(q, d, c);
    mpz_mod(rem, d, c);
    mpz_set(d, c);
    mpz_set(c, rem);
    mpz_set(uct, uc);
    mpz_set(vct, vc);
    mpz_set(udt, ud);
    mpz_set(vdt, vd);
    mpz_mul(temp, q, uct);
    mpz_sub(uc, udt, temp);
    mpz_mul(temp, q, vct);
    mpz_sub(vc, vdt, temp);
    mpz_set(ud, uct);
    mpz_set(vd, vct);
  }
  if (mpz_cmp_ui(ud, 0) > 0) {
    mpz_set(r, ud);
  } else {
    mpz_add(r, ud, m);
  }
  mpz_clear(c);
  mpz_clear(d);
  mpz_clear(uc);
  mpz_clear(vc);
  mpz_clear(ud);
  mpz_clear(vd);
  mpz_clear(rem);
  mpz_clear(q);
  mpz_clear(uct);
  mpz_clear(vct);
  mpz_clear(udt);
  mpz_clear(vdt);
  mpz_clear(temp);
}
```