	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function update_firmware
_update_firmware:                       ## @update_firmware
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_NVME_MAX_XFER_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	%r14, %rsi
	callq	_aligned_alloc
	movq	%rax, %r12
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	testq	%rbx, %rbx
	jg	LBB0_3
	jmp	LBB0_9
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_errx
	testq	%rbx, %rbx
	jle	LBB0_9
LBB0_3:
	leaq	-112(%rbp), %r13
	xorl	%r15d, %r15d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	addq	%r14, %r15
	subq	%r14, %rbx
	jle	LBB0_9
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	_NVME_MAX_XFER_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	cmpq	%r14, %rbx
	cmovlq	%rbx, %r14
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r15,4), %rsi
	movq	%r12, %rdi
	movq	%r14, %rdx
	callq	_memcpy
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$56, %edx
	callq	_memset
	movq	_NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	%r14, %rdi
	shrq	$2, %rdi
	decq	%rdi
	callq	_htole32
	movq	%rax, -72(%rbp)
	movq	%r15, %rdi
	shrq	$2, %rdi
	callq	_htole32
	movq	%rax, -80(%rbp)
	movq	%r12, -88(%rbp)
	movq	%r14, -96(%rbp)
	movq	$0, -104(%rbp)
	movq	_NVME_PASSTHROUGH_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	%r13, %rdx
	callq	_ioctl
	testq	%rax, %rax
	jns	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	$1, %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_err
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	%r13, %rdi
	callq	_nvme_completion_is_error
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	$1, %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_errx
	jmp	LBB0_8
LBB0_9:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_NVME_MAX_XFER_SIZE,8,3         ## @NVME_MAX_XFER_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to malloc %d bytes"

	.comm	_NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD,4,2 ## @NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD
	.comm	_NVME_PASSTHROUGH_CMD,4,2       ## @NVME_PASSTHROUGH_CMD
L_.str.1:                               ## @.str.1
	.asciz	"firmware download request failed"

L_.str.2:                               ## @.str.2
	.asciz	"firmware download request returned error"

	.no_dead_strip	_update_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function update_firmware
_update_firmware:                       ; @update_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x26, _NVME_MAX_XFER_SIZE@GOTPAGE
Lloh4:
	ldr	x26, [x26, _NVME_MAX_XFER_SIZE@GOTPAGEOFF]
	ldr	x23, [x26]
	mov	x1, x23
	bl	_aligned_alloc
	mov	x22, x0
	cbz	x0, LBB0_2
; %bb.1:
	cmp	x19, #1
	b.ge	LBB0_3
	b	LBB0_9
LBB0_2:
	str	x23, [sp]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_errx
	cmp	x19, #1
	b.lt	LBB0_9
LBB0_3:
	mov	x27, #0
Lloh7:
	adrp	x28, _NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD@GOTPAGE
Lloh8:
	ldr	x28, [x28, _NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD@GOTPAGEOFF]
Lloh9:
	adrp	x23, _NVME_PASSTHROUGH_CMD@GOTPAGE
Lloh10:
	ldr	x23, [x23, _NVME_PASSTHROUGH_CMD@GOTPAGEOFF]
Lloh11:
	adrp	x24, l_.str.2@PAGE
Lloh12:
	add	x24, x24, l_.str.2@PAGEOFF
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	sub	x19, x19, x25
	add	x27, x25, x27
	cmp	x19, #0
	b.le	LBB0_9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x26]
	cmp	x19, x8
	csel	x25, x19, x8, lt
	add	x1, x20, x27, lsl #2
	mov	x0, x22
	mov	x2, x25
	bl	_memcpy
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #56
	bl	_memset
	ldr	w8, [x28]
	str	w8, [sp, #56]
	lsr	x8, x25, #2
	sub	x0, x8, #1
	bl	_htole32
	str	x0, [sp, #48]
	lsr	x0, x27, #2
	bl	_htole32
	stp	x22, x0, [sp, #32]
	stp	xzr, x25, [sp, #16]
	ldr	w1, [x23]
	add	x2, sp, #8
	mov	x0, x21
	bl	_ioctl
	tbz	x0, #63, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #1
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_err
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x0, sp, #8
	bl	_nvme_completion_is_error
	cbz	x0, LBB0_4
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #1
	mov	x1, x24
	bl	_errx
	b	LBB0_4
LBB0_9:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_NVME_MAX_XFER_SIZE,8,3         ; @NVME_MAX_XFER_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to malloc %d bytes"

	.comm	_NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD,4,2 ; @NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD
	.comm	_NVME_PASSTHROUGH_CMD,4,2       ; @NVME_PASSTHROUGH_CMD
l_.str.1:                               ; @.str.1
	.asciz	"firmware download request failed"

l_.str.2:                               ; @.str.2
	.asciz	"firmware download request returned error"

	.no_dead_strip	_update_firmware
.subsections_via_symbols
