	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usnic_vnic_discover_resources
_usnic_vnic_discover_resources:         ## @usnic_vnic_discover_resources
	.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, %r12
	movq	%rdi, %r14
	movq	(%rsi), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_7
## %bb.1:
	xorl	%r15d, %r15d
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %r13
	xorl	%ebx, %ebx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	(%r12), %rdi
LBB0_3:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%rbx
	callq	_ARRAY_SIZE
	cltq
	addq	$12, %r15
	cmpq	%rax, %rbx
	jge	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_pci_resource_flags
	testl	%eax, (%r13)
	je	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_pci_resource_len
	movq	(%r12), %rcx
	movl	%eax, 8(%rcx,%r15)
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_pci_iomap
	movq	(%r12), %rcx
	movl	%eax, (%rcx,%r15)
	testl	%eax, %eax
	je	LBB0_15
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_pci_resource_start
	movq	(%r12), %rdi
	movl	%eax, 4(%rdi,%r15)
	jmp	LBB0_3
LBB0_7:
	movq	(%r12), %rbx
	movq	%rbx, %rdi
	callq	_ARRAY_SIZE
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	movq	%r14, %rsi
	movq	%r14, %rdx
	movq	%rbx, %rcx
	movl	%eax, %r8d
	callq	_vnic_dev_register
	movl	%eax, 8(%r12)
	testl	%eax, %eax
	je	LBB0_14
## %bb.8:
	movq	_USNIC_VNIC_RES_TYPE_EOL@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	leal	-1(%r13), %ebx
	incl	%r13d
	shlq	$2, %r13
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	leal	2(%rbx), %esi
	movq	_USNIC_VNIC_RES_TYPE_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %esi
	jae	LBB0_23
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	16(%r12), %rdx
	addq	%r13, %rdx
	movq	%r12, %rdi
	callq	_usnic_vnic_alloc_res_chunk
	incl	%ebx
	addq	$4, %r13
	testl	%eax, %eax
	je	LBB0_9
## %bb.11:
	movl	%eax, %r15d
	movq	_USNIC_VNIC_RES_TYPE_EOL@GOTPCREL(%rip), %r13
	cmpl	(%r13), %ebx
	jbe	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	shlq	$2, %rdi
	addq	16(%r12), %rdi
	callq	_usnic_vnic_free_res_chunk
	decl	%ebx
	cmpl	(%r13), %ebx
	ja	LBB0_12
LBB0_13:
	movl	8(%r12), %edi
	callq	_vnic_dev_unregister
	jmp	LBB0_17
LBB0_14:
	movq	%r14, %rdi
	callq	_pci_name
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	callq	_usnic_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_15:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_usnic_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
LBB0_16:
	subl	(%rax), %r15d
LBB0_17:
	movq	(%r12), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_24
## %bb.18:
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_21 Depth=1
	callq	_iounmap
LBB0_20:                                ##   in Loop: Header=BB0_21 Depth=1
	incq	%rbx
	movq	(%r12), %rdi
	callq	_ARRAY_SIZE
	cltq
	addq	$12, %r13
	cmpq	%rax, %rbx
	jge	LBB0_24
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_pci_resource_flags
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_20
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=1
	movq	(%r12), %rax
	movl	(%rax,%r13), %edi
	testl	%edi, %edi
	jne	LBB0_19
	jmp	LBB0_24
LBB0_23:
	xorl	%r15d, %r15d
LBB0_24:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IORESOURCE_MEM,4,2             ## @IORESOURCE_MEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot memory-map BAR %d, aborting\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.1:                               ## @.str.1
	.asciz	"Failed to register device %s\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_USNIC_VNIC_RES_TYPE_EOL,4,2    ## @USNIC_VNIC_RES_TYPE_EOL
	.comm	_USNIC_VNIC_RES_TYPE_MAX,4,2    ## @USNIC_VNIC_RES_TYPE_MAX
	.no_dead_strip	_usnic_vnic_discover_resources
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usnic_vnic_discover_resources
_usnic_vnic_discover_resources:         ; @usnic_vnic_discover_resources
	.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	x19, x1
	mov	x20, x0
	ldr	x0, [x1]
	bl	_ARRAY_SIZE
Lloh0:
	adrp	x23, _IORESOURCE_MEM@GOTPAGE
