// File: /workspace/github_c_makefile_star2_O1/KhuramAli[P]JAM-Benchmark/Summation_lock_free_cppThread/code12.cpp
// Function: main
int main() {

	std::cout << std::endl;

	std::vector<int> randValues;
	randValues.reserve(size);

	std::mt19937 engine;
	std::uniform_int_distribution<> uniformDist(1, 10);
	for (long long i = 0; i < size; ++i) randValues.push_back(uniformDist(engine));

	std::atomic<unsigned long long> sum(0);
	auto start = std::chrono::system_clock::now();

	std::thread t1(sumUp, std::ref(sum), std::ref(randValues), 0, firBound);
	std::thread t2(sumUp, std::ref(sum), std::ref(randValues), firBound, secBound);
	std::thread t3(sumUp, std::ref(sum), std::ref(randValues), secBound, thiBound);
	std::thread t4(sumUp, std::ref(sum), std::ref(randValues), thiBound, fouBound);


	t1.join();
	t2.join();
	t3.join();
	t4.join();
	std::chrono::duration<double> dur = std::chrono::system_clock::now() - start;
	std::cout << "Time for addition " << dur.count() << " seconds" << std::endl;
	std::cout << "Result: " << sum << std::endl;

	std::cout << std::endl;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x13f0, %rsp           # imm = 0x13F0
movq 0x2cfc(%rip), %rbx      # 0x3fd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movapd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x5f5e100, %esi        # imm = 0x5F5E100
callq 0x1652
movq $0x1571, 0x68(%rsp)     # imm = 0x1571
movl $0x1, %eax
movl $0x1571, %ecx           # imm = 0x1571
movq %rcx, %rdx
shrq $0x1e, %rdx
xorl %ecx, %edx
imull $0x6c078965, %edx, %ecx # imm = 0x6C078965
addl %eax, %ecx
movq %rcx, 0x68(%rsp,%rax,8)
incq %rax
cmpq $0x270, %rax            # imm = 0x270
jne 0x1335
leaq 0x68(%rsp), %rbx
movq $0x270, 0x1380(%rbx) # imm = 0x270
movabsq $0xa00000001, %rax      # imm = 0xA00000001
leaq 0x60(%rsp), %r12
movq %rax, (%r12)
movl $0x5f5e100, %r13d       # imm = 0x5F5E100
leaq 0x30(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r12, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x185e
movl %eax, 0x28(%rsp)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x13b4
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x13bf
movq %r14, %rdi
movq %r15, %rdx
callq 0x1ab8
decq %r13
jne 0x1389
movq $0x0, 0x28(%rsp)
callq 0x1040
movq %rax, %rbx
leaq 0x18(%rsp), %rdx
movq %r15, (%rdx)
leaq 0x10(%rsp), %rcx
movq %r14, (%rcx)
leaq 0x8(%rsp), %r8
movl $0x0, (%r8)
leaq -0x14c(%rip), %rsi      # 0x12ac
leaq 0xc41(%rip), %r9        # 0x2040
leaq 0x20(%rsp), %rdi
callq 0x16e0
leaq 0x10(%rsp), %rdx
movq %r15, (%rdx)
leaq 0x8(%rsp), %rcx
movq %r14, (%rcx)
leaq -0x174(%rip), %rsi      # 0x12ac
leaq 0xc19(%rip), %r8        # 0x2040
leaq 0xc1a(%rip), %r9        # 0x2048
leaq 0x18(%rsp), %rdi
callq 0x1790
leaq 0x8(%rsp), %rdx
movq %r15, (%rdx)
leaq 0x50(%rsp), %rcx
movq %r14, (%rcx)
leaq -0x1a3(%rip), %rsi      # 0x12ac
leaq 0xbf2(%rip), %r8        # 0x2048
leaq 0xbf3(%rip), %r9        # 0x2050
leaq 0x10(%rsp), %rdi
callq 0x1790
leaq 0x50(%rsp), %rdx
movq %r15, (%rdx)
leaq 0x58(%rsp), %rcx
movq %r14, (%rcx)
leaq -0x1d2(%rip), %rsi      # 0x12ac
leaq 0xbcb(%rip), %r8        # 0x2050
leaq 0xbcc(%rip), %r9        # 0x2058
leaq 0x8(%rsp), %rdi
callq 0x1790
leaq 0x20(%rsp), %rdi
callq 0x1150
leaq 0x18(%rsp), %rdi
callq 0x1150
leaq 0x10(%rsp), %rdi
callq 0x1150
leaq 0x8(%rsp), %rdi
callq 0x1150
callq 0x1040
movq %rax, %r14
movq 0x2b0b(%rip), %rdi      # 0x3fd8
leaq 0xb8c(%rip), %rsi       # 0x2060
movl $0x12, %edx
callq 0x1110
subq %rbx, %r14
cvtsi2sd %r14, %xmm0
divsd 0xb1a(%rip), %xmm0      # 0x2008
movq 0x2ae3(%rip), %rdi      # 0x3fd8
callq 0x1130
movq %rax, %rbx
leaq 0xb6f(%rip), %rsi       # 0x2073
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x2a99(%rip), %rdi      # 0x3fd8
leaq 0xb36(%rip), %rsi       # 0x207c
movl $0x8, %edx
callq 0x1110
movq 0x28(%rsp), %rsi
movq 0x2a7c(%rip), %rbx      # 0x3fd8
movq %rbx, %rdi
callq 0x1090
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq 0x2a2c(%rip), %rdi      # 0x3fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
cmpq $0x0, 0x8(%rsp)
jne 0x1633
cmpq $0x0, 0x10(%rsp)
jne 0x1633
cmpq $0x0, 0x18(%rsp)
jne 0x1633
cmpq $0x0, 0x20(%rsp)
jne 0x1633
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x15e8
callq 0x10e0
xorl %eax, %eax
addq $0x13f0, %rsp           # imm = 0x13F0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0x161b
movq %rax, %rbx
jmp 0x1623
movq %rax, %rbx
jmp 0x162b
jmp 0x1638
jmp 0x1638
jmp 0x1610
movq %rax, %rbx
cmpq $0x0, 0x8(%rsp)
jne 0x1633
cmpq $0x0, 0x10(%rsp)
jne 0x1633
cmpq $0x0, 0x18(%rsp)
jne 0x1633
cmpq $0x0, 0x20(%rsp)
je 0x163b
callq 0x1050
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x164a
callq 0x10e0
movq %rbx, %rdi
callq 0x1160