	.file	"886047.c"
	.intel_syntax noprefix
	.text
	.globl	mutex
	.bss
	.align 32
	.type	mutex, @object
	.size	mutex, 32
mutex:
	.zero	32
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 160
S:
	.zero	160
	.globl	state
	.align 16
	.type	state, @object
	.size	state, 20
state:
	.zero	20
	.globl	phil_num
	.data
	.align 16
	.type	phil_num, @object
	.size	phil_num, 20
phil_num:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.section	.rodata
.LC0:
	.string	"Philosopher %d is thinkingn \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, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	sem_init@PLT
	mov	DWORD PTR -52[rbp], 0
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, S[rip]
	add	rax, rdx
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	sem_init@PLT
	add	DWORD PTR -52[rbp], 1
.L2:
	cmp	DWORD PTR -52[rbp], 4
	jle	.L3
	mov	DWORD PTR -52[rbp], 0
	jmp	.L4
.L5:
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, phil_num[rip]
	add	rdx, rax
	lea	rcx, -48[rbp]
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	sal	rax, 3
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, philospher[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, DWORD PTR -52[rbp]
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -52[rbp], 1
.L4:
	cmp	DWORD PTR -52[rbp], 4
	jle	.L5
	mov	DWORD PTR -52[rbp], 0
	jmp	.L6
.L7:
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -52[rbp], 1
.L6:
	cmp	DWORD PTR -52[rbp], 4
	jle	.L7
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	philospher
	.type	philospher, @function
philospher:
.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	QWORD PTR -24[rbp], rdi
.L11:
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	edi, 1
	mov	eax, 0
	call	sleep@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	take_fork
	mov	edi, 0
	mov	eax, 0
	call	sleep@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	put_fork
	jmp	.L11
	.cfi_endproc
.LFE7:
	.size	philospher, .-philospher
	.section	.rodata
.LC1:
	.string	"Philosopher %d is Hungryn \n"
	.text
	.globl	take_fork
	.type	take_fork, @function
take_fork:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	test
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, S[rip]
	add	rax, rdx
	mov	rdi, rax
	call	sem_wait@PLT
	mov	edi, 1
	mov	eax, 0
	call	sleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	take_fork, .-take_fork
	.section	.rodata
	.align 8
.LC2:
	.string	"Philosopher %d takes fork %d and %d \n"
.LC3:
	.string	"Philosopher %d is Eatingn \n"
	.text
	.globl	test
	.type	test, @function
test:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	eax, 1
	jne	.L15
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 4[rax]
	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
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	eax, 2
	je	.L15
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 1[rax]
	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
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	eax, 2
	je	.L15
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	DWORD PTR [rdx+rax], 2
	mov	edi, 2
	mov	eax, 0
	call	sleep@PLT
	mov	eax, DWORD PTR -4[rbp]
	lea	esi, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 4[rax]
	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
	lea	edx, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	ecx, esi
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, S[rip]
	add	rax, rdx
	mov	rdi, rax
	call	sem_post@PLT
.L15:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	test, .-test
	.section	.rodata
	.align 8
.LC4:
	.string	"Philosopher %d putting fork %d and %d down \n"
	.text
	.globl	put_fork
	.type	put_fork, @function
put_fork:
.LFB10:
	.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
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, state[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	lea	esi, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 4[rax]
	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
	lea	edx, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	ecx, esi
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 4[rax]
	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
	call	test
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 1[rax]
	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
	call	test
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	put_fork, .-put_fork
	.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	"886047.c"
	.text
	.comm	mutex,16,4
	.comm	S,80,4
	.comm	state,20,4
	.global	phil_num
	.data
	.align	2
	.type	phil_num, %object
	.size	phil_num, 20
phil_num:
	.word	0
	.word	1
	.word	2
	.word	3
	.word	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Philosopher %d is thinkingn \012\000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.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
	ldr	r3, .L10
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L10+4
	bl	sem_init
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L2
.L3:
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #4
	ldr	r2, .L10+8
	add	r3, r3, r2
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	sem_init
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L2:
	ldr	r3, [fp, #-32]
	cmp	r3, #4
	ble	.L3
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L4
.L5:
	sub	r2, fp, #28
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	ldr	r2, .L10+12
	add	r3, r3, r2
	ldr	r2, .L10+16
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L10+20
	bl	printf
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L4:
	ldr	r3, [fp, #-32]
	cmp	r3, #4
	ble	.L5
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L6
.L7:
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-24]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L6:
	ldr	r3, [fp, #-32]
	cmp	r3, #4
	ble	.L7
	mov	r3, #0
	ldr	r2, .L10
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L9
	bl	__stack_chk_fail
.L9:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC1
	.word	mutex
	.word	S
	.word	phil_num
	.word	philospher
	.word	.LC0
	.size	main, .-main
	.align	2
	.global	philospher
	.syntax unified
	.arm
	.fpu softvfp
	.type	philospher, %function
philospher:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
.L13:
	ldr	r3, [fp, #-16]
	str	r3, [fp, #-8]
	mov	r0, #1
	bl	sleep
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r0, r3
	bl	take_fork
	mov	r0, #0
	bl	sleep
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r0, r3
	bl	put_fork
	b	.L13
	.size	philospher, .-philospher
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Philosopher %d is Hungryn \012\000"
	.text
	.align	2
	.global	take_fork
	.syntax unified
	.arm
	.fpu softvfp
	.type	take_fork, %function
take_fork:
	@ 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]
	ldr	r0, .L15
	bl	sem_wait
	ldr	r2, .L15+4
	ldr	r3, [fp, #-8]
	mov	r1, #1
	str	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L15+8
	bl	printf
	ldr	r0, [fp, #-8]
	bl	test
	ldr	r0, .L15
	bl	sem_post
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	ldr	r2, .L15+12
	add	r3, r3, r2
	mov	r0, r3
	bl	sem_wait
	mov	r0, #1
	bl	sleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	mutex
	.word	state
	.word	.LC2
	.word	S
	.size	take_fork, .-take_fork
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Philosopher %d takes fork %d and %d \012\000"
	.align	2
.LC4:
	.ascii	"Philosopher %d is Eatingn \012\000"
	.text
	.align	2
	.global	test
	.syntax unified
	.arm
	.fpu softvfp
	.type	test, %function
test:
	@ 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]
	ldr	r2, .L20
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #1
	bne	.L19
	ldr	r3, [fp, #-8]
	add	r1, r3, #4
	ldr	r3, .L20+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
	ldr	r3, .L20
	ldr	r3, [r3, r2, lsl #2]
	cmp	r3, #2
	beq	.L19
	ldr	r3, [fp, #-8]
	add	r1, r3, #1
	ldr	r3, .L20+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
	ldr	r3, .L20
	ldr	r3, [r3, r2, lsl #2]
	cmp	r3, #2
	beq	.L19
	ldr	r2, .L20
	ldr	r3, [fp, #-8]
	mov	r1, #2
	str	r1, [r2, r3, lsl #2]
	mov	r0, #2
	bl	sleep
	ldr	r3, [fp, #-8]
	add	r0, r3, #1
	ldr	r3, [fp, #-8]
	add	r1, r3, #4
	ldr	r3, .L20+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
	add	r2, r2, #1
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r1, r0
	ldr	r0, .L20+8
	bl	printf
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L20+12
	bl	printf
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	ldr	r2, .L20+16
	add	r3, r3, r2
	mov	r0, r3
	bl	sem_post
.L19:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	state
	.word	1717986919
	.word	.LC3
	.word	.LC4
	.word	S
	.size	test, .-test
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Philosopher %d putting fork %d and %d down \012\000"
	.text
	.align	2
	.global	put_fork
	.syntax unified
	.arm
	.fpu softvfp
	.type	put_fork, %function
put_fork:
	@ 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]
	ldr	r0, .L23
	bl	sem_wait
	ldr	r2, .L23+4
	ldr	r3, [fp, #-8]
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-8]
	add	r0, r3, #1
	ldr	r3, [fp, #-8]
	add	r1, r3, #4
	ldr	r3, .L23+8
	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
	add	r2, r2, #1
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r1, r0
	ldr	r0, .L23+12
	bl	printf
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L23+16
	bl	printf
	ldr	r3, [fp, #-8]
	add	r2, r3, #4
	ldr	r3, .L23+8
	smull	r1, r3, r2, r3
	asr	r1, r3, #1
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r0, r1
	bl	test
	ldr	r3, [fp, #-8]
	add	r2, r3, #1
	ldr	r3, .L23+8
	smull	r1, r3, r2, r3
	asr	r1, r3, #1
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r0, r1
	bl	test
	ldr	r0, .L23
	bl	sem_post
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L24:
	.align	2
.L23:
	.word	mutex
	.word	state
	.word	1717986919
	.word	.LC5
	.word	.LC0
	.size	put_fork, .-put_fork
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
