// File: /workspace/github_cpp_makefile_star2_O3/MarkCBell[P]twister/./twister/kernel/twister.cpp
// Function: cube::cube(manifold&, int, cube*)
cube::cube(manifold &home_in, int layer_number, cube *parent_cube)
{
	output_debugging("cube", 3);
	
	home = &home_in;
	status = true;
	
	is_glued[0] = is_glued[1] = false;
	
	topleft = new tetra(home, cubie, top, left, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(top, left) : NULL);
	midleft = new tetra(home, cubie, mid, left, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(mid, left) : NULL);
	lowleft = new tetra(home, cubie, low, left, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(low, left) : NULL);
	
	topright = new tetra(home, cubie, top, right, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(top, right) : NULL);
	midright = new tetra(home, cubie, mid, right, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(mid, right) : NULL);
	lowright = new tetra(home, cubie, low, right, layer_number, (parent_cube != NULL) ? parent_cube->get_tetra(low, right) : NULL);
	
	// Assemble these tetrahedra into a cube.
	// We'll glue these into two triangular prisms, and then a cube.
	// See the diagram of the cube.
	
	// Gluings inside left prism.
	topleft->gluesym(midleft, 3, perm(0,1,3,2));
	midleft->gluesym(lowleft, 3, perm(3,1,2,0));
	
	// Gluings inside right prism.
	topright->gluesym(midright, 3, perm(0,3,2,1));
	midright->gluesym(lowright, 3, perm(3,1,2,0));
	
	// Gluings between the two prisms.
	midleft->gluesym(topright, 1, perm(1,0,2,3));
	lowleft->gluesym(midright, 1, perm(1,0,2,3));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x917b(%rip), %rsi      # 0x175f6
leaq 0x9178(%rip), %rdx      # 0x175fa
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x892e
movq %r12, %rdi
movl $0x3, %esi
callq 0x4229
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0xe4b3
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3220
movq %r15, 0x38(%rbx)
movb $0x1, 0x32(%rbx)
movw $0x0, 0x30(%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r12
testq %r14, %r14
je 0xe4d8
movq (%r14), %rax
jmp 0xe4da
xorl %eax, %eax
movq %rax, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r12, (%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r15
movq 0x38(%rbx), %rsi
testq %r14, %r14
je 0xe512
movq 0x8(%r14), %rax
jmp 0xe514
xorl %eax, %eax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r15, 0x8(%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r15
movq 0x38(%rbx), %rsi
testq %r14, %r14
je 0xe54d
movq 0x10(%r14), %rax
jmp 0xe54f
xorl %eax, %eax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %edx, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r15, 0x10(%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r15
movq 0x38(%rbx), %rsi
testq %r14, %r14
je 0xe588
movq 0x18(%r14), %rax
jmp 0xe58a
xorl %eax, %eax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r15, 0x18(%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r15
movq 0x38(%rbx), %rsi
testq %r14, %r14
je 0xe5c3
movq 0x20(%r14), %rax
jmp 0xe5c5
xorl %eax, %eax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r15, 0x20(%rbx)
movl $0xc0, %edi
callq 0x3210
movq %rax, %r15
movq 0x38(%rbx), %rsi
testq %r14, %r14
je 0xe601
movq 0x28(%r14), %rax
jmp 0xe603
xorl %eax, %eax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %edx, %edx
movl $0x2, %ecx
movl $0x1, %r8d
movl %ebp, %r9d
callq 0xde5c
movq %r15, 0x28(%rbx)
movq (%rbx), %r14
movq 0x8(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movl $0x1, %edx
movl $0x3, %ecx
movl $0x2, %r8d
callq 0x8860
movq %r14, %rdi
movq %r15, %rsi
movl $0x3, %edx
movq %r12, %rcx
callq 0xe04e
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x3, %esi
movl $0x1, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x8860
movq %r14, %rdi
movq %r15, %rsi
movl $0x3, %edx
movq %r12, %rcx
callq 0xe04e
movq 0x18(%rbx), %r14
movq 0x20(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movl $0x3, %edx
movl $0x2, %ecx
movl $0x1, %r8d
callq 0x8860
movq %r14, %rdi
movq %r15, %rsi
movl $0x3, %edx
movq %r12, %rcx
callq 0xe04e
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x3, %esi
movl $0x1, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x8860
movq %r14, %rdi
movq %r15, %rsi
movl $0x3, %edx
movq %r12, %rcx
callq 0xe04e
movq 0x8(%rbx), %r14
movq 0x18(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x8860
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
movq %r12, %rcx
callq 0xe04e
movq 0x10(%rbx), %r14
movq 0x20(%rbx), %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x8860
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
movq %r15, %rcx
callq 0xe04e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe795
jmp 0xe795
jmp 0xe795
jmp 0xe795
movq %rax, %rbx
movl $0xc0, %esi
movq %r15, %rdi
callq 0x3220
movq %rbx, %rdi
callq 0x33e0
movq %rax, %rbx
movl $0xc0, %esi
movq %r12, %rdi
jmp 0xe7a0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0xe7a5
movq 0x28(%rsp), %rsi
incq %rsi
jmp 0xe7a0