user: What would the C source look like for the assembly code provided here?

```asm
<foo>:
  endbr64
  push   %r15
  movzwl %di,%r15d
  shr    $0x10,%rdi
  push   %r14
  movzwl %di,%eax
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,-0xc(%rsp)
  mov    %rax,-0x20(%rsp)
  test   %rsi,%rsi
  je     L184
  test   %edx,%edx
  je     L136
  nopl   0x0(%rax,%rax,1)
L149:
  mov    -0xc(%rsp),%ebx
  mov    $0x15b0,%eax
  cmp    %eax,%ebx
  mov    %ebx,%ecx
  cmovbe %ebx,%eax
  sub    %eax,%ebx
  mov    %eax,%edx
  mov    %ebx,-0xc(%rsp)
  cmp    $0xf,%ecx
  jbe    L85
  sub    $0x10,%eax
  mov    %eax,-0x4(%rsp)
  shr    $0x4,%eax
  mov    %eax,-0x8(%rsp)
  add    $0x1,%eax
  shl    $0x4,%rax
  add    %rsi,%rax
  mov    %rax,-0x18(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L109:
  movzbl (%rsi),%eax
  movzbl 0x1(%rsi),%r14d
  add    $0x10,%rsi
  movzbl -0xe(%rsi),%r13d
  movzbl -0xd(%rsi),%r12d
  add    %r15,%rax
  movzbl -0xc(%rsi),%ebp
  movzbl -0xb(%rsi),%ebx
  add    %rax,%r14
  movzbl -0xa(%rsi),%r11d
  movzbl -0x9(%rsi),%edx
  add    %r14,%r13
  add    %r14,%rax
  movzbl -0x7(%rsi),%r10d
  movzbl -0x6(%rsi),%r9d
  add    %r13,%r12
  add    %r13,%rax
  movzbl -0x5(%rsi),%r8d
  movzbl -0x3(%rsi),%ecx
  add    %r12,%rbp
  add    %r12,%rax
  add    %rbp,%rbx
  add    %rbp,%rax
  add    %rbx,%r11
  add    %rbx,%rax
  lea    (%rdx,%r11,1),%rdi
  movzbl -0x8(%rsi),%edx
  add    %r11,%rax
  mov    %rdi,-0x30(%rsp)
  add    -0x30(%rsp),%rax
  add    %rdi,%rdx
  movzbl -0x4(%rsi),%edi
  add    %rdx,%r10
  mov    %rdx,-0x28(%rsp)
  add    -0x28(%rsp),%rax
  add    %r10,%r9
  add    %r10,%rax
  movzbl -0x2(%rsi),%edx
  movzbl -0x1(%rsi),%r15d
  add    %r9,%r8
  add    %r9,%rax
  add    %r8,%rdi
  add    %r8,%rax
  add    %rdi,%rcx
  add    %rdi,%rax
  add    %rcx,%rdx
  add    %rcx,%rax
  add    %rdx,%r15
  add    %rdx,%rax
  add    %r15,%rax
  add    %rax,-0x20(%rsp)
  cmp    -0x18(%rsp),%rsi
  jne    L109
  mov    -0x8(%rsp),%eax
  mov    -0x4(%rsp),%edx
  shl    $0x4,%eax
  sub    %eax,%edx
  jne    L159
L207:
  movabs $0xf00e10d2fc5cd,%rax
  mov    -0x20(%rsp),%rcx
  mul    %r15
  mov    %r15,%rax
  sub    %rdx,%rax
  shr    %rax
  add    %rax,%rdx
  movabs $0xf00e10d2fc5cd,%rax
  shr    $0xf,%rdx
  imul   $0xfff1,%rdx,%rdx
  sub    %rdx,%r15
  mul    %rcx
  mov    %rcx,%rax
  sub    %rdx,%rax
  shr    %rax
  add    %rax,%rdx
  mov    -0xc(%rsp),%eax
  shr    $0xf,%rdx
  imul   $0xfff1,%rdx,%rdx
  sub    %rdx,%rcx
  mov    %rcx,-0x20(%rsp)
  test   %eax,%eax
  jne    L149
L136:
  mov    -0x20(%rsp),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  shl    $0x10,%rax
  pop    %r13
  pop    %r14
  or     %r15,%rax
  pop    %r15
  ret
  nopl   (%rax)
L85:
  mov    %rsi,-0x18(%rsp)
L159:
  mov    -0x18(%rsp),%rcx
  movzbl (%rcx),%eax
  add    %rax,%r15
  add    %r15,-0x20(%rsp)
  mov    -0x20(%rsp),%rbx
  cmp    $0x1,%edx
  je     L164
  movzbl 0x1(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x2,%edx
  je     L164
  movzbl 0x2(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x3,%edx
  je     L164
  movzbl 0x3(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x4,%edx
  je     L164
  movzbl 0x4(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x5,%edx
  je     L164
  movzbl 0x5(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x6,%edx
  je     L164
  movzbl 0x6(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x7,%edx
  je     L164
  movzbl 0x7(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x8,%edx
  je     L164
  movzbl 0x8(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x9,%edx
  je     L164
  movzbl 0x9(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0xa,%edx
  je     L164
  movzbl 0xa(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0xb,%edx
  je     L164
  movzbl 0xb(%rcx),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0xc,%edx
  je     L164
  movzbl 0xc(%rcx),%eax
  mov    %rcx,%rdi
  add    %rax,%r15
  mov    %edx,%eax
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  sub    $0xd,%eax
  je     L164
  movzbl 0xd(%rcx),%ecx
  add    %rcx,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  cmp    $0x1,%eax
  je     L164
  movzbl 0xe(%rdi),%eax
  add    %rax,%r15
  add    %r15,%rbx
  mov    %rbx,-0x20(%rsp)
  nop
L164:
  mov    -0x18(%rsp),%rsi
  movslq %edx,%rdx
  add    %rdx,%rsi
  jmp    L207
L184:
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned long foo(unsigned long x, unsigned char *y, unsigned int z) {
  unsigned long a = x & 0xffff;
  unsigned long b = (x >> 16) & 0xffff;
  int k;
  if (y == 0)
    return 1L;
  while (z > 0) {
    k = z < 5552 ? z : 5552;
    z -= k;
    while (k >= 16) {
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      a += *y++;
      b += a;
      k -= 16;
    }
    if (k != 0)
      do {
        a += *y++;
        b += a;
      } while (--k);
    a %= 65521L;
    b %= 65521L;
  }
  return (b << 16) | a;
}
```