	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vc_vchi_msg_bulk_write
_vc_vchi_msg_bulk_write:                ## @vc_vchi_msg_bulk_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	%rcx, %r13
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	_FILESERV_MAX_BULK@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpq	%rdx, (%rax)
	setge	%dil
	callq	_vcos_verify
	movl	$-1, %ecx
	testl	%eax, %eax
	je	LBB0_18
## %bb.1:
	movq	_vc_filesys_client@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	incl	%eax
	andl	$2147483647, %eax               ## imm = 0x7FFFFFFF
	movl	%eax, (%r15)
	movl	%eax, (%r12)
	movq	%r14, 8(%r12)
	movq	16(%r12), %rax
	movq	%rbx, 16(%rax)
	movq	_FILESERV_MAX_DATA@GOTPCREL(%rip), %rax
	cmpq	%rbx, (%rax)
	jge	LBB0_6
## %bb.2:
	movq	%r13, %rdi
	callq	_VCHI_BULK_ALIGN_NBYTES
	movq	16(%r12), %rcx
	movq	$0, 24(%rcx)
	movq	_VCHI_BULK_GRANULARITY@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	subl	(%rcx), %edx
	movslq	%edx, %r14
	andq	%rbx, %r14
	movl	$24, %edx
	cmpq	%rbx, %r14
	je	LBB0_4
## %bb.3:
	subq	%r14, %rbx
	addq	24(%r12), %rax
	leaq	(,%r14,4), %rsi
	addq	%r13, %rsi
	movq	%rax, %rdi
	movq	%rbx, %rdx
	callq	_memcpy
	addl	$24, %ebx
	movslq	%ebx, %rdx
LBB0_4:
	movl	8(%r15), %edi
	movq	_VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	movq	%r12, %rsi
	xorl	%r8d, %r8d
	callq	_vchi_msg_queue
	testq	%rax, %rax
	jne	LBB0_17
## %bb.8:
	movl	8(%r15), %edi
	movl	(%rbx), %ecx
	movq	%r13, %rsi
	movq	%r14, %rdx
	xorl	%r8d, %r8d
	callq	_vchi_bulk_queue_transmit
	testq	%rax, %rax
	jne	LBB0_17
## %bb.14:
	addq	$4, %r15
	movq	%r15, %rdi
	callq	_vcos_event_wait
	movq	_VCOS_SUCCESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_17
## %bb.15:
	movq	8(%r12), %rax
	movq	_FILESERV_BULK_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$-1, %ecx
	jne	LBB0_18
## %bb.16:
	movq	16(%r12), %rax
	movl	(%rax), %ecx
	jmp	LBB0_18
LBB0_6:
	movq	24(%r12), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movq	16(%r12), %rax
	movq	$0, 24(%rax)
	movl	8(%r15), %edi
	leal	24(%rbx), %eax
	movslq	%eax, %rdx
	movq	_VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	xorl	%r8d, %r8d
	callq	_vchi_msg_queue
	testq	%rax, %rax
	jne	LBB0_17
## %bb.10:
	addq	$4, %r15
	movq	%r15, %rdi
	callq	_vcos_event_wait
	movq	_VCOS_SUCCESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_17
## %bb.11:
	movq	8(%r12), %rax
	movq	_FILESERV_RESP_ERROR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$-1, %ecx
	je	LBB0_18
## %bb.12:
	movq	16(%r12), %rax
	movq	(%rax), %rax
	cmpq	%rbx, %rax
	movl	$-1, %ecx
	cmovel	%eax, %ecx
	jmp	LBB0_18
LBB0_17:
	movl	$-1, %ecx
LBB0_18:
	movl	%ecx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FILESERV_MAX_BULK,8,3          ## @FILESERV_MAX_BULK
	.comm	_vc_filesys_client,12,2         ## @vc_filesys_client
	.comm	_FILESERV_MAX_DATA,8,3          ## @FILESERV_MAX_DATA
	.comm	_VCHI_FLAGS_BLOCK_UNTIL_QUEUED,4,2 ## @VCHI_FLAGS_BLOCK_UNTIL_QUEUED
	.comm	_VCOS_SUCCESS,8,3               ## @VCOS_SUCCESS
	.comm	_FILESERV_RESP_ERROR,8,3        ## @FILESERV_RESP_ERROR
	.comm	_VCHI_BULK_GRANULARITY,4,2      ## @VCHI_BULK_GRANULARITY
	.comm	_FILESERV_BULK_READ,8,3         ## @FILESERV_BULK_READ
	.no_dead_strip	_vc_vchi_msg_bulk_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vc_vchi_msg_bulk_write
_vc_vchi_msg_bulk_write:                ; @vc_vchi_msg_bulk_write
	.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	x21, x3
	mov	x20, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _FILESERV_MAX_BULK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FILESERV_MAX_BULK@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x2
	cset	w0, ge
	bl	_vcos_verify
	cbz	w0, LBB0_14
