	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function HandleCopyStream
_HandleCopyStream:                      ## @HandleCopyStream
	.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
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	$0, -56(%rbp)
	movl	$-1, -48(%rbp)
	movl	24(%rsi), %edx
	movl	%edx, -44(%rbp)
	movq	_still_sending@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	%r14, %rcx
	callq	_CheckCopyStreamStop
	testl	%eax, %eax
	je	LBB0_26
## %bb.1:
	leaq	-56(%rbp), %r12
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	xorl	%eax, %eax
	callq	_feGetCurrentTimestamp
	movl	%eax, %r13d
	cmpq	$0, 16(%rbx)
	je	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_lastFlushPosition@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	-44(%rbp), %eax
	jge	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_walfile@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	8(%rbx), %rax
	callq	*(%rax)
	testq	%rax, %rax
	jne	LBB0_30
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	-44(%rbp), %esi
	movq	_lastFlushPosition@GOTPCREL(%rip), %rax
	movl	%esi, (%rax)
	movq	%r15, %rdi
	movl	%r13d, %edx
	xorl	%ecx, %ecx
	callq	_sendFeedback
	testl	%eax, %eax
	je	LBB0_26
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r13d, -48(%rbp)
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_still_sending@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_14
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%rbx), %edx
	testl	%edx, %edx
	jle	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	-48(%rbp), %edi
	movl	%r13d, %esi
	callq	_feTimestampDifferenceExceeds
	testq	%rax, %rax
	je	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	-44(%rbp), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	xorl	%ecx, %ecx
	callq	_sendFeedback
	testl	%eax, %eax
	je	LBB0_26
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	%r13d, -48(%rbp)
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%rbx), %esi
	movl	-48(%rbp), %edx
	movl	%r13d, %edi
	callq	_CalculateCopyStreamSleeptime
	movq	%rax, %rsi
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_24:                                ##   in Loop: Header=BB0_15 Depth=2
	movl	$0, %esi
	testl	%eax, %eax
	je	LBB0_26
LBB0_15:                                ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rbx), %edx
	movq	%r15, %rdi
	movq	%r12, %rcx
	callq	_CopyStreamReceive
	testl	%eax, %eax
	je	LBB0_2
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	cmpl	$-1, %eax
	je	LBB0_26
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=2
	cmpl	$-2, %eax
	je	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_15 Depth=2
	movq	-56(%rbp), %rdx
	movzbl	(%rdx), %ecx
	cmpb	$119, %cl
	je	LBB0_22
## %bb.20:                              ##   in Loop: Header=BB0_15 Depth=2
	cmpb	$107, %cl
	jne	LBB0_25
## %bb.21:                              ##   in Loop: Header=BB0_15 Depth=2
	movl	-44(%rbp), %r8d
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%eax, %ecx
	leaq	-48(%rbp), %r9
	callq	_ProcessKeepaliveMsg
	jmp	LBB0_24
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_15 Depth=2
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%eax, %ecx
	leaq	-44(%rbp), %r8
	callq	_ProcessXLogDataMsg
	testl	%eax, %eax
	je	LBB0_26
## %bb.23:                              ##   in Loop: Header=BB0_15 Depth=2
	movl	-44(%rbp), %edx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rcx
	callq	_CheckCopyStreamStop
	jmp	LBB0_24
LBB0_2:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	-44(%rbp), %edx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rcx
	callq	_CheckCopyStreamStop
	testl	%eax, %eax
	jne	LBB0_3
	jmp	LBB0_26
