	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sem_alloc
_sem_alloc:                             ## @sem_alloc
	.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	_SEM_VALUE_MAX@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jae	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_3:
	movl	%edx, %r14d
	movl	%esi, %r15d
	movl	%edi, %ebx
	movl	$4, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movl	%ebx, %ecx
	movq	%rcx, 24(%rax)
	movq	$0, 16(%rax)
	movq	_SEM_MAGIC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 8(%rax)
	movl	%r15d, 4(%rax)
	movl	%r14d, (%rax)
	jmp	LBB0_6
LBB0_4:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
LBB0_2:
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	xorl	%eax, %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SEM_VALUE_MAX,4,2              ## @SEM_VALUE_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_SEM_MAGIC,4,2                  ## @SEM_MAGIC
	.no_dead_strip	_sem_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sem_alloc
_sem_alloc:                             ; @sem_alloc
	.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, _SEM_VALUE_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SEM_VALUE_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.hs	LBB0_2
; %bb.1:
	mov	x0, #0
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_5
LBB0_2:
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	mov	w0, #4
	bl	_malloc
	cbz	x0, LBB0_4
; %bb.3:
	mov	w8, w21
	stp	xzr, x8, [x0, #16]
Lloh5:
	adrp	x8, _SEM_MAGIC@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SEM_MAGIC@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	stp	w20, w8, [x0, #4]
	str	w19, [x0]
	b	LBB0_6
LBB0_4:
Lloh8:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _errno@GOTPAGE
Lloh11:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh12:
	str	w8, [x9]
LBB0_6:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_SEM_VALUE_MAX,4,2              ; @SEM_VALUE_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_SEM_MAGIC,4,2                  ; @SEM_MAGIC
	.no_dead_strip	_sem_alloc
.subsections_via_symbols
