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

```asm
<initialize_global_topic_counts>:
  endbr64
  push   %r15
  movslq %ecx,%r15
  push   %r14
  mov    %r9,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  sub    $0x8,%rsp
  test   %ecx,%ecx
  js     L155
  lea    0x8(,%r15,8),%rdx
  xor    %esi,%esi
  call   <memset@plt>
  mov    %rax,%rdi
  test   %ebp,%ebp
  jle    L71
L41:
  movsd  D30(%rip),%xmm0
  lea    (%rdi,%r15,8),%rcx
  xor    %r9d,%r9d
  nopw   0x0(%rax,%rax,1)
L11:
  movslq (%r14,%r9,4),%r10
  test   %r10d,%r10d
  jle    L88
  mov    0x0(%r13,%r9,8),%r11
  xor    %r8d,%r8d
  nopl   0x0(%rax)
L116:
  mov    (%r11,%r8,4),%edx
  test   %edx,%edx
  jle    L154
  mov    (%rbx,%r9,8),%rax
  sub    $0x1,%edx
  mov    (%rax,%r8,8),%rax
  lea    (%rax,%rdx,4),%rsi
  nop
L43:
  movslq (%rax),%rdx
  lea    -0x8(%rdi,%rdx,8),%rdx
  movsd  (%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdx)
  movsd  (%rcx),%xmm1
  mov    %rax,%rdx
  add    $0x4,%rax
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rcx)
  cmp    %rdx,%rsi
  jne    L43
L154:
  add    $0x1,%r8
  cmp    %r8,%r10
  jne    L116
L88:
  add    $0x1,%r9
  cmp    %r9d,%ebp
  jg     L11
  test   %r12d,%r12d
  js     L27
L93:
  xor    %edx,%edx
  test   %r12d,%r12d
  lea    0x8(%rcx),%rsi
  cmovns %r12d,%edx
  lea    0x1(%rdx),%eax
  mov    %rax,%rdx
  lea    (%rdi,%rax,8),%rax
  cmp    %rax,%rcx
  setae  %al
  cmp    %rsi,%rdi
  setae  %sil
  or     %sil,%al
  je     L67
  test   %r12d,%r12d
  jle    L67
  mov    %edx,%esi
  movsd  (%rcx),%xmm2
  movapd D11(%rip),%xmm1
  mov    %rdi,%rax
  shr    %esi
  sub    $0x1,%esi
  unpcklpd %xmm2,%xmm2
  shl    $0x4,%rsi
  lea    0x10(%rdi,%rsi,1),%rsi
L84:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  divpd  %xmm2,%xmm0
  mulpd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rsi
  jne    L84
  mov    %edx,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%edx
  je     L27
  cltq
  lea    (%rdi,%rax,8),%rax
  movsd  (%rax),%xmm0
  divsd  (%rcx),%xmm0
  mulsd  D11(%rip),%xmm0
  movsd  %xmm0,(%rax)
L27:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L67:
  movsd  D11(%rip),%xmm1
  xor    %eax,%eax
L126:
  movsd  (%rdi,%rax,8),%xmm0
  divsd  (%rcx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jge    L126
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L155:
  test   %edx,%edx
  jg     L41
  jmp    L27
L71:
  lea    (%rax,%r15,8),%rcx
  jmp    L93
```

tool_calls: name: read_data
arguments: label: D30
type_infered: f64
name: read_data
arguments: label: D11
type_infered: f64[2]

tool: D30: 1

tool: {"D11": [0.5,0.5]}

assistant: ```c
void initialize_global_topic_counts(int ***z, double *global_topic_counts, int D, int K, int **M, int *N) {
  int i;
  int j;
  int k;
  for (i = 0; i <= K; i++) {
    global_topic_counts[i] = 0.0;
  }
  for (i = 0; i < D; i++) {
    for (j = 0; j < N[i]; j++) {
      for (k = 0; k < M[i][j]; k++) {
        global_topic_counts[z[i][j][k] - 1] += 1.0;
        global_topic_counts[K] += 1.0;
      }
    }
  }
  for (i = 0; i <= K; i++) {
    global_topic_counts[i] /= global_topic_counts[K];
    global_topic_counts[i] *= 0.5;
  }
}
```