	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mga_crtc_load_lut
_mga_crtc_load_lut:                     ## @mga_crtc_load_lut
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 16(%rdi)
	je	LBB0_15
## %bb.1:
	movq	24(%rdi), %rax
	movq	(%rax), %rbx
	movq	8(%rdi), %r13
	movslq	(%rdi), %r12
	movq	_DAC_INDEX@GOTPCREL(%rip), %r14
	movq	_MGA1064_INDEX@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%r14), %rdi
	xorl	%esi, %esi
	callq	_WREG8
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.2:
	movq	(%rbx), %rax
	movq	(%rax), %rcx
	cmpl	$2, (%rcx)
	jne	LBB0_12
## %bb.3:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	8(%rax), %ecx
	xorl	%edx, %edx
	cmpl	$15, %ecx
	sete	%sil
	movq	_MGAG200_LUT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_15
## %bb.4:
	leaq	(,%r12,4), %rbx
	addq	%r13, %rbx
	leaq	(%rbx,%r12,4), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movb	%sil, %dl
	leal	4(,%rdx,4), %edx
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$16, %ecx
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	jne	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	sarl	%eax
	xorl	%esi, %esi
	cmpl	%eax, %r12d
	jle	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%r15d, %r15d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r13), %esi
	addq	$4, %r13
	sarl	$8, %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r15d
	addq	$4, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	sarl	$8, %r15d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r13), %esi
	sarl	$8, %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r15d
	sarl	$8, %r15d
	addq	$8, %r13
	addq	$8, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	_MGA1064_COL_PAL@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	addq	(%r14), %rdi
	callq	_WREG8
	movq	(%rbx), %rdi
	addq	(%r14), %rdi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %esi
	sarl	$8, %esi
	callq	_WREG8
	movq	_MGA1064_COL_PAL@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%r14), %rdi
	movl	%r15d, %esi
	callq	_WREG8
	addl	-60(%rbp), %r12d                ## 4-byte Folded Reload
	movq	_MGAG200_LUT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r12d
	jge	LBB0_15
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	addq	$4, %rbx
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movl	8(%rcx), %ecx
	jmp	LBB0_5
LBB0_12:
	movq	_MGAG200_LUT_SIZE@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_15
## %bb.13:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	_MGA1064_COL_PAL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	movq	%rcx, %r12
	addq	(%r14), %rdi
	leaq	4(%r13), %rcx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movl	(%r13), %esi
	sarl	$8, %esi
	callq	_WREG8
	movq	(%r12), %rdi
	addq	(%r14), %rdi
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movl	(%r13,%r12,4), %esi
	sarl	$8, %esi
	callq	_WREG8
	movq	_MGA1064_COL_PAL@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%r14), %rdi
	movl	(%r13,%r12,8), %esi
	sarl	$8, %esi
	callq	_WREG8
	incl	%ebx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	cmpl	(%r15), %ebx
	jl	LBB0_14
