	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mlxbf_tmfifo_create_vdev
_mlxbf_tmfifo_create_vdev:              ## @mlxbf_tmfifo_create_vdev
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -60(%rbp)                 ## 4-byte Spill
	movq	%r8, %r15
	movl	%ecx, %r12d
	movl	%edx, %r14d
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	callq	_mutex_lock
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	8(%r13), %rax
	movl	%r14d, %r13d
	movslq	%r14d, %rcx
	cmpq	$0, (%rax,%rcx,8)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EEXIST@GOTPCREL(%rip), %rax
LBB0_4:
	subl	(%rax), %r15d
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
LBB0_14:
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$48, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	movq	%rax, %r14
	movl	%r13d, 24(%rax)
	movq	_mlxbf_tmfifo_virtio_config_ops@GOTPCREL(%rip), %rax
	movq	%rax, 16(%r14)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 8(%r14)
	movq	_tmfifo_virtio_dev_release@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	movl	%r12d, 40(%r14)
	testq	%r15, %r15
	je	LBB0_7
## %bb.6:
	movq	%r14, %rdi
	addq	$36, %rdi
	movq	%r15, %rsi
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	callq	_memcpy
LBB0_7:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mlxbf_tmfifo_alloc_vrings
	testq	%rax, %rax
	je	LBB0_8
## %bb.13:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mlxbf_tmfifo_free_vrings
	movq	8(%rbx), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	$0, (%rax,%rcx,8)
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_14
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_4
LBB0_8:
	movq	_VIRTIO_ID_CONSOLE@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jne	LBB0_10
## %bb.9:
	movq	_MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_devm_kmalloc
	movl	%eax, 32(%r14)
LBB0_10:
	movq	8(%rbx), %rax
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	%r14, (%rax,%r12,8)
	movq	%r14, %rdi
	callq	_register_virtio_device
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mlxbf_tmfifo_free_vrings
	movq	8(%rbx), %rax
	movq	$0, (%rax,%r12,8)
	movq	%r14, %rdi
	callq	_put_device
	jmp	LBB0_14
LBB0_11:
	xorl	%r15d, %r15d
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vdev %d already exists\n"

	.comm	_EEXIST,4,2                     ## @EEXIST
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_mlxbf_tmfifo_virtio_config_ops,4,2 ## @mlxbf_tmfifo_virtio_config_ops
	.comm	_tmfifo_virtio_dev_release,4,2  ## @tmfifo_virtio_dev_release
L_.str.1:                               ## @.str.1
	.asciz	"unable to allocate vring\n"

	.comm	_VIRTIO_ID_CONSOLE,4,2          ## @VIRTIO_ID_CONSOLE
	.comm	_MLXBF_TMFIFO_CON_TX_BUF_SIZE,4,2 ## @MLXBF_TMFIFO_CON_TX_BUF_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"register_virtio_device failed\n"

	.no_dead_strip	_mlxbf_tmfifo_create_vdev
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlxbf_tmfifo_create_vdev
_mlxbf_tmfifo_create_vdev:              ; @mlxbf_tmfifo_create_vdev
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x23, x5
	mov	x24, x4
	mov	x25, x3
	mov	x22, x2
	mov	x19, x1
	mov	x21, x0
	mov	x0, x1
	bl	_mutex_lock
	ldr	x8, [x19, #8]
	ldr	x8, [x8, w22, sxtw #3]
	cbz	x8, LBB0_4
; %bb.1:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	str	x22, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_dev_err
Lloh2:
	adrp	x8, _EEXIST@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EEXIST@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_3:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_4:
Lloh4:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x26]
	mov	w0, #48
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.5:
	mov	x20, x0
	str	w22, [x0, #24]
Lloh6:
	adrp	x8, _mlxbf_tmfifo_virtio_config_ops@GOTPAGE
Lloh7:
	ldr	x8, [x8, _mlxbf_tmfifo_virtio_config_ops@GOTPAGEOFF]
	stp	x21, x8, [x0, #8]
Lloh8:
	adrp	x8, _tmfifo_virtio_dev_release@GOTPAGE
Lloh9:
	ldr	x8, [x8, _tmfifo_virtio_dev_release@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	str	w8, [x0]
	str	w25, [x0, #40]
	cbz	x24, LBB0_7
; %bb.6:
	add	x0, x20, #36
	mov	x1, x24
	mov	x2, x23
	bl	_memcpy
LBB0_7:
	sxtw	x23, w22
	mov	x0, x19
	mov	x1, x20
	bl	_mlxbf_tmfifo_alloc_vrings
	cbz	x0, LBB0_10
; %bb.8:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_dev_err
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w22, w8
	mov	x0, x19
	mov	x1, x20
	bl	_mlxbf_tmfifo_free_vrings
	ldr	x8, [x19, #8]
	str	xzr, [x8, x23, lsl #3]
	mov	x0, x20
	bl	_kfree
	b	LBB0_3
LBB0_9:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_10:
Lloh18:
	adrp	x8, _VIRTIO_ID_CONSOLE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _VIRTIO_ID_CONSOLE@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_12
; %bb.11:
Lloh21:
	adrp	x8, _MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	ldr	w2, [x26]
	mov	x0, x21
	bl	_devm_kmalloc
	str	w0, [x20, #32]
LBB0_12:
	ldr	x8, [x19, #8]
	str	x20, [x8, x23, lsl #3]
	mov	x0, x20
	bl	_register_virtio_device
	mov	x22, x0
	cbz	w0, LBB0_3
; %bb.13:
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_dev_err
	mov	x0, x19
	mov	x1, x20
	bl	_mlxbf_tmfifo_free_vrings
	ldr	x8, [x19, #8]
	str	xzr, [x8, x23, lsl #3]
	mov	x0, x20
	bl	_put_device
	b	LBB0_3
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vdev %d already exists\n"

	.comm	_EEXIST,4,2                     ; @EEXIST
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_mlxbf_tmfifo_virtio_config_ops,4,2 ; @mlxbf_tmfifo_virtio_config_ops
	.comm	_tmfifo_virtio_dev_release,4,2  ; @tmfifo_virtio_dev_release
l_.str.1:                               ; @.str.1
	.asciz	"unable to allocate vring\n"

	.comm	_VIRTIO_ID_CONSOLE,4,2          ; @VIRTIO_ID_CONSOLE
	.comm	_MLXBF_TMFIFO_CON_TX_BUF_SIZE,4,2 ; @MLXBF_TMFIFO_CON_TX_BUF_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"register_virtio_device failed\n"

	.no_dead_strip	_mlxbf_tmfifo_create_vdev
.subsections_via_symbols
