	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s3fwrn5_fw_setup               ## -- Begin function s3fwrn5_fw_setup
	.p2align	4, 0x90
_s3fwrn5_fw_setup:                      ## @s3fwrn5_fw_setup
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	callq	_s3fwrn5_fw_request_firmware
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	leaq	-24(%rbp), %rsi
	movq	%r14, %rdi
	callq	_s3fwrn5_fw_get_bootinfo
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	leaq	40(%r14), %rsi
	leaq	-24(%rbp), %rdi
	callq	_s3fwrn5_fw_get_base_addr
	testl	%eax, %eax
	js	LBB0_5
## %bb.8:
	movl	-24(%rbp), %eax
	movl	%eax, 24(%r14)
	leaq	-24(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_is_custom
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movl	8(%r14,%rcx,4), %eax
	movl	%eax, 20(%r14)
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_is_custom
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movl	(%r14,%rcx,4), %eax
	movl	%eax, 16(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_1:
	movl	%eax, %ebx
	movq	32(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_7
LBB0_3:
	movl	%eax, %ebx
	movq	32(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_6
LBB0_5:
	movl	%eax, %ebx
	movq	32(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_6:
	movq	%r14, %rdi
	callq	_s3fwrn5_fw_release_firmware
LBB0_7:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get fw file, ret=%02x\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to get bootinfo, ret=%02x\n"

L_.str.2:                               ## @.str.2
	.asciz	"Unknown hardware version\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s3fwrn5_fw_setup               ; -- Begin function s3fwrn5_fw_setup
	.p2align	2
_s3fwrn5_fw_setup:                      ; @s3fwrn5_fw_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_s3fwrn5_fw_request_firmware
	tbnz	w0, #31, LBB0_4
; %bb.1:
	add	x1, sp, #8
	mov	x0, x19
	bl	_s3fwrn5_fw_get_bootinfo
	tbnz	w0, #31, LBB0_5
; %bb.2:
	add	x1, x19, #40
	add	x0, sp, #8
	bl	_s3fwrn5_fw_get_base_addr
	tbnz	w0, #31, LBB0_6
; %bb.3:
	ldr	w8, [sp, #8]
	str	w8, [x19, #24]
	add	x0, sp, #8
	bl	_s3fwrn5_fw_is_custom
	mov	w8, #12
	mov	w9, #8
	cmp	x0, #0
	csel	x8, x9, x8, eq
	ldr	w8, [x19, x8]
	str	w8, [x19, #20]
	add	x0, sp, #8
	bl	_s3fwrn5_fw_is_custom
	mov	w20, #0
	cmp	x0, #0
	cset	w8, ne
	ldr	w8, [x19, w8, uxtw #2]
	str	w8, [x19, #16]
	b	LBB0_8
LBB0_4:
	mov	x20, x0
	ldr	x8, [x19, #32]
	ldr	x0, [x8]
	str	x20, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_8
LBB0_5:
	mov	x20, x0
	ldr	x8, [x19, #32]
	ldr	x0, [x8]
	str	x20, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	b	LBB0_7
LBB0_6:
	mov	x20, x0
	ldr	x8, [x19, #32]
	ldr	x0, [x8]
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
LBB0_7:
	mov	x0, x19
	bl	_s3fwrn5_fw_release_firmware
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get fw file, ret=%02x\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to get bootinfo, ret=%02x\n"

l_.str.2:                               ; @.str.2
	.asciz	"Unknown hardware version\n"

.subsections_via_symbols
