	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ser12_rx
_ser12_rx:                              ## @ser12_rx
	.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	%rsi, %r12
	movq	%rdi, %r15
	movl	(%rdi), %edi
	callq	_MSR
	movl	%eax, %edi
	callq	_inb
	movl	%eax, %ebx
	andb	$16, %bl
	leaq	64(%r12), %r14
	andl	$16, %eax
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_hdlcdrv_channelbit
	movl	16(%r12), %eax
	xorl	%ecx, %ecx
	cmpb	20(%r12), %bl
	setne	%cl
	leal	(%rcx,%rax,2), %ecx
	movl	%ecx, 16(%r12)
	movb	%bl, 20(%r12)
	je	LBB0_5
## %bb.1:
	cmpl	$0, (%r12)
	je	LBB0_2
## %bb.3:
	leaq	24(%r12), %rax
	movl	24(%r12), %ecx
	movl	$-1, %edx
	jmp	LBB0_4
LBB0_2:
	movl	%eax, %ecx
	shll	$30, %ecx
	sarl	$31, %ecx
	movl	%eax, %edx
	shll	$29, %edx
	sarl	$31, %edx
	addl	%ecx, %edx
	movl	%eax, %esi
	shll	$28, %esi
	sarl	$31, %esi
	addl	%edx, %esi
	movl	%eax, %edx
	shll	$4, %edx
	andl	$16, %edx
	leal	32(%rdx), %ecx
	testl	$1073741823, %eax               ## imm = 0x3FFFFFFF
	cmovnel	%edx, %ecx
	addl	%esi, %ecx
	leaq	24(%r12), %rax
	movl	24(%r12), %edx
LBB0_4:
	addl	%ecx, %edx
	movl	%edx, (%rax)
LBB0_5:
	movq	56(%r12), %rax
	testq	%rax, %rax
	jne	LBB0_7
## %bb.6:
	movslq	24(%r12), %rsi
	addq	32(%r12), %rsi
	addq	40(%r12), %rsi
	shrq	$63, %rsi
	movq	%r14, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_hdlcdrv_setdcd
	movq	32(%r12), %rax
	movq	%rax, 40(%r12)
	movslq	24(%r12), %rax
	movq	%rax, 32(%r12)
	movl	$2, 24(%r12)
	movq	%r12, %rdi
	callq	_SER12_DCD_INTERVAL
LBB0_7:
	decq	%rax
	movq	%rax, 56(%r12)
	cmpl	$0, (%r12)
	movl	48(%r12), %eax
	je	LBB0_8
## %bb.15:
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movq	%r15, %rdi
	movl	$6, %esi
	callq	_ser12_set_divisor
	jmp	LBB0_20
LBB0_8:
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movq	%r15, %rdi
	movl	$4, %esi
	callq	_ser12_set_divisor
	jmp	LBB0_13
LBB0_17:
	movl	16(%r12), %eax
	andl	$3, %eax
	xorl	%ecx, %ecx
	cmpl	$2, %eax
	sete	%cl
	movl	$6, %edx
	subl	%ecx, %edx
	cmpl	$1, %eax
	movl	$7, %esi
	cmovnel	%edx, %esi
	movq	%r15, %rdi
	callq	_ser12_set_divisor
	movl	8(%r12), %eax
	sarl	%eax
	movl	%eax, 8(%r12)
	movb	20(%r12), %cl
	cmpb	52(%r12), %cl
	jne	LBB0_19
## %bb.18:
	orl	$65536, %eax                    ## imm = 0x10000
	movl	%eax, 8(%r12)
LBB0_19:
	movb	%cl, 52(%r12)
LBB0_20:
	xorl	%eax, %eax
	cmpl	$0, 48(%r12)
	sete	%al
	movl	%eax, 48(%r12)
	movl	16(%r12), %eax
	andl	$1, %eax
	subl	%eax, 24(%r12)
	jmp	LBB0_21
LBB0_10:
	movl	16(%r12), %eax
	andl	$7, %eax
	xorl	%ecx, %ecx
	cmpl	$4, %eax
	sete	%cl
	movl	$4, %edx
	subl	%ecx, %edx
	cmpl	$1, %eax
	movl	$5, %esi
	cmovnel	%edx, %esi
	movq	%r15, %rdi
	callq	_ser12_set_divisor
	movl	8(%r12), %eax
	sarl	%eax
	movl	%eax, 8(%r12)
	movb	20(%r12), %cl
	cmpb	52(%r12), %cl
	jne	LBB0_12
## %bb.11:
	orl	$65536, %eax                    ## imm = 0x10000
	movl	%eax, 8(%r12)
LBB0_12:
	movb	%cl, 52(%r12)
