	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehca_reg_mr_rpages             ## -- Begin function ehca_reg_mr_rpages
	.p2align	4, 0x90
_ehca_reg_mr_rpages:                    ## @ehca_reg_mr_rpages
	.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, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	cmpl	$0, (%rdx)
	je	LBB0_28
## %bb.1:
	movq	%rdx, %r13
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ehca_alloc_fw_ctrlblock
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_4
## %bb.2:
	movl	(%r13), %edi
	movq	_MAX_RPAGES@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_NUM_CHUNKS
	testl	%eax, %eax
	jle	LBB0_3
## %bb.5:
	xorl	%r12d, %r12d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_H_PAGE_REGISTERED@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r14
	jne	LBB0_21
LBB0_22:                                ##   in Loop: Header=BB0_6 Depth=1
	incl	%r12d
	movl	(%r13), %edi
	movl	(%rbx), %esi
	callq	_NUM_CHUNKS
	cmpl	%eax, %r12d
	jge	LBB0_23
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	movl	(%rbx), %esi
	callq	_NUM_CHUNKS
	decl	%eax
	cmpl	%eax, %r12d
	jne	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	(%r13), %eax
	movl	(%rbx), %r15d
	cltd
	idivl	%r15d
	testl	%edx, %edx
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	%edx, %r15d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	(%rbx), %r15d
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rdi
	movl	%r15d, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	callq	_ehca_set_pagebuf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	cmpl	$2, %r15d
	jl	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_virt_to_abs
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_16
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rbx
LBB0_16:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	8(%r13), %edi
	callq	_ehca_encode_hwpage_size
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	4(%rcx), %edi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	%eax, %edx
	xorl	%ecx, %ecx
	movq	%rbx, %r8
	movl	%r15d, %r9d
	callq	_hipz_h_register_rpage_mr
	movq	%rax, %r14
	movl	(%r13), %edi
	movq	_MAX_RPAGES@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_NUM_CHUNKS
	decl	%eax
	cmpl	%eax, %r12d
	jne	LBB0_20
## %bb.17:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_H_SUCCESS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r14
	je	LBB0_22
## %bb.18:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	4(%rdi), %r9d
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %r10d
	movl	4(%rcx), %ebx
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_19
LBB0_4:
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_ehca_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	testl	%r14d, %r14d
	jne	LBB0_27
	jmp	LBB0_28
LBB0_3:
	xorl	%r14d, %r14d
	jmp	LBB0_25
LBB0_11:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	movl	%r15d, %ecx
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	xorl	%eax, %eax
	callq	_ehca_err
	jmp	LBB0_24
LBB0_23:
	xorl	%r14d, %r14d
	jmp	LBB0_24
LBB0_21:
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %ebx
	movl	4(%rcx), %r9d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	4(%rdi), %r10d
	leaq	L_.str.4(%rip), %rsi
LBB0_19:
	movq	%r14, %rdx
	movl	%r12d, %r8d
	xorl	%eax, %eax
	pushq	%rbx
	pushq	%r10
	callq	_ehca_err
	addq	$16, %rsp
	movq	%r14, %rdi
	callq	_ehca2ib_return_code
	movl	%eax, %r14d
	jmp	LBB0_24
LBB0_14:
	leaq	L_.str.2(%rip), %rsi
	xorl	%r14d, %r14d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_ehca_err
	movq	_EFAULT@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_24:
	xorl	%r15d, %r15d
LBB0_25:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_ehca_free_fw_ctrlblock
	testl	%r14d, %r14d
	je	LBB0_28
LBB0_27:
	movl	(%r13), %ebx
	movl	4(%r13), %r10d
	leaq	L_.str.5(%rip), %rsi
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, %rdi
	movl	%r14d, %edx
	movq	-64(%rbp), %r8                  ## 8-byte Reload
	movq	%r13, %r9
	xorl	%eax, %eax
	pushq	%rbx
	pushq	%r10
	callq	_ehca_err
	addq	$16, %rsp
	movl	%r14d, %r15d
LBB0_28:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kpage alloc failed"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MAX_RPAGES,4,2                 ## @MAX_RPAGES
L_.str.1:                               ## @.str.1
	.asciz	"ehca_set_pagebuf bad rc, ret=%i rnum=%x kpage=%p"

L_.str.2:                               ## @.str.2
	.asciz	"kpage=%p i=%x"

	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_H_SUCCESS,8,3                  ## @H_SUCCESS
L_.str.3:                               ## @.str.3
	.asciz	"last hipz_reg_rpage_mr failed, h_ret=%lli e_mr=%p i=%x hca_hndl=%llx mr_hndl=%llx lkey=%x"

	.comm	_H_PAGE_REGISTERED,8,3          ## @H_PAGE_REGISTERED
L_.str.4:                               ## @.str.4
	.asciz	"hipz_reg_rpage_mr failed, h_ret=%lli e_mr=%p i=%x lkey=%x hca_hndl=%llx mr_hndl=%llx"

L_.str.5:                               ## @.str.5
	.asciz	"ret=%i shca=%p e_mr=%p pginfo=%p num_kpages=%llx num_hwpages=%llx"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehca_reg_mr_rpages             ; -- Begin function ehca_reg_mr_rpages
	.p2align	2
_ehca_reg_mr_rpages:                    ; @ehca_reg_mr_rpages
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	w8, [x2]
	cbz	w8, LBB0_16
