	.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	%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	%rsi, %rbx
	movl	(%rsi), %r12d
	movl	16(%rsi), %edi
	movl	(%rdx), %eax
	movq	_NSEC_PER_USEC@GOTPCREL(%rip), %rsi
	cltd
	idivl	(%rsi)
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, %r8d
	subl	%edi, %r8d
	leal	1000000(%r8), %esi
	cmpl	$499999, %esi                   ## imm = 0x7A11F
	movl	$499999, %edx                   ## imm = 0x7A11F
	cmovll	%esi, %edx
	movl	%ecx, %r15d
	addl	%edi, %edx
	negl	%edx
	addl	%edx, %eax
	addl	$1999999, %eax                  ## imm = 0x1E847F
	imulq	$1125899907, %rax, %rcx         ## imm = 0x431BDE83
	shrq	$50, %rcx
	imull	$1000000, %ecx, %ecx            ## imm = 0xF4240
	movl	%eax, %edx
	subl	%ecx, %edx
	subl	%eax, %edx
	movl	%r12d, %r14d
	sarl	%r14d
	leal	(%rdx,%r8), %r13d
	addl	$1000000, %r13d                 ## imm = 0xF4240
	cmpl	%r14d, %r13d
	jl	LBB0_6
## %bb.1:
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	leaq	68(%rbx), %r15
	movl	8(%rbx), %esi
	movl	%r12d, %eax
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	subl	%eax, %r13d
	addl	%eax, %edi
	movl	%edi, 16(%rbx)
	decq	24(%rbx)
	testb	$1, %sil
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	sarl	%esi
	xorl	$65535, %esi                    ## imm = 0xFFFF
	movq	%r15, %rdi
	callq	_hdlcdrv_putbits
	movl	$65536, %esi                    ## imm = 0x10000
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	sarl	%esi
	movl	%esi, 8(%rbx)
	cmpl	%r14d, %r13d
	jl	LBB0_5
## %bb.22:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %eax
	movl	16(%rbx), %edi
	jmp	LBB0_2
LBB0_5:
	movl	-44(%rbp), %r15d                ## 4-byte Reload
LBB0_6:
	movq	24(%rbx), %rax
	testq	%rax, %rax
	jle	LBB0_7
## %bb.10:
	cmpb	%r15b, 56(%rbx)
	jne	LBB0_12
LBB0_11:
	movl	16(%rbx), %r12d
	cmpl	$1000000, %r12d                 ## imm = 0xF4240
	jge	LBB0_20
	jmp	LBB0_21
LBB0_7:
	cmpl	$0, 72(%rbx)
	jne	LBB0_9
## %bb.8:
	movslq	32(%rbx), %rsi
	addq	40(%rbx), %rsi
	leaq	68(%rbx), %rdi
	addq	48(%rbx), %rsi
	shrq	$63, %rsi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_hdlcdrv_setdcd
	movq	24(%rbx), %rax
LBB0_9:
	movq	40(%rbx), %rcx
	movq	%rcx, 48(%rbx)
	movslq	32(%rbx), %rcx
	movq	%rcx, 40(%rbx)
	movl	$2, 32(%rbx)
	addq	$120, %rax
	movq	%rax, 24(%rbx)
	cmpb	%r15b, 56(%rbx)
	je	LBB0_11
LBB0_12:
	movl	%r12d, %eax
	sarl	$2, %eax
	sarl	$3, %r12d
	movb	%r15b, 56(%rbx)
	orb	$1, 10(%rbx)
	testl	%r13d, %r13d
	jle	LBB0_14
## %bb.13:
	movl	16(%rbx), %ecx
	jmp	LBB0_15
LBB0_14:
	movl	$1000000, %ecx                  ## imm = 0xF4240
	subl	%r12d, %ecx
	movl	16(%rbx), %r12d
LBB0_15:
	addl	%ecx, %r12d
	movl	%r12d, 16(%rbx)
	movl	%r13d, %edx
	negl	%edx
	cmovsl	%r13d, %edx
	movl	32(%rbx), %ecx
	cmpl	%eax, %edx
	jle	LBB0_17
## %bb.16:
	addl	$4, %ecx
	jmp	LBB0_18
LBB0_17:
	decl	%ecx
LBB0_18:
	movl	%ecx, 32(%rbx)
	cmpl	$1000000, %r12d                 ## imm = 0xF4240
	jl	LBB0_21
LBB0_20:
	cmpl	$1999999, %r12d                 ## imm = 0x1E847F
	movl	$1999999, %eax                  ## imm = 0x1E847F
	cmovll	%r12d, %eax
	negl	%eax
	addl	%r12d, %eax
	addl	$999999, %eax                   ## imm = 0xF423F
	imulq	$1125899907, %rax, %rcx         ## imm = 0x431BDE83
	shrq	$50, %rcx
	imull	$1000000, %ecx, %ecx            ## imm = 0xF4240
	movl	%eax, %edx
	subl	%ecx, %edx
	subl	%eax, %edx
	leal	(%r12,%rdx), %eax
	addl	$-1000000, %eax                 ## imm = 0xFFF0BDC0
	movl	%eax, 16(%rbx)
