	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_XboxDiskReadLogicalSectors     ## -- Begin function XboxDiskReadLogicalSectors
	.p2align	4, 0x90
_XboxDiskReadLogicalSectors:            ## @XboxDiskReadLogicalSectors
	.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
	cmpl	$128, %edi
	jl	LBB0_2
## %bb.1:
	movl	%edi, %r15d
	andl	$15, %r15d
	cmpl	$2, %r15d
	jb	LBB0_5
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_WARN
LBB0_3:
	movq	_FALSE@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%rcx, %r14
	movl	%edx, %r13d
	movl	%esi, %r12d
	leal	(%r12,%r13), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$-268435456, %edi               ## imm = 0xF0000000
	callq	_UINT64_C
	movl	%eax, %ebx
	andl	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	xorl	%edi, %edi
	callq	_UINT64_C
	cmpl	%eax, %ebx
	jne	LBB0_13
## %bb.6:
	movq	_TRUE@GOTPCREL(%rip), %rax
	testl	%r13d, %r13d
	jle	LBB0_4
## %bb.7:
	movq	%r12, %rcx
	movzbl	%cl, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movzbl	%ch, %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	shrl	$24, %ecx
	andl	$15, %ecx
	movq	%rcx, %r12
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$255, %r13d
	movl	$255, %ebx
	cmovll	%r13d, %ebx
	movq	_IDE_DH_LBA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%r12, %rcx
	orl	%ecx, %eax
	movq	_IDE_DH_DRV1@GOTPCREL(%rip), %rcx
	testl	%r15d, %r15d
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	_IDE_DH_DRV0@GOTPCREL(%rip), %rcx
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	_XBOX_IDE_COMMAND_PORT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
	movq	_XBOX_IDE_CONTROL_PORT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	orl	(%rcx), %eax
	movq	_IDE_CMD_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r10d
	xorl	%edx, %edx
	movl	%ebx, %ecx
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	movl	-48(%rbp), %r9d                 ## 4-byte Reload
	pushq	%r14
	pushq	%r10
	pushq	%rax
	pushq	-56(%rbp)                       ## 8-byte Folded Reload
	callq	_XboxDiskPolledRead
	addq	$32, %rsp
	testl	%eax, %eax
	je	LBB0_3
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	_IDE_SECTOR_BUF_SZ@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	%ebx, %rcx
	imulq	%rax, %rcx
	addq	%rcx, %r14
	subl	%ebx, %r13d
	jg	LBB0_8
## %bb.12:
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_13:
	leaq	L_.str.1(%rip), %rdi
	callq	_FIXME
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid drive number\n"

	.comm	_FALSE,4,2                      ## @FALSE
L_.str.1:                               ## @.str.1
	.asciz	"48bit LBA required but not implemented\n"

	.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_LBA,4,2                 ## @IDE_DH_LBA
	.comm	_IDE_DH_DRV0,4,2                ## @IDE_DH_DRV0
	.comm	_IDE_DH_DRV1,4,2                ## @IDE_DH_DRV1
	.comm	_IDE_CMD_READ,4,2               ## @IDE_CMD_READ
	.comm	_IDE_SECTOR_BUF_SZ,4,2          ## @IDE_SECTOR_BUF_SZ
	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_XboxDiskReadLogicalSectors     ; -- Begin function XboxDiskReadLogicalSectors
	.p2align	2
_XboxDiskReadLogicalSectors:            ; @XboxDiskReadLogicalSectors
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	cmp	w0, #128
	b.lt	LBB0_2
; %bb.1:
	and	w25, w0, #0xf
	cmp	w25, #2
	b.lo	LBB0_5
LBB0_2:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WARN
LBB0_3:
Lloh2:
	adrp	x26, _FALSE@GOTPAGE
Lloh3:
	ldr	x26, [x26, _FALSE@GOTPAGEOFF]
LBB0_4:
	ldr	w0, [x26]
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_5:
	mov	x19, x3
	mov	x20, x2
	mov	x24, x1
	add	w21, w2, w1
	mov	w0, #-268435456
	bl	_UINT64_C
	and	w21, w0, w21
	mov	w0, #0
	bl	_UINT64_C
	cmp	w21, w0
	b.ne	LBB0_11
; %bb.6:
	cmp	w20, #1
	b.lt	LBB0_10
; %bb.7:
	and	w21, w24, #0xff
	ubfx	w22, w24, #8, #8
	ubfx	w23, w24, #16, #8
	ubfx	w28, w24, #24, #4
Lloh4:
	adrp	x27, _IDE_CMD_READ@GOTPAGE
Lloh5:
	ldr	x27, [x27, _IDE_CMD_READ@GOTPAGEOFF]
Lloh6:
	adrp	x26, _FALSE@GOTPAGE
Lloh7:
	ldr	x26, [x26, _FALSE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w20, #255
	mov	w8, #255
	csel	w24, w20, w8, lt
Lloh8:
	adrp	x8, _XBOX_IDE_COMMAND_PORT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _XBOX_IDE_COMMAND_PORT@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x8, _XBOX_IDE_CONTROL_PORT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _XBOX_IDE_CONTROL_PORT@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
Lloh14:
	adrp	x8, _IDE_DH_LBA@GOTPAGE
Lloh15:
	ldr	x8, [x8, _IDE_DH_LBA@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	orr	w8, w8, w28
	cmp	w25, #0
Lloh17:
	adrp	x9, _IDE_DH_DRV0@GOTPAGE
Lloh18:
	ldr	x9, [x9, _IDE_DH_DRV0@GOTPAGEOFF]
Lloh19:
	adrp	x10, _IDE_DH_DRV1@GOTPAGE
Lloh20:
	ldr	x10, [x10, _IDE_DH_DRV1@GOTPAGEOFF]
	csel	x9, x9, x10, eq
	ldr	w9, [x9]
	orr	w7, w8, w9
	ldr	w8, [x27]
	str	x19, [sp, #8]
	str	w8, [sp]
	mov	w2, #0
	mov	x3, x24
	mov	x4, x21
	mov	x5, x22
	mov	x6, x23
	bl	_XboxDiskPolledRead
	cbz	w0, LBB0_4
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sub	w20, w20, w24
Lloh21:
	adrp	x8, _IDE_SECTOR_BUF_SZ@GOTPAGE
Lloh22:
	ldr	x8, [x8, _IDE_SECTOR_BUF_SZ@GOTPAGEOFF]
Lloh23:
	ldrsw	x8, [x8]
	sxtw	x9, w24
	madd	x19, x8, x9, x19
	cmp	w20, #0
	b.gt	LBB0_8
LBB0_10:
Lloh24:
	adrp	x26, _TRUE@GOTPAGE
Lloh25:
	ldr	x26, [x26, _TRUE@GOTPAGEOFF]
	b	LBB0_4
LBB0_11:
Lloh26:
	adrp	x0, l_.str.1@PAGE
Lloh27:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_FIXME
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid drive number\n"

	.comm	_FALSE,4,2                      ; @FALSE
l_.str.1:                               ; @.str.1
	.asciz	"48bit LBA required but not implemented\n"

	.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_LBA,4,2                 ; @IDE_DH_LBA
	.comm	_IDE_DH_DRV0,4,2                ; @IDE_DH_DRV0
	.comm	_IDE_DH_DRV1,4,2                ; @IDE_DH_DRV1
	.comm	_IDE_CMD_READ,4,2               ; @IDE_CMD_READ
	.comm	_IDE_SECTOR_BUF_SZ,4,2          ; @IDE_SECTOR_BUF_SZ
	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
