// File: /workspace/github_cpp_makefile_star2_O3/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 $0xb8, %rsp
movl %ecx, %eax
movb $0x1, %cl
movl $0x7ffffff, %r9d        # imm = 0x7FFFFFF
xorl %r8d, %r8d
xorl %r10d, %r10d
movl $0x1ff, %r14d           # imm = 0x1FF
movq %rsi, -0x38(%rsp)
vxorps %xmm0, %xmm0, %xmm0
movq %rdi, -0x80(%rsp)
subb %al, %cl
leal (%rax,%rax,8), %eax
vmovups %zmm0, 0x70(%rsp)
vmovups %zmm0, 0x60(%rsp)
vmovups %zmm0, 0x20(%rsp)
movzbl %cl, %ecx
leal (%rcx,%rcx,8), %ecx
leal (%rax,%rax,2), %r11d
leal (%rcx,%rcx,2), %ecx
shldq %cl, %r9, %r8
shlxq %rcx, %r9, %rbx
testb $0x40, %cl
movl $0x2d, %ecx
movl $0x24, %r9d
cmovneq %rbx, %r8
cmovneq %r10, %rbx
subl %r11d, %ecx
xorl %eax, %eax
shldq %cl, %r14, %rax
xorq $0x1ffff, %r8           # imm = 0x1FFFF
shlxq %rcx, %r14, %rsi
testb $0x40, %cl
movq %rcx, -0x28(%rsp)
notq %rbx
movq %r8, -0x18(%rsp)
movl $0x1b, %r8d
movq %rbx, -0x20(%rsp)
cmovneq %rsi, %rax
cmovneq %r10, %rsi
subl %r11d, %r9d
movl %r9d, %ecx
movq %rax, -0x30(%rsp)
xorl %eax, %eax
movq %rsi, -0x40(%rsp)
shldq %cl, %r14, %rax
shlxq %r9, %r14, %rcx
testb $0x40, %r9b
cmovneq %rcx, %rax
cmovneq %r10, %rcx
subl %r11d, %r8d
movq %rcx, -0x50(%rsp)
movl %r8d, %ecx
movq %rax, -0x48(%rsp)
xorl %eax, %eax
shldq %cl, %r14, %rax
shlxq %r8, %r14, %rcx
testb $0x40, %r8b
cmovneq %rcx, %rax
cmovneq %r10, %rcx
xorl %r14d, %r14d
movq %rcx, -0x60(%rsp)
movslq (%rdx), %rcx
movq %rax, -0x58(%rsp)
shlq $0x4, %rcx
leaq -0x10(%rsp,%rcx), %rax
movslq 0x4(%rdx), %rcx
movq %rax, -0x68(%rsp)
shlq $0x4, %rcx
leaq -0x10(%rsp,%rcx), %rax
movslq 0x8(%rdx), %rcx
movq %rax, -0x70(%rsp)
shlq $0x4, %rcx
leaq -0x10(%rsp,%rcx), %rax
movq %rax, -0x78(%rsp)
movq -0x38(%rsp), %rax
movq -0x28(%rsp), %rdx
movq 0x60(%rax,%r14), %rsi
movq 0x68(%rax,%r14), %rbx
movl %edx, %ecx
movl $0x0, %eax
movq %rbx, %rdi
movq %rsi, %r15
andq -0x30(%rsp), %rdi
andq -0x40(%rsp), %r15
movq %rbx, %r10
movq %rsi, %r12
andq -0x48(%rsp), %r10
andq -0x50(%rsp), %r12
movq %rbx, %r13
movq %rsi, %rbp
shrdq %cl, %rdi, %r15
movl %r9d, %ecx
shrxq %rdx, %rdi, %rdi
shrdq %cl, %r10, %r12
shrxq %r9, %r10, %r10
testb $0x40, %r9b
movl %r8d, %ecx
cmovneq %r10, %r12
cmovneq %rax, %r10
andq -0x58(%rsp), %r13
andq -0x60(%rsp), %rbp
shrdq %cl, %r13, %rbp
shrxq %r8, %r13, %rcx
testb $0x40, %r8b
cmovneq %rcx, %rbp
cmovneq %rax, %rcx
testb $0x40, %dl
cmovneq %rdi, %r15
cmovneq %rax, %rdi
movq %rdi, -0x8(%rsp)
movq %r15, -0x10(%rsp)
movq %r10, 0x8(%rsp)
movq %r12, (%rsp)
movq %rcx, 0x18(%rsp)
movq -0x68(%rsp), %rcx
movq %rbp, 0x10(%rsp)
movq (%rcx), %rdi
movq 0x8(%rcx), %r12
movl %edx, %ecx
shlxq %rdx, %rdi, %r10
movq %r10, %r15
cmovneq %rax, %r15
shldq %cl, %rdi, %r12
movq -0x70(%rsp), %rcx
testb $0x40, %dl
cmovneq %r10, %r12
testb $0x40, %r9b
movq (%rcx), %r13
movq 0x8(%rcx), %r10
movl %r9d, %ecx
shlxq %r9, %r13, %rbp
movq %rbp, %rdi
cmovneq %rax, %rdi
shldq %cl, %r13, %r10
movq -0x78(%rsp), %rcx
testb $0x40, %r9b
cmovneq %rbp, %r10
testb $0x40, %r8b
movq (%rcx), %rbp
movq 0x8(%rcx), %r13
movl %r8d, %ecx
shlxq %r8, %rbp, %r11
movq %r11, %rdx
cmovneq %rax, %rdx
shldq %cl, %rbp, %r13
testb $0x40, %r8b
cmovneq %r11, %r13
andq -0x18(%rsp), %rbx
andq -0x20(%rsp), %rsi
orq %rdi, %rdx
orq %r10, %r13
orq %r12, %rbx
orq %r15, %rsi
orq %rbx, %r13
orq %rsi, %rdx
movq %rdx, 0x20(%rsp,%r14)
movq %r13, 0x28(%rsp,%r14)
addq $0x10, %r14
cmpq $0x90, %r14
jne 0x4623
vmovups 0x20(%rsp), %zmm0
vmovups 0x60(%rsp), %zmm1
vmovups 0x70(%rsp), %zmm2
movq -0x80(%rsp), %rax
vmovups %zmm2, 0xb0(%rax)
vmovups %zmm1, 0xa0(%rax)
vmovups %zmm0, 0x60(%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq