package seccomp

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"syscall"
	"unsafe"
)

// #include "linux/futex.h"
import "C"

func render_futex(pid int, args RegisterArgs) (string, error) {

	ops := map[uint32]string{
		C.FUTEX_WAIT:                    "FUTEX_WAIT",
		C.FUTEX_WAKE:                    "FUTEX_WAKE",
		C.FUTEX_FD:                      "FUTEX_FD",
		C.FUTEX_REQUEUE:                 "FUTEX_REQUEUE",
		C.FUTEX_CMP_REQUEUE:             "FUTEX_CMP_REQUEUE",
		C.FUTEX_WAKE_OP:                 "FUTEX_WAKE_OP",
		C.FUTEX_LOCK_PI:                 "FUTEX_LOCK_PI",
		C.FUTEX_UNLOCK_PI:               "FUTEX_UNLOCK_PI",
		C.FUTEX_TRYLOCK_PI:              "FUTEX_TRYLOCK_PI",
		C.FUTEX_WAIT_BITSET:             "FUTEX_WAIT_BITSET",
		C.FUTEX_WAKE_BITSET:             "FUTEX_WAKE_BITSET",
		C.FUTEX_WAIT_REQUEUE_PI:         "FUTEX_WAIT_REQUEUE_PI",
		C.FUTEX_CMP_REQUEUE_PI:          "FUTEX_CMP_REQUEUE_PI",
		C.FUTEX_WAIT_PRIVATE:            "FUTEX_WAIT_PRIVATE",
		C.FUTEX_WAKE_PRIVATE:            "FUTEX_WAKE_PRIVATE",
		C.FUTEX_REQUEUE_PRIVATE:         "FUTEX_REQUEUE_PRIVATE",
		C.FUTEX_CMP_REQUEUE_PRIVATE:     "FUTEX_CMP_REQUEUE_PRIVATE",
		C.FUTEX_WAKE_OP_PRIVATE:         "FUTEX_WAKE_OP_PRIVATE",
		C.FUTEX_LOCK_PI_PRIVATE:         "FUTEX_LOCK_PI_PRIVATE",
		C.FUTEX_UNLOCK_PI_PRIVATE:       "FUTEX_UNLOCK_PI_PRIVATE",
		C.FUTEX_TRYLOCK_PI_PRIVATE:      "FUTEX_TRYLOCK_PI_PRIVATE",
		C.FUTEX_WAIT_BITSET_PRIVATE:     "FUTEX_WAIT_BITSET_PRIVATE",
		C.FUTEX_WAKE_BITSET_PRIVATE:     "FUTEX_WAKE_BITSET_PRIVATE",
		C.FUTEX_WAIT_REQUEUE_PI_PRIVATE: "FUTEX_WAIT_REQUEUE_PI_PRIVATE",
		C.FUTEX_CMP_REQUEUE_PI_PRIVATE:  "FUTEX_CMP_REQUEUE_PI_PRIVATE",
	}
	wakeops := map[uint32]string{
		C.FUTEX_OP_SET:  "FUTEX_OP_SET",
		C.FUTEX_OP_ADD:  "FUTEX_OP_ADD",
		C.FUTEX_OP_OR:   "FUTEX_OP_OR",
		C.FUTEX_OP_ANDN: "FUTEX_OP_ANDN",
		C.FUTEX_OP_XOR:  "FUTEX_OP_XOR",
	}
	cmps := map[uint32]string{
		C.FUTEX_OP_CMP_EQ: "FUTEX_OP_CMP_EQ",
		C.FUTEX_OP_CMP_NE: "FUTEX_OP_CMP_NE",
		C.FUTEX_OP_CMP_LT: "FUTEX_OP_CMP_LT",
		C.FUTEX_OP_CMP_LE: "FUTEX_OP_CMP_LE",
		C.FUTEX_OP_CMP_GT: "FUTEX_OP_CMP_GT",
		C.FUTEX_OP_CMP_GE: "FUTEX_OP_CMP_GE",
	}

	callrep := ""
	opstr := ""

	op := uint32(args[1]) & 127
	if (uint32(args[1]) & C.FUTEX_PRIVATE_FLAG) == C.FUTEX_PRIVATE_FLAG {
		opstr = ops[op|C.FUTEX_PRIVATE_FLAG]
	} else {
		opstr = ops[op]
	}

	if opstr == "" {
		opstr = fmt.Sprintf("(FUTEX_??? %d %d %s)", args[1], op, ops[op])
	}

	if (args[1] & C.FUTEX_CLOCK_REALTIME) == C.FUTEX_CLOCK_REALTIME {
		opstr += "|FUTEX_CLOCK_REALTIME"
	}

	// TODO: lots

	switch op {
	case C.FUTEX_WAIT:
		callrep = fmt.Sprintf("futex(0x%X, %s, %d)", uintptr(args[0]), opstr, int32(args[2]))
	case C.FUTEX_WAKE:
		callrep = fmt.Sprintf("futex(0x%X, %s, %d)", uintptr(args[0]), opstr, int32(args[2]))
	case C.FUTEX_FD:
		callrep = fmt.Sprintf("futex(0x%X, %s, %d)", uintptr(args[0]), opstr, int32(args[2]))
	case C.FUTEX_WAKE_BITSET:
		callrep = fmt.Sprintf("futex(0x%X, %s, %d, %d)", uintptr(args[0]), opstr, int32(args[2]), args[5])
	case C.FUTEX_WAIT_BITSET:
		var t syscall.Timespec
		if (args[3]) != 0 {
			buf, err := readBytesArg(pid, int(unsafe.Sizeof(t)), uintptr(args[3]))
			if err != nil {
				return "", err
			}
			b := bytes.NewBuffer(buf)
			binary.Read(b, binary.LittleEndian, &t)
		}
		callrep = fmt.Sprintf("futex(0x%X, %s, %d, {%d, %d}, %x)", uintptr(args[0]), opstr, int32(args[2]), t.Sec, t.Nsec, uint32(args[5]))
	case C.FUTEX_WAKE_OP:
		wakeopstr := "{"
		wakeop := uint32(args[5])
		if ((wakeop >> 28) & C.FUTEX_OP_OPARG_SHIFT) == C.FUTEX_OP_OPARG_SHIFT {
			wakeopstr += "FUTEX_OP_OPARG_SHIFT|"
		}
		wakeopstr += wakeops[(wakeop>>28)&0x7]
		wakeopstr += fmt.Sprintf(", %d, ", (wakeop>>12)&0xfff)
		if (uint(wakeop>>24) & C.FUTEX_OP_OPARG_SHIFT) == C.FUTEX_OP_OPARG_SHIFT {
			wakeopstr += "FUTEX_OP_OPARG_SHIFT|"
		}
		wakeopstr += cmps[(wakeop>>24)&0x7]
		wakeopstr += fmt.Sprintf(", %d}", wakeop&0xfff)
		callrep = fmt.Sprintf("futex(0x%X, %s, %d, 0x%X, %s)", uintptr(args[0]), opstr, int32(args[2]), uintptr(args[3]), wakeopstr)
	default:
		callrep = fmt.Sprintf("futex(0x%X, %s, %d, 0x%X, 0x%x, %d)", uintptr(args[0]), opstr, int32(args[2]), uintptr(args[3]), args[4], args[5])
	}
	return callrep, nil

}

