	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_grub_disk_write                ## -- Begin function grub_disk_write
	.p2align	4, 0x90
_grub_disk_write:                       ## @grub_disk_write
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r13
	movl	%ecx, %r15d
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	%esi, -52(%rbp)
	movl	%edx, -56(%rbp)
	movl	24(%rdi), %edx
	leaq	L_.str(%rip), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_grub_dprintf
	leaq	-52(%rbp), %rsi
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	movl	%r15d, %ecx
	callq	_grub_disk_adjust_range
	movq	_GRUB_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.1:
	testl	%r15d, %r15d
	je	LBB0_14
## %bb.2:
	movl	-56(%rbp), %ebx
	movq	_GRUB_DISK_SECTOR_SIZE@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	incl	-52(%rbp)
	movq	-64(%rbp), %rsp                 ## 8-byte Reload
	movq	-72(%rbp), %r13                 ## 8-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_GRUB_DISK_SECTOR_SIZE@GOTPCREL(%rip), %rcx
LBB0_13:                                ##   in Loop: Header=BB0_3 Depth=1
	movslq	%r12d, %rax
	addq	%rax, %r13
	xorl	%ebx, %ebx
	subl	%eax, %r15d
	je	LBB0_14
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	movl	(%rcx), %r12d
	testl	%ebx, %ebx
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	%r12d, %r15d
	jl	LBB0_5
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_GRUB_DISK_SECTOR_BITS@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%r15d, %ebx
	sarl	%cl, %ebx
	movq	8(%r14), %rax
	movl	-52(%rbp), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	movq	%r13, %rcx
	callq	*(%rax)
	movq	_GRUB_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	_GRUB_DISK_SECTOR_SIZE@GOTPCREL(%rip), %rcx
	jne	LBB0_14
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	negl	%r12d
	andl	%r15d, %r12d
	testl	%ebx, %ebx
	je	LBB0_13
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%r14), %rax
	movl	8(%rax), %edi
	movl	(%r14), %esi
	movl	-52(%rbp), %edx
	leal	1(%rdx), %eax
	movl	%eax, -52(%rbp)
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_grub_disk_cache_invalidate
	decl	%ebx
	jne	LBB0_11
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	%rsp, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	movq	16(%r14), %r12
	movq	$0, 16(%r14)
	movl	-52(%rbp), %esi
	movq	_GRUB_DISK_SECTOR_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	xorl	%edx, %edx
	movq	%r13, %r8
	callq	_grub_disk_read
	movq	_GRUB_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	%r12, 16(%r14)
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_GRUB_DISK_SECTOR_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	subl	%ebx, %r12d
	cmpl	%r15d, %r12d
	cmovgel	%r15d, %r12d
	movl	%ebx, %edi
	addq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %edx
	callq	_grub_memcpy
	movq	8(%r14), %rax
	movl	8(%rax), %edi
	movl	(%r14), %esi
	movl	-52(%rbp), %edx
	callq	_grub_disk_cache_invalidate
	movq	8(%r14), %rax
	movl	-52(%rbp), %esi
	movq	%r14, %rdi
	movl	$1, %edx
	movq	%r13, %rcx
	callq	*(%rax)
	movq	_GRUB_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_8
LBB0_7:
	movq	-64(%rbp), %rsp                 ## 8-byte Reload
LBB0_14:
	movq	_grub_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_16
## %bb.15:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"disk"

L_.str.1:                               ## @.str.1
	.asciz	"Writing `%s'...\n"

	.comm	_GRUB_ERR_NONE,8,3              ## @GRUB_ERR_NONE
	.comm	_grub_errno,4,2                 ## @grub_errno
	.comm	_GRUB_DISK_SECTOR_SIZE,4,2      ## @GRUB_DISK_SECTOR_SIZE
	.comm	_GRUB_DISK_SECTOR_BITS,4,2      ## @GRUB_DISK_SECTOR_BITS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_grub_disk_write                ; -- Begin function grub_disk_write
	.p2align	2
