	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_FS_FOpenFileWrite              ## -- Begin function FS_FOpenFileWrite
	.p2align	4, 0x90
_FS_FOpenFileWrite:                     ## @FS_FOpenFileWrite
	.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
	movq	_fs_searchpaths@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_ERR_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_Com_Error
LBB0_2:
	xorl	%eax, %eax
	callq	_FS_HandleForFile
	movq	%rax, %r15
	movq	_qfalse@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_fsh@GOTPCREL(%rip), %r12
	movq	(%r12), %rcx
	movq	%r15, %rbx
	shlq	$5, %rbx
	movq	%rax, 24(%rcx,%rbx)
	movq	_fs_homepath@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	movq	_fs_gamedir@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_FS_BuildOSPath
	movq	%rax, %r13
	movq	_fs_debug@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	callq	_Com_Printf
LBB0_4:
	movq	%r13, %rdi
	callq	_FS_CreatePath
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	xorl	%r15d, %r15d
	jmp	LBB0_7
LBB0_6:
	leaq	L_.str.2(%rip), %rsi
	movq	%r13, %rdi
	callq	_fopen
	movq	(%r12), %rcx
	movl	%eax, (%rcx,%rbx)
	movl	16(%rcx,%rbx), %edi
	movq	%r14, %rsi
	movl	$4, %edx
	callq	_Q_strncpyz
	movq	_qfalse@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r12), %rcx
	movq	%rax, 8(%rcx,%rbx)
	movq	(%r12), %rax
	xorl	%ecx, %ecx
	cmpl	$0, (%rax,%rbx)
	cmoveq	%rcx, %r15
LBB0_7:
	movq	%r15, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_fs_searchpaths,4,2             ## @fs_searchpaths
	.comm	_ERR_FATAL,4,2                  ## @ERR_FATAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Filesystem call made without initialization\n"

	.comm	_qfalse,8,3                     ## @qfalse
	.comm	_fsh,8,3                        ## @fsh
	.comm	_fs_homepath,8,3                ## @fs_homepath
	.comm	_fs_gamedir,4,2                 ## @fs_gamedir
	.comm	_fs_debug,8,3                   ## @fs_debug
L_.str.1:                               ## @.str.1
	.asciz	"FS_FOpenFileWrite: %s\n"

L_.str.2:                               ## @.str.2
	.asciz	"wb"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_FS_FOpenFileWrite              ; -- Begin function FS_FOpenFileWrite
	.p2align	2
_FS_FOpenFileWrite:                     ; @FS_FOpenFileWrite
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _fs_searchpaths@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fs_searchpaths@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbnz	w8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _ERR_FATAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERR_FATAL@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_Com_Error
LBB0_2:
	bl	_FS_HandleForFile
	mov	x20, x0
Lloh8:
	adrp	x23, _qfalse@GOTPAGE
Lloh9:
	ldr	x23, [x23, _qfalse@GOTPAGEOFF]
	ldr	x8, [x23]
Lloh10:
	adrp	x22, _fsh@GOTPAGE
Lloh11:
	ldr	x22, [x22, _fsh@GOTPAGEOFF]
	ldr	x9, [x22]
	add	x9, x9, x0, lsl #5
Lloh12:
	adrp	x10, _fs_homepath@GOTPAGE
Lloh13:
	ldr	x10, [x10, _fs_homepath@GOTPAGEOFF]
	str	x8, [x9, #24]
Lloh14:
	ldr	x8, [x10]
	ldr	w0, [x8]
Lloh15:
	adrp	x8, _fs_gamedir@GOTPAGE
Lloh16:
	ldr	x8, [x8, _fs_gamedir@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_FS_BuildOSPath
	mov	x21, x0
Lloh18:
	adrp	x8, _fs_debug@GOTPAGE
Lloh19:
	ldr	x8, [x8, _fs_debug@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	ldr	x8, [x8]
	cbz	x8, LBB0_4
; %bb.3:
Lloh21:
	adrp	x0, l_.str.1@PAGE
Lloh22:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	bl	_Com_Printf
LBB0_4:
	mov	x0, x21
	bl	_FS_CreatePath
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, #0
	b	LBB0_7
LBB0_6:
Lloh23:
	adrp	x1, l_.str.2@PAGE
Lloh24:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_fopen
	ldr	x8, [x22]
	lsl	x21, x20, #5
	add	x8, x8, x21
	str	w0, [x8]
	ldr	w0, [x8, #16]
	mov	x1, x19
	mov	w2, #4
	bl	_Q_strncpyz
	ldr	x8, [x23]
	ldr	x9, [x22]
	add	x9, x9, x21
	str	x8, [x9, #8]
	ldr	x8, [x22]
	ldr	w8, [x8, x21]
	cmp	w8, #0
	csel	x0, xzr, x20, eq
LBB0_7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_fs_searchpaths,4,2             ; @fs_searchpaths
	.comm	_ERR_FATAL,4,2                  ; @ERR_FATAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Filesystem call made without initialization\n"

	.comm	_qfalse,8,3                     ; @qfalse
	.comm	_fsh,8,3                        ; @fsh
	.comm	_fs_homepath,8,3                ; @fs_homepath
	.comm	_fs_gamedir,4,2                 ; @fs_gamedir
	.comm	_fs_debug,8,3                   ; @fs_debug
l_.str.1:                               ; @.str.1
	.asciz	"FS_FOpenFileWrite: %s\n"

l_.str.2:                               ; @.str.2
	.asciz	"wb"

.subsections_via_symbols
