	.file	"extr_sysv_shm.c_shmget_allocate_segment.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	shmget_allocate_segment, @function
shmget_allocate_segment:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xor	eax, eax
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	r14, QWORD PTR 16[rdi]
	call	SYSVSHM_ASSERT_LOCKED@PLT
	mov	edi, DWORD PTR 0[rbp]
	cmp	edi, DWORD PTR shminfo[rip+20]
	jl	.L2
	cmp	edi, DWORD PTR shminfo[rip+16]
	jg	.L2
	mov	rax, QWORD PTR shm_nused[rip]
	cmp	QWORD PTR shminfo[rip], rax
	jle	.L11
	call	round_page@PLT
	mov	rdi, rax
	mov	r15, rax
	call	btoc@PLT
	add	rax, QWORD PTR shm_committed[rip]
	cmp	rax, QWORD PTR shminfo[rip+8]
	jg	.L20
	mov	r10d, DWORD PTR shm_last_free[rip]
	test	r10d, r10d
	js	.L22
	mov	DWORD PTR shm_last_free[rip], -1
	movsx	rax, r10d
	lea	rdx, [rax+rax*4]
	lea	r13, [rax+rdx*2]
	mov	eax, DWORD PTR shmalloced[rip]
	sal	r13, 3
.L9:
	cmp	eax, r10d
	movsx	rsi, eax
	mov	DWORD PTR 8[rsp], r10d
	setg	dil
	movzx	edi, dil
	call	KASSERT@PLT
	mov	ecx, DWORD PTR VM_PROT_DEFAULT[rip]
	mov	r10d, DWORD PTR 8[rsp]
	mov	rax, QWORD PTR shmsegs[rip]
	cmp	QWORD PTR shm_use_phys[rip], 0
	mov	edi, DWORD PTR OBJT_PHYS[rip]
	mov	QWORD PTR 16[rsp], rax
	jne	.L12
	mov	edi, DWORD PTR OBJT_SWAP[rip]
.L12:
	xor	r8d, r8d
	xor	esi, esi
	mov	r9, r14
	mov	rdx, r15
	mov	DWORD PTR 8[rsp], r10d
	call	vm_pager_allocate@PLT
	mov	r10d, DWORD PTR 8[rsp]
	test	rax, rax
	je	.L20
	mov	QWORD PTR [rax], 0
	mov	rdi, rax
	add	r13, QWORD PTR 16[rsp]
	mov	DWORD PTR 28[rsp], r10d
	mov	QWORD PTR 8[rsp], rax
	call	VM_OBJECT_WLOCK@PLT
	mov	rdx, QWORD PTR 8[rsp]
	mov	esi, DWORD PTR OBJ_ONEMAPPING[rip]
	mov	rdi, rdx
	call	vm_object_clear_flag@PLT
	mov	rdx, QWORD PTR 8[rsp]
	mov	esi, DWORD PTR OBJ_COLORED[rip]
	or	esi, DWORD PTR OBJ_NOSPLIT[rip]
	mov	rdi, rdx
	call	vm_object_set_flag@PLT
	mov	rdx, QWORD PTR 8[rsp]
	mov	rdi, rdx
	call	VM_OBJECT_WUNLOCK@PLT
	mov	eax, DWORD PTR 4[r14]
	mov	rdx, QWORD PTR 8[rsp]
	mov	rdi, r14
	mov	DWORD PTR 20[r13], eax
	mov	DWORD PTR 24[r13], eax
	mov	eax, DWORD PTR [r14]
	mov	QWORD PTR 80[r13], rdx
	mov	edx, DWORD PTR ACCESSPERMS[rip]
	mov	DWORD PTR 12[r13], eax
	mov	DWORD PTR 16[r13], eax
	mov	eax, DWORD PTR 4[rbp]
	and	edx, r12d
	or	edx, DWORD PTR SHMSEG_ALLOCATED[rip]
	mov	DWORD PTR 8[r13], eax
	mov	eax, DWORD PTR 4[r13]
	mov	DWORD PTR 0[r13], edx
	add	eax, 1
	and	eax, 32767
	mov	DWORD PTR 4[r13], eax
	call	crhold@PLT
	mov	rdi, r15
	mov	DWORD PTR 72[r13], eax
	mov	eax, DWORD PTR 0[rbp]
	mov	DWORD PTR 68[r13], eax
	mov	rax, QWORD PTR 8[rbx]
	mov	eax, DWORD PTR [rax]
	mov	QWORD PTR 48[r13], 0
	mov	QWORD PTR 56[r13], 0
	mov	DWORD PTR 64[r13], eax
	mov	eax, DWORD PTR time_second[rip]
	mov	QWORD PTR 32[r13], 0
	mov	QWORD PTR 40[r13], 0
	mov	DWORD PTR 28[r13], eax
	call	btoc@PLT
	movdqu	xmm0, XMMWORD PTR 0[r13]
	sub	rsp, 32
	.cfi_def_cfa_offset 128
	mov	rbx, QWORD PTR [rbx]
	add	QWORD PTR shm_committed[rip], rax
	mov	r10d, DWORD PTR 60[rsp]
	movups	XMMWORD PTR [rsp], xmm0
	mov	rax, QWORD PTR 16[r13]
	mov	edi, r10d
	add	QWORD PTR shm_nused[rip], 1
	mov	QWORD PTR 16[rsp], rax
	mov	eax, DWORD PTR 24[r13]
	mov	DWORD PTR 24[rsp], eax
	call	IXSEQ_TO_IPCID@PLT
	add	rsp, 32
	.cfi_def_cfa_offset 96
	mov	DWORD PTR [rbx], eax
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	mov	eax, DWORD PTR EINVAL[rip]
.L1:
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	xor	eax, eax
	call	shmrealloc@PLT
	mov	eax, DWORD PTR shmalloced[rip]
	test	eax, eax
	jle	.L8
	mov	rcx, QWORD PTR shmsegs[rip]
	mov	edx, DWORD PTR SHMSEG_FREE[rip]
	xor	r13d, r13d
	xor	r10d, r10d
	.p2align 4,,10
	.p2align 3
