// File: /workspace/github_cpp_makefile_star2_O3/chuckwolber[P]Cube/test/../Cube.cpp
// Function: Cube::rotateLayer(Layer, bool)
void Cube::rotateLayer(Layer layer, bool clockwise) {
    unsigned int subCubeSize, subLayerMax;
    unsigned int ulr, ulc, urr, urc, llr, llc, lrr, lrc;

    /**
     * We have to set this to a throw-away value because -Ofast optimization
     * causes an unassigned variable to emit -Werror=maybe-uninitialized. This
     * warning cannot be squelched when using LLVM because of LLVM bug
     * https://bugs.llvm.org/show_bug.cgi?id=24979
     */
    Coordinate ul = {Layer::U, true};
   
    getLayerUpperLeft(ul, layer);
    subLayerMax = (unsigned int)ceil((float)cubeSize/2);
   
    for (unsigned int subLayer=0; subLayer<subLayerMax; subLayer++) {
        subCubeSize = cubeSize - 2*subLayer;
      
        ulr = ul.row + subLayer;
        urc = ul.col + subLayer + subCubeSize - 1;
        llc = ul.col + subLayer;
        lrr = ul.row + subLayer + subCubeSize - 1;
      
        for (unsigned int i=0; i<(subCubeSize - 1); i++) {
            ulc = ul.col + subLayer + i;
            urr = ul.row + subLayer + i;
            llr = ul.row + subLayer + subCubeSize - 1 - i;
            lrc = ul.col + subLayer + subCubeSize - 1 - i;
         
            fourWayRotate({{ulr, ulc},  // Upper Left
                           {urr, urc},  // Upper Right
                           {lrr, lrc},  // Lower Right
                           {llr, llc}}, // Lower Left
                            clockwise);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebp
leal -0xa(%rsi), %eax
cmpl $0x3, %eax
movq %rdi, 0x50(%rsp)
ja 0x3fa3
movl 0x8(%rdi), %r10d
movl $0x1, %eax
movq %rax, 0x38(%rsp)
movl $0x1, %eax
jmp 0x3fd3
movl 0x8(%rdi), %r10d
movl 0x2c(%rdi), %r8d
xorl %r9d, %r9d
movl %esi, %eax
xorl %edx, %edx
divl %r8d
imull %r10d, %edx
movq %rdx, 0x38(%rsp)
leal (%r8,%r8), %eax
cmpl %esi, %eax
setbe %cl
movl %r10d, %eax
shll %cl, %eax
cmpl %esi, %r8d
cmoval %r9d, %eax
movq %rax, 0x30(%rsp)
movl %r10d, %eax
cvtsi2ss %rax, %xmm0
mulss 0x52f8(%rip), %xmm0     # 0x92e0
callq 0x2080
cvttss2si %xmm0, %rax
movq %rax, 0x78(%rsp)
testl %eax, %eax
movq 0x50(%rsp), %rdi
je 0x4132
xorl %edx, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movzbl %bpl, %r14d
movq 0x30(%rsp), %rcx
movl %ecx, %r15d
movq 0x38(%rsp), %rax
movl %eax, %ebp
movl %eax, 0x2c(%rsp)
movl %ecx, 0x28(%rsp)
movl 0x8(%rdi), %r13d
movq %rdx, 0x48(%rsp)
movl %r13d, %eax
subl %edx, %eax
subl %edx, %eax
cmpl $0x1, %eax
je 0x4110
movq 0x30(%rsp), %rcx
movq 0x48(%rsp), %rdx
leal (%rdx,%rcx), %r11d
movq 0x38(%rsp), %rcx
addl %edx, %ecx
movq %rcx, 0x80(%rsp)
leal -0x1(%rax,%rcx), %ecx
movl %ecx, 0x44(%rsp)
movq %r11, 0x88(%rsp)
addl %r11d, %eax
decl %eax
movl %eax, 0x40(%rsp)
decl %r13d
movl 0x2c(%rsp), %r12d
movl 0x28(%rsp), %ebx
movq %r8, 0x90(%rsp)
leal (%r15,%r13), %eax
leal (%rbp,%r13), %ecx
movq 0x88(%rsp), %rdx
movl %edx, 0x58(%rsp)
movl %r12d, 0x5c(%rsp)
movl %ebx, 0x60(%rsp)
movl 0x44(%rsp), %edx
movl %edx, 0x64(%rsp)
movl 0x40(%rsp), %edx
movl %edx, 0x68(%rsp)
movl %ecx, 0x6c(%rsp)
movl %eax, 0x70(%rsp)
movq 0x80(%rsp), %rax
movl %eax, 0x74(%rsp)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movl %r14d, %esi
callq 0x4238
movq 0x90(%rsp), %r8
movq 0x50(%rsp), %rdi
leal (%r8,%r13), %eax
decl %eax
movl %r13d, %ecx
decl %ecx
incl %ebx
incl %r12d
movl %ecx, %r13d
cmpl $-0x1, %eax
jne 0x408a
movq 0x48(%rsp), %rdx
incl %edx
addl $-0x2, %r8d
incl 0x28(%rsp)
incl 0x2c(%rsp)
decl %ebp
decl %r15d
cmpl 0x78(%rsp), %edx
jne 0x4027
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq