	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_index                     ## -- Begin function save_index
	.p2align	4, 0x90
_save_index:                            ## @save_index
	.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
	leaq	L_.str(%rip), %rdi
	callq	_dbg
	movq	_engine_snapshot_replica@GOTPCREL(%rip), %r14
	movq	(%r14), %rbx
	testq	%rbx, %rbx
	je	LBB0_14
## %bb.1:
	xorl	%eax, %eax
	callq	_log_cur_pos
	movq	(%r14), %rcx
	movl	(%rcx), %edx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_get_new_snapshot_name
	testq	%rax, %rax
	je	LBB0_14
## %bb.2:
	movq	%rax, %r15
	cmpb	$45, (%rax)
	je	LBB0_14
## %bb.3:
	xorl	%eax, %eax
	callq	_log_cur_pos
	movq	_jump_log_pos@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.4:
	movq	_stderr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_fprintf
	jmp	LBB0_13
LBB0_5:
	movq	_verbosity@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jle	LBB0_7
## %bb.6:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	xorl	%eax, %eax
	callq	_log_cur_pos
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %edi
	movq	%r15, %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_fprintf
LBB0_7:
	movq	_binlog_disabled@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_8
## %bb.9:
	xorl	%edi, %edi
	callq	_relax_log_crc32
	jmp	LBB0_10
LBB0_8:
	xorl	%eax, %eax
	callq	_relax_write_log_crc32
LBB0_10:
	leaq	-80(%rbp), %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	_O_CREAT@GOTPCREL(%rip), %rax
	movq	_O_TRUNC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_O_EXCL@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	%r15, %rdi
	movl	$432, %edx                      ## imm = 0x1B0
	callq	_open
	movq	_fd@GOTPCREL(%rip), %r12
	movq	(%r12), %rcx
	movl	%eax, 4(%rcx)
	testl	%eax, %eax
	js	LBB0_15
## %bb.11:
	movq	_SUPPORT_INDEX_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	xorl	%edi, %edi
	callq	_time
	movl	%eax, -48(%rbp)
	leaq	-80(%rbp), %r14
	movq	%r14, %rdi
	callq	_get_index_header_size
	movq	%rax, %rbx
	movq	(%r12), %rax
	movl	4(%rax), %edi
	movq	_SEEK_SET@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%rbx, %rsi
	callq	_lseek
	xorl	%edi, %edi
	cmpq	%rbx, %rax
	sete	%dil
	callq	_assert
	xorl	%eax, %eax
	callq	_log_cur_pos
	movq	%rax, -56(%rbp)
	movq	_log_last_ts@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	_log_split_min@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -68(%rbp)
	movq	_log_split_max@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)
	movq	_log_split_mod@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -76(%rbp)
	xorl	%edi, %edi
	callq	_relax_log_crc32
	movq	_log_crc32_complement@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	movl	%eax, -80(%rbp)
	movq	(%r12), %rax
	movl	4(%rax), %edi
	movl	(%r13), %edx
	xorl	%esi, %esi
	callq	_lseek
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_assert
	movq	(%r12), %rax
	movl	4(%rax), %edi
	movq	%r14, %rsi
	movl	$40, %edx
	callq	_write
	xorl	%edi, %edi
	cmpl	$40, %eax
	sete	%dil
	callq	_assert
	movq	(%r12), %rax
	movl	4(%rax), %edi
	callq	_fsync
	shrq	$63, %rax
	xorl	$1, %eax
	movl	%eax, %edi
	callq	_assert
	movq	(%r12), %rax
	movl	4(%rax), %edi
	callq	_close
	shrq	$63, %rax
	xorl	$1, %eax
	movl	%eax, %edi
	callq	_assert
	movq	(%r12), %rax
	movl	$-1, 4(%rax)
	movq	%r15, %rdi
	callq	_rename_temporary_snapshot
	testq	%rax, %rax
	jne	LBB0_16
## %bb.12:
	movq	%r15, %rdi
	callq	_print_snapshot_name
LBB0_13:
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	movl	$1, %edi
	callq	_exit
LBB0_15:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movl	$1, %edi
	callq	_exit
LBB0_16:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movq	%r15, %rdi
	callq	_unlink
	movl	$1, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"save_index\n"

	.comm	_engine_snapshot_replica,8,3    ## @engine_snapshot_replica
	.comm	_stderr,4,2                     ## @stderr
L_.str.1:                               ## @.str.1
	.asciz	"cannot write index: cannot compute its name\n"

	.comm	_jump_log_pos,8,3               ## @jump_log_pos
L_.str.2:                               ## @.str.2
	.asciz	"skipping generation of new snapshot %s for position %lld: snapshot for this position already exists\n"

	.comm	_verbosity,8,3                  ## @verbosity
