	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_Q2_FixTextureReferences        ## -- Begin function Q2_FixTextureReferences
	.p2align	4, 0x90
_Q2_FixTextureReferences:               ## @Q2_FixTextureReferences
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_brushsidetextured@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_MAX_MAP_BRUSHSIDES@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_memset
	movq	_numbrushes@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_25
## %bb.1:
	xorl	%r15d, %r15d
	movq	_dbrushsides@GOTPCREL(%rip), %r13
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%r15
	movq	_numbrushes@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r15
	jge	LBB0_25
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
                                        ##       Child Loop BB0_21 Depth 3
	movq	_dbrushes@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	leaq	(%rbx,%r15,8), %r12
	movq	%r12, %rdi
	callq	_Q2_HintSkipBrush
	testq	%rax, %rax
	jne	LBB0_2
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	cmpl	$0, (%r12)
	jle	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%r12d, %r12d
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_9 Depth=2
	movq	%rbx, %rdx
	movq	_brushsidetextured@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	4(%rbx,%r15,8), %rcx
	addq	%r14, %rcx
LBB0_7:                                 ##   in Loop: Header=BB0_9 Depth=2
	movl	$1, (%rax,%rcx,4)
LBB0_8:                                 ##   in Loop: Header=BB0_9 Depth=2
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	incl	%r12d
	cmpl	(%rdi), %r12d
	jge	LBB0_2
LBB0_9:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_21 Depth 3
	movq	(%r13), %rax
	movslq	4(%rbx,%r15,8), %rcx
	movslq	%r12d, %r14
	addq	%r14, %rcx
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rcx,8), %rsi
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	callq	_Q2_BrushSideWinding
	testq	%rax, %rax
	je	LBB0_6
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	%rax, %rbx
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_WindingIsTiny
	testq	%rax, %rax
	je	LBB0_12
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	%rbx, %rdi
	callq	_FreeWinding
	movq	_brushsidetextured@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movslq	4(%rbx,%r15,8), %rcx
	addq	-64(%rbp), %rcx                 ## 8-byte Folded Reload
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	%rbx, %rdi
	callq	_WindingError
	movq	_WE_NOTENOUGHPOINTS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	_WE_SMALLAREA@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_11
## %bb.14:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	_WE_POINTBOGUSRANGE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_11
## %bb.15:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	%rbx, %rdi
	callq	_WindingArea
	cmpl	$19, %eax
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	jg	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	_brushsidetextured@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movslq	4(%rcx,%r15,8), %rcx
	addq	%rdx, %rcx
	movl	$1, (%rax,%rcx,4)
LBB0_17:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	_numfaces@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_24
## %bb.18:                              ##   in Loop: Header=BB0_9 Depth=2
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_21 Depth=3
	movq	_numfaces@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_20:                                ##   in Loop: Header=BB0_21 Depth=3
	incq	%r15
	movslq	%eax, %rcx
	addq	$8, %r14
	cmpq	%rcx, %r15
	jge	LBB0_24
LBB0_21:                                ##   Parent Loop BB0_3 Depth=1
                                        ##     Parent Loop BB0_9 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	_dfaces@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r13
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %ecx
	xorl	(%r13,%r14), %ecx
	cmpl	$1, %ecx
	ja	LBB0_20
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=3
	leaq	(%r14,%r13), %rdi
	movq	%rbx, %rsi
	callq	_Q2_FaceOnWinding
	testq	%rax, %rax
	je	LBB0_19
## %bb.23:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	4(%r13,%r14), %eax
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, 4(%rcx,%rdx,8)
	movq	_brushsidetextured@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movslq	4(%rdx,%rcx,8), %rcx
	addq	-64(%rbp), %rcx                 ## 8-byte Folded Reload
	movl	$1, (%rax,%rcx,4)
