user: Please show me the C implementation that matches the assembly code listed below:

```asm
<find_stable>:
  endbr64
  push   %rbp
  mov    %rdi,%rax
  mov    %rsi,%rdx
  push   %rbx
  mov    (%rdi),%r10d
  cmp    $0x2,%r10d
  je     L1611
  cmpl   $0x2,0x4(%rdi)
  je     L1718
  mov    0x8(%rdi),%ecx
  cmp    $0x2,%ecx
  je     L1108
  cmpl   $0x2,0xc(%rdi)
  je     L877
  cmpl   $0x2,0x10(%rdi)
  je     L851
  cmpl   $0x2,0x14(%rdi)
  je     L589
  cmpl   $0x2,0x18(%rdi)
  je     L1334
  cmpl   $0x2,0x1c(%rdi)
  je     L743
  movdqa D83(%rip),%xmm0
  movups %xmm0,(%rsi)
  movups %xmm0,0x10(%rsi)
L860:
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L1718:
  mov    $0x1,%ecx
  nopw   0x0(%rax,%rax,1)
L1108:
  lea    0x1(%rcx),%edi
  lea    -0x1(%rcx),%r11d
  movslq %edi,%r8
  cmpl   $0x2,(%rax,%r8,4)
  lea    0x0(,%r8,4),%rsi
  jne    L1511
  lea    0x2(%rcx),%edi
  cmp    $0x6,%ecx
  je     L558
  cmpl   $0x2,0x4(%rax,%rsi,1)
  jne    L1511
  lea    0x3(%rcx),%edi
  cmp    $0x5,%ecx
  je     L558
  cmpl   $0x2,0x8(%rax,%rsi,1)
  jne    L1511
  lea    0x4(%rcx),%edi
  cmp    $0x4,%ecx
  je     L558
  cmpl   $0x2,0xc(%rax,%rsi,1)
  jne    L1511
  lea    0x5(%rcx),%edi
  cmp    $0x3,%ecx
  je     L1511
  cmpl   $0x2,0x10(%rax,%rsi,1)
  jne    L1511
  cmp    $0x2,%ecx
  je     L1
  xor    %edi,%edi
  cmpl   $0x2,0x14(%rax,%rsi,1)
  sete   %dil
  add    $0x7,%edi
L1511:
  movslq %r11d,%rsi
  mov    (%rax,%rsi,4),%r8d
  lea    0x0(,%rsi,4),%r9
  lea    -0x2(%rcx),%esi
  cmp    $0x1,%ecx
  je     L69
L763:
  cmp    -0x4(%rax,%r9,1),%r8d
  jne    L1043
  lea    -0x1(%rsi),%ebx
  test   %esi,%esi
  je     L69
  cmp    -0x8(%rax,%r9,1),%r8d
  jne    L223
  lea    -0x2(%rsi),%ebx
  cmp    $0x1,%esi
  je     L69
  cmp    -0xc(%rax,%r9,1),%r8d
  jne    L223
  lea    -0x3(%rsi),%ebx
  cmp    $0x2,%esi
  je     L1487
  cmp    -0x10(%rax,%r9,1),%r8d
  jne    L223
  lea    -0x4(%rsi),%ebx
  cmp    $0x3,%esi
  je     L1487
  cmp    -0x14(%rax,%r9,1),%r8d
  jne    L223
  cmp    $0x4,%esi
  je     L1487
  cmp    %r8d,%r10d
  jne    L410
  lea    -0x1(%rcx),%esi
  cmp    $0x2,%esi
  jbe    L69
L259:
  movdqa D83(%rip),%xmm0
  mov    $0x4,%esi
  movups %xmm0,(%rdx)
  cmp    $0x4,%ecx
  je     L1611
L899:
  movslq %esi,%rcx
  add    $0x1,%esi
  movl   $0x6,(%rdx,%rcx,4)
  lea    0x0(,%rcx,4),%rdi
  cmp    %r11d,%esi
  jg     L1611
L521:
  movl   $0x6,0x4(%rdx,%rdi,1)
  cmp    %r11d,%esi
  jge    L1611
  movl   $0x6,0x8(%rdx,%rdi,1)
  nopl   0x0(%rax,%rax,1)
L1611:
  cmpl   $0x2,0x1c(%rax)
  je     L860
  cmpl   $0x2,0x18(%rax)
  lea    0x1c(%rax),%r11
  je     L342
  cmpl   $0x2,0x14(%rax)
  je     L0
  cmpl   $0x2,0x10(%rax)
  je     L1259
  cmpl   $0x2,0xc(%rax)
  je     L1228
  mov    0x8(%rax),%esi
  cmp    $0x2,%esi
  je     L1323
  mov    0x4(%rax),%ecx
  cmp    $0x2,%ecx
  je     L392
  cmpl   $0x2,(%rax)
  je     L76
  mov    (%rax),%r9d
  xor    %r8d,%r8d
  mov    $0x1,%edi
  xor    %r10d,%r10d
  xor    %ecx,%ecx
  nop
L408:
  lea    0x4(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L1052
  lea    0x1(%rdi),%ebx
  cmp    $0x7,%edi
  je     L652
  lea    0x8(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L103
  lea    0x2(%rdi),%ebx
  cmp    $0x6,%edi
  je     L652
  lea    0xc(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L103
  lea    0x3(%rdi),%ebx
  cmp    $0x5,%edi
  je     L35
  lea    0x10(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L103
  lea    0x4(%rdi),%ebx
  cmp    $0x4,%edi
  je     L919
  lea    0x14(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L103
  lea    0x5(%rdi),%ebx
  cmp    $0x3,%edi
  je     L919
  lea    0x18(%rax,%r8,1),%rsi
  cmp    %r9d,(%rsi)
  jne    L103
  cmp    $0x2,%edi
  je     L919
  cmp    %r9d,0x1c(%rax)
  jne    L167
L919:
  mov    $0x8,%eax
  mov    $0x1,%esi
  sub    %ecx,%eax
  cmp    $0x7,%ecx
  cmovg  %esi,%eax
  mov    $0x7,%esi
  sub    %ecx,%esi
  cmp    $0x2,%esi
  jbe    L1431
L1639:
  movdqa D83(%rip),%xmm0
  mov    %eax,%esi
  shr    $0x2,%esi
  movups %xmm0,0x10(%rdx)
  cmp    $0x2,%esi
  je     L549
  cmp    $0x4,%eax
  je     L860
  mov    $0x3,%eax
L1143:
  movslq %eax,%rsi
  sub    $0x1,%eax
  movl   $0x6,(%rdx,%rsi,4)
  lea    0x0(,%rsi,4),%rdi
  cmp    %ecx,%eax
  jl     L860
L138:
  movl   $0x6,-0x4(%rdx,%rdi,1)
  cmp    %eax,%ecx
  jge    L860
  movl   $0x6,-0x8(%rdx,%rdi,1)
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L223:
  mov    %ebx,%esi
L1043:
  lea    0x1(%rsi),%ecx
  cmp    $0x2,%esi
  jle    L116
  movdqa D83(%rip),%xmm0
  movups %xmm0,(%rdx)
  cmp    $0x3,%esi
  je     L1470
  movl   $0x6,0x10(%rdx)
  cmp    $0x4,%esi
  jg     L513
L1470:
  sub    %r11d,%edi
  sub    $0x1,%edi
  cmp    $0x1,%edi
  jle    L1611
L300:
  movslq %ecx,%rcx
  mov    -0x4(%rax,%rcx,4),%r8d
  movslq %esi,%rcx
  nopl   0x0(%rax,%rax,1)
L1223:
  mov    %ecx,%ebx
  mov    %ecx,%r11d
  cmp    %r8d,(%rax,%rcx,4)
  jne    L36
  sub    $0x1,%rcx
  cmp    $0xffffffff,%ecx
  jne    L1223
  jmp    L1611
  nopl   (%rax)
L549:
  xor    %eax,%eax
  pop    %rbx
  movups %xmm0,(%rdx)
  pop    %rbp
  ret
L743:
  mov    $0x7,%ecx
  mov    $0x6,%r11d
L558:
  movslq %r11d,%rsi
  mov    $0x8,%edi
  mov    (%rax,%rsi,4),%r8d
  lea    0x0(,%rsi,4),%r9
  lea    -0x1(%r11),%esi
  jmp    L763
L103:
  mov    %ebx,%ecx
L1030:
  mov    $0x8,%edi
  mov    $0x1,%r8d
  mov    %ecx,%ebx
  sub    %ecx,%edi
  cmp    $0x7,%ecx
  cmovg  %r8d,%edi
  mov    $0x7,%r8d
  sub    %ecx,%r8d
  cmp    $0x2,%r8d
  jbe    L1332
  movdqa D83(%rip),%xmm0
  movups %xmm0,0x10(%rdx)
  cmp    $0x4,%edi
  je     L1326
  mov    $0x3,%edi
L1685:
  movslq %edi,%r8
  movl   $0x6,(%rdx,%r8,4)
  lea    0x0(,%r8,4),%r9
  lea    -0x1(%rdi),%r8d
  cmp    %ecx,%edi
  jle    L1326
  movl   $0x6,-0x4(%rdx,%r9,1)
  cmp    %ecx,%r8d
  jle    L1326
  movl   $0x6,-0x8(%rdx,%r9,1)
L1326:
  cmp    $0x1,%r10d
  jle    L860
  movslq %ecx,%rdi
  mov    (%rsi),%r8d
  shl    $0x2,%rdi
  lea    (%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1046
  lea    0x1(%rcx),%r9d
  cmp    $0x7,%ecx
  je     L860
  lea    0x4(%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1127
  lea    0x2(%rcx),%r9d
  cmp    $0x6,%ecx
  je     L860
  lea    0x8(%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1127
  lea    0x3(%rcx),%r9d
  cmp    $0x5,%ecx
  je     L860
  lea    0xc(%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1127
  lea    0x4(%rcx),%r9d
  cmp    $0x4,%ecx
  je     L860
  lea    0x10(%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1127
  lea    0x5(%rcx),%r9d
  cmp    $0x3,%ecx
  je     L860
  lea    0x14(%rax,%rdi,1),%rsi
  cmp    (%rsi),%r8d
  jne    L1127
  cmp    $0x2,%ecx
  je     L860
  mov    %r11,%rsi
  cmp    0x1c(%rax),%r8d
  je     L860
  mov    $0x6,%r8d
  mov    $0x7,%r9d
  jmp    L1522
  nop
L1127:
  lea    -0x1(%r9),%r8d
  cmp    %ecx,%r9d
  jle    L1384
L1522:
  mov    %r9d,%r11d
  sub    %ebx,%r11d
  lea    -0x1(%r11),%edi
  cmp    $0x2,%edi
  jbe    L790
  movdqa D25(%rip),%xmm0
  movslq %r9d,%rdi
  movups %xmm0,-0x10(%rdx,%rdi,4)
  mov    %r11d,%edi
  and    $0xfffffffc,%edi
  sub    %edi,%r8d
  cmp    %r11d,%edi
  je     L1384
L790:
  movslq %r8d,%rdi
  movl   $0x4,(%rdx,%rdi,4)
  lea    0x0(,%rdi,4),%r11
  lea    -0x1(%r8),%edi
  cmp    %ecx,%r8d
  jle    L1384
  movl   $0x4,-0x4(%rdx,%r11,1)
  cmp    %ecx,%edi
  jle    L1384
  movl   $0x4,-0x8(%rdx,%r11,1)
L1384:
  cmp    $0x2,%r10d
  je     L860
  movslq %r9d,%rcx
  mov    (%rsi),%esi
  lea    0x0(,%rcx,4),%rdi
  cmp    %esi,(%rax,%rcx,4)
  jne    L860
  lea    0x1(%r9),%ecx
  cmp    $0x7,%r9d
  je     L860
  cmp    0x4(%rax,%rdi,1),%esi
  jne    L1145
  lea    0x2(%r9),%ecx
  cmp    $0x6,%r9d
  je     L860
  cmp    0x8(%rax,%rdi,1),%esi
  jne    L1145
  lea    0x3(%r9),%ecx
  cmp    $0x5,%r9d
  je     L860
  cmp    0xc(%rax,%rdi,1),%esi
  jne    L1145
  lea    0x4(%r9),%ecx
  cmp    $0x4,%r9d
  je     L860
  cmp    0x10(%rax,%rdi,1),%esi
  jne    L1145
  lea    0x5(%r9),%ecx
  cmp    $0x3,%r9d
  je     L860
  cmp    0x14(%rax,%rdi,1),%esi
  jne    L1145
  cmp    $0x2,%r9d
  je     L860
  cmp    0x1c(%rax),%esi
  je     L860
  mov    $0x6,%eax
  mov    $0x7,%ecx
  jmp    L613
  nopw   0x0(%rax,%rax,1)
L1145:
  lea    -0x1(%rcx),%eax
  cmp    %ecx,%r9d
  jge    L860
L613:
  mov    %ecx,%esi
  sub    %r9d,%esi
  lea    -0x1(%rsi),%edi
  cmp    $0x2,%edi
  jbe    L1597
  movdqa D68(%rip),%xmm0
  movslq %ecx,%rcx
  movups %xmm0,-0x10(%rdx,%rcx,4)
  mov    %esi,%ecx
  and    $0xfffffffc,%ecx
  sub    %ecx,%eax
  cmp    %esi,%ecx
  je     L860
L1597:
  movslq %eax,%rcx
  movl   $0x5,(%rdx,%rcx,4)
  lea    0x0(,%rcx,4),%rsi
  lea    -0x1(%rax),%ecx
  cmp    %r9d,%eax
  jle    L860
  movl   $0x5,-0x4(%rdx,%rsi,1)
  cmp    %r9d,%ecx
  jle    L860
  movl   $0x5,-0x8(%rdx,%rsi,1)
  jmp    L860
  nopl   0x0(%rax)
L36:
  add    $0x1,%ecx
  je     L1611
  cmp    %esi,%ebx
  jge    L1658
  mov    %esi,%ebp
  sub    %ebx,%ebp
  lea    -0x1(%rbp),%r8d
  cmp    $0x2,%r8d
  jbe    L1670
  movslq %ecx,%r8
  movdqa D25(%rip),%xmm0
  lea    (%rdx,%r8,4),%r9
  mov    %ebp,%r8d
  shr    $0x2,%r8d
  lea    -0x1(%r8),%r10d
  lea    0x10(%r9),%r8
  shl    $0x4,%r10
  add    %r8,%r10
  jmp    L1119
  nopw   0x0(%rax,%rax,1)
L1148:
  add    $0x10,%r8
L1119:
  movups %xmm0,(%r9)
  mov    %r8,%r9
  cmp    %r10,%r8
  jne    L1148
  mov    %ebp,%r9d
  and    $0xfffffffc,%r9d
  lea    (%r9,%rcx,1),%r8d
  cmp    %r9d,%ebp
  je     L1658
L1149:
  movslq %r8d,%r9
  movl   $0x4,(%rdx,%r9,4)
  lea    0x0(,%r9,4),%r10
  lea    0x1(%r8),%r9d
  cmp    %esi,%r8d
  jge    L1658
  movl   $0x4,0x4(%rdx,%r10,1)
  cmp    %esi,%r9d
  jge    L1658
  movl   $0x4,0x8(%rdx,%r10,1)
L1658:
  cmp    $0x2,%edi
  je     L1611
  movslq %ecx,%rcx
  mov    -0x4(%rax,%rcx,4),%edi
  movslq %r11d,%rcx
  xchg   %ax,%ax
L105:
  cmp    %edi,(%rax,%rcx,4)
  jne    L635
  sub    $0x1,%rcx
  cmp    $0xffffffff,%ecx
  jne    L105
  jmp    L1611
  nopw   0x0(%rax,%rax,1)
L1487:
  lea    -0x1(%rcx),%esi
  cmp    $0x2,%esi
  ja     L259
  movl   $0x6,(%rdx)
  mov    $0x1,%esi
  xor    %edi,%edi
  jmp    L521
  xchg   %ax,%ax
L589:
  mov    $0x5,%ecx
  jmp    L1108
L0:
  mov    $0x5,%esi
  mov    $0x6,%ecx
  nopl   0x0(%rax)
L369:
  movslq %esi,%r9
  lea    -0x1(%rsi),%edi
  cmpl   $0x2,-0x4(%rax,%r9,4)
  lea    0x0(,%r9,4),%r8
  jne    L372
  lea    -0x2(%rsi),%edi
  cmp    $0x1,%esi
  je     L372
  cmpl   $0x2,-0x8(%rax,%r8,1)
  jne    L372
  lea    -0x3(%rsi),%edi
  cmp    $0x2,%esi
  je     L372
  cmpl   $0x2,-0xc(%rax,%r8,1)
  jne    L372
  lea    -0x4(%rsi),%edi
  cmp    $0x3,%esi
  je     L372
  cmpl   $0x2,-0x10(%rax,%r8,1)
  jne    L372
  lea    -0x5(%rsi),%edi
  cmp    $0x4,%esi
  je     L372
  cmpl   $0x2,-0x14(%rax,%r8,1)
  jne    L372
  cmp    $0x5,%esi
  je     L426
  xor    %edi,%edi
  cmpl   $0x2,-0x18(%rax,%r8,1)
  sete   %dil
  neg    %edi
L372:
  mov    0x4(%rax,%r8,1),%r9d
  movslq %ecx,%r8
  mov    %ecx,%r10d
  shl    $0x2,%r8
  sub    %edi,%r10d
  lea    (%rax,%r8,1),%rsi
  sub    $0x1,%r10d
  cmp    (%rsi),%r9d
  jne    L1030
  lea    0x1(%rcx),%edi
  cmp    $0x7,%ecx
  jne    L408
L652:
  mov    $0x7,%eax
  jmp    L1143
L513:
  movl   $0x6,0x14(%rdx)
  jmp    L1470
L877:
  mov    $0x3,%ecx
  jmp    L1108
L342:
  mov    $0x6,%esi
  mov    $0x7,%ecx
  jmp    L369
L851:
  mov    $0x4,%ecx
  jmp    L1108
L1334:
  mov    $0x6,%ecx
  jmp    L1108
  nopw   0x0(%rax,%rax,1)
L69:
  xor    %esi,%esi
  jmp    L899
L1259:
  mov    $0x4,%esi
  mov    $0x5,%ecx
  jmp    L369
L1052:
  mov    %edi,%ecx
  jmp    L1030
L410:
  mov    $0x1,%ecx
  xor    %esi,%esi
L116:
  movl   $0x6,(%rdx)
  test   %esi,%esi
  jle    L1470
  movl   $0x6,0x4(%rdx)
  cmp    $0x1,%esi
  jle    L1470
  sub    %r11d,%edi
  movl   $0x6,0x8(%rdx)
  sub    $0x1,%edi
  cmp    $0x1,%edi
  jg     L300
  jmp    L1611
L635:
  mov    %ecx,%r9d
  add    $0x1,%r9d
  je     L1611
  cmp    %ecx,%r11d
  jle    L1611
  sub    %ecx,%ebx
  lea    -0x1(%rbx),%esi
  mov    %ebx,%ecx
  cmp    $0x2,%esi
  jbe    L1560
  movslq %r9d,%rsi
  movdqa D68(%rip),%xmm0
  lea    (%rdx,%rsi,4),%rdi
  mov    %ebx,%esi
  shr    $0x2,%esi
  lea    -0x1(%rsi),%r8d
  lea    0x10(%rdi),%rsi
  shl    $0x4,%r8
  add    %rsi,%r8
  jmp    L119
  nopl   0x0(%rax)
L495:
  add    $0x10,%rsi
L119:
  movups %xmm0,(%rdi)
  mov    %rsi,%rdi
  cmp    %r8,%rsi
  jne    L495
  mov    %ecx,%esi
  and    $0xfffffffc,%esi
  add    %esi,%r9d
  cmp    %esi,%ecx
  je     L1611
L1560:
  movslq %r9d,%rcx
  movl   $0x5,(%rdx,%rcx,4)
  lea    0x0(,%rcx,4),%rsi
  lea    0x1(%r9),%ecx
  cmp    %r9d,%r11d
  jle    L1611
  movl   $0x5,0x4(%rdx,%rsi,1)
  cmp    %ecx,%r11d
  jle    L1611
  movl   $0x5,0x8(%rdx,%rsi,1)
  jmp    L1611
L1228:
  mov    $0x3,%esi
  mov    $0x4,%ecx
  jmp    L369
L1323:
  mov    $0x3,%ecx
  jmp    L369
L392:
  mov    $0x1,%esi
  jmp    L369
L76:
  xor    %r8d,%r8d
  mov    $0x1,%ecx
  mov    $0xffffffff,%edi
  jmp    L372
L35:
  sub    %ecx,%ebx
  mov    $0x1,%eax
  cmp    $0x7,%ecx
  cmovle %ebx,%eax
  jmp    L1639
L1:
  mov    $0x8,%edi
  jmp    L1511
L426:
  mov    $0xffffffff,%edi
  jmp    L372
L167:
  mov    %r11,%rsi
  mov    $0x7,%ecx
  mov    $0x7,%ebx
  mov    $0x7,%edi
  jmp    L1685
L1046:
  mov    %ecx,%r9d
  jmp    L1384
L1332:
  mov    $0x7,%edi
  jmp    L1685
L1670:
  mov    %ecx,%r8d
  jmp    L1149
L1431:
  movl   $0x6,0x1c(%rdx)
  mov    $0x6,%eax
  mov    $0x1c,%edi
  jmp    L138
```

