	.file	"200216.c"
	.intel_syntax noprefix
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 200000000
v:
	.zero	200000000
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	an_list
	.align 32
	.type	an_list, @object
	.size	an_list, 400000000
an_list:
	.zero	400000000
	.globl	tid
	.align 32
	.type	tid, @object
	.size	tid, 400000000
tid:
	.zero	400000000
	.globl	tid2
	.align 32
	.type	tid2, @object
	.size	tid2, 400000000
tid2:
	.zero	400000000
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB6:
	.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 -8[rbp], rdi
	mov	QWORD PTR -16[rbp], rsi
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	ecx, DWORD PTR [rax]
	mov	eax, edx
	sub	eax, ecx
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	min
	.type	min, @function
min:
.LFB7:
	.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	DWORD PTR -8[rbp], eax
	cmovle	eax, DWORD PTR -8[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min, .-min
	.globl	_ceil
	.type	_ceil, @function
_ceil:
.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 -4[rbp], edi
	mov	DWORD PTR -8[rbp], esi
	mov	eax, DWORD PTR -4[rbp]
	cdq
	idiv	DWORD PTR -8[rbp]
	mov	eax, edx
	test	eax, eax
	jne	.L6
	mov	eax, DWORD PTR -4[rbp]
	cdq
	idiv	DWORD PTR -8[rbp]
	jmp	.L7
.L6:
	mov	eax, DWORD PTR -4[rbp]
	cdq
	idiv	DWORD PTR -8[rbp]
	add	eax, 1
.L7:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	_ceil, .-_ceil
	.section	.rodata
.LC0:
	.string	"Handling elements:"
.LC1:
	.string	"\n"
.LC2:
	.string	" "
.LC3:
	.string	"%d%s"
.LC4:
	.string	"Sorted %d elements.\n"
	.text
	.globl	sort
	.type	sort, @function
sort:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -40[rbp]
	mov	DWORD PTR -16[rbp], eax
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -12[rbp], eax
	mov	DWORD PTR -20[rbp], 0
	jmp	.L9
.L12:
	mov	eax, DWORD PTR -20[rbp]
	add	eax, 1
	cmp	DWORD PTR -12[rbp], eax
	jne	.L10
	lea	rax, .LC1[rip]
	jmp	.L11
.L10:
	lea	rax, .LC2[rip]
.L11:
	mov	edx, DWORD PTR -20[rbp]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*4]
	mov	rdx, QWORD PTR -8[rbp]
	add	rdx, rcx
	mov	ecx, DWORD PTR [rdx]
	mov	rdx, rax
	mov	esi, ecx
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -20[rbp], 1
.L9:
	mov	eax, DWORD PTR -20[rbp]
	cmp	eax, DWORD PTR -12[rbp]
	jl	.L12
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -12[rbp]
	movsx	rsi, eax
	mov	rax, QWORD PTR -8[rbp]
	lea	rcx, cmp[rip]
	mov	edx, 4
	mov	rdi, rax
	call	qsort@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sort, .-sort
	.section	.rodata
	.align 8
.LC5:
	.string	"Merged %d and %d elements with %d duplicates.\n"
	.text
	.globl	merge
	.type	merge, @function
