	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function olpc_apsp_open
_olpc_apsp_open:                        ## @olpc_apsp_open
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rbx
	movl	12(%rbx), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 12(%rbx)
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jne	LBB0_4
## %bb.1:
	movq	_COMMAND_FIFO_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%rbx), %rdi
	callq	_readl
	movq	_CMD_STS_MASK@GOTPCREL(%rip), %rcx
	testq	%rax, (%rcx)
	je	LBB0_2
## %bb.3:
	movq	_PJ_INTERRUPT_MASK@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	addq	(%rbx), %rdi
	callq	_readl
	movq	_INT_0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	notl	%edi
	andl	%eax, %edi
	movq	(%r15), %rsi
	addq	(%rbx), %rsi
	callq	_writel
	jmp	LBB0_4
LBB0_2:
	movl	8(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_4:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_COMMAND_FIFO_STATUS,8,3        ## @COMMAND_FIFO_STATUS
	.comm	_CMD_STS_MASK,8,3               ## @CMD_STS_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SP cannot accept commands.\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_PJ_INTERRUPT_MASK,8,3          ## @PJ_INTERRUPT_MASK
	.comm	_INT_0,4,2                      ## @INT_0
	.no_dead_strip	_olpc_apsp_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function olpc_apsp_open
_olpc_apsp_open:                        ; @olpc_apsp_open
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x19, [x0]
	ldr	w8, [x19, #12]
	add	w9, w8, #1
	str	w9, [x19, #12]
	cbnz	w8, LBB0_3
; %bb.1:
	ldr	x8, [x19]
Lloh0:
	adrp	x9, _COMMAND_FIFO_STATUS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _COMMAND_FIFO_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
Lloh3:
	adrp	x8, _CMD_STS_MASK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CMD_STS_MASK@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	tst	x8, x0
	b.eq	LBB0_5
; %bb.2:
	ldr	x8, [x19]
Lloh6:
	adrp	x20, _PJ_INTERRUPT_MASK@GOTPAGE
Lloh7:
	ldr	x20, [x20, _PJ_INTERRUPT_MASK@GOTPAGEOFF]
	ldr	x9, [x20]
	add	x0, x9, x8
	bl	_readl
Lloh8:
	adrp	x8, _INT_0@GOTPAGE
Lloh9:
	ldr	x8, [x8, _INT_0@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	bic	w0, w0, w8
	ldr	x8, [x19]
	ldr	x9, [x20]
	add	x1, x9, x8
	bl	_writel
LBB0_3:
	mov	w0, #0
LBB0_4:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	w0, [x19, #8]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_COMMAND_FIFO_STATUS,8,3        ; @COMMAND_FIFO_STATUS
	.comm	_CMD_STS_MASK,8,3               ; @CMD_STS_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SP cannot accept commands.\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_PJ_INTERRUPT_MASK,8,3          ; @PJ_INTERRUPT_MASK
	.comm	_INT_0,4,2                      ; @INT_0
	.no_dead_strip	_olpc_apsp_open
.subsections_via_symbols
