	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VL_StoreLightmap               ## -- Begin function VL_StoreLightmap
	.p2align	4, 0x90
_VL_StoreLightmap:                      ## @VL_StoreLightmap
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	leaq	L_.str(%rip), %rdi
	callq	__printf
	xorl	%eax, %eax
	callq	_VL_FixLightmapEdges
	movq	_numDrawSurfaces@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_13
## %bb.1:
	xorl	%edi, %edi
	movq	_lsurfaceTest@GOTPCREL(%rip), %rbx
	movq	_drawSurfaces@GOTPCREL(%rip), %r8
	movq	_LIGHTMAP_HEIGHT@GOTPCREL(%rip), %r12
	movq	_LIGHTMAP_WIDTH@GOTPCREL(%rip), %r15
	movq	_lightAmbientColor@GOTPCREL(%rip), %r13
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_numDrawSurfaces@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	_lsurfaceTest@GOTPCREL(%rip), %rbx
	movq	_drawSurfaces@GOTPCREL(%rip), %r8
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%rdi
	movslq	%eax, %rcx
	cmpq	%rcx, %rdi
	jge	LBB0_13
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##       Child Loop BB0_8 Depth 3
	movq	(%rbx), %rcx
	cmpq	$0, (%rcx,%rdi,8)
	je	LBB0_12
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r8), %rdx
	leaq	(%rdi,%rdi,4), %rsi
	cmpl	$0, (%rdx,%rsi,4)
	js	LBB0_12
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rdx,%rsi,4), %ecx
	testl	%ecx, %ecx
	jle	LBB0_12
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rdx,%rsi,4), %rdi
	movl	8(%rdx,%rsi,4), %eax
	xorl	%edx, %edx
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=2
	incl	%edx
	cmpl	%ecx, %edx
	jge	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_8 Depth 3
	testl	%eax, %eax
	jle	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	xorl	%r14d, %r14d
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_6 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	(%r12), %eax
	imull	(%rdi), %eax
	movl	12(%rdi), %ecx
	addl	%edx, %ecx
	addl	%eax, %ecx
	imull	(%r15), %ecx
	addl	16(%rdi), %ecx
	addl	%r14d, %ecx
	leal	(%rcx,%rcx,2), %eax
	movslq	%eax, %rbx
	shlq	$2, %rbx
	movq	_lightFloats@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	%rbx, %rdi
	movl	(%r13), %esi
	movq	%rdi, %rdx
	callq	_VectorAdd
	movq	_lightFloats@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	%rbx, %rdi
	movq	_lightBytes@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
	movq	%rbx, %rsi
	callq	_ColorToBytes
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	incl	%r14d
	movl	8(%rdi), %eax
	cmpl	%eax, %r14d
	jl	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=2
	movl	4(%rdi), %ecx
	jmp	LBB0_10
LBB0_13:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"storing lightmaps...\n"

	.comm	_numDrawSurfaces,4,2            ## @numDrawSurfaces
	.comm	_lsurfaceTest,8,3               ## @lsurfaceTest
	.comm	_drawSurfaces,8,3               ## @drawSurfaces
	.comm	_LIGHTMAP_HEIGHT,4,2            ## @LIGHTMAP_HEIGHT
	.comm	_LIGHTMAP_WIDTH,4,2             ## @LIGHTMAP_WIDTH
	.comm	_lightFloats,8,3                ## @lightFloats
	.comm	_lightAmbientColor,4,2          ## @lightAmbientColor
	.comm	_lightBytes,8,3                 ## @lightBytes
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VL_StoreLightmap               ; -- Begin function VL_StoreLightmap
	.p2align	2
_VL_StoreLightmap:                      ; @VL_StoreLightmap
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	__printf
	bl	_VL_FixLightmapEdges
Lloh2:
	adrp	x8, _numDrawSurfaces@GOTPAGE
