	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function torture_peb
_torture_peb:                           ## @torture_peb
	.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	%esi, %r14d
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	callq	_ubi_msg
	movq	_patterns@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	callq	_ARRAY_SIZE
	movl	%eax, %r15d
	xorl	%edi, %edi
	testl	%eax, %eax
	setg	%dil
	callq	_ubi_assert
	movq	%rbx, %rdi
	callq	_mutex_lock
	testl	%r15d, %r15d
	jle	LBB0_9
## %bb.1:
	movl	%r15d, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_do_sync_erase
	testl	%eax, %eax
	jne	LBB0_10
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rbx), %r8d
	movl	8(%rbx), %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	xorl	%ecx, %ecx
	callq	_ubi_io_read
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rbx), %edx
	movl	8(%rbx), %edi
	movl	$255, %esi
	callq	_check_pattern
	testl	%eax, %eax
	je	LBB0_12
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rbx), %edx
	movl	8(%rbx), %edi
	movq	(%r12), %rax
	movl	(%rax,%r13,4), %esi
	callq	_memset
	movl	4(%rbx), %r8d
	movl	8(%rbx), %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	xorl	%ecx, %ecx
	callq	_ubi_io_write
	testl	%eax, %eax
	jne	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rbx), %edx
	movl	8(%rbx), %edi
	movq	(%r12), %rax
	movl	(%rax,%r13,4), %esi
	notl	%esi
	callq	_memset
	movl	4(%rbx), %r8d
	movl	8(%rbx), %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	xorl	%ecx, %ecx
	callq	_ubi_io_read
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%rbx), %edx
	movl	8(%rbx), %edi
	movq	(%r12), %rax
	movl	(%rax,%r13,4), %esi
	callq	_check_pattern
	testl	%eax, %eax
	je	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	cmpq	%r13, -48(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_2
LBB0_9:
	leaq	L_.str.3(%rip), %rdi
	movl	%r14d, %esi
	callq	_ubi_msg
	jmp	LBB0_17
LBB0_10:
	movl	%eax, %r15d
	jmp	LBB0_17
LBB0_12:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r15d, %r15d
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_ubi_err
	jmp	LBB0_16
LBB0_15:
	movq	(%r12), %rax
	movl	(%rax,%r13,4), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%r15d, %r15d
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_ubi_err
LBB0_16:
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_17:
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movq	_UBI_IO_BITFLIPS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	je	LBB0_19
## %bb.18:
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r15d, %eax
	jne	LBB0_20
LBB0_19:
	leaq	L_.str.4(%rip), %rdi
	xorl	%r15d, %r15d
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_ubi_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_20:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"run torture test for PEB %d"

	.comm	_patterns,8,3                   ## @patterns
L_.str.1:                               ## @.str.1
	.asciz	"erased PEB %d, but a non-0xFF byte found"

	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"pattern %x checking failed for PEB %d"

L_.str.3:                               ## @.str.3
	.asciz	"PEB %d passed torture test, do not mark it a bad"

	.comm	_UBI_IO_BITFLIPS,4,2            ## @UBI_IO_BITFLIPS
	.comm	_EBADMSG,4,2                    ## @EBADMSG
L_.str.4:                               ## @.str.4
	.asciz	"read problems on freshly erased PEB %d, must be bad"

	.no_dead_strip	_torture_peb
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function torture_peb
_torture_peb:                           ; @torture_peb
	.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	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ubi_msg
Lloh2:
	adrp	x22, _patterns@GOTPAGE
Lloh3:
	ldr	x22, [x22, _patterns@GOTPAGEOFF]
	ldr	x0, [x22]
	bl	_ARRAY_SIZE
	mov	x21, x0
	cmp	w0, #0
	cset	w0, gt
	bl	_ubi_assert
	mov	x0, x20
	bl	_mutex_lock
	cmp	w21, #1
	b.lt	LBB0_9
; %bb.1:
	mov	x23, #0
	mov	w8, w21
	lsl	x24, x8, #2
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_do_sync_erase
	cbnz	w0, LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldp	w4, w1, [x20, #4]
	mov	x0, x20
	mov	x2, x19
	mov	w3, #0
	bl	_ubi_io_read
	cbnz	w0, LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldp	w2, w0, [x20, #4]
	mov	w1, #255
	bl	_check_pattern
	cbz	w0, LBB0_11
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x22]
	ldr	w1, [x8, x23]
	ldp	w2, w0, [x20, #4]
	bl	_memset
	ldp	w4, w1, [x20, #4]
	mov	x0, x20
	mov	x2, x19
	mov	w3, #0
	bl	_ubi_io_write
	cbnz	w0, LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x22]
	ldr	w8, [x8, x23]
	mvn	w1, w8
	ldp	w2, w0, [x20, #4]
	bl	_memset
	ldp	w4, w1, [x20, #4]
	mov	x0, x20
	mov	x2, x19
	mov	w3, #0
	bl	_ubi_io_read
	cbnz	w0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x22]
	ldr	w1, [x8, x23]
	ldp	w2, w0, [x20, #4]
	bl	_check_pattern
	cbz	w0, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x23, x23, #4
	cmp	x24, x23
	b.ne	LBB0_2
LBB0_9:
Lloh4:
	adrp	x0, l_.str.3@PAGE
Lloh5:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x19
	bl	_ubi_msg
	b	LBB0_14
LBB0_10:
	mov	x21, x0
	b	LBB0_14
LBB0_11:
Lloh6:
	adrp	x0, l_.str.1@PAGE
Lloh7:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	b	LBB0_13
LBB0_12:
	ldr	x8, [x22]
	ldr	w1, [x8, x23]
	str	x19, [sp]
Lloh8:
	adrp	x0, l_.str.2@PAGE
Lloh9:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_13:
	bl	_ubi_err
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_14:
	mov	x0, x20
	bl	_mutex_unlock
Lloh13:
	adrp	x8, _UBI_IO_BITFLIPS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _UBI_IO_BITFLIPS@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w21, w8
	b.eq	LBB0_16
; %bb.15:
Lloh16:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmn	w21, w8
	b.ne	LBB0_17
LBB0_16:
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x19
	bl	_ubi_err
Lloh21:
	adrp	x8, _EIO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_17:
	mov	x0, x21
	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	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"run torture test for PEB %d"

	.comm	_patterns,8,3                   ; @patterns
l_.str.1:                               ; @.str.1
	.asciz	"erased PEB %d, but a non-0xFF byte found"

	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"pattern %x checking failed for PEB %d"

l_.str.3:                               ; @.str.3
	.asciz	"PEB %d passed torture test, do not mark it a bad"

	.comm	_UBI_IO_BITFLIPS,4,2            ; @UBI_IO_BITFLIPS
	.comm	_EBADMSG,4,2                    ; @EBADMSG
l_.str.4:                               ; @.str.4
	.asciz	"read problems on freshly erased PEB %d, must be bad"

	.no_dead_strip	_torture_peb
.subsections_via_symbols
