user: Translate the below assembly code into C programming language:

```asm
<DecompressBlockDXT1Internal>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x58,%rsp
  mov    (%rdi),%ecx
  mov    0x10(%rdi),%ebp
  mov    %rsi,0x10(%rsp)
  mov    %ecx,%eax
  mov    %edx,0x1c(%rsp)
  mov    0x8(%rdi),%edx
  sar    $0xb,%eax
  mov    %eax,%esi
  shl    $0x8,%esi
  sub    %eax,%esi
  lea    0x2f(%rsi),%eax
  add    $0x10,%esi
  cmovns %esi,%eax
  sar    $0x5,%eax
  add    %esi,%eax
  lea    0x1f(%rax),%esi
  cmovs  %esi,%eax
  mov    %ecx,%esi
  sar    $0x5,%esi
  sar    $0x5,%eax
  and    $0x3f,%esi
  mov    %eax,0xc(%rsp)
  mov    %eax,%r11d
  mov    %esi,%eax
  shl    $0x8,%eax
  sub    %esi,%eax
  add    $0x20,%eax
  mov    %eax,%esi
  sar    $0x6,%esi
  add    %esi,%eax
  mov    %ecx,%esi
  sar    $0x6,%eax
  and    $0x1f,%esi
  mov    %eax,(%rsp)
  mov    %eax,%r9d
  mov    %esi,%eax
  shl    $0x8,%eax
  sub    %esi,%eax
  add    $0x10,%eax
  mov    %eax,%esi
  sar    $0x5,%esi
  add    %esi,%eax
  sar    $0x5,%eax
  mov    %eax,0x4(%rsp)
  mov    %eax,%r14d
  mov    %edx,%eax
  sar    $0xb,%eax
  mov    %eax,%esi
  shl    $0x8,%esi
  sub    %eax,%esi
  lea    0x2f(%rsi),%eax
  add    $0x10,%esi
  cmovns %esi,%eax
  sar    $0x5,%eax
  add    %esi,%eax
  lea    0x1f(%rax),%esi
  cmovs  %esi,%eax
  mov    %edx,%esi
  sar    $0x5,%esi
  sar    $0x5,%eax
  and    $0x3f,%esi
  mov    %eax,0x18(%rsp)
  mov    %eax,%r10d
  mov    %esi,%eax
  shl    $0x8,%eax
  sub    %esi,%eax
  add    $0x20,%eax
  mov    %eax,%esi
  sar    $0x6,%esi
  add    %esi,%eax
  mov    %edx,%esi
  sar    $0x6,%eax
  and    $0x1f,%esi
  mov    %eax,0x8(%rsp)
  mov    %eax,%r8d
  mov    %esi,%eax
  shl    $0x8,%eax
  sub    %esi,%eax
  add    $0x10,%eax
  mov    %eax,%r12d
  sar    $0x5,%r12d
  add    %eax,%r12d
  sar    $0x5,%r12d
  cmp    %edx,%ecx
  jg     L70
  lea    (%r12,%r14,1),%eax
  mov    %r10d,%edx
  mov    %r12d,0x38(%rsp)
  xor    %r14d,%r14d
  sar    %eax
  add    %r11d,%edx
  movl   $0x0,0x30(%rsp)
  mov    %eax,0x20(%rsp)
  mov    %r9d,%eax
  add    %r8d,%eax
  sar    %eax
  mov    %eax,0x28(%rsp)
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x34(%rsp)
L163:
  movslq 0x30(%rsp),%rax
  mov    0x10(%rsp),%rdx
  lea    (%r14,%r14,1),%r15d
  xor    %r12d,%r12d
  lea    (%rdx,%rax,4),%r13
L83:
  mov    %r15d,%ecx
  mov    %ebp,%eax
  mov    (%rbx,%r12,1),%r8d
  sar    %cl,%eax
  and    $0x3,%eax
  mov    %r8d,%ecx
  cmp    $0x2,%eax
  je     L140
  cmp    $0x3,%eax
  je     L23
  cmp    $0x1,%eax
  je     L106
  mov    0x4(%rsp),%edx
  mov    (%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <PackRGBA@plt>
L130:
  mov    %eax,0x0(%r13,%r12,1)
  add    $0x4,%r12
  add    $0x2,%r15d
  cmp    $0x10,%r12
  jne    L83
  add    $0x4,%r14d
  mov    0x1c(%rsp),%edi
  add    $0x10,%rbx
  add    %edi,0x30(%rsp)
  cmp    $0x10,%r14d
  jne    L163
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L106:
  mov    0x38(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    0x18(%rsp),%edi
  call   <PackRGBA@plt>
  jmp    L130
  nopl   0x0(%rax,%rax,1)
L23:
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %edi,%edi
  call   <PackRGBA@plt>
  jmp    L130
  nopl   (%rax)
L140:
  mov    0x20(%rsp),%edx
  mov    0x28(%rsp),%esi
  mov    0x34(%rsp),%edi
  call   <PackRGBA@plt>
  jmp    L130
  nopl   0x0(%rax,%rax,1)
L70:
  mov    0x4(%rsp),%edi
  mov    $0xaaaaaaab,%edx
  mov    0x8(%rsp),%esi
  xor    %r14d,%r14d
  mov    (%rsp),%r9d
  mov    0x18(%rsp),%r10d
  movl   $0x0,0x30(%rsp)
  lea    (%r12,%rdi,2),%eax
  mov    0xc(%rsp),%r11d
  mov    %r12d,0x4c(%rsp)
  imul   %rdx,%rax
  lea    (%r10,%r11,2),%ecx
  shr    $0x21,%rax
  mov    %rax,0x20(%rsp)
  lea    (%rsi,%r9,2),%eax
  imul   %rdx,%rax
  shr    $0x21,%rax
  mov    %rax,0x28(%rsp)
  movslq %ecx,%rax
  sar    $0x1f,%ecx
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  sub    %ecx,%eax
  mov    %eax,0x34(%rsp)
  lea    (%rdi,%r12,2),%eax
  imul   %rdx,%rax
  shr    $0x21,%rax
  mov    %rax,0x38(%rsp)
  lea    (%r9,%rsi,2),%eax
  imul   %rdx,%rax
  lea    (%r11,%r10,2),%edx
  shr    $0x21,%rax
  mov    %rax,0x40(%rsp)
  movslq %edx,%rax
  sar    $0x1f,%edx
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  sub    %edx,%eax
  mov    %eax,0x48(%rsp)
L77:
  movslq 0x30(%rsp),%rax
  mov    0x10(%rsp),%rdi
  lea    (%r14,%r14,1),%r15d
  xor    %r12d,%r12d
  lea    (%rdi,%rax,4),%r13
L117:
  mov    %r15d,%ecx
  mov    %ebp,%eax
  mov    (%rbx,%r12,1),%r8d
  sar    %cl,%eax
  and    $0x3,%eax
  mov    %r8d,%ecx
  cmp    $0x2,%eax
  je     L68
  cmp    $0x3,%eax
  je     L17
  cmp    $0x1,%eax
  je     L53
  mov    0x4(%rsp),%edx
  mov    (%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <PackRGBA@plt>
L12:
  mov    %eax,0x0(%r13,%r12,1)
  add    $0x4,%r12
  add    $0x2,%r15d
  cmp    $0x10,%r12
  jne    L117
  add    $0x4,%r14d
  mov    0x1c(%rsp),%edi
  add    $0x10,%rbx
  add    %edi,0x30(%rsp)
  cmp    $0x10,%r14d
  jne    L77
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L53:
  mov    0x4c(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    0x18(%rsp),%edi
  call   <PackRGBA@plt>
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L17:
  mov    0x38(%rsp),%edx
  mov    0x40(%rsp),%esi
  mov    0x48(%rsp),%edi
  call   <PackRGBA@plt>
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L68:
  mov    0x20(%rsp),%edx
  mov    0x28(%rsp),%esi
  mov    0x34(%rsp),%edi
  call   <PackRGBA@plt>
  jmp    L12
```

