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

```asm
<R_LYP_Correlation>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %rdi,%r12
  mov    %rsi,0x40(%rsp)
  mov    %rdx,0xd8(%rsp)
  mov    %rcx,0xd0(%rsp)
  mov    $0x0,%eax
  call   <N_LogGrid@plt>
  mov    %eax,%r13d
  mov    $0x0,%eax
  call   <r_LogGrid@plt>
  mov    %eax,0xe4(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,%ebp
  cltq
  mov    %rax,0xc0(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,%ebx
  cltq
  mov    %rax,0x90(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,0xe0(%rsp)
  cltq
  mov    %rax,0x98(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,0xe8(%rsp)
  cltq
  mov    %rax,0xa0(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,0x88(%rsp)
  cltq
  mov    %rax,0xc8(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,0x8c(%rsp)
  cltq
  mov    %rax,0xa8(%rsp)
  mov    $0x0,%eax
  call   <alloc_LogGrid@plt>
  mov    %eax,0xec(%rsp)
  cltq
  mov    %rax,0xb0(%rsp)
  test   %r13d,%r13d
  jle    L97
  movslq %ebx,%rbx
  lea    -0x1(%r13),%eax
  shl    $0x3,%rax
  mov    %rax,0xb8(%rsp)
  lea    0x8(%rbx,%rax,1),%rdx
  mov    %rdx,0xf8(%rsp)
  mov    %rbx,%rax
  mov    %rbx,%rsi
  neg    %rsi
  mov    %rsi,0xf0(%rsp)
  mov    %r12,%r15
  sub    %rbx,%r15
  movsd  D411(%rip),%xmm1
L92:
  movsd  (%r15,%rax,1),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L92
  mov    0x98(%rsp),%r14
  mov    %r14,%rsi
  mov    0x90(%rsp),%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  mov    0xa0(%rsp),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  movslq %ebp,%rcx
  mov    %rcx,0x28(%rsp)
  mov    0xb8(%rsp),%rax
  lea    0x8(%rcx,%rax,1),%r14
  mov    %rcx,%rbp
  movslq 0xe0(%rsp),%rax
  sub    %rcx,%rax
  mov    %rbx,0x100(%rsp)
  mov    %r15,0x108(%rsp)
  mov    %rax,%r15
  jmp    L20
L16:
  movq   $0x0,0x0(%rbp)
L44:
  add    $0x8,%rbp
  cmp    %r14,%rbp
  je     L94
L20:
  mov    %r12,%r13
  sub    0x28(%rsp),%r13
  movsd  0x0(%r13,%rbp,1),%xmm0
  divsd  D411(%rip),%xmm0
  movsd  %xmm0,0x8(%rsp)
  comisd D412(%rip),%xmm0
  jbe    L16
  movsd  (%r15,%rbp,1),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,0x30(%rsp)
  mov    D6(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  mulsd  D233(%rip),%xmm0
  call   <exp@plt>
  movsd  %xmm0,0x18(%rsp)
  mov    D6(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  mulsd  D305(%rip),%xmm0
  addsd  D67(%rip),%xmm0
  movsd  D67(%rip),%xmm4
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0x10(%rsp)
  mulsd  %xmm4,%xmm4
  movsd  %xmm4,0x48(%rsp)
  mov    D128(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  mulsd  0x48(%rsp),%xmm0
  mulsd  D305(%rip),%xmm0
  movapd %xmm0,%xmm6
  divsd  D93(%rip),%xmm6
  movsd  %xmm6,0x20(%rsp)
  mov    D128(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  %xmm0,0x50(%rsp)
  movsd  D390(%rip),%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  %xmm0,0x58(%rsp)
  mov    D41(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  mulsd  0x10(%rsp),%xmm0
  movapd %xmm0,%xmm8
  mulsd  0x18(%rsp),%xmm8
  movsd  %xmm8,0x38(%rsp)
  mov    D41(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movq   %xmm0,%rbx
  mov    D232(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movapd %xmm0,%xmm2
  movsd  0x8(%rsp),%xmm5
  movapd %xmm5,%xmm0
  mulsd  %xmm5,%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm5,%xmm1
  movsd  D67(%rip),%xmm11
  movsd  %xmm1,0x60(%rsp)
  divsd  %xmm1,%xmm11
  movq   %rbx,%xmm0
  mulsd  0x20(%rsp),%xmm0
  movsd  0x18(%rsp),%xmm4
  mulsd  %xmm4,%xmm0
  movsd  D203(%rip),%xmm13
  movsd  0x10(%rsp),%xmm7
  mulsd  %xmm7,%xmm13
  movapd %xmm13,%xmm1
  mulsd  %xmm2,%xmm1
  mulsd  %xmm4,%xmm1
  subsd  %xmm1,%xmm0
  movapd %xmm7,%xmm1
  mulsd  D208(%rip),%xmm1
  movsd  %xmm11,0x68(%rsp)
  mulsd  %xmm11,%xmm1
  mulsd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x80(%rsp)
  mov    D41(%rip),%rax
  movq   %rax,%xmm1
  movapd %xmm5,%xmm0
  call   <pow@plt>
  movsd  %xmm0,0x70(%rsp)
  mov    D232(%rip),%rax
  movq   %rax,%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  %xmm0,0x78(%rsp)
  movsd  D141(%rip),%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movq   %xmm0,%rbx
  movsd  D352(%rip),%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  0x10(%rsp),%xmm7
  movapd %xmm7,%xmm1
  addsd  %xmm7,%xmm1
  movsd  0x20(%rsp),%xmm6
  mulsd  %xmm6,%xmm1
  mulsd  0x50(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm2
  mulsd  D368(%rip),%xmm2
  mulsd  0x58(%rsp),%xmm2
  subsd  %xmm2,%xmm1
  mulsd  D328(%rip),%xmm1
  mulsd  0x70(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm4
  mulsd  %xmm4,%xmm1
  movsd  0x68(%rsp),%xmm2
  mulsd  D92(%rip),%xmm2
  mulsd  %xmm4,%xmm2
  movsd  0x78(%rsp),%xmm3
  mulsd  D248(%rip),%xmm3
  mulsd  %xmm4,%xmm3
  subsd  %xmm3,%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm2,%xmm1
  movq   %rbx,%xmm3
  mulsd  D361(%rip),%xmm3
  movapd %xmm3,%xmm2
  movapd %xmm4,%xmm6
  mulsd  %xmm4,%xmm2
  movsd  0x60(%rsp),%xmm4
  movsd  0x8(%rsp),%xmm5
  mulsd  %xmm5,%xmm4
  movsd  D67(%rip),%xmm3
  divsd  %xmm4,%xmm3
  mulsd  D286(%rip),%xmm3
  mulsd  %xmm6,%xmm3
  subsd  %xmm3,%xmm2
  mulsd  D168(%rip),%xmm0
  mulsd  %xmm6,%xmm0
  addsd  %xmm0,%xmm2
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,0x48(%rsp)
  mov    D203(%rip),%rax
  movq   %rax,%xmm1
  movapd %xmm5,%xmm0
  call   <pow@plt>
  movapd %xmm0,%xmm3
  movsd  0x8(%rsp),%xmm6
  movapd %xmm6,%xmm7
  movsd  0x80(%rsp),%xmm5
  mulsd  %xmm5,%xmm7
  movsd  D93(%rip),%xmm10
  mulsd  %xmm5,%xmm10
  movslq 0x88(%rsp),%rax
  mov    0x28(%rsp),%rsi
  sub    %rsi,%rax
  movsd  0x20(%rsp),%xmm2
  mulsd  %xmm6,%xmm2
  movapd %xmm2,%xmm0
  addsd  0x10(%rsp),%xmm0
  mulsd  D339(%rip),%xmm0
  movsd  D453(%rip),%xmm1
  movsd  0x38(%rsp),%xmm8
  movapd %xmm8,%xmm2
  mulsd  %xmm1,%xmm2
  movsd  %xmm7,0x18(%rsp)
  addsd  %xmm7,%xmm2
  mulsd  D490(%rip),%xmm3
  mulsd  %xmm3,%xmm2
  subsd  %xmm2,%xmm0
  movapd %xmm6,%xmm2
  movsd  0x48(%rsp),%xmm12
  mulsd  %xmm12,%xmm2
  movsd  0x30(%rsp),%xmm9
  mulsd  %xmm9,%xmm2
  movsd  %xmm10,0x20(%rsp)
  movapd %xmm10,%xmm3
  mulsd  %xmm9,%xmm3
  addsd  %xmm3,%xmm2
  mulsd  D224(%rip),%xmm2
  addsd  %xmm2,%xmm0
  movsd  D93(%rip),%xmm2
  mulsd  %xmm12,%xmm2
  mulsd  %xmm6,%xmm2
  mulsd  %xmm9,%xmm2
  movapd %xmm5,%xmm3
  mulsd  D12(%rip),%xmm3
  mulsd  %xmm9,%xmm3
  addsd  %xmm3,%xmm2
  mulsd  D116(%rip),%xmm2
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movapd %xmm8,%xmm3
  mulsd  D265(%rip),%xmm3
  movslq 0x8c(%rsp),%rax
  sub    %rsi,%rax
  movapd %xmm5,%xmm2
  addsd  %xmm5,%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm3,%xmm2
  mulsd  D224(%rip),%xmm2
  mulsd  D23(%rip),%xmm5
  movapd %xmm5,%xmm0
  mulsd  %xmm6,%xmm0
  addsd  %xmm3,%xmm0
  mulsd  D116(%rip),%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm2,(%rax,%rbp,1)
  movapd %xmm6,%xmm0
  call   <pow@plt>
  movapd %xmm0,%xmm3
  movsd  0x38(%rsp),%xmm5
  movapd %xmm5,%xmm2
  addsd  %xmm5,%xmm2
  movsd  0x30(%rsp),%xmm9
  mulsd  %xmm9,%xmm2
  movsd  D339(%rip),%xmm0
  mulsd  0x10(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm6
  mulsd  %xmm6,%xmm0
  movsd  D490(%rip),%xmm4
  mulsd  %xmm5,%xmm4
  movapd %xmm4,%xmm1
  mulsd  %xmm3,%xmm1
  subsd  %xmm1,%xmm0
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm9,%xmm1
  addsd  %xmm2,%xmm1
  mulsd  D224(%rip),%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x20(%rsp),%xmm1
  mulsd  %xmm6,%xmm1
  mulsd  %xmm9,%xmm1
  addsd  %xmm2,%xmm1
  mulsd  D116(%rip),%xmm1
  addsd  %xmm1,%xmm0
  divsd  %xmm6,%xmm0
  movsd  %xmm0,0x0(%rbp)
  jmp    L44
L94:
  mov    0x100(%rsp),%rbx
  mov    0x108(%rsp),%r15
  mov    0xb0(%rsp),%rsi
  mov    0xa8(%rsp),%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  movslq 0xe8(%rsp),%rcx
  mov    0xb8(%rsp),%rax
  lea    0x8(%rcx,%rax,1),%r8
  mov    %rcx,%rax
  mov    %rcx,%rdi
  neg    %rdi
  mov    %r12,%rsi
  sub    %rcx,%rsi
  movslq 0xe0(%rsp),%r12
  sub    %rcx,%r12
  movslq 0x88(%rsp),%rbp
  sub    %rcx,%rbp
  movslq 0xe4(%rsp),%r11
  sub    %rcx,%r11
  movslq 0x8c(%rsp),%r10
  sub    %rcx,%r10
  mov    %rcx,0x8(%rsp)
  mov    0xec(%rsp),%ecx
  jmp    L75
L30:
  mov    0x40(%rsp),%rdx
  add    %rdi,%rdx
  movq   $0x0,(%rdx,%rax,1)
L48:
  add    $0x8,%rax
  cmp    %r8,%rax
  je     L118
L75:
  movsd  (%rsi,%rax,1),%xmm0
  divsd  D411(%rip),%xmm0
  comisd D412(%rip),%xmm0
  jbe    L30
  movsd  (%r12,%rax,1),%xmm1
  mov    0x40(%rsp),%rdx
  lea    (%rdx,%rdi,1),%r9
  movsd  D314(%rip),%xmm0
  divsd  (%r11,%rax,1),%xmm0
  mulsd  %xmm1,%xmm0
  addsd  (%rax),%xmm0
  mulsd  (%r10,%rax,1),%xmm0
  movslq %ecx,%rdx
  sub    0x8(%rsp),%rdx
  mulsd  (%rdx,%rax,1),%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x0(%rbp,%rax,1),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%r9,%rax,1)
  jmp    L48
L118:
  mov    0x28(%rsp),%rcx
  mov    %rcx,%rax
  mov    %rbx,%rdx
  sub    %rcx,%rdx
L116:
  movsd  0x0(%r13,%rax,1),%xmm0
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    %r14,%rax
  jne    L116
  mov    0x90(%rsp),%rdi
  mov    $0x0,%eax
  call   <Integrate_LogGrid@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    0xd8(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    0x40(%rsp),%rax
  add    0xf0(%rsp),%rax
  mov    0xf8(%rsp),%rdx
L76:
  movsd  (%rax,%rbx,1),%xmm0
  mulsd  (%r15,%rbx,1),%xmm0
  movsd  %xmm0,(%rbx)
  add    $0x8,%rbx
  cmp    %rdx,%rbx
  jne    L76
L103:
  mov    0x90(%rsp),%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <Integrate_LogGrid@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    0xd0(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    0xc0(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    0x98(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    0xa0(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    0xc8(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    0xa8(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  mov    0xb0(%rsp),%rdi
  mov    $0x0,%eax
  call   <dealloc_LogGrid@plt>
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L97:
  mov    0x98(%rsp),%r14
  mov    %r14,%rsi
  mov    0x90(%rsp),%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  mov    0xa0(%rsp),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  mov    0xb0(%rsp),%rsi
  mov    0xa8(%rsp),%rdi
  mov    $0x0,%eax
  call   <Derivative_LogGrid@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <Integrate_LogGrid@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    0xd8(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L103
```

