// File: 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 %r14
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, (%rsp)
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq %rdx, 0x130(%rsp)
movl %ecx, 0x12c(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x10(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovdqu64 %zmm0, 0xe0(%rsp)
vmovdqu64 %zmm0, 0xd0(%rsp)
vmovdqu64 %zmm0, 0x90(%rsp)
movb 0x12c(%rsp), %cl
movb $0x1, %al
subb %cl, %al
movzbl %al, %ecx
movl %ecx, %eax
leal (%rax,%rax,8), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
movb %al, %sil
movb %sil, %cl
movl $0x7ffffff, %eax        # imm = 0x7FFFFFF
shlxq %rcx, %rax, %rcx
movb %sil, %al
notb %al
movb %al, %dl
movl $0x3ffffff, %eax        # imm = 0x3FFFFFF
shrxq %rdx, %rax, %rax
xorl %edx, %edx
testb $0x40, %sil
cmovneq %rcx, %rax
cmovneq %rdx, %rcx
xorq $0x1ffff, %rax          # imm = 0x1FFFF
notq %rcx
movq %rcx, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movl 0x12c(%rsp), %ecx
movl %ecx, %eax
leal (%rax,%rax,8), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
movb $0x2d, %r8b
subb %al, %r8b
movb %r8b, %al
movl $0x1ff, %ecx            # imm = 0x1FF
shlxq %rax, %rcx, %rdi
movb %r8b, %al
notb %al
movb %al, %sil
movl $0xff, %eax
shrxq %rsi, %rax, %rsi
testb $0x40, %r8b
cmovneq %rdi, %rsi
cmovneq %rdx, %rdi
movq %rdi, 0x70(%rsp)
movq %rsi, 0x78(%rsp)
movl 0x12c(%rsp), %edi
movl %edi, %esi
leal (%rsi,%rsi,8), %edi
movl %edi, %esi
leal (%rsi,%rsi,2), %esi
movb $0x24, %r8b
subb %sil, %r8b
movb %r8b, %sil
shlxq %rsi, %rcx, %rdi
movb %r8b, %r9b
notb %r9b
movb %r9b, %sil
shrxq %rsi, %rax, %rsi
testb $0x40, %r8b
cmovneq %rdi, %rsi
cmovneq %rdx, %rdi
movq %rdi, 0x60(%rsp)
movq %rsi, 0x68(%rsp)
movl 0x12c(%rsp), %edi
movl %edi, %esi
leal (%rsi,%rsi,8), %edi
movl %edi, %esi
leal (%rsi,%rsi,2), %esi
movb %sil, %dil
movb $0x1b, %sil
subb %dil, %sil
movb %sil, %dil
shlxq %rdi, %rcx, %rcx
movb %sil, %r8b
notb %r8b
movb %r8b, %dil
shrxq %rdi, %rax, %rax
testb $0x40, %sil
cmovneq %rcx, %rax
cmovneq %rdx, %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movl $0x0, 0x1c(%rsp)
cmpl $0x9, 0x1c(%rsp)
jge 0x8808
movq 0x10(%rsp), %r9
movslq 0x1c(%rsp), %rcx
shlq $0x4, %rcx
movq 0x60(%r9,%rcx), %rax
movq 0x68(%r9,%rcx), %rcx
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rsi
andq %rsi, %rcx
andq %rdx, %rax
movl 0x12c(%rsp), %esi
movl %esi, %edx
leal (%rdx,%rdx,8), %esi
movl %esi, %edx
leal (%rdx,%rdx,2), %edx
movb $0x2d, %dil
movb %dil, %sil
subb %dl, %sil
movb %sil, %dl
shrxq %rdx, %rax, %r8
movb %sil, %al
notb %al
movb %al, %r10b
movq %rcx, %rax
addq %rax, %rax
shlxq %r10, %rax, %rax
orq %r8, %rax
shrxq %rdx, %rcx, %rdx
xorl %ecx, %ecx
testb $0x40, %sil
cmovneq %rdx, %rax
cmovneq %rcx, %rdx
movq %rdx, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movslq 0x1c(%rsp), %rdx
shlq $0x4, %rdx
movq 0x60(%r9,%rdx), %rax
movq 0x68(%r9,%rdx), %rdx
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %r8
andq %r8, %rdx
andq %rsi, %rax
movl 0x12c(%rsp), %r8d
movl %r8d, %esi
leal (%rsi,%rsi,8), %r8d
movl %r8d, %esi
leal (%rsi,%rsi,2), %esi
movb %sil, %r10b
movb $0x24, %sil
movb %sil, %r8b
subb %r10b, %r8b
movb %r8b, %r10b
shrxq %r10, %rax, %r11
movb %r8b, %al
notb %al
movb %al, %bl
movq %rdx, %rax
addq %rax, %rax
shlxq %rbx, %rax, %rax
orq %r11, %rax
shrxq %r10, %rdx, %rdx
testb $0x40, %r8b
cmovneq %rdx, %rax
cmovneq %rcx, %rdx
movq %rdx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movslq 0x1c(%rsp), %rdx
shlq $0x4, %rdx
movq 0x60(%r9,%rdx), %rax
movq 0x68(%r9,%rdx), %r8
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %r10
andq %r10, %r8
andq %rdx, %rax
movl 0x12c(%rsp), %r10d
movl %r10d, %edx
leal (%rdx,%rdx,8), %r10d
movl %r10d, %edx
leal (%rdx,%rdx,2), %edx
movb %dl, %r11b
movb $0x1b, %dl
movb %dl, %r10b
subb %r11b, %r10b
movb %r10b, %r11b
shrxq %r11, %rax, %rbx
movb %r10b, %al
notb %al
movb %al, %r14b
movq %r8, %rax
addq %rax, %rax
shlxq %r14, %rax, %rax
orq %rbx, %rax
shrxq %r11, %r8, %r8
testb $0x40, %r10b
cmovneq %r8, %rax
cmovneq %rcx, %r8
movq %r8, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movslq 0x1c(%rsp), %rax
shlq $0x4, %rax
movq 0x60(%r9,%rax), %r8
movq 0x68(%r9,%rax), %r9
movq 0x80(%rsp), %r11
movq 0x88(%rsp), %r10
andq %r11, %r8
andq %r10, %r9
movq %r9, 0x98(%rsp,%rax)
movq %r8, 0x90(%rsp,%rax)
movq 0x130(%rsp), %rax
movslq (%rax), %r8
shlq $0x4, %r8
movq 0x20(%rsp,%r8), %rax
movq 0x28(%rsp,%r8), %r9
movl 0x12c(%rsp), %r10d
movl %r10d, %r8d
leal (%r8,%r8,8), %r10d
movl %r10d, %r8d
leal (%r8,%r8,2), %r8d
subb %r8b, %dil
movb %dil, %r8b
shlxq %r8, %r9, %r10
movb %dil, %r9b
notb %r9b
movb %r9b, %r11b
movq %rax, %r9
shrq %r9
shrxq %r11, %r9, %r9
orq %r9, %r10
shlxq %r8, %rax, %rax
testb $0x40, %dil
movq %rax, %r9
cmovneq %rcx, %r9
cmovneq %rax, %r10
movslq 0x1c(%rsp), %rax
shlq $0x4, %rax
movq 0x90(%rsp,%rax), %r8
movq 0x98(%rsp,%rax), %rdi
orq %r10, %rdi
orq %r9, %r8
movq %r8, 0x90(%rsp,%rax)
movq %rdi, 0x98(%rsp,%rax)
movq 0x130(%rsp), %rax
movslq 0x4(%rax), %rdi
shlq $0x4, %rdi
movq 0x20(%rsp,%rdi), %rax
movq 0x28(%rsp,%rdi), %r8
movl 0x12c(%rsp), %r9d
movl %r9d, %edi
leal (%rdi,%rdi,8), %r9d
movl %r9d, %edi
leal (%rdi,%rdi,2), %edi
subb %dil, %sil
movb %sil, %dil
shlxq %rdi, %r8, %r9
movb %sil, %r8b
notb %r8b
movb %r8b, %r10b
movq %rax, %r8
shrq %r8
shrxq %r10, %r8, %r8
orq %r8, %r9
shlxq %rdi, %rax, %rax
testb $0x40, %sil
movq %rax, %r8
cmovneq %rcx, %r8
cmovneq %rax, %r9
movslq 0x1c(%rsp), %rax
shlq $0x4, %rax
movq 0x90(%rsp,%rax), %rdi
movq 0x98(%rsp,%rax), %rsi
orq %r9, %rsi
orq %r8, %rdi
movq %rdi, 0x90(%rsp,%rax)
movq %rsi, 0x98(%rsp,%rax)
movq 0x130(%rsp), %rax
movslq 0x8(%rax), %rsi
shlq $0x4, %rsi
movq 0x20(%rsp,%rsi), %rax
movq 0x28(%rsp,%rsi), %rdi
movl 0x12c(%rsp), %r8d
movl %r8d, %esi
leal (%rsi,%rsi,8), %r8d
movl %r8d, %esi
leal (%rsi,%rsi,2), %esi
subb %sil, %dl
movb %dl, %sil
shlxq %rsi, %rdi, %rdi
movb %dl, %r8b
notb %r8b
movb %r8b, %r9b
movq %rax, %r8
shrq %r8
shrxq %r9, %r8, %r8
orq %r8, %rdi
shlxq %rsi, %rax, %rax
testb $0x40, %dl
movq %rax, %rsi
cmovneq %rcx, %rsi
cmovneq %rax, %rdi
movslq 0x1c(%rsp), %rax
shlq $0x4, %rax
movq 0x90(%rsp,%rax), %rdx
movq 0x98(%rsp,%rax), %rcx
orq %rdi, %rcx
orq %rsi, %rdx
movq %rdx, 0x90(%rsp,%rax)
movq %rcx, 0x98(%rsp,%rax)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x8484
movq (%rsp), %rdi
leaq 0x90(%rsp), %rsi
vzeroupper
callq 0x3f20
movq 0x8(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
retq
nopl (%rax)