	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvm_assign_ioeventfd
_kvm_assign_ioeventfd:                  ## @kvm_assign_ioeventfd
	.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, %rbx
	movq	%rdi, %r12
	movl	(%rsi), %eax
	movl	4(%rsi), %edx
	movq	_KVM_IOEVENTFD_FLAG_PIO@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_1
## %bb.2:
	movq	_KVM_MMIO_BUS@GOTPCREL(%rip), %rcx
	cmpl	$8, %edx
	jbe	LBB0_4
	jmp	LBB0_5
LBB0_1:
	movq	_KVM_PIO_BUS@GOTPCREL(%rip), %rcx
	cmpl	$8, %edx
	ja	LBB0_5
LBB0_4:
	movl	$278, %esi                      ## imm = 0x116
	btl	%edx, %esi
	jae	LBB0_5
## %bb.6:
	movq	_KVM_IOEVENTFD_VALID_FLAG_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	notl	%edx
	testl	%edx, %eax
	je	LBB0_7
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_19:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	(%rcx), %r13d
	movl	20(%rbx), %edi
	callq	_eventfd_ctx_fdget
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_8
## %bb.20:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_8:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$40, %edi
	callq	_kzalloc
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	leaq	16(%r15), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_INIT_LIST_HEAD
	movq	8(%rbx), %rax
	movq	%rax, (%r15)
	movl	4(%rbx), %eax
	movl	%eax, 8(%r15)
	movq	%r14, 32(%r15)
	movq	_KVM_IOEVENTFD_FLAG_DATAMATCH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_12
## %bb.11:
	movl	16(%rbx), %eax
	movl	%eax, 24(%r15)
	jmp	LBB0_13
LBB0_9:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_12:
	movl	$1, 12(%r15)
LBB0_13:
	movq	%r12, %rdi
	callq	_mutex_lock
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_ioeventfd_check_collision
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	_EEXIST@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_17:
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_18:
	movq	%r15, %rdi
	callq	_kfree
	movq	%r14, %rdi
	callq	_eventfd_ctx_put
	jmp	LBB0_19
LBB0_15:
	movq	%r15, %rbx
	addq	$20, %rbx
	movq	_ioeventfd_ops@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	callq	_kvm_iodevice_init
	movq	%r12, %rdi
	movl	%r13d, %esi
	movq	%rbx, %rdx
	callq	_kvm_io_bus_register_dev
	testl	%eax, %eax
	js	LBB0_16
## %bb.21:
	leaq	4(%r12), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_list_add_tail
	movq	%r12, %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_19
LBB0_16:
	movl	%eax, %ebx
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_KVM_IOEVENTFD_FLAG_PIO,4,2     ## @KVM_IOEVENTFD_FLAG_PIO
	.comm	_KVM_PIO_BUS,4,2                ## @KVM_PIO_BUS
	.comm	_KVM_MMIO_BUS,4,2               ## @KVM_MMIO_BUS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_KVM_IOEVENTFD_VALID_FLAG_MASK,4,2 ## @KVM_IOEVENTFD_VALID_FLAG_MASK
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_KVM_IOEVENTFD_FLAG_DATAMATCH,4,2 ## @KVM_IOEVENTFD_FLAG_DATAMATCH
	.comm	_EEXIST,4,2                     ## @EEXIST
	.comm	_ioeventfd_ops,4,2              ## @ioeventfd_ops
	.no_dead_strip	_kvm_assign_ioeventfd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvm_assign_ioeventfd
_kvm_assign_ioeventfd:                  ; @kvm_assign_ioeventfd
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
Lloh0:
	adrp	x8, _KVM_IOEVENTFD_FLAG_PIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KVM_IOEVENTFD_FLAG_PIO@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
Lloh3:
	adrp	x10, _KVM_PIO_BUS@GOTPAGE
Lloh4:
	ldr	x10, [x10, _KVM_PIO_BUS@GOTPAGEOFF]
	ldp	w8, w11, [x1]
	tst	w9, w8
