	.file	"extr_sunsab.c_receive_chars.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	receive_chars, @function
receive_chars:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rdi
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rsi
	sub	rsp, 72
	.cfi_def_cfa_offset 128
	mov	r15, QWORD PTR 48[rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 56[rsp], rax
	xor	eax, eax
	test	r15, r15
	je	.L2
	mov	r15, QWORD PTR [r15]
.L2:
	mov	eax, DWORD PTR [rbx]
	xor	ebp, ebp
	mov	r13d, eax
	and	r13d, DWORD PTR SAB82532_ISR0_RPF[rip]
	je	.L3
	mov	r13d, DWORD PTR SAB82532_RECV_FIFO_SIZE[rip]
	mov	ebp, 1
.L3:
	test	DWORD PTR SAB82532_ISR0_TCD[rip], eax
	jne	.L61
	test	DWORD PTR SAB82532_ISR0_TIME[rip], eax
	jne	.L62
.L5:
	test	DWORD PTR SAB82532_ISR0_RFO[rip], eax
	jne	.L63
	test	r13d, r13d
	jle	.L10
.L8:
	lea	rax, 16[rsp]
	xor	r12d, r12d
	mov	QWORD PTR [rsp], rax
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rax, QWORD PTR 56[r14]
	mov	rax, QWORD PTR 8[rax]
	lea	rdi, [rax+r12*4]
	call	readb@PLT
	mov	rcx, QWORD PTR [rsp]
	mov	BYTE PTR [rcx+r12], al
	add	r12, 1
	cmp	r13d, r12d
	jg	.L11
.L10:
	test	ebp, ebp
	jne	.L12
	mov	eax, DWORD PTR 4[rbx]
	and	eax, DWORD PTR SAB82532_ISR1_BRK[rip]
	mov	DWORD PTR 12[rsp], eax
	jne	.L13
.L69:
	test	r13d, r13d
	jle	.L1
.L14:
	lea	rax, 16[rsp]
	xor	ebp, ebp
	mov	QWORD PTR [rsp], rax
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L68:
	movzx	eax, BYTE PTR TTY_BREAK[rip]
	mov	BYTE PTR 11[rsp], al
.L22:
	mov	esi, r12d
	mov	rdi, r14
	call	uart_handle_sysrq_char@PLT
	test	rax, rax
	jne	.L17
	mov	edx, DWORD PTR [rbx]
	mov	eax, DWORD PTR 12[r14]
	mov	esi, edx
	and	esi, eax
	test	sil, sil
	jne	.L30
	sar	eax, 8
	and	eax, DWORD PTR 4[rbx]
	test	al, al
	je	.L64
.L30:
	test	DWORD PTR SAB82532_ISR0_RFO[rip], edx
	jne	.L65
.L17:
	add	rbp, 1
	cmp	r13d, ebp
	jle	.L15
.L31:
	mov	rax, QWORD PTR [rsp]
	movzx	r12d, BYTE PTR [rax+rbp]
	test	r15, r15
	je	.L66
	add	DWORD PTR 32[r14], 1
	movzx	eax, BYTE PTR TTY_NORMAL[rip]
	mov	edi, DWORD PTR SAB82532_ISR0_PERR[rip]
	or	edi, DWORD PTR SAB82532_ISR0_FERR[rip]
	or	edi, DWORD PTR SAB82532_ISR0_RFO[rip]
	and	edi, DWORD PTR [rbx]
	mov	BYTE PTR 11[rsp], al
	call	unlikely@PLT
	test	rax, rax
	je	.L18
.L21:
	mov	edi, DWORD PTR 4[rbx]
	mov	edx, DWORD PTR [rbx]
	mov	esi, DWORD PTR SAB82532_ISR0_PERR[rip]
	test	DWORD PTR SAB82532_ISR1_BRK[rip], edi
	jne	.L67
	test	edx, esi
	je	.L25
	add	DWORD PTR 24[r14], 1
.L24:
	test	DWORD PTR SAB82532_ISR0_RFO[rip], edx
	je	.L26
	add	DWORD PTR 16[r14], 1
.L26:
	mov	eax, DWORD PTR 8[r14]
	and	edx, eax
	sar	eax, 8
	and	eax, edi
	movzx	edx, dl
	movzx	eax, al
	mov	DWORD PTR [rbx], edx
	mov	DWORD PTR 4[rbx], eax
	test	DWORD PTR SAB82532_ISR1_BRK[rip], eax
	jne	.L68
	test	DWORD PTR SAB82532_ISR0_PERR[rip], edx
	je	.L28
	movzx	eax, BYTE PTR TTY_PARITY[rip]
	mov	BYTE PTR 11[rsp], al
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L63:
	add	ebp, 1
	test	r13d, r13d
	jg	.L8
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rdi, r14
	call	sunsab_cec_wait@PLT
	mov	rsi, QWORD PTR 56[r14]
	mov	edi, DWORD PTR SAB82532_CMDR_RMC[rip]
	call	writeb@PLT
	mov	eax, DWORD PTR 4[rbx]
	and	eax, DWORD PTR SAB82532_ISR1_BRK[rip]
	mov	DWORD PTR 12[rsp], eax
	je	.L69
.L13:
	mov	rax, QWORD PTR 40[r14]
	mov	rcx, QWORD PTR [r14]
	cmp	QWORD PTR [rax], rcx
	sete	al
	movzx	eax, al
	mov	DWORD PTR 12[rsp], eax
	test	r13d, r13d
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	mov	eax, DWORD PTR 12[rsp]
	test	eax, eax
	je	.L1
	xor	eax, eax
	call	sun_do_break@PLT
.L1:
	mov	rax, QWORD PTR 56[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L70
	add	rsp, 72
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r15
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	mov	edi, DWORD PTR 4[rbx]
	and	edi, DWORD PTR SAB82532_ISR1_BRK[rip]
	call	unlikely@PLT
	test	rax, rax
	jne	.L21
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L25:
	test	DWORD PTR SAB82532_ISR0_FERR[rip], edx
	je	.L24
	add	DWORD PTR 20[r14], 1
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L67:
	or	esi, DWORD PTR SAB82532_ISR0_FERR[rip]
	mov	rdi, r14
	not	esi
	and	edx, esi
	mov	DWORD PTR [rbx], edx
	add	DWORD PTR 28[r14], 1
	call	uart_handle_break@PLT
	test	rax, rax
	jne	.L17
	mov	edx, DWORD PTR [rbx]
	mov	edi, DWORD PTR 4[rbx]
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L66:
	movzx	esi, r12b
	mov	rdi, r14
	call	uart_handle_sysrq_char@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L65:
	movzx	edx, BYTE PTR TTY_OVERRUN[rip]
	xor	esi, esi
	mov	rdi, r15
	call	tty_insert_flip_char@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L28:
	movzx	ecx, BYTE PTR 11[rsp]
	movzx	eax, BYTE PTR TTY_FRAME[rip]
	test	DWORD PTR SAB82532_ISR0_FERR[rip], edx
	cmovne	ecx, eax
	mov	BYTE PTR 11[rsp], cl
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L64:
	movzx	edx, BYTE PTR 11[rsp]
	mov	esi, r12d
	mov	rdi, r15
	call	tty_insert_flip_char@PLT
	mov	edx, DWORD PTR [rbx]
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L61:
	mov	rax, QWORD PTR 56[r14]
	add	ebp, 1
	lea	rdi, 16[rax]
	call	readb@PLT
	mov	ecx, DWORD PTR SAB82532_RECV_FIFO_SIZE[rip]
	lea	r13d, -1[rcx]
	and	r13d, eax
	mov	eax, DWORD PTR [rbx]
	test	DWORD PTR SAB82532_ISR0_TIME[rip], eax
	je	.L5
.L62:
	mov	rdi, r14
	call	sunsab_cec_wait@PLT
	mov	rsi, QWORD PTR 56[r14]
	mov	edi, DWORD PTR SAB82532_CMDR_RFRD[rip]
	call	writeb@PLT
	jmp	.L1
.L70:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	receive_chars, .-receive_chars
	.comm	TTY_PARITY,1,1
	.comm	TTY_OVERRUN,1,1
	.comm	TTY_NORMAL,1,1
	.comm	TTY_FRAME,1,1
	.comm	TTY_BREAK,1,1
	.comm	SAB82532_RECV_FIFO_SIZE,4,4
	.comm	SAB82532_ISR1_BRK,4,4
	.comm	SAB82532_ISR0_TIME,4,4
	.comm	SAB82532_ISR0_TCD,4,4
	.comm	SAB82532_ISR0_RPF,4,4
	.comm	SAB82532_ISR0_RFO,4,4
	.comm	SAB82532_ISR0_PERR,4,4
	.comm	SAB82532_ISR0_FERR,4,4
	.comm	SAB82532_CMDR_RMC,4,4
	.comm	SAB82532_CMDR_RFRD,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_sunsab.c_receive_chars.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	receive_chars, %function
receive_chars:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r5, r1
	ldr	r3, [r0, #36]
	sub	sp, sp, #60
	ldr	r1, .L70
	ldr	r2, .L70+4
	str	r3, [sp, #4]
	cmp	r3, #0
	ldr	r2, [r2]
	str	r2, [sp, #52]
	mov	r2,#0
	ldrne	r3, [r3]
	ldr	r2, [r5]
	mov	fp, r0
	ldr	r0, [r1]
	strne	r3, [sp, #4]
	ands	r3, r2, r0
	ldrne	r1, .L70+8
	str	r3, [sp]
	ldrne	r3, [r1]
	ldr	r1, .L70+12
	movne	r8, #1
	ldr	r1, [r1]
	ldreq	r8, [sp]
	strne	r3, [sp]
	tst	r2, r1
	bne	.L61
	ldr	r1, .L70+16
	ldr	r4, [r1]
	ands	r4, r2, r4
	bne	.L62
.L5:
	ldr	r7, .L70+20
	ldr	r3, [sp]
	ldr	r1, [r7]
	tst	r2, r1
	bne	.L63
	cmp	r3, #0
	ble	.L10
.L8:
	ldr	r9, [sp]
	add	r6, sp, #19
.L11:
	ldr	r3, [fp, #40]
	ldr	r0, [r3, #4]
	add	r0, r0, r4, lsl #2
	bl	readb
	add	r4, r4, #1
	cmp	r9, r4
	strb	r0, [r6, #1]!
	bgt	.L11
.L10:
	cmp	r8, #0
	bne	.L12
.L9:
	ldr	r10, .L70+24
	ldr	r1, [r5, #4]
	ldr	r2, [r10]
	ands	r3, r1, r2
	str	r3, [sp, #12]
	bne	.L13
	ldr	r3, [sp]
	cmp	r3, #0
	ble	.L1
.L14:
	ldr	r9, .L70+28
	add	r6, sp, #19
	b	.L31
.L68:
	ldr	r2, .L70+32
	ldrb	r3, [r2]	@ zero_extendqisi2
	str	r3, [sp, #8]
.L22:
	mov	r1, r8
	mov	r0, fp
	bl	uart_handle_sysrq_char
	cmp	r0, #0
	bne	.L17
	ldr	r2, [r5]
	ldr	r1, [fp, #8]
	and	r0, r2, r1
	tst	r0, #255
	bne	.L30
	ldr	r0, [r5, #4]
	and	r1, r0, r1, asr #8
	tst	r1, #255
	beq	.L64
.L30:
	ldr	r1, [r7]
	tst	r2, r1
	bne	.L65
.L17:
	add	r3, sp, #20
	add	r4, r4, #2
	sub	r4, r4, r3
	ldr	r3, [sp]
	cmp	r3, r4
	ble	.L15
.L31:
	ldr	r3, [sp, #4]
	mov	r4, r6
	cmp	r3, #0
	ldrb	r8, [r6, #1]!	@ zero_extendqisi2
	beq	.L66
	ldr	r3, .L70+36
	ldr	r2, [r9]
	ldr	r1, [r3]
	ldr	r0, [r7]
	orr	r2, r2, r1
	ldr	r3, .L70+40
	ldr	r1, [fp, #28]
	orr	r2, r2, r0
	ldr	r0, [r5]
	ldrb	r3, [r3]	@ zero_extendqisi2
	add	r1, r1, #1
	and	r0, r0, r2
	str	r1, [fp, #28]
	str	r3, [sp, #8]
	bl	unlikely
	cmp	r0, #0
	beq	.L18
.L21:
	ldr	r0, [r10]
	ldr	r1, [r5, #4]
	ldr	r2, [r5]
	tst	r1, r0
	ldr	r0, [r9]
	bne	.L67
	tst	r2, r0
	beq	.L25
	ldr	r0, [fp, #20]
	add	r0, r0, #1
	str	r0, [fp, #20]
.L24:
	ldr	r0, [r7]
	tst	r2, r0
	ldrne	r0, [fp, #12]
	addne	r0, r0, #1
	strne	r0, [fp, #12]
	ldr	r0, [fp, #4]
	and	r2, r2, r0
	and	r2, r2, #255
	str	r2, [r5]
	and	r1, r1, r0, asr #8
	ldr	r0, [r10]
	and	r1, r1, #255
	tst	r1, r0
	str	r1, [r5, #4]
	bne	.L68
	ldr	r1, [r9]
	tst	r2, r1
	beq	.L28
	ldr	r3, .L70+44
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [sp, #8]
	b	.L22
.L63:
	cmp	r3, #0
	add	r8, r8, #1
	bgt	.L8
.L12:
	mov	r0, fp
	bl	sunsab_cec_wait
	ldr	r2, .L70+48
	ldr	r1, [fp, #40]
	ldr	r0, [r2]
	bl	writeb
	b	.L9
.L18:
	ldr	r0, [r5, #4]
	ldr	r2, [r10]
	and	r0, r0, r2
	bl	unlikely
	cmp	r0, #0
	bne	.L21
	b	.L22
.L25:
	ldr	r3, .L70+36
	ldr	r0, [r3]
	tst	r2, r0
	ldrne	r0, [fp, #16]
	addne	r0, r0, #1
	strne	r0, [fp, #16]
	b	.L24
.L67:
	ldr	r3, .L70+36
	ldr	r1, [fp, #24]
	ldr	ip, [r3]
	add	r1, r1, #1
	orr	r0, r0, ip
	bic	r2, r2, r0
	str	r2, [r5]
	mov	r0, fp
	str	r1, [fp, #24]
	bl	uart_handle_break
	cmp	r0, #0
	bne	.L17
	ldr	r2, [r5]
	ldr	r1, [r5, #4]
	b	.L24
.L66:
	mov	r1, r8
	mov	r0, fp
	bl	uart_handle_sysrq_char
	b	.L17
.L65:
	ldr	r3, .L70+52
	mov	r1, #0
	ldrb	r2, [r3]	@ zero_extendqisi2
	ldr	r0, [sp, #4]
	bl	tty_insert_flip_char
	b	.L17
.L13:
	ldr	r1, [fp, #32]
	ldr	r2, [fp]
	ldr	r1, [r1]
	sub	r3, r1, r2
	clz	r3, r3
	lsr	r3, r3, #5
	str	r3, [sp, #12]
	ldr	r3, [sp]
	cmp	r3, #0
	bgt	.L14
.L15:
	ldr	r3, [sp, #12]
	cmp	r3, #0
	beq	.L1
	bl	sun_do_break
.L1:
	ldr	r3, .L70+4
	ldr	r2, [r3]
	ldr	r3, [sp, #52]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L69
	ldr	r0, [sp, #4]
	add	sp, sp, #60
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L28:
	ldr	r3, .L70+36
	ldr	r1, [r3]
	tst	r2, r1
	ldrne	r3, .L70+56
	ldrbne	r3, [r3]	@ zero_extendqisi2
	strne	r3, [sp, #8]
	b	.L22
.L64:
	ldr	r2, [sp, #8]
	mov	r1, r8
	ldr	r0, [sp, #4]
	bl	tty_insert_flip_char
	ldr	r2, [r5]
	b	.L30
.L61:
	ldr	r0, [fp, #40]
	add	r8, r8, #1
	add	r0, r0, #8
	bl	readb
	ldr	r1, .L70+8
	ldr	r2, [r5]
	ldr	r1, [r1]
	sub	r1, r1, #1
	and	r3, r1, r0
	ldr	r1, .L70+16
	str	r3, [sp]
	ldr	r4, [r1]
	ands	r4, r2, r4
	beq	.L5
.L62:
	mov	r0, fp
	bl	sunsab_cec_wait
	ldr	r2, .L70+60
	ldr	r1, [fp, #40]
	ldr	r0, [r2]
	bl	writeb
	b	.L1
.L69:
	bl	__stack_chk_fail
.L71:
	.align	2
.L70:
	.word	SAB82532_ISR0_RPF
	.word	.LC0
	.word	SAB82532_RECV_FIFO_SIZE
	.word	SAB82532_ISR0_TCD
	.word	SAB82532_ISR0_TIME
	.word	SAB82532_ISR0_RFO
	.word	SAB82532_ISR1_BRK
	.word	SAB82532_ISR0_PERR
	.word	TTY_BREAK
	.word	SAB82532_ISR0_FERR
	.word	TTY_NORMAL
	.word	TTY_PARITY
	.word	SAB82532_CMDR_RMC
	.word	TTY_OVERRUN
	.word	TTY_FRAME
	.word	SAB82532_CMDR_RFRD
	.size	receive_chars, .-receive_chars
	.comm	TTY_PARITY,1,1
	.comm	TTY_OVERRUN,1,1
	.comm	TTY_NORMAL,1,1
	.comm	TTY_FRAME,1,1
	.comm	TTY_BREAK,1,1
	.comm	SAB82532_RECV_FIFO_SIZE,4,4
	.comm	SAB82532_ISR1_BRK,4,4
	.comm	SAB82532_ISR0_TIME,4,4
	.comm	SAB82532_ISR0_TCD,4,4
	.comm	SAB82532_ISR0_RPF,4,4
	.comm	SAB82532_ISR0_RFO,4,4
	.comm	SAB82532_ISR0_PERR,4,4
	.comm	SAB82532_ISR0_FERR,4,4
	.comm	SAB82532_CMDR_RMC,4,4
	.comm	SAB82532_CMDR_RFRD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
