	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_XboxDiskGetDriveGeometry       ## -- Begin function XboxDiskGetDriveGeometry
	.p2align	4, 0x90
_XboxDiskGetDriveGeometry:              ## @XboxDiskGetDriveGeometry
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	_FALSE@GOTPCREL(%rip), %rbx
	movq	(%rbx), %r15
	movq	_XBOX_IDE_COMMAND_PORT@GOTPCREL(%rip), %rax
	movq	_XBOX_IDE_CONTROL_PORT@GOTPCREL(%rip), %rcx
	testb	$15, %dil
	jne	LBB0_1
## %bb.2:
	movq	_IDE_DH_DRV0@GOTPCREL(%rip), %rdx
	jmp	LBB0_3
LBB0_1:
	movq	_IDE_DH_DRV1@GOTPCREL(%rip), %rdx
LBB0_3:
	movl	(%rax), %edi
	movl	(%rcx), %esi
	movl	(%rdx), %r10d
	testq	%r15, %r15
	jne	LBB0_4
## %bb.5:
	movq	_IDE_CMD_IDENT_ATA_DRV@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
LBB0_4:
	movq	_IDE_CMD_IDENT_ATAPI_DRV@GOTPCREL(%rip), %rcx
LBB0_6:
	movl	(%rcx), %eax
	leaq	-48(%rbp), %r11
	xorl	%edx, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	%r11
	pushq	%rax
	pushq	%r10
	pushq	$0
	callq	_XboxDiskPolledRead
	addq	$32, %rsp
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movl	-48(%rbp), %eax
	movl	%eax, (%r14)
	movl	-44(%rbp), %eax
	movl	%eax, 4(%r14)
	movl	-40(%rbp), %eax
	movl	%eax, 8(%r14)
	testq	%r15, %r15
	je	LBB0_9
LBB0_10:
	movl	-32(%rbp), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_TRACE
	movl	-32(%rbp), %eax
	movl	$512, %ecx                      ## imm = 0x200
	testl	%eax, %eax
	je	LBB0_27
## %bb.11:
	movl	$32768, %ecx                    ## imm = 0x8000
	testl	$32768, %eax                    ## imm = 0x8000
	jne	LBB0_27
## %bb.12:
	movl	$16384, %ecx                    ## imm = 0x4000
	testl	$16384, %eax                    ## imm = 0x4000
	jne	LBB0_27
## %bb.13:
	movl	$8192, %ecx                     ## imm = 0x2000
	testl	$8192, %eax                     ## imm = 0x2000
	jne	LBB0_27
## %bb.14:
	movl	$4096, %ecx                     ## imm = 0x1000
	testl	$4096, %eax                     ## imm = 0x1000
	jne	LBB0_27
## %bb.15:
	movl	$2048, %ecx                     ## imm = 0x800
	testl	$2048, %eax                     ## imm = 0x800
	jne	LBB0_27
## %bb.16:
	movl	$1024, %ecx                     ## imm = 0x400
	testl	$1024, %eax                     ## imm = 0x400
	jne	LBB0_27
## %bb.17:
	movl	$512, %ecx                      ## imm = 0x200
	testl	$512, %eax                      ## imm = 0x200
	jne	LBB0_27
## %bb.18:
	movl	$256, %ecx                      ## imm = 0x100
	testl	$256, %eax                      ## imm = 0x100
	jne	LBB0_27
## %bb.19:
	movl	$128, %ecx
	testb	$-128, %al
	jne	LBB0_27
## %bb.20:
	movl	$64, %ecx
	testb	$64, %al
	jne	LBB0_27
## %bb.21:
	movl	$32, %ecx
	testb	$32, %al
	jne	LBB0_27
## %bb.22:
	movl	$16, %ecx
	testb	$16, %al
	jne	LBB0_27
## %bb.23:
	movl	$8, %ecx
	testb	$8, %al
	jne	LBB0_27
## %bb.24:
	movl	$4, %ecx
	testb	$4, %al
	jne	LBB0_27
## %bb.25:
	movl	$2, %ecx
	testb	$2, %al
	jne	LBB0_27
## %bb.26:
	movl	$1, %ecx
	testb	$1, %al
	jne	LBB0_27
	jmp	LBB0_28
LBB0_7:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
	jmp	LBB0_29
