user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1e8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1d8(%rsp)
  xor    %eax,%eax
  lea    0x40(%rsp),%r14
  lea    0x1d0(%rsp),%rdx
  mov    %r14,%rax
L6:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L6
  lea    0x3c(%rsp),%rdx
  lea    0x38(%rsp),%rsi
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  cmpl   $0x0,0x38(%rsp)
  jle    L95
  mov    %r14,%r12
  mov    $0x0,%ebx
  lea    D22(%rip),%r13
L81:
  mov    %r12,%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    0x38(%rsp),%r11d
  add    $0x4,%r12
  cmp    %ebx,%r11d
  jg     L81
  test   %r11d,%r11d
  jle    L95
  mov    0x3c(%rsp),%eax
  mov    %eax,0x24(%rsp)
  lea    0x48(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    -0x1(%r11),%ebx
  mov    %r11d,%eax
  mov    %rax,0x28(%rsp)
  movq   $0x1,0x10(%rsp)
  movl   $0x0,0x20(%rsp)
  mov    $0x0,%edi
  add    $0x4,%r14
  jmp    L124
L58:
  addq   $0x4,0x18(%rsp)
L124:
  mov    0x18(%rsp),%r12
  mov    -0x8(%r12),%ecx
  cmp    -0x4(%r12),%ecx
  mov    $0x1,%eax
  cmovge 0x20(%rsp),%eax
  mov    %eax,0x20(%rsp)
  mov    0x10(%rsp),%rsi
  mov    0x28(%rsp),%rax
  cmp    %rax,%rsi
  je     L14
  mov    0x24(%rsp),%eax
  cltd
  idiv   %ecx
  mov    %edx,0xc(%rsp)
  mov    %eax,%r13d
  add    $0x1,%rsi
  mov    %rsi,0x10(%rsp)
  mov    %rsi,%rbp
  jmp    L88
L89:
  add    $0x4,%r12
L88:
  mov    %r13d,%r10d
  imul   -0x4(%r12),%r10d
  add    0xc(%rsp),%r10d
  cmp    %r10d,%edi
  cmovl  %r10d,%edi
  cmp    %ebp,%r11d
  jle    L58
  add    $0x1,%rbp
  mov    %r12,%r9
  mov    %rbp,%r8
L74:
  cmp    %r8d,%r11d
  jle    L89
  mov    %r10d,%eax
  cltd
  idivl  (%r9)
  mov    %ebx,%ecx
  sub    %r8d,%ecx
  lea    -0x1(%r8,%rcx,1),%rcx
  lea    (%r14,%rcx,4),%r15
  mov    %r9,%rsi
L8:
  mov    %eax,%ecx
  imul   0x4(%rsi),%ecx
  add    %edx,%ecx
  cmp    %ecx,%edi
  cmovl  %ecx,%edi
  add    $0x4,%rsi
  cmp    %r15,%rsi
  jne    L8
  add    $0x1,%r8
  add    $0x4,%r9
  jmp    L74
L66:
  mov    %edi,%esi
  lea    D37(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L18
L14:
  cmpl   $0x1,0x20(%rsp)
  je     L66
L95:
  lea    D7(%rip),%rdi
  call   <puts@plt>
L18:
  mov    0x1d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L91
  mov    $0x0,%eax
  add    $0x1e8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L91:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D35
data_type: string
name: retrieve_data
arguments: tag: D22
data_type: string
name: retrieve_data
arguments: tag: D37
data_type: string
name: retrieve_data
arguments: tag: D7
data_type: string

tool: D35: %d %d

tool: D22: %d

tool: D37: Capital final = R$%d


tool: D7: Melhor nao investir agora, cara!

assistant: ```c
int main() {
  int nDias, nAcoes, cInicial, cAtual, cFinal, valor[100], resto, i, j, k, l, maior = 0, decres = 0;
  for (i = 0; i < 100; i++) {
    valor[i] = 0;
  }
  scanf("%d %d", &nDias, &cInicial);
  for (i = 0; i < nDias; i++)
    scanf("%d", &valor[i]);
  for (i = 0; i < nDias; i++) {
    if (valor[i] < valor[i + 1])
      decres = 1;
    for (j = i + 1; j < nDias; j++) {
      nAcoes = cInicial / valor[i];
      resto = cInicial % valor[i];
      cAtual = (nAcoes * valor[j]) + resto;
      if (cAtual > maior) {
        maior = cAtual;
      }
      for (k = j + 1; k < nDias; k++) {
        for (l = k + 1; l < nDias; l++) {
          cFinal = cAtual;
          nAcoes = cFinal / valor[k];
          resto = cFinal % valor[k];
          cFinal = (nAcoes * valor[l]) + resto;
          if (cFinal > maior) {
            maior = cFinal;
          }
        }
      }
    }
  }
  if (decres == 1)
    printf("Capital final = R$%d\n", maior);
  else
    printf("Melhor nao investir agora, cara!\n");
  return 0;
}
```