{'repo_name': 'subgraph/oz', 'stars': '423', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 1437441098279489787, 'source_dataset': 'data'}


/*
 * Copyright © 2020 Lisk Foundation
 *
 * See the LICENSE file at the top-level directory of this distribution
 * for licensing information.
 *
 * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
 * no part of this software, including this file, may be copied, modified,
 * propagated, or distributed except according to the terms contained in the
 * LICENSE file.
 *
 * Removal or modification of this copyright notice is prohibited.
 */

'use strict';

const { bufferToHex, hash, intToBuffer, getRandomBytes } = require('@liskhq/lisk-cryptography');
const BaseGenerator = require('../base_generator');

const getRandomTransactionIds = count => {
	const ids = [];
	for (let index = 0; index < count; index += 1) {
		ids.push(getRandomBytes(32));
	}
	return ids;
};

const LEAFPREFIX = intToBuffer(0);
const BRANCHPREFIX = intToBuffer(1);

const concat = (m1, m2) => Buffer.concat([m1, m2]);

const leafHash = m => hash(concat(LEAFPREFIX, m));

const branchHash = m => hash(concat(BRANCHPREFIX, m));

const merkleRoot = transactionIds => {
	const len = transactionIds.length;
	if (len === 0) return hash(Buffer.from([]));
	if (len === 1) return leafHash(transactionIds[0]);

	const k = 2 ** Math.floor(Math.log2(len - 1));
	const newData = transactionIds.splice(k);

	return branchHash(concat(merkleRoot(transactionIds), merkleRoot(newData)));
};

