	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vmci_guest_remove_device
_vmci_guest_remove_device:              ## @vmci_guest_remove_device
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_pci_get_drvdata
	movq	%rax, %rbx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_dbg
	movq	_vmci_num_guest_devices@GOTPCREL(%rip), %rdi
	callq	_atomic_dec
	xorl	%eax, %eax
	callq	_vmci_qp_guest_endpoints_exit
	movq	_ctx_update_sub_id@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_vmci_event_unsubscribe
	movq	_VMCI_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_2
## %bb.1:
	movq	_VMCI_EVENT_CTX_ID_UPDATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	(%r15), %ecx
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %r8d
	callq	_dev_warn
LBB0_2:
	movq	_vmci_dev_spinlock@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_spin_lock_irq
	movq	_vmci_dev_g@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_vmci_pdev@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	%r15, %rdi
	callq	_spin_unlock_irq
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_dbg
	movq	_VMCI_CONTROL_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_VMCI_CONTROL_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%rbx), %rsi
	callq	_iowrite32
	cmpq	$0, 24(%rbx)
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_pci_irq_vector
	movl	%eax, %edi
	movq	%rbx, %rsi
	callq	_free_irq
LBB0_4:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_pci_irq_vector
	movl	%eax, %edi
	movq	%rbx, %rsi
	callq	_free_irq
	movq	%r14, %rdi
	callq	_pci_free_irq_vectors
	leaq	20(%rbx), %rdi
	callq	_tasklet_kill
	movq	%rbx, %rdi
	addq	$16, %rdi
	callq	_tasklet_kill
	movq	8(%rbx), %rdx
	testq	%rdx, %rdx
	je	LBB0_6
## %bb.5:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	4(%rbx), %ecx
	movq	%r14, %rdi
	callq	_dma_free_coherent
LBB0_6:
	movl	(%rbx), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vfree                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Removing device\n"

	.comm	_vmci_num_guest_devices,4,2     ## @vmci_num_guest_devices
	.comm	_ctx_update_sub_id,4,2          ## @ctx_update_sub_id
	.comm	_VMCI_SUCCESS,4,2               ## @VMCI_SUCCESS
L_.str.1:                               ## @.str.1
	.asciz	"Failed to unsubscribe from event (type=%d) with subscriber (ID=0x%x): %d\n"

	.comm	_VMCI_EVENT_CTX_ID_UPDATE,4,2   ## @VMCI_EVENT_CTX_ID_UPDATE
	.comm	_vmci_dev_spinlock,4,2          ## @vmci_dev_spinlock
	.comm	_vmci_dev_g,8,3                 ## @vmci_dev_g
	.comm	_vmci_pdev,8,3                  ## @vmci_pdev
L_.str.2:                               ## @.str.2
	.asciz	"Resetting vmci device\n"

	.comm	_VMCI_CONTROL_RESET,4,2         ## @VMCI_CONTROL_RESET
	.comm	_VMCI_CONTROL_ADDR,8,3          ## @VMCI_CONTROL_ADDR
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.no_dead_strip	_vmci_guest_remove_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vmci_guest_remove_device
_vmci_guest_remove_device:              ; @vmci_guest_remove_device
	.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, x0
	bl	_pci_get_drvdata
	mov	x19, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
Lloh2:
	adrp	x0, _vmci_num_guest_devices@GOTPAGE
Lloh3:
	ldr	x0, [x0, _vmci_num_guest_devices@GOTPAGEOFF]
	bl	_atomic_dec
	bl	_vmci_qp_guest_endpoints_exit
Lloh4:
	adrp	x21, _ctx_update_sub_id@GOTPAGE
Lloh5:
	ldr	x21, [x21, _ctx_update_sub_id@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_vmci_event_unsubscribe
Lloh6:
	adrp	x8, _VMCI_SUCCESS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VMCI_SUCCESS@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ge	LBB0_2
; %bb.1:
	mov	x4, x0
Lloh9:
	adrp	x8, _VMCI_EVENT_CTX_ID_UPDATE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _VMCI_EVENT_CTX_ID_UPDATE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	ldr	w3, [x21]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_warn
LBB0_2:
Lloh14:
	adrp	x21, _vmci_dev_spinlock@GOTPAGE
Lloh15:
	ldr	x21, [x21, _vmci_dev_spinlock@GOTPAGEOFF]
	mov	x0, x21
	bl	_spin_lock_irq
Lloh16:
	adrp	x8, _vmci_dev_g@GOTPAGE
Lloh17:
	ldr	x8, [x8, _vmci_dev_g@GOTPAGEOFF]
Lloh18:
	str	xzr, [x8]
Lloh19:
	adrp	x8, _vmci_pdev@GOTPAGE
Lloh20:
	ldr	x8, [x8, _vmci_pdev@GOTPAGEOFF]
Lloh21:
	str	xzr, [x8]
	mov	x0, x21
	bl	_spin_unlock_irq
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
Lloh24:
	adrp	x8, _VMCI_CONTROL_RESET@GOTPAGE
Lloh25:
	ldr	x8, [x8, _VMCI_CONTROL_RESET@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	ldr	x8, [x19, #32]
Lloh27:
	adrp	x9, _VMCI_CONTROL_ADDR@GOTPAGE
Lloh28:
	ldr	x9, [x9, _VMCI_CONTROL_ADDR@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_4
; %bb.3:
	mov	x0, x20
	mov	w1, #1
	bl	_pci_irq_vector
	mov	x1, x19
	bl	_free_irq
LBB0_4:
	mov	x0, x20
	mov	w1, #0
	bl	_pci_irq_vector
	mov	x1, x19
	bl	_free_irq
	mov	x0, x20
	bl	_pci_free_irq_vectors
	add	x0, x19, #20
	bl	_tasklet_kill
	add	x0, x19, #16
	bl	_tasklet_kill
	ldr	x2, [x19, #8]
	cbz	x2, LBB0_6
; %bb.5:
Lloh30:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
	ldr	w3, [x19, #4]
	mov	x0, x20
	bl	_dma_free_coherent
LBB0_6:
	ldr	w0, [x19]
	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
	b	_vfree
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotStr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Removing device\n"

	.comm	_vmci_num_guest_devices,4,2     ; @vmci_num_guest_devices
	.comm	_ctx_update_sub_id,4,2          ; @ctx_update_sub_id
	.comm	_VMCI_SUCCESS,4,2               ; @VMCI_SUCCESS
l_.str.1:                               ; @.str.1
	.asciz	"Failed to unsubscribe from event (type=%d) with subscriber (ID=0x%x): %d\n"

	.comm	_VMCI_EVENT_CTX_ID_UPDATE,4,2   ; @VMCI_EVENT_CTX_ID_UPDATE
	.comm	_vmci_dev_spinlock,4,2          ; @vmci_dev_spinlock
	.comm	_vmci_dev_g,8,3                 ; @vmci_dev_g
	.comm	_vmci_pdev,8,3                  ; @vmci_pdev
l_.str.2:                               ; @.str.2
	.asciz	"Resetting vmci device\n"

	.comm	_VMCI_CONTROL_RESET,4,2         ; @VMCI_CONTROL_RESET
	.comm	_VMCI_CONTROL_ADDR,8,3          ; @VMCI_CONTROL_ADDR
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.no_dead_strip	_vmci_guest_remove_device
.subsections_via_symbols
