<commit_before>#include <iomanip>
#include "utils.hpp"
#include "thirdparty/MurmurHash3.h"

using namespace std;
namespace bohrium{
namespace core{

const char TAG[] = "Utils";

void tac_transform(tac_t& tac, SymbolTable& symbol_table)
{
    switch(tac.op) {
        case REDUCE_COMPLETE:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            }
            break;

        case REDUCE_PARTIAL:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            } else if (symbol_table[tac.out].layout == SCALAR) {
                tac.op = REDUCE_COMPLETE;
            }
            break;

        case SCAN:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            }
            break;

        case ZIP:
            switch(tac.oper) {
                case ADD:
                    if (((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) && \
                        (get_scalar(symbol_table[tac.in2]) == 0.0)) {
                        tac.op = MAP;
                        tac.oper = IDENTITY;
                        // tac.in1 = same as before
                        tac.in2 = 0;
                        goto transform_identity;
                    }
                    break;
                case MULTIPLY:
                    if ((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) {
                        if (get_scalar(symbol_table[tac.in2]) == 0.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            tac.in1 = tac.in2;
                            set_scalar(symbol_table[tac.in1], 0);
                            tac.in2 = 0;
                        } else if (get_scalar(symbol_table[tac.in2]) == 1.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            // tac.in1 = same as before
                            tac.in2 = 0;
                            goto transform_identity;
                        }
                    }
                    break;
                case DIVIDE:
                    if ((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) {
                        if (get_scalar(symbol_table[tac.in2]) == 1.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            // tac.in1 = same as before
                            tac.in2 = 0;
                            goto transform_identity;
                        }
                    }
                    break;

                case POWER:
                    if (((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) && \
                        (get_scalar(symbol_table[tac.in2]) == 2.0)) {
                        tac.oper = MULTIPLY;
                        tac.in2 = tac.in1;
                    }
                    break;
                default:
                    break;
            }
            break;

        case MAP:
            switch(tac.oper) {
                case IDENTITY:
                    transform_identity:
                    if (tac.out == tac.in1) {
                        tac.op = NOOP;
                    }
                    break;
                default:
                    break;
            }
            break;

        default:
            break;
    }
}

std::string string_format(const std::string fmt_str, ...) {
    int size = 100;
    std::string str;
    va_list ap;
    while (1) {<commit_msg>cpu: Removed POW(A, K) transformation.<commit_after>#include <iomanip>
#include "utils.hpp"
#include "thirdparty/MurmurHash3.h"

using namespace std;
namespace bohrium{
namespace core{

const char TAG[] = "Utils";

void tac_transform(tac_t& tac, SymbolTable& symbol_table)
{
    switch(tac.op) {
        case REDUCE_COMPLETE:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            }
            break;

        case REDUCE_PARTIAL:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            } else if (symbol_table[tac.out].layout == SCALAR) {
                tac.op = REDUCE_COMPLETE;
            }
            break;

        case SCAN:
            if (symbol_table[tac.in1].layout == SCALAR) {
                tac.op   = MAP;
                tac.oper = IDENTITY;
                tac.in2  = 0;
                goto transform_identity;
            }
            break;

        case ZIP:
            switch(tac.oper) {
                case ADD:
                    if (((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) && \
                        (get_scalar(symbol_table[tac.in2]) == 0.0)) {
                        tac.op = MAP;
                        tac.oper = IDENTITY;
                        // tac.in1 = same as before
                        tac.in2 = 0;
                        goto transform_identity;
                    }
                    break;
                case MULTIPLY:
                    if ((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) {
                        if (get_scalar(symbol_table[tac.in2]) == 0.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            tac.in1 = tac.in2;
                            set_scalar(symbol_table[tac.in1], 0);
                            tac.in2 = 0;
                        } else if (get_scalar(symbol_table[tac.in2]) == 1.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            // tac.in1 = same as before
                            tac.in2 = 0;
                            goto transform_identity;
                        }
                    }
                    break;
                case DIVIDE:
                    if ((symbol_table[tac.in2].layout & (SCALAR_CONST))>0) {
                        if (get_scalar(symbol_table[tac.in2]) == 1.0) {
                            tac.op = MAP;
                            tac.oper = IDENTITY;
                            // tac.in1 = same as before
                            tac.in2 = 0;
                            goto transform_identity;
                        }
                    }
                    break;
                default:
                    break;
            }
            break;

        case MAP:
            switch(tac.oper) {
                case IDENTITY:
                    transform_identity:
                    if (tac.out == tac.in1) {
                        tac.op = NOOP;
                    }
                    break;
                default:
                    break;
            }
            break;

        default:
            break;
    }
}

std::string string_format(const std::string fmt_str, ...) {
    int size = 100;
    std::string str;
    va_list ap;
    while (1) {
{'fraction_non_alphanumeric': 0.09408458244111349, 'fraction_numerical': 0.013784796573875803, 'mean_word_length': 0.8429099876695437, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1255077', 'n_tokens_mistral': 2229, 'n_tokens_neox': 2044, 'n_words': 382}