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

```asm
<rsencode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x418,%rsp
  mov    %esi,%r9d
  mov    %rdx,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x70(%rsp)
  mov    $0x70,%r10d
  cmp    %r10d,%esi
  cmovle %esi,%r10d
  test   %esi,%esi
  jle    L96
  lea    0x74(%rsp),%rcx
  mov    $0x1,%esi
L109:
  mov    -0x4(%rcx),%eax
  lea    (%rax,%rax,2),%edx
  movslq %edx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edx,%r8d
  sar    $0x1f,%r8d
  sub    %r8d,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edx
  mov    %edx,(%rcx)
  add    $0x1,%esi
  add    $0x4,%rcx
  cmp    %r10d,%esi
  jle    L109
L96:
  add    %edi,%r9d
  lea    0x6f(%r9),%edx
  movslq %edx,%rax
  imul   $0xffffffff92492493,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x6,%eax
  sar    $0x1f,%edx
  sub    %edx,%eax
  mov    %eax,0x34(%rsp)
  test   %r9d,%r9d
  jle    L46
  movq   $0x0,0x28(%rsp)
  lea    -0x1(%rax,%rdi,1),%ebx
  mov    %ebx,0x50(%rsp)
  lea    -0x1(%r9,%rax,1),%ebx
  mov    %ebx,0x54(%rsp)
  lea    0x240(%rsp),%rbx
  mov    %rbx,0x58(%rsp)
  lea    0x248(%rsp),%rbx
  mov    %rbx,0x40(%rsp)
  lea    0x78(%rsp),%rbx
  mov    %rbx,0x60(%rsp)
  lea    0x23c(%rsp),%rbx
  mov    %rbx,0x68(%rsp)
  cltq
  mov    %rax,(%rsp)
  mov    $0x71,%r15d
  jmp    L110
L122:
  mov    (%r9),%esi
  mov    %r10,%rdx
L98:
  mov    %esi,%ecx
  imul   -0x4(%rdx),%ecx
  movslq %ecx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %ecx,%edi
  sar    $0x1f,%edi
  sub    %edi,%eax
  imul   $0x71,%eax,%eax
  mov    (%rdx),%edi
  sub    %ecx,%edi
  lea    0x71(%rdi,%rax,1),%ecx
  movslq %ecx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %ecx,%edi
  sar    $0x1f,%edi
  sub    %edi,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%ecx
  mov    %ecx,(%rdx)
  sub    $0x4,%rdx
  cmp    %r8,%rdx
  jne    L98
  add    $0x4,%r9
  cmp    %r11,%r9
  jne    L122
L134:
  mov    0x48(%rsp),%edx
  cmp    %r14d,%edx
  jge    L108
  mov    0x34(%rsp),%eax
  imul   %edx,%eax
  cltq
  add    0x28(%rsp),%rax
  add    0x38(%rsp),%rax
L50:
  movb   $0x0,(%rax)
  add    $0x1,%edx
  add    (%rsp),%rax
  cmp    %edx,%r14d
  jne    L50
L108:
  mov    0x48(%rsp),%esi
  test   %esi,%esi
  jle    L64
  mov    0x34(%rsp),%ecx
  mov    %ecx,%eax
  imul   %esi,%eax
  add    %r12d,%eax
  cltq
  mov    0x38(%rsp),%rdi
  add    %rdi,%rax
  mov    %rax,0x8(%rsp)
  lea    -0x1(%r14),%eax
  imul   %ecx,%eax
  add    %ebx,%eax
  cltq
  add    %rdi,%rax
  mov    %rax,0x10(%rsp)
  mov    %rdi,%r13
  mov    0x28(%rsp),%rax
  add    %rax,%r13
  lea    0x1(%rsi),%r10d
  imul   %ecx,%r10d
  movslq %r10d,%r10
  add    %r10,%rax
  add    %rdi,%rax
  mov    %rax,0x20(%rsp)
  mov    0x30(%rsp),%edi
  lea    -0x2(%rdi),%eax
  mov    0x40(%rsp),%rbx
  lea    (%rbx,%rax,4),%rbx
  imul   %ecx,%esi
  movslq %esi,%r11
  neg    %r10
  mov    $0x0,%r12d
  movslq %edi,%rax
  mov    %rax,0x18(%rsp)
  mov    %r14d,0x4c(%rsp)
  mov    (%rsp),%r14
L195:
  movzbl 0x0(%r13),%eax
  mov    0x8(%rsp),%rsi
  movzbl (%rsi),%edx
  add    %edx,%eax
  movslq %eax,%rdi
  imul   $0x487ede05,%rdi,%rdi
  sar    $0x25,%rdi
  imul   $0x71,%edi,%edx
  sub    %edx,%eax
  mov    %eax,%edi
  cmpl   $0x1,0x30(%rsp)
  jle    L90
  lea    0x244(%rsp),%rsi
  mov    0x20(%rsp),%rcx
L17:
  lea    (%rcx,%r11,1),%r8
  mov    %edi,%edx
  imul   (%rsi),%edx
  movslq %edx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edx,%r9d
  sar    $0x1f,%r9d
  sub    %r9d,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edx
  mov    %r15d,%r9d
  sub    %edx,%r9d
  movzbl (%rcx),%eax
  lea    (%r9,%rax,1),%edx
  movslq %edx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edx,%r9d
  sar    $0x1f,%r9d
  sub    %r9d,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edx
  mov    %dl,(%r8,%r10,1)
  add    $0x4,%rsi
  add    %r14,%rcx
  cmp    %rbx,%rsi
  jne    L17
L90:
  mov    0x18(%rsp),%rax
  imul   0x240(%rsp,%rax,4),%edi
  movslq %edi,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edi
  mov    %r15d,%edx
  sub    %edi,%edx
  movslq %edx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edx
  mov    0x10(%rsp),%rax
  mov    %dl,(%rax)
  add    $0x1,%r12d
  add    %r14,%r13
  cmp    %r12d,%ebp
  jne    L195
  mov    0x4c(%rsp),%r14d
L64:
  mov    0x48(%rsp),%eax
  cmp    %r14d,%eax
  jge    L104
  mov    %eax,%ecx
  imul   0x34(%rsp),%ecx
  movslq %ecx,%rcx
  add    0x28(%rsp),%rcx
  add    0x38(%rsp),%rcx
L63:
  movzbl (%rcx),%eax
  mov    %r15d,%edx
  sub    %eax,%edx
  movslq %edx,%rax
  imul   $0x487ede05,%rax,%rax
  sar    $0x25,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x71,%eax,%eax
  sub    %eax,%edx
  mov    %dl,(%rcx)
  add    $0x1,%ebp
  add    (%rsp),%rcx
  cmp    %ebp,%r14d
  jne    L63
L104:
  addq   $0x1,0x28(%rsp)
  mov    0x28(%rsp),%rax
  cmp    %eax,0x34(%rsp)
  jle    L46
L110:
  mov    0x28(%rsp),%rsi
  mov    %esi,%ebx
  mov    %esi,%r12d
  mov    0x50(%rsp),%eax
  sub    %esi,%eax
  mov    0x34(%rsp),%ecx
  cltd
  idiv   %ecx
  mov    %eax,0x48(%rsp)
  mov    %eax,%r11d
  mov    %eax,%ebp
  mov    0x54(%rsp),%edi
  sub    %esi,%edi
  mov    %edi,%eax
  cltd
  idiv   %ecx
  mov    %eax,%r14d
  mov    %eax,%esi
  sub    %r11d,%esi
  mov    %esi,0x30(%rsp)
  test   %esi,%esi
  jle    L43
  lea    0x244(%rsp),%rdx
  lea    -0x1(%rsi),%eax
  shl    $0x2,%rax
  mov    0x40(%rsp),%rsi
  lea    (%rsi,%rax,1),%rcx
L91:
  movl   $0x0,(%rdx)
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L91
  movl   $0x1,0x240(%rsp)
  lea    0x74(%rsp),%r9
  mov    0x60(%rsp),%rsi
  lea    (%rsi,%rax,1),%r11
  movslq 0x30(%rsp),%rdx
  shl    $0x2,%rdx
  mov    0x58(%rsp),%rsi
  lea    (%rsi,%rdx,1),%r10
  mov    0x68(%rsp),%rsi
  lea    (%rsi,%rdx,1),%r8
  sub    %rax,%r8
  jmp    L122
L43:
  movl   $0x1,0x240(%rsp)
  jmp    L134
L46:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L41:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void rsencode(int nd, int nc, unsigned char *wd) {
  int i, j, k, nw, start, step, root[113], c[113];
  root[0] = 1;
  for (i = 1; (i <= nc) && (i < 113); i++)
    root[i] = (3 * root[i - 1]) % 113;
  nw = nd + nc;
  step = (nw + 113 - 2) / (113 - 1);
  for (start = 0; start < step; start++) {
    int ND = (nd - start + step - 1) / step, NW = (nw - start + step - 1) / step, NC = NW - ND;
    for (i = 1; i <= NC; i++)
      c[i] = 0;
    c[0] = 1;
    for (i = 1; i <= NC; i++) {
      for (j = NC; j >= 1; j--) {
        c[j] = (113 + c[j] - (root[i] * c[j - 1]) % 113) % 113;
      }
    }
    for (i = ND; i < NW; i++)
      wd[start + i * step] = 0;
    for (i = 0; i < ND; i++) {
      k = (wd[start + i * step] + wd[start + ND * step]) % 113;
      for (j = 0; j < NC - 1; j++) {
        wd[start + (ND + j) * step] = (113 - ((c[j + 1] * k) % 113) + wd[start + (ND + j + 1) * step]) % 113;
      }
      wd[start + (ND + NC - 1) * step] = (113 - ((c[NC] * k) % 113)) % 113;
    }
    for (i = ND; i < NW; i++)
      wd[start + i * step] = (113 - wd[start + i * step]) % 113;
  }
}
```