	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_remove_event_from_heap         ## -- Begin function remove_event_from_heap
	.p2align	4, 0x90
_remove_event_from_heap:                ## @remove_event_from_heap
	.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	%esi, %ebx
	movq	%rdi, %r15
	movslq	(%rdi), %rax
	movq	_ev_heap_size@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	testl	%eax, %eax
	setns	%cl
	movq	_MAX_EVENTS@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %eax
	setl	%dl
	andb	%cl, %dl
	movq	_Events@GOTPCREL(%rip), %rcx
	shlq	$3, %rax
	addq	(%rcx), %rax
	cmpq	%rdi, %rax
	sete	%al
	andb	%dl, %al
	movzbl	%al, %edi
	callq	_assert
	movl	4(%r15), %r13d
	testl	%r13d, %r13d
	je	LBB0_5
## %bb.1:
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	setg	%al
	cmpl	%r12d, %r13d
	setle	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	movl	$0, 4(%r15)
	leal	(%r13,%r13), %r14d
	cmpl	%r12d, %r14d
	jle	LBB0_6
## %bb.2:
	movl	%r13d, %ebx
LBB0_3:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.4:
	movq	_ev_heap@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movq	$0, (%rax,%rcx,8)
	movl	%ebx, %r12d
	jmp	LBB0_21
LBB0_5:
	xorl	%r12d, %r12d
	jmp	LBB0_21
LBB0_6:
	movq	_ev_heap@GOTPCREL(%rip), %r15
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_9 Depth=1
	movl	%ebx, %r14d
LBB0_8:                                 ##   in Loop: Header=BB0_9 Depth=1
	movl	%r14d, %ebx
	movq	(%r15), %rax
	movslq	%r14d, %r14
	movq	(%rax,%r14,8), %rcx
	movslq	%r13d, %rdx
	movq	%rcx, (%rax,%rdx,8)
	movl	%edx, 4(%rcx)
	addl	%r14d, %r14d
	movl	%ebx, %r13d
	cmpl	%r12d, %r14d
	jg	LBB0_3
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%r12d, %r14d
	jge	LBB0_8
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	(%r15), %rax
	movl	%r14d, %ebx
	orl	$1, %ebx
	movslq	%ebx, %rcx
	movq	(%rax,%rcx,8), %rdi
	movslq	%r14d, %rcx
	movq	(%rax,%rcx,8), %rsi
	callq	_cmp_ev
	testq	%rax, %rax
	js	LBB0_7
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%r14d, %ebx
	jmp	LBB0_7
LBB0_12:
	cmpl	%r12d, %ebx
	jge	LBB0_20
## %bb.13:
	movslq	%r12d, %rax
	movq	_ev_heap@GOTPCREL(%rip), %r14
	movq	(%r14), %rcx
	movq	(%rcx,%rax,8), %rsi
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	$0, (%rcx,%rax,8)
	cmpl	$2, %ebx
	jl	LBB0_18
## %bb.14:
	movl	%ebx, %r13d
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	shrl	%r13d
	movq	(%r14), %rax
	movq	(%rax,%r13,8), %r15
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_cmp_ev
	testq	%rax, %rax
	jle	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	(%r14), %rax
	movl	%ebx, %ecx
	movq	%r15, (%rax,%rcx,8)
	movl	%ebx, 4(%r15)
	cmpl	$3, %ebx
	movl	%r13d, %ebx
	ja	LBB0_15
	jmp	LBB0_19
LBB0_18:
	movl	%ebx, %r13d
LBB0_19:
	movq	(%r14), %rax
	movslq	%r13d, %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	%rdx, (%rax,%rcx,8)
	movl	%ecx, 4(%rdx)
LBB0_20:
	movq	_ev_heap_size@GOTPCREL(%rip), %rax
	decl	(%rax)