Lloh3:
	ldr	x8, [x8, _numDrawSurfaces@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.1:
	mov	x11, #0
Lloh5:
	adrp	x12, _lsurfaceTest@GOTPAGE
Lloh6:
	ldr	x12, [x12, _lsurfaceTest@GOTPAGEOFF]
Lloh7:
	adrp	x13, _drawSurfaces@GOTPAGE
Lloh8:
	ldr	x13, [x13, _drawSurfaces@GOTPAGEOFF]
	mov	w14, #20
Lloh9:
	adrp	x27, _LIGHTMAP_HEIGHT@GOTPAGE
Lloh10:
	ldr	x27, [x27, _LIGHTMAP_HEIGHT@GOTPAGEOFF]
Lloh11:
	adrp	x28, _LIGHTMAP_WIDTH@GOTPAGE
Lloh12:
	ldr	x28, [x28, _LIGHTMAP_WIDTH@GOTPAGEOFF]
Lloh13:
	adrp	x26, _lightAmbientColor@GOTPAGE
Lloh14:
	ldr	x26, [x26, _lightAmbientColor@GOTPAGEOFF]
Lloh15:
	adrp	x20, _lightFloats@GOTPAGE
Lloh16:
	ldr	x20, [x20, _lightFloats@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh17:
	adrp	x8, _numDrawSurfaces@GOTPAGE
Lloh18:
	ldr	x8, [x8, _numDrawSurfaces@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	ldr	x11, [sp, #8]                   ; 8-byte Folded Reload
Lloh20:
	adrp	x12, _lsurfaceTest@GOTPAGE
Lloh21:
	ldr	x12, [x12, _lsurfaceTest@GOTPAGEOFF]
Lloh22:
	adrp	x13, _drawSurfaces@GOTPAGE
Lloh23:
	ldr	x13, [x13, _drawSurfaces@GOTPAGEOFF]
	mov	w14, #20
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x11, x11, #1
	cmp	x11, w8, sxtw
	b.ge	LBB0_13
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
                                        ;       Child Loop BB0_11 Depth 3
	ldr	x9, [x12]
	ldr	x9, [x9, x11, lsl #3]
	cbz	x9, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x10, [x13]
	madd	x22, x11, x14, x10
	ldr	w9, [x22]
	tbnz	w9, #31, LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	madd	x1, x11, x14, x10
	ldr	w9, [x1, #4]!
	str	x1, [sp, #16]                   ; 8-byte Folded Spill
	cmp	w9, #1
	b.lt	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w23, #0
	str	x11, [sp, #8]                   ; 8-byte Folded Spill
	madd	x10, x11, x14, x10
	ldr	w8, [x10, #8]!
	add	x21, x10, #4
	add	x19, x10, #8
	str	x10, [sp, #24]                  ; 8-byte Folded Spill
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=2
	add	w23, w23, #1
	cmp	w23, w9
	b.ge	LBB0_2
LBB0_9:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_11 Depth 3
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	mov	w24, #0
LBB0_11:                                ;   Parent Loop BB0_4 Depth=1
                                        ;     Parent Loop BB0_9 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	w8, [x22]
	ldr	w9, [x27]
	ldr	w10, [x21]
	ldr	w11, [x28]
	ldr	w12, [x19]
	add	w10, w23, w10
	madd	w8, w9, w8, w10
	madd	w8, w11, w8, w12
	add	w8, w24, w8
	ldr	x9, [x20]
	add	w8, w8, w8, lsl #1
	sbfiz	x25, x8, #2, #32
	add	x0, x9, x25
	ldr	w1, [x26]
	mov	x2, x0
	bl	_VectorAdd
	ldr	x8, [x20]
	add	x0, x8, x25
Lloh24:
	adrp	x8, _lightBytes@GOTPAGE
Lloh25:
	ldr	x8, [x8, _lightBytes@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	add	x1, x8, x25
	bl	_ColorToBytes
	ldr	x10, [sp, #24]                  ; 8-byte Folded Reload
	add	w24, w24, #1
	ldr	w8, [x10]
	cmp	w24, w8
	b.lt	LBB0_11
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=2
	ldr	x9, [sp, #16]                   ; 8-byte Folded Reload
	ldr	w9, [x9]
	b	LBB0_8
LBB0_13:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"storing lightmaps...\n"

	.comm	_numDrawSurfaces,4,2            ; @numDrawSurfaces
	.comm	_lsurfaceTest,8,3               ; @lsurfaceTest
	.comm	_drawSurfaces,8,3               ; @drawSurfaces
	.comm	_LIGHTMAP_HEIGHT,4,2            ; @LIGHTMAP_HEIGHT
	.comm	_LIGHTMAP_WIDTH,4,2             ; @LIGHTMAP_WIDTH
	.comm	_lightFloats,8,3                ; @lightFloats
	.comm	_lightAmbientColor,4,2          ; @lightAmbientColor
	.comm	_lightBytes,8,3                 ; @lightBytes
.subsections_via_symbols