tool_calls: name: unpack_data
arguments: data_tag: D411
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D412
type_infered: byte[16]
name: unpack_data
arguments: data_tag: D6
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D233
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D305
type_infered: f64
name: unpack_data
arguments: data_tag: D67
type_infered: f64
name: unpack_data
arguments: data_tag: D128
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D93
type_infered: f64
name: unpack_data
arguments: data_tag: D390
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D41
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D232
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D203
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D208
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D141
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D352
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D368
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D328
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D92
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D248
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D361
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D286
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D168
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D339
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D453
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D490
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D224
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D12
type_infered: f64
name: unpack_data
arguments: data_tag: D116
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D265
type_infered: f64
name: unpack_data
arguments: data_tag: D23
type_infered: f64
name: unpack_data
arguments: data_tag: D314
type_infered: f64

tool: {"D411": [0x18,0x2d,0x44,0x54,0xfb,0x21,0x29,0x40]}

tool: {"D412": [0x01,0x1e,0xc9,0xfb,0xd6,0x22,0x36,0x3c,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xbf]}

tool: {"D6": [0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xbf]}

tool: {"D233": [0x4b,0xea,0x04,0x34,0x11,0x36,0xd0,0xbf]}

tool: D305: 0.349

tool: D67: 1

tool: {"D128": [0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0xbf]}