LBB0_21:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ev_heap_size,4,2               ## @ev_heap_size
	.comm	_MAX_EVENTS,4,2                 ## @MAX_EVENTS
	.comm	_Events,8,3                     ## @Events
	.comm	_ev_heap,8,3                    ## @ev_heap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_remove_event_from_heap         ; -- Begin function remove_event_from_heap
	.p2align	2
_remove_event_from_heap:                ; @remove_event_from_heap
	.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
	mov	x19, x1
	mov	x20, x0
	ldrsw	x8, [x0]
Lloh0:
	adrp	x22, _ev_heap_size@GOTPAGE
Lloh1:
	ldr	x22, [x22, _ev_heap_size@GOTPAGEOFF]
	ldr	w23, [x22]
	cmp	w8, #0
Lloh2:
	adrp	x9, _MAX_EVENTS@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MAX_EVENTS@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	ccmp	w8, w9, #0, ge
Lloh5:
	adrp	x9, _Events@GOTPAGE
Lloh6:
	ldr	x9, [x9, _Events@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	add	x8, x9, x8, lsl #3
	ccmp	x8, x0, #0, lt
	cset	w0, eq
	bl	_assert
	ldr	w21, [x20, #4]
	cbz	w21, LBB0_8
; %bb.1:
	cmp	w21, #0
	ccmp	w21, w23, #0, gt
	cset	w0, le
	bl	_assert
	str	wzr, [x20, #4]
	lsl	w25, w21, #1
Lloh8:
	adrp	x24, _ev_heap@GOTPAGE
Lloh9:
	ldr	x24, [x24, _ev_heap@GOTPAGEOFF]
	cmp	w25, w23
	b.le	LBB0_6
; %bb.2:
	mov	x20, x21
LBB0_3:
	cbz	w19, LBB0_9
; %bb.4:
	ldr	x8, [x24]
	str	xzr, [x8, w20, sxtw #3]
	b	LBB0_16
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x20, x25
	ldr	x8, [x24]
	ldr	x9, [x8, w25, sxtw #3]
	str	x9, [x8, w21, sxtw #3]
	str	w21, [x9, #4]
	lsl	w25, w25, #1
	mov	x21, x20
	cmp	w25, w23
	b.gt	LBB0_3
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w25, w23
	b.ge	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x24]
	sxtw	x9, w25
	orr	x20, x9, #0x1
	ldr	x0, [x8, x20, lsl #3]
	ldr	x1, [x8, w25, sxtw #3]
	bl	_cmp_ev
	cmp	x0, #0
	csel	w25, w20, w25, lt
	b	LBB0_5
LBB0_8:
	mov	w20, #0
	b	LBB0_16
LBB0_9:
	cmp	w20, w23
	b.ge	LBB0_15
; %bb.10:
	sxtw	x8, w23
	ldr	x9, [x24]
	lsl	x8, x8, #3
	ldr	x19, [x9, x8]
	str	xzr, [x9, x8]
	cmp	w20, #2
	b.lt	LBB0_13
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	lsr	w25, w20, #1
	ldr	x8, [x24]
	ldr	x21, [x8, w25, uxtw #3]
	mov	x0, x21
	mov	x1, x19
	bl	_cmp_ev
	cmp	x0, #1
	b.lt	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x8, [x24]
	str	x21, [x8, w20, uxtw #3]
	str	w20, [x21, #4]
	cmp	w20, #3
	mov	x20, x25
	b.hi	LBB0_11
	b	LBB0_14
LBB0_13:
	mov	x25, x20
LBB0_14:
	ldr	x8, [x24]
	str	x19, [x8, w25, sxtw #3]
	str	w25, [x19, #4]
LBB0_15:
	ldr	w8, [x22]
	sub	w8, w8, #1
	str	w8, [x22]
	mov	x20, x23
LBB0_16:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_ev_heap_size,4,2               ; @ev_heap_size
	.comm	_MAX_EVENTS,4,2                 ; @MAX_EVENTS
	.comm	_Events,8,3                     ; @Events
	.comm	_ev_heap,8,3                    ; @ev_heap
.subsections_via_symbols
