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

```asm
<ibm3624Offset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rcx,%r15
  mov    %r9,%rcx
  push   %r14
  mov    %r9,%r14
  push   %r13
  push   %r12
  mov    %r8,%r12
  push   %rbx
  mov    %rsi,%rbx
  mov    %r9,%rsi
  sub    $0x38,%rsp
  mov    %rdi,-0x48(%rbp)
  lea    0x8(%r9),%rdi
  mov    %rdx,-0x50(%rbp)
  and    $0xfffffffffffffff8,%rdi
  sub    %rdi,%rcx
  add    $0x65,%ecx
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  shr    $0x3,%ecx
  movq   $0x0,(%r9)
  movq   $0x0,0x5d(%r9)
  rep stos %rax,%es:(%rdi)
  mov    %rbx,%rdi
  call   <validatePin@plt>
  cmp    $0xffffffff,%eax
  je     L20
  lea    0x1(%rax),%r11d
  mov    %eax,%r10d
  mov    %rsp,%rsi
  movslq %r11d,%rdx
  lea    0xf(%rdx),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L82
L29:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L29
L82:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L18
L52:
  xor    %esi,%esi
  mov    %rsp,%rdi
  mov    %r11d,-0x58(%rbp)
  mov    %rsp,%r13
  mov    %r10d,-0x54(%rbp)
  mov    %rdx,-0x60(%rbp)
  call   <memset@plt>
  mov    -0x60(%rbp),%rdx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    -0x50(%rbp),%rdx
  mov    -0x58(%rbp),%esi
  xor    %eax,%eax
  mov    -0x48(%rbp),%rdi
  mov    %r14,%r9
  mov    %rsp,%r8
  mov    %r15,%rcx
  call   <naturalpin@plt>
  cmp    $0xffffffff,%eax
  je     L20
  movslq -0x54(%rbp),%rax
  xor    %r14d,%r14d
  mov    %rax,-0x48(%rbp)
  test   %eax,%eax
  jle    L19
  nopl   0x0(%rax)
L57:
  movzbl 0x0(%r13,%r14,1),%edi
  xor    %eax,%eax
  call   <getHexValue@plt>
  movzbl (%rbx,%r14,1),%edi
  mov    %eax,%r15d
  xor    %eax,%eax
  call   <getHexValue@plt>
  mov    $0xa,%edi
  sub    %r15d,%edi
  add    %eax,%edi
  movslq %edi,%rax
  mov    %edi,%ecx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x22,%rax
  sub    %ecx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  sub    %eax,%edi
  xor    %eax,%eax
  call   <getUChar@plt>
  mov    %al,(%r12,%r14,1)
  add    $0x1,%r14
  cmp    -0x48(%rbp),%r14
  jne    L57
L19:
  xor    %eax,%eax
L24:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L45
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L18:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L52
L20:
  mov    $0xffffffff,%eax
  jmp    L24
L45:
  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;
}
```