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

```asm
<sorted_array_to_tree>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %ecx,0x30(%rsp)
  cmp    %ecx,%edx
  jg     L33
  mov    %rdi,%r14
  mov    %rsi,%r12
  lea    D5(%rip),%r13
  mov    %edx,%r15d
L82:
  mov    0x30(%rsp),%eax
  mov    %r13,%rdi
  lea    (%rax,%r15,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x34(%rsp)
  mov    %eax,%ebp
  cltq
  lea    (%r12,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r14,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%rbp),%eax
  mov    %eax,0x24(%rsp)
  cmp    %r15d,%eax
  jl     L118
L141:
  mov    0x24(%rsp),%eax
  mov    %r13,%rdi
  lea    (%rax,%r15,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x38(%rsp)
  mov    %eax,%ebp
  cltq
  lea    (%r12,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r14,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%rbp),%eax
  mov    %eax,0x28(%rsp)
  cmp    %r15d,%eax
  jl     L132
  mov    %r12,0x8(%rsp)
  mov    %r15d,%r12d
L117:
  mov    0x28(%rsp),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  lea    (%rax,%r12,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x3c(%rsp)
  mov    %eax,%r15d
  cltq
  lea    (%rdx,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r14,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%r15),%eax
  mov    %eax,0x2c(%rsp)
  cmp    %r12d,%eax
  jl     L173
  mov    %r12d,%r15d
L92:
  mov    0x2c(%rsp),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  lea    (%rax,%r15,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x40(%rsp)
  mov    %eax,%ebp
  cltq
  lea    (%rdx,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r14,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%rbp),%eax
  mov    %eax,0x10(%rsp)
  cmp    %r15d,%eax
  jl     L113
  mov    %r15d,%r12d
  mov    %r14,%r15
L169:
  mov    0x10(%rsp),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  lea    (%r12,%rax,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,0x18(%rsp)
  mov    %eax,%r14d
  cltq
  lea    (%rdx,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r15,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%r14),%eax
  mov    %eax,0x14(%rsp)
  cmp    %eax,%r12d
  jg     L32
  mov    %r12d,%r14d
L9:
  mov    0x14(%rsp),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  add    %r14d,%eax
  mov    %eax,%ebx
  shr    $0x1f,%ebx
  add    %eax,%ebx
  sar    %ebx
  movslq %ebx,%rax
  mov    %ebx,0x20(%rsp)
  lea    (%rdx,%rax,4),%rbp
  mov    0x0(%rbp),%esi
  call   <printf@plt>
  mov    0x0(%rbp),%esi
  mov    %r15,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%rbx),%eax
  mov    %eax,0x1c(%rsp)
  cmp    %r14d,%eax
  jl     L7
L85:
  mov    0x1c(%rsp),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  add    %r14d,%eax
  mov    %eax,%ebp
  shr    $0x1f,%ebp
  add    %eax,%ebp
  sar    %ebp
  movslq %ebp,%rax
  mov    %ebp,0x44(%rsp)
  lea    (%rdx,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r15,%rdi
  lea    -0x1(%rbp),%ebx
  call   <tree_insert@plt>
  cmp    %r14d,%ebx
  jl     L158
  mov    %ebx,%r12d
L13:
  lea    (%r12,%r14,1),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  mov    %eax,%ebp
  shr    $0x1f,%ebp
  add    %eax,%ebp
  sar    %ebp
  movslq %ebp,%rax
  lea    (%rdx,%rax,4),%rbx
  mov    (%rbx),%esi
  call   <printf@plt>
  mov    (%rbx),%esi
  mov    %r15,%rdi
  call   <tree_insert@plt>
  lea    -0x1(%rbp),%r9d
  cmp    %r14d,%r9d
  jl     L170
  mov    %ebp,%r8d
L66:
  lea    (%r9,%r14,1),%eax
  mov    0x8(%rsp),%rdx
  mov    %r13,%rdi
  mov    %r8d,0x4c(%rsp)
  mov    %eax,%ebx
  mov    %r9d,0x48(%rsp)
  shr    $0x1f,%ebx
  add    %eax,%ebx
  sar    %ebx
  movslq %ebx,%rax
  lea    (%rdx,%rax,4),%rbp
  mov    0x0(%rbp),%esi
  call   <printf@plt>
  mov    0x0(%rbp),%esi
  mov    %r15,%rdi
  call   <tree_insert@plt>
  mov    0x8(%rsp),%rsi
  mov    %r14d,%edx
  lea    -0x1(%rbx),%ecx
  mov    %r15,%rdi
  lea    0x1(%rbx),%r14d
  call   <sorted_array_to_tree>
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  cmp    %r14d,%r9d
  jge    L66
  mov    %r8d,%ebp
L170:
  lea    0x1(%rbp),%r14d
  cmp    %r14d,%r12d
  jge    L13
L158:
  mov    0x44(%rsp),%r14d
  add    $0x1,%r14d
  cmp    %r14d,0x1c(%rsp)
  jge    L85
L7:
  mov    0x20(%rsp),%r14d
  add    $0x1,%r14d
  cmp    %r14d,0x14(%rsp)
  jge    L9
L32:
  mov    0x18(%rsp),%r12d
  add    $0x1,%r12d
  cmp    %r12d,0x10(%rsp)
  jge    L169
  mov    %r15,%r14
L113:
  mov    0x40(%rsp),%r15d
  add    $0x1,%r15d
  cmp    %r15d,0x2c(%rsp)
  jge    L92
L173:
  mov    0x3c(%rsp),%r12d
  add    $0x1,%r12d
  cmp    %r12d,0x28(%rsp)
  jge    L117
  mov    0x8(%rsp),%r12
L132:
  mov    0x38(%rsp),%r15d
  add    $0x1,%r15d
  cmp    %r15d,0x24(%rsp)
  jge    L141
L118:
  mov    0x34(%rsp),%r15d
  add    $0x1,%r15d
  cmp    0x30(%rsp),%r15d
  jle    L82
L33:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: tag: D5
data_type: string

tool: D5: %d: 

assistant: ```c
void sorted_array_to_tree(struct node **leaf, int arr[], int start, int end) {
  if (end < start)
    return;
  int middle = (start + end) / 2;
  printf("%d: ", arr[middle]);
  tree_insert(leaf, arr[middle]);
  sorted_array_to_tree(leaf, arr, start, middle - 1);
  sorted_array_to_tree(leaf, arr, middle + 1, end);
}
```