	.file	"234569.c"
	.intel_syntax noprefix
	.text
	.globl	gridsize
	.bss
	.align 4
	.type	gridsize, @object
	.size	gridsize, 4
gridsize:
	.zero	4
	.globl	grid
	.align 32
	.type	grid, @object
	.size	grid, 400
grid:
	.zero	400
	.globl	threads_left
	.align 4
	.type	threads_left, @object
	.size	threads_left, 4
threads_left:
	.zero	4
	.globl	lock
	.align 32
	.type	lock, @object
	.size	lock, 4000
lock:
	.zero	4000
	.globl	start_t
	.align 8
	.type	start_t, @object
	.size	start_t, 8
start_t:
	.zero	8
	.globl	end_t
	.align 8
	.type	end_t, @object
	.size	end_t, 8
end_t:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d\t"
	.text
	.globl	PrintGrid
	.type	PrintGrid, @function
PrintGrid:
.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	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	DWORD PTR -8[rbp], 0
	jmp	.L2
.L5:
	mov	DWORD PTR -4[rbp], 0
	jmp	.L3
.L4:
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -24[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	mov	edx, DWORD PTR [rdx+rax*4]
	mov	rax, QWORD PTR stdout[rip]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	add	DWORD PTR -4[rbp], 1
.L3:
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L4
	mov	rax, QWORD PTR stdout[rip]
	mov	rsi, rax
	mov	edi, 10
	call	fputc@PLT
	add	DWORD PTR -8[rbp], 1
.L2:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L5
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	PrintGrid, .-PrintGrid
	.section	.rodata
	.align 8
.LC1:
	.string	"\n mutex initialization failed!"
	.text
	.globl	InitGrid
	.type	InitGrid, @function
InitGrid:
.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	DWORD PTR -44[rbp], esi
	mov	QWORD PTR -8[rbp], 0
	mov	DWORD PTR -12[rbp], 0
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	DWORD PTR -20[rbp], 0
	jmp	.L8
.L13:
	mov	DWORD PTR -16[rbp], 0
	jmp	.L9
.L12:
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -12[rbp], edx
	mov	edx, DWORD PTR -12[rbp]
	imul	edx, edx, 100
	sub	eax, edx
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -40[rbp]
	lea	rcx, [rdx+rax]
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	edx, DWORD PTR -12[rbp]
	mov	DWORD PTR [rcx+rax*4], edx
	mov	eax, DWORD PTR -12[rbp]
	cdqe
	add	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	esi, 0
	mov	rdi, rax
	call	pthread_mutex_init@PLT
	test	eax, eax
	je	.L10
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L11
.L10:
	add	DWORD PTR -16[rbp], 1
.L9:
	mov	eax, DWORD PTR -16[rbp]
	cmp	eax, DWORD PTR -44[rbp]
	jl	.L12
	add	DWORD PTR -20[rbp], 1
.L8:
	mov	eax, DWORD PTR -20[rbp]
	cmp	eax, DWORD PTR -44[rbp]
	jl	.L13
	mov	rax, QWORD PTR -8[rbp]
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	InitGrid, .-InitGrid
	.globl	SumGrid
	.type	SumGrid, @function
SumGrid:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	QWORD PTR -8[rbp], 0
	mov	DWORD PTR -16[rbp], 0
	jmp	.L15
.L18:
	mov	DWORD PTR -12[rbp], 0
	jmp	.L16
.L17:
	mov	eax, DWORD PTR -16[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -24[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -12[rbp]
	cdqe
	mov	eax, DWORD PTR [rdx+rax*4]
	cdqe
	add	QWORD PTR -8[rbp], rax
	add	DWORD PTR -12[rbp], 1
.L16:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L17
	add	DWORD PTR -16[rbp], 1
.L15:
	mov	eax, DWORD PTR -16[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L18
	mov	rax, QWORD PTR -8[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	SumGrid, .-SumGrid
	.globl	max
	.type	max, @function
max:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	mov	DWORD PTR -8[rbp], esi
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jle	.L21
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L22
.L21:
	mov	eax, DWORD PTR -8[rbp]
.L22:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	mov	DWORD PTR -8[rbp], esi
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jge	.L24
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L25
.L24:
	mov	eax, DWORD PTR -8[rbp]
.L25:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	min, .-min
	.globl	do_swaps
	.type	do_swaps, @function
do_swaps:
.LFB11:
	.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	eax, DWORD PTR threads_left[rip]
	add	eax, 1
	mov	DWORD PTR threads_left[rip], eax
	mov	DWORD PTR -32[rbp], 0
	jmp	.L27
.L42:
	call	rand@PLT
	mov	ecx, DWORD PTR gridsize[rip]
	cdq
	idiv	ecx
	mov	DWORD PTR -28[rbp], edx
	call	rand@PLT
	mov	ecx, DWORD PTR gridsize[rip]
	cdq
	idiv	ecx
	mov	DWORD PTR -24[rbp], edx
	call	rand@PLT
	mov	ecx, DWORD PTR gridsize[rip]
	cdq
	idiv	ecx
	mov	DWORD PTR -20[rbp], edx
	call	rand@PLT
	mov	ecx, DWORD PTR gridsize[rip]
	cdq
	idiv	ecx
	mov	DWORD PTR -16[rbp], edx
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 1
	jne	.L28
	mov	edx, DWORD PTR -20[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, edx
	mov	edi, eax
	call	min
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 4
	lea	rdx, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_trylock@PLT
	test	eax, eax
	je	.L29
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L29:
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	je	.L31
	mov	edx, DWORD PTR -20[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, edx
	mov	edi, eax
	call	max
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 4
	lea	rdx, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_trylock@PLT
	test	eax, eax
	je	.L31
	mov	edx, DWORD PTR -20[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, edx
	mov	edi, eax
	call	min
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 4
	lea	rdx, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L28:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 2
	jne	.L32
	mov	eax, DWORD PTR gridsize[rip]
	imul	eax, DWORD PTR -28[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -24[rbp]
	add	edx, eax
	mov	eax, DWORD PTR gridsize[rip]
	imul	eax, DWORD PTR -20[rbp]
	mov	ecx, eax
	mov	eax, DWORD PTR -16[rbp]
	add	eax, ecx
	cmp	edx, eax
	jge	.L33
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_trylock@PLT
	test	eax, eax
	je	.L34
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L34:
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jne	.L35
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	je	.L31
.L35:
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	test	eax, eax
	je	.L31
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L33:
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_trylock@PLT
	test	eax, eax
	je	.L36
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L36:
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jne	.L37
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	je	.L31
.L37:
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	test	eax, eax
	je	.L31
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	sub	DWORD PTR -32[rbp], 1
	mov	edi, 100
	call	usleep@PLT
	jmp	.L30
.L32:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	jne	.L31
	lea	rdi, lock[rip]
	call	pthread_mutex_lock@PLT
.L31:
	mov	eax, DWORD PTR -24[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, grid[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -12[rbp], eax
	mov	edi, 1
	call	sleep@PLT
	mov	eax, DWORD PTR -16[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, grid[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -24[rbp]
	movsx	rsi, eax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	add	rax, rax
	add	rax, rsi
	lea	rcx, 0[0+rax*4]
	lea	rax, grid[rip]
	mov	DWORD PTR [rcx+rax], edx
	mov	eax, DWORD PTR -16[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	lea	rdx, grid[rip]
	mov	eax, DWORD PTR -12[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 1
	jne	.L38
	mov	eax, DWORD PTR -28[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 4
	lea	rdx, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	je	.L30
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 4
	lea	rdx, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	jmp	.L30
.L38:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 2
	jne	.L39
	mov	eax, DWORD PTR gridsize[rip]
	imul	eax, DWORD PTR -28[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -24[rbp]
	add	edx, eax
	mov	eax, DWORD PTR gridsize[rip]
	imul	eax, DWORD PTR -20[rbp]
	mov	ecx, eax
	mov	eax, DWORD PTR -16[rbp]
	add	eax, ecx
	cmp	edx, eax
	jge	.L40
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jne	.L41
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	je	.L30
.L41:
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	jmp	.L30
.L40:
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	mov	rdx, rax
	sal	rdx, 2
	add	rdx, rax
	lea	rax, 0[0+rdx*8]
	mov	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 4
	add	rdx, rax
	lea	rax, lock[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	jmp	.L30
.L39:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	jne	.L30
	lea	rdi, lock[rip]
	call	pthread_mutex_unlock@PLT
.L30:
	add	DWORD PTR -32[rbp], 1
.L27:
	cmp	DWORD PTR -32[rbp], 19
	jle	.L42
	mov	eax, DWORD PTR threads_left[rip]
	sub	eax, 1
	mov	DWORD PTR threads_left[rip], eax
	mov	eax, DWORD PTR threads_left[rip]
	test	eax, eax
	jne	.L43
	lea	rdi, end_t[rip]
	call	time@PLT
.L43:
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	do_swaps, .-do_swaps
	.section	.rodata
	.align 8
.LC2:
	.string	"Grid size must be between 1 and 10."
	.align 8
.LC3:
	.string	"Number of threads must be between 1 and 1000."
	.align 8
.LC4:
	.string	"Format:  gridapp gridSize numThreads -cell"
	.align 8
.LC5:
	.string	"         gridapp gridSize numThreads -row"
	.align 8
.LC6:
	.string	"         gridapp gridSize numThreads -grid"
	.align 8
.LC7:
	.string	"         gridapp gridSize numThreads -none"
.LC8:
	.string	"Initial Grid:\n"
.LC9:
	.string	"\nInitial Sum:  %d\n"
.LC10:
	.string	"Executing threads..."
.LC11:
	.string	"thread creation failed:"
.LC12:
	.string	"\nFinal Grid:\n\n"
.LC13:
	.string	"\n\nFinal Sum:  %d\n"
	.align 8
.LC14:
	.string	"DATA INTEGRITY VIOLATION!!!!!\n"
	.align 8
.LC15:
	.string	"DATA INTEGRITY MAINTAINED!!!!!\n"
.LC16:
	.string	"Secs elapsed:  %g\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 3968
	mov	DWORD PTR -8052[rbp], edi
	mov	QWORD PTR -8064[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -8036[rbp], 0
	mov	DWORD PTR -8044[rbp], 3
	mov	QWORD PTR -8032[rbp], 0
	mov	QWORD PTR -8024[rbp], 0
	cmp	DWORD PTR -8052[rbp], 3
	jle	.L46
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR gridsize[rip], eax
	mov	eax, DWORD PTR gridsize[rip]
	cmp	eax, 10
	jg	.L47
	mov	eax, DWORD PTR gridsize[rip]
	test	eax, eax
	jg	.L48
.L47:
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L67
.L48:
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -8036[rbp], eax
	cmp	DWORD PTR -8036[rbp], 0
	jle	.L50
	cmp	DWORD PTR -8036[rbp], 1000
	jle	.L51
.L50:
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L67
.L51:
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 114
	je	.L52
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 82
	jne	.L53
.L52:
	mov	DWORD PTR -8044[rbp], 1
.L53:
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 99
	je	.L54
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 67
	jne	.L55
.L54:
	mov	DWORD PTR -8044[rbp], 2
.L55:
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 103
	je	.L56
	mov	rax, QWORD PTR -8064[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, 71
	jne	.L57
.L56:
	mov	DWORD PTR -8044[rbp], 0
	jmp	.L57
.L46:
	lea	rdi, .LC4[rip]
	call	puts@PLT
	lea	rdi, .LC5[rip]
	call	puts@PLT
	lea	rdi, .LC6[rip]
	call	puts@PLT
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L67
.L57:
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	eax, DWORD PTR gridsize[rip]
	mov	esi, eax
	lea	rdi, grid[rip]
	call	InitGrid
	mov	QWORD PTR -8032[rbp], rax
	mov	eax, DWORD PTR gridsize[rip]
	mov	esi, eax
	lea	rdi, grid[rip]
	call	PrintGrid
	mov	rax, QWORD PTR -8032[rbp]
	mov	rsi, rax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC10[rip]
	call	puts@PLT
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	lea	rdi, start_t[rip]
	call	time@PLT
	mov	DWORD PTR -8040[rbp], 0
	jmp	.L58
.L60:
	lea	rdx, -8016[rbp]
	mov	eax, DWORD PTR -8040[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	lea	rax, -8044[rbp]
	mov	rcx, rax
	lea	rdx, do_swaps[rip]
	mov	esi, 0
	call	pthread_create@PLT
	test	eax, eax
	je	.L59
	lea	rdi, .LC11[rip]
	call	perror@PLT
	mov	edi, -1
	call	exit@PLT
.L59:
	add	DWORD PTR -8040[rbp], 1
.L58:
	mov	eax, DWORD PTR -8040[rbp]
	cmp	eax, DWORD PTR -8036[rbp]
	jl	.L60
	mov	DWORD PTR -8040[rbp], 0
	jmp	.L61
.L62:
	mov	eax, DWORD PTR -8040[rbp]
	cdqe
	mov	rax, QWORD PTR -8016[rbp+rax*8]
	mov	rdi, rax
	call	pthread_detach@PLT
	add	DWORD PTR -8040[rbp], 1
.L61:
	mov	eax, DWORD PTR -8040[rbp]
	cmp	eax, DWORD PTR -8036[rbp]
	jl	.L62
.L66:
	mov	edi, 2
	call	sleep@PLT
	mov	eax, DWORD PTR threads_left[rip]
	test	eax, eax
	jne	.L66
	mov	rax, QWORD PTR stdout[rip]
	mov	rcx, rax
	mov	edx, 14
	mov	esi, 1
	lea	rdi, .LC12[rip]
	call	fwrite@PLT
	mov	eax, DWORD PTR gridsize[rip]
	mov	esi, eax
	lea	rdi, grid[rip]
	call	PrintGrid
	mov	eax, DWORD PTR gridsize[rip]
	mov	esi, eax
	lea	rdi, grid[rip]
	call	SumGrid
	mov	QWORD PTR -8024[rbp], rax
	mov	rax, QWORD PTR stdout[rip]
	mov	rdx, QWORD PTR -8024[rbp]
	lea	rsi, .LC13[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -8032[rbp]
	cmp	rax, QWORD PTR -8024[rbp]
	je	.L64
	mov	rax, QWORD PTR stdout[rip]
	mov	rcx, rax
	mov	edx, 30
	mov	esi, 1
	lea	rdi, .LC14[rip]
	call	fwrite@PLT
	jmp	.L65
.L64:
	mov	rax, QWORD PTR stdout[rip]
	mov	rcx, rax
	mov	edx, 31
	mov	esi, 1
	lea	rdi, .LC15[rip]
	call	fwrite@PLT
.L65:
	mov	rdx, QWORD PTR start_t[rip]
	mov	rax, QWORD PTR end_t[rip]
	mov	rsi, rdx
	mov	rdi, rax
	call	difftime@PLT
	movq	rax, xmm0
	mov	rdx, QWORD PTR stdout[rip]
	movq	xmm0, rax
	lea	rsi, .LC16[rip]
	mov	rdi, rdx
	mov	eax, 1
	call	fprintf@PLT
	mov	edi, 0
	call	exit@PLT
.L67:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L68
	call	__stack_chk_fail@PLT
.L68:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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	"234569.c"
	.text
	.global	gridsize
	.bss
	.align	2
	.type	gridsize, %object
	.size	gridsize, 4
gridsize:
	.space	4
	.comm	grid,400,4
	.global	threads_left
	.align	2
	.type	threads_left, %object
	.size	threads_left, 4
threads_left:
	.space	4
	.comm	lock,2400,4
	.comm	start_t,4,4
	.comm	end_t,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d\011\000"
	.text
	.align	2
	.global	PrintGrid
	.syntax unified
	.arm
	.fpu softvfp
	.type	PrintGrid, %function
PrintGrid:
	@ 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	r3, #0
	str	r3, [fp, #-12]
	b	.L2
.L5:
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L3
.L4:
	ldr	r3, .L7
	ldr	r0, [r3]
	ldr	r2, [fp, #-12]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	mov	r2, r3
	ldr	r3, [fp, #-16]
	add	r3, r3, r2
	ldr	r2, [fp, #-8]
	ldr	r3, [r3, r2, lsl #2]
	mov	r2, r3
	ldr	r1, .L7+4
	bl	fprintf
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L3:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L4
	ldr	r3, .L7
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, #10
	bl	fputc
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L2:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L5
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	stdout
	.word	.LC0
	.size	PrintGrid, .-PrintGrid
	.section	.rodata
	.align	2
.LC1:
	.ascii	"\012 mutex initialization failed!\000"
	.text
	.align	2
	.global	InitGrid
	.syntax unified
	.arm
	.fpu softvfp
	.type	InitGrid, %function
InitGrid:
	@ 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]
	str	r1, [fp, #-28]
	mov	r3, #0
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L10
.L15:
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L11
.L14:
	bl	rand
	mov	r2, r0
	ldr	r3, .L16
	smull	r1, r3, r2, r3
	asr	r1, r3, #5
	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, #2
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	mov	r2, r3
	ldr	r3, [fp, #-24]
	add	r3, r3, r2
	ldr	r2, [fp, #-16]
	ldr	r1, [fp, #-8]
	str	r1, [r3, r2, lsl #2]
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-16]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-20]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L16+4
	add	r3, r3, r2
	mov	r1, #0
	mov	r0, r3
	bl	pthread_mutex_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	ldr	r0, .L16+8
	bl	puts
	mov	r3, #1
	b	.L13
.L12:
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L11:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L14
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L10:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L15
	ldr	r3, [fp, #-12]
.L13:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	1374389535
	.word	lock
	.word	.LC1
	.size	InitGrid, .-InitGrid
	.align	2
	.global	SumGrid
	.syntax unified
	.arm
	.fpu softvfp
	.type	SumGrid, %function
SumGrid:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #28
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	mov	r3, #0
	str	r3, [fp, #-8]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L19
.L22:
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L20
.L21:
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	mov	r2, r3
	ldr	r3, [fp, #-24]
	add	r3, r3, r2
	ldr	r2, [fp, #-12]
	ldr	r3, [r3, r2, lsl #2]
	ldr	r2, [fp, #-8]
	add	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L20:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L21
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L19:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L22
	ldr	r3, [fp, #-8]
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	SumGrid, .-SumGrid
	.align	2
	.global	max
	.syntax unified
	.arm
	.fpu softvfp
	.type	max, %function
max:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	str	r1, [fp, #-12]
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	ble	.L25
	ldr	r3, [fp, #-8]
	b	.L26
.L25:
	ldr	r3, [fp, #-12]
.L26:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	max, .-max
	.align	2
	.global	min
	.syntax unified
	.arm
	.fpu softvfp
	.type	min, %function
min:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	str	r1, [fp, #-12]
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	bge	.L28
	ldr	r3, [fp, #-8]
	b	.L29
.L28:
	ldr	r3, [fp, #-12]
.L29:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	min, .-min
	.global	__aeabi_idivmod
	.align	2
	.global	do_swaps
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_swaps, %function
do_swaps:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	str	r0, [fp, #-40]
	ldr	r3, [fp, #-40]
	str	r3, [fp, #-28]
	ldr	r3, .L49
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L49
	str	r3, [r2]
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L31
.L46:
	bl	rand
	mov	r2, r0
	ldr	r3, .L49+4
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-24]
	bl	rand
	mov	r2, r0
	ldr	r3, .L49+4
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-20]
	bl	rand
	mov	r2, r0
	ldr	r3, .L49+4
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-16]
	bl	rand
	mov	r2, r0
	ldr	r3, .L49+4
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L32
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-24]
	bl	min
	mov	r2, r0
	mov	r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_trylock
	mov	r3, r0
	cmp	r3, #0
	beq	.L33
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L33:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	beq	.L35
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-24]
	bl	max
	mov	r2, r0
	mov	r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_trylock
	mov	r3, r0
	cmp	r3, #0
	beq	.L35
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-24]
	bl	min
	mov	r2, r0
	mov	r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L32:
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L36
	ldr	r3, .L49+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	mul	r2, r3, r2
	ldr	r3, [fp, #-20]
	add	r2, r2, r3
	ldr	r3, .L49+4
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	mul	r1, r3, r1
	ldr	r3, [fp, #-12]
	add	r3, r1, r3
	cmp	r2, r3
	bge	.L37
	ldr	r3, [fp, #-20]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-24]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_trylock
	mov	r3, r0
	cmp	r3, #0
	beq	.L38
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L38:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bne	.L39
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L35
.L39:
	ldr	r3, [fp, #-12]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-16]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_lock
	mov	r3, r0
	cmp	r3, #0
	beq	.L35
	ldr	r3, [fp, #-20]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-24]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L37:
	ldr	r3, [fp, #-12]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-16]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_trylock
	mov	r3, r0
	cmp	r3, #0
	beq	.L40
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L40:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bne	.L41
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L35
.L41:
	ldr	r3, [fp, #-20]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-24]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_lock
	mov	r3, r0
	cmp	r3, #0
	beq	.L35
	ldr	r3, [fp, #-12]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-16]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-32]
	sub	r3, r3, #1
	str	r3, [fp, #-32]
	mov	r0, #100
	bl	usleep
	b	.L34
.L36:
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L35
	ldr	r0, .L49+8
	bl	pthread_mutex_lock
.L35:
	ldr	r1, .L49+12
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	ldr	r2, [fp, #-20]
	add	r3, r3, r2
	ldr	r3, [r1, r3, lsl #2]
	str	r3, [fp, #-8]
	mov	r0, #1
	bl	sleep
	ldr	r1, .L49+12
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	ldr	r2, [fp, #-12]
	add	r3, r3, r2
	ldr	r1, [r1, r3, lsl #2]
	ldr	r0, .L49+12
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	ldr	r2, [fp, #-20]
	add	r3, r3, r2
	str	r1, [r0, r3, lsl #2]
	ldr	r1, .L49+12
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	ldr	r2, [fp, #-12]
	add	r3, r3, r2
	ldr	r2, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L42
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	beq	.L34
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	b	.L34
.L42:
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L43
	ldr	r3, .L49+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	mul	r2, r3, r2
	ldr	r3, [fp, #-20]
	add	r2, r2, r3
	ldr	r3, .L49+4
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	mul	r1, r3, r1
	ldr	r3, [fp, #-12]
	add	r3, r1, r3
	cmp	r2, r3
	bge	.L44
	ldr	r3, [fp, #-20]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-24]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bne	.L45
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L34
.L45:
	ldr	r3, [fp, #-12]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-16]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	b	.L34
.L44:
	ldr	r3, [fp, #-12]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-16]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-20]
	mov	r2, r3
	lsl	r2, r2, #1
	add	r2, r2, r3
	lsl	r3, r2, #3
	mov	r2, r3
	ldr	r1, [fp, #-24]
	mov	r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, .L49+8
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	b	.L34
.L43:
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L34
	ldr	r0, .L49+8
	bl	pthread_mutex_unlock
.L34:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L31:
	ldr	r3, [fp, #-32]
	cmp	r3, #19
	ble	.L46
	ldr	r3, .L49
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L49
	str	r3, [r2]
	ldr	r3, .L49
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L47
	ldr	r0, .L49+16
	bl	time
.L47:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L50:
	.align	2
.L49:
	.word	threads_left
	.word	gridsize
	.word	lock
	.word	grid
	.word	end_t
	.size	do_swaps, .-do_swaps
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Grid size must be between 1 and 10.\000"
	.align	2
.LC3:
	.ascii	"Number of threads must be between 1 and 1000.\000"
	.align	2
.LC4:
	.ascii	"Format:  gridapp gridSize numThreads -cell\000"
	.align	2
.LC5:
	.ascii	"         gridapp gridSize numThreads -row\000"
	.align	2
.LC6:
	.ascii	"         gridapp gridSize numThreads -grid\000"
	.align	2
.LC7:
	.ascii	"         gridapp gridSize numThreads -none\000"
	.align	2
.LC8:
	.ascii	"Initial Grid:\012\000"
	.align	2
.LC9:
	.ascii	"\012Initial Sum:  %d\012\000"
	.align	2
.LC10:
	.ascii	"Executing threads...\000"
	.align	2
.LC11:
	.ascii	"thread creation failed:\000"
	.align	2
.LC12:
	.ascii	"\012Final Grid:\012\012\000"
	.align	2
.LC13:
	.ascii	"\012\012Final Sum:  %d\012\000"
	.align	2
.LC14:
	.ascii	"DATA INTEGRITY VIOLATION!!!!!\012\000"
	.align	2
.LC15:
	.ascii	"DATA INTEGRITY MAINTAINED!!!!!\012\000"
	.align	2
.LC16:
	.ascii	"Secs elapsed:  %g\012\000"
	.align	2
.LC17:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 4032
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #4032
	sub	sp, sp, #4
	str	r0, [fp, #-4040]
	str	r1, [fp, #-4044]
	ldr	r3, .L75
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-4028]
	mov	r3, #3
	str	r3, [fp, #-4036]
	mov	r3, #0
	str	r3, [fp, #-4024]
	mov	r3, #0
	str	r3, [fp, #-4020]
	ldr	r3, [fp, #-4040]
	cmp	r3, #3
	ble	.L52
	ldr	r3, [fp, #-4044]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L75+4
	str	r3, [r2]
	ldr	r3, .L75+4
	ldr	r3, [r3]
	cmp	r3, #10
	bgt	.L53
	ldr	r3, .L75+4
	ldr	r3, [r3]
	cmp	r3, #0
	bgt	.L54
.L53:
	ldr	r0, .L75+8
	bl	puts
	mov	r3, #1
	b	.L73
.L54:
	ldr	r3, [fp, #-4044]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-4028]
	ldr	r3, [fp, #-4028]
	cmp	r3, #0
	ble	.L56
	ldr	r3, [fp, #-4028]
	cmp	r3, #1000
	ble	.L57
.L56:
	ldr	r0, .L75+12
	bl	printf
	mov	r3, #1
	b	.L73
.L57:
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #114
	beq	.L58
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #82
	bne	.L59
.L58:
	mov	r3, #1
	str	r3, [fp, #-4036]
.L59:
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #99
	beq	.L60
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #67
	bne	.L61
.L60:
	mov	r3, #2
	str	r3, [fp, #-4036]
.L61:
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #103
	beq	.L62
	ldr	r3, [fp, #-4044]
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #71
	bne	.L63
.L62:
	mov	r3, #0
	str	r3, [fp, #-4036]
	b	.L63
.L52:
	ldr	r0, .L75+16
	bl	puts
	ldr	r0, .L75+20
	bl	puts
	ldr	r0, .L75+24
	bl	puts
	ldr	r0, .L75+28
	bl	puts
	mov	r3, #1
	b	.L73
.L63:
	ldr	r0, .L75+32
	bl	puts
	ldr	r3, .L75+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L75+36
	bl	InitGrid
	str	r0, [fp, #-4024]
	ldr	r3, .L75+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L75+36
	bl	PrintGrid
	ldr	r1, [fp, #-4024]
	ldr	r0, .L75+40
	bl	printf
	ldr	r0, .L75+44
	bl	puts
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	ldr	r0, .L75+48
	bl	time
	mov	r3, #0
	str	r3, [fp, #-4032]
	b	.L64
.L66:
	sub	r3, fp, #4000
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r2, [fp, #-4032]
	lsl	r2, r2, #2
	add	r0, r3, r2
	sub	r3, fp, #4016
	sub	r3, r3, #12
	sub	r3, r3, #8
	ldr	r2, .L75+52
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L65
	ldr	r0, .L75+56
	bl	perror
	mvn	r0, #0
	bl	exit
.L65:
	ldr	r3, [fp, #-4032]
	add	r3, r3, #1
	str	r3, [fp, #-4032]
.L64:
	ldr	r2, [fp, #-4032]
	ldr	r3, [fp, #-4028]
	cmp	r2, r3
	blt	.L66
	mov	r3, #0
	str	r3, [fp, #-4032]
	b	.L67
.L68:
	ldr	r3, [fp, #-4032]
	lsl	r3, r3, #2
	sub	r2, fp, #12
	add	r3, r2, r3
	ldr	r3, [r3, #-4004]
	mov	r0, r3
	bl	pthread_detach
	ldr	r3, [fp, #-4032]
	add	r3, r3, #1
	str	r3, [fp, #-4032]
.L67:
	ldr	r2, [fp, #-4032]
	ldr	r3, [fp, #-4028]
	cmp	r2, r3
	blt	.L68
.L72:
	mov	r0, #2
	bl	sleep
	ldr	r3, .L75+60
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L72
	ldr	r3, .L75+64
	ldr	r3, [r3]
	mov	r2, #14
	mov	r1, #1
	ldr	r0, .L75+68
	bl	fwrite
	ldr	r3, .L75+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L75+36
	bl	PrintGrid
	ldr	r3, .L75+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L75+36
	bl	SumGrid
	str	r0, [fp, #-4020]
	ldr	r3, .L75+64
	ldr	r3, [r3]
	ldr	r2, [fp, #-4020]
	ldr	r1, .L75+72
	mov	r0, r3
	bl	fprintf
	ldr	r2, [fp, #-4024]
	ldr	r3, [fp, #-4020]
	cmp	r2, r3
	beq	.L70
	ldr	r3, .L75+64
	ldr	r3, [r3]
	mov	r2, #30
	mov	r1, #1
	ldr	r0, .L75+76
	bl	fwrite
	b	.L71
.L70:
	ldr	r3, .L75+64
	ldr	r3, [r3]
	mov	r2, #31
	mov	r1, #1
	ldr	r0, .L75+80
	bl	fwrite
.L71:
	ldr	r3, .L75+64
	ldr	r4, [r3]
	ldr	r3, .L75+84
	ldr	r3, [r3]
	ldr	r2, .L75+48
	ldr	r2, [r2]
	mov	r1, r2
	mov	r0, r3
	bl	difftime
	mov	r2, r0
	mov	r3, r1
	ldr	r1, .L75+88
	mov	r0, r4
	bl	fprintf
	mov	r0, #0
	bl	exit
.L73:
	ldr	r2, .L75
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L74
	bl	__stack_chk_fail
.L74:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L76:
	.align	2
.L75:
	.word	.LC17
	.word	gridsize
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	grid
	.word	.LC9
	.word	.LC10
	.word	start_t
	.word	do_swaps
	.word	.LC11
	.word	threads_left
	.word	stdout
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.word	end_t
	.word	.LC16
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
