	.file	"extr_xpt2046.c_xpt2046_init.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	xpt2046_init, @function
xpt2046_init:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	esi, 1
	mov	rbp, rdi
	call	luaL_checkinteger@PLT
	mov	rdi, rbp
	mov	esi, 2
	mov	QWORD PTR _cs_pin[rip], rax
	call	luaL_checkinteger@PLT
	mov	rdi, rbp
	mov	esi, 3
	mov	QWORD PTR _irq_pin[rip], rax
	call	luaL_checkinteger@PLT
	mov	rdi, rbp
	mov	esi, 4
	mov	DWORD PTR _height[rip], eax
	call	luaL_checkinteger@PLT
	mov	edx, DWORD PTR PLATFORM_GPIO_FLOAT[rip]
	mov	esi, DWORD PTR PLATFORM_GPIO_OUTPUT[rip]
	mov	rdi, QWORD PTR _cs_pin[rip]
	mov	DWORD PTR _width[rip], eax
	call	platform_gpio_mode@PLT
	mov	esi, DWORD PTR _height[rip]
	mov	r10d, DWORD PTR CAL_MARGIN[rip]
	mov	r8d, DWORD PTR ADC_MAX[rip]
	mov	r9d, DWORD PTR _width[rip]
	mov	eax, esi
	mov	edi, r10d
	sub	eax, r10d
	imul	edi, r8d
	imul	eax, r8d
	cdq
	idiv	esi
	mov	ecx, eax
	mov	eax, r9d
	sub	eax, r10d
	imul	eax, r8d
	cdq
	idiv	r9d
	mov	r8d, eax
	mov	eax, edi
	cdq
	idiv	esi
	mov	esi, eax
	mov	eax, edi
	cdq
	idiv	r9d
	mov	edx, r8d
	mov	edi, eax
	call	setCalibration@PLT
	mov	esi, DWORD PTR PLATFORM_GPIO_LOW[rip]
	mov	rdi, QWORD PTR _cs_pin[rip]
	call	platform_gpio_write@PLT
	mov	esi, 8
	mov	edx, DWORD PTR CTRL_HI_Y[rip]
	mov	edi, 1
	or	edx, DWORD PTR CTRL_LO_SER[rip]
	call	platform_spi_send_recv@PLT
	xor	edi, edi
	call	transfer16@PLT
	mov	esi, DWORD PTR PLATFORM_GPIO_HIGH[rip]
	mov	rdi, QWORD PTR _cs_pin[rip]
	call	platform_gpio_write@PLT
	xor	eax, eax
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	xpt2046_init, .-xpt2046_init
	.comm	_width,4,4
	.comm	_irq_pin,8,8
	.comm	_height,4,4
	.comm	_cs_pin,8,8
	.comm	PLATFORM_GPIO_OUTPUT,4,4
	.comm	PLATFORM_GPIO_LOW,4,4
	.comm	PLATFORM_GPIO_HIGH,4,4
	.comm	PLATFORM_GPIO_FLOAT,4,4
	.comm	CTRL_LO_SER,4,4
	.comm	CTRL_HI_Y,4,4
	.comm	CAL_MARGIN,4,4
	.comm	ADC_MAX,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_xpt2046.c_xpt2046_init.c"
	.text
	.global	__aeabi_idiv
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	xpt2046_init, %function
xpt2046_init:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r1, #1
	mov	r4, r0
	bl	luaL_checkinteger
	mov	r3, r0
	ldr	r5, .L4
	mov	r0, r4
	mov	r1, #2
	str	r3, [r5]
	bl	luaL_checkinteger
	mov	r2, r0
	ldr	r3, .L4+4
	mov	r0, r4
	mov	r1, #3
	str	r2, [r3]
	bl	luaL_checkinteger
	mov	r3, r0
	ldr	r7, .L4+8
	mov	r0, r4
	mov	r1, #4
	str	r3, [r7]
	bl	luaL_checkinteger
	mov	r3, r0
	ldr	r2, .L4+12
	ldr	r1, .L4+16
	ldr	r6, .L4+20
	ldr	r0, [r5]
	ldr	r2, [r2]
	ldr	r1, [r1]
	str	r3, [r6]
	bl	platform_gpio_mode
	ldr	r2, .L4+24
	ldr	r3, .L4+28
	ldr	r4, [r2]
	ldr	r9, [r7]
	ldr	r10, [r3]
	sub	r0, r9, r4
	mov	r1, r9
	mul	r0, r10, r0
	bl	__aeabi_idiv
	ldr	r8, [r6]
	mov	r7, r0
	sub	r0, r8, r4
	mov	r1, r8
	mul	r0, r10, r0
	bl	__aeabi_idiv
	mul	r4, r10, r4
	mov	r6, r0
	mov	r1, r9
	mov	r0, r4
	bl	__aeabi_idiv
	mov	ip, r0
	mov	r0, r4
	mov	r4, ip
	mov	r1, r8
	bl	__aeabi_idiv
	mov	r2, r6
	mov	r3, r7
	mov	r1, r4
	bl	setCalibration
	ldr	r3, .L4+32
	ldr	r0, [r5]
	ldr	r1, [r3]
	bl	platform_gpio_write
	ldr	r2, .L4+36
	ldr	r3, .L4+40
	ldr	r2, [r2]
	ldr	r3, [r3]
	mov	r1, #8
	orr	r2, r2, r3
	mov	r0, #1
	bl	platform_spi_send_recv
	mov	r0, #0
	bl	transfer16
	ldr	r3, .L4+44
	ldr	r0, [r5]
	ldr	r1, [r3]
	bl	platform_gpio_write
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L5:
	.align	2
.L4:
	.word	_cs_pin
	.word	_irq_pin
	.word	_height
	.word	PLATFORM_GPIO_FLOAT
	.word	PLATFORM_GPIO_OUTPUT
	.word	_width
	.word	CAL_MARGIN
	.word	ADC_MAX
	.word	PLATFORM_GPIO_LOW
	.word	CTRL_HI_Y
	.word	CTRL_LO_SER
	.word	PLATFORM_GPIO_HIGH
	.size	xpt2046_init, .-xpt2046_init
	.comm	_width,4,4
	.comm	_irq_pin,4,4
	.comm	_height,4,4
	.comm	_cs_pin,4,4
	.comm	PLATFORM_GPIO_OUTPUT,4,4
	.comm	PLATFORM_GPIO_LOW,4,4
	.comm	PLATFORM_GPIO_HIGH,4,4
	.comm	PLATFORM_GPIO_FLOAT,4,4
	.comm	CTRL_LO_SER,4,4
	.comm	CTRL_HI_Y,4,4
	.comm	CAL_MARGIN,4,4
	.comm	ADC_MAX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
