	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function olpc_apsp_write
_olpc_apsp_write:                       ## @olpc_apsp_write
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	(%rdi), %r13
	cmpq	%rdi, 16(%r13)
	jne	LBB0_1
## %bb.2:
	movq	_TOUCHPAD_PORT@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_KEYBOARD_PORT@GOTPCREL(%rip), %rax
LBB0_3:
	movzbl	(%rax), %edx
	movq	_PORT_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	movl	8(%r13), %edi
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movzbl	%dl, %edx
	leaq	L_.str(%rip), %rsi
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$50, %ebx
	movq	_COMMAND_FIFO_STATUS@GOTPCREL(%rip), %r12
	movq	_CMD_CNTR_MASK@GOTPCREL(%rip), %r14
	movq	_MAX_PENDING_CMDS@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rdi
	addq	(%r13), %rdi
	callq	_readl
	andb	(%r14), %al
	cmpb	(%r15), %al
	jb	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	$1, %edi
	callq	_mdelay
	decl	%ebx
	jne	LBB0_4
## %bb.7:
	movl	8(%r13), %r14d
	movq	(%r12), %rdi
	addq	(%r13), %rdi
	callq	_readl
	movzbl	%al, %edx
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%r14d, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_5:
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	orb	-48(%rbp), %cl                  ## 1-byte Folded Reload
	movq	_SECURE_PROCESSOR_COMMAND@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r13), %rsi
	movzbl	%cl, %edi
	callq	_writel
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TOUCHPAD_PORT,1,0              ## @TOUCHPAD_PORT
	.comm	_PORT_SHIFT,1,0                 ## @PORT_SHIFT
	.comm	_KEYBOARD_PORT,1,0              ## @KEYBOARD_PORT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"olpc_apsp_write which=%x val=%x\n"

	.comm	_COMMAND_FIFO_STATUS,8,3        ## @COMMAND_FIFO_STATUS
	.comm	_CMD_CNTR_MASK,1,0              ## @CMD_CNTR_MASK
	.comm	_MAX_PENDING_CMDS,1,0           ## @MAX_PENDING_CMDS
	.comm	_SECURE_PROCESSOR_COMMAND,8,3   ## @SECURE_PROCESSOR_COMMAND
L_.str.1:                               ## @.str.1
	.asciz	"olpc_apsp_write timeout, status=%x\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_olpc_apsp_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function olpc_apsp_write
_olpc_apsp_write:                       ; @olpc_apsp_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	ldr	x20, [x0]
	ldr	x8, [x20, #16]
Lloh0:
	adrp	x9, _TOUCHPAD_PORT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _TOUCHPAD_PORT@GOTPAGEOFF]
Lloh2:
	adrp	x10, _KEYBOARD_PORT@GOTPAGE
Lloh3:
	ldr	x10, [x10, _KEYBOARD_PORT@GOTPAGEOFF]
	cmp	x8, x0
	csel	x8, x9, x10, eq
	ldrb	w8, [x8]
Lloh4:
	adrp	x9, _PORT_SHIFT@GOTPAGE
Lloh5:
	ldr	x9, [x9, _PORT_SHIFT@GOTPAGEOFF]
	ldrb	w9, [x9]
	lsl	w21, w8, w9
	ldr	w0, [x20, #8]
	mov	w8, w1
	str	x8, [sp]
	and	w2, w21, #0xff
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	mov	w23, #50
Lloh8:
	adrp	x22, _COMMAND_FIFO_STATUS@GOTPAGE
Lloh9:
	ldr	x22, [x22, _COMMAND_FIFO_STATUS@GOTPAGEOFF]
Lloh10:
	adrp	x24, _CMD_CNTR_MASK@GOTPAGE
Lloh11:
	ldr	x24, [x24, _CMD_CNTR_MASK@GOTPAGEOFF]
Lloh12:
	adrp	x25, _MAX_PENDING_CMDS@GOTPAGE
Lloh13:
	ldr	x25, [x25, _MAX_PENDING_CMDS@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_readl
	ldrb	w8, [x24]
	and	w8, w8, w0
	ldrb	w9, [x25]
	cmp	w8, w9
	b.lo	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #1
	bl	_mdelay
	subs	w23, w23, #1
	b.ne	LBB0_1
; %bb.3:
	ldr	w19, [x20, #8]
	ldr	x8, [x20]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_readl
	mov	x2, x0
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_dbg
Lloh16:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_5
LBB0_4:
	orr	w8, w21, w19
	ldr	x9, [x20]
Lloh19:
	adrp	x10, _SECURE_PROCESSOR_COMMAND@GOTPAGE
Lloh20:
	ldr	x10, [x10, _SECURE_PROCESSOR_COMMAND@GOTPAGEOFF]
Lloh21:
	ldr	x10, [x10]
	add	x1, x10, x9
	and	w0, w8, #0xff
	bl	_writel
	mov	w0, #0
LBB0_5:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_TOUCHPAD_PORT,1,0              ; @TOUCHPAD_PORT
	.comm	_PORT_SHIFT,1,0                 ; @PORT_SHIFT
	.comm	_KEYBOARD_PORT,1,0              ; @KEYBOARD_PORT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"olpc_apsp_write which=%x val=%x\n"

	.comm	_COMMAND_FIFO_STATUS,8,3        ; @COMMAND_FIFO_STATUS
	.comm	_CMD_CNTR_MASK,1,0              ; @CMD_CNTR_MASK
	.comm	_MAX_PENDING_CMDS,1,0           ; @MAX_PENDING_CMDS
	.comm	_SECURE_PROCESSOR_COMMAND,8,3   ; @SECURE_PROCESSOR_COMMAND
l_.str.1:                               ; @.str.1
	.asciz	"olpc_apsp_write timeout, status=%x\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_olpc_apsp_write
.subsections_via_symbols
