	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_AllocateLightmaps              ## -- Begin function AllocateLightmaps
	.p2align	4, 0x90
_AllocateLightmaps:                     ## @AllocateLightmaps
	.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	%rdi, %r14
	leaq	L_.str(%rip), %rdi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_qprintf
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	$0, (%rax)
	movslq	(%r14), %r15
	movq	_numMapDrawSurfs@GOTPCREL(%rip), %rdi
	cmpl	(%rdi), %r15d
	jge	LBB0_17
## %bb.1:
	xorl	%r12d, %r12d
	movq	_mapDrawSurfs@GOTPCREL(%rip), %r8
	movq	_surfsOnShader@GOTPCREL(%rip), %r9
	jmp	LBB0_2
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r9), %rax
	movq	%r10, (%rax,%r13,8)
	incl	%r12d
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	%r12d, (%rax)
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r15
	movslq	(%rdi), %rax
	cmpq	%rax, %r15
	jge	LBB0_17
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	movq	(%r8), %r14
	movq	%r15, %rbx
	shlq	$6, %rbx
	cmpl	$0, 56(%r14,%rbx)
	je	LBB0_16
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpq	$0, 48(%r14,%rbx)
	jne	LBB0_16
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$0, 40(%r14,%rbx)
	jne	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_mapplanes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	24(%r14,%rbx), %rcx
	movq	32(%r14,%rbx), %rdx
	movq	(%rdx), %rdx
	movl	(%rax,%rdx,4), %edi
	movl	8(%rcx), %esi
	callq	_VectorCopy
	movq	_surfsOnShader@GOTPCREL(%rip), %r9
	movq	_mapDrawSurfs@GOTPCREL(%rip), %r8
	movq	_numMapDrawSurfs@GOTPCREL(%rip), %rdi
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%r14,%rbx), %r10
	movl	%r12d, %r13d
	testl	%r12d, %r12d
	jle	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%r14,%rbx), %rcx
	movq	(%r9), %rdx
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rdx,%rax,8), %rsi
	cmpq	16(%rsi), %rcx
	je	LBB0_10
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=2
	incq	%rax
	cmpq	%rax, %r13
	jne	LBB0_9
	jmp	LBB0_13
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%rsi, 8(%r14,%rbx)
	movq	(%r9), %rcx
	movq	%r10, (%rcx,%rax,8)
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r12d, %eax
	jne	LBB0_16
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_MAX_MAP_SHADERS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jl	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str.1(%rip), %rdi
	movq	%r10, %rbx
	callq	_Error
	movq	%rbx, %r10
	movq	_surfsOnShader@GOTPCREL(%rip), %r9
	movq	_mapDrawSurfs@GOTPCREL(%rip), %r8
	movq	_numMapDrawSurfs@GOTPCREL(%rip), %rdi
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	jmp	LBB0_15
LBB0_17:
	leaq	L_.str.2(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_qprintf
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_29
## %bb.18:
	xorl	%r14d, %r14d
	movq	_SURF_NOLIGHTMAP@GOTPCREL(%rip), %r13
	movq	_SURF_POINTLIGHT@GOTPCREL(%rip), %r15
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_19 Depth=1
	movq	_numSortShaders@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_28:                                ##   in Loop: Header=BB0_19 Depth=1
	incq	%r14
	movslq	%eax, %rcx
	cmpq	%rcx, %r14
	jge	LBB0_29
LBB0_19:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_21 Depth 2
	movq	_surfsOnShader@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rcx,%r14,8), %rbx
	testq	%rbx, %rbx
	je	LBB0_28
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	movq	16(%rbx), %r12
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_21 Depth=2
	movl	$-1, (%rbx)
LBB0_26:                                ##   in Loop: Header=BB0_21 Depth=2
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_27
LBB0_21:                                ##   Parent Loop BB0_19 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %eax
	testl	%eax, (%r13)
	jne	LBB0_22
## %bb.23:                              ##   in Loop: Header=BB0_21 Depth=2
	testl	%eax, (%r15)
	je	LBB0_25
## %bb.24:                              ##   in Loop: Header=BB0_21 Depth=2
	movl	$-3, (%rbx)
	jmp	LBB0_26
LBB0_25:                                ##   in Loop: Header=BB0_21 Depth=2
	movq	%rbx, %rdi
	callq	_AllocateLightmapForSurface
	jmp	LBB0_26
