	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlcore_cmd_wait_for_event_or_timeout ## -- Begin function wlcore_cmd_wait_for_event_or_timeout
	.p2align	4, 0x90
_wlcore_cmd_wait_for_event_or_timeout:  ## @wlcore_cmd_wait_for_event_or_timeout
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r14
	movl	$0, (%rdx)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	_GFP_DMA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movl	$4, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r13
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_WL1271_EVENT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movq	%rax, %r12
	movl	(%r14), %edi
	callq	_pm_runtime_get_sync
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_7
## %bb.3:
	addq	%rbx, %r12
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	%r12, %rsi
	callq	_time_after
	testq	%rax, %rax
	je	LBB0_4
LBB0_9:
	movq	_DEBUG_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_wl1271_debug
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
LBB0_16:
	movl	(%r14), %edi
	callq	_pm_runtime_mark_last_busy
	movl	(%r14), %edi
	callq	_pm_runtime_put_autosuspend
	jmp	LBB0_17
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_18
LBB0_7:
	movl	(%r14), %edi
	callq	_pm_runtime_put_noidle
LBB0_17:
	movq	%r13, %rdi
	callq	_kfree
LBB0_18:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	$1, %ecx
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	_WL1271_WAIT_EVENT_FAST_POLL_COUNT@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	jge	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$50, %edi
	movl	$51, %esi
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	$1000, %edi                     ## imm = 0x3E8
	movl	$5000, %esi                     ## imm = 0x1388
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	callq	_usleep_range
	movq	8(%r14), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movq	%r13, %rdx
	movl	$4, %ecx
	xorl	%r8d, %r8d
	callq	_wlcore_read
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r13), %r12d
	movq	8(%r14), %rax
	movl	4(%rax), %esi
	movq	%r14, %rdi
	movq	%r13, %rdx
	movl	$4, %ecx
	xorl	%r8d, %r8d
	callq	_wlcore_read
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	%r14, %rbx
	movq	%r13, %r14
	orl	(%r13), %r12d
	testl	%r12d, -44(%rbp)                ## 4-byte Folded Reload
	jne	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_time_after
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	incq	%rcx
	testq	%rax, %rax
	movq	%r14, %r13
	movq	%rbx, %r14
	je	LBB0_5
	jmp	LBB0_9
LBB0_12:
	movl	%eax, %r15d
	jmp	LBB0_16
LBB0_15:
	movq	%r14, %r13
	movq	%rbx, %r14
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_GFP_DMA,4,2                    ## @GFP_DMA
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_WL1271_EVENT_TIMEOUT,4,2       ## @WL1271_EVENT_TIMEOUT
	.comm	_DEBUG_CMD,4,2                  ## @DEBUG_CMD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"timeout waiting for event %d"

	.comm	_WL1271_WAIT_EVENT_FAST_POLL_COUNT,8,3 ## @WL1271_WAIT_EVENT_FAST_POLL_COUNT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlcore_cmd_wait_for_event_or_timeout ; -- Begin function wlcore_cmd_wait_for_event_or_timeout
	.p2align	2
_wlcore_cmd_wait_for_event_or_timeout:  ; @wlcore_cmd_wait_for_event_or_timeout
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x2
	mov	x22, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
	str	wzr, [x2]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _GFP_DMA@GOTPAGE
Lloh4:
	ldr	x9, [x9, _GFP_DMA@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	w0, #4
	bl	_kmalloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
Lloh6:
	adrp	x25, _jiffies@GOTPAGE
Lloh7:
	ldr	x25, [x25, _jiffies@GOTPAGEOFF]
	ldr	x26, [x25]
Lloh8:
	adrp	x8, _WL1271_EVENT_TIMEOUT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _WL1271_EVENT_TIMEOUT@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	mov	x24, x0
	ldr	w0, [x20]
	bl	_pm_runtime_get_sync
	mov	x23, x0
	tbnz	w0, #31, LBB0_6
; %bb.2:
	add	x24, x24, x26
	ldr	x0, [x25]
	mov	x1, x24
	bl	_time_after
	cbz	x0, LBB0_9
LBB0_3:
Lloh11:
	adrp	x8, _DEBUG_CMD@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DEBUG_CMD@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	bl	_wl1271_debug
	mov	w8, #1
	str	w8, [x21]
LBB0_4:
	ldr	w0, [x20]
	bl	_pm_runtime_mark_last_busy
	ldr	w0, [x20]
	bl	_pm_runtime_put_autosuspend
	b	LBB0_7
LBB0_5:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_8
LBB0_6:
	ldr	w0, [x20]
	bl	_pm_runtime_put_noidle
LBB0_7:
	mov	x0, x19
	bl	_kfree
LBB0_8:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_9:
	mov	w26, #1
Lloh19:
	adrp	x27, _WL1271_WAIT_EVENT_FAST_POLL_COUNT@GOTPAGE
Lloh20:
	ldr	x27, [x27, _WL1271_WAIT_EVENT_FAST_POLL_COUNT@GOTPAGEOFF]
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x27]
	cmp	x26, x8
	b.ge	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	w0, #50
	mov	w1, #51
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	w0, #1000
	mov	w1, #5000
LBB0_13:                                ;   in Loop: Header=BB0_10 Depth=1
	bl	_usleep_range
	ldr	x8, [x20, #8]
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x19
	mov	w3, #4
	mov	w4, #0
	bl	_wlcore_read
	tbnz	w0, #31, LBB0_17
; %bb.14:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w28, [x19]
	ldr	x8, [x20, #8]
	ldr	w1, [x8, #4]
	mov	x0, x20
	mov	x2, x19
	mov	w3, #4
	mov	w4, #0
	bl	_wlcore_read
	mov	x23, x0
	tbnz	w0, #31, LBB0_4
; %bb.15:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x19]
	orr	w8, w8, w28
	tst	w8, w22
	b.ne	LBB0_4
; %bb.16:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x0, [x25]
	mov	x1, x24
	bl	_time_after
	add	x26, x26, #1
	cbz	x0, LBB0_10
	b	LBB0_3
LBB0_17:
	mov	x23, x0
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_GFP_DMA,4,2                    ; @GFP_DMA
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_WL1271_EVENT_TIMEOUT,4,2       ; @WL1271_EVENT_TIMEOUT
	.comm	_DEBUG_CMD,4,2                  ; @DEBUG_CMD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"timeout waiting for event %d"

	.comm	_WL1271_WAIT_EVENT_FAST_POLL_COUNT,8,3 ; @WL1271_WAIT_EVENT_FAST_POLL_COUNT
.subsections_via_symbols
