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

```asm
<self_adj_theta_norm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  movsd  %xmm0,-0x58(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L128
L35:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jb     L87
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  addl   $0x1,-0x2c(%rbp)
L87:
  addl   $0x1,-0x30(%rbp)
L128:
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L35
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  sub    -0x2c(%rbp),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  -0x18(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L93
L41:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  addsd  -0x18(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <log@plt>
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x30(%rbp)
L93:
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L41
  movsd  -0x58(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  ja     L110
  jmp    L76
L110:
  mov    -0x38(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L40
L108:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x20(%rbp),%xmm0
  jbe    L78
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x20(%rbp)
L78:
  addl   $0x1,-0x30(%rbp)
L40:
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L108
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L107
L81:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  subsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  movq   %rax,%xmm0
  call   <exp@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  movsd  -0x28(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  addl   $0x1,-0x30(%rbp)
L107:
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L81
  movl   $0x1,-0x30(%rbp)
  jmp    L25
L20:
  mov    -0x58(%rbp),%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %xmm0,%rbx
  mov    -0x28(%rbp),%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %rbx,%xmm1
  subsd  %xmm0,%xmm1
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x30(%rbp)
L25:
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L20
L76:
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void self_adj_theta_norm(double *theta, double *freq_ref, double *freq_est, int grid_size, double norm_const) {
  int i;
  int N_empty;
  double sumv;
  double maxv;
  double pr_e;
  pr_e = 0.0;
  N_empty = 0;
  for (i = 1; i <= grid_size + 1; i++)
    if (freq_est[i] <= 0.0) {
      pr_e += freq_ref[i];
      N_empty++;
    }
  pr_e = pr_e / (grid_size + 1 - N_empty);
  for (i = 1; i <= grid_size + 1; i++)
    theta[i] += log(freq_ref[i] + pr_e);
  if (norm_const > 0.0) {
    maxv = theta[1];
    for (i = 1; i <= grid_size + 1; i++)
      if (theta[i] > maxv)
        maxv = theta[i];
    sumv = 0.0;
    for (i = 1; i <= grid_size + 1; i++) {
      theta[i] -= maxv;
      sumv += exp(theta[i]);
    }
    for (i = 1; i <= grid_size + 1; i++)
      theta[i] += (-log(sumv) + log(norm_const));
  }
}
```