	.file	"extr_file_storage.c_fsg_main_thread.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	fsg_main_thread, @function
fsg_main_thread:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	rbx, rdi
	lea	rbp, 16[rbx]
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	edi, DWORD PTR SIGINT[rip]
	call	allow_signal@PLT
	mov	edi, DWORD PTR SIGTERM[rip]
	call	allow_signal@PLT
	mov	edi, DWORD PTR SIGKILL[rip]
	call	allow_signal@PLT
	mov	edi, DWORD PTR SIGUSR1[rip]
	call	allow_signal@PLT
	xor	eax, eax
	call	set_freezable@PLT
	xor	eax, eax
	call	get_ds@PLT
	mov	edi, eax
	call	set_fs@PLT
	mov	rax, QWORD PTR [rbx]
	cmp	QWORD PTR FSG_STATE_TERMINATED[rip], rax
	je	.L14
	.p2align 4,,10
	.p2align 3
.L2:
	mov	rdi, rbx
	call	exception_in_progress@PLT
	test	rax, rax
	jne	.L7
	mov	edi, DWORD PTR current[rip]
	call	signal_pending@PLT
	test	rax, rax
	jne	.L7
	mov	eax, DWORD PTR 32[rbx]
	mov	rdi, rbx
	test	eax, eax
	je	.L19
	call	get_next_command@PLT
	test	rax, rax
	jne	.L6
	mov	rdi, rbp
	call	spin_lock_irq@PLT
	mov	rdi, rbx
	call	exception_in_progress@PLT
	test	rax, rax
	jne	.L10
	mov	rax, QWORD PTR FSG_STATE_DATA_PHASE[rip]
	mov	QWORD PTR [rbx], rax
.L10:
	mov	rdi, rbp
	call	spin_unlock_irq@PLT
	mov	rdi, rbx
	call	do_scsi_command@PLT
	test	rax, rax
	jne	.L6
	mov	rdi, rbx
	call	finish_reply@PLT
	test	rax, rax
	je	.L20
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rax, QWORD PTR FSG_STATE_TERMINATED[rip]
	cmp	QWORD PTR [rbx], rax
	jne	.L2
.L14:
	mov	rdi, rbp
	call	spin_lock_irq@PLT
	mov	QWORD PTR 24[rbx], 0
	mov	rdi, rbp
	call	spin_unlock_irq@PLT
	mov	edi, DWORD PTR REGISTERED[rip]
	lea	rsi, 12[rbx]
	call	test_and_clear_bit@PLT
	test	rax, rax
	jne	.L21
.L4:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	lea	rdi, 8[rbx]
	xor	esi, esi
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	jmp	complete_and_exit@PLT
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	mov	rdi, rbx
	call	handle_exception@PLT
	mov	rax, QWORD PTR FSG_STATE_TERMINATED[rip]
	cmp	QWORD PTR [rbx], rax
	jne	.L2
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L19:
	call	sleep_thread@PLT
	mov	rax, QWORD PTR FSG_STATE_TERMINATED[rip]
	cmp	QWORD PTR [rbx], rax
	jne	.L2
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	mov	rdi, rbp
	call	spin_lock_irq@PLT
	mov	rdi, rbx
	call	exception_in_progress@PLT
	test	rax, rax
	jne	.L12
	mov	rax, QWORD PTR FSG_STATE_STATUS_PHASE[rip]
	mov	QWORD PTR [rbx], rax
.L12:
	mov	rdi, rbp
	call	spin_unlock_irq@PLT
	mov	rdi, rbx
	call	send_status@PLT
	test	rax, rax
	jne	.L6
	mov	rdi, rbp
	call	spin_lock_irq@PLT
	mov	rdi, rbx
	call	exception_in_progress@PLT
	test	rax, rax
	jne	.L13
	mov	rax, QWORD PTR FSG_STATE_IDLE[rip]
	mov	QWORD PTR [rbx], rax
.L13:
	mov	rdi, rbp
	call	spin_unlock_irq@PLT
	mov	rax, QWORD PTR FSG_STATE_TERMINATED[rip]
	cmp	QWORD PTR [rbx], rax
	jne	.L2
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L21:
	lea	rdi, fsg_driver[rip]
	call	usb_gadget_unregister_driver@PLT
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	fsg_main_thread, .-fsg_main_thread
	.comm	fsg_driver,4,4
	.comm	current,4,4
	.comm	SIGUSR1,4,4
	.comm	SIGTERM,4,4
	.comm	SIGKILL,4,4
	.comm	SIGINT,4,4
	.comm	REGISTERED,4,4
	.comm	FSG_STATE_TERMINATED,8,8
	.comm	FSG_STATE_STATUS_PHASE,8,8
	.comm	FSG_STATE_IDLE,8,8
	.comm	FSG_STATE_DATA_PHASE,8,8
	.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_file_storage.c_fsg_main_thread.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	fsg_main_thread, %function