.L10:
	test	DWORD PTR [rcx+r13], edx
	jne	.L9
	add	r10d, 1
	add	r13, 88
	cmp	r10d, eax
	jne	.L10
.L11:
	mov	eax, DWORD PTR ENOSPC[rip]
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	mov	eax, DWORD PTR ENOMEM[rip]
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	je	.L11
	xor	r13d, r13d
	xor	r10d, r10d
	jmp	.L9
	.cfi_endproc
.LFE0:
	.size	shmget_allocate_segment, .-shmget_allocate_segment
	.comm	time_second,4,4
	.comm	shmsegs,8,8
	.comm	shminfo,24,16
	.comm	shmalloced,4,4
	.comm	shm_use_phys,8,8
	.comm	shm_nused,8,8
	.comm	shm_last_free,4,4
	.comm	shm_committed,8,8
	.comm	racct_enable,8,8
	.comm	VM_PROT_DEFAULT,4,4
	.comm	SHMSEG_FREE,4,4
	.comm	SHMSEG_ALLOCATED,4,4
	.comm	RACCT_SHMSIZE,4,4
	.comm	RACCT_NSHM,4,4
	.comm	OBJ_ONEMAPPING,4,4
	.comm	OBJ_NOSPLIT,4,4
	.comm	OBJ_COLORED,4,4
	.comm	OBJT_SWAP,4,4
	.comm	OBJT_PHYS,4,4
	.comm	ENOSPC,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	ACCESSPERMS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_sysv_shm.c_shmget_allocate_segment.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	shmget_allocate_segment, %function
