	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_uart_bus_ioctl
_aml8726_uart_bus_ioctl:                ## @aml8726_uart_bus_ioctl
	.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	%rdx, %r14
	movl	%esi, %ebx
	movq	%rdi, %r12
	leaq	4(%rdi), %r15
	movl	(%rdi), %edi
	callq	_uart_lock
	leal	-128(%rbx), %eax
	cmpl	$2, %eax
	jae	LBB0_1
## %bb.8:
	movq	_AML_UART_CONTROL_REG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movq	_AML_UART_CONTROL_TWO_WIRE_EN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %ecx
	notl	%ecx
	andl	%eax, %ecx
	orl	%eax, %edx
	testq	%r14, %r14
	cmovnel	%ecx, %edx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_uart_setreg
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_1:
	cmpl	$130, %ebx
	jne	LBB0_9
## %bb.2:
	movq	_AML_UART_CONTROL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movl	%eax, %r13d
	movq	_AML_UART_CONTROL_BAUD_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %r13d
	movq	_AML_UART_MISC_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movl	%eax, %ebx
	movq	_AML_UART_MISC_BAUD_EXT_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	movq	_AML_UART_MISC_BAUD_EXT_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movq	_AML_UART_CONTROL_BAUD_WIDTH@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	orl	%r13d, %ebx
	movq	_aml8726_soc_hw_rev@GOTPCREL(%rip), %rax
	movl	$-131, %ecx
	addl	(%rax), %ecx
	cmpl	$2, %ecx
	ja	LBB0_5
## %bb.3:
	movq	_AML_UART_NEW_BAUD_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_uart_getreg
	movq	_AML_UART_NEW_BAUD_RATE_EN@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_5
## %bb.4:
	movq	_AML_UART_NEW_BAUD_RATE_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_AML_UART_NEW_BAUD_RATE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	movl	%eax, %ebx
LBB0_5:
	movl	(%r15), %ecx
	leal	3(%rcx), %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$2, %eax
	incl	%ebx
	cltd
	idivl	%ebx
	testl	%eax, %eax
	jle	LBB0_7
