	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ConnectDatabase                ## -- Begin function ConnectDatabase
	.p2align	4, 0x90
_ConnectDatabase:                       ## @ConnectDatabase
	.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	$280, %rsp                      ## imm = 0x118
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r14
	movq	%r8, -312(%rbp)                 ## 8-byte Spill
	movq	%rcx, -304(%rbp)                ## 8-byte Spill
	movq	%rdx, -296(%rbp)                ## 8-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	cmpq	$0, 8(%rdi)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_fatal
LBB0_2:
	movq	(%rbx), %r12
	movq	_TRI_YES@GOTPCREL(%rip), %rax
	cmpq	%r14, (%rax)
	jne	LBB0_5
## %bb.3:
	testq	%r12, %r12
	jne	LBB0_5
## %bb.4:
	leaq	-160(%rbp), %r12
	leaq	L_.str.1(%rip), %rdi
	movq	%r12, %rsi
	movl	$100, %edx
	xorl	%ecx, %ecx
	callq	_simple_prompt
LBB0_5:
	movq	%r14, 16(%rbx)
	leaq	-160(%rbp), %r13
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	leaq	L_.str.2(%rip), %rax
	movq	%rax, -224(%rbp)
	movq	-296(%rbp), %rax                ## 8-byte Reload
	movq	%rax, -288(%rbp)
	leaq	L_.str.3(%rip), %rax
	movq	%rax, -216(%rbp)
	movq	-304(%rbp), %rax                ## 8-byte Reload
	movq	%rax, -280(%rbp)
	leaq	L_.str.4(%rip), %rax
	movq	%rax, -208(%rbp)
	movq	-312(%rbp), %rax                ## 8-byte Reload
	movq	%rax, -272(%rbp)
	leaq	L_.str.5(%rip), %rax
	movq	%rax, -200(%rbp)
	movq	%r12, -264(%rbp)
	leaq	L_.str.6(%rip), %rax
	movq	%rax, -192(%rbp)
	movq	%r15, -256(%rbp)
	leaq	L_.str.7(%rip), %rax
	movq	%rax, -184(%rbp)
	movq	_progname@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -248(%rbp)
	movq	$0, -176(%rbp)
	movq	$0, -240(%rbp)
	leaq	-224(%rbp), %rdi
	leaq	-288(%rbp), %rsi
	movl	$1, %edx
	callq	_PQconnectdbParams
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	leaq	L_.str.8(%rip), %rdi
	xorl	%eax, %eax
	callq	_fatal
	movq	8(%rbx), %rax
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %rdi
	callq	_PQstatus
	movq	_CONNECTION_BAD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	8(%rbx), %rdi
	callq	_PQconnectionNeedsPassword
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	testq	%r12, %r12
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_TRI_NO@GOTPCREL(%rip), %rax
	cmpq	%r14, (%rax)
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	8(%rbx), %rdi
	callq	_PQfinish
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	movl	$100, %edx
	xorl	%ecx, %ecx
	callq	_simple_prompt
	movq	%r13, %r12
	jmp	LBB0_6
LBB0_13:
	movq	8(%rbx), %rdi
	callq	_PQstatus
	movq	_CONNECTION_BAD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.14:
	movq	8(%rbx), %rdi
	callq	_PQdb
	testq	%rax, %rax
	je	LBB0_15
## %bb.16:
	movq	8(%rbx), %rdi
	callq	_PQdb
	movq	%rax, %r14
	jmp	LBB0_17
LBB0_15:
	leaq	L_.str.10(%rip), %r14
LBB0_17:
	movq	8(%rbx), %rdi
	callq	_PQerrorMessage
	leaq	L_.str.9(%rip), %rdi
	movq	%r14, %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_fatal
LBB0_18:
	movq	_ALWAYS_SECURE_SEARCH_PATH_SQL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ExecuteSqlQueryForSingleRow
	movl	%eax, %edi
	callq	_PQclear
	movq	8(%rbx), %rdi
	callq	_PQconnectionUsedPassword
	testq	%rax, %rax
	je	LBB0_22
## %bb.19:
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_21
## %bb.20:
	callq	_free
LBB0_21:
	movq	8(%rbx), %rdi
	callq	_PQpass
	movl	%eax, %edi
	callq	_pg_strdup
	movq	%rax, (%rbx)
