	.file	"23576048.c"
	.intel_syntax noprefix
	.text
	.globl	galtonBoard
	.type	galtonBoard, @function
galtonBoard:
.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, 16
	mov	DWORD PTR -8[rbp], 0
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L3:
	call	rand@PLT
	cdq
	shr	edx, 31
	add	eax, edx
	and	eax, 1
	sub	eax, edx
	add	DWORD PTR -8[rbp], eax
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 18
	jle	.L3
	mov	eax, DWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	galtonBoard, .-galtonBoard
	.globl	array
	.bss
	.align 32
	.type	array, @object
	.size	array, 80
array:
	.zero	80
	.globl	mutex_array
	.align 32
	.type	mutex_array, @object
	.size	mutex_array, 800
mutex_array:
	.zero	800
	.section	.rodata
.LC0:
	.string	"Cell:  Value\n------------"
.LC1:
	.string	"   %i:  %i\n"
.LC2:
	.string	"  %i:  %i\n"
	.text
	.globl	print_cells
	.type	print_cells, @function
print_cells:
.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, 16
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	DWORD PTR -4[rbp], 0
	jmp	.L6
.L9:
	cmp	DWORD PTR -4[rbp], 9
	jg	.L7
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, array[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L8
.L7:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, array[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
.L8:
	add	DWORD PTR -4[rbp], 1
.L6:
	cmp	DWORD PTR -4[rbp], 19
	jle	.L9
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	print_cells, .-print_cells
	.globl	sumOfCells
	.type	sumOfCells, @function
sumOfCells:
.LFB8:
	.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 -8[rbp], 0
	mov	DWORD PTR -4[rbp], 0
	jmp	.L11
.L12:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, array[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	DWORD PTR -8[rbp], eax
	add	DWORD PTR -4[rbp], 1
.L11:
	cmp	DWORD PTR -4[rbp], 19
	jle	.L12
	mov	eax, DWORD PTR -8[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sumOfCells, .-sumOfCells
	.section	.rodata
	.align 8
.LC3:
	.string	"Successfully created threads: %i\n"
	.align 8
.LC4:
	.string	"Sum of values in the cell: %i\n\n\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	sub	rsp, 120
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -140[rbp], 0
	jmp	.L15
.L16:
	mov	eax, DWORD PTR -140[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, mutex_array[rip]
	add	rax, rdx
	mov	esi, 0
	mov	rdi, rax
	call	pthread_mutex_init@PLT
	add	DWORD PTR -140[rbp], 1
.L15:
	cmp	DWORD PTR -140[rbp], 19
	jle	.L16
	mov	DWORD PTR -136[rbp], 1000000
	mov	eax, DWORD PTR -136[rbp]
	mov	rdx, rsp
	mov	rbx, rdx
	movsx	rdx, eax
	sub	rdx, 1
	mov	QWORD PTR -128[rbp], rdx
	movsx	rdx, eax
	mov	r14, rdx
	mov	r15d, 0
	movsx	rdx, eax
	mov	r12, rdx
	mov	r13d, 0
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	eax, 16
	sub	rax, 1
	add	rax, rdx
	mov	esi, 16
	mov	edx, 0
	div	rsi
	imul	rax, rax, 16
	mov	rcx, rax
	and	rcx, -4096
	mov	rdx, rsp
	sub	rdx, rcx
.L17:
	cmp	rsp, rdx
	je	.L18
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	jmp	.L17
.L18:
	mov	rdx, rax
	and	edx, 4095
	sub	rsp, rdx
	mov	rdx, rax
	and	edx, 4095
	test	rdx, rdx
	je	.L19
	and	eax, 4095
	sub	rax, 8
	add	rax, rsp
	or	QWORD PTR [rax], 0
.L19:
	mov	rax, rsp
	add	rax, 7
	shr	rax, 3
	sal	rax, 3
	mov	QWORD PTR -120[rbp], rax
	lea	rax, -112[rbp]
	mov	rdi, rax
	call	pthread_attr_init@PLT
	mov	DWORD PTR -144[rbp], 0
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	DWORD PTR -148[rbp], 0
	jmp	.L20
.L22:
	mov	eax, DWORD PTR -148[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -120[rbp]
	lea	rdi, [rdx+rax]
	lea	rax, -112[rbp]
	mov	ecx, 0
	lea	rdx, cell[rip]
	mov	rsi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -132[rbp], eax
	cmp	DWORD PTR -132[rbp], 0
	jne	.L21
	add	DWORD PTR -144[rbp], 1
.L21:
	add	DWORD PTR -148[rbp], 1
.L20:
	mov	eax, DWORD PTR -148[rbp]
	cmp	eax, DWORD PTR -136[rbp]
	jl	.L22
	mov	DWORD PTR -152[rbp], 0
	jmp	.L23
.L24:
	mov	rax, QWORD PTR -120[rbp]
	mov	edx, DWORD PTR -152[rbp]
	movsx	rdx, edx
	mov	rax, QWORD PTR [rax+rdx*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -152[rbp], 1
.L23:
	mov	eax, DWORD PTR -152[rbp]
	cmp	eax, DWORD PTR -144[rbp]
	jl	.L24
	mov	eax, 0
	call	print_cells
	mov	eax, DWORD PTR -144[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	sumOfCells
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rsp, rbx
	mov	rbx, QWORD PTR -56[rbp]
	sub	rbx, QWORD PTR fs:40
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	main, .-main
	.globl	cell
	.type	cell, @function
cell:
.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	eax, 0
	call	galtonBoard
	mov	DWORD PTR -4[rbp], eax
	nop
.L28:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, mutex_array[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_trylock@PLT
	test	eax, eax
	jne	.L28
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, array[rip]
	mov	eax, DWORD PTR [rdx+rax]
	lea	ecx, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, array[rip]
	mov	DWORD PTR [rdx+rax], ecx
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	lea	rdx, mutex_array[rip]
	add	rax, rdx
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	cell, .-cell
	.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	"23576048.c"
	.text
	.align	2
	.global	galtonBoard
	.syntax unified
	.arm
	.fpu softvfp
	.type	galtonBoard, %function
galtonBoard:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r3, #0
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L3:
	bl	rand
	mov	r3, r0
	cmp	r3, #0
	and	r3, r3, #1
	rsblt	r3, r3, #0
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #18
	ble	.L3
	ldr	r3, [fp, #-12]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	galtonBoard, .-galtonBoard
	.global	array
	.bss
	.align	2
	.type	array, %object
	.size	array, 80
array:
	.space	80
	.comm	mutex_array,480,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Cell:  Value\012------------\000"
	.align	2
.LC1:
	.ascii	"   %i:  %i\012\000"
	.align	2
.LC2:
	.ascii	"  %i:  %i\012\000"
	.text
	.align	2
	.global	print_cells
	.syntax unified
	.arm
	.fpu softvfp
	.type	print_cells, %function
print_cells:
	@ 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, .L10
	bl	puts
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L6
.L9:
	ldr	r3, [fp, #-8]
	cmp	r3, #9
	bgt	.L7
	ldr	r2, .L10+4
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L10+8
	bl	printf
	b	.L8
.L7:
	ldr	r2, .L10+4
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L10+12
	bl	printf
.L8:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L6:
	ldr	r3, [fp, #-8]
	cmp	r3, #19
	ble	.L9
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC0
	.word	array
	.word	.LC1
	.word	.LC2
	.size	print_cells, .-print_cells
	.align	2
	.global	sumOfCells
	.syntax unified
	.arm
	.fpu softvfp
	.type	sumOfCells, %function
sumOfCells:
	@ 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
	mov	r3, #0
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L13
.L14:
	ldr	r2, .L16
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L13:
	ldr	r3, [fp, #-8]
	cmp	r3, #19
	ble	.L14
	ldr	r3, [fp, #-12]
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L17:
	.align	2
.L16:
	.word	array
	.size	sumOfCells, .-sumOfCells
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Successfully created threads: %i\012\000"
	.align	2
.LC4:
	.ascii	"Sum of values in the cell: %i\012\012\012\000"
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 72
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #76
	ldr	r3, .L28
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L19
.L20:
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L28+4
	add	r3, r3, r2
	mov	r1, #0
	mov	r0, r3
	bl	pthread_mutex_init
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
.L19:
	ldr	r3, [fp, #-72]
	cmp	r3, #19
	ble	.L20
	ldr	r3, .L28+8
	str	r3, [fp, #-68]
	ldr	ip, [fp, #-68]
	mov	r3, sp
	mov	r4, r3
	sub	r3, ip, #1
	str	r3, [fp, #-64]
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r3, #7
	lsr	r3, r3, #3
	lsl	r3, r3, #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #3
	lsr	r3, r3, #2
	lsl	r3, r3, #2
	str	r3, [fp, #-60]
	sub	r3, fp, #52
	mov	r0, r3
	bl	pthread_attr_init
	mov	r3, #0
	str	r3, [fp, #-76]
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r3, #0
	str	r3, [fp, #-80]
	b	.L21
.L23:
	ldr	r3, [fp, #-80]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-60]
	add	r0, r2, r3
	sub	r1, fp, #52
	mov	r3, #0
	ldr	r2, .L28+12
	bl	pthread_create
	str	r0, [fp, #-56]
	ldr	r3, [fp, #-56]
	cmp	r3, #0
	bne	.L22
	ldr	r3, [fp, #-76]
	add	r3, r3, #1
	str	r3, [fp, #-76]
.L22:
	ldr	r3, [fp, #-80]
	add	r3, r3, #1
	str	r3, [fp, #-80]
.L21:
	ldr	r2, [fp, #-80]
	ldr	r3, [fp, #-68]
	cmp	r2, r3
	blt	.L23
	mov	r3, #0
	str	r3, [fp, #-84]
	b	.L24
.L25:
	ldr	r3, [fp, #-60]
	ldr	r2, [fp, #-84]
	ldr	r3, [r3, r2, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-84]
	add	r3, r3, #1
	str	r3, [fp, #-84]
.L24:
	ldr	r2, [fp, #-84]
	ldr	r3, [fp, #-76]
	cmp	r2, r3
	blt	.L25
	bl	print_cells
	ldr	r1, [fp, #-76]
	ldr	r0, .L28+16
	bl	printf
	bl	sumOfCells
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L28+20
	bl	printf
	mov	r3, #0
	mov	sp, r4
	ldr	r2, .L28
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L27
	bl	__stack_chk_fail
.L27:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L29:
	.align	2
.L28:
	.word	.LC5
	.word	mutex_array
	.word	1000000
	.word	cell
	.word	.LC3
	.word	.LC4
	.size	main, .-main
	.align	2
	.global	cell
	.syntax unified
	.arm
	.fpu softvfp
	.type	cell, %function
cell:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	bl	galtonBoard
	str	r0, [fp, #-8]
	nop
.L31:
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L32
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_trylock
	mov	r3, r0
	cmp	r3, #0
	bne	.L31
	ldr	r2, .L32+4
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #2]
	add	r2, r3, #1
	ldr	r1, .L32+4
	ldr	r3, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, .L32
	add	r3, r3, r2
	mov	r0, r3
	bl	pthread_mutex_unlock
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L33:
	.align	2
.L32:
	.word	mutex_array
	.word	array
	.size	cell, .-cell
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
