// File: kaityo256[P]minlex/minlex.cpp
// Function: MinlexSearcher::search[abi:cxx11](Sudoku&)
std::string search(Sudoku &g) {
    min = max;
    std::vector<Sudoku> v;
    std::vector<int> vi;
    for (auto a : perm3) {
      Sudoku g2 = g.perm_rbox(a);
      v.push_back(g2);
      vi.push_back(g2.headbox_index(true));
    }
    Sudoku gt = g.transpose();
    for (auto a : perm3) {
      Sudoku g2 = gt.perm_rbox(a);
      v.push_back(g2);
      vi.push_back(g2.headbox_index(true));
    }
    int hb_min = *std::min_element(vi.begin(), vi.end());
    for (size_t i = 0; i < v.size(); i++) {
      if (vi[i] > hb_min) continue;
      perm_cbox(v[i], hb_min);
    }
    return min.str();
  }

// Assembly:
subq $0x3c8, %rsp            # imm = 0x3C8
movq %rdi, 0x20(%rsp)
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movq %rdi, 0x3c0(%rsp)
movq %rsi, 0x3b8(%rsp)
movq %rdx, 0x3b0(%rsp)
movq 0x3b8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movq %rdi, %rsi
addq $0xf0, %rsi
movl $0xf0, %edx
callq 0x2110
leaq 0x398(%rsp), %rdi
callq 0x3380
leaq 0x380(%rsp), %rdi
callq 0x3390
leaq 0x9452(%rip), %rax      # 0xc170
movq %rax, 0x378(%rsp)
leaq 0x9443(%rip), %rax      # 0xc170
movq %rax, 0x370(%rsp)
leaq 0x9434(%rip), %rax      # 0xc170
addq $0x48, %rax
movq %rax, 0x368(%rsp)
movq 0x370(%rsp), %rax
cmpq 0x368(%rsp), %rax
je 0x2e2c
movq 0x370(%rsp), %rax
movq %rax, 0x360(%rsp)
movq 0x3b0(%rsp), %rsi
movq 0x360(%rsp), %rdx
leaq 0x270(%rsp), %rdi
callq 0x33a0
jmp 0x2d8d
leaq 0x398(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x3630
jmp 0x2da4
leaq 0x270(%rsp), %rdi
movl $0x1, %esi
callq 0x36e0
movl %eax, 0x1c(%rsp)
jmp 0x2dbc
movl 0x1c(%rsp), %eax
movl %eax, 0x260(%rsp)
leaq 0x380(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x36b0
jmp 0x2dde
jmp 0x2de0
movq 0x370(%rsp), %rax
addq $0xc, %rax
movq %rax, 0x370(%rsp)
jmp 0x2d48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x268(%rsp)
movl %eax, 0x264(%rsp)
leaq 0x380(%rsp), %rdi
callq 0x3d50
leaq 0x398(%rsp), %rdi
callq 0x3db0
jmp 0x3022
movq 0x3b0(%rsp), %rsi
leaq 0x170(%rsp), %rdi
callq 0x39c0
jmp 0x2e43
leaq 0x9326(%rip), %rax      # 0xc170
movq %rax, 0x168(%rsp)
leaq 0x9317(%rip), %rax      # 0xc170
movq %rax, 0x160(%rsp)
leaq 0x9308(%rip), %rax      # 0xc170
addq $0x48, %rax
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rax
cmpq 0x158(%rsp), %rax
je 0x2f16
movq 0x160(%rsp), %rax
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rdx
leaq 0x60(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x33a0
jmp 0x2eb6
leaq 0x398(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3630
jmp 0x2eca
leaq 0x60(%rsp), %rdi
movl $0x1, %esi
callq 0x36e0
movl %eax, 0x18(%rsp)
jmp 0x2edf
movl 0x18(%rsp), %eax
movl %eax, 0x5c(%rsp)
leaq 0x380(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
callq 0x36b0
jmp 0x2efb
jmp 0x2efd
movq 0x160(%rsp), %rax
addq $0xc, %rax
movq %rax, 0x160(%rsp)
jmp 0x2e74
leaq 0x380(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x3ac0
movq 0x8(%rsp), %rdi
movq %rax, 0x48(%rsp)
callq 0x3af0
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x3a70
movq %rax, 0x10(%rsp)
jmp 0x2f52
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x3b20
movl (%rax), %eax
movl %eax, 0x58(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
leaq 0x398(%rsp), %rdi
callq 0x3b30
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x2fea
movq 0x38(%rsp), %rsi
leaq 0x380(%rsp), %rdi
callq 0x3b50
movl (%rax), %eax
cmpl 0x58(%rsp), %eax
jle 0x2fb3
jmp 0x2fda
movq 0x38(%rsp), %rsi
leaq 0x398(%rsp), %rdi
callq 0x3c60
movq 0x30(%rsp), %rdi
movq %rax, %rsi
movl 0x58(%rsp), %edx
callq 0x3b70
jmp 0x2fd8
jmp 0x2fda
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x2f75
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x3c80
jmp 0x2ffb
leaq 0x380(%rsp), %rdi
callq 0x3d50
leaq 0x398(%rsp), %rdi
callq 0x3db0
movq 0x28(%rsp), %rax
addq $0x3c8, %rsp            # imm = 0x3C8
retq
movq 0x268(%rsp), %rdi
callq 0x2230
nop