// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x29170
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
testb $0x1, -0x14(%rbp)
je 0x2b64b
movsbl -0x20(%rbp), %eax
cmpl $0x54, %eax
jne 0x2b42f
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x2, %r9d
callq 0x2c990
jmp 0x2b649
movsbl -0x20(%rbp), %eax
cmpl $0x4c, %eax
jne 0x2b47b
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x3, %r9d
callq 0x2c990
jmp 0x2b647
movsbl -0x20(%rbp), %eax
cmpl $0x5a, %eax
jne 0x2b4c7
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x4, %r9d
callq 0x2c990
jmp 0x2b645
movsbl -0x20(%rbp), %eax
cmpl $0x4f, %eax
jne 0x2b513
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x5, %r9d
callq 0x2c990
jmp 0x2b643
movsbl -0x20(%rbp), %eax
cmpl $0x53, %eax
jne 0x2b55f
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x6, %r9d
callq 0x2c990
jmp 0x2b641
movsbl -0x20(%rbp), %eax
cmpl $0x4a, %eax
jne 0x2b5ab
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x7, %r9d
callq 0x2c990
jmp 0x2b63f
movsbl -0x20(%rbp), %eax
cmpl $0x49, %eax
jne 0x2b5f4
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0x8, %r9d
callq 0x2c990
jmp 0x2b63d
movsbl -0x20(%rbp), %eax
cmpl $0x2a, %eax
jne 0x2b63b
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
movl $0xb, %r9d
callq 0x2c990
jmp 0x2b63d
jmp 0x2b63f
jmp 0x2b641
jmp 0x2b643
jmp 0x2b645
jmp 0x2b647
jmp 0x2b649
jmp 0x2b686
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x18(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl -0x1c(%rbp), %ecx
imull 0x8(%rax), %ecx
addl %ecx, %edx
movl 0x8(%rax), %ecx
movl 0x8(%rax), %r8d
xorl %r9d, %r9d
callq 0x2c990
movl $0x1, -0x24(%rbp)
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0x2b6da
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
movl 0x18(%rax), %edx
imull $0x22, -0x24(%rbp), %eax
addl %eax, %edx
movl $0x177, %ecx            # imm = 0x177
movl $0x1, %r8d
movl $0xa, %r9d
callq 0x2c990
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2b68d
movl $0x1, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x2b72e
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x2c1c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
imull $0x22, -0x28(%rbp), %ecx
addl %ecx, %esi
movl 0x18(%rax), %edx
movl $0x1, %ecx
movl $0x264, %r8d            # imm = 0x264
movl $0xa, %r9d
callq 0x2c990
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2b6e1
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)