	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function safe_read
_safe_read:                             ## @safe_read
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdx, %rdx
	je	LBB0_8
## %bb.1:
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	_DEFAULT_NSCD_IO_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	movq	$0, -56(%rbp)
	xorl	%r13d, %r13d
	movl	$-1, %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%r15), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	-80(%rbp), %rcx
	movl	$1, %r8d
	leaq	-56(%rbp), %r9
	callq	_kevent
	cmpl	$1, %eax
	jne	LBB0_9
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-80(%rbp), %rax
	movq	_EVFILT_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15), %edi
	leaq	(%r14,%r13), %rsi
	movq	-64(%rbp), %rax
	movq	%rbx, %rdx
	subq	%r13, %rdx
	cmpq	%rdx, %rax
	cmovbq	%rax, %rdx
	callq	_read
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	cltq
	addq	%rax, %r13
	movq	_EV_EOF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -72(%rbp)
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%rbx, %r13
	jb	LBB0_2
LBB0_8:
	xorl	%r12d, %r12d
	jmp	LBB0_9
LBB0_6:
	xorl	%r12d, %r12d
	cmpq	%rbx, %r13
	sbbl	%r12d, %r12d
LBB0_9:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DEFAULT_NSCD_IO_TIMEOUT,4,2    ## @DEFAULT_NSCD_IO_TIMEOUT
	.comm	_EVFILT_READ,8,3                ## @EVFILT_READ
	.comm	_EV_EOF,4,2                     ## @EV_EOF
	.no_dead_strip	_safe_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function safe_read
_safe_read:                             ; @safe_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	cbz	x2, LBB0_7
; %bb.1:
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	mov	x22, #0
Lloh0:
	adrp	x8, _DEFAULT_NSCD_IO_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DEFAULT_NSCD_IO_TIMEOUT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #16]
	str	xzr, [sp, #8]
Lloh3:
	adrp	x23, _EVFILT_READ@GOTPAGE
Lloh4:
	ldr	x23, [x23, _EVFILT_READ@GOTPAGEOFF]
Lloh5:
	adrp	x24, _EV_EOF@GOTPAGE
Lloh6:
	ldr	x24, [x24, _EV_EOF@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x21, #4]
	add	x3, sp, #24
	add	x5, sp, #8
	mov	x1, #0
	mov	w2, #0
	mov	w4, #1
	bl	_kevent
	cmp	w0, #1
	b.ne	LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [sp, #24]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x21]
	add	x1, x20, x22
	ldr	x8, [sp, #40]
	sub	x9, x19, x22
	cmp	x8, x9
	csel	x2, x8, x9, lo
	bl	_read
	cmn	w0, #1
	b.eq	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x22, x22, w0, sxtw
	ldr	w8, [sp, #32]
	ldr	w9, [x24]
	tst	w9, w8
	b.ne	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	x22, x19
	b.lo	LBB0_2
LBB0_7:
	mov	w0, #0
	b	LBB0_10
LBB0_8:
	mov	w0, #-1
	b	LBB0_10
LBB0_9:
	cmp	x22, x19
	csetm	w0, lo
LBB0_10:
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_DEFAULT_NSCD_IO_TIMEOUT,4,2    ; @DEFAULT_NSCD_IO_TIMEOUT
	.comm	_EVFILT_READ,8,3                ; @EVFILT_READ
	.comm	_EV_EOF,4,2                     ; @EV_EOF
	.no_dead_strip	_safe_read
.subsections_via_symbols
