	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_color_update_m4                ## -- Begin function color_update_m4
	.p2align	4, 0x90
_color_update_m4:                       ## @color_update_m4
	.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
	pushq	%rax
	.cfi_offset %rbx, -24
	movl	%edi, %ebx
	movq	_system_hw@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	$128, %ecx
	je	LBB0_3
## %bb.1:
	movl	%esi, %edx
	cmpl	$129, %ecx
	jne	LBB0_5
## %bb.2:
	movl	%edx, %edi
	andl	$15, %edi
	movl	%edx, %esi
	shrl	$4, %esi
	andl	$15, %esi
	shrl	$8, %edx
	andl	$15, %edx
	callq	_MAKE_PIXEL
	jmp	LBB0_15
LBB0_3:
	movl	%ebx, %ecx
	movq	_tms_palette@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	andl	$15, %ecx
	je	LBB0_13
## %bb.4:
	movl	%ecx, %ecx
	jmp	LBB0_14
LBB0_5:
	movq	_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testb	$4, (%rax)
	jne	LBB0_11
## %bb.6:
	movq	_SYSTEM_MD@GOTPCREL(%rip), %rdi
	xorl	%esi, %esi
	testl	%ecx, (%rdi)
	jne	LBB0_12
## %bb.7:
	movq	_SYSTEM_GGMS@GOTPCREL(%rip), %rdi
	movl	%edx, %esi
	cmpl	(%rdi), %ecx
	je	LBB0_12
## %bb.8:
	movl	%ebx, %edx
	movq	_tms_crom@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	andl	$15, %edx
	jne	LBB0_10
## %bb.9:
	movl	28(%rax), %edx
	andl	$15, %edx
LBB0_10:
	movl	%edx, %eax
	movl	(%rcx,%rax,4), %esi
	jmp	LBB0_12
LBB0_11:
	movl	%edx, %esi
LBB0_12:
	movq	_pixel_lut_m4@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	andl	$63, %esi
	movl	(%rax,%rsi,4), %eax
	jmp	LBB0_15
LBB0_13:
	movq	_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	28(%rcx), %ecx
	andl	$15, %ecx
LBB0_14:
	movl	(%rax,%rcx,4), %eax
LBB0_15:
	movq	_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	testb	$4, (%rcx)
	jne	LBB0_20
## %bb.16:
	cmpl	$64, %ebx
	je	LBB0_18
## %bb.17:
	movl	28(%rcx), %ecx
	andl	$15, %ecx
	orl	$16, %ecx
	cmpl	%ebx, %ecx
	jne	LBB0_19
LBB0_18:
	movq	_pixel@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, 256(%rcx)
	movl	%eax, 64(%rcx)
	movl	%eax, 192(%rcx)
	movl	%eax, 576(%rcx)
	movl	%eax, 704(%rcx)
LBB0_19:
	testb	$15, %bl
	je	LBB0_21
LBB0_20:
	movq	_pixel@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	%ebx, %rdx
	movl	%eax, (%rcx,%rdx,4)
	movl	%ebx, %edx
	orl	$32, %edx
	movslq	%edx, %rdx
	movl	%eax, (%rcx,%rdx,4)
	movl	%ebx, %edx
	orl	$128, %edx
	movslq	%edx, %rdx
	movl	%eax, (%rcx,%rdx,4)
	orl	$160, %ebx
	movslq	%ebx, %rdx
	movl	%eax, (%rcx,%rdx,4)
LBB0_21:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_system_hw,4,2                  ## @system_hw
	.comm	_tms_palette,8,3                ## @tms_palette
	.comm	_reg,8,3                        ## @reg
	.comm	_SYSTEM_MD,4,2                  ## @SYSTEM_MD
	.comm	_SYSTEM_GGMS,4,2                ## @SYSTEM_GGMS
	.comm	_tms_crom,8,3                   ## @tms_crom
	.comm	_pixel_lut_m4,8,3               ## @pixel_lut_m4
	.comm	_pixel,8,3                      ## @pixel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_color_update_m4                ; -- Begin function color_update_m4
	.p2align	2