LBB0_24:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	%rbx, %rdi
	callq	_FreeWinding
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	_dbrushsides@GOTPCREL(%rip), %r13
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_8
LBB0_25:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_brushsidetextured,8,3          ## @brushsidetextured
	.comm	_MAX_MAP_BRUSHSIDES,4,2         ## @MAX_MAP_BRUSHSIDES
	.comm	_numbrushes,4,2                 ## @numbrushes
	.comm	_dbrushes,8,3                   ## @dbrushes
	.comm	_dbrushsides,8,3                ## @dbrushsides
	.comm	_WE_NOTENOUGHPOINTS,4,2         ## @WE_NOTENOUGHPOINTS
	.comm	_WE_SMALLAREA,4,2               ## @WE_SMALLAREA
	.comm	_WE_POINTBOGUSRANGE,4,2         ## @WE_POINTBOGUSRANGE
	.comm	_numfaces,4,2                   ## @numfaces
	.comm	_dfaces,8,3                     ## @dfaces
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_Q2_FixTextureReferences        ; -- Begin function Q2_FixTextureReferences
	.p2align	2
_Q2_FixTextureReferences:               ; @Q2_FixTextureReferences
	.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
Lloh0:
	adrp	x25, _brushsidetextured@GOTPAGE
Lloh1:
	ldr	x25, [x25, _brushsidetextured@GOTPAGEOFF]
	ldr	x0, [x25]
Lloh2:
	adrp	x8, _MAX_MAP_BRUSHSIDES@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MAX_MAP_BRUSHSIDES@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_memset
Lloh5:
	adrp	x8, _numbrushes@GOTPAGE
