// File: /workspace/github_cpp_makefile_star2_O3/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 0x4717
leaq 0x190(%rsp), %rdi
callq 0x20e0
leaq 0x1a0(%rsp), %r14
movq 0x8(%rbx), %r15
testq %r15, %r15
je 0x4763
movq %r15, %rdi
callq 0x2080
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x4784
jle 0x48c3
movq 0x58c4(%rip), %r14      # 0x9fe8
leaq 0x2a55(%rip), %rsi      # 0x7180
movl $0x7, %edx
movq %r14, %rdi
callq 0x2180
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4870
movq %rbx, %rdi
callq 0x2080
movq 0x5895(%rip), %rdi      # 0x9fe8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x4888
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 0x484d
movq 0x5831(%rip), %r14      # 0x9fe8
leaq 0x29c2(%rip), %rsi      # 0x7180
movl $0x7, %edx
movq %r14, %rdi
callq 0x2180
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x47ef
movq %rbx, %rdi
callq 0x2080
movq 0x5806(%rip), %rdi      # 0x9fe8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x4807
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x21f0
movq 0x57da(%rip), %rbx      # 0x9fe8
leaq 0x2973(%rip), %rsi      # 0x7188
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 0x57a8(%rip), %rdi      # 0x9fe8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x5754(%rip), %rsi      # 0x9fa8
leaq 0x190(%rsp), %rdi
callq 0x2100
leaq 0x210(%rsp), %rdi
callq 0x2050
jmp 0x48c3
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x21f0
leaq 0x28f9(%rip), %rsi      # 0x7188
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, %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, %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, %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 0x54a6
leaq 0x30(%rsp), %rdi
movl $0x23, %esi
callq 0x54a6
leaq 0x10(%rsp), %rdi
movl $0x23, %esi
callq 0x54a6
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 0x588c
movq 0x1a8(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x588c
movq 0x48(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x170(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x588c
movq 0x28(%rsp), %rax
leaq 0x170(%rsp), %rdx
movq %rax, 0x18(%rdx)
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x556a
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x4ab0
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x4acd
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x4aea
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 0x4b30
cmpb $0x1, 0x6(%rsp)
jne 0x4b30
movl 0x8(%rsp), %eax
testl %eax, %eax
setle %cl
testb %cl, 0x5(%rsp)
je 0x4b34
jmp 0x4d31
movl 0x8(%rsp), %eax
testl %eax, %eax
jle 0x4b3e
decl %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x5652
movq %r14, %rdi
callq 0x5652
movq %r15, %rdi
callq 0x5652
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0x588c
movq 0x1a8(%rsp), %rax
movq %rax, 0x108(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x588c
movq 0x48(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x588c
movq 0x28(%rsp), %rax
movq %rax, 0x168(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %rbp, %rdx
callq 0x556a
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x4be0
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4bfd
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4c1a
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpb $0x1, 0x7(%rsp)
jne 0x4c33
cmpb $0x1, 0x6(%rsp)
jne 0x4c33
cmpb $0x0, 0x5(%rsp)
jne 0x4d23
leaq 0xb0(%rsp), %rdi
movq %rbx, %rsi
callq 0x588c
movq 0x1a8(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
leaq 0x7(%rsp), %rdx
movq %r13, %rcx
callq 0x580d
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4c88
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x588c
movq 0x48(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
leaq 0x6(%rsp), %rdx
movq %r13, %rcx
callq 0x580d
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x4cda
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x588c
movq 0x28(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
leaq 0x5(%rsp), %rdx
movq %r13, %rcx
callq 0x580d
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4d23
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movl 0xc(%rsp), %edi
callq 0x21b0
jmp 0x4b0e
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4d48
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4d5f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x4d7c
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4d93
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 0x4dcc
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4dcc
movq %rax, %rbx
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x4dee
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4dee
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x4f16
movq 0x140(%rsp), %rsi
jmp 0x4f09
jmp 0x4f13
movq %rax, %rbx
jmp 0x4f2d
movq %rax, %rbx
jmp 0x4f44
movq %rax, %rbx
jmp 0x4f61
movq %rax, %rbx
movq 0x5175(%rip), %rsi      # 0x9fa8
leaq 0x190(%rsp), %rdi
callq 0x2100
leaq 0x210(%rsp), %rdi
callq 0x2050
jmp 0x4f78
jmp 0x4f13
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4f16
movq 0x80(%rsp), %rsi
jmp 0x4f09
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x4f16
movq 0xa0(%rsp), %rsi
jmp 0x4f09
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4f16
movq 0xc0(%rsp), %rsi
jmp 0x4f09
movq %rax, %rbx
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x4ed2
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4ed2
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4ef4
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4ef4
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4f16
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4f16
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4f2d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4f44
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x4f61
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4f78
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2210