	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ibmvmc_rem_buffer
_ibmvmc_rem_buffer:                     ## @ibmvmc_rem_buffer
	.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
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	%rdi, %r15
	movq	(%rsi), %rbx
	movq	8(%rsi), %r13
	movq	_ibmvmc@GOTPCREL(%rip), %r14
	cmpq	(%r14), %r13
	jbe	LBB0_4
## %bb.3:
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdx
	callq	_dev_warn
	movl	$-1, %r14d
	movq	_VMC_MSG_INVALID_HMC_INDEX@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	jmp	LBB0_10
LBB0_1:
	movl	$-1, %r14d
	jmp	LBB0_11
LBB0_4:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_hmcs@GOTPCREL(%rip), %rax
	leaq	(,%r13,4), %rbx
	movq	(%rax), %rdi
	addq	%rbx, %rdi
	callq	_spin_lock_irqsave
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_ibmvmc_get_free_hmc_buffer
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r12
	movl	16(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	cmpq	$0, 8(%r12)
	je	LBB0_8
## %bb.7:
	movl	(%r15), %edi
	callq	_to_vio_dev
	movl	8(%r14), %esi
	movl	(%r12), %ecx
	movl	4(%r12), %edx
	movl	%eax, %edi
	callq	_free_dma_buffer
LBB0_8:
	xorl	%r14d, %r14d
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	_hmcs@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edx
	callq	_dev_dbg
	movq	_VMC_MSG_SUCCESS@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_5:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_info
	movq	_hmcs@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	_VMC_INVALID_BUFFER_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movl	$-1, %r14d
	movq	_VMC_MSG_NO_BUFFER@GOTPCREL(%rip), %rax
LBB0_9:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
LBB0_10:
	movl	(%rax), %esi
	movq	%r15, %rdi
	movq	%rbx, %rdx
	movq	%r13, %rcx
	movl	%r12d, %r8d
	callq	_ibmvmc_send_rem_buffer_resp
LBB0_11:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ibmvmc,16,3                    ## @ibmvmc
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rem_buffer: invalid hmc_index = 0x%x\n"

	.comm	_VMC_MSG_INVALID_HMC_INDEX,4,2  ## @VMC_MSG_INVALID_HMC_INDEX
	.comm	_hmcs,8,3                       ## @hmcs
L_.str.1:                               ## @.str.1
	.asciz	"rem_buffer: no buffer to remove\n"

	.comm	_VMC_MSG_NO_BUFFER,4,2          ## @VMC_MSG_NO_BUFFER
	.comm	_VMC_INVALID_BUFFER_ID,4,2      ## @VMC_INVALID_BUFFER_ID
L_.str.2:                               ## @.str.2
	.asciz	"rem_buffer: removed buffer 0x%x.\n"

	.comm	_VMC_MSG_SUCCESS,4,2            ## @VMC_MSG_SUCCESS
	.no_dead_strip	_ibmvmc_rem_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ibmvmc_rem_buffer
_ibmvmc_rem_buffer:                     ; @ibmvmc_rem_buffer
	.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
	cbz	x1, LBB0_3
; %bb.1:
	mov	x19, x0
	ldp	x20, x21, [x1]
Lloh0:
	adrp	x25, _ibmvmc@GOTPAGE
Lloh1:
	ldr	x25, [x25, _ibmvmc@GOTPAGEOFF]
	ldr	x8, [x25]
	cmp	x21, x8
	b.ls	LBB0_4
; %bb.2:
	ldr	w0, [x19]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	bl	_dev_warn
	mov	w22, #0
	mov	w23, #-1
Lloh4:
	adrp	x8, _VMC_MSG_INVALID_HMC_INDEX@GOTPAGE
Lloh5:
	ldr	x8, [x8, _VMC_MSG_INVALID_HMC_INDEX@GOTPAGEOFF]
	b	LBB0_9
LBB0_3:
	mov	w23, #-1
	b	LBB0_10
LBB0_4:
Lloh6:
	adrp	x24, _hmcs@GOTPAGE
Lloh7:
	ldr	x24, [x24, _hmcs@GOTPAGEOFF]
	ldr	x8, [x24]
	add	x0, x8, x21, lsl #2
	bl	_spin_lock_irqsave
	mov	x0, x19
	mov	x1, x21
	bl	_ibmvmc_get_free_hmc_buffer
	cbz	x0, LBB0_8
; %bb.5:
	mov	x23, x0
	ldr	w22, [x0, #16]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w0, [x19]
	bl	_to_vio_dev
	ldr	w1, [x25, #8]
	ldp	w3, w2, [x23]
	bl	_free_dma_buffer
LBB0_7:
	mov	x0, x23
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	ldr	x8, [x24]
	add	x0, x8, x21, lsl #2
	bl	_spin_unlock_irqrestore
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dev_dbg
	mov	w23, #0
Lloh10:
	adrp	x8, _VMC_MSG_SUCCESS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _VMC_MSG_SUCCESS@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
	ldr	w0, [x19]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
	ldr	x8, [x24]
	add	x0, x8, x21, lsl #2
	bl	_spin_unlock_irqrestore
Lloh14:
	adrp	x8, _VMC_INVALID_BUFFER_ID@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VMC_INVALID_BUFFER_ID@GOTPAGEOFF]
Lloh16:
	ldr	w22, [x8]
	mov	w23, #-1
Lloh17:
	adrp	x8, _VMC_MSG_NO_BUFFER@GOTPAGE
Lloh18:
	ldr	x8, [x8, _VMC_MSG_NO_BUFFER@GOTPAGEOFF]
LBB0_9:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	mov	x4, x22
	bl	_ibmvmc_send_rem_buffer_resp
LBB0_10:
	mov	x0, x23
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ibmvmc,16,3                    ; @ibmvmc
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rem_buffer: invalid hmc_index = 0x%x\n"

	.comm	_VMC_MSG_INVALID_HMC_INDEX,4,2  ; @VMC_MSG_INVALID_HMC_INDEX
	.comm	_hmcs,8,3                       ; @hmcs
l_.str.1:                               ; @.str.1
	.asciz	"rem_buffer: no buffer to remove\n"

	.comm	_VMC_MSG_NO_BUFFER,4,2          ; @VMC_MSG_NO_BUFFER
	.comm	_VMC_INVALID_BUFFER_ID,4,2      ; @VMC_INVALID_BUFFER_ID
l_.str.2:                               ; @.str.2
	.asciz	"rem_buffer: removed buffer 0x%x.\n"

	.comm	_VMC_MSG_SUCCESS,4,2            ; @VMC_MSG_SUCCESS
	.no_dead_strip	_ibmvmc_rem_buffer
.subsections_via_symbols
