	.file	"427945.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"semget failed"
.LC1:
	.string	"semctl failed"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	edx, 950
	mov	esi, 1
	mov	edi, 73
	call	semget@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	DWORD PTR -8[rbp], 1
	mov	rdx, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR -12[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	cmp	eax, -1
	jne	.L3
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	DWORD PTR -16[rbp], 0
	jmp	.L4
.L6:
	call	fork@PLT
	test	eax, eax
	jne	.L5
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	testsem
.L5:
	add	DWORD PTR -16[rbp], 1
.L4:
	cmp	DWORD PTR -16[rbp], 2
	jle	.L6
	mov	edi, 10
	mov	eax, 0
	call	sleep@PLT
	mov	rdx, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR -12[rbp]
	mov	rcx, rdx
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	cmp	eax, -1
	jne	.L7
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.string	"process %d : semaphore in use\n"
	.align 8
.LC3:
	.string	"process %d : putting semaphore\n"
	.text
	.globl	testsem
	.type	testsem, @function
testsem:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	DWORD PTR -4[rbp], edi
	mov	eax, 0
	call	getpid@PLT
	mov	edi, eax
	call	srand@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	p
	mov	eax, 0
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	mov	edx, eax
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax
	mov	ecx, edx
	sar	ecx, 31
	sub	eax, ecx
	mov	ecx, eax
	sal	ecx, 2
	add	ecx, eax
	mov	eax, edx
	sub	eax, ecx
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	mov	eax, 0
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	v
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE7:
	.size	testsem, .-testsem
	.section	.rodata
.LC4:
	.string	"semop failed"
	.text
	.globl	p
	.type	p, @function
p:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	WORD PTR -14[rbp], 0
	mov	WORD PTR -12[rbp], -1
	mov	WORD PTR -10[rbp], 4096
	lea	rcx, -14[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L13
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L13:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	p, .-p
	.globl	v
	.type	v, @function
v:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	WORD PTR -14[rbp], 0
	mov	WORD PTR -12[rbp], 1
	mov	WORD PTR -10[rbp], 4096
	lea	rcx, -14[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L17
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L17:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	v, .-v
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"427945.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"semget failed\000"
	.align	2
.LC1:
	.ascii	"semctl failed\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r2, .L9
	mov	r1, #1
	mov	r0, #73
	bl	semget
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L9+4
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	mov	r3, #1
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	mov	r2, #16
	mov	r1, #0
	ldr	r0, [fp, #-8]
	bl	semctl
	mov	r3, r0
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L9+8
	bl	perror
	mov	r0, #1
	bl	exit
.L3:
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L4
.L6:
	bl	fork
	mov	r3, r0
	cmp	r3, #0
	bne	.L5
	ldr	r0, [fp, #-8]
	bl	testsem
.L5:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L4:
	ldr	r3, [fp, #-12]
	cmp	r3, #2
	ble	.L6
	mov	r0, #10
	bl	sleep
	ldr	r3, [fp, #-16]
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-8]
	bl	semctl
	mov	r3, r0
	cmn	r3, #1
	bne	.L7
	ldr	r0, .L9+8
	bl	perror
	mov	r0, #1
	bl	exit
.L7:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	950
	.word	.LC0
	.word	.LC1
	.size	main, .-main
	.section	.rodata
	.align	2
.LC2:
	.ascii	"process %d : semaphore in use\012\000"
	.align	2
.LC3:
	.ascii	"process %d : putting semaphore\012\000"
	.text
	.align	2
	.global	testsem
	.syntax unified
	.arm
	.fpu softvfp
	.type	testsem, %function
testsem:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	bl	getpid
	mov	r3, r0
	mov	r0, r3
	bl	srand
	ldr	r0, [fp, #-8]
	bl	p
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L12
	bl	printf
	bl	rand
	mov	r1, r0
	ldr	r3, .L12+4
	smull	r2, r3, r1, r3
	asr	r2, r3, #1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	sub	r2, r1, r3
	mov	r0, r2
	bl	sleep
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L12+8
	bl	printf
	ldr	r0, [fp, #-8]
	bl	v
	mov	r0, #0
	bl	exit
.L13:
	.align	2
.L12:
	.word	.LC2
	.word	1717986919
	.word	.LC3
	.size	testsem, .-testsem
	.section	.rodata
	.align	2
.LC4:
	.ascii	"semop failed\000"
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	p
	.syntax unified
	.arm
	.fpu softvfp
	.type	p, %function
p:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r3, .L18
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	strh	r3, [fp, #-16]	@ movhi
	mvn	r3, #0
	strh	r3, [fp, #-14]	@ movhi
	mov	r3, #4096
	strh	r3, [fp, #-12]	@ movhi
	sub	r3, fp, #16
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L17
	ldr	r0, .L18+4
	bl	perror
	mov	r0, #1
	bl	exit
.L17:
	nop
	ldr	r3, .L18
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L16
	bl	__stack_chk_fail
.L16:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC5
	.word	.LC4
	.size	p, .-p
	.section	.rodata
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	v
	.syntax unified
	.arm
	.fpu softvfp
	.type	v, %function
v:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	strh	r3, [fp, #-16]	@ movhi
	mov	r3, #1
	strh	r3, [fp, #-14]	@ movhi
	mov	r3, #4096
	strh	r3, [fp, #-12]	@ movhi
	sub	r3, fp, #16
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L23
	ldr	r0, .L24+4
	bl	perror
	mov	r0, #1
	bl	exit
.L23:
	nop
	ldr	r3, .L24
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L22
	bl	__stack_chk_fail
.L22:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC6
	.word	.LC4
	.size	v, .-v
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
