	.file	"59463.c"
	.intel_syntax noprefix
	.text
	.globl	mem_fd
	.bss
	.align 4
	.type	mem_fd, @object
	.size	mem_fd, 4
mem_fd:
	.zero	4
	.globl	gpio_mem
	.align 8
	.type	gpio_mem, @object
	.size	gpio_mem, 8
gpio_mem:
	.zero	8
	.globl	gpio_map
	.align 8
	.type	gpio_map, @object
	.size	gpio_map, 8
gpio_map:
	.zero	8
	.globl	spi0_mem
	.align 8
	.type	spi0_mem, @object
	.size	spi0_mem, 8
spi0_mem:
	.zero	8
	.globl	spi0_map
	.align 8
	.type	spi0_map, @object
	.size	spi0_map, 8
spi0_map:
	.zero	8
	.globl	gpio
	.align 8
	.type	gpio, @object
	.size	gpio, 8
gpio:
	.zero	8
	.globl	spi0
	.align 8
	.type	spi0, @object
	.size	spi0, 8
spi0:
	.zero	8
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	eax, 0
	call	setup_io
	mov	DWORD PTR -4[rbp], 7
	jmp	.L2
.L3:
	mov	rcx, QWORD PTR gpio[rip]
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx, 2
	sar	eax, 31
	mov	esi, edx
	sub	esi, eax
	movsx	rax, esi
	sal	rax, 2
	add	rax, rcx
	mov	edi, DWORD PTR [rax]
	mov	ecx, DWORD PTR -4[rbp]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	r8d, ecx
	sar	r8d, 31
	sub	eax, r8d
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	eax, edx
	add	eax, eax
	add	eax, edx
	mov	edx, 7
	mov	ecx, eax
	sal	edx, cl
	mov	eax, edx
	not	eax
	mov	ecx, eax
	mov	rdx, QWORD PTR gpio[rip]
	movsx	rax, esi
	sal	rax, 2
	add	rax, rdx
	and	edi, ecx
	mov	edx, edi
	mov	DWORD PTR [rax], edx
	mov	rcx, QWORD PTR gpio[rip]
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx, 2
	sar	eax, 31
	mov	esi, edx
	sub	esi, eax
	movsx	rax, esi
	sal	rax, 2
	add	rax, rcx
	mov	edi, DWORD PTR [rax]
	mov	ecx, DWORD PTR -4[rbp]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	r8d, ecx
	sar	r8d, 31
	sub	eax, r8d
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	eax, edx
	add	eax, eax
	add	eax, edx
	mov	edx, 4
	mov	ecx, eax
	sal	edx, cl
	mov	eax, edx
	mov	ecx, eax
	mov	rdx, QWORD PTR gpio[rip]
	movsx	rax, esi
	sal	rax, 2
	add	rax, rdx
	or	edi, ecx
	mov	edx, edi
	mov	DWORD PTR [rax], edx
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 11
	jle	.L3
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC0:
	.string	"/dev/mem"
.LC1:
	.string	"can't open /dev/mem "
.LC2:
	.string	"allocation error "
.LC3:
	.string	"mmap error %d\n"
.LC4:
	.string	"SPI mapped from 0x%p to 0x%p\n"
	.text
	.globl	setup_io
	.type	setup_io, @function
setup_io:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	esi, 1052674
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR mem_fd[rip], eax
	mov	eax, DWORD PTR mem_fd[rip]
	test	eax, eax
	jns	.L6
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	edi, -1
	call	exit@PLT
.L6:
	mov	edi, 8191
	call	malloc@PLT
	mov	QWORD PTR gpio_mem[rip], rax
	mov	rax, QWORD PTR gpio_mem[rip]
	test	rax, rax
	jne	.L7
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	edi, -1
	call	exit@PLT
.L7:
	mov	rax, QWORD PTR gpio_mem[rip]
	and	eax, 4095
	test	rax, rax
	je	.L8
	mov	rdx, QWORD PTR gpio_mem[rip]
	mov	rax, QWORD PTR gpio_mem[rip]
	and	eax, 4095
	mov	rcx, rax
	mov	eax, 4096
	sub	rax, rcx
	add	rax, rdx
	mov	QWORD PTR gpio_mem[rip], rax