; %bb.1:
Lloh3:
	adrp	x23, _vc_filesys_client@GOTPAGE
Lloh4:
	ldr	x23, [x23, _vc_filesys_client@GOTPAGEOFF]
	ldr	w8, [x23]
	add	w8, w8, #1
	and	w8, w8, #0x7fffffff
	str	w8, [x23]
	str	w8, [x19]
	str	x22, [x19, #8]
	ldr	x8, [x19, #16]
	str	x20, [x8, #16]
Lloh5:
	adrp	x8, _FILESERV_MAX_DATA@GOTPAGE
Lloh6:
	ldr	x8, [x8, _FILESERV_MAX_DATA@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cmp	x8, x20
	b.ge	LBB0_4
; %bb.2:
	mov	x0, x21
	bl	_VCHI_BULK_ALIGN_NBYTES
	ldr	x8, [x19, #16]
Lloh8:
	adrp	x9, _VCHI_BULK_GRANULARITY@GOTPAGE
Lloh9:
	ldr	x9, [x9, _VCHI_BULK_GRANULARITY@GOTPAGEOFF]
	str	xzr, [x8, #24]
Lloh10:
	ldr	w8, [x9]
	neg	w8, w8
	sxtw	x8, w8
	and	x22, x8, x20
	cmp	x22, x20
	b.ne	LBB0_8
; %bb.3:
	mov	w2, #24
	b	LBB0_9
LBB0_4:
	ldr	x0, [x19, #24]
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	ldr	x8, [x19, #16]
	str	xzr, [x8, #24]
	ldr	w0, [x23, #8]
	add	w8, w20, #24
	sxtw	x2, w8
Lloh11:
	adrp	x8, _VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	mov	x1, x19
	mov	x4, #0
	bl	_vchi_msg_queue
	cbnz	x0, LBB0_14
; %bb.5:
	add	x0, x23, #4
	bl	_vcos_event_wait
Lloh14:
	adrp	x8, _VCOS_SUCCESS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VCOS_SUCCESS@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_14
; %bb.6:
	ldr	x8, [x19, #8]
Lloh17:
	adrp	x9, _FILESERV_RESP_ERROR@GOTPAGE
Lloh18:
	ldr	x9, [x9, _FILESERV_RESP_ERROR@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_14
; %bb.7:
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	cmp	x8, x20
	csinv	w0, w8, wzr, eq
	b	LBB0_15
LBB0_8:
	sub	x20, x20, x22
	ldr	x8, [x19, #24]
	add	x0, x8, x0
	add	x1, x21, x22, lsl #2
	mov	x2, x20
	bl	_memcpy
	add	w8, w20, #24
	sxtw	x2, w8
LBB0_9:
	ldr	w0, [x23, #8]
Lloh20:
	adrp	x20, _VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPAGE
Lloh21:
	ldr	x20, [x20, _VCHI_FLAGS_BLOCK_UNTIL_QUEUED@GOTPAGEOFF]
	ldr	w3, [x20]
	mov	x1, x19
	mov	x4, #0
	bl	_vchi_msg_queue
	cbnz	x0, LBB0_14
; %bb.10:
	ldr	w0, [x23, #8]
	ldr	w3, [x20]
	mov	x1, x21
	mov	x2, x22
	mov	x4, #0
	bl	_vchi_bulk_queue_transmit
	cbnz	x0, LBB0_14
; %bb.11:
	add	x0, x23, #4
	bl	_vcos_event_wait
Lloh22:
	adrp	x8, _VCOS_SUCCESS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _VCOS_SUCCESS@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_14
; %bb.12:
	ldr	x8, [x19, #8]
Lloh25:
	adrp	x9, _FILESERV_BULK_READ@GOTPAGE
Lloh26:
	ldr	x9, [x9, _FILESERV_BULK_READ@GOTPAGEOFF]
Lloh27:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.13:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	b	LBB0_15
LBB0_14:
	mov	w0, #-1
LBB0_15:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_FILESERV_MAX_BULK,8,3          ; @FILESERV_MAX_BULK
	.comm	_vc_filesys_client,12,2         ; @vc_filesys_client
	.comm	_FILESERV_MAX_DATA,8,3          ; @FILESERV_MAX_DATA
	.comm	_VCHI_FLAGS_BLOCK_UNTIL_QUEUED,4,2 ; @VCHI_FLAGS_BLOCK_UNTIL_QUEUED
	.comm	_VCOS_SUCCESS,8,3               ; @VCOS_SUCCESS
	.comm	_FILESERV_RESP_ERROR,8,3        ; @FILESERV_RESP_ERROR
	.comm	_VCHI_BULK_GRANULARITY,4,2      ; @VCHI_BULK_GRANULARITY
	.comm	_FILESERV_BULK_READ,8,3         ; @FILESERV_BULK_READ
	.no_dead_strip	_vc_vchi_msg_bulk_write
.subsections_via_symbols