LBB0_22:
	movq	%rbx, %rdi
	callq	__check_database_version
	movq	8(%rbx), %rdi
	movq	_notice_processor@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_PQsetNoticeProcessor
	movq	8(%rbx), %rsi
	movq	%rbx, %rdi
	callq	_set_archive_cancel_info
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_24
## %bb.23:
	addq	$280, %rsp                      ## imm = 0x118
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"already connected to a database"

	.comm	_TRI_YES,8,3                    ## @TRI_YES
L_.str.1:                               ## @.str.1
	.asciz	"Password: "

L_.str.2:                               ## @.str.2
	.asciz	"host"

L_.str.3:                               ## @.str.3
	.asciz	"port"

L_.str.4:                               ## @.str.4
	.asciz	"user"

L_.str.5:                               ## @.str.5
	.asciz	"password"

L_.str.6:                               ## @.str.6
	.asciz	"dbname"

L_.str.7:                               ## @.str.7
	.asciz	"fallback_application_name"

	.comm	_progname,8,3                   ## @progname
L_.str.8:                               ## @.str.8
	.asciz	"could not connect to database"

	.comm	_CONNECTION_BAD,8,3             ## @CONNECTION_BAD
	.comm	_TRI_NO,8,3                     ## @TRI_NO
L_.str.9:                               ## @.str.9
	.asciz	"connection to database \"%s\" failed: %s"

L_.str.10:                              ## @.str.10
	.space	1

	.comm	_ALWAYS_SECURE_SEARCH_PATH_SQL,4,2 ## @ALWAYS_SECURE_SEARCH_PATH_SQL
	.comm	_notice_processor,4,2           ## @notice_processor
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ConnectDatabase                ; -- Begin function ConnectDatabase
	.p2align	2