LBB0_29:
	movq	_c_exactLightmap@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_qprintf
	movq	_numLightmaps@GOTPCREL(%rip), %rax
	movq	_LIGHTMAP_WIDTH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	imull	(%rax), %esi
	movq	_LIGHTMAP_HEIGHT@GOTPCREL(%rip), %rax
	imull	(%rax), %esi
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_qprintf                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"--- AllocateLightmaps ---\n"

	.comm	_numSortShaders,4,2             ## @numSortShaders
	.comm	_numMapDrawSurfs,4,2            ## @numMapDrawSurfs
	.comm	_mapDrawSurfs,8,3               ## @mapDrawSurfs
	.comm	_mapplanes,8,3                  ## @mapplanes
	.comm	_surfsOnShader,8,3              ## @surfsOnShader
	.comm	_MAX_MAP_SHADERS,4,2            ## @MAX_MAP_SHADERS
L_.str.1:                               ## @.str.1
	.asciz	"MAX_MAP_SHADERS"

L_.str.2:                               ## @.str.2
	.asciz	"%5i unique shaders\n"

	.comm	_SURF_NOLIGHTMAP,4,2            ## @SURF_NOLIGHTMAP
	.comm	_SURF_POINTLIGHT,4,2            ## @SURF_POINTLIGHT
L_.str.3:                               ## @.str.3
	.asciz	"%7i exact lightmap texels\n"

	.comm	_c_exactLightmap,4,2            ## @c_exactLightmap
L_.str.4:                               ## @.str.4
	.asciz	"%7i block lightmap texels\n"

	.comm	_numLightmaps,4,2               ## @numLightmaps
	.comm	_LIGHTMAP_WIDTH,4,2             ## @LIGHTMAP_WIDTH
	.comm	_LIGHTMAP_HEIGHT,4,2            ## @LIGHTMAP_HEIGHT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_AllocateLightmaps              ; -- Begin function AllocateLightmaps
	.p2align	2
_AllocateLightmaps:                     ; @AllocateLightmaps
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_qprintf
	mov	w24, #0
Lloh2:
	adrp	x20, _numSortShaders@GOTPAGE
Lloh3:
	ldr	x20, [x20, _numSortShaders@GOTPAGEOFF]
	str	wzr, [x20]
	ldrsw	x22, [x19]
Lloh4:
	adrp	x23, _numMapDrawSurfs@GOTPAGE
