	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_uart_bus_receive
_aml8726_uart_bus_receive:              ## @aml8726_uart_bus_receive
	.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, %r14
	leaq	24(%rdi), %r15
	movl	8(%rdi), %edi
	callq	_uart_lock
	movq	_AML_UART_STATUS_REG@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movl	%eax, %ebx
	movq	_AML_UART_STATUS_RX_FIFO_EMPTY@GOTPCREL(%rip), %r13
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_1 Depth=1
	orl	%ebx, %esi
	movq	%r14, %rdi
	callq	_uart_rx_put
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movl	%eax, %ebx
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %eax
	testl	%ebx, %eax
	jne	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r14, %rdi
	callq	_uart_rx_full
	testq	%rax, %rax
	jne	LBB0_3
## %bb.11:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_AML_UART_RFIFO_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movq	_AML_UART_STATUS_FRAME_ERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%ebx, %ecx
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_UART_STAT_FRAMERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_13:                                ##   in Loop: Header=BB0_1 Depth=1
	movzbl	%al, %esi
	orl	%ecx, %esi
	movq	_AML_UART_STATUS_PARITY_ERR@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_UART_STAT_PARERR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_15
LBB0_3:
	movq	_UART_STAT_OVERRUN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r14), %rcx
	movq	16(%r14), %rdx
	movl	%eax, (%rdx,%rcx,4)
	movl	(%r13), %eax
LBB0_4:
	testl	%ebx, %eax
	jne	LBB0_8
## %bb.5:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	%r13, %r14
	movq	%r12, %r13
	movq	_AML_UART_RFIFO_REG@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	testl	%eax, (%r14)
	je	LBB0_6
## %bb.7:
	movl	%eax, %ebx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
LBB0_8:
	movq	_AML_UART_STATUS_FRAME_ERR@GOTPCREL(%rip), %rax
	movq	_AML_UART_STATUS_PARITY_ERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ebx, %ecx
	je	LBB0_10
## %bb.9:
	movq	_AML_UART_CONTROL_REG@GOTPCREL(%rip), %r12
	movl	(%r12), %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_uart_getreg
	movq	_AML_UART_CONTROL_CLR_ERR@GOTPCREL(%rip), %r13
	orl	(%r13), %eax
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_uart_setreg
	movq	%r15, %rdi
	callq	_uart_barrier
	movl	(%r12), %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_uart_getreg
	movl	(%r13), %edx
	notl	%edx
	andl	%eax, %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_uart_setreg
	movq	%r15, %rdi
	callq	_uart_barrier
