	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_split_and_remove_iova          ## -- Begin function split_and_remove_iova
	.p2align	4, 0x90
_split_and_remove_iova:                 ## @split_and_remove_iova
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r14
	callq	_spin_lock_irqsave
	movq	(%r13), %rdi
	cmpq	%rbx, %rdi
	jae	LBB0_1
## %bb.4:
	leaq	-1(%rbx), %rsi
	callq	_alloc_and_init_iova
	testq	%rax, %rax
	jne	LBB0_2
## %bb.5:
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	jmp	LBB0_14
LBB0_1:
	xorl	%eax, %eax
LBB0_2:
	movq	8(%r13), %rsi
	cmpq	%r12, %rsi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	jbe	LBB0_3
## %bb.6:
	leaq	1(%r12), %rdi
	callq	_alloc_and_init_iova
	movq	%rax, %r15
	testq	%rax, %rax
	jne	LBB0_7
## %bb.12:
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	testq	%rdi, %rdi
	je	LBB0_14
## %bb.13:
	callq	_free_iova_mem
LBB0_14:
	xorl	%r13d, %r13d
	jmp	LBB0_15
LBB0_3:
	xorl	%r15d, %r15d
LBB0_7:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	___cached_rbnode_delete_update
	leaq	16(%r13), %rdi
	leaq	4(%r14), %r12
	movq	%r12, %rsi
	callq	_rb_erase
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.8:
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_iova_insert_rbtree
	movq	%rbx, (%r13)
LBB0_9:
	testq	%r15, %r15
	je	LBB0_11
## %bb.10:
	movq	%r12, %rdi
	movq	%r15, %rsi
	xorl	%edx, %edx
	callq	_iova_insert_rbtree
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 8(%r13)
LBB0_11:
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
LBB0_15:
	movq	%r13, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_split_and_remove_iova          ; -- Begin function split_and_remove_iova
	.p2align	2
_split_and_remove_iova:                 ; @split_and_remove_iova
	.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	x21, x3
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
	bl	_spin_lock_irqsave
	ldr	x0, [x19]
	cmp	x0, x22
	b.hs	LBB0_3
; %bb.1:
	sub	x1, x22, #1
	bl	_alloc_and_init_iova
	mov	x23, x0
	cbnz	x0, LBB0_4
; %bb.2:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	b	LBB0_8
LBB0_3:
	mov	x23, #0
LBB0_4:
	ldr	x1, [x19, #8]
	cmp	x1, x21
	b.ls	LBB0_9
; %bb.5:
	add	x0, x21, #1
	bl	_alloc_and_init_iova
	mov	x24, x0
	cbnz	x0, LBB0_10
; %bb.6:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	cbz	x23, LBB0_8
; %bb.7:
	mov	x0, x23
	bl	_free_iova_mem
LBB0_8:
	mov	x19, #0
	b	LBB0_15
LBB0_9:
	mov	x24, #0
LBB0_10:
	mov	x0, x20
	mov	x1, x19
	bl	___cached_rbnode_delete_update
	add	x0, x19, #16
	add	x25, x20, #4
	mov	x1, x25
	bl	_rb_erase
	cbz	x23, LBB0_12
; %bb.11:
	mov	x0, x25
	mov	x1, x23
	mov	x2, #0
	bl	_iova_insert_rbtree
	str	x22, [x19]
LBB0_12:
	cbz	x24, LBB0_14
; %bb.13:
	mov	x0, x25
	mov	x1, x24
	mov	x2, #0
	bl	_iova_insert_rbtree
	str	x21, [x19, #8]
LBB0_14:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
LBB0_15:
	mov	x0, x19
	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
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