## %bb.6:
	movl	%eax, (%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_7:
	movq	_ENXIO@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %ebx
LBB0_11:
	movl	(%r12), %edi
	callq	_uart_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AML_UART_CONTROL_REG,4,2       ## @AML_UART_CONTROL_REG
	.comm	_AML_UART_CONTROL_BAUD_MASK,4,2 ## @AML_UART_CONTROL_BAUD_MASK
	.comm	_AML_UART_MISC_REG,4,2          ## @AML_UART_MISC_REG
	.comm	_AML_UART_MISC_BAUD_EXT_MASK,4,2 ## @AML_UART_MISC_BAUD_EXT_MASK
	.comm	_AML_UART_MISC_BAUD_EXT_SHIFT,4,2 ## @AML_UART_MISC_BAUD_EXT_SHIFT
	.comm	_AML_UART_CONTROL_BAUD_WIDTH,4,2 ## @AML_UART_CONTROL_BAUD_WIDTH
	.comm	_aml8726_soc_hw_rev,4,2         ## @aml8726_soc_hw_rev
	.comm	_AML_UART_NEW_BAUD_REG,4,2      ## @AML_UART_NEW_BAUD_REG
	.comm	_AML_UART_NEW_BAUD_RATE_EN,4,2  ## @AML_UART_NEW_BAUD_RATE_EN
	.comm	_AML_UART_NEW_BAUD_RATE_MASK,4,2 ## @AML_UART_NEW_BAUD_RATE_MASK
	.comm	_AML_UART_NEW_BAUD_RATE_SHIFT,4,2 ## @AML_UART_NEW_BAUD_RATE_SHIFT
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_AML_UART_CONTROL_TWO_WIRE_EN,4,2 ## @AML_UART_CONTROL_TWO_WIRE_EN
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_aml8726_uart_bus_ioctl
.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_ioctl
_aml8726_uart_bus_ioctl:                ; @aml8726_uart_bus_ioctl
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x2
	mov	x22, x1
	mov	x19, x0
	mov	x21, x0
	ldr	w0, [x21], #4
	bl	_uart_lock
	sub	w8, w22, #128
	cmp	w8, #2
	b.hs	LBB0_2
; %bb.1:
Lloh0:
	adrp	x22, _AML_UART_CONTROL_REG@GOTPAGE
Lloh1:
	ldr	x22, [x22, _AML_UART_CONTROL_REG@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x21
	bl	_uart_getreg
Lloh2:
	adrp	x8, _AML_UART_CONTROL_TWO_WIRE_EN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AML_UART_CONTROL_TWO_WIRE_EN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	bic	w9, w0, w8
	orr	w8, w8, w0
	cmp	x20, #0
	csel	w2, w8, w9, eq
	ldr	w1, [x22]
	mov	x0, x21
	bl	_uart_setreg
	mov	w21, #0
	b	LBB0_11
LBB0_2:
	cmp	w22, #130
	b.ne	LBB0_8
; %bb.3:
Lloh5:
	adrp	x8, _AML_UART_CONTROL_REG@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AML_UART_CONTROL_REG@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_uart_getreg
Lloh8:
	adrp	x8, _AML_UART_CONTROL_BAUD_MASK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AML_UART_CONTROL_BAUD_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	and	w22, w8, w0
Lloh11:
	adrp	x8, _AML_UART_MISC_REG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AML_UART_MISC_REG@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_uart_getreg
Lloh14:
	adrp	x8, _AML_UART_MISC_BAUD_EXT_MASK@GOTPAGE
Lloh15:
	ldr	x8, [x8, _AML_UART_MISC_BAUD_EXT_MASK@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh17:
	adrp	x9, _AML_UART_MISC_BAUD_EXT_SHIFT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _AML_UART_MISC_BAUD_EXT_SHIFT@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	asr	w8, w8, w9
Lloh20:
	adrp	x9, _AML_UART_CONTROL_BAUD_WIDTH@GOTPAGE
Lloh21:
	ldr	x9, [x9, _AML_UART_CONTROL_BAUD_WIDTH@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	orr	w22, w8, w22
Lloh23:
	adrp	x8, _aml8726_soc_hw_rev@GOTPAGE
Lloh24:
	ldr	x8, [x8, _aml8726_soc_hw_rev@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	sub	w8, w8, #131
	cmp	w8, #2
	b.hi	LBB0_6
; %bb.4:
Lloh26:
	adrp	x8, _AML_UART_NEW_BAUD_REG@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AML_UART_NEW_BAUD_REG@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_uart_getreg
Lloh29:
	adrp	x8, _AML_UART_NEW_BAUD_RATE_EN@GOTPAGE
Lloh30:
	ldr	x8, [x8, _AML_UART_NEW_BAUD_RATE_EN@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_6
; %bb.5:
Lloh32:
	adrp	x8, _AML_UART_NEW_BAUD_RATE_MASK@GOTPAGE
Lloh33:
	ldr	x8, [x8, _AML_UART_NEW_BAUD_RATE_MASK@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh35:
	adrp	x9, _AML_UART_NEW_BAUD_RATE_SHIFT@GOTPAGE
Lloh36:
	ldr	x9, [x9, _AML_UART_NEW_BAUD_RATE_SHIFT@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	asr	w22, w8, w9
LBB0_6:
	ldr	w8, [x21]
	add	w9, w8, #3
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #2
	add	w9, w22, #1
	sdiv	w8, w8, w9
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.7:
	mov	w21, #0
	str	w8, [x20]
	b	LBB0_11
LBB0_8:
Lloh38:
	adrp	x8, _EINVAL@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh40:
	adrp	x8, _ENXIO@GOTPAGE
Lloh41:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
LBB0_10:
	ldr	w21, [x8]
LBB0_11:
	ldr	w0, [x19]
	bl	_uart_unlock
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_AML_UART_CONTROL_REG,4,2       ; @AML_UART_CONTROL_REG
	.comm	_AML_UART_CONTROL_BAUD_MASK,4,2 ; @AML_UART_CONTROL_BAUD_MASK
	.comm	_AML_UART_MISC_REG,4,2          ; @AML_UART_MISC_REG
	.comm	_AML_UART_MISC_BAUD_EXT_MASK,4,2 ; @AML_UART_MISC_BAUD_EXT_MASK
	.comm	_AML_UART_MISC_BAUD_EXT_SHIFT,4,2 ; @AML_UART_MISC_BAUD_EXT_SHIFT
	.comm	_AML_UART_CONTROL_BAUD_WIDTH,4,2 ; @AML_UART_CONTROL_BAUD_WIDTH
	.comm	_aml8726_soc_hw_rev,4,2         ; @aml8726_soc_hw_rev
	.comm	_AML_UART_NEW_BAUD_REG,4,2      ; @AML_UART_NEW_BAUD_REG
	.comm	_AML_UART_NEW_BAUD_RATE_EN,4,2  ; @AML_UART_NEW_BAUD_RATE_EN
	.comm	_AML_UART_NEW_BAUD_RATE_MASK,4,2 ; @AML_UART_NEW_BAUD_RATE_MASK
	.comm	_AML_UART_NEW_BAUD_RATE_SHIFT,4,2 ; @AML_UART_NEW_BAUD_RATE_SHIFT
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_AML_UART_CONTROL_TWO_WIRE_EN,4,2 ; @AML_UART_CONTROL_TWO_WIRE_EN
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_aml8726_uart_bus_ioctl
.subsections_via_symbols
