	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_do_kevent                      ## -- Begin function do_kevent
	.p2align	4, 0x90
_do_kevent:                             ## @do_kevent
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	xorl	%eax, %eax
	callq	_kqueue
	movl	%eax, %r15d
	xorl	%ebx, %ebx
	cmpl	$-1, %eax
	setne	%bl
	movq	_errno@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	callq	_strerror
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
	movq	_KEVNT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	xorl	%eax, %eax
	callq	_isQEMU
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movslq	%r12d, %rax
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rsi
	sarq	$38, %rsi
	movq	%rax, %rcx
	shrq	$63, %rcx
	addl	%ecx, %esi
	movl	(%r14), %edx
	cmpl	%edx, %esi
	jge	LBB0_4
## %bb.2:
	sarq	$37, %rax
	addl	%ecx, %eax
	cmpl	%edx, %eax
	jle	LBB0_4
## %bb.3:
	movq	_MAXSLEEP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
LBB0_4:
	movq	_EVFILT_TIMER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_EV_ADD@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$0, (%rsp)
	leaq	-56(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$1, %esi
	xorl	%r8d, %r8d
	movl	%r12d, %r9d
	callq	_EV_SET
	leaq	-48(%rbp), %rcx
	movl	%r15d, %edi
	movq	%rbx, %rsi
	movl	$1, %edx
	movl	$1, %r8d
	movq	%r14, %r9
	callq	_kevent
	movl	%eax, %ebx
	movl	(%r13), %r13d
	movl	%r15d, %edi
	callq	_close
	cmpl	$-1, %ebx
	je	LBB0_5
## %bb.6:
	movq	_BILLION@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	(%r14), %eax
	addl	4(%r14), %eax
	movq	_MILLION@GOTPCREL(%rip), %rcx
	imull	(%rcx), %r12d
	cmpl	%r12d, %eax
	jle	LBB0_8
## %bb.7:
	xorl	%edi, %edi
	testl	%ebx, %ebx
	setg	%dil
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
	jmp	LBB0_8
LBB0_5:
	movq	_EINTR@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpl	(%rax), %r13d
	sete	%bl
	movl	%r13d, %edi
	callq	_strerror
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
LBB0_8:
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kqueue: %s"

	.comm	_errno,4,2                      ## @errno
	.comm	_KEVNT_TIMEOUT,4,2              ## @KEVNT_TIMEOUT
	.comm	_MAXSLEEP,4,2                   ## @MAXSLEEP
	.comm	_EVFILT_TIMER,4,2               ## @EVFILT_TIMER
	.comm	_EV_ADD,4,2                     ## @EV_ADD
	.comm	_EINTR,4,2                      ## @EINTR
L_.str.1:                               ## @.str.1
	.asciz	"kevent: %s"

	.comm	_BILLION,4,2                    ## @BILLION
	.comm	_MILLION,4,2                    ## @MILLION
L_.str.2:                               ## @.str.2
	.asciz	"kevent: KEVNT_TIMEOUT did not cause EVFILT_TIMER event"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_do_kevent                      ; -- Begin function do_kevent
	.p2align	2
_do_kevent:                             ; @do_kevent
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	bl	_kqueue
	mov	x20, x0
	cmn	w0, #1
	cset	w21, ne
Lloh0:
	adrp	x23, _errno@GOTPAGE
Lloh1:
	ldr	x23, [x23, _errno@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_ATF_REQUIRE_MSG
Lloh4:
	adrp	x8, _KEVNT_TIMEOUT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _KEVNT_TIMEOUT@GOTPAGEOFF]
Lloh6:
	ldr	w21, [x8]
	bl	_isQEMU
	cbz	x0, LBB0_3
; %bb.1:
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w21, w8
	asr	x9, x8, #38
	lsr	x10, x8, #63
	ldr	w11, [x19]
	asr	x8, x8, #37
	add	w8, w8, w10
	add	w9, w9, w10
	cmp	w9, w11
	ccmp	w8, w11, #4, lt
	b.le	LBB0_3
; %bb.2:
Lloh7:
	adrp	x8, _MAXSLEEP@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MAXSLEEP@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_3:
Lloh10:
	adrp	x8, _EVFILT_TIMER@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EVFILT_TIMER@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
Lloh13:
	adrp	x8, _EV_ADD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EV_ADD@GOTPAGEOFF]
Lloh15:
	ldr	w3, [x8]
	add	x0, sp, #24
	mov	w1, #1
	mov	w4, #0
	mov	x5, x21
	mov	w6, #0
	bl	_EV_SET
	add	x1, sp, #24
	add	x3, sp, #16
	mov	x0, x20
	mov	w2, #1
	mov	w4, #1
	mov	x5, x19
	bl	_kevent
	mov	x22, x0
	ldr	w23, [x23]
	mov	x0, x20
	bl	_close
	cmn	w22, #1
	b.eq	LBB0_6
; %bb.4:
Lloh16:
	adrp	x8, _BILLION@GOTPAGE
Lloh17:
	ldr	x8, [x8, _BILLION@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	ldp	w9, w10, [x19]
	madd	w8, w8, w9, w10
Lloh19:
	adrp	x9, _MILLION@GOTPAGE
Lloh20:
	ldr	x9, [x9, _MILLION@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	mul	w9, w9, w21
	cmp	w8, w9
	b.le	LBB0_8
; %bb.5:
	cmp	w22, #0
	cset	w0, gt
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_7
LBB0_6:
Lloh24:
	adrp	x8, _EINTR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	cmp	w23, w8
	cset	w19, eq
	mov	x0, x23
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh27:
	adrp	x1, l_.str.1@PAGE
Lloh28:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
LBB0_7:
	bl	_ATF_REQUIRE_MSG
LBB0_8:
	mov	w0, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kqueue: %s"

	.comm	_errno,4,2                      ; @errno
	.comm	_KEVNT_TIMEOUT,4,2              ; @KEVNT_TIMEOUT
	.comm	_MAXSLEEP,4,2                   ; @MAXSLEEP
	.comm	_EVFILT_TIMER,4,2               ; @EVFILT_TIMER
	.comm	_EV_ADD,4,2                     ; @EV_ADD
	.comm	_EINTR,4,2                      ; @EINTR
l_.str.1:                               ; @.str.1
	.asciz	"kevent: %s"

	.comm	_BILLION,4,2                    ; @BILLION
	.comm	_MILLION,4,2                    ; @MILLION
l_.str.2:                               ; @.str.2
	.asciz	"kevent: KEVNT_TIMEOUT did not cause EVFILT_TIMER event"

.subsections_via_symbols
