	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_FS_FOpenFileByMode             ## -- Begin function FS_FOpenFileByMode
	.p2align	4, 0x90
_FS_FOpenFileByMode:                    ## @FS_FOpenFileByMode
	.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
	movl	%edx, %r14d
	leal	-128(%r14), %eax
	cmpl	$3, %eax
	ja	LBB0_6
## %bb.1:
	movq	%rsi, %r15
	movq	_qfalse@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r12
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_2:
	callq	_FS_FOpenFileWrite
	jmp	LBB0_3
LBB0_6:
	movq	_ERR_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_Com_Error
	movl	$-1, %ebx
	jmp	LBB0_17
LBB0_7:
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%r15, %rsi
	callq	_FS_FOpenFileRead
	movl	%eax, %ebx
	testq	%r15, %r15
	je	LBB0_17
## %bb.8:
	movl	(%r15), %eax
	testl	%eax, %eax
	jne	LBB0_11
LBB0_10:
	xorl	%edi, %edi
	jmp	LBB0_16
LBB0_4:
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
LBB0_5:
	callq	_FS_FOpenFileAppend
LBB0_3:
	movl	%eax, (%r15)
	xorl	%ebx, %ebx
	cmpl	$1, %eax
	sbbl	%ebx, %ebx
	testl	%eax, %eax
	je	LBB0_10
LBB0_11:
	movq	_fsh@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	cltq
	leaq	(%rax,%rax,2), %rax
	shlq	$4, %rax
	movq	(%rcx,%rax), %rdx
	movq	_qtrue@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_13
## %bb.12:
	movl	36(%rcx,%rax), %edi
	callq	_unztell
	jmp	LBB0_14
LBB0_13:
	movl	32(%rcx,%rax), %edi
	callq	_ftell
LBB0_14:
	movq	(%r13), %rcx
	movslq	(%r15), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	shlq	$4, %rdx
	movl	%eax, 40(%rcx,%rdx)
	movslq	(%r15), %rax
	leaq	(%rax,%rax,2), %rax
	shlq	$4, %rax
	movl	%ebx, 8(%rcx,%rax)
	movq	_qfalse@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	(%r15), %rdi
	leaq	(%rdi,%rdi,2), %rdx
	shlq	$4, %rdx
	movq	%rax, 24(%rcx,%rdx)
	cmpl	$129, %r14d
	jne	LBB0_16
## %bb.15:
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$16384, %esi                    ## imm = 0x4000
	callq	_Sys_BeginStreamedFile
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %rcx
	movslq	(%r15), %rdi
	leaq	(%rdi,%rdi,2), %rdx
	shlq	$4, %rdx
	movq	%rax, 24(%rcx,%rdx)
LBB0_16:
	movq	_fsh@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%edi, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	shlq	$4, %rcx
	movq	%r12, 16(%rax,%rcx)
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
LJTI0_0:
	.long	L0_0_set_2
	.long	L0_0_set_7
	.long	L0_0_set_4
	.long	L0_0_set_5
	.end_data_region
                                        ## -- End function
	.comm	_qfalse,8,3                     ## @qfalse
	.comm	_qtrue,8,3                      ## @qtrue
	.comm	_ERR_FATAL,4,2                  ## @ERR_FATAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"FSH_FOpenFile: bad mode"

	.comm	_fsh,8,3                        ## @fsh
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_FS_FOpenFileByMode             ; -- Begin function FS_FOpenFileByMode
	.p2align	2
_FS_FOpenFileByMode:                    ; @FS_FOpenFileByMode
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	sub	w8, w2, #128
	cmp	w8, #3
	b.hi	LBB0_3
; %bb.1:
	mov	x20, x2
	mov	x19, x1
Lloh0:
	adrp	x23, _qfalse@GOTPAGE
Lloh1:
	ldr	x23, [x23, _qfalse@GOTPAGEOFF]
	ldr	x22, [x23]
Lloh2:
	adrp	x9, lJTI0_0@PAGE
Lloh3:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_2
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_2:
	bl	_FS_FOpenFileWrite
	b	LBB0_8
LBB0_3:
Lloh4:
	adrp	x8, _ERR_FATAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ERR_FATAL@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_Com_Error
	mov	w21, #-1
	b	LBB0_16
LBB0_4:
Lloh9:
	adrp	x8, _qtrue@GOTPAGE
Lloh10:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh11:
	ldr	x2, [x8]
	mov	x1, x19
	bl	_FS_FOpenFileRead
	mov	x21, x0
	cbz	x19, LBB0_16
; %bb.5:
	ldr	w0, [x19]
	b	LBB0_9
LBB0_6:
Lloh12:
	adrp	x8, _qtrue@GOTPAGE
Lloh13:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh14:
	ldr	x22, [x8]
LBB0_7:
	bl	_FS_FOpenFileAppend
LBB0_8:
                                        ; kill: def $w0 killed $w0 def $x0
	str	w0, [x19]
	cmp	w0, #0
	csetm	w21, eq
LBB0_9:
Lloh15:
	adrp	x24, _fsh@GOTPAGE
Lloh16:
	ldr	x24, [x24, _fsh@GOTPAGEOFF]
	cbz	w0, LBB0_15
; %bb.10:
	ldr	x8, [x24]
	sxtw	x9, w0
	mov	w10, #48
	smull	x10, w0, w10
	ldr	x10, [x8, x10]
Lloh17:
	adrp	x25, _qtrue@GOTPAGE
Lloh18:
	ldr	x25, [x25, _qtrue@GOTPAGEOFF]
	ldr	x11, [x25]
	cmp	x10, x11
	b.ne	LBB0_12
; %bb.11:
	mov	w10, #48
	madd	x8, x9, x10, x8
	ldr	w0, [x8, #36]
	bl	_unztell
	b	LBB0_13
LBB0_12:
	mov	w10, #48
	madd	x8, x9, x10, x8
	ldr	w0, [x8, #32]
	bl	_ftell
LBB0_13:
	ldr	x8, [x24]
	ldrsw	x9, [x19]
	mov	w10, #48
	madd	x9, x9, x10, x8
	str	w0, [x9, #40]
	ldrsw	x9, [x19]
	madd	x9, x9, x10, x8
	str	w21, [x9, #8]
	ldr	x9, [x23]
	ldrsw	x0, [x19]
	madd	x8, x0, x10, x8
	str	x9, [x8, #24]
	cmp	w20, #129
	b.ne	LBB0_15
; %bb.14:
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	w1, #16384
	bl	_Sys_BeginStreamedFile
	ldr	x8, [x25]
	ldr	x9, [x24]
	ldrsw	x0, [x19]
	mov	w10, #48
	madd	x9, x0, x10, x9
	str	x8, [x9, #24]
                                        ; kill: def $w0 killed $w0 killed $x0 def $x0
LBB0_15:
	ldr	x8, [x24]
	mov	w9, #48
	smaddl	x8, w0, w9, x8
	str	x22, [x8, #16]
LBB0_16:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_4-LBB0_2)>>2
	.byte	(LBB0_6-LBB0_2)>>2
	.byte	(LBB0_7-LBB0_2)>>2
                                        ; -- End function
	.comm	_qfalse,8,3                     ; @qfalse
	.comm	_qtrue,8,3                      ; @qtrue
	.comm	_ERR_FATAL,4,2                  ; @ERR_FATAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"FSH_FOpenFile: bad mode"

	.comm	_fsh,8,3                        ; @fsh
.subsections_via_symbols
