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

```asm
<tm_diffmonths>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  push   0x28(%rbp)
  push   0x20(%rbp)
  push   0x18(%rbp)
  push   0x10(%rbp)
  call   <tm_getrepresentation@plt>
  add    $0x20,%rsp
  mov    %rax,%rbx
  push   0x48(%rbp)
  push   0x40(%rbp)
  push   0x38(%rbp)
  push   0x30(%rbp)
  call   <tm_getrepresentation@plt>
  add    $0x20,%rsp
  cmp    %rax,%rbx
  je     L81
  mov    D0(%rip),%rax
  mov    (%rax),%edx
  mov    D19(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L61
L81:
  movl   $0x1,-0x38(%rbp)
  push   0x48(%rbp)
  push   0x40(%rbp)
  push   0x38(%rbp)
  push   0x30(%rbp)
  push   0x28(%rbp)
  push   0x20(%rbp)
  push   0x18(%rbp)
  push   0x10(%rbp)
  call   <tm_diffseconds@plt>
  add    $0x40,%rsp
  test   %rax,%rax
  jns    L66
  mov    0x10(%rbp),%rax
  mov    0x18(%rbp),%rdx
  mov    %rax,-0x30(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    0x20(%rbp),%rax
  mov    0x28(%rbp),%rdx
  mov    %rax,-0x20(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    0x30(%rbp),%rax
  mov    0x38(%rbp),%rdx
  mov    %rax,0x10(%rbp)
  mov    %rdx,0x18(%rbp)
  mov    0x40(%rbp),%rax
  mov    0x48(%rbp),%rdx
  mov    %rax,0x20(%rbp)
  mov    %rdx,0x28(%rbp)
  mov    -0x30(%rbp),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rax,0x30(%rbp)
  mov    %rdx,0x38(%rbp)
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rax,0x40(%rbp)
  mov    %rdx,0x48(%rbp)
  movl   $0xffffffff,-0x38(%rbp)
L66:
  push   0x48(%rbp)
  push   0x40(%rbp)
  push   0x38(%rbp)
  push   0x30(%rbp)
  push   0x28(%rbp)
  push   0x20(%rbp)
  push   0x18(%rbp)
  push   0x10(%rbp)
  call   <tm_diffcalendarmonths@plt>
  add    $0x40,%rsp
  mov    %eax,-0x34(%rbp)
  mov    0x30(%rbp),%rdx
  mov    0x10(%rbp),%rax
  cmp    %rax,%rdx
  jl     L139
  mov    0x30(%rbp),%rdx
  mov    0x10(%rbp),%rax
  cmp    %rax,%rdx
  jne    L155
  mov    0x38(%rbp),%rdx
  mov    0x18(%rbp),%rax
  cmp    %rax,%rdx
  jl     L139
L155:
  mov    0x30(%rbp),%rdx
  mov    0x10(%rbp),%rax
  cmp    %rax,%rdx
  jne    L156
  mov    0x38(%rbp),%rdx
  mov    0x18(%rbp),%rax
  cmp    %rax,%rdx
  jne    L156
  mov    0x40(%rbp),%rdx
  mov    0x20(%rbp),%rax
  cmp    %rax,%rdx
  jl     L139
L156:
  mov    0x30(%rbp),%rdx
  mov    0x10(%rbp),%rax
  cmp    %rax,%rdx
  jne    L25
  mov    0x38(%rbp),%rdx
  mov    0x18(%rbp),%rax
  cmp    %rax,%rdx
  jne    L25
  mov    0x40(%rbp),%rdx
  mov    0x20(%rbp),%rax
  cmp    %rax,%rdx
  jne    L25
  mov    0x48(%rbp),%rdx
  mov    0x28(%rbp),%rax
  cmp    %rax,%rdx
  jge    L25
L139:
  cmpl   $0x0,-0x34(%rbp)
  jle    L25
  subl   $0x1,-0x34(%rbp)
L25:
  cmpq   $0x0,-0x48(%rbp)
  je     L60
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    0x10(%rbp),%rdi
  call   <tm_addmonths@plt>
  mov    -0x50(%rbp),%rax
  push   0x48(%rbp)
  push   0x40(%rbp)
  push   0x38(%rbp)
  push   0x30(%rbp)
  push   0x28(%rbp)
  push   0x20(%rbp)
  push   0x18(%rbp)
  push   0x10(%rbp)
  mov    %rax,%rdi
  call   <tm_diffdays@plt>
  add    $0x40,%rsp
  imul   -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
  cmpq   $0x0,-0x50(%rbp)
  je     L60
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  imul   -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
L60:
  mov    -0x38(%rbp),%eax
  imul   -0x34(%rbp),%eax
L61:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int tm_diffmonths(struct tm debut, struct tm fin, int *days, int *seconds) {
  if (tm_getrepresentation(debut) != tm_getrepresentation(fin)) {
    errno = EINVAL;
    return 0;
  }
  int coeff = 1;
  if (tm_diffseconds(debut, fin) < 0) {
    struct tm tmp = debut;
    debut = fin;
    fin = tmp;
    coeff = -1;
  }
  int ret = tm_diffcalendarmonths(debut, fin);
  if (fin.tm_mday < debut.tm_mday || (fin.tm_mday == debut.tm_mday && fin.tm_hour < debut.tm_hour) || (fin.tm_mday == debut.tm_mday && fin.tm_hour == debut.tm_hour && fin.tm_min < debut.tm_min) || (fin.tm_mday == debut.tm_mday && fin.tm_hour == debut.tm_hour && fin.tm_min == debut.tm_min && fin.tm_sec < debut.tm_sec))
    if (ret > 0)
      ret--;
  if (days) {
    tm_addmonths(&debut, ret);
    *days = coeff * tm_diffdays(debut, fin, seconds);
    if (seconds)
      *seconds *= coeff;
  }
  return coeff * ret;
}
```