	.file	"extr_st.c_test_ready.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	test_ready, @function
test_ready:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12d, esi
	push	rbx
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 40
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR MAX_COMMAND_SIZE[rip]
	mov	rsi, rsp
	mov	rdx, rax
	add	rax, 15
	mov	rcx, rax
	and	rax, -4096
	sub	rsi, rax
	and	rcx, -16
	mov	rax, rsi
	cmp	rsp, rax
	je	.L3
.L26:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L26
.L3:
	and	ecx, 4095
	sub	rsp, rcx
	test	rcx, rcx
	jne	.L27
.L4:
	mov	DWORD PTR -76[rbp], 0
	mov	r14, QWORD PTR [rbx]
	test	r12d, r12d
	mov	r13, rsp
	mov	DWORD PTR -68[rbp], 0
	cmovne	r12d, DWORD PTR ST_BLOCK_SECONDS[rip]
	xor	r15d, r15d
	mov	DWORD PTR -72[rbp], 0
.L6:
	xor	esi, esi
	mov	rdi, r13
	call	memset@PLT
	xor	ecx, ecx
	mov	rdx, r13
	mov	rdi, r15
	movzx	eax, BYTE PTR TEST_UNIT_READY[rip]
	mov	r8d, DWORD PTR DMA_NONE[rip]
	mov	rsi, rbx
	mov	BYTE PTR 0[r13], al
	mov	eax, DWORD PTR MAX_READY_RETRIES[rip]
	push	1
	push	rax
	mov	r9d, DWORD PTR 16[rbx]
	call	st_do_scsi@PLT
	pop	rdx
	pop	rcx
	mov	r15, rax
	test	rax, rax
	je	.L28
	cmp	QWORD PTR 16[r14], 0
	je	.L9
	mov	eax, DWORD PTR 8[r14]
	cmp	DWORD PTR UNIT_ATTENTION[rip], eax
	je	.L29
	cmp	DWORD PTR NOT_READY[rip], eax
	jne	.L9
	cmp	DWORD PTR -68[rbp], r12d
	jge	.L14
	mov	edi, 1000
	call	msleep_interruptible@PLT
	test	rax, rax
	je	.L15
	mov	r12d, DWORD PTR EINTR[rip]
	neg	r12d
.L13:
	mov	rdi, r15
	call	st_release_request@PLT
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L30
	lea	rsp, -40[rbp]
	mov	eax, r12d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L29:
	.cfi_restore_state
	mov	eax, DWORD PTR -72[rbp]
	cmp	eax, DWORD PTR MAX_ATTENTIONS[rip]
	jl	.L31
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L15:
	add	DWORD PTR -68[rbp], 1
.L12:
	mov	edx, DWORD PTR MAX_COMMAND_SIZE[rip]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L27:
	or	QWORD PTR -8[rsp+rcx], 0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L31:
	add	DWORD PTR -72[rbp], 1
	mov	DWORD PTR -76[rbp], 1
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	mov	rax, QWORD PTR [rbx]
	mov	r12d, DWORD PTR [rax]
	test	r12d, r12d
	jne	.L13
	mov	eax, DWORD PTR -76[rbp]
	mov	r12d, DWORD PTR CHKRES_NEW_SESSION[rip]
	test	eax, eax
	cmove	r12d, DWORD PTR CHKRES_READY[rip]
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L28:
	mov	rax, QWORD PTR [rbx]
	mov	r12d, DWORD PTR [rax]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rax, QWORD PTR 8[rbx]
	mov	rbx, QWORD PTR SCSI_2[rip]
	cmp	QWORD PTR [rax], rbx
	jl	.L16
	cmp	DWORD PTR 12[r14], 58
	mov	r12d, DWORD PTR CHKRES_NO_TAPE[rip]
	je	.L13
.L16:
	mov	r12d, DWORD PTR CHKRES_NOT_READY[rip]
	jmp	.L13
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	test_ready, .-test_ready
	.comm	UNIT_ATTENTION,4,4
	.comm	TEST_UNIT_READY,1,1
	.comm	ST_BLOCK_SECONDS,4,4
	.comm	SCSI_2,8,8
	.comm	NOT_READY,4,4
	.comm	MAX_READY_RETRIES,4,4
	.comm	MAX_COMMAND_SIZE,4,4
	.comm	MAX_ATTENTIONS,4,4
	.comm	EIO,4,4
	.comm	EINTR,4,4
	.comm	DMA_NONE,4,4
	.comm	CHKRES_READY,4,4
	.comm	CHKRES_NO_TAPE,4,4
	.comm	CHKRES_NOT_READY,4,4
	.comm	CHKRES_NEW_SESSION,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_st.c_test_ready.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	test_ready, %function