.L8:
	mov	edx, DWORD PTR mem_fd[rip]
	mov	rax, QWORD PTR gpio_mem[rip]
	mov	r9d, 538968064
	mov	r8d, edx
	mov	ecx, 17
	mov	edx, 3
	mov	esi, 4096
	mov	rdi, rax
	call	mmap@PLT
	mov	QWORD PTR gpio_map[rip], rax
	mov	rax, QWORD PTR gpio_map[rip]
	test	rax, rax
	jns	.L9
	mov	rax, QWORD PTR gpio_map[rip]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, -1
	call	exit@PLT
.L9:
	mov	rax, QWORD PTR gpio_map[rip]
	mov	QWORD PTR gpio[rip], rax
	mov	edi, 8191
	call	malloc@PLT
	mov	QWORD PTR spi0_mem[rip], rax
	mov	rax, QWORD PTR spi0_mem[rip]
	test	rax, rax
	jne	.L10
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	edi, -1
	call	exit@PLT
.L10:
	mov	rax, QWORD PTR spi0_mem[rip]
	and	eax, 4095
	test	rax, rax
	je	.L11
	mov	rdx, QWORD PTR spi0_mem[rip]
	mov	rax, QWORD PTR spi0_mem[rip]
	and	eax, 4095
	mov	rcx, rax
	mov	eax, 4096
	sub	rax, rcx
	add	rax, rdx
	mov	QWORD PTR spi0_mem[rip], rax
.L11:
	mov	edx, DWORD PTR mem_fd[rip]
	mov	rax, QWORD PTR spi0_mem[rip]
	mov	r9d, 538984448
	mov	r8d, edx
	mov	ecx, 17
	mov	edx, 3
	mov	esi, 4096
	mov	rdi, rax
	call	mmap@PLT
	mov	QWORD PTR spi0_map[rip], rax
	mov	rax, QWORD PTR spi0_map[rip]
	mov	rdx, rax
	mov	esi, 538984448
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR spi0_map[rip]
	test	rax, rax
	jns	.L12
	mov	rax, QWORD PTR spi0_map[rip]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, -1
	call	exit@PLT
