	.file	"extr_aiutils.c_ai_doattach.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	ai_doattach, @function
ai_doattach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	eax, DWORD PTR 32[rsi]
	mov	rbp, QWORD PTR 24[rsi]
	mov	QWORD PTR 8[rdi], rsi
	mov	DWORD PTR [rdi], eax
	mov	eax, DWORD PTR 16[rsi]
	mov	DWORD PTR 32[rdi], eax
	mov	eax, DWORD PTR 12[rsi]
	mov	DWORD PTR 28[rdi], eax
	mov	eax, DWORD PTR 8[rsi]
	mov	DWORD PTR 24[rdi], eax
	mov	eax, DWORD PTR 4[rsi]
	mov	DWORD PTR 20[rdi], eax
	mov	eax, DWORD PTR [rsi]
	mov	rsi, rbp
	mov	DWORD PTR 16[rdi], eax
	call	ai_buscore_setup@PLT
	test	eax, eax
	je	.L3
	mov	edi, DWORD PTR gpiopullup[rip]
	lea	r13, 16[r12]
	call	CHIPCREGOFFS@PLT
	xor	edx, edx
	mov	rdi, rbp
	mov	esi, eax
	call	bcma_write32@PLT
	mov	edi, DWORD PTR gpiopulldown[rip]
	call	CHIPCREGOFFS@PLT
	xor	edx, edx
	mov	rdi, rbp
	mov	esi, eax
	call	bcma_write32@PLT
	mov	rdi, r13
	call	ai_get_cccaps@PLT
	test	DWORD PTR CC_CAP_PMU[rip], eax
	jne	.L9
	mov	rax, r12
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	mov	rdi, r13
	call	si_pmu_measure_alpclk@PLT
	mov	rax, r12
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	xor	r12d, r12d
	pop	rbp
	.cfi_def_cfa_offset 24
	mov	rax, r12
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	ai_doattach, .-ai_doattach
	.comm	gpiopullup,4,4
	.comm	gpiopulldown,4,4
	.comm	CC_CAP_PMU,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_aiutils.c_ai_doattach.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ai_doattach, %function
ai_doattach:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r3, [r1, #24]
	push	{r4, r5, r6, lr}
	ldr	r2, [r1, #16]
	ldr	r5, [r1, #20]
	str	r3, [r0]
	ldr	r3, [r1, #12]
	ldr	ip, [r1, #8]
	str	r2, [r0, #24]
	str	r3, [r0, #20]
	ldr	r2, [r1, #4]
	ldr	r3, [r1]
	str	r1, [r0, #4]
	str	ip, [r0, #16]
	mov	r1, r5
	str	r2, [r0, #12]
	str	r3, [r0, #8]
	mov	r4, r0
	bl	ai_buscore_setup
	cmp	r0, #0
	moveq	r4, r0
	beq	.L2
	ldr	r3, .L10
	add	r6, r4, #8
	ldr	r0, [r3]
	bl	CHIPCREGOFFS
	mov	r2, #0
	mov	r1, r0
	mov	r0, r5
	bl	bcma_write32
	ldr	r3, .L10+4
	ldr	r0, [r3]
	bl	CHIPCREGOFFS
	mov	r2, #0
	mov	r1, r0
	mov	r0, r5
	bl	bcma_write32
	mov	r0, r6
	bl	ai_get_cccaps
	ldr	r3, .L10+8
	ldr	r3, [r3]
	tst	r0, r3
	bne	.L9
.L2:
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L9:
	mov	r0, r6
	bl	si_pmu_measure_alpclk
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L11:
	.align	2
.L10:
	.word	gpiopullup
	.word	gpiopulldown
	.word	CC_CAP_PMU
	.size	ai_doattach, .-ai_doattach
	.comm	gpiopullup,4,4
	.comm	gpiopulldown,4,4
	.comm	CC_CAP_PMU,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
