// File: /workspace/github_cpp_makefile_star2_O1/tanakh[P]icfpc2015/main.cpp
// Function: to_unit(picojson::value&)
unit to_unit(value &v) {
  unit u;
  for (auto &c: v.get<object>()["members"].get<picojson::array>()) {
    u.members.push_back(to_cell(c));
  }
  u.pivot = to_cell(v.get<object>()["pivot"]);

  // calculate rotation max
  set<set<pair<int, int>>> ss;
  u.rot_max = 1;
  for (int i = 0; i < 6; i++) {
    set<pair<int, int>> s;
    for (auto &c: u.members) {
      auto p = rot_pivot(c, u.pivot, i);
      s.insert(make_pair(p.real(), p.imag()));
    }
    if (ss.count(s)) break;
    ss.insert(s);
    u.rot_max = i + 1;
  }

  u.miny = 0x7fffffff;
  for (auto &p: u.members)
    u.miny = min(u.miny, p.imag());

  return u;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
cmpl $0x5, (%rsi)
jne 0x4447
movq %rsi, %r14
movq 0x8(%rsi), %r15
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x11163(%rip), %rsi     # 0x15399
leaq 0x11163(%rip), %rdx     # 0x153a0
leaq 0x8(%rsp), %rdi
callq 0xf8e6
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xb898
cmpl $0x4, (%rax)
jne 0x4479
movq 0x8(%rax), %r12
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4270
callq 0x32f0
movq (%r12), %r15
movq 0x8(%r12), %rbp
cmpq %rbp, %r15
je 0x42b8
leaq 0x8(%rsp), %r12
movq %r15, %rdi
callq 0x403a
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x42a4
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x42af
movq %rbx, %rdi
movq %r12, %rdx
callq 0xfaec
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x4283
cmpl $0x5, (%r14)
jne 0x44ab
movq 0x8(%r14), %r14
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x110cc(%rip), %rsi     # 0x153a1
leaq 0x110ca(%rip), %rdx     # 0x153a6
callq 0xf8e6
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0xb898
movq %rax, %rdi
callq 0x403a
movq %rax, 0x18(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4309
callq 0x32f0
leaq 0x10(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movl $0x1, 0x20(%rbx)
leaq 0x38(%rsp), %r15
movq %rsp, %r12
xorl %ebp, %ebp
movl $0x0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x48(%rsp)
leaq 0x40(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq (%rbx), %r14
movq 0x8(%rbx), %r13
cmpq %r13, %r14
je 0x43b8
movq (%r14), %rax
movq %rax, %rcx
shrq $0x20, %rcx
movl 0x18(%rbx), %edx
subl 0x1c(%rbx), %ecx
subl %edx, %eax
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0xc88c
movq %rax, %rcx
shrq $0x20, %rcx
movl 0x18(%rbx), %edx
addl 0x1c(%rbx), %ecx
addl %eax, %edx
shlq $0x20, %rcx
orq %rcx, %rdx
movq %rdx, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xfc2a
addq $0x8, %r14
jmp 0x4361
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xfd7e
leaq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jne 0x43f5
movq %r14, %rdi
movq %r15, %rsi
callq 0xfe96
incl %ebp
movl %ebp, 0x20(%rbx)
movq %r15, %rdi
callq 0xc8cc
cmpl $0x6, %ebp
jne 0x4337
jmp 0x43ff
leaq 0x38(%rsp), %rdi
callq 0xc8cc
movl $0x7fffffff, 0x24(%rbx) # imm = 0x7FFFFFFF
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x442b
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl 0x4(%rax), %esi
cmpl %edx, %esi
cmovll %esi, %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x4417
movl %edx, 0x24(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xc916
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3150
movq %rax, %r15
leaq 0x1129a(%rip), %rsi     # 0x156f5
movq %rax, %rdi
callq 0x3100
movq 0x18b86(%rip), %rsi     # 0x1cff0
movq 0x18b47(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3490
movl $0x10, %edi
callq 0x3150
movq %rax, %r15
leaq 0x112f1(%rip), %rsi     # 0x1577e
movq %rax, %rdi
callq 0x3100
movq 0x18b54(%rip), %rsi     # 0x1cff0
movq 0x18b15(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3490
movl $0x10, %edi
callq 0x3150
movq %rax, %r15
leaq 0x11236(%rip), %rsi     # 0x156f5
movq %rax, %rdi
callq 0x3100
movq 0x18b22(%rip), %rsi     # 0x1cff0
movq 0x18ae3(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3490
jmp 0x4517
jmp 0x44f0
movq %rax, %r14
movq %r15, %rdi
callq 0x3250
jmp 0x4506
jmp 0x4517
movq %rax, %r14
movq %r15, %rdi
callq 0x3250
jmp 0x4537
jmp 0x4517
jmp 0x4517
jmp 0x4503
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4537
callq 0x32f0
jmp 0x4537
movq %rax, %r14
jmp 0x4537
jmp 0x4520
jmp 0x4520
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0xc8cc
leaq 0x8(%rsp), %rdi
callq 0xc916
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4544
callq 0x32f0
movq %r14, %rdi
callq 0x34b0