	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s5p_mfc_wait_wakeup
_s5p_mfc_wait_wakeup:                   ## @s5p_mfc_wait_wakeup
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movl	4(%rdi), %edi
	movq	_wakeup_cmd@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %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_8
LBB0_2:
	movq	%r14, %rdi
	callq	_IS_MFCV6_PLUS
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movl	$1, (%r14)
	movl	$1, %esi
	movq	_S5P_FIMV_RISC_ON_V6@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movl	$1023, %esi                     ## imm = 0x3FF
	movq	_S5P_FIMV_SW_RESET@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mfc_write
	movq	_S5P_MFC_R2H_CMD_WAKEUP_RET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_s5p_mfc_wait_for_done_dev
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	callq	_mfc_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_6:
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_wakeup_cmd,4,2                 ## @wakeup_cmd
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to send command to MFC - timeout\n"

	.comm	_S5P_FIMV_RISC_ON_V6,4,2        ## @S5P_FIMV_RISC_ON_V6
	.comm	_S5P_FIMV_SW_RESET,4,2          ## @S5P_FIMV_SW_RESET
	.comm	_S5P_MFC_R2H_CMD_WAKEUP_RET,4,2 ## @S5P_MFC_R2H_CMD_WAKEUP_RET
L_.str.1:                               ## @.str.1
	.asciz	"Failed to wakeup MFC\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_s5p_mfc_wait_wakeup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s5p_mfc_wait_wakeup
_s5p_mfc_wait_wakeup:                   ; @s5p_mfc_wait_wakeup
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	w0, [x0, #4]
Lloh0:
	adrp	x8, _wakeup_cmd@GOTPAGE
Lloh1:
	ldr	x8, [x8, _wakeup_cmd@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_mfc_err
	b	LBB0_8
LBB0_2:
	mov	x0, x19
	bl	_IS_MFCV6_PLUS
	cbz	x0, LBB0_4
; %bb.3:
	mov	w1, #1
	str	w1, [x19]
Lloh5:
	adrp	x8, _S5P_FIMV_RISC_ON_V6@GOTPAGE
Lloh6:
	ldr	x8, [x8, _S5P_FIMV_RISC_ON_V6@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
	mov	w1, #1023
Lloh7:
	adrp	x8, _S5P_FIMV_SW_RESET@GOTPAGE
Lloh8:
	ldr	x8, [x8, _S5P_FIMV_SW_RESET@GOTPAGEOFF]
LBB0_5:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mfc_write
Lloh9:
	adrp	x8, _S5P_MFC_R2H_CMD_WAKEUP_RET@GOTPAGE
Lloh10:
	ldr	x8, [x8, _S5P_MFC_R2H_CMD_WAKEUP_RET@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_s5p_mfc_wait_for_done_dev
	cbz	x0, LBB0_7
; %bb.6:
Lloh12:
	adrp	x0, l_.str.1@PAGE
Lloh13:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_mfc_err
Lloh14:
	adrp	x8, _EIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_8
LBB0_7:
	mov	w20, #0
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_wakeup_cmd,4,2                 ; @wakeup_cmd
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to send command to MFC - timeout\n"

	.comm	_S5P_FIMV_RISC_ON_V6,4,2        ; @S5P_FIMV_RISC_ON_V6
	.comm	_S5P_FIMV_SW_RESET,4,2          ; @S5P_FIMV_SW_RESET
	.comm	_S5P_MFC_R2H_CMD_WAKEUP_RET,4,2 ; @S5P_MFC_R2H_CMD_WAKEUP_RET
l_.str.1:                               ; @.str.1
	.asciz	"Failed to wakeup MFC\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_s5p_mfc_wait_wakeup
.subsections_via_symbols
