	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s3fwrn5_i2c_set_mode
_s3fwrn5_i2c_set_mode:                  ## @s3fwrn5_i2c_set_mode
	.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
	movl	%esi, %r15d
	movq	%rdi, %rbx
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	cmpl	%r15d, (%rbx)
	je	LBB0_6
## %bb.1:
	movl	%r15d, (%rbx)
	movl	12(%rbx), %edi
	movl	$1, %esi
	callq	_gpio_set_value
	movl	16(%rbx), %edi
	xorl	%esi, %esi
	callq	_gpio_set_value
	movq	_S3FWRN5_MODE_FW@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_3
## %bb.2:
	movl	16(%rbx), %edi
	movl	$1, %esi
	callq	_gpio_set_value
LBB0_3:
	movq	_S3FWRN5_MODE_COLD@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	je	LBB0_5
## %bb.4:
	movq	_S3FWRN5_EN_WAIT_TIME@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_msleep
	movl	12(%rbx), %edi
	xorl	%esi, %esi
	callq	_gpio_set_value
	movl	(%r15), %eax
	movl	%eax, %edi
	shrl	$31, %edi
	addl	%eax, %edi
	sarl	%edi
	callq	_msleep
LBB0_5:
	movl	$1, 4(%rbx)
LBB0_6:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_S3FWRN5_MODE_FW,4,2            ## @S3FWRN5_MODE_FW
	.comm	_S3FWRN5_MODE_COLD,4,2          ## @S3FWRN5_MODE_COLD
	.comm	_S3FWRN5_EN_WAIT_TIME,4,2       ## @S3FWRN5_EN_WAIT_TIME
	.no_dead_strip	_s3fwrn5_i2c_set_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s3fwrn5_i2c_set_mode
_s3fwrn5_i2c_set_mode:                  ; @s3fwrn5_i2c_set_mode
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x21, x1
	mov	x20, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x20]
	cmp	w8, w21
	b.eq	LBB0_6
; %bb.1:
	str	w21, [x20]
	ldr	w0, [x20, #12]
	mov	w1, #1
	bl	_gpio_set_value
	ldr	w0, [x20, #16]
	mov	w1, #0
	bl	_gpio_set_value
Lloh0:
	adrp	x8, _S3FWRN5_MODE_FW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _S3FWRN5_MODE_FW@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_3
; %bb.2:
	ldr	w0, [x20, #16]
	mov	w1, #1
	bl	_gpio_set_value
LBB0_3:
Lloh3:
	adrp	x8, _S3FWRN5_MODE_COLD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _S3FWRN5_MODE_COLD@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w21
	b.eq	LBB0_5
; %bb.4:
Lloh6:
	adrp	x21, _S3FWRN5_EN_WAIT_TIME@GOTPAGE
Lloh7:
	ldr	x21, [x21, _S3FWRN5_EN_WAIT_TIME@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_msleep
	ldr	w0, [x20, #12]
	mov	w1, #0
	bl	_gpio_set_value
	ldr	w8, [x21]
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w0, w8, #1
	bl	_msleep
LBB0_5:
	mov	w8, #1
	str	w8, [x20, #4]
LBB0_6:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_mutex_unlock
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_S3FWRN5_MODE_FW,4,2            ; @S3FWRN5_MODE_FW
	.comm	_S3FWRN5_MODE_COLD,4,2          ; @S3FWRN5_MODE_COLD
	.comm	_S3FWRN5_EN_WAIT_TIME,4,2       ; @S3FWRN5_EN_WAIT_TIME
	.no_dead_strip	_s3fwrn5_i2c_set_mode
.subsections_via_symbols
