	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bd_getdev                      ## -- Begin function bd_getdev
	.p2align	4, 0x90
_bd_getdev:                             ## @bd_getdev
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	leaq	8(%rdi), %r13
	movq	%r13, %rdi
	callq	_bd_get_bdinfo
	movl	$-1, %ebx
	testq	%rax, %rax
	je	LBB0_17
## %bb.1:
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_bd_unit2bios
	movl	%eax, %r12d
	movl	16(%r14), %esi
	leaq	L_.str(%rip), %rdi
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_DPRINTF
	cmpl	$-1, %r12d
	je	LBB0_17
## %bb.2:
	movq	(%r13), %rax
	movq	(%rax), %rax
	movq	_DEVT_DISK@GOTPCREL(%rip), %rcx
	movl	$0, %esi
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.3:
	movl	4(%r15), %edx
	movl	(%r15), %esi
	imull	%edx, %esi
	movq	%r14, %rdi
	callq	_disk_open
	testq	%rax, %rax
	jne	LBB0_17
## %bb.4:
	movq	%r14, %rdi
	callq	_disk_close
	movl	(%r14), %eax
	movl	4(%r14), %esi
	incl	%eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_5:
	cmpl	$127, %r12d
	jg	LBB0_6
## %bb.7:
	movq	8(%r15), %rax
	movq	_DT_ATAPI@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.9:
	movq	_WFDMAJOR@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_6:
	movq	_WDMAJOR@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_8:
	movq	_FDMAJOR@GOTPCREL(%rip), %rax
LBB0_10:
	movq	(%r13), %rcx
	movq	(%rcx), %rcx
	movq	_DEVT_CD@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_11
## %bb.12:
	movl	%esi, %r15d
	xorl	%r12d, %r12d
	movq	_ACDMAJOR@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_11:
	movl	%esi, %r15d
	andl	$127, %r12d
LBB0_13:
	movl	(%rax), %r14d
	leaq	L_.str.1(%rip), %rdi
	callq	_getenv
	testq	%rax, %rax
	je	LBB0_16
## %bb.14:
	movq	%rax, %rbx
	leaq	-56(%rbp), %rsi
	movq	%rax, %rdi
	xorl	%edx, %edx
	callq	_strtol
	movq	-56(%rbp), %rcx
	cmpq	%rbx, %rcx
	je	LBB0_16
## %bb.15:
	cmpb	$0, (%rcx)
	cmovel	%eax, %r12d
LBB0_16:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %ecx
	movl	%r14d, %edi
	movl	%r12d, %edx
	callq	_MAKEBOOTDEV
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DPRINTF
LBB0_17:
	movl	%ebx, %eax
	addq	$24, %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	"unit %d BIOS device %d"

	.comm	_DEVT_DISK,8,3                  ## @DEVT_DISK
	.comm	_DT_ATAPI,8,3                   ## @DT_ATAPI
	.comm	_WFDMAJOR,4,2                   ## @WFDMAJOR
	.comm	_FDMAJOR,4,2                    ## @FDMAJOR
	.comm	_WDMAJOR,4,2                    ## @WDMAJOR
	.comm	_DEVT_CD,8,3                    ## @DEVT_CD
	.comm	_ACDMAJOR,4,2                   ## @ACDMAJOR
L_.str.1:                               ## @.str.1
	.asciz	"root_disk_unit"

L_.str.2:                               ## @.str.2
	.asciz	"dev is 0x%x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bd_getdev                      ; -- Begin function bd_getdev
	.p2align	2
_bd_getdev:                             ; @bd_getdev
	.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	x20, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_bd_get_bdinfo
	cbz	x0, LBB0_4
; %bb.1:
	mov	x23, x0
	mov	x0, x20
	bl	_bd_unit2bios
	mov	x22, x0
	ldr	w1, [x20, #16]
	str	x22, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DPRINTF
	cmn	w22, #1
	b.eq	LBB0_4
; %bb.2:
	ldr	x8, [x19]
	ldr	x8, [x8]
Lloh2:
	adrp	x9, _DEVT_DISK@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DEVT_DISK@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	ldp	w8, w2, [x23]
	mul	w1, w2, w8
	mov	x0, x20
	bl	_disk_open
	cbz	x0, LBB0_7
LBB0_4:
	mov	w19, #-1
	b	LBB0_13
LBB0_5:
	mov	w21, #0
	mov	w20, #0
	cmp	w22, #127
	b.gt	LBB0_8
LBB0_6:
	ldr	x8, [x23, #8]
Lloh5:
	adrp	x9, _DT_ATAPI@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DT_ATAPI@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
Lloh8:
	adrp	x10, _FDMAJOR@GOTPAGE
Lloh9:
	ldr	x10, [x10, _FDMAJOR@GOTPAGEOFF]
Lloh10:
	adrp	x11, _WFDMAJOR@GOTPAGE
Lloh11:
	ldr	x11, [x11, _WFDMAJOR@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x11, x10, eq
	b	LBB0_9
LBB0_7:
	mov	x0, x20
	bl	_disk_close
	ldp	w8, w20, [x20]
	add	w21, w8, #1
	cmp	w22, #127
	b.le	LBB0_6
LBB0_8:
Lloh12:
	adrp	x8, _WDMAJOR@GOTPAGE
Lloh13:
	ldr	x8, [x8, _WDMAJOR@GOTPAGEOFF]
LBB0_9:
	and	w9, w22, #0x7f
	ldr	x10, [x19]
	ldr	x10, [x10]
Lloh14:
	adrp	x11, _DEVT_CD@GOTPAGE
Lloh15:
	ldr	x11, [x11, _DEVT_CD@GOTPAGEOFF]
Lloh16:
	ldr	x11, [x11]
Lloh17:
	adrp	x12, _ACDMAJOR@GOTPAGE
Lloh18:
	ldr	x12, [x12, _ACDMAJOR@GOTPAGEOFF]
	cmp	x10, x11
	csel	x8, x12, x8, eq
	csel	w19, wzr, w9, eq
	ldr	w22, [x8]
Lloh19:
	adrp	x0, l_.str.1@PAGE
Lloh20:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_getenv
	cbz	x0, LBB0_12
; %bb.10:
	mov	x23, x0
	add	x1, sp, #8
	mov	w2, #0
	bl	_strtol
	ldr	x8, [sp, #8]
	cmp	x8, x23
	b.eq	LBB0_12
; %bb.11:
	ldrb	w8, [x8]
	cmp	w8, #0
	csel	w19, w0, w19, eq
LBB0_12:
	mov	x0, x22
	mov	x1, x21
	mov	x2, x19
	mov	x3, x20
	bl	_MAKEBOOTDEV
	mov	x19, x0
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	bl	_DPRINTF
LBB0_13:
	mov	x0, x19
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unit %d BIOS device %d"

	.comm	_DEVT_DISK,8,3                  ; @DEVT_DISK
	.comm	_DT_ATAPI,8,3                   ; @DT_ATAPI
	.comm	_WFDMAJOR,4,2                   ; @WFDMAJOR
	.comm	_FDMAJOR,4,2                    ; @FDMAJOR
	.comm	_WDMAJOR,4,2                    ; @WDMAJOR
	.comm	_DEVT_CD,8,3                    ; @DEVT_CD
	.comm	_ACDMAJOR,4,2                   ; @ACDMAJOR
l_.str.1:                               ; @.str.1
	.asciz	"root_disk_unit"

l_.str.2:                               ; @.str.2
	.asciz	"dev is 0x%x\n"

.subsections_via_symbols
