user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<find_stable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,%rax
  mov    %rsi,-0x30(%rbp)
  mov    (%rax),%edx
  cmp    $0x2,%edx
  je     L50
  mov    $0x1,%ebx
  jmp    L499
L417:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    $0x2,%edx
  je     L79
  add    $0x1,%ebx
L499:
  cmp    $0x7,%ebx
  jle    L417
  jmp    L729
L79:
  nop
L729:
  lea    -0x1(%rbx),%r13d
  cmp    $0x7,%r13d
  jne    L506
  mov    $0x0,%ebx
  jmp    L121
L574:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movl   $0x6,(%rax)
  add    $0x1,%ebx
L121:
  cmp    $0x7,%ebx
  jle    L574
  jmp    L305
L506:
  lea    0x1(%r13),%ebx
  jmp    L434
L708:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    $0x2,%edx
  jne    L661
  add    $0x1,%ebx
L434:
  cmp    $0x7,%ebx
  jle    L708
  jmp    L468
L661:
  nop
L468:
  sub    %r13d,%ebx
  mov    %ebx,%edx
  sub    $0x1,%edx
  mov    %edx,-0x20(%rbp)
  mov    %r13d,%ebx
  jmp    L720
L638:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  movslq %r13d,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L668
  sub    $0x1,%ebx
L720:
  test   %ebx,%ebx
  jns    L638
  jmp    L551
L668:
  nop
L551:
  lea    0x1(%rbx),%r12d
  test   %r12d,%r12d
  jne    L539
  mov    $0x0,%ebx
  jmp    L289
L239:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x6,(%rdx)
  add    $0x1,%ebx
L289:
  cmp    %r13d,%ebx
  jle    L239
  jmp    L50
L539:
  mov    $0x0,%ebx
  jmp    L27
L718:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x6,(%rdx)
  add    $0x1,%ebx
L27:
  cmp    %r12d,%ebx
  jl     L718
  cmpl   $0x1,-0x20(%rbp)
  jle    L50
  lea    -0x1(%r12),%ebx
  jmp    L572
L18:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  movslq %r12d,%rdx
  shl    $0x2,%rdx
  sub    $0x4,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L465
  sub    $0x1,%ebx
L572:
  test   %ebx,%ebx
  jns    L18
  jmp    L537
L465:
  nop
L537:
  lea    0x1(%rbx),%edx
  mov    %edx,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L50
  mov    -0x1c(%rbp),%ebx
  jmp    L689
L714:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x4,(%rdx)
  add    $0x1,%ebx
L689:
  cmp    %r12d,%ebx
  jl     L714
  cmpl   $0x2,-0x20(%rbp)
  jle    L50
  mov    -0x1c(%rbp),%edx
  lea    -0x1(%rdx),%ebx
  jmp    L319
L517:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  sub    $0x4,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L403
  sub    $0x1,%ebx
L319:
  test   %ebx,%ebx
  jns    L517
  jmp    L115
L403:
  nop
L115:
  lea    0x1(%rbx),%r12d
  test   %r12d,%r12d
  je     L50
  mov    %r12d,%ebx
  jmp    L439
L279:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x5,(%rdx)
  add    $0x1,%ebx
L439:
  cmp    -0x1c(%rbp),%ebx
  jl     L279
L50:
  lea    0x1c(%rax),%rdx
  mov    (%rdx),%edx
  cmp    $0x2,%edx
  je     L150
  mov    $0x7,%ebx
  jmp    L702
L160:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    $0x2,%edx
  je     L245
  sub    $0x1,%ebx
L702:
  test   %ebx,%ebx
  jns    L160
  jmp    L710
L245:
  nop
L710:
  lea    0x1(%rbx),%r13d
  lea    -0x1(%r13),%ebx
  jmp    L389
L249:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    $0x2,%edx
  jne    L295
  sub    $0x1,%ebx
L389:
  test   %ebx,%ebx
  jns    L249
  jmp    L508
L295:
  nop
L508:
  mov    %r13d,%edx
  sub    %ebx,%edx
  sub    $0x1,%edx
  mov    %edx,-0x20(%rbp)
  mov    %r13d,%ebx
  jmp    L423
L80:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  movslq %r13d,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L392
  add    $0x1,%ebx
L423:
  cmp    $0x7,%ebx
  jle    L80
  jmp    L6
L392:
  nop
L6:
  lea    -0x1(%rbx),%r12d
  cmp    $0x7,%r12d
  jne    L662
  mov    $0x7,%ebx
  jmp    L460
L382:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movl   $0x6,(%rax)
  sub    $0x1,%ebx
L460:
  cmp    %r13d,%ebx
  jge    L382
  jmp    L150
L662:
  mov    $0x7,%ebx
  jmp    L86
L54:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x6,(%rdx)
  sub    $0x1,%ebx
L86:
  cmp    %r12d,%ebx
  jg     L54
  cmpl   $0x1,-0x20(%rbp)
  jle    L150
  lea    0x1(%r12),%ebx
  jmp    L99
L153:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  movslq %r12d,%rdx
  add    $0x1,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L475
  add    $0x1,%ebx
L99:
  cmp    $0x7,%ebx
  jle    L153
  jmp    L292
L475:
  nop
L292:
  lea    -0x1(%rbx),%edx
  mov    %edx,-0x1c(%rbp)
  cmpl   $0x7,-0x1c(%rbp)
  je     L379
  mov    -0x1c(%rbp),%ebx
  jmp    L235
L63:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movl   $0x4,(%rdx)
  sub    $0x1,%ebx
L235:
  cmp    %r12d,%ebx
  jg     L63
  cmpl   $0x2,-0x20(%rbp)
  jle    L150
  mov    -0x1c(%rbp),%edx
  lea    0x1(%rdx),%ebx
  jmp    L467
L733:
  movslq %ebx,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%ecx
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    (%rdx),%edx
  cmp    %edx,%ecx
  jne    L696
  add    $0x1,%ebx
L467:
  cmp    $0x7,%ebx
  jle    L733
  jmp    L143
L696:
  nop
L143:
  lea    -0x1(%rbx),%r12d
  cmp    $0x7,%r12d
  je     L303
  mov    %r12d,%ebx
  jmp    L261
L338:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movl   $0x5,(%rax)
  sub    $0x1,%ebx
L261:
  cmp    -0x1c(%rbp),%ebx
  jg     L338
L150:
  nop
  jmp    L305
L379:
  nop
  jmp    L305
L303:
  nop
L305:
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

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;
}
```