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)
L206:
  mov    %r15d,%eax
  sub    %r11d,%eax
  cmp    $0x6,%eax
  jg     L161
L91:
  movslq 0x8(%rsp),%rdi
  mov    %r11d,%esi
  mov    %rdi,%rax
  sub    $0x1,%rdi
  cmp    %eax,%r15d
  jl     L124
  nopl   0x0(%rax,%rax,1)
L54:
  mov    0x8(%rbx,%rdi,8),%rcx
  mov    0x4(%rbp,%rdi,4),%r8d
  cmp    %esi,%r11d
  jg     L142
  movslq %esi,%rax
  jmp    L174
  nopl   0x0(%rax,%rax,1)
L223:
  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     L129
L174:
  mov    (%rbx,%rax,8),%rdx
  cmp    %rcx,%rdx
  jg     L223
L217:
  add    $0x1,%rax
  add    $0x1,%esi
  add    $0x1,%rdi
  mov    %rcx,(%rbx,%rax,8)
  mov    %r8d,0x0(%rbp,%rax,4)
  cmp    %r15d,%esi
  jne    L54
L124:
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  je     L97
  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    L91
L161:
  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    L17
  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)
L17:
  cmp    %r9,%rsi
  jle    L165
  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)
L165:
  mov    (%rdx),%rcx
  movq   %rsi,%xmm0
  movq   %rcx,%xmm2
  punpcklqdq %xmm2,%xmm0
  cmp    %rsi,%rcx
  jle    L212
  movups %xmm0,(%rdx)
  lea    -0x4(%rbp,%rax,1),%rdx
  movd   0xc(%rsp),%xmm0
  mov    %rcx,%rsi
  mov    (%rdx),%eax
  movd   %eax,%xmm5
  mov    %eax,0xc(%rsp)
  punpckldq %xmm5,%xmm0
  movq   %xmm0,(%rdx)
L212:
  lea    0x2(%r11),%edi
  movslq %r15d,%r12
  movslq %edi,%rdi
  nopl   0x0(%rax,%rax,1)
L137:
  mov    (%rbx,%rdi,8),%r10
  mov    %edi,%r14d
  cmp    %rsi,%r10
  jl     L36
  lea    -0x1(%r12),%eax
  lea    -0x8(%rbx,%r12,8),%rdx
  cltq
  nopl   0x0(%rax,%rax,1)
L156:
  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     L156
  lea    0x0(%rbp,%r8,4),%rax
  mov    (%rax),%edx
  cmp    %edi,%r12d
  jl     L3
  mov    %rcx,(%rbx,%rdi,8)
  mov    0x0(%rbp,%rdi,4),%ecx
  mov    %r10,(%r9)
  mov    %edx,0x0(%rbp,%rdi,4)
  mov    %ecx,(%rax)
L36:
  add    $0x1,%rdi
  jmp    L137
  nop
L129:
  movslq %edx,%rax
  jmp    L217
L142:
  mov    %rdi,%rax
  jmp    L217
L3:
  mov    0x10(%rsp),%rdi
  movd   %r14d,%xmm1
  movd   %r15d,%xmm3
  punpckldq %xmm3,%xmm1
  mov    %rcx,(%rdi)
  mov    0xc(%rsp),%edi
  mov    %rsi,(%r9)
  mov    0x18(%rsp),%rsi
  mov    %edx,(%rsi)
  mov    %edi,(%rax)
  mov    0x4(%rsp),%eax
  lea    0x2(%rax),%edx
  cmp    $0x32,%edx
  jg     L56
L37:
  mov    0x4(%rsp),%eax
  mov    %r15d,%ecx
  sub    $0x1,%r13d
  movd   %r11d,%xmm0
  sub    %r14d,%ecx
  movd   %r13d,%xmm4
  sub    %r11d,%r12d
  add    $0x1,%eax
  add    $0x1,%ecx
  punpckldq %xmm4,%xmm0
  cltq
  cmp    %r12d,%ecx
  jl     L25
  mov    %edx,0x4(%rsp)
  mov    %r13d,%r15d
  movq   %xmm1,0x20(%rsp,%rax,4)
  jmp    L206
L25:
  movq   %xmm0,0x20(%rsp,%rax,4)
  lea    0x1(%r14),%eax
  mov    %r14d,%r11d
  mov    %edx,0x4(%rsp)
  mov    %eax,0x8(%rsp)
  jmp    L206
L56:
  lea    D5(%rip),%rdi
  mov    %r11d,0x18(%rsp)
  mov    %edx,0xc(%rsp)
  movq   %xmm1,0x10(%rsp)
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  mov    0x18(%rsp),%r11d
  movq   0x10(%rsp),%xmm1
  mov    0xc(%rsp),%edx
  jmp    L37
L97:
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L82
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L82:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D5
datatype: string

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