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

```asm
<_forward>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %r8d,%r15d
  mov    %r9d,%ebx
  test   %r8d,%r8d
  jle    L29
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  lea    -0x1(%r8),%ebp
  mov    %r8d,%ecx
  mov    $0x0,%eax
  pxor   %xmm7,%xmm7
  movsd  %xmm7,(%rsp)
L146:
  movsd  (%rdx,%rax,8),%xmm0
  mulsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%r12,%rax,8)
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L146
  movsd  (%rsp),%xmm0
  call   <log@plt>
  movsd  %xmm0,0x8(%rsp)
  movsd  (%rsp),%xmm6
  ucomisd D18(%rip),%xmm6
  jp     L86
  je     L59
L86:
  mov    %r12,%rax
  lea    0x8(%r12,%rbp,8),%rdx
L155:
  movsd  (%rax),%xmm0
  divsd  (%rsp),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L155
L59:
  cmp    $0x1,%ebx
  jle    L31
  lea    -0x1(%rbx),%eax
  mov    %eax,0x28(%rsp)
  movslq %r15d,%rbx
  shl    $0x3,%rbx
  mov    %r15d,%ebp
  mov    $0x0,%r13d
  lea    -0x1(%r15),%eax
  mov    %eax,0x2c(%rsp)
  lea    0x8(%r12),%rax
  mov    %rax,(%rsp)
  jmp    L89
L82:
  add    0x10(%rsp),%r14
  mov    (%rsp),%rax
  lea    (%rax,%r14,8),%rax
L131:
  movsd  (%r8),%xmm0
  divsd  %xmm2,%xmm0
  movsd  %xmm0,(%r8)
  add    $0x8,%r8
  cmp    %r8,%rax
  jne    L131
L9:
  movapd %xmm2,%xmm0
  call   <log@plt>
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  add    $0x1,%r13d
  add    %r15d,%ebp
  cmp    0x28(%rsp),%r13d
  je     L31
L89:
  test   %r15d,%r15d
  jle    L14
  mov    0x18(%rsp),%rdi
  mov    0x2c(%rsp),%esi
  mov    %rsi,0x10(%rsp)
  mov    %r15d,%r11d
  mov    %ebp,%eax
  sub    %r15d,%eax
  cltq
  lea    (%r12,%rax,8),%r10
  add    %rsi,%rax
  mov    (%rsp),%rsi
  lea    (%rsi,%rax,8),%rcx
  movslq %ebp,%r14
  lea    0x0(,%r14,8),%r8
  mov    0x20(%rsp),%rax
  lea    (%rax,%r8,1),%r9
  add    %r12,%r8
  mov    $0x0,%esi
  pxor   %xmm2,%xmm2
L130:
  mov    %rdi,%rdx
  mov    %r10,%rax
  pxor   %xmm1,%xmm1
L90:
  movsd  (%rax),%xmm0
  mulsd  (%rdx),%xmm0
  addsd  %xmm0,%xmm1
  add    $0x8,%rax
  add    %rbx,%rdx
  cmp    %rcx,%rax
  jne    L90
  mulsd  (%r9,%rsi,8),%xmm1
  movsd  %xmm1,(%r8,%rsi,8)
  addsd  %xmm1,%xmm2
  add    $0x1,%rsi
  add    $0x8,%rdi
  cmp    %r11,%rsi
  jne    L130
  ucomisd D18(%rip),%xmm2
  jp     L82
  je     L9
  jmp    L82
L14:
  pxor   %xmm2,%xmm2
  jmp    L9
L29:
  pxor   %xmm0,%xmm0
  call   <log@plt>
  movsd  %xmm0,0x8(%rsp)
  jmp    L59
L31:
  movsd  0x8(%rsp),%xmm0
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D18
datatype: f64

tool: D18: 0

assistant: ```c
double _forward(double *alpha, const double *A, const double *pobs, const double *pi, int N, int T) {
  int i, j, t;
  double sum, logprob, scaling;
  scaling = 0.0;
  for (i = 0; i < N; i++) {
    alpha[i] = pi[i] * pobs[i];
    scaling += alpha[i];
  }
  logprob = log(scaling);
  if (scaling != 0)
    for (i = 0; i < N; i++)
      alpha[i] /= scaling;
  for (t = 0; t < T - 1; t++) {
    scaling = 0.0;
    for (j = 0; j < N; j++) {
      sum = 0.0;
      for (i = 0; i < N; i++) {
        sum += alpha[t * N + i] * A[i * N + j];
      }
      alpha[(t + 1) * N + j] = sum * pobs[(t + 1) * N + j];
      scaling += alpha[(t + 1) * N + j];
    }
    if (scaling != 0)
      for (j = 0; j < N; j++)
        alpha[(t + 1) * N + j] /= scaling;
    logprob += log(scaling);
  }
  return logprob;
}
```