// File: chuckwolber[P]Cube/test/test_algorithm.cpp
// Function: test_triples()
void test_triples() {
    std::cout << "Testing triples... ";

    Algorithm alg_1;
    alg_1.addTurn({Layer::R, true});
    alg_1.addTurn({Layer::R, true});
    alg_1.addTurn({Layer::R, true});
    alg_1.addTurn({Layer::R, true});
    assert(alg_1.hasTriple());

    Algorithm alg_2;
    alg_2.addTurn({Layer::R, false});
    alg_2.addTurn({Layer::R, false});
    alg_2.addTurn({Layer::R, true});
    alg_2.addTurn({Layer::R, true});
    assert(!alg_2.hasTriple());
    alg_2.addTurn({Layer::R, true});
    alg_2.addTurn({Layer::F, true});
    alg_2.addTurn({Layer::U, true});
    alg_2.addTurn({Layer::B, true});
    assert(alg_2.hasTriple());

    Algorithm alg_3;
    alg_3.addTurn({Layer::R, false});
    alg_3.addTurn({Layer::U, true});
    alg_3.addTurn({Layer::R, false});
    alg_3.addTurn({Layer::B, true});
    alg_3.addTurn({Layer::R, false});
    alg_3.addTurn({Layer::F, true});
    alg_3.addTurn({Layer::U, false});
    alg_3.addTurn({Layer::B, false});
    assert(!alg_3.hasTriple());

    alg_3.addTurn({Layer::U, true});
    alg_3.addTurn({Layer::U, true});
    alg_3.addTurn({Layer::U, true});
    alg_3.addTurn({Layer::U, true});

    alg_3.addTurn({Layer::R, false});
    alg_3.addTurn({Layer::F, true});
    alg_3.addTurn({Layer::U, false});
    alg_3.addTurn({Layer::B, true});
    assert(alg_3.hasTriple());

    std::cout << "Passed" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq 0x95f6(%rip), %rdi      # 0x15fd8
leaq 0x3c60(%rip), %rsi      # 0x10649
callq 0x2190
leaq -0x28(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x2420
movq -0x170(%rbp), %rdi
movl $0x6, -0x30(%rbp)
movb $0x1, -0x2c(%rbp)
movq -0x30(%rbp), %rsi
callq 0x2490
jmp 0xca1b
movl $0x6, -0x44(%rbp)
movb $0x1, -0x40(%rbp)
movq -0x44(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x2490
jmp 0xca35
movl $0x6, -0x4c(%rbp)
movb $0x1, -0x48(%rbp)
movq -0x4c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x2490
jmp 0xca4f
movl $0x6, -0x54(%rbp)
movb $0x1, -0x50(%rbp)
movq -0x54(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x2490
jmp 0xca69
leaq -0x28(%rbp), %rdi
callq 0x39b0
movb %al, -0x171(%rbp)
jmp 0xca7a
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0xca86
jmp 0xca88
jmp 0xcab8
leaq 0x3bce(%rip), %rdi      # 0x1065d
leaq 0x3843(%rip), %rsi      # 0x102d9
movl $0x159, %edx            # imm = 0x159
leaq 0x3bcd(%rip), %rcx      # 0x1066f
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xcfda
leaq -0x80(%rbp), %rdi
callq 0x2420
jmp 0xcac3
movl $0x6, -0x88(%rbp)
movb $0x0, -0x84(%rbp)
movq -0x88(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcae6
movl $0x6, -0x90(%rbp)
movb $0x0, -0x8c(%rbp)
movq -0x90(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcb09
movl $0x6, -0x98(%rbp)
movb $0x1, -0x94(%rbp)
movq -0x98(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcb2c
movl $0x6, -0xa0(%rbp)
movb $0x1, -0x9c(%rbp)
movq -0xa0(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcb4f
leaq -0x80(%rbp), %rdi
callq 0x39b0
movb %al, -0x172(%rbp)
jmp 0xcb60
movb -0x172(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xcb6e
jmp 0xcb70
jmp 0xcba0
leaq 0x3b0c(%rip), %rdi      # 0x10683
leaq 0x375b(%rip), %rsi      # 0x102d9
movl $0x160, %edx            # imm = 0x160
leaq 0x3ae5(%rip), %rcx      # 0x1066f
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xcfd1
movl $0x6, -0xa8(%rbp)
movb $0x1, -0xa4(%rbp)
movq -0xa8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcbc3
movl $0x5, -0xb0(%rbp)
movb $0x1, -0xac(%rbp)
movq -0xb0(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcbe6
movl $0x1, -0xb8(%rbp)
movb $0x1, -0xb4(%rbp)
movq -0xb8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcc09
movl $0x7, -0xc0(%rbp)
movb $0x1, -0xbc(%rbp)
movq -0xc0(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2490
jmp 0xcc2c
leaq -0x80(%rbp), %rdi
callq 0x39b0
movb %al, -0x173(%rbp)
jmp 0xcc3d
movb -0x173(%rbp), %al
testb $0x1, %al
jne 0xcc49
jmp 0xcc4b
jmp 0xcc6a
leaq 0x3a32(%rip), %rdi      # 0x10684
leaq 0x3680(%rip), %rsi      # 0x102d9
movl $0x165, %edx            # imm = 0x165
leaq 0x3a0a(%rip), %rcx      # 0x1066f
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x2420
jmp 0xcc78
movl $0x6, -0xf0(%rbp)
movb $0x0, -0xec(%rbp)
movq -0xf0(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcc9e
movl $0x1, -0xf8(%rbp)
movb $0x1, -0xf4(%rbp)
movq -0xf8(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xccc4
movl $0x6, -0x100(%rbp)
movb $0x0, -0xfc(%rbp)
movq -0x100(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xccea
movl $0x7, -0x108(%rbp)
movb $0x1, -0x104(%rbp)
movq -0x108(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcd10
movl $0x6, -0x110(%rbp)
movb $0x0, -0x10c(%rbp)
movq -0x110(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcd36
movl $0x5, -0x118(%rbp)
movb $0x1, -0x114(%rbp)
movq -0x118(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcd5c
movl $0x1, -0x120(%rbp)
movb $0x0, -0x11c(%rbp)
movq -0x120(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcd82
movl $0x7, -0x128(%rbp)
movb $0x0, -0x124(%rbp)
movq -0x128(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcda8
leaq -0xe8(%rbp), %rdi
callq 0x39b0
movb %al, -0x174(%rbp)
jmp 0xcdbc
movb -0x174(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xcdca
jmp 0xcdcc
jmp 0xce08
leaq 0x38c3(%rip), %rdi      # 0x10696
leaq 0x34ff(%rip), %rsi      # 0x102d9
movl $0x170, %edx            # imm = 0x170
leaq 0x3889(%rip), %rcx      # 0x1066f
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4bd0
jmp 0xcfd1
movl $0x1, -0x130(%rbp)
movb $0x1, -0x12c(%rbp)
movq -0x130(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xce2e
movl $0x1, -0x138(%rbp)
movb $0x1, -0x134(%rbp)
movq -0x138(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xce54
movl $0x1, -0x140(%rbp)
movb $0x1, -0x13c(%rbp)
movq -0x140(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xce7a
movl $0x1, -0x148(%rbp)
movb $0x1, -0x144(%rbp)
movq -0x148(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcea0
movl $0x6, -0x150(%rbp)
movb $0x0, -0x14c(%rbp)
movq -0x150(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcec6
movl $0x5, -0x158(%rbp)
movb $0x1, -0x154(%rbp)
movq -0x158(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xceec
movl $0x1, -0x160(%rbp)
movb $0x0, -0x15c(%rbp)
movq -0x160(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcf12
movl $0x7, -0x168(%rbp)
movb $0x1, -0x164(%rbp)
movq -0x168(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2490
jmp 0xcf38
leaq -0xe8(%rbp), %rdi
callq 0x39b0
movb %al, -0x175(%rbp)
jmp 0xcf4c
movb -0x175(%rbp), %al
testb $0x1, %al
jne 0xcf58
jmp 0xcf5a
jmp 0xcf79
leaq 0x3736(%rip), %rdi      # 0x10697
leaq 0x3371(%rip), %rsi      # 0x102d9
movl $0x17b, %edx            # imm = 0x17B
leaq 0x36fb(%rip), %rcx      # 0x1066f
callq 0x2100
movq 0x9058(%rip), %rdi      # 0x15fd8
leaq 0x342f(%rip), %rsi      # 0x103b6
callq 0x2190
movq %rax, -0x180(%rbp)
jmp 0xcf95
movq -0x180(%rbp), %rdi
movq 0x9025(%rip), %rsi      # 0x15fc8
callq 0x21c0
jmp 0xcfaa
leaq -0xe8(%rbp), %rdi
callq 0x4bd0
leaq -0x80(%rbp), %rdi
callq 0x4bd0
leaq -0x28(%rbp), %rdi
callq 0x4bd0
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0x4bd0
leaq -0x28(%rbp), %rdi
callq 0x4bd0
movq -0x38(%rbp), %rdi
callq 0x22a0
nopl (%rax)