	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_shared_memory_init             ## -- Begin function shared_memory_init
	.p2align	4, 0x90
_shared_memory_init:                    ## @shared_memory_init
	.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	$152, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_max_process_number@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	movl	$-1, %ecx
	cmovgl	%eax, %ecx
	movq	_shm_no@GOTPCREL(%rip), %rbx
	movl	%ecx, (%rbx)
	xorl	%edi, %edi
	testl	%ecx, %ecx
	setg	%dil
	callq	_assert
	movl	$1, %eax
	cmpl	$0, (%rbx)
	jle	LBB0_9
## %bb.1:
	leaq	-176(%rbp), %r12
	movq	_SHM@GOTPCREL(%rip), %r15
	movq	_MAX_SHARED_MEMORY_SIZE@GOTPCREL(%rip), %r13
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_getpid
	movq	_now@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movq	_port@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	movl	%r14d, (%rsp)
	movq	%r12, %rdi
	movl	$126, %esi
	leaq	L_.str(%rip), %rdx
	movl	%eax, %ecx
	callq	_snprintf
	movl	%eax, %ebx
	xorl	%edi, %edi
	cmpl	$128, %eax
	setl	%dil
	callq	_assert
	movslq	%ebx, %rax
	movb	$0, -176(%rbp,%rax)
	movq	_O_CREAT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_O_EXCL@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	%r12, %rdi
	movl	$416, %edx                      ## imm = 0x1A0
	callq	_shm_open
	movq	(%r15), %rcx
	movq	%rax, (%rcx,%r14,8)
	testq	%rax, %rax
	js	LBB0_3
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %esi
	movq	%rax, %rdi
	callq	_ftruncate
	movq	%r12, %rdi
	callq	_shm_unlink
	testq	%rax, %rax
	js	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%r14
	movq	_shm_no@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r14
	jl	LBB0_2
## %bb.8:
	movl	$1, %eax
	jmp	LBB0_9
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_4
LBB0_6:
	leaq	L_.str.2(%rip), %rdi
LBB0_4:
	leaq	-176(%rbp), %rsi
	callq	_kprintf
	movq	_shm_no@GOTPCREL(%rip), %rax
	movl	%r14d, (%rax)
	xorl	%eax, %eax
LBB0_9:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_11
## %bb.10:
	addq	$152, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_max_process_number,8,3         ## @max_process_number
	.comm	_shm_no,4,2                     ## @shm_no
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/img%d_%d_%d_%d"

	.comm	_now,4,2                        ## @now
	.comm	_port,4,2                       ## @port
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_EXCL,4,2                     ## @O_EXCL
	.comm	_SHM,8,3                        ## @SHM
L_.str.1:                               ## @.str.1
	.asciz	"Couldn't create share memory object %s\n%m\n"

	.comm	_MAX_SHARED_MEMORY_SIZE,4,2     ## @MAX_SHARED_MEMORY_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"shm_unlink (%s) failed. %m\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_shared_memory_init             ; -- Begin function shared_memory_init
	.p2align	2