LBB0_9:
	movq	_IDE_DRID_LBA_SUPPORTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$512, %ecx                      ## imm = 0x200
	testl	%eax, -36(%rbp)
	je	LBB0_10
LBB0_27:
	movl	%ecx, 12(%r14)
LBB0_28:
	movl	(%r14), %esi
	leaq	L_.str.2(%rip), %rdi
	callq	_TRACE
	movl	4(%r14), %esi
	leaq	L_.str.3(%rip), %rdi
	callq	_TRACE
	movl	8(%r14), %esi
	leaq	L_.str.4(%rip), %rdi
	callq	_TRACE
	movl	12(%r14), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_TRACE
	movq	_TRUE@GOTPCREL(%rip), %rbx
LBB0_29:
	movq	(%rbx), %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FALSE,8,3                      ## @FALSE
	.comm	_XBOX_IDE_COMMAND_PORT,4,2      ## @XBOX_IDE_COMMAND_PORT
	.comm	_XBOX_IDE_CONTROL_PORT,4,2      ## @XBOX_IDE_CONTROL_PORT
	.comm	_IDE_DH_DRV0,4,2                ## @IDE_DH_DRV0
	.comm	_IDE_DH_DRV1,4,2                ## @IDE_DH_DRV1
	.comm	_IDE_CMD_IDENT_ATAPI_DRV,4,2    ## @IDE_CMD_IDENT_ATAPI_DRV
	.comm	_IDE_CMD_IDENT_ATA_DRV,4,2      ## @IDE_CMD_IDENT_ATA_DRV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"XboxDiskPolledRead() failed\n"

	.comm	_IDE_DRID_LBA_SUPPORTED,4,2     ## @IDE_DRID_LBA_SUPPORTED
L_.str.1:                               ## @.str.1
	.asciz	"BytesPerSector %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Cylinders %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Heads %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"Sectors %d\n"

	.comm	_TRUE,8,3                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_XboxDiskGetDriveGeometry       ; -- Begin function XboxDiskGetDriveGeometry
	.p2align	2
_XboxDiskGetDriveGeometry:              ; @XboxDiskGetDriveGeometry
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x1
Lloh0:
	adrp	x8, _FALSE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh2:
	ldr	x20, [x8]
Lloh3:
	adrp	x8, _XBOX_IDE_COMMAND_PORT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _XBOX_IDE_COMMAND_PORT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _XBOX_IDE_CONTROL_PORT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _XBOX_IDE_CONTROL_PORT@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x9]
Lloh9:
	adrp	x9, _IDE_DH_DRV0@GOTPAGE
Lloh10:
	ldr	x9, [x9, _IDE_DH_DRV0@GOTPAGEOFF]
Lloh11:
	adrp	x10, _IDE_DH_DRV1@GOTPAGE
Lloh12:
	ldr	x10, [x10, _IDE_DH_DRV1@GOTPAGEOFF]
	tst	w0, #0xf
	csel	x9, x9, x10, eq
Lloh13:
	adrp	x10, _IDE_CMD_IDENT_ATAPI_DRV@GOTPAGE
Lloh14:
	ldr	x10, [x10, _IDE_CMD_IDENT_ATAPI_DRV@GOTPAGEOFF]
	ldr	w7, [x9]
Lloh15:
	adrp	x9, _IDE_CMD_IDENT_ATA_DRV@GOTPAGE
Lloh16:
	ldr	x9, [x9, _IDE_CMD_IDENT_ATA_DRV@GOTPAGEOFF]
	cmp	x20, #0
	csel	x9, x9, x10, eq
	ldr	w9, [x9]
	add	x10, sp, #8
	stp	w9, w10, [sp]
	mov	x0, x8
	mov	w2, #0
	mov	w3, #1
	mov	w4, #0
	mov	w5, #0
	mov	w6, #0
	bl	_XboxDiskPolledRead
	cbz	w0, LBB0_20
