	.file	"485710.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"./prvi.c"
.LC1:
	.string	"%d\n"
	.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, 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	call	getpid@PLT
	mov	edi, eax
	call	srand@PLT
	mov	DWORD PTR -40[rbp], 3
	mov	esi, 97
	lea	rdi, .LC0[rip]
	call	ftok@PLT
	mov	DWORD PTR -36[rbp], eax
	mov	eax, DWORD PTR -36[rbp]
	mov	edx, 1974
	mov	esi, 4
	mov	edi, eax
	call	semget@PLT
	mov	DWORD PTR -48[rbp], eax
	cmp	DWORD PTR -48[rbp], -1
	je	.L2
	mov	DWORD PTR -16[rbp], 1
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -16[rbp], 0
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	esi, 1
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -16[rbp], 0
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	esi, 2
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -16[rbp], 0
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	esi, 3
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	jmp	.L3
.L2:
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 17
	jne	.L4
	mov	eax, DWORD PTR -36[rbp]
	mov	edx, 0
	mov	esi, 4
	mov	edi, eax
	call	semget@PLT
	mov	DWORD PTR -48[rbp], eax
	jmp	.L3
.L4:
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	WORD PTR -28[rbp], 2
	mov	WORD PTR -26[rbp], -1
	mov	WORD PTR -24[rbp], 0
	mov	WORD PTR -20[rbp], 1
	mov	WORD PTR -18[rbp], 0
.L6:
	lea	rcx, -28[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1431655766
	shr	rdx, 32
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	add	ecx, ecx
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 1[rdx]
	mov	DWORD PTR -32[rbp], eax
	mov	edi, 3
	call	sleep@PLT
	mov	edx, DWORD PTR -40[rbp]
	mov	eax, DWORD PTR -32[rbp]
	add	eax, edx
	mov	DWORD PTR -44[rbp], eax
	cmp	DWORD PTR -44[rbp], 4
	jle	.L5
	sub	DWORD PTR -44[rbp], 4
.L5:
	mov	eax, DWORD PTR -44[rbp]
	sub	eax, 1
	mov	WORD PTR -22[rbp], ax
	lea	rcx, -22[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	mov	eax, DWORD PTR -32[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L6
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.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	"485710.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"./prvi.c\000"
	.align	2
.LC1:
	.ascii	"%d\012\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	ldr	r3, .L8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	getpid
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r3, #3
	str	r3, [fp, #-36]
	mov	r1, #97
	ldr	r0, .L8+4
	bl	ftok
	str	r0, [fp, #-32]
	ldr	r2, .L8+8
	mov	r1, #4
	ldr	r0, [fp, #-32]
	bl	semget
	str	r0, [fp, #-44]
	ldr	r3, [fp, #-44]
	cmn	r3, #1
	beq	.L2
	mov	r3, #1
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	mov	r2, #16
	mov	r1, #0
	ldr	r0, [fp, #-44]
	bl	semctl
	mov	r3, #0
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	mov	r2, #16
	mov	r1, #1
	ldr	r0, [fp, #-44]
	bl	semctl
	mov	r3, #0
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	mov	r2, #16
	mov	r1, #2
	ldr	r0, [fp, #-44]
	bl	semctl
	mov	r3, #0
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	mov	r2, #16
	mov	r1, #3
	ldr	r0, [fp, #-44]
	bl	semctl
	b	.L3
.L2:
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #17
	bne	.L4
	mov	r2, #0
	mov	r1, #4
	ldr	r0, [fp, #-32]
	bl	semget
	str	r0, [fp, #-44]
	b	.L3
.L4:
	mov	r0, #1
	bl	exit
.L3:
	mov	r3, #2
	strh	r3, [fp, #-24]	@ movhi
	mvn	r3, #0
	strh	r3, [fp, #-22]	@ movhi
	mov	r3, #0
	strh	r3, [fp, #-20]	@ movhi
	mov	r3, #1
	strh	r3, [fp, #-14]	@ movhi
	mov	r3, #0
	strh	r3, [fp, #-12]	@ movhi
.L6:
	sub	r3, fp, #24
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-44]
	bl	semop
	bl	rand
	mov	r1, r0
	ldr	r3, .L8+12
	smull	r0, r2, r3, r1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	sub	r2, r1, r3
	add	r3, r2, #1
	str	r3, [fp, #-28]
	mov	r0, #3
	bl	sleep
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-28]
	add	r3, r2, r3
	str	r3, [fp, #-40]
	ldr	r3, [fp, #-40]
	cmp	r3, #4
	ble	.L5
	ldr	r3, [fp, #-40]
	sub	r3, r3, #4
	str	r3, [fp, #-40]
.L5:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	sub	r3, r3, #1
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	strh	r3, [fp, #-16]	@ movhi
	sub	r3, fp, #16
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-44]
	bl	semop
	ldr	r1, [fp, #-28]
	ldr	r0, .L8+16
	bl	printf
	b	.L6
.L9:
	.align	2
.L8:
	.word	.LC2
	.word	.LC0
	.word	1974
	.word	1431655766
	.word	.LC1
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
