user: 请将以下的汇编代码转换成C语言代码：

```asm
<pll_core_create_lookup>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %edi,0xc(%rsp)
  mov    0xb0(%rsp),%ebx
  mov    %esi,0x40(%rsp)
  mov    %rcx,0x48(%rsp)
  mov    %r8,0x50(%rsp)
  mov    %r9,0x30(%rsp)
  cmp    $0x4,%edi
  je     L126
  mov    %ebx,%edi
  call   <log2@plt>
  mov    %eax,%edi
  call   <ceil@plt>
  mov    0x40(%rsp),%edi
  mov    %eax,0x5c(%rsp)
  mov    0xc(%rsp),%eax
  imul   %eax,%edi
  mov    %edi,0x58(%rsp)
  test   %ebx,%ebx
  je     L59
  movq   $0x0,0x20(%rsp)
  mov    %eax,%eax
  pxor   %xmm2,%xmm2
  lea    0x0(,%rax,8),%r15
  mov    %rax,%rdi
  mov    %ebx,%eax
  mov    %rax,0x60(%rsp)
  lea    -0x1(%rbx),%eax
  mov    0x30(%rsp),%rbx
  lea    -0x1(%rdi),%r13d
  lea    0x4(%rbx,%rax,4),%rax
  mov    %rax,0x68(%rsp)
  lea    0x1(%r13),%rax
  imul   %r15,%rax
  mov    %rax,0x38(%rsp)
  mov    %r14,%rax
  mov    %r15,%r14
  mov    %rax,%r15
L68:
  mov    0x20(%rsp),%eax
  movzbl 0x5c(%rsp),%ecx
  shl    %cl,%eax
  imul   0x58(%rsp),%eax
  mov    %eax,0x44(%rsp)
  mov    0x30(%rsp),%rax
  mov    %rax,0x28(%rsp)
L107:
  mov    0x40(%rsp),%edx
  mov    0x44(%rsp),%ebp
  test   %edx,%edx
  je     L2
  mov    0x50(%rsp),%rax
  xor    %edi,%edi
  xor    %r12d,%r12d
  mov    %rax,0x18(%rsp)
  mov    0x48(%rsp),%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L61:
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L75
  mov    0x30(%rsp),%rax
  mov    0x20(%rsp),%rbx
  mov    0x18(%rsp),%r9
  mov    0x10(%rsp),%r8
  mov    (%rax,%rbx,4),%ebx
  mov    0x28(%rsp),%rax
  mov    (%rax),%r11d
  mov    0xc(%rsp),%eax
  lea    (%rax,%rdi,1),%r10d
  nopl   0x0(%rax,%rax,1)
L87:
  mov    %r11d,%ecx
  mov    %ebx,%edx
  movapd %xmm2,%xmm1
  xor    %eax,%eax
  movapd %xmm2,%xmm0
  jmp    L83
  nopl   0x0(%rax)
L67:
  mov    %rsi,%rax
L83:
  test   $0x1,%dl
  je     L56
  addsd  (%r8,%rax,8),%xmm0
L56:
  test   $0x1,%cl
  je     L6
  addsd  (%r9,%rax,8),%xmm1
L6:
  shr    %edx
  shr    %ecx
  lea    0x1(%rax),%rsi
  cmp    %r13,%rax
  jne    L67
  mulsd  %xmm1,%xmm0
  lea    0x1(%rdi),%eax
  add    %rbp,%rdi
  add    %r14,%r8
  add    %r14,%r9
  movsd  %xmm0,(%r15,%rdi,8)
  cmp    %eax,%r10d
  je     L7
  mov    %eax,%edi
  jmp    L87
  nopl   (%rax)
L7:
  mov    0x38(%rsp),%rbx
  add    %rbx,0x10(%rsp)
  mov    %r10d,%edi
  add    %rbx,0x18(%rsp)
L75:
  add    $0x1,%r12d
  cmp    %r12d,0x40(%rsp)
  jne    L61
L2:
  addq   $0x4,0x28(%rsp)
  mov    0x58(%rsp),%ebx
  mov    0x28(%rsp),%rax
  add    %ebx,0x44(%rsp)
  cmp    0x68(%rsp),%rax
  jne    L107
  addq   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%rax
  cmp    %rax,0x60(%rsp)
  jne    L68
L59:
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L126:
  mov    0x48(%rsp),%rdx
  mov    0x40(%rsp),%edi
  add    $0x78,%rsp
  mov    %r14,%rsi
  pop    %rbx
  mov    %r8,%rcx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <pll_core_create_lookup_4x4@plt>
```

assistant: ```c
void pll_core_create_lookup(unsigned int states, unsigned int rate_cats, double *lookup, const double *left_matrix, const double *right_matrix, const unsigned int *tipmap, unsigned int tipmap_size, unsigned int attrib) {
  if (states == 4) {
    pll_core_create_lookup_4x4(rate_cats, lookup, left_matrix, right_matrix);
    return;
  }
  unsigned int i, j, k, n, m;
  unsigned int index = 0;
  unsigned int maxstates = tipmap_size;
  unsigned int log2_maxstates = (unsigned int)ceil(log2(maxstates));
  unsigned int span = states * rate_cats;
  double termj = 0;
  double termk = 0;
  const double *jmat;
  const double *kmat;
  double *lh_statepair;
  for (j = 0; j < maxstates; ++j) {
    for (k = 0; k < maxstates; ++k) {
      jmat = left_matrix;
      kmat = right_matrix;
      index = 0;
      lh_statepair = lookup;
      lh_statepair += ((j << log2_maxstates) + k) * span;
      for (n = 0; n < rate_cats; ++n) {
        for (i = 0; i < states; ++i) {
          termj = 0;
          termk = 0;
          unsigned int jstate = tipmap[j];
          unsigned int kstate = tipmap[k];
          for (m = 0; m < states; ++m) {
            if (jstate & 1)
              termj += jmat[m];
            if (kstate & 1)
              termk += kmat[m];
            jstate >>= 1;
            kstate >>= 1;
          }
          jmat += states;
          kmat += states;
          lh_statepair[index++] = termj * termk;
        }
      }
    }
  }
}
```