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

```asm
<quick_select>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r11
  lea    -0x1(%rsi),%ebp
  mov    %ebp,%r13d
  shr    $0x1f,%r13d
  add    %ebp,%r13d
  sar    %r13d
  test   %ebp,%ebp
  jle    L62
  cmp    $0x1,%ebp
  je     L97
  mov    $0x0,%r12d
  mov    $0x1,%eax
  jmp    L123
L62:
  movslq %r13d,%r13
  mov    (%r11,%r13,4),%eax
L154:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L97:
  mov    $0x0,%r12d
L10:
  movslq %r12d,%r12
  lea    (%r11,%r12,4),%rcx
  mov    (%rcx),%edx
  movslq %ebp,%rbp
  lea    (%r11,%rbp,4),%rax
  mov    (%rax),%esi
  cmp    %esi,%edx
  jle    L19
  mov    %esi,(%rcx)
  mov    %edx,(%rax)
L19:
  movslq %r13d,%r13
  mov    (%r11,%r13,4),%eax
  jmp    L154
L88:
  add    $0x1,%r8
L174:
  mov    %r8d,%r14d
  mov    (%rbx),%esi
  mov    (%r11,%r8,4),%r10d
  cmp    %r10d,%esi
  jg     L88
  movslq %edx,%rax
  lea    -0x4(%r11,%rax,4),%rax
L24:
  mov    %edx,%r9d
  sub    $0x1,%edx
  mov    %rax,%rdi
  sub    $0x4,%rax
  mov    0x4(%rax),%ecx
  cmp    %ecx,%esi
  jl     L24
  cmp    %r8d,%edx
  jl     L51
  mov    %ecx,(%r11,%r8,4)
  mov    %r10d,(%rdi)
  jmp    L88
L51:
  mov    %ecx,(%rbx)
  mov    %esi,(%rdi)
  cmp    %edx,%r13d
  jl     L11
  je     L30
  mov    %r14d,%r12d
L80:
  cmp    %r12d,%ebp
  jle    L62
  lea    0x1(%r12),%eax
  cmp    %ebp,%eax
  je     L10
L123:
  lea    (%r12,%rbp,1),%ecx
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  movslq %edx,%rdx
  lea    (%r11,%rdx,4),%rdx
  mov    (%rdx),%ecx
  movslq %ebp,%rsi
  lea    (%r11,%rsi,4),%rsi
  mov    (%rsi),%edi
  cmp    %edi,%ecx
  jle    L39
  mov    %edi,(%rdx)
  mov    %ecx,(%rsi)
L39:
  movslq %r12d,%rcx
  shl    $0x2,%rcx
  lea    (%r11,%rcx,1),%rbx
  mov    (%rbx),%edi
  mov    (%rsi),%r8d
  cmp    %r8d,%edi
  jle    L87
  mov    %r8d,(%rbx)
  mov    %edi,(%rsi)
L87:
  mov    (%rdx),%esi
  mov    (%rbx),%edi
  cmp    %edi,%esi
  jle    L116
  mov    %edi,(%rdx)
  mov    %esi,(%rbx)
L116:
  mov    (%rdx),%esi
  lea    0x4(%r11,%rcx,1),%rcx
  mov    (%rcx),%edi
  mov    %edi,(%rdx)
  mov    %esi,(%rcx)
  add    $0x1,%eax
  movslq %eax,%r8
  mov    %ebp,%edx
  jmp    L174
L30:
  mov    %r14d,%r12d
L11:
  lea    -0x2(%r9),%ebp
  jmp    L80
```

assistant: ```c
int quick_select(int arr[], int n) {
  int low, high;
  int median;
  int middle, ll, hh;
  low = 0;
  high = n - 1;
  median = (low + high) / 2;
  for (;;) {
    if (high <= low)
      return arr[median];
    if (high == low + 1) {
      if (arr[low] > arr[high]) {
        register int t = (arr[low]);
        (arr[low]) = (arr[high]);
        (arr[high]) = t;
      };
      return arr[median];
    }
    middle = (low + high) / 2;
    if (arr[middle] > arr[high]) {
      register int t = (arr[middle]);
      (arr[middle]) = (arr[high]);
      (arr[high]) = t;
    };
    if (arr[low] > arr[high]) {
      register int t = (arr[low]);
      (arr[low]) = (arr[high]);
      (arr[high]) = t;
    };
    if (arr[middle] > arr[low]) {
      register int t = (arr[middle]);
      (arr[middle]) = (arr[low]);
      (arr[low]) = t;
    };
    {
      register int t = (arr[middle]);
      (arr[middle]) = (arr[low + 1]);
      (arr[low + 1]) = t;
    };
    ll = low + 1;
    hh = high;
    for (;;) {
      do
        ll++;
      while (arr[low] > arr[ll]);
      do
        hh--;
      while (arr[hh] > arr[low]);
      if (hh < ll)
        break;
      {
        register int t = (arr[ll]);
        (arr[ll]) = (arr[hh]);
        (arr[hh]) = t;
      };
    }
    {
      register int t = (arr[low]);
      (arr[low]) = (arr[hh]);
      (arr[hh]) = t;
    };
    if (hh <= median)
      low = ll;
    if (hh >= median)
      high = hh - 1;
  }
}
```