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

```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     L246
  mov    %rdx,%r14
  xor    %r12d,%r12d
  jmp    L8
  nopl   0x0(%rax)
L195:
  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
L35:
  call   <assert@plt>
  cmp    %r13,%rbp
  sete   %al
  cmp    %r13,%r12
  sete   %dl
  or     %dl,%al
  jne    L187
  test   %r15b,%r15b
  jne    L187
  cmp    %r14,%r12
  je     L86
  cmp    %r13,%r14
  ja     L266
  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     L168
  mov    0xc(%rsp),%ecx
  test   %ecx,%ecx
  jne    L169
L286:
  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)
L142:
  cmp    %rbp,%r12
  je     L246
L8:
  mov    0xc(%rsp),%r9d
  test   %r9d,%r9d
  jne    L177
L125:
  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     L195
  mov    $0x1,%edi
  call   <assert@plt>
  cmp    %r13,%r14
  je     L131
  mov    %r14,%rax
  xor    %edi,%edi
  sub    %r13,%rax
  cmp    (%rsp),%rax
  sete   %dil
  call   <assert@plt>
  mov    $0x1,%edi
  jmp    L35
L131:
  mov    $0x1,%edi
  call   <assert@plt>
  cmpq   $0x0,(%rsp)
  je     L112
  mov    (%rsp),%rax
  xor    %edi,%edi
  add    %r12,%rax
  cmp    %rbp,%rax
  sete   %dil
  xor    %r15d,%r15d
  jmp    L35
  nopl   (%rax)
L86:
  mov    0xc(%rsp),%edi
  mov    %rbp,%r14
  test   %edi,%edi
  je     L142
  lea    D65(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  mov    %rbp,%rsi
  lea    D60(%rip),%rdi
  call   <printf@plt>
  cmp    %rbp,%r12
  jne    L8
L246:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L168:
  mov    %r13,%r11
  sub    %r12,%r11
  cmp    %r15,%r11
  jbe    L47
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L36
L224:
  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    L142
  nopl   (%rax)
L177:
  xor    %r15d,%r15d
  nopl   0x0(%rax,%rax,1)
L63:
  mov    (%rbx,%r15,4),%esi
  lea    D58(%rip),%rdi
  xor    %eax,%eax
  add    $0x1,%r15
  call   <printf@plt>
  cmp    %r15,%rbp
  jne    L63
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%rsp),%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %r12,%rsi
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L125
  nopl   (%rax)
L169:
  lea    D85(%rip),%rdi
  call   <puts@plt>
  jmp    L286
  nopl   0x0(%rax)
L47:
  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    L104
L182:
  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    L8
  nopw   0x0(%rax,%rax,1)
L36:
  lea    D6(%rip),%rdi
  call   <puts@plt>
  jmp    L224
L112:
  mov    $0x1,%edi
  call   <assert@plt>
  nopl   0x0(%rax,%rax,1)
L187:
  mov    0xc(%rsp),%r8d
  test   %r8d,%r8d
  je     L246
  add    $0x28,%rsp
  lea    D5(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <puts@plt>
  nopl   0x0(%rax,%rax,1)
L104:
  lea    D81(%rip),%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%r11
  jmp    L182
L266:
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jne    L210
L156:
  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>
L210:
  lea    D10(%rip),%rdi
  call   <puts@plt>
  jmp    L156
```

tool_calls: name: extract_symbolic_data
arguments: label: D65
type: string
name: extract_symbolic_data
arguments: label: D60
type: string
name: extract_symbolic_data
arguments: label: D58
type: string
name: extract_symbolic_data
arguments: label: D36
type: string
name: extract_symbolic_data
arguments: label: D85
type: string
name: extract_symbolic_data
arguments: label: D6
type: string
name: extract_symbolic_data
arguments: label: D5
type: string
name: extract_symbolic_data
arguments: label: D81
type: string
name: extract_symbolic_data
arguments: label: D10
type: string

tool: D65: Case 2:

tool: D60: Setting end to %d.


tool: D58: %d 

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


tool: D85: Case 4:

tool: D6: Case 6

tool: D5: Case 1:
Terminating

tool: D81: Case 5

tool: D10: 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);
      }
    }
  }
}
```