	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_AllocateFile                   ## -- Begin function AllocateFile
	.p2align	4, 0x90
_AllocateFile:                          ## @AllocateFile
	.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	%rsi, %r14
	movq	%rdi, %r13
	movq	_LOG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_numAllocatedDescs@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rcx
	callq	_elog
	movl	%eax, %edi
	callq	_DO_DB
	xorl	%eax, %eax
	callq	_reserveAllocatedDesc
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_ERRCODE_INSUFFICIENT_RESOURCES@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	movq	_maxAllocatedDescs@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	_errmsg
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_ereport
LBB0_2:
	xorl	%eax, %eax
	callq	_ReleaseLruFiles
	movq	_errno@GOTPCREL(%rip), %r15
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_LOG@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_ERRCODE_INSUFFICIENT_RESOURCES@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_errmsg
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_ereport
	movl	$0, (%r15)
	xorl	%eax, %eax
	callq	_ReleaseLruFile
	testq	%rax, %rax
	je	LBB0_8
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_fopen
	testq	%rax, %rax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r15), %r12d
	movq	_EMFILE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_ENFILE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_7
	jmp	LBB0_9
LBB0_8:
	movl	%r12d, (%r15)
LBB0_9:
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_4:
	movq	_allocatedDescs@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r14
	movq	_numAllocatedDescs@GOTPCREL(%rip), %r15
	movq	(%r15), %rbx
	movq	_AllocateDescFile@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	shlq	$4, %rbx
	movl	%ecx, 12(%r14,%rbx)
	movq	%rax, (%r14,%rbx)
	xorl	%eax, %eax
	callq	_GetCurrentSubTransactionId
	movl	%eax, 8(%r14,%rbx)
	incq	(%r15)
	movq	(%r14,%rbx), %rax
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LOG,4,2                        ## @LOG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"AllocateFile: Allocated %d (%s)"

	.comm	_numAllocatedDescs,8,3          ## @numAllocatedDescs
	.comm	_ERROR,4,2                      ## @ERROR
	.comm	_ERRCODE_INSUFFICIENT_RESOURCES,4,2 ## @ERRCODE_INSUFFICIENT_RESOURCES
L_.str.1:                               ## @.str.1
	.asciz	"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\""

	.comm	_maxAllocatedDescs,4,2          ## @maxAllocatedDescs
	.comm	_allocatedDescs,8,3             ## @allocatedDescs
	.comm	_AllocateDescFile,4,2           ## @AllocateDescFile
	.comm	_errno,4,2                      ## @errno
	.comm	_EMFILE,4,2                     ## @EMFILE
	.comm	_ENFILE,4,2                     ## @ENFILE
L_.str.2:                               ## @.str.2
	.asciz	"out of file descriptors: %m; release and retry"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_AllocateFile                   ; -- Begin function AllocateFile
	.p2align	2
_AllocateFile:                          ; @AllocateFile
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	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
	.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	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x24, _LOG@GOTPAGE
Lloh1:
	ldr	x24, [x24, _LOG@GOTPAGEOFF]
	ldr	w0, [x24]
Lloh2:
	adrp	x8, _numAllocatedDescs@GOTPAGE
Lloh3:
	ldr	x8, [x8, _numAllocatedDescs@GOTPAGEOFF]
Lloh4:
	ldr	x2, [x8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x20
	bl	_elog
	bl	_DO_DB
	bl	_reserveAllocatedDesc
Lloh7:
	adrp	x25, _ERRCODE_INSUFFICIENT_RESOURCES@GOTPAGE
Lloh8:
	ldr	x25, [x25, _ERRCODE_INSUFFICIENT_RESOURCES@GOTPAGEOFF]
	cbnz	w0, LBB0_2
; %bb.1:
Lloh9:
	adrp	x8, _ERROR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w21, [x8]
	ldr	w0, [x25]
	bl	_errcode
Lloh12:
	adrp	x8, _maxAllocatedDescs@GOTPAGE
Lloh13:
	ldr	x8, [x8, _maxAllocatedDescs@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	stp	x8, x20, [sp]
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_errmsg
	mov	x1, x0
	mov	x0, x21
	bl	_ereport
LBB0_2:
	bl	_ReleaseLruFiles
Lloh17:
	adrp	x26, _errno@GOTPAGE
Lloh18:
	ldr	x26, [x26, _errno@GOTPAGEOFF]
Lloh19:
	adrp	x27, _EMFILE@GOTPAGE
Lloh20:
	ldr	x27, [x27, _EMFILE@GOTPAGEOFF]
Lloh21:
	adrp	x21, l_.str.2@PAGE
Lloh22:
	add	x21, x21, l_.str.2@PAGEOFF
Lloh23:
	adrp	x28, _ENFILE@GOTPAGE
Lloh24:
	ldr	x28, [x28, _ENFILE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_fopen
	cbnz	x0, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w23, [x26]
	ldr	w8, [x27]
	ldr	w9, [x28]
	cmp	w23, w8
	ccmp	w23, w9, #4, ne
	b.ne	LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w22, [x24]
	ldr	w0, [x25]
	bl	_errcode
	mov	x0, x21
	bl	_errmsg
	mov	x1, x0
	mov	x0, x22
	bl	_ereport
	str	wzr, [x26]
	bl	_ReleaseLruFile
	cbnz	x0, LBB0_3
; %bb.6:
	str	w23, [x26]
	b	LBB0_9
LBB0_7:
Lloh25:
	adrp	x8, _allocatedDescs@GOTPAGE
Lloh26:
	ldr	x8, [x8, _allocatedDescs@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
Lloh28:
	adrp	x20, _numAllocatedDescs@GOTPAGE
Lloh29:
	ldr	x20, [x20, _numAllocatedDescs@GOTPAGEOFF]
	ldr	x9, [x20]
Lloh30:
	adrp	x10, _AllocateDescFile@GOTPAGE
Lloh31:
	ldr	x10, [x10, _AllocateDescFile@GOTPAGEOFF]
Lloh32:
	ldr	w10, [x10]
	add	x19, x8, x9, lsl #4
	str	w10, [x19, #12]
	str	x0, [x19]
	bl	_GetCurrentSubTransactionId
	str	w0, [x19, #8]
	ldr	x8, [x20]
	add	x8, x8, #1
	str	x8, [x20]
	ldr	x0, [x19]
	b	LBB0_9
LBB0_8:
	mov	x0, #0
LBB0_9:
	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
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_LOG,4,2                        ; @LOG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"AllocateFile: Allocated %d (%s)"

	.comm	_numAllocatedDescs,8,3          ; @numAllocatedDescs
	.comm	_ERROR,4,2                      ; @ERROR
	.comm	_ERRCODE_INSUFFICIENT_RESOURCES,4,2 ; @ERRCODE_INSUFFICIENT_RESOURCES
l_.str.1:                               ; @.str.1
	.asciz	"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\""

	.comm	_maxAllocatedDescs,4,2          ; @maxAllocatedDescs
	.comm	_allocatedDescs,8,3             ; @allocatedDescs
	.comm	_AllocateDescFile,4,2           ; @AllocateDescFile
	.comm	_errno,4,2                      ; @errno
	.comm	_EMFILE,4,2                     ; @EMFILE
	.comm	_ENFILE,4,2                     ; @ENFILE
l_.str.2:                               ; @.str.2
	.asciz	"out of file descriptors: %m; release and retry"

.subsections_via_symbols
