	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sp887x_init
_sp887x_init:                           ## @sp887x_init
	.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), %r14
	movq	$0, -32(%rbp)
	cmpl	$0, (%r14)
	je	LBB0_1
LBB0_7:
	movq	%r14, %rdi
	movl	$3096, %esi                     ## imm = 0xC18
	movl	$13, %edx
	callq	_sp887x_writereg
	xorl	%r15d, %r15d
	jmp	LBB0_8
LBB0_1:
	movq	%rdi, %rbx
	movq	_SP887X_DEFAULT_FIRMWARE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
	movq	8(%r14), %rax
	movl	(%r15), %edx
	leaq	-32(%rbp), %rsi
	movq	%rbx, %rdi
	callq	*(%rax)
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r15d
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_5
LBB0_3:
	movq	-32(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_sp887x_initial_setup
	movl	%eax, %r15d
	movq	-32(%rbp), %rdi
	callq	_release_firmware
	testl	%r15d, %r15d
	je	LBB0_6
## %bb.4:
	leaq	L_.str.2(%rip), %rdi
LBB0_5:
	xorl	%eax, %eax
	callq	_printk
LBB0_8:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
	movl	$1, (%r14)
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sp887x: waiting for firmware upload (%s)...\n"

	.comm	_SP887X_DEFAULT_FIRMWARE,4,2    ## @SP887X_DEFAULT_FIRMWARE
L_.str.1:                               ## @.str.1
	.asciz	"sp887x: no firmware upload (timeout or file not found?)\n"

L_.str.2:                               ## @.str.2
	.asciz	"sp887x: writing firmware to device failed\n"

L_.str.3:                               ## @.str.3
	.asciz	"sp887x: firmware upload complete\n"

	.no_dead_strip	_sp887x_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sp887x_init
_sp887x_init:                           ; @sp887x_init
	.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
	ldr	x19, [x0]
	str	xzr, [sp, #8]
	ldr	w8, [x19]
	cbz	w8, LBB0_2
LBB0_1:
	mov	x0, x19
	mov	w1, #3096
	mov	w2, #13
	bl	_sp887x_writereg
	mov	w21, #0
	b	LBB0_7
LBB0_2:
	mov	x20, x0
Lloh0:
	adrp	x21, _SP887X_DEFAULT_FIRMWARE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SP887X_DEFAULT_FIRMWARE@GOTPAGEOFF]
	ldr	w8, [x21]
	str	x8, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printk
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w2, [x21]
	add	x1, sp, #8
	mov	x0, x20
	blr	x8
	cbz	w0, LBB0_4
; %bb.3:
	mov	x21, x0
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_4:
	ldr	x1, [sp, #8]
	mov	x0, x20
	bl	_sp887x_initial_setup
	mov	x21, x0
	ldr	x0, [sp, #8]
	bl	_release_firmware
	cbz	w21, LBB0_8
; %bb.5:
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_6:
	bl	_printk
LBB0_7:
	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_8:
Lloh8:
	adrp	x0, l_.str.3@PAGE
Lloh9:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_printk
	mov	w8, #1
	str	w8, [x19]
	b	LBB0_1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sp887x: waiting for firmware upload (%s)...\n"

	.comm	_SP887X_DEFAULT_FIRMWARE,4,2    ; @SP887X_DEFAULT_FIRMWARE
l_.str.1:                               ; @.str.1
	.asciz	"sp887x: no firmware upload (timeout or file not found?)\n"

l_.str.2:                               ; @.str.2
	.asciz	"sp887x: writing firmware to device failed\n"

l_.str.3:                               ; @.str.3
	.asciz	"sp887x: firmware upload complete\n"

	.no_dead_strip	_sp887x_init
.subsections_via_symbols
