// File: /workspace/github_cpp_makefile_star2_O1/sgielen[P]clife/multi_indep.cpp
// Function: main
int main(int argc, char *argv[]) {
	int microsleeptime = 100000;
	if(argc == 2) {
		std::stringstream ss;
		ss << argv[1];
		ss >> microsleeptime;
		if(!ss) {
			std::cerr << "Usage: " << argv[0] << " [microsleeptime]" << std::endl;
		}
	} else if(argc > 2) {
		std::cerr << "Usage: " << argv[0] << " [microsleeptime]" << std::endl;
	}

	init_random();

	std::vector<uint64_t> earlier_hashes;
	GameOfLifeField<SimpleValue<char(0x80), 0>> red(8, 80);
	GameOfLifeField<SimpleValue<char(0x80), 0>> green(8, 80);
	GameOfLifeField<SimpleValue<char(0x80), 0>> blue(8, 80);

	red.generateRandom(35);
	green.generateRandom(35);
	blue.generateRandom(35);

	bool red_done = false;
	bool green_done = false;
	bool blue_done = false;
	int repeats_to_do = 0;
	print_rgb(red, green, blue);
	while(!red_done || !green_done || !blue_done || repeats_to_do > 0) {
		if(repeats_to_do > 0) {
			--repeats_to_do;
		}
		red.nextState();
		green.nextState();
		blue.nextState();
		print_rgb(red, green, blue);
		if(!red_done || !green_done || !blue_done) {
			check_stop_condition(red, earlier_hashes, red_done, repeats_to_do);
			check_stop_condition(green, earlier_hashes, green_done, repeats_to_do);
			check_stop_condition(blue, earlier_hashes, blue_done, repeats_to_do);
		}
		usleep(microsleeptime);
		continue;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rsi, %rbx
movl $0x186a0, 0xc(%rsp)     # imm = 0x186A0
cmpl $0x2, %edi
jne 0x45b7
leaq 0x190(%rsp), %rdi
callq 0x20e0
leaq 0x1a0(%rsp), %r14
movq 0x8(%rbx), %r15
testq %r15, %r15
je 0x4603
movq %r15, %rdi
callq 0x2080
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x4624
jle 0x4763
movq 0x4a24(%rip), %r14      # 0x8fe8
leaq 0x1b75(%rip), %rsi      # 0x6140
movl $0x7, %edx
movq %r14, %rdi
callq 0x2180
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4710
movq %rbx, %rdi
callq 0x2080
movq 0x49f5(%rip), %rdi      # 0x8fe8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x4728
movq 0x1a0(%rsp), %rax
movq -0x18(%rax), %rax
addq %rax, %r14
movl 0x1c0(%rsp,%rax), %esi
orl $0x1, %esi
movq %r14, %rdi
callq 0x21f0
leaq 0x190(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x20c0
movq 0x190(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x1b0(%rsp,%rax)
je 0x46ed
movq 0x4991(%rip), %r14      # 0x8fe8
leaq 0x1ae2(%rip), %rsi      # 0x6140
movl $0x7, %edx
movq %r14, %rdi
callq 0x2180
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x468f
movq %rbx, %rdi
callq 0x2080
movq 0x4966(%rip), %rdi      # 0x8fe8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x46a7
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x21f0
movq 0x493a(%rip), %rbx      # 0x8fe8
leaq 0x1a93(%rip), %rsi      # 0x6148
movl $0x11, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq 0x4908(%rip), %rdi      # 0x8fe8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x48b4(%rip), %rsi      # 0x8fa8
leaq 0x190(%rsp), %rdi
callq 0x2100
leaq 0x210(%rsp), %rdi
callq 0x2050
jmp 0x4763
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x21f0
leaq 0x1a19(%rip), %rsi      # 0x6148
movl $0x11, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
xorl %r14d, %r14d
leaq 0x190(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21d0
movl 0x8(%rbx), %edi
callq 0x2140
movq %r14, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %r14, 0x10(%rbx)
movaps %xmm0, (%rbx)
movl $0x280, %edi            # imm = 0x280
callq 0x2160
movq %rax, 0x190(%rsp)
movq %rax, 0x198(%rsp)
movq %rax, %rbx
addq $0x280, %rbx            # imm = 0x280
movq %rbx, 0x1a0(%rsp)
movl $0x280, %edx            # imm = 0x280
movq %rax, %rdi
xorl %esi, %esi
callq 0x20b0
movq %rbx, 0x198(%rsp)
movabsq $0x800000050, %rbx      # imm = 0x800000050
movq %rbx, 0x1a8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x280, %edi            # imm = 0x280
callq 0x2160
movq %rax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq %rax, %r14
addq $0x280, %r14            # imm = 0x280
movq %r14, 0x40(%rsp)
movl $0x280, %edx            # imm = 0x280
movq %rax, %rdi
xorl %esi, %esi
callq 0x20b0
movq %r14, 0x38(%rsp)
movq %rbx, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x280, %edi            # imm = 0x280
callq 0x2160
movq %rax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %rax, %r14
addq $0x280, %r14            # imm = 0x280
movq %r14, 0x20(%rsp)
movl $0x280, %edx            # imm = 0x280
movq %rax, %rdi
xorl %esi, %esi
callq 0x20b0
movq %r14, 0x18(%rsp)
movq %rbx, 0x28(%rsp)
leaq 0x190(%rsp), %rdi
movl $0x23, %esi
callq 0x5352
leaq 0x30(%rsp), %rdi
movl $0x23, %esi
callq 0x5352
leaq 0x10(%rsp), %rdi
movl $0x23, %esi
callq 0x5352
xorl %eax, %eax
movb %al, 0x7(%rsp)
movb %al, 0x6(%rsp)
movb %al, 0x5(%rsp)
movl $0x0, 0x8(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x5716
movq 0x1a8(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5716
movq 0x48(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x170(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5716
movq 0x28(%rsp), %rax
leaq 0x170(%rsp), %rdx
movq %rax, 0x18(%rdx)
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x540f
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x4962
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x497f
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x499c
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x190(%rsp), %rbx
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x150(%rsp), %rbp
leaq 0x50(%rsp), %r12
leaq 0x8(%rsp), %r13
cmpb $0x1, 0x7(%rsp)
jne 0x49e0
cmpb $0x1, 0x6(%rsp)
jne 0x49e0
cmpb $0x1, 0x5(%rsp)
jne 0x49e0
cmpl $0x0, 0x8(%rsp)
jle 0x4be1
movl 0x8(%rsp), %eax
testl %eax, %eax
jle 0x49ee
decl %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x54e2
movq %r14, %rdi
callq 0x54e2
movq %r15, %rdi
callq 0x54e2
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0x5716
movq 0x1a8(%rsp), %rax
movq %rax, 0x108(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x5716
movq 0x48(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x5716
movq 0x28(%rsp), %rax
movq %rax, 0x168(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %rbp, %rdx
callq 0x540f
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x4a90
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4aad
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4aca
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpb $0x1, 0x7(%rsp)
jne 0x4ae3
cmpb $0x1, 0x6(%rsp)
jne 0x4ae3
cmpb $0x0, 0x5(%rsp)
jne 0x4bd3
leaq 0xb0(%rsp), %rdi
movq %rbx, %rsi
callq 0x5716
movq 0x1a8(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
leaq 0x7(%rsp), %rdx
movq %r13, %rcx
callq 0x5697
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4b38
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x5716
movq 0x48(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
leaq 0x6(%rsp), %rdx
movq %r13, %rcx
callq 0x5697
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x4b8a
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x5716
movq 0x28(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
leaq 0x5(%rsp), %rdx
movq %r13, %rcx
callq 0x5697
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4bd3
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movl 0xc(%rsp), %edi
callq 0x21b0
jmp 0x49c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4bf8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4c0f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x4c2c
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c43
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
xorl %eax, %eax
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x4c7c
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4c7c
movq %rax, %rbx
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x4c9e
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4c9e
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x4dc6
movq 0x140(%rsp), %rsi
jmp 0x4db9
jmp 0x4dc3
movq %rax, %rbx
jmp 0x4ddd
movq %rax, %rbx
jmp 0x4df4
movq %rax, %rbx
jmp 0x4e11
movq %rax, %rbx
movq 0x42c5(%rip), %rsi      # 0x8fa8
leaq 0x190(%rsp), %rdi
callq 0x2100
leaq 0x210(%rsp), %rdi
callq 0x2050
jmp 0x4e28
jmp 0x4dc3
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4dc6
movq 0x80(%rsp), %rsi
jmp 0x4db9
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x4dc6
movq 0xa0(%rsp), %rsi
jmp 0x4db9
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4dc6
movq 0xc0(%rsp), %rsi
jmp 0x4db9
movq %rax, %rbx
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x4d82
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4d82
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4da4
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4da4
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4dc6
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4dc6
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4ddd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4df4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x4e11
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4e28
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2210