	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function xen_msi_alloc
LCPI0_0:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
LCPI0_1:
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
LCPI0_2:
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_xen_msi_alloc
	.p2align	4, 0x90
_xen_msi_alloc:                         ## @xen_msi_alloc
	.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	%rcx, %r13
	movl	%esi, %r14d
	movl	%edi, %r15d
	movq	_msi_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	movq	_msi_last_irq@GOTPCREL(%rip), %r9
	movq	(%r9), %rbx
	movslq	%r14d, %rax
	addq	%rbx, %rax
	movq	_num_msi_irqs@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_2
## %bb.1:
	movq	_msi_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_26
LBB0_2:
	movl	%r14d, %r12d
	testl	%r14d, %r14d
	jle	LBB0_22
## %bb.3:
	cmpl	$8, %r14d
	jb	LBB0_4
## %bb.5:
	movq	_first_msi_irq@GOTPCREL(%rip), %r8
	leaq	4(%r8), %rax
	cmpq	%rax, %r13
	jae	LBB0_8
## %bb.6:
	leaq	(,%r12,4), %rax
	addq	%r13, %rax
	cmpq	_first_msi_irq@GOTPCREL(%rip), %rax
	jbe	LBB0_8
LBB0_4:
	xorl	%edx, %edx
LBB0_14:
	movq	%rdx, %rax
	notq	%rax
	addq	%r12, %rax
	movq	%r12, %rsi
	andq	$3, %rsi
	je	LBB0_17
## %bb.15:
	movq	_first_msi_irq@GOTPCREL(%rip), %rdi
	movq	%rbx, %rcx
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	leaq	1(%rcx), %rbx
	addl	(%rdi), %ecx
	movl	%ecx, (%r13,%rdx,4)
	incq	%rdx
	movq	%rbx, %rcx
	decq	%rsi
	jne	LBB0_16
LBB0_17:
	cmpq	$3, %rax
	jb	LBB0_21
## %bb.18:
	movq	%r12, %r8
	subq	%rdx, %r8
	leaq	12(,%rdx,4), %rsi
	addq	%r13, %rsi
	xorl	%edx, %edx
	movq	_first_msi_irq@GOTPCREL(%rip), %rdi
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	leal	(%rbx,%rdx), %ecx
	movl	%ecx, %eax
	addl	(%rdi), %eax
	movl	%eax, -12(%rsi,%rdx,4)
	movl	(%rdi), %eax
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, -8(%rsi,%rdx,4)
	movl	(%rdi), %eax
	leal	2(%rax,%rcx), %eax
	movl	%eax, -4(%rsi,%rdx,4)
	movl	(%rdi), %eax
	addl	%ecx, %eax
	addl	$3, %eax
	movl	%eax, (%rsi,%rdx,4)
	addq	$4, %rdx
	cmpq	%rdx, %r8
	jne	LBB0_19
## %bb.20:
	addq	%rdx, %rbx
	jmp	LBB0_21
LBB0_8:
	movl	%r12d, %edx
	andl	$-8, %edx
	movd	%ebx, %xmm0
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	paddd	LCPI0_0(%rip), %xmm0
	leaq	-8(%rdx), %rcx
	movq	%rcx, %rax
	shrq	$3, %rax
	incq	%rax
	testq	%rcx, %rcx
	je	LBB0_27
## %bb.9:
	movq	%rax, %rdi
	andq	$-2, %rdi
	movd	(%r8), %xmm2                    ## xmm2 = mem[0],zero,zero,zero
	pshufd	$0, %xmm2, %xmm1                ## xmm1 = xmm2[0,0,0,0]
	movl	$4, %ecx
	movd	%ecx, %xmm3
	paddd	%xmm2, %xmm3
	pshufd	$0, %xmm3, %xmm2                ## xmm2 = xmm3[0,0,0,0]
	xorl	%esi, %esi
	movdqa	LCPI0_1(%rip), %xmm3            ## xmm3 = [8,8,8,8]
	movdqa	LCPI0_2(%rip), %xmm4            ## xmm4 = [16,16,16,16]
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movdqa	%xmm1, %xmm5
	paddd	%xmm0, %xmm5
	movdqa	%xmm2, %xmm6
	paddd	%xmm0, %xmm6
	movdqu	%xmm5, (%r13,%rsi,4)
	movdqu	%xmm6, 16(%r13,%rsi,4)
	movdqa	%xmm0, %xmm5
	paddd	%xmm3, %xmm5
	movdqa	%xmm1, %xmm6
	paddd	%xmm5, %xmm6
	paddd	%xmm2, %xmm5
	movdqu	%xmm6, 32(%r13,%rsi,4)
	movdqu	%xmm5, 48(%r13,%rsi,4)
	addq	$16, %rsi
	paddd	%xmm4, %xmm0
	addq	$-2, %rdi
	jne	LBB0_10
## %bb.11:
	testb	$1, %al
	je	LBB0_13
LBB0_12:
	movd	(%r8), %xmm1                    ## xmm1 = mem[0],zero,zero,zero
	pshufd	$0, %xmm1, %xmm2                ## xmm2 = xmm1[0,0,0,0]
	paddd	%xmm0, %xmm2
	movl	$4, %eax
	movd	%eax, %xmm3
	paddd	%xmm1, %xmm3
	pshufd	$0, %xmm3, %xmm1                ## xmm1 = xmm3[0,0,0,0]
	paddd	%xmm0, %xmm1
	movdqu	%xmm2, (%r13,%rsi,4)
	movdqu	%xmm1, 16(%r13,%rsi,4)