LBB0_18:
	movq	-56(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r14, %r8
	callq	_HandleEndOfCopyStream
	testq	%rax, %rax
	jne	LBB0_29
	jmp	LBB0_26
LBB0_25:
	movsbl	%cl, %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_pg_log_error
LBB0_26:
	movq	-56(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_28
## %bb.27:
	callq	_PQfreemem
LBB0_28:
	xorl	%eax, %eax
LBB0_29:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	movq	_current_walfile_name@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	8(%rbx), %rcx
	xorl	%eax, %eax
	callq	*8(%rcx)
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_pg_log_fatal
	movl	$1, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.comm	_still_sending,4,2              ## @still_sending
	.comm	_lastFlushPosition,4,2          ## @lastFlushPosition
	.comm	_walfile,8,3                    ## @walfile
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not fsync file \"%s\": %s"

	.comm	_current_walfile_name,4,2       ## @current_walfile_name
L_.str.1:                               ## @.str.1
	.asciz	"unrecognized streaming header: \"%c\""

	.no_dead_strip	_HandleCopyStream
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function HandleCopyStream
_HandleCopyStream:                      ; @HandleCopyStream
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	str	xzr, [sp, #8]
	mov	w8, #-1
	ldr	w2, [x1, #24]
	stp	w2, w8, [sp]
Lloh0:
	adrp	x23, _still_sending@GOTPAGE
Lloh1:
	ldr	x23, [x23, _still_sending@GOTPAGEOFF]
	mov	w8, #1
	str	w8, [x23]
	mov	x3, x19
	bl	_CheckCopyStreamStop
	cbz	w0, LBB0_25
; %bb.1:
Lloh2:
	adrp	x24, _lastFlushPosition@GOTPAGE
Lloh3:
	ldr	x24, [x24, _lastFlushPosition@GOTPAGEOFF]
Lloh4:
	adrp	x25, _walfile@GOTPAGE
Lloh5:
	ldr	x25, [x25, _walfile@GOTPAGEOFF]
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_16 Depth 2
	bl	_feGetCurrentTimestamp
	mov	x22, x0
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x24]
	ldr	w9, [sp]
	ldr	x0, [x25]
	cmp	w8, w9
	ccmp	x0, #0, #4, lt
	b.eq	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	blr	x8
	cbnz	x0, LBB0_28
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [sp]
	str	w1, [x24]
	mov	x0, x21
	mov	x2, x22
	mov	w3, #0
	bl	_sendFeedback
	cbz	w0, LBB0_25
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	str	w22, [sp, #4]
LBB0_7:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x23]
	cbz	w8, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w2, [x20, #4]
	cmp	w2, #1
	b.lt	LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [sp, #4]
	mov	x1, x22
	bl	_feTimestampDifferenceExceeds
	cbz	x0, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [sp]
	mov	x0, x21
	mov	x2, x22
	mov	w3, #0
	bl	_sendFeedback
	cbz	w0, LBB0_25
; %bb.11:                               ;   in Loop: Header=BB0_2 Depth=1
	str	w22, [sp, #4]
LBB0_12:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x20, #4]
	ldr	w2, [sp, #4]
	mov	x0, x22
	bl	_CalculateCopyStreamSleeptime
	mov	x1, x0
	b	LBB0_16
LBB0_13:                                ;   in Loop: Header=BB0_16 Depth=2
	mov	x4, sp
	mov	x0, x21
	mov	x1, x20
	bl	_ProcessXLogDataMsg
	cbz	w0, LBB0_25
; %bb.14:                               ;   in Loop: Header=BB0_16 Depth=2
	ldr	w2, [sp]
	mov	x0, x21
	mov	x1, x20
	mov	x3, x19
	bl	_CheckCopyStreamStop
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=2
	mov	x1, #0
	cbz	w0, LBB0_25
LBB0_16:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w2, [x20]
	add	x3, sp, #8
	mov	x0, x21
	bl	_CopyStreamReceive
	cbz	w0, LBB0_22
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=2
	mov	x3, x0
	cmn	w0, #1
	b.eq	LBB0_25
; %bb.18:                               ;   in Loop: Header=BB0_16 Depth=2
	cmn	w3, #2
	b.eq	LBB0_23
; %bb.19:                               ;   in Loop: Header=BB0_16 Depth=2
	ldr	x2, [sp, #8]
	ldrb	w8, [x2]
	cmp	w8, #119
	b.eq	LBB0_13
; %bb.20:                               ;   in Loop: Header=BB0_16 Depth=2
	cmp	w8, #107
	b.ne	LBB0_24
; %bb.21:                               ;   in Loop: Header=BB0_16 Depth=2
	ldr	w4, [sp]
	add	x5, sp, #4
	mov	x0, x21
	mov	x1, x20
	bl	_ProcessKeepaliveMsg
	b	LBB0_15
LBB0_22:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w2, [sp]
	mov	x0, x21
	mov	x1, x20
	mov	x3, x19
	bl	_CheckCopyStreamStop
	cbnz	w0, LBB0_2
	b	LBB0_25
LBB0_23:
	ldr	x2, [sp, #8]
	ldr	w3, [sp]
	mov	x0, x21
	mov	x1, x20
	mov	x4, x19
	bl	_HandleEndOfCopyStream
	cbnz	x0, LBB0_27
	b	LBB0_25
LBB0_24:
	sxtb	w1, w8
Lloh6:
	adrp	x0, l_.str.1@PAGE
Lloh7:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pg_log_error
LBB0_25:
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_27
; %bb.26:
	bl	_PQfreemem
	mov	x0, #0
LBB0_27:
	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
	add	sp, sp, #96
	ret
LBB0_28:
Lloh8:
	adrp	x8, _current_walfile_name@GOTPAGE
Lloh9:
	ldr	x8, [x8, _current_walfile_name@GOTPAGEOFF]
Lloh10:
	ldr	w19, [x8]
	ldr	x8, [x20, #8]
	ldr	x8, [x8, #8]
	blr	x8
	mov	x2, x0
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_pg_log_fatal
	mov	w0, #1
	bl	_exit
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_still_sending,4,2              ; @still_sending
	.comm	_lastFlushPosition,4,2          ; @lastFlushPosition
	.comm	_walfile,8,3                    ; @walfile
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not fsync file \"%s\": %s"

	.comm	_current_walfile_name,4,2       ; @current_walfile_name
l_.str.1:                               ; @.str.1
	.asciz	"unrecognized streaming header: \"%c\""

	.no_dead_strip	_HandleCopyStream
.subsections_via_symbols
