	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function upload_palette
_upload_palette:                        ## @upload_palette
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rdi, %r15
	movq	(%rsi), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	(%rax), %r12
	jmp	LBB0_3
LBB0_1:
	xorl	%r12d, %r12d
LBB0_3:
	movq	(%r14), %rbx
	cmpl	$0, (%r15)
	jne	LBB0_5
## %bb.4:
	movl	$1, %edi
	movq	%r15, %rsi
	callq	*32(%rbx)
LBB0_5:
	movq	_GL_TEXTURE1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_glActiveTexture
	movl	%eax, %edi
	callq	_GL_EXTCALL
	movq	_GL_TEXTURE_1D@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movl	(%r15), %esi
	callq	*24(%rbx)
	movq	_GL_TEXTURE_ENV@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GL_TEXTURE_ENV_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_GL_REPLACE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	*16(%rbx)
	movl	(%r13), %edi
	movq	_GL_TEXTURE_MIN_FILTER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_GL_NEAREST@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	callq	*8(%rbx)
	movl	(%r13), %edi
	movq	_GL_TEXTURE_MAG_FILTER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r15), %edx
	callq	*8(%rbx)
	movl	(%r13), %edi
	movq	_GL_TEXTURE_WRAP_S@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_GL_CLAMP_TO_EDGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	*8(%rbx)
	testq	%r12, %r12
	je	LBB0_7
## %bb.6:
	movl	(%r13), %edi
	movq	_GL_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_GL_BGRA@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	_GL_UNSIGNED_INT_8_8_8_8_REV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%esi, %esi
	movl	$256, %ecx                      ## imm = 0x100
	xorl	%r8d, %r8d
	pushq	(%r12)
	jmp	LBB0_8
LBB0_7:
	leaq	L_.str(%rip), %rdi
	callq	_FIXME
	movl	(%r13), %edi
	movq	_GL_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_GL_BGRA@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	_GL_UNSIGNED_INT_8_8_8_8_REV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	_upload_palette.black(%rip), %r10
	xorl	%esi, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	pushq	%r10
LBB0_8:
	pushq	%rax
	callq	*(%rbx)
	addq	$16, %rsp
	movq	%r14, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_context_active_texture         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_GL_TEXTURE1,4,2                ## @GL_TEXTURE1
	.comm	_GL_TEXTURE_1D,4,2              ## @GL_TEXTURE_1D
	.comm	_GL_TEXTURE_ENV,4,2             ## @GL_TEXTURE_ENV
	.comm	_GL_TEXTURE_ENV_MODE,4,2        ## @GL_TEXTURE_ENV_MODE
	.comm	_GL_REPLACE,4,2                 ## @GL_REPLACE
	.comm	_GL_TEXTURE_MIN_FILTER,4,2      ## @GL_TEXTURE_MIN_FILTER
	.comm	_GL_NEAREST,4,2                 ## @GL_NEAREST
	.comm	_GL_TEXTURE_MAG_FILTER,4,2      ## @GL_TEXTURE_MAG_FILTER
	.comm	_GL_TEXTURE_WRAP_S,4,2          ## @GL_TEXTURE_WRAP_S
	.comm	_GL_CLAMP_TO_EDGE,4,2           ## @GL_CLAMP_TO_EDGE
	.comm	_GL_RGB,4,2                     ## @GL_RGB
	.comm	_GL_BGRA,4,2                    ## @GL_BGRA
	.comm	_GL_UNSIGNED_INT_8_8_8_8_REV,4,2 ## @GL_UNSIGNED_INT_8_8_8_8_REV
	.section	__TEXT,__const
	.p2align	2                               ## @upload_palette.black
_upload_palette.black:
	.long	0                               ## 0x0

	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"P8 surface loaded without a palette.\n"

	.no_dead_strip	_upload_palette
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function upload_palette
_upload_palette:                        ; @upload_palette
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x2
	mov	x21, x0
	ldr	x8, [x1]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	x22, [x8]
	b	LBB0_3
LBB0_2:
	mov	x22, #0
LBB0_3:
	ldr	x20, [x19]
	ldr	w8, [x21]
	cbnz	w8, LBB0_5
