	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sirf_set_active
_sirf_set_active:                       ## @sirf_set_active
	.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, %r14d
	movq	%rdi, %r12
	testl	%esi, %esi
	jne	LBB0_1
## %bb.2:
	movq	_SIRF_HIBERNATE_TIMEOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_SIRF_ACTIVATE_TIMEOUT@GOTPCREL(%rip), %rax
LBB0_3:
	movq	(%rax), %r15
	cmpl	$0, (%r12)
	je	LBB0_4
LBB0_5:
	movl	$-3, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_sirf_pulse_on_off
	movq	%r12, %rdi
	movl	%r14d, %esi
	movq	%r15, %rdx
	callq	_sirf_wait_for_power_state
	movl	%eax, %ebx
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	leal	1(%r13), %eax
	testl	%r13d, %r13d
	movl	%eax, %r13d
	jne	LBB0_6
LBB0_8:
	cmpl	$0, (%r12)
	jne	LBB0_10
## %bb.9:
	movq	%r12, %rdi
	callq	_sirf_serdev_close
	jmp	LBB0_10
LBB0_4:
	movq	%r12, %rdi
	callq	_sirf_serdev_open
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_5
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SIRF_ACTIVATE_TIMEOUT,8,3      ## @SIRF_ACTIVATE_TIMEOUT
	.comm	_SIRF_HIBERNATE_TIMEOUT,8,3     ## @SIRF_HIBERNATE_TIMEOUT
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_sirf_set_active
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sirf_set_active
_sirf_set_active:                       ; @sirf_set_active
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _SIRF_HIBERNATE_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SIRF_HIBERNATE_TIMEOUT@GOTPAGEOFF]
Lloh2:
	adrp	x9, _SIRF_ACTIVATE_TIMEOUT@GOTPAGE
Lloh3:
	ldr	x9, [x9, _SIRF_ACTIVATE_TIMEOUT@GOTPAGEOFF]
	cmp	w1, #0
	csel	x8, x8, x9, eq
	ldr	x21, [x8]
	ldr	w8, [x0]
	cbz	w8, LBB0_7
LBB0_1:
	mov	x0, x19
	bl	_sirf_pulse_on_off
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_sirf_wait_for_power_state
	mov	x22, x0
Lloh4:
	adrp	x23, _ETIMEDOUT@GOTPAGE
Lloh5:
	ldr	x23, [x23, _ETIMEDOUT@GOTPAGEOFF]
	ldr	w8, [x23]
	cmn	w0, w8
	b.ne	LBB0_5
; %bb.2:
	mov	x0, x19
	bl	_sirf_pulse_on_off
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_sirf_wait_for_power_state
	mov	x22, x0
	ldr	w8, [x23]
	cmn	w0, w8
	b.ne	LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_sirf_pulse_on_off
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_sirf_wait_for_power_state
	mov	x22, x0
	ldr	w8, [x23]
	cmn	w0, w8
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_sirf_pulse_on_off
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_sirf_wait_for_power_state
	mov	x22, x0
LBB0_5:
	ldr	w8, [x19]
	cbnz	w8, LBB0_8
; %bb.6:
	mov	x0, x19
	bl	_sirf_serdev_close
	b	LBB0_8
LBB0_7:
	mov	x0, x19
	bl	_sirf_serdev_open
	mov	x22, x0
	cbz	w0, LBB0_1
LBB0_8:
	mov	x0, x22
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_SIRF_ACTIVATE_TIMEOUT,8,3      ; @SIRF_ACTIVATE_TIMEOUT
	.comm	_SIRF_HIBERNATE_TIMEOUT,8,3     ; @SIRF_HIBERNATE_TIMEOUT
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_sirf_set_active
.subsections_via_symbols
