	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fopencookie                    ## -- Begin function fopencookie
	.p2align	4, 0x90
_fopencookie:                           ## @fopencookie
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rax
	movq	%rdi, %r12
	leaq	-36(%rbp), %rsi
	movq	%rax, %rdi
	callq	___sflags
	testl	%eax, %eax
	je	LBB0_10
## %bb.1:
	movl	%eax, %ebx
	movl	$16, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.2:
	movq	%rax, %r15
	movq	%r12, 8(%rax)
	movl	%r14d, (%rax)
	movq	___SWR@GOTPCREL(%rip), %rcx
	movq	___SRD@GOTPCREL(%rip), %rax
	xorl	%esi, %esi
	cmpl	(%rax), %ebx
	movq	__fopencookie_write@GOTPCREL(%rip), %rdx
	movq	%rdx, %rax
	cmoveq	%rsi, %rax
	cmpl	(%rcx), %ebx
	je	LBB0_4
## %bb.3:
	movq	__fopencookie_read@GOTPCREL(%rip), %rsi
	movq	%rax, %rdx
LBB0_4:
	movq	__fopencookie_seek@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	__fopencookie_close@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r15, %rdi
	callq	_funopen
	testq	%rax, %rax
	je	LBB0_9
## %bb.5:
	movq	_O_APPEND@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, -36(%rbp)
	je	LBB0_11
## %bb.6:
	movq	___SAPP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, (%rax)
	jmp	LBB0_11
LBB0_9:
	movq	%r15, %rdi
	callq	_free
LBB0_10:
	xorl	%eax, %eax
LBB0_11:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	___SWR,4,2                      ## @__SWR
	.comm	___SRD,4,2                      ## @__SRD
	.comm	__fopencookie_seek,4,2          ## @_fopencookie_seek
	.comm	__fopencookie_close,4,2         ## @_fopencookie_close
	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.comm	___SAPP,4,2                     ## @__SAPP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fopencookie                    ; -- Begin function fopencookie
	.p2align	2
_fopencookie:                           ; @fopencookie
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x2
	mov	x8, x1
	mov	x22, x0
	add	x1, sp, #12
	mov	x0, x8
	bl	___sflags
	cbz	w0, LBB0_6
; %bb.1:
	mov	x21, x0
	mov	w0, #16
	bl	_malloc
	cbz	x0, LBB0_7
; %bb.2:
	mov	x19, x0
	str	x22, [x0, #8]
	str	w20, [x0]
Lloh0:
	adrp	x8, ___SWR@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___SWR@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, ___SRD@GOTPAGE
Lloh4:
	ldr	x9, [x9, ___SRD@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, __fopencookie_write@GOTPAGE
Lloh7:
	ldr	x10, [x10, __fopencookie_write@GOTPAGEOFF]
	cmp	w21, w9
	csel	x9, xzr, x10, eq
	cmp	w21, w8
	csel	x2, x10, x9, eq
Lloh8:
	adrp	x8, __fopencookie_read@GOTPAGE
Lloh9:
	ldr	x8, [x8, __fopencookie_read@GOTPAGEOFF]
	csel	x1, xzr, x8, eq
Lloh10:
	adrp	x8, __fopencookie_seek@GOTPAGE
Lloh11:
	ldr	x8, [x8, __fopencookie_seek@GOTPAGEOFF]
Lloh12:
	ldr	w3, [x8]
Lloh13:
	adrp	x8, __fopencookie_close@GOTPAGE
Lloh14:
	ldr	x8, [x8, __fopencookie_close@GOTPAGEOFF]
Lloh15:
	ldr	w4, [x8]
	bl	_funopen
	cbz	x0, LBB0_5
; %bb.3:
	ldr	w8, [sp, #12]
Lloh16:
	adrp	x9, _O_APPEND@GOTPAGE
Lloh17:
	ldr	x9, [x9, _O_APPEND@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.4:
Lloh19:
	adrp	x8, ___SAPP@GOTPAGE
Lloh20:
	ldr	x8, [x8, ___SAPP@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	ldr	w9, [x0]
	orr	w8, w9, w8
	str	w8, [x0]
	b	LBB0_7
LBB0_5:
	mov	x0, x19
	bl	_free
LBB0_6:
	mov	x0, #0
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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	___SWR,4,2                      ; @__SWR
	.comm	___SRD,4,2                      ; @__SRD
	.comm	__fopencookie_seek,4,2          ; @_fopencookie_seek
	.comm	__fopencookie_close,4,2         ; @_fopencookie_close
	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.comm	___SAPP,4,2                     ; @__SAPP
.subsections_via_symbols
