	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PGSemaphoreCreate              ## -- Begin function PGSemaphoreCreate
	.p2align	4, 0x90
_PGSemaphoreCreate:                     ## @PGSemaphoreCreate
	.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	_IsUnderPostmaster@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	$0, (%rax)
	sete	%dil
	callq	_Assert
	movq	_nextSemaNumber@GOTPCREL(%rip), %r14
	movq	(%r14), %rsi
	movq	_SEMAS_PER_SET@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	cmpq	%rdi, %rsi
	jl	LBB0_4
## %bb.1:
	movq	_numSemaSets@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	_maxSemaSets@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jb	LBB0_3
## %bb.2:
	movq	_PANIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_elog
	movq	(%rbx), %rdi
LBB0_3:
	callq	_IpcSemaphoreCreate
	movq	_mySemaSets@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%r15), %rdx
	movl	%eax, (%rcx,%rdx,4)
	incq	%rdx
	movq	%rdx, (%r15)
	movq	$0, (%r14)
	xorl	%esi, %esi
LBB0_4:
	movq	_numSharedSemas@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	_maxSharedSemas@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_6
## %bb.5:
	movq	_PANIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_elog
	movq	(%rbx), %rax
	movq	(%r14), %rsi
LBB0_6:
	movq	_sharedSemas@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	leaq	1(%rax), %rdx
	movq	%rdx, (%rbx)
	shlq	$4, %rax
	leaq	(%rcx,%rax), %rbx
	movq	_mySemaSets@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	_numSemaSets@GOTPCREL(%rip), %rdi
	movq	(%rdi), %rdi
	movl	-4(%rdx,%rdi,4), %edi
	movl	%edi, 8(%rcx,%rax)
	leaq	1(%rsi), %rdx
	movq	%rdx, (%r14)
	movq	%rsi, (%rcx,%rax)
	movl	$1, %edx
	callq	_IpcSemaphoreInitialize
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IsUnderPostmaster,4,2          ## @IsUnderPostmaster
	.comm	_nextSemaNumber,8,3             ## @nextSemaNumber
	.comm	_SEMAS_PER_SET,8,3              ## @SEMAS_PER_SET
	.comm	_numSemaSets,8,3                ## @numSemaSets
	.comm	_maxSemaSets,8,3                ## @maxSemaSets
	.comm	_PANIC,4,2                      ## @PANIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"too many semaphores created"

	.comm	_mySemaSets,8,3                 ## @mySemaSets
	.comm	_numSharedSemas,8,3             ## @numSharedSemas
	.comm	_maxSharedSemas,8,3             ## @maxSharedSemas
	.comm	_sharedSemas,8,3                ## @sharedSemas
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PGSemaphoreCreate              ; -- Begin function PGSemaphoreCreate
	.p2align	2
_PGSemaphoreCreate:                     ; @PGSemaphoreCreate
	.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
Lloh0:
	adrp	x8, _IsUnderPostmaster@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IsUnderPostmaster@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, #0
	cset	w0, eq
	bl	_Assert
Lloh3:
	adrp	x20, _nextSemaNumber@GOTPAGE
Lloh4:
	ldr	x20, [x20, _nextSemaNumber@GOTPAGEOFF]
	ldr	x1, [x20]
Lloh5:
	adrp	x19, _SEMAS_PER_SET@GOTPAGE
Lloh6:
	ldr	x19, [x19, _SEMAS_PER_SET@GOTPAGEOFF]
	ldr	x0, [x19]
Lloh7:
	adrp	x21, _mySemaSets@GOTPAGE
Lloh8:
	ldr	x21, [x21, _mySemaSets@GOTPAGEOFF]
Lloh9:
	adrp	x22, _numSemaSets@GOTPAGE
Lloh10:
	ldr	x22, [x22, _numSemaSets@GOTPAGEOFF]
	cmp	x1, x0
	b.lt	LBB0_4
; %bb.1:
	ldr	x8, [x22]
Lloh11:
	adrp	x9, _maxSemaSets@GOTPAGE
Lloh12:
	ldr	x9, [x9, _maxSemaSets@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lo	LBB0_3
; %bb.2:
Lloh14:
	adrp	x8, _PANIC@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PANIC@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
	ldr	x0, [x19]
LBB0_3:
	bl	_IpcSemaphoreCreate
	mov	x1, #0
	ldr	x8, [x21]
	ldr	x9, [x22]
	str	w0, [x8, x9, lsl #2]
	add	x8, x9, #1
	str	x8, [x22]
	str	xzr, [x20]
LBB0_4:
Lloh19:
	adrp	x19, _numSharedSemas@GOTPAGE
Lloh20:
	ldr	x19, [x19, _numSharedSemas@GOTPAGEOFF]
	ldr	x8, [x19]
Lloh21:
	adrp	x9, _maxSharedSemas@GOTPAGE
Lloh22:
	ldr	x9, [x9, _maxSharedSemas@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_6
; %bb.5:
Lloh24:
	adrp	x8, _PANIC@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PANIC@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
	ldr	x8, [x19]
	ldr	x1, [x20]
LBB0_6:
Lloh29:
	adrp	x9, _sharedSemas@GOTPAGE
Lloh30:
	ldr	x9, [x9, _sharedSemas@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	add	x10, x8, #1
	str	x10, [x19]
	add	x19, x9, x8, lsl #4
	ldr	x8, [x21]
	ldr	x9, [x22]
	add	x8, x8, x9, lsl #2
	ldur	w0, [x8, #-4]
	str	w0, [x19, #8]
	add	x8, x1, #1
	str	x8, [x20]
	str	x1, [x19]
	mov	w2, #1
	bl	_IpcSemaphoreInitialize
	mov	x0, x19
	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
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_IsUnderPostmaster,4,2          ; @IsUnderPostmaster
	.comm	_nextSemaNumber,8,3             ; @nextSemaNumber
	.comm	_SEMAS_PER_SET,8,3              ; @SEMAS_PER_SET
	.comm	_numSemaSets,8,3                ; @numSemaSets
	.comm	_maxSemaSets,8,3                ; @maxSemaSets
	.comm	_PANIC,4,2                      ; @PANIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"too many semaphores created"

	.comm	_mySemaSets,8,3                 ; @mySemaSets
	.comm	_numSharedSemas,8,3             ; @numSharedSemas
	.comm	_maxSharedSemas,8,3             ; @maxSharedSemas
	.comm	_sharedSemas,8,3                ; @sharedSemas
.subsections_via_symbols