; %bb.4:
	ldr	x8, [x20, #32]
	mov	w0, #1
	mov	x1, x21
	blr	x8
LBB0_5:
Lloh0:
	adrp	x8, _GL_TEXTURE1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GL_TEXTURE1@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_glActiveTexture
	bl	_GL_EXTCALL
	ldr	x8, [x20, #24]
Lloh3:
	adrp	x23, _GL_TEXTURE_1D@GOTPAGE
Lloh4:
	ldr	x23, [x23, _GL_TEXTURE_1D@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	w1, [x21]
	blr	x8
	ldr	x8, [x20, #16]
Lloh5:
	adrp	x9, _GL_TEXTURE_ENV@GOTPAGE
Lloh6:
	ldr	x9, [x9, _GL_TEXTURE_ENV@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x9]
Lloh8:
	adrp	x9, _GL_TEXTURE_ENV_MODE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _GL_TEXTURE_ENV_MODE@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x9]
Lloh11:
	adrp	x9, _GL_REPLACE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _GL_REPLACE@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x9]
	blr	x8
	ldr	x8, [x20, #8]
	ldr	w0, [x23]
Lloh14:
	adrp	x9, _GL_TEXTURE_MIN_FILTER@GOTPAGE
Lloh15:
	ldr	x9, [x9, _GL_TEXTURE_MIN_FILTER@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x9]
Lloh17:
	adrp	x21, _GL_NEAREST@GOTPAGE
Lloh18:
	ldr	x21, [x21, _GL_NEAREST@GOTPAGEOFF]
	ldr	w2, [x21]
	blr	x8
	ldr	x8, [x20, #8]
	ldr	w0, [x23]
Lloh19:
	adrp	x9, _GL_TEXTURE_MAG_FILTER@GOTPAGE
Lloh20:
	ldr	x9, [x9, _GL_TEXTURE_MAG_FILTER@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x9]
	ldr	w2, [x21]
	blr	x8
	ldr	x8, [x20, #8]
	ldr	w0, [x23]
Lloh22:
	adrp	x9, _GL_TEXTURE_WRAP_S@GOTPAGE
Lloh23:
	ldr	x9, [x9, _GL_TEXTURE_WRAP_S@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x9]
Lloh25:
	adrp	x9, _GL_CLAMP_TO_EDGE@GOTPAGE
Lloh26:
	ldr	x9, [x9, _GL_CLAMP_TO_EDGE@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x9]
	blr	x8
	cbz	x22, LBB0_7
; %bb.6:
	ldr	x8, [x20]
	ldr	w0, [x23]
Lloh28:
	adrp	x9, _GL_RGB@GOTPAGE
Lloh29:
	ldr	x9, [x9, _GL_RGB@GOTPAGEOFF]
Lloh30:
	adrp	x10, _GL_BGRA@GOTPAGE
Lloh31:
	ldr	x10, [x10, _GL_BGRA@GOTPAGEOFF]
Lloh32:
	ldr	w2, [x9]
Lloh33:
	ldr	w5, [x10]
Lloh34:
	adrp	x9, _GL_UNSIGNED_INT_8_8_8_8_REV@GOTPAGE
Lloh35:
	ldr	x9, [x9, _GL_UNSIGNED_INT_8_8_8_8_REV@GOTPAGEOFF]
Lloh36:
	ldr	w6, [x9]
	ldr	x7, [x22]
	mov	w1, #0
	mov	w3, #256
	b	LBB0_8
LBB0_7:
Lloh37:
	adrp	x0, l_.str@PAGE
Lloh38:
	add	x0, x0, l_.str@PAGEOFF
	bl	_FIXME
	ldr	x8, [x20]
	ldr	w0, [x23]
Lloh39:
	adrp	x9, _GL_RGB@GOTPAGE
Lloh40:
	ldr	x9, [x9, _GL_RGB@GOTPAGEOFF]
Lloh41:
	ldr	w2, [x9]
Lloh42:
	adrp	x9, _GL_BGRA@GOTPAGE
Lloh43:
	ldr	x9, [x9, _GL_BGRA@GOTPAGEOFF]
Lloh44:
	ldr	w5, [x9]
Lloh45:
	adrp	x9, _GL_UNSIGNED_INT_8_8_8_8_REV@GOTPAGE
Lloh46:
	ldr	x9, [x9, _GL_UNSIGNED_INT_8_8_8_8_REV@GOTPAGEOFF]
Lloh47:
	ldr	w6, [x9]
Lloh48:
	adrp	x7, _upload_palette.black@PAGE
Lloh49:
	add	x7, x7, _upload_palette.black@PAGEOFF
	mov	w1, #0
	mov	w3, #1
LBB0_8:
	mov	w4, #0
	blr	x8
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_context_active_texture
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh32
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdd	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_GL_TEXTURE1,4,2                ; @GL_TEXTURE1
	.comm	_GL_TEXTURE_1D,4,2              ; @GL_TEXTURE_1D
	.comm	_GL_TEXTURE_ENV,4,2             ; @GL_TEXTURE_ENV
	.comm	_GL_TEXTURE_ENV_MODE,4,2        ; @GL_TEXTURE_ENV_MODE
	.comm	_GL_REPLACE,4,2                 ; @GL_REPLACE
	.comm	_GL_TEXTURE_MIN_FILTER,4,2      ; @GL_TEXTURE_MIN_FILTER
	.comm	_GL_NEAREST,4,2                 ; @GL_NEAREST
	.comm	_GL_TEXTURE_MAG_FILTER,4,2      ; @GL_TEXTURE_MAG_FILTER
	.comm	_GL_TEXTURE_WRAP_S,4,2          ; @GL_TEXTURE_WRAP_S
	.comm	_GL_CLAMP_TO_EDGE,4,2           ; @GL_CLAMP_TO_EDGE
	.comm	_GL_RGB,4,2                     ; @GL_RGB
	.comm	_GL_BGRA,4,2                    ; @GL_BGRA
	.comm	_GL_UNSIGNED_INT_8_8_8_8_REV,4,2 ; @GL_UNSIGNED_INT_8_8_8_8_REV
	.section	__TEXT,__const
	.p2align	2                               ; @upload_palette.black
_upload_palette.black:
	.long	0                               ; 0x0

	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"P8 surface loaded without a palette.\n"

	.no_dead_strip	_upload_palette
.subsections_via_symbols