const generateTransactionMerkleRoot = () =>
	[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 50, 150, 300, 1000].map(count => {
		const transactionIds = getRandomTransactionIds(count);
		const ids = transactionIds.map(t => bufferToHex(t));
		const transactionMerkleRoot = merkleRoot(transactionIds);

		return {
			description: `Given valid transaction ids: ${count}`,
			input: {
				transactionIds: ids,
			},
			output: {
				transactionMerkleRoot: transactionMerkleRoot.toString('hex'),
			},
		};
	});

const transactionMerkleRootSuite = () => ({
	title: 'Transaction Merkle tree root',
	summary: 'Replace payload hash with Merkle tree root in block header',
	config: {},
	runner: 'transaction_merkle_root',
	handler: 'transaction_merkle_root',
	testCases: [...generateTransactionMerkleRoot()],
});

BaseGenerator.runGenerator('transaction_merkle_root', [transactionMerkleRootSuite]);

{'repo_name': 'LiskHQ/lisk-sdk', 'stars': '2692', 'repo_language': 'TypeScript', 'file_name': 'index.ts', 'mime_type': 'text/plain', 'hash': 1810079932741504822, 'source_dataset': 'data'}


/*
 * Polybench header for instrumentation.
 *
 * Programs must be compiled with `-I utilities utilities/polybench.c'
 *
 * Optionally, one can define:
 *
 * -DPOLYBENCH_TIME, to report the execution time,
 *   OR (exclusive):
 * -DPOLYBENCH_PAPI, to use PAPI H/W counters (defined in polybench.c)
 *
 *
 * See README or utilities/polybench.c for additional options.
 *
 */
#ifndef POLYBENCH_H
# define POLYBENCH_H

# include <stdlib.h>

/* Array padding. By default, none is used. */
# ifndef POLYBENCH_PADDING_FACTOR
/* default: */
#  define POLYBENCH_PADDING_FACTOR 0
# endif

#define POLYBENCH_TIME 1

/* C99 arrays in function prototype. By default, do not use. */
# ifdef POLYBENCH_USE_C99_PROTO
#  define POLYBENCH_C99_SELECT(x,y) y
# else
/* default: */
#  define POLYBENCH_C99_SELECT(x,y) x
# endif

/* Scalar loop bounds in SCoPs. By default, use parametric loop bounds. */
# ifdef POLYBENCH_USE_SCALAR_LB
#  define POLYBENCH_LOOP_BOUND(x,y) x
# else
/* default: */
#  define POLYBENCH_LOOP_BOUND(x,y) y
# endif

/* Use the 'restrict' keyword to declare that the different arrays do not
 * alias. By default, we do not use it as it is only supported in C99 and
 * even here several compilers do not properly get it.
 */
# ifdef POLYBENCH_USE_RESTRICT
#  define POLYBENCH_RESTRICT restrict
# else
/* default: */
#  define POLYBENCH_RESTRICT
# endif

