	.file	"813078.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"usage: %s parameter1 parameter2 ...\n"
.LC1:
	.string	"semget failed!"
.LC2:
	.string	"1"
.LC3:
	.string	"Process %d:"
.LC4:
	.string	"\n %d -finished \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	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	DWORD PTR -20[rbp], 0
	cmp	DWORD PTR -36[rbp], 1
	jg	.L2
	mov	rax, QWORD PTR -48[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	call	getpid@PLT
	mov	edi, eax
	call	srand@PLT
	mov	edx, 944
	mov	esi, 1
	mov	edi, 1234
	call	semget@PLT
	mov	DWORD PTR -16[rbp], eax
	cmp	DWORD PTR -16[rbp], -1
	jne	.L3
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	edi, 2
	call	exit@PLT
.L3:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC2[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	je	.L4
	mov	eax, DWORD PTR -16[rbp]
	mov	ecx, 1
	mov	edx, 16
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -20[rbp], 1
	mov	edi, 2
	call	sleep@PLT
.L4:
	mov	DWORD PTR -24[rbp], 0
	jmp	.L5
.L10:
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -48[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -16[rbp]
	mov	edi, eax
	call	semaphore_P
	test	eax, eax
	jne	.L6
	mov	edi, 3
	call	exit@PLT
.L6:
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	jmp	.L7
.L8:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1431655766
	shr	rdx, 32
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -12[rbp], edx
	mov	ecx, DWORD PTR -12[rbp]
	mov	edx, ecx
	add	edx, edx
	add	edx, ecx
	sub	eax, edx
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	sleep@PLT
	add	QWORD PTR -8[rbp], 1
.L7:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L8
	mov	edi, 10
	call	putchar@PLT
	mov	eax, DWORD PTR -16[rbp]
	mov	edi, eax
	call	semaphore_V
	test	eax, eax
	jne	.L9
	mov	edi, 4
	call	exit@PLT
.L9:
	call	rand@PLT
	cdq
	shr	edx, 31
	add	eax, edx
	and	eax, 1
	sub	eax, edx
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	sleep@PLT
	add	DWORD PTR -24[rbp], 1
.L5:
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -36[rbp]
	jl	.L10
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	cmp	DWORD PTR -20[rbp], 1
	jne	.L11
	mov	edi, 10
	call	sleep@PLT
	mov	eax, DWORD PTR -16[rbp]
	mov	ecx, 0
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
.L11:
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC5:
	.string	"semaphore_P failed."
	.text
	.globl	semaphore_P
	.type	semaphore_P, @function
semaphore_P:
.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, 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	.L14
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	eax, 0
	jmp	.L16
.L14:
	mov	eax, 1
.L16:
	mov	rdx, QWORD PTR -8[rbp]
	sub	rdx, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	semaphore_P, .-semaphore_P
	.section	.rodata
.LC6:
	.string	"semaphore_V failed. "
	.text
	.globl	semaphore_V
	.type	semaphore_V, @function
semaphore_V:
.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	.L19
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	eax, 0
	jmp	.L21
.L19:
	mov	eax, 1
.L21:
	mov	rdx, QWORD PTR -8[rbp]
	sub	rdx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	semaphore_V, .-semaphore_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	"813078.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"usage: %s parameter1 parameter2 ...\012\000"
	.align	2
.LC1:
	.ascii	"semget failed!\000"
	.align	2
.LC2:
	.ascii	"1\000"
	.align	2
.LC3:
	.ascii	"Process %d:\000"
	.align	2
.LC4:
	.ascii	"\012 %d -finished \012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	mov	r3, #0
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-32]
	cmp	r3, #1
	bgt	.L2
	ldr	r3, [fp, #-36]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L13
	bl	printf
	mov	r0, #1
	bl	exit
.L2:
	bl	getpid
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r2, #944
	mov	r1, #1
	ldr	r0, .L13+4
	bl	semget
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L13+8
	bl	puts
	mov	r0, #2
	bl	exit
.L3:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L13+12
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	mov	r3, #1
	mov	r2, #16
	mov	r1, #0
	ldr	r0, [fp, #-12]
	bl	semctl
	mov	r3, #1
	str	r3, [fp, #-20]
	mov	r0, #2
	bl	sleep
.L4:
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L5
.L10:
	ldr	r3, [fp, #-24]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-36]
	add	r3, r2, r3
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	ldr	r0, [fp, #-12]
	bl	semaphore_P
	mov	r3, r0
	cmp	r3, #0
	bne	.L6
	mov	r0, #3
	bl	exit
.L6:
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L13+16
	bl	printf
	ldr	r3, .L13+20
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	b	.L7
.L8:
	ldr	r3, [fp, #-16]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldr	r3, .L13+20
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	bl	rand
	mov	r2, r0
	ldr	r3, .L13+24
	smull	r0, r1, r3, r2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	bl	sleep
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L7:
	ldr	r3, [fp, #-16]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L8
	mov	r0, #10
	bl	putchar
	ldr	r0, [fp, #-12]
	bl	semaphore_V
	mov	r3, r0
	cmp	r3, #0
	bne	.L9
	mov	r0, #4
	bl	exit
.L9:
	bl	rand
	mov	r3, r0
	cmp	r3, #0
	and	r3, r3, #1
	rsblt	r3, r3, #0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	bl	sleep
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L5:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-32]
	cmp	r2, r3
	blt	.L10
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L13+28
	bl	printf
	ldr	r3, [fp, #-20]
	cmp	r3, #1
	bne	.L11
	mov	r0, #10
	bl	sleep
	mov	r3, #0
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-12]
	bl	semctl
.L11:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC0
	.word	1234
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	stdout
	.word	1431655766
	.word	.LC4
	.size	main, .-main
	.section	.rodata
	.align	2
.LC5:
	.ascii	"semaphore_P failed.\000"
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	semaphore_P
	.syntax unified
	.arm
	.fpu softvfp
	.type	semaphore_P, %function
semaphore_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, .L20
	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	.L16
	ldr	r0, .L20+4
	bl	puts
	mov	r3, #0
	b	.L18
.L16:
	mov	r3, #1
.L18:
	ldr	r2, .L20
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC6
	.word	.LC5
	.size	semaphore_P, .-semaphore_P
	.section	.rodata
	.align	2
.LC7:
	.ascii	"semaphore_V failed. \000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	semaphore_V
	.syntax unified
	.arm
	.fpu softvfp
	.type	semaphore_V, %function
semaphore_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, .L27
	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, .L27+4
	bl	puts
	mov	r3, #0
	b	.L25
.L23:
	mov	r3, #1
.L25:
	ldr	r2, .L27
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L26
	bl	__stack_chk_fail
.L26:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC8
	.word	.LC7
	.size	semaphore_V, .-semaphore_V
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
