	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function enter_uart_mode
_enter_uart_mode:                       ## @enter_uart_mode
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	$30000, %ebx                    ## imm = 0x7530
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_output_ready
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	leal	-1(%rbx), %eax
	cmpl	$1, %ebx
	movl	%eax, %ebx
	ja	LBB0_1
LBB0_3:
	movq	$0, (%r15)
	movq	_UART_MODE_ON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_uart401_cmd
	movl	$50000, %ebx                    ## imm = 0xC350
	movq	_MPU_ACK@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	cmpq	(%r12), %rax
	je	LBB0_10
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r15, %rdi
	callq	_input_avail
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r15, %rdi
	callq	_uart401_read
	xorl	%ecx, %ecx
	cmpq	(%r12), %rax
	sete	%cl
	cmpl	$2, %ebx
	jae	LBB0_9
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	xorl	%ecx, %ecx
	cmpl	$2, %ebx
	jb	LBB0_10
LBB0_9:                                 ##   in Loop: Header=BB0_4 Depth=1
	decl	%ebx
	testl	%ecx, %ecx
	je	LBB0_4
LBB0_10:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_UART_MODE_ON,4,2               ## @UART_MODE_ON
	.comm	_MPU_ACK,8,3                    ## @MPU_ACK
	.no_dead_strip	_enter_uart_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function enter_uart_mode
_enter_uart_mode:                       ; @enter_uart_mode
	.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, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_spin_lock_irqsave
	mov	w21, #30000
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_output_ready
	subs	w21, w21, #1
	cbnz	w0, LBB0_3
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	b.hi	LBB0_1
LBB0_3:
	str	xzr, [x20]
Lloh0:
	adrp	x8, _UART_MODE_ON@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UART_MODE_ON@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_uart401_cmd
	mov	w21, #50000
Lloh3:
	adrp	x22, _MPU_ACK@GOTPAGE
Lloh4:
	ldr	x22, [x22, _MPU_ACK@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	x9, [x22]
	cmp	x8, x9
	b.eq	LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_input_avail
	cbz	x0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_uart401_read
	ldr	x8, [x22]
	cmp	x0, x8
	cset	w8, eq
	cmp	w21, #2
	b.hs	LBB0_8
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	w8, #0
	cmp	w21, #2
	b.lo	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	sub	w21, w21, #1
	cbz	w8, LBB0_4
LBB0_9:
	mov	x0, x19
	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
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_UART_MODE_ON,4,2               ; @UART_MODE_ON
	.comm	_MPU_ACK,8,3                    ; @MPU_ACK
	.no_dead_strip	_enter_uart_mode
.subsections_via_symbols
