LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/main.cpp
// Function: main
int main()
{
    int start = 1;
    bool firstGame = true;

    while (start == 1 || start == 2)
    {
        //create game
        Game donnarV;
        if (firstGame)
        {
            start = donnarV.startMenu();
            if (start == 3)
            {
                return 0;
            }
        }

        //play the game
        donnarV.play(start);

        //play again?
        firstGame = false;
        start = donnarV.startMenu();
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
pushq $0x1
popq %r14
movb $0x1, %r12b
leaq -0x128(%rbp), %rbx
pushq $0x3
popq %r15
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0xe19d
movq %rbx, %rdi
callq 0xbf0c
testb $0x1, %r12b
je 0xe174
movq %rbx, %rdi
callq 0xd73c
movl %eax, %r14d
cmpl $0x3, %eax
jne 0xe174
movb $0x1, %r12b
xorl %r13d, %r13d
movl %r15d, %r14d
jmp 0xe190
movq %rbx, %rdi
movl %r14d, %esi
callq 0xc24c
movq %rbx, %rdi
callq 0xd73c
movl %eax, %r14d
movb $0x1, %r13b
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0xc18c
testb %r13b, %r13b
jne 0xe142
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
callq 0xc18c
movq %rbx, %rdi
callq 0x3300
// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/Player.cpp
// Function: Player::Player()
Player::Player()
{
    state = UNFINISHED;
    incubated = false;
    crewInfected = 1;
    crewDead = 0;
    innocentsShot = 0;
    injectedWrong = false;
    ingredientsFound = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
xorl %eax, %eax
movb %al, 0x28(%rdi)
movl $0x1, 0x24(%rdi)
andq $0x0, 0x2c(%rdi)
movb %al, 0x18(%rdi)
andq $0x0, 0x1c(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::takeItem(Player&, int)
void Space::takeItem(Player& markNelson, int input)
{
    if (markNelson.pack.isFull())
    {
        std::cout << RED
                  << "\nYour pack is full. Discard items you don't need."
                  << RESET << std::endl;
        //won't be able to take anything else, exit search menu
        return;
    }
    else
    {
        std::cout << NARRATOR_COLOR << "\n" << roomItems[input-1]
                  << " added to pack." << RESET << std::endl;
        //add item to pack
        markNelson.pack.addItem(roomItems[input-1]);

        //update ingredient counter if necessary
        checkForIngredient(markNelson, roomItems[input-1]);

        //remove item from room
        auto iterator = roomItems.begin() + input - 1;
        roomItems.erase(iterator);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x96d8
movq 0x7551(%rip), %rdi      # 0x15fc8
testb %al, %al
je 0xeabb
leaq 0x1f21(%rip), %rsi      # 0x109a3
callq 0x31d0
leaq 0x27c5(%rip), %rsi      # 0x11253
movq %rax, %rdi
callq 0x31d0
leaq 0x1616(%rip), %rsi      # 0x100b3
movq %rax, %rdi
callq 0x31d0
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30f0
leaq 0x15d6(%rip), %rsi      # 0x10098
callq 0x31d0
leaq 0x1e56(%rip), %rsi      # 0x10924
movq %rax, %rdi
callq 0x31d0
movslq %r15d, %r13
leaq -0x1(%r13), %r15
shlq $0x5, %r15
movq 0x30(%rbx), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x31b0
leaq 0x278e(%rip), %rsi      # 0x11285
movq %rax, %rdi
callq 0x31d0
leaq 0x15ad(%rip), %rsi      # 0x100b3
movq %rax, %rdi
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
movq 0x30(%rbx), %rsi
addq %r15, %rsi
leaq -0x68(%rbp), %r12
movq %r12, %rdi
callq 0x3250
movq %r14, %rdi
movq %r12, %rsi
callq 0x9700
addq $0x30, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3368
addq (%rbx), %r15
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3250
movq %r14, %rsi
movq %r12, %rdx
callq 0xeba2
leaq -0x48(%rbp), %rdi
callq 0x3368
movq (%rbx), %rax
shlq $0x5, %r13
leaq (%rax,%r13), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0x97c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xeb8f
movq %rax, %rbx
movq %r12, %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3300
// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::checkForIngredient(Player&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Space::checkForIngredient(Player& markNelson, std::string item)
{
    //update counter if we've found an ingredient
    if (std::find(ingredientList.begin(),
        ingredientList.end(), item)
        != ingredientList.end())
    {
        markNelson.ingredientsFound++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x8fbe(%rip), %rdi      # 0x17b70
movq 0x8fbf(%rip), %rsi      # 0x17b78
callq 0x997d
cmpq 0x8fb3(%rip), %rax      # 0x17b78
je 0xebca
incl 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: getwhite(unsigned int)
std::vector<floattype> getwhite(uint size) {
    std::vector<floattype> data(size);
    for (uint k = 0; k < size; ++k)
        data[k] = (1.0 * rand() / (RAND_MAX)) - 0.5;
    return data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, %r14d
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x36e6
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x2377
callq 0x2040
vcvtsi2sd %eax, %xmm1, %xmm0
vdivsd 0x4ca7(%rip), %xmm0, %xmm0 # 0x7008
vaddsd 0x4ca7(%rip), %xmm0, %xmm0 # 0x7010
movq (%rbx), %rax
vmovsd %xmm0, (%rax,%r15,8)
incq %r15
jmp 0x234b
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: getrandomwalk(unsigned int)
std::vector<floattype> getrandomwalk(uint size) {
    std::vector<floattype> data(size);
    data[0] = 0.0;
    for (uint k = 1; k < size; ++k)
        data[k] = (1.0 * rand() / (RAND_MAX)) - 0.5 + data[k - 1];
    return data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, %r14d
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x36e6
movq (%rbx), %rax
andq $0x0, (%rax)
pushq $0x1
popq %r15
cmpq %r14, %r15
jae 0x23de
callq 0x2040
vcvtsi2sd %eax, %xmm1, %xmm0
vdivsd 0x4c47(%rip), %xmm0, %xmm0 # 0x7008
vaddsd 0x4c47(%rip), %xmm0, %xmm0 # 0x7010
movq (%rbx), %rax
vaddsd -0x8(%rax,%r15,8), %xmm0, %xmm0
vmovsd %xmm0, (%rax,%r15,8)
incq %r15
jmp 0x23ab
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: getcin()
std::vector<floattype> getcin() {
    float val;
    std::cin >> val;
    std::vector<floattype> v;
    while (std::cin) {
        v.push_back(val);
        std::cin >> val;
    }
    std::cout << "# Read " << v.size() << " data points. " << std::endl;
    return v;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8bd8(%rip), %r14      # 0xafd8
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x21f0
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x10(%rsp), %r12
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
jne 0x2455
vcvtss2sd 0xc(%rsp), %xmm1, %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6bce
movq %r14, %rdi
movq %r15, %rsi
callq 0x21f0
jmp 0x2422
movq 0x8b6c(%rip), %rdi      # 0xafc8
leaq 0x4bcd(%rip), %rsi      # 0x7030
callq 0x2100
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x20c0
leaq 0x4bb6(%rip), %rsi      # 0x7038
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2080
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x24a5
jmp 0x24a5
movq %rax, %r14
movq %rbx, %rdi
callq 0x6b18
movq %r14, %rdi
callq 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: process(std::vector<double, std::allocator<double>>&, unsigned int, unsigned int, bool)
void process(std::vector<floattype> & data, uint width = 30, uint times = 1,
             bool doslow = true) {
    std::vector<double> timings;
    for (uint i = 0; i < times; ++i) {
        compareallalgos(data, timings, width, doslow);
    }
    std::cout << "#\tslow\t\tvanHerk\t\tlemire\tsimplelemire\t\tgilkimmel"
              << std::endl;
    std::cout << "\t" << timings[0] << "\t" << timings[1] << "\t" << timings[2]
              << "\t" << timings[5] << "\t\t" << timings[3] << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %r15
vmovaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movzbl %cl, %r12d
subl $0x1, %ebx
jb 0x27e4
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %r12d, %ecx
callq 0x24b8
jmp 0x27cd
movq 0x87dd(%rip), %rdi      # 0xafc8
leaq 0x4855(%rip), %rsi      # 0x7047
callq 0x2100
movq %rax, %rdi
callq 0x2080
movq 0x87c2(%rip), %rdi      # 0xafc8
leaq 0x486b(%rip), %rsi      # 0x7078
callq 0x2100
movq (%rsp), %rcx
vmovsd (%rcx), %xmm0
movq %rax, %rdi
callq 0x2190
leaq 0x484f(%rip), %rsi      # 0x7078
movq %rax, %rdi
callq 0x2100
movq (%rsp), %rcx
vmovsd 0x8(%rcx), %xmm0
movq %rax, %rdi
callq 0x2190
leaq 0x482f(%rip), %rsi      # 0x7078
movq %rax, %rdi
callq 0x2100
movq (%rsp), %rcx
vmovsd 0x10(%rcx), %xmm0
movq %rax, %rdi
callq 0x2190
leaq 0x480f(%rip), %rsi      # 0x7078
movq %rax, %rdi
callq 0x2100
movq (%rsp), %rcx
vmovsd 0x28(%rcx), %xmm0
movq %rax, %rdi
callq 0x2190
leaq 0x47ee(%rip), %rsi      # 0x7077
movq %rax, %rdi
callq 0x2100
movq (%rsp), %rcx
vmovsd 0x18(%rcx), %xmm0
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x2080
movq %rsp, %rdi
callq 0x6b18
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28c1
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6b18
movq %rbx, %rdi
callq 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: timings(unsigned int, unsigned int, unsigned int, bool)
void timings(uint width = 50, uint size = 10000, uint times = 500,
             bool doslow = true) {
    std::vector<double> timings;
    for (uint i = 0; i < times; ++i) {
        std::vector<floattype> data = getwhite(size);
        compareallalgos(data, timings, width, doslow);
    }
    std::cout << std::setw(15) << "slow";
    std::cout << std::setw(15) << "vanHerk";
    std::cout << std::setw(15) << "lemire";
    std::cout << std::setw(15) << "gilkimmel";
    std::cout << std::setw(15) << "bitmap";
    std::cout << std::setw(15) << "simplelemire";
    std::cout << std::setw(15) << "lemirew";
    std::cout << std::setw(15) << "monowedge";
    std::cout << std::endl;
    for (int i = 0; i <= 7; ++i) {
        std::cout << std::setw(15) << timings[i];
    }
    std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
movq %rsp, %r15
andq $0x0, 0x10(%r15)
vxorps %xmm0, %xmm0, %xmm0
vmovaps %xmm0, (%r15)
leaq 0x20(%rsp), %r12
movzbl %cl, %r13d
subl $0x1, %ebx
jb 0x292d
movq %r12, %rdi
movl %ebp, %esi
callq 0x232c
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %r13d, %ecx
callq 0x24b8
movq %r12, %rdi
callq 0x6b18
jmp 0x2903
movq 0x8694(%rip), %rbx      # 0xafc8
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x478f(%rip), %rsi      # 0x70da
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x4710(%rip), %rsi      # 0x707a
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x4706(%rip), %rsi      # 0x708f
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x46c5(%rip), %rsi      # 0x706d
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x46bb(%rip), %rsi      # 0x7082
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x46a3(%rip), %rsi      # 0x7089
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x4691(%rip), %rsi      # 0x7096
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
leaq 0x467a(%rip), %rsi      # 0x709e
movq %rbx, %rdi
callq 0x2100
movq 0x8595(%rip), %rbx      # 0xafc8
movq %rbx, %rdi
callq 0x2080
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x2a6b
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x10(%rbx,%rax)
movq (%rsp), %rax
vmovsd (%rax,%r14,8), %xmm0
movq %rbx, %rdi
callq 0x2190
incq %r14
jmp 0x2a3e
movq 0x8556(%rip), %rdi      # 0xafc8
callq 0x2080
movq %rsp, %rdi
callq 0x6b18
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a92
jmp 0x2a92
movq %rax, %rbx
jmp 0x2aa4
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6b18
movq %rsp, %rdi
callq 0x6b18
movq %rbx, %rdi
callq 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: timingsline(std::vector<double, std::allocator<double>>, unsigned int, bool)
void timingsline(std::vector<floattype> data, uint width = 30,
                 bool doslow = false) {
    std::cout << " width = " << width << std::endl;
    clock_t start, finish;
    start = clock();
    if (doslow)
        for (uint i = 0; i < 30; ++i)
            slowmaxmin A(data, width);
    finish = clock();
    std::cout << "slow = "
              << static_cast<double>(finish - start) / CLOCKS_PER_SEC
              << std::endl;
    start = clock();
    for (uint i = 0; i < 30; ++i)
        vanHerkGilWermanmaxmin B(data, width);
    finish = clock();
    std::cout << "vanHerk = "
              << static_cast<double>(finish - start) / CLOCKS_PER_SEC
              << std::endl;
    start = clock();
    for (uint i = 0; i < 30; ++i)
        lemiremaxmin C(data, width);
    finish = clock();
    std::cout << "lemire = "
              << static_cast<double>(finish - start) / CLOCKS_PER_SEC
              << std::endl;
    std::cout << "------------" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movq 0x80ed(%rip), %rdi      # 0xafc8
leaq 0x41c6(%rip), %rsi      # 0x70a8
callq 0x2100
movl %ebx, %esi
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x2080
callq 0x20b0
movq %rax, %r15
testl %ebp, %ebp
je 0x2f29
pushq $0x1e
popq %rbp
leaq 0x8(%rsp), %r12
subl $0x1, %ebp
jb 0x2f29
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x3792
movq %r12, %rdi
callq 0x3888
jmp 0x2f0d
pushq $0x1e
popq %rbp
callq 0x20b0
movq %rax, %r12
movq 0x808d(%rip), %rdi      # 0xafc8
leaq 0x4358(%rip), %rsi      # 0x729a
callq 0x2100
subq %r15, %r12
vcvtsi2sd %r12, %xmm0, %xmm0
vdivsd 0x40c1(%rip), %xmm0, %xmm0 # 0x7018
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x2080
callq 0x20b0
movq %rax, %r15
leaq 0x8(%rsp), %r12
subl $0x1, %ebp
jb 0x2f90
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x38b0
movq %r12, %rdi
callq 0x4e36
jmp 0x2f74
callq 0x20b0
movq %rax, %r12
movq 0x8029(%rip), %rdi      # 0xafc8
leaq 0x410c(%rip), %rsi      # 0x70b2
callq 0x2100
subq %r15, %r12
vcvtsi2sd %r12, %xmm1, %xmm0
vdivsd 0x405d(%rip), %xmm0, %xmm0 # 0x7018
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x2080
pushq $0x1e
popq %rbp
callq 0x20b0
movq %rax, %r15
leaq 0x8(%rsp), %r12
subl $0x1, %ebp
jb 0x2ff7
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x3c8a
movq %r12, %rdi
callq 0x4e0e
jmp 0x2fdb
callq 0x20b0
movq %rax, %rbx
movq 0x7fc2(%rip), %r14      # 0xafc8
leaq 0x40b0(%rip), %rsi      # 0x70bd
movq %r14, %rdi
callq 0x2100
subq %r15, %rbx
vcvtsi2sd %rbx, %xmm1, %xmm0
vdivsd 0x3ff3(%rip), %xmm0, %xmm0 # 0x7018
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x2080
leaq 0x408b(%rip), %rsi      # 0x70c7
movq %r14, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2080
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/fast_random.h
// Function: xorshf96()
unsigned long xorshf96(void) {//period 2^96-1
    unsigned long t;
    x ^= x << 16;
    x ^= x >> 5;
    x ^= x << 1;

    t = x;
    x = y;
    y = z;
    z = t ^ x ^ y;

    return z;
}

// Assembly:
movq 0xaced(%rip), %rax      # 0xd1d0
movq 0xacee(%rip), %rsi      # 0xd1d8
movq 0xacef(%rip), %rdx      # 0xd1e0
movq %rax, %rcx
shlq $0x10, %rcx
movq %rsi, 0xacd1(%rip)      # 0xd1d0
movq %rdx, 0xacd2(%rip)      # 0xd1d8
xorq %rax, %rcx
movq %rcx, %rax
shrq $0x5, %rax
xorq %rcx, %rax
xorq %rax, %rsi
addq %rax, %rax
xorq %rsi, %rax
xorq %rdx, %rax
movq %rax, 0xacba(%rip)      # 0xd1e0
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/interpolation.h
// Function: fit_line(long, long, double, double)
linear_regression fit_line(long fr, long to, double dfr, double dto){
    double a = (to - fr) / (dto - dfr);
    double b = to - (dto * a);
    if (a == -std::numeric_limits<double>::infinity()){
        a = std::numeric_limits<double>::infinity();
    }
    return linear_regression(a,b);
}

// Assembly:
vcvtsi2sd %rsi, %xmm2, %xmm2
subq %rdi, %rsi
vcvtsi2sd %rsi, %xmm3, %xmm3
vsubsd %xmm0, %xmm1, %xmm0
vdivsd %xmm0, %xmm3, %xmm0
vcmplesd 0x6a33(%rip), %xmm0, %k1 # 0x9008
vfnmadd213sd %xmm2, %xmm0, %xmm1 # xmm1 = -(xmm0 * xmm1) + xmm2
vmovsd 0x6a2c(%rip), %xmm0 {%k1} # 0x9010
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/competitor_regression.h
// Function: simple_linear_regression(std::vector<double, std::allocator<double>>&)
linear_regression simple_linear_regression(std::vector<double>& data){
    long double count = data.size();
    long double x_sum = 0;
    long double y_sum = 0;
    long double xx_sum = 0;
    long double xy_sum = 0;

    for(int i = 0; i < data.size(); i++){
        x_sum += data[i];
        y_sum += (long double)i;
        xx_sum += data[i] * data[i];
        xy_sum += (long double)i * data[i];
    }

    double a = ((count * xy_sum) - (x_sum * y_sum)) / ((count * xx_sum) - (x_sum * x_sum));
    double b = (y_sum - (a * x_sum)) / count;
    assert(a >= 0);
    return linear_regression(a,b);
}

// Assembly:
subq $0x38, %rsp
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
fldz
fld %st(0)
fld %st(1)
xorl %edx, %edx
fld %st(2)
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rdx, %rax
je 0x263c
vmovsd (%rcx,%rdx,8), %xmm0
vmovsd %xmm0, 0x30(%rsp)
vmulsd %xmm0, %xmm0, %xmm0
fldl 0x30(%rsp)
fadd %st, %st(1)
movl %edx, 0x4(%rsp)
incq %rdx
fildl 0x4(%rsp)
fadd %st, %st(3)
vmovsd %xmm0, 0x28(%rsp)
fxch %st(5)
faddl 0x28(%rsp)
fxch %st(5)
fmulp %st, %st(1)
faddp %st, %st(3)
jmp 0x2601
xorl %ecx, %ecx
testq %rax, %rax
movq %rax, 0x20(%rsp)
leaq 0x69cb(%rip), %rax      # 0x9018
vxorpd %xmm1, %xmm1, %xmm1
sets %cl
fildll 0x20(%rsp)
fadds (%rax,%rcx,4)
fld %st(2)
fmul %st(2), %st
fxch %st(4)
fmul %st(1), %st
fsubp %st, %st(4)
fld %st(1)
fmul %st(2), %st
fxch %st(5)
fmul %st(1), %st
fsubp %st, %st(5)
fxch %st(3)
fdivp %st, %st(4)
fxch %st(3)
fstpl 0x18(%rsp)
vmovsd 0x18(%rsp), %xmm0
vucomisd %xmm1, %xmm0
jb 0x26a4
vmovsd %xmm0, 0x10(%rsp)
fxch %st(2)
fmull 0x10(%rsp)
fsubrp %st, %st(2)
fdivrp %st, %st(1)
fstpl 0x8(%rsp)
vmovsd 0x8(%rsp), %xmm1
addq $0x38, %rsp
retq
fstp %st(0)
fstp %st(1)
fstp %st(0)
leaq 0x6a1b(%rip), %rdi      # 0x90cc
leaq 0x6a1b(%rip), %rsi      # 0x90d3
leaq 0x6a32(%rip), %rcx      # 0x90f1
pushq $0x19
popq %rdx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/competitor_regression.h
// Function: simple_linear_regression_stable(std::vector<double, std::allocator<double>>&)
linear_regression simple_linear_regression_stable(std::vector<double>& data){
    long double count = data.size();
    long double x_mean = 0;
    long double y_mean = 0;
    long double xx_sum = 0;
    long double xy_sum = 0;

    for(int i = 0; i < data.size(); i++){
        x_mean += data[i];
        y_mean += (long double)i;
    }
    x_mean /= count;
    y_mean /= count;

    for(int i = 0; i < data.size(); i++){
        xx_sum += std::pow<long double>((long double)data[i] - x_mean, 2);
        xy_sum += (long double)(i - y_mean) * (long double)(data[i] - x_mean);
    }

    double a = xy_sum / xx_sum;
    double b = y_mean - (a * x_mean);

    assert(a >= 0);
    return linear_regression(a,b);
}

// Assembly:
subq $0x28, %rsp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
fldz
xorl %edx, %edx
fld %st(0)
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdx, %rcx
je 0x26f8
faddl (%rax,%rdx,8)
movl %edx, 0x4(%rsp)
fxch %st(1)
fiaddl 0x4(%rsp)
incq %rdx
fxch %st(1)
jmp 0x26df
xorl %edx, %edx
testq %rcx, %rcx
movq %rcx, 0x20(%rsp)
leaq 0x690f(%rip), %rsi      # 0x9018
sets %dl
fildll 0x20(%rsp)
fadds (%rsi,%rdx,4)
fdivr %st, %st(1)
fdivrp %st, %st(2)
fldz
xorl %edx, %edx
fld %st(0)
cmpq %rdx, %rcx
je 0x273e
fld %st(2)
fsubrl (%rax,%rdx,8)
fld %st(0)
fmul %st(1), %st
faddp %st, %st(3)
movl %edx, (%rsp)
fld %st(4)
fisubrl (%rsp)
fmulp %st, %st(1)
faddp %st, %st(1)
incq %rdx
jmp 0x271d
fdivp %st, %st(1)
fstpl 0x18(%rsp)
vxorpd %xmm1, %xmm1, %xmm1
vmovsd 0x18(%rsp), %xmm0
vucomisd %xmm1, %xmm0
jb 0x276f
vmovsd %xmm0, 0x10(%rsp)
fmull 0x10(%rsp)
fsubrp %st, %st(1)
fstpl 0x8(%rsp)
vmovsd 0x8(%rsp), %xmm1
addq $0x28, %rsp
retq
fstp %st(0)
fstp %st(0)
leaq 0x6952(%rip), %rdi      # 0x90cc
leaq 0x6952(%rip), %rsi      # 0x90d3
leaq 0x69ab(%rip), %rcx      # 0x9133
pushq $0x33
popq %rdx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/irls.h
// Function: weighted_mean_x(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>&)
long double weighted_mean_x(std::vector<double> data, std::vector<double>& weights){
    long double w_sum = 0;
    long double d_sum = 0;
    for(int i = 0; i < data.size(); i++){
        w_sum += weights[i];
        d_sum += weights[i] * (long double)data[i];
    }
    return d_sum/w_sum;
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq (%rsi), %rdx
fldz
xorl %esi, %esi
fld %st(0)
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rsi, %rcx
je 0x286e
fldl (%rdx,%rsi,8)
fadd %st, %st(2)
fmull (%rax,%rsi,8)
faddp %st, %st(1)
incq %rsi
jmp 0x285a
fdivp %st, %st(1)
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/irls.h
// Function: weighted_mean_y(std::vector<double, std::allocator<double>>&)
long double weighted_mean_y(std::vector<double>& weights){
    long double w_sum = 0;
    long double d_sum = 0;
    for(int i = 0; i < weights.size(); i++){
        w_sum += weights[i];
        d_sum += weights[i] * (long double)i;
    }
    return d_sum/w_sum;
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
fldz
xorl %edx, %edx
fld %st(0)
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdx, %rcx
je 0x289e
fldl (%rax,%rdx,8)
fadd %st, %st(2)
movl %edx, -0x4(%rsp)
incq %rdx
fimull -0x4(%rsp)
faddp %st, %st(1)
jmp 0x2885
fdivp %st, %st(1)
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/irls.h
// Function: weighted_simple_regression(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
linear_regression weighted_simple_regression(std::vector<double>& data, std::vector<double>& weights){
    long double x_mean = weighted_mean_x(data, weights);
    long double y_mean = weighted_mean_y(weights);

    long double top = 0;
    long double bot = 0;
    for(int i = 0; i < data.size(); i++){
        top += weights[i] * (data[i] - x_mean) * ((long double)i - y_mean);
        bot += weights[i] * (data[i] - x_mean) * (data[i] - x_mean);
    }

    double a = top/bot;
    double b = y_mean - (a * x_mean);
    return linear_regression(a,b);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
leaq 0x38(%rsp), %r15
movq %rdi, %r14
movq %rsi, %rbx
movq %r14, %rsi
movq %r15, %rdi
callq 0x4050
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2843
movq %r15, %rdi
fstpt 0x2c(%rsp)
callq 0x6034
movq %rbx, %rdi
callq 0x2871
fldt 0x2c(%rsp)
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq (%rbx), %rdx
fldz
xorl %esi, %esi
fld %st(0)
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rsi, %rcx
je 0x2920
fld %st(2)
fsubrl (%rax,%rsi,8)
fld %st(0)
fmull (%rdx,%rsi,8)
movl %esi, 0xc(%rsp)
fld %st(5)
fisubrl 0xc(%rsp)
fmul %st(1), %st
faddp %st, %st(3)
fmulp %st, %st(1)
faddp %st, %st(2)
incq %rsi
jmp 0x28fa
fdivp %st, %st(1)
fstpl 0x20(%rsp)
vmovsd 0x20(%rsp), %xmm0
vmovsd %xmm0, 0x18(%rsp)
fmull 0x18(%rsp)
fsubrp %st, %st(1)
fstpl 0x10(%rsp)
vmovsd 0x10(%rsp), %xmm1
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/helpers/../exponential_search.h
// Function: exponential_search_lower_bound_linear_head(int, double, std::vector<double, std::allocator<double>>&)
int exponential_search_lower_bound_linear_head(int m, double key, std::vector<double> & data) {
    if(data[m] == key){
        return m;
    }
    int bound = 4;
    int l, r;  // will do binary search in range [l, r)
    if (data[m] >= key) {
        for(int i = 1; i < 4; i++){
            if(data[m-i] < key){
                return m-i;
            }
        }
        int size = m;
        while (bound < size && data[m - bound] > key) {
            bound *= 2;
        }
        l = m - std::min<int>(bound, size);
        r = m - bound / 2;
    } else {
        for(int i = 1; i < 4; i++){
            if(data[m+1] > key){
                return m+i;
            }
        }
        int size = data.size() - m;
        while (bound < size && data[m + bound] < key) {
            bound *= 2;
        }
        l = m + bound / 2;
        r = m + std::min<int>(bound, size);
    }
    return binary_search_lower_bound(l, r, key, data);
}

// Assembly:
movq %rsi, %rdx
movq (%rdx), %rax
movslq %edi, %rsi
vmovsd (%rax,%rsi,8), %xmm1
vucomisd %xmm0, %xmm1
jne 0x29f5
jp 0x29f5
movl %edi, %eax
retq
vucomisd %xmm0, %xmm1
jae 0x2a0b
vmovsd 0x8(%rax,%rsi,8), %xmm1
vucomisd %xmm0, %xmm1
jbe 0x2a5d
incl %edi
jmp 0x29f2
leaq -0x8(%rax,%rsi,8), %r8
movl %esi, %ecx
xorl %esi, %esi
cmpq $0x3, %rsi
je 0x2a2c
incq %rsi
vucomisd (%r8), %xmm0
leaq -0x8(%r8), %r8
jbe 0x2a14
subl %esi, %edi
jmp 0x29f2
pushq $0x4
popq %rsi
cmpl %ecx, %esi
jge 0x2a4c
movl %edi, %r8d
subl %esi, %r8d
movslq %r8d, %r8
vmovsd (%rax,%r8,8), %xmm1
vucomisd %xmm0, %xmm1
jbe 0x2a4c
addl %esi, %esi
jmp 0x2a2f
cmpl %edi, %esi
movl %edi, %ecx
movl %edi, %eax
cmovll %esi, %ecx
sarl %esi
subl %ecx, %eax
negl %esi
jmp 0x2a8f
movq 0x8(%rdx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
subl %edi, %ecx
pushq $0x4
popq %rsi
cmpl %ecx, %esi
jge 0x2a84
leal (%rsi,%rdi), %r8d
movslq %r8d, %r8
vucomisd (%rax,%r8,8), %xmm0
jbe 0x2a84
addl %esi, %esi
jmp 0x2a6d
movl %esi, %eax
sarl %eax
addl %edi, %eax
cmpl %esi, %ecx
cmovll %ecx, %esi
addl %edi, %esi
movl %eax, %edi
jmp 0x409f
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/helpers/../exponential_search.h
// Function: exponential_search_lower_bound_steps(int, double, std::vector<double, std::allocator<double>>&, int&)
int exponential_search_lower_bound_steps(int m, double key, std::vector<double> & data, int & steps) {
    // Continue doubling the bound until it contains the lower bound. Then use
    // binary search.
    steps = 1;
    int bound = 1;
    int l, r;  // will do binary search in range [l, r)
    if (data[m] >= key) {
        int size = m;
        while (bound < size && data[m - bound] >= key) {
            bound *= 2;
            steps++;
        }
        l = m - std::min<int>(bound, size);
        r = m - bound / 2;
    } else {
        int size = data.size() - m;
        while (bound < size && data[m + bound] < key) {
            bound *= 2;
            steps++;
        }
        l = m + bound / 2;
        r = m + std::min<int>(bound, size);
    }
    return binary_search_lower_bound(l, r, key, data);
}

// Assembly:
movl $0x1, (%rdx)
movslq %edi, %rax
movq %rsi, %rcx
movq (%rsi), %r8
vmovsd (%r8,%rax,8), %xmm1
vucomisd %xmm0, %xmm1
jae 0x2afc
movq 0x8(%rcx), %r9
subq %r8, %r9
shrq $0x3, %r9
subl %edi, %r9d
pushq $0x1
popq %rsi
pushq $0x2
popq %rax
cmpl %r9d, %esi
jge 0x2ae3
leal (%rsi,%rdi), %r10d
movslq %r10d, %r10
vucomisd (%r8,%r10,8), %xmm0
jbe 0x2ae3
movl %eax, (%rdx)
addl %esi, %esi
incl %eax
jmp 0x2ac7
pushq $0x2
popq %r8
movl %esi, %eax
cltd
idivl %r8d
movl %eax, %r8d
addl %edi, %r8d
cmpl %esi, %r9d
cmovll %r9d, %esi
jmp 0x2b36
pushq $0x1
popq %rax
pushq $0x2
popq %rsi
movl %edi, %r9d
subl %eax, %r9d
jle 0x2b21
movslq %r9d, %r9
vmovsd (%r8,%r9,8), %xmm1
vucomisd %xmm0, %xmm1
jb 0x2b21
movl %esi, (%rdx)
addl %eax, %eax
incl %esi
jmp 0x2b02
cmpl %edi, %eax
movl %edi, %edx
movl %edi, %r8d
cmovll %eax, %edx
subl %edx, %r8d
pushq $-0x2
popq %rsi
cltd
idivl %esi
movl %eax, %esi
addl %edi, %esi
movl %r8d, %edi
movq %rcx, %rdx
jmp 0x409f
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/helpers/regression_benchmark.h
// Function: benchmark_lookup_linear_regression(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>, linear_regression)
long benchmark_lookup_linear_regression(std::vector<double> & data, std::vector<double> lookups, linear_regression lr){ 
    int data_size = data.size()-1;
    auto start = std::chrono::high_resolution_clock::now();
    
    for(int i = 0; i < lookups.size(); i++){
        long pos = lr.predict(lookups[i]);
        pos = std::max<long>(std::min<long>(pos, data_size), 0);
        DoNotOptimize(exponential_search_lower_bound_linear_head(pos, lookups[i], data));
    }

    auto stop = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);

    return duration.count();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq 0x8(%rdi), %r13
vmovsd %xmm1, 0x8(%rsp)
vmovsd %xmm0, (%rsp)
movq %rsi, %rbx
movq %rdi, %r14
subq (%rdi), %r13
callq 0x2030
shlq $0x1d, %r13
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
movq %rax, %r15
addq %r13, %r12
xorl %r13d, %r13d
sarq $0x20, %r12
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x2bda
vmovsd (%rax,%r13,8), %xmm0
vmovsd (%rsp), %xmm2
movq %r12, %rax
vmovapd %xmm0, %xmm1
vfmadd213sd 0x8(%rsp), %xmm2, %xmm1 # xmm1 = (xmm2 * xmm1) + mem
vcvttsd2si %xmm1, %rcx
cmpq %rcx, %r12
jl 0x2bc1
movq %rcx, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
movq %r14, %rsi
andnl %eax, %ecx, %edi
callq 0x29dc
incq %r13
jmp 0x2b88
callq 0x2030
subq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/helpers/regression_benchmark.h
// Function: perform_benchmark(linear_regression, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&, int)
std::vector<long> perform_benchmark(linear_regression lr, std::vector<double>& data, std::vector<double>& lookups, int num){
    std::vector<long> measurements;
    for (int i = 0; i < num; i++){
        long time = benchmark_lookup_linear_regression(data, lookups, lr);
        measurements.push_back(time);
    }

    std::sort(measurements.begin(), measurements.end());
    return measurements;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
andq $0x0, 0x10(%rdi)
movl %ecx, %eax
sarl $0x1f, %eax
vmovsd %xmm0, 0x8(%rsp)
vxorps %xmm0, %xmm0, %xmm0
leaq 0x20(%rsp), %r12
movq %rdx, %r14
movq %rsi, %r15
vmovsd %xmm1, 0x10(%rsp)
movq %rdi, %rbx
andnl %ecx, %eax, %r13d
vmovups %xmm0, (%rdi)
subl $0x1, %r13d
jb 0x2c76
movq %r12, %rdi
movq %r14, %rsi
callq 0x4050
vmovsd 0x8(%rsp), %xmm0
vmovsd 0x10(%rsp), %xmm1
movq %r15, %rdi
movq %r12, %rsi
callq 0x2b43
movq %r12, %rdi
movq %rax, %rbp
callq 0x6034
movq %rbp, 0x18(%rsp)
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x40d0
jmp 0x2c2f
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x6241
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ca5
leaq 0x20(%rsp), %rdi
movq %rax, %r14
callq 0x6034
jmp 0x2ca8
movq %rax, %r14
movq %rbx, %rdi
callq 0x60ca
movq %r14, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/theil_sen.h
// Function: theil_sen(std::vector<double, std::allocator<double>>&, long)
linear_regression theil_sen(std::vector<double>& data, long max_trails){
    std::vector<double> slopes;
    double a,b;
    long num = (data.size() * (data.size()-1)) / 2;

    for (int i = 0; i < max_trails; i++){
        double a_tmp, b_tmp;
        fit_line(data, rand()%data.size(), rand()%data.size(), a_tmp, b_tmp);
        slopes.push_back(a_tmp);
    }
    a = quickselect(slopes,slopes.size()/2,0,slopes.size()-1);

    std::vector<double> intercepts;
    for (int i = 0; i < max_trails; i++){
        int element = rand()%data.size();
        double intercept = (double)element - (a * data[element]);
        intercepts.push_back(intercept);
    }
    b = quickselect(intercepts,intercepts.size()/2,0,intercepts.size()-1);
    return linear_regression(a,b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x30(%rsp), %r14
movq %rsi, %rax
sarq $0x3f, %rax
vxorpd %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movq %rdi, %rbx
andq $0x0, 0x10(%r14)
andnq %rsi, %rax, %r13
vmovapd %xmm0, (%r14)
movq %r13, %rbp
subq $0x1, %rbp
jb 0x3518
callq 0x2070
movq 0x8(%rbx), %rcx
cltq
xorl %edx, %edx
subq (%rbx), %rcx
sarq $0x3, %rcx
divq %rcx
movq %rdx, %r12
callq 0x2070
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
cltq
xorl %edx, %edx
subq %rcx, %rsi
sarq $0x3, %rsi
divq %rsi
vmovsd (%rcx,%rdx,8), %xmm0
subq %r12, %rdx
vcvtsi2sd %rdx, %xmm2, %xmm1
vsubsd (%rcx,%r12,8), %xmm0, %xmm0
vdivsd %xmm0, %xmm1, %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x4212
jmp 0x34b4
leaq 0x30(%rsp), %rdi
movq 0x8(%rdi), %rcx
subq (%rdi), %rcx
sarq $0x3, %rcx
movq %rcx, %rsi
shrq %rsi
decl %ecx
xorl %edx, %edx
callq 0x4234
vxorpd 0x5aff(%rip){1to2}, %xmm0, %xmm2 # 0x9040
leaq 0x10(%rsp), %r14
vxorpd %xmm1, %xmm1, %xmm1
leaq 0x28(%rsp), %r15
vmovapd %xmm0, 0x50(%rsp)
andq $0x0, 0x10(%r14)
vmovapd %xmm1, (%r14)
vmovapd %xmm2, (%rsp)
subq $0x1, %r13
jb 0x35a9
callq 0x2070
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
cltq
xorl %edx, %edx
subq %rcx, %rsi
sarq $0x3, %rsi
divq %rsi
vmovapd (%rsp), %xmm1
movslq %edx, %rax
vcvtsi2sd %edx, %xmm3, %xmm0
vfmadd231sd (%rcx,%rax,8), %xmm1, %xmm0 # xmm0 = (xmm1 * mem) + xmm0
vmovsd %xmm0, 0x28(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x4212
jmp 0x3564
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rcx
subq (%rdi), %rcx
sarq $0x3, %rcx
movq %rcx, %rsi
shrq %rsi
decl %ecx
xorl %edx, %edx
callq 0x4234
vmovsd %xmm0, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x6034
leaq 0x30(%rsp), %rdi
callq 0x6034
vmovaps 0x50(%rsp), %xmm0
vmovsd (%rsp), %xmm1
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35ff
jmp 0x360e
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x6034
jmp 0x3611
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6034
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/fast_brute_force.h
// Function: build_regression(std::vector<double, std::allocator<double>>&)
linear_regression build_regression(std::vector<double>& data){
    long min_cost = std::numeric_limits<long>::max();
    linear_regression lr_opt;
    
    for(int i = 0; i < data.size(); i++){
        double a,b;
        std::pair<linear_regression, long> p = build_regression_i(data, i);
        linear_regression lr = p.first;
        long cost = p.second;
        if(cost < min_cost){
            min_cost = cost;
            lr_opt = lr;
        }
    }
    return lr_opt;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movabsq $0x7fffffffffffffff, %r12 # imm = 0x7FFFFFFFFFFFFFFF
vxorpd %xmm0, %xmm0, %xmm0
leaq 0x8(%rsp), %r15
vxorpd %xmm1, %xmm1, %xmm1
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x398d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
vmovapd %xmm0, 0x30(%rsp)
vmovapd %xmm1, 0x20(%rsp)
callq 0x362d
movq 0x18(%rsp), %rax
vmovapd 0x20(%rsp), %xmm1
vmovapd 0x30(%rsp), %xmm0
cmpq %r12, %rax
setl %cl
cmovlq %rax, %r12
incq %r14
kmovd %ecx, %k1
vmovsd 0x8(%rsp), %xmm0 {%k1}
vmovsd 0x10(%rsp), %xmm1 {%k1}
jmp 0x392f
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/fast_brute_force.h
// Function: find_min_idx(std::vector<double, std::allocator<double>>&, linear_regression, long)
long find_min_idx(std::vector<double>& data, linear_regression lr, long selfi){
    long min_idx = -1;
    double min_err = std::numeric_limits<double>::infinity();
    for(int i = 0; i < data.size(); i++){
        if(i != selfi){
            double err = calculate_error_single_element<L1Norm, false, false>(data, lr.a, lr.b, i);
            if (err < min_err){
                min_idx = i;
                min_err = err;
            }
        }
    }
    return min_idx;
}

// Assembly:
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
pushq $-0x1
popq %rax
vmovsd 0x565e(%rip), %xmm2     # 0x9010
vmovddup 0x5696(%rip), %xmm3     # xmm3 = mem[0,0]
xorl %edi, %edi
cmpq %rdi, %rdx
je 0x39ed
cmpq %rdi, %rsi
je 0x39e8
vmovsd (%rcx,%rdi,8), %xmm5
vcvtsi2sd %edi, %xmm6, %xmm4
vfmadd213sd %xmm1, %xmm0, %xmm5 # xmm5 = (xmm0 * xmm5) + xmm1
vsubsd %xmm5, %xmm4, %xmm4
vandpd %xmm3, %xmm4, %xmm4
vucomisd %xmm4, %xmm2
vminsd %xmm2, %xmm4, %xmm2
cmovaq %rdi, %rax
incq %rdi
jmp 0x39bc
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/fast_brute_force.h
// Function: build_regression_direct_descent(std::vector<double, std::allocator<double>>&, int)
linear_regression build_regression_direct_descent(std::vector<double>& data, int num){
    srand(time(nullptr));
    long index = rand()%data.size();

    linear_regression lr;
    for(int i = 0; i < num; i++){
        double a,b;
        std::pair<linear_regression, long> p = build_regression_i(data, index);
        lr = p.first;
        long cost = p.second;
        index = find_min_idx(data, lr, index);
        //std::cout << calculate_error<DiscreteLogNorm>(data, lr) << std::endl;
    }
    return lr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %edi, %edi
movl %esi, %ebp
callq 0x21c0
movl %eax, %edi
callq 0x21f0
callq 0x2070
movq 0x8(%rbx), %rcx
cltq
xorl %edx, %edx
vxorps %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %r15
subq (%rbx), %rcx
sarq $0x3, %rcx
divq %rcx
movl %ebp, %eax
sarl $0x1f, %eax
vmovsd %xmm0, 0x8(%rsp)
vmovsd %xmm0, (%rsp)
andnl %ebp, %eax, %ebp
movq %rdx, %r14
subl $0x1, %ebp
jb 0x3a7d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x362d
vmovsd 0x10(%rsp), %xmm0
vmovsd 0x18(%rsp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
vmovsd %xmm0, 0x8(%rsp)
vmovsd %xmm1, (%rsp)
callq 0x3999
movq %rax, %r14
jmp 0x3a43
vmovsd 0x8(%rsp), %xmm0
vmovsd (%rsp), %xmm1
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/helpers/../exponential_search.h
// Function: binary_search_lower_bound(int, int, double, std::vector<double, std::allocator<double>>&)
inline int binary_search_lower_bound(int l, int r, const double key, std::vector<double> & data) {
    while (l < r) {
        int mid = l + (r - l) / 2;
        if (data[mid] >= key) {
            r = mid;    
        } else {
            l = mid + 1;
        }
    }
    return l;
}

// Assembly:
movq (%rdx), %rcx
pushq $0x2
popq %r8
movl %esi, %eax
subl %edi, %eax
jle 0x40cc
cltd
idivl %r8d
leal (%rax,%rdi), %edx
movslq %edx, %r9
vmovsd (%rcx,%r9,8), %xmm1
vucomisd %xmm0, %xmm1
jb 0x40c6
movl %edx, %esi
jmp 0x40a6
leal 0x1(%rax,%rdi), %edi
jmp 0x40a6
movl %edi, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/median.h
// Function: double quickselect<double>(std::vector<double, std::allocator<double>>&, int, int, int)
T quickselect(std::vector<T>& data, int k, int lo, int hi){
    int i = hoare_partition(data, lo, hi, data[(lo+hi)/2]);
    if(i == k){
        return data[i];
    }
    else if(i < k){
        return quickselect(data, k, i+1, hi);
    }
    else{
        return quickselect(data, k, lo, i-1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %rbx
pushq $0x2
popq %r12
leal (%r14,%r15), %eax
movq %rbx, %rdi
movl %r15d, %esi
cltd
idivl %r12d
movq (%rbx), %rcx
movl %r14d, %edx
cltq
vmovsd (%rcx,%rax,8), %xmm0
callq 0x73f0
cmpl %ebp, %eax
je 0x427f
jl 0x4278
decl %eax
movl %eax, %r14d
jmp 0x424b
incl %eax
movl %eax, %r15d
jmp 0x424b
movq (%rbx), %rcx
movslq %ebp, %rax
vmovsd (%rcx,%rax,8), %xmm0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/fast_brute_force.h
// Function: comp_target(long, long, long)
inline long comp_target(long i, long error, long index){
    long target = i;
    if (i < index){
        error += 1;
    }
    if(error > 0){
        target += pow2(error - 1);
    }
    else if(error < 0){
        target -= pow2(-error) - 1;
    }
    return target;
}

// Assembly:
xorl %ecx, %ecx
cmpq %rdx, %rdi
movq %rdi, %rax
setl %cl
addq %rsi, %rcx
jle 0x42e5
decb %cl
pushq $0x1
popq %rdx
shlxq %rcx, %rdx, %rcx
addq %rcx, %rax
retq
js 0x42e8
retq
negb %cl
pushq $-0x1
popq %rdx
shlxq %rcx, %rdx, %rcx
leaq 0x1(%rax,%rcx), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/log_regression.h
// Function: linear_regression create_regression_tournament_selection<(ERROR_TYPE)1, true, true>(std::vector<double, std::allocator<double>>&)
linear_regression create_regression_tournament_selection(std::vector<double>& data){
    long s = std::pow(2, (int)std::ceil(log2(data.size())));
    std::vector<int> tournament;
    tournament.resize(s);
    for (int i = 0; i < s/2; i++){
        int fr = rand() % data.size();
        int to;
        do{
            to = rand() % data.size();
        }while(fr == to);
        tournament[2*i] = fr;
        tournament[2*i + 1] = to;
    }
    double error;
    return create_regression_tournament_selection_recursive<E,ROUND,BOUNDED>(data, tournament, 0, s, error);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq 0x8(%rdi), %rax
movq %rdi, %rbx
subq (%rdi), %rax
sarq $0x3, %rax
vcvtusi2sd %rax, %xmm0, %xmm0
callq 0x2350
vroundsd $0xa, %xmm0, %xmm0, %xmm0
vcvttsd2si %xmm0, %edi
vmovsd 0x4471(%rip), %xmm0     # 0x9058
callq 0x22c0
leaq 0x10(%rsp), %rdi
vcvttsd2si %xmm0, %r14
vxorpd %xmm0, %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
vmovapd %xmm0, (%rdi)
movq %r14, %rsi
callq 0x7adc
pushq $0x2
popq %rcx
movq %r14, %rax
cqto
xorl %r13d, %r13d
idivq %rcx
movq %rax, %rcx
sarq $0x3f, %rcx
andnq %rax, %rcx, %r12
cmpq %r12, %r13
je 0x4c73
callq 0x2070
movq 0x8(%rbx), %rcx
cltq
xorl %edx, %edx
subq (%rbx), %rcx
sarq $0x3, %rcx
divq %rcx
movq %rdx, %r15
callq 0x2070
movq 0x8(%rbx), %rcx
cltq
xorl %edx, %edx
subq (%rbx), %rcx
sarq $0x3, %rcx
divq %rcx
cmpl %edx, %r15d
je 0x4c44
movq 0x10(%rsp), %rax
movl %r15d, (%rax,%r13,8)
movl %edx, 0x4(%rax,%r13,8)
incq %r13
jmp 0x4c25
leaq 0x10(%rsp), %rsi
leaq 0x28(%rsp), %r8
movq %rbx, %rdi
xorl %edx, %edx
movl %r14d, %ecx
callq 0x7b0d
vmovsd %xmm0, 0x8(%rsp)
vmovsd %xmm1, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x7f08
vmovsd 0x8(%rsp), %xmm0
vmovsd (%rsp), %xmm1
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x4cba
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x7f08
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/log_regression.h
// Function: linear_regression create_regression_optimal<(ERROR_TYPE)0, true, true>(std::vector<double, std::allocator<double>>&)
linear_regression create_regression_optimal(std::vector<double>& data){
    double e = INFINITY;
    double a, b;
    for(long fr = 0; fr < data.size(); fr++){
        for(long to = fr+1; to < data.size(); to++){
            double a_tmp;
            double b_tmp;
            fit_line(data, fr, to, a_tmp, b_tmp);
            double error_tmp = calculate_error<E,ROUND,BOUNDED>(data, a_tmp, b_tmp);
            if(error_tmp < e){
                a = a_tmp;
                b = b_tmp;
                e = error_tmp;
            }
        }
    }
    return linear_regression(a,b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
vmovsd 0x31d3(%rip), %xmm0     # 0x9010
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rdi, %rbx
xorl %r15d, %r15d
vmovsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %r14
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %r15
jae 0x5f31
vcvtsi2sd %r15, %xmm1, %xmm0
leaq 0x1(%r15), %r12
movq %r14, %r13
movq %r12, %rbp
vmovsd %xmm0, 0x10(%rsp)
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rbp
jae 0x5f29
vmovsd (%rax,%rbp,8), %xmm2
vmovsd (%rax,%r15,8), %xmm1
vcvtsi2sd %r13, %xmm5, %xmm0
movq %rbx, %rdi
vsubsd %xmm1, %xmm2, %xmm2
vdivsd %xmm2, %xmm0, %xmm0
vfnmadd213sd 0x10(%rsp), %xmm0, %xmm1 # xmm1 = -(xmm0 * xmm1) + mem
vmovapd %xmm0, 0x40(%rsp)
vmovapd %xmm1, 0x50(%rsp)
callq 0x8151
fstpl 0x18(%rsp)
vmovsd 0x18(%rsp), %xmm0
vmovsd 0x8(%rsp), %xmm1
vmovapd 0x30(%rsp), %xmm2
vmovapd 0x40(%rsp), %xmm3
vmovapd 0x20(%rsp), %xmm4
movq 0x8(%rbx), %rcx
vucomisd %xmm0, %xmm1
vminsd %xmm1, %xmm0, %xmm1
vmovsd %xmm1, 0x8(%rsp)
seta %al
incq %rbp
incq %r13
kmovd %eax, %k1
movq (%rbx), %rax
vmovsd %xmm3, %xmm2, %xmm2 {%k1}
vmovapd 0x50(%rsp), %xmm3
vmovapd %xmm2, 0x30(%rsp)
vmovsd %xmm3, %xmm4, %xmm4 {%k1}
vmovapd %xmm4, 0x20(%rsp)
jmp 0x5e7c
movq %r12, %r15
jmp 0x5e54
vmovaps 0x30(%rsp), %xmm0
vmovaps 0x20(%rsp), %xmm1
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/median.h
// Function: int hoare_partition<double>(std::vector<double, std::allocator<double>>&, int, int, double)
int hoare_partition(std::vector<T>& data, int lo, int hi, T pivot){
    int i = lo - 1;
    int j = hi + 1;
    while(true){
        do{
            i += 1;
        }while (data[i] < pivot);
        do{
            j -= 1;
        }while (data[j] > pivot);
        if(i >= j){
            return j;
        }
        std::swap(data[i], data[j]);
    }
}

// Assembly:
movq (%rdi), %rcx
movl %edx, %eax
decl %esi
incl %eax
movslq %esi, %rsi
vmovsd 0x8(%rcx,%rsi,8), %xmm1
incq %rsi
vucomisd %xmm1, %xmm0
ja 0x73fc
cltq
vmovsd -0x8(%rcx,%rax,8), %xmm2
decq %rax
vucomisd %xmm0, %xmm2
ja 0x740d
cmpq %rax, %rsi
jge 0x742d
vmovsd %xmm2, (%rcx,%rsi,8)
vmovsd %xmm1, (%rcx,%rax,8)
jmp 0x73f9
retq
// File: /workspace/github_cpp_makefile_star2_O2/umatin[P]LogarithmicErrorRegression/./src/error_function.h
// Function: long double calculate_error<(ERROR_TYPE)3, true, false>(std::vector<double, std::allocator<double>>&, linear_regression)
long double calculate_error(std::vector<double>& data, linear_regression lr){
    long double total_error = 0;
    for(long i = 0; i < data.size(); i++){
        total_error += calculate_error_single_element<E, CORRECT, BOUNDED>(data, lr, i);
    }
    return total_error;
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
fldz
xorl %edx, %edx
xorl %edi, %edi
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdi, %rcx
je 0x7a21
movq %rdx, %r8
sarq $0x1d, %r8
vcvtsi2sd %edi, %xmm4, %xmm2
incq %rdi
addq %rsi, %rdx
vmovsd (%rax,%r8), %xmm3
vfmadd213sd %xmm1, %xmm0, %xmm3 # xmm3 = (xmm0 * xmm3) + xmm1
vroundsd $0x9, %xmm3, %xmm3, %xmm3
vsubsd %xmm3, %xmm2, %xmm2
vmovsd %xmm2, -0x8(%rsp)
fldl -0x8(%rsp)
fmul %st, %st(0)
fstpl -0x10(%rsp)
vmovsd -0x10(%rsp), %xmm2
vmovsd %xmm2, -0x18(%rsp)
faddl -0x18(%rsp)
jmp 0x79d4
retq