_ConnectDatabase:                       ; @ConnectDatabase
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #352
	.cfi_def_cfa_offset 352
	stp	x28, x27, [sp, #256]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #272]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #288]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #304]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #320]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #336]            ; 16-byte Folded Spill
	add	x29, sp, #336
	.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	x20, x5
	mov	x21, x4
	mov	x22, x3
	mov	x23, x2
	mov	x24, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_fatal
LBB0_2:
	ldr	x27, [x19]
Lloh5:
	adrp	x8, _TRI_YES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TRI_YES@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cmp	x8, x20
	ccmp	x27, #0, #0, eq
	b.ne	LBB0_4
; %bb.3:
	add	x27, sp, #140
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	add	x1, sp, #140
	mov	w2, #100
	mov	w3, #0
	bl	_simple_prompt
LBB0_4:
	str	x20, [x19, #16]
Lloh10:
	adrp	x28, _CONNECTION_BAD@GOTPAGE
Lloh11:
	ldr	x28, [x28, _CONNECTION_BAD@GOTPAGEOFF]
Lloh12:
	adrp	x25, _TRI_NO@GOTPAGE
Lloh13:
	ldr	x25, [x25, _TRI_NO@GOTPAGEOFF]
Lloh14:
	adrp	x26, l_.str.1@PAGE
Lloh15:
	add	x26, x26, l_.str.1@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
Lloh16:
	adrp	x8, l_.str.2@PAGE
Lloh17:
	add	x9, x8, l_.str.2@PAGEOFF
Lloh18:
	adrp	x8, l_.str.3@PAGE
Lloh19:
	add	x8, x8, l_.str.3@PAGEOFF
	stp	x9, x8, [sp, #80]
	stp	x23, x22, [sp, #24]
Lloh20:
	adrp	x8, l_.str.4@PAGE
Lloh21:
	add	x9, x8, l_.str.4@PAGEOFF
Lloh22:
	adrp	x8, l_.str.5@PAGE
Lloh23:
	add	x8, x8, l_.str.5@PAGEOFF
	stp	x9, x8, [sp, #96]
	stp	x21, x27, [sp, #40]
Lloh24:
	adrp	x8, l_.str.6@PAGE
Lloh25:
	add	x9, x8, l_.str.6@PAGEOFF
Lloh26:
	adrp	x8, l_.str.7@PAGE
Lloh27:
	add	x8, x8, l_.str.7@PAGEOFF
	stp	x9, x8, [sp, #112]
Lloh28:
	adrp	x8, _progname@GOTPAGE
Lloh29:
	ldr	x8, [x8, _progname@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	stp	x24, x8, [sp, #56]
	str	xzr, [sp, #128]
	str	xzr, [sp, #72]
	add	x0, sp, #80
	add	x1, sp, #24
	mov	w2, #1
	bl	_PQconnectdbParams
	str	x0, [x19, #8]
	cbnz	x0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh31:
	adrp	x0, l_.str.8@PAGE
Lloh32:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_fatal
	ldr	x0, [x19, #8]
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	bl	_PQstatus
	ldr	x8, [x28]
	cmp	x0, x8
	b.ne	LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x0, [x19, #8]
	bl	_PQconnectionNeedsPassword
	cbz	x0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	cbnz	x27, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x25]
	cmp	x8, x20
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
	add	x27, sp, #140
	ldr	x0, [x19, #8]
	bl	_PQfinish
	add	x1, sp, #140
	mov	x0, x26
	mov	w2, #100
	mov	w3, #0
	bl	_simple_prompt
	b	LBB0_5
LBB0_12:
	ldr	x0, [x19, #8]
	bl	_PQstatus
	ldr	x8, [x28]
	cmp	x0, x8
	b.ne	LBB0_17
; %bb.13:
	ldr	x0, [x19, #8]
	bl	_PQdb
	cbz	x0, LBB0_15
; %bb.14:
	ldr	x0, [x19, #8]
	bl	_PQdb
	mov	x20, x0
	b	LBB0_16
LBB0_15:
Lloh33:
	adrp	x20, l_.str.10@PAGE
Lloh34:
	add	x20, x20, l_.str.10@PAGEOFF
LBB0_16:
	ldr	x0, [x19, #8]
	bl	_PQerrorMessage
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x20, x0, [sp]
Lloh35:
	adrp	x0, l_.str.9@PAGE
Lloh36:
	add	x0, x0, l_.str.9@PAGEOFF
	bl	_fatal
LBB0_17:
Lloh37:
	adrp	x8, _ALWAYS_SECURE_SEARCH_PATH_SQL@GOTPAGE
Lloh38:
	ldr	x8, [x8, _ALWAYS_SECURE_SEARCH_PATH_SQL@GOTPAGEOFF]
Lloh39:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ExecuteSqlQueryForSingleRow
	bl	_PQclear
	ldr	x0, [x19, #8]
	bl	_PQconnectionUsedPassword
	cbz	x0, LBB0_21
; %bb.18:
	ldr	x0, [x19]
	cbz	x0, LBB0_20
; %bb.19:
	bl	_free
LBB0_20:
	ldr	x0, [x19, #8]
	bl	_PQpass
	bl	_pg_strdup
	str	x0, [x19]
LBB0_21:
	mov	x0, x19
	bl	__check_database_version
	ldr	x0, [x19, #8]
Lloh40:
	adrp	x8, _notice_processor@GOTPAGE
Lloh41:
	ldr	x8, [x8, _notice_processor@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
	mov	x2, #0
	bl	_PQsetNoticeProcessor
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_set_archive_cancel_info
	ldur	x8, [x29, #-96]
Lloh43:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh44:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh45:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_23
; %bb.22:
	ldp	x29, x30, [sp, #336]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #320]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #304]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #288]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #272]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #256]            ; 16-byte Folded Reload
	add	sp, sp, #352
	ret
LBB0_23:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdrp	Lloh24, Lloh26
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdrp	Lloh20, Lloh22
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdrp	Lloh16, Lloh18
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"already connected to a database"

	.comm	_TRI_YES,8,3                    ; @TRI_YES
l_.str.1:                               ; @.str.1
	.asciz	"Password: "

l_.str.2:                               ; @.str.2
	.asciz	"host"

l_.str.3:                               ; @.str.3
	.asciz	"port"

l_.str.4:                               ; @.str.4
	.asciz	"user"

l_.str.5:                               ; @.str.5
	.asciz	"password"

l_.str.6:                               ; @.str.6
	.asciz	"dbname"

l_.str.7:                               ; @.str.7
	.asciz	"fallback_application_name"

	.comm	_progname,8,3                   ; @progname
l_.str.8:                               ; @.str.8
	.asciz	"could not connect to database"

	.comm	_CONNECTION_BAD,8,3             ; @CONNECTION_BAD
	.comm	_TRI_NO,8,3                     ; @TRI_NO
l_.str.9:                               ; @.str.9
	.asciz	"connection to database \"%s\" failed: %s"

l_.str.10:                              ; @.str.10
	.space	1

	.comm	_ALWAYS_SECURE_SEARCH_PATH_SQL,4,2 ; @ALWAYS_SECURE_SEARCH_PATH_SQL
	.comm	_notice_processor,4,2           ; @notice_processor
.subsections_via_symbols
