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

```asm
<vis5d_link_slices>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,0xc(%rsp)
  mov    %esi,%ebx
  mov    %edx,%r12d
  mov    %ecx,0x20(%rsp)
  mov    %r8d,%ebp
  mov    %r9d,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  cmp    %r8d,%esi
  sete   %dl
  cmp    %r9d,%r12d
  sete   %al
  test   %al,%dl
  je     L52
  cmp    %ecx,%edi
  je     L101
L52:
  lea    0x30(%rsp),%rsi
  mov    0xc(%rsp),%edi
  call   <vis5d_get_ctx_numvars@plt>
  cmp    $0x9,%ebx
  ja     L14
  mov    %ebx,%eax
  lea    D15(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x2,%eax
  mov    $0x1,%r14d
  mov    $0x0,%r13d
  jmp    L73
  mov    0x30(%rsp),%eax
  mov    $0x0,%r14d
  mov    $0x1,%r13d
  jmp    L73
  mov    0x30(%rsp),%eax
  mov    $0x1,%r14d
  mov    $0x0,%r13d
  jmp    L73
  mov    $0x2,%eax
  mov    $0x0,%r14d
  mov    $0x1,%r13d
L73:
  test   %r12d,%r12d
  js     L108
  cmp    %r12d,%eax
  jle    L108
  lea    0x30(%rsp),%rsi
  mov    0x20(%rsp),%edi
  call   <vis5d_get_ctx_numvars@plt>
  cmp    $0x9,%ebp
  ja     L103
  mov    %ebp,%eax
  lea    D14(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    0x30(%rsp),%eax
  add    $0x1,%r13d
L262:
  mov    0x8(%rsp),%edx
  test   %edx,%edx
  js     L117
  cmp    %edx,%eax
  jle    L117
  cmp    $0x2,%r13d
  je     L159
  cmp    $0x2,%r14d
  jne    L151
L159:
  mov    %ebx,0x34(%rsp)
  mov    %r12d,0x38(%rsp)
  mov    0xc(%rsp),%eax
  mov    %eax,0x3c(%rsp)
  mov    %eax,%r13d
  mov    %r12d,%r14d
  mov    %ebx,(%rsp)
  lea    0x38(%rsp),%r15
  jmp    L54
  mov    0x30(%rsp),%eax
  add    $0x1,%r14d
  jmp    L262
  add    $0x1,%r13d
  mov    $0x2,%eax
  jmp    L262
  add    $0x1,%r14d
  mov    $0x2,%eax
  jmp    L262
L53:
  cmp    %r12d,0x38(%rsp)
  jne    L95
  mov    0xc(%rsp),%edx
  cmp    %edx,0x3c(%rsp)
  jne    L95
L330:
  mov    %ebp,0x34(%rsp)
  mov    0x8(%rsp),%eax
  mov    %eax,0x38(%rsp)
  mov    0x20(%rsp),%ecx
  mov    %ecx,0x3c(%rsp)
  mov    %ecx,%r15d
  mov    %ebp,0x4(%rsp)
  lea    0x38(%rsp),%rdx
  mov    %r14d,0x10(%rsp)
  mov    %eax,%r14d
  mov    %r13d,0x18(%rsp)
  mov    %rdx,%r13
  jmp    L231
L214:
  mov    0x38(%rsp),%r14d
  mov    0x3c(%rsp),%r13d
  mov    %eax,(%rsp)
L54:
  lea    0x34(%rsp),%rsi
  lea    0x3c(%rsp),%rdi
  mov    %r15,%rdx
  call   <follow_slice_link@plt>
  test   %rax,%rax
  je     L330
  mov    0x34(%rsp),%eax
  cmp    %ebx,%eax
  je     L53
L95:
  cmp    %ebp,%eax
  jne    L214
  mov    0x8(%rsp),%ecx
  cmp    %ecx,0x38(%rsp)
  jne    L214
  mov    0x20(%rsp),%ecx
  mov    %ecx,0x3c(%rsp)
  test   %ecx,%ecx
  je     L214
  mov    $0x1,%eax
  jmp    L312
L236:
  mov    0x8(%rsp),%ecx
  cmp    %ecx,0x38(%rsp)
  jne    L56
  mov    0x20(%rsp),%edx
  cmp    %edx,0x3c(%rsp)
  jne    L56
L282:
  mov    %r14d,0x24(%rsp)
  mov    0x10(%rsp),%r14d
  mov    0x18(%rsp),%r13d
  lea    0x48(%rsp),%rax
  lea    0x40(%rsp),%rcx
  lea    0x50(%rsp),%rdi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r9
  mov    %rcx,0x18(%rsp)
  mov    %rcx,%r8
  mov    %rdi,0x28(%rsp)
  mov    %rdi,%rcx
  mov    %r14d,%edx
  mov    (%rsp),%esi
  mov    %r13d,%edi
  call   <vis5d_get_slice_link@plt>
  mov    0x40(%rsp),%rax
  mov    %ebp,(%rax)
  mov    0x48(%rsp),%rax
  mov    0x8(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x50(%rsp),%rax
  mov    0x20(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x10(%rsp),%r9
  mov    0x18(%rsp),%r8
  mov    0x28(%rsp),%rcx
  mov    0x24(%rsp),%edx
  mov    0x4(%rsp),%esi
  mov    %r15d,%edi
  call   <vis5d_get_slice_link@plt>
  mov    0x40(%rsp),%rax
  mov    %ebx,(%rax)
  mov    0x48(%rsp),%rax
  mov    %r12d,(%rax)
  mov    0x50(%rsp),%rax
  mov    0xc(%rsp),%ebx
  mov    %ebx,(%rax)
  mov    $0x0,%eax
L312:
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L186
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L205:
  mov    0x38(%rsp),%r14d
  mov    0x3c(%rsp),%r15d
  mov    %eax,0x4(%rsp)
L231:
  lea    0x34(%rsp),%rsi
  lea    0x3c(%rsp),%rdi
  mov    %r13,%rdx
  call   <follow_slice_link@plt>
  test   %rax,%rax
  je     L282
  mov    0x34(%rsp),%eax
  cmp    %ebp,%eax
  je     L236
L56:
  cmp    %ebx,%eax
  jne    L205
  cmp    %r12d,0x38(%rsp)
  jne    L205
  mov    0xc(%rsp),%ecx
  mov    %ecx,0x3c(%rsp)
  test   %ecx,%ecx
  je     L205
  mov    $0x1,%eax
  jmp    L312
L101:
  mov    $0xfffffffc,%eax
  jmp    L312
L14:
  mov    $0xfffffffe,%eax
  jmp    L312
L108:
  mov    $0xfffffffb,%eax
  jmp    L312
L103:
  mov    $0xfffffffe,%eax
  jmp    L312
L117:
  mov    $0xfffffffb,%eax
  jmp    L312
L151:
  mov    $0xfffffffc,%eax
  jmp    L312
L186:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int vis5d_link_slices(int vindex1, int type1, int number1, int vindex2, int type2, int number2) {
  int numvar, numh, numv, nmax;
  int cur_type, cur_num, end1_type, end1_num, end2_type, end2_num;
  int *p_type, *p_num, *p_vindex, cur_vindex, end1_vindex, end2_vindex;
  if ((vindex1 == vindex2) && (type1 == type2) && (number1 == number2))
    return -4;
  vis5d_get_ctx_numvars(vindex1, &numvar);
  numh = numv = 0;
  switch (type1) {
  case 1:
  case 3:
    nmax = numvar;
    numh++;
    break;
  case 2:
  case 4:
    nmax = numvar;
    numv++;
    break;
  case 6:
  case 8:
    nmax = 2;
    numh++;
    break;
  case 7:
  case 9:
    nmax = 2;
    numv++;
    break;
  default:
    return -2;
  }
  if ((number1 < 0) || (number1 >= nmax))
    return -5;
  vis5d_get_ctx_numvars(vindex2, &numvar);
  switch (type2) {
  case 1:
  case 3:
    nmax = numvar;
    numh++;
    break;
  case 2:
  case 4:
    nmax = numvar;
    numv++;
    break;
  case 6:
  case 8:
    nmax = 2;
    numh++;
    break;
  case 7:
  case 9:
    nmax = 2;
    numv++;
    break;
  default:
    return -2;
  }
  if ((number2 < 0) || (number2 >= nmax))
    return -5;
  if ((numh != 2) && (numv != 2))
    return -4;
  end1_type = type1;
  end1_num = number1;
  end1_vindex = vindex1;
  cur_type = type1;
  cur_num = number1;
  cur_vindex = vindex1;
  while (follow_slice_link(&cur_vindex, &cur_type, &cur_num)) {
    if ((cur_type == type1) && (cur_num == number1) && (cur_vindex == vindex1)) {
      break;
    }
    if ((cur_type == type2) && (cur_num == number2) && (cur_vindex = vindex2)) {
      return 1;
    }
    end1_type = cur_type;
    end1_num = cur_num;
    end1_vindex = cur_vindex;
  }
  end2_type = type2;
  end2_num = number2;
  end2_vindex = vindex2;
  cur_type = type2;
  cur_num = number2;
  cur_vindex = vindex2;
  while (follow_slice_link(&cur_vindex, &cur_type, &cur_num)) {
    if ((cur_type == type2) && (cur_num == number2) && (cur_vindex == vindex2)) {
      break;
    }
    if ((cur_type == type1) && (cur_num == number1) && (cur_vindex = vindex1)) {
      return 1;
    }
    end2_type = cur_type;
    end2_num = cur_num;
    end2_vindex = cur_vindex;
  }
  vis5d_get_slice_link(end1_vindex, end1_type, end1_num, &p_vindex, &p_type, &p_num);
  *p_type = type2;
  *p_num = number2;
  *p_vindex = vindex2;
  vis5d_get_slice_link(end2_vindex, end2_type, end2_num, &p_vindex, &p_type, &p_num);
  *p_type = type1;
  *p_num = number1;
  *p_vindex = vindex1;
  return 0;
}
```