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

```asm
<InverseModify>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,%r13d
  mov    %rdx,%rbx
  mov    %rcx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  movabs $0x4344414247484546,%rax
  movabs $0x4b4c494a4f504d4e,%rdx
  mov    %rax,0x50(%rsp)
  mov    %rdx,0x58(%rsp)
  movb   $0x0,0x60(%rsp)
  lea    0x10(%rsp),%rax
  lea    0x50(%rsp),%rbp
L13:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rbp,%rax
  jne    L13
  lea    0x0(%r13,%r13,1),%r15d
  lea    0x1(%r15),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %r13d,%r13d
  jle    L55
  mov    0x8(%rsp),%rcx
  mov    %rax,%rdx
  mov    %r13d,%r13d
  lea    (%rax,%r13,2),%rdi
L43:
  movzbl (%rcx),%eax
  shr    $0x4,%al
  and    $0xf,%eax
  movzbl 0x50(%rsp,%rax,1),%eax
  mov    %al,(%rdx)
  movzbl (%rcx),%eax
  mov    %eax,%esi
  shr    $0x4,%sil
  and    $0xf,%esi
  addl   $0x1,0x10(%rsp,%rsi,4)
  and    $0xf,%eax
  movzbl 0x50(%rsp,%rax,1),%eax
  mov    %al,0x1(%rdx)
  movzbl (%rcx),%eax
  and    $0xf,%eax
  addl   $0x1,0x10(%rsp,%rax,4)
  add    $0x1,%rcx
  add    $0x2,%rdx
  cmp    %rdi,%rdx
  jne    L43
L55:
  movslq %r15d,%r15
  movb   $0x0,(%r12,%r15,1)
  mov    0x10(%rsp),%r13d
  lea    0x14(%rsp),%rax
L18:
  mov    (%rax),%edx
  cmp    %edx,%r13d
  cmovl  %edx,%r13d
  add    $0x4,%rax
  cmp    %rbp,%rax
  jne    L18
  mov    %r13d,%eax
  shl    $0x4,%eax
  mov    %eax,(%r14)
  lea    0x1(%rax),%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    $0x0,%r15d
  jmp    L2
L96:
  movzbl (%r12,%r15,1),%edx
  mov    (%rbx),%rax
  mov    %dl,(%rax,%r15,1)
  add    $0x1,%r15
L2:
  mov    %r15d,%ebp
  mov    %r12,%rdi
  call   <strlen@plt>
  cmp    %r15d,%eax
  jg     L96
  mov    %r12,%rdi
  call   <free@plt>
  mov    $0x0,%edi
  mov    %r13d,%r10d
  lea    -0x1(%r13),%r9d
  jmp    L100
L11:
  add    $0x1,%rdi
  cmp    $0x10,%rdi
  je     L33
L100:
  mov    0x10(%rsp,%rdi,4),%r8d
  cmp    %r8d,%r13d
  jle    L11
  movzbl 0x50(%rsp,%rdi,1),%esi
  movslq %ebp,%rax
  mov    %r9d,%edx
  sub    %r8d,%edx
  lea    0x1(%rax,%rdx,1),%rcx
L21:
  mov    (%rbx),%rdx
  mov    %sil,(%rdx,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L21
  add    %r10d,%ebp
  sub    %r8d,%ebp
  jmp    L11
L33:
  movslq (%r14),%rax
  mov    (%rbx),%rdx
  movb   $0x0,(%rdx,%rax,1)
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L104
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L104:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void InverseModify(const char *modifiedBuf, const int modifiedLen, char **restoredString, int *restoredLen) {
  char binList[] = "FEHGBADCNMPOJILK";
  int frequencyTable[16];
  char *shellCodeBuffer;
  int i, j, k;
  int maxNum;
  for (i = 0; i < 16; ++i)
    frequencyTable[i] = 0;
  shellCodeBuffer = (char *)malloc(modifiedLen * 2 + 1);
  for (i = 0; i < modifiedLen; ++i) {
    shellCodeBuffer[i * 2] = binList[(unsigned char)modifiedBuf[i] >> 4];
    ++frequencyTable[(unsigned char)modifiedBuf[i] >> 4];
    shellCodeBuffer[i * 2 + 1] = binList[modifiedBuf[i] & 0x0f];
    ++frequencyTable[modifiedBuf[i] & 0x0f];
  }
  shellCodeBuffer[modifiedLen * 2] = 0;
  maxNum = frequencyTable[0];
  for (i = 1; i < 16; ++i)
    if (maxNum < frequencyTable[i])
      maxNum = frequencyTable[i];
  *restoredLen = maxNum * 16;
  *restoredString = (char *)malloc(*restoredLen + 1);
  for (i = 0; i < strlen(shellCodeBuffer); ++i)
    (*restoredString)[i] = shellCodeBuffer[i];
  free(shellCodeBuffer);
  for (j = 0; j < 16; ++j) {
    for (k = frequencyTable[j]; k < maxNum; ++k) {
      (*restoredString)[i] = binList[j];
      ++i;
    }
  }
  (*restoredString)[*restoredLen] = 0;
}
```