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

```asm
<hsfc2d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  mov    $0x2,%edx
  cmp    %edx,%eax
  cmova  %edx,%eax
  mov    %eax,-0x38(%rbp)
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%eax
  imul   %rdx,%rax
  shl    $0x2,%rax
  shr    %rax
  mov    %eax,-0x34(%rbp)
  mov    D63(%rip),%eax
  test   %eax,%eax
  jne    L117
  movb   $0x0,-0x1c(%rbp)
  mov    $0x1,%ebx
  jmp    L77
L129:
  mov    $0x0,%r12d
  jmp    L106
L105:
  mov    %ebx,%eax
  sub    %r12d,%eax
  sub    $0x1,%eax
  mov    %eax,%eax
  movzbl -0x1c(%rbp,%rax,1),%eax
  mov    %ebx,%ecx
  lea    (%rbx,%r12,1),%edx
  or     %ecx,%eax
  mov    %edx,%edx
  mov    %al,-0x1c(%rbp,%rdx,1)
  add    $0x1,%r12d
L106:
  cmp    %ebx,%r12d
  jb     L105
  add    %ebx,%ebx
L77:
  cmp    $0x3,%ebx
  jbe    L129
  mov    $0x0,%ebx
  jmp    L90
L112:
  mov    %ebx,%eax
  movzbl -0x1c(%rbp,%rax,1),%eax
  movzbl %al,%eax
  mov    %ebx,%ecx
  cltq
  lea    D51(%rip),%rdx
  mov    %cl,(%rax,%rdx,1)
  add    $0x1,%ebx
L90:
  cmp    $0x3,%ebx
  jbe    L112
  movl   $0x1,D63(%rip)
L117:
  movl   $0x0,-0x3c(%rbp)
  jmp    L130
L4:
  mov    -0x3c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x3c(%rbp)
L130:
  mov    -0x3c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jb     L4
  movb   $0x0,-0x1c(%rbp)
  movb   $0x1,-0x1b(%rbp)
  movb   $0x0,-0x3d(%rbp)
  movl   $0x1,-0x3c(%rbp)
  jmp    L88
L10:
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x2,%eax
  sub    -0x3c(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  movzbl -0x3d(%rbp),%esi
  mov    -0x48(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%eax
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  mov    %eax,%edx
  movzbl -0x1c(%rbp),%eax
  movzbl %al,%eax
  mov    %edx,%edi
  mov    %eax,%ecx
  shl    %cl,%edi
  mov    -0x48(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%eax
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  mov    %eax,%edx
  movzbl -0x1b(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %edi,%eax
  xor    %esi,%eax
  mov    %eax,%edx
  lea    D51(%rip),%rax
  movzbl (%rdx,%rax,1),%eax
  movzbl %al,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x3c(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  mov    D65(%rip),%rdx
  mov    (%rdx),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rdi
  mov    $0x0,%edx
  div    %rdi
  mov    %eax,-0x24(%rbp)
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%ecx
  mov    -0x28(%rbp),%eax
  mov    D65(%rip),%rdx
  mov    (%rdx),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rsi
  mov    $0x0,%edx
  div    %rsi
  mov    %rdx,%rax
  mov    %eax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%edx
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x2,%rax
  cmp    %rax,%rdx
  jne    L113
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x24(%rbp),%edx
  sub    $0x1,%edx
  mov    %edx,%edx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x58(%rbp),%rdx
  add    %rcx,%rdx
  or     -0x2c(%rbp),%eax
  mov    %eax,(%rdx)
  jmp    L78
L113:
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%esi
  mov    -0x20(%rbp),%eax
  mov    -0x2c(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,4),%rcx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  or     %esi,%edx
  mov    %edx,(%rax)
L78:
  cmpl   $0x0,-0x2c(%rbp)
  je     L155
  cmpl   $0x3,-0x2c(%rbp)
  jne    L11
  xorb   $0x3,-0x3d(%rbp)
L155:
  movzbl -0x1c(%rbp),%eax
  mov    %al,-0x1a(%rbp)
  movzbl -0x1b(%rbp),%eax
  mov    %al,-0x19(%rbp)
  movzbl -0x19(%rbp),%eax
  mov    %al,-0x1c(%rbp)
  movzbl -0x1a(%rbp),%eax
  mov    %al,-0x1b(%rbp)
  nop
L11:
  addl   $0x1,-0x3c(%rbp)
L88:
  mov    -0x3c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jbe    L10
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L115
  call   <__stack_chk_fail@plt>
L115:
  add    $0x50,%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
void hsfc2d(unsigned coord[], unsigned *nkey, unsigned key[]) {
  static int init = 0;
  static unsigned char gray_inv[2 * 2];
  const unsigned NKey = (2 < *nkey) ? 2 : (*nkey);
  const unsigned NBits = ((sizeof(unsigned) * CHAR_BIT) * NKey) / 2;
  unsigned i;
  unsigned char order[2 + 2];
  unsigned char reflect;
  if (!init) {
    unsigned char gray[2 * 2];
    register unsigned k;
    register unsigned j;
    gray[0] = 0;
    for (k = 1; k < sizeof(gray); k <<= 1) {
      for (j = 0; j < k; j++)
        gray[k + j] = k | gray[k - (j + 1)];
    }
    for (k = 0; k < sizeof(gray); k++)
      gray_inv[gray[k]] = k;
    init = 1;
  }
  for (i = 0; i < NKey; ++i)
    key[i] = 0;
  order[0] = 0;
  order[1] = 1;
  reflect = (0 << 0) | (0);
  for (i = 1; i <= NBits; i++) {
    const unsigned s = (sizeof(unsigned) * CHAR_BIT) - i;
    const unsigned c = gray_inv[reflect ^ ((((coord[0] >> s) & 01) << order[0]) | (((coord[1] >> s) & 01) << order[1]))];
    const unsigned off = 2 * i;
    const unsigned which = off / (sizeof(unsigned) * CHAR_BIT);
    const unsigned shift = (sizeof(unsigned) * CHAR_BIT) - off % (sizeof(unsigned) * CHAR_BIT);
    if (shift == (sizeof(unsigned) * CHAR_BIT)) {
      key[which - 1] |= c;
    } else {
      key[which] |= c << shift;
    }
    switch (c) {
    case 3:
      reflect ^= 03;
    case 0:
      order[2 + 0] = order[0];
      order[2 + 1] = order[1];
      order[0] = order[2 + 1];
      order[1] = order[2 + 0];
      break;
    }
  }
}
```