LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tscott8706[P]cpp-csv-col-replacer/src/CsvArgs.cpp
// Function: CsvArgs::setOutputData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void CsvArgs::setOutputData(const std::string &data)
{
    if (!isOutputOpen)
    {
        outputFile.open(outputFname.c_str(), std::ofstream::out);
        checkFile(&outputFile, "output");
        isOutputOpen = true;
    }
    outputFile << data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x0, 0x489(%rdi)
jne 0x2922
leaq 0x248(%rbx), %r15
movq 0x468(%rbx), %rsi
movq %r15, %rdi
movl $0x10, %edx
callq 0x2030
movq 0x248(%rbx), %rax
addq -0x18(%rax), %r15
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1722(%rip), %rsi      # 0x400a
leaq 0x1721(%rip), %rdx      # 0x4010
movq %rsp, %r12
movq %r12, %rdi
callq 0x2ad6
movq %r15, %rsi
movq %r12, %rdx
callq 0x276a
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x291b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2130
movb $0x1, 0x489(%rbx)
addq $0x248, %rbx            # imm = 0x248
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2170
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x295f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rbx, %rdi
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O3/tscott8706[P]cpp-csv-col-replacer/src/CsvProcessor.cpp
// Function: CsvProcessor::findColToReplace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int CsvProcessor::findColToReplace(const std::string &headerName)
{
    getColHeaders();

    int colNum = COL_NOT_FOUND;
    std::istringstream colHeaderProcessor(colHeaders);
    std::string colHeader;

    while (getline(colHeaderProcessor, colHeader, ','))
    {
        if (colHeader == headerName)
        {
            colNum = numCols;
        }
        numCols++;
    }

    if (colNum == COL_NOT_FOUND)
    {
        throw std::invalid_argument("column name doesn't exist in the input "
            "data\n");
    }

    return colNum;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r15
movq %rdi, %r14
callq 0x3288
movl 0x2c(%r14), %ebx
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x21d0
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0x2c, %edx
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2dca
movq 0x10(%rsp), %rdx
cmpq 0x8(%r15), %rdx
jne 0x2db6
testq %rdx, %rdx
je 0x2dbc
movq (%r15), %rsi
movq 0x8(%rsp), %rdi
callq 0x2140
testl %eax, %eax
movl 0x28(%r14), %eax
cmovel %eax, %ebx
jmp 0x2dc2
movl 0x28(%r14), %eax
jmp 0x2dc2
movl 0x28(%r14), %eax
movl %eax, %ebx
incl %eax
movl %eax, 0x28(%r14)
jmp 0x2d70
cmpl 0x2c(%r14), %ebx
je 0x2e19
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2de7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x31e2(%rip), %rsi      # 0x5fd0
leaq 0x28(%rsp), %rdi
callq 0x2190
leaq 0xa0(%rsp), %rdi
callq 0x2090
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0x126e(%rip), %rsi      # 0x409b
movq %rax, %rdi
callq 0x2240
movq 0x31ac(%rip), %rsi      # 0x5fe8
movq 0x3195(%rip), %rdx      # 0x5fd8
movq %r14, %rdi
callq 0x21f0
jmp 0x2e5a
movq %rax, %rbx
movq %r14, %rdi
callq 0x20f0
jmp 0x2e5d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2e74
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x3155(%rip), %rsi      # 0x5fd0
leaq 0x28(%rsp), %rdi
callq 0x2190
leaq 0xa0(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/tscott8706[P]cpp-csv-col-replacer/src/CsvProcessor.cpp
// Function: CsvProcessor::checkedGetNextWord(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void CsvProcessor::checkedGetNextWord(std::string &word,
    std::istringstream &colProcessor, const std::string &line,
    bool expectedResult)
{
    bool result = !getline(colProcessor, word, ',').eof();
    if (result != expectedResult)
    {
        throw std::invalid_argument("Input file is malformed.  " +
            line + " has a different number of columns.  word is " + word);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movl %r8d, %ebx
movq %rcx, %r15
movq %rdx, %rdi
movq %rsi, %r14
movl $0x2c, %edx
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movb 0x20(%rax,%rcx), %al
andb $0x2, %al
shrb %al
cmpb %bl, %al
je 0x334e
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %rbx
leaq 0xd7a(%rip), %rsi       # 0x40dc
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x29b8
leaq 0xd81(%rip), %rsi       # 0x40f7
leaq 0x8(%rsp), %rdi
callq 0x2250
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x33a1
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x33ae
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x48(%rsp), %rdi
movq %r14, %rdx
callq 0x34f8
movb $0x1, %bpl
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x2200
xorl %ebp, %ebp
movq 0x2bf8(%rip), %rsi      # 0x5fe8
movq 0x2be1(%rip), %rdx      # 0x5fd8
movq %rbx, %rdi
callq 0x21f0
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3425
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x3425
movq %rax, %r14
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x343c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3457
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
testb %bpl, %bpl
jne 0x3481
jmp 0x3489
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3481
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x3481
movq %rax, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O3/tscott8706[P]cpp-csv-col-replacer/src/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    CsvArgs args(argc, argv);
    CsvProcessor processor(args.getInputData());
    std::string output = processor.replaceColVals(args.getColToOverwrite(),
        args.getColReplaceVal());
    args.setOutputData(output);
    return 0;
}

// Assembly:
pushq %rbx
subq $0x520, %rsp            # imm = 0x520
movq %rsi, %rdx
movl %edi, %esi
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x237c
movq %rbx, %rdi
callq 0x26b0
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x2b6c
leaq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x2968
movq %rsp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x298a
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
callq 0x2b92
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35da
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35f5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x90(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2896
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3622
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x363d
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x90(%rsp), %rdi
callq 0x25cc
xorl %eax, %eax
addq $0x520, %rsp            # imm = 0x520
popq %rbx
retq
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36b0
movq 0x50(%rsp), %rsi
jmp 0x36a3
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3690
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x3690
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36b0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x36b0
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36d0
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x36d0
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x25cc
movq %rbx, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/include/utils/StringHelper.h
// Function: abcdl::utils::StringHelper::real2str[abi:cxx11](float)
std::string StringHelper::real2str(real f){
    std::stringstream ss;
    std::string s;
    ss << f;
    ss >> s;
    return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movss %xmm0, 0x4(%rsp)
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa2e0
leaq 0x10(%rbx), %r15
movq %r15, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq 0x18(%rsp), %rdi
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
callq 0xa6c0
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xa550
movq 0x5fc2f(%rip), %rsi     # 0x6af70
leaq 0x8(%rsp), %rdi
callq 0xa330
leaq 0x88(%rsp), %rdi
callq 0xa140
movq %rbx, %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xb378
callq 0xa440
movq 0x5fbf1(%rip), %rsi     # 0x6af70
leaq 0x8(%rsp), %rdi
callq 0xa330
leaq 0x88(%rsp), %rdi
callq 0xa140
movq %r14, %rdi
callq 0xa780
// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/include/utils/StringHelper.h
// Function: abcdl::utils::StringHelper::strtoupper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string StringHelper::strtoupper(std::string s){
    std::string t = s;
    int i = -1;
    while(t[i++]){
        t[i] = toupper(t[i]);
    }
    return t;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
callq 0x127a4
movq (%rbx), %r14
cmpb $0x0, -0x1(%r14)
je 0xb43d
xorl %r15d, %r15d
movsbl (%r14,%r15), %edi
callq 0xa800
movb %al, (%r14,%r15)
movq (%rbx), %r14
cmpb $0x0, (%r14,%r15)
leaq 0x1(%r15), %r15
jne 0xb421
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/include/utils/StringHelper.h
// Function: abcdl::utils::StringHelper::strtolower(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string StringHelper::strtolower(std::string s){
    std::string t = s;
    int i = -1;
    while(t[i++]){
        t[i] = tolower(t[i]);
    }
    return t;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
callq 0x127a4
movq (%rbx), %r14
cmpb $0x0, -0x1(%r14)
je 0xb4cd
xorl %r15d, %r15d
movsbl (%r14,%r15), %edi
callq 0xa630
movb %al, (%r14,%r15)
movq (%rbx), %r14
cmpb $0x0, (%r14,%r15)
leaq 0x1(%r15), %r15
jne 0xb4b1
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/src/rnn/RNN.cpp
// Function: abcdl::rnn::RNN::write_model(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool RNN::write_model(const std::string& path){
    std::vector<abcdl::algebra::Mat*> models;
    models.push_back(&_U);
    models.push_back(&_W);
    models.push_back(&_V);
    return loader.write<real>(models, path, "RNNMODEL", false);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x70(%r14), %rax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
xorl %esi, %esi
callq 0x250c8
movq 0x8(%rsp), %rsi
leaq 0xa8(%r14), %rax
movq %rax, 0x18(%rsp)
cmpq 0x10(%rsp), %rsi
je 0x23b38
movq %rax, (%rsi)
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x23b4a
movq %rsp, %rdi
leaq 0x18(%rsp), %rdx
callq 0x250c8
movq 0x8(%rsp), %rsi
leaq 0xe0(%r14), %rax
movq %rax, 0x18(%rsp)
cmpq 0x10(%rsp), %rsi
je 0x23b68
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x23b75
movq %rsp, %rdi
leaq 0x18(%rsp), %rdx
callq 0x250c8
leaq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x24d22
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2610f(%rip), %rsi     # 0x49ca1
leaq 0x26110(%rip), %rdx     # 0x49ca9
leaq 0x18(%rsp), %rdi
callq 0x1453a
addq $0x50, %r14
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x247a0
movl %eax, %ebx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x23bd0
callq 0xa440
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x23bdf
callq 0xa440
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x23bed
callq 0xa440
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x23c27
jmp 0x23c27
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c14
callq 0xa440
jmp 0x23c14
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x23c2a
callq 0xa440
jmp 0x23c2a
jmp 0x23c27
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x23c38
callq 0xa440
movq %rbx, %rdi
callq 0xa780
// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/src/rnn/RNN.cpp
// Function: abcdl::rnn::RNN::loss(abcdl::algebra::MatrixSet<float> const&, abcdl::algebra::MatrixSet<float> const&)
real RNN::loss(const abcdl::algebra::MatSet& train_seq_data,
               const abcdl::algebra::MatSet& train_seq_label){

    //L(y, o) = - (1/N)(Sum y_n*log(o_n))

    real loss_value = total_loss(train_seq_data, train_seq_label);
    size_t N = 0;
    
    size_t size = train_seq_label.size();
    for(size_t i = 0; i != size; i++){
        N += train_seq_label[i].rows();
    }

    return loss_value / N;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
callq 0x23ce6
movq 0x8(%rbx), %rax
movq (%rbx), %rcx
subq %rcx, %rax
je 0x23cb3
movss %xmm0, 0x4(%rsp)
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %r13
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x242d4
addq 0x8(%rsp), %r12
movq %r15, %rdi
callq 0x26a2e
incq %r14
cmpq %r14, %r13
jne 0x23c84
testq %r12, %r12
js 0x23cb8
cvtsi2ss %r12, %xmm1
jmp 0x23cce
xorps %xmm1, %xmm1
jmp 0x23cd4
movq %r12, %rax
shrq %rax
andl $0x1, %r12d
orq %rax, %r12
cvtsi2ss %r12, %xmm1
addss %xmm1, %xmm1
movss 0x4(%rsp), %xmm0
divss %xmm1, %xmm0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/maclellant[P]ReliableGoBackN/server.cpp
// Function: receive_success_msg(int, sockaddr_in)
void receive_success_msg(int sockfd, struct sockaddr_in client_addr)
{
    Packet received;
    struct sockaddr_in client_rec;
    socklen_t slen_rec = sizeof(client_addr);
    Timer final_timer = Timer();
    final_timer.start();

    while (1)
    {
        if (final_timer.timeout(SERVER_CLOSE_TIMEOUT_MSEC))
        {
            break;
        }
        int receiver = recvfrom(sockfd, received.buffer, PACKET_SIZE, 0, (struct sockaddr*)&client_rec, &slen_rec);
        if (receiver < 0)
        {          
            if (errno == EWOULDBLOCK)
            {
                errno = 0;
            }
            else
            {
                std::cerr << "Error: Could not receive from client" << std::endl;
                close(sockfd);
                exit(EXIT_FAILURE);
            }
        }
        else if (receiver > 0)
        {
            if (received.type() == GET)
            {
                break;
            }
        }
    }

    std::cout << "FINISHED: Successful GET command completed" << std::endl << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl %edi, %ebx
leaq -0x250(%rbp), %rdi
callq 0x3c80
movl $0x10, -0x2c(%rbp)
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r14
movaps %xmm0, (%r14)
xorl %edi, %edi
movq %r14, %rsi
callq 0x2190
movq %r14, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x37f8
testb %al, %al
jne 0x2f88
leaq -0x250(%rbp), %r14
leaq -0x50(%rbp), %r15
leaq -0x2c(%rbp), %r12
leaq -0x40(%rbp), %r13
movl $0x200, %edx            # imm = 0x200
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %r9
callq 0x2130
testl %eax, %eax
js 0x2f63
je 0x2f77
cmpb $0x2, -0x250(%rbp)
jne 0x2f77
jmp 0x2f88
callq 0x2040
cmpl $0xb, (%rax)
jne 0x3006
movl $0x0, (%rax)
movq %r13, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x37f8
testb %al, %al
je 0x2f3b
movq 0x3039(%rip), %rbx      # 0x5fc8
leaq 0x12b3(%rip), %rsi      # 0x4249
movl $0x2a, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2fe3(%rip), %rdi      # 0x5ff0
leaq 0x11e2(%rip), %rsi      # 0x41f6
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movl %ebx, %edi
callq 0x22b0
movl $0x1, %edi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/maclellant[P]ReliableGoBackN/server.cpp
// Function: send_packet(int, sockaddr_in, Packet&, GremlinInfo&)
int send_packet(int sockfd, struct sockaddr_in client_addr, Packet& packet, GremlinInfo& info)
{
    int result = gremlin(packet.data(), info.corrupt_chance, info.loss_chance, info.delay_chance);
    if (result == FINE)
    {
        std::cout << "SENDING: sequence " << (int)packet.sequence() << "\n";
        std::cout << "DATA:\n";
        std::cout << packet_string(packet, 48);
        std::cout << "\n\n";
        if (sendto(sockfd, packet.buffer, PACKET_SIZE, 0, (struct sockaddr*) &client_addr, sizeof(client_addr)) == -1)
        {
            std::cerr << "Error: could not send packet to client" << std::endl;
            close(sockfd);
            exit(EXIT_FAILURE);
        }
    }

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rcx, %r14
movl %edi, %ebx
movq %rsi, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq 0x6(%rcx), %r13
movl 0x8(%r8), %esi
movl (%r8), %ecx
movl 0x4(%r8), %edx
movq %r13, %rdi
callq 0x3484
movl %eax, %r15d
testl %eax, %eax
jne 0x3423
movl %ebx, -0x2c(%rbp)
movq 0x2cb4(%rip), %rbx      # 0x5fc8
leaq 0xe71(%rip), %rsi       # 0x418c
movl $0x12, %edx
movq %rbx, %rdi
callq 0x21f0
movzbl 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2270
leaq 0xe08(%rip), %rsi       # 0x4144
movl $0x1, %edx
movq %rax, %rdi
callq 0x21f0
leaq 0xe4f(%rip), %rsi       # 0x419f
movl $0x6, %edx
movq %rbx, %rdi
callq 0x21f0
movzwl 0x4(%r14), %eax
cmpw $0x30, %ax
movl $0x30, %ecx
cmovbl %eax, %ecx
movzwl %cx, %ebx
leaq -0x260(%rbp), %r12
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x20f0
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2150
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq %r12, %rdi
callq 0x20c0
leaq (%rax,%rbp), %rdx
addq $-0x260, %rdx           # imm = 0xFDA0
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3908
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x2bfb(%rip), %rdi      # 0x5fc8
callq 0x21f0
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
movl -0x2c(%rbp), %ebx
je 0x33ea
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21e0
movq 0x2bd7(%rip), %rdi      # 0x5fc8
leaq 0xd4b(%rip), %rsi       # 0x4143
movl $0x2, %edx
callq 0x21f0
leaq -0x60(%rbp), %r8
movl $0x200, %edx            # imm = 0x200
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2060
cmpq $-0x1, %rax
je 0x3438
movl %r15d, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2bb1(%rip), %rdi      # 0x5ff0
leaq 0xd60(%rip), %rsi       # 0x41a6
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movl %ebx, %edi
callq 0x22b0
movl $0x1, %edi
callq 0x2210
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x347c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O3/maclellant[P]ReliableGoBackN/util.cpp
// Function: Packet::Packet(unsigned char, unsigned char)
Packet::Packet(uint8_t sequence, uint8_t type)
{
	bzero(buffer, PACKET_SIZE);

	char* segment = (char*)(buffer + 6);
	uint16_t* size = (uint16_t*)(buffer + 4);
	uint16_t* chksum = (uint16_t*)(buffer + 2);
	uint8_t* seq = (uint8_t*)(buffer + 1);
	uint8_t* packet_type = (uint8_t*)(buffer + 0);

	*size = 0;
	*seq = sequence;
	*packet_type = type;
	*chksum = calc_checksum(segment, (uint16_t)*size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
addq $0x4, %rdi
movl $0x1fc, %edx            # imm = 0x1FC
xorl %esi, %esi
callq 0x20f0
movb %r14b, 0x1(%r15)
movb %bl, (%r15)
movw $0x0, 0x2(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: kryoflux_bits_refill(flux_bits&, kryoflux_event&, _IO_FILE*)
bool kryoflux_bits_refill(flux_bits &fb,struct kryoflux_event &ev,FILE *fp) {
    while (fb.avail() <= 24) {
        if (!kryoflux_read(ev,fp))
            return false;

        if (ev.message == MSG_FLUX) {
            long len;

            len = ((((long)ev.flux_interval - (long)fb.shortest) + (long)(fb.dist / 2l)) / (long)fb.dist) + 1l;
            if (len < 1) len = 1;
            if (len > 8) len = 8;

            fb.add((unsigned int)len);
        }
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movb $0x1, %r12b
cmpl $0x18, 0x4(%rdi)
ja 0x3ea7
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ca4
movl %eax, %r12d
testb %al, %al
je 0x3ea7
cmpb $0x1, 0x4(%r14)
jne 0x3ea0
movl (%r14), %ecx
movl 0x8(%r15), %eax
movl 0xc(%r15), %esi
subq %rax, %rcx
movl %esi, %eax
shrl %eax
addq %rcx, %rax
cqto
idivq %rsi
testq %rax, %rax
jg 0x3e89
xorl %eax, %eax
cmpq $0x7, %rax
jl 0x3e94
movl $0x7, %eax
incl %eax
movq %r15, %rdi
movl %eax, %esi
callq 0x3ebe
cmpl $0x19, 0x4(%r15)
jb 0x3e4f
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits::add(unsigned int)
void flux_bits::add(unsigned int len) {
    if (len != 0) {
        left  += len;
        if (left > (sizeof(unsigned int) * 8u)) fprintf(stderr,"flux_bits::add() overrun\n");
        bits <<= len;
        bits  += 1u << (len - 1u);
    }
}

// Assembly:
testl %esi, %esi
je 0x3ef8
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movl 0x4(%rdi), %eax
addl %esi, %eax
movl %eax, 0x4(%rdi)
cmpl $0x21, %eax
jae 0x3ef9
movl (%rbx), %eax
movl %r14d, %ecx
shll %cl, %eax
decb %r14b
movl $0x1, %edx
movl %r14d, %ecx
shll %cl, %edx
addl %eax, %edx
movl %edx, (%rbx)
popq %rbx
popq %r14
popq %rbp
retq
callq 0x22e0
jmp 0x3edc
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits::get(unsigned int)
unsigned int flux_bits::get(unsigned int bc) {
    if (left >= bc) {
        unsigned int r = peek(bc);
        left -= bc;
        return r;
    }
    else {
        fprintf(stderr,"flux_bits::get() overrun\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl %esi, 0x4(%rdi)
jb 0x3f53
movl %esi, %ebx
movq %rdi, %r14
callq 0x3f0e
subl %ebx, 0x4(%r14)
popq %rbx
popq %r14
popq %rbp
retq
callq 0x233e
xorl %eax, %eax
jmp 0x3f4e
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits_mfm_decode_bit(flux_bits&, kryoflux_event&, _IO_FILE*)
int flux_bits_mfm_decode_bit(struct flux_bits &fb,struct kryoflux_event &ev,FILE *fp) {
    unsigned int raw,bit;

    if (fb.avail() < 2) {
        if (!kryoflux_bits_refill(fb,ev,fp))
            return -1;
    }

    raw = fb.peek(2);
    if (raw == 1/*01*/) {
        bit = 1;
    }
    else if (raw == 3/*11*/) {
        fb.get(1);
        return -1;
    }
    else {
        /* 10 if previous bit 0
         * 00 if previous bit 1 */
        raw ^= (1u ^ flux_bits_pbit) << 1u;
        if (raw != 0) {
            fb.get(1);
            return -1;
        }
        bit = 0;
    }

    fb.get(2);
    flux_bits_pbit = bit;
    return bit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, 0x4(%rdi)
ja 0x414f
movq %rbx, %rdi
callq 0x3e32
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x41a6
movq %rbx, %rdi
movl $0x2, %esi
callq 0x3f0e
movl %eax, %r14d
cmpl $0x1, %eax
je 0x417d
cmpl $0x3, %r14d
je 0x4193
movl 0x8028(%rip), %eax      # 0xc198
addl %eax, %eax
xorl %r14d, %eax
xorl %r14d, %r14d
cmpl $0x2, %eax
jne 0x4193
movq %rbx, %rdi
movl $0x2, %esi
callq 0x3f34
movl %r14d, 0x8007(%rip)     # 0xc198
jmp 0x41a6
movq %rbx, %rdi
movl $0x1, %esi
callq 0x3f34
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits_mfm_decode(flux_bits&, kryoflux_event&, _IO_FILE*)
int flux_bits_mfm_decode(struct flux_bits &fb,struct kryoflux_event &ev,FILE *fp) {
    unsigned int byte = 0,i;
    int c;

    if (fb.avail() < 16) {
        if (!kryoflux_bits_refill(fb,ev,fp))
            return -1;
    }

    if (fb.peek(MFM_A1_SYNC_LENGTH) == MFM_A1_SYNC) {
        fb.get(MFM_A1_SYNC_LENGTH);
        flux_bits_pbit = 1; /* last bit of 0xA1 is 1 */
        return -MFM_A1_SYNC_BYTE;
    }

    for (i=0;i < 8;i++) {
        c = flux_bits_mfm_decode_bit(fb,ev,fp);
        if (c < 0 || c >= 2) return -1;
        byte |= (unsigned int)c << (7u - i);
    }

    return byte;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0xf, 0x4(%rdi)
ja 0x41e3
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3e32
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x4247
movq %rbx, %rdi
movl $0x10, %esi
callq 0x3f0e
cmpl $0x4489, %eax           # imm = 0x4489
jne 0x4216
movq %rbx, %rdi
movl $0x10, %esi
callq 0x3f34
movl $0x1, 0x7f8a(%rip)      # 0xc198
movl $0xffffff5f, %r12d      # imm = 0xFFFFFF5F
jmp 0x4247
xorl %r12d, %r12d
movl $0x7, %r13d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x412d
testl %eax, %eax
js 0x4241
movl %r13d, %ecx
shll %cl, %eax
orl %eax, %r12d
addl $-0x1, %r13d
jb 0x421f
jmp 0x4247
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: mfm_crc16fd_update(unsigned short, void const*, unsigned long)
mfm_crc16fd_t mfm_crc16fd_update(mfm_crc16fd_t crc, const void *data, size_t data_len)
{
    const unsigned char *d = (const unsigned char *)data;
    unsigned int tbl_idx;

    while (data_len--) {
        tbl_idx = ((crc >> 8) ^ *d) & 0xff;
        crc = (mfm_crc16fd_table[tbl_idx] ^ (crc << 8)) & 0xffff;
        d++;
    }
    return crc & 0xffff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
testq %rdx, %rdx
je 0x428d
xorl %ecx, %ecx
leaq 0x1113(%rip), %rdi      # 0x5380
movzwl %ax, %r8d
shrl $0x8, %r8d
movzbl (%rsi,%rcx), %r9d
xorl %r8d, %r9d
shll $0x8, %eax
xorw (%rdi,%r9,2), %ax
incq %rcx
cmpq %rcx, %rdx
jne 0x426d
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: kryoflux_parse_stream_nv_pair(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>&, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
void kryoflux_parse_stream_nv_pair(std::string &name,std::string &value,std::vector<unsigned char>::iterator &mi,const std::vector<unsigned char>::iterator mend) {
    name.clear();
    value.clear();

    /* leading space */
    while (mi != mend && *mi == ' ') mi++;

    /* name */
    while (mi != mend) {
        if (*mi == 0) return; /* end of string, return now */
        if (*mi == '=') {
            mi++; /* skip it and break to next loop */
            break;
        }
        if (*mi == ',') {
            mi++; /* skip it and return */
            return;
        }

        name += *mi;
        mi++;
    }

    /* value */
    while (mi != mend) {
        if (*mi == 0) return; /* end of string, return now */
        if (*mi == ',') {
            mi++; /* skip it and return */
            return;
        }

        value += *mi;
        mi++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movq (%rdi), %rcx
movb %al, (%rcx)
movq %rax, 0x8(%rsi)
movq (%rsi), %rcx
movb %al, (%rcx)
movq (%rdx), %rax
cmpq %r14, %rax
je 0x435b
cmpb $0x20, (%rax)
jne 0x435b
incq %rax
movq %rax, (%rbx)
jmp 0x4324
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x438f
cmpl $0x2c, %ecx
je 0x4389
cmpl $0x3d, %ecx
je 0x4362
movsbl %cl, %esi
movq %r12, %rdi
callq 0x2120
movq (%rbx), %rax
incq %rax
movq %rax, (%rbx)
cmpq %r14, %rax
jne 0x4336
jmp 0x4368
incq %rax
movq %rax, (%rbx)
cmpq %r14, %rax
je 0x438f
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x438f
cmpl $0x2c, %ecx
je 0x4389
movsbl %cl, %esi
movq %r15, %rdi
callq 0x2120
movq (%rbx), %rax
jmp 0x4362
incq %rax
movq %rax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: kryoflux_update_stream_info(kryoflux_stream_info&, std::vector<unsigned char, std::allocator<unsigned char>>&)
bool kryoflux_update_stream_info(struct kryoflux_stream_info &si,std::vector<unsigned char> &msg) {
    std::string name,value;

    std::vector<unsigned char>::iterator mi = msg.begin();
    while (mi != msg.end() && *mi != 0) {
        kryoflux_parse_stream_nv_pair(name,value,mi,msg.end());

        if (name == "name")
            si.name = value;
        else if (name == "sck")
            si.sck = atof(value.c_str());
        else if (name == "ick")
            si.ick = atof(value.c_str());
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq -0x70(%rbp), %r14
movq %r14, -0x10(%r14)
xorl %eax, %eax
movq %rax, -0x8(%r14)
movb %al, (%r14)
leaq -0x50(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq (%rsi), %rax
movq %rax, -0x30(%rbp)
movq 0x8(%rsi), %rcx
cmpq %rcx, %rax
je 0x448b
movq %rsi, %rbx
leaq 0x28(%rdi), %rdx
movq %rdx, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
leaq 0x20(%rdi), %r14
leaq -0x80(%rbp), %r15
leaq -0x60(%rbp), %r12
cmpb $0x0, (%rax)
je 0x4475
movq %r15, %rdi
movq %r12, %rsi
leaq -0x30(%rbp), %rdx
callq 0x42f6
movq %r15, %rdi
leaq 0x11ba(%rip), %rsi      # 0x55cf
callq 0x2070
testl %eax, %eax
je 0x445c
movq %r15, %rdi
leaq 0x11ac(%rip), %rsi      # 0x55d4
callq 0x2070
movq %r14, %r13
testl %eax, %eax
je 0x444b
movq %r15, %rdi
leaq 0x119a(%rip), %rsi      # 0x55d8
callq 0x2070
movq -0x40(%rbp), %r13
testl %eax, %eax
jne 0x4468
movq -0x60(%rbp), %rdi
callq 0x21a0
movsd %xmm0, (%r13)
jmp 0x4468
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x20c0
movq 0x8(%rbx), %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jne 0x43f7
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
leaq -0x70(%rbp), %r14
je 0x448b
callq 0x2140
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x4499
callq 0x2140
movb $0x1, %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x44bf
callq 0x2140
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x44d1
callq 0x2140
movq %rbx, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: kryo_fopen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int, unsigned int)
FILE *kryo_fopen(const std::string &cappath,unsigned int track,unsigned int head) {
    std::string path;
    char tmp[128];

    sprintf(tmp,"track%02u.%u.raw",track,head);
    path = cappath + "/" + tmp;

    return fopen(path.c_str(),"rb");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %rbx
leaq -0x50(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
leaq 0xc34(%rip), %rsi       # 0x5141
leaq -0x100(%rbp), %rdi
xorl %eax, %eax
callq 0x2050
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %rdi
callq 0x3c04
leaq 0xc15(%rip), %rsi       # 0x5152
leaq -0x40(%rbp), %rdi
callq 0x2230
leaq -0x40(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x2230
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x457b
movq %rdx, -0x80(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x70(%rbp)
jmp 0x4583
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x80(%rbp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x2190
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x45b7
callq 0x2140
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x45c5
callq 0x2140
movq -0x60(%rbp), %rdi
leaq 0xb8b(%rip), %rsi       # 0x515b
callq 0x2180
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0x45e6
callq 0x2140
movq %rbx, %rax
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x45fb
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x4611
callq 0x2140
jmp 0x4611
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0x461f
callq 0x2140
movq %rbx, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: mfm_find_sync(flux_bits&, kryoflux_event, _IO_FILE*)
bool mfm_find_sync(flux_bits &fb,struct kryoflux_event ev,FILE *fp) {
    do {
        kryoflux_bits_refill(fb,ev,fp);

        while (fb.avail() >= MFM_A1_SYNC_LENGTH) {
            if (fb.peek(MFM_A1_SYNC_LENGTH) == MFM_A1_SYNC) {
                return true;
            }
            else {
                fb.get(1);
            }
        }

        if (!kryoflux_bits_refill(fb,ev,fp))
            break;
    } while (fb.avail() > 0);

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3e32
cmpl $0x10, 0x4(%r15)
jb 0x4677
movq %r15, %rdi
movl $0x10, %esi
callq 0x3f0e
cmpl $0x4489, %eax           # imm = 0x4489
je 0x4696
movq %r15, %rdi
movl $0x1, %esi
callq 0x3f34
cmpl $0xf, 0x4(%r15)
ja 0x464f
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3e32
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0x4698
cmpl $0x0, 0x4(%r15)
jne 0x463a
jmp 0x4698
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits_mfm_skip_sync(flux_bits&, kryoflux_event&, _IO_FILE*)
int flux_bits_mfm_skip_sync(struct flux_bits &fb,struct kryoflux_event &ev,FILE *fp) {
    int count=0,c;

    kryoflux_bits_refill(fb,ev,fp);
    while (fb.avail() >= MFM_A1_SYNC_LENGTH && fb.peek(MFM_A1_SYNC_LENGTH) == MFM_A1_SYNC) {
        c=flux_bits_mfm_decode(fb,ev,fp);
        if (c != -MFM_A1_SYNC_BYTE) {
            if (c < 0) break;
        }

        kryoflux_bits_refill(fb,ev,fp);
        count++;
    }

    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x3e32
xorl %r12d, %r12d
cmpl $0x10, 0x4(%r15)
jb 0x476d
xorl %r12d, %r12d
movq %r15, %rdi
movl $0x10, %esi
callq 0x3f0e
cmpl $0x4489, %eax           # imm = 0x4489
jne 0x476d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x41ae
cmpl $0xffffff5f, %eax       # imm = 0xFFFFFF5F
setne %cl
testl %eax, %eax
sets %al
testb %al, %cl
jne 0x476d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3e32
incl %r12d
cmpl $0xf, 0x4(%r15)
ja 0x4722
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]floppytools/kryocomm.cpp
// Function: flux_bits_mfm_read_sector_id(mfm_sector_id&, flux_bits&, kryoflux_event&, _IO_FILE*)
int flux_bits_mfm_read_sector_id(mfm_sector_id &sid,struct flux_bits &fb,struct kryoflux_event &ev,FILE *fp) {
    unsigned char tmp[8];
    mfm_crc16fd_t check;
    int c;

    sid.clear();

    tmp[0] = (unsigned char)MFM_A1_SYNC_BYTE;
    tmp[1] = (unsigned char)MFM_A1_SYNC_BYTE;
    tmp[2] = (unsigned char)MFM_A1_SYNC_BYTE;
    tmp[3] = (unsigned char)0xFE;

    int track = flux_bits_mfm_decode(fb,ev,fp);
    if (track < 0)
        return -MFM_READ_DECODE_ERROR;
    tmp[4] = sid.track = (unsigned char)track;

    int side = flux_bits_mfm_decode(fb,ev,fp);
    if (side < 0)
        return -MFM_READ_DECODE_ERROR;
    tmp[5] = sid.side = (unsigned char)side;

    int sector = flux_bits_mfm_decode(fb,ev,fp);
    if (sector < 0)
        return -MFM_READ_DECODE_ERROR;
    tmp[6] = sid.sector = (unsigned char)sector;

    int ssize = flux_bits_mfm_decode(fb,ev,fp);
    if (ssize < 0)
        return -MFM_READ_DECODE_ERROR;
    tmp[7] = sid.sector_size_code = (unsigned char)ssize;

    unsigned int crc;
    if ((c=flux_bits_mfm_decode(fb,ev,fp)) < 0)
        return -MFM_READ_DECODE_ERROR;
    crc  = (unsigned int)c << 8;

    if ((c=flux_bits_mfm_decode(fb,ev,fp)) < 0)
        return -MFM_READ_DECODE_ERROR;
    crc += (unsigned int)c;

    check = mfm_crc16fd_update(0xffff,tmp,8);
    if (check != crc)
        return -MFM_CRC_ERROR;

    sid.crc_ok = true;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movb $0x0, 0x4(%rdi)
movl $0x0, (%rdi)
movl $0xfea1a1a1, -0x30(%rbp) # imm = 0xFEA1A1A1
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x41ae
movl $0xfffffeff, %r14d      # imm = 0xFFFFFEFF
testl %eax, %eax
js 0x4908
movb %al, (%rbx)
movb %al, -0x2c(%rbp)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x41ae
testl %eax, %eax
js 0x4908
movb %al, 0x1(%rbx)
movb %al, -0x2b(%rbp)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x41ae
testl %eax, %eax
js 0x4908
movb %al, 0x2(%rbx)
movb %al, -0x2a(%rbp)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x41ae
testl %eax, %eax
js 0x4908
movb %al, 0x3(%rbx)
movb %al, -0x29(%rbp)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x41ae
testl %eax, %eax
js 0x4908
movl %eax, -0x34(%rbp)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x41ae
testl %eax, %eax
js 0x4908
movl -0x34(%rbp), %r9d
shll $0x8, %r9d
movw $0xffff, %cx            # imm = 0xFFFF
xorl %edx, %edx
leaq 0xaaf(%rip), %rsi       # 0x5380
movzwl %cx, %edi
shrl $0x8, %edi
movzbl -0x30(%rbp,%rdx), %r8d
xorl %edi, %r8d
shll $0x8, %ecx
xorw (%rsi,%r8,2), %cx
incq %rdx
cmpq $0x8, %rdx
jne 0x48d1
addl %r9d, %eax
movzwl %cx, %ecx
movl $0xffffff00, %r14d      # imm = 0xFFFFFF00
cmpl %ecx, %eax
jne 0x4908
movb $0x1, 0x4(%rbx)
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/pranavmodx[P]modlang/src/lexer.cpp
// Function: Lexer::readChar()
void Lexer::readChar()
{
	if (readPos >= input.size())
		curChar = 0; // 0 -> end of file
	else
		curChar = input[readPos];

	pos = readPos;
	readPos++;
}

// Assembly:
movl 0x24(%rdi), %eax
movslq %eax, %rcx
cmpq %rcx, 0x8(%rdi)
jbe 0x517a
movq (%rdi), %rdx
movb (%rdx,%rcx), %cl
jmp 0x517c
xorl %ecx, %ecx
movb %cl, 0x28(%rdi)
movl %eax, 0x20(%rdi)
incl %eax
movl %eax, 0x24(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/pranavmodx[P]modlang/src/lexer.cpp
// Function: Lexer::readString[abi:cxx11]()
std::string Lexer::readString()
{
	int start = pos + 1;

	do
	{
		readChar();
	} while (curChar != '"' && curChar != 0);

	// todo: throw error if ending " not found

	return input.substr(start, pos - start);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movslq 0x20(%rsi), %rdx
movq (%rsi), %rcx
movq 0x8(%rsi), %rdi
movslq 0x24(%rsi), %rax
cmpq %rax, %rdi
jbe 0x6c4e
movzbl (%rcx,%rax), %r9d
movq %rax, %r8
incq %r8
leal 0x1(%rax), %r10d
movb %r9b, 0x28(%rsi)
movl %eax, 0x20(%rsi)
movl %r10d, 0x24(%rsi)
cmpl $0x22, %r9d
je 0x6c46
movq %r8, %rax
testl %r9d, %r9d
jne 0x6c19
decl %r8d
movl %r8d, %eax
jmp 0x6c5b
movb $0x0, 0x28(%rsi)
movl %eax, 0x20(%rsi)
leal 0x1(%rax), %ecx
movl %ecx, 0x24(%rsi)
incq %rdx
subl %edx, %eax
movslq %eax, %rcx
movq %rbx, %rdi
callq 0x2150
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/pranavmodx[P]modlang/src/lexer.cpp
// Function: Lexer::readIdentifier[abi:cxx11]()
std::string Lexer::readIdentifier()
{
	int start = pos;

	while (isLetter(curChar))
		readChar();

	return input.substr(start, pos - start);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x20(%rsi), %r12d
movslq %r12d, %r15
movsbl 0x28(%rsi), %ebp
movl %ebp, %edi
callq 0x21c0
cmpl $0x5f, %ebp
je 0x6c9c
testl %eax, %eax
je 0x6ce8
movq %rbx, (%rsp)
movq (%r14), %r13
movq 0x8(%r14), %rbx
movslq 0x24(%r14), %r12
cmpq %r12, %rbx
jbe 0x6cb7
movb (%r13,%r12), %al
jmp 0x6cb9
xorl %eax, %eax
movl %r12d, %ecx
movb %al, 0x28(%r14)
movl %r12d, 0x20(%r14)
incq %r12
incl %ecx
movl %ecx, 0x24(%r14)
movsbl %al, %ebp
movl %ebp, %edi
callq 0x21c0
cmpb $0x5f, %bpl
je 0x6cab
testl %eax, %eax
jne 0x6cab
decl %r12d
movq (%rsp), %rbx
subl %r15d, %r12d
movslq %r12d, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2150
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/pranavmodx[P]modlang/src/lexer.cpp
// Function: Lexer::readNumber[abi:cxx11]()
std::string Lexer::readNumber()
{
	int start = pos;

	while (isDigit(curChar))
		readChar();

	return input.substr(start, pos - start); // check
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rsi), %eax
movslq %eax, %rdx
movsbl 0x28(%rsi), %ecx
addl $-0x30, %ecx
cmpl $0x9, %ecx
ja 0x6d61
movq (%rsi), %rcx
movq 0x8(%rsi), %rdi
movslq 0x24(%rsi), %rax
cmpq %rax, %rdi
jbe 0x6d3a
movb (%rcx,%rax), %r8b
jmp 0x6d3d
xorl %r8d, %r8d
movl %eax, %r9d
movb %r8b, 0x28(%rsi)
movl %eax, 0x20(%rsi)
incq %rax
incl %r9d
movl %r9d, 0x24(%rsi)
movsbl %r8b, %r8d
addl $-0x30, %r8d
cmpl $0xa, %r8d
jb 0x6d2f
decl %eax
subl %edx, %eax
movslq %eax, %rcx
movq %rbx, %rdi
callq 0x2150
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/aempirei[P]Chat-Art/pgmtobrailedux.c
// Function: dither
void dither(int *data, int *error, size_t width, size_t height) {

	int *front;

	size_t sz = width * height;

	front = malloc(sizeof(int) * sz);
	error = malloc(sizeof(int) * sz);

	memset(error, 0, sizeof(int) * sz);

	for(size_t z = 0; z < sz; z++)
		front[z] = ((data[z] >= mid) ? upper : lower) - data[z];

	for(size_t y = 0; y < height; y++) {
		for(size_t x = 0; x < width; x++) {

			int used = (x<width-1)+(y<height-1)+1;
			int e = BIT(front,x,y,width) / used;

			if(x < width - 1) 
				BIT(error,x+1,y,width) += e;
			if(y < height - 1) 
				BIT(error,x,y+1,width) += e;

			//	BIT(error,x,y,width) -= e * used;

		}
	}

	int max = lower;
	int min = upper;

	for(size_t z = 0; z < sz; z++) {
		data[z] += error[z];
		if(data[z] > max)
			max = data[z];
		if(data[z] < min)
			min = data[z];
	}

	for(size_t z = 0; z < sz; z++) {
		data[z] = ((upper - lower) * (data[z] - min) / (max - min)) + lower;
	}

	free(front);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbp
movq %rdx, %r12
movq %rdi, %rbx
movq %rcx, %r14
imulq %rdx, %r14
leaq (,%r14,4), %r13
movq %r13, %rdi
callq 0x10b0
movq %rax, %r15
movl $0x1, %edi
movq %r13, %rsi
callq 0x1080
movq %r14, %r8
testq %r14, %r14
je 0x1363
movl 0x2d60(%rip), %r9d      # 0x40a0
xorl %ecx, %ecx
movl $0x1, %edx
movl (%rbx,%rcx,4), %esi
cmpl %r9d, %esi
movl $0xff, %edi
cmovll %edx, %edi
subl %esi, %edi
movl %edi, (%r15,%rcx,4)
incq %rcx
cmpq %rcx, %r8
jne 0x1347
testq %rbp, %rbp
je 0x1475
movq %rbx, 0x8(%rsp)
movq %r8, 0x10(%rsp)
leaq 0x4(%rax), %rcx
movq %rcx, 0x18(%rsp)
leaq -0x1(%r12), %rdi
leaq -0x1(%rbp), %r8
xorl %r9d, %r9d
movq %rbp, 0x20(%rsp)
testq %r12, %r12
je 0x1409
cmpq %r8, %r9
movl $0x0, %r14d
adcl $0x1, %r14d
movq %r9, %rcx
imulq %r12, %rcx
movq %r15, %rbp
leaq (%r15,%rcx,4), %r13
movq 0x18(%rsp), %rdx
leaq (%rdx,%rcx,4), %rsi
leaq 0x1(%r9), %r10
movq %r10, %rcx
imulq %r12, %rcx
movq %rax, %rbx
leaq (%rax,%rcx,4), %r15
xorl %ecx, %ecx
cmpq %rdi, %rcx
movl %r14d, %r11d
adcl $0x0, %r11d
movl (%r13,%rcx,4), %eax
cltd
idivl %r11d
cmpq %rdi, %rcx
jae 0x13e8
addl %eax, (%rsi,%rcx,4)
cmpq %r8, %r9
jae 0x13f1
addl %eax, (%r15,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x13cd
movq %r10, %r9
movq %rbp, %r15
movq %rbx, %rax
movq 0x20(%rsp), %rbp
jmp 0x140f
incq %r9
movq %r9, %r10
cmpq %rbp, %r10
jne 0x1390
movq 0x10(%rsp), %r8
testq %r8, %r8
movq 0x8(%rsp), %r9
je 0x1475
movl $0x1, %esi
movl $0xff, %edi
xorl %edx, %edx
movl %edi, %ecx
movl (%r9,%rdx,4), %edi
addl (%rax,%rdx,4), %edi
movl %edi, (%r9,%rdx,4)
cmpl %esi, %edi
cmovgl %edi, %esi
cmpl %ecx, %edi
cmovgel %ecx, %edi
incq %rdx
cmpq %rdx, %r8
jne 0x1433
subl %edi, %esi
xorl %ecx, %ecx
movl (%r9,%rcx,4), %eax
subl %edi, %eax
leal (%rax,%rax), %edx
shll $0x8, %eax
subl %edx, %eax
cltd
idivl %esi
incl %eax
movl %eax, (%r9,%rcx,4)
incq %rcx
cmpq %rcx, %r8
jne 0x1456
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030