; %bb.1:
	ldr	d0, [sp, #8]
	str	d0, [x19]
	ldr	w8, [sp, #16]
	str	w8, [x19, #8]
	cbz	x20, LBB0_21
LBB0_2:
	ldr	w1, [sp, #24]
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_TRACE
	ldr	w8, [sp, #24]
	cbz	w8, LBB0_22
; %bb.3:
	tbnz	w8, #15, LBB0_23
; %bb.4:
	tbnz	w8, #14, LBB0_24
; %bb.5:
	tbnz	w8, #13, LBB0_25
; %bb.6:
	tbnz	w8, #12, LBB0_26
; %bb.7:
	tbnz	w8, #11, LBB0_27
; %bb.8:
	tbnz	w8, #10, LBB0_28
; %bb.9:
	tbnz	w8, #9, LBB0_22
; %bb.10:
	tbnz	w8, #8, LBB0_32
; %bb.11:
	tbnz	w8, #7, LBB0_33
; %bb.12:
	tbnz	w8, #6, LBB0_34
; %bb.13:
	tbnz	w8, #5, LBB0_35
; %bb.14:
	tbnz	w8, #4, LBB0_36
; %bb.15:
	tbnz	w8, #3, LBB0_37
; %bb.16:
	tbnz	w8, #2, LBB0_38
; %bb.17:
	tbnz	w8, #1, LBB0_39
; %bb.18:
	tbz	w8, #0, LBB0_30
; %bb.19:
	mov	w8, #1
	b	LBB0_29
LBB0_20:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
Lloh21:
	adrp	x8, _FALSE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
	b	LBB0_31
LBB0_21:
	ldr	w8, [sp, #20]
Lloh23:
	adrp	x9, _IDE_DRID_LBA_SUPPORTED@GOTPAGE
Lloh24:
	ldr	x9, [x9, _IDE_DRID_LBA_SUPPORTED@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
LBB0_22:
	mov	w8, #512
	b	LBB0_29
LBB0_23:
	mov	w8, #32768
	b	LBB0_29
LBB0_24:
	mov	w8, #16384
	b	LBB0_29
LBB0_25:
	mov	w8, #8192
	b	LBB0_29
LBB0_26:
	mov	w8, #4096
	b	LBB0_29
LBB0_27:
	mov	w8, #2048
	b	LBB0_29
LBB0_28:
	mov	w8, #1024
LBB0_29:
	str	w8, [x19, #12]
LBB0_30:
	ldr	w1, [x19]
Lloh26:
	adrp	x0, l_.str.2@PAGE
Lloh27:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_TRACE
	ldr	w1, [x19, #4]
Lloh28:
	adrp	x0, l_.str.3@PAGE
Lloh29:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_TRACE
	ldr	w1, [x19, #8]
Lloh30:
	adrp	x0, l_.str.4@PAGE
Lloh31:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_TRACE
	ldr	w1, [x19, #12]
Lloh32:
	adrp	x0, l_.str.1@PAGE
Lloh33:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_TRACE
Lloh34:
	adrp	x8, _TRUE@GOTPAGE
Lloh35:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
LBB0_31:
	ldr	x0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_32:
	mov	w8, #256
	b	LBB0_29
LBB0_33:
	mov	w8, #128
	b	LBB0_29
LBB0_34:
	mov	w8, #64
	b	LBB0_29
LBB0_35:
	mov	w8, #32
	b	LBB0_29
LBB0_36:
	mov	w8, #16
	b	LBB0_29
LBB0_37:
	mov	w8, #8
	b	LBB0_29
LBB0_38:
	mov	w8, #4
	b	LBB0_29
LBB0_39:
	mov	w8, #2
	b	LBB0_29
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_FALSE,8,3                      ; @FALSE
	.comm	_XBOX_IDE_COMMAND_PORT,4,2      ; @XBOX_IDE_COMMAND_PORT
	.comm	_XBOX_IDE_CONTROL_PORT,4,2      ; @XBOX_IDE_CONTROL_PORT
	.comm	_IDE_DH_DRV0,4,2                ; @IDE_DH_DRV0
	.comm	_IDE_DH_DRV1,4,2                ; @IDE_DH_DRV1
	.comm	_IDE_CMD_IDENT_ATAPI_DRV,4,2    ; @IDE_CMD_IDENT_ATAPI_DRV
	.comm	_IDE_CMD_IDENT_ATA_DRV,4,2      ; @IDE_CMD_IDENT_ATA_DRV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"XboxDiskPolledRead() failed\n"

	.comm	_IDE_DRID_LBA_SUPPORTED,4,2     ; @IDE_DRID_LBA_SUPPORTED
l_.str.1:                               ; @.str.1
	.asciz	"BytesPerSector %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Cylinders %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Heads %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"Sectors %d\n"

	.comm	_TRUE,8,3                       ; @TRUE
.subsections_via_symbols