LBB0_10:
	movl	8(%r14), %edi
	callq	_uart_unlock
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AML_UART_STATUS_REG,4,2        ## @AML_UART_STATUS_REG
	.comm	_AML_UART_STATUS_RX_FIFO_EMPTY,4,2 ## @AML_UART_STATUS_RX_FIFO_EMPTY
	.comm	_UART_STAT_OVERRUN,4,2          ## @UART_STAT_OVERRUN
	.comm	_AML_UART_RFIFO_REG,4,2         ## @AML_UART_RFIFO_REG
	.comm	_AML_UART_STATUS_FRAME_ERR,4,2  ## @AML_UART_STATUS_FRAME_ERR
	.comm	_UART_STAT_FRAMERR,4,2          ## @UART_STAT_FRAMERR
	.comm	_AML_UART_STATUS_PARITY_ERR,4,2 ## @AML_UART_STATUS_PARITY_ERR
	.comm	_UART_STAT_PARERR,4,2           ## @UART_STAT_PARERR
	.comm	_AML_UART_CONTROL_REG,4,2       ## @AML_UART_CONTROL_REG
	.comm	_AML_UART_CONTROL_CLR_ERR,4,2   ## @AML_UART_CONTROL_CLR_ERR
	.no_dead_strip	_aml8726_uart_bus_receive
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_uart_bus_receive
_aml8726_uart_bus_receive:              ; @aml8726_uart_bus_receive
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	add	x20, x0, #24
	ldr	w0, [x0, #8]
	bl	_uart_lock
Lloh0:
	adrp	x22, _AML_UART_STATUS_REG@GOTPAGE
Lloh1:
	ldr	x22, [x22, _AML_UART_STATUS_REG@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_uart_getreg
	mov	x21, x0
Lloh2:
	adrp	x25, _AML_UART_STATUS_RX_FIFO_EMPTY@GOTPAGE
Lloh3:
	ldr	x25, [x25, _AML_UART_STATUS_RX_FIFO_EMPTY@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh4:
	adrp	x23, _AML_UART_STATUS_FRAME_ERR@GOTPAGE
Lloh5:
	ldr	x23, [x23, _AML_UART_STATUS_FRAME_ERR@GOTPAGEOFF]
Lloh6:
	adrp	x24, _AML_UART_STATUS_PARITY_ERR@GOTPAGE
Lloh7:
	ldr	x24, [x24, _AML_UART_STATUS_PARITY_ERR@GOTPAGEOFF]
	tst	w8, w0
	b.ne	LBB0_4
; %bb.1:
Lloh8:
	adrp	x26, _AML_UART_RFIFO_REG@GOTPAGE
Lloh9:
	ldr	x26, [x26, _AML_UART_RFIFO_REG@GOTPAGEOFF]
Lloh10:
	adrp	x27, _UART_STAT_FRAMERR@GOTPAGE
Lloh11:
	ldr	x27, [x27, _UART_STAT_FRAMERR@GOTPAGEOFF]
Lloh12:
	adrp	x28, _UART_STAT_PARERR@GOTPAGE
Lloh13:
	ldr	x28, [x28, _UART_STAT_PARERR@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_uart_rx_full
	cbnz	x0, LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x26]
	mov	x0, x20
	bl	_uart_getreg
	and	w8, w0, #0xff
	ldr	w9, [x23]
	ldr	w10, [x27]
	tst	w9, w21
	csel	w9, wzr, w10, eq
	orr	w8, w9, w8
	ldr	w9, [x24]
	ldr	w10, [x28]
	tst	w9, w21
	csel	w9, wzr, w10, eq
	orr	w1, w8, w9
	mov	x0, x19
	bl	_uart_rx_put
	ldr	w1, [x22]
	mov	x0, x20
	bl	_uart_getreg
	mov	x21, x0
	ldr	w8, [x25]
	tst	w8, w0
	b.eq	LBB0_2
LBB0_4:
	tst	w8, w21
	b.ne	LBB0_9
LBB0_5:
Lloh14:
	adrp	x26, _AML_UART_RFIFO_REG@GOTPAGE
Lloh15:
	ldr	x26, [x26, _AML_UART_RFIFO_REG@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x20
	bl	_uart_getreg
	ldr	w1, [x22]
	mov	x0, x20
	bl	_uart_getreg
	ldr	w8, [x25]
	tst	w8, w0
	b.eq	LBB0_6
; %bb.7:
	mov	x21, x0
	b	LBB0_9
LBB0_8:
Lloh16:
	adrp	x8, _UART_STAT_OVERRUN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _UART_STAT_OVERRUN@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	ldr	x9, [x19, #16]
	ldr	x10, [x19]
	str	w8, [x9, x10, lsl #2]
	ldr	w8, [x25]
	tst	w8, w21
	b.eq	LBB0_5
LBB0_9:
	ldr	w8, [x23]
	ldr	w9, [x24]
	orr	w8, w9, w8
	tst	w8, w21
	b.eq	LBB0_11
; %bb.10:
Lloh19:
	adrp	x22, _AML_UART_CONTROL_REG@GOTPAGE
Lloh20:
	ldr	x22, [x22, _AML_UART_CONTROL_REG@GOTPAGEOFF]
	ldr	w21, [x22]
	mov	x0, x20
	mov	x1, x21
	bl	_uart_getreg
Lloh21:
	adrp	x23, _AML_UART_CONTROL_CLR_ERR@GOTPAGE
Lloh22:
	ldr	x23, [x23, _AML_UART_CONTROL_CLR_ERR@GOTPAGEOFF]
	ldr	w8, [x23]
	orr	w2, w8, w0
	mov	x0, x20
	mov	x1, x21
	bl	_uart_setreg
	mov	x0, x20
	bl	_uart_barrier
	ldr	w21, [x22]
	mov	x0, x20
	mov	x1, x21
	bl	_uart_getreg
	ldr	w8, [x23]
	bic	w2, w0, w8
	mov	x0, x20
	mov	x1, x21
	bl	_uart_setreg
	mov	x0, x20
	bl	_uart_barrier
LBB0_11:
	ldr	w0, [x19, #8]
	bl	_uart_unlock
	mov	w0, #0
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_AML_UART_STATUS_REG,4,2        ; @AML_UART_STATUS_REG
	.comm	_AML_UART_STATUS_RX_FIFO_EMPTY,4,2 ; @AML_UART_STATUS_RX_FIFO_EMPTY
	.comm	_UART_STAT_OVERRUN,4,2          ; @UART_STAT_OVERRUN
	.comm	_AML_UART_RFIFO_REG,4,2         ; @AML_UART_RFIFO_REG
	.comm	_AML_UART_STATUS_FRAME_ERR,4,2  ; @AML_UART_STATUS_FRAME_ERR
	.comm	_UART_STAT_FRAMERR,4,2          ; @UART_STAT_FRAMERR
	.comm	_AML_UART_STATUS_PARITY_ERR,4,2 ; @AML_UART_STATUS_PARITY_ERR
	.comm	_UART_STAT_PARERR,4,2           ; @UART_STAT_PARERR
	.comm	_AML_UART_CONTROL_REG,4,2       ; @AML_UART_CONTROL_REG
	.comm	_AML_UART_CONTROL_CLR_ERR,4,2   ; @AML_UART_CONTROL_CLR_ERR
	.no_dead_strip	_aml8726_uart_bus_receive
.subsections_via_symbols
