	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function load_twl4030_script
_load_twl4030_script:                   ## @load_twl4030_script
	.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	%rdx, %r14
	movq	(%rsi), %rdx
	leaq	(%rdx,%r14), %rax
	movq	_END_OF_SCRIPT@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jle	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_2
LBB0_3:
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movl	12(%rsi), %esi
	movq	%r14, %rdi
	callq	_twl4030_write_script
	testl	%eax, %eax
	je	LBB0_4
LBB0_2:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	8(%rbx), %eax
	movq	_TWL4030_WRST_SCRIPT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.5:
	movq	%r14, %rdi
	callq	_twl4030_config_warmreset_sequence
	testl	%eax, %eax
	jne	LBB0_2
## %bb.6:
	movl	8(%rbx), %eax
LBB0_7:
	movq	_TWL4030_WAKEUP12_SCRIPT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.8:
	movq	_TWL_MODULE_PM_MASTER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rsi
	movq	_R_SEQ_ADD_A2S@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_twl_i2c_write_u8
	testl	%eax, %eax
	jne	LBB0_2
## %bb.9:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_twl4030_config_wakeup12_sequence
	testl	%eax, %eax
	jne	LBB0_2
## %bb.10:
	movb	$1, _load_twl4030_script.order(%rip)
	movl	8(%rbx), %eax
LBB0_11:
	movq	_TWL4030_WAKEUP3_SCRIPT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_14
## %bb.12:
	movq	%r14, %rdi
	callq	_twl4030_config_wakeup3_sequence
	testl	%eax, %eax
	jne	LBB0_2
## %bb.13:
	movl	8(%rbx), %eax
LBB0_14:
	movq	_TWL4030_SLEEP_SCRIPT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_15
## %bb.16:
	cmpb	$0, _load_twl4030_script.order(%rip)
	jne	LBB0_18
## %bb.17:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_warn
LBB0_18:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_twl4030_config_sleep_sequence  ## TAILCALL
LBB0_15:
	xorl	%eax, %eax
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_load_twl4030_script.order,1,2 ## @load_twl4030_script.order
	.comm	_END_OF_SCRIPT,8,3              ## @END_OF_SCRIPT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"TWL4030 scripts too big error\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TWL4030_WRST_SCRIPT,4,2        ## @TWL4030_WRST_SCRIPT
	.comm	_TWL4030_WAKEUP12_SCRIPT,4,2    ## @TWL4030_WAKEUP12_SCRIPT
	.comm	_TWL_MODULE_PM_MASTER,4,2       ## @TWL_MODULE_PM_MASTER
	.comm	_R_SEQ_ADD_A2S,4,2              ## @R_SEQ_ADD_A2S
	.comm	_TWL4030_WAKEUP3_SCRIPT,4,2     ## @TWL4030_WAKEUP3_SCRIPT
	.comm	_TWL4030_SLEEP_SCRIPT,4,2       ## @TWL4030_SLEEP_SCRIPT
L_.str.1:                               ## @.str.1
	.asciz	"TWL4030: Bad order of scripts (sleep script before wakeup) Leads to boot failure on some boards\n"

	.no_dead_strip	_load_twl4030_script
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function load_twl4030_script
_load_twl4030_script:                   ; @load_twl4030_script
	.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, x2
	ldr	x2, [x1]
Lloh0:
	adrp	x22, _END_OF_SCRIPT@GOTPAGE
Lloh1:
	ldr	x22, [x22, _END_OF_SCRIPT@GOTPAGEOFF]
	ldr	x8, [x22]
	add	x9, x2, x19
	cmp	x9, x8
	b.le	LBB0_2
; %bb.1:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_3
LBB0_2:
	mov	x20, x1
	mov	x21, x0
	ldr	w1, [x1, #12]
	mov	x0, x19
	bl	_twl4030_write_script
	cbz	w0, LBB0_4
LBB0_3:
	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
LBB0_4:
	ldr	w8, [x20, #8]
Lloh7:
	adrp	x9, _TWL4030_WRST_SCRIPT@GOTPAGE
Lloh8:
	ldr	x9, [x9, _TWL4030_WRST_SCRIPT@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.5:
	mov	x0, x19
	bl	_twl4030_config_warmreset_sequence
	cbnz	w0, LBB0_3
; %bb.6:
	ldr	w8, [x20, #8]
LBB0_7:
Lloh10:
	adrp	x9, _TWL4030_WAKEUP12_SCRIPT@GOTPAGE
Lloh11:
	ldr	x9, [x9, _TWL4030_WAKEUP12_SCRIPT@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.8:
Lloh13:
	adrp	x8, _TWL_MODULE_PM_MASTER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _TWL_MODULE_PM_MASTER@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	ldr	x1, [x22]
Lloh16:
	adrp	x8, _R_SEQ_ADD_A2S@GOTPAGE
Lloh17:
	ldr	x8, [x8, _R_SEQ_ADD_A2S@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	bl	_twl_i2c_write_u8
	cbnz	w0, LBB0_3
; %bb.9:
	mov	x0, x21
	mov	x1, x19
	bl	_twl4030_config_wakeup12_sequence
	cbnz	w0, LBB0_3
; %bb.10:
	mov	w8, #1
	adrp	x9, _load_twl4030_script.order@PAGE
	strb	w8, [x9, _load_twl4030_script.order@PAGEOFF]
	ldr	w8, [x20, #8]
LBB0_11:
Lloh19:
	adrp	x9, _TWL4030_WAKEUP3_SCRIPT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _TWL4030_WAKEUP3_SCRIPT@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.12:
	mov	x0, x19
	bl	_twl4030_config_wakeup3_sequence
	cbnz	w0, LBB0_3
; %bb.13:
	ldr	w8, [x20, #8]
LBB0_14:
Lloh22:
	adrp	x9, _TWL4030_SLEEP_SCRIPT@GOTPAGE
Lloh23:
	ldr	x9, [x9, _TWL4030_SLEEP_SCRIPT@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_18
; %bb.15:
	adrp	x8, _load_twl4030_script.order@PAGE
	ldrb	w8, [x8, _load_twl4030_script.order@PAGEOFF]
	tbnz	w8, #0, LBB0_17
; %bb.16:
Lloh25:
	adrp	x0, l_.str.1@PAGE
Lloh26:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_warn
LBB0_17:
	mov	x0, x19
	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
	b	_twl4030_config_sleep_sequence
LBB0_18:
	mov	w0, #0
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_load_twl4030_script.order,1,2 ; @load_twl4030_script.order
	.comm	_END_OF_SCRIPT,8,3              ; @END_OF_SCRIPT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"TWL4030 scripts too big error\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TWL4030_WRST_SCRIPT,4,2        ; @TWL4030_WRST_SCRIPT
	.comm	_TWL4030_WAKEUP12_SCRIPT,4,2    ; @TWL4030_WAKEUP12_SCRIPT
	.comm	_TWL_MODULE_PM_MASTER,4,2       ; @TWL_MODULE_PM_MASTER
	.comm	_R_SEQ_ADD_A2S,4,2              ; @R_SEQ_ADD_A2S
	.comm	_TWL4030_WAKEUP3_SCRIPT,4,2     ; @TWL4030_WAKEUP3_SCRIPT
	.comm	_TWL4030_SLEEP_SCRIPT,4,2       ; @TWL4030_SLEEP_SCRIPT
l_.str.1:                               ; @.str.1
	.asciz	"TWL4030: Bad order of scripts (sleep script before wakeup) Leads to boot failure on some boards\n"

	.no_dead_strip	_load_twl4030_script
.subsections_via_symbols
