	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sx_transmit_chars
_sx_transmit_chars:                     ## @sx_transmit_chars
	.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	%rdi, %r15
	xorl	%eax, %eax
	callq	_func_enter2
	movq	_SX_DEBUG_TRANSMIT@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movl	8(%r15), %ecx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_sx_dprintk
	movq	_SX_PORT_TRANSMIT_LOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_test_and_set_bit
	testq	%rax, %rax
	je	LBB0_1
## %bb.10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	8(%r15), %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_sx_dprintk
	movq	_hi_txipos@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_sx_read_channel_byte
	movl	%eax, %r14d
	movq	_hi_txopos@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_sx_read_channel_byte
	movl	%r14d, %ecx
	notl	%ecx
	addl	%eax, %ecx
	movzbl	%cl, %ecx
	cmpl	%ecx, %ebx
	cmovgel	%ecx, %ebx
	movl	(%r12), %edi
	leaq	L_.str.2(%rip), %r13
	movq	%r13, %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_sx_dprintk
	movl	$256, %ecx                      ## imm = 0x100
	subl	%r14d, %ecx
	cmpl	%ecx, %ebx
	cmovgel	%ecx, %ebx
	movl	(%r12), %edi
	movq	%r13, %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_sx_dprintk
	movq	_SERIAL_XMIT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	subl	12(%r15), %ecx
	cmpl	%ecx, %ebx
	cmovgel	%ecx, %ebx
	movl	(%r12), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_sx_dprintk
	testl	%ebx, %ebx
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	32(%r15), %rax
	movq	_hi_txbuf@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movslq	%r14d, %r13
	addq	(%rax), %r13
	movq	%r15, %rdi
	callq	_CHAN_OFFSET
	addq	%rax, %r13
	movl	12(%r15), %esi
	addl	16(%r15), %esi
	movq	%r13, %rdi
	movq	_hi_txipos@GOTPCREL(%rip), %r13
	movq	_SX_DEBUG_TRANSMIT@GOTPCREL(%rip), %r12
	movl	%ebx, %edx
	callq	_memcpy_toio
	movl	(%r13), %esi
	addl	%ebx, %r14d
	movzbl	%r14b, %edx
	movq	%r15, %rdi
	callq	_sx_write_channel_byte
	movl	12(%r15), %eax
	addl	%ebx, %eax
	movq	_SERIAL_XMIT_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	decl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 12(%r15)
	movl	8(%r15), %eax
	subl	%ebx, %eax
	movl	%eax, 8(%r15)
	movl	%eax, %ebx
	jmp	LBB0_2
LBB0_4:
	movl	8(%r15), %eax
	testl	%eax, %eax
	jne	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	callq	_sx_disable_tx_interrupts
	movl	8(%r15), %eax
LBB0_6:
	cmpl	20(%r15), %eax
	movq	_SX_PORT_TRANSMIT_LOCK@GOTPCREL(%rip), %rbx
	jg	LBB0_9
## %bb.7:
	movq	24(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.8:
	callq	_tty_wakeup
	movl	(%r12), %edi
	movl	20(%r15), %edx
	leaq	L_.str.4(%rip), %rsi
	xorl	%eax, %eax
	callq	_sx_dprintk
LBB0_9:
	movl	(%rbx), %edi
	movq	%r15, %rsi
	callq	_clear_bit
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_func_exit                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SX_DEBUG_TRANSMIT,4,2          ## @SX_DEBUG_TRANSMIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Port %p: transmit %d chars\n"

	.comm	_SX_PORT_TRANSMIT_LOCK,4,2      ## @SX_PORT_TRANSMIT_LOCK
L_.str.1:                               ## @.str.1
	.asciz	"Copying %d "

	.comm	_hi_txipos,4,2                  ## @hi_txipos
	.comm	_hi_txopos,4,2                  ## @hi_txopos
L_.str.2:                               ## @.str.2
	.asciz	" %d(%d) "

	.comm	_SERIAL_XMIT_SIZE,4,2           ## @SERIAL_XMIT_SIZE
L_.str.3:                               ## @.str.3
	.asciz	" %d(%ld) \n"

	.comm	_hi_txbuf,4,2                   ## @hi_txbuf
L_.str.4:                               ## @.str.4
	.asciz	"Waking up.... ldisc (%d)....\n"

	.no_dead_strip	_sx_transmit_chars
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sx_transmit_chars
_sx_transmit_chars:                     ; @sx_transmit_chars
	.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
	mov	x19, x0
	bl	_func_enter2
Lloh0:
	adrp	x25, _SX_DEBUG_TRANSMIT@GOTPAGE
Lloh1:
	ldr	x25, [x25, _SX_DEBUG_TRANSMIT@GOTPAGEOFF]
	ldr	w0, [x25]
	ldr	w8, [x19, #8]
	stp	x19, x8, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_sx_dprintk
Lloh4:
	adrp	x8, _SX_PORT_TRANSMIT_LOCK@GOTPAGE
Lloh5:
	ldr	x8, [x8, _SX_PORT_TRANSMIT_LOCK@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_test_and_set_bit
	cbz	x0, LBB0_2
; %bb.1:
	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
LBB0_2:
Lloh7:
	adrp	x27, _hi_txipos@GOTPAGE
Lloh8:
	ldr	x27, [x27, _hi_txipos@GOTPAGEOFF]
	ldr	w24, [x19, #8]
Lloh9:
	adrp	x21, l_.str.2@PAGE
Lloh10:
	add	x21, x21, l_.str.2@PAGEOFF
	mov	w26, #256
Lloh11:
	adrp	x20, _SERIAL_XMIT_SIZE@GOTPAGE
Lloh12:
	ldr	x20, [x20, _SERIAL_XMIT_SIZE@GOTPAGEOFF]
Lloh13:
	adrp	x22, l_.str.3@PAGE
Lloh14:
	add	x22, x22, l_.str.3@PAGEOFF
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x25]
	str	x24, [sp]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_sx_dprintk
	ldr	w1, [x27]
	mov	x0, x19
	bl	_sx_read_channel_byte
	mov	x23, x0
Lloh17:
	adrp	x8, _hi_txopos@GOTPAGE
Lloh18:
	ldr	x8, [x8, _hi_txopos@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_sx_read_channel_byte
	mvn	w8, w23
	add	w8, w0, w8
	and	w8, w8, #0xff
	cmp	w24, w8
	csel	w24, w24, w8, lt
	ldr	w0, [x25]
	stp	x24, x8, [sp]
	mov	x1, x21
	bl	_sx_dprintk
	sub	w8, w26, w23
	cmp	w24, w8
	csel	w24, w24, w8, lt
	ldr	w0, [x25]
	stp	x24, x8, [sp]
	mov	x1, x21
	bl	_sx_dprintk
	ldr	w8, [x20]
	ldr	w9, [x19, #12]
	sub	w8, w8, w9
	cmp	w24, w8
	csel	w24, w24, w8, lt
	ldr	w0, [x25]
	stp	x24, x8, [sp]
	mov	x1, x22
	bl	_sx_dprintk
	cbz	w24, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x19, #32]
	ldr	x28, [x8]
Lloh20:
	adrp	x8, _hi_txbuf@GOTPAGE
Lloh21:
	ldr	x8, [x8, _hi_txbuf@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_CHAN_OFFSET
	add	x8, x28, w23, sxtw
	add	x0, x8, x0
	ldp	w9, w8, [x19, #12]
	add	w1, w9, w8
	mov	x2, x24
	bl	_memcpy_toio
	ldr	w1, [x27]
	add	w8, w24, w23
	and	w2, w8, #0xff
	mov	x0, x19
	bl	_sx_write_channel_byte
	ldr	w8, [x20]
	sub	w8, w8, #1
	ldp	w10, w9, [x19, #8]
	add	w9, w9, w24
	and	w8, w8, w9
	sub	w24, w10, w24
	stp	w24, w8, [x19, #8]
	b	LBB0_3
LBB0_5:
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_sx_disable_tx_interrupts
	ldr	w8, [x19, #8]
LBB0_7:
	ldr	w9, [x19, #20]
	cmp	w8, w9
Lloh23:
	adrp	x20, _SX_PORT_TRANSMIT_LOCK@GOTPAGE
Lloh24:
	ldr	x20, [x20, _SX_PORT_TRANSMIT_LOCK@GOTPAGEOFF]
	b.gt	LBB0_10
; %bb.8:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_10
; %bb.9:
	bl	_tty_wakeup
	ldr	w0, [x25]
	ldr	w8, [x19, #20]
	str	x8, [sp]
Lloh25:
	adrp	x1, l_.str.4@PAGE
Lloh26:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_sx_dprintk
LBB0_10:
	ldr	w0, [x20]
	mov	x1, x19
	bl	_clear_bit
	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
	b	_func_exit
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_SX_DEBUG_TRANSMIT,4,2          ; @SX_DEBUG_TRANSMIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Port %p: transmit %d chars\n"

	.comm	_SX_PORT_TRANSMIT_LOCK,4,2      ; @SX_PORT_TRANSMIT_LOCK
l_.str.1:                               ; @.str.1
	.asciz	"Copying %d "

	.comm	_hi_txipos,4,2                  ; @hi_txipos
	.comm	_hi_txopos,4,2                  ; @hi_txopos
l_.str.2:                               ; @.str.2
	.asciz	" %d(%d) "

	.comm	_SERIAL_XMIT_SIZE,4,2           ; @SERIAL_XMIT_SIZE
l_.str.3:                               ; @.str.3
	.asciz	" %d(%ld) \n"

	.comm	_hi_txbuf,4,2                   ; @hi_txbuf
l_.str.4:                               ; @.str.4
	.asciz	"Waking up.... ldisc (%d)....\n"

	.no_dead_strip	_sx_transmit_chars
.subsections_via_symbols
