	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ipw_write
_ipw_write:                             ## @ipw_write
	.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
	movq	(%rdi), %r12
	testq	%r12, %r12
	je	LBB0_1
## %bb.3:
	movl	%edx, %r15d
	movq	%rsi, %rbx
	leaq	4(%r12), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	cmpl	$0, 12(%r12)
	je	LBB0_4
## %bb.5:
	movq	%rbx, %rdx
	movq	_IPWIRELESS_TX_QUEUE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	subl	(%r12), %ebx
	xorl	%r13d, %r13d
	testl	%ebx, %ebx
	cmovlel	%r13d, %ebx
	cmpl	%r15d, %ebx
	cmovgel	%r15d, %ebx
	testl	%ebx, %ebx
	je	LBB0_6
## %bb.7:
	movl	8(%r12), %edi
	movq	_IPW_CHANNEL_RAS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ipw_write_packet_sent_callback@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	%ebx, %ecx
	movq	%r12, %r9
	callq	_ipwireless_send_packet
	cmpl	$-1, %eax
	je	LBB0_8
## %bb.9:
	addl	%ebx, (%r12)
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %r13d
	jmp	LBB0_10
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_10:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%r14, %rdi
	callq	_mutex_unlock
	jmp	LBB0_10
LBB0_8:
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%r13d, %r13d
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IPWIRELESS_TX_QUEUE_SIZE,4,2   ## @IPWIRELESS_TX_QUEUE_SIZE
	.comm	_IPW_CHANNEL_RAS,4,2            ## @IPW_CHANNEL_RAS
	.comm	_ipw_write_packet_sent_callback,4,2 ## @ipw_write_packet_sent_callback
	.no_dead_strip	_ipw_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ipw_write
_ipw_write:                             ; @ipw_write
	.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
	ldr	x20, [x0]
	cbz	x20, LBB0_6
; %bb.1:
	mov	x21, x2
	mov	x22, x1
	add	x19, x20, #4
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x20, #12]
	cbz	w8, LBB0_7
; %bb.2:
Lloh0:
	adrp	x8, _IPWIRELESS_TX_QUEUE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IPWIRELESS_TX_QUEUE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x20]
	sub	w8, w8, w9
	cmp	w8, #0
	csel	w8, w8, wzr, gt
	cmp	w8, w21
	csel	w21, w8, w21, lt
	cbz	w21, LBB0_5
; %bb.3:
	ldr	w0, [x20, #8]
Lloh3:
	adrp	x8, _IPW_CHANNEL_RAS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IPW_CHANNEL_RAS@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x8, _ipw_write_packet_sent_callback@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ipw_write_packet_sent_callback@GOTPAGEOFF]
Lloh8:
	ldr	w4, [x8]
	mov	x2, x22
	mov	x3, x21
	mov	x5, x20
	bl	_ipwireless_send_packet
	cmn	w0, #1
	b.eq	LBB0_10
; %bb.4:
	ldr	w8, [x20]
	add	w8, w8, w21
	str	w8, [x20]
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_9
LBB0_6:
Lloh9:
	adrp	x8, _ENODEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
	mov	x0, x19
	bl	_mutex_unlock
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_9:
	mov	x0, x21
	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
	ret
LBB0_10:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w21, #0
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IPWIRELESS_TX_QUEUE_SIZE,4,2   ; @IPWIRELESS_TX_QUEUE_SIZE
	.comm	_IPW_CHANNEL_RAS,4,2            ; @IPW_CHANNEL_RAS
	.comm	_ipw_write_packet_sent_callback,4,2 ; @ipw_write_packet_sent_callback
	.no_dead_strip	_ipw_write
.subsections_via_symbols
