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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D8(%rip),%rsi
  lea    D46(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  lea    D39(%rip),%rsi
  lea    D13(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,0x8(%rsp)
  lea    0x14(%rsp),%rdx
  lea    D50(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    0x14(%rsp),%edx
  test   %edx,%edx
  jle    L47
  mov    %r12,%rbx
  mov    $0x0,%ebp
  lea    D21(%rip),%r15
L41:
  mov    %r13,%rcx
  sub    %r12,%rcx
  add    %rbx,%rcx
  mov    %rbx,%rdx
  mov    %r15,%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  add    $0x1,%ebp
  mov    0x14(%rsp),%edx
  add    $0x4,%rbx
  cmp    %ebp,%edx
  jg     L41
L47:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <sorter@plt>
  mov    (%r12),%r9d
  mov    0x0(%r13),%edx
  mov    %edx,%esi
  sub    %r9d,%esi
  mov    0x14(%rsp),%ecx
  cmp    $0x1,%ecx
  jle    L28
  lea    0x4(%r13),%rax
  lea    -0x2(%rcx),%ecx
  lea    0x8(%r13,%rcx,4),%r10
  mov    $0x0,%edi
  sub    %r13,%r12
  jmp    L81
L28:
  mov    $0x0,%edi
L7:
  mov    %edi,%ecx
  mov    %esi,%edx
  lea    D66(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L30:
  mov    %edx,%r8d
  sub    %r9d,%r8d
  cmp    %r8d,%esi
  cmovl  %r8d,%esi
  mov    %ecx,%r8d
  sub    %edx,%r8d
  cmp    %r8d,%edi
  cmovl  %r8d,%edi
  mov    (%rax),%edx
  mov    %ecx,%r9d
L52:
  add    $0x4,%rax
  cmp    %r10,%rax
  je     L7
L81:
  mov    (%r12,%rax,1),%ecx
  cmp    %edx,%ecx
  jg     L30
  mov    (%rax),%ecx
  cmp    %edx,%ecx
  jl     L52
  mov    %ecx,%edx
  sub    %r9d,%edx
  cmp    %edx,%esi
  cmovl  %edx,%esi
  mov    %ecx,%edx
  jmp    L52
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D8
type_infered: string
name: disassemble_data
arguments: data_tag: D46
type_infered: string
name: disassemble_data
arguments: data_tag: D39
type_infered: string
name: disassemble_data
arguments: data_tag: D13
type_infered: string
name: disassemble_data
arguments: data_tag: D50
type_infered: string
name: disassemble_data
arguments: data_tag: D21
type_infered: string
name: disassemble_data
arguments: data_tag: D66
type_infered: string

tool: D8: r

tool: D46: milk2.in

tool: D39: w

tool: D13: milk2.out

tool: D50: %d

tool: D21: %d %d

tool: D66: %d %d


assistant: ```c
main() {
  FILE *fin = fopen("milk2.in", "r");
  FILE *fout = fopen("milk2.out", "w");
  int n, i, start, end, milk, stop = 0;
  int *bone1;
  int *bone2;
  fscanf(fin, "%d", &n);
  bone1 = (int *)malloc(sizeof(int) * n);
  bone2 = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; ++i) {
    fscanf(fin, "%d %d", &bone1[i], &bone2[i]);
  }
  sorter(bone1, bone2, n);
  start = bone1[0];
  end = bone2[0];
  milk = end - start;
  for (i = 1; i < n; ++i) {
    if (bone1[i] <= end && end <= bone2[i]) {
      end = bone2[i];
      if (end - start > milk)
        milk = end - start;
    }
    if (bone1[i] > end) {
      if (end - start > milk)
        milk = end - start;
      if (bone1[i] - end > stop)
        stop = bone1[i] - end;
      start = bone1[i];
      end = bone2[i];
    }
  }
  fprintf(fout, "%d %d\n", milk, stop);
  exit(0);
}
```