	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpc_attach
_cpc_attach:                            ## @cpc_attach
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edx, %r14d
	movl	%esi, %ebx
	callq	_dev_to_hdlc
	movq	(%rax), %rax
	movq	(%rax), %rdi
	movq	8(%rdi), %rcx
	movq	(%rcx), %rdx
	movq	_PC300_TE@GOTPCREL(%rip), %rsi
	movq	_ENCODING_NRZ@GOTPCREL(%rip), %rcx
	cmpw	%bx, (%rcx)
	sete	%al
	movq	_ENCODING_NRZI@GOTPCREL(%rip), %rcx
	cmpw	%bx, (%rcx)
	sete	%cl
	orb	%al, %cl
	cmpq	(%rsi), %rdx
	jne	LBB0_3
## %bb.1:
	testb	%cl, %cl
	jne	LBB0_5
	jmp	LBB0_2
LBB0_3:
	movq	_ENCODING_FM_MARK@GOTPCREL(%rip), %rax
	cmpw	%bx, (%rax)
	sete	%al
	orb	%al, %cl
	jne	LBB0_5
## %bb.4:
	movq	_ENCODING_FM_SPACE@GOTPCREL(%rip), %rax
	cmpw	%bx, (%rax)
	jne	LBB0_2
LBB0_5:
	movq	_PARITY_NONE@GOTPCREL(%rip), %rax
	cmpw	%r14w, (%rax)
	je	LBB0_10
## %bb.6:
	movq	_PARITY_CRC16_PR0@GOTPCREL(%rip), %rax
	cmpw	%r14w, (%rax)
	je	LBB0_10
## %bb.7:
	movq	_PARITY_CRC16_PR1@GOTPCREL(%rip), %rax
	cmpw	%r14w, (%rax)
	je	LBB0_10
## %bb.8:
	movq	_PARITY_CRC32_PR1_CCITT@GOTPCREL(%rip), %rax
	cmpw	%r14w, (%rax)
	je	LBB0_10
## %bb.9:
	movq	_PARITY_CRC16_PR1_CCITT@GOTPCREL(%rip), %rax
	cmpw	%r14w, (%rax)
	je	LBB0_10
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_11
LBB0_10:
	movw	%bx, (%rdi)
	movw	%r14w, 2(%rdi)
	xorl	%eax, %eax
LBB0_11:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PC300_TE,8,3                   ## @PC300_TE
	.comm	_ENCODING_NRZ,2,1               ## @ENCODING_NRZ
	.comm	_ENCODING_NRZI,2,1              ## @ENCODING_NRZI
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENCODING_FM_MARK,2,1           ## @ENCODING_FM_MARK
	.comm	_ENCODING_FM_SPACE,2,1          ## @ENCODING_FM_SPACE
	.comm	_PARITY_NONE,2,1                ## @PARITY_NONE
	.comm	_PARITY_CRC16_PR0,2,1           ## @PARITY_CRC16_PR0
	.comm	_PARITY_CRC16_PR1,2,1           ## @PARITY_CRC16_PR1
	.comm	_PARITY_CRC32_PR1_CCITT,2,1     ## @PARITY_CRC32_PR1_CCITT
	.comm	_PARITY_CRC16_PR1_CCITT,2,1     ## @PARITY_CRC16_PR1_CCITT
	.no_dead_strip	_cpc_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpc_attach
_cpc_attach:                            ; @cpc_attach
	.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, x2
	mov	x20, x1
	bl	_dev_to_hdlc
	ldr	x8, [x0]
	ldr	x8, [x8]
	ldr	x9, [x8, #8]
Lloh0:
	adrp	x10, _PC300_TE@GOTPAGE
Lloh1:
	ldr	x10, [x10, _PC300_TE@GOTPAGEOFF]
	ldr	x11, [x9]
Lloh2:
	ldr	x10, [x10]
Lloh3:
	adrp	x9, _ENCODING_NRZ@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ENCODING_NRZ@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w20
Lloh5:
	adrp	x9, _ENCODING_NRZI@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ENCODING_NRZI@GOTPAGEOFF]
	ldrh	w9, [x9]
	ccmp	w9, w20, #4, ne
	cset	w9, eq
	cmp	x11, x10
	b.ne	LBB0_2
; %bb.1:
	tbnz	w9, #0, LBB0_4
	b	LBB0_9
LBB0_2:
Lloh7:
	adrp	x10, _ENCODING_FM_MARK@GOTPAGE
Lloh8:
	ldr	x10, [x10, _ENCODING_FM_MARK@GOTPAGEOFF]
	ldrh	w10, [x10]
	cmp	w10, w20
	cset	w10, eq
	orr	w9, w9, w10
	tbnz	w9, #0, LBB0_4
; %bb.3:
Lloh9:
	adrp	x9, _ENCODING_FM_SPACE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ENCODING_FM_SPACE@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w20
	b.ne	LBB0_9
LBB0_4:
Lloh11:
	adrp	x9, _PARITY_NONE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _PARITY_NONE@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w19
	b.eq	LBB0_10
; %bb.5:
Lloh13:
	adrp	x9, _PARITY_CRC16_PR0@GOTPAGE
Lloh14:
	ldr	x9, [x9, _PARITY_CRC16_PR0@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w19
	b.eq	LBB0_10
; %bb.6:
Lloh15:
	adrp	x9, _PARITY_CRC16_PR1@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PARITY_CRC16_PR1@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w19
	b.eq	LBB0_10
; %bb.7:
Lloh17:
	adrp	x9, _PARITY_CRC32_PR1_CCITT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _PARITY_CRC32_PR1_CCITT@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w19
	b.eq	LBB0_10
; %bb.8:
Lloh19:
	adrp	x9, _PARITY_CRC16_PR1_CCITT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _PARITY_CRC16_PR1_CCITT@GOTPAGEOFF]
	ldrh	w9, [x9]
	cmp	w9, w19
	b.eq	LBB0_10
LBB0_9:
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
LBB0_10:
	mov	w0, #0
	strh	w20, [x8]
	strh	w19, [x8, #2]
LBB0_11:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_PC300_TE,8,3                   ; @PC300_TE
	.comm	_ENCODING_NRZ,2,1               ; @ENCODING_NRZ
	.comm	_ENCODING_NRZI,2,1              ; @ENCODING_NRZI
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENCODING_FM_MARK,2,1           ; @ENCODING_FM_MARK
	.comm	_ENCODING_FM_SPACE,2,1          ; @ENCODING_FM_SPACE
	.comm	_PARITY_NONE,2,1                ; @PARITY_NONE
	.comm	_PARITY_CRC16_PR0,2,1           ; @PARITY_CRC16_PR0
	.comm	_PARITY_CRC16_PR1,2,1           ; @PARITY_CRC16_PR1
	.comm	_PARITY_CRC32_PR1_CCITT,2,1     ; @PARITY_CRC32_PR1_CCITT
	.comm	_PARITY_CRC16_PR1_CCITT,2,1     ; @PARITY_CRC16_PR1_CCITT
	.no_dead_strip	_cpc_attach
.subsections_via_symbols
