	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vmci_ctx_enqueue_datagram      ## -- Begin function vmci_ctx_enqueue_datagram
	.p2align	4, 0x90
_vmci_ctx_enqueue_datagram:             ## @vmci_ctx_enqueue_datagram
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	%rsi, %rdi
	callq	_VMCI_DG_SIZE
	movq	%rax, %r13
	movq	_VMCI_MAX_DG_SIZE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r13
	jbe	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movq	%r13, %rsi
	jmp	LBB0_9
LBB0_2:
	movq	%r15, %rdi
	callq	_vmci_ctx_get
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movq	%rax, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_12
## %bb.4:
	movq	%rax, %r12
	movq	%rbx, 16(%rax)
	movq	%r13, (%rax)
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r12, %rbx
	addq	$8, %rbx
	movq	%rbx, %rdi
	callq	_INIT_LIST_HEAD
	leaq	8(%r14), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_spin_lock
	movq	(%r14), %rax
	addq	%r13, %rax
	movq	_VMCI_MAX_DATAGRAM_QUEUE_SIZE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jb	LBB0_7
## %bb.5:
	movq	_VMCI_HYPERVISOR_CONTEXT_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_VMCI_CONTEXT_RESOURCE_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_vmci_make_handle
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_vmci_handle_is_equal
	testl	%eax, %eax
	je	LBB0_13
## %bb.6:
	movq	(%r14), %rax
	addq	%r13, %rax
	movq	_VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jae	LBB0_13
LBB0_7:
	leaq	20(%r14), %rsi
	movq	%rbx, %rdi
	callq	_list_add
	incl	16(%r14)
	addq	%r13, (%r14)
	movq	%r14, %rdi
	callq	_ctx_signal_notify
	movq	%r14, %rdi
	addq	$12, %rdi
	callq	_wake_up
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	%r14, %rdi
	callq	_vmci_ctx_put
	jmp	LBB0_11
LBB0_8:
	leaq	L_.str.1(%rip), %rdi
	movq	%r15, %rsi
LBB0_9:
	callq	_pr_devel
	movq	_VMCI_ERROR_INVALID_ARGS@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %r13d
LBB0_11:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_warn
	movq	%r14, %rdi
	callq	_vmci_ctx_put
	movq	_VMCI_ERROR_NO_MEM@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_13:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	%r14, %rdi
	callq	_vmci_ctx_put
	movq	%r12, %rdi
	callq	_kfree
	leaq	L_.str.3(%rip), %rdi
	movq	%r15, %rsi
	callq	_pr_devel
	movq	_VMCI_ERROR_NO_RESOURCES@GOTPCREL(%rip), %rax
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_VMCI_MAX_DG_SIZE,8,3           ## @VMCI_MAX_DG_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Datagram too large (bytes=%zu)\n"

	.comm	_VMCI_ERROR_INVALID_ARGS,4,2    ## @VMCI_ERROR_INVALID_ARGS
L_.str.1:                               ## @.str.1
	.asciz	"Invalid context (ID=0x%x)\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"Failed to allocate memory for datagram\n"

	.comm	_VMCI_ERROR_NO_MEM,4,2          ## @VMCI_ERROR_NO_MEM
	.comm	_VMCI_MAX_DATAGRAM_QUEUE_SIZE,8,3 ## @VMCI_MAX_DATAGRAM_QUEUE_SIZE
	.comm	_VMCI_HYPERVISOR_CONTEXT_ID,4,2 ## @VMCI_HYPERVISOR_CONTEXT_ID
	.comm	_VMCI_CONTEXT_RESOURCE_ID,4,2   ## @VMCI_CONTEXT_RESOURCE_ID
	.comm	_VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE,8,3 ## @VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"Context (ID=0x%x) receive queue is full\n"

	.comm	_VMCI_ERROR_NO_RESOURCES,4,2    ## @VMCI_ERROR_NO_RESOURCES
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vmci_ctx_enqueue_datagram      ; -- Begin function vmci_ctx_enqueue_datagram
	.p2align	2
_vmci_ctx_enqueue_datagram:             ; @vmci_ctx_enqueue_datagram
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x22, x1
	mov	x21, x0
	mov	x0, x1
	bl	_VMCI_DG_SIZE
	mov	x19, x0
Lloh0:
	adrp	x8, _VMCI_MAX_DG_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VMCI_MAX_DG_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ls	LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	b	LBB0_9
LBB0_2:
	mov	x0, x21
	bl	_vmci_ctx_get
	cbz	x0, LBB0_8
