	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s5p_mfc_init_hw                ## -- Begin function s5p_mfc_init_hw
	.p2align	4, 0x90
_s5p_mfc_init_hw:                       ## @s5p_mfc_init_hw
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_mfc_debug_enter
	cmpl	$0, 36(%r14)
	je	LBB0_1
## %bb.2:
	leaq	L_.str.1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	callq	_mfc_debug
	xorl	%eax, %eax
	callq	_s5p_mfc_clock_on
	movl	$0, (%r14)
	movq	%r14, %rdi
	callq	_s5p_mfc_reset
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_mfc_err
	jmp	LBB0_24
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_mfc_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_24
LBB0_4:
	leaq	L_.str.3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	callq	_mfc_debug
	movq	%r14, %rdi
	callq	_s5p_mfc_init_memctrl
	movq	%r14, %rdi
	callq	_s5p_mfc_clear_cmds
	movq	%r14, %rdi
	callq	_s5p_mfc_clean_dev_int_flags
	movq	%r14, %rdi
	callq	_IS_MFCV6_PLUS
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movl	$1, (%r14)
	movl	$1, %esi
	movq	_S5P_FIMV_RISC_ON_V6@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	movl	$1023, %esi                     ## imm = 0x3FF
	movq	_S5P_FIMV_SW_RESET@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mfc_write
	movq	%r14, %rdi
	callq	_IS_MFCV10
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	movq	_S5P_FIMV_MFC_CLOCK_OFF_V10@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_mfc_write
LBB0_9:
	leaq	L_.str.4(%rip), %rsi
	xorl	%ebx, %ebx
	movl	$2, %edi
	xorl	%eax, %eax
	callq	_mfc_debug
	movq	_S5P_MFC_R2H_CMD_FW_STATUS_RET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r14, %rdi
	callq	_s5p_mfc_wait_for_done_dev
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	leaq	L_.str.5(%rip), %rdi
LBB0_11:
	xorl	%eax, %eax
	callq	_mfc_err
LBB0_12:
	movq	%r14, %rdi
	callq	_s5p_mfc_reset
	xorl	%eax, %eax
	callq	_s5p_mfc_clock_off
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_24
LBB0_13:
	movq	%r14, %rdi
	callq	_s5p_mfc_clean_dev_int_flags
	movl	32(%r14), %edi
	movq	_sys_init_cmd@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_s5p_mfc_hw_call
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %ebx
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_mfc_err
	movq	%r14, %rdi
	callq	_s5p_mfc_reset
	xorl	%eax, %eax
	callq	_s5p_mfc_clock_off
LBB0_24:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	leaq	L_.str.7(%rip), %rsi
	xorl	%ebx, %ebx
	movl	$2, %edi
	xorl	%eax, %eax
	callq	_mfc_debug
	movq	_S5P_MFC_R2H_CMD_SYS_INIT_RET@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	movq	%r14, %rdi
	callq	_s5p_mfc_wait_for_done_dev
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:
	leaq	L_.str.8(%rip), %rdi
	jmp	LBB0_11
LBB0_17:
	movq	$0, 24(%r14)
	movq	8(%r14), %rsi
	movq	16(%r14), %rdx
	testq	%rsi, %rsi
	jne	LBB0_19
## %bb.18:
	cmpq	(%r15), %rdx
	jne	LBB0_19
## %bb.20:
	movq	%r14, %rdi
	callq	_IS_MFCV6_PLUS
	testq	%rax, %rax
	jne	LBB0_21
## %bb.22:
	movq	_S5P_FIMV_FW_VERSION@GOTPCREL(%rip), %rax
	jmp	LBB0_23
