	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ibmasm_get_next_event          ## -- Begin function ibmasm_get_next_event
	.p2align	4, 0x90
_ibmasm_get_next_event:                 ## @ibmasm_get_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	%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
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	8(%rdi), %r12
	movq	$0, 16(%rsi)
	movl	24(%rsi), %ebx
	movq	%r12, %rdi
	callq	_event_available
	movl	$1, %esi
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	xorl	%esi, %esi
	cmpq	$0, 16(%r15)
	setne	%sil
LBB0_2:
	movl	%ebx, %edi
	callq	_wait_event_interruptible
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_12
LBB0_4:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_event_available
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	(%r12), %r13d
	movq	8(%r12), %r12
	movq	(%r15), %rcx
	movq	%r13, %rbx
	shlq	$4, %rbx
	cmpq	%rcx, (%r12,%rbx)
	jge	LBB0_7
## %bb.8:
	movq	_IBMASM_NUM_EVENTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	incl	%r13d
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%edx, %r13d
	movq	%r13, %rbx
	shlq	$4, %rbx
	cmpq	%rcx, (%r12,%rbx)
	jl	LBB0_9
## %bb.10:
	addq	%r12, %rbx
	movl	%r13d, %r13d
	jmp	LBB0_11
LBB0_5:
	xorl	%eax, %eax
	jmp	LBB0_12
LBB0_7:
	addq	%r12, %rbx
LBB0_11:
	movl	12(%r15), %edi
	shlq	$4, %r13
	movl	8(%r12,%r13), %edx
	movl	12(%r12,%r13), %esi
	callq	_memcpy
	movl	8(%r12,%r13), %eax
	movl	%eax, 8(%r15)
	movq	(%rbx), %rax
	incq	%rax
	movq	%rax, (%r15)
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	movl	8(%r12,%r13), %eax
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
	.comm	_IBMASM_NUM_EVENTS,4,2          ## @IBMASM_NUM_EVENTS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ibmasm_get_next_event          ; -- Begin function ibmasm_get_next_event
	.p2align	2
_ibmasm_get_next_event:                 ; @ibmasm_get_next_event
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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, x1
	mov	x19, x0
	ldr	x21, [x0, #8]
	str	xzr, [x1, #16]
	ldr	w22, [x1, #24]
	mov	x0, x21
	bl	_event_available
	cbz	x0, LBB0_2
; %bb.1:
	mov	w1, #1
	b	LBB0_3
LBB0_2:
	ldr	x8, [x20, #16]
	cmp	x8, #0
	cset	w1, ne
LBB0_3:
	mov	x0, x22
	bl	_wait_event_interruptible
	cbz	x0, LBB0_5
; %bb.4:
Lloh0:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_5:
	mov	x0, x21
	mov	x1, x20
	bl	_event_available
	cbz	x0, LBB0_10
; %bb.6:
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	w9, [x21]
	ldr	x8, [x21, #8]
	ldr	x10, [x20]
	add	x21, x8, w9, uxtw #4
	ldr	x11, [x21]
	cmp	x11, x10
	b.ge	LBB0_9
; %bb.7:
Lloh3:
	adrp	x11, _IBMASM_NUM_EVENTS@GOTPAGE
Lloh4:
	ldr	x11, [x11, _IBMASM_NUM_EVENTS@GOTPAGEOFF]
Lloh5:
	ldr	w11, [x11]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	add	w9, w9, #1
	udiv	w12, w9, w11
	msub	w9, w12, w11, w9
	add	x21, x8, w9, uxtw #4
	ldr	x12, [x21]
	cmp	x12, x10
	b.lt	LBB0_8
LBB0_9:
	ldr	w0, [x20, #12]
	add	x22, x8, x9, lsl #4
	ldp	w2, w1, [x22, #8]
	bl	_memcpy
	ldr	w8, [x22, #8]
	str	w8, [x20, #8]
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x20]
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	ldr	w0, [x22, #8]
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
	.comm	_IBMASM_NUM_EVENTS,4,2          ; @IBMASM_NUM_EVENTS
.subsections_via_symbols
