user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  lea    D8(%rip),%rdi
  call   <printf@plt>
  lea    -0x2c(%rbp),%rsi
  lea    D51(%rip),%rdi
  call   <scanf@plt>
  mov    -0x2c(%rbp),%esi
  movslq %esi,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L108:
  cmp    %rdx,%rsp
  je     L22
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L108
L22:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L4
  orq    $0x0,-0x8(%rsp,%rax,1)
L4:
  mov    %rsp,%rbx
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpl   $0x0,-0x2c(%rbp)
  jle    L86
  mov    %rbx,%r13
  mov    $0x0,%r12d
  lea    D51(%rip),%r14
L3:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  add    $0x1,%r12d
  mov    -0x2c(%rbp),%edi
  add    $0x4,%r13
  cmp    %r12d,%edi
  jg     L3
  test   %edi,%edi
  jle    L86
  mov    %edi,%r11d
  mov    $0x0,%r9d
  mov    $0xffffffff,%r12d
  jmp    L46
L28:
  add    $0x1,%rax
L169:
  mov    %eax,%esi
  cmp    %eax,%edi
  jle    L33
  mov    (%rbx,%rax,4),%edx
  cmp    %ecx,%edx
  jge    L28
  mov    %esi,%r8d
  mov    %edx,%ecx
  jmp    L28
L33:
  cmp    $0xffffffff,%r8d
  je     L23
  mov    %ecx,(%rbx,%r9,4)
  movslq %r8d,%r8
  mov    %r10d,(%rbx,%r8,4)
L23:
  add    $0x1,%r9
  cmp    %r11,%r9
  je     L86
L46:
  mov    (%rbx,%r9,4),%r10d
  cmp    %r9d,%edi
  jle    L23
  lea    0x1(%r9),%rax
  mov    %r10d,%ecx
  mov    %r12d,%r8d
  jmp    L169
L86:
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpl   $0x0,-0x2c(%rbp)
  jle    L168
  mov    $0x0,%r12d
  lea    D21(%rip),%r13
L166:
  mov    (%rbx,%r12,4),%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%r12
  cmp    %r12d,-0x2c(%rbp)
  jg     L166
L168:
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L117
  mov    $0x0,%eax
  lea    -0x20(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %rbp
  ret
L117:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D8
type_guessed: string
name: parse_data
arguments: data_label: D51
type_guessed: string
name: parse_data
arguments: data_label: D7
type_guessed: string
name: parse_data
arguments: data_label: D28
type_guessed: string
name: parse_data
arguments: data_label: D21
type_guessed: string

tool: D8: Length of array: 

tool: D51: %d

tool: D7: 
Enter %d numbers: 

tool: D28: 
Sorted array: 

tool: D21: %d 

assistant: ```c
int main() {
  int n, i;
  printf("Length of array: ");
  scanf("%d", &n);
  int ar[n];
  printf("\nEnter %d numbers: ", n);
  for (i = 0; i < n; i++)
    scanf("%d", &ar[i]);
  for (i = 0; i < n; i++) {
    int min, j, li = -1, tmp;
    min = ar[i];
    for (j = i; j < n; j++) {
      if (ar[j] < min) {
        min = ar[j];
        li = j;
      }
    }
    if (li != -1) {
      tmp = ar[i];
      ar[i] = min;
      ar[li] = tmp;
    }
  }
  printf("\nSorted array: ");
  for (i = 0; i < n; i++)
    printf("%d ", ar[i]);
  return 0;
}
```