merge:
.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, 80
	mov	QWORD PTR -72[rbp], rdi
	mov	rax, QWORD PTR -72[rbp]
	mov	DWORD PTR -32[rbp], eax
	mov	eax, DWORD PTR step[rip]
	mov	edx, eax
	shr	edx, 31
	add	eax, edx
	sar	eax
	mov	edx, eax
	mov	eax, DWORD PTR -32[rbp]
	add	eax, edx
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -24[rbp], eax
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -20[rbp], eax
	mov	edx, DWORD PTR -24[rbp]
	mov	eax, DWORD PTR -20[rbp]
	add	eax, edx
	mov	DWORD PTR -16[rbp], eax
	mov	DWORD PTR -56[rbp], 0
	mov	DWORD PTR -52[rbp], 0
	mov	DWORD PTR -48[rbp], 0
	mov	DWORD PTR -44[rbp], 0
	mov	eax, DWORD PTR -16[rbp]
	cdqe
	sal	rax, 2
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	jmp	.L15
.L18:
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rdx, QWORD PTR [rax]
	mov	eax, DWORD PTR -48[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	edx, DWORD PTR [rax]
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rcx+rax]
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -44[rbp]
	cdqe
	sal	rax, 2
	add	rax, rcx
	mov	ecx, DWORD PTR [rax]
	mov	eax, edx
	sub	eax, ecx
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], 0
	jg	.L16
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -48[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -48[rbp], edx
	cdqe
	sal	rax, 2
	add	rcx, rax
	mov	eax, DWORD PTR -52[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -52[rbp], edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR [rcx]
	mov	DWORD PTR [rdx], eax
	cmp	DWORD PTR -12[rbp], 0
	jne	.L15
	add	DWORD PTR -56[rbp], 1
	jmp	.L15
.L16:
	cmp	DWORD PTR -12[rbp], 0
	jle	.L15
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -44[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -44[rbp], edx
	cdqe
	sal	rax, 2
	add	rcx, rax
	mov	eax, DWORD PTR -52[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -52[rbp], edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR [rcx]
	mov	DWORD PTR [rdx], eax
.L15:
	mov	eax, DWORD PTR -52[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	jge	.L19
	mov	eax, DWORD PTR -48[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jge	.L19
	mov	eax, DWORD PTR -44[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jl	.L18
	jmp	.L19
.L20:
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -48[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -48[rbp], edx
	cdqe
	sal	rax, 2
	add	rcx, rax
	mov	eax, DWORD PTR -52[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -52[rbp], edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR [rcx]
	mov	DWORD PTR [rdx], eax
.L19:
	mov	eax, DWORD PTR -48[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jl	.L20
	jmp	.L21
.L22:
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -44[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -44[rbp], edx
	cdqe
	sal	rax, 2
	add	rcx, rax
	mov	eax, DWORD PTR -52[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -52[rbp], edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR [rcx]
	mov	DWORD PTR [rdx], eax
.L21:
	mov	eax, DWORD PTR -44[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jl	.L22
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	DWORD PTR -40[rbp], 0
	jmp	.L23
.L26:
	mov	eax, DWORD PTR -40[rbp]
	add	eax, 1
	cmp	DWORD PTR -16[rbp], eax
	jne	.L24
	lea	rax, .LC1[rip]
	jmp	.L25
.L24:
	lea	rax, .LC2[rip]
.L25:
	mov	edx, DWORD PTR -32[rbp]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*8]
	lea	rdx, an_list[rip]
	mov	rdx, QWORD PTR [rcx+rdx]
	mov	rcx, QWORD PTR [rdx]
	mov	edx, DWORD PTR -40[rbp]
	movsx	rdx, edx
	sal	rdx, 2
	add	rdx, rcx
	mov	ecx, DWORD PTR [rdx]
	mov	rdx, rax
	mov	esi, ecx
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -40[rbp], 1
.L23:
	mov	eax, DWORD PTR -40[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	jl	.L26
	mov	ecx, DWORD PTR -56[rbp]
	mov	edx, DWORD PTR -20[rbp]
	mov	eax, DWORD PTR -24[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -16[rbp]
	mov	DWORD PTR 8[rax], edx
	mov	DWORD PTR -36[rbp], 0
	jmp	.L27
.L28:
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	lea	rcx, [rdx+rax]
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rdx, QWORD PTR [rax]
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	eax, DWORD PTR [rcx]
	mov	DWORD PTR [rdx], eax
	add	DWORD PTR -36[rbp], 1
.L27:
	mov	eax, DWORD PTR -36[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	jl	.L28
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	merge, .-merge
	.section	.rodata
	.align 8
.LC6:
	.string	"Usage: ./merger [segment_size]"
.LC7:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 72
	.cfi_offset 3, -24
	mov	DWORD PTR -68[rbp], edi
	mov	QWORD PTR -80[rbp], rsi
	cmp	DWORD PTR -68[rbp], 2
	je	.L31
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L32
.L31:
	mov	rax, QWORD PTR -80[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -28[rbp], eax
	lea	rsi, n[rip]
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -64[rbp], 0
	jmp	.L33
.L34:
	mov	eax, DWORD PTR -64[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, v[rip]
	add	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	add	DWORD PTR -64[rbp], 1
.L33:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -64[rbp], eax
	jl	.L34
	mov	eax, DWORD PTR n[rip]
	mov	edx, DWORD PTR -28[rbp]
	mov	esi, edx
	mov	edi, eax
	call	_ceil
	mov	DWORD PTR -24[rbp], eax
	mov	DWORD PTR -60[rbp], 0
	jmp	.L35
.L36:
	mov	edi, 16
	call	malloc@PLT
	mov	rcx, rax
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	QWORD PTR [rdx+rax], rcx
	mov	eax, DWORD PTR -60[rbp]
	imul	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	lea	rdx, v[rip]
	add	rdx, rcx
	mov	QWORD PTR [rax], rdx
	mov	edx, DWORD PTR n[rip]
	mov	eax, DWORD PTR -60[rbp]
	imul	eax, DWORD PTR -28[rbp]
	sub	edx, eax
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rbx, QWORD PTR [rcx+rax]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, edx
	mov	edi, eax
	call	min
	mov	DWORD PTR 8[rbx], eax
	add	DWORD PTR -60[rbp], 1
.L35:
	mov	eax, DWORD PTR -60[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jl	.L36
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -56[rbp], 0
	jmp	.L37
.L38:
	mov	eax, DWORD PTR -56[rbp]
	cdqe
	mov	rdx, rax
	mov	eax, DWORD PTR -56[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, tid[rip]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, sort[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -56[rbp], 1
.L37:
	mov	eax, DWORD PTR -56[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jl	.L38
	mov	DWORD PTR -52[rbp], 0
	jmp	.L39
.L40:
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, tid[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -52[rbp], 1
.L39:
	mov	eax, DWORD PTR -52[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jl	.L40
	mov	DWORD PTR step[rip], 2
	mov	eax, DWORD PTR -24[rbp]
	mov	DWORD PTR -48[rbp], eax
	jmp	.L41
.L46:
	mov	eax, DWORD PTR -48[rbp]
	mov	edx, eax
	shr	edx, 31
	add	eax, edx
	sar	eax
	mov	DWORD PTR -20[rbp], eax
	mov	DWORD PTR -44[rbp], 0
	jmp	.L42
.L43:
	mov	eax, DWORD PTR step[rip]
	imul	eax, DWORD PTR -44[rbp]
	cdqe
	mov	rdx, rax
	mov	eax, DWORD PTR -44[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, tid2[rip]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, merge[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -44[rbp], 1
.L42:
	mov	eax, DWORD PTR -44[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jl	.L43
	mov	DWORD PTR -40[rbp], 0
	jmp	.L44
.L45:
	mov	eax, DWORD PTR -40[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, tid2[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -40[rbp], 1
.L44:
	mov	eax, DWORD PTR -40[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jl	.L45
	mov	eax, DWORD PTR -20[rbp]
	sub	DWORD PTR -48[rbp], eax
	mov	eax, DWORD PTR step[rip]
	add	eax, eax
	mov	DWORD PTR step[rip], eax
.L41:
	cmp	DWORD PTR -48[rbp], 1
	jg	.L46
	mov	DWORD PTR -36[rbp], 0
	jmp	.L47
.L50:
	mov	eax, DWORD PTR -36[rbp]
	lea	edx, 1[rax]
	mov	eax, DWORD PTR n[rip]
	cmp	edx, eax
	jne	.L48
	lea	rax, .LC1[rip]
	jmp	.L49
.L48:
	lea	rax, .LC2[rip]
.L49:
	mov	edx, DWORD PTR -36[rbp]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*4]
	lea	rdx, v[rip]
	mov	ecx, DWORD PTR [rcx+rdx]
	mov	rdx, rax
	mov	esi, ecx
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -36[rbp], 1
.L47:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -36[rbp], eax
	jl	.L50
	mov	DWORD PTR -32[rbp], 0
	jmp	.L51
.L52:
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, an_list[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rdi, rax
	call	free@PLT
	add	DWORD PTR -32[rbp], 1
.L51:
	mov	eax, DWORD PTR -32[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jl	.L52
	lea	rdi, mutex[rip]
	call	pthread_mutex_destroy@PLT
	mov	eax, 0
.L32:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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	"200216.c"
	.text
	.comm	n,4,4
	.comm	v,200000000,4
	.comm	step,4,4
	.comm	an_list,200000000,4
	.comm	tid,200000000,4
	.comm	tid2,200000000,4
	.comm	mutex,24,4
	.align	2
	.global	cmp
	.syntax unified
	.arm
	.fpu softvfp
	.type	cmp, %function
cmp:
	@ 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	r3, [fp, #-8]
	ldr	r2, [r3]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	sub	r3, r2, r3
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	cmp, .-cmp
	.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, #-12]
	ldr	r3, [fp, #-8]
	cmp	r2, r3
	movlt	r3, r2
	movge	r3, r3
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	min, .-min
	.global	__aeabi_idivmod
	.global	__aeabi_idiv
	.align	2
	.global	_ceil
	.syntax unified
	.arm
	.fpu softvfp
	.type	_ceil, %function
_ceil:
	@ 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]
	str	r1, [fp, #-12]
	ldr	r3, [fp, #-8]
	ldr	r1, [fp, #-12]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	cmp	r3, #0
	bne	.L6
	ldr	r1, [fp, #-12]
	ldr	r0, [fp, #-8]
	bl	__aeabi_idiv
	mov	r3, r0
	b	.L7
.L6:
	ldr	r1, [fp, #-12]
	ldr	r0, [fp, #-8]
	bl	__aeabi_idiv
	mov	r3, r0
	add	r3, r3, #1
.L7:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	_ceil, .-_ceil
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Handling elements:\000"
	.align	2
.LC1:
	.ascii	"\012\000"
	.align	2
.LC2:
	.ascii	" \000"
	.align	2
.LC3:
	.ascii	"%d%s\000"
	.align	2
.LC4:
	.ascii	"Sorted %d elements.\012\000"
	.text
	.align	2
	.global	sort
	.syntax unified
	.arm
	.fpu softvfp
	.type	sort, %function
sort:
	@ 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	r0, .L14
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-16]
	ldr	r0, .L14+4
	bl	puts
	ldr	r2, .L14+8
	ldr	r3, [fp, #-16]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	ldr	r2, .L14+8
	ldr	r3, [fp, #-16]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-8]
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L9
.L12:
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	ldr	r1, [r3]
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bne	.L10
	ldr	r3, .L14+12
	b	.L11
.L10:
	ldr	r3, .L14+16
.L11:
	mov	r2, r3
	ldr	r0, .L14+20
	bl	printf
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L9:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-8]
	cmp	r2, r3
	blt	.L12
	ldr	r1, [fp, #-8]
	ldr	r0, .L14+24
	bl	printf
	ldr	r0, .L14
	bl	pthread_mutex_unlock
	ldr	r1, [fp, #-8]
	ldr	r3, .L14+28
	mov	r2, #4
	ldr	r0, [fp, #-12]
	bl	qsort
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L15:
	.align	2
.L14:
	.word	mutex
	.word	.LC0
	.word	an_list
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	cmp
	.size	sort, .-sort
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Merged %d and %d elements with %d duplicates.\012\000"
	.text
	.align	2
	.global	merge
	.syntax unified
	.arm
	.fpu softvfp
	.type	merge, %function
merge:
	@ args = 0, pretend = 0, frame = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #64
	str	r0, [fp, #-64]
	ldr	r3, [fp, #-64]
	str	r3, [fp, #-32]
	ldr	r3, .L32
	ldr	r3, [r3]
	lsr	r2, r3, #31
	add	r3, r2, r3
	asr	r3, r3, #1
	mov	r2, r3
	ldr	r3, [fp, #-32]
	add	r3, r3, r2
	str	r3, [fp, #-28]
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-24]
	ldr	r2, .L32+4
	ldr	r3, [fp, #-28]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-20]
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-20]
	add	r3, r2, r3
	str	r3, [fp, #-16]
	mov	r3, #0
	str	r3, [fp, #-56]
	mov	r3, #0
	str	r3, [fp, #-52]
	mov	r3, #0
	str	r3, [fp, #-48]
	mov	r3, #0
	str	r3, [fp, #-44]
	ldr	r3, [fp, #-16]
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-12]
	b	.L17
.L20:
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-48]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, [r3]
	ldr	r1, .L32+4
	ldr	r3, [fp, #-28]
	ldr	r3, [r1, r3, lsl #2]
	ldr	r1, [r3]
	ldr	r3, [fp, #-44]
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r3, [r3]
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bgt	.L18
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-48]
	add	r1, r3, #1
	str	r1, [fp, #-48]
	lsl	r3, r3, #2
	add	r2, r2, r3
	ldr	r3, [fp, #-52]
	add	r1, r3, #1
	str	r1, [fp, #-52]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-12]
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L17
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
	b	.L17
.L18:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	ble	.L17
	ldr	r2, .L32+4
	ldr	r3, [fp, #-28]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-44]
	add	r1, r3, #1
	str	r1, [fp, #-44]
	lsl	r3, r3, #2
	add	r2, r2, r3
	ldr	r3, [fp, #-52]
	add	r1, r3, #1
	str	r1, [fp, #-52]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-12]
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
.L17:
	ldr	r2, [fp, #-52]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bge	.L21
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	bge	.L21
	ldr	r2, [fp, #-44]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L20
	b	.L21
.L22:
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-48]
	add	r1, r3, #1
	str	r1, [fp, #-48]
	lsl	r3, r3, #2
	add	r2, r2, r3
	ldr	r3, [fp, #-52]
	add	r1, r3, #1
	str	r1, [fp, #-52]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-12]
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
.L21:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	blt	.L22
	b	.L23
.L24:
	ldr	r2, .L32+4
	ldr	r3, [fp, #-28]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-44]
	add	r1, r3, #1
	str	r1, [fp, #-44]
	lsl	r3, r3, #2
	add	r2, r2, r3
	ldr	r3, [fp, #-52]
	add	r1, r3, #1
	str	r1, [fp, #-52]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-12]
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
.L23:
	ldr	r2, [fp, #-44]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L24
	ldr	r0, .L32+8
	bl	pthread_mutex_lock
	ldr	r0, .L32+12
	bl	puts
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L25
.L28:
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r1, [r3]
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L26
	ldr	r3, .L32+16
	b	.L27
.L26:
	ldr	r3, .L32+20
.L27:
	mov	r2, r3
	ldr	r0, .L32+24
	bl	printf
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L25:
	ldr	r2, [fp, #-40]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	blt	.L28
	ldr	r3, [fp, #-56]
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-24]
	ldr	r0, .L32+28
	bl	printf
	ldr	r0, .L32+8
	bl	pthread_mutex_unlock
	ldr	r2, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #4]
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L29
.L30:
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-12]
	add	r2, r2, r3
	ldr	r1, .L32+4
	ldr	r3, [fp, #-32]
	ldr	r3, [r1, r3, lsl #2]
	ldr	r1, [r3]
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L29:
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	blt	.L30
	ldr	r0, [fp, #-12]
	bl	free
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L33:
	.align	2
.L32:
	.word	step
	.word	an_list
	.word	mutex
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC5
	.size	merge, .-merge
	.section	.rodata
	.align	2
.LC6:
	.ascii	"Usage: ./merger [segment_size]\000"
	.align	2
.LC7:
	.ascii	"%d\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #60
	str	r0, [fp, #-64]
	str	r1, [fp, #-68]
	ldr	r3, [fp, #-64]
	cmp	r3, #2
	beq	.L35
	ldr	r0, .L57
	bl	puts
	mvn	r3, #0
	b	.L36
.L35:
	ldr	r3, [fp, #-68]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-24]
	ldr	r1, .L57+4
	ldr	r0, .L57+8
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-60]
	b	.L37
.L38:
	ldr	r3, [fp, #-60]
	lsl	r3, r3, #2
	ldr	r2, .L57+12
	add	r3, r3, r2
	mov	r1, r3
	ldr	r0, .L57+8
	bl	__isoc99_scanf
	ldr	r3, [fp, #-60]
	add	r3, r3, #1
	str	r3, [fp, #-60]
.L37:
	ldr	r3, .L57+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-60]
	cmp	r2, r3
	blt	.L38
	ldr	r3, .L57+4
	ldr	r3, [r3]
	ldr	r1, [fp, #-24]
	mov	r0, r3
	bl	_ceil
	str	r0, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L39
.L40:
	mov	r0, #8
	bl	malloc
	mov	r3, r0
	mov	r1, r3
	ldr	r2, .L57+16
	ldr	r3, [fp, #-56]
	str	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-56]
	ldr	r2, [fp, #-24]
	mul	r3, r2, r3
	lsl	r2, r3, #2
	ldr	r1, .L57+16
	ldr	r3, [fp, #-56]
	ldr	r3, [r1, r3, lsl #2]
	ldr	r1, .L57+12
	add	r2, r2, r1
	str	r2, [r3]
	ldr	r3, .L57+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-24]
	mul	r3, r1, r3
	sub	r2, r2, r3
	ldr	r1, .L57+16
	ldr	r3, [fp, #-56]
	ldr	r4, [r1, r3, lsl #2]
	mov	r1, r2
	ldr	r0, [fp, #-24]
	bl	min
	mov	r3, r0
	str	r3, [r4, #4]
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L39:
	ldr	r2, [fp, #-56]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L40
	mov	r1, #0
	ldr	r0, .L57+20
	bl	pthread_mutex_init
	mov	r3, #0
	str	r3, [fp, #-52]
	b	.L41
.L42:
	ldr	r3, [fp, #-52]
	lsl	r3, r3, #2
	ldr	r2, .L57+24
	add	r0, r3, r2
	ldr	r3, [fp, #-52]
	ldr	r2, .L57+28
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-52]
	add	r3, r3, #1
	str	r3, [fp, #-52]
.L41:
	ldr	r2, [fp, #-52]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L42
	mov	r3, #0
	str	r3, [fp, #-48]
	b	.L43
.L44:
	ldr	r2, .L57+24
	ldr	r3, [fp, #-48]
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-48]
	add	r3, r3, #1
	str	r3, [fp, #-48]
.L43:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L44
	ldr	r3, .L57+32
	mov	r2, #2
	str	r2, [r3]
	ldr	r3, [fp, #-20]
	str	r3, [fp, #-44]
	b	.L45
.L50:
	ldr	r3, [fp, #-44]
	lsr	r2, r3, #31
	add	r3, r2, r3
	asr	r3, r3, #1
	str	r3, [fp, #-16]
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L46
.L47:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	ldr	r2, .L57+36
	add	r0, r3, r2
	ldr	r3, .L57+32
	ldr	r3, [r3]
	ldr	r2, [fp, #-40]
	mul	r3, r2, r3
	ldr	r2, .L57+40
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L46:
	ldr	r2, [fp, #-40]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	blt	.L47
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L48
.L49:
	ldr	r2, .L57+36
	ldr	r3, [fp, #-36]
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L48:
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	blt	.L49
	ldr	r2, [fp, #-44]
	ldr	r3, [fp, #-16]
	sub	r3, r2, r3
	str	r3, [fp, #-44]
	ldr	r3, .L57+32
	ldr	r3, [r3]
	lsl	r3, r3, #1
	ldr	r2, .L57+32
	str	r3, [r2]
.L45:
	ldr	r3, [fp, #-44]
	cmp	r3, #1
	bgt	.L50
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L51
.L54:
	ldr	r2, .L57+12
	ldr	r3, [fp, #-32]
	ldr	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-32]
	add	r2, r3, #1
	ldr	r3, .L57+4
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L52
	ldr	r3, .L57+44
	b	.L53
.L52:
	ldr	r3, .L57+48
.L53:
	mov	r2, r3
	ldr	r0, .L57+52
	bl	printf
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L51:
	ldr	r3, .L57+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-32]
	cmp	r2, r3
	blt	.L54
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L55
.L56:
	ldr	r2, .L57+16
	ldr	r3, [fp, #-28]
	ldr	r3, [r2, r3, lsl #2]
	mov	r0, r3
	bl	free
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L55:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L56
	ldr	r0, .L57+20
	bl	pthread_mutex_destroy
	mov	r3, #0
.L36:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L58:
	.align	2
.L57:
	.word	.LC6
	.word	n
	.word	.LC7
	.word	v
	.word	an_list
	.word	mutex
	.word	tid
	.word	sort
	.word	step
	.word	tid2
	.word	merge
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
