user: Demonstrate the C code that generates the assembly output below:

```asm
<sporkel_bspatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %rdx,-0x88(%rbp)
  mov    %rcx,-0x90(%rbp)
  mov    %r8,-0x98(%rbp)
  mov    %r9,-0xa0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x78(%rbp)
  je     L215
  cmpq   $0x0,-0x88(%rbp)
  je     L215
  cmpq   $0x0,-0x98(%rbp)
  jne    L20
L215:
  mov    $0xffffffff,%eax
  jmp    L103
L20:
  cmpq   $0x0,-0x80(%rbp)
  js     L102
  cmpq   $0x0,-0x90(%rbp)
  js     L102
  cmpq   $0x0,-0xa0(%rbp)
  jns    L180
L102:
  mov    $0xffffffff,%eax
  jmp    L103
L180:
  mov    -0x90(%rbp),%rdx
  mov    -0x88(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sporkel_bspatch_valid_header@plt>
  test   %eax,%eax
  jne    L71
  mov    $0xfffffffe,%eax
  jmp    L103
L71:
  mov    -0x88(%rbp),%rax
  add    $0x40,%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x88(%rbp),%rax
  sub    $0xffffffffffffff80,%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x88(%rbp),%rax
  add    $0xc0,%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  cmp    -0xa0(%rbp),%rax
  jle    L211
  mov    $0xffffffff,%eax
  jmp    L103
L211:
  mov    -0x88(%rbp),%rax
  add    $0x100,%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x20,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  add    $0x20,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x58(%rbp)
  movq   $0x0,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  jmp    L61
L57:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x68(%rbp),%rax
  add    $0x40,%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x68(%rbp),%rax
  sub    $0xffffffffffffff80,%rax
  mov    %rax,%rdi
  call   <offtin@plt>
  mov    %rax,-0x10(%rbp)
  addq   $0xc0,-0x68(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x28(%rbp)
  jge    L189
  mov    $0xfffffffd,%eax
  jmp    L103
L189:
  mov    -0x20(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x98(%rbp),%rax
  add    %rax,%rcx
  mov    -0x60(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x20(%rbp),%rax
  shl    $0x3,%rax
  add    %rax,-0x60(%rbp)
  movq   $0x0,-0x40(%rbp)
  jmp    L82
L216:
  mov    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  test   %rax,%rax
  js     L219
  mov    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x80(%rbp)
  jle    L219
  mov    -0x48(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rcx
  mov    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x48(%rbp),%rsi
  mov    -0x40(%rbp),%rax
  add    %rsi,%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x98(%rbp),%rax
  add    %rsi,%rax
  add    %rcx,%rdx
  mov    %rdx,(%rax)
L219:
  addq   $0x1,-0x40(%rbp)
L82:
  mov    -0x20(%rbp),%rax
  cmp    %rax,-0x40(%rbp)
  jl     L216
  mov    -0x20(%rbp),%rax
  add    %rax,-0x48(%rbp)
  mov    -0x20(%rbp),%rax
  add    %rax,-0x50(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x28(%rbp)
  jge    L149
  mov    $0xfffffffd,%eax
  jmp    L103
L149:
  mov    -0x18(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x98(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  add    %rax,-0x58(%rbp)
  mov    -0x18(%rbp),%rax
  add    %rax,-0x48(%rbp)
  mov    -0x10(%rbp),%rax
  add    %rax,-0x50(%rbp)
L61:
  mov    -0x48(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jl     L57
  mov    $0x0,%eax
L103:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L206
  call   <__stack_chk_fail@plt>
L206:
  leave
  ret
```

assistant: ```c
int sporkel_bspatch(u_char *oldp, ssize_t oldsz, u_char *patch, ssize_t patchsz, u_char *newp, ssize_t newsz) {
  ssize_t newsize, ctrllen, datalen;
  u_char *ctrlblock, *diffblock, *extrablock;
  off_t oldpos, newpos;
  off_t ctrl[3];
  off_t i;
  if (oldp == NULL || patch == NULL || newp == NULL)
    return -1;
  if (oldsz < 0 || patchsz < 0 || newsz < 0)
    return -1;
  if (!sporkel_bspatch_valid_header(patch, patchsz))
    return -2;
  ctrllen = offtin(patch + 8);
  datalen = offtin(patch + 16);
  newsize = offtin(patch + 24);
  if (newsize > newsz)
    return -1;
  ctrlblock = patch + 32;
  diffblock = patch + 32 + ctrllen;
  extrablock = patch + 32 + ctrllen + datalen;
  oldpos = 0;
  newpos = 0;
  while (newpos < newsize) {
    ctrl[0] = offtin(ctrlblock);
    ctrl[1] = offtin(ctrlblock + 8);
    ctrl[2] = offtin(ctrlblock + 16);
    ctrlblock += 24;
    if (newpos + ctrl[0] > newsize)
      return -3;
    memcpy(newp + newpos, diffblock, ctrl[0]);
    diffblock += ctrl[0];
    for (i = 0; i < ctrl[0]; i++)
      if ((oldpos + i >= 0) && (oldpos + i < oldsz))
        newp[newpos + i] += oldp[oldpos + i];
    newpos += ctrl[0];
    oldpos += ctrl[0];
    if (newpos + ctrl[1] > newsize)
      return -3;
    memcpy(newp + newpos, extrablock, ctrl[1]);
    extrablock += ctrl[1];
    newpos += ctrl[1];
    oldpos += ctrl[2];
  };
  return 0;
}
```