tool_calls: name: disassemble_data
arguments: data_tag: D83
type_guessed: byte[16]
name: disassemble_data
arguments: data_tag: D25
type_guessed: byte[16]
name: disassemble_data
arguments: data_tag: D68
type_guessed: byte[16]

tool: {"D83": [0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00]}

tool: {"D25": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D68": [0x05,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x05,0x00,0x00,0x00]}

assistant: ```c
find_stable(edge, stability) register int edge[10];
int stability[10];
{
  register int i, last, first;
  int num_empty, first1;
  if (edge[0] != 2) {
    for (i = 1; i <= 7; i++)
      if (edge[i] == 2)
        break;
    last = i - 1;
    if (last == 7) {
      for (i = 0; i <= 7; i++)
        stability[i] = 6;
      return;
    } else {
      for (i = last + 1; i <= 7; i++)
        if (edge[i] != 2)
          break;
      num_empty = i - last - 1;
      for (i = last; i >= 0; i--)
        if (edge[i] != edge[last])
          break;
      first = i + 1;
      if (first == 0) {
        for (i = 0; i <= last; i++)
          stability[i] = 6;
      } else {
        for (i = 0; i < first; i++)
          stability[i] = 6;
        if (num_empty >= 2) {
          for (i = first - 1; i >= 0; i--)
            if (edge[i] != edge[first - 1])
              break;
          first1 = i + 1;
          if (first1 != 0) {
            for (i = first1; i < first; i++)
              stability[i] = 4;
            if (num_empty >= 3) {
              for (i = first1 - 1; i >= 0; i--)
                if (edge[i] != edge[first1 - 1])
                  break;
              first = i + 1;
              if (first != 0)
                for (i = first; i < first1; i++)
                  stability[i] = 5;
            }
          }
        }
      }
    }
  }
  if (edge[7] != 2) {
    for (i = 7; i >= 0; i--)
      if (edge[i] == 2)
        break;
    last = i + 1;
    for (i = last - 1; i >= 0; i--)
      if (edge[i] != 2)
        break;
    num_empty = last - i - 1;
    for (i = last; i <= 7; i++)
      if (edge[i] != edge[last])
        break;
    first = i - 1;
    if (first == 7) {
      for (i = 7; i >= last; i--)
        stability[i] = 6;
    } else {
      for (i = 7; i > first; i--)
        stability[i] = 6;
      if (num_empty >= 2) {
        for (i = first + 1; i <= 7; i++)
          if (edge[i] != edge[first + 1])
            break;
        first1 = i - 1;
        if (first1 == 7)
          return;
        for (i = first1; i > first; i--)
          stability[i] = 4;
        if (num_empty >= 3) {
          for (i = first1 + 1; i <= 7; i++)
            if (edge[i] != edge[first1 + 1])
              break;
          first = i - 1;
          if (first == 7)
            return;
          for (i = first; i > first1; i--)
            stability[i] = 5;
        }
      }
    }
  }
  return;
}
```