	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mip4_bl_change_mode
_mip4_bl_change_mode:                   ## @mip4_bl_change_mode
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r13d
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MIP4_R0_BOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)
	movq	_MIP4_R1_BOOT_MODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -56(%rbp)
	movl	%esi, -52(%rbp)
	movl	%eax, -68(%rbp)
	movl	%ecx, -64(%rbp)
	movl	$8, -128(%rbp)
	leaq	-68(%rbp), %rax
	movq	%rax, -120(%rbp)
	movl	$0, -112(%rbp)
	movq	(%rdi), %rdi
	movl	8(%rdi), %eax
	movl	%eax, -108(%rbp)
	movl	$4, -104(%rbp)
	leaq	-132(%rbp), %rcx
	movq	%rcx, -96(%rbp)
	movq	_I2C_M_RD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -88(%rbp)
	movl	%eax, -84(%rbp)
	leaq	-60(%rbp), %rsi
	movl	$12, %edx
	callq	_i2c_master_send
	cmpl	$12, %eax
	jne	LBB0_7
## %bb.1:
	movl	$-10, %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, -136(%rbp)                ## 4-byte Spill
	movq	(%r14), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_msleep
	movq	(%r14), %rax
	movl	%r13d, %ebx
	movl	4(%rax), %r15d
	leaq	-128(%rbp), %r12
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	movl	%r15d, %edi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_i2c_transfer
	movl	%eax, %r13d
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	cmpl	%eax, %r13d
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rdi
	movl	-132(%rbp), %edx
	xorl	%r15d, %r15d
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	cmpl	%ebx, -132(%rbp)
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, %r13d
	movl	-136(%rbp), %ebx                ## 4-byte Reload
	incl	%ebx
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rdi
	leaq	-60(%rbp), %rsi
	movl	$12, %edx
	callq	_i2c_master_send
	cmpl	$12, %eax
	je	LBB0_2
LBB0_7:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	subl	(%rcx), %r15d
	testl	%eax, %eax
	cmovsl	%eax, %r15d
	movq	(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_dev_err
LBB0_9:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_11
## %bb.10:
	movl	%r15d, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	testl	%r13d, %r13d
	cmovsl	%r13d, %r15d
	movq	(%r14), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_9
LBB0_8:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_9
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MIP4_R0_BOOT,4,2               ## @MIP4_R0_BOOT
	.comm	_MIP4_R1_BOOT_MODE,4,2          ## @MIP4_R1_BOOT_MODE
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to send %d mode change: %d (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Sent mode change request (mode: %d)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to read device mode: %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Current device mode: %d, want: %d\n"

	.no_dead_strip	_mip4_bl_change_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mip4_bl_change_mode
_mip4_bl_change_mode:                   ; @mip4_bl_change_mode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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
	mov	x19, x1
	mov	x20, 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, _MIP4_R0_BOOT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MIP4_R0_BOOT@GOTPAGEOFF]
Lloh5:
	adrp	x9, _MIP4_R1_BOOT_MODE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MIP4_R1_BOOT_MODE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
Lloh8:
	ldr	w9, [x9]
	stp	w8, w9, [x29, #-68]
	stur	w1, [x29, #-60]
	stp	w8, w9, [x29, #-76]
	mov	w8, #8
	str	w8, [sp, #32]
	sub	x8, x29, #76
	str	x8, [sp, #40]
	str	wzr, [sp, #48]
	ldr	x0, [x0]
	ldr	w8, [x0, #8]
	mov	w9, #4
	stp	w8, w9, [sp, #52]
	add	x9, sp, #28
	str	x9, [sp, #64]
Lloh9:
	adrp	x9, _I2C_M_RD@GOTPAGE
Lloh10:
	ldr	x9, [x9, _I2C_M_RD@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #72]
	sub	x1, x29, #68
	mov	w2, #12
	bl	_i2c_master_send
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w0, #12
	b.ne	LBB0_6
; %bb.1:
	mov	w24, #-10
Lloh12:
	adrp	x21, l_.str.1@PAGE
Lloh13:
	add	x21, x21, l_.str.1@PAGEOFF
Lloh14:
	adrp	x22, l_.str.3@PAGE
Lloh15:
	add	x22, x22, l_.str.3@PAGEOFF
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x20]
	mov	x1, x21
	mov	x2, x19
	bl	_dev_dbg
	mov	w0, #1000
	bl	_msleep
	ldr	x8, [x20]
	ldr	w23, [x8, #4]
	add	x0, sp, #32
	bl	_ARRAY_SIZE
	mov	x2, x0
	add	x1, sp, #32
	mov	x0, x23
	bl	_i2c_transfer
	mov	x23, x0
	add	x0, sp, #32
	bl	_ARRAY_SIZE
	cmp	w23, w0
	b.ne	LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20]
	ldr	w2, [sp, #28]
	str	x19, [sp]
	mov	x1, x22
	bl	_dev_dbg
	ldr	w8, [sp, #28]
	cmp	w8, w19
	b.eq	LBB0_11
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	adds	w24, w24, #1
	b.hs	LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20]
	sub	x1, x29, #68
	mov	w2, #12
	bl	_i2c_master_send
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w0, #12
	b.eq	LBB0_2
LBB0_6:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w21, w0, w8, lt
	ldr	x8, [x20]
	stp	x21, x0, [sp]
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	mov	x2, x19
LBB0_7:
	bl	_dev_err
LBB0_8:
	ldur	x8, [x29, #-56]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.9:
	mov	x0, x21
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_10:
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	cmp	w23, #0
	csneg	w21, w23, w8, lt
	ldr	x0, [x20]
Lloh27:
	adrp	x1, l_.str.2@PAGE
Lloh28:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x21
	b	LBB0_7
LBB0_11:
	mov	w21, #0
	b	LBB0_8
LBB0_12:
Lloh29:
	adrp	x8, _EIO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_8
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_MIP4_R0_BOOT,4,2               ; @MIP4_R0_BOOT
	.comm	_MIP4_R1_BOOT_MODE,4,2          ; @MIP4_R1_BOOT_MODE
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to send %d mode change: %d (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Sent mode change request (mode: %d)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to read device mode: %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Current device mode: %d, want: %d\n"

	.no_dead_strip	_mip4_bl_change_mode
.subsections_via_symbols
