	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mmc_calc_max_discard           ## -- Begin function mmc_calc_max_discard
	.p2align	4, 0x90
_mmc_calc_max_discard:                  ## @mmc_calc_max_discard
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	16(%rdi), %r14
	callq	_mmc_card_mmc
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	testb	$1, 8(%rbx)
	jne	LBB0_3
## %bb.2:
	movl	(%rbx), %r15d
	jmp	LBB0_9
LBB0_3:
	movq	_MMC_ERASE_ARG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mmc_do_calc_max_discard
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_mmc_can_trim
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	_MMC_TRIM_ARG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mmc_do_calc_max_discard
	movl	%eax, %r15d
	leal	-1(%r12), %eax
	cmpl	%r15d, %eax
	cmovbl	%r12d, %r15d
	jmp	LBB0_6
LBB0_5:
	xorl	%r15d, %r15d
	cmpl	4(%rbx), %r12d
	cmovael	%r12d, %r15d
LBB0_6:
	movq	%r14, %rdi
	callq	_mmc_hostname
	movq	(%r14), %rcx
	testq	%rcx, %rcx
	jne	LBB0_8
## %bb.7:
	movq	_MMC_ERASE_TIMEOUT_MS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
LBB0_8:
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%r15d, %edx
	callq	_pr_debug
LBB0_9:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MMC_ERASE_ARG,4,2              ## @MMC_ERASE_ARG
	.comm	_MMC_TRIM_ARG,4,2               ## @MMC_TRIM_ARG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: calculated max. discard sectors %u for timeout %u ms\n"

	.comm	_MMC_ERASE_TIMEOUT_MS,8,3       ## @MMC_ERASE_TIMEOUT_MS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mmc_calc_max_discard           ; -- Begin function mmc_calc_max_discard
	.p2align	2
_mmc_calc_max_discard:                  ; @mmc_calc_max_discard
	.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, x0
	ldr	x19, [x0, #16]
	bl	_mmc_card_mmc
	cbz	x0, LBB0_3
; %bb.1:
	ldrb	w8, [x20, #8]
	tbnz	w8, #0, LBB0_3
; %bb.2:
	ldr	w20, [x20]
	b	LBB0_7
LBB0_3:
Lloh0:
	adrp	x8, _MMC_ERASE_ARG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MMC_ERASE_ARG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_mmc_do_calc_max_discard
	mov	x21, x0
	mov	x0, x20
	bl	_mmc_can_trim
	cbz	x0, LBB0_5
; %bb.4:
Lloh3:
	adrp	x8, _MMC_TRIM_ARG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MMC_TRIM_ARG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_mmc_do_calc_max_discard
	sub	w8, w21, #1
	cmp	w8, w0
	csel	w20, w21, w0, lo
	b	LBB0_6
LBB0_5:
	ldr	w8, [x20, #4]
	cmp	w21, w8
	csel	w20, wzr, w21, lo
LBB0_6:
	mov	x0, x19
	bl	_mmc_hostname
	mov	x1, x0
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _MMC_ERASE_TIMEOUT_MS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MMC_ERASE_TIMEOUT_MS@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, #0
	csel	x3, x9, x8, eq
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x20
	bl	_pr_debug
LBB0_7:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MMC_ERASE_ARG,4,2              ; @MMC_ERASE_ARG
	.comm	_MMC_TRIM_ARG,4,2               ; @MMC_TRIM_ARG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: calculated max. discard sectors %u for timeout %u ms\n"

	.comm	_MMC_ERASE_TIMEOUT_MS,8,3       ; @MMC_ERASE_TIMEOUT_MS
.subsections_via_symbols
