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

```asm
<vis5d_unlink_slice>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x48,%rsp
  mov    %edi,0xc(%rsp)
  lea    0x10(%rsp),%rsi
  mov    %edx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <vis5d_get_ctx_numvars@plt>
  cmp    $0x4,%ebx
  jle    L139
  lea    -0x6(%rbx),%edx
  mov    $0xfffffffe,%eax
  cmp    $0x3,%edx
  ja     L163
  mov    $0x2,%eax
L28:
  mov    0x8(%rsp),%r12d
  test   %r12d,%r12d
  js     L103
  cmp    %r12d,%eax
  jle    L103
  mov    0xc(%rsp),%eax
  mov    %ebx,0x18(%rsp)
  mov    %ebx,%ebp
  lea    0x1c(%rsp),%r15
  mov    %r12d,0x1c(%rsp)
  lea    0x18(%rsp),%r14
  lea    0x14(%rsp),%r13
  mov    %eax,0x14(%rsp)
  mov    %eax,0x4(%rsp)
  jmp    L124
  nopl   0x0(%rax)
L187:
  mov    %ecx,0x4(%rsp)
  mov    %edx,%r12d
  mov    %eax,%ebp
L124:
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <follow_slice_link@plt>
  test   %rax,%rax
  je     L118
  mov    0x18(%rsp),%eax
  mov    0x1c(%rsp),%edx
  mov    0x14(%rsp),%ecx
  cmp    %ebx,%eax
  jne    L187
  cmp    %edx,0x8(%rsp)
  jne    L187
  cmp    %ecx,0xc(%rsp)
  jne    L187
L118:
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%edi
  lea    0x28(%rsp),%r15
  mov    %ebx,%esi
  lea    0x20(%rsp),%r14
  lea    0x30(%rsp),%r13
  mov    %r15,%r9
  mov    %r13,%rcx
  mov    %r14,%r8
  call   <vis5d_get_slice_link@plt>
  mov    0x20(%rsp),%rcx
  mov    0x28(%rsp),%rdx
  cmp    %ebx,%ebp
  mov    (%rcx),%eax
  mov    %eax,0x18(%rsp)
  mov    (%rdx),%eax
  mov    %eax,0x1c(%rsp)
  mov    0x30(%rsp),%rax
  mov    (%rax),%esi
  mov    %esi,0x14(%rsp)
  movl   $0xffffffff,(%rcx)
  movl   $0xffffffff,(%rdx)
  movl   $0xffffffff,(%rax)
  setne  %al
  cmp    0x8(%rsp),%r12d
  setne  %dl
  or     %dl,%al
  jne    L182
  mov    0xc(%rsp),%ebx
  xor    %eax,%eax
  cmp    %ebx,0x4(%rsp)
  je     L163
L182:
  mov    0x4(%rsp),%edi
  mov    %r15,%r9
  mov    %r14,%r8
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %ebp,%esi
  call   <vis5d_get_slice_link@plt>
  mov    0x18(%rsp),%eax
  cmp    %ebp,%eax
  je     L174
L35:
  mov    0x20(%rsp),%rdx
  mov    %eax,(%rdx)
  mov    0x28(%rsp),%rax
  mov    0x1c(%rsp),%edx
  mov    %edx,(%rax)
  mov    0x30(%rsp),%rax
  mov    0x14(%rsp),%edx
  mov    %edx,(%rax)
  xor    %eax,%eax
L163:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L33
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L139:
  mov    $0xfffffffe,%eax
  test   %ebx,%ebx
  jle    L163
  mov    0x10(%rsp),%eax
  jmp    L28
  nopw   0x0(%rax,%rax,1)
L174:
  cmp    %r12d,0x1c(%rsp)
  jne    L35
  mov    0x4(%rsp),%ebx
  cmp    %ebx,0x14(%rsp)
  jne    L35
  movl   $0xffffffff,0x14(%rsp)
  mov    $0xffffffff,%eax
  movl   $0xffffffff,0x1c(%rsp)
  jmp    L35
L103:
  mov    $0xfffffffb,%eax
  jmp    L163
L33:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int vis5d_unlink_slice(int vindex, int type, int number) {
  int numvar, nmax;
  int cur_vindex, end_vindex, cur_type, cur_num, end_type, end_num;
  int *p_type, *p_num, *p_vindex;
  vis5d_get_ctx_numvars(vindex, &numvar);
  switch (type) {
  case 1:
  case 2:
  case 3:
  case 4:
    nmax = numvar;
    break;
  case 6:
  case 7:
  case 8:
  case 9:
    nmax = 2;
    break;
  default:
    return -2;
  }
  if ((number < 0) || (number >= nmax))
    return -5;
  end_type = type;
  end_num = number;
  end_vindex = vindex;
  cur_type = type;
  cur_num = number;
  cur_vindex = vindex;
  while (follow_slice_link(&cur_vindex, &cur_type, &cur_num)) {
    if ((cur_type == type) && (cur_num == number) && (cur_vindex == vindex)) {
      break;
    }
    end_type = cur_type;
    end_num = cur_num;
    end_vindex = cur_vindex;
  }
  vis5d_get_slice_link(vindex, type, number, &p_vindex, &p_type, &p_num);
  cur_type = *p_type;
  cur_num = *p_num;
  cur_vindex = *p_vindex;
  *p_type = -1;
  *p_num = -1;
  *p_vindex = -1;
  if ((end_type != type) || (end_num != number) || (end_vindex != vindex)) {
    vis5d_get_slice_link(end_vindex, end_type, end_num, &p_vindex, &p_type, &p_num);
    if ((cur_type == end_type) && (cur_num == end_num) && (cur_vindex == end_vindex)) {
      cur_type = cur_num = cur_vindex = -1;
    }
    *p_type = cur_type;
    *p_num = cur_num;
    *p_vindex = cur_vindex;
  }
  return 0;
}
```