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

```asm
<counting_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %esi,%rax
  mov    %rsp,%rcx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L204
L177:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L177
L204:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L194
L148:
  mov    (%r14),%ebx
  mov    %rsp,%r15
  cmp    $0x1,%r12d
  jle    L133
  lea    0x4(%r14),%r8
  lea    -0x2(%r12),%edx
  mov    %ebx,%ecx
  mov    %r8,%rax
  lea    0x8(%r14,%rdx,4),%rsi
  jmp    L58
  nopl   0x0(%rax)
L32:
  cmp    %edx,%ebx
  cmovg  %edx,%ebx
  add    $0x4,%rax
  cmp    %rax,%rsi
  je     L209
L58:
  mov    (%rax),%edx
  cmp    %ecx,%edx
  jle    L32
  add    $0x4,%rax
  mov    %edx,%ecx
  cmp    %rax,%rsi
  jne    L58
L209:
  sub    %ebx,%ecx
  mov    %rsp,%rdi
  add    $0x1,%ecx
  movslq %ecx,%rdx
  lea    0xf(,%rdx,4),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rdi
  and    $0xfffffffffffffff0,%rsi
  cmp    %rdi,%rsp
  je     L182
L91:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L91
L182:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L169
L93:
  mov    %rsp,%rdi
  mov    %rdi,%r13
  test   %ecx,%ecx
  jle    L24
  shl    $0x2,%rdx
  xor    %esi,%esi
  mov    %r8,-0x50(%rbp)
  mov    %ecx,-0x44(%rbp)
  call   <memset@plt>
  mov    -0x44(%rbp),%ecx
  mov    -0x50(%rbp),%r8
  mov    %r13,%rdi
L24:
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L202:
  mov    (%r14,%rdx,4),%eax
  add    $0x1,%rdx
  sub    %ebx,%eax
  cltq
  addl   $0x1,(%rdi,%rax,4)
  cmp    %edx,%r12d
  jg     L202
  cmp    $0x1,%ecx
  jle    L81
  sub    $0x2,%ecx
  mov    (%rdi),%edx
  lea    0x4(%rdi),%rax
  lea    0x8(%rdi,%rcx,4),%rcx
  nopl   0x0(%rax,%rax,1)
L56:
  add    (%rax),%edx
  add    $0x4,%rax
  mov    %edx,-0x4(%rax)
  cmp    %rax,%rcx
  jne    L56
L81:
  test   %r12d,%r12d
  jle    L109
L61:
  lea    -0x1(%r12),%eax
  mov    %r14,%rcx
  lea    (%r8,%rax,4),%r8
  nop
L191:
  mov    (%rcx),%esi
  add    $0x4,%rcx
  mov    %esi,%eax
  sub    %ebx,%eax
  cltq
  mov    0x0(%r13,%rax,4),%edi
  lea    -0x1(%rdi),%edx
  movslq %edx,%rdi
  mov    %edx,0x0(%r13,%rax,4)
  mov    %esi,(%r15,%rdi,4)
  cmp    %r8,%rcx
  jne    L191
  mov    %r12d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  shl    $0x2,%rdx
  call   <memcpy@plt>
L109:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L205
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   (%rax)
L194:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L148
  nopl   0x0(%rax,%rax,1)
L169:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L93
L133:
  movl   $0x0,-0x3c(%rbp)
  lea    -0x3c(%rbp),%r13
  jne    L109
  movl   $0x1,-0x3c(%rbp)
  lea    0x4(%r14),%r8
  jmp    L61
L205:
  call   <__stack_chk_fail@plt>
```

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];
}
```