user: Please show me the C implementation that matches the assembly code listed below:

```asm
<g>:
  endbr64
  push   %r15
  mov    %rdi,%rax
  movslq %esi,%r10
  mov    $0xf,%ecx
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x2b8,%rsp
  mov    (%rdi),%ebp
  mov    0x4(%rdi),%ebx
  mov    %fs:0x28,%rdx
  mov    %rdx,0x2a8(%rsp)
  xor    %edx,%edx
  mov    0x8(%rdi),%edx
  mov    %r10,0x20(%rsp)
  lea    0x20(%rsp),%r11
  bswap  %ebp
  bswap  %ebx
  movslq %ebp,%rbp
  movslq %ebx,%rbx
  bswap  %edx
  movslq %edx,%rdi
  mov    0xc(%rax),%edx
  mov    0x10(%rax),%eax
  mov    %rdi,0x8(%rsp)
  lea    0x220(%rsp),%rsi
  bswap  %edx
  bswap  %eax
  movslq %edx,%rdi
  cltq
  lea    0x28(%rsp),%rdx
  mov    %rdi,0x10(%rsp)
  mov    %rax,0x18(%rsp)
  mov    %rdx,%rdi
  xor    %eax,%eax
  rep stos %rax,%es:(%rdi)
  mov    %rdx,%rdi
  mov    %rdx,%rcx
  mov    %r10,%rdx
  jmp    L57
  nopl   (%rax)
L88:
  mov    (%rcx),%rdx
  add    $0x8,%rcx
L57:
  mov    0x60(%rcx),%rax
  xor    0x38(%rcx),%rax
  xor    0x8(%rcx),%rax
  xor    %rdx,%rax
  mov    %rax,0x78(%rcx)
  cmp    %rsi,%rcx
  jne    L88
  mov    0x18(%rsp),%r9
  mov    0x10(%rsp),%r13
  mov    %rbx,%r15
  mov    %rbp,%rdx
  mov    0x8(%rsp),%r8
  lea    0xa0(%r11),%r14
  jmp    L56
  nopl   (%rax)
L31:
  mov    (%rdi),%r10
  mov    %r13,%r9
  mov    %rdx,%r15
  mov    %r8,%r13
  add    $0x8,%rdi
  mov    %rcx,%r8
  mov    %rax,%rdx
L56:
  mov    %rdx,%rcx
  mov    %rdx,%rax
  shl    $0x5,%rax
  shr    $0x1b,%rcx
  or     %rax,%rcx
  mov    %r8,%rax
  xor    %r13,%rax
  and    %r15,%rax
  xor    %r13,%rax
  lea    0x5a827999(%rcx,%rax,1),%rax
  mov    %r15,%rcx
  shl    $0x1e,%r15
  add    %r9,%rax
  shr    $0x2,%rcx
  add    %r10,%rax
  or     %r15,%rcx
  cmp    %r14,%rdi
  jne    L31
  mov    %rcx,%rsi
  lea    0xc0(%rsp),%r9
  lea    0x140(%r11),%r10
  jmp    L99
L68:
  mov    %rsi,%r8
  mov    %rcx,%rax
  mov    %rdi,%rsi
L99:
  mov    %rax,%rdi
  mov    %rax,%rcx
  add    $0x8,%r9
  shl    $0x5,%rcx
  shr    $0x1b,%rdi
  or     %rcx,%rdi
  mov    %rdx,%rcx
  xor    %rsi,%rcx
  xor    %r8,%rcx
  lea    0x6ed9eba1(%rdi,%rcx,1),%rcx
  mov    %rdx,%rdi
  add    -0x8(%r9),%rcx
  shl    $0x1e,%rdx
  shr    $0x2,%rdi
  add    %r13,%rcx
  mov    %r8,%r13
  or     %rdx,%rdi
  mov    %rax,%rdx
  cmp    %r10,%r9
  jne    L68
  lea    0x160(%rsp),%r10
  lea    0x1e0(%r11),%r15
  mov    $0x8f1bbcdc,%r14d
  jmp    L43
  cs nopw 0x0(%rax,%rax,1)
L44:
  mov    %rdi,%rsi
  mov    %rdx,%rcx
  mov    %r9,%rdi
L43:
  mov    %rcx,%rdx
  mov    %rcx,%r9
  mov    %rdi,%r13
  add    $0x8,%r10
  shl    $0x5,%r9
  shr    $0x1b,%rdx
  and    %rsi,%r13
  or     %r9,%rdx
  mov    %rdi,%r9
  add    -0x8(%r10),%rdx
  or     %rsi,%r9
  add    %r14,%rdx
  and    %rax,%r9
  or     %r13,%r9
  add    %r9,%rdx
  add    %r8,%rdx
  mov    %rax,%r8
  shl    $0x1e,%rax
  shr    $0x2,%r8
  or     %rax,%r8
  mov    %rcx,%rax
  mov    %r8,%r9
  mov    %rsi,%r8
  cmp    %r15,%r10
  jne    L44
  lea    0x200(%rsp),%r8
  add    $0x280,%r11
  mov    $0xca62c1d6,%r10d
  jmp    L21
L7:
  mov    %r9,%rdi
  mov    %rax,%rdx
  mov    %r13,%r9
L21:
  mov    %rdx,%rax
  mov    %rdx,%r13
  add    $0x8,%r8
  shl    $0x5,%r13
  shr    $0x1b,%rax
  or     %r13,%rax
  mov    %rcx,%r13
  xor    %r9,%r13
  xor    %rdi,%r13
  add    %r13,%rax
  add    %r10,%rax
  add    -0x8(%r8),%rax
  add    %rsi,%rax
  mov    %rcx,%rsi
  shl    $0x1e,%rcx
  shr    $0x2,%rsi
  or     %rcx,%rsi
  mov    %rdx,%rcx
  mov    %rsi,%r13
  mov    %rdi,%rsi
  cmp    %r8,%r11
  jne    L7
  add    %rax,%rbp
  mov    0x8(%rsp),%rax
  add    %rdx,%rbx
  mov    %rbp,(%r12)
  add    %r13,%rax
  mov    %rbx,0x8(%r12)
  mov    %rax,0x10(%r12)
  mov    0x10(%rsp),%rax
  add    %r9,%rax
  mov    %rax,0x18(%r12)
  mov    0x18(%rsp),%rax
  add    %rdi,%rax
  mov    %rax,0x20(%r12)
  mov    0x2a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L59
  add    $0x2b8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L59:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int g(in, i, h)
unsigned char *in;
int i;
unsigned long *h;
{
  unsigned long h0, h1, h2, h3, h4, a, b, c, d, e, temp;
  unsigned char *kp;
  unsigned long w[80];
  kp = in;
  h0 = ((kp[0] << 24) | (kp[1] << 16) | (kp[2] << 8) | (kp[3]));
  kp += 4;
  h1 = ((kp[0] << 24) | (kp[1] << 16) | (kp[2] << 8) | (kp[3]));
  kp += 4;
  h2 = ((kp[0] << 24) | (kp[1] << 16) | (kp[2] << 8) | (kp[3]));
  kp += 4;
  h3 = ((kp[0] << 24) | (kp[1] << 16) | (kp[2] << 8) | (kp[3]));
  kp += 4;
  h4 = ((kp[0] << 24) | (kp[1] << 16) | (kp[2] << 8) | (kp[3]));
  kp += 4;
  w[0] = i;
  for (i = 1; i < 16; i++)
    w[i] = 0;
  for (i = 16; i < 80; i++)
    w[i] = w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16];
  a = h0;
  b = h1;
  c = h2;
  d = h3;
  e = h4;
  for (i = 0; i < 20; i++) {
    temp = (((a) >> 27) | ((a) << 5)) + (((b) & (c)) | ((~(b)) & (d))) + e + w[i] + 0x5a827999;
    e = d;
    d = c;
    c = (((b) >> 2) | ((b) << 30));
    b = a;
    a = temp;
  }
  for (i = 20; i < 40; i++) {
    temp = (((a) >> 27) | ((a) << 5)) + ((b) ^ (c) ^ (d)) + e + w[i] + 0x6ed9eba1;
    e = d;
    d = c;
    c = (((b) >> 2) | ((b) << 30));
    b = a;
    a = temp;
  }
  for (i = 40; i < 60; i++) {
    temp = (((a) >> 27) | ((a) << 5)) + (((b) & (c)) | ((b) & (d)) | ((c) & (d))) + e + w[i] + 0x8f1bbcdc;
    e = d;
    d = c;
    c = (((b) >> 2) | ((b) << 30));
    b = a;
    a = temp;
  }
  for (i = 60; i < 80; i++) {
    temp = (((a) >> 27) | ((a) << 5)) + ((b) ^ (c) ^ (d)) + e + w[i] + 0xca62c1d6;
    e = d;
    d = c;
    c = (((b) >> 2) | ((b) << 30));
    b = a;
    a = temp;
  }
  h[0] = h0 + a;
  h[1] = h1 + b;
  h[2] = h2 + c;
  h[3] = h3 + d;
  h[4] = h4 + e;
  return (0);
}
```