LBB0_15:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DAC_INDEX,8,3                  ## @DAC_INDEX
	.comm	_MGA1064_INDEX,8,3              ## @MGA1064_INDEX
	.comm	_MGAG200_LUT_SIZE,4,2           ## @MGAG200_LUT_SIZE
	.comm	_MGA1064_COL_PAL,8,3            ## @MGA1064_COL_PAL
	.no_dead_strip	_mga_crtc_load_lut
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mga_crtc_load_lut
_mga_crtc_load_lut:                     ; @mga_crtc_load_lut
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	w8, [x0, #16]
	cbz	w8, LBB0_15
; %bb.1:
	ldr	x8, [x0, #24]
	ldr	x22, [x8]
	ldr	x20, [x0, #8]
Lloh0:
	adrp	x21, _DAC_INDEX@GOTPAGE
Lloh1:
	ldr	x21, [x21, _DAC_INDEX@GOTPAGEOFF]
	ldrsw	x26, [x0]
	ldr	x8, [x21]
Lloh2:
	adrp	x9, _MGA1064_INDEX@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MGA1064_INDEX@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	add	x0, x9, x8
	mov	w1, #0
	bl	_WREG8
	cbz	x22, LBB0_12
; %bb.2:
	ldr	x8, [x22]
	ldr	x9, [x8]
	ldr	w9, [x9]
	cmp	w9, #2
	b.ne	LBB0_12
; %bb.3:
	ldr	w9, [x8, #8]
	mov	w8, #4
	mov	w10, #8
	cmp	w9, #15
	csel	w23, w10, w8, eq
Lloh5:
	adrp	x24, _MGAG200_LUT_SIZE@GOTPAGE
Lloh6:
	ldr	x24, [x24, _MGAG200_LUT_SIZE@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.4:
	mov	w25, #0
	lsl	x10, x26, #2
	add	x26, x20, x10
	add	x27, x26, x10
Lloh7:
	adrp	x28, _MGA1064_COL_PAL@GOTPAGE
Lloh8:
	ldr	x28, [x28, _MGA1064_COL_PAL@GOTPAGEOFF]
	cmp	w9, #16
	b.ne	LBB0_7
LBB0_5:
	cmp	w25, w8, asr #1
	b.le	LBB0_8
; %bb.6:
	mov	w1, #0
	mov	w19, #0
	b	LBB0_10
LBB0_7:
	ldr	w8, [x20], #4
	asr	w1, w8, #8
	ldr	w8, [x27], #4
	b	LBB0_9
LBB0_8:
	ldr	w8, [x20], #8
	asr	w1, w8, #8
	ldr	w8, [x27], #8
LBB0_9:
	asr	w19, w8, #8
LBB0_10:
	ldr	x8, [x21]
	ldr	x9, [x28]
	add	x0, x9, x8
	bl	_WREG8
	ldr	x8, [x21]
	ldr	x9, [x28]
	add	x0, x9, x8
	ldr	w8, [x26]
	asr	w1, w8, #8
	bl	_WREG8
	ldr	x8, [x21]
	ldr	x9, [x28]
	add	x0, x9, x8
	mov	x1, x19
	bl	_WREG8
	ldr	w8, [x24]
	add	w25, w25, w23
	cmp	w25, w8
	b.ge	LBB0_15
; %bb.11:
	add	x26, x26, #4
	ldr	x9, [x22]
	ldr	w9, [x9, #8]
	cmp	w9, #16
	b.ne	LBB0_7
	b	LBB0_5
LBB0_12:
Lloh9:
	adrp	x19, _MGAG200_LUT_SIZE@GOTPAGE
Lloh10:
	ldr	x19, [x19, _MGAG200_LUT_SIZE@GOTPAGEOFF]
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.13:
	mov	x22, #0
	add	x23, x20, x26, lsl #3
Lloh11:
	adrp	x24, _MGA1064_COL_PAL@GOTPAGE
Lloh12:
	ldr	x24, [x24, _MGA1064_COL_PAL@GOTPAGEOFF]
	add	x25, x20, x26, lsl #2
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	lsl	x26, x22, #2
	ldr	x8, [x21]
	ldr	x9, [x24]
	add	x0, x9, x8
	ldr	w8, [x20, x26]
	asr	w1, w8, #8
	bl	_WREG8
	ldr	x8, [x21]
	ldr	x9, [x24]
	add	x0, x9, x8
	ldr	w8, [x25, x26]
	asr	w1, w8, #8
	bl	_WREG8
	ldr	x8, [x21]
	ldr	x9, [x24]
	add	x0, x9, x8
	ldr	w8, [x23, x26]
	asr	w1, w8, #8
	bl	_WREG8
	ldr	w8, [x19]
	add	x22, x22, #1
	cmp	w22, w8
	b.lt	LBB0_14
LBB0_15:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_DAC_INDEX,8,3                  ; @DAC_INDEX
	.comm	_MGA1064_INDEX,8,3              ; @MGA1064_INDEX
	.comm	_MGAG200_LUT_SIZE,4,2           ; @MGAG200_LUT_SIZE
	.comm	_MGA1064_COL_PAL,8,3            ; @MGA1064_COL_PAL
	.no_dead_strip	_mga_crtc_load_lut
.subsections_via_symbols
