	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function do_format
_do_format:                             ## @do_format
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movl	%esi, %r12d
	movl	%edi, %r14d
	movslq	8(%rdx), %rdi
	callq	_DPRINT
	callq	_local_irq_save
	movq	_fdc_busy@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	je	LBB0_3
## %bb.1:
	movq	_fdc_wait@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_sleep_on
	cmpl	$0, (%r13)
	jne	LBB0_2
LBB0_3:
	movl	$1, (%r13)
	movq	_floppy_irq@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_stdma_lock
	movq	_IRQ_MFP_FDC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_atari_turnon_irq
	callq	_local_irq_restore
	testl	%r12d, %r12d
	je	LBB0_8
## %bb.4:
	movq	_NUM_DISK_MINORS@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jl	LBB0_6
## %bb.5:
	movslq	%r12d, %rax
	decq	%rax
	movq	_minor2disktype@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	shlq	$4, %rax
	movq	(%rcx,%rax), %rdx
	movq	_DriveType@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jg	LBB0_6
## %bb.7:
	movslq	8(%rcx,%rax), %rcx
	movq	_atari_disk_type@GOTPCREL(%rip), %rax
	shlq	$3, %rcx
	addq	(%rax), %rcx
	movq	_UDT@GOTPCREL(%rip), %rax
	movq	%rcx, (%rax)
	testq	%rcx, %rcx
	jne	LBB0_10
	jmp	LBB0_6
LBB0_8:
	movq	_UDT@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_6
LBB0_10:
	movl	(%r15), %esi
	movl	(%rcx), %eax
	movl	4(%rcx), %r12d
	cltd
	idivl	%r12d
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	cmpl	%ecx, %esi
	jge	LBB0_6
## %bb.11:
	cmpl	$2, 4(%r15)
	jl	LBB0_12
LBB0_6:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_redo_fd_request
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	_TrackBuffer@GOTPCREL(%rip), %r13
	movq	(%r13), %rbx
	movq	_BufferDrive@GOTPCREL(%rip), %rax
	movl	$-1, (%rax)
	movq	_motor_off_timer@GOTPCREL(%rip), %rdi
	callq	_del_timer
	movslq	%r12d, %rax
	imulq	$954437177, %rax, %rax          ## imm = 0x38E38E39
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$33, %rax
	addl	%ecx, %eax
	imull	$60, %eax, %edi
	movl	$78, %esi
	callq	_FILL
	testl	%r12d, %r12d
	jle	LBB0_16
## %bb.13:
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	$12, %edi
	xorl	%esi, %esi
	callq	_FILL
	movl	$3, %edi
	movl	$245, %esi
	callq	_FILL
	movb	$-2, (%rbx)
	movzbl	(%r15), %eax
	movb	%al, 1(%rbx)
	movzbl	4(%r15), %eax
	movb	%al, 2(%rbx)
	leal	(%r12,%r13), %eax
	subl	8(%r15), %eax
	cltd
	idivl	%r12d
	incb	%dl
	movb	%dl, 3(%rbx)
	movw	$-2302, 4(%rbx)                 ## imm = 0xF702
	movl	$22, %edi
	movl	$78, %esi
	callq	_FILL
	movl	$12, %edi
	xorl	%esi, %esi
	callq	_FILL
	movl	$3, %edi
	movl	$245, %esi
	callq	_FILL
	movb	$-5, 6(%rbx)
	movl	$512, %edi                      ## imm = 0x200
	movl	$229, %esi
	callq	_FILL
	movb	$-9, 7(%rbx)
	addq	$8, %rbx
	movl	$40, %edi
	movl	$78, %esi
	callq	_FILL
	incl	%r13d
	cmpl	%r13d, %r12d
	jne	LBB0_14
## %bb.15:
	movq	_TrackBuffer@GOTPCREL(%rip), %r13
LBB0_16:
	movl	(%r13), %edi
	movq	_BUFFER_SIZE@GOTPCREL(%rip), %rax
	addl	(%rax), %edi
	subl	%ebx, %edi
	movl	$78, %esi
	callq	_FILL
	movq	_IsFormatting@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	_FormatError@GOTPCREL(%rip), %r12
	movq	$0, (%r12)
	movl	(%r15), %eax
	movq	_ReqTrack@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	4(%r15), %eax
	movq	_ReqSide@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	%r14d, %edi
	callq	_do_fd_action
	movq	_format_wait@GOTPCREL(%rip), %rdi
	callq	_sleep_on
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_redo_fd_request
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	cmpq	$0, (%r12)
	cmovel	%r14d, %ebx
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_fdc_busy,4,2                   ## @fdc_busy
	.comm	_fdc_wait,4,2                   ## @fdc_wait
	.comm	_floppy_irq,4,2                 ## @floppy_irq
	.comm	_IRQ_MFP_FDC,4,2                ## @IRQ_MFP_FDC
	.comm	_NUM_DISK_MINORS,4,2            ## @NUM_DISK_MINORS
	.comm	_minor2disktype,8,3             ## @minor2disktype
	.comm	_DriveType,8,3                  ## @DriveType
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_atari_disk_type,8,3            ## @atari_disk_type
	.comm	_UDT,8,3                        ## @UDT
	.comm	_TrackBuffer,8,3                ## @TrackBuffer
	.comm	_BufferDrive,4,2                ## @BufferDrive
	.comm	_motor_off_timer,4,2            ## @motor_off_timer
	.comm	_BUFFER_SIZE,4,2                ## @BUFFER_SIZE
	.comm	_IsFormatting,4,2               ## @IsFormatting
	.comm	_FormatError,8,3                ## @FormatError
	.comm	_ReqTrack,4,2                   ## @ReqTrack
	.comm	_ReqSide,4,2                    ## @ReqSide
	.comm	_format_wait,4,2                ## @format_wait
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_do_format
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function do_format
_do_format:                             ; @do_format
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldrsw	x0, [x2, #8]
	bl	_DPRINT
	bl	_local_irq_save
Lloh0:
	adrp	x23, _fdc_busy@GOTPAGE
Lloh1:
	ldr	x23, [x23, _fdc_busy@GOTPAGEOFF]
	ldr	w8, [x23]
	cbz	w8, LBB0_3
; %bb.1:
Lloh2:
	adrp	x22, _fdc_wait@GOTPAGE
Lloh3:
	ldr	x22, [x22, _fdc_wait@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	bl	_sleep_on
	ldr	w8, [x23]
	cbnz	w8, LBB0_2
LBB0_3:
	mov	w8, #1
	str	w8, [x23]
Lloh4:
	adrp	x8, _floppy_irq@GOTPAGE
Lloh5:
	ldr	x8, [x8, _floppy_irq@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	mov	x1, #0
	bl	_stdma_lock
Lloh7:
	adrp	x8, _IRQ_MFP_FDC@GOTPAGE
Lloh8:
	ldr	x8, [x8, _IRQ_MFP_FDC@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	bl	_atari_turnon_irq
	bl	_local_irq_restore
	cbz	w21, LBB0_7
; %bb.4:
Lloh10:
	adrp	x8, _NUM_DISK_MINORS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _NUM_DISK_MINORS@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmp	w8, w21
	b.lt	LBB0_10
; %bb.5:
	sxtw	x8, w21
	sub	x8, x8, #1
Lloh13:
	adrp	x9, _minor2disktype@GOTPAGE
Lloh14:
	ldr	x9, [x9, _minor2disktype@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	lsl	x10, x8, #4
	ldr	x10, [x9, x10]
Lloh16:
	adrp	x11, _DriveType@GOTPAGE
Lloh17:
	ldr	x11, [x11, _DriveType@GOTPAGEOFF]
Lloh18:
	ldr	x11, [x11]
	cmp	x10, x11
	b.gt	LBB0_10
; %bb.6:
	add	x8, x9, x8, lsl #4
Lloh19:
	adrp	x9, _atari_disk_type@GOTPAGE
Lloh20:
	ldr	x9, [x9, _atari_disk_type@GOTPAGEOFF]
	ldrsw	x8, [x8, #8]
Lloh21:
	ldr	x9, [x9]
	add	x8, x9, x8, lsl #3
Lloh22:
	adrp	x9, _UDT@GOTPAGE
Lloh23:
	ldr	x9, [x9, _UDT@GOTPAGEOFF]
Lloh24:
	str	x8, [x9]
	cbnz	x8, LBB0_8
	b	LBB0_10
LBB0_7:
Lloh25:
	adrp	x8, _UDT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _UDT@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	cbz	x8, LBB0_10
LBB0_8:
	ldr	w9, [x20]
	ldp	w10, w21, [x8]
	sdiv	w8, w10, w21
	cmp	w8, #0
	cinc	w8, w8, lt
	cmp	w9, w8, asr #1
	b.ge	LBB0_10
; %bb.9:
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.le	LBB0_12
LBB0_10:
	bl	_redo_fd_request
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
Lloh31:
	adrp	x23, _TrackBuffer@GOTPAGE
Lloh32:
	ldr	x23, [x23, _TrackBuffer@GOTPAGEOFF]
	ldr	x22, [x23]
Lloh33:
	adrp	x8, _BufferDrive@GOTPAGE
Lloh34:
	ldr	x8, [x8, _BufferDrive@GOTPAGEOFF]
	mov	w9, #-1
Lloh35:
	str	w9, [x8]
Lloh36:
	adrp	x0, _motor_off_timer@GOTPAGE
Lloh37:
	ldr	x0, [x0, _motor_off_timer@GOTPAGEOFF]
	bl	_del_timer
	mov	w8, #36409
	movk	w8, #14563, lsl #16
	smull	x8, w21, w8
	lsr	x9, x8, #63
	asr	x8, x8, #33
	add	w8, w8, w9
	mov	w9, #60
	mul	w0, w8, w9
	mov	w1, #78
	bl	_FILL
	cmp	w21, #1
	b.lt	LBB0_16
; %bb.13:
	mov	w24, #0
	mov	w25, #254
	mov	w26, #63234
	mov	w27, #251
	mov	w28, #247
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	mov	w0, #12
	mov	w1, #0
	bl	_FILL
	mov	w0, #3
	mov	w1, #245
	bl	_FILL
	strb	w25, [x22]
	ldr	w8, [x20]
	strb	w8, [x22, #1]
	ldr	w8, [x20, #4]
	strb	w8, [x22, #2]
	ldr	w8, [x20, #8]
	add	w9, w21, w24
	sub	w8, w9, w8
	sdiv	w9, w8, w21
	msub	w8, w9, w21, w8
	add	w8, w8, #1
	strb	w8, [x22, #3]
	strh	w26, [x22, #4]
	mov	w0, #22
	mov	w1, #78
	bl	_FILL
	mov	w0, #12
	mov	w1, #0
	bl	_FILL
	mov	w0, #3
	mov	w1, #245
	bl	_FILL
	strb	w27, [x22, #6]
	mov	w0, #512
	mov	w1, #229
	bl	_FILL
	add	x23, x22, #8
	strb	w28, [x22, #7]
	mov	w0, #40
	mov	w1, #78
	bl	_FILL
	add	w24, w24, #1
	mov	x22, x23
	cmp	w21, w24
	b.ne	LBB0_14
; %bb.15:
	mov	x22, x23
Lloh38:
	adrp	x23, _TrackBuffer@GOTPAGE
Lloh39:
	ldr	x23, [x23, _TrackBuffer@GOTPAGEOFF]
LBB0_16:
	ldr	w8, [x23]
Lloh40:
	adrp	x9, _BUFFER_SIZE@GOTPAGE
Lloh41:
	ldr	x9, [x9, _BUFFER_SIZE@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	add	w8, w8, w9
	sub	w0, w8, w22
	mov	w1, #78
	bl	_FILL
Lloh43:
	adrp	x8, _IsFormatting@GOTPAGE
Lloh44:
	ldr	x8, [x8, _IsFormatting@GOTPAGEOFF]
	mov	w9, #1
Lloh45:
	str	w9, [x8]
Lloh46:
	adrp	x21, _FormatError@GOTPAGE
Lloh47:
	ldr	x21, [x21, _FormatError@GOTPAGEOFF]
	str	xzr, [x21]
Lloh48:
	adrp	x8, _ReqTrack@GOTPAGE
Lloh49:
	ldr	x8, [x8, _ReqTrack@GOTPAGEOFF]
	ldp	w9, w10, [x20]
Lloh50:
	str	w9, [x8]
Lloh51:
	adrp	x8, _ReqSide@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ReqSide@GOTPAGEOFF]
Lloh53:
	str	w10, [x8]
	mov	x0, x19
	bl	_do_fd_action
Lloh54:
	adrp	x0, _format_wait@GOTPAGE
Lloh55:
	ldr	x0, [x0, _format_wait@GOTPAGEOFF]
	bl	_sleep_on
	bl	_redo_fd_request
	ldr	x8, [x21]
Lloh56:
	adrp	x9, _EIO@GOTPAGE
Lloh57:
	ldr	x9, [x9, _EIO@GOTPAGEOFF]
Lloh58:
	ldr	w9, [x9]
	cmp	x8, #0
	csneg	w0, wzr, w9, eq
	b	LBB0_11
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotStr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGotStr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGot	Lloh54, Lloh55
	.loh AdrpLdrGotStr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotStr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGotStr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.comm	_fdc_busy,4,2                   ; @fdc_busy
	.comm	_fdc_wait,4,2                   ; @fdc_wait
	.comm	_floppy_irq,4,2                 ; @floppy_irq
	.comm	_IRQ_MFP_FDC,4,2                ; @IRQ_MFP_FDC
	.comm	_NUM_DISK_MINORS,4,2            ; @NUM_DISK_MINORS
	.comm	_minor2disktype,8,3             ; @minor2disktype
	.comm	_DriveType,8,3                  ; @DriveType
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_atari_disk_type,8,3            ; @atari_disk_type
	.comm	_UDT,8,3                        ; @UDT
	.comm	_TrackBuffer,8,3                ; @TrackBuffer
	.comm	_BufferDrive,4,2                ; @BufferDrive
	.comm	_motor_off_timer,4,2            ; @motor_off_timer
	.comm	_BUFFER_SIZE,4,2                ; @BUFFER_SIZE
	.comm	_IsFormatting,4,2               ; @IsFormatting
	.comm	_FormatError,8,3                ; @FormatError
	.comm	_ReqTrack,4,2                   ; @ReqTrack
	.comm	_ReqSide,4,2                    ; @ReqSide
	.comm	_format_wait,4,2                ; @format_wait
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_do_format
.subsections_via_symbols
