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

```asm
<_tram_direct_update_lagrangian_mult>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %r8d,-0x4(%rsp)
  test   %r8d,%r8d
  jle    L74
  mov    %r9d,%eax
  mov    %rdi,%rbx
  mov    %rcx,-0x30(%rsp)
  mov    %rsi,%rbp
  imul   %r9d,%eax
  movl   $0x0,-0x28(%rsp)
  movsd  D11(%rip),%xmm4
  mov    %rdx,%r12
  movq   $0x0,-0x20(%rsp)
  movsd  D6(%rip),%xmm3
  xor    %r15d,%r15d
  lea    -0x1(%r9),%r11d
  movl   $0x0,-0x24(%rsp)
  mov    %eax,-0x8(%rsp)
  movslq %r9d,%rax
  lea    0x0(,%rax,8),%rdi
  shl    $0x2,%rax
  mov    %rdi,-0x18(%rsp)
  mov    %rax,-0x10(%rsp)
  xchg   %ax,%ax
L70:
  test   %r9d,%r9d
  jle    L78
  mov    -0x20(%rsp),%r10
  mov    0x38(%rsp),%r8
  xor    %edi,%edi
  mov    -0x28(%rsp),%r14d
  add    %r10,%r8
  jmp    L46
  nop
L86:
  lea    0x1(%rdi),%rax
  add    $0x8,%r8
  add    %r9d,%r14d
  add    $0x8,%r10
  cmp    %r11,%rdi
  je     L78
  mov    %rax,%rdi
L46:
  mov    -0x30(%rsp),%rax
  movq   $0x0,(%r8)
  mov    (%rax,%rdi,4),%eax
  test   %eax,%eax
  je     L86
  mov    -0x28(%rsp),%eax
  lea    (%rax,%rdi,1),%ecx
  movslq %r14d,%rax
  lea    (%r12,%rax,4),%r13
  xor    %eax,%eax
  jmp    L105
L103:
  movslq %ecx,%rsi
  add    (%r12,%rsi,4),%edx
  test   %edx,%edx
  jle    L97
  lea    (%r15,%rax,1),%esi
  movsd  0x0(%rbp,%r10,1),%xmm2
  pxor   %xmm1,%xmm1
  movslq %esi,%rsi
  cvtsi2sd %edx,%xmm1
  movsd  (%rbx,%rsi,8),%xmm0
  divsd  0x0(%rbp,%rsi,8),%xmm2
  divsd  (%rbx,%r10,1),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm4,%xmm0
  divsd  %xmm0,%xmm1
  addsd  (%r8),%xmm1
  movapd %xmm1,%xmm0
  movapd %xmm3,%xmm1
  maxsd  %xmm0,%xmm1
  movsd  %xmm1,(%r8)
L97:
  lea    0x1(%rax),%rdx
  add    %r9d,%ecx
  cmp    %r11,%rax
  je     L86
  mov    %rdx,%rax
L105:
  mov    0x0(%r13,%rax,4),%edx
  cmp    %edi,%eax
  jne    L103
  pxor   %xmm0,%xmm0
  cvtsi2sd %edx,%xmm0
  addsd  (%r8),%xmm0
  movsd  %xmm0,(%r8)
  jmp    L97
  nopl   0x0(%rax)
L78:
  mov    -0x8(%rsp),%edi
  addl   $0x1,-0x24(%rsp)
  add    %r9d,%r15d
  add    %edi,-0x28(%rsp)
  mov    -0x24(%rsp),%eax
  mov    -0x18(%rsp),%rdi
  add    %rdi,-0x20(%rsp)
  mov    -0x10(%rsp),%rdi
  add    %rdi,-0x30(%rsp)
  cmp    %eax,-0x4(%rsp)
  jne    L70
L74:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D11
type_infered: f64
name: unpack_data
arguments: data_label: D6
type_infered: byte[8]

tool: D11: 1

tool: {"D6": [0x30,0x05,0x8e,0xe4,0x2e,0xff,0x2b,0x2b]}

assistant: ```c
void _tram_direct_update_lagrangian_mult(double *lagrangian_mult, double *biased_conf_weights, int *count_matrices, int *state_counts, int n_therm_states, int n_conf_states, double *new_lagrangian_mult) {
  int i, j, K, KMM, Ki, Kj;
  int CCT_Kij;
  for (K = 0; K < n_therm_states; ++K) {
    KMM = K * n_conf_states * n_conf_states;
    for (i = 0; i < n_conf_states; ++i) {
      Ki = K * n_conf_states + i;
      new_lagrangian_mult[Ki] = 0;
      if (0 == state_counts[Ki])
        continue;
      for (j = 0; j < n_conf_states; ++j) {
        CCT_Kij = count_matrices[KMM + i * n_conf_states + j];
        if (i == j) {
          new_lagrangian_mult[Ki] += CCT_Kij;
        } else {
          Kj = K * n_conf_states + j;
          CCT_Kij += count_matrices[KMM + j * n_conf_states + i];
          if (0 < CCT_Kij) {
            new_lagrangian_mult[Ki] += (double)CCT_Kij / (1.0 + (lagrangian_mult[Kj] / lagrangian_mult[Ki]) * (biased_conf_weights[Ki] / biased_conf_weights[Kj]));
            if (new_lagrangian_mult[Ki] < 1.E-100) {
              new_lagrangian_mult[Ki] = 1.E-100;
            }
          }
        }
      }
    }
  }
}
```