Lloh5:
	ldr	x23, [x23, _numMapDrawSurfs@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh6:
	adrp	x21, _surfsOnShader@GOTPAGE
Lloh7:
	ldr	x21, [x21, _surfsOnShader@GOTPAGEOFF]
	cmp	w22, w8
	b.ge	LBB0_17
; %bb.1:
	mov	w24, #0
Lloh8:
	adrp	x25, _mapDrawSurfs@GOTPAGE
Lloh9:
	ldr	x25, [x25, _mapDrawSurfs@GOTPAGEOFF]
Lloh10:
	adrp	x26, _mapplanes@GOTPAGE
Lloh11:
	ldr	x26, [x26, _mapplanes@GOTPAGEOFF]
Lloh12:
	adrp	x27, _MAX_MAP_SHADERS@GOTPAGE
Lloh13:
	ldr	x27, [x27, _MAX_MAP_SHADERS@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x9, [x21]
	str	x28, [x9, w24, uxtw #3]
	add	w24, w8, #1
	str	w24, [x20]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x22, x22, #1
	ldrsw	x8, [x23]
	cmp	x22, x8
	b.ge	LBB0_17
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	ldr	x19, [x25]
	add	x28, x19, x22, lsl #6
	ldr	w8, [x28, #56]
	cbz	w8, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x28, #48]
	cbnz	x8, LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x8, x19, x22, lsl #6
	ldr	w9, [x8, #40]
	cbz	w9, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w24, #1
	b.lt	LBB0_12
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x8, #0
	add	x9, x19, x22, lsl #6
	ldr	x9, [x9, #16]
	ldr	x10, [x21]
	mov	w11, w24
LBB0_9:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x12, [x10, x8, lsl #3]
	ldr	x13, [x12, #16]
	cmp	x9, x13
	b.eq	LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x8, x8, #1
	cmp	x11, x8
	b.ne	LBB0_9
	b	LBB0_15
LBB0_11:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x9, [x26]
	ldp	x8, x10, [x8, #24]
	ldr	x10, [x10]
	ldr	w0, [x9, x10, lsl #2]
	ldr	w1, [x8, #8]
	bl	_VectorCopy
	ldr	w24, [x20]
	cmp	w24, #1
	b.ge	LBB0_8
LBB0_12:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w8, #0
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x9, x19, x22, lsl #6
	str	x12, [x9, #8]
	ldr	x9, [x21]
	str	x28, [x9, x8, lsl #3]
LBB0_14:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w8, w24
	b.ne	LBB0_3
LBB0_15:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w9, [x27]
	mov	x8, x24
	cmp	w24, w9
	b.lt	LBB0_2
; %bb.16:                               ;   in Loop: Header=BB0_4 Depth=1
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_Error
	ldr	w8, [x20]
	b	LBB0_2
LBB0_17:
	str	x24, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_qprintf
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_29
; %bb.18:
	mov	x22, #0
Lloh18:
	adrp	x23, _SURF_NOLIGHTMAP@GOTPAGE
Lloh19:
	ldr	x23, [x23, _SURF_NOLIGHTMAP@GOTPAGEOFF]
Lloh20:
	adrp	x24, _SURF_POINTLIGHT@GOTPAGE
Lloh21:
	ldr	x24, [x24, _SURF_POINTLIGHT@GOTPAGEOFF]
	mov	w25, #-3
	mov	w26, #-1
	b	LBB0_21
LBB0_19:                                ;   in Loop: Header=BB0_21 Depth=1
	ldr	w8, [x20]
LBB0_20:                                ;   in Loop: Header=BB0_21 Depth=1
	add	x22, x22, #1
	cmp	x22, w8, sxtw
	b.ge	LBB0_29
LBB0_21:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_25 Depth 2
	ldr	x9, [x21]
	ldr	x19, [x9, x22, lsl #3]
	cbz	x19, LBB0_20
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	ldr	x27, [x19, #16]
	b	LBB0_25
LBB0_23:                                ;   in Loop: Header=BB0_25 Depth=2
	str	w26, [x19]
LBB0_24:                                ;   in Loop: Header=BB0_25 Depth=2
	ldr	x19, [x19, #8]
	cbz	x19, LBB0_19
LBB0_25:                                ;   Parent Loop BB0_21 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x27]
	ldr	w9, [x23]
	tst	w9, w8
	b.ne	LBB0_23
; %bb.26:                               ;   in Loop: Header=BB0_25 Depth=2
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_28
; %bb.27:                               ;   in Loop: Header=BB0_25 Depth=2
	str	w25, [x19]
	b	LBB0_24
LBB0_28:                                ;   in Loop: Header=BB0_25 Depth=2
	mov	x0, x19
	bl	_AllocateLightmapForSurface
	b	LBB0_24
LBB0_29:
Lloh22:
	adrp	x8, _c_exactLightmap@GOTPAGE
Lloh23:
	ldr	x8, [x8, _c_exactLightmap@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh25:
	adrp	x0, l_.str.3@PAGE
Lloh26:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_qprintf
Lloh27:
	adrp	x8, _numLightmaps@GOTPAGE
Lloh28:
	ldr	x8, [x8, _numLightmaps@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, _LIGHTMAP_WIDTH@GOTPAGE
Lloh31:
	ldr	x9, [x9, _LIGHTMAP_WIDTH@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	mul	w8, w9, w8
Lloh33:
	adrp	x9, _LIGHTMAP_HEIGHT@GOTPAGE
Lloh34:
	ldr	x9, [x9, _LIGHTMAP_HEIGHT@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
	mul	w8, w8, w9
	str	x8, [sp]
Lloh36:
	adrp	x0, l_.str.4@PAGE
Lloh37:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_qprintf
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"--- AllocateLightmaps ---\n"

	.comm	_numSortShaders,4,2             ; @numSortShaders
	.comm	_numMapDrawSurfs,4,2            ; @numMapDrawSurfs
	.comm	_mapDrawSurfs,8,3               ; @mapDrawSurfs
	.comm	_mapplanes,8,3                  ; @mapplanes
	.comm	_surfsOnShader,8,3              ; @surfsOnShader
	.comm	_MAX_MAP_SHADERS,4,2            ; @MAX_MAP_SHADERS
l_.str.1:                               ; @.str.1
	.asciz	"MAX_MAP_SHADERS"

l_.str.2:                               ; @.str.2
	.asciz	"%5i unique shaders\n"

	.comm	_SURF_NOLIGHTMAP,4,2            ; @SURF_NOLIGHTMAP
	.comm	_SURF_POINTLIGHT,4,2            ; @SURF_POINTLIGHT
l_.str.3:                               ; @.str.3
	.asciz	"%7i exact lightmap texels\n"

	.comm	_c_exactLightmap,4,2            ; @c_exactLightmap
l_.str.4:                               ; @.str.4
	.asciz	"%7i block lightmap texels\n"

	.comm	_numLightmaps,4,2               ; @numLightmaps
	.comm	_LIGHTMAP_WIDTH,4,2             ; @LIGHTMAP_WIDTH
	.comm	_LIGHTMAP_HEIGHT,4,2            ; @LIGHTMAP_HEIGHT
.subsections_via_symbols