LBB0_13:
	movl	16(%r12), %eax
	movl	48(%r12), %ecx
	leal	1(%rcx), %edx
	xorl	%esi, %esi
	cmpl	$2, %ecx
	cmovll	%edx, %esi
	movl	%esi, 48(%r12)
	testb	$1, %al
	je	LBB0_21
## %bb.14:
	movl	%eax, %ecx
	shrl	%ecx
	andl	$1, %ecx
	xorl	%edx, %edx
	testl	$2147483646, %eax               ## imm = 0x7FFFFFFE
	sete	%dl
	leal	(%rcx,%rdx,2), %ecx
	movl	%eax, %edx
	shll	$29, %edx
	sarl	$31, %edx
	movl	%eax, %esi
	shll	$28, %esi
	sarl	$31, %esi
	addl	%edx, %esi
	shll	$27, %eax
	sarl	$31, %eax
	addl	%esi, %eax
	shll	$4, %ecx
	addl	%eax, %ecx
	addl	%ecx, 24(%r12)
LBB0_21:
	movl	(%r15), %edi
	callq	_MCR
	movl	$13, %edi
	movl	%eax, %esi
	callq	_outb
	movl	8(%r12), %esi
	testb	$1, %sil
	je	LBB0_23
## %bb.22:
	sarl	%esi
	movq	%r14, %rdi
	callq	_hdlcdrv_putbits
	movl	$65536, 8(%r12)                 ## imm = 0x10000
LBB0_23:
	movq	56(%r12), %rax
	testq	%rax, %rax
	jne	LBB0_28
## %bb.24:
	testb	$1, (%r12)
	jne	LBB0_25
## %bb.26:
	movslq	24(%r12), %rsi
	addq	32(%r12), %rsi
	addq	40(%r12), %rsi
	shrq	$63, %rsi
	jmp	LBB0_27
LBB0_25:
	movl	(%r15), %edi
	callq	_MSR
	movl	%eax, %edi
	callq	_inb
	xorl	(%r12), %eax
	xorl	%esi, %esi
	testb	$-128, %al
	sete	%sil
LBB0_27:
	movq	%r14, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_hdlcdrv_setdcd
	movq	32(%r12), %rax
	movq	%rax, 40(%r12)
	movslq	24(%r12), %rax
	movq	%rax, 32(%r12)
	movl	$2, 24(%r12)
	movq	%r12, %rdi
	callq	_SER12_DCD_INTERVAL
