user: What would the C source look like for the assembly code provided here:

```asm
<point_math_inversemod>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x28,%rsp
  mov    %edi,0x1c(%rsp)
  mov    %ebp,%edi
  mov    %edx,0x18(%rsp)
  call   <mpz_init@plt>
  mov    %r12d,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  mov    %r13d,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  mov    %r13d,%edi
  call   <mpz_init@plt>
  mov    %ebp,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  xor    %edi,%edi
  call   <mpz_init@plt>
  mov    %r12d,%edi
  call   <mpz_init@plt>
  jmp    L37
  nopl   (%rax)
L45:
  mov    0x18(%rsp),%edx
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <mpz_add@plt>
L37:
  xor    %esi,%esi
  mov    %ebx,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  js     L45
  xor    %esi,%esi
  mov    %ebx,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  js     L84
  mov    0x18(%rsp),%edi
  mov    %ebx,%esi
  call   <mpz_cmp@plt>
  test   %rax,%rax
  jle    L84
L48:
  mov    %ebx,%esi
  xor    %edi,%edi
  call   <mpz_set@plt>
  mov    0x18(%rsp),%esi
  xor    %edi,%edi
  call   <mpz_set@plt>
  xor    %edi,%edi
  mov    $0x1,%esi
  call   <mpz_set_ui@plt>
  xor    %esi,%esi
  xor    %edi,%edi
  call   <mpz_set_ui@plt>
  xor    %esi,%esi
  xor    %edi,%edi
  call   <mpz_set_ui@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <mpz_set_ui@plt>
  jmp    L47
  nopl   0x0(%rax)
L23:
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  xor    %r14d,%r14d
  xor    %r13d,%r13d
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  xor    %r15d,%r15d
  call   <mpz_tdiv_q@plt>
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <mpz_mod@plt>
  mov    %ebp,%esi
  mov    %r12d,%edi
  call   <mpz_set@plt>
  mov    %r13d,%esi
  mov    %ebp,%edi
  call   <mpz_set@plt>
  xor    %r10d,%r10d
  mov    %r13d,%edi
  mov    %r10d,%esi
  mov    %r10d,0x14(%rsp)
  call   <mpz_set@plt>
  xor    %r9d,%r9d
  mov    %ebp,%edi
  mov    %r9d,%esi
  mov    %r9d,0x10(%rsp)
  call   <mpz_set@plt>
  xor    %ecx,%ecx
  mov    %r15d,%esi
  mov    %ecx,%edi
  mov    %ecx,0xc(%rsp)
  call   <mpz_set@plt>
  xor    %r8d,%r8d
  xor    %r11d,%r11d
  mov    %r8d,%esi
  mov    %r11d,%edi
  mov    %r8d,0x8(%rsp)
  mov    %r11d,0x4(%rsp)
  call   <mpz_set@plt>
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %r12d,%edi
  call   <mpz_mul@plt>
  mov    0xc(%rsp),%esi
  mov    0x14(%rsp),%edi
  mov    %r12d,%edx
  call   <mpz_sub@plt>
  mov    %ebp,%edx
  mov    %r14d,%esi
  mov    %r12d,%edi
  call   <mpz_mul@plt>
  mov    0x4(%rsp),%esi
  mov    0x10(%rsp),%edi
  mov    %r12d,%edx
  call   <mpz_sub@plt>
  mov    %r13d,%esi
  mov    %r15d,%edi
  call   <mpz_set@plt>
  mov    0x8(%rsp),%edi
  mov    %ebp,%esi
  call   <mpz_set@plt>
L47:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  jne    L23
  xor    %r15d,%r15d
  xor    %esi,%esi
  mov    %r15d,%edi
  call   <mpz_cmp_ui@plt>
  test   %rax,%rax
  jle    L42
  mov    0x1c(%rsp),%edi
  mov    %r15d,%esi
  call   <mpz_set@plt>
L43:
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  xor    %r13d,%r13d
  mov    %ebp,%edi
  call   <mpz_clear@plt>
  mov    %r12d,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  mov    %r13d,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  mov    %r13d,%edi
  call   <mpz_clear@plt>
  mov    %ebp,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  xor    %edi,%edi
  call   <mpz_clear@plt>
  add    $0x28,%rsp
  mov    %r12d,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1140 <mpz_clear@plt>
  cs nopw 0x0(%rax,%rax,1)
L84:
  mov    0x18(%rsp),%edx
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <mpz_mod@plt>
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L42:
  mov    0x18(%rsp),%edx
  mov    0x1c(%rsp),%edi
  xor    %esi,%esi
  call   <mpz_add@plt>
  jmp    L43
```

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);
}
```