	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function UploadNewPalette
LCPI0_0:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
LCPI0_1:
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_UploadNewPalette
	.p2align	4, 0x90
_UploadNewPalette:                      ## @UploadNewPalette
	.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
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_X_visualinfo@GOTPCREL(%rip), %rax
	movq	16(%rax), %rcx
	movq	_PseudoColor@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_14
## %bb.1:
	cmpl	$8, 8(%rax)
	jne	LBB0_14
## %bb.2:
	movl	%edi, %r8d
	cmpb	$1, _UploadNewPalette.firstcall(%rip)
	jne	LBB0_4
## %bb.3:
	movq	_colors@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	jmp	LBB0_11
LBB0_14:
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_colors@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	5108(%rdx), %rbx
	movq	_DoRed@GOTPCREL(%rip), %r9
	leaq	4(%r9), %rax
	cmpq	%rax, %rdx
	setb	%r14b
	cmpq	%r9, %rbx
	seta	%r15b
	movb	$1, _UploadNewPalette.firstcall(%rip)
	movq	_DoGreen@GOTPCREL(%rip), %r10
	leaq	4(%r10), %rax
	cmpq	%rax, %rdx
	setb	%cl
	cmpq	%r10, %rbx
	seta	%r11b
	movq	_DoBlue@GOTPCREL(%rip), %rax
	leaq	4(%rax), %rdi
	cmpq	%rdi, %rdx
	setb	%dil
	cmpq	%rax, %rbx
	seta	%bl
	testb	%r15b, %r14b
	jne	LBB0_7
## %bb.5:
	andb	%r11b, %cl
	jne	LBB0_7
## %bb.6:
	andb	%bl, %dil
	jne	LBB0_7
## %bb.9:
	movl	(%r10), %ecx
	orl	(%r9), %ecx
	orl	(%rax), %ecx
	movdqa	LCPI0_0(%rip), %xmm0            ## xmm0 = [0,1,2,3]
	movl	$64, %eax
	movdqa	LCPI0_1(%rip), %xmm1            ## xmm1 = [4,4,4,4]
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movd	%xmm0, -64(%rdx,%rax)
	pextrd	$1, %xmm0, -44(%rdx,%rax)
	pextrd	$2, %xmm0, -24(%rdx,%rax)
	pextrd	$3, %xmm0, -4(%rdx,%rax)
	movl	%ecx, -60(%rdx,%rax)
	movl	%ecx, -40(%rdx,%rax)
	movl	%ecx, -20(%rdx,%rax)
	movl	%ecx, (%rdx,%rax)
	paddd	%xmm1, %xmm0
	addq	$80, %rax
	cmpq	$5184, %rax                     ## imm = 0x1440
	jne	LBB0_10
	jmp	LBB0_11
LBB0_7:
	leaq	24(%rdx), %rcx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edi, -24(%rcx)
	movl	(%r10), %ebx
	orl	(%r9), %ebx
	orl	(%rax), %ebx
	movl	%ebx, -20(%rcx)
	movl	%edi, %ebx
	orl	$1, %ebx
	movl	%ebx, -4(%rcx)
	movl	(%r10), %ebx
	orl	(%r9), %ebx
	orl	(%rax), %ebx
	movl	%ebx, (%rcx)
	addq	$2, %rdi
	addq	$40, %rcx
	cmpq	$256, %rdi                      ## imm = 0x100
	jne	LBB0_8
LBB0_11:
	movq	_gammatable@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_usegamma@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rax,%rcx,8), %rax
	movl	$16, %ecx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movslq	(%rsi), %rdi
	movl	(%rax,%rdi,4), %ebx
	movl	%ebx, %edi
	shll	$8, %edi
	addl	%ebx, %edi
	movl	%edi, -8(%rdx,%rcx)
	movslq	4(%rsi), %rdi
	movl	(%rax,%rdi,4), %ebx
	movl	%ebx, %edi
	shll	$8, %edi
	addl	%ebx, %edi
	movl	%edi, -4(%rdx,%rcx)
	movslq	8(%rsi), %rdi
	movl	(%rax,%rdi,4), %ebx
	movl	%ebx, %edi
	shll	$8, %edi
	addl	%ebx, %edi
	movl	%edi, (%rdx,%rcx)
	addq	$20, %rcx
	addq	$12, %rsi
	cmpq	$5136, %rcx                     ## imm = 0x1410
	jne	LBB0_12
