	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vnic_dev_init_devcmd2
_vnic_dev_init_devcmd2:                 ## @vnic_dev_init_devcmd2
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%ebx, %ebx
	cmpq	$0, 16(%rdi)
	jne	LBB0_13
## %bb.1:
	movq	%rdi, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$64, %edi
	callq	_kzalloc
	movq	%rax, 16(%r14)
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movl	$1, (%rax)
	movq	_DEVCMD2_RING_SIZE@GOTPCREL(%rip), %r15
	movq	(%r15), %rdx
	movq	%rdx, 56(%rax)
	addq	$8, %rax
	movq	_DEVCMD2_DESC_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_enic_wq_devcmd2_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.4:
	movq	16(%r14), %rax
	movq	8(%rax), %rdi
	callq	_ioread32
	cmpl	$-1, %eax
	je	LBB0_5
## %bb.6:
	movl	%eax, %ebx
	movq	16(%r14), %rdi
	addq	$8, %rdi
	xorl	%esi, %esi
	movl	%eax, %edx
	movl	%eax, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_enic_wq_init_start
	movq	16(%r14), %rdi
	movl	%ebx, 4(%rdi)
	addq	$8, %rdi
	callq	_vnic_wq_enable
	movq	16(%r14), %rsi
	addq	$24, %rsi
	movq	(%r15), %rdx
	movl	(%r12), %ecx
	movq	%r14, %rdi
	callq	_vnic_dev_alloc_desc_ring
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:
	movq	16(%r14), %rax
	movl	32(%rax), %ecx
	movl	%ecx, 52(%rax)
	movl	16(%rax), %ecx
	movl	%ecx, 48(%rax)
	movq	8(%rax), %rcx
	movq	%rcx, 40(%rax)
	movq	_VNIC_PADDR_TARGET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	24(%rax), %ecx
	movq	(%r14), %rax
	movl	%ecx, (%rax)
	movl	(%r15), %ecx
	movl	%ecx, 4(%rax)
	movq	_CMD_INITIALIZE_DEVCMD2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1000, %edx                     ## imm = 0x3E8
	callq	__vnic_dev_cmd2
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%eax, %ebx
	movq	16(%r14), %rsi
	addq	$24, %rsi
	movq	%r14, %rdi
	callq	_vnic_dev_free_desc_ring
LBB0_10:
	movq	16(%r14), %rdi
	addq	$8, %rdi
	callq	_vnic_wq_disable
	jmp	LBB0_11
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_5:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_vdev_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movq	16(%r14), %rdi
	addq	$8, %rdi
	callq	_vnic_wq_free