L_.str.3:                               ## @.str.3
	.asciz	"creating index %s at log position %lld\n"

	.comm	_binlog_disabled,4,2            ## @binlog_disabled
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_EXCL,4,2                     ## @O_EXCL
	.comm	_fd,8,3                         ## @fd
L_.str.4:                               ## @.str.4
	.asciz	"cannot create new index file %s: %m\n"

	.comm	_SUPPORT_INDEX_MAGIC,4,2        ## @SUPPORT_INDEX_MAGIC
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_log_last_ts,4,2                ## @log_last_ts
	.comm	_log_split_min,4,2              ## @log_split_min
	.comm	_log_split_max,4,2              ## @log_split_max
	.comm	_log_split_mod,4,2              ## @log_split_mod
	.comm	_log_crc32_complement,4,2       ## @log_crc32_complement
L_.str.5:                               ## @.str.5
	.asciz	"cannot rename new index file from %s: %m\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_index                     ; -- Begin function save_index
	.p2align	2
_save_index:                            ; @save_index
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg
Lloh2:
	adrp	x20, _engine_snapshot_replica@GOTPAGE
Lloh3:
	ldr	x20, [x20, _engine_snapshot_replica@GOTPAGEOFF]
	ldr	x19, [x20]
	cbz	x19, LBB0_14
; %bb.1:
	bl	_log_cur_pos
	mov	x1, x0
	ldr	x8, [x20]
	ldr	w2, [x8]
	mov	x0, x19
	bl	_get_new_snapshot_name
	cbz	x0, LBB0_14
; %bb.2:
	mov	x19, x0
	ldrb	w8, [x0]
	cmp	w8, #45
	b.eq	LBB0_14
; %bb.3:
	bl	_log_cur_pos
Lloh4:
	adrp	x8, _jump_log_pos@GOTPAGE
