	.file	"extr_applesmc.c_read_smc.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%.4s: read arg fail\n"
.LC1:
	.string	"%.4s: read len fail\n"
.LC2:
	.string	"%.4s: read data[%d] fail\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC3:
	.string	"flushed %d bytes, last value is: %d\n"
	.text
	.p2align 4
	.type	read_smc, @function
read_smc:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	mov	r14d, ecx
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12, rdx
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	send_command@PLT
	test	rax, rax
	jne	.L4
	mov	rdi, rbp
	call	send_argument@PLT
	test	rax, rax
	je	.L21
.L4:
	mov	rsi, rbp
	lea	rdi, .LC0[rip]
	xor	eax, eax
	call	pr_warn@PLT
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	mov	esi, DWORD PTR APPLESMC_DATA_PORT[rip]
	mov	edi, r14d
	call	send_byte@PLT
	test	rax, rax
	jne	.L5
	lea	r13d, -1[r14]
	xor	ebx, ebx
	test	r14d, r14d
	jg	.L9
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	mov	edi, DWORD PTR APPLESMC_DATA_PORT[rip]
	call	inb@PLT
	mov	DWORD PTR [r12+rbx*4], eax
	lea	rax, 1[rbx]
	cmp	r13, rbx
	je	.L7
	mov	rbx, rax
.L9:
	xor	eax, eax
	call	wait_read@PLT
	test	rax, rax
	je	.L8
	mov	edx, ebx
	mov	rsi, rbp
	lea	rdi, .LC2[rip]
	xor	eax, eax
	call	pr_warn@PLT
	mov	r12d, DWORD PTR EIO[rip]
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	neg	r12d
	mov	eax, r12d
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	xor	r12d, r12d
	xor	r13d, r13d
	.p2align 4,,10
	.p2align 3
.L11:
	mov	edi, DWORD PTR APPLESMC_MIN_WAIT[rip]
	call	udelay@PLT
	mov	edi, DWORD PTR APPLESMC_CMD_PORT[rip]
	call	inb@PLT
	test	al, 1
	je	.L10
	mov	edi, DWORD PTR APPLESMC_DATA_PORT[rip]
	add	r12d, 1
	call	inb@PLT
	mov	r13d, eax
	cmp	r12d, 16
	jne	.L11
.L12:
	mov	esi, r12d
	mov	edx, r13d
	lea	rdi, .LC3[rip]
	xor	eax, eax
	call	pr_warn@PLT
	xor	r12d, r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	test	r12d, r12d
	je	.L1
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rsi, rbp
	lea	rdi, .LC1[rip]
	xor	eax, eax
	call	pr_warn@PLT
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	read_smc, .-read_smc
	.comm	EIO,4,4
	.comm	APPLESMC_MIN_WAIT,4,4
	.comm	APPLESMC_DATA_PORT,4,4
	.comm	APPLESMC_CMD_PORT,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_applesmc.c_read_smc.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"%.4s: read arg fail\012\000"
	.align	2
.LC1:
	.ascii	"%.4s: read len fail\012\000"
	.align	2
.LC2:
	.ascii	"%.4s: read data[%d] fail\012\000"
	.align	2
.LC3:
	.ascii	"flushed %d bytes, last value is: %d\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_smc, %function
read_smc:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r8, r1
	mov	r5, r2
	mov	r6, r3
	bl	send_command
	cmp	r0, #0
	bne	.L4
	mov	r0, r8
	bl	send_argument
	cmp	r0, #0
	beq	.L20
.L4:
	mov	r1, r8
	ldr	r0, .L21
	bl	pr_warn
	ldr	r3, .L21+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, pc}
.L20:
	ldr	r7, .L21+8
	mov	r0, r6
	ldr	r1, [r7]
	bl	send_byte
	subs	r4, r0, #0
	bne	.L5
	cmp	r6, #0
	subgt	r5, r5, #4
	bgt	.L9
	b	.L7
.L8:
	ldr	r0, [r7]
	bl	inb
	add	r4, r4, #1
	cmp	r6, r4
	str	r0, [r5, #4]!
	beq	.L7
.L9:
	bl	wait_read
	cmp	r0, #0
	beq	.L8
	mov	r2, r4
	mov	r1, r8
	ldr	r0, .L21+12
	bl	pr_warn
	ldr	r3, .L21+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, pc}
.L7:
	mov	r4, #0
	mov	r5, r4
	ldr	r8, .L21+16
	ldr	r6, .L21+20
.L11:
	ldr	r0, [r8]
	bl	udelay
	ldr	r0, [r6]
	bl	inb
	tst	r0, #1
	beq	.L10
	ldr	r0, [r7]
	bl	inb
	add	r4, r4, #1
	cmp	r4, #16
	mov	r5, r0
	bne	.L11
.L12:
	mov	r1, r4
	mov	r2, r5
	ldr	r0, .L21+24
	bl	pr_warn
	mov	r4, #0
	b	.L1
.L10:
	cmp	r4, #0
	beq	.L1
	b	.L12
.L5:
	mov	r1, r8
	ldr	r0, .L21+28
	bl	pr_warn
	ldr	r3, .L21+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L1
.L22:
	.align	2
.L21:
	.word	.LC0
	.word	EIO
	.word	APPLESMC_DATA_PORT
	.word	.LC2
	.word	APPLESMC_MIN_WAIT
	.word	APPLESMC_CMD_PORT
	.word	.LC3
	.word	.LC1
	.size	read_smc, .-read_smc
	.comm	EIO,4,4
	.comm	APPLESMC_MIN_WAIT,4,4
	.comm	APPLESMC_DATA_PORT,4,4
	.comm	APPLESMC_CMD_PORT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
