	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mlxbf_tmfifo_console_tx
_mlxbf_tmfifo_console_tx:               ## @mlxbf_tmfifo_console_tx
	.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	_MLXBF_TMFIFO_DATA_MIN_WORDS@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jg	LBB0_16
## %bb.1:
	movq	%rdi, %r14
	movq	16(%rdi), %rax
	movq	_VIRTIO_ID_CONSOLE@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	movq	(%rax,%rcx,8), %r15
	testq	%r15, %r15
	je	LBB0_16
## %bb.2:
	cmpq	$0, (%r15)
	je	LBB0_16
## %bb.3:
	movl	%esi, %ebx
	movl	8(%r15), %esi
	movl	12(%r15), %edi
	movq	_MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_CIRC_CNT
	testl	%eax, %eax
	je	LBB0_16
## %bb.4:
	movslq	%eax, %rcx
	addq	$16, %rcx
	movslq	%ebx, %rdx
	shlq	$2, %rdx
	leal	-16(%rdx), %r12d
	cmpq	%rdx, %rcx
	cmovbel	%eax, %r12d
	movl	(%r13), %ebx
	movl	%r12d, %edi
	callq	_htons
	movq	_MLXBF_TMFIFO_TX_DATA@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	movl	%ebx, %edi
	callq	_writeq
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	testl	%r12d, %r12d
	jle	LBB0_15
## %bb.5:
	movl	8(%r15), %edx
	movq	_MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_6 Depth=1
	xorl	%edx, %edx
	divq	%rsi
LBB0_14:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	%edx, 8(%r15)
	leal	-4(%r12), %eax
	cmpl	$4, %r12d
	movl	%eax, %r12d
	jle	LBB0_15
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%edx, %rsi
	movq	(%r15), %r13
	addq	%rsi, %r13
	movl	12(%r15), %edi
                                        ## kill: def $esi killed $esi killed $rsi
	movl	%ecx, %edx
	callq	_CIRC_CNT_TO_END
	cmpl	$4, %eax
	jb	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	leaq	-44(%rbp), %rdi
	movq	%r13, %rsi
	movl	$4, %edx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, %ebx
	movl	%eax, %r14d
	leaq	-44(%rbp), %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_memcpy
	leaq	-44(,%r14,4), %rdi
	addq	%rbp, %rdi
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	(%r15), %rsi
	movl	$4, %edx
	subl	%ebx, %edx
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	callq	_memcpy
	movl	-44(%rbp), %edi
	movq	_MLXBF_TMFIFO_TX_DATA@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writeq
	movslq	8(%r15), %rax
	cmpl	$3, %r12d
	jbe	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	addq	$4, %rax
	movq	_MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movslq	%ecx, %rsi
	movq	%rax, %rdx
	orq	%rsi, %rdx
	shrq	$32, %rdx
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	jmp	LBB0_14
LBB0_10:
	addl	%eax, %r12d
	movl	%r12d, %eax
	cltd
	movq	_MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPCREL(%rip), %rcx
	idivl	(%rcx)
	movl	%edx, 8(%r15)
LBB0_15:
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MLXBF_TMFIFO_DATA_MIN_WORDS,4,2 ## @MLXBF_TMFIFO_DATA_MIN_WORDS
	.comm	_VIRTIO_ID_CONSOLE,8,3          ## @VIRTIO_ID_CONSOLE
	.comm	_MLXBF_TMFIFO_CON_TX_BUF_SIZE,4,2 ## @MLXBF_TMFIFO_CON_TX_BUF_SIZE
	.comm	_MLXBF_TMFIFO_TX_DATA,8,3       ## @MLXBF_TMFIFO_TX_DATA
	.no_dead_strip	_mlxbf_tmfifo_console_tx
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlxbf_tmfifo_console_tx
_mlxbf_tmfifo_console_tx:               ; @mlxbf_tmfifo_console_tx
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _MLXBF_TMFIFO_DATA_MIN_WORDS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MLXBF_TMFIFO_DATA_MIN_WORDS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.gt	LBB0_13
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0, #16]
Lloh3:
	adrp	x21, _VIRTIO_ID_CONSOLE@GOTPAGE
