	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_write_ec_hdr            ## -- Begin function ubi_io_write_ec_hdr
	.p2align	4, 0x90
_ubi_io_write_ec_hdr:                   ## @ubi_io_write_ec_hdr
	.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	%rdx, %rbx
	movl	%esi, %r14d
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rdi
	callq	_dbg_io
	xorl	%edi, %edi
	testl	%r14d, %r14d
	js	LBB0_2
## %bb.1:
	cmpl	%r14d, (%r15)
	setg	%dil
LBB0_2:
	callq	_ubi_assert
	movq	_UBI_EC_HDR_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_cpu_to_be32
	movq	%rax, 40(%rbx)
	movq	_UBI_VERSION@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movl	16(%r15), %edi
	callq	_cpu_to_be32
	movq	%rax, 24(%rbx)
	movl	12(%r15), %edi
	callq	_cpu_to_be32
	movq	%rax, 16(%rbx)
	movl	8(%r15), %edi
	callq	_cpu_to_be32
	movq	%rax, 8(%rbx)
	movq	_UBI_CRC32_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_UBI_EC_HDR_SIZE_CRC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rsi
	callq	_crc32
	movl	%eax, %edi
	callq	_cpu_to_be32
	movq	%rax, (%rbx)
	movq	%r15, %rdi
	movl	%r14d, %esi
	movq	%rbx, %rdx
	callq	_paranoid_check_ec_hdr
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	4(%r15), %r8d
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%r14d, %edx
	xorl	%ecx, %ecx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ubi_io_write                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write EC header to PEB %d"

	.comm	_UBI_EC_HDR_MAGIC,4,2           ## @UBI_EC_HDR_MAGIC
	.comm	_UBI_VERSION,4,2                ## @UBI_VERSION
	.comm	_UBI_CRC32_INIT,4,2             ## @UBI_CRC32_INIT
	.comm	_UBI_EC_HDR_SIZE_CRC,4,2        ## @UBI_EC_HDR_SIZE_CRC
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_write_ec_hdr            ; -- Begin function ubi_io_write_ec_hdr
	.p2align	2
_ubi_io_write_ec_hdr:                   ; @ubi_io_write_ec_hdr
	.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	x20, x2
	mov	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg_io
	tbnz	w19, #31, LBB0_2
; %bb.1:
	ldr	w8, [x21]
	cmp	w8, w19
	cset	w0, gt
	b	LBB0_3
LBB0_2:
	mov	w0, #0
LBB0_3:
	bl	_ubi_assert
Lloh2:
	adrp	x8, _UBI_EC_HDR_MAGIC@GOTPAGE
Lloh3:
	ldr	x8, [x8, _UBI_EC_HDR_MAGIC@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	bl	_cpu_to_be32
	str	x0, [x20, #40]
Lloh5:
	adrp	x8, _UBI_VERSION@GOTPAGE
Lloh6:
	ldr	x8, [x8, _UBI_VERSION@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x20, #32]
	ldr	w0, [x21, #16]
	bl	_cpu_to_be32
	str	x0, [x20, #24]
	ldr	w0, [x21, #12]
	bl	_cpu_to_be32
	str	x0, [x20, #16]
	ldr	w0, [x21, #8]
	bl	_cpu_to_be32
	str	x0, [x20, #8]
Lloh8:
	adrp	x8, _UBI_CRC32_INIT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _UBI_CRC32_INIT@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x8, _UBI_EC_HDR_SIZE_CRC@GOTPAGE
Lloh12:
	ldr	x8, [x8, _UBI_EC_HDR_SIZE_CRC@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x1, x20
	bl	_crc32
	bl	_cpu_to_be32
	str	x0, [x20]
	mov	x0, x21
	mov	x1, x19
	mov	x2, x20
	bl	_paranoid_check_ec_hdr
	cbz	w0, LBB0_5
; %bb.4:
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
	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_5:
	ldr	w4, [x21, #4]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	mov	w3, #0
	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	_ubi_io_write
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write EC header to PEB %d"

	.comm	_UBI_EC_HDR_MAGIC,4,2           ; @UBI_EC_HDR_MAGIC
	.comm	_UBI_VERSION,4,2                ; @UBI_VERSION
	.comm	_UBI_CRC32_INIT,4,2             ; @UBI_CRC32_INIT
	.comm	_UBI_EC_HDR_SIZE_CRC,4,2        ; @UBI_EC_HDR_SIZE_CRC
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
