	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cmtp_register_appl
_cmtp_register_appl:                    ## @cmtp_register_appl
	.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
	subq	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movl	%esi, -60(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_wait@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_current@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_DECLARE_WAITQUEUE
	movq	8(%r12), %r13
	movq	_CMTP_INTEROP_TIMEOUT@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movl	(%r15), %r14d
	movl	4(%r15), %r8d
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movl	8(%r15), %r9d
	leaq	L_.str(%rip), %rdi
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r12, %rsi
	movl	-60(%rbp), %r15d                ## 4-byte Reload
	movl	%r15d, %edx
	movl	%r14d, %ecx
	callq	_BT_DBG
	movq	%r13, -88(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_cmtp_application_add
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r15
	testl	%r14d, %r14d
	jns	LBB0_5
## %bb.4:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	imull	(%rax), %r14d
	negl	%r14d
LBB0_5:
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	testl	%r14d, %r14d
	jne	LBB0_7
## %bb.6:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r14d
LBB0_7:
	leaq	-56(%rbp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	%r14d, %edx
	callq	_capimsg_setu16
	movl	4(%r12), %edx
	movq	%r13, %rdi
	movl	$2, %esi
	callq	_capimsg_setu16
	movl	8(%r12), %edx
	movq	%r13, %rdi
	movl	$4, %esi
	callq	_capimsg_setu16
	movq	_BT_CONFIG@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r15)
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	callq	_cmtp_msgnum_get
	movl	%eax, 12(%r15)
	movq	_CAPI_REQ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_CAPI_FUNCTION_REGISTER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	$6, (%rsp)
	movq	%r14, %rdi
	xorl	%edx, %edx
	movl	%eax, %ecx
	movq	%r13, %r9
	callq	_cmtp_send_interopmsg
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_add_wait_queue
	movq	_TASK_INTERRUPTIBLE@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	callq	_set_current_state
	testq	%rbx, %rbx
	je	LBB0_16
## %bb.8:
	movq	_BT_CLOSED@GOTPCREL(%rip), %r12
	movq	_BT_CONNECTED@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	cmpq	(%r12), %rax
	je	LBB0_10
## %bb.18:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpq	(%r13), %rax
	je	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	_current@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_signal_pending
	testq	%rax, %rax
	jne	LBB0_21
## %bb.15:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	%rbx, %rdi
	callq	_schedule_timeout
	movq	%rax, %rbx
	movl	(%r14), %edi
	callq	_set_current_state
	testq	%rbx, %rbx
	jne	LBB0_9
LBB0_16:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_1:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_14
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_BT_ERR                         ## TAILCALL
LBB0_10:
	xorl	%r14d, %r14d
	subl	8(%r15), %r14d
	jmp	LBB0_11
LBB0_19:
	xorl	%r14d, %r14d
	jmp	LBB0_11
LBB0_21:
	movq	_EINTR@GOTPCREL(%rip), %rax
LBB0_17:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_11:
	movq	_TASK_RUNNING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_set_current_state
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_remove_wait_queue
	testl	%r14d, %r14d
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_cmtp_application_del
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_14
## %bb.22:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_wait,4,2                       ## @wait
	.comm	_current,4,2                    ## @current
	.comm	_CMTP_INTEROP_TIMEOUT,8,3       ## @CMTP_INTEROP_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ctrl %p appl %d level3cnt %d datablkcnt %d datablklen %d"

L_.str.1:                               ## @.str.1
	.asciz	"Can't allocate memory for new application"

	.comm	_BT_CONFIG,8,3                  ## @BT_CONFIG
	.comm	_CAPI_REQ,4,2                   ## @CAPI_REQ
	.comm	_CAPI_FUNCTION_REGISTER,4,2     ## @CAPI_FUNCTION_REGISTER
	.comm	_TASK_INTERRUPTIBLE,4,2         ## @TASK_INTERRUPTIBLE
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_BT_CLOSED,8,3                  ## @BT_CLOSED
	.comm	_BT_CONNECTED,8,3               ## @BT_CONNECTED
	.comm	_EINTR,4,2                      ## @EINTR
	.comm	_TASK_RUNNING,4,2               ## @TASK_RUNNING
	.no_dead_strip	_cmtp_register_appl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cmtp_register_appl
_cmtp_register_appl:                    ; @cmtp_register_appl
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x22, x2
	mov	x20, x1
	mov	x23, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
Lloh3:
	adrp	x8, _wait@GOTPAGE
Lloh4:
	ldr	x8, [x8, _wait@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
Lloh6:
	adrp	x25, _current@GOTPAGE
Lloh7:
	ldr	x25, [x25, _current@GOTPAGEOFF]
	ldr	w1, [x25]
	bl	_DECLARE_WAITQUEUE
	ldr	x19, [x23, #8]
Lloh8:
	adrp	x8, _CMTP_INTEROP_TIMEOUT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CMTP_INTEROP_TIMEOUT@GOTPAGEOFF]
Lloh10:
	ldr	x21, [x8]
	ldp	w24, w4, [x22]
	ldr	w5, [x22, #8]
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x23
	mov	x2, x20
	mov	x3, x24
	bl	_BT_DBG
	mov	x0, x19
	mov	x1, x20
	bl	_cmtp_application_add
	cbz	x0, LBB0_10
; %bb.1:
	mov	x20, x0
	tbnz	w24, #31, LBB0_12
; %bb.2:
	cbz	w24, LBB0_13
LBB0_3:
	mov	x0, sp
	mov	w1, #0
	mov	x2, x24
	bl	_capimsg_setu16
	ldr	w2, [x22, #4]
	mov	x0, sp
	mov	w1, #2
	bl	_capimsg_setu16
	ldr	w2, [x22, #8]
	mov	x0, sp
	mov	w1, #4
	bl	_capimsg_setu16
Lloh13:
	adrp	x8, _BT_CONFIG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _BT_CONFIG@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	str	x8, [x20]
	mov	x0, x19
	bl	_cmtp_msgnum_get
	mov	x3, x0
	str	w0, [x20, #12]
Lloh16:
	adrp	x8, _CAPI_REQ@GOTPAGE
Lloh17:
	ldr	x8, [x8, _CAPI_REQ@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
Lloh19:
	adrp	x8, _CAPI_FUNCTION_REGISTER@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CAPI_FUNCTION_REGISTER@GOTPAGEOFF]
Lloh21:
	ldr	w4, [x8]
	mov	x5, sp
	mov	x0, x19
	mov	w2, #0
	mov	w6, #6
	bl	_cmtp_send_interopmsg
Lloh22:
	adrp	x1, _wait@GOTPAGE
Lloh23:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x19
	bl	_add_wait_queue
Lloh24:
	adrp	x22, _TASK_INTERRUPTIBLE@GOTPAGE
Lloh25:
	ldr	x22, [x22, _TASK_INTERRUPTIBLE@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_set_current_state
	cbz	x21, LBB0_9
; %bb.4:
Lloh26:
	adrp	x23, _BT_CLOSED@GOTPAGE
Lloh27:
	ldr	x23, [x23, _BT_CLOSED@GOTPAGEOFF]
Lloh28:
	adrp	x24, _BT_CONNECTED@GOTPAGE
Lloh29:
	ldr	x24, [x24, _BT_CONNECTED@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	x9, [x23]
	cmp	x8, x9
	b.eq	LBB0_14
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x9, [x24]
	cmp	x8, x9
	b.eq	LBB0_15
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x25]
	bl	_signal_pending
	cbnz	x0, LBB0_16
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
	bl	_schedule_timeout
	mov	x21, x0
	ldr	w0, [x22]
	bl	_set_current_state
	cbnz	x21, LBB0_5
LBB0_9:
Lloh30:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_17
LBB0_10:
	ldr	x8, [sp, #8]
Lloh32:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh33:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_23
; %bb.11:
Lloh35:
	adrp	x0, l_.str.1@PAGE
Lloh36:
	add	x0, x0, l_.str.1@PAGEOFF
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_BT_ERR
LBB0_12:
	ldr	w8, [x23]
	mneg	w24, w24, w8
	cbnz	w24, LBB0_3
LBB0_13:
	ldr	w24, [x23]
	b	LBB0_3
LBB0_14:
	ldr	w8, [x20, #8]
	b	LBB0_18
LBB0_15:
	mov	w21, #0
	b	LBB0_19
LBB0_16:
Lloh37:
	adrp	x8, _EINTR@GOTPAGE
Lloh38:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
LBB0_18:
	neg	w21, w8
LBB0_19:
Lloh39:
	adrp	x8, _TASK_RUNNING@GOTPAGE
Lloh40:
	ldr	x8, [x8, _TASK_RUNNING@GOTPAGEOFF]
Lloh41:
	ldr	w0, [x8]
	bl	_set_current_state
Lloh42:
	adrp	x1, _wait@GOTPAGE
Lloh43:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x19
	bl	_remove_wait_queue
	cbz	w21, LBB0_21
; %bb.20:
	mov	x0, x19
	mov	x1, x20
	bl	_cmtp_application_del
LBB0_21:
	ldr	x8, [sp, #8]
Lloh44:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh45:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh46:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_23
; %bb.22:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_23:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_wait,4,2                       ; @wait
	.comm	_current,4,2                    ; @current
	.comm	_CMTP_INTEROP_TIMEOUT,8,3       ; @CMTP_INTEROP_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ctrl %p appl %d level3cnt %d datablkcnt %d datablklen %d"

l_.str.1:                               ; @.str.1
	.asciz	"Can't allocate memory for new application"

	.comm	_BT_CONFIG,8,3                  ; @BT_CONFIG
	.comm	_CAPI_REQ,4,2                   ; @CAPI_REQ
	.comm	_CAPI_FUNCTION_REGISTER,4,2     ; @CAPI_FUNCTION_REGISTER
	.comm	_TASK_INTERRUPTIBLE,4,2         ; @TASK_INTERRUPTIBLE
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_BT_CLOSED,8,3                  ; @BT_CLOSED
	.comm	_BT_CONNECTED,8,3               ; @BT_CONNECTED
	.comm	_EINTR,4,2                      ; @EINTR
	.comm	_TASK_RUNNING,4,2               ; @TASK_RUNNING
	.no_dead_strip	_cmtp_register_appl
.subsections_via_symbols