assistant: ```c
void DecompressBlockDXT1Internal(const uint8_t *block, uint32_t *output, uint32_t outputStride, const uint8_t *alphaValues) {
  uint32_t temp, code;
  uint16_t color0, color1;
  uint8_t r0, g0, b0, r1, g1, b1;
  int i, j;
  color0 = *(const uint16_t *)(block);
  color1 = *(const uint16_t *)(block + 2);
  temp = (color0 >> 11) * 255 + 16;
  r0 = (uint8_t)((temp / 32 + temp) / 32);
  temp = ((color0 & 0x07E0) >> 5) * 255 + 32;
  g0 = (uint8_t)((temp / 64 + temp) / 64);
  temp = (color0 & 0x001F) * 255 + 16;
  b0 = (uint8_t)((temp / 32 + temp) / 32);
  temp = (color1 >> 11) * 255 + 16;
  r1 = (uint8_t)((temp / 32 + temp) / 32);
  temp = ((color1 & 0x07E0) >> 5) * 255 + 32;
  g1 = (uint8_t)((temp / 64 + temp) / 64);
  temp = (color1 & 0x001F) * 255 + 16;
  b1 = (uint8_t)((temp / 32 + temp) / 32);
  code = *(const uint32_t *)(block + 4);
  if (color0 > color1) {
    for (j = 0; j < 4; ++j) {
      for (i = 0; i < 4; ++i) {
        uint32_t finalColor, positionCode;
        uint8_t alpha;
        alpha = alphaValues[j * 4 + i];
        finalColor = 0;
        positionCode = (code >> 2 * (4 * j + i)) & 0x03;
        switch (positionCode) {
        case 0:
          finalColor = PackRGBA(r0, g0, b0, alpha);
          break;
        case 1:
          finalColor = PackRGBA(r1, g1, b1, alpha);
          break;
        case 2:
          finalColor = PackRGBA((2 * r0 + r1) / 3, (2 * g0 + g1) / 3, (2 * b0 + b1) / 3, alpha);
          break;
        case 3:
          finalColor = PackRGBA((r0 + 2 * r1) / 3, (g0 + 2 * g1) / 3, (b0 + 2 * b1) / 3, alpha);
          break;
        }
        output[j * outputStride + i] = finalColor;
      }
    }
  } else {
    for (j = 0; j < 4; ++j) {
      for (i = 0; i < 4; ++i) {
        uint32_t finalColor, positionCode;
        uint8_t alpha;
        alpha = alphaValues[j * 4 + i];
        finalColor = 0;
        positionCode = (code >> 2 * (4 * j + i)) & 0x03;
        switch (positionCode) {
        case 0:
          finalColor = PackRGBA(r0, g0, b0, alpha);
          break;
        case 1:
          finalColor = PackRGBA(r1, g1, b1, alpha);
          break;
        case 2:
          finalColor = PackRGBA((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, alpha);
          break;
        case 3:
          finalColor = PackRGBA(0, 0, 0, alpha);
          break;
        }
        output[j * outputStride + i] = finalColor;
      }
    }
  }
}
```