user: What is the c source code of the assembly code below?

```asm
<util_format_unsigned_encode_rgtc_ubyte>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %rsi,(%rsp)
  mov    %ecx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L145
  mov    (%rsp),%rbp
  mov    0x8(%rsp),%ebx
  mov    %edx,%esi
  xor    %r8d,%r8d
  xor    %edi,%edi
  xor    %r9d,%r9d
  mov    $0xffffffff,%r10d
  xor    %r11d,%r11d
  nopl   0x0(%rax,%rax,1)
L495:
  test   %esi,%esi
  jle    L533
  movzbl %r9b,%eax
  xor    %edx,%edx
  lea    0x0(%rbp,%rax,4),%rcx
  xor    %eax,%eax
  jmp    L304
  nopl   0x0(%rax,%rax,1)
L800:
  cmp    $0xff,%al
  je     L1022
  cmp    %al,%r11b
  cmovb  %eax,%r11d
  cmp    %al,%r10b
  cmova  %eax,%r10d
L143:
  add    $0x1,%edx
  movzbl %dl,%eax
  cmp    %esi,%eax
  jge    L533
L304:
  movzbl (%rcx,%rax,1),%eax
  test   %al,%al
  jne    L800
  add    $0x1,%edx
  mov    $0x1,%edi
  movzbl %dl,%eax
  cmp    %esi,%eax
  jl     L304
L533:
  add    $0x1,%r9d
  movzbl %r9b,%eax
  cmp    %ebx,%eax
  jl     L495
  cmp    %r11b,%r10b
  ja     L983
  jne    L286
  mov    %r8d,%eax
  or     %edi,%eax
  je     L145
L286:
  test   %edi,%edi
  jne    L714
  movzbl %r10b,%eax
  mov    %r10d,%ebx
  mov    %eax,0x18(%rsp)
L155:
  test   %r8d,%r8d
  jne    L60
  movzbl %r11b,%eax
  mov    %r11b,0x10(%rsp)
  mov    %eax,0x1c(%rsp)
  jmp    L619
  nopl   0x0(%rax)
L1022:
  mov    $0x1,%r8d
  jmp    L143
L983:
  xor    $0x1,%r8d
  xor    $0x1,%edi
  or     %dil,%r8b
  jne    L145
  movl   $0x0,0x18(%rsp)
  xor    %ebx,%ebx
  movl   $0xff,0x1c(%rsp)
  movb   $0xff,0x10(%rsp)
L619:
  mov    0x18(%rsp),%edx
  mov    0x1c(%rsp),%ecx
  lea    0x70(%rsp),%r9
  mov    $0x92492493,%r8d
  mov    %r9,0x48(%rsp)
  mov    %edx,%edi
  lea    (%rcx,%rcx,2),%eax
  sub    %ecx,%edi
  lea    (%rcx,%rax,4),%ecx
  add    %edx,%ecx
  lea    0x69(%rsp),%rdx
  add    %edi,%edi
  mov    %rdx,0x28(%rsp)
  nopw   0x0(%rax,%rax,1)
L625:
  mov    %ecx,%eax
  add    $0x1,%rdx
  add    %edi,%ecx
  shr    %eax
  imul   %r8,%rax
  shr    $0x22,%rax
  mov    %al,-0x1(%rdx)
  cmp    %rdx,%r9
  jne    L625
  mov    0x18(%rsp),%r14d
  movzbl 0x6b(%rsp),%eax
  mov    %r10b,0x44(%rsp)
  mov    0x1c(%rsp),%r15d
  movzbl 0x6c(%rsp),%edi
  lea    (%r14,%r14,1),%r9d
  mov    %al,0x38(%rsp)
  movzbl 0x69(%rsp),%ebp
  lea    (%r9,%r14,1),%eax
  mov    %dil,0xf(%rsp)
  movzbl 0x6d(%rsp),%edi
  lea    (%r15,%rax,2),%edx
  movzbl 0x6a(%rsp),%r13d
  movslq %edx,%rcx
  mov    %dil,0x14(%rsp)
  movzbl 0x6e(%rsp),%edi
  imul   $0xffffffff92492493,%rcx,%rcx
  mov    %dil,0x34(%rsp)
  movzbl 0x6f(%rsp),%edi
  shr    $0x20,%rcx
  mov    %dil,0x40(%rsp)
  lea    (%r15,%r15,1),%edi
  add    %ecx,%edx
  sar    $0x2,%edx
  mov    %edx,%ecx
  lea    0x0(,%r14,4),%edx
  neg    %ecx
  mov    %cx,0x5c(%rsp)
  lea    (%rdx,%r14,1),%ecx
  add    %edi,%ecx
  movslq %ecx,%r8
  imul   $0xffffffff92492493,%r8,%r8
  shr    $0x20,%r8
  add    %r8d,%ecx
  sar    $0x2,%ecx
  neg    %ecx
  mov    %cx,0x36(%rsp)
  lea    (%rdi,%r15,1),%ecx
  add    %ecx,%edx
  movslq %edx,%rdi
  imul   $0xffffffff92492493,%rdi,%rdi
  shr    $0x20,%rdi
  add    %edi,%edx
  sar    $0x2,%edx
  mov    %edx,%edi
  lea    0x0(,%r15,4),%edx
  add    %edx,%eax
  neg    %edi
  mov    %di,0x30(%rsp)
  movslq %eax,%rdi
  imul   $0xffffffff92492493,%rdi,%rdi
  shr    $0x20,%rdi
  add    %edi,%eax
  sar    $0x2,%eax
  neg    %eax
  mov    %ax,0x12(%rsp)
  lea    (%rdx,%r15,1),%eax
  add    %r9d,%eax
  movslq %eax,%rdx
  imul   $0xffffffff92492493,%rdx,%rdx
  shr    $0x20,%rdx
  add    %edx,%eax
  sar    $0x2,%eax
  mov    %eax,%r12d
  lea    (%r14,%rcx,2),%eax
  movzbl %bl,%ecx
  movzbl 0x38(%rsp),%ebx
  movslq %eax,%rdx
  mov    %cx,0x50(%rsp)
  neg    %r12d
  imul   $0xffffffff92492493,%rdx,%rdx
  mov    %r11b,0x38(%rsp)
  shr    $0x20,%rdx
  lea    (%rax,%rdx,1),%r15d
  sar    $0x2,%r15d
  neg    %r15d
  xor    %r14d,%r14d
  xor    %edi,%edi
  xor    %r9d,%r9d
  nopw   0x0(%rax,%rax,1)
L116:
  test   %esi,%esi
  jle    L281
  mov    (%rsp),%rcx
  movzbl %r14b,%eax
  movzbl 0x10(%rsp),%r11d
  xor    %edx,%edx
  shl    $0x2,%r9d
  lea    (%rcx,%rax,4),%r10
  xor    %ecx,%ecx
  jmp    L760
  nopl   0x0(%rax)
L1047:
  sub    %r11d,%eax
  xor    %r8d,%r8d
L1008:
  cwtl
  movslq %edx,%rdx
  add    $0x1,%ecx
  imul   %eax,%eax
  mov    %r8b,0x70(%rsp,%rdx,1)
  movzbl %cl,%edx
  add    %eax,%edi
  cmp    %esi,%edx
  jge    L281
L760:
  movslq %edx,%rax
  add    %r9d,%edx
  movzbl (%r10,%rax,1),%eax
  cmp    %bpl,%al
  ja     L1047
  cmp    %r13b,%al
  jbe    L232
  add    %r15d,%eax
  mov    $0x2,%r8d
  jmp    L1008
L145:
  mov    (%rsp),%rax
  mov    0x20(%rsp),%rbx
  xor    %r11d,%r11d
  movzbl (%rax),%eax
  movl   $0x0,0x2(%rbx)
  mov    %r11w,0x6(%rbx)
  mov    %al,(%rbx)
L320:
  mov    0xa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L817
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L232:
  cmp    %bl,%al
  jbe    L713
  add    %r12d,%eax
  mov    $0x3,%r8d
  jmp    L1008
  nopw   0x0(%rax,%rax,1)
L713:
  cmp    0xf(%rsp),%al
  jbe    L525
  add    0x12(%rsp),%ax
  mov    $0x4,%r8d
  jmp    L1008
  nopw   0x0(%rax,%rax,1)
L281:
  add    $0x1,%r14d
  movzbl %r14b,%r9d
  cmp    0x8(%rsp),%r9d
  jl     L116
  movzbl 0x38(%rsp),%r11d
  movzbl 0x44(%rsp),%r10d
  cmp    $0x1f,%edi
  jbe    L1039
  movzbl %r11b,%eax
  movzbl %r10b,%ecx
  mov    0x28(%rsp),%rdx
  mov    $0xcccccccd,%r8d
  mov    %eax,%ebx
  mov    %eax,0x14(%rsp)
  sub    %ecx,%ebx
  mov    %ecx,0x30(%rsp)
  lea    (%rcx,%rcx,8),%ecx
  mov    %ebx,0x50(%rsp)
  lea    (%rbx,%rbx,1),%r9d
  lea    0x5(%rdx),%rbx
  add    %eax,%ecx
  mov    %rbx,0x38(%rsp)
L28:
  mov    %ecx,%eax
  add    $0x1,%rdx
  add    %r9d,%ecx
  imul   %r8,%rax
  shr    $0x23,%rax
  mov    %al,-0x1(%rdx)
  cmp    %rbx,%rdx
  jne    L28
  movzbl 0x6b(%rsp),%eax
  mov    0x30(%rsp),%ebx
  mov    %edi,0x40(%rsp)
  xor    %r9d,%r9d
  mov    0x14(%rsp),%r14d
  movzbl 0x69(%rsp),%ebp
  mov    %al,0xf(%rsp)
  movzbl 0x6c(%rsp),%eax
  lea    (%rbx,%rbx,1),%ecx
  movzbl 0x6a(%rsp),%r13d
  mov    (%rsp),%rdi
  mov    %al,0x12(%rsp)
  movzbl 0x6d(%rsp),%eax
  mov    %al,0x36(%rsp)
  lea    (%rbx,%r14,4),%eax
  cltq
  imul   $0x66666667,%rax,%rax
  sar    $0x21,%rax
  neg    %eax
  mov    %ax,0x44(%rsp)
  lea    (%r14,%r14,1),%eax
  lea    (%rax,%r14,1),%edx
  add    %ecx,%edx
  add    %ebx,%ecx
  add    %ecx,%eax
  movslq %edx,%rdx
  cltq
  imul   $0x66666667,%rdx,%rdx
  imul   $0x66666667,%rax,%rax
  sar    $0x21,%rdx
  sar    $0x21,%rax
  neg    %edx
  neg    %eax
  mov    %dx,0x34(%rsp)
  mov    %ax,0x10(%rsp)
  lea    (%r14,%rbx,4),%eax
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  cltq
  imul   $0x66666667,%rax,%rax
  sar    $0x21,%rax
  mov    %eax,%r15d
  movzbl %r11b,%eax
  mov    %ax,0x5c(%rsp)
  neg    %r15d
  nop
L908:
  test   %esi,%esi
  jle    L1027
  movzbl %bl,%eax
  shl    $0x2,%r9d
  xor    %ecx,%ecx
  movzbl %r10b,%r12d
  lea    (%rdi,%rax,4),%r11
  xor    %eax,%eax
  jmp    L643
  nopl   (%rax)
L882:
  sub    %r12d,%r8d
  movswl %r8w,%r8d
  imul   %r8d,%r8d
  add    %r8d,%r14d
  xor    %r8d,%r8d
  nopl   0x0(%rax)
L744:
  cltq
  add    $0x1,%ecx
  mov    %r8b,0x80(%rsp,%rax,1)
  movzbl %cl,%eax
  cmp    %esi,%eax
  jge    L1027
L643:
  movslq %eax,%rdx
  mov    $0x6,%r8d
  add    %r9d,%eax
  movzbl (%r11,%rdx,1),%edx
  test   %dl,%dl
  je     L744
  mov    $0x7,%r8d
  cmp    $0xff,%dl
  je     L744
  movzbl %dl,%r8d
  cmp    %bpl,%dl
  jbe    L882
  cmp    %r13b,%dl
  ja     L448
  add    %r15d,%r8d
  movswl %r8w,%r8d
  imul   %r8d,%r8d
  add    %r8d,%r14d
  mov    $0x2,%r8d
  jmp    L744
  nopl   0x0(%rax)
L525:
  cmp    0x14(%rsp),%al
  jbe    L306
  add    0x30(%rsp),%ax
  mov    $0x5,%r8d
  jmp    L1008
  nopw   0x0(%rax,%rax,1)
L1027:
  add    $0x1,%ebx
  movzbl %bl,%r9d
  cmp    0x8(%rsp),%r9d
  jl     L908
  mov    0x40(%rsp),%edi
  cmp    $0x60,%r14d
  jbe    L369
  cmp    $0x60,%edi
  jbe    L369
  movslq 0x50(%rsp),%rax
  mov    (%rsp),%r11
  xor    %r10d,%r10d
  xor    %r12d,%r12d
  mov    0x8(%rsp),%r9d
  mov    $0xff,%r8d
  mov    %rax,%rbx
  imul   $0xffffffff92492493,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x1f,%ebx
  sar    $0x4,%eax
  sub    %eax,%ebx
  lea    0xfe(%rbx),%ebp
  neg    %ebx
  nopl   0x0(%rax,%rax,1)
L31:
  test   %esi,%esi
  jle    L663
  movzbl %r12b,%eax
  xor    %edx,%edx
  lea    (%r11,%rax,4),%rcx
  xor    %eax,%eax
L415:
  movzbl (%rcx,%rax,1),%eax
  movswl %r10w,%r15d
  mov    %eax,%r13d
  cmp    %r15d,%eax
  jle    L651
  movzbl %al,%r15d
  cmp    %ebp,%eax
  cmovle %r15d,%r10d
L651:
  movswl %r8w,%r15d
  cmp    %r15d,%eax
  jge    L45
  cmp    %ebx,%eax
  cmovg  %r13d,%r8d
L45:
  add    $0x1,%edx
  movzbl %dl,%eax
  cmp    %esi,%eax
  jl     L415
L663:
  add    $0x1,%r12d
  movzbl %r12b,%eax
  cmp    %r9d,%eax
  jl     L31
  cmp    %r10w,%r8w
  jge    L721
  movswl %r10w,%ebx
  movswl %r8w,%r11d
  mov    %r8d,%r9d
  mov    %r8w,0x40(%rsp)
  lea    (%rbx,%r11,4),%edx
  lea    (%r11,%r11,1),%r8d
  mov    %r10w,0x44(%rsp)
  sar    %r9w
  movslq %edx,%rax
  sar    $0x1f,%edx
  lea    0xff(%rbx),%ebp
  movswl %r9w,%r9d
  imul   $0x66666667,%rax,%rax
  mov    %edx,%ecx
  lea    (%r8,%r11,1),%edx
  sar    %ebp
  sar    $0x21,%rax
  sub    %eax,%ecx
  lea    (%rbx,%rbx,1),%eax
  add    %eax,%edx
  mov    %cx,0x12(%rsp)
  add    %ebx,%eax
  movslq %edx,%rcx
  sar    $0x1f,%edx
  add    %r8d,%eax
  imul   $0x66666667,%rcx,%rcx
  sar    $0x21,%rcx
  sub    %ecx,%edx
  mov    %dx,0x36(%rsp)
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  sub    %edx,%eax
  mov    %ax,0x50(%rsp)
  lea    (%r11,%rbx,4),%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  sub    %edx,%eax
  mov    %ax,0x5e(%rsp)
L483:
  mov    %ebx,%r10d
  lea    (%r11,%r11,8),%edx
  mov    0x28(%rsp),%rcx
  sub    %r11d,%r10d
  mov    0x38(%rsp),%r11
  add    %ebx,%edx
  add    %r10d,%r10d
L80:
  movslq %edx,%rax
  mov    %edx,%r8d
  add    $0x1,%rcx
  add    %r10d,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%r8d
  sar    $0x22,%rax
  sub    %r8d,%eax
  mov    %al,-0x1(%rcx)
  cmp    %r11,%rcx
  jne    L80
  movzbl 0x6a(%rsp),%eax
  mov    %edi,0x54(%rsp)
  xor    %ebx,%ebx
  xor    %r10d,%r10d
  mov    %r14d,0x58(%rsp)
  mov    (%rsp),%r8
  xor    %r15d,%r15d
  xor    %r11d,%r11d
  mov    %al,0xf(%rsp)
  movzbl 0x6b(%rsp),%eax
  xor    %r12d,%r12d
  movzbl 0x69(%rsp),%r13d
  movzwl 0x40(%rsp),%r14d
  mov    %al,0x10(%rsp)
  movzbl 0x6c(%rsp),%eax
  mov    %al,0x34(%rsp)
  movzbl 0x6d(%rsp),%eax
  mov    %al,0x5c(%rsp)
  nopl   0x0(%rax,%rax,1)
L450:
  test   %esi,%esi
  jle    L402
  movzbl %r12b,%eax
  xor    %edx,%edx
  lea    (%r8,%rax,4),%rdi
  xor    %eax,%eax
  jmp    L528
  nopw   0x0(%rax,%rax,1)
L223:
  sub    %r14d,%ecx
  add    $0x1,%r10d
  add    %ecx,%r11d
  nopw   0x0(%rax,%rax,1)
L90:
  add    $0x1,%eax
  movzbl %al,%edx
  cmp    %esi,%edx
  jge    L402
L528:
  movzbl (%rdi,%rdx,1),%ecx
  mov    %ecx,%edx
  cmp    %r9d,%ecx
  jle    L90
  cmp    %ebp,%ecx
  jg     L90
  movzbl %cl,%ecx
  cmp    %r13b,%dl
  jbe    L223
  add    $0x1,%ebx
  cmp    0xf(%rsp),%dl
  ja     L666
  add    $0x1,%eax
  add    0x12(%rsp),%cx
  add    $0x1,%r10d
  movzbl %al,%edx
  add    %ecx,%r11d
  add    %ecx,%r15d
  cmp    %esi,%edx
  jl     L528
  nop
L402:
  add    $0x1,%r12d
  movzbl %r12b,%eax
  cmp    0x8(%rsp),%eax
  jl     L450
  test   %r10b,%r10b
  mov    $0x1,%ecx
  movswl %r11w,%eax
  mov    0x54(%rsp),%edi
  cmovne %r10d,%ecx
  cltd
  mov    0x58(%rsp),%r14d
  movzbl %cl,%ecx
  idiv   %ecx
  mov    %eax,%ecx
  mov    $0x0,%eax
  add    0x40(%rsp),%cx
  cmovns %ecx,%eax
  test   %bl,%bl
  mov    $0x1,%ecx
  cmovne %ebx,%ecx
  movzwl 0x44(%rsp),%ebx
  movswl %ax,%r9d
  movswl %r15w,%eax
  movzbl %cl,%ecx
  cltd
  mov    %r9w,0x36(%rsp)
  idiv   %ecx
  mov    0x28(%rsp),%rcx
  lea    (%r9,%r9,4),%edx
  add    %eax,%ebx
  mov    $0xff,%eax
  cmp    %ax,%bx
  cmovle %ebx,%eax
  mov    0x38(%rsp),%rbx
  movswl %ax,%r10d
  mov    %ax,0x40(%rsp)
  mov    %r10d,%eax
  sub    %r9d,%eax
  lea    (%rax,%rax,1),%r8d
  lea    (%rax,%rdx,2),%edx
L407:
  movslq %edx,%rax
  mov    %edx,%r11d
  add    $0x1,%rcx
  add    %r8d,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%r11d
  sar    $0x22,%rax
  sub    %r11d,%eax
  mov    %al,-0x1(%rcx)
  cmp    %rbx,%rcx
  jne    L407
  lea    (%r10,%r10,1),%r8d
  movzwl 0x36(%rsp),%ebx
  mov    %edi,0x38(%rsp)
  xor    %r12d,%r12d
  lea    0xff(%r10),%edx
  movzbl 0x69(%rsp),%r13d
  mov    %r14d,0x44(%rsp)
  xor    %r11d,%r11d
  mov    %edx,%eax
  mov    %ebx,%ebp
  mov    %ebx,%r14d
  shr    $0x1f,%eax
  sar    %bp
  add    %edx,%eax
  lea    (%r9,%r10,4),%edx
  movswl %bp,%ebp
  sar    %eax
  mov    %eax,%r15d
  movzbl 0x6a(%rsp),%eax
  mov    %al,0xf(%rsp)
  movzbl 0x6b(%rsp),%eax
  mov    %al,0x12(%rsp)
  movzbl 0x6c(%rsp),%eax
  mov    %al,0x28(%rsp)
  movzbl 0x6d(%rsp),%eax
  mov    %al,0x50(%rsp)
  movslq %edx,%rax
  sar    $0x1f,%edx
  imul   $0x66666667,%rax,%rax
  mov    %edx,%ecx
  lea    (%r8,%r10,1),%edx
  sar    $0x21,%rax
  sub    %eax,%ecx
  lea    (%r9,%r9,1),%eax
  add    %eax,%edx
  mov    %cx,0x54(%rsp)
  add    %r9d,%eax
  movslq %edx,%rcx
  sar    $0x1f,%edx
  add    %r8d,%eax
  imul   $0x66666667,%rcx,%rcx
  sar    $0x21,%rcx
  sub    %ecx,%edx
  mov    %dx,0x5c(%rsp)
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  sub    %edx,%eax
  mov    %ax,0x34(%rsp)
  lea    (%r10,%r9,4),%eax
  xor    %r10d,%r10d
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  sub    %edx,%eax
  mov    %ax,0x10(%rsp)
  nopl   0x0(%rax)
L972:
  test   %esi,%esi
  jle    L302
  mov    (%rsp),%rbx
  movzbl %r12b,%eax
  lea    0x0(,%r11,4),%r9d
  xor    %ecx,%ecx
  mov    $0xff,%r11d
  lea    (%rbx,%rax,4),%rbx
  xor    %eax,%eax
  jmp    L184
L803:
  mov    %r11d,%edx
  sub    %r8d,%edx
  mov    $0x7,%r8d
  movzwl %dx,%edx
L115:
  imul   %edx,%edx
  cltq
  add    $0x1,%ecx
  mov    %r8b,0x90(%rsp,%rax,1)
  movzbl %cl,%eax
  add    %edx,%r10d
  cmp    %esi,%eax
  jge    L302
L184:
  movslq %eax,%rdx
  mov    $0x6,%r8d
  add    %r9d,%eax
  movzbl (%rbx,%rdx,1),%edx
  cmp    %ebp,%edx
  jle    L115
  movzbl %dl,%r8d
  cmp    %r15d,%edx
  jg     L803
  cmp    %r13b,%dl
  ja     L990
  sub    %r14d,%r8d
  movswl %r8w,%edx
  xor    %r8d,%r8d
  jmp    L115
  nop
L448:
  cmp    0xf(%rsp),%dl
  ja     L522
  movzwl 0x10(%rsp),%edx
  add    %r8d,%edx
  mov    $0x3,%r8d
  movswl %dx,%edx
  imul   %edx,%edx
  add    %edx,%r14d
  jmp    L744
  nopw   0x0(%rax,%rax,1)
L306:
  cmp    0x34(%rsp),%al
  jbe    L596
  add    0x36(%rsp),%ax
  mov    $0x6,%r8d
  jmp    L1008
  xchg   %ax,%ax
L522:
  cmp    0x12(%rsp),%dl
  ja     L425
  movzwl 0x34(%rsp),%edx
  add    %r8d,%edx
  mov    $0x4,%r8d
  movswl %dx,%edx
  imul   %edx,%edx
  add    %edx,%r14d
  jmp    L744
  nopw   0x0(%rax,%rax,1)
L596:
  cmp    0x40(%rsp),%al
  jbe    L564
  add    0x5c(%rsp),%ax
  mov    $0x7,%r8d
  jmp    L1008
L425:
  cmp    0x36(%rsp),%dl
  ja     L61
  movzwl 0x44(%rsp),%edx
  add    %r8d,%edx
  mov    $0x5,%r8d
  movswl %dx,%edx
  imul   %edx,%edx
  add    %edx,%r14d
  jmp    L744
L564:
  sub    0x50(%rsp),%ax
  mov    $0x1,%r8d
  jmp    L1008
L1039:
  mov    0x48(%rsp),%rcx
  mov    0x18(%rsp),%edx
  xor    %eax,%eax
  mov    0x1c(%rsp),%esi
  mov    0x20(%rsp),%rdi
  call   <util_format_unsigned_write_rgtc_encoded_channel@plt>
  jmp    L320
L61:
  sub    0x5c(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x1,%r8d
  imul   %edx,%edx
  add    %edx,%r14d
  jmp    L744
L369:
  cmp    %r14d,%edi
  jbe    L1039
L955:
  mov    0x14(%rsp),%edx
  mov    0x30(%rsp),%esi
  xor    %eax,%eax
  lea    0x80(%rsp),%rcx
  mov    0x20(%rsp),%rdi
  call   <util_format_unsigned_write_rgtc_encoded_channel@plt>
  jmp    L320
  nop
L990:
  cmp    0xf(%rsp),%dl
  ja     L755
  add    0x10(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x2,%r8d
  jmp    L115
  nopl   0x0(%rax,%rax,1)
L302:
  add    $0x1,%r12d
  movzbl %r12b,%r11d
  cmp    0x8(%rsp),%r11d
  jl     L972
  mov    0x44(%rsp),%r14d
  mov    0x38(%rsp),%edi
  cmp    %r14d,%r10d
  mov    %r14d,%eax
  cmovbe %r10d,%eax
  cmp    %edi,%eax
  jae    L1039
  cmp    %r14d,%r10d
  jae    L955
  movzbl 0x40(%rsp),%edx
  movzbl 0x36(%rsp),%esi
  xor    %eax,%eax
  lea    0x90(%rsp),%rcx
  mov    0x20(%rsp),%rdi
  call   <util_format_unsigned_write_rgtc_encoded_channel@plt>
  jmp    L320
  cs nopw 0x0(%rax,%rax,1)
L755:
  cmp    0x12(%rsp),%dl
  ja     L768
  add    0x34(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x3,%r8d
  jmp    L115
  nopl   0x0(%rax,%rax,1)
L666:
  cmp    0x10(%rsp),%dl
  ja     L566
  add    0x36(%rsp),%cx
  add    $0x1,%r10d
  add    %ecx,%r11d
  add    %ecx,%r15d
  jmp    L90
L768:
  cmp    0x28(%rsp),%dl
  ja     L837
  add    0x5c(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x4,%r8d
  jmp    L115
L566:
  cmp    0x34(%rsp),%dl
  ja     L869
  add    0x50(%rsp),%cx
  add    $0x1,%r10d
  add    %ecx,%r11d
  add    %ecx,%r15d
  jmp    L90
L837:
  cmp    0x50(%rsp),%dl
  ja     L268
  add    0x54(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x5,%r8d
  jmp    L115
L869:
  cmp    0x5c(%rsp),%dl
  ja     L574
  add    0x5e(%rsp),%cx
  add    $0x1,%r10d
  add    %ecx,%r11d
  add    %ecx,%r15d
  jmp    L90
L268:
  sub    0x40(%rsp),%r8w
  movswl %r8w,%edx
  mov    $0x1,%r8d
  jmp    L115
L574:
  sub    0x44(%rsp),%cx
  add    %ecx,%r15d
  jmp    L90
L721:
  mov    $0xffffffcd,%r9d
  mov    $0xfe,%eax
  mov    $0xffffff35,%edx
  mov    $0xffffff68,%ecx
  mov    $0xffffff9a,%r8d
  mov    $0x1,%r10d
  mov    %r9w,0x12(%rsp)
  mov    $0xfe,%ebp
  mov    %ax,0x44(%rsp)
  xor    %r9d,%r9d
  mov    $0xfe,%ebx
  mov    $0x1,%r11d
  mov    %dx,0x5e(%rsp)
  mov    %cx,0x50(%rsp)
  mov    %r8w,0x36(%rsp)
  mov    %r10w,0x40(%rsp)
  jmp    L483
L714:
  movl   $0x0,0x18(%rsp)
  xor    %ebx,%ebx
  jmp    L155
L60:
  movl   $0xff,0x1c(%rsp)
  movb   $0xff,0x10(%rsp)
  jmp    L619
L817:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void util_format_unsigned_encode_rgtc_ubyte(unsigned char *blkaddr, unsigned char srccolors[4][4], int numxpixels, int numypixels) {
  unsigned char alphabase[2], alphause[2];
  short alphatest[2] = {0};
  unsigned int alphablockerror1, alphablockerror2, alphablockerror3;
  unsigned char i, j, aindex, acutValues[7];
  unsigned char alphaenc1[16], alphaenc2[16], alphaenc3[16];
  int alphaabsmin = 0, alphaabsmax = 0;
  short alphadist;
  alphabase[0] = 0xff;
  alphabase[1] = 0;
  for (j = 0; j < numypixels; j++) {
    for (i = 0; i < numxpixels; i++) {
      if (srccolors[j][i] == 0)
        alphaabsmin = 1;
      else if (srccolors[j][i] == 0xff)
        alphaabsmax = 1;
      else {
        if (srccolors[j][i] > alphabase[1])
          alphabase[1] = srccolors[j][i];
        if (srccolors[j][i] < alphabase[0])
          alphabase[0] = srccolors[j][i];
      }
    }
  }
  if (((alphabase[0] > alphabase[1]) && !(alphaabsmin && alphaabsmax)) || (alphabase[0] == alphabase[1] && !alphaabsmin && !alphaabsmax)) {
    *blkaddr++ = srccolors[0][0];
    blkaddr++;
    *blkaddr++ = 0;
    *blkaddr++ = 0;
    *blkaddr++ = 0;
    *blkaddr++ = 0;
    *blkaddr++ = 0;
    *blkaddr++ = 0;
    return;
  }
  alphablockerror1 = 0x0;
  alphablockerror2 = 0xffffffff;
  alphablockerror3 = 0xffffffff;
  if (alphaabsmin)
    alphause[0] = 0;
  else
    alphause[0] = alphabase[0];
  if (alphaabsmax)
    alphause[1] = 0xff;
  else
    alphause[1] = alphabase[1];
  for (aindex = 0; aindex < 7; aindex++) {
    acutValues[aindex] = (alphause[0] * (2 * aindex + 1) + alphause[1] * (14 - (2 * aindex + 1))) / 14;
  }
  for (j = 0; j < numypixels; j++) {
    for (i = 0; i < numxpixels; i++) {
      if (srccolors[j][i] > acutValues[0]) {
        alphaenc1[4 * j + i] = 0;
        alphadist = srccolors[j][i] - alphause[1];
      } else if (srccolors[j][i] > acutValues[1]) {
        alphaenc1[4 * j + i] = 2;
        alphadist = srccolors[j][i] - (alphause[1] * 6 + alphause[0] * 1) / 7;
      } else if (srccolors[j][i] > acutValues[2]) {
        alphaenc1[4 * j + i] = 3;
        alphadist = srccolors[j][i] - (alphause[1] * 5 + alphause[0] * 2) / 7;
      } else if (srccolors[j][i] > acutValues[3]) {
        alphaenc1[4 * j + i] = 4;
        alphadist = srccolors[j][i] - (alphause[1] * 4 + alphause[0] * 3) / 7;
      } else if (srccolors[j][i] > acutValues[4]) {
        alphaenc1[4 * j + i] = 5;
        alphadist = srccolors[j][i] - (alphause[1] * 3 + alphause[0] * 4) / 7;
      } else if (srccolors[j][i] > acutValues[5]) {
        alphaenc1[4 * j + i] = 6;
        alphadist = srccolors[j][i] - (alphause[1] * 2 + alphause[0] * 5) / 7;
      } else if (srccolors[j][i] > acutValues[6]) {
        alphaenc1[4 * j + i] = 7;
        alphadist = srccolors[j][i] - (alphause[1] * 1 + alphause[0] * 6) / 7;
      } else {
        alphaenc1[4 * j + i] = 1;
        alphadist = srccolors[j][i] - alphause[0];
      }
      alphablockerror1 += alphadist * alphadist;
    }
  }
  if (alphablockerror1 >= 32) {
    alphablockerror2 = 0;
    for (aindex = 0; aindex < 5; aindex++) {
      acutValues[aindex] = (alphabase[0] * (10 - (2 * aindex + 1)) + alphabase[1] * (2 * aindex + 1)) / 10;
    }
    for (j = 0; j < numypixels; j++) {
      for (i = 0; i < numxpixels; i++) {
        if (srccolors[j][i] == 0) {
          alphaenc2[4 * j + i] = 6;
          alphadist = 0;
        } else if (srccolors[j][i] == 0xff) {
          alphaenc2[4 * j + i] = 7;
          alphadist = 0;
        } else if (srccolors[j][i] <= acutValues[0]) {
          alphaenc2[4 * j + i] = 0;
          alphadist = srccolors[j][i] - alphabase[0];
        } else if (srccolors[j][i] <= acutValues[1]) {
          alphaenc2[4 * j + i] = 2;
          alphadist = srccolors[j][i] - (alphabase[0] * 4 + alphabase[1] * 1) / 5;
        } else if (srccolors[j][i] <= acutValues[2]) {
          alphaenc2[4 * j + i] = 3;
          alphadist = srccolors[j][i] - (alphabase[0] * 3 + alphabase[1] * 2) / 5;
        } else if (srccolors[j][i] <= acutValues[3]) {
          alphaenc2[4 * j + i] = 4;
          alphadist = srccolors[j][i] - (alphabase[0] * 2 + alphabase[1] * 3) / 5;
        } else if (srccolors[j][i] <= acutValues[4]) {
          alphaenc2[4 * j + i] = 5;
          alphadist = srccolors[j][i] - (alphabase[0] * 1 + alphabase[1] * 4) / 5;
        } else {
          alphaenc2[4 * j + i] = 1;
          alphadist = srccolors[j][i] - alphabase[1];
        }
        alphablockerror2 += alphadist * alphadist;
      }
    }
    if ((alphablockerror2 > 96) && (alphablockerror1 > 96)) {
      short blockerrlin1 = 0;
      short blockerrlin2 = 0;
      unsigned char nralphainrangelow = 0;
      unsigned char nralphainrangehigh = 0;
      alphatest[0] = 0xff;
      alphatest[1] = 0;
      for (j = 0; j < numypixels; j++) {
        for (i = 0; i < numxpixels; i++) {
          if ((srccolors[j][i] > alphatest[1]) && (srccolors[j][i] < (0xff - (alphabase[1] - alphabase[0]) / 28)))
            alphatest[1] = srccolors[j][i];
          if ((srccolors[j][i] < alphatest[0]) && (srccolors[j][i] > (alphabase[1] - alphabase[0]) / 28))
            alphatest[0] = srccolors[j][i];
        }
      }
      if (alphatest[1] <= alphatest[0]) {
        alphatest[0] = 0 + 1;
        alphatest[1] = 0xff - 1;
      }
      for (aindex = 0; aindex < 5; aindex++) {
        acutValues[aindex] = (alphatest[0] * (10 - (2 * aindex + 1)) + alphatest[1] * (2 * aindex + 1)) / 10;
      }
      for (j = 0; j < numypixels; j++) {
        for (i = 0; i < numxpixels; i++) {
          if (srccolors[j][i] <= alphatest[0] / 2) {
          } else if (srccolors[j][i] > ((0xff + alphatest[1]) / 2)) {
          } else if (srccolors[j][i] <= acutValues[0]) {
            blockerrlin1 += (srccolors[j][i] - alphatest[0]);
            nralphainrangelow += 1;
          } else if (srccolors[j][i] <= acutValues[1]) {
            blockerrlin1 += (srccolors[j][i] - (alphatest[0] * 4 + alphatest[1] * 1) / 5);
            blockerrlin2 += (srccolors[j][i] - (alphatest[0] * 4 + alphatest[1] * 1) / 5);
            nralphainrangelow += 1;
            nralphainrangehigh += 1;
          } else if (srccolors[j][i] <= acutValues[2]) {
            blockerrlin1 += (srccolors[j][i] - (alphatest[0] * 3 + alphatest[1] * 2) / 5);
            blockerrlin2 += (srccolors[j][i] - (alphatest[0] * 3 + alphatest[1] * 2) / 5);
            nralphainrangelow += 1;
            nralphainrangehigh += 1;
          } else if (srccolors[j][i] <= acutValues[3]) {
            blockerrlin1 += (srccolors[j][i] - (alphatest[0] * 2 + alphatest[1] * 3) / 5);
            blockerrlin2 += (srccolors[j][i] - (alphatest[0] * 2 + alphatest[1] * 3) / 5);
            nralphainrangelow += 1;
            nralphainrangehigh += 1;
          } else if (srccolors[j][i] <= acutValues[4]) {
            blockerrlin1 += (srccolors[j][i] - (alphatest[0] * 1 + alphatest[1] * 4) / 5);
            blockerrlin2 += (srccolors[j][i] - (alphatest[0] * 1 + alphatest[1] * 4) / 5);
            nralphainrangelow += 1;
            nralphainrangehigh += 1;
          } else {
            blockerrlin2 += (srccolors[j][i] - alphatest[1]);
            nralphainrangehigh += 1;
          }
        }
      }
      if (nralphainrangelow == 0)
        nralphainrangelow = 1;
      if (nralphainrangehigh == 0)
        nralphainrangehigh = 1;
      alphatest[0] = alphatest[0] + (blockerrlin1 / nralphainrangelow);
      if (alphatest[0] < 0) {
        alphatest[0] = 0;
      }
      alphatest[1] = alphatest[1] + (blockerrlin2 / nralphainrangehigh);
      if (alphatest[1] > 0xff) {
        alphatest[1] = 0xff;
      }
      alphablockerror3 = 0;
      for (aindex = 0; aindex < 5; aindex++) {
        acutValues[aindex] = (alphatest[0] * (10 - (2 * aindex + 1)) + alphatest[1] * (2 * aindex + 1)) / 10;
      }
      for (j = 0; j < numypixels; j++) {
        for (i = 0; i < numxpixels; i++) {
          if (srccolors[j][i] <= alphatest[0] / 2) {
            alphaenc3[4 * j + i] = 6;
            alphadist = srccolors[j][i];
          } else if (srccolors[j][i] > ((0xff + alphatest[1]) / 2)) {
            alphaenc3[4 * j + i] = 7;
            alphadist = 0xff - srccolors[j][i];
          } else if (srccolors[j][i] <= acutValues[0]) {
            alphaenc3[4 * j + i] = 0;
            alphadist = srccolors[j][i] - alphatest[0];
          } else if (srccolors[j][i] <= acutValues[1]) {
            alphaenc3[4 * j + i] = 2;
            alphadist = srccolors[j][i] - (alphatest[0] * 4 + alphatest[1] * 1) / 5;
          } else if (srccolors[j][i] <= acutValues[2]) {
            alphaenc3[4 * j + i] = 3;
            alphadist = srccolors[j][i] - (alphatest[0] * 3 + alphatest[1] * 2) / 5;
          } else if (srccolors[j][i] <= acutValues[3]) {
            alphaenc3[4 * j + i] = 4;
            alphadist = srccolors[j][i] - (alphatest[0] * 2 + alphatest[1] * 3) / 5;
          } else if (srccolors[j][i] <= acutValues[4]) {
            alphaenc3[4 * j + i] = 5;
            alphadist = srccolors[j][i] - (alphatest[0] * 1 + alphatest[1] * 4) / 5;
          } else {
            alphaenc3[4 * j + i] = 1;
            alphadist = srccolors[j][i] - alphatest[1];
          }
          alphablockerror3 += alphadist * alphadist;
        }
      }
    }
  }
  if ((alphablockerror1 <= alphablockerror2) && (alphablockerror1 <= alphablockerror3)) {
    util_format_unsigned_write_rgtc_encoded_channel(blkaddr, alphause[1], alphause[0], alphaenc1);
  } else if (alphablockerror2 <= alphablockerror3) {
    util_format_unsigned_write_rgtc_encoded_channel(blkaddr, alphabase[0], alphabase[1], alphaenc2);
  } else {
    util_format_unsigned_write_rgtc_encoded_channel(blkaddr, (unsigned char)alphatest[0], (unsigned char)alphatest[1], alphaenc3);
  }
}
```