	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cuda_write
_cuda_write:                            ## @cuda_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	cmpl	$2, (%rdi)
	jl	LBB0_2
## %bb.1:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	movq	_CUDA_PACKET@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_3
LBB0_2:
	movl	$1, 16(%rbx)
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_8
LBB0_3:
	movl	$0, 16(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 24(%rbx)
	movq	$0, 40(%rbx)
	movq	_cuda_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movq	_current_req@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_5
## %bb.4:
	movq	_last_req@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%rbx, 24(%rcx)
	movq	%rbx, (%rax)
	jmp	LBB0_7
LBB0_5:
	movq	%rbx, (%rax)
	movq	_last_req@GOTPCREL(%rip), %rax
	movq	%rbx, (%rax)
	movq	_cuda_state@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_idle@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.6:
	xorl	%eax, %eax
	callq	_cuda_start
LBB0_7:
	movq	_cuda_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	xorl	%eax, %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CUDA_PACKET,8,3                ## @CUDA_PACKET
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_cuda_lock,4,2                  ## @cuda_lock
	.comm	_current_req,8,3                ## @current_req
	.comm	_last_req,8,3                   ## @last_req
	.comm	_cuda_state,8,3                 ## @cuda_state
	.comm	_idle,8,3                       ## @idle
	.no_dead_strip	_cuda_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cuda_write
_cuda_write:                            ; @cuda_write
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	w8, [x0]
	cmp	w8, #2
	b.lt	LBB0_2
; %bb.1:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
Lloh0:
	adrp	x9, _CUDA_PACKET@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CUDA_PACKET@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.le	LBB0_3
LBB0_2:
	mov	w8, #1
	str	w8, [x19, #16]
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_8
LBB0_3:
	str	wzr, [x19, #16]
	stp	xzr, xzr, [x19, #32]
	str	xzr, [x19, #24]
Lloh6:
	adrp	x0, _cuda_lock@GOTPAGE
Lloh7:
	ldr	x0, [x0, _cuda_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
Lloh8:
	adrp	x8, _current_req@GOTPAGE
Lloh9:
	ldr	x8, [x8, _current_req@GOTPAGEOFF]
	ldr	x9, [x8]
	cbz	x9, LBB0_5
; %bb.4:
Lloh10:
	adrp	x8, _last_req@GOTPAGE
Lloh11:
	ldr	x8, [x8, _last_req@GOTPAGEOFF]
	ldr	x9, [x8]
	str	x19, [x9, #24]
	str	x19, [x8]
	b	LBB0_7
LBB0_5:
	str	x19, [x8]
Lloh12:
	adrp	x8, _last_req@GOTPAGE
Lloh13:
	ldr	x8, [x8, _last_req@GOTPAGEOFF]
Lloh14:
	adrp	x9, _cuda_state@GOTPAGE
Lloh15:
	ldr	x9, [x9, _cuda_state@GOTPAGEOFF]
Lloh16:
	str	x19, [x8]
Lloh17:
	ldr	x8, [x9]
Lloh18:
	adrp	x9, _idle@GOTPAGE
Lloh19:
	ldr	x9, [x9, _idle@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	bl	_cuda_start
LBB0_7:
Lloh21:
	adrp	x0, _cuda_lock@GOTPAGE
Lloh22:
	ldr	x0, [x0, _cuda_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	mov	w0, #0
LBB0_8:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh17
	.loh AdrpLdrGotStr	Lloh12, Lloh13, Lloh16
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_CUDA_PACKET,8,3                ; @CUDA_PACKET
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_cuda_lock,4,2                  ; @cuda_lock
	.comm	_current_req,8,3                ; @current_req
	.comm	_last_req,8,3                   ; @last_req
	.comm	_cuda_state,8,3                 ; @cuda_state
	.comm	_idle,8,3                       ; @idle
	.no_dead_strip	_cuda_write
.subsections_via_symbols
