	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm32_fmc2_select_chip
_stm32_fmc2_select_chip:                ## @stm32_fmc2_select_chip
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	8(%rdi), %edi
	callq	_to_stm32_nfc
	movq	%rax, %r13
	movq	%r14, %rdi
	callq	_to_fmc2_nand
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movq	(%rax,%rcx,8), %rax
	xorl	%r15d, %r15d
	cmpq	(%r13), %rax
	je	LBB0_18
## %bb.1:
	movq	%rax, (%r13)
	movq	%r14, %rdi
	callq	_stm32_fmc2_setup
	movq	%r14, %rdi
	callq	_stm32_fmc2_timings_init
	cmpq	$0, 40(%r13)
	je	LBB0_8
## %bb.2:
	cmpq	$0, 32(%r13)
	je	LBB0_8
## %bb.3:
	leaq	-80(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	(%r13), %rax
	movq	48(%r13), %rcx
	movl	(%rcx,%rax,4), %edx
	movl	%edx, -64(%rbp)
	movl	(%rcx,%rax,4), %eax
	movl	%eax, -48(%rbp)
	movq	_DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -72(%rbp)
	movq	%rax, -56(%rbp)
	movabsq	$137438953504, %rax             ## imm = 0x2000000020
	movq	%rax, -80(%rbp)
	movq	40(%r13), %rdi
	movq	%rbx, %rsi
	callq	_dmaengine_slave_config
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	%eax, %r12d
	movl	12(%r13), %edi
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_5
LBB0_6:
	movq	32(%r13), %rdi
	leaq	-80(%rbp), %rsi
	callq	_dmaengine_slave_config
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %r12d
	movl	12(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
LBB0_5:
	callq	_dev_err
	movl	%r12d, %r15d
	jmp	LBB0_18
LBB0_8:
	cmpq	$0, 16(%r13)
	je	LBB0_18
## %bb.9:
	leaq	-80(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movl	24(%r13), %eax
	movq	(%r14), %rcx
	movq	_FMC2_ECC_HAM@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rcx
	jne	LBB0_10
## %bb.11:
	movq	_FMC2_HECCR@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_10:
	movq	_FMC2_BCHDSR0@GOTPCREL(%rip), %rcx
LBB0_12:
	addl	(%rcx), %eax
	movl	%eax, -64(%rbp)
	movq	_DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -72(%rbp)
	movq	16(%r13), %rdi
	movq	%r15, %rsi
	callq	_dmaengine_slave_config
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %r15d
	movl	12(%r13), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_18
LBB0_14:
	movq	(%r14), %rax
	cmpq	(%rbx), %rax
	jne	LBB0_15
## %bb.16:
	movq	_FMC2_HECCR_LEN@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_15:
	movq	_FMC2_BCHDSRS_LEN@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %eax
	movl	%eax, 8(%r13)
	xorl	%r15d, %r15d
LBB0_18:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ## @DMA_SLAVE_BUSWIDTH_4_BYTES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"tx DMA engine slave config failed\n"

L_.str.1:                               ## @.str.1
	.asciz	"rx DMA engine slave config failed\n"

	.comm	_FMC2_ECC_HAM,8,3               ## @FMC2_ECC_HAM
	.comm	_FMC2_HECCR,8,3                 ## @FMC2_HECCR
	.comm	_FMC2_BCHDSR0,8,3               ## @FMC2_BCHDSR0
L_.str.2:                               ## @.str.2
	.asciz	"ECC DMA engine slave config failed\n"

	.comm	_FMC2_HECCR_LEN,4,2             ## @FMC2_HECCR_LEN
	.comm	_FMC2_BCHDSRS_LEN,4,2           ## @FMC2_BCHDSRS_LEN
	.no_dead_strip	_stm32_fmc2_select_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm32_fmc2_select_chip
_stm32_fmc2_select_chip:                ; @stm32_fmc2_select_chip
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x21, x1
	mov	x20, x0
	ldr	w0, [x0, #8]
	bl	_to_stm32_nfc
	mov	x19, x0
	mov	x0, x20
	bl	_to_fmc2_nand
	ldr	x8, [x0]
	ldr	x8, [x8, w21, sxtw #3]
	ldr	x9, [x19]
	cmp	x8, x9
	b.ne	LBB0_3
LBB0_1:
	mov	w21, #0
LBB0_2:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_3:
	str	x8, [x19]
	mov	x0, x20
	bl	_stm32_fmc2_setup
	mov	x0, x20
	bl	_stm32_fmc2_timings_init
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_9
; %bb.4:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_9
; %bb.5:
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	ldr	x8, [x19]
	lsl	x8, x8, #2
	ldp	x0, x9, [x19, #40]
	ldr	w10, [x9, x8]
	str	w10, [sp, #24]
	ldr	w8, [x9, x8]
Lloh0:
	adrp	x9, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGEOFF]
	str	w8, [sp, #40]
Lloh2:
	ldr	x8, [x9]
	str	x8, [sp, #16]
	str	x8, [sp, #32]
	movi.2s	v0, #32
	str	d0, [sp, #8]
	add	x1, sp, #8
	bl	_dmaengine_slave_config
	cbz	w0, LBB0_7
; %bb.6:
	mov	x21, x0
	ldr	w0, [x19, #12]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_2
LBB0_7:
	ldr	x0, [x19, #32]
	add	x1, sp, #8
	bl	_dmaengine_slave_config
	cbz	w0, LBB0_9
; %bb.8:
	mov	x21, x0
	ldr	w0, [x19, #12]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_2
LBB0_9:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_1
; %bb.10:
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	ldr	w8, [x19, #24]
	ldr	x9, [x20]
Lloh7:
	adrp	x22, _FMC2_ECC_HAM@GOTPAGE
Lloh8:
	ldr	x22, [x22, _FMC2_ECC_HAM@GOTPAGEOFF]
	ldr	x10, [x22]
Lloh9:
	adrp	x11, _FMC2_HECCR@GOTPAGE
Lloh10:
	ldr	x11, [x11, _FMC2_HECCR@GOTPAGEOFF]
Lloh11:
	adrp	x12, _FMC2_BCHDSR0@GOTPAGE
Lloh12:
	ldr	x12, [x12, _FMC2_BCHDSR0@GOTPAGEOFF]
	cmp	x9, x10
	csel	x9, x11, x12, eq
	ldr	w9, [x9]
	add	w8, w8, w9
	str	w8, [sp, #24]
Lloh13:
	adrp	x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	str	x8, [sp, #16]
	ldr	x0, [x19, #16]
	add	x1, sp, #8
	bl	_dmaengine_slave_config
	mov	x21, x0
	cbz	w0, LBB0_12
; %bb.11:
	ldr	w0, [x19, #12]
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	b	LBB0_2
LBB0_12:
	ldr	x8, [x20]
	ldr	x9, [x22]
Lloh18:
	adrp	x10, _FMC2_HECCR_LEN@GOTPAGE
Lloh19:
	ldr	x10, [x10, _FMC2_HECCR_LEN@GOTPAGEOFF]
Lloh20:
	adrp	x11, _FMC2_BCHDSRS_LEN@GOTPAGE
Lloh21:
	ldr	x11, [x11, _FMC2_BCHDSRS_LEN@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x10, x11, eq
	ldr	w8, [x8]
	str	w8, [x19, #8]
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ; @DMA_SLAVE_BUSWIDTH_4_BYTES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"tx DMA engine slave config failed\n"

l_.str.1:                               ; @.str.1
	.asciz	"rx DMA engine slave config failed\n"

	.comm	_FMC2_ECC_HAM,8,3               ; @FMC2_ECC_HAM
	.comm	_FMC2_HECCR,8,3                 ; @FMC2_HECCR
	.comm	_FMC2_BCHDSR0,8,3               ; @FMC2_BCHDSR0
l_.str.2:                               ; @.str.2
	.asciz	"ECC DMA engine slave config failed\n"

	.comm	_FMC2_HECCR_LEN,4,2             ; @FMC2_HECCR_LEN
	.comm	_FMC2_BCHDSRS_LEN,4,2           ; @FMC2_BCHDSRS_LEN
	.no_dead_strip	_stm32_fmc2_select_chip
.subsections_via_symbols