LBB0_28:
	decq	%rax
	movq	%rax, 56(%r12)
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_ser12_rx
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ser12_rx
_ser12_rx:                              ; @ser12_rx
	.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	x19, x1
	mov	x21, x0
	ldr	w0, [x0]
	bl	_MSR
	bl	_inb
	add	x20, x19, #64
	and	w22, w0, #0x10
	mov	x0, x20
	mov	x1, x22
	bl	_hdlcdrv_channelbit
	ldr	w8, [x19, #16]
	ldrb	w9, [x19, #20]
	strb	w22, [x19, #20]
	cmp	w22, w9
	cset	w9, ne
	bfi	w9, w8, #1, #31
	str	w9, [x19, #16]
	b.eq	LBB0_5
; %bb.1:
	ldr	w9, [x19]
	cbz	w9, LBB0_3
; %bb.2:
	mov	x9, x19
	ldr	w8, [x9, #24]!
	mov	w10, #-1
	b	LBB0_4
LBB0_3:
	sbfx	w9, w8, #1, #1
	lsl	w10, w8, #29
	add	w9, w9, w10, asr #31
	lsl	w10, w8, #28
	add	w9, w9, w10, asr #31
	ubfiz	w10, w8, #4, #1
	mov	w11, #32
	bfi	w11, w8, #4, #1
	tst	w8, #0x3fffffff
	csel	w8, w11, w10, eq
	add	w8, w9, w8
	mov	x9, x19
	ldr	w10, [x9, #24]!
LBB0_4:
	add	w8, w8, w10
	str	w8, [x9]
LBB0_5:
	ldr	x0, [x19, #56]
	cbnz	x0, LBB0_7
; %bb.6:
	ldrsw	x8, [x19, #24]
	ldp	x9, x10, [x19, #32]
	add	x8, x9, x8
	add	x8, x8, x10
	lsr	x1, x8, #63
	mov	x0, x20
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_hdlcdrv_setdcd
	ldr	x8, [x19, #32]
	ldrsw	x9, [x19, #24]
	stp	x9, x8, [x19, #32]
	mov	w8, #2
	str	w8, [x19, #24]
	mov	x0, x19
	bl	_SER12_DCD_INTERVAL
LBB0_7:
	sub	x8, x0, #1
	str	x8, [x19, #56]
	ldr	w9, [x19]
	ldr	w8, [x19, #48]
	cbz	w9, LBB0_10
; %bb.8:
	cbz	w8, LBB0_12
; %bb.9:
	mov	x0, x21
	mov	w1, #6
	bl	_ser12_set_divisor
	b	LBB0_15
LBB0_10:
	cbz	w8, LBB0_16
; %bb.11:
	mov	x0, x21
	mov	w1, #4
	bl	_ser12_set_divisor
	b	LBB0_19
LBB0_12:
	ldr	w8, [x19, #16]
	and	w8, w8, #0x3
	cmp	w8, #2
	mov	w9, #5
	cinc	w9, w9, ne
	mov	w10, #7
	cmp	w8, #1
	csel	w1, w10, w9, eq
	mov	x0, x21
	bl	_ser12_set_divisor
	ldr	w8, [x19, #8]
	asr	w9, w8, #1
	str	w9, [x19, #8]
	ldrb	w8, [x19, #20]
	ldrb	w10, [x19, #52]
	cmp	w8, w10
	b.ne	LBB0_14
; %bb.13:
	orr	w9, w9, #0x10000
	str	w9, [x19, #8]
LBB0_14:
	strb	w8, [x19, #52]
LBB0_15:
	ldr	w8, [x19, #48]
	cmp	w8, #0
	cset	w8, eq
	str	w8, [x19, #48]
	ldr	w8, [x19, #16]
	and	w8, w8, #0x1
	ldr	w9, [x19, #24]
	sub	w8, w9, w8
	b	LBB0_21
LBB0_16:
	ldr	w8, [x19, #16]
	and	w8, w8, #0x7
	cmp	w8, #4
	mov	w9, #3
	cinc	w9, w9, ne
	mov	w10, #5
	cmp	w8, #1
	csel	w1, w10, w9, eq
	mov	x0, x21
	bl	_ser12_set_divisor
	ldr	w8, [x19, #8]
	asr	w9, w8, #1
	str	w9, [x19, #8]
	ldrb	w8, [x19, #20]
	ldrb	w10, [x19, #52]
	cmp	w8, w10
	b.ne	LBB0_18
; %bb.17:
	orr	w9, w9, #0x10000
	str	w9, [x19, #8]
LBB0_18:
	strb	w8, [x19, #52]
LBB0_19:
	ldr	w8, [x19, #48]
	cmp	w8, #1
	csinc	w8, wzr, w8, gt
	str	w8, [x19, #48]
	ldr	w8, [x19, #16]
	tbz	w8, #0, LBB0_22
; %bb.20:
	ubfx	w9, w8, #1, #1
	tst	w8, #0x7ffffffe
	cset	w10, eq
	bfi	w9, w10, #1, #1
	sbfx	w10, w8, #2, #1
	lsl	w11, w8, #28
	add	w10, w10, w11, asr #31
	lsl	w8, w8, #27
	add	w8, w10, w8, asr #31
	add	w8, w8, w9, lsl #4
	ldr	w9, [x19, #24]
	add	w8, w8, w9
LBB0_21:
	str	w8, [x19, #24]
LBB0_22:
	ldr	w0, [x21]
	bl	_MCR
	mov	x1, x0
	mov	w0, #13
	bl	_outb
	ldr	w8, [x19, #8]
	tbz	w8, #0, LBB0_24
; %bb.23:
	asr	w1, w8, #1
	mov	x0, x20
	bl	_hdlcdrv_putbits
	mov	w8, #65536
	str	w8, [x19, #8]
LBB0_24:
	ldr	x0, [x19, #56]
	cbnz	x0, LBB0_29
; %bb.25:
	ldrb	w8, [x19]
	tbnz	w8, #0, LBB0_27
; %bb.26:
	ldrsw	x8, [x19, #24]
	ldp	x9, x10, [x19, #32]
	add	x8, x9, x8
	add	x8, x8, x10
	lsr	x1, x8, #63
	b	LBB0_28
LBB0_27:
	ldr	w0, [x21]
	bl	_MSR
	bl	_inb
	ldr	w8, [x19]
	eor	w8, w8, w0
	mov	w9, #1
	bic	w1, w9, w8, lsr #7
LBB0_28:
	mov	x0, x20
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_hdlcdrv_setdcd
	ldr	x8, [x19, #32]
	ldrsw	x9, [x19, #24]
	stp	x9, x8, [x19, #32]
	mov	w8, #2
	str	w8, [x19, #24]
	mov	x0, x19
	bl	_SER12_DCD_INTERVAL
LBB0_29:
	sub	x8, x0, #1
	str	x8, [x19, #56]
	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
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_ser12_rx
.subsections_via_symbols
