	.file	"extr_at45d.c_at45d_detach.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"at45dt"
.LC1:
	.string	"Failed to stop queue task\n"
	.text
	.p2align 4
	.type	at45d_detach, @function
at45d_detach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	device_get_softc@PLT
	mov	rbp, rax
	mov	rdi, rax
	call	AT45D_LOCK@PLT
	mov	rax, QWORD PTR TSTATE_RUNNING[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L2
.L15:
	mov	rdi, rbp
	xor	r12d, r12d
	call	AT45D_UNLOCK@PLT
	mov	rax, QWORD PTR TSTATE_STOPPED[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L18
	mov	eax, r12d
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rax, QWORD PTR TSTATE_STOPPING[rip]
	mov	rdi, rbp
	lea	rbx, 28[rbp]
	mov	QWORD PTR 0[rbp], rax
	call	wakeup@PLT
	.p2align 4,,10
	.p2align 3
.L4:
	mov	rax, QWORD PTR TSTATE_STOPPED[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L15
	mov	eax, DWORD PTR hz[rip]
	xor	edx, edx
	mov	rsi, rbx
	mov	rdi, rbp
	lea	rcx, .LC0[rip]
	lea	r8d, [rax+rax*2]
	call	msleep@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L4
	mov	rax, QWORD PTR TSTATE_RUNNING[rip]
	mov	edi, DWORD PTR 24[rbp]
	lea	rsi, .LC1[rip]
	mov	QWORD PTR 0[rbp], rax
	call	device_printf@PLT
	mov	rdi, rbp
	call	AT45D_UNLOCK@PLT
	mov	eax, r12d
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	mov	rdi, QWORD PTR 16[rbp]
	test	rdi, rdi
	jne	.L19
.L8:
	mov	rdi, rbp
	xor	r12d, r12d
	call	AT45D_LOCK_DESTROY@PLT
	mov	eax, r12d
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	call	disk_destroy@PLT
	mov	edx, DWORD PTR ENXIO[rip]
	lea	rdi, 12[rbp]
	xor	esi, esi
	call	bioq_flush@PLT
	mov	edi, DWORD PTR 8[rbp]
	mov	esi, DWORD PTR M_DEVBUF[rip]
	call	free@PLT
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	at45d_detach, .-at45d_detach
	.comm	hz,4,4
	.comm	TSTATE_STOPPING,8,8
	.comm	TSTATE_STOPPED,8,8
	.comm	TSTATE_RUNNING,8,8
	.comm	M_DEVBUF,4,4
	.comm	ENXIO,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_at45d.c_at45d_detach.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"at45dt\000"
	.align	2
.LC1:
	.ascii	"Failed to stop queue task\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	at45d_detach, %function
at45d_detach:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	sub	sp, sp, #8
	bl	device_get_softc
	mov	r4, r0
	ldr	r6, .L21
	bl	AT45D_LOCK
	ldr	r2, [r4]
	ldr	r3, [r6]
	cmp	r2, r3
	beq	.L2
	mov	r0, r4
	bl	AT45D_UNLOCK
	ldr	r5, .L21+4
.L3:
	ldr	r3, [r5]
	ldr	r2, [r4]
	cmp	r2, r3
	movne	r10, #0
	beq	.L18
	mov	r0, r10
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L2:
	ldr	r3, .L21+8
	mov	r0, r4
	ldr	r3, [r3]
	ldr	r5, .L21+4
	str	r3, [r4]
	bl	wakeup
	ldr	r8, .L21+12
	ldr	r7, .L21+16
	add	r9, r4, #20
.L4:
	ldr	r2, [r4]
	ldr	r3, [r5]
	cmp	r2, r3
	beq	.L19
	ldr	r2, [r8]
	mov	r3, r7
	add	r2, r2, r2, lsl #1
	str	r2, [sp]
	mov	r1, r9
	mov	r2, #0
	mov	r0, r4
	bl	msleep
	subs	r10, r0, #0
	beq	.L4
	ldr	r3, [r6]
	ldr	r1, .L21+20
	str	r3, [r4]
	ldr	r0, [r4, #16]
	bl	device_printf
	mov	r0, r4
	bl	AT45D_UNLOCK
	mov	r0, r10
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L18:
	ldr	r0, [r4, #12]
	cmp	r0, #0
	bne	.L20
.L8:
	mov	r10, #0
	mov	r0, r4
	bl	AT45D_LOCK_DESTROY
	mov	r0, r10
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L20:
	bl	disk_destroy
	ldr	r3, .L21+24
	mov	r1, #0
	ldr	r2, [r3]
	add	r0, r4, #8
	bl	bioq_flush
	ldr	r3, .L21+28
	ldr	r0, [r4, #4]
	ldr	r1, [r3]
	bl	free
	b	.L8
.L19:
	mov	r0, r4
	bl	AT45D_UNLOCK
	b	.L3
.L22:
	.align	2
.L21:
	.word	TSTATE_RUNNING
	.word	TSTATE_STOPPED
	.word	TSTATE_STOPPING
	.word	hz
	.word	.LC0
	.word	.LC1
	.word	ENXIO
	.word	M_DEVBUF
	.size	at45d_detach, .-at45d_detach
	.comm	hz,4,4
	.comm	TSTATE_STOPPING,4,4
	.comm	TSTATE_STOPPED,4,4
	.comm	TSTATE_RUNNING,4,4
	.comm	M_DEVBUF,4,4
	.comm	ENXIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
