Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class DotProduct extends Handler { use MultipleAddressMode, BinaryOperator, Float..

Decoded Output download

<?php

class DotProduct extends Handler {

	use MultipleAddressMode, BinaryOperator, FloatingPointOnly, Multithreaded;
	
	public function getInputOperandCount() {
		if($this->operandSize == "variable") {
			return 3;
		} else {
			return 2;
		}
	}
	
	public function getOperandAddressMode($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return "ARR";
				case 2: return "ARR";
				case 3: return "SCA";
				case 4: return $this->addressMode;
			}
		} else {
			switch($i) {
				case 1: return "ARR";
				case 2: return "ARR";
				case 3: return $this->addressMode;
			}
		}
	}

	public function getOperandSize($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return "op3";
				case 2: return "op3";
				case 3: return 1;
				case 4: return 1;
			}
		} else {
			switch($i) {
				case 1: return $this->operandSize;
				case 2: return $this->operandSize;
				case 3: return 1;
			}
		}
	}

	public function getOperandType($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return $this->operandType;
				case 2: return $this->operandType;
				case 3: return "U32";
				case 4: return $this->operandType;
			}
		} else {
			switch($i) {
				case 1: return $this->operandType;
				case 2: return $this->operandType;
				case 3: return $this->operandType;
			}
		}
	}
	
	public function getActionOnUnitData() {
		$cType = $this->getOperandCType(1);
		$lines = array();
		if($this->operandSize == "variable") {
			$lines[] = "uint32_t i, vector_width = op3;";
			$lines[] = "$cType sum = 0;";
			$lines[] = "for(i = 0; i < vector_width; i++) {";
			$lines[] = 		"sum += op1_ptr[i] * op2_ptr[i];";
			$lines[] = "}";
			$lines[] = "res = sum;";
		} else {
			switch($this->operandSize) {
				case 2: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]);";
				}	break;
				case 3: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]) + (op1_ptr[2] * op2_ptr[2]);";
				}	break;
				case 4: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]) + (op1_ptr[2] * op2_ptr[2]) + (op1_ptr[3] * op2_ptr[3]);";
				}	break;
			}
		}
		return $lines;
	}
}

?>

Did this file decode correctly?

Original Code

<?php

class DotProduct extends Handler {

	use MultipleAddressMode, BinaryOperator, FloatingPointOnly, Multithreaded;
	
	public function getInputOperandCount() {
		if($this->operandSize == "variable") {
			return 3;
		} else {
			return 2;
		}
	}
	
	public function getOperandAddressMode($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return "ARR";
				case 2: return "ARR";
				case 3: return "SCA";
				case 4: return $this->addressMode;
			}
		} else {
			switch($i) {
				case 1: return "ARR";
				case 2: return "ARR";
				case 3: return $this->addressMode;
			}
		}
	}

	public function getOperandSize($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return "op3";
				case 2: return "op3";
				case 3: return 1;
				case 4: return 1;
			}
		} else {
			switch($i) {
				case 1: return $this->operandSize;
				case 2: return $this->operandSize;
				case 3: return 1;
			}
		}
	}

	public function getOperandType($i) {
		if($this->operandSize == "variable") {
			switch($i) {
				case 1: return $this->operandType;
				case 2: return $this->operandType;
				case 3: return "U32";
				case 4: return $this->operandType;
			}
		} else {
			switch($i) {
				case 1: return $this->operandType;
				case 2: return $this->operandType;
				case 3: return $this->operandType;
			}
		}
	}
	
	public function getActionOnUnitData() {
		$cType = $this->getOperandCType(1);
		$lines = array();
		if($this->operandSize == "variable") {
			$lines[] = "uint32_t i, vector_width = op3;";
			$lines[] = "$cType sum = 0;";
			$lines[] = "for(i = 0; i < vector_width; i++) {";
			$lines[] = 		"sum += op1_ptr[i] * op2_ptr[i];";
			$lines[] = "}";
			$lines[] = "res = sum;";
		} else {
			switch($this->operandSize) {
				case 2: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]);";
				}	break;
				case 3: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]) + (op1_ptr[2] * op2_ptr[2]);";
				}	break;
				case 4: {
					$lines[] = "res = (op1_ptr[0] * op2_ptr[0]) + (op1_ptr[1] * op2_ptr[1]) + (op1_ptr[2] * op2_ptr[2]) + (op1_ptr[3] * op2_ptr[3]);";
				}	break;
			}
		}
		return $lines;
	}
}

?>

Function Calls

None

Variables

None

Stats

MD5 ab15c5898d95ec924d0f768589017c61
Eval Count 0
Decode Time 78 ms