	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function LoadShaderImage
LCPI0_0:
	.quad	0x3ff0000000000000              ## double 1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_LoadShaderImage:                       ## @LoadShaderImage
	.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
	subq	$1064, %rsp                     ## imm = 0x428
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -1080(%rbp)
	movq	48(%rdi), %rcx
	cmpq	$0, (%rcx)
	je	LBB0_2
## %bb.1:
	movq	_gamedir@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	L_.str(%rip), %rsi
	leaq	-1056(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sprintf
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	callq	_DefaultExtension
	leaq	-1080(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_LoadImageFile
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_7
LBB0_2:
	movq	40(%r14), %rcx
	cmpq	$0, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_gamedir@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	L_.str(%rip), %rsi
	leaq	-1056(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sprintf
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	callq	_DefaultExtension
	leaq	-1080(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_LoadImageFile
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_7
LBB0_4:
	movq	_gamedir@GOTPCREL(%rip), %r15
	movq	(%r15), %rdx
	movq	32(%r14), %rcx
	leaq	L_.str.2(%rip), %rsi
	leaq	-1056(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sprintf
	leaq	-1080(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_LoadImageFile
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:
	movq	(%r15), %rdx
	movq	32(%r14), %rcx
	leaq	L_.str.3(%rip), %rsi
	leaq	-1056(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sprintf
	leaq	-1080(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_LoadImageFile
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	cmpq	$0, -1080(%rbp)
	je	LBB0_9
## %bb.8:
	leaq	16(%r14), %rsi
	leaq	8(%r14), %rdx
	leaq	12(%r14), %rcx
	movq	%rbx, %rdi
	callq	_LoadTGABuffer
LBB0_9:
	movq	%rbx, %rdi
	callq	_free
	movl	12(%r14), %ebx
	imull	8(%r14), %ebx
	leaq	-1072(%rbp), %rdi
	callq	_VectorClear
	movl	$0, -1060(%rbp)
	testl	%ebx, %ebx
	jle	LBB0_12
## %bb.10:
	movq	16(%r14), %rax
	movl	%ebx, %ecx
	movss	-1072(%rbp), %xmm0              ## xmm0 = mem[0],zero,zero,zero
	movss	-1068(%rbp), %xmm1              ## xmm1 = mem[0],zero,zero,zero
	movss	-1064(%rbp), %xmm2              ## xmm2 = mem[0],zero,zero,zero
	shlq	$4, %rcx
	xorps	%xmm3, %xmm3
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	addss	(%rax,%rdx), %xmm0
	movss	%xmm0, -1072(%rbp)
	addss	4(%rax,%rdx), %xmm1
	movss	%xmm1, -1068(%rbp)
	addss	8(%rax,%rdx), %xmm2
	movss	%xmm2, -1064(%rbp)
	addss	12(%rax,%rdx), %xmm3
	movss	%xmm3, -1060(%rbp)
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	LBB0_11
LBB0_12:
	movq	(%r14), %rsi
	leaq	-1072(%rbp), %r15
	movq	%r15, %rdi
	callq	_ColorNormalize
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ebx, %xmm1
	movsd	LCPI0_0(%rip), %xmm0            ## xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	24(%r14), %esi
	movq	%r15, %rdi
	callq	_VectorScale
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_15
## %bb.14:
	addq	$1064, %rsp                     ## imm = 0x428
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	32(%r14), %rsi
	leaq	L_.str.4(%rip), %rdi
	callq	__printf
	movq	(%r14), %rax
	movabsq	$4294967297, %rcx               ## imm = 0x100000001
	movq	%rcx, (%rax)
	movl	$1, 8(%rax)
	movabsq	$274877907008, %rax             ## imm = 0x4000000040
	movq	%rax, 8(%r14)
	movl	$16384, %edi                    ## imm = 0x4000
	callq	_malloc
	movq	%rax, 16(%r14)
	movl	8(%r14), %edx
	imull	12(%r14), %edx
	shll	$2, %edx
	movq	%rax, %rdi
	movl	$255, %esi
	callq	_memset
	jmp	LBB0_13
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_qtrue,8,3                      ## @qtrue
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s%s"

	.comm	_gamedir,8,3                    ## @gamedir
L_.str.1:                               ## @.str.1
	.asciz	".tga"

L_.str.2:                               ## @.str.2
	.asciz	"%s%s.tga"

L_.str.3:                               ## @.str.3
	.asciz	"%s%s.TGA"

L_.str.4:                               ## @.str.4
	.asciz	"WARNING: Couldn't find image for shader %s\n"

	.no_dead_strip	_LoadShaderImage
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function LoadShaderImage
_LoadShaderImage:                       ; @LoadShaderImage
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	sub	sp, sp, #1056
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh3:
	adrp	x8, _qtrue@GOTPAGE
Lloh4:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	str	x8, [sp]
	ldr	x3, [x0, #48]
	ldr	x8, [x3]
Lloh6:
	adrp	x21, _gamedir@GOTPAGE
Lloh7:
	ldr	x21, [x21, _gamedir@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	x2, [x21]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	add	x0, sp, #24
	bl	_sprintf
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x0, sp, #24
	bl	_DefaultExtension
	add	x0, sp, #24
	mov	x1, sp
	bl	_LoadImageFile
	mov	x20, x0
	cbnz	x0, LBB0_6
LBB0_2:
	ldr	x3, [x19, #40]
	ldr	x8, [x3]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	x2, [x21]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	add	x0, sp, #24
	bl	_sprintf
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x0, sp, #24
	bl	_DefaultExtension
	add	x0, sp, #24
	mov	x1, sp
	bl	_LoadImageFile
	mov	x20, x0
	cbnz	x0, LBB0_6
LBB0_4:
	ldr	x2, [x21]
	ldr	x3, [x19, #32]
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	add	x0, sp, #24
	bl	_sprintf
	add	x0, sp, #24
	mov	x1, sp
	bl	_LoadImageFile
	mov	x20, x0
	cbnz	x0, LBB0_6
; %bb.5:
	ldr	x2, [x21]
	ldr	x3, [x19, #32]
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	add	x0, sp, #24
	bl	_sprintf
	add	x0, sp, #24
	mov	x1, sp
	bl	_LoadImageFile
	mov	x20, x0
	cbz	x0, LBB0_14
LBB0_6:
	ldr	x8, [sp]
	cbz	x8, LBB0_8
; %bb.7:
	add	x1, x19, #16
	add	x2, x19, #8
	add	x3, x19, #12
	mov	x0, x20
	bl	_LoadTGABuffer
LBB0_8:
	mov	x0, x20
	bl	_free
	ldp	w8, w9, [x19, #8]
	mul	w20, w9, w8
	add	x0, sp, #8
	bl	_VectorClear
	str	wzr, [sp, #20]
	cmp	w20, #1
	b.lt	LBB0_11
; %bb.9:
	ldr	x8, [x19, #16]
	ldp	s0, s1, [sp, #8]
	ldr	s2, [sp, #16]
	add	x8, x8, #8
	movi	d3, #0000000000000000
	mov	x9, x20
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldur	s4, [x8, #-8]
	fadd	s0, s4, s0
	str	s0, [sp, #8]
	ldur	s4, [x8, #-4]
	fadd	s1, s4, s1
	str	s1, [sp, #12]
	ldr	s4, [x8]
	fadd	s2, s4, s2
	str	s2, [sp, #16]
	ldr	s4, [x8, #4]
	fadd	s3, s4, s3
	str	s3, [sp, #20]
	add	x8, x8, #16
	subs	x9, x9, #1
	b.ne	LBB0_10
LBB0_11:
	ldr	x1, [x19]
	add	x0, sp, #8
	bl	_ColorNormalize
	scvtf	d0, w20
	fmov	d1, #1.00000000
	fdiv	d0, d1, d0
	ldr	w1, [x19, #24]
	add	x0, sp, #8
	bl	_VectorScale
LBB0_12:
	ldur	x8, [x29, #-40]
Lloh20:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh21:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.13:
	add	sp, sp, #1056
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_14:
	ldr	x1, [x19, #32]
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	__printf
	ldr	x8, [x19]
	movi.2s	v0, #1
	str	d0, [x8]
	mov	w9, #1
	str	w9, [x8, #8]
	movi.2s	v0, #64
	str	d0, [x19, #8]
	mov	w0, #16384
	bl	_malloc
	str	x0, [x19, #16]
	ldp	w8, w9, [x19, #8]
	mul	w8, w8, w9
	lsl	w2, w8, #2
	mov	w1, #255
	bl	_memset
	b	LBB0_12
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_qtrue,8,3                      ; @qtrue
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s%s"

	.comm	_gamedir,8,3                    ; @gamedir
l_.str.1:                               ; @.str.1
	.asciz	".tga"

l_.str.2:                               ; @.str.2
	.asciz	"%s%s.tga"

l_.str.3:                               ; @.str.3
	.asciz	"%s%s.TGA"

l_.str.4:                               ; @.str.4
	.asciz	"WARNING: Couldn't find image for shader %s\n"

	.no_dead_strip	_LoadShaderImage
.subsections_via_symbols
