	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function IpcSemaphoreCreate
_IpcSemaphoreCreate:                    ## @IpcSemaphoreCreate
	.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
	movl	%edi, %r12d
	leal	1(%r12), %r15d
	movq	_nextSemaKey@GOTPCREL(%rip), %r13
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
LBB0_1:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$2, %r14d
	je	LBB0_15
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	incl	%edi
	movl	%edi, (%r13)
	movl	%r15d, %esi
	callq	_InternalIpcSemaphoreCreate
	testq	%rax, %rax
	jns	LBB0_14
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r13), %edi
	movl	%r15d, %esi
	xorl	%edx, %edx
	callq	_semget
	movq	%rax, %rbx
	movl	$4, %r14d
	testq	%rax, %rax
	js	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_IpcSemaphoreGetValue
	movq	_PGSemaMagic@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_IpcSemaphoreGetLastPID
	testq	%rax, %rax
	jle	LBB0_1
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %r12
	xorl	%eax, %eax
	callq	_getpid
	cmpq	%rax, %r12
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_kill
	testq	%rax, %rax
	je	LBB0_1
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_ESRCH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_IPC_RMID@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	callq	_semctl
	testq	%rax, %rax
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	js	LBB0_2
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r13), %edi
	movl	%r15d, %esi
	callq	_InternalIpcSemaphoreCreate
	movq	%rax, %rbx
	movq	%rax, %r14
	shrq	$62, %r14
	notl	%r14d
	andl	$2, %r14d
	jmp	LBB0_2
LBB0_14:
	movq	%rax, %rbx
LBB0_15:
	movq	_PGSemaMagic@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	decq	%rdx
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_IpcSemaphoreInitialize
	movq	%rbx, -56(%rbp)
	movl	%r12d, -64(%rbp)
	leaq	-64(%rbp), %rdi
	callq	_PGSemaphoreUnlock
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_nextSemaKey,4,2                ## @nextSemaKey
	.comm	_PGSemaMagic,8,3                ## @PGSemaMagic
	.comm	_errno,8,3                      ## @errno
	.comm	_ESRCH,8,3                      ## @ESRCH
	.comm	_IPC_RMID,4,2                   ## @IPC_RMID
	.no_dead_strip	_IpcSemaphoreCreate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function IpcSemaphoreCreate
_IpcSemaphoreCreate:                    ; @IpcSemaphoreCreate
	.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, x0
	add	w20, w0, #1
Lloh0:
	adrp	x24, _nextSemaKey@GOTPAGE
Lloh1:
	ldr	x24, [x24, _nextSemaKey@GOTPAGEOFF]
Lloh2:
	adrp	x23, _PGSemaMagic@GOTPAGE
Lloh3:
	ldr	x23, [x23, _PGSemaMagic@GOTPAGEOFF]
Lloh4:
	adrp	x25, _IPC_RMID@GOTPAGE
Lloh5:
	ldr	x25, [x25, _IPC_RMID@GOTPAGEOFF]
Lloh6:
	adrp	x26, _errno@GOTPAGE
Lloh7:
	ldr	x26, [x26, _errno@GOTPAGEOFF]
Lloh8:
	adrp	x27, _ESRCH@GOTPAGE
Lloh9:
	ldr	x27, [x27, _ESRCH@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	add	w0, w8, #1
	str	w0, [x24]
	mov	x1, x20
	bl	_InternalIpcSemaphoreCreate
	tbz	x0, #63, LBB0_11
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x24]
	mov	x1, x20
	mov	w2, #0
	bl	_semget
	mov	x21, x0
	tbnz	x0, #63, LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x21
	mov	x1, x19
	bl	_IpcSemaphoreGetValue
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x21
	mov	x1, x19
	bl	_IpcSemaphoreGetLastPID
	cmp	x0, #1
	b.lt	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x22, x0
	bl	_getpid
	cmp	x22, x0
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x22
	mov	w1, #0
	bl	_kill
	cbz	x0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x26]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w2, [x25]
	mov	x0, x21
	mov	w1, #0
	mov	x3, #0
	bl	_semctl
	tbnz	x0, #63, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x24]
	mov	x1, x20
	bl	_InternalIpcSemaphoreCreate
	mov	x21, x0
	lsr	x8, x0, #62
	mvn	w8, w8
	and	w8, w8, #0x2
	cmp	w8, #2
	b.ne	LBB0_1
	b	LBB0_12
LBB0_10:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w8, #4
	cmp	w8, #2
	b.ne	LBB0_1
	b	LBB0_12
LBB0_11:
	mov	x21, x0
LBB0_12:
	ldr	x8, [x23]
	sub	x2, x8, #1
	mov	x0, x21
	mov	x1, x19
	bl	_IpcSemaphoreInitialize
	str	x21, [sp, #8]
	str	w19, [sp]
	mov	x0, sp
	bl	_PGSemaphoreUnlock
	mov	x0, x21
	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	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_nextSemaKey,4,2                ; @nextSemaKey
	.comm	_PGSemaMagic,8,3                ; @PGSemaMagic
	.comm	_errno,8,3                      ; @errno
	.comm	_ESRCH,8,3                      ; @ESRCH
	.comm	_IPC_RMID,4,2                   ; @IPC_RMID
	.no_dead_strip	_IpcSemaphoreCreate
.subsections_via_symbols