_grub_disk_write:                       ; @grub_disk_write
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #16
	mov	x19, x4
	mov	x20, x3
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	stp	w2, w1, [x29, #-96]
	ldr	w2, [x0, #24]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_grub_dprintf
	sub	x1, x29, #92
	sub	x2, x29, #96
	mov	x0, x21
	mov	x3, x20
	bl	_grub_disk_adjust_range
Lloh7:
	adrp	x24, _GRUB_ERR_NONE@GOTPAGE
Lloh8:
	ldr	x24, [x24, _GRUB_ERR_NONE@GOTPAGEOFF]
	ldr	x8, [x24]
	cmp	x0, x8
	ccmp	w20, #0, #4, eq
	b.eq	LBB0_12
; %bb.1:
	ldur	w28, [x29, #-96]
Lloh9:
	adrp	x25, _GRUB_DISK_SECTOR_SIZE@GOTPAGE
Lloh10:
	ldr	x25, [x25, _GRUB_DISK_SECTOR_SIZE@GOTPAGEOFF]
Lloh11:
	adrp	x26, _GRUB_DISK_SECTOR_BITS@GOTPAGE
Lloh12:
	ldr	x26, [x26, _GRUB_DISK_SECTOR_BITS@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldur	w8, [x29, #-92]
	add	w8, w8, #1
	stur	w8, [x29, #-92]
	mov	sp, x27
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	w28, #0
	add	x19, x19, w22, sxtw
	subs	w20, w20, w22
	b.eq	LBB0_12
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	ldr	w22, [x25]
	cbnz	w28, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w20, w22
	b.lt	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x26]
	asr	w23, w20, w8
	ldr	x8, [x21, #8]
	ldr	x8, [x8]
	ldur	w1, [x29, #-92]
	mov	x0, x21
	mov	x2, x23
	mov	x3, x19
	blr	x8
	ldr	x8, [x24]
	cmp	x0, x8
	b.ne	LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	neg	w8, w22
	and	w22, w20, w8
	cbz	w23, LBB0_3
LBB0_8:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	sub	w23, w23, #1
	ldr	x8, [x21, #8]
	ldr	w0, [x8, #8]
	ldr	w1, [x21]
	ldur	w2, [x29, #-92]
	add	w8, w2, #1
	stur	w8, [x29, #-92]
	bl	_grub_disk_cache_invalidate
	cbnz	w23, LBB0_8
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x27, sp
	mov	x9, x22
Lloh13:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh14:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x22, #15
	and	x9, x9, #0x1fffffff0
	sub	x23, x8, x9
	mov	sp, x23
	ldr	x22, [x21, #16]
	str	xzr, [x21, #16]
	ldur	w1, [x29, #-92]
	ldr	w3, [x25]
	mov	x0, x21
	mov	w2, #0
	mov	x4, x23
	bl	_grub_disk_read
	ldr	x8, [x24]
	str	x22, [x21, #16]
	cmp	x0, x8
	b.ne	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x25]
	sub	w8, w8, w28
	cmp	w8, w20
	csel	w22, w8, w20, lt
	add	x0, x23, w28, uxtw
	mov	x1, x19
	mov	x2, x22
	bl	_grub_memcpy
	ldr	x8, [x21, #8]
	ldr	w0, [x8, #8]
	ldr	w1, [x21]
	ldur	w2, [x29, #-92]
	bl	_grub_disk_cache_invalidate
	ldr	x8, [x21, #8]
	ldr	x8, [x8]
	ldur	w1, [x29, #-92]
	mov	x0, x21
	mov	w2, #1
	mov	x3, x23
	blr	x8
	ldr	x8, [x24]
	cmp	x0, x8
	b.eq	LBB0_2
LBB0_11:
	mov	sp, x27
LBB0_12:
Lloh15:
	adrp	x8, _grub_errno@GOTPAGE
Lloh16:
	ldr	x8, [x8, _grub_errno@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	ldur	x8, [x29, #-88]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"disk"

l_.str.1:                               ; @.str.1
	.asciz	"Writing `%s'...\n"

	.comm	_GRUB_ERR_NONE,8,3              ; @GRUB_ERR_NONE
	.comm	_grub_errno,4,2                 ; @grub_errno
	.comm	_GRUB_DISK_SECTOR_SIZE,4,2      ; @GRUB_DISK_SECTOR_SIZE
	.comm	_GRUB_DISK_SECTOR_BITS,4,2      ; @GRUB_DISK_SECTOR_BITS
.subsections_via_symbols
