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

```asm
<pack_dxt>:
  endbr64
  push   %r15
  mov    %rdi,%rdx
  lea    0x80(%rdi),%rcx
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0xf8,%rsp
  mov    %rsi,0x48(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  nopl   0x0(%rax)
L111:
  mov    (%rdx),%rax
  and    $0xf8fcf8,%eax
  test   %ebp,%ebp
  jle    L269
  cmp    0x60(%rsp),%rax
  je     L263
  cmp    $0x1,%ebp
  je     L402
  cmp    0x68(%rsp),%rax
  je     L263
  cmp    $0x2,%ebp
  je     L283
  cmp    0x70(%rsp),%rax
  je     L263
  cmp    $0x3,%ebp
  je     L337
  cmp    0x78(%rsp),%rax
  je     L263
  cmp    $0x4,%ebp
  je     L514
  cmp    0x80(%rsp),%rax
  je     L263
  cmp    $0x5,%ebp
  je     L247
  cmp    0x88(%rsp),%rax
  je     L263
  cmp    $0x6,%ebp
  je     L522
  cmp    0x90(%rsp),%rax
  je     L263
  cmp    $0x7,%ebp
  je     L482
  cmp    0x98(%rsp),%rax
  je     L263
  cmp    $0x8,%ebp
  je     L313
  cmp    0xa0(%rsp),%rax
  je     L263
  cmp    $0x9,%ebp
  je     L450
  cmp    0xa8(%rsp),%rax
  je     L263
  cmp    $0xa,%ebp
  je     L31
  cmp    0xb0(%rsp),%rax
  je     L263
  cmp    $0xb,%ebp
  je     L559
  cmp    0xb8(%rsp),%rax
  je     L263
  cmp    $0xc,%ebp
  je     L391
  cmp    0xc0(%rsp),%rax
  je     L263
  cmp    $0xd,%ebp
  je     L126
  cmp    0xc8(%rsp),%rax
  je     L263
  cmp    $0xe,%ebp
  je     L205
  cmp    0xd0(%rsp),%rax
  je     L263
  cmp    $0xf,%ebp
  je     L227
  cmp    0xd8(%rsp),%rax
  je     L263
  mov    $0x10,%esi
L60:
  cmp    %ebp,%esi
  jne    L263
  movslq %ebp,%rsi
  add    $0x1,%ebp
  mov    %rax,0x60(%rsp,%rsi,8)
L263:
  add    $0x8,%rdx
  cmp    %rdx,%rcx
  jne    L111
  cmp    $0x1,%ebp
  je     L596
  jle    L293
  lea    -0x2(%rbp),%eax
  mov    $0x40000000,%edi
  mov    %ebp,0x38(%rsp)
  mov    %eax,0x3c(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %edi,%ebp
  mov    %rax,0x30(%rsp)
  lea    0x60(%rsp),%rax
  movq   $0x0,0x28(%rsp)
  mov    %rax,0x40(%rsp)
L382:
  mov    0x28(%rsp),%rdi
  mov    %edi,%eax
  add    $0x1,%eax
  cmp    %eax,0x38(%rsp)
  jle    L452
  mov    0x3c(%rsp),%eax
  mov    0x40(%rsp),%rcx
  lea    0x58(%rsp),%r12
  sub    %edi,%eax
  mov    (%rcx,%rdi,8),%r14
  lea    (%rcx,%rdi,8),%rbx
  add    %rdi,%rax
  lea    0x68(%rsp,%rax,8),%rax
  mov    %rax,0x8(%rsp)
  mov    %r12,%rax
  mov    %r14,%r12
  mov    %rax,%r14
  nopw   0x0(%rax,%rax,1)
L607:
  mov    0x8(%rbx),%r15
  mov    %r14,%r8
  mov    %r12,%rdx
  mov    $0x2,%esi
  mov    %r13,%rdi
  mov    %r15,%rcx
  call   <score_dxt@plt>
  cmp    %ebp,%eax
  jge    L78
  mov    %r15,0x18(%rsp)
  mov    %eax,%ebp
  mov    %r12,0x10(%rsp)
  movl   $0x2,0x24(%rsp)
L78:
  mov    %r14,%r8
  mov    %r15,%rcx
  mov    %r12,%rdx
  mov    $0x3,%esi
  mov    %r13,%rdi
  call   <score_dxt@plt>
  cmp    %eax,%ebp
  jle    L234
  mov    %r15,0x18(%rsp)
  mov    %eax,%ebp
  mov    %r12,0x10(%rsp)
  movl   $0x3,0x24(%rsp)
L234:
  add    $0x8,%rbx
  cmp    %rbx,0x8(%rsp)
  jne    L607
L452:
  addq   $0x1,0x28(%rsp)
  mov    0x28(%rsp),%rax
  cmp    %rax,0x30(%rsp)
  jne    L382
  mov    0x10(%rsp),%rsi
  mov    %esi,%eax
  mov    %rsi,%rdx
  shr    $0xa,%ax
  shr    $0x13,%rdx
  shl    $0xb,%edx
  shl    $0x5,%eax
  add    %edx,%eax
  mov    %esi,%edx
  mov    0x18(%rsp),%rsi
  shr    $0x3,%dl
  movzbl %dl,%edx
  mov    %rsi,%rcx
  add    %edx,%eax
  mov    %esi,%edx
  shr    $0x13,%rcx
  shr    $0xa,%dx
  shl    $0xb,%ecx
  shl    $0x5,%edx
  add    %ecx,%edx
  mov    %esi,%ecx
  shr    $0x3,%cl
  movzbl %cl,%ecx
  add    %ecx,%edx
  cmp    %dx,%ax
  seta   %sil
  cmpl   $0x3,0x24(%rsp)
  sete   %cl
L42:
  mov    0x48(%rsp),%rbx
  mov    %ax,(%rbx)
  mov    %dx,0x2(%rbx)
  cmp    %cl,%sil
  jne    L221
L352:
  mov    0x48(%rsp),%r8
  mov    0x18(%rsp),%rcx
  mov    %r13,%rdi
  mov    0x10(%rsp),%rdx
  mov    0x24(%rsp),%esi
  add    $0x4,%r8
  call   <score_dxt@plt>
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L146
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L269:
  xor    %esi,%esi
  jmp    L60
L402:
  mov    $0x1,%esi
  jmp    L60
L283:
  mov    $0x2,%esi
  jmp    L60
L337:
  mov    $0x3,%esi
  jmp    L60
L514:
  mov    $0x4,%esi
  jmp    L60
L247:
  mov    $0x5,%esi
  jmp    L60
L221:
  mov    0x18(%rsp),%rcx
  mov    0x10(%rsp),%rbx
  mov    %rcx,0x10(%rsp)
  mov    %rbx,0x18(%rsp)
L128:
  mov    0x48(%rsp),%rsi
  mov    %dx,(%rsi)
  mov    %ax,0x2(%rsi)
  jmp    L352
L522:
  mov    $0x6,%esi
  jmp    L60
L482:
  mov    $0x7,%esi
  jmp    L60
L313:
  mov    $0x8,%esi
  jmp    L60
L596:
  mov    0x60(%rsp),%rdi
  movl   $0x3,0x24(%rsp)
  mov    %edi,%eax
  mov    %rdi,%rdx
  mov    %rdi,0x18(%rsp)
  shr    $0xa,%ax
  shr    $0x13,%rdx
  mov    %rdi,0x10(%rsp)
  shl    $0xb,%edx
  shl    $0x5,%eax
  add    %edx,%eax
  mov    %edi,%edx
  shr    $0x3,%dl
  movzbl %dl,%edx
  add    %edx,%eax
  mov    %eax,%edx
  jmp    L128
L450:
  mov    $0x9,%esi
  jmp    L60
L31:
  mov    $0xa,%esi
  jmp    L60
L559:
  mov    $0xb,%esi
  jmp    L60
L391:
  mov    $0xc,%esi
  jmp    L60
L126:
  mov    $0xd,%esi
  jmp    L60
L205:
  mov    $0xe,%esi
  jmp    L60
L227:
  mov    $0xf,%esi
  jmp    L60
L293:
  movq   $0x0,0x10(%rsp)
  xor    %eax,%eax
  xor    %edx,%edx
  xor    %esi,%esi
  movq   $0x0,0x18(%rsp)
  xor    %ecx,%ecx
  movl   $0x0,0x24(%rsp)
  jmp    L42
L146:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void pack_dxt(unsigned long *px, unsigned char *dest) {
  int i1, i2, best_ninter, err, best_err, ncolors;
  unsigned long uniq[16];
  unsigned long col1, col2, best_col1, best_col2, pack;
  unsigned char *c1, *c2;
  unsigned short *sptr, tmpshort;
  ncolors = 0;
  for (i1 = 0; i1 < 16; i1++) {
    col1 = px[i1] & 0xf8fcf8;
    for (i2 = 0; i2 < ncolors; i2++)
      if (uniq[i2] == col1)
        break;
    if (i2 == ncolors)
      uniq[ncolors++] = col1;
  }
  if (ncolors == 1) {
    best_col1 = uniq[0];
    best_col2 = uniq[0];
    best_err = 1000;
    best_ninter = 3;
  } else {
    best_err = (1 << 30);
    for (i1 = 0; i1 < ncolors - 1; i1++)
      for (i2 = i1 + 1; i2 < ncolors; i2++) {
        err = score_dxt(px, 2, uniq[i1], uniq[i2], &pack);
        if (err < best_err) {
          best_col1 = uniq[i1];
          best_col2 = uniq[i2];
          best_ninter = 2;
          best_err = err;
        }
        err = score_dxt(px, 3, uniq[i1], uniq[i2], &pack);
        if (err < best_err) {
          best_col1 = uniq[i1];
          best_col2 = uniq[i2];
          best_ninter = 3;
          best_err = err;
        }
      }
  }
  c1 = (unsigned char *)&col1;
  c2 = (unsigned char *)&col2;
  col1 = best_col1;
  col2 = best_col2;
  sptr = (unsigned short *)dest;
  sptr[0] = ((unsigned short)c1[0] >> 3) + (((unsigned short)c1[1] >> 2) << 5) + (((unsigned short)c1[2] >> 3) << 11);
  sptr[1] = ((unsigned short)c2[0] >> 3) + (((unsigned short)c2[1] >> 2) << 5) + (((unsigned short)c2[2] >> 3) << 11);
  if ((sptr[0] > sptr[1]) ^ (best_ninter == 3)) {
    tmpshort = sptr[0];
    sptr[0] = sptr[1];
    sptr[1] = tmpshort;
    best_col1 = col2;
    best_col2 = col1;
  }
  score_dxt(px, best_ninter, best_col1, best_col2, (unsigned long *)(dest + 4));
}
```