	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ads7846_setup_pendown
_ads7846_setup_pendown:                 ## @ads7846_setup_pendown
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	16(%rdx), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rax, 8(%r12)
	xorl	%r15d, %r15d
LBB0_8:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%rdx, %rbx
	movq	%rdi, %r14
	movl	8(%rdx), %edi
	callq	_gpio_is_valid
	testq	%rax, %rax
	je	LBB0_7
## %bb.3:
	movl	8(%rbx), %edi
	movq	_GPIOF_IN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	callq	_gpio_request_one
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r15d
	movl	8(%rbx), %edx
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_8
LBB0_7:
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_8
LBB0_5:
	movl	8(%rbx), %edi
	movl	%edi, (%r12)
	movq	(%rbx), %rsi
	xorl	%r15d, %r15d
	testq	%rsi, %rsi
	je	LBB0_8
## %bb.6:
	callq	_gpio_set_debounce
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_GPIOF_IN,4,2                   ## @GPIOF_IN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ads7846_pendown"

L_.str.1:                               ## @.str.1
	.asciz	"failed to request/setup pendown GPIO%d: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"no get_pendown_state nor gpio_pendown?\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_ads7846_setup_pendown
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ads7846_setup_pendown
_ads7846_setup_pendown:                 ; @ads7846_setup_pendown
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x22, x1
	ldr	x8, [x2, #16]
	cbz	x8, LBB0_3
; %bb.1:
	mov	w21, #0
	str	x8, [x22, #8]
LBB0_2:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_3:
	mov	x20, x2
	mov	x19, x0
	ldr	w0, [x2, #8]
	bl	_gpio_is_valid
	cbz	x0, LBB0_6
; %bb.4:
	ldr	w0, [x20, #8]
Lloh0:
	adrp	x8, _GPIOF_IN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GPIOF_IN@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x2, l_.str@PAGE
Lloh4:
	add	x2, x2, l_.str@PAGEOFF
	bl	_gpio_request_one
	cbz	w0, LBB0_7
; %bb.5:
	mov	x21, x0
	ldr	w8, [x20, #8]
	stp	x8, x21, [sp]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	b	LBB0_2
LBB0_6:
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_2
LBB0_7:
	ldr	w0, [x20, #8]
	str	w0, [x22]
	ldr	x1, [x20]
	cbz	x1, LBB0_9
; %bb.8:
	bl	_gpio_set_debounce
LBB0_9:
	mov	w21, #0
	b	LBB0_2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_GPIOF_IN,4,2                   ; @GPIOF_IN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ads7846_pendown"

l_.str.1:                               ; @.str.1
	.asciz	"failed to request/setup pendown GPIO%d: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"no get_pendown_state nor gpio_pendown?\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_ads7846_setup_pendown
.subsections_via_symbols