/* Macros to reference an array. Generic for heap and stack arrays
   (C99).  Each array dimensionality has his own macro, to be used at
   declaration or as a function argument.
   Example:
   int b[x] => POLYBENCH_1D_ARRAY(b, x)
   int A[N][N] => POLYBENCH_2D_ARRAY(A, N, N)
*/
# ifndef POLYBENCH_STACK_ARRAYS
#  define POLYBENCH_ARRAY(x) *x
#  define POLYBENCH_FREE_ARRAY(x) free((void*)x);
#  define POLYBENCH_DECL_VAR(x) (*x)
# else
#  define POLYBENCH_ARRAY(x) x
#  define POLYBENCH_FREE_ARRAY(x)
#  define POLYBENCH_DECL_VAR(x) x
# endif
/* Macros for using arrays in the function prototypes. */
# define POLYBENCH_1D(var, dim1,ddim1) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_2D(var, dim1, dim2, ddim1, ddim2) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_3D(var, dim1, dim2, dim3, ddim1, ddim2, ddim3) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_4D(var, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_5D(var, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim5,ddim5) + POLYBENCH_PADDING_FACTOR]
/* Macros for using arrays within the functions. */
# define POLYBENCH_1D_F(var, dim1,ddim1) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_2D_F(var, dim1, dim2, ddim1, ddim2) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_3D_F(var, dim1, dim2, dim3, ddim1, ddim2, ddim3) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_4D_F(var, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR]
# define POLYBENCH_5D_F(var, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim5,ddim5) + POLYBENCH_PADDING_FACTOR]

/* Macros to allocate heap arrays.
   Example:
   polybench_alloc_2d_array(N, M, double) => allocates N x M x sizeof(double)
					  and returns a pointer to the 2d array
 */
# define POLYBENCH_ALLOC_1D_ARRAY(n1, type)	\
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (n1 + POLYBENCH_PADDING_FACTOR, sizeof(type))
# define POLYBENCH_ALLOC_2D_ARRAY(n1, n2, type)		\
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR), sizeof(type))
# define POLYBENCH_ALLOC_3D_ARRAY(n1, n2, n3, type)		\
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR), sizeof(type))
# define POLYBENCH_ALLOC_4D_ARRAY(n1, n2, n3, n4, type)			\
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR), sizeof(type))
# define POLYBENCH_ALLOC_5D_ARRAY(n1, n2, n3, n4, n5, type)		\
  (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR][n5 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR) * (n5 + POLYBENCH_PADDING_FACTOR), sizeof(type))

/* Macros for array declaration. */
# ifndef POLYBENCH_STACK_ARRAYS
#  define POLYBENCH_1D_ARRAY_DECL(var, type, dim1, ddim1)		\
  type POLYBENCH_1D_F(POLYBENCH_DECL_VAR(var), dim1, ddim1); \
  var = POLYBENCH_ALLOC_1D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), type);
#  define POLYBENCH_2D_ARRAY_DECL(var, type, dim1, dim2, ddim1, ddim2)	\
  type POLYBENCH_2D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, ddim1, ddim2); \
  var = POLYBENCH_ALLOC_2D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), type);
#  define POLYBENCH_3D_ARRAY_DECL(var, type, dim1, dim2, dim3, ddim1, ddim2, ddim3) \
  type POLYBENCH_3D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, ddim1, ddim2, ddim3); \
  var = POLYBENCH_ALLOC_3D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), type);
#  define POLYBENCH_4D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) \
  type POLYBENCH_4D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4); \
  var = POLYBENCH_ALLOC_4D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), POLYBENCH_C99_SELECT(dim4, ddim4), type);
#  define POLYBENCH_5D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) \
  type POLYBENCH_5D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5); \
  var = POLYBENCH_ALLOC_5D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), POLYBENCH_C99_SELECT(dim4, ddim4), POLYBENCH_C99_SELECT(dim5, ddim5), type);
# else
#  define POLYBENCH_1D_ARRAY_DECL(var, type, dim1, ddim1)		\
  type POLYBENCH_1D_F(POLYBENCH_DECL_VAR(var), dim1, ddim1);
#  define POLYBENCH_2D_ARRAY_DECL(var, type, dim1, dim2, ddim1, ddim2)	\
  type POLYBENCH_2D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, ddim1, ddim2);
#  define POLYBENCH_3D_ARRAY_DECL(var, type, dim1, dim2, dim3, ddim1, ddim2, ddim3) \
  type POLYBENCH_3D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, ddim1, ddim2, ddim3);
#  define POLYBENCH_4D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) \
  type POLYBENCH_4D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4);
#  define POLYBENCH_5D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) \
  type POLYBENCH_5D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5);
# endif

