	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ivtvfb_setcolreg
_ivtvfb_setcolreg:                      ## @ivtvfb_setcolreg
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	%edi, 16(%r9)
	jbe	LBB0_1
## %bb.2:
	movl	%edi, %r14d
	shll	$16, %r8d
	andl	$-16777216, %r8d                ## imm = 0xFF000000
	movl	%esi, %eax
	shll	$8, %eax
	andl	$16711680, %eax                 ## imm = 0xFF0000
	movl	%edx, %edi
	andl	$65280, %edi                    ## imm = 0xFF00
	orl	%eax, %edi
	movzbl	%ch, %ebx
	orl	%edi, %ebx
	orl	%r8d, %ebx
	movl	8(%r9), %edi
	cmpl	$8, %edi
	jg	LBB0_4
## %bb.3:
	movq	24(%r9), %r15
	movl	%r14d, %edi
	movl	$10800, %esi                    ## imm = 0x2A30
	callq	_write_reg
	movl	%ebx, %edi
	movl	$10804, %esi                    ## imm = 0x2A34
	callq	_write_reg
	movq	(%r15), %rax
	movq	(%rax), %rax
	jmp	LBB0_14
LBB0_4:
	cmpl	$16, %r14d
	jb	LBB0_5
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_15
LBB0_5:
	movq	(%r9), %rax
	cmpl	$16, %edi
	jne	LBB0_14
## %bb.6:
	movl	12(%r9), %edi
	cmpl	$6, %edi
	je	LBB0_11
## %bb.7:
	cmpl	$5, %edi
	je	LBB0_10
## %bb.8:
	cmpl	$4, %edi
	jne	LBB0_14
## %bb.9:
	shrl	$4, %esi
	andl	$3840, %esi                     ## imm = 0xF00
	shrl	$8, %edx
	andl	$240, %edx
	orl	%esi, %edx
	shrl	$12, %ecx
	andl	$15, %ecx
	jmp	LBB0_13
LBB0_11:
	andl	$63488, %esi                    ## imm = 0xF800
	shrl	$5, %edx
	andl	$2016, %edx                     ## imm = 0x7E0
	jmp	LBB0_12
LBB0_10:
	shrl	%esi
	andl	$31744, %esi                    ## imm = 0x7C00
	shrl	$6, %edx
	andl	$992, %edx                      ## imm = 0x3E0
LBB0_12:
	orl	%esi, %edx
	shrl	$11, %ecx
	andl	$31, %ecx
LBB0_13:
	orl	%edx, %ecx
	movl	%ecx, %ebx
LBB0_14:
	movl	%r14d, %ecx
	movl	%ebx, (%rax,%rcx,4)
	xorl	%eax, %eax
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_ivtvfb_setcolreg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ivtvfb_setcolreg
_ivtvfb_setcolreg:                      ; @ivtvfb_setcolreg
	.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
	ldr	w8, [x5, #16]
	cmp	w8, w0
	b.ls	LBB0_4
; %bb.1:
	mov	x19, x0
	lsr	w8, w4, #8
	lsl	w20, w1, #8
	bfxil	w20, w2, #0, #16
	bfxil	w20, w3, #8, #8
	bfi	w20, w8, #24, #8
	ldr	w9, [x5, #8]
	cmp	w9, #8
	b.gt	LBB0_3
; %bb.2:
	ldr	x21, [x5, #24]
	mov	x0, x19
	mov	w1, #10800
	bl	_write_reg
	mov	x0, x20
	mov	w1, #10804
	bl	_write_reg
	mov	w0, #0
	ldr	x8, [x21]
	ldr	x8, [x8]
	b	LBB0_8
LBB0_3:
	cmp	w19, #16
	b.lo	LBB0_5
LBB0_4:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_5:
	ldr	x8, [x5]
	cmp	w9, #16
	b.ne	LBB0_7
; %bb.6:
	ldr	w9, [x5, #12]
	and	w10, w1, #0xf800
	bfxil	w10, w2, #5, #11
	bfxil	w10, w3, #11, #5
	lsr	w11, w1, #1
	and	w11, w11, #0x7c00
	bfxil	w11, w2, #6, #10
	bfxil	w11, w3, #11, #5
	lsr	w12, w1, #4
	and	w12, w12, #0xf00
	bfxil	w12, w2, #8, #8
	bfxil	w12, w3, #12, #4
	cmp	w9, #4
	csel	w12, w20, w12, ne
	cmp	w9, #5
	csel	w11, w11, w12, eq
	cmp	w9, #6
	csel	w20, w10, w11, eq
LBB0_7:
	mov	w0, #0
LBB0_8:
	str	w20, [x8, w19, uxtw #2]
LBB0_9:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_ivtvfb_setcolreg
.subsections_via_symbols