Lloh6:
	ldr	x8, [x8, _numbrushes@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_22
; %bb.1:
	mov	x24, #0
Lloh8:
	adrp	x26, _dbrushsides@GOTPAGE
Lloh9:
	ldr	x26, [x26, _dbrushsides@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x24, x24, #1
Lloh10:
	adrp	x8, _numbrushes@GOTPAGE
Lloh11:
	ldr	x8, [x8, _numbrushes@GOTPAGEOFF]
Lloh12:
	ldrsw	x8, [x8]
	cmp	x24, x8
	b.ge	LBB0_22
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
                                        ;       Child Loop BB0_18 Depth 3
Lloh13:
	adrp	x8, _dbrushes@GOTPAGE
Lloh14:
	ldr	x8, [x8, _dbrushes@GOTPAGEOFF]
Lloh15:
	ldr	x20, [x8]
	add	x19, x20, x24, lsl #3
	mov	x0, x19
	bl	_Q2_HintSkipBrush
	cbnz	x0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w23, #0
	add	x8, x20, x24, lsl #3
	add	x22, x8, #4
	b	LBB0_9
LBB0_6:                                 ;   in Loop: Header=BB0_9 Depth=2
	mov	x0, x20
	bl	_FreeWinding
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=2
	ldr	x8, [x25]
	ldr	w9, [x22]
	add	w9, w9, w23
	mov	w10, #1
	str	w10, [x8, w9, sxtw #2]
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=2
	add	w23, w23, #1
	ldr	w8, [x19]
	cmp	w23, w8
	b.ge	LBB0_2
LBB0_9:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_18 Depth 3
	ldr	x28, [x26]
	ldr	w8, [x22]
	add	w27, w8, w23
	add	x21, x28, w27, sxtw #3
	mov	x0, x19
	mov	x1, x21
	bl	_Q2_BrushSideWinding
	cbz	x0, LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	mov	x20, x0
	bl	_WindingIsTiny
	cbnz	x0, LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=2
	mov	x0, x20
	bl	_WindingError
Lloh16:
	adrp	x8, _WE_NOTENOUGHPOINTS@GOTPAGE
Lloh17:
	ldr	x8, [x8, _WE_NOTENOUGHPOINTS@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _WE_SMALLAREA@GOTPAGE
Lloh20:
	ldr	x9, [x9, _WE_SMALLAREA@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
Lloh22:
	adrp	x10, _WE_POINTBOGUSRANGE@GOTPAGE
Lloh23:
	ldr	x10, [x10, _WE_POINTBOGUSRANGE@GOTPAGEOFF]
Lloh24:
	ldr	w10, [x10]
	cmp	w0, w8
	ccmp	w0, w9, #4, ne
	ccmp	w0, w10, #4, ne
	b.eq	LBB0_6
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=2
	mov	x0, x20
	bl	_WindingArea
	cmp	w0, #19
	b.gt	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=2
	ldr	x8, [x25]
	ldr	w9, [x22]
	add	w9, w9, w23
	mov	w10, #1
	str	w10, [x8, w9, sxtw #2]
LBB0_14:                                ;   in Loop: Header=BB0_9 Depth=2
Lloh25:
	adrp	x8, _numfaces@GOTPAGE
Lloh26:
	ldr	x8, [x8, _numfaces@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_21
; %bb.15:                               ;   in Loop: Header=BB0_9 Depth=2
	mov	x26, #0
	mov	x25, #0
	sxtw	x9, w27
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
	b	LBB0_18
LBB0_16:                                ;   in Loop: Header=BB0_18 Depth=3
Lloh28:
	adrp	x8, _numfaces@GOTPAGE
Lloh29:
	ldr	x8, [x8, _numfaces@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
LBB0_17:                                ;   in Loop: Header=BB0_18 Depth=3
	add	x25, x25, #1
	add	x26, x26, #8
	cmp	x25, w8, sxtw
	b.ge	LBB0_21
LBB0_18:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_9 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
Lloh31:
	adrp	x9, _dfaces@GOTPAGE
Lloh32:
	ldr	x9, [x9, _dfaces@GOTPAGEOFF]
Lloh33:
	ldr	x27, [x9]
	add	x0, x27, x26
	ldr	w9, [x0]
	ldr	w10, [x21]
	eor	w9, w10, w9
	cmp	w9, #1
	b.hi	LBB0_17
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=3
	mov	x1, x20
	bl	_Q2_FaceOnWinding
	cbz	x0, LBB0_16
; %bb.20:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x8, x27, x26
	ldr	w8, [x8, #4]
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	add	x9, x28, x9, lsl #3
	str	w8, [x9, #4]
Lloh34:
	adrp	x8, _brushsidetextured@GOTPAGE
Lloh35:
	ldr	x8, [x8, _brushsidetextured@GOTPAGEOFF]
Lloh36:
	ldr	x8, [x8]
	ldr	w9, [x22]
	add	w9, w9, w23
	mov	w10, #1
	str	w10, [x8, w9, sxtw #2]
LBB0_21:                                ;   in Loop: Header=BB0_9 Depth=2
	mov	x0, x20
	bl	_FreeWinding
Lloh37:
	adrp	x25, _brushsidetextured@GOTPAGE
Lloh38:
	ldr	x25, [x25, _brushsidetextured@GOTPAGEOFF]
Lloh39:
	adrp	x26, _dbrushsides@GOTPAGE
Lloh40:
	ldr	x26, [x26, _dbrushsides@GOTPAGEOFF]
	b	LBB0_8
LBB0_22:
	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 AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_brushsidetextured,8,3          ; @brushsidetextured
	.comm	_MAX_MAP_BRUSHSIDES,4,2         ; @MAX_MAP_BRUSHSIDES
	.comm	_numbrushes,4,2                 ; @numbrushes
	.comm	_dbrushes,8,3                   ; @dbrushes
	.comm	_dbrushsides,8,3                ; @dbrushsides
	.comm	_WE_NOTENOUGHPOINTS,4,2         ; @WE_NOTENOUGHPOINTS
	.comm	_WE_SMALLAREA,4,2               ; @WE_SMALLAREA
	.comm	_WE_POINTBOGUSRANGE,4,2         ; @WE_POINTBOGUSRANGE
	.comm	_numfaces,4,2                   ; @numfaces
	.comm	_dfaces,8,3                     ; @dfaces
.subsections_via_symbols