/* Dead-code elimination macros. Use argc/argv for the run-time check. */
# ifndef POLYBENCH_DUMP_ARRAYS
#  define POLYBENCH_DCE_ONLY_CODE    if (argc > 42 && ! strcmp(argv[0], ""))
# else
#  define POLYBENCH_DCE_ONLY_CODE
# endif

#define POLYBENCH_DUMP_TARGET stderr
#define POLYBENCH_DUMP_START    fprintf(POLYBENCH_DUMP_TARGET, "==BEGIN DUMP_ARRAYS==\n")
#define POLYBENCH_DUMP_FINISH   fprintf(POLYBENCH_DUMP_TARGET, "==END   DUMP_ARRAYS==\n")
#define POLYBENCH_DUMP_BEGIN(s) fprintf(POLYBENCH_DUMP_TARGET, "begin dump: %s", s)
#define POLYBENCH_DUMP_END(s)   fprintf(POLYBENCH_DUMP_TARGET, "\nend   dump: %s\n", s)

# define polybench_prevent_dce(func)		\
  POLYBENCH_DCE_ONLY_CODE			\
  func

/* Performance-related instrumentation. See polybench.c */
# define polybench_start_instruments
# define polybench_stop_instruments
# define polybench_print_instruments

/* PAPI support. */
# ifdef POLYBENCH_PAPI
extern const unsigned int polybench_papi_eventlist[];
#  undef polybench_start_instruments
#  undef polybench_stop_instruments
#  undef polybench_print_instruments
#  define polybench_set_papi_thread_report(x)	\
   polybench_papi_counters_threadid = x;
#  define polybench_start_instruments				\
  polybench_prepare_instruments();				\
  polybench_papi_init();					\
  int evid;							\
  for (evid = 0; polybench_papi_eventlist[evid] != 0; evid++)	\
    {								\
      if (polybench_papi_start_counter(evid))			\
	continue;						\

#  define polybench_stop_instruments		\
      polybench_papi_stop_counter(evid);	\
    }						\
  polybench_papi_close();			\

#  define polybench_print_instruments polybench_papi_print();
# endif

/* Timing support. */
# if defined(POLYBENCH_TIME) || defined(POLYBENCH_GFLOPS)
#  undef polybench_start_instruments
#  undef polybench_stop_instruments
#  undef polybench_print_instruments
#  define polybench_start_instruments polybench_timer_start();
#  define polybench_stop_instruments polybench_timer_stop();
#  define polybench_print_instruments polybench_timer_print();
extern double polybench_program_total_flops;
extern void polybench_timer_start();
extern void polybench_timer_stop();
extern void polybench_timer_print();
# endif

/* Function declaration. */
# ifdef POLYBENCH_TIME
extern void polybench_timer_start();
extern void polybench_timer_stop();
extern void polybench_timer_print();
# endif

# ifdef POLYBENCH_PAPI
extern void polybench_prepare_instruments();
extern int polybench_papi_start_counter(int evid);
extern void polybench_papi_stop_counter(int evid);
extern void polybench_papi_init();
extern void polybench_papi_close();
extern void polybench_papi_print();
# endif

/* Function prototypes. */
extern void* polybench_alloc_data(unsigned long long int n, int elt_size);

#endif /* !POLYBENCH_H */

{'repo_name': 'Tiramisu-Compiler/tiramisu', 'stars': '620', 'repo_language': 'Jupyter Notebook', 'file_name': 'wrapper_test_86.cpp', 'mime_type': 'text/x-c', 'hash': -6707403161248222780, 'source_dataset': 'data'}