Lloh5:
	ldr	x8, [x8, _jump_log_pos@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_5
; %bb.4:
Lloh7:
	adrp	x8, _stderr@GOTPAGE
Lloh8:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	stp	x19, x0, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x8
	bl	_fprintf
	b	LBB0_13
LBB0_5:
Lloh12:
	adrp	x8, _verbosity@GOTPAGE
Lloh13:
	ldr	x8, [x8, _verbosity@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	cmp	x8, #1
	b.lt	LBB0_7
; %bb.6:
Lloh15:
	adrp	x8, _stderr@GOTPAGE
Lloh16:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh17:
	ldr	w20, [x8]
	bl	_log_cur_pos
	stp	x19, x0, [sp]
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_fprintf
LBB0_7:
Lloh20:
	adrp	x8, _binlog_disabled@GOTPAGE
Lloh21:
	ldr	x8, [x8, _binlog_disabled@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	cbz	w8, LBB0_9
; %bb.8:
	mov	w0, #0
	bl	_relax_log_crc32
	b	LBB0_10
LBB0_9:
	bl	_relax_write_log_crc32
LBB0_10:
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #40
	bl	_memset
Lloh23:
	adrp	x8, _O_CREAT@GOTPAGE
Lloh24:
	ldr	x8, [x8, _O_CREAT@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
Lloh26:
	adrp	x9, _O_TRUNC@GOTPAGE
Lloh27:
	ldr	x9, [x9, _O_TRUNC@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh29:
	adrp	x9, _O_WRONLY@GOTPAGE
Lloh30:
	ldr	x9, [x9, _O_WRONLY@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh32:
	adrp	x9, _O_EXCL@GOTPAGE
Lloh33:
	ldr	x9, [x9, _O_EXCL@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	x0, x19
	mov	w2, #432
	bl	_open
Lloh35:
	adrp	x21, _fd@GOTPAGE
Lloh36:
	ldr	x21, [x21, _fd@GOTPAGEOFF]
	ldr	x8, [x21]
	str	w0, [x8, #4]
	tbnz	w0, #31, LBB0_16
; %bb.11:
Lloh37:
	adrp	x8, _SUPPORT_INDEX_MAGIC@GOTPAGE
Lloh38:
	ldr	x8, [x8, _SUPPORT_INDEX_MAGIC@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	str	w8, [sp, #60]
	mov	x0, #0
	bl	_time
	str	w0, [sp, #56]
	add	x0, sp, #24
	bl	_get_index_header_size
	mov	x20, x0
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
Lloh40:
	adrp	x22, _SEEK_SET@GOTPAGE
Lloh41:
	ldr	x22, [x22, _SEEK_SET@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x1, x20
	bl	_lseek
	cmp	x0, x20
	cset	w0, eq
	bl	_assert
	bl	_log_cur_pos
	str	x0, [sp, #48]
Lloh42:
	adrp	x8, _log_last_ts@GOTPAGE
Lloh43:
	ldr	x8, [x8, _log_last_ts@GOTPAGEOFF]
Lloh44:
	adrp	x9, _log_split_min@GOTPAGE
Lloh45:
	ldr	x9, [x9, _log_split_min@GOTPAGEOFF]
Lloh46:
	ldr	w8, [x8]
Lloh47:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #36]
Lloh48:
	adrp	x8, _log_split_max@GOTPAGE
Lloh49:
	ldr	x8, [x8, _log_split_max@GOTPAGEOFF]
Lloh50:
	ldr	w8, [x8]
Lloh51:
	adrp	x9, _log_split_mod@GOTPAGE
Lloh52:
	ldr	x9, [x9, _log_split_mod@GOTPAGEOFF]
Lloh53:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #28]
	mov	w0, #0
	bl	_relax_log_crc32
Lloh54:
	adrp	x8, _log_crc32_complement@GOTPAGE
Lloh55:
	ldr	x8, [x8, _log_crc32_complement@GOTPAGEOFF]
Lloh56:
	ldr	w8, [x8]
	mvn	w8, w8
	str	w8, [sp, #24]
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
	ldr	w2, [x22]
	mov	x1, #0
	bl	_lseek
	cmp	x0, #0
	cset	w0, eq
	bl	_assert
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
	add	x1, sp, #24
	mov	w2, #40
	bl	_write
	cmp	w0, #40
	cset	w0, eq
	bl	_assert
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
	bl	_fsync
	lsr	x8, x0, #63
	eor	w0, w8, #0x1
	bl	_assert
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
	bl	_close
	lsr	x8, x0, #63
	eor	w0, w8, #0x1
	bl	_assert
	ldr	x8, [x21]
	mov	w9, #-1
	str	w9, [x8, #4]
	mov	x0, x19
	bl	_rename_temporary_snapshot
	cbnz	x0, LBB0_17
; %bb.12:
	mov	x0, x19
	bl	_print_snapshot_name
LBB0_13:
	mov	w0, #0
	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
	add	sp, sp, #112
	ret
LBB0_14:
Lloh57:
	adrp	x8, _stderr@GOTPAGE
Lloh58:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh59:
	ldr	w0, [x8]
Lloh60:
	adrp	x1, l_.str.1@PAGE
Lloh61:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_15:
	bl	_fprintf
	mov	w0, #1
	bl	_exit
LBB0_16:
Lloh62:
	adrp	x8, _stderr@GOTPAGE
Lloh63:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh64:
	ldr	w0, [x8]
	str	x19, [sp]
Lloh65:
	adrp	x1, l_.str.4@PAGE
Lloh66:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_15
LBB0_17:
Lloh67:
	adrp	x8, _stderr@GOTPAGE
Lloh68:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh69:
	ldr	w0, [x8]
	str	x19, [sp]
Lloh70:
	adrp	x1, l_.str.5@PAGE
Lloh71:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_fprintf
	mov	x0, x19
	bl	_unlink
	mov	w0, #1
	bl	_exit
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh46
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpAdd	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpAdd	Lloh70, Lloh71
	.loh AdrpLdrGotLdr	Lloh67, Lloh68, Lloh69
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"save_index\n"

	.comm	_engine_snapshot_replica,8,3    ; @engine_snapshot_replica
	.comm	_stderr,4,2                     ; @stderr
l_.str.1:                               ; @.str.1
	.asciz	"cannot write index: cannot compute its name\n"

	.comm	_jump_log_pos,8,3               ; @jump_log_pos
l_.str.2:                               ; @.str.2
	.asciz	"skipping generation of new snapshot %s for position %lld: snapshot for this position already exists\n"

	.comm	_verbosity,8,3                  ; @verbosity
l_.str.3:                               ; @.str.3
	.asciz	"creating index %s at log position %lld\n"

	.comm	_binlog_disabled,4,2            ; @binlog_disabled
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_EXCL,4,2                     ; @O_EXCL
	.comm	_fd,8,3                         ; @fd
l_.str.4:                               ; @.str.4
	.asciz	"cannot create new index file %s: %m\n"

	.comm	_SUPPORT_INDEX_MAGIC,4,2        ; @SUPPORT_INDEX_MAGIC
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_log_last_ts,4,2                ; @log_last_ts
	.comm	_log_split_min,4,2              ; @log_split_min
	.comm	_log_split_max,4,2              ; @log_split_max
	.comm	_log_split_mod,4,2              ; @log_split_mod
	.comm	_log_crc32_complement,4,2       ; @log_crc32_complement
l_.str.5:                               ; @.str.5
	.asciz	"cannot rename new index file from %s: %m\n"

.subsections_via_symbols