Lloh1:
	ldr	x23, [x23, _IORESOURCE_MEM@GOTPAGEOFF]
	cmp	w0, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x22, #0
	mov	x21, #0
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x0, [x19]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x21, x21, #1
	bl	_ARRAY_SIZE
	add	x22, x22, #12
	cmp	x21, w0, sxtw
	b.ge	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x21
	bl	_pci_resource_flags
	ldr	w8, [x23]
	tst	w8, w0
	b.eq	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	mov	x1, x21
	bl	_pci_resource_len
	mov	x2, x0
	ldr	x8, [x19]
	add	x8, x8, x22
	str	w0, [x8, #8]
	mov	x0, x20
	mov	x1, x21
	bl	_pci_iomap
	ldr	x8, [x19]
	str	w0, [x8, x22]
	cbz	w0, LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	mov	x1, x21
	bl	_pci_resource_start
	mov	x8, x0
	ldr	x0, [x19]
	add	x9, x0, x22
	str	w8, [x9, #4]
	b	LBB0_3
LBB0_7:
	ldr	x21, [x19]
	mov	x0, x21
	bl	_ARRAY_SIZE
	mov	x4, x0
	mov	x0, #0
	mov	x1, x20
	mov	x2, x20
	mov	x3, x21
	bl	_vnic_dev_register
	str	w0, [x19, #8]
	cbz	w0, LBB0_14
; %bb.8:
Lloh2:
	adrp	x22, _USNIC_VNIC_RES_TYPE_EOL@GOTPAGE
Lloh3:
	ldr	x22, [x22, _USNIC_VNIC_RES_TYPE_EOL@GOTPAGEOFF]
	ldr	w8, [x22]
	sub	w24, w8, #1
	add	w8, w8, #1
	lsl	x25, x8, #2
Lloh4:
	adrp	x26, _USNIC_VNIC_RES_TYPE_MAX@GOTPAGE
Lloh5:
	ldr	x26, [x26, _USNIC_VNIC_RES_TYPE_MAX@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	add	w1, w24, #2
	ldr	w8, [x26]
	cmp	w1, w8
	b.hs	LBB0_17
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x19, #16]
	add	x2, x8, x25
	mov	x0, x19
	bl	_usnic_vnic_alloc_res_chunk
	add	w24, w24, #1
	add	x25, x25, #4
	cbz	w0, LBB0_9
; %bb.11:
	mov	x21, x0
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x22]
	cmp	w24, w8
	b.ls	LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [x19, #16]
	add	x0, x8, w24, uxtw #2
	bl	_usnic_vnic_free_res_chunk
	sub	w24, w24, #1
	b	LBB0_12
LBB0_14:
	mov	x0, x20
	bl	_pci_name
	mov	x1, x0
Lloh6:
	adrp	x0, l_.str.1@PAGE
Lloh7:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_usnic_err
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_16
LBB0_15:
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_usnic_err
Lloh12:
	adrp	x8, _ENODEV@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_16:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_19
LBB0_17:
	mov	w21, #0
	b	LBB0_25
LBB0_18:
	ldr	w0, [x19, #8]
	bl	_vnic_dev_unregister
LBB0_19:
	ldr	x0, [x19]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_25
; %bb.20:
	mov	x24, #0
	mov	x22, #0
	b	LBB0_23
LBB0_21:                                ;   in Loop: Header=BB0_23 Depth=1
	bl	_iounmap
LBB0_22:                                ;   in Loop: Header=BB0_23 Depth=1
	add	x22, x22, #1
	ldr	x0, [x19]
	bl	_ARRAY_SIZE
	add	x24, x24, #12
	cmp	x22, w0, sxtw
	b.ge	LBB0_25
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x22
	bl	_pci_resource_flags
	ldr	w8, [x23]
	tst	w8, w0
	b.eq	LBB0_22
; %bb.24:                               ;   in Loop: Header=BB0_23 Depth=1
	ldr	x8, [x19]
	ldr	w0, [x8, x24]
	cbnz	w0, LBB0_21
LBB0_25:
	mov	x0, x21
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_IORESOURCE_MEM,4,2             ; @IORESOURCE_MEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot memory-map BAR %d, aborting\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.1:                               ; @.str.1
	.asciz	"Failed to register device %s\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_USNIC_VNIC_RES_TYPE_EOL,4,2    ; @USNIC_VNIC_RES_TYPE_EOL
	.comm	_USNIC_VNIC_RES_TYPE_MAX,4,2    ; @USNIC_VNIC_RES_TYPE_MAX
	.no_dead_strip	_usnic_vnic_discover_resources
.subsections_via_symbols
