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

```asm
<counting_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%r8
  mov    %esi,%r10d
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movslq %esi,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L203:
  cmp    %rdx,%rsp
  je     L121
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L203
L121:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L184
  orq    $0x0,-0x8(%rsp,%rax,1)
L184:
  mov    %rsp,%r9
  mov    (%r8),%ecx
  cmp    $0x1,%r10d
  jle    L122
  lea    0x4(%r8),%rax
  lea    -0x2(%r10),%edx
  lea    0x8(%r8,%rdx,4),%rsi
  mov    %ecx,%edi
  jmp    L16
L128:
  mov    %edx,%ecx
L183:
  add    $0x4,%rax
  cmp    %rsi,%rax
  je     L100
L16:
  mov    (%rax),%edx
  cmp    %ecx,%edx
  jg     L128
  cmp    %edx,%edi
  cmovg  %edx,%edi
  jmp    L183
L100:
  sub    %edi,%ecx
  lea    0x1(%rcx),%esi
  movslq %esi,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L119:
  cmp    %rdx,%rsp
  je     L46
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L119
L46:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L21
  orq    $0x0,-0x8(%rsp,%rax,1)
L21:
  mov    %rsp,%rdx
  mov    $0x0,%eax
  test   %esi,%esi
  jle    L34
L219:
  movl   $0x0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L219
L38:
  test   %r10d,%r10d
  jle    L81
L34:
  mov    $0x0,%ecx
L66:
  mov    (%r8,%rcx,4),%eax
  sub    %edi,%eax
  cltq
  addl   $0x1,(%rdx,%rax,4)
  add    $0x1,%rcx
  cmp    %ecx,%r10d
  jg     L66
  cmp    $0x1,%esi
  jle    L172
L6:
  lea    0x4(%rdx),%rax
  lea    -0x2(%rsi),%ecx
  lea    0x8(%rdx,%rcx,4),%rsi
L56:
  mov    -0x4(%rax),%ecx
  add    %ecx,(%rax)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L56
L172:
  test   %r10d,%r10d
  jle    L216
  mov    %r8,%rsi
  lea    -0x1(%r10),%eax
  lea    0x4(%r8,%rax,4),%r12
L10:
  mov    (%rsi),%r11d
  mov    %r11d,%eax
  sub    %edi,%eax
  cltq
  mov    (%rdx,%rax,4),%ebx
  lea    -0x1(%rbx),%ecx
  movslq %ecx,%rbx
  mov    %r11d,(%r9,%rbx,4)
  mov    %ecx,(%rdx,%rax,4)
  add    $0x4,%rsi
  cmp    %r12,%rsi
  jne    L10
  mov    %r10d,%r10d
  mov    $0x0,%eax
L103:
  mov    (%r9,%rax,4),%edx
  mov    %edx,(%r8,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%r10
  jne    L103
L216:
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  lea    -0x10(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
L81:
  cmp    $0x1,%esi
  jg     L6
  jmp    L216
L122:
  movl   $0x0,-0x1c(%rbp)
  mov    %ecx,%edi
  lea    -0x1c(%rbp),%rdx
  mov    $0x1,%esi
  jmp    L38
L0:
  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];
}
```