	.file	"extr_mcp3422.c_mcp3422_read_channel.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	mcp3422_read_channel, @function
mcp3422_read_channel:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	r12, rdx
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rdi, QWORD PTR [rdi]
	mov	rbx, QWORD PTR [rsi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	MCP3422_CHANNEL@PLT
	cmp	rax, rbx
	je	.L2
	mov	rax, QWORD PTR MCP3422_CHANNEL_MASK[rip]
	mov	rdi, rbx
	not	rax
	and	rax, QWORD PTR 0[rbp]
	mov	QWORD PTR [rsp], rax
	call	MCP3422_CHANNEL_VALUE@PLT
	mov	rdx, QWORD PTR MCP3422_PGA_MASK[rip]
	or	rax, QWORD PTR [rsp]
	not	rdx
	and	rax, rdx
	mov	QWORD PTR [rsp], rax
	mov	rax, QWORD PTR 8[rbp]
	mov	edi, DWORD PTR [rax+rbx*4]
	call	MCP3422_PGA_VALUE@PLT
	or	rax, QWORD PTR [rsp]
	mov	rdi, rbp
	mov	rsi, rax
	mov	QWORD PTR [rsp], rax
	call	mcp3422_update_config@PLT
	test	eax, eax
	js	.L1
	mov	rdi, QWORD PTR 0[rbp]
	mov	rbx, QWORD PTR mcp3422_read_times[rip]
	call	MCP3422_SAMPLE_RATE@PLT
	mov	edi, DWORD PTR [rbx+rax*4]
	call	msleep@PLT
.L2:
	mov	rdx, rsp
	mov	rsi, r12
	mov	rdi, rbp
	call	mcp3422_read@PLT
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L7
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	mcp3422_read_channel, .-mcp3422_read_channel
	.comm	mcp3422_read_times,8,8
	.comm	MCP3422_PGA_MASK,8,8
	.comm	MCP3422_CHANNEL_MASK,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_mcp3422.c_mcp3422_read_channel.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	mcp3422_read_channel, %function
mcp3422_read_channel:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	ldr	r3, .L8
	sub	sp, sp, #8
	mov	r4, r0
	ldr	r0, [r0]
	ldr	r6, [r1]
	mov	r5, r2
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	bl	MCP3422_CHANNEL
	cmp	r0, r6
	beq	.L2
	ldr	r2, .L8+4
	ldr	r3, [r4]
	ldr	r2, [r2]
	mov	r0, r6
	bic	r3, r3, r2
	str	r3, [sp]
	bl	MCP3422_CHANNEL_VALUE
	ldr	r2, .L8+8
	ldr	r3, [sp]
	ldr	r1, [r2]
	ldr	r2, [r4, #4]
	orr	r3, r0, r3
	bic	r3, r3, r1
	ldr	r0, [r2, r6, lsl #2]
	str	r3, [sp]
	bl	MCP3422_PGA_VALUE
	mov	r1, r0
	ldr	r3, [sp]
	mov	r0, r4
	orr	r1, r1, r3
	str	r1, [sp]
	bl	mcp3422_update_config
	cmp	r0, #0
	blt	.L1
	ldr	r3, .L8+12
	ldr	r0, [r4]
	ldr	r6, [r3]
	bl	MCP3422_SAMPLE_RATE
	ldr	r0, [r6, r0, lsl #2]
	bl	msleep
.L2:
	mov	r1, r5
	mov	r0, r4
	mov	r2, sp
	bl	mcp3422_read
.L1:
	ldr	r3, .L8
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L7
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L7:
	bl	__stack_chk_fail
.L9:
	.align	2
.L8:
	.word	.LC0
	.word	MCP3422_CHANNEL_MASK
	.word	MCP3422_PGA_MASK
	.word	mcp3422_read_times
	.size	mcp3422_read_channel, .-mcp3422_read_channel
	.comm	mcp3422_read_times,4,4
	.comm	MCP3422_PGA_MASK,4,4
	.comm	MCP3422_CHANNEL_MASK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
