user: What would the C source look like for the assembly code provided here:

```asm
<ss_swapmerge>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x468,%rsp
  mov    %r9,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x458(%rsp)
  xor    %eax,%eax
  movslq 0x4a0(%rsp),%rax
  movl   $0x0,(%rsp)
  movl   $0x0,0x4(%rsp)
  mov    %rax,0x8(%rsp)
L410:
  mov    %r13,%rax
  sub    %rbp,%rax
  mov    %rax,%rbx
  mov    %rax,0x18(%rsp)
  sar    $0x2,%rbx
  cmp    0x8(%rsp),%rbx
  jg     L236
  cmp    %rbp,%r14
  jae    L0
  cmp    %r13,%rbp
  jb     L20
  nopl   0x0(%rax,%rax,1)
L0:
  testb  $0x1,(%rsp)
  jne    L444
  testb  $0x2,(%rsp)
  je     L186
  movslq (%r14),%rax
  lea    (%r12,%rax,4),%rdx
  mov    -0x4(%r14),%eax
  test   %eax,%eax
  js     L311
L173:
  movslq %eax,%rsi
  mov    0x4a8(%rsp),%ecx
  xor    %eax,%eax
  mov    %r15,%rdi
  lea    (%r12,%rsi,4),%rsi
  call   <ss_compare@plt>
  test   %eax,%eax
  je     L444
  nopw   0x0(%rax,%rax,1)
L186:
  testb  $0x4,(%rsp)
  je     L276
  movslq 0x0(%r13),%rax
  lea    (%r12,%rax,4),%rdx
  mov    -0x4(%r13),%eax
  test   %eax,%eax
  jns    L172
  not    %eax
L172:
  movslq %eax,%rsi
  mov    0x4a8(%rsp),%ecx
  xor    %eax,%eax
  mov    %r15,%rdi
  lea    (%r12,%rsi,4),%rsi
  call   <ss_compare@plt>
  test   %eax,%eax
  jne    L276
  notl   0x0(%r13)
L276:
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  je     L88
  sub    $0x1,%eax
  mov    %eax,0x4(%rsp)
  cltq
  shl    $0x5,%rax
  mov    0x50(%rsp,%rax,1),%r14
  mov    0x58(%rsp,%rax,1),%rbp
  mov    0x60(%rsp,%rax,1),%r13
  mov    0x68(%rsp,%rax,1),%eax
  mov    %eax,(%rsp)
  jmp    L410
  nopl   0x0(%rax)
L444:
  notl   (%r14)
  jmp    L186
  nopl   (%rax)
L236:
  mov    %rbp,%rax
  sub    %r14,%rax
  mov    %rax,0x40(%rsp)
  sar    $0x2,%rax
  cmp    0x8(%rsp),%rax
  jg     L275
  cmp    %rbp,%r14
  jae    L0
  sub    $0x8,%rsp
  mov    %r12,%rsi
  mov    %r15,%rdi
  mov    %r13,%r8
  mov    0x4b0(%rsp),%eax
  mov    %rbp,%rcx
  mov    %r14,%rdx
  push   %rax
  mov    0x38(%rsp),%r9
  xor    %eax,%eax
  call   <ss_mergeforward@plt>
  pop    %rsi
  pop    %rdi
  jmp    L0
  nopl   0x0(%rax)
L88:
  mov    0x458(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L397
  add    $0x468,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L20:
  sub    $0x8,%rsp
  mov    %r13,%r8
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    0x4b0(%rsp),%eax
  mov    %r12,%rsi
  mov    %r15,%rdi
  push   %rax
  mov    0x38(%rsp),%r9
  xor    %eax,%eax
  call   <ss_mergebackward@plt>
  pop    %r8
  pop    %r9
  jmp    L0
L311:
  not    %eax
  jmp    L173
  nopw   0x0(%rax,%rax,1)
L275:
  mov    0x40(%rsp),%rdi
  cmp    %rdi,0x18(%rsp)
  cmovg  %eax,%ebx
  mov    %ebx,%r9d
  sar    %r9d
  test   %ebx,%ebx
  jle    L298
  mov    %r14,0x30(%rsp)
  mov    %rbp,%r14
  mov    %r12,%rbp
  mov    0x4a8(%rsp),%r12d
  mov    %r13,0x48(%rsp)
  mov    %r9d,%r13d
  movl   $0x0,0x20(%rsp)
  movq   $0x0,0x10(%rsp)
  jmp    L21
  nopl   0x0(%rax)
L119:
  mov    %r13d,%eax
  sar    %eax
  test   %r13d,%r13d
  jle    L111
L95:
  mov    %r13d,%ebx
  mov    %eax,%r13d
L21:
  movslq %r13d,%rax
  add    0x10(%rsp),%rax
  mov    $0xfffffffffffffffc,%rdx
  lea    0x0(,%rax,4),%rcx
  sub    %rcx,%rdx
  movslq (%r14,%rdx,1),%rdx
  test   %edx,%edx
  jns    L16
  not    %edx
  movslq %edx,%rdx
L16:
  movslq (%r14,%rax,4),%rsi
  lea    0x0(%rbp,%rdx,4),%rdx
  test   %esi,%esi
  jns    L335
  not    %esi
  movslq %esi,%rsi
L335:
  xor    %eax,%eax
  lea    0x0(%rbp,%rsi,4),%rsi
  mov    %r12d,%ecx
  mov    %r15,%rdi
  call   <ss_compare@plt>
  test   %eax,%eax
  jns    L119
  mov    0x20(%rsp),%eax
  not    %ebx
  and    $0x1,%ebx
  lea    0x1(%r13,%rax,1),%edi
  sub    %ebx,%r13d
  mov    %r13d,%eax
  mov    %edi,0x20(%rsp)
  sar    %eax
  test   %r13d,%r13d
  jle    L111
  movslq %edi,%rdi
  mov    %rdi,0x10(%rsp)
  jmp    L95
  nopl   0x0(%rax)
L111:
  mov    0x20(%rsp),%edx
  mov    %rbp,%r12
  mov    0x48(%rsp),%r13
  mov    %r14,%rbp
  mov    0x30(%rsp),%r14
  test   %edx,%edx
  jg     L337
L298:
  movslq 0x0(%rbp),%rax
  lea    (%r12,%rax,4),%rdx
  mov    -0x4(%rbp),%eax
  test   %eax,%eax
  jns    L83
  not    %eax
L83:
  movslq %eax,%rsi
  mov    0x4a8(%rsp),%ecx
  xor    %eax,%eax
  mov    %r15,%rdi
  lea    (%r12,%rsi,4),%rsi
  call   <ss_compare@plt>
  test   %eax,%eax
  jne    L0
  notl   0x0(%rbp)
  jmp    L0
  nopl   0x0(%rax)
L337:
  movslq %edx,%rax
  mov    %rbp,%rbx
  movq   %r14,%xmm1
  mov    %rbp,%rsi
  shl    $0x2,%rax
  sub    %rax,%rbx
  lea    0x0(%rbp,%rax,1),%rcx
  xor    %eax,%eax
  movq   %rbx,%xmm2
  mov    %rbx,0x10(%rsp)
  mov    %rcx,%rbx
  punpcklqdq %xmm2,%xmm1
  movq   %xmm2,%rdi
  mov    %rcx,0x20(%rsp)
  movaps %xmm1,0x30(%rsp)
  call   <ss_blockswap@plt>
  cmp    %rbx,%r13
  jbe    L125
  mov    (%rbx),%eax
  test   %eax,%eax
  js     L379
  cmp    0x10(%rsp),%r14
  jae    L125
  mov    0x0(%rbp),%r9d
  mov    %rbp,%rdx
  test   %r9d,%r9d
  jns    L330
  mov    0x10(%rsp),%rbx
  nopl   0x0(%rax)
L294:
  mov    0x4(%rdx),%r8d
  add    $0x4,%rdx
  test   %r8d,%r8d
  js     L294
  mov    %r13,%rax
  mov    %rbx,0x10(%rsp)
  mov    %rbp,%rcx
  xor    %r8d,%r8d
  sub    %rdx,%rax
  mov    %rax,0x18(%rsp)
  mov    $0x2,%eax
  jmp    L18
  nopw   0x0(%rax,%rax,1)
L125:
  mov    %rbp,%rdx
  mov    %rbp,%rcx
  xor    %r8d,%r8d
  xor    %eax,%eax
L18:
  mov    (%rsp),%esi
  mov    0x4(%rsp),%r11d
  movq   %rdx,%xmm0
  mov    0x18(%rsp),%rbx
  movhps 0x20(%rsp),%xmm0
  mov    %esi,%edi
  and    $0x4,%esi
  mov    %esi,%r9d
  and    $0x3,%edi
  lea    0x1(%r11),%esi
  cmp    %rbx,0x40(%rsp)
  jg     L41
  movslq %r11d,%rdx
  and    $0x3,%eax
  or     %edi,%r8d
  mov    %esi,0x4(%rsp)
  shl    $0x5,%rdx
  or     %r9d,%eax
  mov    %r8d,(%rsp)
  mov    0x10(%rsp),%rbp
  mov    %r13,0x60(%rsp,%rdx,1)
  mov    %rcx,%r13
  mov    %eax,0x68(%rsp,%rdx,1)
  movaps %xmm0,0x50(%rsp,%rdx,1)
  jmp    L410
  nopl   0x0(%rax,%rax,1)
L41:
  test   $0x2,%al
  je     L246
  cmp    %rdx,%rbp
  jne    L246
  xor    $0x6,%eax
  mov    %eax,%r8d
  and    $0x4,%r8d
  nopl   0x0(%rax,%rax,1)
L246:
  movslq 0x4(%rsp),%r10
  and    $0x3,%eax
  or     %edi,%r8d
  mov    %esi,0x4(%rsp)
  movdqa 0x30(%rsp),%xmm3
  or     %r9d,%eax
  mov    0x20(%rsp),%rbp
  mov    %rdx,%r14
  shl    $0x5,%r10
  mov    %eax,(%rsp)
  mov    %rcx,0x60(%rsp,%r10,1)
  mov    %r8d,0x68(%rsp,%r10,1)
  movaps %xmm3,0x50(%rsp,%r10,1)
  jmp    L410
L379:
  not    %eax
  mov    %rbp,%rcx
  xor    %r8d,%r8d
  mov    %eax,(%rbx)
  mov    $0x1,%eax
  cmp    0x10(%rsp),%r14
  jb     L306
L12:
  mov    %rbp,%rdx
  jmp    L18
L306:
  mov    0x10(%rsp),%rbx
  nop
L195:
  mov    -0x4(%rcx),%r10d
  sub    $0x4,%rcx
  test   %r10d,%r10d
  js     L195
  mov    %rcx,%rax
  mov    %rbx,0x10(%rsp)
  mov    $0x4,%r8d
  sub    %r14,%rax
  mov    %rax,0x40(%rsp)
  mov    $0x5,%eax
  jmp    L12
L330:
  mov    %rbp,%rcx
  xor    %r8d,%r8d
  mov    $0x2,%eax
  jmp    L18
L397:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void ss_swapmerge(const unsigned char *T, const int *PA, int *first, int *middle, int *last, int *buf, int bufsize, int depth) {
  struct {
    int *a, *b, *c;
    int d;
  } stack[(32)];
  int *l, *r, *lm, *rm;
  int m, len, half;
  int ssize;
  int check, next;
  for (check = 0, ssize = 0;;) {
    if ((last - middle) <= bufsize) {
      if ((first < middle) && (middle < last)) {
        ss_mergebackward(T, PA, first, middle, last, buf, depth);
      }
      do {
        if (((check)&1) || (((check)&2) && (ss_compare(T, PA + ((0 <= (*((first)-1))) ? (*((first)-1)) : (~(*((first)-1)))), PA + *(first), depth) == 0))) {
          *(first) = ~*(first);
        }
        if (((check)&4) && ((ss_compare(T, PA + ((0 <= (*((last)-1))) ? (*((last)-1)) : (~(*((last)-1)))), PA + *(last), depth) == 0))) {
          *(last) = ~*(last);
        }
      } while (0);
      do {
        if (ssize == 0) {
          return;
        }
        (first) = stack[--ssize].a, (middle) = stack[ssize].b, (last) = stack[ssize].c, (check) = stack[ssize].d;
      } while (0);
      continue;
    }
    if ((middle - first) <= bufsize) {
      if (first < middle) {
        ss_mergeforward(T, PA, first, middle, last, buf, depth);
      }
      do {
        if (((check)&1) || (((check)&2) && (ss_compare(T, PA + ((0 <= (*((first)-1))) ? (*((first)-1)) : (~(*((first)-1)))), PA + *(first), depth) == 0))) {
          *(first) = ~*(first);
        }
        if (((check)&4) && ((ss_compare(T, PA + ((0 <= (*((last)-1))) ? (*((last)-1)) : (~(*((last)-1)))), PA + *(last), depth) == 0))) {
          *(last) = ~*(last);
        }
      } while (0);
      do {
        if (ssize == 0) {
          return;
        }
        (first) = stack[--ssize].a, (middle) = stack[ssize].b, (last) = stack[ssize].c, (check) = stack[ssize].d;
      } while (0);
      continue;
    }
    for (m = 0, len = (((middle - first) < (last - middle)) ? (middle - first) : (last - middle)), half = len >> 1; 0 < len; len = half, half >>= 1) {
      if (ss_compare(T, PA + ((0 <= (*(middle + m + half))) ? (*(middle + m + half)) : (~(*(middle + m + half)))), PA + ((0 <= (*(middle - m - half - 1))) ? (*(middle - m - half - 1)) : (~(*(middle - m - half - 1)))), depth) < 0) {
        m += half + 1;
        half -= (len & 1) ^ 1;
      }
    }
    if (0 < m) {
      lm = middle - m, rm = middle + m;
      ss_blockswap(lm, middle, m);
      l = r = middle, next = 0;
      if (rm < last) {
        if (*rm < 0) {
          *rm = ~*rm;
          if (first < lm) {
            for (; *--l < 0;) {
            }
            next |= 4;
          }
          next |= 1;
        } else if (first < lm) {
          for (; *r < 0; ++r) {
          }
          next |= 2;
        }
      }
      if ((l - first) <= (last - r)) {
        do {
          stack[ssize].a = (r), stack[ssize].b = (rm), stack[ssize].c = (last), stack[ssize++].d = ((next & 3) | (check & 4));
        } while (0);
        middle = lm, last = l, check = (check & 3) | (next & 4);
      } else {
        if ((next & 2) && (r == middle)) {
          next ^= 6;
        }
        do {
          stack[ssize].a = (first), stack[ssize].b = (lm), stack[ssize].c = (l), stack[ssize++].d = ((check & 3) | (next & 4));
        } while (0);
        first = r, middle = rm, check = (next & 3) | (check & 4);
      }
    } else {
      if (ss_compare(T, PA + ((0 <= (*(middle - 1))) ? (*(middle - 1)) : (~(*(middle - 1)))), PA + *middle, depth) == 0) {
        *middle = ~*middle;
      }
      do {
        if (((check)&1) || (((check)&2) && (ss_compare(T, PA + ((0 <= (*((first)-1))) ? (*((first)-1)) : (~(*((first)-1)))), PA + *(first), depth) == 0))) {
          *(first) = ~*(first);
        }
        if (((check)&4) && ((ss_compare(T, PA + ((0 <= (*((last)-1))) ? (*((last)-1)) : (~(*((last)-1)))), PA + *(last), depth) == 0))) {
          *(last) = ~*(last);
        }
      } while (0);
      do {
        if (ssize == 0) {
          return;
        }
        (first) = stack[--ssize].a, (middle) = stack[ssize].b, (last) = stack[ssize].c, (check) = stack[ssize].d;
      } while (0);
    }
  }
}
```