fsg_main_thread:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r6, r0
	ldr	r3, .L22
	mov	r4, r0
	ldr	r0, [r3]
	bl	allow_signal
	ldr	r3, .L22+4
	ldr	r5, .L22+8
	ldr	r0, [r3]
	bl	allow_signal
	ldr	r3, .L22+12
	ldr	r0, [r3]
	bl	allow_signal
	ldr	r3, .L22+16
	ldr	r0, [r3]
	bl	allow_signal
	bl	set_freezable
	bl	get_ds
	bl	set_fs
	ldr	r3, [r6], #12
	ldr	r2, [r5]
	cmp	r2, r3
	beq	.L14
	ldr	r7, .L22+20
	ldr	r10, .L22+24
	ldr	r9, .L22+28
	ldr	r8, .L22+32
.L2:
	mov	r0, r4
	bl	exception_in_progress
	cmp	r0, #0
	bne	.L7
	ldr	r0, [r7]
	bl	signal_pending
	cmp	r0, #0
	bne	.L7
	ldr	r3, [r4, #20]
	mov	r0, r4
	cmp	r3, #0
	beq	.L19
	bl	get_next_command
	cmp	r0, #0
	bne	.L6
	mov	r0, r6
	bl	spin_lock_irq
	mov	r0, r4
	bl	exception_in_progress
	cmp	r0, #0
	ldreq	r3, [r8]
	mov	r0, r6
	streq	r3, [r4]
	bl	spin_unlock_irq
	mov	r0, r4
	bl	do_scsi_command
	cmp	r0, #0
	bne	.L6
	mov	r0, r4
	bl	finish_reply
	cmp	r0, #0
	beq	.L20
.L6:
	ldr	r2, [r4]
	ldr	r3, [r5]
	cmp	r2, r3
	bne	.L2
.L14:
	mov	r0, r6
	bl	spin_lock_irq
	mov	r3, #0
	mov	r0, r6
	str	r3, [r4, #16]
	bl	spin_unlock_irq
	ldr	r3, .L22+36
	add	r1, r4, #8
	ldr	r0, [r3]
	bl	test_and_clear_bit
	cmp	r0, #0
	bne	.L21
	add	r0, r4, #4
	mov	r1, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	complete_and_exit
.L7:
	mov	r0, r4
	bl	handle_exception
	ldr	r2, [r4]
	ldr	r3, [r5]
	cmp	r2, r3
	bne	.L2
	b	.L14
.L19:
	bl	sleep_thread
	ldr	r2, [r4]
	ldr	r3, [r5]
	cmp	r2, r3
	bne	.L2
	b	.L14
.L20:
	mov	r0, r6
	bl	spin_lock_irq
	mov	r0, r4
	bl	exception_in_progress
	cmp	r0, #0
	ldreq	r3, [r9]
	mov	r0, r6
	streq	r3, [r4]
	bl	spin_unlock_irq
	mov	r0, r4
	bl	send_status
	cmp	r0, #0
	bne	.L6
	mov	r0, r6
	bl	spin_lock_irq
	mov	r0, r4
	bl	exception_in_progress
	cmp	r0, #0
	ldreq	r3, [r10]
	mov	r0, r6
	streq	r3, [r4]
	bl	spin_unlock_irq
	ldr	r2, [r4]
	ldr	r3, [r5]
	cmp	r2, r3
	bne	.L2
	b	.L14
.L21:
	ldr	r0, .L22+40
	bl	usb_gadget_unregister_driver
	add	r0, r4, #4
	mov	r1, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	complete_and_exit
.L23:
	.align	2
.L22:
	.word	SIGINT
	.word	SIGTERM
	.word	FSG_STATE_TERMINATED
	.word	SIGKILL
	.word	SIGUSR1
	.word	current
	.word	FSG_STATE_IDLE
	.word	FSG_STATE_STATUS_PHASE
	.word	FSG_STATE_DATA_PHASE
	.word	REGISTERED
	.word	fsg_driver
	.size	fsg_main_thread, .-fsg_main_thread
	.comm	fsg_driver,4,4
	.comm	current,4,4
	.comm	SIGUSR1,4,4
	.comm	SIGTERM,4,4
	.comm	SIGKILL,4,4
	.comm	SIGINT,4,4
	.comm	REGISTERED,4,4
	.comm	FSG_STATE_TERMINATED,4,4
	.comm	FSG_STATE_STATUS_PHASE,4,4
	.comm	FSG_STATE_IDLE,4,4
	.comm	FSG_STATE_DATA_PHASE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