LBB0_21:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NSEC_PER_USEC,4,2              ## @NSEC_PER_USEC
	.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	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x3
	mov	x19, x1
	mov	w22, #16960
	movk	w22, #15, lsl #16
	ldr	w24, [x1]
	ldr	w8, [x2]
Lloh0:
	adrp	x9, _NSEC_PER_USEC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NSEC_PER_USEC@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	sdiv	w9, w8, w9
	ldr	w8, [x1, #16]
	add	w10, w9, w22
	sub	w10, w10, w8
	mov	w11, #41247
	movk	w11, #7, lsl #16
	cmp	w10, w11
	csel	w11, w10, w11, lt
	add	w11, w8, w11
	sub	w9, w9, w11
	add	w9, w9, #488, lsl #12           ; =1998848
	add	w9, w9, #1151
	mov	w11, #56963
	movk	w11, #17179, lsl #16
	umull	x11, w9, w11
	lsr	x11, x11, #50
	msub	w11, w11, w22, w9
	asr	w25, w24, #1
	sub	w9, w11, w9
	add	w23, w9, w10
	cmp	w23, w25
	b.ge	LBB0_7
LBB0_1:
	ldr	x8, [x19, #24]
	cmp	x8, #0
	b.gt	LBB0_5
; %bb.2:
	ldr	w9, [x19, #72]
	cbnz	w9, LBB0_4
; %bb.3:
	add	x0, x19, #68
	ldrsw	x8, [x19, #32]
	ldp	x9, x10, [x19, #40]
	add	x8, x9, x8
	add	x8, x8, x10
	lsr	x1, x8, #63
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_hdlcdrv_setdcd
	ldr	x8, [x19, #24]
LBB0_4:
	ldr	x9, [x19, #40]
	ldrsw	x10, [x19, #32]
	stp	x10, x9, [x19, #40]
	mov	w9, #2
	str	w9, [x19, #32]
	add	x8, x8, #120
	str	x8, [x19, #24]
LBB0_5:
	ldrb	w8, [x19, #56]
	cmp	w8, w20
	b.ne	LBB0_12
; %bb.6:
	ldr	w8, [x19, #16]
	b	LBB0_19
LBB0_7:
	add	x21, x19, #68
	ldr	w9, [x19, #8]
	mov	x10, x24
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	sub	w23, w23, w10
	add	w8, w8, w10
	str	w8, [x19, #16]
	ldr	x8, [x19, #24]
	sub	x8, x8, #1
	str	x8, [x19, #24]
	tbz	w9, #0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	asr	w8, w9, #1
	eor	w1, w8, #0xffff
	mov	x0, x21
	bl	_hdlcdrv_putbits
	mov	w9, #65536
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	asr	w9, w9, #1
	str	w9, [x19, #8]
	cmp	w23, w25
	b.lt	LBB0_1
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	w10, [x19]
	ldr	w8, [x19, #16]
	b	LBB0_8
LBB0_12:
	asr	w8, w24, #3
	asr	w9, w24, #2
	strb	w20, [x19, #56]
	ldr	w10, [x19, #8]
	orr	w10, w10, #0x10000
	str	w10, [x19, #8]
	cmp	w23, #1
	b.lt	LBB0_14
; %bb.13:
	ldr	w10, [x19, #16]
	b	LBB0_15
LBB0_14:
	sub	w10, w22, w8
	ldr	w8, [x19, #16]
LBB0_15:
	add	w8, w10, w8
	str	w8, [x19, #16]
	cmp	w23, #0
	cneg	w11, w23, mi
	ldr	w10, [x19, #32]
	cmp	w11, w9
	b.le	LBB0_17
; %bb.16:
	add	w9, w10, #4
	b	LBB0_18
LBB0_17:
	sub	w9, w10, #1
LBB0_18:
	str	w9, [x19, #32]
LBB0_19:
	sub	w9, w22, #1
	cmp	w8, w9
	b.le	LBB0_21
; %bb.20:
	mov	w9, #33919
	movk	w9, #30, lsl #16
	cmp	w8, w9
	csel	w9, w8, w9, lt
	mvn	w9, w9
	add	w10, w22, w8
	add	w9, w9, w10
	udiv	w10, w9, w22
	msub	w10, w10, w22, w9
	sub	w9, w10, w9
	add	w8, w8, w9
	sub	w8, w8, #244, lsl #12           ; =999424
	sub	w8, w8, #576
	str	w8, [x19, #16]
LBB0_21:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NSEC_PER_USEC,4,2              ; @NSEC_PER_USEC
	.no_dead_strip	_ser12_rx
.subsections_via_symbols
