LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: night-shift[P]Srl/src/lib/ToolsStrConv.cpp
// Function: Srl::Tools::type_to_str(Srl::Value const&, std::vector<unsigned char, std::allocator<unsigned char>>&)
size_t Tools::type_to_str(const Value& value, vector<uint8_t>& out)
{
    switch(value.type()) {
        /* defined in Type.h */
        SRL_TYPES_SCALAR(SRL_TYPE_TO_STR)

        default : return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x35b80
movzbl %al, %ecx
movq %rcx, -0x20(%rbp)
subb $0xb, %al
ja 0x6368f
movq -0x20(%rbp), %rax
leaq 0x6c6d(%rip), %rcx      # 0x6a200
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x636b0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63730
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63890
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x639e0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63b40
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63c90
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63df0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x63f40
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x640a0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x641f0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x642e0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x643d0
movq %rax, -0x8(%rbp)
jmp 0x63697
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/ToolsStrConv.cpp
// Function: std::enable_if<(Srl::Type)0 == (Srl::Type)0, unsigned long>::type (anonymous namespace)::conv_type<(Srl::Type)0>(Srl::Value const&, std::vector<unsigned char, std::allocator<unsigned char>>&)
typename enable_if<type == Type::Bool, size_t>::type
    conv_type(const Value& value, vector<uint8_t>& out)
    {
        const char* str = value.pblock().ui64 ? str_true : str_false;
        size_t size = (value.pblock().ui64 ? sizeof(str_true) : sizeof(str_false)) - 1;

        Aux::copy_to_vec(out, (const uint8_t*)str, size);

        return size;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x34bd0
movq (%rax), %rdx
leaq 0x6b72(%rip), %rax      # 0x6a245
leaq 0x6b66(%rip), %rcx      # 0x6a240
cmpq $0x0, %rdx
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x34bd0
movq (%rax), %rdx
movl $0x6, %eax
movl $0x5, %ecx
cmpq $0x0, %rdx
cmovneq %rcx, %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x36ef0
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: night-shift[P]Srl/src/lib/ToolsStrConv.cpp
// Function: std::enable_if<Srl::TpTools::is_num(Srl::Type)((Srl::Type)1) && !Srl::TpTools::is_fp(Srl::Type)((Srl::Type)1), unsigned long>::type (anonymous namespace)::conv_type<(Srl::Type)1>(Srl::Value const&, std::vector<unsigned char, std::allocator<unsigned char>>&)
typename enable_if<TpTools::is_num(TP) && !TpTools::is_fp(TP), size_t>::type
    conv_type(const Value& value, vector<uint8_t>& out)
    {
        typedef typename TpTools::Real<TP>::type T;
        const auto buffer_size = size_t(numeric_limits<T>::digits10) + 1 + TpTools::is_signed(TP);

        uint8_t buffer[buffer_size];

        bool negative = TpTools::is_signed(TP) && value.pblock().i64 < 0;

        uint64_t val = negative ? -value.pblock().i64 : value.pblock().ui64;

        if(val == 0) {
            if(out.size() < 1) out.resize(1);
            out[0] = '0';
            return 1;
        }

        size_t str_len = 0;
        auto* ptr = buffer + buffer_size - 1;

        for(; val > 0U;
            val /= 10U, ptr--, str_len++) {

            *ptr = '0' + val % 10;
        }

        if(negative) {
            *(ptr) = '-';
            str_len++;
        } else {
            ptr++;
        }

        Aux::copy_to_vec(out, ptr, str_len);

        return str_len;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x4, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x34bd0
cmpq $0x0, (%rax)
setl %al
andb $0x1, %al
movb %al, -0x25(%rbp)
testb $0x1, -0x25(%rbp)
je 0x6377a
movq -0x10(%rbp), %rdi
callq 0x34bd0
movq %rax, %rcx
xorl %eax, %eax
subq (%rcx), %rax
movq %rax, -0x48(%rbp)
jmp 0x6378a
movq -0x10(%rbp), %rdi
callq 0x34bd0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x637d3
movq -0x18(%rbp), %rdi
callq 0x37840
cmpq $0x1, %rax
jae 0x637b6
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x35f00
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x33120
movb $0x30, (%rax)
movq $0x1, -0x8(%rbp)
jmp 0x63878
movq $0x0, -0x38(%rbp)
leaq -0x24(%rbp), %rax
addq $0x4, %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x30(%rbp)
jbe 0x63838
movq -0x30(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
addq $0x30, %rdx
movb %dl, %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
movq -0x30(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x637eb
testb $0x1, -0x25(%rbp)
je 0x63853
movq -0x40(%rbp), %rax
movb $0x2d, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6385f
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x36ef0
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/ToolsStrConv.cpp
// Function: std::enable_if<Srl::TpTools::is_fp(Srl::Type)((Srl::Type)9), unsigned long>::type (anonymous namespace)::conv_type<(Srl::Type)9>(Srl::Value const&, std::vector<unsigned char, std::allocator<unsigned char>>&)
typename enable_if<TpTools::is_fp(type), size_t>::type
    conv_type(const Value& value, vector<uint8_t>& out)
    {
        double val = type == Type::FP64 ? value.pblock().fp64 : value.pblock().fp32;

        if(floor(val) == val && val <= (double)numeric_limits<int64_t>::max() && val >= numeric_limits<int64_t>::min()) {

            return conv_type<Type::I64>((int64_t)val, out);
        }

        if(out.size() < 24) {
            out.resize(24);
        }

        return fpconv_dtoa(val, (char*)out.data());
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x34bd0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x37eb0
ucomisd -0x20(%rbp), %xmm0
jne 0x64291
jp 0x64291
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x358c0
movsd -0x48(%rbp), %xmm1
cvtsi2sd %rax, %xmm0
ucomisd %xmm1, %xmm0
jb 0x64291
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0x37d80
movsd -0x50(%rbp), %xmm0
cvtsi2sd %rax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x64291
cvttsd2si -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x34be0
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x63f40
movq %rax, -0x8(%rbp)
jmp 0x642d4
movq -0x18(%rbp), %rdi
callq 0x37840
cmpq $0x18, %rax
jae 0x642ae
movq -0x18(%rbp), %rdi
movl $0x18, %esi
callq 0x35f00
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x36f40
movsd -0x58(%rbp), %xmm0
movq %rax, %rdi
callq 0x33aa0
cltq
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop
// File: night-shift[P]Srl/src/lib/ToolsStrConv.cpp
// Function: (anonymous namespace)::get_charset_string(Srl::Encoding)
const char* get_charset_string(Encoding encoding)
    {
        static const char str_utf8[] = "UTF-8", str_utf16[] = "UTF-16LE", str_utf32[] = "UTF-32LE";

        const char* rslt = nullptr;

        switch(encoding) {
            case Encoding::UTF8    : rslt = str_utf8;  break;
            case Encoding::UTF16   : rslt = str_utf16; break;
            case Encoding::UTF32   : rslt = str_utf32; break;
            case Encoding::Unknown : rslt = nullptr;   break;
        }

        return rslt;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %dil, %al
movb %al, -0x1(%rbp)
movq $0x0, -0x10(%rbp)
movzbl -0x1(%rbp), %eax
movq %rax, -0x18(%rbp)
subq $0x3, %rax
ja 0x64c63
movq -0x18(%rbp), %rax
leaq 0x5605(%rip), %rcx      # 0x6a230
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5615(%rip), %rax      # 0x6a250
movq %rax, -0x10(%rbp)
jmp 0x64c63
leaq 0x560e(%rip), %rax      # 0x6a256
movq %rax, -0x10(%rbp)
jmp 0x64c63
leaq 0x560a(%rip), %rax      # 0x6a25f
movq %rax, -0x10(%rbp)
jmp 0x64c63
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: night-shift[P]Srl/src/lib/Tree.cpp
// Function: Srl::Tree::operator=(Srl::Tree&&)
Tree& Tree::operator= (Tree&& g)
{
    this->root_node = g.root_node;
    this->env       = move(g.env);
    if(this->env) {
        this->env->tree = this;
    }
    g.root_node = nullptr;

    return *this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdi)
movq -0x10(%rbp), %rsi
callq 0x36b50
movq -0x18(%rbp), %rdi
callq 0x34720
testb $0x1, %al
jne 0x662cc
jmp 0x662dc
movq -0x18(%rbp), %rdi
callq 0x36450
movq -0x18(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq $0x0, 0x8(%rcx)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/Tree.cpp
// Function: Srl::Tree::create_env(Srl::Type)
void Tree::create_env(Type tp)
{
    assert(!this->env);

    if(tp != Srl::Type::Object && tp != Srl::Type::Array) {
        tp = Srl::Type::Object;
    }

    this->env = unique_ptr<Environment>(new Environment(*this));
    this->root_node = &env->create_node(tp, "")->field;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x34720
xorb $-0x1, %al
testb $0x1, %al
jne 0x66387
jmp 0x66389
jmp 0x663a8
leaq 0x40cf(%rip), %rdi      # 0x6a45f
leaq 0x40d3(%rip), %rsi      # 0x6a46a
movl $0x77, %edx
leaq 0x40d8(%rip), %rcx      # 0x6a47b
callq 0x349a0
cmpb $0xe, -0x9(%rbp)
je 0x663b8
cmpb $0xf, -0x9(%rbp)
je 0x663b8
movb $0xe, -0x9(%rbp)
movl $0x348, %edi            # imm = 0x348
callq 0x35c40
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
callq 0x34120
jmp 0x663d7
movq -0x48(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x37450
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x36b50
leaq -0x18(%rbp), %rdi
callq 0x35a00
movq -0x40(%rbp), %rdi
callq 0x36450
movq %rax, -0x58(%rbp)
movb -0x9(%rbp), %al
movb %al, -0x49(%rbp)
leaq -0x38(%rbp), %rdi
leaq 0x3556(%rip), %rsi      # 0x6996e
callq 0x355e0
movq -0x58(%rbp), %rdi
movb -0x49(%rbp), %al
leaq -0x38(%rbp), %rdx
movzbl %al, %esi
callq 0x337b0
movq %rax, %rcx
movq -0x40(%rbp), %rax
addq $0x8, %rcx
movq %rcx, 0x8(%rax)
addq $0x60, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x348, %esi            # imm = 0x348
callq 0x35d30
movq -0x20(%rbp), %rdi
callq 0x38210
nopl (%rax,%rax)
// File: night-shift[P]Srl/src/lib/Tree.cpp
// Function: Srl::Tree::clear()
void Tree::clear()
{
    if(!this->env) {
        return;
    }

    auto rtp = this->root().scope_type;

    this->env->clear();
    this->root_node = &env->create_node(rtp, "")->field;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x34720
testb $0x1, %al
jne 0x6673f
jmp 0x667a4
movq -0x28(%rbp), %rdi
callq 0x35df0
movq -0x28(%rbp), %rdi
movb 0x50(%rax), %al
movb %al, -0x9(%rbp)
callq 0x36450
movq %rax, %rdi
callq 0x35ed0
movq -0x28(%rbp), %rdi
callq 0x36450
movq %rax, -0x38(%rbp)
movb -0x9(%rbp), %al
movb %al, -0x29(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x31f1(%rip), %rsi      # 0x6996e
callq 0x355e0
movq -0x38(%rbp), %rdi
movb -0x29(%rbp), %al
leaq -0x20(%rbp), %rdx
movzbl %al, %esi
callq 0x337b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
addq $0x8, %rcx
movq %rcx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: night-shift[P]Srl/src/lib/Tree.cpp
// Function: Srl::Tree::to_source(Srl::Type, Srl::Parser&, Srl::Lib::Out::Source, std::function<void ()> const&)
void Tree::to_source(Type type, Parser& parser, Lib::Out::Source source, const function<void()>& store_switch)
{
    if(!this->env) {
        this->create_env();
    }
    this->env->set_output(parser, source);
    this->env->parsing = true;

    auto& name = this->root_node->name();
    this->env->write(Value(type), name);

    store_switch();

    this->env->write(Value(Type::Scope_End), name);

    this->env->parsing = false;
    this->env->out.flush();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rcx, -0x88(%rbp)
movl %esi, %eax
movq -0x88(%rbp), %rsi
movb %r8b, %cl
movq %rsi, -0x10(%rbp)
movb %cl, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %rdx, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x34720
testb $0x1, %al
jne 0x66803
movq -0x80(%rbp), %rdi
movl $0xe, %esi
callq 0x35960
movq -0x80(%rbp), %rdi
callq 0x36450
movq %rax, %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rdx
movzbl -0x38(%rbp), %ecx
callq 0x379e0
movq -0x80(%rbp), %rdi
callq 0x36450
movq %rax, %rcx
movq -0x80(%rbp), %rax
movb $0x1, 0x258(%rcx)
movq 0x8(%rax), %rdi
callq 0x362a0
movq -0x80(%rbp), %rdi
movq %rax, -0x48(%rbp)
callq 0x36450
movq %rax, -0x98(%rbp)
leaq -0x60(%rbp), %rdi
movzbl -0x19(%rbp), %esi
callq 0x33ff0
movq -0x98(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x60(%rbp), %rsi
callq 0x35a70
movq -0x30(%rbp), %rdi
callq 0x35bb0
movq -0x80(%rbp), %rdi
callq 0x36450
movq %rax, -0x90(%rbp)
leaq -0x78(%rbp), %rdi
movl $0x10, %esi
callq 0x33ff0
movq -0x90(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x78(%rbp), %rsi
callq 0x35a70
movq -0x80(%rbp), %rdi
callq 0x36450
movq -0x80(%rbp), %rdi
movb $0x0, 0x258(%rax)
callq 0x36450
movq %rax, %rdi
addq $0x2b0, %rdi            # imm = 0x2B0
callq 0x37c70
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: fpconv_dtoa
int fpconv_dtoa(double d, char dest[24])
{
    char digits[18];

    int str_len = 0;
    bool neg = false;

    if(get_dbits(d) & signmask) {
        dest[0] = '-';
        str_len++;
        neg = true;
    }

    int spec = filter_special(d, dest + str_len);

    if(spec) {
        return str_len + spec;
    }

    int K = 0;
    int ndigits = grisu2(d, digits, &K);

    str_len += emit_digits(digits, ndigits, dest + str_len, K, neg);

    return str_len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl $0x0, -0x34(%rbp)
movb $0x0, -0x35(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x67f80
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
andq %rcx, %rax
cmpq $0x0, %rax
je 0x67efd
movq -0x18(%rbp), %rax
movb $0x2d, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movb $0x1, -0x35(%rbp)
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
callq 0x67fa0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x67f26
movl -0x34(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x67f71
movl $0x0, -0x40(%rbp)
movsd -0x10(%rbp), %xmm0
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x68070
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x18(%rbp), %rdx
movslq -0x34(%rbp), %rax
addq %rax, %rdx
movl -0x40(%rbp), %ecx
movb -0x35(%rbp), %al
andb $0x1, %al
movzbl %al, %r8d
callq 0x68190
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: filter_special
static int filter_special(double fp, char* dest)
{
    if(fp == 0.0) {
        dest[0] = '0';
        return 1;
    }

    uint64_t bits = get_dbits(fp);

    bool nan = (bits & expmask) == expmask;

    if(!nan) {
        return 0;
    }

    if(bits & fracmask) {
        dest[0] = 'n'; dest[1] = 'a'; dest[2] = 'n';

    } else {
        dest[0] = 'i'; dest[1] = 'n'; dest[2] = 'f';
    }

    return 3;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x67fd4
jp 0x67fd4
movq -0x18(%rbp), %rax
movb $0x30, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x6805f
movsd -0x10(%rbp), %xmm0
callq 0x67f80
movq %rax, -0x20(%rbp)
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
andq -0x20(%rbp), %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x68014
movl $0x0, -0x4(%rbp)
jmp 0x6805f
movabsq $0xfffffffffffff, %rax  # imm = 0xFFFFFFFFFFFFF
andq -0x20(%rbp), %rax
cmpq $0x0, %rax
je 0x68041
movq -0x18(%rbp), %rax
movb $0x6e, (%rax)
movq -0x18(%rbp), %rax
movb $0x61, 0x1(%rax)
movq -0x18(%rbp), %rax
movb $0x6e, 0x2(%rax)
jmp 0x68058
movq -0x18(%rbp), %rax
movb $0x69, (%rax)
movq -0x18(%rbp), %rax
movb $0x6e, 0x1(%rax)
movq -0x18(%rbp), %rax
movb $0x66, 0x2(%rax)
movl $0x3, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: grisu2
static int grisu2(double d, char* digits, int* K)
{
    Fp w = build_fp(d);

    Fp lower, upper;
    get_normalized_boundaries(&w, &lower, &upper);

    normalize(&w);

    int k;
    Fp cp = find_cachedpow10(upper.exp, &k);

    w     = multiply(&w,     &cp);
    upper = multiply(&upper, &cp);
    lower = multiply(&lower, &cp);

    lower.frac++;
    upper.frac--;

    *K = -k;

    return generate_digits(&w, &upper, &lower, digits, K);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movsd %xmm0, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd -0x8(%rbp), %xmm0
callq 0x68500
movq %rax, -0x28(%rbp)
movl %edx, -0x20(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x68580
leaq -0x28(%rbp), %rdi
callq 0x686a0
movl -0x40(%rbp), %edi
leaq -0x4c(%rbp), %rsi
callq 0x68710
movq %rax, -0x60(%rbp)
movl %edx, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x687d0
movq %rax, -0x70(%rbp)
movl %edx, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x687d0
movq %rax, -0x80(%rbp)
movl %edx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x687d0
movq %rax, -0x90(%rbp)
movl %edx, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
xorl %ecx, %ecx
subl -0x4c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x688a0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: build_fp
static Fp build_fp(double d)
{
    uint64_t bits = get_dbits(d);

    Fp fp;
    fp.frac = bits & fracmask;
    fp.exp = (bits & expmask) >> 52;

    if(fp.exp) {
        fp.frac += hiddenbit;
        fp.exp -= expbias;

    } else {
        fp.exp = -expbias + 1;
    }

    return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x67f80
movq %rax, -0x20(%rbp)
movabsq $0xfffffffffffff, %rax  # imm = 0xFFFFFFFFFFFFF
andq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
andq -0x20(%rbp), %rax
shrq $0x34, %rax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x68567
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x8(%rbp), %eax
subl $0x433, %eax            # imm = 0x433
movl %eax, -0x8(%rbp)
jmp 0x6856e
movl $0xfffffbce, -0x8(%rbp) # imm = 0xFFFFFBCE
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %edx
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: get_normalized_boundaries
static void get_normalized_boundaries(Fp* fp, Fp* lower, Fp* upper)
{
    upper->frac = (fp->frac << 1) + 1;
    upper->exp  = fp->exp - 1;

    while ((upper->frac & (hiddenbit << 1)) == 0) {
        upper->frac <<= 1;
        upper->exp--;
    }

    int u_shift = 64 - 52 - 2;

    upper->frac <<= u_shift;
    upper->exp = upper->exp - u_shift;


    int l_shift = fp->frac == hiddenbit ? 2 : 1;

    lower->frac = (fp->frac << l_shift) - 1;
    lower->exp = fp->exp - l_shift;


    lower->frac <<= lower->exp - upper->exp;
    lower->exp = upper->exp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
shlq %rcx
addq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movabsq $0x20000000000000, %rax # imm = 0x20000000000000
andq (%rcx), %rax
cmpq $0x0, %rax
jne 0x685e9
movq -0x18(%rbp), %rax
movq (%rax), %rcx
shlq %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x685b6
movl $0xa, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movabsq $0x10000000000000, %rsi # imm = 0x10000000000000
movl $0x1, %eax
movl $0x2, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x20(%rbp), %ecx
shlq %cl, %rax
movq %rax, %rcx
subq $0x1, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: normalize
static void normalize(Fp* fp)
{
    while ((fp->frac & hiddenbit) == 0) {
        fp->frac <<= 1;
        fp->exp--;
    }

    int shift = 64 - 52 - 1;
    fp->frac <<= shift;
    fp->exp -= shift;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rcx
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
andq (%rcx), %rax
cmpq $0x0, %rax
jne 0x686db
movq -0x8(%rbp), %rax
movq (%rax), %rcx
shlq %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x686a8
movl $0xb, -0xc(%rbp)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
movq %rcx, (%rax)
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/powers.h
// Function: find_cachedpow10
static Fp find_cachedpow10(int exp, int* k)
{
    const double one_log_ten = 0.30102999566398114;

    int approx = -(exp + npowers) * one_log_ten;
    int idx = (approx - firstpower) / steppowers;

    while(1) {
        int current = exp + powers_ten[idx].exp + 64;

        if(current < expmin) {
            idx++;
            continue;
        }

        if(current > expmax) {
            idx--;
            continue;
        }

        *k = (firstpower + idx * steppowers);

        return powers_ten[idx];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movsd 0x1d7d(%rip), %xmm0     # 0x6a4a0
movsd %xmm0, -0x28(%rbp)
movl -0x14(%rbp), %ecx
addl $0x57, %ecx
xorl %eax, %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x1d62(%rip), %xmm1     # 0x6a4a0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
subl $0xfffffea4, %eax       # imm = 0xFFFFFEA4
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movslq -0x30(%rbp), %rdx
leaq 0x1d726(%rip), %rcx     # 0x85e90
shlq $0x4, %rdx
addq %rdx, %rcx
addl 0x8(%rcx), %eax
addl $0x40, %eax
movl %eax, -0x34(%rbp)
cmpl $-0x3c, -0x34(%rbp)
jge 0x6878b
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x6875c
cmpl $-0x20, -0x34(%rbp)
jle 0x6879c
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x6875c
movl -0x30(%rbp), %ecx
movl %ecx, %eax
leal -0x15c(,%rax,8), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
leaq 0x1d6d3(%rip), %rcx     # 0x85e90
movups (%rax,%rcx), %xmm0
movaps %xmm0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %edx
popq %rbp
retq
nop
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: multiply
static Fp multiply(Fp* a, Fp* b)
{
    const uint64_t lomask = 0x00000000FFFFFFFF;

    uint64_t ah_bl = (a->frac >> 32)    * (b->frac & lomask);
    uint64_t al_bh = (a->frac & lomask) * (b->frac >> 32);
    uint64_t al_bl = (a->frac & lomask) * (b->frac & lomask);
    uint64_t ah_bh = (a->frac >> 32)    * (b->frac >> 32);

    uint64_t tmp = (ah_bl & lomask) + (al_bh & lomask) + (al_bl >> 32);
    /* round up */
    tmp += 1U << 31;

    Fp fp = {
        ah_bh + (ah_bl >> 32) + (al_bh >> 32) + (tmp >> 32),
        a->exp + b->exp + 64
    };

    return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
imulq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
movl 0x4(%rcx), %ecx
imulq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
imulq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movl 0x4(%rcx), %ecx
imulq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x30(%rbp), %eax
movl -0x38(%rbp), %ecx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
subq $-0x80000000, %rax      # imm = 0x80000000
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
addq %rcx, %rax
movl -0x34(%rbp), %ecx
addq %rcx, %rax
movl -0x4c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x40(%rax,%rcx), %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %edx
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: night-shift[P]Srl/src/lib/fpconv/fpconv.c
// Function: round_digit
static void round_digit(char* digits, int ndigits, uint64_t delta, uint64_t rem, uint64_t kappa, uint64_t frac)
{
    while (rem < frac && delta - rem >= kappa &&
           (rem + kappa < frac || frac - rem > rem + kappa - frac)) {

        digits[ndigits - 1]--;
        rem += kappa;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x31(%rbp)
jae 0x68ba3
movq -0x18(%rbp), %rcx
subq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x31(%rbp)
jb 0x68ba3
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
movb $0x1, %al
cmpq -0x30(%rbp), %rcx
movb %al, -0x32(%rbp)
jb 0x68b9d
movq -0x30(%rbp), %rax
subq -0x20(%rbp), %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
subq -0x30(%rbp), %rcx
cmpq %rcx, %rax
seta %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x68bac
jmp 0x68bd3
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
addb $-0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x68b4b
popq %rbp
retq
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: buildPrefixList(unsigned int*, unsigned int)
PrefixList* buildPrefixList(uint32_t* a, uint32_t a_len) {
	PrefixNode* head = NULL;
	PrefixNode* last = NULL;
	for (int i = 0; i < a_len; i++) {
		uint16_t h16 = _high16(a[i]);
		if (head != NULL) {
			assert(last != NULL);
			if (h16 == last->prefix) {
				last->cnt++;
			} else {
				PrefixNode* last2 = new PrefixNode(NULL, i, 1, h16);
				last->next = last2;
				last = last2;
			}
		} else {
			head = new PrefixNode(NULL, i, 1, h16);
			last = head;
		}
	}

	PrefixList* pl = new PrefixList;
	pl->head = head;
	pl->data = a;
	pl->data_len = a_len;
	return pl;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x4c(%rsp), %eax
jae 0x3bdf
movq 0x50(%rsp), %rax
movslq 0x34(%rsp), %rcx
movl (%rax,%rcx,4), %edi
callq 0x4920
movw %ax, 0x32(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x3b6c
cmpq $0x0, 0x38(%rsp)
je 0x3ab2
jmp 0x3ad1
leaq 0xa54b(%rip), %rdi      # 0xe004
leaq 0xa551(%rip), %rsi      # 0xe011
movl $0x1b, %edx
leaq 0xa554(%rip), %rcx      # 0xe020
callq 0x2120
movzwl 0x32(%rsp), %eax
movq 0x38(%rsp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
jne 0x3af6
movq 0x38(%rsp), %rax
movw 0xc(%rax), %cx
addw $0x1, %cx
movw %cx, 0xc(%rax)
jmp 0x3b6a
movl $0x10, %edi
callq 0x21e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movl 0x34(%rsp), %edx
movzwl 0x32(%rsp), %r8d
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %ecx
callq 0x4930
jmp 0x3b25
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x3b6a
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
movl $0x10, %esi
callq 0x21f0
jmp 0x3c1f
jmp 0x3bcd
movl $0x10, %edi
callq 0x21e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, (%rsp)
movl 0x34(%rsp), %edx
movzwl 0x32(%rsp), %r8d
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %ecx
callq 0x4930
jmp 0x3b9a
movq (%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x3bcd
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
movl $0x10, %esi
callq 0x21f0
jmp 0x3c1f
jmp 0x3bcf
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x3a77
movl $0x18, %edi
callq 0x21e0
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x4c(%rsp), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
addq $0x58, %rsp
retq
movq 0x20(%rsp), %rdi
callq 0x2330
nopl (%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: dumpPrefixList(PrefixList*)
void dumpPrefixList(PrefixList* pl) {
	PrefixNode* n = pl->head;
	while (n != NULL) {
		cout<<n->offset<<"\t"<<n->cnt<<"\t"<<hex<<n->prefix<<endl;
		n = n->next;
	}
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x3cd6
movq 0x8(%rsp), %rax
movl 0x8(%rax), %esi
movq 0xe377(%rip), %rdi      # 0x11fd8
callq 0x2270
movq %rax, %rdi
leaq 0xab26(%rip), %rsi      # 0xe796
callq 0x21d0
movq %rax, %rdi
movq 0x8(%rsp), %rax
movzwl 0xc(%rax), %esi
callq 0x2310
movq %rax, %rdi
leaq 0xab06(%rip), %rsi      # 0xe796
callq 0x21d0
movq %rax, %rdi
leaq 0xce1(%rip), %rsi       # 0x4980
callq 0x2090
movq %rax, %rdi
movq 0x8(%rsp), %rax
movzwl 0xe(%rax), %esi
callq 0x2310
movq %rax, %rdi
movq 0xe309(%rip), %rsi      # 0x11fc8
callq 0x2200
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3c46
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: dumpPrefixList2(PrefixList*)
void dumpPrefixList2(PrefixList* pl) {
	PrefixNode* n = pl->head;
        while (n != NULL) {
		for (int i = n->offset; i < n->offset+n->cnt; i++) {
			cout<<pl->data[i]<<endl;
		}
                n = n->next;
        }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x3d6d
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movq 0x8(%rsp), %rcx
movl 0x8(%rcx), %ecx
movq 0x8(%rsp), %rdx
movzwl 0xc(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jae 0x3d5e
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
movq 0xe29b(%rip), %rdi      # 0x11fd8
callq 0x2270
movq %rax, %rdi
movq 0xe27c(%rip), %rsi      # 0x11fc8
callq 0x2200
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x3d0a
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3cf6
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: intersectPrefixList(PrefixList*, PrefixList*, unsigned int*)
uint32_t intersectPrefixList(PrefixList* a, PrefixList* b, uint32_t* c) {
	uint32_t c_pos = 0;
	PrefixNode* an = a->head;
	PrefixNode* bn = b->head;

	while (an != NULL && bn != NULL) {
		if (an->prefix == bn->prefix) {
			c_pos += intersect(a->data + an->offset, an->cnt, b->data + bn->offset, bn->cnt, c + c_pos, an->prefix);
			an = an->next;
			bn = bn->next;
		} else if (an->prefix < bn->prefix) {
			an = an->next;
		} else {
			bn = bn->next;
		}
	}
	return c_pos;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x10(%rsp)
movb %al, 0x7(%rsp)
je 0x4200
cmpq $0x0, 0x8(%rsp)
setne %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x420d
jmp 0x42e5
movq 0x10(%rsp), %rax
movzwl 0xe(%rax), %eax
movq 0x8(%rsp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
jne 0x42ac
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
shlq $0x2, %rax
addq %rax, %rdi
movq 0x10(%rsp), %rax
movzwl 0xc(%rax), %esi
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
shlq $0x2, %rax
addq %rax, %rdx
movq 0x8(%rsp), %rax
movzwl 0xc(%rax), %ecx
movq 0x20(%rsp), %r8
movl 0x1c(%rsp), %eax
shlq $0x2, %rax
addq %rax, %r8
movq 0x10(%rsp), %rax
movzwl 0xe(%rax), %r9d
callq 0x3d80
addl 0x1c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x42e0
movq 0x10(%rsp), %rax
movzwl 0xe(%rax), %eax
movq 0x8(%rsp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
jge 0x42d1
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x42de
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x42e0
jmp 0x41e5
movl 0x1c(%rsp), %eax
addq $0x38, %rsp
retq
nop
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: prepare_shuffling_dict16()
void prepare_shuffling_dict16() {
	for (int i = 0; i  < 256; i++) {
		int counter = 0;
		char permutation[16];
		memset(permutation, 0xFF, sizeof(permutation));
		for (char b = 0; b < 8; b++) {
			if (getBit(i, b)) {
				permutation[counter++] = 2*b;
				permutation[counter++] = 2*b + 1;
			}
		}
		__m128i mask = _mm_loadu_si128((const __m128i*)permutation);
		shuffle_mask16[i] = mask;
	}
}

// Assembly:
subq $0x48, %rsp
movl $0x0, 0x3c(%rsp)
cmpl $0x100, 0x3c(%rsp)      # imm = 0x100
jge 0x4405
movl $0x0, 0x38(%rsp)
leaq 0x20(%rsp), %rdi
movl $0xff, %esi
movl $0x10, %edx
callq 0x2100
movb $0x0, 0x1f(%rsp)
movsbl 0x1f(%rsp), %eax
cmpl $0x8, %eax
jge 0x43c1
movl 0x3c(%rsp), %edi
movsbl 0x1f(%rsp), %esi
callq 0x42f0
cmpl $0x0, %eax
je 0x43b3
movsbl 0x1f(%rsp), %eax
shll %eax
movb %al, %cl
movl 0x38(%rsp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x38(%rsp)
cltq
movb %cl, 0x20(%rsp,%rax)
movsbl 0x1f(%rsp), %eax
shll %eax
addl $0x1, %eax
movb %al, %cl
movl 0x38(%rsp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x38(%rsp)
cltq
movb %cl, 0x20(%rsp,%rax)
jmp 0x43b5
movb 0x1f(%rsp), %al
addb $0x1, %al
movb %al, 0x1f(%rsp)
jmp 0x435b
leaq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
vmovdqu (%rax), %xmm0
vmovdqa %xmm0, (%rsp)
vmovdqa (%rsp), %xmm0
movq 0xde2b(%rip), %rax      # 0x12210
movslq 0x3c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x432c
addq $0x48, %rsp
retq
nopw (%rax,%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: main3()
int main3() {
	prepare_shuffling_dict16();

	uint16_t A[8] = {1, 3, 7, 19, 23, 31, 37, 41};
	uint16_t B[8] = {2, 4, 7, 19, 24, 31, 39, 40};
	uint16_t* C = new uint16_t[8];
	uint32_t count = intersect_vector16(A, B, C); 
	cout<<"count="<<count<<endl;
	for (int i = 0; i < count; i++) {
		cout<<C[i]<<endl;
	}
	return 0;
}

// Assembly:
subq $0x38, %rsp
callq 0x4320
movq 0x9c70(%rip), %rax      # 0xe090
movq %rax, 0x20(%rsp)
movq 0x9c6c(%rip), %rax      # 0xe098
movq %rax, 0x28(%rsp)
movq 0x9c68(%rip), %rax      # 0xe0a0
movq %rax, 0x10(%rsp)
movq 0x9c64(%rip), %rax      # 0xe0a8
movq %rax, 0x18(%rsp)
movl $0x10, %edi
callq 0x2030
movq %rax, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x49b0
movl %eax, 0x4(%rsp)
movq 0xdb61(%rip), %rdi      # 0x11fd8
leaq 0x9bd4(%rip), %rsi      # 0xe052
callq 0x21d0
movq %rax, %rdi
movl 0x4(%rsp), %esi
callq 0x2270
movq %rax, %rdi
movq 0xdb2f(%rip), %rsi      # 0x11fc8
callq 0x2200
movl $0x0, (%rsp)
movl (%rsp), %eax
cmpl 0x4(%rsp), %eax
jae 0x44e1
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
movq 0xdb1a(%rip), %rdi      # 0x11fd8
movzwl (%rax,%rcx,2), %esi
callq 0x2310
movq %rax, %rdi
movq 0xdaf7(%rip), %rsi      # 0x11fc8
callq 0x2200
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x44a5
xorl %eax, %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: main2()
int main2() {
	uint32_t a[] = {
		0xFED01001,
		0xFED20001,
		0xFED20002,
		0xFED30001,
		0xFED30002,
		0xFED30003,
	};

	uint32_t a_len = sizeof(a)/sizeof(a[0]);


	PrefixList* a_pl = buildPrefixList(a, a_len);
	dumpPrefixList(a_pl);


	
	uint32_t b[] = {
		0xFED01001,
	//	0xFED20001,
	//	0xFED20002,
		0xFED30001,
	//	0xFED30002,
		0xFED30003,
	};

	uint32_t b_len = sizeof(b)/sizeof(b[0]);


	PrefixList* b_pl = buildPrefixList(b, b_len);
	dumpPrefixList(b_pl);


	uint32_t * c = new uint32_t[a_len];
	uint32_t c_cnt = intersectPrefixList(a_pl, b_pl, c);

	cout<<c_cnt<<endl;
	for (int i = 0; i < c_cnt; i++) {
		cout<<hex<<c[i]<<endl;
	}
	return 0;
}

// Assembly:
subq $0x58, %rsp
movq 0x9bb5(%rip), %rax      # 0xe0b0
movq %rax, 0x40(%rsp)
movq 0x9bb1(%rip), %rax      # 0xe0b8
movq %rax, 0x48(%rsp)
movq 0x9bad(%rip), %rax      # 0xe0c0
movq %rax, 0x50(%rsp)
movl $0x6, 0x3c(%rsp)
leaq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0x3a50
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
callq 0x3c30
movq 0x9b84(%rip), %rax      # 0xe0c8
movq %rax, 0x24(%rsp)
movl 0x9b81(%rip), %eax      # 0xe0d0
movl %eax, 0x2c(%rsp)
movl $0x3, 0x20(%rsp)
leaq 0x24(%rsp), %rdi
movl 0x20(%rsp), %esi
callq 0x3a50
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x3c30
movl 0x3c(%rsp), %eax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x41b0
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %esi
movq 0xda13(%rip), %rdi      # 0x11fd8
callq 0x2270
movq %rax, %rdi
movq 0xd9f4(%rip), %rsi      # 0x11fc8
callq 0x2200
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0xc(%rsp), %eax
jae 0x462f
movq 0xd9e6(%rip), %rdi      # 0x11fd8
leaq 0x387(%rip), %rsi       # 0x4980
callq 0x2090
movq %rax, %rdi
movq 0x10(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x2270
movq %rax, %rdi
movq 0xd9ab(%rip), %rsi      # 0x11fc8
callq 0x2200
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x45e1
xorl %eax, %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: main4(int, char**)
int main4(int argc, char* argv[]) {
        string file1 = argv[1];

        uint32_t a_len = 0;
        uint32_t* a = read_sorted_int_from_file(file1, &a_len);

        PrefixList* pl = buildPrefixList(a, a_len);

	dumpPrefixList2(pl);

	return 0;
}

// Assembly:
subq $0x98, %rsp
movl %edi, 0x94(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x2340
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0x4ac0
jmp 0x468c
leaq 0x67(%rsp), %rdi
callq 0x2220
movl $0x0, 0x50(%rsp)
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x20d0
jmp 0x46af
leaq 0x28(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xd780
movq %rax, 0x8(%rsp)
jmp 0x46c5
leaq 0x28(%rsp), %rdi
callq 0x2110
movq 0x8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movl 0x50(%rsp), %esi
callq 0x3a50
movq %rax, (%rsp)
jmp 0x46ed
movq (%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x3ce0
jmp 0x4702
leaq 0x68(%rsp), %rdi
callq 0x2110
xorl %eax, %eax
addq $0x98, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x67(%rsp), %rdi
callq 0x2220
jmp 0x4762
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0x4758
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x2110
leaq 0x68(%rsp), %rdi
callq 0x2110
movq 0x58(%rsp), %rdi
callq 0x2330
nopl (%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: main5()
int main5() {
        prepare_shuffling_dict16();

        uint32_t _A[8] = {16449536, 16449580, 16449914, 16450040, 16450068, 16450264, 16450296, 16450304};
	uint16_t A[8] = {0};
	for (int i = 0; i < 8; i++) {
		A[i] = _low16(_A[i]);
	}

	uint32_t _B[8] = {16449622, 16449724, 16449807, 16449856, 16449861, 16450264, 16450500, 16450581};
        uint16_t B[8] = {0};
	for (int i = 0; i < 8; i++) {
		B[i] = _low16(_B[i]);
	}

        uint16_t* C = new uint16_t[8];
        uint32_t count = intersect_vector16(A, B, C);
        cout<<"count="<<count<<endl;
        for (int i = 0; i < count; i++) {
                cout<<C[i]<<endl;
        }
        return 0;
}

// Assembly:
subq $0x98, %rsp
callq 0x4320
movq 0x995d(%rip), %rax      # 0xe0e0
movq %rax, 0x70(%rsp)
movq 0x9959(%rip), %rax      # 0xe0e8
movq %rax, 0x78(%rsp)
movq 0x9955(%rip), %rax      # 0xe0f0
movq %rax, 0x80(%rsp)
movq 0x994e(%rip), %rax      # 0xe0f8
movq %rax, 0x88(%rsp)
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2100
movl $0x0, 0x5c(%rsp)
cmpl $0x8, 0x5c(%rsp)
jge 0x47fa
movslq 0x5c(%rsp), %rax
movl 0x70(%rsp,%rax,4), %edi
callq 0x49a0
movw %ax, %cx
movslq 0x5c(%rsp), %rax
movw %cx, 0x60(%rsp,%rax,2)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x47cb
movq 0x98ff(%rip), %rax      # 0xe100
movq %rax, 0x30(%rsp)
movq 0x98fb(%rip), %rax      # 0xe108
movq %rax, 0x38(%rsp)
movq 0x98f7(%rip), %rax      # 0xe110
movq %rax, 0x40(%rsp)
movq 0x98f3(%rip), %rax      # 0xe118
movq %rax, 0x48(%rsp)
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2100
movl $0x0, 0x1c(%rsp)
cmpl $0x8, 0x1c(%rsp)
jge 0x4872
movslq 0x1c(%rsp), %rax
movl 0x30(%rsp,%rax,4), %edi
callq 0x49a0
movw %ax, %cx
movslq 0x1c(%rsp), %rax
movw %cx, 0x20(%rsp,%rax,2)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4843
movl $0x10, %edi
callq 0x2030
movq %rax, 0x10(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x49b0
movl %eax, 0xc(%rsp)
movq 0xd738(%rip), %rdi      # 0x11fd8
leaq 0x97ab(%rip), %rsi      # 0xe052
callq 0x21d0
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x2270
movq %rax, %rdi
movq 0xd706(%rip), %rsi      # 0x11fc8
callq 0x2200
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0xc(%rsp), %eax
jae 0x490f
movq 0x10(%rsp), %rax
movslq 0x8(%rsp), %rcx
movq 0xd6ee(%rip), %rdi      # 0x11fd8
movzwl (%rax,%rcx,2), %esi
callq 0x2310
movq %rax, %rdi
movq 0xd6cb(%rip), %rsi      # 0x11fc8
callq 0x2200
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x48cf
xorl %eax, %eax
addq $0x98, %rsp
retq
nopl (%rax)
// File: ralgond[P]SortedListIntersection/./algo_intersection.h
// Function: PrefixNode::PrefixNode(PrefixNode*, unsigned int, unsigned short, unsigned short)
PrefixNode(PrefixNode* next, uint32_t offset, uint16_t cnt, uint16_t prefix) {
                this->next = next;
                this->offset = offset;
                this->cnt = cnt;
                this->prefix = prefix;
        }

// Assembly:
movw %r8w, %ax
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movw %cx, -0x16(%rsp)
movw %ax, -0x18(%rsp)
movq -0x8(%rsp), %rax
movq -0x10(%rsp), %rcx
movq %rcx, (%rax)
movl -0x14(%rsp), %ecx
movl %ecx, 0x8(%rax)
movw -0x16(%rsp), %cx
movw %cx, 0xc(%rax)
movw -0x18(%rsp), %cx
movw %cx, 0xe(%rax)
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: ralgond[P]SortedListIntersection/algo_STTNI.cpp
// Function: intersect_vector16(unsigned short*, unsigned short*, unsigned short*)
inline uint32_t intersect_vector16(uint16_t* A, uint16_t* B, uint16_t* C) {
	uint32_t count = 0;

	__m128i a_v = _mm_loadu_si128((__m128i*)&A[0]);
	__m128i b_v = _mm_loadu_si128((__m128i*)&B[0]);

	__m128i res_v = _mm_cmpestrm(b_v, 8, a_v, 8, _SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_BIT_MASK);
	//__m128i res_v = _mm_cmpistrm(b_v, a_v, _SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_BIT_MASK);
	int r = _mm_extract_epi32(res_v, 0);
	__m128i p = _mm_shuffle_epi8(a_v, shuffle_mask16[r]);
	_mm_storeu_si128((__m128i*)&C[count], p);
	count += _mm_popcnt_u32(r);

	return count;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, -0x18(%rsp)
movq %rsi, -0x20(%rsp)
movq %rdx, -0x28(%rsp)
movl $0x0, -0x2c(%rsp)
movq -0x18(%rsp), %rax
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
vmovdqu (%rax), %xmm0
vmovdqa %xmm0, -0x40(%rsp)
movq -0x20(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
vmovdqu (%rax), %xmm0
vmovdqa %xmm0, -0x50(%rsp)
vmovdqa -0x50(%rsp), %xmm0
vmovdqa -0x40(%rsp), %xmm1
movl $0x8, %edx
movl %edx, %eax
vpcmpestrm $0x1, %xmm1, %xmm0
vmovdqa %xmm0, -0x60(%rsp)
movl -0x60(%rsp), %eax
movl %eax, -0x64(%rsp)
vmovdqa -0x40(%rsp), %xmm1
movq 0xd7df(%rip), %rax      # 0x12210
movslq -0x64(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa (%rax), %xmm0
vmovdqa %xmm1, 0x10(%rsp)
vmovdqa %xmm0, (%rsp)
vmovdqa 0x10(%rsp), %xmm0
vmovdqa (%rsp), %xmm1
vpshufb %xmm1, %xmm0, %xmm0
vmovdqa %xmm0, -0x80(%rsp)
movq -0x28(%rsp), %rax
movl -0x2c(%rsp), %ecx
shlq %rcx
addq %rcx, %rax
vmovdqa -0x80(%rsp), %xmm0
movq %rax, 0x38(%rsp)
vmovdqa %xmm0, 0x20(%rsp)
vmovdqa 0x20(%rsp), %xmm0
movq 0x38(%rsp), %rax
vmovdqu %xmm0, (%rax)
movl -0x64(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
popcntl %eax, %eax
addl -0x2c(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)