	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mgsl_program_hw
_mgsl_program_hw:                       ## @mgsl_program_hw
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	callq	_spin_lock_irqsave
	movq	%rbx, %rdi
	callq	_usc_stop_receiver
	movq	%rbx, %rdi
	callq	_usc_stop_transmitter
	xorps	%xmm0, %xmm0
	movups	%xmm0, 64(%rbx)
	movq	$0, 80(%rbx)
	movq	56(%rbx), %rax
	movq	_MGSL_MODE_HDLC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.1:
	movq	_MGSL_MODE_RAW@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.2:
	cmpq	$0, 16(%rbx)
	je	LBB0_4
LBB0_3:
	movq	%rbx, %rdi
	callq	_usc_set_sync_mode
	jmp	LBB0_5
LBB0_4:
	movq	%rbx, %rdi
	callq	_usc_set_async_mode
LBB0_5:
	movq	%rbx, %rdi
	callq	_usc_set_serial_signals
	xorps	%xmm0, %xmm0
	movups	%xmm0, 24(%rbx)
	movups	%xmm0, 40(%rbx)
	movq	_SICR_CTS@GOTPCREL(%rip), %rax
	movq	_SICR_DSR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rax), %rsi
	movq	_SICR_DCD@GOTPCREL(%rip), %rax
	addq	(%rax), %rsi
	movq	_SICR_RI@GOTPCREL(%rip), %rax
	addq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_usc_EnableStatusIrqs
	movq	_IO_PIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_usc_EnableInterrupts
	movq	%rbx, %rdi
	callq	_usc_get_serial_signals
	cmpq	$0, 16(%rbx)
	jne	LBB0_7
## %bb.6:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	movq	_CREAD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_8
LBB0_7:
	movq	%rbx, %rdi
	callq	_usc_start_receiver
LBB0_8:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MGSL_MODE_HDLC,8,3             ## @MGSL_MODE_HDLC
	.comm	_MGSL_MODE_RAW,8,3              ## @MGSL_MODE_RAW
	.comm	_SICR_CTS,8,3                   ## @SICR_CTS
	.comm	_SICR_DSR,8,3                   ## @SICR_DSR
	.comm	_SICR_DCD,8,3                   ## @SICR_DCD
	.comm	_SICR_RI,8,3                    ## @SICR_RI
	.comm	_IO_PIN,4,2                     ## @IO_PIN
	.comm	_CREAD,4,2                      ## @CREAD
	.no_dead_strip	_mgsl_program_hw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mgsl_program_hw
_mgsl_program_hw:                       ; @mgsl_program_hw
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_spin_lock_irqsave
	mov	x0, x19
	bl	_usc_stop_receiver
	mov	x0, x19
	bl	_usc_stop_transmitter
	stp	xzr, xzr, [x19, #72]
	str	xzr, [x19, #64]
	ldr	x8, [x19, #56]
Lloh0:
	adrp	x9, _MGSL_MODE_HDLC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MGSL_MODE_HDLC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _MGSL_MODE_RAW@GOTPAGE
Lloh4:
	ldr	x10, [x10, _MGSL_MODE_RAW@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.eq	LBB0_2
; %bb.1:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_3
LBB0_2:
	mov	x0, x19
	bl	_usc_set_sync_mode
	b	LBB0_4
LBB0_3:
	mov	x0, x19
	bl	_usc_set_async_mode
LBB0_4:
	mov	x0, x19
	bl	_usc_set_serial_signals
	movi.2d	v0, #0000000000000000
	stur	q0, [x19, #24]
	stur	q0, [x19, #40]
Lloh6:
	adrp	x8, _SICR_CTS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SICR_CTS@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
Lloh9:
	adrp	x9, _SICR_DSR@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SICR_DSR@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
Lloh12:
	adrp	x10, _SICR_DCD@GOTPAGE
Lloh13:
	ldr	x10, [x10, _SICR_DCD@GOTPAGEOFF]
Lloh14:
	ldr	x10, [x10]
	add	x8, x9, x8
	add	x8, x8, x10
Lloh15:
	adrp	x9, _SICR_RI@GOTPAGE
Lloh16:
	ldr	x9, [x9, _SICR_RI@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x1, x8, x9
	mov	x0, x19
	bl	_usc_EnableStatusIrqs
Lloh18:
	adrp	x8, _IO_PIN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _IO_PIN@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_usc_EnableInterrupts
	mov	x0, x19
	bl	_usc_get_serial_signals
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_6
; %bb.5:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _CREAD@GOTPAGE
Lloh22:
	ldr	x9, [x9, _CREAD@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
LBB0_6:
	mov	x0, x19
	bl	_usc_start_receiver
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_MGSL_MODE_HDLC,8,3             ; @MGSL_MODE_HDLC
	.comm	_MGSL_MODE_RAW,8,3              ; @MGSL_MODE_RAW
	.comm	_SICR_CTS,8,3                   ; @SICR_CTS
	.comm	_SICR_DSR,8,3                   ; @SICR_DSR
	.comm	_SICR_DCD,8,3                   ; @SICR_DCD
	.comm	_SICR_RI,8,3                    ; @SICR_RI
	.comm	_IO_PIN,4,2                     ; @IO_PIN
	.comm	_CREAD,4,2                      ; @CREAD
	.no_dead_strip	_mgsl_program_hw
.subsections_via_symbols
