user: 请从给定的汇编指令推导出C源代码：

```asm
<encode_alpha_block_DXT5>:
  endbr64
  movslq %edx,%rdx
  push   %r15
  lea    (%rsi,%rdx,1),%rcx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  movzbl 0x2f(%rcx),%eax
  movzbl 0x7(%rcx),%r15d
  movzbl 0xb(%rcx),%edx
  movzbl 0x3(%rcx),%r14d
  movzbl 0xf(%rcx),%r13d
  cmp    %r15d,%edx
  movzbl 0x13(%rcx),%r12d
  movzbl 0x17(%rcx),%ebp
  mov    %eax,-0x14(%rsp)
  movzbl 0x37(%rcx),%eax
  movzbl 0x1b(%rcx),%ebx
  mov    %rdi,-0x8(%rsp)
  movzbl 0x1f(%rcx),%r11d
  movzbl 0x23(%rcx),%r10d
  movzbl 0x27(%rcx),%r9d
  movzbl 0x2b(%rcx),%r8d
  mov    %eax,-0xc(%rsp)
  mov    %r15d,%eax
  cmovge %edx,%eax
  movzbl 0x33(%rcx),%esi
  movzbl 0x3b(%rcx),%edi
  cmp    %r14d,%eax
  mov    %esi,-0x10(%rsp)
  movzbl 0x3f(%rcx),%esi
  cmovl  %r14d,%eax
  cmp    %r13d,%eax
  cmovl  %r13d,%eax
  cmp    %r12d,%eax
  cmovl  %r12d,%eax
  cmp    %ebp,%eax
  cmovl  %ebp,%eax
  cmp    %ebx,%eax
  cmovl  %ebx,%eax
  cmp    %r11d,%eax
  cmovl  %r11d,%eax
  cmp    %r10d,%eax
  cmovl  %r10d,%eax
  cmp    %r9d,%eax
  cmovl  %r9d,%eax
  cmp    %r8d,%eax
  cmovl  %r8d,%eax
  cmp    -0x14(%rsp),%eax
  cmovl  -0x14(%rsp),%eax
  cmp    -0x10(%rsp),%eax
  cmovl  -0x10(%rsp),%eax
  cmp    -0xc(%rsp),%eax
  cmovl  -0xc(%rsp),%eax
  cmp    %edi,%eax
  cmovl  %edi,%eax
  cmp    %esi,%eax
  cmovl  %esi,%eax
  cmp    %r15d,%edx
  cmovg  %r15d,%edx
  cmp    %r14d,%edx
  cmovg  %r14d,%edx
  cmp    %r13d,%edx
  cmovg  %r13d,%edx
  cmp    %r12d,%edx
  cmovg  %r12d,%edx
  lea    0x43(%rcx),%r12
  cmp    %ebp,%edx
  cmovg  %ebp,%edx
  cmp    %ebx,%edx
  cmovg  %ebx,%edx
  mov    -0x14(%rsp),%ebx
  cmp    %r11d,%edx
  cmovg  %r11d,%edx
  cmp    %r10d,%edx
  cmovg  %r10d,%edx
  cmp    %r9d,%edx
  cmovg  %r9d,%edx
  cmp    %r8d,%edx
  cmovg  %r8d,%edx
  cmp    %ebx,%edx
  cmovg  %ebx,%edx
  mov    -0x10(%rsp),%ebx
  cmp    %ebx,%edx
  cmovg  %ebx,%edx
  mov    -0xc(%rsp),%ebx
  cmp    %ebx,%edx
  cmovg  %ebx,%edx
  cmp    %edi,%edx
  cmovg  %edi,%edx
  mov    -0x8(%rsp),%rdi
  cmp    %esi,%edx
  mov    %al,(%rdi)
  lea    0x2(%rdi),%rbx
  cmovg  %esi,%edx
  xor    %r9d,%r9d
  sub    %edx,%eax
  lea    0x0(,%rdx,8),%ebp
  mov    %dl,0x1(%rdi)
  lea    0x3(%rcx),%rdi
  sub    %edx,%ebp
  mov    %eax,%edx
  lea    0x0(,%rax,4),%r11d
  xor    %ecx,%ecx
  sar    %edx
  lea    (%rax,%rax,1),%r10d
  sub    %edx,%ebp
  jmp    L32
  nopl   0x0(%rax,%rax,1)
L23:
  add    $0x4,%rdi
  mov    %r9b,(%rbx)
  sub    $0x5,%ecx
  sar    $0x8,%r9d
  add    $0x1,%rbx
  cmp    %r12,%rdi
  je     L17
L32:
  movzbl (%rdi),%esi
  lea    0x0(,%rsi,8),%edx
  sub    %esi,%edx
  mov    %r11d,%esi
  sub    %ebp,%edx
  sub    %edx,%esi
  sar    $0x1f,%esi
  mov    %esi,%r13d
  and    %r11d,%esi
  sub    %esi,%edx
  mov    %r10d,%esi
  and    $0x4,%r13d
  sub    %edx,%esi
  sar    $0x1f,%esi
  mov    %esi,%r8d
  and    %r10d,%esi
  sub    %esi,%edx
  and    $0x2,%r8d
  or     %r13d,%r8d
  mov    %edx,%r13d
  mov    %eax,%edx
  sub    %r13d,%edx
  sar    $0x1f,%edx
  sub    %r8d,%edx
  mov    %edx,%esi
  and    $0x7,%esi
  and    $0x6,%edx
  sete   %dl
  movzbl %dl,%edx
  xor    %esi,%edx
  shl    %cl,%edx
  or     %edx,%r9d
  lea    0x3(%rcx),%edx
  cmp    $0x7,%edx
  jg     L23
  add    $0x4,%rdi
  mov    %edx,%ecx
  cmp    %r12,%rdi
  jne    L32
L17:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void encode_alpha_block_DXT5(unsigned char *dst, const unsigned char *block, const int offset) {
  int i, v, mn, mx;
  int dist, bias, dist2, dist4, bits, mask;
  int a, idx, t;
  block += offset;
  block += 3;
  mn = mx = block[0];
  for (i = 0; i < 16; ++i) {
    v = block[4 * i];
    if (v > mx)
      mx = v;
    if (v < mn)
      mn = v;
  }
  *dst++ = mx;
  *dst++ = mn;
  dist = mx - mn;
  bias = mn * 7 - (dist >> 1);
  dist4 = dist * 4;
  dist2 = dist * 2;
  bits = 0;
  mask = 0;
  for (i = 0; i < 16; ++i) {
    a = block[4 * i] * 7 - bias;
    t = (dist4 - a) >> 31;
    idx = t & 4;
    a -= dist4 & t;
    t = (dist2 - a) >> 31;
    idx += t & 2;
    a -= dist2 & t;
    t = (dist - a) >> 31;
    idx += t & 1;
    idx = -idx & 7;
    idx ^= (2 > idx);
    mask |= idx << bits;
    if ((bits += 3) >= 8) {
      *dst++ = mask;
      mask >>= 8;
      bits -= 8;
    }
  }
}
```