	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ergo_writebootseq
_ergo_writebootseq:                     ## @ergo_writebootseq
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	8(%rdi), %r13
	movq	_LOG_POF_CARD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rdi)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_hysdn_addlog
LBB0_2:
	testl	%r15d, %r15d
	je	LBB0_18
## %bb.3:
	movq	(%r13), %r10
	movzbl	8(%r13), %r11d
	movb	9(%r13), %sil
	xorl	%r9d, %r9d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_5 Depth=1
	testl	%r15d, %r15d
	je	LBB0_18
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##     Child Loop BB0_14 Depth 2
	movzbl	%sil, %r8d
	movl	%r8d, %edi
	notl	%edi
	movzbl	10(%r13), %ecx
	addl	%edi, %ecx
	movl	%ecx, %eax
	sarl	$31, %eax
	andl	%r11d, %eax
	addl	%ecx, %eax
	movl	$-4096, %ecx                    ## imm = 0xF000
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	testl	%eax, %eax
	jne	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	addl	$2, %ecx
	je	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=2
	movzbl	10(%r13), %r12d
	addl	%edi, %r12d
	movl	%r12d, %edx
	sarl	$31, %edx
	andl	%r11d, %edx
	addl	%r12d, %edx
	je	LBB0_6
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %edx
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	cmpl	%r15d, %edx
	cmovgel	%r15d, %edx
	subl	%edx, %r15d
	testl	%edx, %edx
	je	LBB0_4
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	testb	$1, %dl
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%edx, %edi
	cmpl	$1, %edx
	jne	LBB0_14
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=1
	leal	-1(%rdx), %edi
	movb	(%rbx), %al
	incq	%rbx
	movb	%al, (%r10,%r8)
	incb	%r8b
	cmpb	%r11b, %r8b
	movzbl	%r8b, %esi
	cmovael	%r9d, %esi
	movb	%sil, 9(%r13)
	cmpl	$1, %edx
	je	LBB0_4
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movzbl	(%rbx), %eax
	movzbl	%sil, %ecx
	movb	%al, (%r10,%rcx)
	incb	%cl
	cmpb	%r11b, %cl
	movzbl	%cl, %eax
	cmovael	%r9d, %eax
	movb	%al, 9(%r13)
	movzbl	1(%rbx), %ecx
	addq	$2, %rbx
	leal	1(%rax), %edx
	cmpb	%r11b, %dl
	movzbl	%dl, %esi
	cmovael	%r9d, %esi
	movzbl	%al, %eax
	movb	%cl, (%r10,%rax)
	movb	%sil, 9(%r13)
	addl	$-2, %edi
	jne	LBB0_14
	jmp	LBB0_4
LBB0_15:
	movq	_LOG_POF_CARD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_17
## %bb.16:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_hysdn_addlog
LBB0_17:
	movq	_ERR_BOOTSEQ_FAIL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_19
LBB0_18:
	xorl	%eax, %eax
LBB0_19:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LOG_POF_CARD,4,2               ## @LOG_POF_CARD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ERGO: write boot seq len=%d "

L_.str.1:                               ## @.str.1
	.asciz	"ERGO: write boot seq timeout"

	.comm	_ERR_BOOTSEQ_FAIL,4,2           ## @ERR_BOOTSEQ_FAIL
	.no_dead_strip	_ergo_writebootseq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ergo_writebootseq
_ergo_writebootseq:                     ; @ergo_writebootseq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x23, [x0, #8]
	ldr	w8, [x0]
Lloh0:
	adrp	x22, _LOG_POF_CARD@GOTPAGE
Lloh1:
	ldr	x22, [x22, _LOG_POF_CARD@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	str	x20, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_hysdn_addlog
LBB0_2:
	cbz	w20, LBB0_10
; %bb.3:
	ldr	x8, [x23]
	ldrb	w9, [x23, #8]
	ldrb	w10, [x23, #9]
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
                                        ;     Child Loop BB0_8 Depth 2
	mvn	w11, w10
	orr	w11, w11, #0xffffff00
	mov	w12, #-4096
LBB0_5:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	adds	w12, w12, #1
	b.hs	LBB0_11
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	ldrb	w13, [x23, #10]
	add	w13, w13, w11
	and	w14, w9, w13, asr #31
	adds	w13, w14, w13
	b.eq	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w13, w20
	csel	w11, w13, w20, lt
	sub	w20, w20, w11
	cbz	w11, LBB0_9
LBB0_8:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrb	w12, [x21], #1
	and	x13, x10, #0xff
	strb	w12, [x8, x13]
	add	w12, w10, #1
	cmp	w9, w12, uxtb
	csinc	w10, wzr, w10, ls
	strb	w10, [x23, #9]
	sub	w11, w11, #1
	cbnz	w11, LBB0_8
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	cbnz	w20, LBB0_4
LBB0_10:
	mov	w0, #0
	b	LBB0_14
LBB0_11:
	ldr	w8, [x19]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.12:
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_hysdn_addlog
LBB0_13:
Lloh6:
	adrp	x8, _ERR_BOOTSEQ_FAIL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ERR_BOOTSEQ_FAIL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_14:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_LOG_POF_CARD,4,2               ; @LOG_POF_CARD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ERGO: write boot seq len=%d "

l_.str.1:                               ; @.str.1
	.asciz	"ERGO: write boot seq timeout"

	.comm	_ERR_BOOTSEQ_FAIL,4,2           ; @ERR_BOOTSEQ_FAIL
	.no_dead_strip	_ergo_writebootseq
.subsections_via_symbols
