user: Converte this assembly snippet into its equivalent C code:

```asm
<delnod_>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %rcx,0x28(%rsp)
  mov    %r8,0x30(%rsp)
  mov    %r9,0x8(%rsp)
  mov    (%rdi),%edx
  mov    %edx,D429(%rip)
  mov    (%rsi),%ecx
  mov    %ecx,D517(%rip)
  cmp    %ecx,%edx
  setg   %al
  test   %edx,%edx
  setle  %sil
  or     %esi,%eax
  cmp    $0x3,%ecx
  setle  %cl
  mov    $0x1,%esi
  or     %cl,%al
  mov    %al,0x3b(%rsp)
  je     L634
L254:
  mov    0xa8(%rsp),%rax
  mov    %esi,(%rax)
  mov    $0x0,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L634:
  mov    0x98(%rsp),%rax
  cmpl   $0x0,(%rax)
  js     L254
  mov    0x88(%rsp),%rax
  lea    -0x4(%rax),%r12
  mov    0x80(%rsp),%rax
  lea    -0x4(%rax),%rbp
  lea    -0x4(%r9),%rbx
  movslq %edx,%rdx
  mov    (%r12,%rdx,4),%eax
  mov    %eax,D641(%rip)
  cltq
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D1756(%rip)
  mov    0x80(%rsp),%rsi
  lea    D641(%rip),%rdi
  mov    $0x0,%eax
  call   <nbcnt_@plt>
  movslq D641(%rip),%rdx
  mov    (%rbx,%rdx,4),%ecx
  mov    %ecx,%edx
  shr    $0x1f,%edx
  mov    %edx,D980(%rip)
  lea    0x1(%rax),%edx
  test   %ecx,%ecx
  cmovs  %edx,%eax
  mov    %eax,D1807(%rip)
  cmp    $0x2,%eax
  jle    L311
  mov    0x98(%rsp),%rdi
  mov    (%rdi),%ecx
  lea    -0x3(%rax),%edx
  mov    %edx,(%rdi)
  mov    $0x2,%esi
  cmp    %edx,%ecx
  jl     L254
  mov    0x30(%rsp),%rdi
  lea    -0x8(%rdi),%r13
  mov    0x28(%rsp),%rdi
  lea    -0x8(%rdi),%r14
  mov    0x20(%rsp),%rdi
  lea    -0x8(%rdi),%r15
  movl   $0x0,D1098(%rip)
  cmp    $0x3,%eax
  je     L241
  mov    0xa0(%rsp),%rax
  sub    $0xc,%rax
  mov    %rax,0x18(%rsp)
  movslq D429(%rip),%rax
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,D1289(%rip)
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,D1702(%rip)
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,D1675(%rip)
  movslq D1756(%rip),%rdx
  mov    (%rbx,%rdx,4),%eax
  mov    %eax,D564(%rip)
  mov    %eax,D1728(%rip)
  cltq
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,D1871(%rip)
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,D1828(%rip)
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,D860(%rip)
  movslq 0x0(%rbp,%rdx,4),%rdx
  mov    (%rbx,%rdx,4),%eax
  mov    %eax,D1254(%rip)
  cltq
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,D723(%rip)
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,D1018(%rip)
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,D463(%rip)
  mov    0x0(%rbp,%rdx,4),%eax
  mov    %eax,D426(%rip)
  jmp    L513
L63:
  cmpl   $0x0,D980(%rip)
  je     L168
  jmp    L592
L632:
  sub    $0x8,%rsp
  lea    D1675(%rip),%rax
  push   %rax
  lea    D1702(%rip),%rax
  push   %rax
  lea    D1289(%rip),%rax
  push   %rax
  lea    D985(%rip),%r9
  lea    D1789(%rip),%r8
  lea    D143(%rip),%rcx
  lea    D860(%rip),%rdx
  lea    D1828(%rip),%rsi
  lea    D1871(%rip),%rdi
  mov    $0x0,%eax
  call   <left_@plt>
  add    $0x20,%rsp
  test   %eax,%eax
  jne    L45
L125:
  mov    D1254(%rip),%eax
  mov    %eax,D434(%rip)
  movsd  D723(%rip),%xmm0
  movsd  %xmm0,D434(%rip)
  movsd  D1018(%rip),%xmm0
  movsd  %xmm0,D434(%rip)
  movsd  D463(%rip),%xmm0
  movsd  %xmm0,D434(%rip)
L192:
  mov    D564(%rip),%eax
  cmp    %eax,D434(%rip)
  je     L631
  mov    D434(%rip),%eax
  mov    %eax,D670(%rip)
  movsd  D143(%rip),%xmm0
  movsd  %xmm0,D670(%rip)
  movsd  D1789(%rip),%xmm0
  movsd  %xmm0,D670(%rip)
  movsd  D985(%rip),%xmm0
  movsd  %xmm0,D670(%rip)
  movslq D426(%rip),%rax
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D670(%rip)
L513:
  movslq D670(%rip),%rax
  mov    (%rbx,%rax,4),%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %eax,D670(%rip)
  cmp    D564(%rip),%eax
  je     L63
L168:
  cltq
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,D670(%rip)
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,D670(%rip)
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,D670(%rip)
  movslq D670(%rip),%rax
  mov    (%r12,%rax,4),%eax
  mov    %eax,D670(%rip)
  cmpl   $0x0,D980(%rip)
  je     L632
L45:
  movslq D670(%rip),%rax
  cmpl   $0x0,(%rbx,%rax,4)
  js     L464
  sub    $0x8,%rsp
  lea    D670(%rip),%rax
  push   %rax
  lea    D670(%rip),%rax
  push   %rax
  lea    D670(%rip),%rax
  push   %rax
  lea    D434(%rip),%r9
  lea    D434(%rip),%r8
  lea    D434(%rip),%rcx
  lea    D670(%rip),%rdx
  lea    D670(%rip),%rsi
  lea    D670(%rip),%rdi
  mov    $0x0,%eax
  call   <left_@plt>
  add    $0x20,%rsp
  test   %eax,%eax
  je     L125
L464:
  lea    D390(%rip),%rax
  push   %rax
  push   0x90(%rsp)
  mov    0x90(%rsp),%r9
  mov    0x18(%rsp),%r8
  lea    D670(%rip),%rcx
  lea    D429(%rip),%rdx
  lea    D434(%rip),%rsi
  lea    D670(%rip),%rdi
  mov    $0x0,%eax
  call   <swap_@plt>
  add    $0x10,%rsp
  cmpl   $0x0,D390(%rip)
  je     L481
  mov    D1098(%rip),%eax
  add    $0x1,%eax
  mov    %eax,D1373(%rip)
  mov    D670(%rip),%edx
  cmp    D429(%rip),%edx
  jg     L58
  add    %eax,%eax
  cltq
  mov    0x18(%rsp),%rdi
  mov    %edx,0x4(%rdi,%rax,4)
L670:
  mov    D434(%rip),%eax
  cmp    D429(%rip),%eax
  jg     L135
  mov    D1373(%rip),%edi
  lea    (%rdi,%rdi,1),%edx
  movslq %edx,%rdx
  mov    0x18(%rsp),%rdi
  mov    %eax,0x8(%rdi,%rdx,4)
L67:
  movslq D429(%rip),%rax
  mov    (%r12,%rax,4),%edx
  mov    %edx,D1373(%rip)
  mov    D1807(%rip),%eax
  sub    $0x1,%eax
  mov    %eax,D1373(%rip)
  cmp    $0x3,%eax
  je     L241
  movslq %edx,%rdx
  mov    0x0(%rbp,%rdx,4),%eax
  mov    %eax,D1373(%rip)
  cltq
  mov    (%rbx,%rax,4),%eax
  mov    %eax,D1373(%rip)
  mov    0x80(%rsp),%rcx
  mov    0x8(%rsp),%rdx
  lea    D670(%rip),%rsi
  lea    D1373(%rip),%rdi
  mov    $0x0,%eax
  call   <lstptr_@plt>
  mov    %eax,D1373(%rip)
  mov    D434(%rip),%eax
  cmp    D1373(%rip),%eax
  je     L192
  mov    %eax,D1373(%rip)
  movsd  D434(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  D434(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  D434(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  movslq D390(%rip),%rax
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D1373(%rip)
  cltq
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D1373(%rip)
  cltq
  mov    (%rbx,%rax,4),%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %eax,D1373(%rip)
  cltq
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,D1373(%rip)
  jmp    L513
L481:
  mov    D1373(%rip),%eax
  mov    %eax,D1373(%rip)
  movsd  D1373(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  D1373(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  movsd  D1373(%rip),%xmm0
  movsd  %xmm0,D1373(%rip)
  jmp    L192
L58:
  add    %eax,%eax
  cltq
  sub    $0x1,%edx
  mov    0x18(%rsp),%rdi
  mov    %edx,0x4(%rdi,%rax,4)
  jmp    L670
L135:
  mov    D1373(%rip),%edi
  lea    (%rdi,%rdi,1),%edx
  movslq %edx,%rdx
  sub    $0x1,%eax
  mov    0x18(%rsp),%rdi
  mov    %eax,0x8(%rdi,%rdx,4)
  jmp    L67
L631:
  cmpl   $0x0,D980(%rip)
  jne    L592
  cmpl   $0x3,D1373(%rip)
  jle    L651
  movl   $0x1,D980(%rip)
L582:
  mov    D517(%rip),%ecx
  movl   $0x1,D1373(%rip)
  test   %ecx,%ecx
  jle    L49
  mov    $0x2,%eax
  mov    $0x1,%esi
  movzbl 0x3b(%rsp),%r8d
  mov    0x88(%rsp),%rdi
L455:
  movslq -0x8(%rdi,%rax,4),%rdx
  cmpl   $0x0,(%rbx,%rdx,4)
  js     L655
  mov    %eax,0x3c(%rsp)
  add    $0x1,%rax
  mov    %esi,%r8d
  lea    -0x1(%rax),%edx
  cmp    %edx,%ecx
  jge    L455
  mov    0x3c(%rsp),%eax
  mov    %eax,D1298(%rip)
L49:
  movslq D1373(%rip),%rax
  negl   (%rbx,%rax,4)
  addl   $0x1,D1373(%rip)
  jmp    L592
L655:
  test   %r8b,%r8b
  je     L189
  mov    0x3c(%rsp),%eax
  mov    %eax,D1298(%rip)
L189:
  movl   $0x0,D980(%rip)
  jmp    L653
L547:
  mov    %edx,D1298(%rip)
  jmp    L354
L227:
  mov    D1298(%rip),%eax
  cmp    %eax,D1298(%rip)
  je     L495
L296:
  movslq D1298(%rip),%rax
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D1298(%rip)
  cltq
  mov    (%rbx,%rax,4),%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %eax,D1298(%rip)
  push   %r15
  push   %r14
  mov    0x98(%rsp),%r9
  mov    0x90(%rsp),%r8
  mov    0x18(%rsp),%rcx
  mov    0x20(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <delnb_@plt>
  mov    D1298(%rip),%edx
  add    $0x10,%rsp
  test   %edx,%edx
  js     L311
  mov    D1102(%rip),%eax
  cmp    %eax,D920(%rip)
  je     L547
L354:
  cmp    D1298(%rip),%eax
  jne    L227
  mov    %edx,D920(%rip)
  jmp    L227
L495:
  mov    D517(%rip),%ecx
  lea    -0x1(%rcx),%r10d
  mov    %r10d,D920(%rip)
  mov    D429(%rip),%eax
  cmp    %eax,%r10d
  jl     L499
  cltq
  mov    0x20(%rsp),%rdx
  mov    0x28(%rsp),%rsi
  mov    0x30(%rsp),%rdi
  mov    0x88(%rsp),%r8
L352:
  movsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,-0x8(%rdx,%rax,8)
  movsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,-0x8(%rsi,%rax,8)
  movsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,-0x8(%rdi,%rax,8)
  mov    (%r8,%rax,4),%r9d
  mov    %r9d,-0x4(%r8,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r10d
  jge    L352
  mov    D1102(%rip),%r9d
  movl   $0x1,D1298(%rip)
  cmp    $0x1,%r9d
  jle    L499
  mov    0x8(%rsp),%rdi
  mov    %rdi,%rax
  lea    -0x1(%r9),%edx
  lea    (%rdi,%rdx,4),%r8
  jmp    L358
L402:
  add    $0x4,%rax
  cmp    %r8,%rax
  je     L109
L358:
  mov    %rax,%rdi
  mov    (%rax),%edx
  cmp    D429(%rip),%edx
  jle    L335
  sub    $0x1,%edx
  mov    %edx,(%rax)
L335:
  mov    (%rdi),%esi
  mov    D429(%rip),%edx
  neg    %edx
  cmp    %edx,%esi
  jge    L402
  add    $0x1,%esi
  mov    %esi,(%rdi)
  jmp    L402
L109:
  mov    %r9d,D920(%rip)
L499:
  cmpl   $0x0,D980(%rip)
  je     L108
  subl   $0x1,D1373(%rip)
L108:
  mov    D920(%rip),%edi
  mov    %edi,D920(%rip)
  mov    D1373(%rip),%r11d
  movl   $0x1,D122(%rip)
  test   %r11d,%r11d
  jle    L468
  lea    -0x1(%rcx),%eax
  cltq
  mov    0x88(%rsp),%rsi
  lea    -0x4(%rsi,%rax,4),%r12
  movslq %ecx,%rax
  lea    -0xc(,%rax,4),%rsi
  lea    -0x2(%rcx),%eax
  shl    $0x2,%rax
  sub    %rax,%rsi
  add    0x88(%rsp),%rsi
  mov    $0x0,%r9d
  mov    $0x0,%r13d
  mov    0x80(%rsp),%rdx
  jmp    L523
L508:
  mov    %edi,(%rax)
  jmp    L435
L395:
  mov    %edi,(%rax)
L194:
  mov    D1102(%rip),%eax
  sub    $0x1,%eax
  test   %eax,%eax
  jle    L557
  cltq
  jmp    L25
L37:
  sub    $0x1,%rax
  test   %eax,%eax
  jle    L620
L25:
  mov    D1102(%rip),%ecx
  cmp    %ecx,-0x4(%rdx,%rax,4)
  jne    L37
  mov    %edi,-0x4(%rdx,%rax,4)
  jmp    L37
L620:
  mov    %r13d,%eax
L557:
  lea    0x1(%r9),%ecx
  cmp    %r11d,%ecx
  je     L480
  mov    %ecx,%r9d
  mov    %r8d,%edi
L523:
  mov    D1102(%rip),%eax
  sub    $0x1,%eax
  mov    %eax,D1629(%rip)
  movslq %edi,%r14
  lea    0x0(%rbp,%r14,4),%rcx
  mov    (%rcx),%r8d
  cltq
  mov    (%rbx,%rax,4),%eax
  mov    %eax,(%rbx,%r14,4)
  movslq D1629(%rip),%rax
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,(%rcx)
  movslq %r8d,%rax
  lea    0x0(%rbp,%rax,4),%rax
  mov    D1629(%rip),%ecx
  cmp    %ecx,(%rax)
  je     L508
L435:
  mov    D1629(%rip),%ecx
  cmp    %ecx,%r8d
  cmove  %edi,%r8d
  test   %r10d,%r10d
  jle    L194
  mov    %r12,%rax
L71:
  cmp    (%rax),%ecx
  je     L395
  sub    $0x4,%rax
  cmp    %rax,%rsi
  jne    L71
  jmp    L194
L480:
  mov    %eax,D1629(%rip)
  add    $0x2,%r9d
  mov    %r9d,D1629(%rip)
  mov    %edi,D1629(%rip)
  mov    %r8d,D1629(%rip)
L468:
  mov    0x10(%rsp),%rax
  mov    %r10d,(%rax)
  mov    D1629(%rip),%eax
  mov    0x90(%rsp),%rbx
  mov    %eax,(%rbx)
  mov    D1373(%rip),%eax
  test   %eax,%eax
  jg     L546
L572:
  mov    $0x0,%esi
  jmp    L254
L546:
  shl    $0x2,%eax
  mov    %eax,D1629(%rip)
  lea    D1740(%rip),%rax
  push   %rax
  push   0xa8(%rsp)
  lea    D1629(%rip),%rax
  push   %rax
  push   0xa0(%rsp)
  mov    0xa0(%rsp),%r9
  mov    0x28(%rsp),%r8
  lea    D1373(%rip),%rcx
  mov    0x50(%rsp),%rdx
  mov    0x48(%rsp),%rsi
  mov    0x40(%rsp),%rdi
  mov    $0x0,%eax
  call   <optim_@plt>
  mov    D1740(%rip),%eax
  add    $0x20,%rsp
  mov    $0x5,%esi
  cmp    $0x1,%eax
  ja     L254
  mov    $0x6,%esi
  jne    L572
  jmp    L254
L311:
  mov    $0x3,%esi
  jmp    L254
L241:
  cmpl   $0x0,D980(%rip)
  jne    L592
L651:
  movslq D920(%rip),%rdx
  mov    0x0(%rbp,%rdx,4),%eax
  mov    %eax,D1698(%rip)
  cltq
  mov    (%rbx,%rax,4),%ecx
  mov    %ecx,D1698(%rip)
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,D1698(%rip)
  cltq
  mov    (%rbx,%rax,4),%eax
  mov    %eax,D1698(%rip)
  mov    (%rbx,%rdx,4),%edx
  mov    %edx,D1698(%rip)
  cltq
  shl    $0x3,%rax
  movslq %edx,%rdx
  shl    $0x3,%rdx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  lea    (%r15,%rdx,1),%r11
  lea    0x0(%r13,%rcx,1),%r10
  lea    (%r14,%rcx,1),%rsi
  lea    (%r15,%rcx,1),%rdi
  sub    $0x8,%rsp
  lea    0x0(%r13,%rax,1),%rcx
  push   %rcx
  lea    (%r14,%rax,1),%rcx
  push   %rcx
  add    %r15,%rax
  push   %rax
  lea    0x0(%r13,%rdx,1),%r9
  lea    (%r14,%rdx,1),%r8
  mov    %r11,%rcx
  mov    %r10,%rdx
  mov    $0x0,%eax
  call   <left_@plt>
  mov    %eax,D1698(%rip)
  add    $0x20,%rsp
  test   %eax,%eax
  jne    L582
L653:
  mov    $0x4,%esi
  cmpl   $0x3,D1373(%rip)
  jg     L254
L592:
  mov    D920(%rip),%eax
  mov    %eax,D1698(%rip)
  mov    0x90(%rsp),%rax
  mov    (%rax),%eax
  mov    %eax,D1698(%rip)
  lea    D1298(%rip),%r15
  lea    D1698(%rip),%r14
  lea    D429(%rip),%r13
  lea    D1698(%rip),%r12
  jmp    L296
```

