// File: MarkCBell[P]twister/./twister/kernel/twister.cpp
// Function: rectangle::rectangle(std::vector<cube*, std::allocator<cube*>> const&, std::vector<bool, std::allocator<bool>> const&)
rectangle::rectangle(const std::vector<cube*> &sq_in, const std::vector<bool> &upright_in)
{
	front = -1;
	back = -1;
	one_ended = false;
	
	length = int(sq_in.size());
	
	sq = new cube*[length];
	upright = new bool[length];
	
	for (int i = 0; i < length; i++)
	{
		sq[i] = sq_in[i];
		upright[i] = upright_in[i];
	}
	
	// Check for self-intersection.
	for (int i = 0; i < length; i++)
		for (int j = i + 1; j < length; j++)
			if (sq[i] == sq[j])
				output_error("A rectangle must not intersect itself.");
	
	// Now glue the cubes together.
	for (int i = 0; i < length - 1; i++)
		glue_cubes(sq[i], sq[i+1], upright[i], upright[i+1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
movb $0x0, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x9b10
movq %rax, %rcx
movq -0x68(%rbp), %rax
movl %ecx, (%rax)
movslq (%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x8(%rax)
movslq (%rax), %rdi
callq 0x3030
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
movq -0x68(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1bda3
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20f70
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rcx), %rdx
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20f90
movb %al, %dl
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
andb $0x1, %dl
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1bd49
movl $0x0, -0x20(%rbp)
movq -0x68(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1be82
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x68(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1be72
movq -0x68(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x8(%rcx), %rcx
movslq -0x24(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x1be62
leaq -0x49(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x3560
movq -0x70(%rbp), %rdx
leaq 0xb7d3(%rip), %rsi      # 0x275da
leaq -0x48(%rbp), %rdi
callq 0x4e10
jmp 0x1be12
leaq -0x48(%rbp), %rdi
callq 0x4d40
jmp 0x1be1d
leaq -0x48(%rbp), %rdi
callq 0x35f8
leaq -0x49(%rbp), %rdi
callq 0x3360
jmp 0x1be62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1be54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x35f8
leaq -0x49(%rbp), %rdi
callq 0x3360
jmp 0x1bef6
jmp 0x1be64
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1bdc2
jmp 0x1be74
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1bdaa
movl $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movl -0x60(%rbp), %eax
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1bef0
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
movq 0x8(%rax), %rcx
movl -0x60(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x10(%rax), %rcx
movslq -0x60(%rbp), %rdx
movb (%rcx,%rdx), %cl
movq 0x10(%rax), %rax
movl -0x60(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movb (%rax,%rdx), %al
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0x18150
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x1be89
addq $0x70, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3550
nop