// File: /workspace/github_cpp_makefile_star2_O2/kaityo256[P]minlex/minlex.cpp
// Function: Sudoku::perm_restrbox2(int*, int)
Sudoku perm_restrbox2(int a[3], int pos) {
    mbit bdata2[9] = {};
    mbit mask = ((mbit(1) << 81) - 1) ^ ((mbit(1) << 27) - 1) << (27 * (1 - pos));
    const mbit t0 = ((mbit(1) << 9) - 1) << (45 - pos * 27);
    const mbit t1 = ((mbit(1) << 9) - 1) << (36 - pos * 27);
    const mbit t2 = ((mbit(1) << 9) - 1) << (27 - pos * 27);
    mbit v[3];
    for (int i = 0; i < 9; i++) {
      v[0] = (bdata[i] & t0) >> (45 - pos * 27);
      v[1] = (bdata[i] & t1) >> (36 - pos * 27);
      v[2] = (bdata[i] & t2) >> (27 - pos * 27);
      bdata2[i] = bdata[i] & mask;
      bdata2[i] |= v[a[0]] << (45 - pos * 27);
      bdata2[i] |= v[a[1]] << (36 - pos * 27);
      bdata2[i] |= v[a[2]] << (27 - pos * 27);
    }
    return Sudoku(bdata2);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movb $0x1, %al
movl %ecx, %ebx
movq %rdx, %r15
movl $0xff, %ebp
vxorps %xmm0, %xmm0, %xmm0
movq %rdi, 0x18(%rsp)
movl $0x7ffffff, %edi        # imm = 0x7FFFFFF
movq %rsi, 0x78(%rsp)
xorl %r14d, %r14d
xorl %esi, %esi
subb %bl, %al
vmovups %zmm0, 0x100(%rsp)
vmovups %zmm0, 0xf0(%rsp)
vmovups %zmm0, 0xb0(%rsp)
movzbl %al, %eax
imull $0x1b, %eax, %edx
andl %ebp, %edx
vzeroupper
callq 0x21a0
imull $0x1b, %ebx, %ebx
xorq $0x1ffff, %rdx          # imm = 0x1FFFF
notq %rax
movq %rdx, 0x68(%rsp)
movq %rax, 0x70(%rsp)
pushq $0x2d
popq %rdx
subl %ebx, %edx
movl $0x1ff, %edi            # imm = 0x1FF
xorl %esi, %esi
andl %ebp, %edx
movl %edx, 0x14(%rsp)
callq 0x21a0
movq %rax, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
pushq $0x24
popq %rdx
subl %ebx, %edx
movl $0x1ff, %edi            # imm = 0x1FF
xorl %esi, %esi
andl %ebp, %edx
movl %edx, 0x10(%rsp)
callq 0x21a0
movq %rax, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
pushq $0x1b
popq %rdx
subl %ebx, %edx
movl $0x1ff, %edi            # imm = 0x1FF
xorl %esi, %esi
andl %ebp, %edx
movl %edx, 0xc(%rsp)
callq 0x21a0
movq %rax, 0x40(%rsp)
movslq (%r15), %rax
movl 0x10(%rsp), %ebx
movq %rdx, 0x38(%rsp)
shlq $0x4, %rax
leaq 0x80(%rsp,%rax), %rax
movq %rax, 0x30(%rsp)
movslq 0x4(%r15), %rax
shlq $0x4, %rax
leaq 0x80(%rsp,%rax), %rax
movq %rax, 0x28(%rsp)
movslq 0x8(%r15), %rax
movl 0xc(%rsp), %r15d
shlq $0x4, %rax
leaq 0x80(%rsp,%rax), %rax
movq %rax, 0x20(%rsp)
cmpq $0x90, %r14
je 0x43f6
movq %r14, (%rsp)
movq 0x78(%rsp), %rax
movl 0x14(%rsp), %r12d
movq (%rsp), %rcx
movl %r12d, %edx
movq 0x60(%rax,%rcx), %r14
movq (%rsp), %rcx
movq 0x68(%rax,%rcx), %rbp
movq %r14, %rdi
andq 0x60(%rsp), %rdi
movq %rbp, %rsi
andq 0x58(%rsp), %rsi
callq 0x2100
movq %r14, %rdi
movq %rbp, %rsi
andq 0x50(%rsp), %rdi
andq 0x48(%rsp), %rsi
movq %rdx, 0x88(%rsp)
movl %ebx, %edx
movq %rax, 0x80(%rsp)
callq 0x2100
movq %r14, %rdi
movq %rbp, %rsi
andq 0x40(%rsp), %rdi
andq 0x38(%rsp), %rsi
movq %rdx, 0x98(%rsp)
movl %r15d, %edx
movq %rax, 0x90(%rsp)
callq 0x2100
movq 0x30(%rsp), %rcx
movq %rdx, 0xa8(%rsp)
movq %rax, 0xa0(%rsp)
andq 0x70(%rsp), %r14
andq 0x68(%rsp), %rbp
movl %r12d, %edx
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
callq 0x21a0
movq 0x28(%rsp), %rcx
movq %rdx, %r13
movq %rax, %r12
orq %rbp, %r13
orq %r14, %r12
movl %ebx, %edx
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
callq 0x21a0
movq 0x20(%rsp), %rcx
movq %rdx, %rbp
movq %rax, %r14
movl %r15d, %edx
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
callq 0x21a0
orq %r14, %rax
movq (%rsp), %r14
orq %rbp, %rdx
orq %r13, %rdx
orq %r12, %rax
movq %rax, 0xb0(%rsp,%r14)
movq %rdx, 0xb8(%rsp,%r14)
addq $0x10, %r14
jmp 0x42d2
movq 0x18(%rsp), %rbx
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x2ec8
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq