	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LogicalTapeWrite               ## -- Begin function LogicalTapeWrite
	.p2align	4, 0x90
_LogicalTapeWrite:                      ## @LogicalTapeWrite
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movq	%rdx, %r14
	movl	%esi, %r15d
	movq	%rdi, %r12
	xorl	%edi, %edi
	testl	%esi, %esi
	js	LBB0_2
## %bb.1:
	cmpl	%r15d, (%r12)
	setg	%dil
LBB0_2:
	callq	_Assert
	movq	8(%r12), %rax
	movslq	%r15d, %rbx
	movq	%rax, %r15
	shlq	$6, %rbx
	movl	(%rax,%rbx), %edi
	callq	_Assert
	xorl	%edi, %edi
	cmpq	$0, 8(%r15,%rbx)
	sete	%dil
	callq	_Assert
	leaq	(%r15,%rbx), %rax
	addq	$16, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	cmpq	$0, 16(%r15,%rbx)
	jne	LBB0_4
## %bb.3:
	movq	_BLCKSZ@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_palloc
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	_BLCKSZ@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r15,%rbx)
LBB0_4:
	leaq	(%r15,%rbx), %rax
	addq	$32, %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	cmpl	$-1, 32(%r15,%rbx)
	jne	LBB0_6
## %bb.5:
	xorl	%edi, %edi
	cmpl	$-1, 36(%r15,%rbx)
	sete	%dil
	callq	_Assert
	xorl	%edi, %edi
	cmpq	$0, 40(%r15,%rbx)
	sete	%dil
	callq	_Assert
	movq	%r12, %rdi
	callq	_ltsGetFreeBlock
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movl	%eax, 36(%r15,%rbx)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	callq	_TapeBlockGetTrailer
	movq	$-1, (%rax)
LBB0_6:
	movq	24(%r15,%rbx), %rax
	movq	_BLCKSZ@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_Assert
	testq	%r13, %r13
	je	LBB0_15
## %bb.7:
	movq	%r15, %rax
	addq	%rbx, %r15
	addq	$40, %r15
	movq	40(%rax,%rbx), %rax
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	addq	%rbx, %r14
	subq	%rbx, %r13
	je	LBB0_15
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	_TapeBlockPayloadSize@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rbx
	cmpq	%rbx, %rax
	jl	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	cmpl	$0, 8(%r15)
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_elog
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%r12, %rdi
	callq	_ltsGetFreeBlock
	movq	%rax, %rbx
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	(%r14), %rdi
	callq	_TapeBlockGetTrailer
	movq	%rbx, 8(%rax)
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %esi
	movq	(%r14), %rdx
	movq	%r12, %rdi
	callq	_ltsWriteBlock
	movslq	(%rbx), %r12
	movq	(%r14), %rdi
	callq	_TapeBlockGetTrailer
	movq	%r12, (%rax)
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, (%rbx)
	movq	$0, (%r15)
	movq	$0, 16(%r15)
	movq	_TapeBlockPayloadSize@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	xorl	%eax, %eax
	movq	-80(%rbp), %r14                 ## 8-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	subq	%rax, %rbx
	cmpq	%r13, %rbx
	cmovaeq	%r13, %rbx
	xorl	%edi, %edi
	testq	%rbx, %rbx
	setne	%dil
	callq	_Assert
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	addq	(%r15), %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movl	$1, 8(%r15)
	movq	(%r15), %rax
	addq	%rbx, %rax
	movq	%rax, (%r15)
	cmpq	%rax, 16(%r15)
	jge	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%rax, 16(%r15)
	jmp	LBB0_14
LBB0_15:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLCKSZ,8,3                     ## @BLCKSZ
	.comm	_TapeBlockPayloadSize,8,3       ## @TapeBlockPayloadSize
	.comm	_ERROR,4,2                      ## @ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid logtape state: should be dirty"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LogicalTapeWrite               ; -- Begin function LogicalTapeWrite
	.p2align	2
_LogicalTapeWrite:                      ; @LogicalTapeWrite
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x19, x3
	mov	x20, x2
	mov	x22, x1
	mov	x21, x0
	tbnz	w1, #31, LBB0_2
; %bb.1:
	ldr	w8, [x21]
	cmp	w8, w22
	cset	w0, gt
	b	LBB0_3
LBB0_2:
	mov	w0, #0
LBB0_3:
	bl	_Assert
	ldr	x23, [x21, #8]
	sxtw	x22, w22
	add	x24, x23, x22, lsl #6
	ldr	w0, [x24]
	bl	_Assert
	ldr	x8, [x24, #8]
	cmp	x8, #0
	cset	w0, eq
	bl	_Assert
	mov	x9, x24
	ldr	x8, [x9, #16]!
	str	x9, [sp, #24]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x27, _BLCKSZ@GOTPAGE
Lloh1:
	ldr	x27, [x27, _BLCKSZ@GOTPAGEOFF]
	cbnz	x8, LBB0_5
; %bb.4:
	ldr	x0, [x27]
	bl	_palloc
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	str	x0, [x8]
	ldr	x8, [x27]
	str	x8, [x24, #24]
LBB0_5:
	ldr	w8, [x24, #32]!
	str	x24, [sp, #16]                  ; 8-byte Folded Spill
	cmn	w8, #1
	b.ne	LBB0_7
; %bb.6:
	add	x26, x23, x22, lsl #6
	ldr	w8, [x26, #36]
	cmn	w8, #1
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x26, #40]
	cmp	x8, #0
	cset	w0, eq
	bl	_Assert
	mov	x0, x21
	bl	_ltsGetFreeBlock
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	str	w0, [x8]
	str	w0, [x26, #36]
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	ldr	x0, [x8]
	bl	_TapeBlockGetTrailer
	mov	x8, #-1
	str	x8, [x0]
LBB0_7:
	add	x26, x23, x22, lsl #6
	ldr	x8, [x26, #24]
	ldr	x9, [x27]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	cbz	x19, LBB0_16
; %bb.8:
	ldr	x8, [x26, #40]!
	add	x27, x26, #8
Lloh2:
	adrp	x28, _TapeBlockPayloadSize@GOTPAGE
Lloh3:
	ldr	x28, [x28, _TapeBlockPayloadSize@GOTPAGEOFF]
	add	x22, x26, #16
	mov	w24, #1
	str	x27, [sp, #8]                   ; 8-byte Folded Spill
	ldr	x25, [sp, #24]                  ; 8-byte Folded Reload
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x20, x20, x23
	subs	x19, x19, x23
	b.eq	LBB0_16
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x28]
	cmp	x8, x9
	b.lt	LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x24, x28
	ldr	w8, [x27]
	cbnz	w8, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
Lloh4:
	adrp	x8, _ERROR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
LBB0_13:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x21
	bl	_ltsGetFreeBlock
	mov	x23, x0
	ldr	x0, [x25]
	bl	_TapeBlockGetTrailer
	str	x23, [x0, #8]
	ldr	x27, [sp, #16]                  ; 8-byte Folded Reload
	ldr	w1, [x27]
	ldr	x2, [x25]
	mov	x0, x21
	bl	_ltsWriteBlock
	mov	x28, x21
	ldrsw	x21, [x27]
	ldr	x0, [x25]
	bl	_TapeBlockGetTrailer
	mov	x8, #0
	str	x21, [x0]
	mov	x21, x28
	str	w23, [x27]
	str	xzr, [x26]
	str	xzr, [x22]
	mov	x28, x24
	ldr	x9, [x24]
	ldr	x27, [sp, #8]                   ; 8-byte Folded Reload
	mov	w24, #1
LBB0_14:                                ;   in Loop: Header=BB0_10 Depth=1
	sub	x8, x9, x8
	cmp	x8, x19
	csel	x23, x8, x19, lo
	cmp	x23, #0
	cset	w0, ne
	bl	_Assert
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	ldr	x8, [x8]
	ldr	x9, [x26]
	add	x0, x8, x9
	mov	x1, x20
	mov	x2, x23
	bl	_memcpy
	str	w24, [x27]
	ldr	x8, [x26]
	ldr	x9, [x22]
	add	x8, x8, x23
	cmp	x9, x8
	str	x8, [x26]
	b.ge	LBB0_9
; %bb.15:                               ;   in Loop: Header=BB0_10 Depth=1
	str	x8, [x22]
	b	LBB0_9
LBB0_16:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_BLCKSZ,8,3                     ; @BLCKSZ
	.comm	_TapeBlockPayloadSize,8,3       ; @TapeBlockPayloadSize
	.comm	_ERROR,4,2                      ; @ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid logtape state: should be dirty"

.subsections_via_symbols