LBB0_19:
	leaq	L_.str.9(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_mfc_err
	jmp	LBB0_12
LBB0_21:
	movq	_S5P_FIMV_FW_VERSION_V6@GOTPCREL(%rip), %rax
LBB0_23:
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_mfc_read
	movzbl	%ah, %ecx
	movzbl	%al, %r8d
	shrl	$16, %eax
	movzbl	%al, %edx
	leaq	L_.str.10(%rip), %rsi
	xorl	%ebx, %ebx
	movl	$2, %edi
	xorl	%eax, %eax
	callq	_mfc_debug
	xorl	%eax, %eax
	callq	_s5p_mfc_clock_off
	xorl	%eax, %eax
	callq	_mfc_debug_leave
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Firmware memory is not allocated.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"MFC reset..\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to reset MFC - timeout\n"

L_.str.3:                               ## @.str.3
	.asciz	"Done MFC reset..\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_FIMV_MFC_CLOCK_OFF_V10,4,2 ## @S5P_FIMV_MFC_CLOCK_OFF_V10
L_.str.4:                               ## @.str.4
	.asciz	"Will now wait for completion of firmware transfer\n"

	.comm	_S5P_MFC_R2H_CMD_FW_STATUS_RET,8,3 ## @S5P_MFC_R2H_CMD_FW_STATUS_RET
L_.str.5:                               ## @.str.5
	.asciz	"Failed to load firmware\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_sys_init_cmd,4,2               ## @sys_init_cmd
L_.str.6:                               ## @.str.6
	.asciz	"Failed to send command to MFC - timeout\n"

L_.str.7:                               ## @.str.7
	.asciz	"Ok, now will wait for completion of hardware init\n"

	.comm	_S5P_MFC_R2H_CMD_SYS_INIT_RET,8,3 ## @S5P_MFC_R2H_CMD_SYS_INIT_RET
L_.str.8:                               ## @.str.8
	.asciz	"Failed to init hardware\n"

L_.str.9:                               ## @.str.9
	.asciz	"Failed to init firmware - error: %d int: %d\n"

	.comm	_S5P_FIMV_FW_VERSION_V6,4,2     ## @S5P_FIMV_FW_VERSION_V6
	.comm	_S5P_FIMV_FW_VERSION,4,2        ## @S5P_FIMV_FW_VERSION
L_.str.10:                              ## @.str.10
	.asciz	"MFC F/W version : %02xyy, %02xmm, %02xdd\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s5p_mfc_init_hw                ; -- Begin function s5p_mfc_init_hw
	.p2align	2
_s5p_mfc_init_hw:                       ; @s5p_mfc_init_hw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
	mov	x19, x0
	bl	_mfc_debug_enter
	ldr	w8, [x19, #36]
	cbz	w8, LBB0_3
; %bb.1:
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
	bl	_s5p_mfc_clock_on
	str	wzr, [x19]
	mov	x0, x19
	bl	_s5p_mfc_reset
	cbz	w0, LBB0_4
; %bb.2:
	mov	x20, x0
Lloh2:
	adrp	x0, l_.str.2@PAGE
Lloh3:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_mfc_err
	b	LBB0_13
LBB0_3:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_mfc_err
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_4:
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
	mov	x0, x19
	bl	_s5p_mfc_init_memctrl
	mov	x0, x19
	bl	_s5p_mfc_clear_cmds
	mov	x0, x19
	bl	_s5p_mfc_clean_dev_int_flags
	mov	x0, x19
	bl	_IS_MFCV6_PLUS
	cbz	x0, LBB0_6
; %bb.5:
	mov	w1, #1
	str	w1, [x19]
Lloh10:
	adrp	x8, _S5P_FIMV_RISC_ON_V6@GOTPAGE
Lloh11:
	ldr	x8, [x8, _S5P_FIMV_RISC_ON_V6@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
	mov	w1, #1023
Lloh12:
	adrp	x8, _S5P_FIMV_SW_RESET@GOTPAGE
Lloh13:
	ldr	x8, [x8, _S5P_FIMV_SW_RESET@GOTPAGEOFF]
LBB0_7:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mfc_write
	mov	x0, x19
	bl	_IS_MFCV10
	cbz	x0, LBB0_9
; %bb.8:
Lloh14:
	adrp	x8, _S5P_FIMV_MFC_CLOCK_OFF_V10@GOTPAGE
Lloh15:
	ldr	x8, [x8, _S5P_FIMV_MFC_CLOCK_OFF_V10@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_mfc_write
LBB0_9:
Lloh17:
	adrp	x1, l_.str.4@PAGE
Lloh18:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
Lloh19:
	adrp	x8, _S5P_MFC_R2H_CMD_FW_STATUS_RET@GOTPAGE
Lloh20:
	ldr	x8, [x8, _S5P_MFC_R2H_CMD_FW_STATUS_RET@GOTPAGEOFF]
Lloh21:
	ldr	x1, [x8]
	mov	x0, x19
	bl	_s5p_mfc_wait_for_done_dev
	cbz	x0, LBB0_14
; %bb.10:
Lloh22:
	adrp	x0, l_.str.5@PAGE
Lloh23:
	add	x0, x0, l_.str.5@PAGEOFF
LBB0_11:
	bl	_mfc_err
	mov	x0, x19
	bl	_s5p_mfc_reset
	bl	_s5p_mfc_clock_off
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_13:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_14:
	mov	x0, x19
	bl	_s5p_mfc_clean_dev_int_flags
	ldr	w0, [x19, #32]
Lloh26:
	adrp	x8, _sys_init_cmd@GOTPAGE
Lloh27:
	ldr	x8, [x8, _sys_init_cmd@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_s5p_mfc_hw_call
	cbz	w0, LBB0_16
; %bb.15:
	mov	x20, x0
Lloh29:
	adrp	x0, l_.str.6@PAGE
Lloh30:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_mfc_err
	mov	x0, x19
	bl	_s5p_mfc_reset
	bl	_s5p_mfc_clock_off
	b	LBB0_13
LBB0_16:
Lloh31:
	adrp	x1, l_.str.7@PAGE
Lloh32:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
Lloh33:
	adrp	x20, _S5P_MFC_R2H_CMD_SYS_INIT_RET@GOTPAGE
Lloh34:
	ldr	x20, [x20, _S5P_MFC_R2H_CMD_SYS_INIT_RET@GOTPAGEOFF]
	ldr	x1, [x20]
	mov	x0, x19
	bl	_s5p_mfc_wait_for_done_dev
	cbz	x0, LBB0_18
; %bb.17:
Lloh35:
	adrp	x0, l_.str.8@PAGE
Lloh36:
	add	x0, x0, l_.str.8@PAGEOFF
	b	LBB0_11
LBB0_18:
	str	xzr, [x19, #24]
	ldp	x8, x9, [x19, #8]
	cbnz	x8, LBB0_21
; %bb.19:
	ldr	x10, [x20]
	cmp	x9, x10
	b.ne	LBB0_21
; %bb.20:
	mov	x0, x19
	bl	_IS_MFCV6_PLUS
Lloh37:
	adrp	x8, _S5P_FIMV_FW_VERSION@GOTPAGE
Lloh38:
	ldr	x8, [x8, _S5P_FIMV_FW_VERSION@GOTPAGEOFF]
Lloh39:
	adrp	x9, _S5P_FIMV_FW_VERSION_V6@GOTPAGE
Lloh40:
	ldr	x9, [x9, _S5P_FIMV_FW_VERSION_V6@GOTPAGEOFF]
	cmp	x0, #0
	csel	x8, x8, x9, eq
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mfc_read
	ubfx	w8, w0, #16, #8
	ubfx	w9, w0, #8, #8
	and	w10, w0, #0xff
	stp	x9, x10, [sp, #8]
	str	x8, [sp]
Lloh41:
	adrp	x1, l_.str.10@PAGE
Lloh42:
	add	x1, x1, l_.str.10@PAGEOFF
	mov	w0, #2
	bl	_mfc_debug
	bl	_s5p_mfc_clock_off
	bl	_mfc_debug_leave
	mov	w20, #0
	b	LBB0_13
LBB0_21:
	stp	x8, x9, [sp]
Lloh43:
	adrp	x0, l_.str.9@PAGE
Lloh44:
	add	x0, x0, l_.str.9@PAGEOFF
	b	LBB0_11
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpLdrGot	Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpAdd	Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Firmware memory is not allocated.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"MFC reset..\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to reset MFC - timeout\n"

l_.str.3:                               ; @.str.3
	.asciz	"Done MFC reset..\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_FIMV_MFC_CLOCK_OFF_V10,4,2 ; @S5P_FIMV_MFC_CLOCK_OFF_V10
l_.str.4:                               ; @.str.4
	.asciz	"Will now wait for completion of firmware transfer\n"

	.comm	_S5P_MFC_R2H_CMD_FW_STATUS_RET,8,3 ; @S5P_MFC_R2H_CMD_FW_STATUS_RET
l_.str.5:                               ; @.str.5
	.asciz	"Failed to load firmware\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_sys_init_cmd,4,2               ; @sys_init_cmd
l_.str.6:                               ; @.str.6
	.asciz	"Failed to send command to MFC - timeout\n"

l_.str.7:                               ; @.str.7
	.asciz	"Ok, now will wait for completion of hardware init\n"

	.comm	_S5P_MFC_R2H_CMD_SYS_INIT_RET,8,3 ; @S5P_MFC_R2H_CMD_SYS_INIT_RET
l_.str.8:                               ; @.str.8
	.asciz	"Failed to init hardware\n"

l_.str.9:                               ; @.str.9
	.asciz	"Failed to init firmware - error: %d int: %d\n"

	.comm	_S5P_FIMV_FW_VERSION_V6,4,2     ; @S5P_FIMV_FW_VERSION_V6
	.comm	_S5P_FIMV_FW_VERSION,4,2        ; @S5P_FIMV_FW_VERSION
l_.str.10:                              ; @.str.10
	.asciz	"MFC F/W version : %02xyy, %02xmm, %02xdd\n"

.subsections_via_symbols