.L12:
	mov	rax, QWORD PTR spi0_map[rip]
	mov	QWORD PTR spi0[rip], rax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	setup_io, .-setup_io
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"59463.c"
	.text
	.comm	mem_fd,4,4
	.comm	gpio_mem,4,4
	.comm	gpio_map,4,4
	.comm	spi0_mem,4,4
	.comm	spi0_map,4,4
	.comm	gpio,4,4
	.comm	spi0,4,4
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	bl	setup_io
	mov	r3, #7
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r3, .L5
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	ldr	r1, .L5+4
	smull	r0, r1, r3, r1
	asr	r1, r1, #2
	asr	r3, r3, #31
	sub	ip, r1, r3
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r0, [r3]
	ldr	r1, [fp, #-8]
	ldr	r3, .L5+4
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	mov	r2, #7
	lsl	r3, r2, r3
	mvn	r3, r3
	mov	r1, r3
	ldr	r3, .L5
	ldr	r2, [r3]
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r2, r3
	and	r2, r0, r1
	str	r2, [r3]
	ldr	r3, .L5
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	ldr	r1, .L5+4
	smull	r0, r1, r3, r1
	asr	r1, r1, #2
	asr	r3, r3, #31
	sub	ip, r1, r3
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r0, [r3]
	ldr	r1, [fp, #-8]
	ldr	r3, .L5+4
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	mov	r2, #4
	lsl	r3, r2, r3
	mov	r1, r3
	ldr	r3, .L5
	ldr	r2, [r3]
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r2, r3
	orr	r2, r0, r1
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #11
	ble	.L3
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	gpio
	.word	1717986919
	.size	main, .-main
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/dev/mem\000"
	.align	2
.LC1:
	.ascii	"can't open /dev/mem \000"
	.align	2
.LC2:
	.ascii	"allocation error \000"
	.align	2
.LC3:
	.ascii	"mmap error %d\012\000"
	.align	2
.LC4:
	.ascii	"SPI mapped from 0x%p to 0x%p\012\000"
	.text
	.align	2
	.global	setup_io
	.syntax unified
	.arm
	.fpu softvfp
	.type	setup_io, %function
setup_io:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r1, .L15
	ldr	r0, .L15+4
	bl	open
	mov	r3, r0
	ldr	r2, .L15+8
	str	r3, [r2]
	ldr	r3, .L15+8
	ldr	r3, [r3]
	cmp	r3, #0
	bge	.L8
	ldr	r0, .L15+12
	bl	puts
	mvn	r0, #0
	bl	exit
.L8:
	ldr	r0, .L15+16
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L15+20
	str	r2, [r3]
	ldr	r3, .L15+20
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L9
	ldr	r0, .L15+24
	bl	puts
	mvn	r0, #0
	bl	exit
.L9:
	ldr	r3, .L15+20
	ldr	r3, [r3]
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	cmp	r3, #0
	beq	.L10
	ldr	r3, .L15+20
	ldr	r2, [r3]
	ldr	r3, .L15+20
	ldr	r3, [r3]
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	rsb	r3, r3, #4096
	add	r3, r2, r3
	ldr	r2, .L15+20
	str	r3, [r2]
.L10:
	ldr	r3, .L15+20
	ldr	r0, [r3]
	ldr	r3, .L15+8
	ldr	r3, [r3]
	ldr	r2, .L15+28
	str	r2, [sp, #4]
	str	r3, [sp]
	mov	r3, #17
	mov	r2, #3
	mov	r1, #4096
	bl	mmap
	mov	r3, r0
	ldr	r2, .L15+32
	str	r3, [r2]
	ldr	r3, .L15+32
	ldr	r3, [r3]
	cmp	r3, #0
	bge	.L11
	ldr	r3, .L15+32
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L15+36
	bl	printf
	mvn	r0, #0
	bl	exit
.L11:
	ldr	r3, .L15+32
	ldr	r3, [r3]
	ldr	r2, .L15+40
	str	r3, [r2]
	ldr	r0, .L15+16
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L15+44
	str	r2, [r3]
	ldr	r3, .L15+44
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L12
	ldr	r0, .L15+24
	bl	puts
	mvn	r0, #0
	bl	exit
.L12:
	ldr	r3, .L15+44
	ldr	r3, [r3]
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	cmp	r3, #0
	beq	.L13
	ldr	r3, .L15+44
	ldr	r2, [r3]
	ldr	r3, .L15+44
	ldr	r3, [r3]
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	rsb	r3, r3, #4096
	add	r3, r2, r3
	ldr	r2, .L15+44
	str	r3, [r2]
.L13:
	ldr	r3, .L15+44
	ldr	r0, [r3]
	ldr	r3, .L15+8
	ldr	r3, [r3]
	ldr	r2, .L15+48
	str	r2, [sp, #4]
	str	r3, [sp]
	mov	r3, #17
	mov	r2, #3
	mov	r1, #4096
	bl	mmap
	mov	r3, r0
	ldr	r2, .L15+52
	str	r3, [r2]
	ldr	r3, .L15+52
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L15+48
	ldr	r0, .L15+56
	bl	printf
	ldr	r3, .L15+52
	ldr	r3, [r3]
	cmp	r3, #0
	bge	.L14
	ldr	r3, .L15+52
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L15+36
	bl	printf
	mvn	r0, #0
	bl	exit
.L14:
	ldr	r3, .L15+52
	ldr	r3, [r3]
	ldr	r2, .L15+60
	str	r3, [r2]
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	1052674
	.word	.LC0
	.word	mem_fd
	.word	.LC1
	.word	8191
	.word	gpio_mem
	.word	.LC2
	.word	538968064
	.word	gpio_map
	.word	.LC3
	.word	gpio
	.word	spi0_mem
	.word	538984448
	.word	spi0_map
	.word	.LC4
	.word	spi0
	.size	setup_io, .-setup_io
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
