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

```asm
<move_to_beginning>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  sub    $0x28,%rsp
  cmp    %rsi,%rdx
  setbe  %dil
  mov    %rcx,(%rsp)
  mov    %r8d,0xc(%rsp)
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %r14,%rbp
  setae  %dil
  call   <assert@plt>
  lea    0x0(%r13,%r14,1),%rax
  xor    %edx,%edx
  div    %rbp
  test   %rbp,%rbp
  je     L232
  mov    %rdx,%r14
  xor    %r12d,%r12d
  jmp    L61
  nopl   0x0(%rax)
L125:
  lea    0x0(%rbp,%r14,1),%rax
  xor    %edi,%edi
  sub    %r13,%rax
  sub    %r12,%rax
  cmp    %rcx,%rax
  sete   %dil
  call   <assert@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  mov    $0x1,%edi
L254:
  call   <assert@plt>
  cmp    %r13,%rbp
  sete   %al
  cmp    %r13,%r12
  sete   %dl
  or     %dl,%al
  jne    L279
  test   %r15b,%r15b
  jne    L279
  cmp    %r14,%r12
  je     L34
  cmp    %r13,%r14
  ja     L69
  mov    %r14,%rax
  mov    %rbp,%r15
  xor    %edi,%edi
  sub    %r12,%rax
  sub    %r13,%r15
  mov    %rax,0x10(%rsp)
  add    %r15,%rax
  cmp    (%rsp),%rax
  sete   %dil
  call   <assert@plt>
  cmp    %r15,0x10(%rsp)
  jb     L143
  mov    0xc(%rsp),%ecx
  test   %ecx,%ecx
  jne    L81
L267:
  mov    0xc(%rsp),%r9d
  mov    %r12,%rdx
  mov    %r15,%r8
  mov    %r13,%rcx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  add    %r15,%r12
  call   <swap_parts@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%rax
  mov    %rax,(%rsp)
L111:
  cmp    %rbp,%r12
  je     L232
L61:
  mov    0xc(%rsp),%r9d
  test   %r9d,%r9d
  jne    L27
L59:
  xor    %edi,%edi
  cmp    %r12,%rbp
  seta   %dil
  call   <assert@plt>
  cmp    %r13,%r12
  setbe  %al
  xor    %edi,%edi
  cmp    %r13,%rbp
  setae  %dil
  and    %eax,%edi
  call   <assert@plt>
  cmp    %r14,%r12
  setbe  %al
  xor    %edi,%edi
  cmp    %r14,%rbp
  setae  %dil
  and    %eax,%edi
  call   <assert@plt>
  mov    (%rsp),%rcx
  test   %rcx,%rcx
  sete   %r15b
  cmp    %r13,%r14
  jb     L125
  mov    $0x1,%edi
  call   <assert@plt>
  cmp    %r13,%r14
  je     L249
  mov    %r14,%rax
  xor    %edi,%edi
  sub    %r13,%rax
  cmp    (%rsp),%rax
  sete   %dil
  call   <assert@plt>
  mov    $0x1,%edi
  jmp    L254
L249:
  mov    $0x1,%edi
  call   <assert@plt>
  cmpq   $0x0,(%rsp)
  je     L280
  mov    (%rsp),%rax
  xor    %edi,%edi
  add    %r12,%rax
  cmp    %rbp,%rax
  sete   %dil
  xor    %r15d,%r15d
  jmp    L254
  nopl   (%rax)
L34:
  mov    0xc(%rsp),%edi
  mov    %rbp,%r14
  test   %edi,%edi
  je     L111
  lea    D14(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  mov    %rbp,%rsi
  lea    D89(%rip),%rdi
  call   <printf@plt>
  cmp    %rbp,%r12
  jne    L61
L232:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L143:
  mov    %r13,%r11
  sub    %r12,%r11
  cmp    %r15,%r11
  jbe    L11
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L162
L54:
  mov    0xc(%rsp),%r9d
  mov    0x10(%rsp),%r8
  mov    %r12,%rdx
  mov    %r13,%rcx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <swap_parts@plt>
  mov    0x10(%rsp),%rax
  mov    %r15,%rdx
  mov    %rbp,%rsi
  sub    %r14,%rdx
  mov    0xc(%rsp),%r9d
  mov    %rbx,%rdi
  lea    (%rdx,%r12,1),%r8
  lea    (%rax,%r13,1),%rcx
  mov    %r14,%rdx
  add    %r15,%r12
  mov    %rcx,(%rsp)
  call   <move_part@plt>
  mov    0x10(%rsp),%rax
  mov    (%rsp),%r14
  mov    %rax,(%rsp)
  jmp    L111
  nopl   (%rax)
L27:
  xor    %r15d,%r15d
  nopl   0x0(%rax,%rax,1)
L164:
  mov    (%rbx,%r15,4),%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  add    $0x1,%r15
  call   <printf@plt>
  cmp    %r15,%rbp
  jne    L164
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%rsp),%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %r12,%rsi
  lea    D33(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L59
  nopl   (%rax)
L81:
  lea    D81(%rip),%rdi
  call   <puts@plt>
  jmp    L267
  nopl   0x0(%rax)
L11:
  cmp    0x10(%rsp),%r11
  mov    %r11,0x18(%rsp)
  setae  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0xc(%rsp),%edx
  mov    0x18(%rsp),%r11
  test   %edx,%edx
  jne    L190
L48:
  mov    0x10(%rsp),%r15
  mov    0xc(%rsp),%r9d
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  mov    %r11,0x18(%rsp)
  mov    %r15,%r8
  call   <swap_parts@plt>
  mov    0xc(%rsp),%r9d
  mov    %r13,%r8
  mov    %r15,%rcx
  add    %r13,%rcx
  sub    %r14,%r8
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <move_part@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  mov    0x18(%rsp),%r11
  add    (%rsp),%r12
  sub    %r13,%r12
  mov    %r12,(%rsp)
  add    %r11,%r14
  mov    %r13,%r12
  add    %r11,%r13
  jmp    L61
  nopw   0x0(%rax,%rax,1)
L162:
  lea    D30(%rip),%rdi
  call   <puts@plt>
  jmp    L54
L280:
  mov    $0x1,%edi
  call   <assert@plt>
  nopl   0x0(%rax,%rax,1)
L279:
  mov    0xc(%rsp),%r8d
  test   %r8d,%r8d
  je     L232
  add    $0x28,%rsp
  lea    D67(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <puts@plt>
  nopl   0x0(%rax,%rax,1)
L190:
  lea    D74(%rip),%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%r11
  jmp    L48
L69:
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jne    L219
L216:
  mov    0xc(%rsp),%r9d
  mov    (%rsp),%r8
  add    $0x28,%rsp
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10d0 <move_part@plt>
L219:
  lea    D9(%rip),%rdi
  call   <puts@plt>
  jmp    L216
```

