	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WritePortalFile                ## -- Begin function WritePortalFile
	.p2align	4, 0x90
_WritePortalFile:                       ## @WritePortalFile
	.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	$1032, %rsp                     ## imm = 0x408
	.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)
	leaq	L_.str(%rip), %rdi
	callq	_qprintf
	movq	_source@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	L_.str.1(%rip), %rsi
	leaq	-1056(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sprintf
	leaq	L_.str.2(%rip), %rdi
	movq	%rbx, %rsi
	callq	__printf
	leaq	L_.str.3(%rip), %rsi
	movq	%rbx, %rdi
	callq	_fopen
	movq	_pf@GOTPCREL(%rip), %r15
	movl	%eax, (%r15)
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.4(%rip), %rdi
	leaq	-1056(%rbp), %rsi
	callq	_Error
	movl	(%r15), %eax
LBB0_2:
	movq	_PORTALFILE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	leaq	L_.str.5(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r15), %edi
	movq	_num_visclusters@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.6(%rip), %rbx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r15), %edi
	movq	_num_visportals@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r15), %edi
	movq	_num_solidfaces@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r14), %edi
	callq	_WritePortalFile_r
	movl	(%r14), %edi
	callq	_WriteFaceFile_r
	movl	(%r15), %edi
	callq	_fclose
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_4
## %bb.3:
	addq	$1032, %rsp                     ## imm = 0x408
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"--- WritePortalFile ---\n"

L_.str.1:                               ## @.str.1
	.asciz	"%s.prt"

	.comm	_source,8,3                     ## @source
L_.str.2:                               ## @.str.2
	.asciz	"writing %s\n"

L_.str.3:                               ## @.str.3
	.asciz	"w"

	.comm	_pf,4,2                         ## @pf
L_.str.4:                               ## @.str.4
	.asciz	"Error opening %s"

L_.str.5:                               ## @.str.5
	.asciz	"%s\n"

	.comm	_PORTALFILE,8,3                 ## @PORTALFILE
L_.str.6:                               ## @.str.6
	.asciz	"%i\n"

	.comm	_num_visclusters,4,2            ## @num_visclusters
	.comm	_num_visportals,4,2             ## @num_visportals
	.comm	_num_solidfaces,4,2             ## @num_solidfaces
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WritePortalFile                ; -- Begin function WritePortalFile
	.p2align	2
_WritePortalFile:                       ; @WritePortalFile
	.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, #1040
	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	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_qprintf
Lloh5:
	adrp	x8, _source@GOTPAGE
Lloh6:
	ldr	x8, [x8, _source@GOTPAGEOFF]
Lloh7:
	ldr	x2, [x8]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x0, sp, #8
	bl	_sprintf
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	add	x1, sp, #8
	bl	__printf
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	add	x0, sp, #8
	bl	_fopen
Lloh14:
	adrp	x21, _pf@GOTPAGE
Lloh15:
	ldr	x21, [x21, _pf@GOTPAGEOFF]
	str	w0, [x21]
	cbnz	w0, LBB0_2
; %bb.1:
Lloh16:
	adrp	x0, l_.str.4@PAGE
Lloh17:
	add	x0, x0, l_.str.4@PAGEOFF
	add	x1, sp, #8
	bl	_Error
	ldr	w0, [x21]
LBB0_2:
Lloh18:
	adrp	x8, _PORTALFILE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PORTALFILE@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	str	x8, [sp]
Lloh21:
	adrp	x1, l_.str.5@PAGE
Lloh22:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_fprintf
	ldr	w0, [x21]
Lloh23:
	adrp	x8, _num_visclusters@GOTPAGE
Lloh24:
	ldr	x8, [x8, _num_visclusters@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh26:
	adrp	x20, l_.str.6@PAGE
Lloh27:
	add	x20, x20, l_.str.6@PAGEOFF
	mov	x1, x20
	bl	_fprintf
	ldr	w0, [x21]
Lloh28:
	adrp	x8, _num_visportals@GOTPAGE
Lloh29:
	ldr	x8, [x8, _num_visportals@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	str	x8, [sp]
	mov	x1, x20
	bl	_fprintf
	ldr	w0, [x21]
Lloh31:
	adrp	x8, _num_solidfaces@GOTPAGE
Lloh32:
	ldr	x8, [x8, _num_solidfaces@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	str	x8, [sp]
	mov	x1, x20
	bl	_fprintf
	ldr	w0, [x19]
	bl	_WritePortalFile_r
	ldr	w0, [x19]
	bl	_WriteFaceFile_r
	ldr	w0, [x21]
	bl	_fclose
	ldur	x8, [x29, #-40]
Lloh34:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh35:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_4
; %bb.3:
	add	sp, sp, #1040
	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_4:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"--- WritePortalFile ---\n"

l_.str.1:                               ; @.str.1
	.asciz	"%s.prt"

	.comm	_source,8,3                     ; @source
l_.str.2:                               ; @.str.2
	.asciz	"writing %s\n"

l_.str.3:                               ; @.str.3
	.asciz	"w"

	.comm	_pf,4,2                         ; @pf
l_.str.4:                               ; @.str.4
	.asciz	"Error opening %s"

l_.str.5:                               ; @.str.5
	.asciz	"%s\n"

	.comm	_PORTALFILE,8,3                 ; @PORTALFILE
l_.str.6:                               ; @.str.6
	.asciz	"%i\n"

	.comm	_num_visclusters,4,2            ; @num_visclusters
	.comm	_num_visportals,4,2             ; @num_visportals
	.comm	_num_solidfaces,4,2             ; @num_solidfaces
.subsections_via_symbols
