	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fetch_2d_texel_rgba_dxt5       ## -- Begin function fetch_2d_texel_rgba_dxt5
	.p2align	4, 0x90
_fetch_2d_texel_rgba_dxt5:              ## @fetch_2d_texel_rgba_dxt5
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r9d
                                        ## kill: def $edi killed $edi def $rdi
	leal	3(%rdi), %ecx
	addl	$6, %edi
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edi
	shrl	$2, %edi
	leal	3(%r9), %ecx
	testl	%r9d, %r9d
	cmovnsl	%r9d, %ecx
	movq	%r8, %r14
                                        ## kill: def $edx killed $edx def $rdx
	shrl	$2, %ecx
	imull	%edi, %ecx
	leal	3(%rdx), %edi
	testl	%edx, %edx
	cmovnsl	%edx, %edi
	shrl	$2, %edi
	addl	%ecx, %edi
	shll	$4, %edi
	movslq	%edi, %rdi
	leaq	(%rsi,%rdi,4), %r8
	andl	$3, %r9d
	andl	$3, %edx
	leal	(%rdx,%r9,4), %ecx
	leal	(%rcx,%rcx,2), %ecx
	movl	%ecx, %ebx
	shrl	$3, %ebx
	movl	8(%r8,%rbx,4), %eax
	movl	12(%r8,%rbx,4), %r15d
	andb	$7, %cl
	sarl	%cl, %eax
	movb	$8, %bl
	subb	%cl, %bl
	movl	%ebx, %ecx
	shll	%cl, %r15d
	movl	(%rsi,%rdi,4), %ebx
	movl	4(%rsi,%rdi,4), %r12d
	orl	%eax, %r15d
	leaq	(%rsi,%rdi,4), %rdi
	addq	$32, %rdi
	movl	%edx, %esi
	movl	%r9d, %edx
	movl	$2, %ecx
	movq	%r14, %r8
	callq	_dxt135_decode_imageblock
	andl	$7, %r15d
	je	LBB0_7
## %bb.1:
	cmpl	$1, %r15d
	jne	LBB0_3
## %bb.2:
	movl	%r12d, %ebx
	jmp	LBB0_7
LBB0_3:
	cmpl	%r12d, %ebx
	jle	LBB0_5
## %bb.4:
	movl	$8, %eax
	subl	%r15d, %eax
	imull	%ebx, %eax
	decl	%r15d
	imull	%r12d, %r15d
	addl	%eax, %r15d
	movslq	%r15d, %rbx
	imulq	$-1840700269, %rbx, %rax        ## imm = 0x92492493
	shrq	$32, %rax
	addl	%eax, %ebx
	movl	%ebx, %eax
	shrl	$31, %eax
	sarl	$2, %ebx
	addl	%eax, %ebx
	jmp	LBB0_7
LBB0_5:
	cmpl	$5, %r15d
	ja	LBB0_8
## %bb.6:
	movl	$6, %eax
	subl	%r15d, %eax
	imull	%ebx, %eax
	decl	%r15d
	imull	%r12d, %r15d
	addl	%eax, %r15d
	movslq	%r15d, %rax
	imulq	$1717986919, %rax, %rbx         ## imm = 0x66666667
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$33, %rbx
	addl	%eax, %ebx
LBB0_7:
	movl	%ebx, %edi
	callq	_UBYTE_TO_CHAN
LBB0_11:
	movq	_ACOMP@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, (%r14,%rcx,8)
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	cmpl	$6, %r15d
	je	LBB0_9
## %bb.10:
	movq	_CHAN_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	jmp	LBB0_11
LBB0_9:
	xorl	%eax, %eax
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_ACOMP,8,3                      ## @ACOMP
	.comm	_CHAN_MAX,8,3                   ## @CHAN_MAX
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fetch_2d_texel_rgba_dxt5       ; -- Begin function fetch_2d_texel_rgba_dxt5
	.p2align	2
_fetch_2d_texel_rgba_dxt5:              ; @fetch_2d_texel_rgba_dxt5
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x4
	add	w8, w0, #3
	add	w9, w0, #6
	cmp	w8, #0
	csel	w8, w9, w8, lt
	lsr	w8, w8, #2
	add	w9, w3, #3
	cmp	w3, #0
	csel	w9, w9, w3, lt
	lsr	w9, w9, #2
	mul	w8, w9, w8
	add	w9, w2, #3
	cmp	w2, #0
	csel	w9, w9, w2, lt
	add	w8, w8, w9, lsr #2
	lsl	w8, w8, #4
	add	x9, x1, w8, sxtw #2
	and	w8, w3, #0x3
	and	w1, w2, #0x3
	mov	x10, x1
	bfi	w10, w8, #2, #2
	add	w10, w10, w10, lsl #1
	lsr	w11, w10, #3
	add	w12, w11, #2
	ldr	w12, [x9, w12, uxtw #2]
	ldp	w21, w20, [x9]
	add	w11, w11, #3
	ldr	w11, [x9, w11, uxtw #2]
	and	w10, w10, #0x7
	asr	w12, w12, w10
	mov	w13, #8
	sub	w10, w13, w10
	lsl	w10, w11, w10
	orr	w10, w10, w12
	and	w22, w10, #0x7
	add	x0, x9, #32
	mov	x2, x8
	mov	w3, #2
	bl	_dxt135_decode_imageblock
	cbz	w22, LBB0_4
; %bb.1:
	subs	w8, w22, #1
	b.eq	LBB0_7
; %bb.2:
	cmp	w21, w20
	b.le	LBB0_5
; %bb.3:
	mov	w9, #8
	sub	w9, w9, w22
	mul	w8, w8, w20
	madd	w8, w9, w21, w8
	mov	w9, #9363
	movk	w9, #37449, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #2
	add	w20, w9, w8, lsr #31
	b	LBB0_7
LBB0_4:
	mov	x20, x21
	b	LBB0_7
LBB0_5:
	cmp	w22, #5
	b.hi	LBB0_9
; %bb.6:
	mov	w9, #6
	sub	w9, w9, w22
	mul	w8, w8, w20
	madd	w8, w9, w21, w8
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #33
	add	w20, w8, w9
LBB0_7:
	mov	x0, x20
	bl	_UBYTE_TO_CHAN
LBB0_8:
Lloh0:
	adrp	x8, _ACOMP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ACOMP@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x0, [x19, x8, lsl #3]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_9:
Lloh3:
	adrp	x8, _CHAN_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CHAN_MAX@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	w22, #6
	csel	x0, xzr, x8, eq
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_ACOMP,8,3                      ; @ACOMP
	.comm	_CHAN_MAX,8,3                   ; @CHAN_MAX
.subsections_via_symbols