test_ready:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #44
	subs	r3, r1, #0
	str	r3, [fp, #-52]
	ldr	r3, .L29
	ldr	r6, [r0]
	ldr	r2, [r3]
	ldr	r3, .L29+4
	mov	r7, #0
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	add	r3, r2, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	ldrne	r3, .L29+8
	str	r7, [fp, #-60]
	ldrne	r3, [r3]
	str	r7, [fp, #-48]
	strne	r3, [fp, #-52]
	mov	r3, r6
	str	r7, [fp, #-56]
	mov	r6, r7
	mov	r4, r0
	mov	r7, r3
	ldr	r9, .L29+12
	ldr	r8, .L29+16
	ldr	r10, .L29+20
	add	r5, sp, #16
.L3:
	mov	r1, #0
	mov	r0, r5
	bl	memset
	ldr	r3, .L29+24
	ldr	r1, [r4, #8]
	ldrb	lr, [r3]	@ zero_extendqisi2
	mov	r3, #1
	ldr	r2, [r8]
	ldr	ip, [r9]
	strb	lr, [r5]
	mov	r0, r6
	stmib	sp, {r1, ip}
	str	r3, [sp, #12]
	str	r2, [sp]
	mov	r3, #0
	mov	r2, r5
	mov	r1, r4
	bl	st_do_scsi
	subs	r6, r0, #0
	beq	.L24
	ldr	r2, [r7, #12]
	cmp	r2, #0
	beq	.L6
	ldr	r2, [r7, #4]
	ldr	r1, [r10]
	cmp	r1, r2
	beq	.L25
	ldr	r3, .L29+28
	ldr	r1, [r3]
	cmp	r1, r2
	bne	.L6
	ldr	r3, [fp, #-48]
	ldr	r2, [fp, #-52]
	cmp	r3, r2
	bge	.L11
	mov	r0, #1000
	bl	msleep_interruptible
	cmp	r0, #0
	beq	.L12
	mov	r7, r6
	ldr	r2, .L29+32
	ldr	r4, [r2]
	rsb	r4, r4, #0
.L10:
	mov	r0, r7
	bl	st_release_request
.L1:
	ldr	r3, .L29+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L26
	mov	r0, r4
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L25:
	ldr	r3, .L29+36
	ldr	r2, [r3]
	ldr	r3, [fp, #-56]
	cmp	r3, r2
	blt	.L27
	ldr	r2, .L29+40
	mov	r7, r6
	ldr	r4, [r2]
	rsb	r4, r4, #0
	b	.L10
.L12:
	ldr	r3, [fp, #-48]
	add	r3, r3, #1
	str	r3, [fp, #-48]
.L9:
	ldr	r3, .L29
	ldr	r2, [r3]
	b	.L3
.L27:
	add	r3, r3, #1
	str	r3, [fp, #-56]
	mov	r3, #1
	str	r3, [fp, #-60]
	b	.L9
.L6:
	ldr	r2, [r4]
	mov	r7, r6
	ldr	r4, [r2]
	cmp	r4, #0
	bne	.L10
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	ldrne	r2, .L29+44
	ldreq	r2, .L29+48
	ldr	r4, [r2]
	b	.L10
.L24:
	ldr	r3, [r4]
	ldr	r4, [r3]
	b	.L1
.L11:
	ldr	r1, [r4, #4]
	ldr	r2, .L29+52
	ldr	r1, [r1]
	ldr	r2, [r2]
	mov	r3, r7
	cmp	r1, r2
	mov	r7, r6
	blt	.L13
	ldr	r2, [r3, #8]
	cmp	r2, #58
	beq	.L28
.L13:
	ldr	r2, .L29+56
	ldr	r4, [r2]
	b	.L10
.L28:
	ldr	r2, .L29+60
	ldr	r4, [r2]
	b	.L10
.L26:
	bl	__stack_chk_fail
.L30:
	.align	2
.L29:
	.word	MAX_COMMAND_SIZE
	.word	.LC0
	.word	ST_BLOCK_SECONDS
	.word	MAX_READY_RETRIES
	.word	DMA_NONE
	.word	UNIT_ATTENTION
	.word	TEST_UNIT_READY
	.word	NOT_READY
	.word	EINTR
	.word	MAX_ATTENTIONS
	.word	EIO
	.word	CHKRES_NEW_SESSION
	.word	CHKRES_READY
	.word	SCSI_2
	.word	CHKRES_NOT_READY
	.word	CHKRES_NO_TAPE
	.size	test_ready, .-test_ready
	.comm	UNIT_ATTENTION,4,4
	.comm	TEST_UNIT_READY,1,1
	.comm	ST_BLOCK_SECONDS,4,4
	.comm	SCSI_2,4,4
	.comm	NOT_READY,4,4
	.comm	MAX_READY_RETRIES,4,4
	.comm	MAX_COMMAND_SIZE,4,4
	.comm	MAX_ATTENTIONS,4,4
	.comm	EIO,4,4
	.comm	EINTR,4,4
	.comm	DMA_NONE,4,4
	.comm	CHKRES_READY,4,4
	.comm	CHKRES_NO_TAPE,4,4
	.comm	CHKRES_NOT_READY,4,4
	.comm	CHKRES_NEW_SESSION,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
