	.file	"extr_crisv10.c_shutdown.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"shutdown %i\n"
	.text
	.p2align 4
	.type	shutdown, @function
shutdown:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	lea	rsi, .LC0[rip]
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, rdi
	mov	r12, QWORD PTR 80[rdi]
	mov	edi, DWORD PTR 36[rdi]
	mov	edx, edi
	call	DEBUG_LOG@PLT
	mov	edi, eax
	call	DFLOW@PLT
	mov	rdi, rbx
	call	e100_disable_rx@PLT
	mov	eax, DWORD PTR 8[rbx]
	mov	rdx, QWORD PTR [rbx]
	mov	rdi, rbx
	mov	rcx, QWORD PTR REG_TR_CTRL[rip]
	and	eax, -65
	cmp	QWORD PTR 64[rbx], 0
	mov	DWORD PTR 8[rbx], eax
	mov	DWORD PTR [rdx+rcx*4], eax
	je	.L2
	call	e100_disable_rxdma_irq@PLT
	mov	edi, DWORD PTR R_DMA_CH6_CMD[rip]
	mov	edx, DWORD PTR reset[rip]
	mov	esi, DWORD PTR cmd[rip]
	mov	rbp, QWORD PTR 72[rbx]
	call	IO_STATE@PLT
	cmp	QWORD PTR 48[rbx], 0
	mov	rdi, rbx
	mov	QWORD PTR 0[rbp], rax
	mov	QWORD PTR 64[rbx], 0
	je	.L4
.L37:
	call	e100_disable_txdma_irq@PLT
	mov	edx, DWORD PTR reset[rip]
	mov	rbp, QWORD PTR 56[rbx]
	mov	QWORD PTR 40[rbx], 0
	mov	esi, DWORD PTR cmd[rip]
	mov	edi, DWORD PTR R_DMA_CH6_CMD[rip]
	call	IO_STATE@PLT
	mov	QWORD PTR 0[rbp], rax
	mov	eax, DWORD PTR 12[rbx]
	mov	QWORD PTR 48[rbx], 0
	test	DWORD PTR ASYNC_INITIALIZED[rip], eax
	jne	.L36
.L1:
	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
	call	e100_disable_serial_data_irq@PLT
	cmp	QWORD PTR 48[rbx], 0
	mov	rdi, rbx
	jne	.L37
.L4:
	call	e100_disable_serial_tx_ready_irq@PLT
	mov	QWORD PTR 40[rbx], 0
	mov	eax, DWORD PTR 12[rbx]
	test	DWORD PTR ASYNC_INITIALIZED[rip], eax
	je	.L1
.L36:
	xor	edi, edi
	call	local_irq_save@PLT
	mov	rdi, QWORD PTR 24[rbx]
	test	rdi, rdi
	je	.L7
	call	free_page@PLT
	mov	QWORD PTR 24[rbx], 0
.L7:
	mov	eax, DWORD PTR SERIAL_RECV_DESCRIPTORS[rip]
	xor	ebp, ebp
	test	eax, eax
	jg	.L8
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	add	rbp, 1
	cmp	DWORD PTR SERIAL_RECV_DESCRIPTORS[rip], ebp
	jle	.L12
.L8:
	mov	rdi, QWORD PTR [r12+rbp*8]
	test	rdi, rdi
	je	.L11
	call	phys_to_virt@PLT
	lea	rdi, -16[rax]
	call	kfree@PLT
	mov	QWORD PTR [r12+rbp*8], 0
	add	rbp, 1
	cmp	DWORD PTR SERIAL_RECV_DESCRIPTORS[rip], ebp
	jg	.L8
.L12:
	mov	rsi, QWORD PTR 16[rbx]
	test	rsi, rsi
	je	.L9
	mov	rax, QWORD PTR 8[rsi]
	mov	eax, DWORD PTR [rax]
	test	DWORD PTR HUPCL[rip], eax
	je	.L13
.L9:
	xor	esi, esi
	mov	rdi, rbx
	call	e100_dtr@PLT
	xor	esi, esi
	mov	rdi, rbx
	call	e100_rts@PLT
	mov	rsi, QWORD PTR 16[rbx]
	test	rsi, rsi
	jne	.L13
.L14:
	mov	eax, DWORD PTR ASYNC_INITIALIZED[rip]
	xor	edi, edi
	not	eax
	and	DWORD PTR 12[rbx], eax
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	jmp	local_irq_restore@PLT
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	mov	edi, DWORD PTR TTY_IO_ERROR[rip]
	call	set_bit@PLT
	jmp	.L14
	.cfi_endproc
