	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cmtp_attach_device             ## -- Begin function cmtp_attach_device
	.p2align	4, 0x90
_cmtp_attach_device:                    ## @cmtp_attach_device
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	xorl	%r14d, %r14d
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_BT_DBG
	leaq	-44(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_capimsg_setu32
	movq	_CAPI_REQ@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_CMTP_INITIAL_MSGNUM@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_CAPI_FUNCTION_GET_PROFILE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	$4, (%rsp)
	movq	%rbx, %rdi
	movl	$65535, %edx                    ## imm = 0xFFFF
	movq	%r15, %r9
	callq	_cmtp_send_interopmsg
	movl	(%rbx), %esi
	movl	76(%rbx), %edi
	movq	_CMTP_INTEROP_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_interruptible_timeout
	movq	%rax, %r15
	movl	(%rbx), %esi
	movl	72(%rbx), %edx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_BT_INFO
	testq	%r15, %r15
	je	LBB0_6
## %bb.1:
	movl	(%rbx), %eax
	testl	%eax, %eax
	je	LBB0_7
## %bb.2:
	cmpl	$2, %eax
	jl	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_BT_INFO
LBB0_4:
	movq	_THIS_MODULE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	8(%rbx), %r14
	movl	%eax, 64(%rbx)
	movq	%rbx, 56(%rbx)
	movl	48(%rbx), %edi
	movl	72(%rbx), %esi
	callq	_strcpy
	leaq	L_.str.3(%rip), %rax
	movq	%rax, 8(%rbx)
	movq	_cmtp_load_firmware@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rbx)
	movq	_cmtp_reset_ctr@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%rbx)
	movq	_cmtp_register_appl@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%rbx)
	movq	_cmtp_release_appl@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	_cmtp_send_message@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rbx)
	movq	_cmtp_procinfo@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	_cmtp_ctr_read_proc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movq	%r14, %rdi
	callq	_attach_capi_ctr
	testq	%rax, %rax
	js	LBB0_8
