	.file	"957713.c"
	.intel_syntax noprefix
	.text
	.globl	chopstick
	.bss
	.align 32
	.type	chopstick, @object
	.size	chopstick, 200
chopstick:
	.zero	200
	.globl	food_lock
	.align 32
	.type	food_lock, @object
	.size	food_lock, 40
food_lock:
	.zero	40
	.globl	philo
	.align 32
	.type	philo, @object
	.size	philo, 40
philo:
	.zero	40
	.globl	lock
	.align 4
	.type	lock, @object
	.size	lock, 4
lock:
	.zero	4
	.globl	palito_ocupado
	.align 16
	.type	palito_ocupado, @object
	.size	palito_ocupado, 20
palito_ocupado:
	.zero	20
	.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	esi, 0
	lea	rdi, food_lock[rip]
	call	pthread_mutex_init@PLT
	mov	QWORD PTR -8[rbp], 0
	jmp	.L2
.L3:
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, chopstick[rip]
	add	rax, rdx
	mov	esi, 0
	mov	rdi, rax
	call	pthread_mutex_init@PLT
	mov	rax, QWORD PTR -8[rbp]
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	DWORD PTR [rdx+rax], 0
	add	QWORD PTR -8[rbp], 1
.L2:
	cmp	QWORD PTR -8[rbp], 4
	jle	.L3
	mov	QWORD PTR -8[rbp], 0
	jmp	.L4
.L5:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR -8[rbp]
	lea	rcx, 0[0+rdx*8]
	lea	rdx, philo[rip]
	lea	rdi, [rcx+rdx]
	mov	rcx, rax
	lea	rdx, philosopher[rip]
	mov	esi, 0
	call	pthread_create@PLT
	add	QWORD PTR -8[rbp], 1
.L4:
	cmp	QWORD PTR -8[rbp], 4
	jle	.L5
	mov	QWORD PTR -8[rbp], 0
	jmp	.L6
