// File: /workspace/github_cpp_makefile_star2_O2/EstherJin[P]TetrisRemake/j.cc
// Function: J::turn(int)
void J::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 -= 2;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(3), false};
      setState(stat);
      notifyObservers();
      coords.at(3).row -= 2;
      coords.at(3).col -= 2;
      stat = {c, coords.at(3), true};
      setState(stat);
      notifyObservers();
    } else if (position == 1) {
      State stat = {' ', coords.at(1), false};
      setState(stat);
      notifyObservers();
      coords.at(1).col += 2;
      stat = {c, coords.at(1), true};
      setState(stat);
      notifyObservers();
      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();
      stat = {' ', coords.at(3), false};
      setState(stat);
      notifyObservers();
      coords.at(3).row += 1;
      coords.at(3).col += 1;
      stat = {c, coords.at(3), 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(1), false};
      setState(stat);
      notifyObservers();
      coords.at(1).col -= 1;
      stat = {c, coords.at(1), true};
      setState(stat);
      notifyObservers();
      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 {
      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(1), false};
      setState(stat);
      notifyObservers();
      coords.at(1).col -= 1;
      stat = {c, coords.at(1), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(2), false};
      setState(stat);
      notifyObservers();
      coords.at(2).row += 2;
      stat = {c, coords.at(2), true};
      setState(stat);
      notifyObservers();
      stat = {' ', coords.at(3), false};
      setState(stat);
      notifyObservers();
      coords.at(3).row += 1;
      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 $0xe8, %rsp
movq %rdi, %r14
andl $0x3, %esi
leaq 0x30(%rdi), %r15
leaq 0x8(%rdi), %r12
testl %esi, %esi
jle 0xce45
movl 0x48(%r14), %eax
cmpl $0x2, %eax
movl %esi, 0x4(%rsp)
movq %r15, %rdi
je 0xc972
cmpl $0x1, %eax
je 0xc777
testl %eax, %eax
jne 0xcb70
pushq $0x2
popq %rbx
movq %rbx, %rsi
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 %rbx, %rsi
callq 0x71fe
addl $-0x2, (%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0x58(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rbp      # imm = 0x100000000
orq %rbp, %rdx
movq %rsi, 0x58(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x3
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x50(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x50(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
addl $-0x2, (%rax)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
addl $-0x2, 0x4(%rax)
movb 0x4c(%r14), %r13b
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x48(%rsp), %rsi
andq %rbx, %rsi
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 0xce0f
pushq $0x1
popq %rbx
movq %rbx, %rsi
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
movq %rbx, %rsi
callq 0x71fe
addl $0x2, 0x4(%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0x80(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rbp      # imm = 0x100000000
orq %rbp, %rdx
movq %rsi, 0x80(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x2
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x78(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x78(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl (%rax)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl 0x4(%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x70(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, 0x70(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x3
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x68(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x68(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl (%rax)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl 0x4(%rax)
movb 0x4c(%r14), %r13b
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x60(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x20(%rsp)
movq %rsi, 0x60(%rsp)
movq %rsi, 0x18(%rsp)
jmp 0xce0f
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %eax
movabsq $-0x10000000000, %rdx   # imm = 0xFFFFFF0000000000
movq 0x30(%rsp), %r8
andq %rdx, %r8
orq %rax, %r8
shlq $0x20, %rcx
movq 0x28(%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), %r13d
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0xa8(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rbp      # imm = 0x100000000
orq %rbp, %rdx
movq %rsi, 0xa8(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x1
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xa0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0xa0(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
decl 0x4(%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x98(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, 0x98(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x2
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x90(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0x90(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
decl (%rax)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
decl 0x4(%rax)
movb 0x4c(%r14), %r13b
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0x88(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x30(%rsp)
movq %rsi, 0x88(%rsp)
movq %rsi, 0x28(%rsp)
jmp 0xce0f
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), %r13d
movq %r15, %rdi
xorl %esi, %esi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movl $0xffffff, %ebx         # imm = 0xFFFFFF
movq 0xe0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rbp      # imm = 0x100000000
orq %rbp, %rdx
movq %rsi, 0xe0(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x1
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xd8(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0xd8(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
decl 0x4(%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xd0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, 0xd0(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x2
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xc8(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0xc8(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
addl $0x2, (%rax)
movzbl 0x4c(%r14), %r13d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xc0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, 0xc0(%rsp)
shlq $0x8, %rsi
orq %r13, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
pushq $0x3
popq %rbp
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xb8(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movq %rsi, 0xb8(%rsp)
shlq $0x8, %rsi
orq $0x20, %rsi
movq %r12, %rdi
callq 0xf2c8
movq %r12, %rdi
callq 0xf29c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl (%rax)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
incl 0x4(%rax)
movb 0x4c(%r14), %r13b
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71fe
movl (%rax), %ecx
movl 0x4(%rax), %edx
shlq $0x18, %rcx
movq 0xb0(%rsp), %rsi
andq %rbx, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rdx
movq %rsi, %rax
movq %rdx, 0x10(%rsp)
movq %rsi, 0xb0(%rsp)
movq %rsi, 0x8(%rsp)
shlq $0x8, %rax
movzbl %r13b, %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)
movl 0x4(%rsp), %esi
decl %esi
jmp 0xc5fb
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop