	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpc_tty_unregister_service     ## -- Begin function cpc_tty_unregister_service
	.p2align	4, 0x90
_cpc_tty_unregister_service:            ## @cpc_tty_unregister_service
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	16(%rdi), %rbx
	testq	%rbx, %rbx
	je	LBB0_9
## %bb.1:
	movl	(%rbx), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_CPC_TTY_DBG
	cmpq	%r14, 24(%rbx)
	je	LBB0_2
## %bb.10:
	movq	8(%r14), %rax
	movl	(%rax), %esi
	movl	(%rbx), %edx
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CPC_TTY_DBG                    ## TAILCALL
LBB0_9:
	movq	8(%r14), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CPC_TTY_DBG                    ## TAILCALL
LBB0_2:
	movq	_cpc_tty_cnt@GOTPCREL(%rip), %r15
	decq	(%r15)
	je	LBB0_3
LBB0_7:
	movq	(%r14), %rax
	movl	(%rax), %edi
	callq	_CPC_TTY_LOCK
	movq	$0, 16(%rbx)
	movq	(%r14), %rax
	movl	(%rax), %edi
	callq	_CPC_TTY_UNLOCK
	movq	$0, 8(%rbx)
	movq	_CPC_TTY_ST_IDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rbx)
	jmp	LBB0_8
LBB0_3:
	movq	_serial_drv@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%rbx), %esi
	testl	%edx, %edx
	je	LBB0_5
## %bb.4:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_CPC_TTY_DBG
	incq	(%r15)
	movq	_cpc_tty_unreg_flag@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_CPC_TTY_DBG
	movq	_serial_drv@GOTPCREL(%rip), %rdi
	callq	_tty_unregister_driver
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	(%rbx), %esi
	leaq	L_.str.5(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_CPC_TTY_DBG
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: interface is not TTY\n"

L_.str.1:                               ## @.str.1
	.asciz	"%s: cpc_tty_unregister_service"

L_.str.2:                               ## @.str.2
	.asciz	"%s: invalid tty ptr=%s\n"

	.comm	_cpc_tty_cnt,8,3                ## @cpc_tty_cnt
	.comm	_serial_drv,4,2                 ## @serial_drv
L_.str.3:                               ## @.str.3
	.asciz	"%s: unregister is not possible, refcount=%d"

	.comm	_cpc_tty_unreg_flag,4,2         ## @cpc_tty_unreg_flag
L_.str.4:                               ## @.str.4
	.asciz	"%s: unregister the tty driver\n"

L_.str.5:                               ## @.str.5
	.asciz	"%s: ERROR ->unregister the tty driver error=%d\n"

	.comm	_CPC_TTY_ST_IDLE,4,2            ## @CPC_TTY_ST_IDLE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpc_tty_unregister_service     ; -- Begin function cpc_tty_unregister_service
	.p2align	2
_cpc_tty_unregister_service:            ; @cpc_tty_unregister_service
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x0
	ldr	x20, [x0, #16]
	cbz	x20, LBB0_3
; %bb.1:
	ldr	w1, [x20]
Lloh0:
	adrp	x0, l_.str.1@PAGE
Lloh1:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_CPC_TTY_DBG
	ldr	x8, [x20, #24]
	cmp	x8, x19
	b.eq	LBB0_4
; %bb.2:
	ldr	x8, [x19, #8]
	ldr	w1, [x8]
	ldr	w8, [x20]
	str	x8, [sp]
Lloh2:
	adrp	x0, l_.str.2@PAGE
Lloh3:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_CPC_TTY_DBG
	b	LBB0_8
LBB0_3:
	ldr	x8, [x19, #8]
	ldr	w1, [x8]
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_CPC_TTY_DBG
LBB0_4:
Lloh6:
	adrp	x21, _cpc_tty_cnt@GOTPAGE
Lloh7:
	ldr	x21, [x21, _cpc_tty_cnt@GOTPAGEOFF]
	ldr	x8, [x21]
	subs	x8, x8, #1
	str	x8, [x21]
	b.eq	LBB0_6
LBB0_5:
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_CPC_TTY_LOCK
	str	xzr, [x20, #16]
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_CPC_TTY_UNLOCK
	str	xzr, [x20, #8]
Lloh8:
	adrp	x8, _CPC_TTY_ST_IDLE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CPC_TTY_ST_IDLE@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	str	w8, [x20, #4]
	b	LBB0_8
LBB0_6:
Lloh11:
	adrp	x8, _serial_drv@GOTPAGE
Lloh12:
	ldr	x8, [x8, _serial_drv@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ldr	w1, [x20]
	cbz	w8, LBB0_9
; %bb.7:
	str	x8, [sp]
Lloh14:
	adrp	x0, l_.str.3@PAGE
Lloh15:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_CPC_TTY_DBG
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x21]
Lloh16:
	adrp	x8, _cpc_tty_unreg_flag@GOTPAGE
Lloh17:
	ldr	x8, [x8, _cpc_tty_unreg_flag@GOTPAGEOFF]
	mov	w9, #1
Lloh18:
	str	w9, [x8]
LBB0_8:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_9:
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_CPC_TTY_DBG
Lloh21:
	adrp	x0, _serial_drv@GOTPAGE
Lloh22:
	ldr	x0, [x0, _serial_drv@GOTPAGEOFF]
	bl	_tty_unregister_driver
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_5
; %bb.10:
	ldr	w1, [x20]
	str	x0, [sp]
Lloh23:
	adrp	x0, l_.str.5@PAGE
Lloh24:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_CPC_TTY_DBG
	b	LBB0_5
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: interface is not TTY\n"

l_.str.1:                               ; @.str.1
	.asciz	"%s: cpc_tty_unregister_service"

l_.str.2:                               ; @.str.2
	.asciz	"%s: invalid tty ptr=%s\n"

	.comm	_cpc_tty_cnt,8,3                ; @cpc_tty_cnt
	.comm	_serial_drv,4,2                 ; @serial_drv
l_.str.3:                               ; @.str.3
	.asciz	"%s: unregister is not possible, refcount=%d"

	.comm	_cpc_tty_unreg_flag,4,2         ; @cpc_tty_unreg_flag
l_.str.4:                               ; @.str.4
	.asciz	"%s: unregister the tty driver\n"

l_.str.5:                               ; @.str.5
	.asciz	"%s: ERROR ->unregister the tty driver error=%d\n"

	.comm	_CPC_TTY_ST_IDLE,4,2            ; @CPC_TTY_ST_IDLE
.subsections_via_symbols