/*
Copyright (C) 2018-2019 de4dot@gmail.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

// GENERATOR-BEGIN: DecoderConstants
// ⚠This was generated by GENERATOR!🦹♂
pub(crate) struct DecoderConstants;
#[allow(dead_code)]
impl DecoderConstants {
	pub(crate) const DEFAULT_IP16: u64 = 0x0000_0000_0000_7FF0;
	pub(crate) const DEFAULT_IP32: u64 = 0x0000_0000_7FFF_FFF0;
	pub(crate) const DEFAULT_IP64: u64 = 0x7FFF_FFFF_FFFF_FFF0;
}
// GENERATOR-END: DecoderConstants

{'repo_name': '0xd4d/iced', 'stars': '643', 'repo_language': 'C#', 'file_name': 'create.rs', 'mime_type': 'text/plain', 'hash': -8926490820764262293, 'source_dataset': 'data'}


/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef QWIZARD_WIN_P_H
#define QWIZARD_WIN_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA

#include <qt_windows.h>
#include <qobject.h>
#include <qwidget.h>
#include <qabstractbutton.h>
#include <QtGui/private/qwidget_p.h>
#include <QtGui/private/qstylehelper_p.h>

QT_BEGIN_NAMESPACE

class QVistaBackButton : public QAbstractButton
{
public:
    QVistaBackButton(QWidget *widget);

    QSize sizeHint() const;
    inline QSize minimumSizeHint() const
    { return sizeHint(); }

    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);
    void paintEvent(QPaintEvent *event);
};

class QWizard;

class QVistaHelper : public QObject
{
public:
    QVistaHelper(QWizard *wizard);
    ~QVistaHelper();
    enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
    bool setDWMTitleBar(TitleBarChangeType type);
    void setTitleBarIconAndCaptionVisible(bool visible);
    void mouseEvent(QEvent *event);
    bool handleWinEvent(MSG *message, long *result);
    void resizeEvent(QResizeEvent *event);
    void paintEvent(QPaintEvent *event);
    QVistaBackButton *backButton() const { return backButton_; }
    void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
    void hideBackButton() { if (backButton_) backButton_->hide(); }
    void setWindowPosHack();
    QColor basicWindowFrameColor();
    enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
    static VistaState vistaState();
    static int titleBarSize() { return frameSize() + captionSize(); }
    static int topPadding() { // padding under text
        return int(QStyleHelper::dpiScaled(
                QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
    }
    static int topOffset() {
        static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
                                QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
        return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
private:
    static HFONT getCaptionFont(HANDLE hTheme);
    bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
    static bool drawBlackRect(const QRect &rect, HDC hdc);

    static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
    static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }

    static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
    static int iconSize() { return 16; } // Standard Aero
    static int glowSize() { return 10; }
    int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }

    int titleOffset();
    bool resolveSymbols();
    void drawTitleBar(QPainter *painter);
    void setMouseCursor(QPoint pos);
    void collapseTopFrameStrut();
    bool winEvent(MSG *message, long *result);
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    bool eventFilter(QObject *obj, QEvent *event);

    static bool is_vista;
    static VistaState cachedVistaState;
    static bool isCompositionEnabled();
    static bool isThemeActive();
    enum Changes { resizeTop, movePosition, noChange } change;
    QPoint pressedPos;
    bool pressed;
    QRect rtTop;
    QRect rtTitle;
    QWizard *wizard;
    QVistaBackButton *backButton_;

    int titleBarOffset;  // Extra spacing above the text
    int iconSpacing;    // Space between button and icon
    int textSpacing;    // Space between icon and text
};

QT_END_NAMESPACE

#endif // QT_NO_STYLE_WINDOWSVISTA
#endif // QT_NO_WIZARD
#endif // QWIZARD_WIN_P_H

{'repo_name': 'arturadib/node-qt', 'stars': '1480', 'repo_language': 'C++', 'file_name': 'qpen.js', 'mime_type': 'text/plain', 'hash': 8806421502125691119, 'source_dataset': 'data'}


/**
 * Default button style: white background, dark gray text, gray border,
 * a bit rounded corners.
 */

@import "~styles/mixins";

@mixin feedback {
  &:active {
    background: white;
    border: 1px solid #00a2e0;
  }

  &:focus {
    background: white;
    border: 1px solid #00a2e0;
  }

  &:hover {
    background: white;
    border: 1px solid #00a2e0;
  }
}

.button {
  background: white;
  border: 1px solid #00a2e0;
  border-radius: 40px;
  // display: inline-block;
  font: 16px/36px "Akkurat regular", monospace !important;
  // margin: $base-unit;
  width: 250px;
  text-align: center;
  vertical-align: top;

  a,
  &,
  &:visited {
    color: #00a2e0 !important;
    text-decoration: none !important;
  }
}

.disabled {
  background: white;
  color: #00a2e0;
  cursor: not-allowed;
}

.link {
  @include feedback;
}

