	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_grabsharedmemory               ## -- Begin function grabsharedmemory
	.p2align	4, 0x90
_grabsharedmemory:                      ## @grabsharedmemory
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movl	$1685024621, %r15d              ## imm = 0x646F6F6D
	movl	$-5, %r14d
	leaq	-72(%rbp), %r12
	leaq	L_.str.6(%rip), %r13
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_1 Depth=1
	movq	%r13, %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_I_Error
	incl	%r14d
	je	LBB0_21
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r15d, %edi
	movl	$64000, %esi                    ## imm = 0xFA00
	movl	$511, %edx                      ## imm = 0x1FF
	callq	_shmget
	cmpl	$-1, %eax
	je	LBB0_16
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	%eax, %ebx
	movq	_IPC_STAT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	movq	%r12, %rdx
	callq	_shmctl
	testl	%eax, %eax
	jne	LBB0_15
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpq	$0, -56(%rbp)
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-72(%rbp), %edx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	jmp	LBB0_19
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	xorl	%eax, %eax
	callq	_getuid
	cmpq	-64(%rbp), %rax
	je	LBB0_6
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	movl	-72(%rbp), %edx
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, -68(%rbp)
	jle	LBB0_13
## %bb.18:                              ##   in Loop: Header=BB0_1 Depth=1
	leaq	L_.str.5(%rip), %rsi
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_fprintf
LBB0_19:                                ##   in Loop: Header=BB0_1 Depth=1
	incl	%r15d
	incl	%r14d
	jne	LBB0_1
	jmp	LBB0_21
LBB0_16:
	movq	_IPC_CREAT@GOTPCREL(%rip), %rax
	movl	$511, %edx                      ## imm = 0x1FF
	orl	(%rax), %edx
	movl	%r15d, %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_shmget
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_14
## %bb.17:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.7(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	leaq	L_.str.8(%rip), %rdi
	xorl	%eax, %eax
	callq	_I_Error
	movl	$-1, %ebx
	jmp	LBB0_14
LBB0_6:
	movq	_IPC_RMID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_shmctl
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_I_Error
	jmp	LBB0_9