Lloh5:
	adrp	x9, _KVM_MMIO_BUS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _KVM_MMIO_BUS@GOTPAGEOFF]
	csel	x9, x9, x10, eq
	cmp	w11, #8
	mov	w10, #1
	lsl	w10, w10, w11
	mov	w11, #278
	and	w10, w10, w11
	ccmp	w10, #0, #4, ls
	b.eq	LBB0_2
; %bb.1:
Lloh7:
	adrp	x10, _KVM_IOEVENTFD_VALID_FLAG_MASK@GOTPAGE
Lloh8:
	ldr	x10, [x10, _KVM_IOEVENTFD_VALID_FLAG_MASK@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	bics	wzr, w8, w10
	b.eq	LBB0_4
LBB0_2:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_3:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_4:
	mov	x23, x1
	mov	x19, x0
	ldr	w22, [x9]
	ldr	w0, [x1, #20]
	bl	_eventfd_ctx_fdget
	mov	x20, x0
	bl	_IS_ERR
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_PTR_ERR
LBB0_6:
Lloh13:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	w0, #40
	bl	_kzalloc
	mov	x21, x0
	cbz	x0, LBB0_9
; %bb.7:
	add	x24, x21, #16
	mov	x0, x24
	bl	_INIT_LIST_HEAD
	ldr	x8, [x23, #8]
	str	x8, [x21]
	ldp	w9, w8, [x23]
	str	w8, [x21, #8]
	str	x20, [x21, #32]
Lloh16:
	adrp	x8, _KVM_IOEVENTFD_FLAG_DATAMATCH@GOTPAGE
Lloh17:
	ldr	x8, [x8, _KVM_IOEVENTFD_FLAG_DATAMATCH@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	tst	w8, w9
	b.eq	LBB0_10
; %bb.8:
	ldr	w8, [x23, #16]
	str	w8, [x21, #24]
	b	LBB0_11
LBB0_9:
Lloh19:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_14
LBB0_10:
	mov	w8, #1
	str	w8, [x21, #12]
LBB0_11:
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x21
	bl	_ioeventfd_check_collision
	cbz	x0, LBB0_15
; %bb.12:
Lloh22:
	adrp	x8, _EEXIST@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EEXIST@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_13:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_14:
	mov	x0, x21
	bl	_kfree
	mov	x0, x20
	bl	_eventfd_ctx_put
	b	LBB0_3
LBB0_15:
	add	x23, x21, #20
Lloh25:
	adrp	x1, _ioeventfd_ops@GOTPAGE
Lloh26:
	ldr	x1, [x1, _ioeventfd_ops@GOTPAGEOFF]
	mov	x0, x23
	bl	_kvm_iodevice_init
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_kvm_io_bus_register_dev
	tbnz	w0, #31, LBB0_17
; %bb.16:
	add	x1, x19, #4
	mov	x0, x24
	bl	_list_add_tail
	mov	x0, x19
	bl	_mutex_unlock
	mov	w22, #0
	b	LBB0_3
LBB0_17:
	mov	x22, x0
	b	LBB0_13
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_KVM_IOEVENTFD_FLAG_PIO,4,2     ; @KVM_IOEVENTFD_FLAG_PIO
	.comm	_KVM_PIO_BUS,4,2                ; @KVM_PIO_BUS
	.comm	_KVM_MMIO_BUS,4,2               ; @KVM_MMIO_BUS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_KVM_IOEVENTFD_VALID_FLAG_MASK,4,2 ; @KVM_IOEVENTFD_VALID_FLAG_MASK
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_KVM_IOEVENTFD_FLAG_DATAMATCH,4,2 ; @KVM_IOEVENTFD_FLAG_DATAMATCH
	.comm	_EEXIST,4,2                     ; @EEXIST
	.comm	_ioeventfd_ops,4,2              ; @ioeventfd_ops
	.no_dead_strip	_kvm_assign_ioeventfd
.subsections_via_symbols