.LFE0:
	.size	shutdown, .-shutdown
	.comm	reset,4,4
	.comm	cmd,4,4
	.comm	TTY_IO_ERROR,4,4
	.comm	SERIAL_RECV_DESCRIPTORS,4,4
	.comm	R_DMA_CH6_CMD,4,4
	.comm	REG_TR_CTRL,8,8
	.comm	HUPCL,4,4
	.comm	ASYNC_INITIALIZED,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_crisv10.c_shutdown.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"shutdown %i\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	shutdown, %function
shutdown:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r4, r0
	ldr	r2, [r0, #24]
	ldr	r1, .L36
	mov	r0, r2
	ldr	r6, [r4, #48]
	bl	DEBUG_LOG
	bl	DFLOW
	mov	r0, r4
	bl	e100_disable_rx
	ldr	r1, .L36+4
	ldr	r3, [r4, #4]
	ldr	r0, [r4, #40]
	ldr	r2, [r4]
	ldr	r1, [r1]
	bic	r3, r3, #64
	cmp	r0, #0
	str	r3, [r4, #4]
	mov	r0, r4
	str	r3, [r2, r1, lsl #2]
	beq	.L2
	bl	e100_disable_rxdma_irq
	ldr	r3, .L36+8
	ldr	r2, .L36+12
	ldr	r1, .L36+16
	ldr	r0, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	ldr	r5, [r4, #44]
	bl	IO_STATE
	mov	r3, #0
	str	r0, [r5]
	ldr	r5, [r4, #32]
	str	r3, [r4, #40]
	cmp	r5, #0
	beq	.L4
.L35:
	mov	r5, #0
	mov	r0, r4
	bl	e100_disable_txdma_irq
	ldr	r3, .L36+8
	ldr	r2, .L36+12
	ldr	r1, .L36+16
	ldr	r2, [r2]
	ldr	r1, [r1]
	ldr	r0, [r3]
	str	r5, [r4, #28]
	ldr	r7, [r4, #36]
	bl	IO_STATE
	str	r0, [r7]
	str	r5, [r4, #32]
.L5:
	ldr	r7, .L36+20
	ldr	r2, [r4, #8]
	ldr	r3, [r7]
	tst	r2, r3
	popeq	{r4, r5, r6, r7, r8, r9, r10, pc}
	mov	r0, #0
	bl	local_irq_save
	ldr	r0, [r4, #16]
	cmp	r0, #0
	beq	.L7
	bl	free_page
	mov	r3, #0
	str	r3, [r4, #16]
.L7:
	ldr	r9, .L36+24
	ldr	r3, [r9]
	cmp	r3, #0
	movgt	r5, #0
	subgt	r6, r6, #4
	movgt	r8, r5
	bgt	.L12
	b	.L13
.L11:
	ldr	r3, [r9]
	cmp	r3, r5
	ble	.L13
.L12:
	ldr	r0, [r6, #4]!
	add	r5, r5, #1
	cmp	r0, #0
	beq	.L11
	bl	phys_to_virt
	sub	r0, r0, #16
	bl	kfree
	ldr	r3, [r9]
	str	r8, [r6]
	cmp	r3, r5
	bgt	.L12
.L13:
	ldr	r1, [r4, #12]
	cmp	r1, #0
	beq	.L9
	ldr	r2, [r1, #4]
	ldr	r3, .L36+28
	ldr	r2, [r2]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L14
.L9:
	mov	r1, #0
	mov	r0, r4
	bl	e100_dtr
	mov	r1, #0
	mov	r0, r4
	bl	e100_rts
	ldr	r1, [r4, #12]
	cmp	r1, #0
	bne	.L14
.L15:
	ldr	r3, [r4, #8]
	ldr	r2, [r7]
	mov	r0, #0
	bic	r3, r3, r2
	str	r3, [r4, #8]
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	local_irq_restore
.L2:
	bl	e100_disable_serial_data_irq
	ldr	r5, [r4, #32]
	cmp	r5, #0
	bne	.L35
.L4:
	mov	r0, r4
	bl	e100_disable_serial_tx_ready_irq
	str	r5, [r4, #28]
	b	.L5
.L14:
	ldr	r3, .L36+32
	ldr	r0, [r3]
	bl	set_bit
	b	.L15
.L37:
	.align	2
.L36:
	.word	.LC0
	.word	REG_TR_CTRL
	.word	R_DMA_CH6_CMD
	.word	reset
	.word	cmd
	.word	ASYNC_INITIALIZED
	.word	SERIAL_RECV_DESCRIPTORS
	.word	HUPCL
	.word	TTY_IO_ERROR
	.size	shutdown, .-shutdown
	.comm	reset,4,4
	.comm	cmd,4,4
	.comm	TTY_IO_ERROR,4,4
	.comm	SERIAL_RECV_DESCRIPTORS,4,4
	.comm	R_DMA_CH6_CMD,4,4
	.comm	REG_TR_CTRL,4,4
	.comm	HUPCL,4,4
	.comm	ASYNC_INITIALIZED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