Lloh4:
	ldr	x21, [x21, _VIRTIO_ID_CONSOLE@GOTPAGEOFF]
	ldr	x9, [x21]
	ldr	x23, [x8, x9, lsl #3]
	cbz	x23, LBB0_13
; %bb.2:
	ldr	x8, [x23]
	cbz	x8, LBB0_13
; %bb.3:
	mov	x20, x1
	ldp	w1, w0, [x23, #8]
Lloh5:
	adrp	x24, _MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPAGE
Lloh6:
	ldr	x24, [x24, _MLXBF_TMFIFO_CON_TX_BUF_SIZE@GOTPAGEOFF]
	ldr	w2, [x24]
	bl	_CIRC_CNT
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_13
; %bb.4:
	sxtw	x8, w0
	add	x8, x8, #16
	sbfiz	x9, x20, #2, #32
	sub	w10, w9, #16
	cmp	x8, x9
	csel	w20, w10, w0, hi
	ldr	w21, [x21]
	mov	x0, x20
	bl	_htons
	ldr	x8, [x19, #8]
Lloh7:
	adrp	x25, _MLXBF_TMFIFO_TX_DATA@GOTPAGE
Lloh8:
	ldr	x25, [x25, _MLXBF_TMFIFO_TX_DATA@GOTPAGEOFF]
	ldr	x9, [x25]
	add	x1, x9, x8
	mov	x0, x21
	bl	_writeq
	mov	x0, x19
	bl	_spin_lock_irqsave
	cmp	w20, #1
	b.lt	LBB0_12
; %bb.5:
	ldr	w1, [x23, #8]
	ldr	w2, [x24]
	add	x26, sp, #12
	mov	w27, #4
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	add	x21, x8, w1, sxtw
	ldr	w0, [x23, #12]
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_CIRC_CNT_TO_END
	cmp	w0, #4
	b.lo	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x0, sp, #12
	mov	x1, x21
	mov	w2, #4
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x22, x0
	add	x0, sp, #12
	mov	x1, x21
	mov	x2, x22
	bl	_memcpy
	add	x0, x26, w22, uxtw #2
	ldr	x1, [x23]
	sub	w2, w27, w22
LBB0_9:                                 ;   in Loop: Header=BB0_6 Depth=1
	bl	_memcpy
	ldr	w0, [sp, #12]
	ldr	x8, [x19, #8]
	ldr	x9, [x25]
	add	x1, x9, x8
	bl	_writeq
	ldrsw	x8, [x23, #8]
	cmp	w20, #3
	b.ls	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	add	x8, x8, #4
	ldrsw	x2, [x24]
	udiv	x9, x8, x2
	msub	w1, w9, w2, w8
	str	w1, [x23, #8]
	subs	w20, w20, #4
	b.gt	LBB0_6
	b	LBB0_12
LBB0_11:
	add	w8, w20, w8
	ldr	w9, [x24]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	str	w8, [x23, #8]
LBB0_12:
	mov	x0, x19
	bl	_spin_unlock_irqrestore
LBB0_13:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MLXBF_TMFIFO_DATA_MIN_WORDS,4,2 ; @MLXBF_TMFIFO_DATA_MIN_WORDS
	.comm	_VIRTIO_ID_CONSOLE,8,3          ; @VIRTIO_ID_CONSOLE
	.comm	_MLXBF_TMFIFO_CON_TX_BUF_SIZE,4,2 ; @MLXBF_TMFIFO_CON_TX_BUF_SIZE
	.comm	_MLXBF_TMFIFO_TX_DATA,8,3       ; @MLXBF_TMFIFO_TX_DATA
	.no_dead_strip	_mlxbf_tmfifo_console_tx
.subsections_via_symbols