.regular {
  @include feedback;
}

{'repo_name': 'topcoder-platform/community-app', 'stars': '112', 'repo_language': 'JavaScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -38148100853194109, 'source_dataset': 'data'}


FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/KZFileWatchers-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/Yams-iOS"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/KZFileWatchers-iOS/KZFileWatchers.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Yams-iOS/Yams.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
OTHER_LDFLAGS = $(inherited) -framework "KZFileWatchers" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

{'repo_name': 'yonaskolb/Stylist', 'stars': '248', 'repo_language': 'Swift', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 3097407132534173408, 'source_dataset': 'data'}


---

dependencies: []

galaxy_info:
  author: 'Stefan G. Weichinger'
  description: 'Install rclone'
  company: 'oops'
  license: 'GNU General Public License v3'
  min_ansible_version: '2.0'
  platforms:
    - name: Debian
      versions:
        - buster
        - stretch
        - jessie
    - name: Fedora
      versions:
        - 30
        - 29
        - 27
    - name: Ubuntu
      versions:
        - bionic
        - xenial
        - trusty
  galaxy_tags:
    - networking
    - system

{'repo_name': 'plexguide/PlexGuide.com', 'stars': '1549', 'repo_language': 'Shell', 'file_name': 'drives_key_generation', 'mime_type': 'text/x-shellscript', 'hash': -6431560792059669901, 'source_dataset': 'data'}


//===--- PPConditionalDirectiveRecord.h - Preprocessing Directives-*- C++ -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  This file implements the PPConditionalDirectiveRecord class, which maintains
//  a record of conditional directive regions.
//
//===----------------------------------------------------------------------===//
#include "clang/Lex/PPConditionalDirectiveRecord.h"
#include "llvm/Support/Capacity.h"

using namespace clang;

PPConditionalDirectiveRecord::PPConditionalDirectiveRecord(SourceManager &SM)
  : SourceMgr(SM) {
  CondDirectiveStack.push_back(SourceLocation());
}

bool PPConditionalDirectiveRecord::rangeIntersectsConditionalDirective(
                                                      SourceRange Range) const {
  if (Range.isInvalid())
    return false;

  CondDirectiveLocsTy::const_iterator low = llvm::lower_bound(
      CondDirectiveLocs, Range.getBegin(), CondDirectiveLoc::Comp(SourceMgr));
  if (low == CondDirectiveLocs.end())
    return false;

  if (SourceMgr.isBeforeInTranslationUnit(Range.getEnd(), low->getLoc()))
    return false;

  CondDirectiveLocsTy::const_iterator
    upp = std::upper_bound(low, CondDirectiveLocs.end(),
                           Range.getEnd(), CondDirectiveLoc::Comp(SourceMgr));
  SourceLocation uppRegion;
  if (upp != CondDirectiveLocs.end())
    uppRegion = upp->getRegionLoc();

  return low->getRegionLoc() != uppRegion;
}

SourceLocation PPConditionalDirectiveRecord::findConditionalDirectiveRegionLoc(
                                                     SourceLocation Loc) const {
  if (Loc.isInvalid())
    return SourceLocation();
  if (CondDirectiveLocs.empty())
    return SourceLocation();

  if (SourceMgr.isBeforeInTranslationUnit(CondDirectiveLocs.back().getLoc(),
                                          Loc))
    return CondDirectiveStack.back();

  CondDirectiveLocsTy::const_iterator low = llvm::lower_bound(
      CondDirectiveLocs, Loc, CondDirectiveLoc::Comp(SourceMgr));
  assert(low != CondDirectiveLocs.end());
  return low->getRegionLoc();
}

void PPConditionalDirectiveRecord::addCondDirectiveLoc(
                                                      CondDirectiveLoc DirLoc) {
  // Ignore directives in system headers.
  if (SourceMgr.isInSystemHeader(DirLoc.getLoc()))
    return;

  assert(CondDirectiveLocs.empty() ||
         SourceMgr.isBeforeInTranslationUnit(CondDirectiveLocs.back().getLoc(),
                                             DirLoc.getLoc()));
  CondDirectiveLocs.push_back(DirLoc);
}

void PPConditionalDirectiveRecord::If(SourceLocation Loc,
                                      SourceRange ConditionRange,
                                      ConditionValueKind ConditionValue) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  CondDirectiveStack.push_back(Loc);
}

