	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function close_walfile
_close_walfile:                         ## @close_walfile
	.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	%rdi, %rbx
	movq	_walfile@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	movl	$1, %r14d
	testq	%rdi, %rdi
	je	LBB0_13
## %bb.1:
	movl	%esi, %r15d
	movq	8(%rbx), %rax
	callq	*(%rax)
	cmpl	$-1, %eax
	je	LBB0_2
## %bb.3:
	movl	%eax, %r12d
	movq	16(%rbx), %rdx
	movq	_WalSegSz@GOTPCREL(%rip), %rcx
	movq	_CLOSE_NORMAL@GOTPCREL(%rip), %rax
	testq	%rdx, %rdx
	je	LBB0_6
## %bb.4:
	cmpl	(%rcx), %r12d
	je	LBB0_6
## %bb.5:
	movq	_current_walfile_name@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_pg_log_info
	movq	_CLOSE_NO_RENAME@GOTPCREL(%rip), %rax
LBB0_6:
	movq	8(%rbx), %rcx
	movq	(%r13), %rdi
	movl	(%rax), %esi
	callq	*8(%rcx)
	movq	$0, (%r13)
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movq	_current_walfile_name@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	8(%rbx), %rcx
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	*16(%rcx)
	leaq	L_.str.2(%rip), %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_pg_log_error
	jmp	LBB0_13
LBB0_2:
	movq	_current_walfile_name@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	8(%rbx), %rcx
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	*16(%rcx)
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_pg_log_error
	movq	8(%rbx), %rax
	movq	(%r13), %rdi
	movq	_CLOSE_UNLINK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	callq	*8(%rax)
	movq	$0, (%r13)
	jmp	LBB0_13
LBB0_8:
	movq	_WalSegSz@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_12
## %bb.9:
	cmpq	$0, (%rbx)
	je	LBB0_12
## %bb.10:
	movq	_current_walfile_name@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mark_file_as_archived
	testl	%eax, %eax
	je	LBB0_11
LBB0_12:
	movq	_lastFlushPosition@GOTPCREL(%rip), %rax
	movl	%r15d, (%rax)
LBB0_13:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	xorl	%r14d, %r14d
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_walfile,8,3                    ## @walfile
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not determine seek position in file \"%s\": %s"

	.comm	_current_walfile_name,4,2       ## @current_walfile_name
	.comm	_CLOSE_UNLINK,4,2               ## @CLOSE_UNLINK
	.comm	_WalSegSz,4,2                   ## @WalSegSz
	.comm	_CLOSE_NORMAL,4,2               ## @CLOSE_NORMAL
L_.str.1:                               ## @.str.1
	.asciz	"not renaming \"%s%s\", segment is not complete"

	.comm	_CLOSE_NO_RENAME,4,2            ## @CLOSE_NO_RENAME
L_.str.2:                               ## @.str.2
	.asciz	"could not close file \"%s\": %s"

	.comm	_lastFlushPosition,4,2          ## @lastFlushPosition
	.no_dead_strip	_close_walfile
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function close_walfile
_close_walfile:                         ; @close_walfile
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
Lloh0:
	adrp	x22, _walfile@GOTPAGE
Lloh1:
	ldr	x22, [x22, _walfile@GOTPAGEOFF]
	ldr	x0, [x22]
	cbz	x0, LBB0_12
; %bb.1:
	mov	x20, x1
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	blr	x8
	cmn	w0, #1
	b.eq	LBB0_7
; %bb.2:
	mov	x21, x0
	ldr	x2, [x19, #16]
Lloh2:
	adrp	x24, _WalSegSz@GOTPAGE
Lloh3:
	ldr	x24, [x24, _WalSegSz@GOTPAGEOFF]
Lloh4:
	adrp	x8, _CLOSE_NORMAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CLOSE_NORMAL@GOTPAGEOFF]
Lloh6:
	adrp	x23, _current_walfile_name@GOTPAGE
Lloh7:
	ldr	x23, [x23, _current_walfile_name@GOTPAGEOFF]
	cbz	x2, LBB0_5
; %bb.3:
	ldr	w9, [x24]
	cmp	w21, w9
	b.eq	LBB0_5
; %bb.4:
	ldr	w1, [x23]
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pg_log_info
Lloh10:
	adrp	x8, _CLOSE_NO_RENAME@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CLOSE_NO_RENAME@GOTPAGEOFF]
LBB0_5:
	ldr	x9, [x19, #8]
	ldr	x9, [x9, #8]
	ldr	x0, [x22]
	ldr	w1, [x8]
	blr	x9
	str	xzr, [x22]
	cbz	w0, LBB0_8
; %bb.6:
	ldr	w20, [x23]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #16]
	blr	x8
	mov	x2, x0
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x20
	bl	_pg_log_error
	mov	w0, #0
	b	LBB0_13
LBB0_7:
Lloh14:
	adrp	x8, _current_walfile_name@GOTPAGE
Lloh15:
	ldr	x8, [x8, _current_walfile_name@GOTPAGEOFF]
Lloh16:
	ldr	w20, [x8]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #16]
	blr	x8
	mov	x2, x0
Lloh17:
	adrp	x0, l_.str@PAGE
Lloh18:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_pg_log_error
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #8]
	ldr	x0, [x22]
Lloh19:
	adrp	x9, _CLOSE_UNLINK@GOTPAGE
Lloh20:
	ldr	x9, [x9, _CLOSE_UNLINK@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x9]
	blr	x8
	mov	w0, #0
	str	xzr, [x22]
	b	LBB0_13
LBB0_8:
	ldr	w8, [x24]
	cmp	w21, w8
	b.ne	LBB0_11
; %bb.9:
	ldr	x8, [x19]
	cbz	x8, LBB0_11
; %bb.10:
	ldr	w1, [x23]
	mov	x0, x19
	bl	_mark_file_as_archived
	cbz	w0, LBB0_13
LBB0_11:
Lloh22:
	adrp	x8, _lastFlushPosition@GOTPAGE
Lloh23:
	ldr	x8, [x8, _lastFlushPosition@GOTPAGEOFF]
Lloh24:
	str	w20, [x8]
LBB0_12:
	mov	w0, #1
LBB0_13:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotStr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_walfile,8,3                    ; @walfile
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not determine seek position in file \"%s\": %s"

	.comm	_current_walfile_name,4,2       ; @current_walfile_name
	.comm	_CLOSE_UNLINK,4,2               ; @CLOSE_UNLINK
	.comm	_WalSegSz,4,2                   ; @WalSegSz
	.comm	_CLOSE_NORMAL,4,2               ; @CLOSE_NORMAL
l_.str.1:                               ; @.str.1
	.asciz	"not renaming \"%s%s\", segment is not complete"

	.comm	_CLOSE_NO_RENAME,4,2            ; @CLOSE_NO_RENAME
l_.str.2:                               ; @.str.2
	.asciz	"could not close file \"%s\": %s"

	.comm	_lastFlushPosition,4,2          ; @lastFlushPosition
	.no_dead_strip	_close_walfile
.subsections_via_symbols
