	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_test_named                     ## -- Begin function test_named
	.p2align	4, 0x90
_test_named:                            ## @test_named
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	leaq	L_str(%rip), %rdi
	callq	_puts
	movq	_SEM_NAME@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_sem_unlink
	movl	(%rbx), %edi
	movq	_O_CREAT@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	$511, %edx                      ## imm = 0x1FF
	xorl	%ecx, %ecx
	callq	_sem_open
	movq	%rax, %r14
	movq	_SEM_FAILED@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_2:
	movl	(%rbx), %edi
	movl	(%r15), %esi
	movl	$511, %edx                      ## imm = 0x1FF
	xorl	%ecx, %ecx
	callq	_sem_open
	movq	%rax, %rbx
	cmpq	(%r12), %rax
	jne	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rsi
	movl	$2, %edi
	callq	_err
LBB0_4:
	cmpq	%rbx, %r14
	je	LBB0_6
## %bb.5:
	leaq	L_.str.3(%rip), %rsi
	movl	$3, %edi
	callq	_errx
LBB0_6:
	movq	%rbx, %rdi
	callq	_sem_close
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.4(%rip), %rsi
	movl	$4, %edi
	callq	_err
LBB0_8:
	xorl	%eax, %eax
	callq	_fork
	testl	%eax, %eax
	je	LBB0_9
## %bb.12:
	movl	%eax, %ebx
	movl	$1, %edi
	callq	_sleep
	leaq	L_str.12(%rip), %rdi
	callq	_puts
	movq	%r14, %rdi
	callq	_sem_post
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	leaq	L_.str.9(%rip), %rsi
	movl	$6, %edi
	callq	_err
LBB0_14:
	leaq	-36(%rbp), %rsi
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_waitpid
	movl	-36(%rbp), %edi
	callq	_WIFEXITED
	testq	%rax, %rax
	je	LBB0_17
## %bb.15:
	movl	-36(%rbp), %edi
	callq	_WEXITSTATUS
	testq	%rax, %rax
	je	LBB0_16
LBB0_17:
	leaq	L_.str.11(%rip), %rdi
	callq	_printf
	jmp	LBB0_18
LBB0_16:
	leaq	L_str.13(%rip), %rdi
	callq	_puts
LBB0_18:
	movq	%r14, %rdi
	callq	_sem_close
	testq	%rax, %rax
	je	LBB0_20
## %bb.19:
	leaq	L_.str.4(%rip), %rsi
	movl	$7, %edi
	callq	_err
LBB0_20:
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	leaq	L_str.14(%rip), %rdi
	callq	_puts
	movq	%r14, %rdi
	callq	_sem_wait
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	leaq	L_.str.6(%rip), %rsi
	movl	$5, %edi
	callq	_err
LBB0_11:
	leaq	L_str.15(%rip), %rdi
	callq	_puts
	xorl	%edi, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.comm	_SEM_NAME,4,2                   ## @SEM_NAME
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_SEM_FAILED,8,3                 ## @SEM_FAILED
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"sem_open failed"

L_.str.2:                               ## @.str.2
	.asciz	"second sem_open call failed"

L_.str.3:                               ## @.str.3
	.asciz	"two sem_open calls for same semaphore do not return same address"

L_.str.4:                               ## @.str.4
	.asciz	"sem_close failed"

L_.str.6:                               ## @.str.6
	.asciz	"sem_wait failed"

L_.str.9:                               ## @.str.9
	.asciz	"sem_post failed"

L_.str.11:                              ## @.str.11
	.asciz	"Failure."

L_str:                                  ## @str
	.asciz	"testing named process-shared semaphore"

L_str.12:                               ## @str.12
	.asciz	"parent: sem_post()"

L_str.13:                               ## @str.13
	.asciz	"OK."

L_str.14:                               ## @str.14
	.asciz	"child: sem_wait()"

L_str.15:                               ## @str.15
	.asciz	"child: sem_wait() returned"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_test_named                     ; -- Begin function test_named
	.p2align	2
_test_named:                            ; @test_named
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x0, l_str@PAGE
Lloh1:
	add	x0, x0, l_str@PAGEOFF
	bl	_puts
Lloh2:
	adrp	x20, _SEM_NAME@GOTPAGE
