	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ST_doPaletteStuff              ## -- Begin function ST_doPaletteStuff
	.p2align	4, 0x90
_ST_doPaletteStuff:                     ## @ST_doPaletteStuff
	.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
	movq	_plyr@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	(%rdx), %esi
	movq	8(%rdx), %rax
	movq	_pw_strength@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %ebx
	movl	%ebx, %edi
	sarl	$6, %edi
	movl	$12, %ecx
	subl	%edi, %ecx
	cmpl	%esi, %ecx
	cmovlel	%esi, %ecx
	testl	%ebx, %ebx
	cmovel	%esi, %ecx
	testl	%ecx, %ecx
	je	LBB0_2
## %bb.1:
	addl	$7, %ecx
	sarl	$3, %ecx
	movq	_NUMREDPALS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	-1(%rax), %ebx
	cmpl	%eax, %ecx
	cmovll	%ecx, %ebx
	movq	_STARTREDPALS@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	movl	16(%rdx), %ecx
	testl	%ecx, %ecx
	je	LBB0_4
## %bb.3:
	addl	$7, %ecx
	sarl	$3, %ecx
	movq	_NUMBONUSPALS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	-1(%rax), %ebx
	cmpl	%eax, %ecx
	cmovll	%ecx, %ebx
	movq	_STARTBONUSPALS@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	jmp	LBB0_5
LBB0_4:
	movq	_pw_ironfeet@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %eax
	movl	%eax, %ebx
	shll	$28, %ebx
	sarl	$31, %ebx
	movq	_RADIATIONPAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%ecx, %ebx
	cmpl	$129, %eax
	cmovgel	%ecx, %ebx
LBB0_5:
	movq	_st_palette@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_7
## %bb.6:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_7:
	movl	%ebx, (%rax)
	movq	_lu_palette@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_PU_CACHE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_W_CacheLumpNum
	shll	$8, %ebx
	leal	(%rbx,%rbx,2), %ecx
	movslq	%ecx, %rcx
	leaq	(%rax,%rcx,4), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_I_SetPalette                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_plyr,8,3                       ## @plyr
	.comm	_pw_strength,8,3                ## @pw_strength
	.comm	_NUMREDPALS,4,2                 ## @NUMREDPALS
	.comm	_STARTREDPALS,8,3               ## @STARTREDPALS
	.comm	_NUMBONUSPALS,4,2               ## @NUMBONUSPALS
	.comm	_STARTBONUSPALS,8,3             ## @STARTBONUSPALS
	.comm	_pw_ironfeet,8,3                ## @pw_ironfeet
	.comm	_RADIATIONPAL,4,2               ## @RADIATIONPAL
	.comm	_st_palette,4,2                 ## @st_palette
	.comm	_lu_palette,4,2                 ## @lu_palette
	.comm	_PU_CACHE,4,2                   ## @PU_CACHE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ST_doPaletteStuff              ; -- Begin function ST_doPaletteStuff
	.p2align	2
_ST_doPaletteStuff:                     ; @ST_doPaletteStuff
	.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
Lloh0:
	adrp	x8, _plyr@GOTPAGE
Lloh1:
	ldr	x8, [x8, _plyr@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x8]
	ldr	w10, [x9]
	ldr	x8, [x9, #8]
Lloh3:
	adrp	x11, _pw_strength@GOTPAGE
Lloh4:
	ldr	x11, [x11, _pw_strength@GOTPAGEOFF]
Lloh5:
	ldr	x11, [x11]
	ldr	w11, [x8, x11, lsl #2]
	mov	w12, #12
	sub	w12, w12, w11, asr #6
	cmp	w12, w10
	csel	w12, w12, w10, gt
	cmp	w11, #0
	csel	w10, w10, w12, eq
	cbz	w10, LBB0_2
; %bb.1:
	add	w8, w10, #7
	asr	w8, w8, #3
Lloh6:
	adrp	x9, _NUMREDPALS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NUMREDPALS@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	sub	w10, w9, #1
	cmp	w8, w9
	csel	w8, w8, w10, lt
Lloh9:
	adrp	x9, _STARTREDPALS@GOTPAGE
Lloh10:
	ldr	x9, [x9, _STARTREDPALS@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:
	ldr	w9, [x9, #16]
	cbz	w9, LBB0_8
; %bb.3:
	add	w8, w9, #7
	asr	w8, w8, #3
Lloh11:
	adrp	x9, _NUMBONUSPALS@GOTPAGE
Lloh12:
	ldr	x9, [x9, _NUMBONUSPALS@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	sub	w10, w9, #1
	cmp	w8, w9
	csel	w8, w8, w10, lt
Lloh14:
	adrp	x9, _STARTBONUSPALS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _STARTBONUSPALS@GOTPAGEOFF]
LBB0_4:
	ldr	w9, [x9]
	add	w19, w8, w9
LBB0_5:
Lloh16:
	adrp	x8, _st_palette@GOTPAGE
Lloh17:
	ldr	x8, [x8, _st_palette@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w19, w9
	b.ne	LBB0_7
; %bb.6:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_7:
	str	w19, [x8]
Lloh18:
	adrp	x8, _lu_palette@GOTPAGE
Lloh19:
	ldr	x8, [x8, _lu_palette@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
Lloh21:
	adrp	x8, _PU_CACHE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PU_CACHE@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	bl	_W_CacheLumpNum
	add	w8, w19, w19, lsl #1
	lsl	w8, w8, #8
	add	x0, x0, w8, sxtw #2
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_I_SetPalette
LBB0_8:
Lloh24:
	adrp	x9, _pw_ironfeet@GOTPAGE
Lloh25:
	ldr	x9, [x9, _pw_ironfeet@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
	tst	w8, #0x8
	mov	w9, #129
	ccmp	w8, w9, #0, eq
Lloh27:
	adrp	x8, _RADIATIONPAL@GOTPAGE
Lloh28:
	ldr	x8, [x8, _RADIATIONPAL@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	csel	w19, wzr, w8, lt
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_plyr,8,3                       ; @plyr
	.comm	_pw_strength,8,3                ; @pw_strength
	.comm	_NUMREDPALS,4,2                 ; @NUMREDPALS
	.comm	_STARTREDPALS,8,3               ; @STARTREDPALS
	.comm	_NUMBONUSPALS,4,2               ; @NUMBONUSPALS
	.comm	_STARTBONUSPALS,8,3             ; @STARTBONUSPALS
	.comm	_pw_ironfeet,8,3                ; @pw_ironfeet
	.comm	_RADIATIONPAL,4,2               ; @RADIATIONPAL
	.comm	_st_palette,4,2                 ; @st_palette
	.comm	_lu_palette,4,2                 ; @lu_palette
	.comm	_PU_CACHE,4,2                   ; @PU_CACHE
.subsections_via_symbols