; %bb.3:
	mov	x20, x0
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kmalloc
	cbz	x0, LBB0_12
; %bb.4:
	mov	x23, x0
	str	x22, [x0, #16]
	str	x19, [x0]
	ldr	w25, [x22]
	add	x24, x0, #8
	mov	x0, x24
	bl	_INIT_LIST_HEAD
	add	x22, x20, #8
	mov	x0, x22
	bl	_spin_lock
	ldr	x8, [x20]
Lloh8:
	adrp	x9, _VMCI_MAX_DATAGRAM_QUEUE_SIZE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _VMCI_MAX_DATAGRAM_QUEUE_SIZE@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x8, x8, x19
	cmp	x8, x9
	b.lo	LBB0_7
; %bb.5:
Lloh11:
	adrp	x8, _VMCI_HYPERVISOR_CONTEXT_ID@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VMCI_HYPERVISOR_CONTEXT_ID@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x8, _VMCI_CONTEXT_RESOURCE_ID@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VMCI_CONTEXT_RESOURCE_ID@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	bl	_vmci_make_handle
	mov	x1, x0
	mov	x0, x25
	bl	_vmci_handle_is_equal
	cbz	w0, LBB0_13
; %bb.6:
	ldr	x8, [x20]
Lloh17:
	adrp	x9, _VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	add	x8, x8, x19
	cmp	x8, x9
	b.hs	LBB0_13
LBB0_7:
	add	x1, x20, #20
	mov	x0, x24
	bl	_list_add
	ldr	w8, [x20, #16]
	add	w8, w8, #1
	str	w8, [x20, #16]
	ldr	x8, [x20]
	add	x8, x8, x19
	str	x8, [x20]
	mov	x0, x20
	bl	_ctx_signal_notify
	add	x0, x20, #12
	bl	_wake_up
	mov	x0, x22
	bl	_spin_unlock
	mov	x0, x20
	bl	_vmci_ctx_put
	b	LBB0_11
LBB0_8:
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
LBB0_9:
	bl	_pr_devel
Lloh22:
	adrp	x8, _VMCI_ERROR_INVALID_ARGS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _VMCI_ERROR_INVALID_ARGS@GOTPAGEOFF]
LBB0_10:
	ldr	w19, [x8]
LBB0_11:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_12:
Lloh24:
	adrp	x0, l_.str.2@PAGE
Lloh25:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_warn
	mov	x0, x20
	bl	_vmci_ctx_put
Lloh26:
	adrp	x8, _VMCI_ERROR_NO_MEM@GOTPAGE
Lloh27:
	ldr	x8, [x8, _VMCI_ERROR_NO_MEM@GOTPAGEOFF]
	b	LBB0_10
LBB0_13:
	mov	x0, x22
	bl	_spin_unlock
	mov	x0, x20
	bl	_vmci_ctx_put
	mov	x0, x23
	bl	_kfree
Lloh28:
	adrp	x0, l_.str.3@PAGE
Lloh29:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x21
	bl	_pr_devel
Lloh30:
	adrp	x8, _VMCI_ERROR_NO_RESOURCES@GOTPAGE
Lloh31:
	ldr	x8, [x8, _VMCI_ERROR_NO_RESOURCES@GOTPAGEOFF]
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_VMCI_MAX_DG_SIZE,8,3           ; @VMCI_MAX_DG_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Datagram too large (bytes=%zu)\n"

	.comm	_VMCI_ERROR_INVALID_ARGS,4,2    ; @VMCI_ERROR_INVALID_ARGS
l_.str.1:                               ; @.str.1
	.asciz	"Invalid context (ID=0x%x)\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"Failed to allocate memory for datagram\n"

	.comm	_VMCI_ERROR_NO_MEM,4,2          ; @VMCI_ERROR_NO_MEM
	.comm	_VMCI_MAX_DATAGRAM_QUEUE_SIZE,8,3 ; @VMCI_MAX_DATAGRAM_QUEUE_SIZE
	.comm	_VMCI_HYPERVISOR_CONTEXT_ID,4,2 ; @VMCI_HYPERVISOR_CONTEXT_ID
	.comm	_VMCI_CONTEXT_RESOURCE_ID,4,2   ; @VMCI_CONTEXT_RESOURCE_ID
	.comm	_VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE,8,3 ; @VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"Context (ID=0x%x) receive queue is full\n"

	.comm	_VMCI_ERROR_NO_RESOURCES,4,2    ; @VMCI_ERROR_NO_RESOURCES
.subsections_via_symbols
