// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, %ebx
movq %rdi, %r14
andl $0x3, %ebx
leaq 0x30(%rdi), %r15
leaq 0x8(%rdi), %r12
testl %ebx, %ebx
jle 0xfa8a
movl 0x48(%r14), %eax
movq %r15, %rdi
cmpl $0x2, %eax
je 0xf702
cmpl $0x1, %eax
je 0xf5b2
pushq $0x2
popq %r13
movq %r13, %rsi
testl %eax, %eax
jne 0xf8fa
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %eax
movabsq $-0x10000000000, %rdx   # imm = 0xFFFFFF0000000000
movq 0x40(%rsp), %r8
andq %rdx, %r8
orq %rax, %r8
shlq $0x20, %rcx
movq 0x38(%rsp), %rax
shll $0x8, %eax
leaq (%rcx,%rax), %rsi
addq $0x20, %rsi
movq %r12, %rdi
movq %r8, %rdx
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
decl (%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
decl 0x4(%rax)
movb 0x4c(%r14), %bpl
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x48(%rsp), %rsi
andl $0xffffff, %esi         # imm = 0xFFFFFF
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x40(%rsp)
movq %rsi, 0x48(%rsp)
movq %rsi, 0x38(%rsp)
jmp 0xfa58
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %eax
movabsq $-0x10000000000, %rdx   # imm = 0xFFFFFF0000000000
movq 0x20(%rsp), %r8
andq %rdx, %r8
orq %rax, %r8
shlq $0x20, %rcx
movq 0x18(%rsp), %rax
shll $0x8, %eax
leaq (%rcx,%rax), %rsi
addq $0x20, %rsi
movq %r12, %rdi
movq %r8, %rdx
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
incl (%rax)
movzbl 0x4c(%r14), %ebp
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl %ebx, 0x4(%rsp)
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0x60(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %r13      # imm = 0x100000000
orq %r13, %rdx
movq %rsi, 0x60(%rsp)
shlq $0x8, %rsi
orq %rbp, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x2
popq %r13
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x58(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x58(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
addl $0x2, (%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
incl 0x4(%rax)
movb 0x4c(%r14), %bpl
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x50(%rsp), %rsi
andq %rbx, %rsi
movl 0x4(%rsp), %ebx
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x20(%rsp)
movq %rsi, 0x50(%rsp)
movq %rsi, 0x18(%rsp)
jmp 0xfa58
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %eax
movabsq $-0x10000000000, %rdx   # imm = 0xFFFFFF0000000000
movq 0x10(%rsp), %r8
andq %rdx, %r8
orq %rax, %r8
shlq $0x20, %rcx
movq 0x8(%rsp), %rax
shll $0x8, %eax
leaq (%rcx,%rax), %rsi
addq $0x20, %rsi
movq %r12, %rdi
movq %r8, %rdx
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
decl (%rax)
movzbl 0x4c(%r14), %ebp
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl %ebx, 0x4(%rsp)
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0x88(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %r13      # imm = 0x100000000
orq %r13, %rdx
movq %rsi, 0x88(%rsp)
shlq $0x8, %rsi
orq %rbp, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x2
popq %r13
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x80(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x80(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
addl $-0x2, (%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
addl $-0x2, 0x4(%rax)
movzbl 0x4c(%r14), %ebp
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x78(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, 0x78(%rsp)
shlq $0x8, %rsi
orq %rbp, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x3
popq %r13
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x70(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x70(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
decl 0x4(%rax)
movb 0x4c(%r14), %bpl
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x68(%rsp), %rsi
andq %rbx, %rsi
movl 0x4(%rsp), %ebx
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x10(%rsp)
movq %rsi, 0x68(%rsp)
movq %rsi, 0x8(%rsp)
jmp 0xfa58
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %eax
movabsq $-0x10000000000, %rdx   # imm = 0xFFFFFF0000000000
movq 0x28(%rsp), %r8
andq %rdx, %r8
orq %rax, %r8
shlq $0x20, %rcx
movq 0x30(%rsp), %rax
shll $0x8, %eax
leaq (%rcx,%rax), %rsi
addq $0x20, %rsi
movq %r12, %rdi
movq %r8, %rdx
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
incl (%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
addl $0x2, 0x4(%rax)
movzbl 0x4c(%r14), %ebp
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl %ebx, 0x4(%rsp)
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0xa0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %r13      # imm = 0x100000000
orq %r13, %rdx
movq %rsi, 0xa0(%rsp)
shlq $0x8, %rsi
orq %rbp, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x3
popq %r13
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x98(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x98(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
incl 0x4(%rax)
movb 0x4c(%r14), %bpl
movq %r15, %rdi
movq %r13, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x90(%rsp), %rsi
andq %rbx, %rsi
movl 0x4(%rsp), %ebx
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rsi, 0x90(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
shlq $0x8, %rax
movzbl %bpl, %esi
orq %rax, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movl 0x48(%r14), %eax
incl %eax
cltd
pushq $0x4
popq %rcx
idivl %ecx
movl %edx, 0x48(%r14)
decl %ebx
jmp 0xf4d7
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq