	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rs_write
_rs_write:                              ## @rs_write
	.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
	movl	%edx, %ebx
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	8(%rdi), %r14
	movl	4(%rdi), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	callq	_serial_paranoia_check
	xorl	%r12d, %r12d
	testq	%rax, %rax
	jne	LBB0_9
## %bb.1:
	movq	16(%r14), %rcx
	testq	%rcx, %rcx
	je	LBB0_9
## %bb.2:
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	_ESP_XMIT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	(%r14), %edx
	movl	4(%r14), %eax
	notl	%edx
	addl	%r15d, %edx
	cmpl	%ebx, %edx
	cmovgel	%ebx, %edx
	subl	%eax, %r15d
	cmpl	%edx, %r15d
	cmovgel	%edx, %r15d
	xorl	%r12d, %r12d
	testl	%r15d, %r15d
	jle	LBB0_4
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%eax, %rdi
	addq	%rcx, %rdi
	movq	%r13, %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movl	4(%r14), %ecx
	addl	%r15d, %ecx
	movq	_ESP_XMIT_SIZE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %eax
	decl	%eax
	andl	%ecx, %eax
	movl	%eax, 4(%r14)
	movl	(%r14), %ecx
	addl	%r15d, %ecx
	movl	%ecx, (%r14)
	subl	%r15d, %ebx
	addl	%r15d, %r12d
	movl	(%rdx), %edx
	notl	%ecx
	addl	%edx, %ecx
	cmpl	%ebx, %ecx
	cmovgel	%ebx, %ecx
	subl	%eax, %edx
	cmpl	%ecx, %edx
	cmovgel	%ecx, %edx
	testl	%edx, %edx
	jle	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	%r15d, %ecx
	addq	%rcx, %r13
	movq	16(%r14), %rcx
	movl	%edx, %r15d
	jmp	LBB0_3
LBB0_4:
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	leaq	12(%r14), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	cmpl	$0, (%r14)
	je	LBB0_8
## %bb.5:
	cmpl	$0, (%r15)
	jne	LBB0_8
## %bb.6:
	movl	8(%r14), %eax
	movq	_UART_IER_THRI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	jne	LBB0_8
## %bb.7:
	orl	%eax, %ecx
	movl	%ecx, 8(%r14)
	movq	_UART_ESI_CMD1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ESI_SET_SRV_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_serial_out
	movq	_UART_ESI_CMD2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	8(%r14), %edx
	movq	%r14, %rdi
	callq	_serial_out
LBB0_8:
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
LBB0_9:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rs_write"

	.comm	_ESP_XMIT_SIZE,4,2              ## @ESP_XMIT_SIZE
	.comm	_UART_IER_THRI,4,2              ## @UART_IER_THRI
	.comm	_UART_ESI_CMD1,4,2              ## @UART_ESI_CMD1
	.comm	_ESI_SET_SRV_MASK,4,2           ## @ESI_SET_SRV_MASK
	.comm	_UART_ESI_CMD2,4,2              ## @UART_ESI_CMD2
	.no_dead_strip	_rs_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rs_write
_rs_write:                              ; @rs_write
	.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	x22, x2
	mov	x23, x1
	mov	x21, x0
	ldr	x19, [x0, #8]
	ldr	w1, [x0, #4]
Lloh0:
	adrp	x2, l_.str@PAGE
Lloh1:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_serial_paranoia_check
	cbz	x0, LBB0_2
LBB0_1:
	mov	w20, #0
	b	LBB0_13
LBB0_2:
	ldr	x9, [x19, #16]
	cbz	x9, LBB0_1
; %bb.3:
Lloh2:
	adrp	x25, _ESP_XMIT_SIZE@GOTPAGE
Lloh3:
	ldr	x25, [x25, _ESP_XMIT_SIZE@GOTPAGEOFF]
	ldr	w10, [x25]
	ldp	w11, w8, [x19]
	mvn	w11, w11
	add	w11, w10, w11
	cmp	w11, w22
	csel	w11, w11, w22, lt
	sub	w10, w10, w8
	cmp	w10, w11
	csel	w24, w10, w11, lt
	cmp	w24, #1
	b.lt	LBB0_7
; %bb.4:
	mov	w20, #0
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, x9, w8, sxtw
	mov	x1, x23
	mov	x2, x24
	bl	_memcpy
	ldr	w8, [x25]
	sub	w8, w8, #1
	ldp	w10, w9, [x19]
	add	w9, w9, w24
	and	w8, w8, w9
	add	w9, w10, w24
	mvn	w10, w9
	stp	w9, w8, [x19]
	sub	w22, w22, w24
	add	w20, w24, w20
	ldr	w9, [x25]
	add	w10, w9, w10
	cmp	w10, w22
	csel	w10, w10, w22, lt
	sub	w9, w9, w8
	cmp	w9, w10
	csel	w10, w9, w10, lt
	cmp	w10, #1
	b.lt	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x23, w24, uxtw
	ldr	x9, [x19, #16]
	mov	x24, x10
	b	LBB0_5
LBB0_7:
	mov	w20, #0
LBB0_8:
	add	x22, x19, #12
	mov	x0, x22
	bl	_spin_lock_irqsave
	ldr	w8, [x19]
	cbz	w8, LBB0_12
; %bb.9:
	ldr	w8, [x21]
	cbnz	w8, LBB0_12
; %bb.10:
	ldr	w8, [x19, #8]
Lloh4:
	adrp	x9, _UART_IER_THRI@GOTPAGE
Lloh5:
	ldr	x9, [x9, _UART_IER_THRI@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_12
; %bb.11:
	orr	w8, w9, w8
	str	w8, [x19, #8]
Lloh7:
	adrp	x8, _UART_ESI_CMD1@GOTPAGE
Lloh8:
	ldr	x8, [x8, _UART_ESI_CMD1@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
Lloh10:
	adrp	x8, _ESI_SET_SRV_MASK@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ESI_SET_SRV_MASK@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_serial_out
Lloh13:
	adrp	x8, _UART_ESI_CMD2@GOTPAGE
Lloh14:
	ldr	x8, [x8, _UART_ESI_CMD2@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	ldr	w2, [x19, #8]
	mov	x0, x19
	bl	_serial_out
LBB0_12:
	mov	x0, x22
	bl	_spin_unlock_irqrestore
LBB0_13:
	mov	x0, x20
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rs_write"

	.comm	_ESP_XMIT_SIZE,4,2              ; @ESP_XMIT_SIZE
	.comm	_UART_IER_THRI,4,2              ; @UART_IER_THRI
	.comm	_UART_ESI_CMD1,4,2              ; @UART_ESI_CMD1
	.comm	_ESI_SET_SRV_MASK,4,2           ; @ESI_SET_SRV_MASK
	.comm	_UART_ESI_CMD2,4,2              ; @UART_ESI_CMD2
	.no_dead_strip	_rs_write
.subsections_via_symbols