_shared_memory_init:                    ; @shared_memory_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #240
	.cfi_def_cfa_offset 240
	stp	x28, x27, [sp, #144]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #160]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #176]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #192]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #208]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #224]            ; 16-byte Folded Spill
	add	x29, sp, #224
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x8, _max_process_number@GOTPAGE
Lloh4:
	ldr	x8, [x8, _max_process_number@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x8, #0
	csinv	w8, w8, wzr, gt
Lloh6:
	adrp	x19, _shm_no@GOTPAGE
Lloh7:
	ldr	x19, [x19, _shm_no@GOTPAGEOFF]
	str	w8, [x19]
	cmp	w8, #0
	cset	w0, gt
	bl	_assert
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x19, #0
Lloh8:
	adrp	x24, _port@GOTPAGE
Lloh9:
	ldr	x24, [x24, _port@GOTPAGEOFF]
	add	x25, sp, #8
Lloh10:
	adrp	x26, _O_RDWR@GOTPAGE
Lloh11:
	ldr	x26, [x26, _O_RDWR@GOTPAGEOFF]
Lloh12:
	adrp	x20, l_.str@PAGE
Lloh13:
	add	x20, x20, l_.str@PAGEOFF
Lloh14:
	adrp	x27, _O_CREAT@GOTPAGE
Lloh15:
	ldr	x27, [x27, _O_CREAT@GOTPAGEOFF]
Lloh16:
	adrp	x28, _O_EXCL@GOTPAGE
Lloh17:
	ldr	x28, [x28, _O_EXCL@GOTPAGEOFF]
Lloh18:
	adrp	x23, _SHM@GOTPAGE
Lloh19:
	ldr	x23, [x23, _SHM@GOTPAGEOFF]
Lloh20:
	adrp	x22, _MAX_SHARED_MEMORY_SIZE@GOTPAGE
Lloh21:
	ldr	x22, [x22, _MAX_SHARED_MEMORY_SIZE@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	bl	_getpid
	mov	x3, x0
Lloh22:
	adrp	x8, _now@GOTPAGE
Lloh23:
	ldr	x8, [x8, _now@GOTPAGEOFF]
Lloh24:
	ldr	w4, [x8]
	ldr	w5, [x24]
	add	x0, sp, #8
	mov	w1, #126
	mov	x2, x20
	mov	x6, x19
	bl	_snprintf
	mov	x21, x0
	cmp	w0, #128
	cset	w0, lt
	bl	_assert
	strb	wzr, [x25, w21, sxtw]
	ldr	w8, [x26]
	ldr	w9, [x27]
	orr	w8, w9, w8
	ldr	w9, [x28]
	orr	w1, w8, w9
	add	x0, sp, #8
	mov	w2, #416
	bl	_shm_open
	ldr	x8, [x23]
	str	x0, [x8, x19, lsl #3]
	tbnz	x0, #63, LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x22]
	bl	_ftruncate
	add	x0, sp, #8
	bl	_shm_unlink
	tbnz	x0, #63, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x19, x19, #1
Lloh25:
	adrp	x8, _shm_no@GOTPAGE
Lloh26:
	ldr	x8, [x8, _shm_no@GOTPAGEOFF]
Lloh27:
	ldrsw	x8, [x8]
	cmp	x19, x8
	b.lt	LBB0_2
LBB0_5:
	mov	w0, #1
	b	LBB0_9
LBB0_6:
Lloh28:
	adrp	x0, l_.str.1@PAGE
Lloh29:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_7:
Lloh30:
	adrp	x0, l_.str.2@PAGE
Lloh31:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_8:
	add	x1, sp, #8
	bl	_kprintf
	mov	w0, #0
Lloh32:
	adrp	x8, _shm_no@GOTPAGE
Lloh33:
	ldr	x8, [x8, _shm_no@GOTPAGEOFF]
Lloh34:
	str	w19, [x8]
LBB0_9:
	ldur	x8, [x29, #-88]
Lloh35:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh36:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh37:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	ldp	x29, x30, [sp, #224]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #208]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #192]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #176]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #160]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #144]            ; 16-byte Folded Reload
	add	sp, sp, #240
	ret
LBB0_11:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotStr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_max_process_number,8,3         ; @max_process_number
	.comm	_shm_no,4,2                     ; @shm_no
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/img%d_%d_%d_%d"

	.comm	_now,4,2                        ; @now
	.comm	_port,4,2                       ; @port
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_EXCL,4,2                     ; @O_EXCL
	.comm	_SHM,8,3                        ; @SHM
l_.str.1:                               ; @.str.1
	.asciz	"Couldn't create share memory object %s\n%m\n"

	.comm	_MAX_SHARED_MEMORY_SIZE,4,2     ; @MAX_SHARED_MEMORY_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"shm_unlink (%s) failed. %m\n"

.subsections_via_symbols