tool: D93: 3

tool: {"D390": [0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0x02,0xc0]}

tool: {"D41": [0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xfa,0xbf]}

tool: {"D232": [0x55,0x55,0x55,0x55,0x55,0x55,0x05,0xc0]}

tool: {"D203": [0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xfa,0x3f]}

tool: {"D208": [0x0f,0xe3,0x5b,0x45,0x6c,0x9d,0xb5,0x3f]}

tool: {"D141": [0x55,0x55,0x55,0x55,0x55,0x55,0x0d,0xc0]}

tool: {"D352": [0x55,0x55,0x55,0x55,0x55,0x55,0x11,0xc0]}

tool: {"D368": [0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0x3f]}

tool: {"D328": [0xfb,0xf0,0x19,0x76,0x05,0xc8,0xbd,0x3f]}

tool: {"D92": [0x0f,0xe3,0x5b,0x45,0x6c,0x9d,0xc5,0x3f]}

tool: {"D248": [0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0x0a,0x40]}

tool: {"D361": [0x72,0x1c,0xc7,0x71,0x1c,0xc7,0x11,0x40]}

tool: {"D286": [0x3c,0xde,0x95,0xfb,0xa8,0x37,0xd9,0x3f]}

tool: {"D168": [0xd4,0x08,0xbf,0x15,0x49,0x33,0x7d,0x3f]}