LBB0_13:
	leaq	L_.str.4(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	jmp	LBB0_14
LBB0_7:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
LBB0_9:
	movq	_IPC_CREAT@GOTPCREL(%rip), %rax
	movl	$511, %edx                      ## imm = 0x1FF
	orl	(%rax), %edx
	movl	%r15d, %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_shmget
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_11
## %bb.10:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_I_Error
LBB0_11:
	movq	_IPC_STAT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdx
	movl	%ebx, %edi
	callq	_shmctl
LBB0_14:
	testl	%r14d, %r14d
	jne	LBB0_22
LBB0_21:
	leaq	L_.str.9(%rip), %rdi
	xorl	%eax, %eax
	callq	_I_Error
LBB0_22:
	movq	_X_shminfo@GOTPCREL(%rip), %r14
	movl	%ebx, (%r14)
	movl	%ebx, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_shmat
	movq	%rax, 8(%r14)
	movq	_image@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, (%rcx)
	movq	_stderr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str.10(%rip), %rsi
	movl	%ebx, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_fprintf
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IPC_STAT,4,2                   ## @IPC_STAT
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"User %d appears to be running DOOM.  Is that wise?\n"

	.comm	_IPC_RMID,4,2                   ## @IPC_RMID
L_.str.1:                               ## @.str.1
	.asciz	"Was able to kill my old shared memory\n"

L_.str.2:                               ## @.str.2
	.asciz	"Was NOT able to kill my old shared memory"

	.comm	_IPC_CREAT,4,2                  ## @IPC_CREAT
L_.str.3:                               ## @.str.3
	.asciz	"Could not get shared memory"

L_.str.4:                               ## @.str.4
	.asciz	"will use %d's stale shared memory\n"

L_.str.5:                               ## @.str.5
	.asciz	"warning: can't use stale shared memory belonging to id %d, key=0x%x\n"

L_.str.6:                               ## @.str.6
	.asciz	"could not get stats on key=%d"

L_.str.7:                               ## @.str.7
	.asciz	"errno=%d\n"

L_.str.8:                               ## @.str.8
	.asciz	"Could not get any shared memory"

L_.str.9:                               ## @.str.9
	.asciz	"Sorry, system too polluted with stale shared memory segments.\n"

	.comm	_X_shminfo,16,3                 ## @X_shminfo
	.comm	_image,8,3                      ## @image
L_.str.10:                              ## @.str.10
	.asciz	"shared memory id=%d, addr=0x%x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_grabsharedmemory               ; -- Begin function grabsharedmemory
	.p2align	2
_grabsharedmemory:                      ; @grabsharedmemory
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x20, x0
	mov	w21, #28525
	movk	w21, #25711, lsl #16
	mov	w26, #-5
Lloh0:
	adrp	x27, _IPC_STAT@GOTPAGE
Lloh1:
	ldr	x27, [x27, _IPC_STAT@GOTPAGEOFF]
Lloh2:
	adrp	x25, _stderr@GOTPAGE
Lloh3:
	ldr	x25, [x25, _stderr@GOTPAGEOFF]
Lloh4:
	adrp	x22, l_.str.5@PAGE
Lloh5:
	add	x22, x22, l_.str.5@PAGEOFF
Lloh6:
	adrp	x23, l_.str@PAGE
Lloh7:
	add	x23, x23, l_.str@PAGEOFF
Lloh8:
	adrp	x24, l_.str.6@PAGE
Lloh9:
	add	x24, x24, l_.str.6@PAGEOFF
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x8, x21
	str	x8, [sp]
	mov	x0, x24
	bl	_I_Error
	adds	w26, w26, #1
	b.hs	LBB0_12
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	w1, #64000
	mov	w2, #511
	bl	_shmget
	cmn	w0, #1
	b.eq	LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x19, x0
	ldr	w1, [x27]
	add	x2, sp, #24
	bl	_shmctl
	cbnz	w0, LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [sp, #40]
	cbz	x8, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x25]
	ldr	w8, [sp, #24]
	str	x8, [sp]
	mov	x1, x23
	b	LBB0_9
LBB0_6:                                 ;   in Loop: Header=BB0_2 Depth=1
	bl	_getuid
	ldr	x8, [sp, #32]
	cmp	x0, x8
	b.eq	LBB0_15
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x25]
	ldp	w8, w9, [sp, #24]
	cmp	w9, w20
	b.le	LBB0_17
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	stp	x8, x21, [sp]
	mov	x1, x22
LBB0_9:                                 ;   in Loop: Header=BB0_2 Depth=1
	bl	_fprintf
	add	w21, w21, #1
	adds	w26, w26, #1
	b.lo	LBB0_2
	b	LBB0_12
LBB0_10:
Lloh10:
	adrp	x8, _IPC_CREAT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _IPC_CREAT@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	orr	w2, w8, #0x1ff
	mov	x0, x21
	mov	x1, x20
	bl	_shmget
	mov	x19, x0
	cmn	w0, #1
	b.eq	LBB0_14
; %bb.11:
	cbnz	w26, LBB0_13
LBB0_12:
Lloh13:
	adrp	x0, l_.str.9@PAGE
Lloh14:
	add	x0, x0, l_.str.9@PAGEOFF
	bl	_I_Error
LBB0_13:
Lloh15:
	adrp	x20, _X_shminfo@GOTPAGE
Lloh16:
	ldr	x20, [x20, _X_shminfo@GOTPAGEOFF]
	str	w19, [x20]
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	bl	_shmat
	str	x0, [x20, #8]
Lloh17:
	adrp	x8, _image@GOTPAGE
Lloh18:
	ldr	x8, [x8, _image@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	str	x0, [x8]
	ldr	w8, [x25]
	stp	x19, x0, [sp]
Lloh20:
	adrp	x1, l_.str.10@PAGE
Lloh21:
	add	x1, x1, l_.str.10@PAGEOFF
	mov	x0, x8
	bl	_fprintf
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_14:
	ldr	w0, [x25]
Lloh22:
	adrp	x8, _errno@GOTPAGE
Lloh23:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh25:
	adrp	x1, l_.str.7@PAGE
Lloh26:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_fprintf
Lloh27:
	adrp	x0, l_.str.8@PAGE
Lloh28:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_I_Error
	mov	w19, #-1
	cbnz	w26, LBB0_13
	b	LBB0_12
LBB0_15:
Lloh29:
	adrp	x8, _IPC_RMID@GOTPAGE
Lloh30:
	ldr	x8, [x8, _IPC_RMID@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, #0
	bl	_shmctl
	cbz	w0, LBB0_18
; %bb.16:
Lloh32:
	adrp	x0, l_.str.2@PAGE
Lloh33:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_I_Error
	b	LBB0_19
LBB0_17:
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	str	x8, [sp]
Lloh34:
	adrp	x1, l_.str.4@PAGE
Lloh35:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_fprintf
	cbnz	w26, LBB0_13
	b	LBB0_12
LBB0_18:
	ldr	w0, [x25]
Lloh36:
	adrp	x1, l_.str.1@PAGE
Lloh37:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fprintf
LBB0_19:
Lloh38:
	adrp	x8, _IPC_CREAT@GOTPAGE
Lloh39:
	ldr	x8, [x8, _IPC_CREAT@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	orr	w2, w8, #0x1ff
	mov	x0, x21
	mov	x1, x20
	bl	_shmget
	mov	x19, x0
	cmn	w0, #1
	b.ne	LBB0_21
; %bb.20:
Lloh41:
	adrp	x0, l_.str.3@PAGE
Lloh42:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_I_Error
LBB0_21:
	ldr	w1, [x27]
	add	x2, sp, #24
	mov	x0, x19
	bl	_shmctl
	cbnz	w26, LBB0_13
	b	LBB0_12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.comm	_IPC_STAT,4,2                   ; @IPC_STAT
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"User %d appears to be running DOOM.  Is that wise?\n"

	.comm	_IPC_RMID,4,2                   ; @IPC_RMID
l_.str.1:                               ; @.str.1
	.asciz	"Was able to kill my old shared memory\n"

l_.str.2:                               ; @.str.2
	.asciz	"Was NOT able to kill my old shared memory"

	.comm	_IPC_CREAT,4,2                  ; @IPC_CREAT
l_.str.3:                               ; @.str.3
	.asciz	"Could not get shared memory"

l_.str.4:                               ; @.str.4
	.asciz	"will use %d's stale shared memory\n"

l_.str.5:                               ; @.str.5
	.asciz	"warning: can't use stale shared memory belonging to id %d, key=0x%x\n"

l_.str.6:                               ; @.str.6
	.asciz	"could not get stats on key=%d"

l_.str.7:                               ; @.str.7
	.asciz	"errno=%d\n"

l_.str.8:                               ; @.str.8
	.asciz	"Could not get any shared memory"

l_.str.9:                               ; @.str.9
	.asciz	"Sorry, system too polluted with stale shared memory segments.\n"

	.comm	_X_shminfo,16,3                 ; @X_shminfo
	.comm	_image,8,3                      ; @image
l_.str.10:                              ; @.str.10
	.asciz	"shared memory id=%d, addr=0x%x\n"

.subsections_via_symbols
