	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pqEndcopy3                     ## -- Begin function pqEndcopy3
	.p2align	4, 0x90
_pqEndcopy3:                            ## @pqEndcopy3
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	_PGASYNC_COPY_IN@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	movq	_PGASYNC_COPY_BOTH@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rdx, %rax
	je	LBB0_4
## %bb.1:
	movq	_PGASYNC_COPY_OUT@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rax
	je	LBB0_4
## %bb.2:
	cmpq	%rcx, %rax
	je	LBB0_4
## %bb.3:
	addq	$16, %rbx
	leaq	L_.str(%rip), %rdi
	callq	_libpq_gettext
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_printfPQExpBuffer
LBB0_23:
	movl	$1, %r14d
LBB0_24:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	cmpq	%rdx, %rax
	je	LBB0_6
## %bb.5:
	cmpq	%rcx, %rax
	je	LBB0_6
LBB0_11:
	movq	%rbx, %rdi
	callq	_pqFlush
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	callq	_pqIsnonblocking
	movl	$1, %r14d
	testq	%rax, %rax
	jne	LBB0_24
LBB0_13:
	movq	_PGASYNC_BUSY@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	leaq	16(%rbx), %r15
	movq	%r15, %rdi
	callq	_resetPQExpBuffer
	movq	%rbx, %rdi
	callq	_pqIsnonblocking
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	%rbx, %rdi
	callq	_PQisBusy
	movl	$1, %r14d
	testq	%rax, %rax
	jne	LBB0_24
LBB0_15:
	movq	%rbx, %rdi
	callq	_PQgetResult
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_18
## %bb.16:
	movq	(%r14), %rax
	movq	_PGRES_COMMAND_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.17:
	movq	%r14, %rdi
	callq	_PQclear
	xorl	%r14d, %r14d
	jmp	LBB0_24
LBB0_6:
	movl	$99, %edi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	callq	_pqPutMsgStart
	movl	$1, %r14d
	testq	%rax, %rax
	js	LBB0_24
## %bb.7:
	movq	%rbx, %rdi
	callq	_pqPutMsgEnd
	testq	%rax, %rax
	js	LBB0_24
## %bb.8:
	movq	8(%rbx), %rax
	movq	_PGQUERY_SIMPLE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.9:
	movl	$83, %edi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	callq	_pqPutMsgStart
	testq	%rax, %rax
	js	LBB0_24
## %bb.10:
	movq	%rbx, %rdi
	callq	_pqPutMsgEnd
	testq	%rax, %rax
	jns	LBB0_11
	jmp	LBB0_24
LBB0_18:
	movl	(%r15), %eax
	testl	%eax, %eax
	jle	LBB0_22
## %bb.19:
	movq	24(%rbx), %rdx
	decl	%eax
	movb	(%rdx,%rax), %r15b
	cmpb	$10, %r15b
	jne	LBB0_21
## %bb.20:
	movb	$0, (%rdx,%rax)
	movq	24(%rbx), %rdx