tool: {"D339": [0x20,0x0c,0x3c,0xf7,0x1e,0x2e,0xa9,0xbf]}

tool: {"D453": [0x55,0x55,0x55,0x55,0x55,0x55,0x05,0x40]}

tool: {"D490": [0x1b,0xb6,0x66,0x69,0x32,0x16,0x93,0x3f]}

tool: {"D224": [0xb2,0xb2,0x4b,0x8e,0x1a,0x97,0x5a,0x3f]}

tool: D12: 5

tool: {"D116": [0xd7,0x9e,0x98,0x45,0xc2,0xa2,0x17,0x3f]}

tool: D265: 4

tool: D23: 6

tool: D314: 2

assistant: ```c
void R_LYP_Correlation(rho, Vc, Ec, Pc) double rho[], Vc[], *Ec, *Pc;
{
  int i;
  double pi;
  double a, b, c, d, Cf;
  double smallnumber;
  double F1, F12, F14, dF1, ddF1, dF1dn;
  double G1, dG1, ddG1;
  double n;
  double agr, agr2, lap;
  double e_c_rho;
  double ce, cp;
  int Ngrid;
  double *rgrid;
  double *ce_density;
  double *tmp;
  double *drho;
  double *ddrho;
  double *fn;
  double *fdn;
  double *dfdn;
  pi = 4.0 * atan(1.0);
  a = 0.04918;
  b = 0.132;
  c = 0.2533;
  d = 0.349;
  smallnumber = 1.0e-80;
  Cf = (3.0 / 10.0) * pow((3.0 * pi * pi), 2.0 / 3.0);
  Ngrid = N_LogGrid();
  rgrid = r_LogGrid();
  ce_density = alloc_LogGrid();
  tmp = alloc_LogGrid();
  drho = alloc_LogGrid();
  ddrho = alloc_LogGrid();
  fn = alloc_LogGrid();
  fdn = alloc_LogGrid();
  dfdn = alloc_LogGrid();
  for (i = 0; i < Ngrid; ++i)
    tmp[i] = rho[i] / (4.0 * pi);
  ;
  Derivative_LogGrid(tmp, drho);
  Derivative_LogGrid(drho, ddrho);
  for (i = 0; i < Ngrid; ++i) {
    n = rho[i] / (4.0 * pi);
    if (n > 1.2e-18) {
      agr = fabs(drho[i]);
      agr2 = agr * agr;
      e_c_rho = exp(-1.0 * c * pow(n, -1.0 / 3.0));
      F1 = 1.0 / (1.0 + d * pow(n, -1.0 / 3.0));
      F12 = F1 * F1;
      dF1 = F12 * pow(n, -4.0 / 3.0) * d / 3.0;
      ddF1 = (d / 3.0) * (2.0 * F1 * dF1 * pow(n, -4.0 / 3.0) - (4.0 / 3.0) * F12 * pow(n, -7.0 / 3.0));
      G1 = F1 * pow(n, -5.0 / 3.0) * e_c_rho;
      dG1 = dF1 * pow(n, -5.0 / 3.0) * e_c_rho - (5.0 / 3.0) * F1 * pow(n, -8.0 / 3.0) * e_c_rho + (c / 3.0) * F1 * (1 / (n * n * n)) * e_c_rho;
      ddG1 = ddF1 * pow(n, -5.0 / 3.0) * e_c_rho + dF1 * ((2.0 * c / 3.0) * (1 / (n * n * n)) * e_c_rho - (10.0 / 3.0) * pow(n, -8.0 / 3.0) * e_c_rho) + F1 * ((40.0 / 9.0) * pow(n, -11.0 / 3.0) * e_c_rho - (14.0 * c / 9.0) * (1 / (n * n * n * n)) * e_c_rho + (c * c / 9.0) * pow(n, -13.0 / 3.0) * e_c_rho);
      fn[i] = -1.0 * a * (dF1 * n + F1) - a * b * Cf * pow(n, 5.0 / 3.0) * (dG1 * n + (8.0 / 3.0) * G1) + (a * b / 4.0) * (ddG1 * n * agr2 + 3.0 * dG1 * agr2) + (a * b / 72.0) * (3.0 * ddG1 * n * agr2 + 5.0 * dG1 * agr2);
      fdn[i] = (a * b / 4.0) * (2.0 * dG1 * n + 4.0 * G1) + (a * b / 72.0) * (6.0 * dG1 * n + 4.0 * G1);
      ce = -1.0 * a * F1 * n - a * b * Cf * G1 * pow(n, 8.0 / 3.0) + (a * b / 4.0) * (dG1 * n * agr2 + 2.0 * G1 * agr2) + (a * b / 72.0) * (3.0 * dG1 * n * agr2 + 2.0 * G1 * agr2);
      ce_density[i] = ce / n;
    } else {
      ce_density[i] = 0.0;
    }
  }
  Derivative_LogGrid(fdn, dfdn);
  for (i = 0; i < Ngrid; ++i) {
    n = rho[i] / (4.0 * pi);
    if (n > 1.2e-18) {
      lap = ddrho[i] + (2.0 / rgrid[i]) * drho[i];
      cp = fn[i] - (dfdn[i] * drho[i] + fdn[i] * lap);
      Vc[i] = cp;
    } else {
      Vc[i] = 0.0;
    }
  }
  for (i = 0; i < Ngrid; ++i)
    tmp[i] = (rho[i]) * ce_density[i];
  *Ec = Integrate_LogGrid(tmp);
  for (i = 0; i < Ngrid; ++i)
    tmp[i] = (rho[i]) * Vc[i];
  *Pc = Integrate_LogGrid(tmp);
  dealloc_LogGrid(ce_density);
  dealloc_LogGrid(tmp);
  dealloc_LogGrid(drho);
  dealloc_LogGrid(ddrho);
  dealloc_LogGrid(fn);
  dealloc_LogGrid(fdn);
  dealloc_LogGrid(dfdn);
}
```