// File: EstherJin[P]TetrisRemake/t.cc
// Function: T::turn(int)
void T::turn(int shift){
  if (shift > 0){
    shift = shift % 4;
  } else{
    shift = ((-4 * shift) - (shift * -1)) % 4;
  }
  while (shift > 0){
    if (position == 0){
      State stat = {' ', coords.at(2), false};
      setState(stat);
      notifyObservers();
      coords.at(2).row -= 1;
      coords.at(2).col -= 1;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
    } else if (position == 1) {
      State stat = {' ', coords.at(0), false};
      setState(stat);
      notifyObservers();
      coords.at(0).row += 1;
      stat = {c, coords.at(0), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(2), false};
      setState(stat);
      notifyObservers();
      coords.at(2).row += 2;
      coords.at(2).col += 1;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
    } else if (position == 2) {
      State stat = {' ', coords.at(0), false};
      setState(stat);
      notifyObservers();
      coords.at(0).row -= 1;
      stat = {c, coords.at(0), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(2), false};
      setState(stat);
      notifyObservers();
      coords.at(2).row -= 2;
      coords.at(2).col -= 2;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(3), false};
      setState(stat);
      notifyObservers();
      coords.at(3).col -= 1;
      stat = {c, coords.at(3), true};
      setState(stat);
      notifyObservers();
    } else {
      State stat = {' ', coords.at(2), false};
      setState(stat);
      notifyObservers();
      coords.at(2).row += 1;
      coords.at(2).col += 2;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(3), false};
      setState(stat);
      notifyObservers();
      coords.at(3).col += 1;
      stat = {c, coords.at(3), true};
      setState(stat);
      notifyObservers();
    }
    position = (position + 1) % 4;
    --shift;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x218(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x29a13
movl -0xc(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %edx, -0xc(%rbp)
jmp 0x29a2b
imull $0xfffffffc, -0xc(%rbp), %eax # imm = 0xFFFFFFFC
imull $-0x1, -0xc(%rbp), %ecx
subl %ecx, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %edx, -0xc(%rbp)
jmp 0x29a2d
cmpl $0x0, -0xc(%rbp)
jle 0x2a440
movq -0x218(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jne 0x29b51
movq -0x218(%rbp), %rdi
movb $0x20, -0x1c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x10(%rbp)
addq $0x8, %rdi
movq -0x1c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x14(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x2c(%rbp), %rsi
movq -0x24(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
subl $0x1, %ecx
movl %ecx, (%rax)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0x3c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movb $0x1, -0x30(%rbp)
movq -0x3c(%rbp), %rax
movq %rax, -0x1c(%rbp)
movq -0x34(%rbp), %rax
movq %rax, -0x14(%rbp)
addq $0x8, %rdi
movq -0x1c(%rbp), %rax
movq %rax, -0x4c(%rbp)
movq -0x14(%rbp), %rax
movq %rax, -0x44(%rbp)
movq -0x4c(%rbp), %rsi
movq -0x44(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
jmp 0x2a413
movq -0x218(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jne 0x29da0
movq -0x218(%rbp), %rdi
movb $0x20, -0x5c(%rbp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movb $0x0, -0x50(%rbp)
addq $0x8, %rdi
movq -0x5c(%rbp), %rax
movq %rax, -0x6c(%rbp)
movq -0x54(%rbp), %rax
movq %rax, -0x64(%rbp)
movq -0x6c(%rbp), %rsi
movq -0x64(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movb 0x4c(%rdi), %al
movb %al, -0x7c(%rbp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movb $0x1, -0x70(%rbp)
movq -0x7c(%rbp), %rax
movq %rax, -0x5c(%rbp)
movq -0x74(%rbp), %rax
movq %rax, -0x54(%rbp)
addq $0x8, %rdi
movq -0x5c(%rbp), %rax
movq %rax, -0x8c(%rbp)
movq -0x54(%rbp), %rax
movq %rax, -0x84(%rbp)
movq -0x8c(%rbp), %rsi
movq -0x84(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
movb $0x20, -0x9c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movb $0x0, -0x90(%rbp)
movq -0x9c(%rbp), %rax
movq %rax, -0x5c(%rbp)
movq -0x94(%rbp), %rax
movq %rax, -0x54(%rbp)
addq $0x8, %rdi
movq -0x5c(%rbp), %rax
movq %rax, -0xac(%rbp)
movq -0x54(%rbp), %rax
movq %rax, -0xa4(%rbp)
movq -0xac(%rbp), %rsi
movq -0xa4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0xbc(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movb $0x1, -0xb0(%rbp)
movq -0xbc(%rbp), %rax
movq %rax, -0x5c(%rbp)
movq -0xb4(%rbp), %rax
movq %rax, -0x54(%rbp)
addq $0x8, %rdi
movq -0x5c(%rbp), %rax
movq %rax, -0xcc(%rbp)
movq -0x54(%rbp), %rax
movq %rax, -0xc4(%rbp)
movq -0xcc(%rbp), %rsi
movq -0xc4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
jmp 0x2a411
movq -0x218(%rbp), %rax
cmpl $0x2, 0x48(%rax)
jne 0x2a183
movq -0x218(%rbp), %rdi
movb $0x20, -0xdc(%rbp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movb $0x0, -0xd0(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0xec(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0xe4(%rbp)
movq -0xec(%rbp), %rsi
movq -0xe4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
subl $0x1, %ecx
movl %ecx, (%rax)
movb 0x4c(%rdi), %al
movb %al, -0xfc(%rbp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movb $0x1, -0xf0(%rbp)
movq -0xfc(%rbp), %rax
movq %rax, -0xdc(%rbp)
movq -0xf4(%rbp), %rax
movq %rax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0x10c(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0x104(%rbp)
movq -0x10c(%rbp), %rsi
movq -0x104(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
movb $0x20, -0x11c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movb $0x0, -0x110(%rbp)
movq -0x11c(%rbp), %rax
movq %rax, -0xdc(%rbp)
movq -0x114(%rbp), %rax
movq %rax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0x12c(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0x124(%rbp)
movq -0x12c(%rbp), %rsi
movq -0x124(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
subl $0x2, %ecx
movl %ecx, (%rax)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
subl $0x2, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0x13c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movb $0x1, -0x130(%rbp)
movq -0x13c(%rbp), %rax
movq %rax, -0xdc(%rbp)
movq -0x134(%rbp), %rax
movq %rax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0x14c(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0x144(%rbp)
movq -0x14c(%rbp), %rsi
movq -0x144(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
movb $0x20, -0x15c(%rbp)
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movb $0x0, -0x150(%rbp)
movq -0x15c(%rbp), %rax
movq %rax, -0xdc(%rbp)
movq -0x154(%rbp), %rax
movq %rax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0x16c(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0x164(%rbp)
movq -0x16c(%rbp), %rsi
movq -0x164(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0x17c(%rbp)
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movb $0x1, -0x170(%rbp)
movq -0x17c(%rbp), %rax
movq %rax, -0xdc(%rbp)
movq -0x174(%rbp), %rax
movq %rax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0x18c(%rbp)
movq -0xd4(%rbp), %rax
movq %rax, -0x184(%rbp)
movq -0x18c(%rbp), %rsi
movq -0x184(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
jmp 0x2a40f
movq -0x218(%rbp), %rdi
movb $0x20, -0x19c(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movb $0x0, -0x190(%rbp)
addq $0x8, %rdi
movq -0x19c(%rbp), %rax
movq %rax, -0x1ac(%rbp)
movq -0x194(%rbp), %rax
movq %rax, -0x1a4(%rbp)
movq -0x1ac(%rbp), %rsi
movq -0x1a4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0x1bc(%rbp)
addq $0x30, %rdi
movl $0x2, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x1b8(%rbp)
movb $0x1, -0x1b0(%rbp)
movq -0x1bc(%rbp), %rax
movq %rax, -0x19c(%rbp)
movq -0x1b4(%rbp), %rax
movq %rax, -0x194(%rbp)
addq $0x8, %rdi
movq -0x19c(%rbp), %rax
movq %rax, -0x1cc(%rbp)
movq -0x194(%rbp), %rax
movq %rax, -0x1c4(%rbp)
movq -0x1cc(%rbp), %rsi
movq -0x1c4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
movb $0x20, -0x1dc(%rbp)
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
movb $0x0, -0x1d0(%rbp)
movq -0x1dc(%rbp), %rax
movq %rax, -0x19c(%rbp)
movq -0x1d4(%rbp), %rax
movq %rax, -0x194(%rbp)
addq $0x8, %rdi
movq -0x19c(%rbp), %rax
movq %rax, -0x1ec(%rbp)
movq -0x194(%rbp), %rax
movq %rax, -0x1e4(%rbp)
movq -0x1ec(%rbp), %rsi
movq -0x1e4(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
movq -0x218(%rbp), %rdi
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movb 0x4c(%rdi), %al
movb %al, -0x1fc(%rbp)
addq $0x30, %rdi
movl $0x3, %esi
callq 0xa800
movq -0x218(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
movb $0x1, -0x1f0(%rbp)
movq -0x1fc(%rbp), %rax
movq %rax, -0x19c(%rbp)
movq -0x1f4(%rbp), %rax
movq %rax, -0x194(%rbp)
addq $0x8, %rdi
movq -0x19c(%rbp), %rax
movq %rax, -0x20c(%rbp)
movq -0x194(%rbp), %rax
movq %rax, -0x204(%rbp)
movq -0x20c(%rbp), %rsi
movq -0x204(%rbp), %rdx
callq 0x29140
movq -0x218(%rbp), %rdi
addq $0x8, %rdi
callq 0x290c0
jmp 0x2a411
jmp 0x2a413
movq -0x218(%rbp), %rax
movl 0x48(%rax), %eax
addl $0x1, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x218(%rbp), %rax
movl %edx, 0x48(%rax)
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x29a2d
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopl (%rax)