user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<pll_core_create_lookup>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,0x30(%rsp)
  mov    %esi,0x24(%rsp)
  mov    %rdx,%r12
  mov    %rcx,0x38(%rsp)
  mov    %r8,0x40(%rsp)
  mov    0xa0(%rsp),%ebx
  cmp    $0x4,%edi
  je     L79
  mov    %r9,%r14
  mov    %ebx,%edi
  call   <log2@plt>
  mov    %eax,%edi
  call   <ceil@plt>
  mov    %eax,0x4c(%rsp)
  mov    0x30(%rsp),%eax
  mov    %eax,%edi
  imul   0x24(%rsp),%edi
  mov    %edi,0x48(%rsp)
  test   %ebx,%ebx
  je     L160
  mov    %eax,%edi
  mov    %eax,%eax
  lea    0x0(,%rax,8),%r13
  mov    %ebx,%eax
  mov    %rax,0x58(%rsp)
  lea    -0x1(%rbx),%eax
  lea    0x4(%r14,%rax,4),%rax
  mov    %rax,0x50(%rsp)
  lea    -0x1(%rdi),%edi
  lea    0x1(%rdi),%rax
  imul   %r13,%rax
  mov    %rax,0x28(%rsp)
  mov    $0x0,%ebp
  mov    $0x0,%r15d
  mov    %rbp,%rbx
  mov    %r13,%rbp
  mov    %r14,%rax
  mov    %r12,%r14
  mov    %rax,%r12
  mov    %rbx,%r13
  jmp    L145
L79:
  mov    %r8,%rcx
  mov    0x38(%rsp),%rdx
  mov    %r12,%rsi
  mov    0x24(%rsp),%edi
  call   <pll_core_create_lookup_4x4@plt>
L160:
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L97:
  shr    %ecx
  shr    %edx
  lea    0x1(%rax),%rsi
  cmp    %rdi,%rax
  je     L144
  mov    %rsi,%rax
L60:
  test   $0x1,%cl
  je     L39
  addsd  (%r9,%rax,8),%xmm0
L39:
  test   $0x1,%dl
  je     L97
  addsd  (%r10,%rax,8),%xmm1
  jmp    L97
L144:
  add    %rbp,%r9
  add    %rbp,%r10
  lea    0x1(%r8),%eax
  mov    %r8d,%r8d
  add    0x8(%rsp),%r8
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%r14,%r8,8)
  cmp    %eax,%r11d
  je     L41
  mov    %eax,%r8d
L127:
  mov    (%r12,%r13,4),%ecx
  mov    (%rbx),%edx
  mov    %r15,%rax
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm0
  jmp    L60
L41:
  mov    0x28(%rsp),%rsi
  add    %rsi,0x10(%rsp)
  add    %rsi,0x18(%rsp)
  mov    %r11d,%r8d
L103:
  addl   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%eax
  cmp    %eax,0x24(%rsp)
  je     L44
L59:
  mov    0x30(%rsp),%eax
  lea    (%rax,%r8,1),%r11d
  mov    0x18(%rsp),%r10
  mov    0x10(%rsp),%r9
  test   %eax,%eax
  jne    L127
  jmp    L103
L44:
  mov    0x48(%rsp),%esi
  add    %esi,0x34(%rsp)
  add    $0x4,%rbx
  cmp    0x50(%rsp),%rbx
  je     L116
L18:
  mov    0x34(%rsp),%eax
  mov    %rax,0x8(%rsp)
  cmpl   $0x0,0x24(%rsp)
  je     L44
  mov    0x40(%rsp),%rax
  mov    %rax,0x18(%rsp)
  mov    0x38(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    $0x0,%r8d
  movl   $0x0,0x20(%rsp)
  jmp    L59
L116:
  add    $0x1,%r13
  cmp    %r13,0x58(%rsp)
  je     L160
L145:
  mov    %r13d,%eax
  movzbl 0x4c(%rsp),%ecx
  shl    %cl,%eax
  imul   0x48(%rsp),%eax
  mov    %eax,0x34(%rsp)
  mov    %r12,%rbx
  jmp    L18
```

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;
        }
      }
    }
  }
}
```