Lloh3:
	ldr	x20, [x20, _SEM_NAME@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_sem_unlink
	ldr	w0, [x20]
Lloh4:
	adrp	x21, _O_CREAT@GOTPAGE
Lloh5:
	ldr	x21, [x21, _O_CREAT@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	w2, #511
	mov	w3, #0
	bl	_sem_open
	mov	x19, x0
Lloh6:
	adrp	x22, _SEM_FAILED@GOTPAGE
Lloh7:
	ldr	x22, [x22, _SEM_FAILED@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_2
; %bb.1:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_2:
	ldr	w0, [x20]
	ldr	w1, [x21]
	mov	w2, #511
	mov	w3, #0
	bl	_sem_open
	mov	x20, x0
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_4
; %bb.3:
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #2
	bl	_err
LBB0_4:
	cmp	x19, x20
	b.eq	LBB0_6
; %bb.5:
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #3
	bl	_errx
LBB0_6:
	mov	x0, x20
	bl	_sem_close
	cbz	x0, LBB0_8
; %bb.7:
Lloh14:
	adrp	x1, l_.str.4@PAGE
Lloh15:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #4
	bl	_err
LBB0_8:
	bl	_fork
	cbz	w0, LBB0_18
; %bb.9:
	mov	x20, x0
	mov	w0, #1
	bl	_sleep
Lloh16:
	adrp	x0, l_str.12@PAGE
Lloh17:
	add	x0, x0, l_str.12@PAGEOFF
	bl	_puts
	mov	x0, x19
	bl	_sem_post
	cbz	x0, LBB0_11
; %bb.10:
Lloh18:
	adrp	x1, l_.str.9@PAGE
Lloh19:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	w0, #6
	bl	_err
LBB0_11:
	add	x1, sp, #12
	mov	x0, x20
	mov	w2, #0
	bl	_waitpid
	ldr	w0, [sp, #12]
	bl	_WIFEXITED
	cbz	x0, LBB0_13
; %bb.12:
	ldr	w0, [sp, #12]
	bl	_WEXITSTATUS
	cbz	x0, LBB0_14
LBB0_13:
Lloh20:
	adrp	x0, l_.str.11@PAGE
Lloh21:
	add	x0, x0, l_.str.11@PAGEOFF
	bl	_printf
	b	LBB0_15
LBB0_14:
Lloh22:
	adrp	x0, l_str.13@PAGE
Lloh23:
	add	x0, x0, l_str.13@PAGEOFF
	bl	_puts
LBB0_15:
	mov	x0, x19
	bl	_sem_close
	cbz	x0, LBB0_17
; %bb.16:
Lloh24:
	adrp	x1, l_.str.4@PAGE
Lloh25:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #7
	bl	_err
LBB0_17:
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_18:
Lloh26:
	adrp	x0, l_str.14@PAGE
Lloh27:
	add	x0, x0, l_str.14@PAGEOFF
	bl	_puts
	mov	x0, x19
	bl	_sem_wait
	cbz	x0, LBB0_20
; %bb.19:
Lloh28:
	adrp	x1, l_.str.6@PAGE
Lloh29:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #5
	bl	_err
LBB0_20:
Lloh30:
	adrp	x0, l_str.15@PAGE
Lloh31:
	add	x0, x0, l_str.15@PAGEOFF
	bl	_puts
	mov	w0, #0
	bl	_exit
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_SEM_NAME,4,2                   ; @SEM_NAME
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_SEM_FAILED,8,3                 ; @SEM_FAILED
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"sem_open failed"

l_.str.2:                               ; @.str.2
	.asciz	"second sem_open call failed"

l_.str.3:                               ; @.str.3
	.asciz	"two sem_open calls for same semaphore do not return same address"

l_.str.4:                               ; @.str.4
	.asciz	"sem_close failed"

l_.str.6:                               ; @.str.6
	.asciz	"sem_wait failed"

l_.str.9:                               ; @.str.9
	.asciz	"sem_post failed"

l_.str.11:                              ; @.str.11
	.asciz	"Failure."

l_str:                                  ; @str
	.asciz	"testing named process-shared semaphore"

l_str.12:                               ; @str.12
	.asciz	"parent: sem_post()"

l_str.13:                               ; @str.13
	.asciz	"OK."

l_str.14:                               ; @str.14
	.asciz	"child: sem_wait()"

l_str.15:                               ; @str.15
	.asciz	"child: sem_wait() returned"

.subsections_via_symbols
