user: Translate the below assembly code into C programming language:

```asm
<vis5d_unlink_slice>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edi,%r15d
  mov    %esi,%ebx
  mov    %edx,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  call   <vis5d_get_ctx_numvars@plt>
  cmp    $0x4,%ebx
  jle    L88
  lea    -0x6(%rbx),%edx
  mov    $0xfffffffe,%eax
  cmp    $0x3,%edx
  ja     L195
  mov    $0x2,%eax
L138:
  test   %r14d,%r14d
  js     L16
  cmp    %r14d,%eax
  jle    L16
  mov    %ebx,0x18(%rsp)
  mov    %r14d,0x1c(%rsp)
  mov    %r15d,0x14(%rsp)
  mov    %r14d,%ebp
  mov    %ebx,0xc(%rsp)
  mov    %r15d,%r12d
  lea    0x1c(%rsp),%r13
  jmp    L92
L88:
  mov    $0xfffffffe,%eax
  test   %ebx,%ebx
  jg     L11
L195:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L41
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  mov    0x10(%rsp),%eax
  jmp    L138
L85:
  mov    0x1c(%rsp),%ebp
  mov    0x14(%rsp),%r12d
  mov    %eax,0xc(%rsp)
L92:
  lea    0x18(%rsp),%rsi
  lea    0x14(%rsp),%rdi
  mov    %r13,%rdx
  call   <follow_slice_link@plt>
  test   %rax,%rax
  je     L168
  mov    0x18(%rsp),%eax
  cmp    %ebx,%eax
  jne    L85
  cmp    %r14d,0x1c(%rsp)
  jne    L85
  cmp    %r15d,0x14(%rsp)
  jne    L85
L168:
  lea    0x30(%rsp),%rcx
  lea    0x28(%rsp),%r9
  lea    0x20(%rsp),%r8
  mov    %r14d,%edx
  mov    %ebx,%esi
  mov    %r15d,%edi
  call   <vis5d_get_slice_link@plt>
  mov    0x20(%rsp),%rax
  mov    (%rax),%edx
  mov    %edx,0x18(%rsp)
  mov    0x28(%rsp),%rdx
  mov    (%rdx),%edx
  mov    %edx,0x1c(%rsp)
  mov    0x30(%rsp),%rdx
  mov    (%rdx),%edx
  mov    %edx,0x14(%rsp)
  movl   $0xffffffff,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0xffffffff,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0xffffffff,(%rax)
  cmp    %ebx,0xc(%rsp)
  setne  %al
  cmp    %r14d,%ebp
  setne  %dl
  or     %dl,%al
  jne    L22
  mov    $0x0,%eax
  cmp    %r15d,%r12d
  je     L195
L22:
  lea    0x30(%rsp),%rcx
  lea    0x28(%rsp),%r9
  lea    0x20(%rsp),%r8
  mov    %ebp,%edx
  mov    0xc(%rsp),%ebx
  mov    %ebx,%esi
  mov    %r12d,%edi
  call   <vis5d_get_slice_link@plt>
  cmp    %ebx,0x18(%rsp)
  je     L82
L1:
  mov    0x20(%rsp),%rax
  mov    0x18(%rsp),%edx
  mov    %edx,(%rax)
  mov    0x28(%rsp),%rax
  mov    0x1c(%rsp),%edx
  mov    %edx,(%rax)
  mov    0x30(%rsp),%rax
  mov    0x14(%rsp),%edx
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L195
L82:
  cmp    %ebp,0x1c(%rsp)
  jne    L1
  cmp    %r12d,0x14(%rsp)
  jne    L1
  movl   $0xffffffff,0x14(%rsp)
  movl   $0xffffffff,0x1c(%rsp)
  movl   $0xffffffff,0x18(%rsp)
  jmp    L1
L16:
  mov    $0xfffffffb,%eax
  jmp    L195
L41:
  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;
}
```