.L7:
	mov	rax, QWORD PTR -8[rbp]
	lea	rdx, 0[0+rax*8]
	lea	rax, philo[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	QWORD PTR -8[rbp], 1
.L6:
	cmp	QWORD PTR -8[rbp], 4
	jle	.L7
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.string	"Philosopher %ld: got chopstick %d\n"
	.align 8
.LC1:
	.string	"Philosopher %ld: eating -- food %d.\n"
	.align 8
.LC2:
	.string	"Philosopher %ld has finished.\n"
	.align 8
.LC3:
	.string	"Philosopher %ld: released chopstick %d\n"
	.text
	.globl	philosopher
	.type	philosopher, @function
philosopher:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR -20[rbp], eax
	mov	rax, QWORD PTR -8[rbp]
	lea	rcx, 1[rax]
	movabs	rdx, 7378697629483820647
	mov	rax, rcx
	imul	rdx
	mov	rax, rdx
	sar	rax
	mov	rdx, rcx
	sar	rdx, 63
	sub	rax, rdx
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	mov	rax, rcx
	sub	rax, rdx
	mov	DWORD PTR -16[rbp], eax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L15
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 274877907
	shr	rdx, 32
	sar	edx, 7
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 2000
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	usleep@PLT
	nop
.L15:
	nop
.L11:
	mov	eax, 1
	xchg	eax, DWORD PTR lock[rip]
	test	eax, eax
	jne	.L11
	nop
.L12:
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jne	.L12
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jne	.L12
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, chopstick[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	edx, DWORD PTR -20[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	eax, DWORD PTR -16[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, chopstick[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	edx, DWORD PTR -16[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	DWORD PTR lock[rip], 0
	mov	eax, 0
	call	food_on_table
	mov	DWORD PTR -12[rbp], eax
	mov	edx, DWORD PTR -12[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 6
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 200
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	usleep@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, chopstick[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	edx, DWORD PTR -20[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -16[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, chopstick[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	edx, DWORD PTR -16[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, palito_ocupado[rip]
	mov	DWORD PTR [rdx+rax], 0
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 6
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 200
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	usleep@PLT
	cmp	DWORD PTR -12[rbp], 0
	jg	.L15
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	philosopher, .-philosopher
	.globl	food_on_table
	.type	food_on_table, @function
food_on_table:
.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
	lea	rdi, food_lock[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR food.0[rip]
	test	eax, eax
	jle	.L17
	mov	eax, DWORD PTR food.0[rip]
	sub	eax, 1
	mov	DWORD PTR food.0[rip], eax
.L17:
	mov	eax, DWORD PTR food.0[rip]
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, food_lock[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -4[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	food_on_table, .-food_on_table
	.data
	.align 4
	.type	food.0, @object
	.size	food.0, 4
food.0:
	.long	150
	.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	"957713.c"
	.text
	.comm	chopstick,120,4
	.comm	food_lock,24,4
	.comm	philo,20,4
	.global	lock
	.bss
	.align	2
	.type	lock, %object
	.size	lock, 4
lock:
	.space	4
	.comm	palito_ocupado,20,4
	.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
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r1, #0
	ldr	r0, .L9
	bl	pthread_mutex_init
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L9+4
	add	r3, r3, r2
	mov	r1, #0
	mov	r0, r3
	bl	pthread_mutex_init
	ldr	r2, .L9+8
	ldr	r3, [fp, #-8]
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #4
	ble	.L3
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L4
.L5:
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, .L9+12
	add	r0, r3, r2
	ldr	r3, [fp, #-8]
	ldr	r2, .L9+16
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L4:
	ldr	r3, [fp, #-8]
	cmp	r3, #4
	ble	.L5
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L6
.L7:
	ldr	r2, .L9+12
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L6:
	ldr	r3, [fp, #-8]
	cmp	r3, #4
	ble	.L7
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	food_lock
	.word	chopstick
	.word	palito_ocupado
	.word	philo
	.word	philosopher
	.size	main, .-main
	.global	__sync_lock_test_and_set_4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Philosopher %ld: got chopstick %d\012\000"
	.align	2
.LC1:
	.ascii	"Philosopher %ld: eating -- food %d.\012\000"
	.align	2
.LC2:
	.ascii	"Philosopher %ld has finished.\012\000"
	.align	2
.LC3:
	.ascii	"Philosopher %ld: released chopstick %d\012\000"
	.text
	.align	2
	.global	philosopher
	.syntax unified
	.arm
	.fpu softvfp
	.type	philosopher, %function
philosopher:
	@ 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, [fp, #-24]
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-20]
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-20]
	add	r2, r3, #1
	ldr	r3, .L18
	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	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	bne	.L17
	bl	rand
	mov	r1, r0
	ldr	r3, .L18+4
	smull	r2, r3, r1, r3
	asr	r2, r3, #7
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #4
	sub	r2, r1, r3
	mov	r3, r2
	mov	r0, r3
	bl	usleep
	nop
.L17:
	nop
.L13:
	ldr	r3, .L18+8
	mov	r1, #1
	mov	r0, r3
	bl	__sync_lock_test_and_set_4
	mov	r3, r0
	cmp	r3, #0
	bne	.L13
	nop
.L14:
	ldr	r2, .L18+12
	ldr	r3, [fp, #-16]
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #0
	bne	.L14
	ldr	r2, .L18+12
	ldr	r3, [fp, #-12]
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #0
	bne	.L14
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L18+16
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r2, [fp, #-16]
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+20
	bl	printf
	ldr	r2, .L18+12
	ldr	r3, [fp, #-16]
	mov	r1, #1
	str	r1, [r2, r3, lsl #2]
	ldr	r2, [fp, #-12]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L18+16
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+20
	bl	printf
	ldr	r2, .L18+12
	ldr	r3, [fp, #-12]
	mov	r1, #1
	str	r1, [r2, r3, lsl #2]
	ldr	r3, .L18+8
	mov	r2, #0
	str	r2, [r3]
	bl	food_on_table
	str	r0, [fp, #-8]
	ldr	r2, [fp, #-8]
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+24
	bl	printf
	bl	rand
	mov	r2, r0
	ldr	r3, .L18+28
	smull	r1, r3, r2, r3
	asr	r1, r3, #6
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #3
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	usleep
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+32
	bl	printf
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L18+16
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r2, [fp, #-16]
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+36
	bl	printf
	ldr	r2, .L18+12
	ldr	r3, [fp, #-16]
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r2, [fp, #-12]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L18+16
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-20]
	ldr	r0, .L18+36
	bl	printf
	ldr	r2, .L18+12
	ldr	r3, [fp, #-12]
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	bl	rand
	mov	r2, r0
	ldr	r3, .L18+28
	smull	r1, r3, r2, r3
	asr	r1, r3, #6
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #3
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	usleep
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bgt	.L17
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	1717986919
	.word	274877907
	.word	lock
	.word	palito_ocupado
	.word	chopstick
	.word	.LC0
	.word	.LC1
	.word	1374389535
	.word	.LC2
	.word	.LC3
	.size	philosopher, .-philosopher
	.align	2
	.global	food_on_table
	.syntax unified
	.arm
	.fpu softvfp
	.type	food_on_table, %function
food_on_table:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L23
	bl	pthread_mutex_lock
	ldr	r3, .L23+4
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L21
	ldr	r3, .L23+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L23+4
	str	r3, [r2]
.L21:
	ldr	r3, .L23+4
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r0, .L23
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L24:
	.align	2
.L23:
	.word	food_lock
	.word	food.6279
	.size	food_on_table, .-food_on_table
	.data
	.align	2
	.type	food.6279, %object
	.size	food.6279, 4
food.6279:
	.word	150
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