## %bb.13:
	movq	_X_display@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r8d, %esi
	movl	$256, %ecx                      ## imm = 0x100
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_XStoreColors                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_UploadNewPalette.firstcall,1,2 ## @UploadNewPalette.firstcall
	.comm	_X_visualinfo,24,3              ## @X_visualinfo
	.comm	_PseudoColor,8,3                ## @PseudoColor
	.comm	_colors,8,3                     ## @colors
	.comm	_DoRed,4,2                      ## @DoRed
	.comm	_DoGreen,4,2                    ## @DoGreen
	.comm	_DoBlue,4,2                     ## @DoBlue
	.comm	_gammatable,8,3                 ## @gammatable
	.comm	_usegamma,8,3                   ## @usegamma
	.comm	_X_display,4,2                  ## @X_display
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_UploadNewPalette               ; -- Begin function UploadNewPalette
	.p2align	2
_UploadNewPalette:                      ; @UploadNewPalette
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x9, _X_visualinfo@GOTPAGE
Lloh1:
	ldr	x9, [x9, _X_visualinfo@GOTPAGEOFF]
	ldr	x10, [x9, #16]
Lloh2:
	adrp	x11, _PseudoColor@GOTPAGE
Lloh3:
	ldr	x11, [x11, _PseudoColor@GOTPAGEOFF]
Lloh4:
	ldr	x11, [x11]
	ldr	w9, [x9, #8]
	cmp	x10, x11
	ccmp	w9, #8, #0, eq
	b.eq	LBB0_2
; %bb.1:
	ret
LBB0_2:
	mov	x8, x0
	adrp	x10, _UploadNewPalette.firstcall@PAGE
	ldrb	w9, [x10, _UploadNewPalette.firstcall@PAGEOFF]
	cmp	w9, #1
	b.ne	LBB0_4
; %bb.3:
Lloh5:
	adrp	x9, _colors@GOTPAGE
Lloh6:
	ldr	x9, [x9, _colors@GOTPAGEOFF]
Lloh7:
	ldr	x2, [x9]
	b	LBB0_6
LBB0_4:
	mov	x9, #0
	mov	w11, #1
	strb	w11, [x10, _UploadNewPalette.firstcall@PAGEOFF]
Lloh8:
	adrp	x10, _colors@GOTPAGE
Lloh9:
	ldr	x10, [x10, _colors@GOTPAGEOFF]
Lloh10:
	ldr	x2, [x10]
	add	x10, x2, #4
Lloh11:
	adrp	x11, _DoRed@GOTPAGE
Lloh12:
	ldr	x11, [x11, _DoRed@GOTPAGEOFF]
Lloh13:
	adrp	x12, _DoGreen@GOTPAGE
Lloh14:
	ldr	x12, [x12, _DoGreen@GOTPAGEOFF]
Lloh15:
	adrp	x13, _DoBlue@GOTPAGE
Lloh16:
	ldr	x13, [x13, _DoBlue@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	stur	w9, [x10, #-4]
	ldr	w14, [x11]
	ldr	w15, [x12]
	orr	w14, w15, w14
	ldr	w15, [x13]
	orr	w14, w14, w15
	str	w14, [x10], #20
	add	x9, x9, #1
	cmp	x9, #256
	b.ne	LBB0_5
LBB0_6:
Lloh17:
	adrp	x9, _gammatable@GOTPAGE
Lloh18:
	ldr	x9, [x9, _gammatable@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
Lloh20:
	adrp	x10, _usegamma@GOTPAGE
Lloh21:
	ldr	x10, [x10, _usegamma@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
	ldr	x9, [x9, x10, lsl #3]
	mov	x10, #-5120
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldrsw	x11, [x1]
	ldr	w11, [x9, x11, lsl #2]
	add	w11, w11, w11, lsl #8
	add	x12, x2, x10
	str	w11, [x12, #5128]
	ldrsw	x11, [x1, #4]
	ldr	w11, [x9, x11, lsl #2]
	add	w11, w11, w11, lsl #8
	str	w11, [x12, #5132]
	ldrsw	x11, [x1, #8]
	ldr	w11, [x9, x11, lsl #2]
	add	w11, w11, w11, lsl #8
	str	w11, [x12, #5136]
	add	x1, x1, #12
	adds	x10, x10, #20
	b.ne	LBB0_7
; %bb.8:
Lloh23:
	adrp	x9, _X_display@GOTPAGE
Lloh24:
	ldr	x9, [x9, _X_display@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x9]
	mov	x1, x8
	mov	w3, #256
	b	_XStoreColors
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_UploadNewPalette.firstcall,1,2 ; @UploadNewPalette.firstcall
	.comm	_X_visualinfo,24,3              ; @X_visualinfo
	.comm	_PseudoColor,8,3                ; @PseudoColor
	.comm	_colors,8,3                     ; @colors
	.comm	_DoRed,4,2                      ; @DoRed
	.comm	_DoGreen,4,2                    ; @DoGreen
	.comm	_DoBlue,4,2                     ; @DoBlue
	.comm	_gammatable,8,3                 ; @gammatable
	.comm	_usegamma,8,3                   ; @usegamma
	.comm	_X_display,4,2                  ; @X_display
.subsections_via_symbols
