// File: /workspace/github_cpp_makefile_star2_O3/EstherJin[P]TetrisRemake/graphicsDisplay.cc
// Function: GraphicsDisplay::notify(Subject&)
void GraphicsDisplay::notify (Subject &whoNotified) {
    State st = whoNotified.getState();

    if (st.add) {
        if (st.type == 'T') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 2);
        } else if (st.type == 'L') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 3);
        } else if (st.type == 'Z') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 4);
        } else if (st.type == 'O') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 5);
        } else if (st.type == 'S') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 6);
        } else if (st.type == 'J') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 7);
        } else if (st.type == 'I') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 8);
        } else if (st.type == '*') {
            window->fillRectangle(xmar + st.coords.col * cellLength,
                                  ymar + st.coords.row * cellLength,
                                  cellLength, cellLength, 11);
        }
    } else {
        window->fillRectangle(xmar + st.coords.col * cellLength,
                              ymar + st.coords.row * cellLength,
                              cellLength, cellLength, 0);

    }
    for (int i = 1; i < row; i++) {

        window->fillRectangle(xmar,ymar+i*34,375,1,10);
    }
    for (int j = 1; j < col; j++) {
        window->fillRectangle(xmar+j*34,ymar,1,612,10);
    }


}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x10e64
xorl %r9d, %r9d
btq $0x20, %rdx
jb 0x12097
movq 0x20(%rbx), %rdi
movl 0x8(%rbx), %ecx
imull %ecx, %edx
addl 0x14(%rbx), %edx
shrq $0x20, %rax
imull %ecx, %eax
addl 0x18(%rbx), %eax
movl %edx, %esi
movl %eax, %edx
movl %ecx, %r8d
callq 0x12b3e
cmpl $0x2, 0xc(%rbx)
jl 0x12053
movl $0x1, %ebp
movl $0x22, %r14d
movq 0x20(%rbx), %rdi
movl 0x14(%rbx), %esi
movl 0x18(%rbx), %edx
addl %r14d, %edx
movl $0x177, %ecx            # imm = 0x177
movl $0x1, %r8d
movl $0xa, %r9d
callq 0x12b3e
incl %ebp
addl $0x22, %r14d
cmpl 0xc(%rbx), %ebp
jl 0x12025
cmpl $0x2, 0x10(%rbx)
jl 0x12092
movl $0x1, %ebp
movl $0x22, %r14d
movq 0x20(%rbx), %rdi
movl 0x14(%rbx), %esi
addl %r14d, %esi
movl 0x18(%rbx), %edx
movl $0x1, %ecx
movl $0x264, %r8d            # imm = 0x264
movl $0xa, %r9d
callq 0x12b3e
incl %ebp
addl $0x22, %r14d
cmpl 0x10(%rbx), %ebp
jl 0x12064
popq %rbx
popq %r14
popq %rbp
retq
movzbl %al, %ecx
leal -0x49(%rcx), %esi
cmpl $0xb, %esi
ja 0x120bd
leaq 0x17f7(%rip), %rcx      # 0x138a0
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
movl $0x8, %r9d
jmp 0x11ff1
cmpl $0x2a, %ecx
je 0x1210d
cmpl $0x5a, %ecx
jne 0x12014
movl $0x4, %r9d
jmp 0x11ff1
movl $0x5, %r9d
jmp 0x11ff1
movl $0x7, %r9d
jmp 0x11ff1
movl $0x6, %r9d
jmp 0x11ff1
movl $0x3, %r9d
jmp 0x11ff1
movl $0x2, %r9d
jmp 0x11ff1
movl $0xb, %r9d
jmp 0x11ff1