void PPConditionalDirectiveRecord::Ifdef(SourceLocation Loc,
                                         const Token &MacroNameTok,
                                         const MacroDefinition &MD) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  CondDirectiveStack.push_back(Loc);
}

void PPConditionalDirectiveRecord::Ifndef(SourceLocation Loc,
                                          const Token &MacroNameTok,
                                          const MacroDefinition &MD) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  CondDirectiveStack.push_back(Loc);
}

void PPConditionalDirectiveRecord::Elif(SourceLocation Loc,
                                        SourceRange ConditionRange,
                                        ConditionValueKind ConditionValue,
                                        SourceLocation IfLoc) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  CondDirectiveStack.back() = Loc;
}

void PPConditionalDirectiveRecord::Else(SourceLocation Loc,
                                        SourceLocation IfLoc) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  CondDirectiveStack.back() = Loc;
}

void PPConditionalDirectiveRecord::Endif(SourceLocation Loc,
                                         SourceLocation IfLoc) {
  addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
  assert(!CondDirectiveStack.empty());
  CondDirectiveStack.pop_back();
}

size_t PPConditionalDirectiveRecord::getTotalMemory() const {
  return llvm::capacity_in_bytes(CondDirectiveLocs);
}

{'repo_name': 'epiqc/ScaffCC', 'stars': '118', 'repo_language': 'C++', 'file_name': 'boolean_formula.x2y2.scaffold', 'mime_type': 'text/x-c', 'hash': 8565585113920389434, 'source_dataset': 'data'}


// Set up some local color variables to make the CSS more clear
$outer-border: $gray-200;
$promo-actions-border-top: $gray-100;
$promo-actions-border-bottom: $gray-100;

.woocommerce-stats-overview {
	.woocommerce-card__body {
		padding: 0;
	}
	.woocommerce-summary {
		margin: 0;
	}
}

.woocommerce-stats-overview__more-btn {
	display: inline-block;
	padding: $gap;
}

.woocommerce-stats-overview__tabs {
	.components-tab-panel__tabs {
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid $outer-border;

		.components-button {
			width: 33.33%;
			padding-right: $gap-large;
			padding-left: $gap-large;
		}
	}
}

.woocommerce-stats-overview__stats {
	margin: 0;

	.woocommerce-summary__item-container {
		width: 50%;
		display: inline-block;
	}

	.woocommerce-summary__item-container:nth-last-of-type(1)
	.woocommerce-summary__item {
		border-bottom: none;
	}

	&.is-even
	.woocommerce-summary__item-container:nth-last-of-type(2)
	.woocommerce-summary__item {
		border-bottom: none;
	}

	.woocommerce-summary__item-container:nth-of-type(even)
	.woocommerce-summary__item {
		border-right: none;
	}

	.woocommerce-summary__item {
		background-color: $studio-white;

		&:hover {
			background-color: $gray-100;
		}

		&:active {
			background-color: $gray-100;
		}
	}
}

article.woocommerce-stats-overview__install-jetpack-promo {
	.woocommerce-stats-overview__install-jetpack-promo__content {
		padding: $gap $gap-large;
	}

	h2 {
		color: $gray-900;
		@include font-size( 16 );
		font-style: normal;
		line-height: 1.5;
		font-weight: normal;
		margin: $gap-smaller 0;
	}
	p {
		color: $gray-700;
		font-style: normal;
		font-weight: normal;
		@include font-size( 14 );
		line-height: 20px;
		margin: $gap-smaller 0;
	}
	footer {
		padding: $gap $gap-large;
		border-top: 1px solid $promo-actions-border-top;
		border-bottom: 1px solid $promo-actions-border-bottom;

		button {
			margin-left: $gap-smaller;

			&:first-child {
				margin-left: 0;
			}
		}
	}
}

{'repo_name': 'woocommerce/woocommerce-admin', 'stars': '238', 'repo_language': 'PHP', 'file_name': 'uploader.js', 'mime_type': 'text/x-java', 'hash': 5038962995439575987, 'source_dataset': 'data'}