## %bb.5:
	movl	16(%rbx), %edx
	movl	%edx, 4(%rbx)
	leaq	L_.str.5(%rip), %rdi
	xorl	%r14d, %r14d
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_BT_DBG
	leaq	-44(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$1, %edx
	callq	_capimsg_setu32
	movl	(%r13), %r12d
	movq	%rbx, %rdi
	callq	_cmtp_msgnum_get
	movq	_CAPI_FUNCTION_GET_MANUFACTURER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	$4, (%rsp)
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	%eax, %ecx
	movq	%r15, %r9
	callq	_cmtp_send_interopmsg
	movl	(%r13), %r12d
	movq	%rbx, %rdi
	callq	_cmtp_msgnum_get
	movq	_CAPI_FUNCTION_GET_VERSION@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	$4, (%rsp)
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	%eax, %ecx
	movq	%r15, %r9
	callq	_cmtp_send_interopmsg
	movl	(%r13), %r12d
	movq	%rbx, %rdi
	callq	_cmtp_msgnum_get
	movq	_CAPI_FUNCTION_GET_SERIAL_NUMBER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	$4, (%rsp)
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	%eax, %ecx
	movq	%r15, %r9
	callq	_cmtp_send_interopmsg
	movl	(%r13), %r12d
	movq	%rbx, %rdi
	callq	_cmtp_msgnum_get
	movq	_CAPI_FUNCTION_GET_PROFILE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	$4, (%rsp)
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	%eax, %ecx
	movq	%r15, %r9
	callq	_cmtp_send_interopmsg
	jmp	LBB0_11
LBB0_6:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_7:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_8:
	leaq	L_.str.4(%rip), %rdi
	callq	_BT_ERR
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_9:
	xorl	%r14d, %r14d
LBB0_10:
	subl	(%rax), %r14d
LBB0_11:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"session %p"

	.comm	_CAPI_REQ,4,2                   ## @CAPI_REQ
	.comm	_CMTP_INITIAL_MSGNUM,4,2        ## @CMTP_INITIAL_MSGNUM
	.comm	_CAPI_FUNCTION_GET_PROFILE,4,2  ## @CAPI_FUNCTION_GET_PROFILE
	.comm	_CMTP_INTEROP_TIMEOUT,4,2       ## @CMTP_INTEROP_TIMEOUT
L_.str.1:                               ## @.str.1
	.asciz	"Found %d CAPI controller(s) on device %s"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.2:                               ## @.str.2
	.asciz	"Setting up only CAPI controller 1"

	.comm	_THIS_MODULE,4,2                ## @THIS_MODULE
L_.str.3:                               ## @.str.3
	.asciz	"cmtp"

	.comm	_cmtp_load_firmware,4,2         ## @cmtp_load_firmware
	.comm	_cmtp_reset_ctr,4,2             ## @cmtp_reset_ctr
	.comm	_cmtp_register_appl,4,2         ## @cmtp_register_appl
	.comm	_cmtp_release_appl,4,2          ## @cmtp_release_appl
	.comm	_cmtp_send_message,4,2          ## @cmtp_send_message
	.comm	_cmtp_procinfo,4,2              ## @cmtp_procinfo
	.comm	_cmtp_ctr_read_proc,4,2         ## @cmtp_ctr_read_proc
L_.str.4:                               ## @.str.4
	.asciz	"Can't attach new controller"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.5:                               ## @.str.5
	.asciz	"session %p num %d"

	.comm	_CAPI_FUNCTION_GET_MANUFACTURER,4,2 ## @CAPI_FUNCTION_GET_MANUFACTURER
	.comm	_CAPI_FUNCTION_GET_VERSION,4,2  ## @CAPI_FUNCTION_GET_VERSION
	.comm	_CAPI_FUNCTION_GET_SERIAL_NUMBER,4,2 ## @CAPI_FUNCTION_GET_SERIAL_NUMBER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cmtp_attach_device             ; -- Begin function cmtp_attach_device
	.p2align	2
_cmtp_attach_device:                    ; @cmtp_attach_device
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_BT_DBG
	add	x0, sp, #28
	mov	w1, #0
	mov	w2, #0
	bl	_capimsg_setu32
Lloh2:
	adrp	x22, _CAPI_REQ@GOTPAGE
Lloh3:
	ldr	x22, [x22, _CAPI_REQ@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh4:
	adrp	x8, _CMTP_INITIAL_MSGNUM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CMTP_INITIAL_MSGNUM@GOTPAGEOFF]
Lloh6:
	ldr	w3, [x8]
Lloh7:
	adrp	x21, _CAPI_FUNCTION_GET_PROFILE@GOTPAGE
Lloh8:
	ldr	x21, [x21, _CAPI_FUNCTION_GET_PROFILE@GOTPAGEOFF]
	ldr	w4, [x21]
	add	x5, sp, #28
	mov	x0, x19
	mov	w2, #65535
	mov	w6, #4
	bl	_cmtp_send_interopmsg
	ldr	w0, [x19, #76]
	ldr	w1, [x19]
Lloh9:
	adrp	x8, _CMTP_INTEROP_TIMEOUT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CMTP_INTEROP_TIMEOUT@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	bl	_wait_event_interruptible_timeout
	mov	x20, x0
	ldr	w8, [x19]
	ldr	w9, [x19, #72]
	stp	x8, x9, [sp]
Lloh12:
	adrp	x0, l_.str.1@PAGE
Lloh13:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_BT_INFO
	cbz	x20, LBB0_6
; %bb.1:
	ldr	w8, [x19]
	cbz	w8, LBB0_7
; %bb.2:
	cmp	w8, #2
	b.lt	LBB0_4
; %bb.3:
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_BT_INFO
LBB0_4:
Lloh16:
	adrp	x8, _THIS_MODULE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _THIS_MODULE@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [x19, #64]
	str	x19, [x19, #56]
	ldr	w0, [x19, #48]
	ldr	w1, [x19, #72]
	bl	_strcpy
Lloh19:
	adrp	x8, l_.str.3@PAGE
Lloh20:
	add	x8, x8, l_.str.3@PAGEOFF
	mov	x0, x19
	str	x8, [x0, #8]!
Lloh21:
	adrp	x8, _cmtp_load_firmware@GOTPAGE
Lloh22:
	ldr	x8, [x8, _cmtp_load_firmware@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	str	w8, [x0, #36]
Lloh24:
	adrp	x8, _cmtp_reset_ctr@GOTPAGE
Lloh25:
	ldr	x8, [x8, _cmtp_reset_ctr@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
Lloh27:
	adrp	x9, _cmtp_register_appl@GOTPAGE
Lloh28:
	ldr	x9, [x9, _cmtp_register_appl@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #28]
Lloh30:
	adrp	x8, _cmtp_release_appl@GOTPAGE
Lloh31:
	ldr	x8, [x8, _cmtp_release_appl@GOTPAGEOFF]
Lloh32:
	adrp	x9, _cmtp_send_message@GOTPAGE
Lloh33:
	ldr	x9, [x9, _cmtp_send_message@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
Lloh35:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #20]
Lloh36:
	adrp	x8, _cmtp_procinfo@GOTPAGE
Lloh37:
	ldr	x8, [x8, _cmtp_procinfo@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
Lloh39:
	adrp	x9, _cmtp_ctr_read_proc@GOTPAGE
Lloh40:
	ldr	x9, [x9, _cmtp_ctr_read_proc@GOTPAGEOFF]
Lloh41:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #12]
	bl	_attach_capi_ctr
	tbnz	x0, #63, LBB0_8
; %bb.5:
	ldr	w8, [x19, #16]
	str	w8, [x19, #4]
	str	x8, [sp]
Lloh42:
	adrp	x0, l_.str.5@PAGE
Lloh43:
	add	x0, x0, l_.str.5@PAGEOFF
	mov	x1, x19
	bl	_BT_DBG
	add	x0, sp, #28
	mov	w1, #0
	mov	w2, #1
	bl	_capimsg_setu32
	ldr	w20, [x22]
	mov	x0, x19
	bl	_cmtp_msgnum_get
	mov	x3, x0
Lloh44:
	adrp	x8, _CAPI_FUNCTION_GET_MANUFACTURER@GOTPAGE
Lloh45:
	ldr	x8, [x8, _CAPI_FUNCTION_GET_MANUFACTURER@GOTPAGEOFF]
Lloh46:
	ldr	w4, [x8]
	add	x5, sp, #28
	mov	x0, x19
	mov	x1, x20
	mov	w2, #65535
	mov	w6, #4
	bl	_cmtp_send_interopmsg
	ldr	w20, [x22]
	mov	x0, x19
	bl	_cmtp_msgnum_get
	mov	x3, x0
Lloh47:
	adrp	x8, _CAPI_FUNCTION_GET_VERSION@GOTPAGE
Lloh48:
	ldr	x8, [x8, _CAPI_FUNCTION_GET_VERSION@GOTPAGEOFF]
Lloh49:
	ldr	w4, [x8]
	add	x5, sp, #28
	mov	x0, x19
	mov	x1, x20
	mov	w2, #65535
	mov	w6, #4
	bl	_cmtp_send_interopmsg
	ldr	w20, [x22]
	mov	x0, x19
	bl	_cmtp_msgnum_get
	mov	x3, x0
Lloh50:
	adrp	x8, _CAPI_FUNCTION_GET_SERIAL_NUMBER@GOTPAGE
Lloh51:
	ldr	x8, [x8, _CAPI_FUNCTION_GET_SERIAL_NUMBER@GOTPAGEOFF]
Lloh52:
	ldr	w4, [x8]
	add	x5, sp, #28
	mov	x0, x19
	mov	x1, x20
	mov	w2, #65535
	mov	w6, #4
	bl	_cmtp_send_interopmsg
	ldr	w20, [x22]
	mov	x0, x19
	bl	_cmtp_msgnum_get
	mov	x3, x0
	ldr	w4, [x21]
	add	x5, sp, #28
	mov	x0, x19
	mov	x1, x20
	mov	w2, #65535
	mov	w6, #4
	bl	_cmtp_send_interopmsg
	mov	w0, #0
	b	LBB0_10
LBB0_6:
Lloh53:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh54:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:
Lloh55:
	adrp	x8, _ENODEV@GOTPAGE
Lloh56:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh57:
	adrp	x0, l_.str.4@PAGE
Lloh58:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_BT_ERR
Lloh59:
	adrp	x8, _EBUSY@GOTPAGE
Lloh60:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	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
	add	sp, sp, #80
	ret
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh34
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGot	Lloh53, Lloh54
	.loh AdrpLdrGot	Lloh55, Lloh56
	.loh AdrpLdrGot	Lloh59, Lloh60
	.loh AdrpAdd	Lloh57, Lloh58
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"session %p"

	.comm	_CAPI_REQ,4,2                   ; @CAPI_REQ
	.comm	_CMTP_INITIAL_MSGNUM,4,2        ; @CMTP_INITIAL_MSGNUM
	.comm	_CAPI_FUNCTION_GET_PROFILE,4,2  ; @CAPI_FUNCTION_GET_PROFILE
	.comm	_CMTP_INTEROP_TIMEOUT,4,2       ; @CMTP_INTEROP_TIMEOUT
l_.str.1:                               ; @.str.1
	.asciz	"Found %d CAPI controller(s) on device %s"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.2:                               ; @.str.2
	.asciz	"Setting up only CAPI controller 1"

	.comm	_THIS_MODULE,4,2                ; @THIS_MODULE
l_.str.3:                               ; @.str.3
	.asciz	"cmtp"

	.comm	_cmtp_load_firmware,4,2         ; @cmtp_load_firmware
	.comm	_cmtp_reset_ctr,4,2             ; @cmtp_reset_ctr
	.comm	_cmtp_register_appl,4,2         ; @cmtp_register_appl
	.comm	_cmtp_release_appl,4,2          ; @cmtp_release_appl
	.comm	_cmtp_send_message,4,2          ; @cmtp_send_message
	.comm	_cmtp_procinfo,4,2              ; @cmtp_procinfo
	.comm	_cmtp_ctr_read_proc,4,2         ; @cmtp_ctr_read_proc
l_.str.4:                               ; @.str.4
	.asciz	"Can't attach new controller"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.5:                               ; @.str.5
	.asciz	"session %p num %d"

	.comm	_CAPI_FUNCTION_GET_MANUFACTURER,4,2 ; @CAPI_FUNCTION_GET_MANUFACTURER
	.comm	_CAPI_FUNCTION_GET_VERSION,4,2  ; @CAPI_FUNCTION_GET_VERSION
	.comm	_CAPI_FUNCTION_GET_SERIAL_NUMBER,4,2 ; @CAPI_FUNCTION_GET_SERIAL_NUMBER
.subsections_via_symbols
