	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hipz_h_alloc_resource_cq       ## -- Begin function hipz_h_alloc_resource_cq
	.p2align	4, 0x90
_hipz_h_alloc_resource_cq:              ## @hipz_h_alloc_resource_cq
	.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	%rdx, %r13
	movq	%rsi, %r15
	movl	%edi, %r14d
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_PLPAR_HCALL9_BUFSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rbx
	movq	_H_ALLOC_RESOURCE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	16(%r13), %eax
	movl	20(%r13), %r8d
	movl	12(%r15), %r9d
	subq	$8, %rsp
	movq	%rbx, %rsi
	movl	%r14d, %edx
	movl	$2, %ecx
	pushq	$0
	pushq	$0
	pushq	$0
	pushq	$0
	pushq	%rax
	callq	_ehca_plpar_hcall9
	addq	$48, %rsp
	movl	%eax, %r12d
	movq	(%rbx), %rax
	movq	%rax, (%r15)
	movdqu	24(%rbx), %xmm0
	pshufd	$78, %xmm0, %xmm0               ## xmm0 = xmm0[2,3,0,1]
	movdqu	%xmm0, (%r13)
	movq	_H_SUCCESS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_3
## %bb.1:
	leaq	8(%r15), %rdi
	movq	40(%rbx), %rdx
	movq	48(%rbx), %rcx
	xorl	%esi, %esi
	callq	_hcp_galpas_ctor
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movq	40(%rbx), %rdx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_ehca_gen_err
	movq	_H_FREE_RESOURCE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r15), %rdx
	movl	%r14d, %esi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	$0
	pushq	$0
	callq	_ehca_plpar_hcall_norets
	addq	$16, %rsp
	movq	_H_NO_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_3:
	movq	_H_NOT_ENOUGH_RESOURCES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_5
## %bb.4:
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_ehca_gen_err
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_7
## %bb.6:
	movl	%r12d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PLPAR_HCALL9_BUFSIZE,4,2       ## @PLPAR_HCALL9_BUFSIZE
	.comm	_H_ALLOC_RESOURCE,4,2           ## @H_ALLOC_RESOURCE
	.comm	_H_SUCCESS,4,2                  ## @H_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not establish HW access. rc=%d paddr=%#lx"

	.comm	_H_FREE_RESOURCE,4,2            ## @H_FREE_RESOURCE
	.comm	_H_NO_MEM,4,2                   ## @H_NO_MEM
	.comm	_H_NOT_ENOUGH_RESOURCES,4,2     ## @H_NOT_ENOUGH_RESOURCES
L_.str.1:                               ## @.str.1
	.asciz	"Not enough resources. ret=%lli"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hipz_h_alloc_resource_cq       ; -- Begin function hipz_h_alloc_resource_cq
	.p2align	2
_hipz_h_alloc_resource_cq:              ; @hipz_h_alloc_resource_cq
	.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
	sub	sp, sp, #16
	mov	x23, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x8, _PLPAR_HCALL9_BUFSIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PLPAR_HCALL9_BUFSIZE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	x8, x8, #3
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x21, x9, x8
	mov	sp, x21
Lloh8:
	adrp	x8, _H_ALLOC_RESOURCE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _H_ALLOC_RESOURCE@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	ldr	w5, [x1, #12]
	ldp	w6, w4, [x2, #16]
	sub	sp, sp, #16
	str	wzr, [sp, #8]
	str	xzr, [sp]
	mov	x1, x21
	mov	x2, x19
	mov	w3, #2
	mov	w7, #0
	bl	_ehca_plpar_hcall9
	add	sp, sp, #16
	mov	x22, x0
	ldr	x8, [x21]
	str	x8, [x20]
	ldp	x8, x9, [x21, #24]
	stp	x9, x8, [x23]
Lloh11:
	adrp	x8, _H_SUCCESS@GOTPAGE
Lloh12:
	ldr	x8, [x8, _H_SUCCESS@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_3
; %bb.1:
	add	x0, x20, #8
	ldp	x2, x3, [x21, #40]
	mov	w1, #0
	bl	_hcp_galpas_ctor
	cbz	w0, LBB0_3
; %bb.2:
	mov	x1, x0
	ldr	x8, [x21, #40]
	str	x8, [sp, #-16]!
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ehca_gen_err
	add	sp, sp, #16
Lloh16:
	adrp	x8, _H_FREE_RESOURCE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _H_FREE_RESOURCE@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	ldr	x2, [x20]
	mov	x1, x19
	mov	w3, #0
	mov	w4, #0
	mov	w5, #0
	mov	w6, #0
	mov	w7, #0
	bl	_ehca_plpar_hcall_norets
Lloh19:
	adrp	x8, _H_NO_MEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _H_NO_MEM@GOTPAGEOFF]
Lloh21:
	ldr	w22, [x8]
LBB0_3:
Lloh22:
	adrp	x8, _H_NOT_ENOUGH_RESOURCES@GOTPAGE
Lloh23:
	ldr	x8, [x8, _H_NOT_ENOUGH_RESOURCES@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_5
; %bb.4:
Lloh25:
	adrp	x0, l_.str.1@PAGE
Lloh26:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x22
	bl	_ehca_gen_err
LBB0_5:
	ldur	x8, [x29, #-56]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x22
	sub	sp, x29, #48
	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
LBB0_7:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PLPAR_HCALL9_BUFSIZE,4,2       ; @PLPAR_HCALL9_BUFSIZE
	.comm	_H_ALLOC_RESOURCE,4,2           ; @H_ALLOC_RESOURCE
	.comm	_H_SUCCESS,4,2                  ; @H_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not establish HW access. rc=%d paddr=%#lx"

	.comm	_H_FREE_RESOURCE,4,2            ; @H_FREE_RESOURCE
	.comm	_H_NO_MEM,4,2                   ; @H_NO_MEM
	.comm	_H_NOT_ENOUGH_RESOURCES,4,2     ; @H_NOT_ENOUGH_RESOURCES
l_.str.1:                               ; @.str.1
	.asciz	"Not enough resources. ret=%lli"

.subsections_via_symbols