LBB0_12:
	movq	16(%r14), %rdi
	callq	_kfree
	movq	$0, 16(%r14)
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	__vnic_dev_cmd2@GOTPCREL(%rip), %rax
	movq	%rax, 8(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DEVCMD2_RING_SIZE,8,3          ## @DEVCMD2_RING_SIZE
	.comm	_DEVCMD2_DESC_SIZE,4,2          ## @DEVCMD2_DESC_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Fatal error in devcmd2 init - hardware surprise removal\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_VNIC_PADDR_TARGET,4,2          ## @VNIC_PADDR_TARGET
	.comm	_CMD_INITIALIZE_DEVCMD2,4,2     ## @CMD_INITIALIZE_DEVCMD2
	.no_dead_strip	_vnic_dev_init_devcmd2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vnic_dev_init_devcmd2
_vnic_dev_init_devcmd2:                 ; @vnic_dev_init_devcmd2
	.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
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_13
LBB0_2:
	mov	x19, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #64
	bl	_kzalloc
	str	x0, [x19, #16]
	cbz	x0, LBB0_9
; %bb.3:
	mov	w8, #1
	str	w8, [x0]
Lloh3:
	adrp	x21, _DEVCMD2_RING_SIZE@GOTPAGE
Lloh4:
	ldr	x21, [x21, _DEVCMD2_RING_SIZE@GOTPAGEOFF]
	ldr	x2, [x21]
	str	x2, [x0, #56]
	add	x1, x0, #8
Lloh5:
	adrp	x22, _DEVCMD2_DESC_SIZE@GOTPAGE
Lloh6:
	ldr	x22, [x22, _DEVCMD2_DESC_SIZE@GOTPAGEOFF]
	ldr	w3, [x22]
	mov	x0, x19
	bl	_enic_wq_devcmd2_alloc
	mov	x20, x0
	cbnz	w0, LBB0_12
; %bb.4:
	ldr	x8, [x19, #16]
	ldr	x0, [x8, #8]
	bl	_ioread32
	cmn	w0, #1
	b.eq	LBB0_10
; %bb.5:
	mov	x20, x0
	ldr	x8, [x19, #16]
	add	x0, x8, #8
	mov	w1, #0
	mov	x2, x20
	mov	x3, x20
	mov	w4, #0
	mov	w5, #0
	bl	_enic_wq_init_start
	ldr	x8, [x19, #16]
	str	w20, [x8, #4]
	add	x0, x8, #8
	bl	_vnic_wq_enable
	ldr	x8, [x19, #16]
	add	x1, x8, #24
	ldr	x2, [x21]
	ldr	w3, [x22]
	mov	x0, x19
	bl	_vnic_dev_alloc_desc_ring
	mov	x20, x0
	cbnz	w0, LBB0_8
; %bb.6:
	ldr	x8, [x19, #16]
	ldr	w9, [x8, #32]
	ldr	w10, [x8, #16]
	stp	w10, w9, [x8, #48]
	ldr	x9, [x8, #8]
	str	x9, [x8, #40]
	ldr	w8, [x8, #24]
Lloh7:
	adrp	x9, _VNIC_PADDR_TARGET@GOTPAGE
Lloh8:
	ldr	x9, [x9, _VNIC_PADDR_TARGET@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	x9, [x19]
	ldr	x10, [x21]
	stp	w8, w10, [x9]
Lloh10:
	adrp	x8, _CMD_INITIALIZE_DEVCMD2@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CMD_INITIALIZE_DEVCMD2@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #1000
	bl	__vnic_dev_cmd2
	mov	x20, x0
	cbz	w0, LBB0_14
; %bb.7:
	ldr	x8, [x19, #16]
	add	x1, x8, #24
	mov	x0, x19
	bl	_vnic_dev_free_desc_ring
LBB0_8:
	ldr	x8, [x19, #16]
	add	x0, x8, #8
	bl	_vnic_wq_disable
	b	LBB0_11
LBB0_9:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_13
LBB0_10:
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_vdev_err
Lloh18:
	adrp	x8, _ENODEV@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_11:
	ldr	x8, [x19, #16]
	add	x0, x8, #8
	bl	_vnic_wq_free
LBB0_12:
	ldr	x0, [x19, #16]
	bl	_kfree
	str	xzr, [x19, #16]
LBB0_13:
	mov	x0, x20
	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
LBB0_14:
Lloh21:
	adrp	x8, __vnic_dev_cmd2@GOTPAGE
Lloh22:
	ldr	x8, [x8, __vnic_dev_cmd2@GOTPAGEOFF]
	str	x8, [x19, #8]
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DEVCMD2_RING_SIZE,8,3          ; @DEVCMD2_RING_SIZE
	.comm	_DEVCMD2_DESC_SIZE,4,2          ; @DEVCMD2_DESC_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Fatal error in devcmd2 init - hardware surprise removal\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_VNIC_PADDR_TARGET,4,2          ; @VNIC_PADDR_TARGET
	.comm	_CMD_INITIALIZE_DEVCMD2,4,2     ; @CMD_INITIALIZE_DEVCMD2
	.no_dead_strip	_vnic_dev_init_devcmd2
.subsections_via_symbols