shmget_allocate_segment:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r5, r1
	ldr	r7, .L26
	sub	sp, sp, #36
	mov	r4, r0
	mov	r6, r2
	ldr	r10, [r0, #8]
	bl	SYSVSHM_ASSERT_LOCKED
	ldr	r0, [r5]
	ldr	r3, [r7, #12]
	cmp	r0, r3
	blt	.L2
	ldr	r3, [r7, #8]
	cmp	r0, r3
	bgt	.L2
	ldr	fp, .L26+4
	ldr	r2, [r7]
	ldr	r3, [fp]
	cmp	r2, r3
	ble	.L11
	bl	round_page
	str	r0, [sp, #20]
	bl	btoc
	ldr	r2, .L26+8
	ldr	r3, [r7, #4]
	ldr	r2, [r2]
	add	r0, r0, r2
	cmp	r0, r3
	bgt	.L21
	ldr	r3, .L26+12
	ldr	r8, [r3]
	cmp	r8, #0
	blt	.L23
	mvn	r1, #0
	ldr	r2, .L26+16
	str	r1, [r3]
	ldr	r7, .L26+20
	lsl	r3, r8, #6
	ldr	r1, [r2]
	str	r3, [sp, #24]
.L9:
	cmp	r1, r8
	movle	r0, #0
	movgt	r0, #1
	bl	KASSERT
	ldr	r3, .L26+24
	ldr	r2, [r7]
	ldr	r3, [r3]
	mov	r9, r2
	cmp	r3, #0
	beq	.L24
	ldr	r3, .L26+28
	ldr	r0, [r3]
.L12:
	mov	r7, #0
	stm	sp, {r7, r10}
	ldr	r3, .L26+32
	mov	r1, r7
	ldr	r3, [r3]
	ldr	r2, [sp, #20]
	bl	vm_pager_allocate
	subs	r3, r0, #0
	beq	.L21
	str	r7, [r3]
	str	r3, [sp, #28]
	bl	VM_OBJECT_WLOCK
	ldr	r2, .L26+36
	ldr	r3, [sp, #28]
	ldr	r1, [r2]
	mov	r0, r3
	bl	vm_object_clear_flag
	ldr	r1, .L26+40
	ldr	r2, .L26+44
	ldr	r3, [sp, #28]
	ldr	r2, [r2]
	ldr	r1, [r1]
	mov	r0, r3
	orr	r1, r1, r2
	bl	vm_object_set_flag
	ldr	r3, [sp, #28]
	mov	r0, r3
	bl	VM_OBJECT_WUNLOCK
	mov	lr, r9
	ldr	r3, [sp, #24]
	ldr	r2, .L26+48
	add	r9, r9, r3
	ldr	r2, [r2]
	ldr	r3, [sp, #28]
	ldr	r1, [r9, #4]
	ldr	r0, .L26+52
	and	r6, r6, r2
	ldr	r2, [r10, #4]
	str	r3, [r9, #60]
	ldr	r3, [r10]
	ldr	r0, [r0]
	add	r1, r1, #1
	ldr	ip, [r5, #4]
	lsl	r1, r1, #17
	str	r3, [r9, #12]
	str	r3, [r9, #16]
	ldr	r3, [sp, #24]
	orr	r6, r6, r0
	lsr	r1, r1, #17
	str	r2, [r9, #20]
	str	r2, [r9, #24]
	mov	r0, r10
	str	r6, [lr, r3]
	stmib	r9, {r1, ip}
	bl	crhold
	ldr	r2, [r4, #4]
	ldr	r3, .L26+56
	ldr	r1, [r5]
	ldr	r2, [r2]
	ldr	r3, [r3]
	str	r0, [r9, #56]
	str	r1, [r9, #52]
	str	r2, [r9, #48]
	str	r3, [r9, #28]
	ldr	r0, [sp, #20]
	str	r7, [r9, #40]
	str	r7, [r9, #44]
	str	r7, [r9, #32]
	str	r7, [r9, #36]
	bl	btoc
	mov	r5, r0
	add	r3, r9, #12
	ldm	r3, {r0, r1, r2, r3}
	stm	sp, {r0, r1, r2, r3}
	ldr	r6, .L26+8
	ldr	ip, [fp]
	ldr	lr, [r6]
	ldr	r4, [r4]
	add	lr, lr, r5
	ldm	r9, {r1, r2, r3}
	add	ip, ip, #1
	mov	r0, r8
	str	lr, [r6]
	str	ip, [fp]
	bl	IXSEQ_TO_IPCID
	mov	r3, r0
	mov	r0, r7
	str	r3, [r4]
	b	.L1
.L2:
	ldr	r3, .L26+60
	ldr	r0, [r3]
.L1:
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L11:
	ldr	r3, .L26+64
	ldr	r0, [r3]
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L21:
	ldr	r3, .L26+68
	ldr	r0, [r3]
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L24:
	ldr	r3, .L26+72
	ldr	r0, [r3]
	b	.L12
.L23:
	bl	shmrealloc
	ldr	r3, .L26+16
	ldr	r1, [r3]
	cmp	r1, #0
	ble	.L8
	ldr	r7, .L26+20
	ldr	r3, .L26+76
	mov	r8, #0
	ldr	r0, [r7]
	ldr	r2, [r3]
	b	.L10
.L25:
	add	r8, r8, #1
	cmp	r8, r1
	beq	.L11
.L10:
	ldr	r3, [r0, r8, lsl #6]
	lsl	ip, r8, #6
	tst	r2, r3
	beq	.L25
	str	ip, [sp, #24]
	b	.L9
.L8:
	beq	.L11
	mov	r3, #0
	ldr	r7, .L26+20
	mov	r8, r3
	str	r3, [sp, #24]
	b	.L9
.L27:
	.align	2
.L26:
	.word	shminfo
	.word	shm_nused
	.word	shm_committed
	.word	shm_last_free
	.word	shmalloced
	.word	shmsegs
	.word	shm_use_phys
	.word	OBJT_PHYS
	.word	VM_PROT_DEFAULT
	.word	OBJ_ONEMAPPING
	.word	OBJ_COLORED
	.word	OBJ_NOSPLIT
	.word	ACCESSPERMS
	.word	SHMSEG_ALLOCATED
	.word	time_second
	.word	EINVAL
	.word	ENOSPC
	.word	ENOMEM
	.word	OBJT_SWAP
	.word	SHMSEG_FREE
	.size	shmget_allocate_segment, .-shmget_allocate_segment
	.comm	time_second,4,4
	.comm	shmsegs,4,4
	.comm	shminfo,16,4
	.comm	shmalloced,4,4
	.comm	shm_use_phys,4,4
	.comm	shm_nused,4,4
	.comm	shm_last_free,4,4
	.comm	shm_committed,4,4
	.comm	racct_enable,4,4
	.comm	VM_PROT_DEFAULT,4,4
	.comm	SHMSEG_FREE,4,4
	.comm	SHMSEG_ALLOCATED,4,4
	.comm	RACCT_SHMSIZE,4,4
	.comm	RACCT_NSHM,4,4
	.comm	OBJ_ONEMAPPING,4,4
	.comm	OBJ_NOSPLIT,4,4
	.comm	OBJ_COLORED,4,4
	.comm	OBJT_SWAP,4,4
	.comm	OBJT_PHYS,4,4
	.comm	ENOSPC,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	ACCESSPERMS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
