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

```asm
<ArraySort_Mix>:
  endbr64
  push   %r15
  xor    %r11d,%r11d
  lea    -0x1(%rdi),%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0xf8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  movl   $0x1,0x8(%rsp)
L181:
  mov    %r15d,%eax
  sub    %r11d,%eax
  cmp    $0x6,%eax
  jg     L45
L51:
  movslq 0x8(%rsp),%rdi
  mov    %r11d,%esi
  mov    %rdi,%rax
  sub    $0x1,%rdi
  cmp    %eax,%r15d
  jl     L60
  nopl   0x0(%rax,%rax,1)
L210:
  mov    0x8(%rbx,%rdi,8),%rcx
  mov    0x4(%rbp,%rdi,4),%r8d
  cmp    %esi,%r11d
  jg     L209
  movslq %esi,%rax
  jmp    L147
  nopl   0x0(%rax,%rax,1)
L100:
  mov    %rdx,0x8(%rbx,%rax,8)
  mov    0x0(%rbp,%rax,4),%edx
  mov    %edx,0x4(%rbp,%rax,4)
  lea    -0x1(%rax),%edx
  sub    $0x1,%rax
  cmp    %eax,%r11d
  jg     L203
L147:
  mov    (%rbx,%rax,8),%rdx
  cmp    %rcx,%rdx
  jg     L100
L126:
  add    $0x1,%rax
  add    $0x1,%esi
  add    $0x1,%rdi
  mov    %rcx,(%rbx,%rax,8)
  mov    %r8d,0x0(%rbp,%rax,4)
  cmp    %esi,%r15d
  jne    L210
L60:
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  je     L93
  movslq 0x4(%rsp),%rdx
  lea    -0x1(%rdx),%eax
  mov    0x20(%rsp,%rdx,4),%r15d
  mov    %rdx,%rdi
  cltq
  sub    $0x2,%edi
  mov    0x20(%rsp,%rax,4),%r11d
  mov    %edi,0x4(%rsp)
  lea    0x1(%r11),%eax
  mov    %eax,0x8(%rsp)
  mov    %r15d,%eax
  sub    %r11d,%eax
  cmp    $0x6,%eax
  jle    L51
L45:
  movslq %r11d,%rax
  lea    (%r15,%r11,1),%edx
  add    $0x1,%rax
  sar    %edx
  lea    0x0(,%rax,8),%rcx
  movslq %edx,%rdx
  shl    $0x2,%rax
  lea    (%rbx,%rcx,1),%r14
  lea    (%rbx,%rdx,8),%rdi
  mov    (%r14),%r8
  lea    0x0(%rbp,%rax,1),%r13
  mov    (%rdi),%rsi
  lea    0x0(%rbp,%rdx,4),%rdx
  mov    (%rdx),%r10d
  mov    %r14,0x10(%rsp)
  mov    %r8,(%rdi)
  mov    0x0(%r13),%edi
  mov    %rsi,(%r14)
  mov    %edi,(%rdx)
  lea    -0x8(%rbx,%rcx,1),%rdx
  movslq %r15d,%rcx
  lea    (%rbx,%rcx,8),%rdi
  mov    (%rdx),%r8
  mov    %r10d,0xc(%rsp)
  mov    (%rdi),%r9
  mov    %r13,0x18(%rsp)
  mov    %r10d,0x0(%r13)
  cmp    %r9,%r8
  jle    L15
  mov    %r9,(%rdx)
  lea    0x0(%rbp,%rcx,4),%rsi
  lea    -0x4(%rbp,%rax,1),%r9
  mov    (%r9),%r10d
  mov    (%rsi),%r12d
  mov    %r8,(%rdi)
  mov    %r12d,(%r9)
  mov    %r8,%r9
  mov    %r10d,(%rsi)
  mov    (%r14),%rsi
  mov    0x0(%r13),%r14d
  mov    %r14d,0xc(%rsp)
L15:
  cmp    %r9,%rsi
  jle    L91
  mov    0x10(%rsp),%r14
  lea    0x0(%rbp,%rcx,4),%rcx
  mov    %r9,(%r14)
  mov    %rsi,(%rdi)
  mov    (%rcx),%esi
  mov    0x18(%rsp),%rdi
  mov    %esi,(%rdi)
  mov    0xc(%rsp),%esi
  mov    %esi,(%rcx)
  mov    (%rdi),%edi
  mov    (%r14),%rsi
  mov    %edi,0xc(%rsp)
L91:
  mov    (%rdx),%rcx
  cmp    %rsi,%rcx
  jle    L127
  mov    %rsi,(%rdx)
  mov    0x10(%rsp),%rsi
  lea    -0x4(%rbp,%rax,1),%rdx
  mov    (%rdx),%eax
  mov    0x18(%rsp),%rdi
  mov    %rcx,(%rsi)
  mov    0xc(%rsp),%esi
  mov    %eax,0xc(%rsp)
  mov    %esi,(%rdx)
  mov    %rcx,%rsi
  mov    %eax,(%rdi)
L127:
  lea    0x2(%r11),%edi
  movslq %r15d,%r12
  movslq %edi,%rdi
  nopl   (%rax)
L237:
  mov    (%rbx,%rdi,8),%r10
  mov    %edi,%r14d
  cmp    %rsi,%r10
  jl     L113
  lea    -0x1(%r12),%eax
  lea    -0x8(%rbx,%r12,8),%rdx
  cltq
  nopl   0x0(%rax,%rax,1)
L13:
  mov    (%rdx),%rcx
  mov    %eax,%r13d
  movslq %eax,%r12
  mov    %rdx,%r9
  mov    %rax,%r8
  sub    $0x8,%rdx
  sub    $0x1,%rax
  cmp    %rsi,%rcx
  jg     L13
  lea    0x0(%rbp,%r8,4),%rax
  mov    (%rax),%edx
  cmp    %edi,%r12d
  jl     L171
  mov    %rcx,(%rbx,%rdi,8)
  mov    0x0(%rbp,%rdi,4),%ecx
  mov    %r10,(%r9)
  mov    %edx,0x0(%rbp,%rdi,4)
  mov    %ecx,(%rax)
L113:
  add    $0x1,%rdi
  jmp    L237
  nop
L203:
  movslq %edx,%rax
  jmp    L126
L209:
  mov    %rdi,%rax
  jmp    L126
L171:
  mov    0x10(%rsp),%rdi
  mov    %rcx,(%rdi)
  mov    %rsi,(%r9)
  mov    0x18(%rsp),%rsi
  mov    %edx,(%rsi)
  mov    0xc(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x4(%rsp),%eax
  lea    0x2(%rax),%edx
  cmp    $0x32,%edx
  jg     L50
L55:
  mov    %r15d,%ecx
  mov    0x4(%rsp),%eax
  sub    %r11d,%r12d
  sub    $0x1,%r13d
  sub    %r14d,%ecx
  add    $0x1,%ecx
  add    $0x1,%eax
  cmp    %r12d,%ecx
  movslq %edx,%rcx
  jl     L42
  cltq
  mov    %r15d,0x20(%rsp,%rcx,4)
  mov    %r13d,%r15d
  mov    %r14d,0x20(%rsp,%rax,4)
  mov    %edx,0x4(%rsp)
  jmp    L181
L42:
  cltq
  mov    %r13d,0x20(%rsp,%rcx,4)
  mov    %r11d,0x20(%rsp,%rax,4)
  lea    0x1(%r14),%eax
  mov    %r14d,%r11d
  mov    %edx,0x4(%rsp)
  mov    %eax,0x8(%rsp)
  jmp    L181
L50:
  lea    D9(%rip),%rdi
  mov    %r11d,0x10(%rsp)
  mov    %edx,0xc(%rsp)
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  mov    0x10(%rsp),%r11d
  mov    0xc(%rsp),%edx
  jmp    L55
L93:
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L140
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L140:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D9
data_type: string

tool: D9: Stack error: NSTACK too small


assistant: ```c
void ArraySort_Mix(int n, long int *arr, int *brr) {
  int i, ir = n - 1, j, k, m = 0, jstack = 0, b, NSTACK = 50, istack[NSTACK];
  long int a, temp, MIN = 7;
  for (;;) {
    if (ir - m < MIN) {
      for (j = m + 1; j <= ir; j++) {
        a = arr[j];
        b = brr[j];
        for (i = j - 1; i >= m; i--) {
          if (arr[i] <= a)
            break;
          arr[i + 1] = arr[i];
          brr[i + 1] = brr[i];
        }
        arr[i + 1] = a;
        brr[i + 1] = b;
      }
      if (!jstack)
        return;
      ir = istack[jstack--];
      m = istack[jstack--];
    } else {
      k = (m + ir) >> 1;
      temp = (arr[k]);
      (arr[k]) = arr[m + 1];
      (arr[m + 1]) = temp;
      ;
      temp = (brr[k]);
      (brr[k]) = brr[m + 1];
      (brr[m + 1]) = temp;
      ;
      if (arr[m] > arr[ir]) {
        temp = (arr[m]);
        (arr[m]) = arr[ir];
        (arr[ir]) = temp;
        ;
        temp = (brr[m]);
        (brr[m]) = brr[ir];
        (brr[ir]) = temp;
        ;
      }
      if (arr[m + 1] > arr[ir]) {
        temp = (arr[m + 1]);
        (arr[m + 1]) = arr[ir];
        (arr[ir]) = temp;
        ;
        temp = (brr[m + 1]);
        (brr[m + 1]) = brr[ir];
        (brr[ir]) = temp;
        ;
      }
      if (arr[m] > arr[m + 1]) {
        temp = (arr[m]);
        (arr[m]) = arr[m + 1];
        (arr[m + 1]) = temp;
        ;
        temp = (brr[m]);
        (brr[m]) = brr[m + 1];
        (brr[m + 1]) = temp;
        ;
      }
      i = m + 1;
      j = ir;
      a = arr[m + 1];
      b = brr[m + 1];
      for (;;) {
        do
          i++;
        while (arr[i] < a);
        do
          j--;
        while (arr[j] > a);
        if (j < i)
          break;
        temp = (arr[i]);
        (arr[i]) = arr[j];
        (arr[j]) = temp;
        ;
        temp = (brr[i]);
        (brr[i]) = brr[j];
        (brr[j]) = temp;
        ;
      }
      arr[m + 1] = arr[j];
      arr[j] = a;
      brr[m + 1] = brr[j];
      brr[j] = b;
      jstack += 2;
      if (jstack > NSTACK) {
        printf("Stack error: NSTACK too small\n");
        exit(0);
      }
      if (ir - i + 1 >= j - m) {
        istack[jstack] = ir;
        istack[jstack - 1] = i;
        ir = j - 1;
      } else {
        istack[jstack] = j - 1;
        istack[jstack - 1] = m;
        m = i;
      }
    }
  }
}
```