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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  lea    -0x44(%rbp),%rsi
  push   %r13
  push   %r12
  push   %rbx
  lea    D17(%rip),%rbx
  mov    %rbx,%rdi
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <scanf@plt>
  mov    -0x44(%rbp),%eax
  test   %eax,%eax
  jle    L102
  lea    -0x3c(%rbp),%rax
  movl   $0x0,-0x54(%rbp)
  mov    %rax,-0x68(%rbp)
  lea    -0x40(%rbp),%rax
  mov    %rax,-0x60(%rbp)
  nopl   0x0(%rax)
L37:
  mov    -0x68(%rbp),%rdx
  mov    -0x60(%rbp),%rsi
  xor    %eax,%eax
  mov    %rsp,%r13
  lea    D5(%rip),%rdi
  call   <scanf@plt>
  movslq -0x40(%rbp),%rax
  mov    %rsp,%rsi
  mov    %rax,%rcx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L105
L150:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L150
L105:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L24
  orq    $0x0,-0x8(%rsp,%rdx,1)
L24:
  mov    %rsp,%r14
  xor    %r15d,%r15d
  mov    %r14,%r12
  test   %ecx,%ecx
  jle    L134
  nopw   0x0(%rax,%rax,1)
L35:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r15d
  call   <scanf@plt>
  mov    -0x40(%rbp),%esi
  add    $0x4,%r12
  cmp    %r15d,%esi
  jg     L35
  test   %esi,%esi
  jle    L134
  mov    -0x3c(%rbp),%r8d
  movslq %esi,%r15
  xor    %r9d,%r9d
  xor    %r10d,%r10d
  xor    %r11d,%r11d
  nopl   (%rax)
L156:
  mov    %r9,%rdx
  xor    %ecx,%ecx
  xor    %eax,%eax
  nop
L80:
  mov    %eax,%edi
  add    (%r14,%rdx,4),%eax
  cmp    %eax,%r8d
  jl     L11
  add    $0x1,%rdx
  add    $0x1,%ecx
  cmp    %edx,%esi
  jg     L80
L136:
  cmp    %r10d,%ecx
  jle    L79
L147:
  mov    %ecx,%r10d
  mov    %eax,%r11d
L120:
  add    $0x1,%r9
  cmp    %r9,%r15
  jne    L156
L158:
  mov    %r10d,%edx
  mov    %r11d,%esi
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rsp
  addl   $0x1,-0x54(%rbp)
  mov    -0x54(%rbp),%eax
  cmp    %eax,-0x44(%rbp)
  jg     L37
L102:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L157
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nop
L79:
  jne    L120
  cmp    %r11d,%eax
  cmovg  %r11d,%eax
  jmp    L147
  nopl   0x0(%rax,%rax,1)
L11:
  mov    %edi,%eax
  jmp    L136
L134:
  xor    %r10d,%r10d
  xor    %r11d,%r11d
  jmp    L158
L157:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D17
type_guessed: string
name: extract_symbolic_data
arguments: tag: D5
type_guessed: string
name: extract_symbolic_data
arguments: tag: D2
type_guessed: string

tool: D17: %d

tool: D5: %d %d

tool: D2: %d %d


assistant: ```c
int main() {
  int turns, i;
  scanf("%d", &turns);
  for (i = 0; i < turns; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    int array[a], ix;
    for (ix = 0; ix < a; ix++)
      scanf("%d", &array[ix]);
    int bestsum = 0;
    int stations = 0;
    int x;
    for (x = 0; x < a; ++x) {
      int sum = 0;
      int turns = 0;
      int ax;
      for (ax = x; ax < a; ++ax) {
        sum += array[ax];
        if (sum > b) {
          sum -= array[ax];
          break;
        }
        turns++;
      }
      if (turns > stations) {
        stations = turns;
        bestsum = sum;
      }
      if (turns == stations) {
        if (sum < bestsum) {
          bestsum = sum;
        }
      }
    }
    printf("%d %d\n", bestsum, stations);
  }
  return 0;
}
```