user: Please show me the C implementation that matches the assembly code listed below:

```asm
<magic_index_aux>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  cmp    %rsi,%rcx
  mov    %rcx,0x80(%rsp)
  setge  0x77(%rsp)
L67:
  mov    0x80(%rsp),%rbx
  mov    %rdx,%rcx
  cmp    %rbx,%rdx
  setg   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L378
  cmpb   $0x0,0x77(%rsp)
  jne    L378
  mov    %rbx,%rax
  sub    %rdx,%rax
  sar    %rax
  lea    (%rax,%rdx,1),%r15
  movslq (%rdi,%r15,4),%rbx
  mov    %rbx,0x8(%rsp)
  cmp    %r15,%rbx
  je     L83
  lea    -0x1(%r15),%rax
  mov    %r15,0x88(%rsp)
  cmovl  %rbx,%rax
  mov    %rax,0x10(%rsp)
  cmp    %rsi,%rax
  setge  0x78(%rsp)
L405:
  mov    0x10(%rsp),%rbx
  mov    %rdx,%rcx
  cmp    %rdx,%rbx
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L430
  cmpb   $0x0,0x78(%rsp)
  jne    L430
  mov    %rbx,%rax
  sub    %rdx,%rax
  sar    %rax
  lea    (%rax,%rdx,1),%r12
  movslq (%rdi,%r12,4),%rcx
  mov    %rcx,0x18(%rsp)
  cmp    %rcx,%r12
  je     L158
  lea    -0x1(%r12),%rax
  mov    %r12,0x90(%rsp)
  cmovg  %rcx,%rax
  mov    %rax,0x20(%rsp)
  cmp    %rax,%rsi
  setle  0x79(%rsp)
L344:
  mov    0x20(%rsp),%rbx
  mov    %rdx,%rcx
  cmp    %rdx,%rbx
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L255
  cmpb   $0x0,0x79(%rsp)
  jne    L255
  mov    %rbx,%rax
  sub    %rdx,%rax
  sar    %rax
  lea    (%rax,%rdx,1),%rbp
  movslq (%rdi,%rbp,4),%rbx
  mov    %rbx,0x28(%rsp)
  cmp    %rbx,%rbp
  je     L1
  lea    -0x1(%rbp),%rax
  mov    %rbp,0x98(%rsp)
  mov    %rdi,%r15
  cmovg  %rbx,%rax
  mov    %rax,0x30(%rsp)
  cmp    %rax,%rsi
  setle  0x7a(%rsp)
L504:
  mov    0x30(%rsp),%rdi
  mov    %rdx,%rcx
  cmp    %rdx,%rdi
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L480
  cmpb   $0x0,0x7a(%rsp)
  jne    L480
  mov    %rdi,%rax
  sub    %rdx,%rax
  sar    %rax
  lea    (%rax,%rdx,1),%r11
  movslq (%r15,%r11,4),%rdi
  mov    %rdi,0x38(%rsp)
  cmp    %rdi,%r11
  je     L432
  lea    -0x1(%r11),%rax
  mov    %r11,0xa0(%rsp)
  mov    %r15,%r14
  mov    %rsi,%r15
  cmovg  %rdi,%rax
  mov    %rax,0x40(%rsp)
  cmp    %rax,%rsi
  setle  0x7b(%rsp)
L305:
  mov    0x40(%rsp),%rsi
  mov    %rdx,%rcx
  cmp    %rdx,%rsi
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L302
  cmpb   $0x0,0x7b(%rsp)
  jne    L302
  mov    %rsi,%rax
  sub    %rdx,%rax
  sar    %rax
  lea    (%rax,%rdx,1),%r11
  movslq (%r14,%r11,4),%rsi
  mov    %rsi,0x48(%rsp)
  cmp    %rsi,%r11
  je     L486
  lea    -0x1(%r11),%rax
  mov    %r11,0xa8(%rsp)
  cmovg  %rsi,%rax
  cmp    %rax,%r15
  mov    %rax,0x50(%rsp)
  mov    %r15,%rax
  mov    %r14,%r15
  setle  0x7c(%rsp)
  mov    %rax,%r14
L40:
  mov    0x50(%rsp),%rsi
  mov    %rdx,%rcx
  cmp    %rdx,%rsi
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L435
  cmpb   $0x0,0x7c(%rsp)
  jne    L435
  sub    %rdx,%rsi
  mov    %rsi,%rbp
  sar    %rbp
  add    %rdx,%rbp
  movslq (%r15,%rbp,4),%rdi
  mov    %rdi,0x58(%rsp)
  cmp    %rdi,%rbp
  je     L356
  lea    -0x1(%rbp),%rax
  mov    %rbp,0xb0(%rsp)
  cmovg  %rdi,%rax
  cmp    %rax,%r14
  mov    %rax,0x60(%rsp)
  mov    %r14,%rax
  mov    %r15,%r14
  setle  0x7d(%rsp)
  mov    %rax,%r15
L292:
  mov    0x60(%rsp),%rsi
  mov    %rdx,%rcx
  cmp    %rdx,%rsi
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L408
  cmpb   $0x0,0x7d(%rsp)
  jne    L408
  sub    %rdx,%rsi
  mov    %rsi,%r12
  sar    %r12
  add    %rdx,%r12
  movslq (%r14,%r12,4),%r10
  cmp    %r10,%r12
  je     L385
  lea    -0x1(%r12),%r13
  mov    %r10,0xc0(%rsp)
  cmovg  %r10,%r13
  mov    %r12,0xb8(%rsp)
  mov    %r15,%r12
  cmp    %r13,%r15
  mov    %r13,0x68(%rsp)
  mov    %r14,%r13
  setle  0x7e(%rsp)
L345:
  mov    0x68(%rsp),%rdi
  mov    %rdx,%rcx
  cmp    %rdx,%rdi
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L76
  cmpb   $0x0,0x7e(%rsp)
  jne    L76
  sub    %rdx,%rdi
  mov    %rdi,%rbx
  sar    %rbx
  add    %rdx,%rbx
  movslq 0x0(%r13,%rbx,4),%r14
  cmp    %r14,%rbx
  je     L297
  lea    -0x1(%rbx),%rbp
  mov    %rbx,0xc8(%rsp)
  mov    %r12,%rbx
  cmovg  %r14,%rbp
  cmp    %rbp,%r12
  setle  0x7f(%rsp)
  nopl   (%rax)
L242:
  cmp    %rdx,%rbp
  mov    %rdx,%rcx
  setl   %al
  shr    $0x3f,%rcx
  or     %cl,%al
  jne    L373
  cmpb   $0x0,0x7f(%rsp)
  jne    L373
  mov    %rbp,%r15
  sub    %rdx,%r15
  sar    %r15
  add    %rdx,%r15
  movslq 0x0(%r13,%r15,4),%r12
  cmp    %r12,%r15
  je     L404
  jle    L132
  mov    %r12,%rcx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <magic_index_aux>
  mov    %rax,%r12
  cmp    $0xffffffffffffffff,%rax
  jne    L404
L41:
  lea    0x1(%r15),%rdx
  jmp    L242
  nopl   (%rax)
L404:
  mov    %r12,%r15
L444:
  add    $0xd8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L132:
  lea    -0x1(%r15),%rcx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <magic_index_aux>
  cmp    $0xffffffffffffffff,%rax
  jne    L72
  cmp    %r12,%r15
  je     L41
  mov    %r12,%rdx
  jmp    L242
L408:
  mov    0xb0(%rsp),%rbp
  mov    0x58(%rsp),%rdi
  mov    %r15,%rax
  mov    %r14,%r15
  mov    %rax,%r14
  lea    0x1(%rbp),%rdx
  cmp    %rdi,%rbp
  cmovl  %rdi,%rdx
  jmp    L40
L435:
  mov    0xa8(%rsp),%r11
  mov    0x48(%rsp),%rsi
  mov    %r14,%rax
  mov    %r15,%r14
  mov    %rax,%r15
  lea    0x1(%r11),%rdx
  cmp    %rsi,%r11
  cmovl  %rsi,%rdx
  jmp    L305
  nopw   0x0(%rax,%rax,1)
L76:
  mov    0xc0(%rsp),%r10
  mov    %r12,%r15
  mov    %r13,%r14
  mov    0xb8(%rsp),%r12
  cmp    %r10,%r12
  lea    0x1(%r12),%rdx
  cmovl  %r10,%rdx
  jmp    L292
L356:
  mov    %rbp,%r15
  jmp    L444
  nopw   0x0(%rax,%rax,1)
L72:
  mov    %rax,%r15
  jmp    L444
L302:
  mov    0xa0(%rsp),%r11
  mov    0x38(%rsp),%rcx
  mov    %r15,%rsi
  mov    %r14,%r15
  lea    0x1(%r11),%rdx
  cmp    %rcx,%r11
  cmovl  %rcx,%rdx
  jmp    L504
  nopl   0x0(%rax,%rax,1)
L297:
  mov    %rbx,%r15
  jmp    L444
L486:
  mov    %r11,%r15
  jmp    L444
L480:
  mov    0x98(%rsp),%rbp
  mov    0x28(%rsp),%rcx
  mov    %r15,%rdi
  lea    0x1(%rbp),%rdx
  cmp    %rcx,%rbp
  cmovl  %rcx,%rdx
  jmp    L344
L385:
  mov    %r12,%r15
  jmp    L444
L432:
  mov    %r11,%r15
  jmp    L444
L1:
  mov    %rbp,%r15
  jmp    L444
L255:
  mov    0x90(%rsp),%r12
  mov    0x18(%rsp),%rcx
  lea    0x1(%r12),%rdx
  cmp    %rcx,%r12
  cmovl  %rcx,%rdx
  jmp    L405
  cs nopw 0x0(%rax,%rax,1)
L373:
  mov    %rbx,%r12
  mov    0xc8(%rsp),%rbx
  cmp    %r14,%rbx
  lea    0x1(%rbx),%rdx
  cmovl  %r14,%rdx
  jmp    L345
L378:
  mov    $0xffffffffffffffff,%r15
  jmp    L444
L158:
  mov    %r12,%r15
  jmp    L444
L430:
  mov    0x88(%rsp),%r15
  mov    0x8(%rsp),%rcx
  lea    0x1(%r15),%rdx
  cmp    %r15,%rcx
  cmovg  %rcx,%rdx
  jmp    L67
L83:
  mov    %rbx,%r15
  jmp    L444
```

assistant: ```c
ssize_t magic_index_aux(int arr[], ssize_t arr_sz, ssize_t l, ssize_t r) {
  if (l > r || l < 0 || r > arr_sz - 1) {
    return -1;
  }
  ssize_t m = l + (r - l) / 2;
  if (arr[m] == m) {
    return m;
  }
  ssize_t ret = magic_index_aux(arr, arr_sz, l, ((m - 1) < (arr[m]) ? (m - 1) : (arr[m])));
  if (ret == -1) {
    ret = magic_index_aux(arr, arr_sz, ((m + 1) > (arr[m]) ? (m + 1) : (arr[m])), r);
  }
  return ret;
}
```