user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  lea    D0(%rip),%r14
  push   %r13
  mov    %r14,%rdi
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  call   <scanf@plt>
  mov    0x10(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jle    L13
  movl   $0x0,0x4(%rsp)
  xor    %ebx,%ebx
  xor    %r13d,%r13d
  xor    %r12d,%r12d
  lea    0x14(%rsp),%r15
  jmp    L77
L179:
  test   %eax,%eax
  js     L52
  add    %eax,0x4(%rsp)
  xor    %ebx,%ebx
  mov    $0x1,%r13d
  nopl   0x0(%rax)
L177:
  add    $0x1,%r12d
  cmp    %r12d,0x10(%rsp)
  jle    L8
L77:
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  je     L177
  mov    %r13d,%edi
  or     %ebx,%edi
  je     L179
  test   %r13d,%r13d
  je     L163
  cmp    $0x1,%r13d
  je     L213
  test   %eax,%eax
  js     L74
  mov    0x4(%rsp),%edi
  mov    0x8(%rsp),%rsi
  movslq %ebx,%rax
  add    $0x1,%r12d
  add    $0x1,%ebx
  mov    $0x1,%r13d
  mov    %edi,(%rsi,%rax,4)
  mov    0x14(%rsp),%eax
  mov    %eax,0x4(%rsp)
  cmp    %r12d,0x10(%rsp)
  jg     L77
  nopl   0x0(%rax,%rax,1)
L8:
  mov    0x4(%rsp),%esi
  test   %esi,%esi
  jle    L104
  mov    0x8(%rsp),%rdi
  movslq %ebx,%rax
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  add    $0x1,%ebx
  mov    %esi,(%rdi,%rax,4)
L214:
  mov    0x8(%rsp),%r12
  lea    -0x1(%rbx),%r10d
  xor    %r11d,%r11d
  nopl   0x0(%rax,%rax,1)
L136:
  mov    %r12,%rsi
  mov    %r11d,%edi
  xor    %edx,%edx
L78:
  mov    (%rsi),%ecx
  lea    (%rcx,%rdx,1),%eax
  cmp    %eax,%ebp
  cmovl  %eax,%ebp
  cmp    %edi,%r10d
  je     L206
  mov    0x4(%rsi),%r9d
  add    %r9d,%eax
  test   %eax,%eax
  jle    L206
  add    %r9d,%ecx
  add    %ecx,%edx
  cmp    %edx,%ebp
  cmovl  %edx,%ebp
  add    $0x2,%edi
  add    $0x8,%rsi
  cmp    %ebx,%edi
  jl     L78
L206:
  add    $0x2,%r11d
  add    $0x8,%r12
  cmp    %ebx,%r11d
  jl     L136
L13:
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L213:
  test   %eax,%eax
  js     L203
L74:
  add    %eax,0x4(%rsp)
  jmp    L177
L163:
  add    %eax,0x4(%rsp)
  sar    $0x1f,%eax
  mov    %eax,%r13d
  or     $0x1,%r13d
  jmp    L177
L52:
  xor    %ebx,%ebx
  xor    %r13d,%r13d
  jmp    L177
L203:
  mov    0x4(%rsp),%esi
  mov    0x8(%rsp),%rdi
  movslq %ebx,%rax
  mov    %esi,(%rdi,%rax,4)
  mov    0x14(%rsp),%eax
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  add    $0x1,%ebx
  or     $0xffffffff,%r13d
  mov    %eax,0x4(%rsp)
  jmp    L177
L104:
  test   %ebx,%ebx
  jne    L214
  jmp    L13
L121:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D0
type_infered: string

tool: D0: %d

assistant: ```c
int main() {
  int n, i, j, new_num;
  scanf("%d", &n);
  int *array = (int *)malloc(n * sizeof(int));
  int neut = 0;
  int counter = 0;
  int curr_accum = 0;
  int max_val = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &new_num);
    if (new_num == 0 || (neut == 0 && counter == 0 && new_num < 0))
      continue;
    if (neut == 0) {
      curr_accum += new_num;
      if (new_num >= 0)
        neut = 1;
      else
        neut = -1;
    } else if (neut == 1) {
      if (new_num >= 0)
        curr_accum += new_num;
      else {
        array[counter++] = curr_accum;
        if (curr_accum > max_val)
          max_val = curr_accum;
        curr_accum = new_num;
        neut = -1;
      }
    } else {
      if (new_num >= 0) {
        array[counter++] = curr_accum;
        curr_accum = new_num;
        neut = 1;
      } else
        curr_accum += new_num;
    }
  }
  if (curr_accum > 0) {
    array[counter++] = curr_accum;
    if (curr_accum > max_val)
      max_val = curr_accum;
  }
  int curr_stream = 0;
  for (i = 0; i < counter; i += 2) {
    for (j = i; j < counter; j += 2) {
      if (curr_stream + array[j] > max_val)
        max_val = curr_stream + array[j];
      if (j == counter - 1) {
        curr_stream = 0;
        break;
      }
      if (curr_stream + array[j] + array[j + 1] > 0) {
        curr_stream += (array[j] + array[j + 1]);
        if (curr_stream > max_val)
          max_val = curr_stream;
      } else
        break;
    }
    curr_stream = 0;
  }
  printf("%d", max_val);
}
```