user: 请从给定的汇编指令推导出C源代码：

```asm
<counting_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %esi,-0x7c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rsi
  mov    -0x7c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%rcx
  mov    $0x0,%ebx
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L210:
  cmp    %rdx,%rsp
  je     L175
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L210
L175:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L66
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L66:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x78(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x6c(%rbp)
  mov    -0x78(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x68(%rbp)
  movl   $0x1,-0x64(%rbp)
  jmp    L194
L60:
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x6c(%rbp)
  jge    L166
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x6c(%rbp)
  jmp    L196
L166:
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x68(%rbp)
  jle    L196
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x68(%rbp)
L196:
  addl   $0x1,-0x64(%rbp)
L194:
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L60
  mov    -0x6c(%rbp),%eax
  sub    -0x68(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x38(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L34:
  cmp    %rdx,%rsp
  je     L187
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L34
L187:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L116
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L116:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x60(%rbp)
  jmp    L174
L86:
  mov    -0x30(%rbp),%rax
  mov    -0x60(%rbp),%edx
  movslq %edx,%rdx
  movl   $0x0,(%rax,%rdx,4)
  addl   $0x1,-0x60(%rbp)
L174:
  mov    -0x60(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L86
  movl   $0x0,-0x5c(%rbp)
  jmp    L161
L158:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x68(%rbp),%eax
  mov    -0x30(%rbp),%rdx
  movslq %eax,%rcx
  mov    (%rdx,%rcx,4),%edx
  lea    0x1(%rdx),%ecx
  mov    -0x30(%rbp),%rdx
  cltq
  mov    %ecx,(%rdx,%rax,4)
  addl   $0x1,-0x5c(%rbp)
L161:
  mov    -0x5c(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L158
  movl   $0x1,-0x58(%rbp)
  jmp    L45
L109:
  mov    -0x30(%rbp),%rax
  mov    -0x58(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%ecx
  mov    -0x58(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x30(%rbp),%rax
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  add    %eax,%ecx
  mov    -0x30(%rbp),%rax
  mov    -0x58(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  addl   $0x1,-0x58(%rbp)
L45:
  mov    -0x58(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L109
  movl   $0x0,-0x54(%rbp)
  jmp    L171
L167:
  mov    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x68(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  lea    -0x1(%rax),%edx
  mov    (%rcx),%ecx
  mov    -0x40(%rbp),%rax
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  mov    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x68(%rbp),%eax
  mov    -0x30(%rbp),%rdx
  movslq %eax,%rcx
  mov    (%rdx,%rcx,4),%edx
  lea    -0x1(%rdx),%ecx
  mov    -0x30(%rbp),%rdx
  cltq
  mov    %ecx,(%rdx,%rax,4)
  addl   $0x1,-0x54(%rbp)
L171:
  mov    -0x54(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L167
  movl   $0x0,-0x50(%rbp)
  jmp    L214
L186:
  mov    -0x50(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x40(%rbp),%rax
  mov    -0x50(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  mov    %eax,(%rcx)
  addl   $0x1,-0x50(%rbp)
L214:
  mov    -0x50(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L186
  mov    %rsi,%rsp
  nop
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L10
  call   <__stack_chk_fail@plt>
L10:
  lea    -0x18(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
void counting_sort(int input[], int n) {
  int output[n];
  int max = input[0];
  int min = input[0];
  for (int i = 1; i < n; i++) {
    if (input[i] > max)
      max = input[i];
    else if (input[i] < min)
      min = input[i];
  }
  int k = max - min + 1;
  int count_array[k];
  for (int i = 0; i < k; i++)
    count_array[i] = 0;
  for (int i = 0; i < n; i++)
    count_array[input[i] - min]++;
  for (int i = 1; i < k; i++)
    count_array[i] += count_array[i - 1];
  for (int i = 0; i < n; i++) {
    output[count_array[input[i] - min] - 1] = input[i];
    count_array[input[i] - min]--;
  }
  for (int i = 0; i < n; i++)
    input[i] = output[i];
}
```