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

```asm
<ibm3624Offset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x50(%rbp)
  mov    %rsi,%r13
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,%r14
  mov    %r9,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movq   $0x0,(%r9)
  movq   $0x0,0x5d(%r9)
  lea    0x8(%r9),%rdi
  and    $0xfffffffffffffff8,%rdi
  mov    %r9,%rcx
  sub    %rdi,%rcx
  add    $0x65,%ecx
  shr    $0x3,%ecx
  mov    %ecx,%ecx
  rep stos %rax,%es:(%rdi)
  mov    %r9,%rsi
  mov    %r13,%rdi
  call   <validatePin@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L56
  lea    0x1(%rax),%eax
  mov    %eax,-0x64(%rbp)
  cltq
  mov    %rax,-0x48(%rbp)
  add    $0xf,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L45:
  cmp    %rdx,%rsp
  je     L12
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L45
L12:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L9
  orq    $0x0,-0x8(%rsp,%rax,1)
L9:
  mov    %rsp,%r15
  mov    -0x48(%rbp),%rdx
  mov    $0x0,%esi
  mov    %rsp,%rdi
  call   <memset@plt>
  mov    -0x48(%rbp),%rdx
  mov    $0x0,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  mov    %rbx,%r9
  mov    %rsp,%r8
  mov    -0x60(%rbp),%rcx
  mov    -0x58(%rbp),%rdx
  mov    -0x64(%rbp),%esi
  mov    -0x50(%rbp),%rdi
  mov    $0x0,%eax
  call   <naturalpin@plt>
  cmp    $0xffffffff,%eax
  je     L7
  test   %r12d,%r12d
  jle    L99
  mov    %r12d,%r12d
  mov    $0x0,%ebx
L65:
  movzbl (%r15,%rbx,1),%edi
  mov    $0x0,%eax
  call   <getHexValue@plt>
  mov    %eax,-0x48(%rbp)
  movzbl 0x0(%r13,%rbx,1),%edi
  mov    $0x0,%eax
  call   <getHexValue@plt>
  mov    $0xa,%edi
  sub    -0x48(%rbp),%edi
  add    %eax,%edi
  movslq %edi,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  sub    %eax,%edi
  mov    $0x0,%eax
  call   <getUChar@plt>
  mov    %al,(%r14,%rbx,1)
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L65
  mov    $0x0,%r12d
L56:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L89
  mov    %r12d,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L7:
  mov    %eax,%r12d
  jmp    L56
L99:
  mov    $0x0,%r12d
  jmp    L56
L89:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ibm3624Offset(unsigned const char *ipvk, unsigned const char *ipin, unsigned const char *idectable, unsigned const char *ipinvaldat, unsigned char *offset, char *errstatus) {
  int k = 0;
  memset(errstatus, '\0', 100 + 1);
  int pinLength = validatePin(ipin, errstatus);
  if (pinLength == -1)
    return -1;
  pinLength++;
  unsigned char natPin[pinLength];
  memset(natPin, '\0', pinLength);
  memset(offset, '\0', pinLength);
  k = naturalpin(ipvk, pinLength, idectable, ipinvaldat, natPin, errstatus);
  if (k == -1)
    return -1;
  for (k = 0; k < pinLength - 1; k++) {
    int i1nat = getHexValue(*(natPin + k));
    int i2pin = getHexValue(*(ipin + k));
    *(offset + k) = getUChar((10 - i1nat + i2pin) % 10);
  }
  return 0;
}
```