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