	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_next_event                     ## -- Begin function next_event
	.p2align	4, 0x90
_next_event:                            ## @next_event
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	-48(%rbp), %rdi
	xorl	%esi, %esi
	callq	_gettimeofday
	cmpl	$-1, %eax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_2:
	leaq	24(%r15), %rdi
	leaq	-48(%rbp), %rsi
	callq	_elapsed
	movl	(%r15), %ecx
	cmpl	%ecx, %eax
	jl	LBB0_4
## %bb.3:
	movq	%r15, %rdi
	callq	_send_beacon
	movl	(%r15), %ecx
	xorl	%eax, %eax
LBB0_4:
	subl	%eax, %ecx
	movslq	%ecx, %r14
	imulq	$1125899907, %r14, %rbx         ## imm = 0x431BDE83
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$50, %rbx
	addl	%eax, %ebx
	movl	%ebx, -40(%rbp)
	imull	$-1000000, %ebx, %eax           ## imm = 0xFFF0BDC0
	addl	%eax, %r14d
	movl	%r14d, -36(%rbp)
	cmpq	$0, 16(%r15)
	je	LBB0_10
## %bb.5:
	leaq	12(%r15), %rdi
	leaq	-48(%rbp), %rsi
	callq	_elapsed
	cmpl	$3000, %eax                     ## imm = 0xBB8
	jl	LBB0_7
## %bb.6:
	movq	%r15, %rdi
	callq	_retransmit
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jne	LBB0_8
	jmp	LBB0_10
LBB0_7:
	cmpl	$-1, %eax
	je	LBB0_10
LBB0_8:
	movl	$3000, %ecx                     ## imm = 0xBB8
	subl	%eax, %ecx
	imull	$1000000, %ebx, %eax            ## imm = 0xF4240
	addl	%r14d, %eax
	cmpl	%ecx, %eax
	jle	LBB0_10
## %bb.9:
	movl	%ecx, %eax
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	shrq	$50, %rax
	movl	%eax, -40(%rbp)
	imull	$-1000000, %eax, %eax           ## imm = 0xFFF0BDC0
	addl	%ecx, %eax
	movl	%eax, -36(%rbp)
LBB0_10:
	leaq	-28(%rbp), %r14
	movq	%r14, %rdi
	callq	_FD_ZERO
	movl	4(%r15), %edi
	movq	%r14, %rsi
	callq	_FD_SET
	movl	8(%r15), %edi
	movq	%r14, %rsi
	callq	_FD_SET
	movl	4(%r15), %eax
	movl	8(%r15), %edi
	cmpl	%edi, %eax
	cmovgl	%eax, %edi
	incl	%edi
	leaq	-40(%rbp), %r8
	movq	%r14, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_select
	cmpl	$-1, %eax
	jne	LBB0_12
## %bb.11:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_12:
	movl	8(%r15), %edi
	leaq	-28(%rbp), %rsi
	callq	_FD_ISSET
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movq	%r15, %rdi
	callq	_read_tap
LBB0_14:
	movl	4(%r15), %edi
	leaq	-28(%rbp), %rsi
	callq	_FD_ISSET
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	%r15, %rdi
	callq	_read_wifi
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"gettimeofday()"

L_.str.1:                               ## @.str.1
	.asciz	"select()"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_next_event                     ; -- Begin function next_event
	.p2align	2
_next_event:                            ; @next_event
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
	add	x0, sp, #16
	mov	x1, #0
	bl	_gettimeofday
	cmn	w0, #1
	b.ne	LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_2:
	add	x0, x19, #24
	add	x1, sp, #16
	bl	_elapsed
	ldr	w8, [x19]
	cmp	w0, w8
	b.lt	LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_send_beacon
	mov	w0, #0
	ldr	w8, [x19]
LBB0_4:
	mov	w20, #48576
	movk	w20, #65520, lsl #16
	sub	w8, w8, w0
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	smull	x9, w8, w9
	lsr	x10, x9, #63
	asr	x9, x9, #50
	add	w21, w9, w10
	madd	w22, w21, w20, w8
	stp	w21, w22, [sp, #24]
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_11
; %bb.5:
	add	x0, x19, #12
	add	x1, sp, #16
	bl	_elapsed
	cmp	w0, #3000
	b.lt	LBB0_8
; %bb.6:
	mov	x0, x19
	bl	_retransmit
	cbz	x0, LBB0_11
; %bb.7:
	mov	w0, #0
	b	LBB0_9
LBB0_8:
	cmn	w0, #1
	b.eq	LBB0_11
LBB0_9:
	mov	w8, #16960
	movk	w8, #15, lsl #16
	mov	w9, #3000
	madd	w10, w21, w8, w22
	sub	w9, w9, w0
	cmp	w10, w9
	b.le	LBB0_11
; %bb.10:
	udiv	w8, w9, w8
	madd	w9, w8, w20, w9
	stp	w8, w9, [sp, #24]
LBB0_11:
	add	x0, sp, #12
	bl	_FD_ZERO
	ldr	w0, [x19, #4]
	add	x1, sp, #12
	bl	_FD_SET
	ldr	w0, [x19, #8]
	add	x1, sp, #12
	bl	_FD_SET
	ldp	w8, w9, [x19, #4]
	cmp	w8, w9
	csel	w8, w8, w9, gt
	add	w0, w8, #1
	add	x1, sp, #12
	add	x4, sp, #24
	mov	x2, #0
	mov	x3, #0
	bl	_select
	cmn	w0, #1
	b.ne	LBB0_13
; %bb.12:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_13:
	ldr	w0, [x19, #8]
	add	x1, sp, #12
	bl	_FD_ISSET
	cbz	x0, LBB0_15
; %bb.14:
	mov	x0, x19
	bl	_read_tap
LBB0_15:
	ldr	w0, [x19, #4]
	add	x1, sp, #12
	bl	_FD_ISSET
	cbz	x0, LBB0_17
; %bb.16:
	mov	x0, x19
	bl	_read_wifi
LBB0_17:
	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
	add	sp, sp, #80
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"gettimeofday()"

l_.str.1:                               ; @.str.1
	.asciz	"select()"

.subsections_via_symbols
