user: What is the c source code of the assembly code below?

```asm
<needed_unusual_el_valence>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    0x60(%rsp),%eax
  test   %eax,%eax
  jne    L55
L132:
  lea    0x2(%r12),%eax
  mov    %ebx,%ecx
  lea    (%rbx,%rbp,1),%r8d
  cmp    $0x4,%eax
  jbe    L209
L195:
  or     %ebx,%ecx
  jne    L41
  cmp    %ebp,%r14d
  je     L108
L41:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  add    $0x28,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L55:
  lea    0x14(%rsp),%r10
  mov    %r10,%rsi
  mov    %r10,(%rsp)
  call   <GetElementFormulaFromAtNum@plt>
  mov    (%rsp),%r10
  test   %eax,%eax
  jne    L132
  push   $0x0
  mov    %r15d,%r8d
  mov    %r12d,%ecx
  mov    %r14d,%r9d
  push   $0x0
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %r10,%rdi
  push   $0x0
  push   $0x0
  call   <get_num_H@plt>
  add    $0x20,%rsp
  lea    (%rbx,%rbp,1),%r8d
  mov    %eax,%ecx
  lea    0x2(%r12),%eax
  cmp    $0x4,%eax
  ja     L195
  cs nopw 0x0(%rax,%rax,1)
L209:
  xor    %edx,%edx
  mov    %r12d,%esi
  mov    %r13d,%edi
  mov    %r8d,0xc(%rsp)
  mov    %ecx,(%rsp)
  call   <get_el_valence@plt>
  mov    (%rsp),%ecx
  mov    0xc(%rsp),%r8d
  test   %eax,%eax
  je     L195
  mov    %r13d,%edi
  call   <do_not_add_H@plt>
  mov    (%rsp),%ecx
  mov    0xc(%rsp),%r8d
  test   %rax,%rax
  jne    L195
  cmp    %ebp,%r14d
  jne    L195
  cmp    %ebx,%ecx
  jne    L195
  mov    $0x1,%ebx
  cmp    $0x2,%r15d
  je     L70
  xor    %ebx,%ebx
  cmp    $0x3,%r15d
  sete   %bl
  add    %ebx,%ebx
L70:
  movl   $0x0,0xc(%rsp)
  xor    %r14d,%r14d
  xor    %r15d,%r15d
L129:
  mov    %r15d,%edx
  mov    %r12d,%esi
  mov    %r13d,%edi
  mov    %r8d,(%rsp)
  call   <get_el_valence@plt>
  mov    (%rsp),%r8d
  test   %eax,%eax
  jle    L28
  sub    %ebx,%eax
  cmp    %eax,%ebp
  jg     L28
  lea    0x1(%r14),%ecx
  cmp    %eax,%r8d
  jl     L80
  mov    0xc(%rsp),%edx
  lea    0x1(%rdx),%esi
  je     L7
  mov    %esi,0xc(%rsp)
  mov    %ecx,%r14d
  nopl   0x0(%rax)
L28:
  add    $0x1,%r15d
  cmp    $0x5,%r15d
  jne    L129
L85:
  test   %r8d,%r8d
  jne    L41
  or     $0xffffffff,%r8d
  jmp    L41
  nopl   0x0(%rax)
L7:
  or     0xc(%rsp),%r14d
  jne    L85
  nopw   0x0(%rax,%rax,1)
L108:
  xor    %r8d,%r8d
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L80:
  mov    %ecx,%r14d
  jmp    L28
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int needed_unusual_el_valence(int nPeriodicNum, int charge, int radical, int bonds_valence, int actual_bonds_valence, int num_H, int num_bonds) {
  int i, num_found, num_found_known, chem_valence, rad_adj, known_chem_valence, exact_found;
  int num_H_expected;
  char szElement[4];
  if (num_bonds && !GetElementFormulaFromAtNum(nPeriodicNum, szElement)) {
    num_H_expected = get_num_H(szElement, 0, NULL, charge, radical, actual_bonds_valence, 0, 0, 0, 0);
  } else {
    num_H_expected = num_H;
  }
  chem_valence = bonds_valence + num_H;
  if (charge < (-2) || charge > 2 || !get_el_valence(nPeriodicNum, charge, 0) || do_not_add_H(nPeriodicNum) || bonds_valence != actual_bonds_valence || num_H_expected != num_H) {
    if (!num_H && !num_H_expected && bonds_valence == actual_bonds_valence)
      return 0;
    return chem_valence;
  }
  if (radical == 2)
    rad_adj = 1;
  else if (radical == 3)
    rad_adj = 2;
  else
    rad_adj = 0;
  num_found_known = 0;
  num_found = 0;
  exact_found = 0;
  for (i = 0; i < 5; i++) {
    if (0 < (known_chem_valence = get_el_valence(nPeriodicNum, charge, i)) && bonds_valence <= (known_chem_valence -= rad_adj)) {
      num_found_known++;
      if (known_chem_valence <= chem_valence) {
        num_found++;
      }
      if (known_chem_valence == chem_valence) {
        exact_found = 1;
        break;
      }
    }
  }
  return (exact_found && 1 == num_found && 1 == num_found_known) ? 0 : chem_valence ? chem_valence : -1;
}
```