LBB0_13:
	addq	%rdx, %rbx
	cmpq	%r12, %rdx
	jne	LBB0_14
LBB0_21:
	movq	%rbx, (%r9)
LBB0_22:
	movq	_msi_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movl	(%r13), %esi
	movl	%r15d, %edi
	movl	%r14d, %edx
	callq	_xen_register_msi
	movl	%eax, %r15d
	testl	%r14d, %r14d
	jle	LBB0_26
## %bb.23:
	testl	%r15d, %r15d
	jne	LBB0_26
## %bb.24:
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_25:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r13,%rbx,4), %edi
	callq	_nexus_add_irq
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_25
LBB0_26:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_27:
	xorl	%esi, %esi
	testb	$1, %al
	jne	LBB0_12
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_msi_lock,4,2                   ## @msi_lock
	.comm	_msi_last_irq,8,3               ## @msi_last_irq
	.comm	_num_msi_irqs,8,3               ## @num_msi_irqs
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_first_msi_irq,4,2              ## @first_msi_irq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function xen_msi_alloc
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_xen_msi_alloc
	.p2align	2
_xen_msi_alloc:                         ; @xen_msi_alloc
	.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	x19, x3
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x0, _msi_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _msi_lock@GOTPAGEOFF]
	bl	_mtx_lock
Lloh2:
	adrp	x8, _msi_last_irq@GOTPAGE
Lloh3:
	ldr	x8, [x8, _msi_last_irq@GOTPAGEOFF]
	ldr	x12, [x8]
	add	x9, x12, w20, sxtw
Lloh4:
	adrp	x10, _num_msi_irqs@GOTPAGE
Lloh5:
	ldr	x10, [x10, _num_msi_irqs@GOTPAGEOFF]
Lloh6:
	ldr	x10, [x10]
	cmp	x9, x10
	b.le	LBB0_2
; %bb.1:
Lloh7:
	adrp	x0, _msi_lock@GOTPAGE
Lloh8:
	ldr	x0, [x0, _msi_lock@GOTPAGEOFF]
	bl	_mtx_unlock
Lloh9:
	adrp	x8, _ENXIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	b	LBB0_16
LBB0_2:
	mov	w22, w20
	cmp	w20, #1
	b.lt	LBB0_12
; %bb.3:
Lloh12:
	adrp	x9, _first_msi_irq@GOTPAGE
Lloh13:
	ldr	x9, [x9, _first_msi_irq@GOTPAGEOFF]
	cmp	w20, #16
	b.lo	LBB0_8
; %bb.4:
	add	x10, x19, x22, lsl #2
	add	x11, x9, #4
	cmp	x19, x11
	ccmp	x10, x9, #0, lo
	b.hi	LBB0_8
; %bb.5:
	and	x11, x22, #0xfffffff0
	add	x10, x12, x11
	dup.4s	v2, w12
	ldr	w12, [x9]
	dup.4s	v0, w12
Lloh14:
	adrp	x13, lCPI0_0@PAGE
Lloh15:
	ldr	q3, [x13, lCPI0_0@PAGEOFF]
	fmov	s4, w12
	movi.4s	v1, #4
	add.4s	v1, v4, v1
	dup.4s	v1, v1[0]
	add.4s	v2, v2, v3
	movi.4s	v3, #8
	add.4s	v3, v4, v3
	dup.4s	v3, v3[0]
	movi.4s	v5, #12
	add.4s	v4, v4, v5
	dup.4s	v4, v4[0]
	add	x12, x19, #32
	movi.4s	v5, #16
	mov	x13, x11
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	add.4s	v6, v0, v2
	add.4s	v7, v1, v2
	add.4s	v16, v3, v2
	add.4s	v17, v4, v2
	stp	q6, q7, [x12, #-32]
	stp	q16, q17, [x12], #64
	add.4s	v2, v2, v5
	subs	x13, x13, #16
	b.ne	LBB0_6
; %bb.7:
	cmp	x11, x22
	b.ne	LBB0_9
	b	LBB0_11
LBB0_8:
	mov	x11, #0
	mov	x10, x12
LBB0_9:
	add	x12, x19, x11, lsl #2
	sub	x11, x22, x11
	mov	x13, x10
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w14, [x9]
	add	x10, x13, #1
	add	w13, w13, w14
	str	w13, [x12], #4
	mov	x13, x10
	subs	x11, x11, #1
	b.ne	LBB0_10
LBB0_11:
	str	x10, [x8]
LBB0_12:
Lloh16:
	adrp	x0, _msi_lock@GOTPAGE
Lloh17:
	ldr	x0, [x0, _msi_lock@GOTPAGEOFF]
	bl	_mtx_unlock
	ldr	w1, [x19]
	mov	x0, x21
	mov	x2, x20
	bl	_xen_register_msi
	cmp	w20, #1
	b.lt	LBB0_16
; %bb.13:
	cbnz	w0, LBB0_16
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19], #4
	bl	_nexus_add_irq
	subs	x22, x22, #1
	b.ne	LBB0_14
; %bb.15:
	mov	w0, #0
LBB0_16:
	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	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_msi_lock,4,2                   ; @msi_lock
	.comm	_msi_last_irq,8,3               ; @msi_last_irq
	.comm	_num_msi_irqs,8,3               ; @num_msi_irqs
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_first_msi_irq,4,2              ; @first_msi_irq
.subsections_via_symbols
