	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s5p_mfc_open_mfc_inst          ## -- Begin function s5p_mfc_open_mfc_inst
	.p2align	4, 0x90
_s5p_mfc_open_mfc_inst:                 ## @s5p_mfc_open_mfc_inst
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movl	8(%rdi), %edi
	movq	_alloc_instance_buffer@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdx
	callq	_s5p_mfc_hw_call
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	callq	_mfc_err
	jmp	LBB0_9
LBB0_2:
	movq	(%r15), %rax
	movq	_MFCINST_DECODER@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_5
## %bb.3:
	movl	8(%r14), %edi
	movq	_alloc_dec_temp_buffers@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdx
	callq	_s5p_mfc_hw_call
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	callq	_mfc_err
	jmp	LBB0_8
LBB0_5:
	movq	%r15, %rdi
	callq	_set_work_bit_irqsave
	movl	8(%r14), %edi
	movq	_try_run@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_s5p_mfc_hw_call
	movq	_S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_s5p_mfc_wait_for_done_ctx
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	leaq	L_.str.2(%rip), %rdi
	callq	_mfc_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movq	(%r15), %rax
	cmpq	(%r12), %rax
	jne	LBB0_8
## %bb.7:
	movl	8(%r14), %edi
	movq	_release_dec_desc_buffer@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdx
	callq	_s5p_mfc_hw_call
LBB0_8:
	movl	8(%r14), %edi
	movq	_release_instance_buffer@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdx
	callq	_s5p_mfc_hw_call
	jmp	LBB0_9
LBB0_10:
	movl	12(%r15), %edx
	leaq	L_.str.3(%rip), %rsi
	movl	$2, %edi
	callq	_mfc_debug
LBB0_9:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_alloc_instance_buffer,4,2      ## @alloc_instance_buffer
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed allocating instance buffer\n"

	.comm	_MFCINST_DECODER,8,3            ## @MFCINST_DECODER
	.comm	_alloc_dec_temp_buffers,4,2     ## @alloc_dec_temp_buffers
L_.str.1:                               ## @.str.1
	.asciz	"Failed allocating temporary buffers\n"

	.comm	_try_run,4,2                    ## @try_run
	.comm	_S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET,4,2 ## @S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET
L_.str.2:                               ## @.str.2
	.asciz	"Error getting instance from hardware\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	"Got instance number: %d\n"

	.comm	_release_dec_desc_buffer,4,2    ## @release_dec_desc_buffer
	.comm	_release_instance_buffer,4,2    ## @release_instance_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s5p_mfc_open_mfc_inst          ; -- Begin function s5p_mfc_open_mfc_inst
	.p2align	2
_s5p_mfc_open_mfc_inst:                 ; @s5p_mfc_open_mfc_inst
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	mov	x20, x0
	ldr	w0, [x0, #8]
Lloh0:
	adrp	x8, _alloc_instance_buffer@GOTPAGE
Lloh1:
	ldr	x8, [x8, _alloc_instance_buffer@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_mfc_err
	b	LBB0_10
LBB0_2:
	ldr	x8, [x19]
Lloh5:
	adrp	x22, _MFCINST_DECODER@GOTPAGE
Lloh6:
	ldr	x22, [x22, _MFCINST_DECODER@GOTPAGEOFF]
	ldr	x9, [x22]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	ldr	w0, [x20, #8]
Lloh7:
	adrp	x8, _alloc_dec_temp_buffers@GOTPAGE
Lloh8:
	ldr	x8, [x8, _alloc_dec_temp_buffers@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
	cbz	w0, LBB0_5
; %bb.4:
	mov	x21, x0
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_mfc_err
	b	LBB0_8
LBB0_5:
	mov	x0, x19
	bl	_set_work_bit_irqsave
	ldr	w0, [x20, #8]
Lloh12:
	adrp	x8, _try_run@GOTPAGE
Lloh13:
	ldr	x8, [x8, _try_run@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_s5p_mfc_hw_call
Lloh15:
	adrp	x8, _S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET@GOTPAGE
Lloh16:
	ldr	x8, [x8, _S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_s5p_mfc_wait_for_done_ctx
	cbz	x0, LBB0_9
; %bb.6:
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_mfc_err
Lloh20:
	adrp	x8, _EIO@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w21, w8
	ldr	x8, [x19]
	ldr	x9, [x22]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	ldr	w0, [x20, #8]
Lloh23:
	adrp	x8, _release_dec_desc_buffer@GOTPAGE
Lloh24:
	ldr	x8, [x8, _release_dec_desc_buffer@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
LBB0_8:
	ldr	w0, [x20, #8]
Lloh26:
	adrp	x8, _release_instance_buffer@GOTPAGE
Lloh27:
	ldr	x8, [x8, _release_instance_buffer@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
	b	LBB0_10
LBB0_9:
	ldr	w2, [x19, #12]
Lloh29:
	adrp	x1, l_.str.3@PAGE
Lloh30:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
	mov	w21, #0
LBB0_10:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_alloc_instance_buffer,4,2      ; @alloc_instance_buffer
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed allocating instance buffer\n"

	.comm	_MFCINST_DECODER,8,3            ; @MFCINST_DECODER
	.comm	_alloc_dec_temp_buffers,4,2     ; @alloc_dec_temp_buffers
l_.str.1:                               ; @.str.1
	.asciz	"Failed allocating temporary buffers\n"

	.comm	_try_run,4,2                    ; @try_run
	.comm	_S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET,4,2 ; @S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET
l_.str.2:                               ; @.str.2
	.asciz	"Error getting instance from hardware\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	"Got instance number: %d\n"

	.comm	_release_dec_desc_buffer,4,2    ; @release_dec_desc_buffer
	.comm	_release_instance_buffer,4,2    ; @release_instance_buffer
.subsections_via_symbols
