// File: /workspace/github_cpp_makefile_star2_O3/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 0x4434
movq %rsi, %r14
movq 0x8(%rsi), %r15
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x11156(%rip), %rsi     # 0x15379
leaq 0x11156(%rip), %rdx     # 0x15380
leaq 0x8(%rsp), %rdi
callq 0xfa08
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xb84a
cmpl $0x4, (%rax)
jne 0x4466
movq 0x8(%rax), %r12
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x425d
callq 0x32f0
movq (%r12), %r15
movq 0x8(%r12), %rbp
cmpq %rbp, %r15
je 0x42a5
leaq 0x8(%rsp), %r12
movq %r15, %rdi
callq 0x4027
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x4291
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x429c
movq %rbx, %rdi
movq %r12, %rdx
callq 0xfbfe
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x4270
cmpl $0x5, (%r14)
jne 0x4498
movq 0x8(%r14), %r14
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x110bf(%rip), %rsi     # 0x15381
leaq 0x110bd(%rip), %rdx     # 0x15386
callq 0xfa08
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0xb84a
movq %rax, %rdi
callq 0x4027
movq %rax, 0x18(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x42f6
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 0x43a5
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 0xc93e
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 0xfd3c
addq $0x8, %r14
jmp 0x434e
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xfe7c
leaq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jne 0x43e2
movq %r14, %rdi
movq %r15, %rsi
callq 0xff80
incl %ebp
movl %ebp, 0x20(%rbx)
movq %r15, %rdi
callq 0xc97e
cmpl $0x6, %ebp
jne 0x4324
jmp 0x43ec
leaq 0x38(%rsp), %rdi
callq 0xc97e
movl $0x7fffffff, 0x24(%rbx) # imm = 0x7FFFFFFF
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x4418
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl 0x4(%rax), %esi
cmpl %edx, %esi
cmovll %esi, %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x4404
movl %edx, 0x24(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xc9c8
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 0x1128d(%rip), %rsi     # 0x156d5
movq %rax, %rdi
callq 0x3100
movq 0x18b99(%rip), %rsi     # 0x1cff0
movq 0x18b5a(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3480
movl $0x10, %edi
callq 0x3150
movq %rax, %r15
leaq 0x112e4(%rip), %rsi     # 0x1575e
movq %rax, %rdi
callq 0x3100
movq 0x18b67(%rip), %rsi     # 0x1cff0
movq 0x18b28(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3480
movl $0x10, %edi
callq 0x3150
movq %rax, %r15
leaq 0x11229(%rip), %rsi     # 0x156d5
movq %rax, %rdi
callq 0x3100
movq 0x18b35(%rip), %rsi     # 0x1cff0
movq 0x18af6(%rip), %rdx     # 0x1cfb8
movq %r15, %rdi
callq 0x3480
jmp 0x4504
jmp 0x44dd
movq %rax, %r14
movq %r15, %rdi
callq 0x3250
jmp 0x44f3
jmp 0x4504
movq %rax, %r14
movq %r15, %rdi
callq 0x3250
jmp 0x4524
jmp 0x4504
jmp 0x4504
jmp 0x44f0
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4524
callq 0x32f0
jmp 0x4524
movq %rax, %r14
jmp 0x4524
jmp 0x450d
jmp 0x450d
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0xc97e
leaq 0x8(%rsp), %rdi
callq 0xc9c8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4531
callq 0x32f0
movq %r14, %rdi
callq 0x34a0