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

```asm
<assign_Mu_by_class>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,-0x50(%rbp)
  mov    %esi,%edi
  mov    %edx,%eax
  mov    %ecx,-0x4c(%rbp)
  mov    %r8d,-0x7c(%rbp)
  mov    %r9,-0x88(%rbp)
  mov    0x10(%rbp),%r15
  mov    0x18(%rbp),%rbx
  mov    %rbx,-0x70(%rbp)
  mov    %fs:0x28,%rdx
  mov    %rdx,-0x38(%rbp)
  xor    %edx,%edx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,4),%rbx
  mov    %rbx,-0x48(%rbp)
  movslq %esi,%rdx
  imul   %rcx,%rdx
  lea    0xf(,%rdx,4),%rcx
  mov    %rcx,%rdx
  and    $0xfffffffffffffff0,%rdx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rsi
  sub    %rcx,%rsi
L44:
  cmp    %rsi,%rsp
  je     L175
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L44
L175:
  mov    %rdx,%rcx
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  je     L256
  orq    $0x0,-0x8(%rsp,%rcx,1)
L256:
  mov    %rsp,%rsi
  mov    -0x48(%rbp),%rbx
  lea    0xf(%rbx),%rcx
  mov    %rcx,%rdx
  and    $0xfffffffffffffff0,%rdx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%r8
  sub    %rcx,%r8
L23:
  cmp    %r8,%rsp
  je     L147
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L23
L147:
  mov    %rdx,%rcx
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  je     L186
  orq    $0x0,-0x8(%rsp,%rcx,1)
L186:
  mov    %rsp,%r12
  test   %eax,%eax
  jle    L102
  mov    -0x48(%rbp),%r10
  shr    $0x2,%r10
  mov    %eax,%eax
  shl    $0x2,%rax
  mov    %rax,-0x68(%rbp)
  lea    -0x1(%rdi),%eax
  mov    -0x70(%rbp),%rbx
  lea    0x8(%rbx,%rax,8),%rax
  mov    %rax,-0x78(%rbp)
  mov    $0x0,%ebx
  mov    -0x4c(%rbp),%r8d
  mov    -0x50(%rbp),%eax
  mov    %rax,-0x90(%rbp)
  jmp    L163
L77:
  cltq
  addl   $0x1,(%r12,%rax,4)
  movslq (%r11,%rdx,4),%r13
  imul   %r10,%r13
  add    %r13,%rax
  addl   $0x1,(%rsi,%rax,4)
L160:
  add    $0x1,%rdx
  cmp    %rcx,%rdx
  je     L254
L135:
  mov    (%r15,%rdx,8),%rax
  mov    (%rax,%rbx,1),%eax
  cmp    $0xffffffff,%eax
  je     L160
  cmp    %r9d,%eax
  jne    L77
  jmp    L160
L254:
  test   %edi,%edi
  jle    L214
  mov    %rsi,%rcx
  mov    -0x70(%rbp),%r11
  mov    %r10,-0x58(%rbp)
  mov    -0x4c(%rbp),%r14d
  mov    %rsi,-0x60(%rbp)
  mov    -0x78(%rbp),%rsi
  jmp    L303
L288:
  je     L172
L260:
  add    $0x1,%rax
  cmp    %rax,%r8
  je     L216
L15:
  mov    (%rcx,%rax,4),%r9d
  cmp    %edx,%r9d
  jle    L288
  mov    (%r11),%rdx
  mov    %eax,(%rdx,%rbx,1)
  mov    %r9d,%edx
  jmp    L260
L172:
  mov    %rbx,%r9
  add    (%r11),%r9
  movslq (%r9),%r13
  mov    (%r12,%r13,4),%r13d
  cmp    %r13d,(%r12,%rax,4)
  jle    L260
  mov    %eax,(%r9)
  jmp    L260
L216:
  add    $0x8,%r11
  add    -0x48(%rbp),%rcx
  cmp    %rsi,%r11
  je     L245
L303:
  mov    $0x0,%eax
  mov    $0xffffffff,%edx
  test   %r14d,%r14d
  jg     L15
  jmp    L216
L245:
  mov    -0x58(%rbp),%r10
  mov    -0x60(%rbp),%rsi
L214:
  add    $0x4,%rbx
  cmp    -0x68(%rbp),%rbx
  je     L102
L163:
  mov    $0x0,%r9d
  cmpl   $0x0,-0x4c(%rbp)
  jle    L265
L306:
  movl   $0x0,(%r12,%r9,4)
  test   %edi,%edi
  jle    L267
  mov    $0x0,%edx
  movslq %r9d,%rcx
L101:
  movslq %edx,%rax
  imul   %r10,%rax
  add    %rcx,%rax
  movl   $0x0,(%rsi,%rax,4)
  add    $0x1,%edx
  cmp    %edx,%edi
  jne    L101
L267:
  add    $0x1,%r9
  cmp    %r8,%r9
  jne    L306
L265:
  cmpl   $0x0,-0x50(%rbp)
  jle    L254
  mov    $0x0,%edx
  mov    -0x7c(%rbp),%r9d
  mov    -0x88(%rbp),%r11
  mov    -0x90(%rbp),%rcx
  jmp    L135
L102:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L161
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L161:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void assign_Mu_by_class(int N_X_org, int K, int L, int ncode, int gap_index, int *class_id, int **X_org, int **Mu) {
  int i, n_X_org, k, l;
  int count_K_N[K][ncode], count_N[ncode], tmp_count;
  for (l = 0; l < L; l++) {
    for (i = 0; i < ncode; i++) {
      count_N[i] = 0;
      for (k = 0; k < K; k++) {
        count_K_N[k][i] = 0;
      }
    }
    for (n_X_org = 0; n_X_org < N_X_org; n_X_org++) {
      if (X_org[n_X_org][l] == gap_index || X_org[n_X_org][l] == -1) {
        continue;
      }
      count_N[X_org[n_X_org][l]]++;
      count_K_N[class_id[n_X_org]][X_org[n_X_org][l]]++;
    }
    for (k = 0; k < K; k++) {
      tmp_count = -1;
      for (i = 0; i < ncode; i++) {
        if (count_K_N[k][i] > tmp_count) {
          tmp_count = count_K_N[k][i];
          Mu[k][l] = i;
        } else if (count_K_N[k][i] == tmp_count && count_N[i] > count_N[Mu[k][l]]) {
          Mu[k][l] = i;
        }
      }
    }
  }
}
```