; %bb.1:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_ehca_alloc_fw_ctrlblock
	cbz	x0, LBB0_17
; %bb.2:
	mov	x22, x0
	ldr	w0, [x21]
Lloh3:
	adrp	x26, _MAX_RPAGES@GOTPAGE
Lloh4:
	ldr	x26, [x26, _MAX_RPAGES@GOTPAGEOFF]
	ldr	w1, [x26]
	bl	_NUM_CHUNKS
	cmp	w0, #1
	b.lt	LBB0_18
; %bb.3:
	mov	w25, #0
Lloh5:
	adrp	x27, _H_SUCCESS@GOTPAGE
Lloh6:
	ldr	x27, [x27, _H_SUCCESS@GOTPAGEOFF]
Lloh7:
	adrp	x28, _H_PAGE_REGISTERED@GOTPAGE
Lloh8:
	ldr	x28, [x28, _H_PAGE_REGISTERED@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x28]
	cmp	x23, x8
	b.ne	LBB0_20
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	w25, w25, #1
	ldr	w0, [x21]
	ldr	w1, [x26]
	bl	_NUM_CHUNKS
	cmp	w25, w0
	b.ge	LBB0_18
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x21]
	ldr	w1, [x26]
	bl	_NUM_CHUNKS
	sub	w8, w0, #1
	cmp	w25, w8
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x21]
	ldr	w9, [x26]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	cmp	w8, #0
	csel	w24, w9, w8, eq
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	w24, [x26]
LBB0_9:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x21
	mov	x1, x24
	mov	x2, x22
	bl	_ehca_set_pagebuf
	cbnz	w0, LBB0_19
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	cmp	w24, #2
	b.lt	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	bl	_virt_to_abs
	mov	x23, x0
	cbnz	x0, LBB0_13
	b	LBB0_22
LBB0_12:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x23, [x22]
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x21, #8]
	bl	_ehca_encode_hwpage_size
	mov	x2, x0
	ldr	w0, [x19, #4]
	mov	x1, x20
	mov	w3, #0
	mov	x4, x23
	mov	x5, x24
	bl	_hipz_h_register_rpage_mr
	mov	x23, x0
	ldr	w0, [x21]
	ldr	w1, [x26]
	bl	_NUM_CHUNKS
	sub	w8, w0, #1
	cmp	w25, w8
	b.ne	LBB0_4
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x27]
	cmp	x23, x8
	b.eq	LBB0_5
; %bb.15:
	ldr	w8, [x19, #4]
	ldp	w9, w10, [x20]
	stp	x9, x10, [sp, #32]
                                        ; kill: def $w25 killed $w25 killed $x25 def $x25
	stp	x25, x8, [sp, #16]
	stp	x23, x20, [sp]
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_21
LBB0_16:
	mov	w23, #0
	b	LBB0_25
LBB0_17:
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w23, w8
	cbnz	w23, LBB0_24
	b	LBB0_25
LBB0_18:
	mov	w23, #0
	b	LBB0_23
LBB0_19:
	mov	x23, x0
	stp	x24, x22, [sp, #8]
	str	x23, [sp]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
	b	LBB0_23
LBB0_20:
	ldr	w8, [x19, #4]
	ldp	w10, w9, [x20]
	stp	x8, x10, [sp, #32]
                                        ; kill: def $w25 killed $w25 killed $x25 def $x25
	stp	x25, x9, [sp, #16]
	stp	x23, x20, [sp]
Lloh18:
	adrp	x1, l_.str.4@PAGE
Lloh19:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_21:
	mov	x0, x19
	bl	_ehca_err
	mov	x0, x23
	bl	_ehca2ib_return_code
	mov	x23, x0
	b	LBB0_23
LBB0_22:
	stp	x22, x25, [sp]
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
Lloh22:
	adrp	x8, _EFAULT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_23:
	mov	x0, x22
	bl	_ehca_free_fw_ctrlblock
	cbz	w23, LBB0_25
LBB0_24:
	ldp	w9, w8, [x21]
	stp	x8, x9, [sp, #32]
	stp	x20, x21, [sp, #16]
	mov	x8, x23
	stp	x8, x19, [sp]
Lloh25:
	adrp	x1, l_.str.5@PAGE
Lloh26:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
LBB0_25:
	mov	x0, x23
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kpage alloc failed"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MAX_RPAGES,4,2                 ; @MAX_RPAGES
l_.str.1:                               ; @.str.1
	.asciz	"ehca_set_pagebuf bad rc, ret=%i rnum=%x kpage=%p"

l_.str.2:                               ; @.str.2
	.asciz	"kpage=%p i=%x"

	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_H_SUCCESS,8,3                  ; @H_SUCCESS
l_.str.3:                               ; @.str.3
	.asciz	"last hipz_reg_rpage_mr failed, h_ret=%lli e_mr=%p i=%x hca_hndl=%llx mr_hndl=%llx lkey=%x"

	.comm	_H_PAGE_REGISTERED,8,3          ; @H_PAGE_REGISTERED
l_.str.4:                               ; @.str.4
	.asciz	"hipz_reg_rpage_mr failed, h_ret=%lli e_mr=%p i=%x lkey=%x hca_hndl=%llx mr_hndl=%llx"

l_.str.5:                               ; @.str.5
	.asciz	"ret=%i shca=%p e_mr=%p pginfo=%p num_kpages=%llx num_hwpages=%llx"

.subsections_via_symbols
