	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vivid_fb_setcolreg
_vivid_fb_setcolreg:                    ## @vivid_fb_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	%rbx
	.cfi_offset %rbx, -24
	cmpl	%edi, 16(%r9)
	jbe	LBB0_1
## %bb.2:
	cmpl	$16, %edi
	jb	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_3:
	movl	%r8d, %r10d
	shll	$16, %r10d
	andl	$-16777216, %r10d               ## imm = 0xFF000000
	movl	%esi, %ebx
	shll	$8, %ebx
	andl	$16711680, %ebx                 ## imm = 0xFF0000
	movl	%edx, %eax
	andl	$65280, %eax                    ## imm = 0xFF00
	orl	%ebx, %eax
	movzbl	%ch, %ebx
	orl	%eax, %ebx
	orl	%r10d, %ebx
	movq	(%r9), %r10
	cmpl	$16, 8(%r9)
	jne	LBB0_8
## %bb.4:
	movl	12(%r9), %eax
	cmpl	$5, %eax
	je	LBB0_7
## %bb.5:
	cmpl	$6, %eax
	jne	LBB0_8
## %bb.6:
	andl	$63488, %esi                    ## imm = 0xF800
	shrl	$5, %edx
	andl	$2016, %edx                     ## imm = 0x7E0
	orl	%esi, %edx
	shrl	$11, %ecx
	andl	$31, %ecx
	orl	%edx, %ecx
	movl	%ecx, %ebx
	jmp	LBB0_8
LBB0_7:
	shrl	%esi
	andl	$31744, %esi                    ## imm = 0x7C00
	shrl	$6, %edx
	andl	$992, %edx                      ## imm = 0x3E0
	orl	%esi, %edx
	shrl	$11, %ecx
	andl	$31, %ecx
	orl	%edx, %ecx
	xorl	%ebx, %ebx
	testl	%r8d, %r8d
	setne	%bl
	shll	$15, %ebx
	orl	%ecx, %ebx
LBB0_8:
	movl	%edi, %eax
	movl	%ebx, (%r10,%rax,4)
	xorl	%eax, %eax
LBB0_9:
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_vivid_fb_setcolreg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vivid_fb_setcolreg
_vivid_fb_setcolreg:                    ; @vivid_fb_setcolreg
	.cfi_startproc
; %bb.0:
	ldr	w8, [x5, #16]
	cmp	w8, w0
	b.ls	LBB0_2
; %bb.1:
	cmp	w0, #16
	b.lo	LBB0_3
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	ret
LBB0_3:
	lsr	w8, w4, #8
	lsl	w9, w1, #8
	bfxil	w9, w2, #0, #16
	bfxil	w9, w3, #8, #8
	bfi	w9, w8, #24, #8
	ldr	x10, [x5]
	ldr	w8, [x5, #8]
	cmp	w8, #16
	b.ne	LBB0_5
; %bb.4:
	ldr	w8, [x5, #12]
	lsr	w11, w1, #1
	and	w11, w11, #0x7c00
	bfxil	w11, w2, #6, #10
	bfxil	w11, w3, #11, #5
	cmp	w4, #0
	cset	w12, ne
	bfi	w11, w12, #15, #1
	and	w12, w1, #0xf800
	bfxil	w12, w2, #5, #11
	bfxil	w12, w3, #11, #5
	cmp	w8, #6
	csel	w9, w9, w12, ne
	cmp	w8, #5
	csel	w9, w11, w9, eq
LBB0_5:
	str	w9, [x10, w0, uxtw #2]
	mov	w0, #0
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_vivid_fb_setcolreg
.subsections_via_symbols