LBB0_21:
	leaq	32(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_pqInternalNotice
	movq	24(%rbx), %rax
	movslq	16(%rbx), %rcx
	movb	%r15b, -1(%rcx,%rax)
LBB0_22:
	movq	%r14, %rdi
	callq	_PQclear
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.comm	_PGASYNC_COPY_IN,8,3            ## @PGASYNC_COPY_IN
	.comm	_PGASYNC_COPY_OUT,8,3           ## @PGASYNC_COPY_OUT
	.comm	_PGASYNC_COPY_BOTH,8,3          ## @PGASYNC_COPY_BOTH
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no COPY in progress\n"

	.comm	_PGQUERY_SIMPLE,8,3             ## @PGQUERY_SIMPLE
	.comm	_PGASYNC_BUSY,8,3               ## @PGASYNC_BUSY
	.comm	_PGRES_COMMAND_OK,8,3           ## @PGRES_COMMAND_OK
L_.str.1:                               ## @.str.1
	.asciz	"%s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pqEndcopy3                     ; -- Begin function pqEndcopy3
	.p2align	2
_pqEndcopy3:                            ; @pqEndcopy3
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _PGASYNC_COPY_IN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PGASYNC_COPY_IN@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _PGASYNC_COPY_OUT@GOTPAGE
Lloh4:
	ldr	x10, [x10, _PGASYNC_COPY_OUT@GOTPAGEOFF]
Lloh5:
	ldr	x11, [x10]
Lloh6:
	adrp	x10, _PGASYNC_COPY_BOTH@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PGASYNC_COPY_BOTH@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x11, #4, ne
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_14
; %bb.1:
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_7
; %bb.2:
	mov	w0, #99
	mov	w1, #0
	mov	x2, x19
	bl	_pqPutMsgStart
	tbnz	x0, #63, LBB0_15
; %bb.3:
	mov	x0, x19
	bl	_pqPutMsgEnd
	tbnz	x0, #63, LBB0_15
; %bb.4:
	ldr	x8, [x19, #8]
Lloh9:
	adrp	x9, _PGQUERY_SIMPLE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PGQUERY_SIMPLE@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_7
; %bb.5:
	mov	w0, #83
	mov	w1, #0
	mov	x2, x19
	bl	_pqPutMsgStart
	tbnz	x0, #63, LBB0_15
; %bb.6:
	mov	x0, x19
	bl	_pqPutMsgEnd
	tbnz	x0, #63, LBB0_15
LBB0_7:
	mov	x0, x19
	bl	_pqFlush
	cbz	x0, LBB0_9
; %bb.8:
	mov	x0, x19
	bl	_pqIsnonblocking
	cbnz	x0, LBB0_15
LBB0_9:
Lloh12:
	adrp	x8, _PGASYNC_BUSY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PGASYNC_BUSY@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	mov	x21, x19
	str	x8, [x21], #16
	mov	x0, x21
	bl	_resetPQExpBuffer
	mov	x0, x19
	bl	_pqIsnonblocking
	cbz	x0, LBB0_11
; %bb.10:
	mov	x0, x19
	bl	_PQisBusy
	cbnz	x0, LBB0_15
LBB0_11:
	mov	x0, x19
	bl	_PQgetResult
	mov	x20, x0
	cbz	x0, LBB0_17
; %bb.12:
	ldr	x8, [x20]
Lloh15:
	adrp	x9, _PGRES_COMMAND_OK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PGRES_COMMAND_OK@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_17
; %bb.13:
	mov	x0, x20
	bl	_PQclear
	mov	w0, #0
	b	LBB0_16
LBB0_14:
	add	x19, x19, #16
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_libpq_gettext
	mov	x1, x0
	mov	x0, x19
	bl	_printfPQExpBuffer
LBB0_15:
	mov	w0, #1
LBB0_16:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_17:
	ldr	w8, [x21]
	subs	w8, w8, #1
	b.lt	LBB0_21
; %bb.18:
	ldr	x2, [x19, #24]
	ldrb	w21, [x2, x8]
	cmp	w21, #10
	b.ne	LBB0_20
; %bb.19:
	strb	wzr, [x2, x8]
	ldr	x2, [x19, #24]
LBB0_20:
	add	x0, x19, #32
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_pqInternalNotice
	ldr	x8, [x19, #24]
	ldrsw	x9, [x19, #16]
	add	x8, x9, x8
	sturb	w21, [x8, #-1]
LBB0_21:
	mov	x0, x20
	bl	_PQclear
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_PGASYNC_COPY_IN,8,3            ; @PGASYNC_COPY_IN
	.comm	_PGASYNC_COPY_OUT,8,3           ; @PGASYNC_COPY_OUT
	.comm	_PGASYNC_COPY_BOTH,8,3          ; @PGASYNC_COPY_BOTH
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no COPY in progress\n"

	.comm	_PGQUERY_SIMPLE,8,3             ; @PGQUERY_SIMPLE
	.comm	_PGASYNC_BUSY,8,3               ; @PGASYNC_BUSY
	.comm	_PGRES_COMMAND_OK,8,3           ; @PGRES_COMMAND_OK
l_.str.1:                               ; @.str.1
	.asciz	"%s"

.subsections_via_symbols
