// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x14a8, %rsp           # imm = 0x14A8
movl $0x0, 0x14a4(%rsp)
movq 0x6cbf(%rip), %rdi      # 0x7fd8
movq 0x6ca0(%rip), %rsi      # 0x7fc0
callq 0x1100
leaq 0x1488(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x1820
movq 0x40(%rsp), %rdi
movl $0x5f5e100, %esi        # imm = 0x5F5E100
callq 0x1830
jmp 0x1348
leaq 0xf0(%rsp), %rdi
callq 0x1940
jmp 0x1357
leaq 0xe8(%rsp), %rdi
movl $0x1, %esi
movl $0xa, %edx
callq 0x1960
jmp 0x1370
movq $0x0, 0xe0(%rsp)
cmpq $0x5f5e100, 0xe0(%rsp) # imm = 0x5F5E100
jge 0x13f8
leaq 0xe8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x19c0
movl %eax, 0x3c(%rsp)
jmp 0x13a5
movl 0x3c(%rsp), %eax
movl %eax, 0xdc(%rsp)
leaq 0x1488(%rsp), %rdi
leaq 0xdc(%rsp), %rsi
callq 0x1990
jmp 0x13c7
jmp 0x13c9
movq 0xe0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xe0(%rsp)
jmp 0x137c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1480(%rsp)
movl %eax, 0x147c(%rsp)
jmp 0x179a
movq $0x0, 0xd0(%rsp)
callq 0x1030
movq %rax, 0xc8(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x19f0
movq %rax, 0xb8(%rsp)
leaq 0x1488(%rsp), %rdi
callq 0x1a20
movq %rax, 0xb0(%rsp)
movl $0x0, 0xac(%rsp)
leaq -0x1ad(%rip), %rsi      # 0x12a0
leaq 0x3bbc(%rip), %r9       # 0x5010
leaq 0xc0(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
leaq 0xb0(%rsp), %rcx
leaq 0xac(%rsp), %r8
callq 0x1a50
jmp 0x147b
leaq 0xd0(%rsp), %rdi
callq 0x19f0
movq %rax, 0x98(%rsp)
leaq 0x1488(%rsp), %rdi
callq 0x1a20
movq %rax, 0x90(%rsp)
leaq -0x20c(%rip), %rsi      # 0x12a0
leaq 0x3b5d(%rip), %r8       # 0x5010
leaq 0x3b5e(%rip), %r9       # 0x5018
leaq 0xa0(%rsp), %rdi
leaq 0x98(%rsp), %rdx
leaq 0x90(%rsp), %rcx
callq 0x1b40
jmp 0x14d9
leaq 0xd0(%rsp), %rdi
callq 0x19f0
movq %rax, 0x80(%rsp)
leaq 0x1488(%rsp), %rdi
callq 0x1a20
movq %rax, 0x78(%rsp)
leaq -0x267(%rip), %rsi      # 0x12a0
leaq 0x3b0a(%rip), %r8       # 0x5018
leaq 0x3b0b(%rip), %r9       # 0x5020
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rdx
leaq 0x78(%rsp), %rcx
callq 0x1b40
jmp 0x1531
leaq 0xd0(%rsp), %rdi
callq 0x19f0
movq %rax, 0x68(%rsp)
leaq 0x1488(%rsp), %rdi
callq 0x1a20
movq %rax, 0x60(%rsp)
leaq -0x2bc(%rip), %rsi      # 0x12a0
leaq 0x3abd(%rip), %r8       # 0x5020
leaq 0x3abe(%rip), %r9       # 0x5028
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x1b40
jmp 0x1580
leaq 0xc0(%rsp), %rdi
callq 0x1130
jmp 0x158f
leaq 0xa0(%rsp), %rdi
callq 0x1130
jmp 0x159e
leaq 0x88(%rsp), %rdi
callq 0x1130
jmp 0x15ad
leaq 0x70(%rsp), %rdi
callq 0x1130
jmp 0x15b9
callq 0x1030
movq %rax, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1c30
movq %rax, 0x30(%rsp)
jmp 0x15dc
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1c80
jmp 0x15f7
movq 0x69da(%rip), %rdi      # 0x7fd8
leaq 0x3a2b(%rip), %rsi      # 0x5030
callq 0x10e0
movq %rax, 0x28(%rsp)
jmp 0x1611
leaq 0x58(%rsp), %rdi
callq 0x1cc0
movsd %xmm0, 0x20(%rsp)
jmp 0x1623
movsd 0x20(%rsp), %xmm0
movq 0x28(%rsp), %rdi
callq 0x1150
movq %rax, 0x18(%rsp)
jmp 0x163a
movq 0x18(%rsp), %rdi
leaq 0x39fd(%rip), %rsi      # 0x5043
callq 0x10e0
movq %rax, 0x10(%rsp)
jmp 0x1652
movq 0x10(%rsp), %rdi
movq 0x6962(%rip), %rsi      # 0x7fc0
callq 0x1100
jmp 0x1665
movq 0x696c(%rip), %rdi      # 0x7fd8
leaq 0x39d9(%rip), %rsi      # 0x504c
callq 0x10e0
movq %rax, 0x8(%rsp)
jmp 0x167f
leaq 0xd0(%rsp), %rdi
callq 0x1cd0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x10c0
movq %rax, (%rsp)
jmp 0x169f
movq (%rsp), %rdi
movq 0x6916(%rip), %rsi      # 0x7fc0
callq 0x1100
jmp 0x16b1
movq 0x6920(%rip), %rdi      # 0x7fd8
movq 0x6901(%rip), %rsi      # 0x7fc0
callq 0x1100
jmp 0x16c6
leaq 0x70(%rsp), %rdi
callq 0x1d70
leaq 0x88(%rsp), %rdi
callq 0x1d70
leaq 0xa0(%rsp), %rdi
callq 0x1d70
leaq 0xc0(%rsp), %rdi
callq 0x1d70
leaq 0x1488(%rsp), %rdi
callq 0x1d90
movl 0x14a4(%rsp), %eax
addq $0x14a8, %rsp           # imm = 0x14A8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1480(%rsp)
movl %eax, 0x147c(%rsp)
jmp 0x178d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1480(%rsp)
movl %eax, 0x147c(%rsp)
jmp 0x1780
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1480(%rsp)
movl %eax, 0x147c(%rsp)
jmp 0x1773
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1480(%rsp)
movl %eax, 0x147c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x1d70
leaq 0x88(%rsp), %rdi
callq 0x1d70
leaq 0xa0(%rsp), %rdi
callq 0x1d70
leaq 0xc0(%rsp), %rdi
callq 0x1d70
leaq 0x1488(%rsp), %rdi
callq 0x1d90
movq 0x1480(%rsp), %rdi
callq 0x1140
nopw %cs:(%rax,%rax)
nop