assistant: ```c
int delnod_(int *k, int *n, double *x, double *y, double *z__, int *list, int *lptr, int *lend, int *lnew, int *lwk, int *iwk, int *ier) {
  int i__1;
  static int i__, j, n1, n2;
  static double x1, x2, y11, y2, z1, z2;
  static int nl, lp, nn, nr;
  static double xl, yl, zl, xr, yr, zr;
  static int nnb, lp21, lpf, lph, lpl, lpn, iwl, nit, lnw, lpl2;
  static int bdry;
  static int ierr, lwkl;
  static int nfrst;
  iwk -= 3;
  --lend;
  --lptr;
  --list;
  --z__;
  --y;
  --x;
  n1 = *k;
  nn = *n;
  if (n1 < 1 || n1 > nn || nn < 4 || *lwk < 0) {
    goto L21;
  }
  lpl = lend[n1];
  lpf = lptr[lpl];
  nnb = nbcnt_(&lpl, &lptr[1]);
  bdry = list[lpl] < 0;
  if (bdry) {
    ++nnb;
  }
  if (nnb < 3) {
    goto L23;
  }
  lwkl = *lwk;
  *lwk = nnb - 3;
  if (lwkl < *lwk) {
    goto L22;
  }
  iwl = 0;
  if (nnb == 3) {
    goto L3;
  }
  x1 = x[n1];
  y11 = y[n1];
  z1 = z__[n1];
  nfrst = list[lpf];
  nr = nfrst;
  xr = x[nr];
  yr = y[nr];
  zr = z__[nr];
  lp = lptr[lpf];
  n2 = list[lp];
  x2 = x[n2];
  y2 = y[n2];
  z2 = z__[n2];
  lp = lptr[lp];
L1:
  nl = (i__1 = list[lp], ((i__1) >= 0 ? (i__1) : -(i__1)));
  if (nl == nfrst && bdry) {
    goto L3;
  }
  xl = x[nl];
  yl = y[nl];
  zl = z__[nl];
  lpl2 = lend[n2];
  if (!((bdry || left_(&xr, &yr, &zr, &xl, &yl, &zl, &x1, &y11, &z1)) && (list[lpl2] < 0 || left_(&xl, &yl, &zl, &xr, &yr, &zr, &x2, &y2, &z2)))) {
    nr = n2;
    xr = x2;
    yr = y2;
    zr = z2;
    goto L2;
  }
  swap_(&nl, &nr, &n1, &n2, &list[1], &lptr[1], &lend[1], &lp21);
  if (lp21 == 0) {
    nr = n2;
    xr = x2;
    yr = y2;
    zr = z2;
    goto L2;
  }
  ++iwl;
  if (nl <= n1) {
    iwk[(iwl << 1) + 1] = nl;
  } else {
    iwk[(iwl << 1) + 1] = nl - 1;
  }
  if (nr <= n1) {
    iwk[(iwl << 1) + 2] = nr;
  } else {
    iwk[(iwl << 1) + 2] = nr - 1;
  }
  lpl = lend[n1];
  --nnb;
  if (nnb == 3) {
    goto L3;
  }
  lpf = lptr[lpl];
  nfrst = list[lpf];
  lp = lstptr_(&lpl, &nl, &list[1], &lptr[1]);
  if (nr == nfrst) {
    goto L2;
  }
  n2 = nr;
  x2 = xr;
  y2 = yr;
  z2 = zr;
  lp21 = lptr[lp21];
  lp21 = lptr[lp21];
  nr = (i__1 = list[lp21], ((i__1) >= 0 ? (i__1) : -(i__1)));
  xr = x[nr];
  yr = y[nr];
  zr = z__[nr];
  goto L1;
L2:
  if (n2 == nfrst) {
    goto L3;
  }
  n2 = nl;
  x2 = xl;
  y2 = yl;
  z2 = zl;
  lp = lptr[lp];
  goto L1;
L3:
  if (!bdry) {
    if (nnb > 3) {
      bdry = (1);
    } else {
      lpf = lptr[lpl];
      nr = list[lpf];
      lp = lptr[lpf];
      n2 = list[lp];
      nl = list[lpl];
      bdry = left_(&x[nr], &y[nr], &z__[nr], &x[nl], &y[nl], &z__[nl], &x[n2], &y[n2], &z__[n2]);
    }
    if (bdry) {
      i__1 = nn;
      for (i__ = 1; i__ <= i__1; ++i__) {
        if (list[lend[i__]] < 0) {
          bdry = (0);
          goto L5;
        }
      }
      list[lpl] = -list[lpl];
      ++nnb;
    }
  }
L5:
  if (!bdry && nnb > 3) {
    goto L24;
  }
  lp = lpl;
  lnw = *lnew;
L6:
  lp = lptr[lp];
  n2 = (i__1 = list[lp], ((i__1) >= 0 ? (i__1) : -(i__1)));
  delnb_(&n2, &n1, n, &list[1], &lptr[1], &lend[1], &lnw, &lph);
  if (lph < 0) {
    goto L23;
  }
  if (lpl == lnw) {
    lpl = lph;
  }
  if (lp == lnw) {
    lp = lph;
  }
  if (lp != lpl) {
    goto L6;
  }
  --nn;
  if (n1 > nn) {
    goto L9;
  }
  i__1 = nn;
  for (i__ = n1; i__ <= i__1; ++i__) {
    x[i__] = x[i__ + 1];
    y[i__] = y[i__ + 1];
    z__[i__] = z__[i__ + 1];
    lend[i__] = lend[i__ + 1];
  }
  i__1 = lnw - 1;
  for (i__ = 1; i__ <= i__1; ++i__) {
    if (list[i__] > n1) {
      --list[i__];
    }
    if (list[i__] < -n1) {
      ++list[i__];
    }
  }
L9:
  if (bdry) {
    --nnb;
  }
  lpn = lpl;
  i__1 = nnb;
  for (j = 1; j <= i__1; ++j) {
    --lnw;
    lp = lpn;
    lpn = lptr[lp];
    list[lp] = list[lnw];
    lptr[lp] = lptr[lnw];
    if (lptr[lpn] == lnw) {
      lptr[lpn] = lp;
    }
    if (lpn == lnw) {
      lpn = lp;
    }
    for (i__ = nn; i__ >= 1; --i__) {
      if (lend[i__] == lnw) {
        lend[i__] = lp;
        goto L11;
      }
    }
  L11:
    for (i__ = lnw - 1; i__ >= 1; --i__) {
      if (lptr[i__] == lnw) {
        lptr[i__] = lp;
      }
    }
  }
  *n = nn;
  *lnew = lnw;
  if (iwl > 0) {
    nit = iwl << 2;
    optim_(&x[1], &y[1], &z__[1], &iwl, &list[1], &lptr[1], &lend[1], &nit, &iwk[3], &ierr);
    if (ierr != 0 && ierr != 1) {
      goto L25;
    }
    if (ierr == 1) {
      goto L26;
    }
  }
  *ier = 0;
  return 0;
L21:
  *ier = 1;
  return 0;
L22:
  *ier = 2;
  return 0;
L23:
  *ier = 3;
  return 0;
L24:
  *ier = 4;
  return 0;
L25:
  *ier = 5;
  return 0;
L26:
  *ier = 6;
  return 0;
}
```