_color_update_m4:                       ; @color_update_m4
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x8, _system_hw@GOTPAGE
Lloh1:
	ldr	x8, [x8, _system_hw@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
Lloh3:
	adrp	x20, _reg@GOTPAGE
Lloh4:
	ldr	x20, [x20, _reg@GOTPAGEOFF]
	cmp	w9, #128
	b.eq	LBB0_3
; %bb.1:
	cmp	w9, #129
	b.ne	LBB0_5
; %bb.2:
	and	w0, w1, #0xf
	ubfx	w8, w1, #4, #4
	ubfx	w2, w1, #8, #4
	mov	x1, x8
	bl	_MAKE_PIXEL
	b	LBB0_14
LBB0_3:
Lloh5:
	adrp	x8, _tms_palette@GOTPAGE
Lloh6:
	ldr	x8, [x8, _tms_palette@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	ands	w9, w19, #0xf
	b.ne	LBB0_13
; %bb.4:
	ldr	x9, [x20]
	ldr	w9, [x9, #28]
	and	x9, x9, #0xf
	ldr	w0, [x8, x9, lsl #2]
	b	LBB0_14
LBB0_5:
	ldr	x8, [x20]
	ldrb	w10, [x8]
	tbnz	w10, #2, LBB0_12
; %bb.6:
Lloh8:
	adrp	x10, _SYSTEM_MD@GOTPAGE
Lloh9:
	ldr	x10, [x10, _SYSTEM_MD@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_8
; %bb.7:
	mov	w1, #0
	b	LBB0_12
LBB0_8:
Lloh11:
	adrp	x10, _SYSTEM_GGMS@GOTPAGE
Lloh12:
	ldr	x10, [x10, _SYSTEM_GGMS@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	cmp	w9, w10
	b.eq	LBB0_12
; %bb.9:
Lloh14:
	adrp	x9, _tms_crom@GOTPAGE
Lloh15:
	ldr	x9, [x9, _tms_crom@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	ands	w10, w19, #0xf
	b.ne	LBB0_11
; %bb.10:
	ldr	w8, [x8, #28]
	and	w10, w8, #0xf
LBB0_11:
	ldr	w1, [x9, w10, uxtw #2]
LBB0_12:
Lloh17:
	adrp	x8, _pixel_lut_m4@GOTPAGE
Lloh18:
	ldr	x8, [x8, _pixel_lut_m4@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	and	w9, w1, #0x3f
LBB0_13:
	ldr	w0, [x8, w9, uxtw #2]
LBB0_14:
	ldr	x9, [x20]
	ldrb	w10, [x9]
Lloh20:
	adrp	x8, _pixel@GOTPAGE
Lloh21:
	ldr	x8, [x8, _pixel@GOTPAGEOFF]
	tbnz	w10, #2, LBB0_19
; %bb.15:
	cmp	w19, #64
	b.eq	LBB0_17
; %bb.16:
	ldr	w9, [x9, #28]
	mov	w10, #16
	bfxil	w10, w9, #0, #4
	cmp	w10, w19
	b.ne	LBB0_18
LBB0_17:
	ldr	x9, [x8]
	str	w0, [x9, #256]
	str	w0, [x9, #64]
	str	w0, [x9, #192]
	str	w0, [x9, #576]
	str	w0, [x9, #704]
LBB0_18:
	tst	w19, #0xf
	b.eq	LBB0_20
LBB0_19:
	ldr	x8, [x8]
	sbfiz	x9, x19, #2, #32
	str	w0, [x8, x9]
	orr	x10, x9, #0x80
	str	w0, [x8, x10]
	orr	x10, x9, #0x200
	str	w0, [x8, x10]
	mov	w10, #640
	orr	x9, x9, x10
	str	w0, [x8, x9]
LBB0_20:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_system_hw,4,2                  ; @system_hw
	.comm	_tms_palette,8,3                ; @tms_palette
	.comm	_reg,8,3                        ; @reg
	.comm	_SYSTEM_MD,4,2                  ; @SYSTEM_MD
	.comm	_SYSTEM_GGMS,4,2                ; @SYSTEM_GGMS
	.comm	_tms_crom,8,3                   ; @tms_crom
	.comm	_pixel_lut_m4,8,3               ; @pixel_lut_m4
	.comm	_pixel,8,3                      ; @pixel
.subsections_via_symbols