tool_calls: name: disassemble_data
arguments: label: D14
type_guessed: string
name: disassemble_data
arguments: label: D89
type_guessed: string
name: disassemble_data
arguments: label: D40
type_guessed: string
name: disassemble_data
arguments: label: D33
type_guessed: string
name: disassemble_data
arguments: label: D81
type_guessed: string
name: disassemble_data
arguments: label: D30
type_guessed: string
name: disassemble_data
arguments: label: D67
type_guessed: string
name: disassemble_data
arguments: label: D74
type_guessed: string
name: disassemble_data
arguments: label: D9
type_guessed: string

tool: D14: Case 2:

tool: D89: Setting end to %d.


tool: D40: %d 

tool: D33: part_start %d  begin %d  end %d  size %d


tool: D81: Case 4:

tool: D30: Case 6

tool: D67: Case 1:
Terminating

tool: D74: Case 5

tool: D9: Case 3:

assistant: ```c
void move_to_beginning(int *A, size_t N, size_t begin, size_t size, int show_steps) {
  assert(begin <= N);
  assert(size <= N);
  size_t part_start = 0;
  size_t end = (begin + size) % N;
  while (part_start != N) {
    size_t i;
    if (show_steps) {
      for (i = 0; i < N; ++i) {
        printf("%d ", A[i]);
      }
      printf("\n");
      printf("part_start %d  begin %d  end %d  size %d\n", part_start, begin, end, size);
    }
    assert(part_start < N);
    assert(part_start <= begin && begin <= N);
    assert(part_start <= end && end <= N);
    assert(begin <= end || (N - begin) + (end - part_start) == size);
    assert(begin >= end || end - begin == size);
    assert(begin != end || size == 0 || part_start + size == N);
    if (size == 0 || begin == N || begin == part_start) {
      if (show_steps) {
        printf("Case 1:\nTerminating\n");
      }
      break;
    } else if (end == part_start) {
      if (show_steps) {
        printf("Case 2:\n");
        printf("Setting end to %d.\n", N);
      }
      end = N;
    } else if (begin < end) {
      if (show_steps) {
        printf("Case 3:\n");
      }
      move_part(A, N, part_start, begin, size, show_steps);
      break;
    } else {
      size_t end_size = end - part_start;
      size_t begin_size = N - begin;
      assert(begin_size + end_size == size);
      if (end_size >= begin_size) {
        if (show_steps) {
          printf("Case 4:\n");
        }
        swap_parts(A, N, part_start, begin, begin_size, show_steps);
        assert(begin_size > 0);
        part_start += begin_size;
        size = end_size;
      } else if (begin - part_start <= begin_size) {
        size_t size_moved = begin - part_start;
        assert(size_moved >= end_size);
        if (show_steps) {
          printf("Case 5\n");
        }
        swap_parts(A, N, part_start, begin, end_size, show_steps);
        move_part(A, N, end, begin + end_size, begin - end, show_steps);
        assert(end_size + (begin - end) == size_moved);
        size -= size_moved;
        part_start = begin;
        begin += size_moved;
        end += size_moved;
      } else if (end_size <= begin_size) {
        if (show_steps) {
          printf("Case 6\n");
        }
        swap_parts(A, N, part_start, begin, end_size, show_steps);
        move_part(A, N, end, begin + end_size, begin_size - end_size, show_steps);
        part_start += begin_size;
        size = end_size;
        end = begin + end_size;
      } else {
        assert(0);
      }
    }
  }
}
```