text
stringlengths
1
1.05M
; A063221: Dimension of the space of weight 2n cuspidal newforms for Gamma_0( 57 ). ; 3,10,14,22,26,34,38,46,50,58,62,70,74,82,86,94,98,106,110,118,122,130,134,142,146,154,158,166,170,178,182,190,194,202,206,214,218,226,230,238,242,250,254,262,266,274,278,286,290,298 mul $0,3 mov $1,$0 mul $0,2 mov $2,-1 bin $2,$1 trn $0,$2 add $0,3
; ; ZX IF1 & Microdrive functions ; ; if1_checksum (internal routine) ; ; check BC bytes starting from HL ; and compare with the following byte ; ; $Id: if1_checksum.asm,v 1.2 2015/01/19 01:33:10 pauloscustodio Exp $ ; PUBLIC if1_checksum if1_checksum: push hl ld e,0 nxt_byte: ld a,e add (hl) inc hl adc 1 jr z,noround dec a noround: ld e,a dec bc ld a,b or c jr nz,nxt_byte ld a,e cp (hl) pop hl ret
-- 7 Billion Humans (2144) -- -- 38: Seek and Destroy 3 -- -- Author: tiansh -- Size: 14 -- Speed: 29 -- Speed Tests: 29, 29, 29, 29, 29, 28, 29, 29, 29, 28, 29, 29 -- Success Rate: 227/300 a: step n if c <= mem1 or mem1 != datacube: mem1 = set c endif if n == wall: pickup mem1 mem4 = nearest shredder b: mem2 = nearest worker if mem2 == nothing: giveto mem4 endif if myitem >= mem2 or myitem == nothing: mem4 = nearest hole step mem4 endif jump b endif jump a
; ; Game device library for the TI calculators ; Stefano Bodrato - 21/8/2001 ; Henk Poley - 03/9/2001 ; ; $Id: joystick.asm,v 1.7 2016-06-16 20:23:52 dom Exp $ ; SECTION code_clib PUBLIC joystick PUBLIC _joystick .joystick ._joystick ;__FASTALL__ : joystick no. in HL ld c,l ld hl,-1 ; HL = 'ERROR' dec c ; Test if device 1 is requested jr z,device1 ; .error ret .device1 ; H = -1 inc l ; L = 0 inc c ; C = 1 out (c),h ; Reset keypad (out (1),$FF) ld a,$BF ; Enable group 7 out (1),a ; in a,(1) ; and @00100000 ; [2nd] pressed ? jr nz,nofire1 ; if zero, then [2nd] was pressed inc l ; L = @00000001 .nofire1 ;out (c),h ; ld a,$DF ; Enable group 6 out (1),a ; in a,(1) ; and @10000000 ; [Alpha] pressed ? jr nz,nofire2 ; if zero, then [Alpha] set 1,l ; L = @0000001x .nofire2 out (c),h ; ld a,$FE ; Enable group 1 out (1),a ; in a,(1) ; cpl ; rl l ; space for the [up] bit rra ; [down] bit -> Carry rl l ; L <- Carry rra ; [left] bit -> Carry rl l ; L <- Carry rra ; [right] bit -> Carry rl l ; L <- Carry rra ; [up] bit -> Carry jr nc,j_done ; Test Carry, if set... set 3,l ; then, set bit 3 in L .j_done ; else, return inc h ; H = 0 ret
; A188293: Positions of 1 in A188291; complement of A188292. ; 4,8,12,21,25,29,38,42,46,55,59,63,72,76,80,84,93,97,101,110,114,118,127,131,135,144,148,152,156,165,169,173,182,186,190,199,203,207,216,220,224,228,237,241,245,254,258,262,271,275,279,288,292,296,300,309,313,317,326,330,334,343,347,351,360,364,368,377,381,385,389 mov $18,$0 mov $20,$0 add $20,1 lpb $20 mov $0,$18 sub $20,1 sub $0,$20 mov $14,$0 mov $16,2 lpb $16 clr $0,14 mov $0,$14 sub $16,1 add $0,$16 sub $0,1 mul $0,17 sub $0,1 add $3,17 add $0,$3 div $0,55 mov $1,$0 mov $17,$16 lpb $17 mov $15,$1 sub $17,1 lpe lpe lpb $14 mov $14,0 sub $15,$1 lpe mov $1,$15 mul $1,5 add $1,4 add $19,$1 lpe mov $1,$19
.include "defaults_mod.asm" table_file_jp equ "exe4-utf8.tbl" table_file_en equ "bn4-utf8.tbl" game_code_len equ 3 game_code equ 0x4234574A // B4WJ game_code_2 equ 0x42345745 // B4WE game_code_3 equ 0x42345750 // B4WP card_type equ 1 card_id equ 43 card_no equ "043" card_sub equ "Mod Card 043" card_sub_x equ 64 card_desc_len equ 2 card_desc_1 equ "Address 0A" card_desc_2 equ "CrackBuster" card_desc_3 equ "" card_name_jp_full equ "クラックバスター" card_name_jp_game equ "クラックバスター" card_name_en_full equ "CrackBuster" card_name_en_game equ "CrackBuster" card_address equ "0A" card_address_id equ 0 card_bug equ 0 card_wrote_en equ "CrackBuster" card_wrote_jp equ "クラックバスター"
#include "SceneLoader.h" #include <iostream> #include <fstream> #include "FileSystem.h" #include "Logger.h" using namespace Utilities; using namespace GenParam; void SceneLoader::readScene(const std::string &fileName, SceneData &sceneData) { LOG_INFO << "Load scene file: " << fileName; try { std::ifstream input_file(fileName); if (!input_file.is_open()) { LOG_ERR << "Cannot open file!\n"; return; } m_json << input_file; std::string basePath = FileSystem::getFilePath(fileName); readValue(m_json, "Name", sceneData.m_sceneName); sceneData.m_camPosition = Vector3r(5.0, 10.0, 30.0); readVector(m_json, "cameraPosition", sceneData.m_camPosition); sceneData.m_camLookat = Vector3r(5.0, 0.0, 0.0); readVector(m_json, "cameraLookat", sceneData.m_camLookat); ////////////////////////////////////////////////////////////////////////// // read general ////////////////////////////////////////////////////////////////////////// sceneData.m_timeStepSize = 0.005; sceneData.m_gravity = Vector3r(0, -9.81, 0); sceneData.m_velocityUpdateMethod = 0; sceneData.m_triangleModelSimulationMethod = -1; sceneData.m_triangleModelBendingMethod = -1; sceneData.m_tetModelSimulationMethod = -1; sceneData.m_contactTolerance = 0.0; sceneData.m_contactStiffnessRigidBody = 1.0; sceneData.m_contactStiffnessParticleRigidBody = 100.0; sceneData.m_cloth_stiffness = 1.0; sceneData.m_cloth_bendingStiffness = 0.01; sceneData.m_cloth_xxStiffness = 1.0; sceneData.m_cloth_yyStiffness = 1.0; sceneData.m_cloth_xyStiffness = 1.0; sceneData.m_cloth_xyPoissonRatio = 0.3; sceneData.m_cloth_yxPoissonRatio = 0.3; sceneData.m_cloth_normalizeStretch = false; sceneData.m_cloth_normalizeShear = false; sceneData.m_cloth_stiffness = 1.0; sceneData.m_cloth_stiffness = 0.3; sceneData.m_solid_normalizeStretch = false; sceneData.m_solid_normalizeShear = false; if (m_json.find("Simulation") != m_json.end()) readSimulation(m_json, "Simulation", sceneData); ////////////////////////////////////////////////////////////////////////// // read rigid bodies ////////////////////////////////////////////////////////////////////////// if (m_json.find("RigidBodies") != m_json.end()) readRigidBodies(m_json, "RigidBodies", basePath, sceneData); ////////////////////////////////////////////////////////////////////////// // read triangle models ////////////////////////////////////////////////////////////////////////// if (m_json.find("TriangleModels") != m_json.end()) readTriangleModels(m_json, "TriangleModels", basePath, sceneData); ////////////////////////////////////////////////////////////////////////// // read tet models ////////////////////////////////////////////////////////////////////////// if (m_json.find("TetModels") != m_json.end()) readTetModels(m_json, "TetModels", basePath, sceneData); ////////////////////////////////////////////////////////////////////////// // read kinematics ////////////////////////////////////////////////////////////////////////// if (m_json.find("Kinematics") != m_json.end()) readKinematics(m_json, "Kinematics", sceneData); ////////////////////////////////////////////////////////////////////////// // read ball joints ////////////////////////////////////////////////////////////////////////// if (m_json.find("BallJoints") != m_json.end()) readBallJoints(m_json, "BallJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read ball-on-line joints ////////////////////////////////////////////////////////////////////////// if (m_json.find("BallOnLineJoints") != m_json.end()) readBallOnLineJoints(m_json, "BallOnLineJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read hinge joints ////////////////////////////////////////////////////////////////////////// if (m_json.find("HingeJoints") != m_json.end()) readHingeJoints(m_json, "HingeJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read universal joints ////////////////////////////////////////////////////////////////////////// if (m_json.find("UniversalJoints") != m_json.end()) readUniversalJoints(m_json, "UniversalJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read slider joints ////////////////////////////////////////////////////////////////////////// if (m_json.find("SliderJoints") != m_json.end()) readSliderJoints(m_json, "SliderJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read RigidBodyParticleBallJoints ////////////////////////////////////////////////////////////////////////// if (m_json.find("RigidBodyParticleBallJoints") != m_json.end()) readRigidBodyParticleBallJoints(m_json, "RigidBodyParticleBallJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read RigidBodySprings ////////////////////////////////////////////////////////////////////////// if (m_json.find("RigidBodySprings") != m_json.end()) readRigidBodySprings(m_json, "RigidBodySprings", sceneData); ////////////////////////////////////////////////////////////////////////// // read DistanceJoints ////////////////////////////////////////////////////////////////////////// if (m_json.find("DistanceJoints") != m_json.end()) readDistanceJoints(m_json, "DistanceJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read DamperJoints ////////////////////////////////////////////////////////////////////////// if (m_json.find("DamperJoints") != m_json.end()) readDamperJoints(m_json, "DamperJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read TargetAngleMotorHingeJoint ////////////////////////////////////////////////////////////////////////// if (m_json.find("TargetAngleMotorHingeJoints") != m_json.end()) readTargetAngleMotorHingeJoints(m_json, "TargetAngleMotorHingeJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read TargetVelocityMotorHingeJoint ////////////////////////////////////////////////////////////////////////// if (m_json.find("TargetVelocityMotorHingeJoints") != m_json.end()) readTargetVelocityMotorHingeJoints(m_json, "TargetVelocityMotorHingeJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read TargetPositionMotorSliderJoint ////////////////////////////////////////////////////////////////////////// if (m_json.find("TargetPositionMotorSliderJoints") != m_json.end()) readTargetPositionMotorSliderJoints(m_json, "TargetPositionMotorSliderJoints", sceneData); ////////////////////////////////////////////////////////////////////////// // read TargetVelocityMotorSliderJoint ////////////////////////////////////////////////////////////////////////// if (m_json.find("TargetVelocityMotorSliderJoints") != m_json.end()) readTargetVelocityMotorSliderJoints(m_json, "TargetVelocityMotorSliderJoints", sceneData); } catch (std::exception& e) { LOG_ERR << e.what(); exit(1); } } void SceneLoader::readSimulation(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; readValue(child, "timeStepSize", sceneData.m_timeStepSize); readVector(child, "gravity", sceneData.m_gravity); readValue(child, "velocityUpdateMethod", sceneData.m_velocityUpdateMethod); readValue(child, "triangleModelSimulationMethod", sceneData.m_triangleModelSimulationMethod); readValue(child, "triangleModelBendingMethod", sceneData.m_triangleModelBendingMethod); readValue(child, "tetModelSimulationMethod", sceneData.m_tetModelSimulationMethod); readValue(child, "contactTolerance", sceneData.m_contactTolerance); readValue(child, "contactStiffnessRigidBody", sceneData.m_contactStiffnessRigidBody); readValue(child, "contactStiffnessParticleRigidBody", sceneData.m_contactStiffnessParticleRigidBody); // stiffness readValue(child, "cloth_stiffness", sceneData.m_cloth_stiffness); // bendingStiffness readValue(child, "cloth_bendingStiffness", sceneData.m_cloth_bendingStiffness); // xxStiffness, yyStiffness, xyStiffness readValue(child, "cloth_xxStiffness", sceneData.m_cloth_xxStiffness); readValue(child, "cloth_yyStiffness", sceneData.m_cloth_yyStiffness); readValue(child, "cloth_xyStiffness", sceneData.m_cloth_xyStiffness); // xyPoissonRatio, yxPoissonRatio readValue(child, "cloth_xyPoissonRatio", sceneData.m_cloth_xyPoissonRatio); readValue(child, "cloth_yxPoissonRatio", sceneData.m_cloth_yxPoissonRatio); // normalize readValue(child, "cloth_normalizeStretch", sceneData.m_cloth_normalizeStretch); readValue(child, "cloth_normalizeShear", sceneData.m_cloth_normalizeShear); // solid stiffness readValue(child, "solid_stiffness", sceneData.m_solid_stiffness); // Poisson ratio readValue(child, "solid_poissonRatio", sceneData.m_solid_poissonRatio); // normalize readValue(child, "solid_normalizeStretch", sceneData.m_solid_normalizeStretch); readValue(child, "solid_normalizeShear", sceneData.m_solid_normalizeShear); } void SceneLoader::readRigidBodies(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) { const nlohmann::json &child = j[key]; sceneData.m_rigidBodyData.reserve(5000); for (auto& rigidBody : child) { std::string geomFileName; if (readValue<std::string>(rigidBody, "geometryFile", geomFileName)) { if (FileSystem::isRelativePath(geomFileName)) { geomFileName = basePath + "/" + geomFileName; } sceneData.m_rigidBodyData.emplace_back(RigidBodyData()); RigidBodyData &rbd = sceneData.m_rigidBodyData.back(); rbd.m_modelFile = geomFileName; // id rbd.m_id = 0; readValue(rigidBody, "id", rbd.m_id); // is dynamic body rbd.m_isDynamic = true; readValue(rigidBody, "isDynamic", rbd.m_isDynamic); // density rbd.m_density = 1.0; readValue(rigidBody, "density", rbd.m_density); // translation rbd.m_x.setZero(); readVector(rigidBody, "translation", rbd.m_x); // rotation axis Vector3r axis; axis.setZero(); Real angle = 0.0; if (readVector(rigidBody, "rotationAxis", axis) && readValue<Real>(rigidBody, "rotationAngle", angle)) { axis.normalize(); rbd.m_q = Quaternionr(AngleAxisr(angle, axis)); } else rbd.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); // scale rbd.m_scale = Vector3r(1.0, 1.0, 1.0); readVector(rigidBody, "scale", rbd.m_scale); // velocity rbd.m_v.setZero(); readVector(rigidBody, "velocity", rbd.m_v); // angular velocity rbd.m_omega.setZero(); readVector(rigidBody, "angularVelocity", rbd.m_omega); // restitution rbd.m_restitutionCoeff = 0.6; readValue(rigidBody, "restitution", rbd.m_restitutionCoeff); // friction rbd.m_frictionCoeff = 0.2; readValue(rigidBody, "friction", rbd.m_frictionCoeff); // collision object type rbd.m_collisionObjectType = CollisionObjectTypes::No_Collision_Object; readValue(rigidBody, "collisionObjectType", rbd.m_collisionObjectType); rbd.m_collisionObjectFileName = ""; readValue(rigidBody, "collisionObjectFileName", rbd.m_collisionObjectFileName); // test mesh rbd.m_testMesh = true; readValue(rigidBody, "testMesh", rbd.m_testMesh); // scale rbd.m_collisionObjectScale = Vector3r(1.0, 1.0, 1.0); readVector(rigidBody, "collisionObjectScale", rbd.m_collisionObjectScale); rbd.m_invertSDF = false; readValue(rigidBody, "invertSDF", rbd.m_invertSDF); rbd.m_thicknessSDF = 0.1; readValue(rigidBody, "thicknessSDF", rbd.m_thicknessSDF); rbd.m_resolutionSDF = Eigen::Matrix<unsigned int, 3, 1, Eigen::DontAlign>(10, 10, 10); readVector(rigidBody, "resolutionSDF", rbd.m_resolutionSDF); rbd.m_json = rigidBody; } } } void SceneLoader::readTriangleModels(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& triModel : child) { std::string geomFileName; if (readValue<std::string>(triModel, "geometryFile", geomFileName)) { if (FileSystem::isRelativePath(geomFileName)) { geomFileName = basePath + "/" + geomFileName; } sceneData.m_triangleModelData.emplace_back(TriangleModelData()); TriangleModelData &data = sceneData.m_triangleModelData.back(); data.m_modelFile = geomFileName; // id data.m_id = 0; readValue(triModel, "id", data.m_id); // translation data.m_x.setZero(); readVector(triModel, "translation", data.m_x); // rotation axis Vector3r axis; axis.setZero(); Real angle = 0.0; if (readVector(triModel, "rotationAxis", axis) && readValue<Real>(triModel, "rotationAngle", angle)) { axis.normalize(); data.m_q = Quaternionr(AngleAxisr(angle, axis)); } else data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); // scale data.m_scale = Vector3r(1.0, 1.0, 1.0); readVector(triModel, "scale", data.m_scale); // static particles unsigned int index = 0; if (triModel.find("staticParticles") != triModel.end()) { data.m_staticParticles.reserve((unsigned int)triModel["staticParticles"].size()); for (auto& item : triModel["staticParticles"]) data.m_staticParticles.push_back(item.get<unsigned int>()); } // restitution data.m_restitutionCoeff = 0.1; readValue(triModel, "restitution", data.m_restitutionCoeff); // friction data.m_frictionCoeff = 0.2; readValue(triModel, "friction", data.m_frictionCoeff); data.m_json = triModel; } } } void SceneLoader::readTetModels(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& tetModel : child) { std::string nodeFileName, eleFileName; if (readValue<std::string>(tetModel, "nodeFile", nodeFileName) && readValue<std::string>(tetModel, "eleFile", eleFileName)) { if (FileSystem::isRelativePath(nodeFileName)) { nodeFileName = basePath + "/" + nodeFileName; } if (FileSystem::isRelativePath(eleFileName)) { eleFileName = basePath + "/" + eleFileName; } std::string visFileName = ""; if (readValue<std::string>(tetModel, "visFile", visFileName)) { if (FileSystem::isRelativePath(visFileName)) { visFileName = basePath + "/" + visFileName; } } sceneData.m_tetModelData.emplace_back(TetModelData()); TetModelData &data = sceneData.m_tetModelData.back(); data.m_modelFileNodes = nodeFileName; data.m_modelFileElements = eleFileName; data.m_modelFileVis = visFileName; // id data.m_id = 0; readValue(tetModel, "id", data.m_id); // translation data.m_x.setZero(); readVector(tetModel, "translation", data.m_x); // rotation axis Vector3r axis; axis.setZero(); Real angle = 0.0; if (readVector(tetModel, "rotationAxis", axis) && readValue<Real>(tetModel, "rotationAngle", angle)) { axis.normalize(); data.m_q = Quaternionr(AngleAxisr(angle, axis)); } else data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); // scale data.m_scale = Vector3r(1.0, 1.0, 1.0); readVector(tetModel, "scale", data.m_scale); // static particles unsigned int index = 0; if (tetModel.find("staticParticles") != tetModel.end()) { data.m_staticParticles.reserve((unsigned int)tetModel["staticParticles"].size()); for (auto& item : tetModel["staticParticles"]) data.m_staticParticles.push_back(item.get<unsigned int>()); } // restitution data.m_restitutionCoeff = 0.1; readValue(tetModel, "restitution", data.m_restitutionCoeff); // friction data.m_frictionCoeff = 0.2; readValue(tetModel, "friction", data.m_frictionCoeff); // collision object type data.m_collisionObjectType = CollisionObjectTypes::No_Collision_Object; readValue(tetModel, "collisionObjectType", data.m_collisionObjectType); data.m_collisionObjectFileName = ""; readValue(tetModel, "collisionObjectFileName", data.m_collisionObjectFileName); // test mesh data.m_testMesh = true; readValue(tetModel, "testMesh", data.m_testMesh); // scale data.m_collisionObjectScale = Vector3r(1.0, 1.0, 1.0); readVector(tetModel, "collisionObjectScale", data.m_collisionObjectScale); data.m_invertSDF = false; readValue(tetModel, "invertSDF", data.m_invertSDF); data.m_thicknessSDF = 0.1; readValue(tetModel, "thicknessSDF", data.m_thicknessSDF); data.m_resolutionSDF = Eigen::Matrix<unsigned int, 3, 1, Eigen::DontAlign>(10, 10, 10); readVector(tetModel, "resolutionSDF", data.m_resolutionSDF); data.m_json = tetModel; } } } void SceneLoader::readKinematics(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (const auto& kinModel : child) { // id unsigned int model_id = 0; readValue(kinModel, "id", model_id); nlohmann::json prescribed_motions = kinModel["prescribedMotions"]; for (const auto& prescr_mot : prescribed_motions) { sceneData.m_kinematicsData.emplace_back(KinematicsData()); KinematicsData &data = sceneData.m_kinematicsData.back(); data.m_id = model_id; // Start time data.m_startTime = 0.0; readValue(prescr_mot, "startTime", data.m_startTime); // End time data.m_endTime = static_cast<Real>(-1.0); readValue(prescr_mot, "endTime", data.m_endTime); // Translation expression data.m_translation[0] = ""; readValue(prescr_mot, "translation_x", data.m_translation[0]); data.m_translation[1] = ""; readValue(prescr_mot, "translation_y", data.m_translation[1]); data.m_translation[2] = ""; readValue(prescr_mot, "translation_z", data.m_translation[2]); // Rotation Axis data.m_rotationAxis = Vector3r::UnitX(); readVector(prescr_mot, "rotation_axis", data.m_rotationAxis); // Angular Velocity data.m_angularVel = static_cast<Real>(0.0); readValue(prescr_mot, "ang_vel", data.m_angularVel); // Use custom reference point data.m_useCustomReferencePoint = false; readValue(prescr_mot, "use_custom_reference_point", data.m_useCustomReferencePoint); // Use avg reference point data.m_useAvgReferencePoint = false; readValue(prescr_mot, "use_avg_reference_point", data.m_useAvgReferencePoint); // Reference Point data.m_refPoint = Vector3r::Zero(); readVector(prescr_mot, "ref_point", data.m_refPoint); // Support Vector data.m_supportVector = Vector3r::Zero(); readVector(prescr_mot, "support_vec", data.m_supportVector); } } } void SceneLoader::readBallJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { BallJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position)) { sceneData.m_ballJointData.push_back(jd); } } } void SceneLoader::readBallOnLineJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { BallOnLineJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position) && readVector(joint, "axis", jd.m_axis)) { sceneData.m_ballOnLineJointData.push_back(jd); } } } void SceneLoader::readHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { HingeJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position) && readVector(joint, "axis", jd.m_axis)) { sceneData.m_hingeJointData.push_back(jd); } } } void SceneLoader::readUniversalJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { UniversalJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position) && readVector(joint, "axis1", jd.m_axis[0]) && readVector(joint, "axis2", jd.m_axis[1])) { sceneData.m_universalJointData.push_back(jd); } } } void SceneLoader::readSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { SliderJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "axis", jd.m_axis)) { sceneData.m_sliderJointData.push_back(jd); } } } void SceneLoader::readRigidBodyParticleBallJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { RigidBodyParticleBallJointData jd; if (readValue(joint, "rbID", jd.m_bodyID[0]) && readValue(joint, "particleID", jd.m_bodyID[1])) { sceneData.m_rigidBodyParticleBallJointData.push_back(jd); } } } void SceneLoader::readTargetAngleMotorHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { TargetAngleMotorHingeJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position) && readVector(joint, "axis", jd.m_axis)) { if (!readValue(joint, "target", jd.m_target)) { jd.m_target = 0.0; // target sequence unsigned int index = 0; if (joint.find("targetSequence") != joint.end()) { jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); for (auto& item : joint["targetSequence"]) jd.m_targetSequence.push_back(item.get<Real>()); // be sure that we have an even number of values if (jd.m_targetSequence.size() % 2 == 1) jd.m_targetSequence.pop_back(); readValue(joint, "repeatSequence", jd.m_repeat); } } sceneData.m_targetAngleMotorHingeJointData.push_back(jd); } } } void SceneLoader::readTargetVelocityMotorHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { TargetVelocityMotorHingeJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position", jd.m_position) && readVector(joint, "axis", jd.m_axis)) { if (!readValue(joint, "target", jd.m_target)) { jd.m_target = 0.0; // target sequence unsigned int index = 0; if (joint.find("targetSequence") != joint.end()) { jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); for (auto& item : joint["targetSequence"]) jd.m_targetSequence.push_back(item.get<Real>()); // be sure that we have an even number of values if (jd.m_targetSequence.size() % 2 == 1) jd.m_targetSequence.pop_back(); readValue(joint, "repeatSequence", jd.m_repeat); } } sceneData.m_targetVelocityMotorHingeJointData.push_back(jd); } } } void SceneLoader::readTargetPositionMotorSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { TargetPositionMotorSliderJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "axis", jd.m_axis)) { if (!readValue(joint, "target", jd.m_target)) { jd.m_target = 0.0; // target sequence unsigned int index = 0; if (joint.find("targetSequence") != joint.end()) { jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); for (auto& item : joint["targetSequence"]) jd.m_targetSequence.push_back(item.get<Real>()); // be sure that we have an even number of values if (jd.m_targetSequence.size() % 2 == 1) jd.m_targetSequence.pop_back(); readValue(joint, "repeatSequence", jd.m_repeat); } } sceneData.m_targetPositionMotorSliderJointData.push_back(jd); } } } void SceneLoader::readTargetVelocityMotorSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { TargetVelocityMotorSliderJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "axis", jd.m_axis)) { if (!readValue(joint, "target", jd.m_target)) { jd.m_target = 0.0; // target sequence unsigned int index = 0; if (joint.find("targetSequence") != joint.end()) { jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); for (auto& item : joint["targetSequence"]) jd.m_targetSequence.push_back(item.get<Real>()); // be sure that we have an even number of values if (jd.m_targetSequence.size() % 2 == 1) jd.m_targetSequence.pop_back(); readValue(joint, "repeatSequence", jd.m_repeat); } } sceneData.m_targetVelocityMotorSliderJointData.push_back(jd); } } } void SceneLoader::readRigidBodySprings(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { RigidBodySpringData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position1", jd.m_position1) && readVector(joint, "position2", jd.m_position2) && readValue(joint, "stiffness", jd.m_stiffness)) { sceneData.m_rigidBodySpringData.push_back(jd); } } } void SceneLoader::readDistanceJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { DistanceJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "position1", jd.m_position1) && readVector(joint, "position2", jd.m_position2)) { sceneData.m_distanceJointData.push_back(jd); } } } void SceneLoader::readDamperJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) { const nlohmann::json &child = j[key]; for (auto& joint : child) { DamperJointData jd; if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && readValue(joint, "bodyID2", jd.m_bodyID[1]) && readVector(joint, "axis", jd.m_axis) && readValue(joint, "stiffness", jd.m_stiffness)) { sceneData.m_damperJointData.push_back(jd); } } } template <> bool SceneLoader::readValue<bool>(const nlohmann::json &j, const std::string &key, bool &v) { if (j.find(key) == j.end()) return false; if (j[key].is_number_integer()) { int val = j[key].get<int>(); v = val != 0; } else v = j[key].get<bool>(); return true; } void SceneLoader::readParameterObject(ParameterObject *paramObj) { if (paramObj == nullptr) return; const unsigned int numParams = paramObj->numParameters(); ////////////////////////////////////////////////////////////////////////// // read configuration ////////////////////////////////////////////////////////////////////////// if (m_json.find("Simulation") != m_json.end()) { nlohmann::json config = m_json["Simulation"]; std::vector<std::string> newParamList; for (unsigned int i = 0; i < numParams; i++) { ParameterBase *paramBase = paramObj->getParameter(i); if (paramBase->getType() == RealParameterType) { Real val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<Real>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::UINT32) { unsigned int val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<unsigned int>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::UINT16) { unsigned short val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<unsigned short>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::UINT8) { unsigned char val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<unsigned char>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::INT32) { int val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<int>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::INT16) { short val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<short>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::INT8) { char val; if (readValue(config, paramBase->getName(), val)) static_cast<NumericParameter<char>*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::ENUM) { int val; if (readValue(config, paramBase->getName(), val)) static_cast<EnumParameter*>(paramBase)->setValue(val); } else if (paramBase->getType() == ParameterBase::BOOL) { bool val; if (readValue(config, paramBase->getName(), val)) static_cast<BoolParameter*>(paramBase)->setValue(val); } else if (paramBase->getType() == RealVectorParameterType) { if (static_cast<VectorParameter<Real>*>(paramBase)->getDim() == 3) { Vector3r val; if (readVector(config, paramBase->getName(), val)) static_cast<VectorParameter<Real>*>(paramBase)->setValue(val.data()); } } } } }
;============================================================================ ; C64 Bedtime Coding ; Copyright (c) by Phaze101 ; eMail - info@phaze101.com ; website - https://www.phaze101.com ; MIT License - https://choosealicense.com/licenses/mit/ ;============================================================================ ;############################################################################## ; Using the Random methods #6 ; Using Colour Memory to obtain Random Numbers ;############################################################################## * = $C000 jmp Start IncAsm "Libs\Constants.asm" IncAsm "Libs\ScrLib.asm" IncAsm "Libs\RandomLib.asm" IncAsm "Libs\Hex2Dec.asm" Start lda #$00 sta $d020 sta $d021 Main ; jsr WaitVBlank jsr GetRandom ldx _101_RNDV2 lda #$51 sta $0400,x lda _101_RNDv1 sta $d800,x jmp Main ; Not a fan of jumps
include "./src/Includes.inc" section "Start", rom0 ; Local macros for code cleanliness ; It's a macro to save uneeded code jumping or stack usage ; Init System "Settings" init_registers: macro xor a ; Zero A ; Clear and Reset Several Registers and Flags ld [rIF], a ; Interrupt Reason Flags ld [rSB], a ld [rSC], a ; Serial Transfer ld [rSCY], a ld [rSCX], a ; Background Scrolling ; Properly setup window placement ld [rWY], a ld a, 7 ld [rWX], a ; When interrupts are re-enabled at the end ; We're only interested in Serial, Timer, LCDC, and VBlank Interrupts only ld a, IEF_SERIAL | IEF_TIMER | IEF_LCDC | IEF_VBLANK ld [rIE], a ; We're also interested in H-Blank Interrupts ld a, STATF_SEL_MODE00 ld [rSTAT], a ; For now LYC Interrupts trigger on VBlank ld a, SCRN_Y ld [rLYC], a ; Reset Palettes ; 11 22 33 44 ; 1 = Color for Darkest Color ; 4 = Color for Lightest Color ; ; The default is ; 11 10 01 00 ; Keep that way for now ld a, %11100100 ld [rBGP], a ld [rOBP0], a ld [rOBP1], a ; Reset Palettes ; Enable ticking timer at 4KHz to count from 0-255 set_timer 4, 0 ; Enable background and switch it to map 0 ($9800) background "on" background "map 0" ; Disable window but prepare it to same map window "off" window "map 0" ; Disable sprites but prepare them to be 8x8 sprites "off" sprites "8x8" ; Use tiledata 1 (Dedicated to Window and BG) ($9000) tiledata 1 endm ; Wipe all memory and cartridge ram if needed and properly setup init_memory: macro ; Power On Cartridge RAM mbc_power "on" ; Wipe All Internal Memory wipe_memory ; Move stack pointer to cleaned up and larger memory section ; From 113 bytes to 256 bytes and expandable ld sp, wStackPointer ; Clean up HRAM now that the SP has vacated it fill _HRAM, _HRAM_SIZE, 0 ; Reset Joypad joypad_reset ; Init and Setup MBC Controller ; Format Cart RAM if need be mbc_init ; Select ROM & RAM Bank 1 ; The Gameboy wants external RAM turned off whenever possible ; to protect accidental data corruption on a power cycle ; We use the RAM for both persistent and non-persistent data ; Therefore we switch to a non-persistent data bank where we ; don't care if this happens ; Leaving it on saves precious clock cycles since we do intend ; to use it for non-persistent data and don't need to keep turning ; it on and off ; Always ensure it's never on a persistent data bank when not needed mbc_select "rom", 1 mbc_select "ram", 1 ; Set OAM page to $C0 ld a, $C0 ld [wOamPage], a ; Init timers ld a, TIMER_TMA ld [wTimerCount], a ld a, TIMER_QUART_SECOND_TMA ld [wTimerQuartSec], a ld a, TIMER_SECOND_TMA ld [wTimerS], a ld a, TIMER_MINUTE_TMA ld [wTimerM], a ld a, TIMER_HOUR_TMA ld [wTimerH], a ; Copy Font into Window & BG Tile Data copy FontTileset, vTileset2, FontTilesetEnd - FontTileset ; Copy Hotel Tileset into Window & BG Tile Data copy HotelTileset, vTilesetShared, HotelTilesetEnd - HotelTileset endm ; Initial setup of the Gameboy Start:: ; Disable Interrupts so we're left alone to initialize ; everything in peace di ; Place the processor stack somewhere temporary ; until we can setup things more ld sp, $FFFE ; Wait for a VBlank meaning all memory is open ; Since interupts are disabled this is a polling wait ; We want to specifically wait until the start of vblank poll_vblank_start ; Disable LCD Screen ; This ensures everything remains uninterupted ; and stays in a permanent V-Blank until re-enabled lcd_power "off" ; Format and Init all Memory init_memory ; Setup All System Registers init_registers ;Install DMA to HRAM (also initiates first run) dma_install ; Print Main Screen starting at UL corner of MAP 0 printmap ScreenMain, _MAP0, 0, 0 ; Flip LCD back on lcd_power "on" ; Re-Enable Interupts now that everything is properly setup ei ; We're done, begin game as usual jp GameLoop
; A135556: Squares of numbers not divisible by 3: a(n) = A001651(n)^2. ; 1,4,16,25,49,64,100,121,169,196,256,289,361,400,484,529,625,676,784,841,961,1024,1156,1225,1369,1444,1600,1681,1849,1936,2116,2209,2401,2500,2704,2809,3025,3136,3364,3481,3721,3844,4096,4225,4489,4624,4900,5041,5329,5476,5776,5929,6241,6400,6724,6889,7225,7396,7744,7921,8281,8464,8836,9025,9409,9604,10000,10201,10609,10816,11236,11449,11881,12100,12544,12769,13225,13456,13924,14161,14641,14884,15376,15625,16129,16384,16900,17161,17689,17956,18496,18769,19321,19600,20164,20449,21025,21316,21904,22201 mul $0,6 add $0,5 div $0,4 pow $0,2
; Small C+ Maths Routines ; ; transcendental floating point routines ; SECTION code_fp PUBLIC pi EXTERN ldfabc ;double pi() ;Just the greek PI constant .pi LD BC,$8249 ; 3,1415... LD IX,$0FDA LD DE,$A222 JP ldfabc
; int __CALLEE__ adt_QueuePushBack_callee(struct adt_Queue *q, void *item) ; 09.2005 aralbrec XLIB adt_QueuePushBack_callee XDEF ASMDISP_ADT_QUEUEPUSHBACK_CALLEE XREF _u_malloc .adt_QueuePushBack_callee pop hl pop de ex (sp),hl .asmentry ; enter: HL = struct adt_Queue * ; DE = item ; exit : HL = 0 and carry reset if memory allocation failed ; carry set if success push de push hl ld hl,4 ; sizeof (struct adt_QueueNode) push hl call _u_malloc ; get memory for a queue node pop de pop de ; de = struct adt_Queue * pop bc ; bc = item ret nc ; ret with hl = 0 if alloc failed push hl ; stack = new QueueNode* ld (hl),c ; store item in new QueueNode container inc hl ld (hl),b inc hl xor a ld (hl),a ; QueueNode.next = 0 inc hl ld (hl),a ex de,hl ; hl = Queue.count ld a,(hl) inc (hl) ; count++ inc hl ld c,(hl) jr nz, nohi inc (hl) .nohi or c ; Z flag if no items in queue inc hl ; hl = Queue.front pop bc ; bc = new QueueNode jp nz, Qnotempty ld (hl),c ; an empty queue so make inc hl ; Queue.front = new QueueNode ld (hl),b dec hl .Qnotempty inc hl inc hl ; hl = Queue.back ld e,(hl) ; de = current last QueueNode ld (hl),c ; Queue.back = new QueueNode inc hl ld d,(hl) ld (hl),b ex de,hl ; hl = last QueueNode inc hl inc hl ld (hl),c ; last QueueNode.next = new QueueNode inc hl ld (hl),b scf ret DEFC ASMDISP_ADT_QUEUEPUSHBACK_CALLEE = asmentry - adt_QueuePushBack_callee
; A052156: Number of compositions of n into 2*j-1 kinds of j's for all j>=1. ; 1,1,4,12,36,108,324,972,2916,8748,26244,78732,236196,708588,2125764,6377292,19131876,57395628,172186884,516560652,1549681956,4649045868,13947137604,41841412812,125524238436,376572715308,1129718145924,3389154437772,10167463313316,30502389939948,91507169819844,274521509459532,823564528378596,2470693585135788,7412080755407364,22236242266222092,66708726798666276,200126180395998828,600378541187996484,1801135623563989452,5403406870691968356,16210220612075905068,48630661836227715204,145891985508683145612,437675956526049436836,1313027869578148310508,3939083608734444931524,11817250826203334794572,35451752478610004383716,106355257435830013151148,319065772307490039453444,957197316922470118360332,2871591950767410355080996,8614775852302231065242988,25844327556906693195728964,77532982670720079587186892,232598948012160238761560676,697796844036480716284682028,2093390532109442148854046084,6280171596328326446562138252,18840514788984979339686414756,56521544366954938019059244268,169564633100864814057177732804,508693899302594442171533198412,1526081697907783326514599595236,4578245093723349979543798785708,13734735281170049938631396357124,41204205843510149815894189071372,123612617530530449447682567214116,370837852591591348343047701642348,1112513557774774045029143104927044,3337540673324322135087429314781132,10012622019972966405262287944343396,30037866059918899215786863833030188,90113598179756697647360591499090564,270340794539270092942081774497271692,811022383617810278826245323491815076 mov $1,3 pow $1,$0 mul $1,8 div $1,6 sub $1,3 div $1,3 add $1,1 mov $0,$1
; A132171: 3^n repeated 3^n times. ; 1,3,3,3,9,9,9,9,9,9,9,9,9,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81 lpb $0 sub $0,1 div $0,3 mul $1,3 add $1,1 lpe mul $1,2 add $1,1 mov $0,$1
#include <iostream> #include <memory> #include <utility> #include "base_test.hpp" #include "gtest/gtest.h" #include "operators/abstract_read_only_operator.hpp" #include "operators/join_nested_loop.hpp" #include "operators/print.hpp" #include "operators/sort.hpp" #include "operators/table_scan.hpp" #include "operators/table_wrapper.hpp" #include "operators/union_all.hpp" #include "storage/chunk_encoder.hpp" #include "storage/storage_manager.hpp" #include "storage/table.hpp" #include "types.hpp" namespace opossum { class OperatorsSortTest : public BaseTestWithParam<EncodingType> { protected: void SetUp() override { _encoding_type = GetParam(); _table_wrapper = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float.tbl", 2)); _table_wrapper_null = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float_with_null.tbl", 2)); auto table = load_table("resources/test_data/tbl/int_float.tbl", 2); ChunkEncoder::encode_all_chunks(table, _encoding_type); auto table_dict = load_table("resources/test_data/tbl/int_float_with_null.tbl", 2); ChunkEncoder::encode_all_chunks(table_dict, _encoding_type); _table_wrapper_dict = std::make_shared<TableWrapper>(std::move(table)); _table_wrapper_dict->execute(); _table_wrapper_null_dict = std::make_shared<TableWrapper>(std::move(table_dict)); _table_wrapper_null_dict->execute(); _table_wrapper_outer_join = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float2.tbl", 2)); _table_wrapper_outer_join->execute(); _table_wrapper->execute(); _table_wrapper_null->execute(); } protected: std::shared_ptr<TableWrapper> _table_wrapper, _table_wrapper_null, _table_wrapper_dict, _table_wrapper_null_dict, _table_wrapper_outer_join; EncodingType _encoding_type; }; auto formatter = [](const ::testing::TestParamInfo<EncodingType> info) { return std::to_string(static_cast<uint32_t>(info.param)); }; // As long as two implementation of dictionary encoding exist, this ensure to run the tests for both. INSTANTIATE_TEST_CASE_P(DictionaryEncodingTypes, OperatorsSortTest, ::testing::Values(EncodingType::Dictionary), formatter); TEST_P(OperatorsSortTest, AscendingSortOfOneColumn) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_sorted.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper, ColumnID{0}, OrderByMode::Ascending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOFilteredColumn) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_filtered_sorted.tbl", 2); auto input = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float.tbl", 1)); input->execute(); auto scan = create_table_scan(input, ColumnID{0}, PredicateCondition::NotEquals, 123); scan->execute(); auto sort = std::make_shared<Sort>(scan, ColumnID{0}, OrderByMode::Ascending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOfOneColumnWithoutChunkSize) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_sorted.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper, ColumnID{0}, OrderByMode::Ascending); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, DoubleSortOfOneColumn) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_sorted.tbl", 2); auto sort1 = std::make_shared<Sort>(_table_wrapper, ColumnID{0}, OrderByMode::Descending, 2u); sort1->execute(); auto sort2 = std::make_shared<Sort>(sort1, ColumnID{0}, OrderByMode::Ascending, 2u); sort2->execute(); EXPECT_TABLE_EQ_ORDERED(sort2->get_output(), expected_result); } TEST_P(OperatorsSortTest, DescendingSortOfOneColumn) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_reverse.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper, ColumnID{0}, OrderByMode::Descending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, MultipleColumnSortIsStable) { auto table_wrapper = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float4.tbl", 2)); table_wrapper->execute(); std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float2_sorted.tbl", 2); // we want the output to be sorted after column a and in second place after column b. // So first we sort after column b and then after column a. auto sort_after_b = std::make_shared<Sort>(table_wrapper, ColumnID{1}, OrderByMode::Ascending, 2u); sort_after_b->execute(); auto sort_after_a = std::make_shared<Sort>(sort_after_b, ColumnID{0}, OrderByMode::Ascending, 2u); sort_after_a->execute(); EXPECT_TABLE_EQ_ORDERED(sort_after_a->get_output(), expected_result); } TEST_P(OperatorsSortTest, MultipleColumnSortIsStableMixedOrder) { auto table_wrapper = std::make_shared<TableWrapper>(load_table("resources/test_data/tbl/int_float4.tbl", 2)); table_wrapper->execute(); std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float2_sorted_mixed.tbl", 2); // we want the output to be sorted after column a and in second place after column b. // So first we sort after column b and then after column a. auto sort_after_b = std::make_shared<Sort>(table_wrapper, ColumnID{1}, OrderByMode::Descending, 2u); sort_after_b->execute(); auto sort_after_a = std::make_shared<Sort>(sort_after_b, ColumnID{0}, OrderByMode::Ascending, 2u); sort_after_a->execute(); EXPECT_TABLE_EQ_ORDERED(sort_after_a->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOfOneColumnWithNull) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_asc.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null, ColumnID{0}, OrderByMode::Ascending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, DescendingSortOfOneColumnWithNull) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_desc.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null, ColumnID{0}, OrderByMode::Descending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOfOneColumnWithNullsLast) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_asc_nulls_last.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null, ColumnID{0}, OrderByMode::AscendingNullsLast, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, DescendingSortOfOneColumnWithNullsLast) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_desc_nulls_last.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null, ColumnID{0}, OrderByMode::DescendingNullsLast, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOfOneDictSegmentWithNull) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_asc.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null_dict, ColumnID{0}, OrderByMode::Ascending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, DescendingSortOfOneDictSegmentWithNull) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_null_sorted_desc.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_null_dict, ColumnID{0}, OrderByMode::Descending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, AscendingSortOfOneDictSegment) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_sorted.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_dict, ColumnID{0}, OrderByMode::Ascending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, DescendingSortOfOneDictSegment) { std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/int_float_reverse.tbl", 2); auto sort = std::make_shared<Sort>(_table_wrapper_dict, ColumnID{0}, OrderByMode::Descending, 2u); sort->execute(); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } TEST_P(OperatorsSortTest, SortAfterOuterJoin) { auto join = std::make_shared<JoinNestedLoop>(_table_wrapper, _table_wrapper_outer_join, JoinMode::FullOuter, OperatorJoinPredicate{{ColumnID{0}, ColumnID{0}}, PredicateCondition::Equals}); join->execute(); auto sort = std::make_shared<Sort>(join, ColumnID{0}, OrderByMode::Ascending); sort->execute(); std::shared_ptr<Table> expected_result = load_table("resources/test_data/tbl/join_operators/int_outer_join_sorted_asc.tbl", 2); EXPECT_TABLE_EQ_ORDERED(sort->get_output(), expected_result); } } // namespace opossum
; A011860: Floor( n(n-1)/7 ). ; 0,0,0,0,1,2,4,6,8,10,12,15,18,22,26,30,34,38,43,48,54,60,66,72,78,85,92,100,108,116,124,132,141,150,160,170,180,190,200,211,222,234,246,258,270,282,295,308,322,336,350,364,378,393,408,424,440,456,472,488,505 mov $1,$0 sub $1,1 mul $0,$1 div $0,7
<% from pwnlib.shellcraft.arm.linux import syscall %> <%page args="when"/> <%docstring> Invokes the syscall stime. See 'man 2 stime' for more information. Arguments: when(time_t): when </%docstring> ${syscall('SYS_stime', when)}
FUNC @main: var n readint "Please input an integer: " pop n push n print "Your input number is: %d" push 0 ret ~ ENDFUNC
# # Test for instructions APX, AUX. # org 1 lbl start xta chess apx cful aux c0ful aex chess+1 uia fail xta chess apx chess+1 uia fail xta chess apx chess aux chess+1 aex chess+1 uia fail xta cful aux chess+1 aex chess+1 uia fail lbl pass stop 0o12345,6 lbl fail stop 0o76543,2 # dorg 0o2000 arr cful 0o7777777777777777 arr c0ful 0o3777777777777777 arr chess [0o5252525252525252, 0o2525252525252525]
ori $1, $0, 12 ori $2, $0, 15 ori $3, $0, 5 ori $4, $0, 12 sw $4, 0($0) sw $4, 4($0) sw $3, 8($0) sw $2, 12($0) sw $1, 16($0) sw $3, 20($0) sw $2, 24($0) sw $2, 28($0) sw $2, 32($0) sw $4, 36($0) sw $3, 40($0) sw $4, 44($0) sw $1, 48($0) sw $4, 52($0) sw $4, 56($0) sw $2, 60($0) sw $2, 64($0) sw $2, 68($0) sw $1, 72($0) sw $3, 76($0) sw $1, 80($0) sw $1, 84($0) sw $4, 88($0) sw $4, 92($0) sw $2, 96($0) sw $2, 100($0) sw $2, 104($0) sw $4, 108($0) sw $1, 112($0) sw $2, 116($0) sw $2, 120($0) sw $4, 124($0) ori $1, $2, 3 bgez $2, TAG1 lui $3, 8 mult $1, $2 TAG1: lui $2, 14 sll $0, $0, 0 bgez $2, TAG2 sll $0, $0, 0 TAG2: sll $0, $0, 0 bne $2, $2, TAG3 sll $0, $0, 0 sll $0, $0, 0 TAG3: sll $0, $0, 0 mfhi $2 lbu $4, 0($2) bne $2, $4, TAG4 TAG4: lbu $2, 0($4) ori $2, $2, 9 lh $4, 0($4) sb $2, 0($4) TAG5: bne $4, $4, TAG6 sb $4, 0($4) lb $4, 0($4) bltz $4, TAG6 TAG6: multu $4, $4 div $4, $4 mfhi $3 sw $4, 0($3) TAG7: mflo $3 mflo $4 bgez $3, TAG8 divu $4, $3 TAG8: xor $2, $4, $4 lui $3, 1 mfhi $1 lhu $4, 0($2) TAG9: lui $2, 9 sllv $2, $4, $4 sra $1, $2, 9 bgez $2, TAG10 TAG10: sb $1, -960($1) mthi $1 mtlo $1 mthi $1 TAG11: mtlo $1 lui $2, 14 beq $1, $2, TAG12 sll $0, $0, 0 TAG12: ori $1, $2, 3 blez $1, TAG13 lui $4, 1 xor $3, $1, $4 TAG13: mtlo $3 bltz $3, TAG14 sll $0, $0, 0 sll $0, $0, 0 TAG14: mflo $4 beq $1, $1, TAG15 mflo $1 sh $4, 0($1) TAG15: beq $1, $1, TAG16 mthi $1 lui $3, 9 bne $3, $1, TAG16 TAG16: lui $4, 15 beq $4, $3, TAG17 divu $3, $3 blez $3, TAG17 TAG17: lui $4, 14 lui $2, 13 mflo $1 bltz $4, TAG18 TAG18: lui $4, 14 bne $1, $1, TAG19 sll $0, $0, 0 divu $4, $4 TAG19: mthi $4 sll $0, $0, 0 sra $2, $4, 12 mflo $1 TAG20: sb $1, 0($1) lui $4, 0 bltz $4, TAG21 sw $4, 0($4) TAG21: mtlo $4 mult $4, $4 lui $1, 7 beq $1, $4, TAG22 TAG22: sll $0, $0, 0 mtlo $1 sll $0, $0, 0 srl $1, $1, 14 TAG23: bltz $1, TAG24 lui $2, 4 divu $2, $1 bgez $1, TAG24 TAG24: sll $0, $0, 0 div $2, $2 mtlo $2 lui $1, 0 TAG25: bgez $1, TAG26 lb $2, 0($1) sltu $4, $1, $1 sw $2, 0($1) TAG26: mthi $4 bgtz $4, TAG27 sra $3, $4, 10 bne $4, $3, TAG27 TAG27: lw $3, 0($3) mfhi $3 mfhi $3 bgez $3, TAG28 TAG28: mfhi $1 blez $1, TAG29 subu $1, $3, $1 sb $1, 0($1) TAG29: lui $3, 12 lui $2, 15 mthi $1 sll $0, $0, 0 TAG30: mflo $4 sll $0, $0, 0 sll $0, $0, 0 mult $2, $2 TAG31: bgtz $4, TAG32 mtlo $4 lui $4, 4 srlv $1, $4, $4 TAG32: addi $3, $1, 13 mtlo $3 blez $3, TAG33 lw $1, 0($1) TAG33: bne $1, $1, TAG34 lw $4, 0($1) sltiu $4, $1, 12 mfhi $1 TAG34: beq $1, $1, TAG35 sll $1, $1, 9 lbu $3, 0($1) lb $3, 0($3) TAG35: div $3, $3 addiu $4, $3, 13 bne $4, $4, TAG36 multu $3, $3 TAG36: bne $4, $4, TAG37 multu $4, $4 divu $4, $4 mthi $4 TAG37: lh $2, 0($4) mthi $2 sh $2, 0($4) beq $2, $2, TAG38 TAG38: mthi $2 mflo $1 mflo $3 mflo $3 TAG39: sb $3, 0($3) div $3, $3 mfhi $2 srlv $4, $2, $2 TAG40: lui $4, 5 mfhi $1 lui $2, 15 sll $0, $0, 0 TAG41: mfhi $4 beq $4, $4, TAG42 mfhi $1 bgez $1, TAG42 TAG42: lh $1, 0($1) mfhi $3 bgtz $1, TAG43 sra $3, $1, 5 TAG43: mthi $3 sb $3, 0($3) lw $2, 0($3) srl $2, $2, 15 TAG44: lbu $3, 0($2) mtlo $2 mfhi $3 mult $3, $2 TAG45: sb $3, 0($3) mfhi $2 div $3, $3 bltz $2, TAG46 TAG46: mfhi $2 beq $2, $2, TAG47 lw $4, 0($2) sub $1, $2, $2 TAG47: sll $0, $0, 0 sb $1, 0($2) sra $3, $1, 12 lui $4, 11 TAG48: mtlo $4 bne $4, $4, TAG49 mtlo $4 bltz $4, TAG49 TAG49: lui $3, 7 xor $3, $4, $3 addiu $3, $3, 5 lui $1, 6 TAG50: mtlo $1 multu $1, $1 bne $1, $1, TAG51 sll $0, $0, 0 TAG51: beq $4, $4, TAG52 mthi $4 sw $4, 0($4) beq $4, $4, TAG52 TAG52: lui $2, 2 sll $0, $0, 0 mult $1, $4 xori $4, $2, 13 TAG53: multu $4, $4 sll $0, $0, 0 multu $4, $4 beq $4, $4, TAG54 TAG54: xori $4, $4, 5 mthi $4 bltz $4, TAG55 mthi $4 TAG55: sll $0, $0, 0 sll $0, $0, 0 beq $4, $4, TAG56 sll $0, $0, 0 TAG56: bltz $3, TAG57 mtlo $3 mfhi $2 sll $0, $0, 0 TAG57: multu $2, $2 sll $0, $0, 0 beq $2, $2, TAG58 mfhi $3 TAG58: blez $3, TAG59 mthi $3 mthi $3 lh $1, 0($3) TAG59: ori $1, $1, 0 slt $3, $1, $1 div $3, $1 sltu $1, $3, $1 TAG60: lui $2, 13 sb $1, 0($1) srav $4, $2, $2 sb $2, 0($1) TAG61: sll $0, $0, 0 mult $4, $3 mthi $3 div $3, $4 TAG62: lbu $3, 0($3) bne $3, $3, TAG63 mthi $3 or $2, $3, $3 TAG63: sll $4, $2, 2 lui $2, 14 divu $4, $2 sll $0, $0, 0 TAG64: xori $4, $1, 8 divu $4, $4 sb $1, 0($4) mthi $1 TAG65: bne $4, $4, TAG66 lbu $4, 0($4) mult $4, $4 mthi $4 TAG66: sra $4, $4, 4 mflo $2 lui $2, 13 lui $2, 14 TAG67: lui $1, 4 addiu $4, $1, 15 subu $1, $4, $1 sll $0, $0, 0 TAG68: subu $3, $4, $4 mtlo $4 nor $1, $4, $4 mult $4, $3 TAG69: lui $1, 8 sll $0, $0, 0 mult $1, $2 sll $0, $0, 0 TAG70: lui $2, 4 mthi $2 mthi $2 sll $0, $0, 0 TAG71: mflo $1 lw $4, 0($1) mflo $4 lui $2, 8 TAG72: sll $0, $0, 0 sll $0, $0, 0 mthi $2 sll $1, $2, 15 TAG73: lui $3, 1 mtlo $3 and $1, $1, $1 bne $1, $3, TAG74 TAG74: lb $3, 0($1) bne $3, $1, TAG75 sra $1, $3, 2 bne $3, $3, TAG75 TAG75: slt $1, $1, $1 multu $1, $1 mult $1, $1 sh $1, 0($1) TAG76: bne $1, $1, TAG77 lui $4, 14 mflo $1 sw $1, 0($1) TAG77: mflo $3 bne $3, $1, TAG78 mult $3, $1 slti $2, $1, 4 TAG78: lb $1, 0($2) sb $2, 0($1) lh $2, 0($1) beq $2, $2, TAG79 TAG79: addiu $1, $2, 10 lbu $4, 0($2) bltz $4, TAG80 lbu $1, 0($1) TAG80: bgtz $1, TAG81 lui $4, 6 lui $3, 7 bne $3, $4, TAG81 TAG81: lui $1, 2 mflo $4 mthi $4 bne $4, $3, TAG82 TAG82: addu $4, $4, $4 sb $4, 0($4) ori $4, $4, 10 lh $2, 0($4) TAG83: mthi $2 blez $2, TAG84 multu $2, $2 xori $1, $2, 2 TAG84: bgez $1, TAG85 multu $1, $1 div $1, $1 mult $1, $1 TAG85: mfhi $1 sltiu $4, $1, 9 lui $1, 9 sb $1, 0($4) TAG86: lui $2, 13 sll $0, $0, 0 subu $1, $2, $1 sltiu $1, $1, 11 TAG87: mfhi $4 mthi $4 multu $4, $1 bne $4, $1, TAG88 TAG88: mtlo $4 mthi $4 srav $4, $4, $4 bne $4, $4, TAG89 TAG89: mtlo $4 srav $1, $4, $4 beq $1, $4, TAG90 multu $4, $1 TAG90: lui $3, 4 sltiu $4, $1, 0 mflo $2 addu $2, $1, $3 TAG91: mult $2, $2 bgtz $2, TAG92 srl $2, $2, 6 mthi $2 TAG92: sll $0, $0, 0 sb $4, 0($4) beq $4, $2, TAG93 mthi $2 TAG93: multu $4, $4 nor $1, $4, $4 mult $4, $4 bne $1, $1, TAG94 TAG94: div $1, $1 bne $1, $1, TAG95 sb $1, 1($1) mtlo $1 TAG95: lui $3, 15 mflo $3 lui $2, 3 mult $2, $2 TAG96: xor $4, $2, $2 sh $4, 0($4) mthi $2 mflo $3 TAG97: lbu $1, 0($3) bne $1, $3, TAG98 addu $4, $1, $1 beq $4, $4, TAG98 TAG98: mfhi $1 multu $1, $4 addi $2, $4, 8 mflo $4 TAG99: sb $4, 0($4) mult $4, $4 mtlo $4 mthi $4 TAG100: bne $4, $4, TAG101 mfhi $3 multu $3, $3 sb $3, 0($4) TAG101: mflo $4 addi $1, $3, 9 mult $3, $3 mfhi $4 TAG102: lui $3, 0 add $3, $3, $4 lhu $2, 0($4) bne $3, $2, TAG103 TAG103: mthi $2 lui $2, 6 slti $3, $2, 3 mflo $4 TAG104: mtlo $4 multu $4, $4 multu $4, $4 bgtz $4, TAG105 TAG105: lui $2, 0 lui $1, 15 bgtz $1, TAG106 sltiu $2, $2, 6 TAG106: bgtz $2, TAG107 sb $2, 0($2) lhu $2, 0($2) lui $4, 12 TAG107: mult $4, $4 beq $4, $4, TAG108 mthi $4 beq $4, $4, TAG108 TAG108: xori $4, $4, 2 mult $4, $4 sb $4, 0($4) mult $4, $4 TAG109: sh $4, 0($4) sb $4, 0($4) divu $4, $4 div $4, $4 TAG110: beq $4, $4, TAG111 lhu $4, 0($4) sw $4, 0($4) bgtz $4, TAG111 TAG111: multu $4, $4 lui $4, 6 mult $4, $4 mfhi $4 TAG112: lui $3, 3 sltiu $4, $4, 9 sh $3, 0($4) sltiu $2, $4, 10 TAG113: mthi $2 lui $4, 2 sll $2, $2, 10 sh $4, -1024($2) TAG114: mflo $3 mfhi $1 mflo $3 lui $4, 0 TAG115: mult $4, $4 bgez $4, TAG116 or $3, $4, $4 sra $2, $3, 15 TAG116: mfhi $1 ori $4, $1, 12 lui $2, 6 sll $0, $0, 0 TAG117: mtlo $2 sra $3, $2, 6 srl $1, $3, 9 addiu $2, $3, 8 TAG118: beq $2, $2, TAG119 slti $1, $2, 3 bgtz $2, TAG119 mthi $1 TAG119: mfhi $2 beq $2, $2, TAG120 lw $2, 0($1) bne $2, $2, TAG120 TAG120: mflo $2 subu $1, $2, $2 sra $3, $2, 9 mflo $2 TAG121: mthi $2 divu $2, $2 mtlo $2 bne $2, $2, TAG122 TAG122: sll $0, $0, 0 lui $2, 12 mflo $2 slti $2, $2, 14 TAG123: lui $4, 8 andi $2, $2, 9 mtlo $4 mflo $1 TAG124: bne $1, $1, TAG125 div $1, $1 sll $0, $0, 0 sll $0, $0, 0 TAG125: mtlo $2 sb $2, 0($2) mfhi $1 mtlo $1 TAG126: bgtz $1, TAG127 lui $1, 6 srav $2, $1, $1 multu $2, $1 TAG127: sll $0, $0, 0 mtlo $2 lui $4, 6 mfhi $3 TAG128: andi $1, $3, 1 multu $3, $1 sb $1, 0($3) beq $3, $3, TAG129 TAG129: subu $4, $1, $1 bgtz $4, TAG130 mflo $3 sw $3, 0($4) TAG130: lhu $2, 0($3) sw $3, 0($3) multu $2, $2 lb $4, 0($2) TAG131: lui $4, 2 bltz $4, TAG132 andi $1, $4, 5 slt $1, $1, $4 TAG132: mult $1, $1 sb $1, 0($1) bne $1, $1, TAG133 sra $1, $1, 10 TAG133: lui $3, 1 blez $1, TAG134 sll $0, $0, 0 mthi $3 TAG134: xori $2, $3, 15 sll $0, $0, 0 bne $2, $2, TAG135 lui $1, 8 TAG135: mfhi $2 sw $2, 0($2) beq $1, $2, TAG136 addiu $4, $2, 8 TAG136: multu $4, $4 srl $2, $4, 13 subu $4, $2, $4 sw $4, 8($4) TAG137: subu $3, $4, $4 mthi $3 srl $3, $4, 14 mflo $1 TAG138: multu $1, $1 bltz $1, TAG139 lh $4, 0($1) sb $4, 0($4) TAG139: divu $4, $4 mfhi $4 sltiu $4, $4, 10 bltz $4, TAG140 TAG140: sb $4, 0($4) sb $4, 0($4) mfhi $2 lbu $3, 0($4) TAG141: sltiu $2, $3, 8 nor $3, $2, $2 lb $2, 2($3) lui $4, 6 TAG142: xori $1, $4, 0 mtlo $4 mthi $1 multu $1, $4 TAG143: divu $1, $1 divu $1, $1 sll $0, $0, 0 sll $0, $0, 0 TAG144: bgtz $2, TAG145 sb $2, 8($2) lui $4, 5 beq $2, $2, TAG145 TAG145: srlv $3, $4, $4 sll $0, $0, 0 beq $3, $3, TAG146 and $2, $3, $3 TAG146: sll $0, $0, 0 mflo $4 lb $2, 0($4) sra $1, $3, 5 TAG147: sh $1, -10240($1) xor $1, $1, $1 lui $3, 12 mfhi $3 TAG148: bgtz $3, TAG149 mfhi $2 bltz $2, TAG149 mthi $3 TAG149: mfhi $4 mfhi $2 srl $3, $4, 4 sw $2, 0($4) TAG150: sh $3, 0($3) beq $3, $3, TAG151 lui $1, 3 subu $4, $3, $1 TAG151: beq $4, $4, TAG152 srav $4, $4, $4 bltz $4, TAG152 lui $1, 11 TAG152: multu $1, $1 addiu $1, $1, 6 bgez $1, TAG153 div $1, $1 TAG153: bgez $1, TAG154 lui $2, 8 mtlo $2 mthi $1 TAG154: mflo $3 divu $2, $2 sll $0, $0, 0 div $3, $3 TAG155: mthi $3 sb $3, 0($3) srl $3, $3, 5 bgtz $3, TAG156 TAG156: mult $3, $3 mtlo $3 lw $1, 0($3) mfhi $1 TAG157: lbu $2, 0($1) xori $1, $1, 2 bne $1, $2, TAG158 lhu $3, 0($1) TAG158: lw $2, 0($3) subu $3, $2, $2 mthi $3 sh $3, -256($2) TAG159: mthi $3 lbu $2, 0($3) lb $1, 0($2) bne $3, $2, TAG160 TAG160: addi $1, $1, 0 lh $4, 0($1) mult $4, $1 bgtz $1, TAG161 TAG161: mthi $4 bne $4, $4, TAG162 lhu $3, 0($4) mfhi $4 TAG162: srlv $1, $4, $4 lhu $3, 0($4) mflo $3 mflo $3 TAG163: sh $3, 0($3) bltz $3, TAG164 sw $3, 0($3) bne $3, $3, TAG164 TAG164: lui $4, 4 blez $4, TAG165 mflo $3 lb $4, 0($3) TAG165: sh $4, 0($4) lb $4, 0($4) lui $4, 7 blez $4, TAG166 TAG166: sll $0, $0, 0 div $4, $4 and $2, $4, $4 slt $3, $2, $2 TAG167: slti $3, $3, 1 bltz $3, TAG168 mtlo $3 mfhi $2 TAG168: beq $2, $2, TAG169 lui $1, 14 srav $4, $2, $1 lui $2, 4 TAG169: lbu $1, 0($2) add $4, $1, $1 sltu $3, $4, $2 lhu $1, 0($2) TAG170: sh $1, 0($1) and $4, $1, $1 bltz $1, TAG171 sb $1, 0($4) TAG171: sb $4, 0($4) sltu $1, $4, $4 mtlo $1 sw $4, 0($4) TAG172: lw $1, 0($1) lui $1, 8 sll $0, $0, 0 bltz $3, TAG173 TAG173: mflo $2 lui $4, 14 sh $3, 0($3) mfhi $4 TAG174: mflo $3 lui $1, 3 sllv $2, $4, $4 sll $0, $0, 0 TAG175: lui $3, 3 mfhi $4 sltiu $2, $3, 7 sll $0, $0, 0 TAG176: bne $2, $2, TAG177 mfhi $2 mtlo $2 bne $2, $2, TAG177 TAG177: sh $2, 0($2) mtlo $2 lh $1, 0($2) mfhi $3 TAG178: mult $3, $3 sltiu $4, $3, 0 lui $1, 8 mthi $4 TAG179: mtlo $1 xori $3, $1, 9 mfhi $3 bgtz $1, TAG180 TAG180: lui $3, 2 mflo $1 bltz $3, TAG181 lui $2, 14 TAG181: mult $2, $2 mthi $2 sltiu $3, $2, 11 beq $2, $2, TAG182 TAG182: multu $3, $3 multu $3, $3 or $2, $3, $3 beq $2, $3, TAG183 TAG183: add $1, $2, $2 andi $1, $1, 14 lui $4, 12 sll $0, $0, 0 TAG184: bgez $4, TAG185 addu $2, $4, $4 ori $4, $4, 10 sltu $1, $4, $2 TAG185: sh $1, 0($1) bgez $1, TAG186 srav $4, $1, $1 mtlo $4 TAG186: and $1, $4, $4 bgez $4, TAG187 add $3, $4, $4 xor $2, $3, $3 TAG187: mflo $1 sb $1, 0($1) lui $3, 13 bltz $3, TAG188 TAG188: mfhi $3 or $1, $3, $3 beq $3, $1, TAG189 lui $2, 4 TAG189: mthi $2 sll $0, $0, 0 bltz $2, TAG190 lui $3, 5 TAG190: sll $0, $0, 0 multu $4, $4 sll $3, $4, 11 blez $3, TAG191 TAG191: mult $3, $3 bgez $3, TAG192 lui $3, 3 ori $1, $3, 15 TAG192: multu $1, $1 mfhi $4 mflo $1 lui $1, 14 TAG193: nor $4, $1, $1 mfhi $4 bne $4, $1, TAG194 sb $1, 0($4) TAG194: multu $4, $4 beq $4, $4, TAG195 mfhi $4 divu $4, $4 TAG195: mflo $3 slt $2, $4, $3 lui $1, 10 lui $1, 14 TAG196: mflo $4 xor $4, $4, $1 sll $0, $0, 0 sra $4, $1, 8 TAG197: sb $4, -3584($4) beq $4, $4, TAG198 mtlo $4 mult $4, $4 TAG198: sll $0, $0, 0 bgtz $1, TAG199 mthi $4 mult $4, $1 TAG199: mult $1, $1 sll $0, $0, 0 mthi $1 mtlo $1 TAG200: mflo $3 sll $0, $0, 0 mtlo $3 sll $0, $0, 0 TAG201: bgez $1, TAG202 lui $4, 10 blez $1, TAG202 addiu $2, $4, 2 TAG202: lui $3, 14 sh $2, 0($2) bltz $2, TAG203 sh $3, 0($2) TAG203: mfhi $1 sll $0, $0, 0 bne $1, $4, TAG204 sll $0, $0, 0 TAG204: bne $4, $4, TAG205 or $3, $4, $4 mfhi $1 srl $1, $4, 6 TAG205: sltiu $4, $1, 6 sllv $4, $4, $1 addiu $2, $1, 15 sllv $3, $2, $2 TAG206: sra $2, $3, 2 lui $1, 14 srl $3, $3, 4 bne $1, $2, TAG207 TAG207: divu $3, $3 bgtz $3, TAG208 sll $0, $0, 0 srl $4, $3, 7 TAG208: mfhi $1 mult $4, $1 xori $4, $1, 13 div $1, $4 TAG209: beq $4, $4, TAG210 addiu $2, $4, 9 divu $4, $4 beq $4, $4, TAG210 TAG210: lui $2, 12 mthi $2 sll $0, $0, 0 div $4, $2 TAG211: beq $4, $4, TAG212 lb $1, 0($4) bltz $4, TAG212 multu $4, $1 TAG212: multu $1, $1 bne $1, $1, TAG213 mflo $4 multu $4, $1 TAG213: lb $3, 0($4) sw $4, 0($4) mult $4, $3 bne $3, $3, TAG214 TAG214: xori $4, $3, 8 mtlo $3 nor $2, $3, $3 bgez $3, TAG215 TAG215: slt $2, $2, $2 mfhi $4 beq $4, $2, TAG216 sb $4, 0($2) TAG216: mfhi $1 sw $4, 0($1) mthi $1 sltiu $4, $1, 14 TAG217: bne $4, $4, TAG218 lui $2, 7 lui $4, 13 divu $4, $4 TAG218: bgez $4, TAG219 divu $4, $4 xori $1, $4, 15 and $3, $1, $1 TAG219: slti $3, $3, 2 mfhi $3 mult $3, $3 lui $4, 15 TAG220: addiu $3, $4, 15 multu $4, $3 sll $0, $0, 0 mult $2, $4 TAG221: lui $2, 11 sll $0, $0, 0 mthi $2 bne $2, $2, TAG222 TAG222: mthi $2 srav $2, $2, $2 addiu $2, $2, 4 addiu $4, $2, 15 TAG223: addu $2, $4, $4 divu $4, $2 sll $0, $0, 0 beq $2, $4, TAG224 TAG224: lui $3, 5 beq $3, $2, TAG225 sll $0, $0, 0 lui $2, 7 TAG225: lui $2, 1 sll $0, $0, 0 mthi $4 mflo $3 TAG226: bgtz $3, TAG227 multu $3, $3 multu $3, $3 lbu $2, 0($3) TAG227: lui $4, 12 beq $4, $2, TAG228 or $1, $2, $2 sltu $3, $2, $4 TAG228: div $3, $3 lb $3, 0($3) bgtz $3, TAG229 lui $4, 12 TAG229: divu $4, $4 mflo $4 addu $1, $4, $4 bgtz $1, TAG230 TAG230: and $1, $1, $1 mtlo $1 lui $1, 12 sllv $3, $1, $1 TAG231: mthi $3 sll $0, $0, 0 sll $0, $0, 0 bne $3, $2, TAG232 TAG232: mtlo $2 lb $2, 0($2) addi $2, $2, 8 lbu $4, 0($2) TAG233: sw $4, 0($4) lui $3, 3 lui $3, 15 xor $2, $4, $3 TAG234: sra $1, $2, 13 ori $1, $2, 10 sll $0, $0, 0 andi $2, $1, 14 TAG235: lh $3, 0($2) bgtz $3, TAG236 mtlo $3 ori $2, $3, 3 TAG236: bltz $2, TAG237 multu $2, $2 sll $4, $2, 7 mfhi $4 TAG237: xor $1, $4, $4 lbu $3, 0($4) lui $3, 9 lui $4, 11 TAG238: mthi $4 mfhi $2 mthi $4 srav $2, $4, $2 TAG239: mfhi $4 mfhi $3 lui $4, 15 sll $0, $0, 0 TAG240: andi $1, $4, 11 bgez $1, TAG241 srlv $1, $4, $4 addi $2, $1, 8 TAG241: lui $3, 12 sll $0, $0, 0 lui $2, 5 mult $3, $2 TAG242: mtlo $2 and $2, $2, $2 multu $2, $2 mult $2, $2 TAG243: lui $1, 6 mflo $4 lbu $2, 0($4) subu $3, $2, $1 TAG244: sll $0, $0, 0 sltu $2, $3, $3 multu $4, $2 bne $3, $3, TAG245 TAG245: lui $1, 10 bltz $2, TAG246 multu $1, $2 mfhi $2 TAG246: sw $2, 0($2) mfhi $2 sh $2, 0($2) lbu $3, 0($2) TAG247: bgtz $3, TAG248 sllv $1, $3, $3 blez $1, TAG248 addi $4, $1, 12 TAG248: sh $4, 0($4) mthi $4 lui $4, 7 lui $3, 9 TAG249: sll $1, $3, 1 bne $1, $1, TAG250 sll $0, $0, 0 beq $3, $3, TAG250 TAG250: lui $2, 8 mthi $2 mtlo $2 sll $0, $0, 0 TAG251: div $2, $2 mthi $2 sltu $4, $2, $2 mtlo $2 TAG252: lui $2, 8 lui $1, 1 mflo $4 lui $4, 3 TAG253: sll $0, $0, 0 blez $1, TAG254 or $3, $1, $1 sll $0, $0, 0 TAG254: blez $1, TAG255 lui $4, 2 bne $1, $1, TAG255 mthi $1 TAG255: sll $0, $0, 0 slti $3, $4, 8 sll $0, $0, 0 sb $4, 0($3) TAG256: sll $0, $0, 0 mfhi $3 mfhi $2 sll $0, $0, 0 TAG257: lui $4, 12 sll $0, $0, 0 div $1, $2 sll $2, $1, 4 TAG258: slti $3, $2, 6 mult $2, $3 sb $3, 0($3) beq $3, $3, TAG259 TAG259: lb $2, 0($3) lui $3, 13 beq $2, $3, TAG260 mtlo $3 TAG260: mthi $3 div $3, $3 mtlo $3 div $3, $3 TAG261: bne $3, $3, TAG262 slti $4, $3, 14 divu $3, $3 beq $4, $4, TAG262 TAG262: mtlo $4 sw $4, 0($4) beq $4, $4, TAG263 mflo $2 TAG263: blez $2, TAG264 sub $4, $2, $2 mfhi $1 mthi $4 TAG264: mfhi $1 bgtz $1, TAG265 slti $2, $1, 0 mflo $1 TAG265: sw $1, 0($1) srlv $1, $1, $1 lui $2, 11 multu $2, $1 TAG266: bltz $2, TAG267 sll $0, $0, 0 mtlo $2 beq $2, $2, TAG267 TAG267: sll $0, $0, 0 bgtz $2, TAG268 sll $0, $0, 0 div $2, $2 TAG268: srl $1, $2, 0 sll $0, $0, 0 bltz $1, TAG269 mtlo $1 TAG269: multu $2, $2 lui $3, 7 and $1, $2, $2 mthi $2 TAG270: beq $1, $1, TAG271 sll $0, $0, 0 lui $4, 7 subu $4, $4, $4 TAG271: lui $3, 5 and $4, $3, $4 lui $2, 2 bgez $2, TAG272 TAG272: addiu $2, $2, 11 mflo $3 sltu $1, $2, $2 sw $2, 0($1) TAG273: sra $4, $1, 12 bne $4, $1, TAG274 sh $4, 0($1) bne $4, $4, TAG274 TAG274: mult $4, $4 bltz $4, TAG275 or $4, $4, $4 lui $3, 0 TAG275: sh $3, 0($3) lbu $3, 0($3) lb $1, 0($3) lui $2, 15 TAG276: lui $4, 9 lui $1, 5 addiu $1, $2, 0 sll $0, $0, 0 TAG277: addiu $3, $1, 15 mflo $4 sra $3, $4, 8 mtlo $1 TAG278: sw $3, 0($3) srl $4, $3, 11 lbu $1, 0($3) andi $4, $3, 15 TAG279: multu $4, $4 sh $4, 0($4) mult $4, $4 mflo $3 TAG280: mflo $3 lui $1, 1 mfhi $3 lbu $1, 0($3) TAG281: sllv $4, $1, $1 blez $4, TAG282 xor $4, $4, $4 divu $4, $4 TAG282: srav $1, $4, $4 or $1, $1, $1 srav $3, $4, $4 lui $2, 12 TAG283: mfhi $1 mthi $1 mflo $2 srav $4, $2, $2 TAG284: mfhi $2 sh $2, 0($4) sb $4, 0($4) lui $2, 11 TAG285: sll $0, $0, 0 sll $0, $0, 0 or $3, $2, $2 sll $0, $0, 0 TAG286: andi $1, $4, 4 lh $3, 0($4) nor $3, $3, $3 mthi $1 TAG287: bne $3, $3, TAG288 mthi $3 or $4, $3, $3 slti $2, $3, 11 TAG288: lui $2, 0 bne $2, $2, TAG289 mtlo $2 mfhi $4 TAG289: mult $4, $4 mult $4, $4 sw $4, 1($4) bltz $4, TAG290 TAG290: slti $3, $4, 10 bgez $3, TAG291 lb $3, 0($3) xori $2, $4, 13 TAG291: multu $2, $2 bgez $2, TAG292 sb $2, 0($2) andi $2, $2, 13 TAG292: lhu $2, 0($2) blez $2, TAG293 mthi $2 sll $0, $0, 0 TAG293: mflo $3 bltz $2, TAG294 sll $0, $0, 0 bgtz $3, TAG294 TAG294: mflo $1 mtlo $3 bltz $3, TAG295 lui $2, 11 TAG295: addiu $1, $2, 4 sll $0, $0, 0 mfhi $1 lui $4, 13 TAG296: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG297: mflo $4 lhu $2, 0($4) xori $4, $4, 2 sll $0, $0, 0 TAG298: blez $3, TAG299 sltu $2, $3, $3 beq $2, $3, TAG299 mfhi $3 TAG299: lbu $3, 0($3) lb $3, 0($3) bltz $3, TAG300 lbu $1, 0($3) TAG300: mtlo $1 lui $4, 10 mfhi $4 lw $4, 0($1) TAG301: ori $4, $4, 8 bgtz $4, TAG302 multu $4, $4 mthi $4 TAG302: sb $4, 248($4) mult $4, $4 lh $4, 248($4) bne $4, $4, TAG303 TAG303: sw $4, 248($4) lb $3, 248($4) mfhi $4 lui $1, 0 TAG304: slti $2, $1, 0 bltz $1, TAG305 sllv $3, $2, $1 mult $3, $1 TAG305: mflo $3 beq $3, $3, TAG306 mfhi $2 lui $1, 11 TAG306: mthi $1 ori $1, $1, 8 beq $1, $1, TAG307 lui $3, 5 TAG307: mflo $1 divu $1, $3 sb $3, 0($1) bgtz $3, TAG308 TAG308: lui $3, 10 lui $3, 5 sll $0, $0, 0 sll $0, $0, 0 TAG309: beq $3, $3, TAG310 subu $1, $3, $3 mtlo $3 lui $3, 11 TAG310: mflo $2 divu $2, $3 srav $4, $2, $3 blez $4, TAG311 TAG311: sll $0, $0, 0 sll $0, $0, 0 sll $2, $4, 11 bgtz $4, TAG312 TAG312: mult $2, $2 mfhi $2 xor $3, $2, $2 sll $0, $0, 0 TAG313: lbu $2, 0($3) sb $2, 0($3) bne $3, $3, TAG314 mfhi $1 TAG314: addu $3, $1, $1 bgez $1, TAG315 sll $0, $0, 0 mtlo $1 TAG315: blez $3, TAG316 mflo $3 sh $3, 0($3) lbu $3, 0($3) TAG316: srav $3, $3, $3 bne $3, $3, TAG317 addi $4, $3, 3 blez $3, TAG317 TAG317: and $2, $4, $4 mtlo $4 mflo $4 sb $4, 0($4) TAG318: sb $4, 0($4) sb $4, 0($4) sll $2, $4, 6 lb $2, 0($4) TAG319: sb $2, 0($2) lb $2, 0($2) bne $2, $2, TAG320 lui $2, 4 TAG320: div $2, $2 bne $2, $2, TAG321 div $2, $2 divu $2, $2 TAG321: srl $3, $2, 7 lbu $3, -2048($3) multu $2, $3 bltz $2, TAG322 TAG322: or $4, $3, $3 bgez $3, TAG323 xor $3, $3, $3 sb $3, 0($3) TAG323: addiu $1, $3, 6 multu $3, $3 lh $1, 0($1) ori $1, $3, 0 TAG324: mflo $1 mtlo $1 mtlo $1 srav $4, $1, $1 TAG325: mfhi $4 xor $4, $4, $4 nor $2, $4, $4 bne $4, $4, TAG326 TAG326: multu $2, $2 slt $1, $2, $2 bgtz $2, TAG327 mthi $1 TAG327: sh $1, 0($1) bgez $1, TAG328 mtlo $1 multu $1, $1 TAG328: multu $1, $1 bne $1, $1, TAG329 srav $3, $1, $1 bltz $1, TAG329 TAG329: lbu $1, 0($3) mflo $3 lw $3, 0($3) lbu $3, 0($1) TAG330: mtlo $3 lw $4, 0($3) bltz $3, TAG331 lbu $3, 0($3) TAG331: slti $4, $3, 3 sh $4, 0($3) mflo $2 beq $4, $2, TAG332 TAG332: lui $4, 9 mthi $4 multu $2, $2 multu $2, $2 TAG333: xor $2, $4, $4 mult $4, $4 multu $4, $4 mflo $4 TAG334: multu $4, $4 multu $4, $4 sllv $1, $4, $4 ori $2, $1, 4 TAG335: srav $2, $2, $2 lbu $2, 0($2) lb $4, 0($2) lui $3, 14 TAG336: or $4, $3, $3 sltiu $3, $3, 15 sh $4, 0($3) beq $3, $3, TAG337 TAG337: mult $3, $3 lhu $4, 0($3) multu $3, $4 bgtz $3, TAG338 TAG338: lui $3, 7 lbu $4, 0($4) bgez $3, TAG339 mult $4, $3 TAG339: beq $4, $4, TAG340 or $1, $4, $4 mfhi $3 mfhi $4 TAG340: multu $4, $4 bne $4, $4, TAG341 srl $1, $4, 15 mflo $4 TAG341: sltu $2, $4, $4 bltz $4, TAG342 mfhi $3 sh $2, 0($3) TAG342: or $3, $3, $3 andi $4, $3, 13 lb $4, 0($4) slti $3, $4, 9 TAG343: srlv $4, $3, $3 sll $4, $3, 1 andi $2, $3, 15 bltz $4, TAG344 TAG344: addiu $3, $2, 6 mthi $3 mthi $3 lui $3, 9 TAG345: bne $3, $3, TAG346 nor $4, $3, $3 sll $0, $0, 0 lb $4, 0($2) TAG346: blez $4, TAG347 lw $1, 0($4) mthi $4 xor $1, $1, $1 TAG347: mfhi $3 mfhi $2 mflo $2 multu $2, $2 TAG348: bgez $2, TAG349 lh $2, 0($2) mfhi $4 mflo $3 TAG349: blez $3, TAG350 sb $3, 0($3) srl $1, $3, 0 mtlo $1 TAG350: srlv $4, $1, $1 mtlo $1 mult $1, $4 andi $4, $1, 4 TAG351: mtlo $4 addu $4, $4, $4 div $4, $4 bne $4, $4, TAG352 TAG352: multu $4, $4 mfhi $2 bltz $2, TAG353 mflo $2 TAG353: blez $2, TAG354 lui $1, 14 lui $3, 5 sll $0, $0, 0 TAG354: subu $1, $3, $3 lui $3, 5 div $1, $3 divu $3, $3 TAG355: sll $0, $0, 0 mtlo $1 div $1, $3 sw $1, 0($1) TAG356: mtlo $1 srl $1, $1, 7 mtlo $1 mthi $1 TAG357: multu $1, $1 beq $1, $1, TAG358 xor $3, $1, $1 mthi $3 TAG358: multu $3, $3 blez $3, TAG359 mfhi $4 bne $3, $4, TAG359 TAG359: sh $4, 0($4) multu $4, $4 mthi $4 andi $1, $4, 7 TAG360: bgez $1, TAG361 sltiu $2, $1, 4 mflo $3 mthi $2 TAG361: lh $4, 0($3) lui $1, 7 blez $3, TAG362 sh $1, 0($4) TAG362: mthi $1 mthi $1 mthi $1 sll $0, $0, 0 TAG363: bgtz $2, TAG364 ori $3, $2, 0 multu $3, $2 slti $4, $3, 4 TAG364: nor $3, $4, $4 lb $3, 1($3) bne $4, $3, TAG365 sllv $3, $4, $3 TAG365: mflo $4 add $3, $3, $3 lhu $4, 0($3) mthi $4 TAG366: addi $2, $4, 1 bgtz $2, TAG367 lh $2, 0($4) lui $3, 7 TAG367: sltu $1, $3, $3 or $2, $1, $3 mthi $2 sll $1, $1, 11 TAG368: bgez $1, TAG369 mflo $3 lui $1, 8 mflo $4 TAG369: bltz $4, TAG370 lhu $3, 0($4) lw $3, 0($3) sw $3, 0($3) TAG370: bne $3, $3, TAG371 sb $3, 0($3) lhu $1, 0($3) lui $2, 1 TAG371: andi $3, $2, 12 mult $3, $3 beq $3, $3, TAG372 lui $3, 0 TAG372: mthi $3 bgtz $3, TAG373 srav $4, $3, $3 mthi $3 TAG373: mtlo $4 blez $4, TAG374 lhu $4, 0($4) lhu $3, 0($4) TAG374: lb $2, 0($3) multu $3, $3 sw $3, 0($2) srl $2, $3, 5 TAG375: lui $1, 6 lui $4, 12 mult $2, $4 blez $2, TAG376 TAG376: divu $4, $4 mtlo $4 divu $4, $4 sll $0, $0, 0 TAG377: beq $4, $4, TAG378 addiu $4, $4, 6 addu $1, $4, $4 sb $4, 0($1) TAG378: divu $1, $1 mtlo $1 mtlo $1 bgtz $1, TAG379 TAG379: mflo $2 sll $0, $0, 0 lui $4, 2 xori $3, $2, 10 TAG380: blez $3, TAG381 mthi $3 bltz $3, TAG381 lui $1, 0 TAG381: srl $2, $1, 14 bltz $1, TAG382 ori $3, $1, 6 mtlo $2 TAG382: lui $4, 11 lui $4, 12 sll $0, $0, 0 blez $3, TAG383 TAG383: lui $3, 2 addiu $2, $3, 1 sll $0, $0, 0 blez $2, TAG384 TAG384: sll $0, $0, 0 xor $4, $2, $2 blez $2, TAG385 mtlo $2 TAG385: lui $1, 8 bltz $1, TAG386 mfhi $4 lui $1, 12 TAG386: sll $0, $0, 0 mtlo $1 sltu $2, $1, $1 sll $3, $2, 8 TAG387: lh $4, 0($3) lw $1, 0($3) multu $1, $3 addiu $3, $3, 12 TAG388: addiu $4, $3, 1 sra $2, $3, 5 mflo $2 mflo $2 TAG389: subu $4, $2, $2 sb $4, 0($2) sb $4, 0($4) nor $4, $2, $4 TAG390: and $3, $4, $4 sh $4, 1($3) nor $2, $3, $3 lbu $3, 1($4) TAG391: sltiu $2, $3, 11 xori $2, $2, 14 xori $1, $3, 0 sltiu $4, $2, 15 TAG392: multu $4, $4 beq $4, $4, TAG393 sb $4, 0($4) sltu $2, $4, $4 TAG393: divu $2, $2 sll $2, $2, 15 addu $4, $2, $2 div $2, $2 TAG394: sll $0, $0, 0 sll $0, $0, 0 mthi $4 lhu $1, -255($1) TAG395: sll $0, $0, 0 blez $1, TAG396 lui $3, 15 lw $1, -511($1) TAG396: mfhi $4 bne $1, $1, TAG397 sb $4, -511($1) sltiu $2, $1, 0 TAG397: mtlo $2 lui $1, 6 blez $2, TAG398 mtlo $2 TAG398: multu $1, $1 bne $1, $1, TAG399 mflo $4 xori $4, $1, 12 TAG399: sll $0, $0, 0 mfhi $1 sra $1, $1, 10 srl $2, $4, 9 TAG400: bne $2, $2, TAG401 sh $2, -768($2) bgtz $2, TAG401 divu $2, $2 TAG401: sll $0, $0, 0 mthi $2 srav $4, $4, $2 mult $4, $4 TAG402: bltz $4, TAG403 sll $0, $0, 0 mthi $4 bltz $3, TAG403 TAG403: xor $2, $3, $3 sra $1, $3, 8 bltz $3, TAG404 sltu $2, $2, $2 TAG404: subu $1, $2, $2 lui $4, 9 mflo $1 bne $2, $1, TAG405 TAG405: divu $1, $1 sll $0, $0, 0 sll $0, $0, 0 lui $3, 2 TAG406: sll $0, $0, 0 divu $3, $3 sll $0, $0, 0 sll $0, $0, 0 TAG407: lui $2, 5 sll $0, $0, 0 sll $0, $0, 0 mfhi $1 TAG408: mfhi $4 lhu $1, 0($4) lui $1, 14 bgtz $1, TAG409 TAG409: sll $0, $0, 0 sll $0, $0, 0 mflo $3 multu $1, $1 TAG410: bltz $3, TAG411 srlv $4, $3, $3 bltz $4, TAG411 subu $3, $3, $4 TAG411: mult $3, $3 mtlo $3 blez $3, TAG412 lbu $3, 0($3) TAG412: div $3, $3 mflo $1 lui $1, 13 bgez $3, TAG413 TAG413: lui $4, 9 sll $0, $0, 0 mflo $3 mfhi $2 TAG414: lui $2, 12 addiu $4, $2, 15 mfhi $1 bne $2, $2, TAG415 TAG415: mthi $1 mfhi $1 multu $1, $1 sw $1, 0($1) TAG416: mtlo $1 mthi $1 mfhi $4 sb $1, 0($1) TAG417: lb $1, 0($4) sh $1, 0($1) bltz $4, TAG418 srlv $1, $4, $1 TAG418: mtlo $1 mtlo $1 blez $1, TAG419 addi $1, $1, 10 TAG419: lhu $3, 0($1) bne $3, $3, TAG420 and $4, $3, $1 lb $4, 0($3) TAG420: lui $1, 11 sll $0, $0, 0 bltz $4, TAG421 lbu $3, 0($4) TAG421: lui $3, 13 divu $3, $3 bne $3, $3, TAG422 sll $0, $0, 0 TAG422: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 mthi $3 TAG423: multu $2, $2 multu $2, $2 mtlo $2 divu $2, $2 TAG424: bgtz $2, TAG425 sltiu $3, $2, 1 mtlo $2 addiu $1, $2, 8 TAG425: sll $0, $0, 0 sll $0, $0, 0 mult $1, $1 bgtz $1, TAG426 TAG426: mfhi $4 sb $1, 0($4) divu $4, $4 addiu $2, $4, 2 TAG427: subu $1, $2, $2 sb $2, 0($1) lb $3, 0($2) slti $3, $3, 3 TAG428: lui $4, 10 slti $1, $3, 11 lui $4, 13 mtlo $4 TAG429: sltu $2, $4, $4 addi $1, $2, 11 sb $4, 0($1) sll $0, $0, 0 TAG430: bne $4, $4, TAG431 sll $0, $0, 0 sll $0, $0, 0 beq $4, $4, TAG431 TAG431: and $3, $4, $4 multu $3, $4 sll $0, $0, 0 multu $4, $4 TAG432: divu $3, $3 sll $0, $0, 0 mult $3, $3 beq $3, $3, TAG433 TAG433: sllv $3, $3, $3 mfhi $2 mthi $3 bltz $2, TAG434 TAG434: lui $3, 5 sh $3, -169($2) sltiu $4, $2, 14 sll $0, $0, 0 TAG435: mthi $2 mflo $3 mthi $2 andi $3, $3, 7 TAG436: andi $3, $3, 7 sb $3, 0($3) sllv $3, $3, $3 mfhi $2 TAG437: addiu $4, $2, 14 beq $2, $2, TAG438 div $4, $2 bgez $4, TAG438 TAG438: lui $1, 3 divu $1, $4 bgtz $4, TAG439 sll $0, $0, 0 TAG439: mtlo $1 srlv $1, $1, $1 sll $0, $0, 0 lui $1, 7 TAG440: sll $0, $0, 0 addu $1, $1, $1 sll $0, $0, 0 beq $1, $1, TAG441 TAG441: xori $4, $4, 15 blez $4, TAG442 mtlo $4 blez $4, TAG442 TAG442: xor $4, $4, $4 multu $4, $4 slt $1, $4, $4 mult $4, $4 TAG443: lb $1, 0($1) sb $1, 0($1) andi $3, $1, 6 andi $1, $1, 1 TAG444: bne $1, $1, TAG445 lui $2, 14 addiu $2, $2, 14 ori $4, $2, 12 TAG445: sll $0, $0, 0 mthi $2 addiu $2, $2, 8 bne $2, $2, TAG446 TAG446: lui $3, 11 blez $2, TAG447 sll $0, $0, 0 mfhi $4 TAG447: sra $3, $4, 5 lhu $4, -28672($3) mfhi $2 mthi $4 TAG448: lui $3, 8 mtlo $2 lui $1, 0 sll $0, $0, 0 TAG449: divu $2, $2 lui $4, 14 sll $0, $0, 0 mfhi $2 TAG450: subu $1, $2, $2 sub $4, $2, $1 beq $1, $2, TAG451 lhu $2, 0($4) TAG451: lbu $1, 0($2) lui $4, 7 or $1, $4, $1 bne $2, $2, TAG452 TAG452: lui $2, 11 sll $0, $0, 0 addiu $2, $2, 1 mfhi $2 TAG453: sw $2, 0($2) addiu $2, $2, 7 bltz $2, TAG454 sb $2, 0($2) TAG454: div $2, $2 div $2, $2 multu $2, $2 div $2, $2 TAG455: lbu $1, 0($2) lbu $4, 0($2) bgez $1, TAG456 mtlo $2 TAG456: lbu $4, 0($4) and $3, $4, $4 lb $2, 0($4) mfhi $1 TAG457: bltz $1, TAG458 multu $1, $1 sra $1, $1, 3 xori $1, $1, 5 TAG458: mtlo $1 div $1, $1 sb $1, 0($1) beq $1, $1, TAG459 TAG459: sb $1, 0($1) sb $1, 0($1) bltz $1, TAG460 srlv $3, $1, $1 TAG460: sll $1, $3, 4 mflo $2 lui $1, 4 bne $3, $1, TAG461 TAG461: mflo $2 ori $3, $2, 4 blez $2, TAG462 addiu $3, $3, 0 TAG462: sll $3, $3, 4 xor $3, $3, $3 sh $3, 0($3) bgtz $3, TAG463 TAG463: multu $3, $3 multu $3, $3 bgez $3, TAG464 lb $2, 0($3) TAG464: lui $2, 15 blez $2, TAG465 slti $2, $2, 7 beq $2, $2, TAG465 TAG465: lw $2, 0($2) sll $2, $2, 6 lbu $3, 0($2) bgtz $2, TAG466 TAG466: multu $3, $3 subu $2, $3, $3 sb $2, 0($2) beq $2, $2, TAG467 TAG467: sw $2, 0($2) bltz $2, TAG468 sra $1, $2, 9 bgez $1, TAG468 TAG468: lui $2, 7 andi $1, $2, 2 sb $2, 0($1) lbu $2, 0($1) TAG469: sh $2, 0($2) multu $2, $2 mflo $1 multu $2, $2 TAG470: mult $1, $1 lui $3, 3 lhu $1, 0($1) multu $1, $1 TAG471: mthi $1 lb $2, 0($1) sw $1, 0($2) sw $2, 0($1) TAG472: sb $2, 0($2) bltz $2, TAG473 lui $2, 12 addu $2, $2, $2 TAG473: addiu $3, $2, 10 divu $2, $3 slti $1, $3, 8 xori $1, $2, 1 TAG474: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 multu $1, $1 TAG475: bgtz $1, TAG476 addu $1, $1, $1 bgtz $1, TAG476 mthi $1 TAG476: sll $0, $0, 0 lui $2, 7 lui $3, 7 mult $3, $1 TAG477: addiu $4, $3, 6 sllv $4, $4, $4 mflo $2 bgez $4, TAG478 TAG478: addu $2, $2, $2 bne $2, $2, TAG479 multu $2, $2 sll $0, $0, 0 TAG479: bgtz $2, TAG480 sll $0, $0, 0 bgtz $2, TAG480 mfhi $3 TAG480: bne $3, $3, TAG481 lui $4, 4 mthi $4 lui $2, 15 TAG481: bgtz $2, TAG482 divu $2, $2 sh $2, 0($2) blez $2, TAG482 TAG482: mtlo $2 lui $4, 1 slt $2, $2, $2 beq $2, $4, TAG483 TAG483: lb $4, 0($2) bne $4, $2, TAG484 sb $2, 0($4) mfhi $2 TAG484: beq $2, $2, TAG485 sh $2, 0($2) mthi $2 mthi $2 TAG485: mthi $2 lui $4, 4 sll $0, $0, 0 subu $4, $2, $4 TAG486: addiu $2, $4, 2 beq $4, $2, TAG487 mthi $4 and $2, $4, $4 TAG487: sll $0, $0, 0 bgez $2, TAG488 multu $2, $2 beq $2, $2, TAG488 TAG488: addu $1, $2, $2 bltz $2, TAG489 addu $3, $1, $1 mfhi $2 TAG489: divu $2, $2 subu $3, $2, $2 sll $0, $0, 0 sll $0, $0, 0 TAG490: mfhi $3 bne $3, $2, TAG491 multu $3, $2 mthi $2 TAG491: sll $4, $3, 2 beq $3, $4, TAG492 lui $3, 0 lui $4, 0 TAG492: mthi $4 lui $4, 13 bne $4, $4, TAG493 xor $1, $4, $4 TAG493: mtlo $1 sra $4, $1, 2 mflo $3 multu $1, $1 TAG494: mfhi $1 sb $3, 0($1) slti $2, $1, 13 bgtz $1, TAG495 TAG495: lb $4, 0($2) sb $2, 0($2) sb $4, 0($2) lbu $3, 0($2) TAG496: mflo $2 lui $1, 8 mult $1, $1 mflo $1 TAG497: mthi $1 bgez $1, TAG498 or $2, $1, $1 lui $2, 1 TAG498: slt $3, $2, $2 sra $2, $2, 15 mthi $3 bgtz $2, TAG499 TAG499: sb $2, 0($2) lhu $4, 0($2) sw $2, 0($4) bgez $2, TAG500 TAG500: mfhi $1 lb $4, 0($1) bltz $1, TAG501 lh $2, 0($4) TAG501: mult $2, $2 beq $2, $2, TAG502 mult $2, $2 blez $2, TAG502 TAG502: lw $1, 0($2) lhu $3, 0($2) sw $3, 0($3) andi $2, $1, 14 TAG503: mtlo $2 or $3, $2, $2 bne $2, $3, TAG504 mtlo $3 TAG504: lw $2, 0($3) sw $2, 0($3) xor $1, $3, $3 bgez $3, TAG505 TAG505: xori $4, $1, 1 beq $1, $1, TAG506 mflo $3 sb $4, 0($4) TAG506: sb $3, 0($3) bgtz $3, TAG507 sll $4, $3, 13 multu $3, $4 TAG507: bne $4, $4, TAG508 lui $1, 8 bltz $4, TAG508 xori $4, $4, 0 TAG508: lbu $3, 0($4) mflo $3 mtlo $3 mflo $1 TAG509: beq $1, $1, TAG510 lhu $2, 0($1) mtlo $2 beq $2, $2, TAG510 TAG510: sb $2, 0($2) lhu $1, 0($2) lui $3, 15 srav $4, $2, $1 TAG511: lh $4, 0($4) lui $3, 9 bgez $4, TAG512 sltiu $3, $3, 6 TAG512: srl $4, $3, 8 lui $4, 11 lhu $3, 0($3) lui $2, 15 TAG513: srl $2, $2, 12 mfhi $2 mflo $1 and $4, $2, $2 TAG514: sb $4, 0($4) sh $4, 0($4) mflo $3 mflo $4 TAG515: blez $4, TAG516 mtlo $4 slti $1, $4, 13 lui $2, 2 TAG516: lui $4, 3 mthi $4 lh $1, 0($2) mflo $4 TAG517: mtlo $4 bltz $4, TAG518 mult $4, $4 mfhi $2 TAG518: lhu $4, 0($2) lui $4, 5 slt $3, $2, $2 bgez $4, TAG519 TAG519: xor $1, $3, $3 mflo $3 sh $1, 0($3) lw $3, 0($1) TAG520: lui $2, 4 lbu $1, 0($3) sll $0, $0, 0 sw $1, 0($3) TAG521: sh $3, 0($3) addi $2, $3, 5 sllv $1, $3, $3 xor $3, $1, $2 TAG522: andi $4, $3, 2 lb $2, 0($4) sb $3, 0($3) mthi $4 TAG523: beq $2, $2, TAG524 lb $2, 0($2) bltz $2, TAG524 div $2, $2 TAG524: mthi $2 sltiu $4, $2, 5 bne $4, $2, TAG525 mult $2, $2 TAG525: bne $4, $4, TAG526 mtlo $4 divu $4, $4 lbu $2, 0($4) TAG526: mfhi $3 mult $2, $2 lui $1, 7 lui $4, 9 TAG527: ori $3, $4, 5 sll $0, $0, 0 mfhi $2 lui $2, 10 TAG528: sra $4, $2, 0 mtlo $2 sll $0, $0, 0 srav $4, $4, $4 TAG529: mthi $4 bgez $4, TAG530 addiu $3, $4, 12 lui $1, 11 TAG530: mult $1, $1 bne $1, $1, TAG531 sra $2, $1, 10 lw $1, -448($2) TAG531: lbu $1, 0($1) mfhi $1 mthi $1 mtlo $1 TAG532: mflo $3 blez $1, TAG533 ori $4, $1, 0 sb $3, 0($3) TAG533: blez $4, TAG534 addu $2, $4, $4 bne $4, $2, TAG534 lbu $3, 0($2) TAG534: sltu $4, $3, $3 lb $1, 0($4) mfhi $3 bltz $1, TAG535 TAG535: lb $1, 0($3) beq $3, $1, TAG536 lb $3, 0($1) lui $3, 8 TAG536: lbu $3, 0($3) sb $3, 0($3) mflo $2 bgez $3, TAG537 TAG537: mtlo $2 divu $2, $2 lb $1, 0($2) lbu $3, 0($2) TAG538: srav $4, $3, $3 lui $4, 7 div $4, $4 divu $4, $3 TAG539: mtlo $4 multu $4, $4 bne $4, $4, TAG540 mthi $4 TAG540: mult $4, $4 div $4, $4 bltz $4, TAG541 mult $4, $4 TAG541: sll $0, $0, 0 addiu $1, $4, 15 bgtz $4, TAG542 mfhi $3 TAG542: mflo $4 mflo $2 mthi $2 lui $3, 0 TAG543: beq $3, $3, TAG544 mfhi $3 bgez $3, TAG544 lui $3, 14 TAG544: bgtz $3, TAG545 sb $3, 0($3) bne $3, $3, TAG545 multu $3, $3 TAG545: multu $3, $3 sltiu $2, $3, 1 mthi $3 beq $2, $2, TAG546 TAG546: lb $1, 0($2) mtlo $1 nor $3, $1, $2 or $2, $1, $3 TAG547: bne $2, $2, TAG548 sra $4, $2, 0 sh $2, 2($4) beq $4, $4, TAG548 TAG548: sll $0, $0, 0 multu $4, $1 add $1, $1, $1 mtlo $1 TAG549: add $3, $1, $1 mult $1, $3 mfhi $3 mthi $3 TAG550: lui $3, 7 sllv $1, $3, $3 lui $4, 13 mthi $1 TAG551: sltiu $3, $4, 11 addiu $2, $3, 5 addiu $3, $3, 8 div $2, $3 TAG552: lw $1, 0($3) lbu $3, 0($1) sh $3, 0($3) lh $3, 0($1) TAG553: mtlo $3 lui $1, 3 sb $1, 0($3) sll $0, $0, 0 TAG554: srav $1, $1, $1 mtlo $1 sll $0, $0, 0 bne $1, $1, TAG555 TAG555: sll $0, $0, 0 bltz $1, TAG556 sll $0, $0, 0 mult $1, $1 TAG556: lui $3, 10 mfhi $4 sb $4, 0($4) sll $0, $0, 0 TAG557: bne $2, $2, TAG558 multu $2, $2 sb $2, 0($2) bne $2, $2, TAG558 TAG558: divu $2, $2 lui $3, 13 lui $4, 3 sll $0, $0, 0 TAG559: lb $4, 0($2) sb $2, 0($2) or $4, $4, $2 mthi $4 TAG560: lui $1, 7 nor $1, $4, $4 lh $2, 6($1) lui $3, 10 TAG561: sll $0, $0, 0 bne $3, $3, TAG562 sll $0, $0, 0 sll $0, $0, 0 TAG562: mthi $3 blez $3, TAG563 mtlo $3 bgtz $3, TAG563 TAG563: mflo $4 addiu $2, $4, 12 lui $2, 0 lui $3, 2 TAG564: mtlo $3 srlv $2, $3, $3 sll $0, $0, 0 lui $4, 0 TAG565: sh $4, 0($4) sub $4, $4, $4 mtlo $4 bltz $4, TAG566 TAG566: multu $4, $4 mtlo $4 bne $4, $4, TAG567 lui $2, 11 TAG567: or $2, $2, $2 bgtz $2, TAG568 mult $2, $2 mtlo $2 TAG568: slti $2, $2, 11 sw $2, 0($2) sra $3, $2, 9 mflo $1 TAG569: mflo $4 multu $1, $4 or $3, $4, $1 beq $1, $4, TAG570 TAG570: mtlo $3 mflo $4 mfhi $2 lb $2, 0($4) TAG571: bltz $2, TAG572 sra $4, $2, 1 mult $4, $4 lw $4, 0($2) TAG572: sltiu $2, $4, 3 nor $1, $2, $4 srl $1, $4, 13 lui $1, 10 TAG573: sll $3, $1, 7 addu $4, $3, $1 lui $2, 3 bne $1, $2, TAG574 TAG574: lui $3, 1 sll $0, $0, 0 sll $4, $2, 1 sll $0, $0, 0 TAG575: multu $3, $3 lui $4, 4 mfhi $3 sb $3, 0($3) TAG576: div $3, $3 lui $1, 0 mflo $2 sw $3, 0($1) TAG577: sb $2, 0($2) sll $3, $2, 12 lui $4, 2 slt $1, $2, $4 TAG578: lb $3, 0($1) xor $4, $3, $1 lb $1, 0($1) lb $1, 0($1) TAG579: beq $1, $1, TAG580 sllv $3, $1, $1 blez $3, TAG580 mfhi $3 TAG580: sltu $1, $3, $3 lb $1, 0($1) mult $1, $1 bgez $1, TAG581 TAG581: mthi $1 div $1, $1 lui $3, 3 sll $0, $0, 0 TAG582: sll $2, $3, 15 sll $0, $0, 0 sll $0, $0, 0 blez $3, TAG583 TAG583: sllv $4, $3, $3 subu $2, $4, $4 beq $2, $2, TAG584 sll $0, $0, 0 TAG584: lb $2, 0($2) divu $2, $2 multu $2, $2 mflo $3 TAG585: lbu $1, 0($3) mfhi $3 lui $1, 3 bgtz $3, TAG586 TAG586: mfhi $4 mult $4, $1 sw $1, 0($4) sll $0, $0, 0 TAG587: mthi $4 slt $4, $4, $4 bne $4, $4, TAG588 addu $4, $4, $4 TAG588: xor $2, $4, $4 mtlo $2 bltz $4, TAG589 multu $4, $2 TAG589: mtlo $2 mtlo $2 mthi $2 beq $2, $2, TAG590 TAG590: slti $2, $2, 15 mthi $2 mflo $1 multu $2, $1 TAG591: lb $2, 0($1) ori $2, $2, 5 lui $1, 15 andi $4, $2, 5 TAG592: mtlo $4 sb $4, 0($4) lb $1, 0($4) div $4, $1 TAG593: lui $4, 1 lui $1, 8 ori $4, $4, 3 sltu $3, $1, $1 TAG594: mfhi $2 lhu $3, 0($3) mtlo $2 mfhi $1 TAG595: mfhi $4 beq $1, $1, TAG596 lb $1, 0($4) xor $4, $1, $1 TAG596: bgez $4, TAG597 slt $2, $4, $4 beq $4, $4, TAG597 lui $2, 4 TAG597: mtlo $2 addi $2, $2, 8 lui $1, 0 sw $2, 0($2) TAG598: lui $1, 10 sll $0, $0, 0 nor $3, $2, $1 sll $1, $2, 8 TAG599: mflo $4 addiu $3, $4, 5 multu $3, $4 lui $2, 7 TAG600: mflo $1 addu $2, $1, $1 mtlo $1 mtlo $1 TAG601: srlv $2, $2, $2 lhu $3, 0($2) beq $2, $2, TAG602 lui $2, 1 TAG602: nor $4, $2, $2 andi $4, $4, 6 sll $0, $0, 0 lh $2, 0($4) TAG603: blez $2, TAG604 mflo $3 mult $2, $3 lb $1, -1792($2) TAG604: lbu $3, 0($1) mfhi $1 ori $1, $3, 3 mtlo $1 TAG605: lbu $2, 0($1) mtlo $2 sb $1, 0($1) addu $3, $1, $2 TAG606: divu $3, $3 sb $3, 0($3) mfhi $4 divu $3, $3 TAG607: multu $4, $4 sh $4, 0($4) sh $4, 0($4) bltz $4, TAG608 TAG608: lhu $3, 0($4) or $1, $3, $4 bgez $1, TAG609 mfhi $3 TAG609: sh $3, 0($3) nor $1, $3, $3 lw $2, 1($1) mult $1, $1 TAG610: mfhi $1 mthi $2 sll $0, $0, 0 lb $3, 0($1) TAG611: lw $2, 0($3) lui $1, 7 addiu $1, $2, 9 or $4, $2, $1 TAG612: sll $4, $4, 3 sll $0, $0, 0 mtlo $4 sll $0, $0, 0 TAG613: mthi $4 lui $2, 14 beq $4, $4, TAG614 lui $4, 0 TAG614: addiu $4, $4, 12 sb $4, 0($4) slti $4, $4, 11 sll $3, $4, 6 TAG615: mflo $1 mthi $3 mtlo $3 lui $2, 9 TAG616: addiu $2, $2, 12 addu $3, $2, $2 bgtz $2, TAG617 mfhi $2 TAG617: bgtz $2, TAG618 mflo $3 mfhi $1 bltz $3, TAG618 TAG618: srl $2, $1, 8 multu $1, $1 srl $3, $1, 7 sra $2, $1, 3 TAG619: sltu $4, $2, $2 beq $4, $2, TAG620 mtlo $2 blez $4, TAG620 TAG620: mtlo $4 sh $4, 0($4) sh $4, 0($4) lbu $1, 0($4) TAG621: sll $2, $1, 4 or $2, $1, $2 bne $2, $2, TAG622 mflo $1 TAG622: mflo $4 mfhi $4 lh $2, 0($4) bgtz $4, TAG623 TAG623: mthi $2 sw $2, 0($2) mthi $2 or $4, $2, $2 TAG624: ori $1, $4, 0 beq $1, $4, TAG625 mfhi $3 andi $4, $4, 13 TAG625: sw $4, 0($4) bltz $4, TAG626 mthi $4 multu $4, $4 TAG626: sb $4, 0($4) mult $4, $4 sra $2, $4, 11 lb $3, 0($4) TAG627: bltz $3, TAG628 slti $3, $3, 11 sb $3, 0($3) bne $3, $3, TAG628 TAG628: mtlo $3 mfhi $2 mthi $3 and $4, $2, $2 TAG629: lb $4, 0($4) mthi $4 lui $4, 15 mtlo $4 TAG630: multu $4, $4 divu $4, $4 div $4, $4 mtlo $4 TAG631: lui $1, 8 div $1, $4 sll $0, $0, 0 bne $4, $1, TAG632 TAG632: slt $3, $3, $3 nor $2, $3, $3 sra $2, $3, 4 lui $3, 9 TAG633: mflo $3 bltz $3, TAG634 lui $1, 6 add $4, $3, $3 TAG634: lh $4, 0($4) lhu $3, -256($4) mthi $4 bne $4, $4, TAG635 TAG635: sh $3, -256($3) mthi $3 beq $3, $3, TAG636 mult $3, $3 TAG636: sll $0, $0, 0 sh $3, -256($3) divu $3, $3 lui $3, 1 TAG637: sll $2, $3, 3 beq $3, $3, TAG638 lui $1, 15 xori $4, $1, 13 TAG638: bne $4, $4, TAG639 srav $4, $4, $4 mtlo $4 multu $4, $4 TAG639: sltu $1, $4, $4 mfhi $3 mtlo $1 bne $4, $1, TAG640 TAG640: mflo $3 lui $4, 7 lui $2, 9 xor $4, $3, $4 TAG641: bne $4, $4, TAG642 mflo $1 bltz $1, TAG642 mflo $3 TAG642: xori $3, $3, 9 mthi $3 lbu $2, 0($3) sh $2, 0($2) TAG643: lui $2, 5 beq $2, $2, TAG644 mthi $2 addi $4, $2, 0 TAG644: lui $4, 15 bne $4, $4, TAG645 mtlo $4 xor $2, $4, $4 TAG645: mflo $4 bgez $4, TAG646 mthi $2 nor $2, $4, $2 TAG646: lui $3, 1 lw $1, 0($2) and $1, $1, $2 mtlo $3 TAG647: blez $1, TAG648 addu $3, $1, $1 sltiu $4, $3, 9 sh $4, 0($4) TAG648: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 bne $1, $1, TAG649 TAG649: mtlo $1 bne $1, $1, TAG650 lui $1, 8 bgtz $1, TAG650 TAG650: andi $1, $1, 3 sltiu $1, $1, 3 divu $1, $1 mfhi $1 TAG651: mfhi $3 multu $1, $3 sll $3, $1, 6 multu $1, $1 TAG652: mfhi $2 mflo $4 lh $1, 0($2) multu $4, $1 TAG653: lui $3, 12 multu $1, $3 sh $3, 0($1) lbu $3, 0($1) TAG654: lui $3, 6 bltz $3, TAG655 lui $2, 6 bgez $2, TAG655 TAG655: mthi $2 beq $2, $2, TAG656 nor $2, $2, $2 addi $3, $2, 0 TAG656: lui $3, 12 mfhi $2 mflo $1 ori $2, $2, 13 TAG657: mflo $3 sll $0, $0, 0 sll $0, $0, 0 mfhi $1 TAG658: lui $3, 4 mflo $4 mflo $4 bgez $3, TAG659 TAG659: lui $4, 11 lui $3, 1 bne $3, $4, TAG660 lui $2, 0 TAG660: mthi $2 lui $2, 12 blez $2, TAG661 addu $1, $2, $2 TAG661: sltiu $4, $1, 5 bgtz $1, TAG662 lui $4, 15 divu $1, $4 TAG662: lui $2, 1 bne $2, $2, TAG663 or $2, $2, $4 beq $4, $2, TAG663 TAG663: lui $3, 15 mfhi $3 sll $0, $0, 0 mthi $3 TAG664: srlv $1, $3, $3 lui $4, 8 lui $4, 12 mthi $4 TAG665: sll $0, $0, 0 addiu $4, $4, 7 sll $0, $0, 0 sll $0, $0, 0 TAG666: multu $4, $4 bne $4, $4, TAG667 lui $2, 10 mthi $4 TAG667: bgtz $2, TAG668 sll $4, $2, 5 lh $4, 0($2) sh $4, 0($4) TAG668: xor $1, $4, $4 sw $4, 0($1) xor $3, $4, $4 bne $4, $4, TAG669 TAG669: multu $3, $3 bgez $3, TAG670 mflo $1 srlv $2, $1, $3 TAG670: lui $1, 2 mfhi $4 mfhi $1 mthi $4 TAG671: mult $1, $1 bne $1, $1, TAG672 lui $1, 15 sll $0, $0, 0 TAG672: sll $0, $0, 0 lui $3, 11 sll $0, $0, 0 subu $2, $3, $1 TAG673: subu $3, $2, $2 sll $4, $2, 5 andi $1, $2, 6 mtlo $1 TAG674: mflo $1 blez $1, TAG675 xor $4, $1, $1 or $4, $1, $1 TAG675: bne $4, $4, TAG676 mtlo $4 lh $3, 0($4) lw $1, 0($4) TAG676: nor $4, $1, $1 srav $1, $1, $1 mthi $1 sll $0, $0, 0 TAG677: mflo $2 lui $1, 3 xor $3, $2, $2 div $1, $4 TAG678: add $3, $3, $3 andi $1, $3, 1 mtlo $1 mflo $3 TAG679: mflo $2 ori $4, $3, 12 mtlo $2 lui $2, 3 TAG680: addu $2, $2, $2 sll $0, $0, 0 sh $2, 0($3) mflo $1 TAG681: bne $1, $1, TAG682 mult $1, $1 mflo $3 bltz $3, TAG682 TAG682: nor $4, $3, $3 lb $3, 1($4) mult $3, $3 mthi $3 TAG683: nor $3, $3, $3 mthi $3 beq $3, $3, TAG684 mtlo $3 TAG684: bltz $3, TAG685 mfhi $2 lh $4, 0($3) bgtz $3, TAG685 TAG685: addu $2, $4, $4 mtlo $2 lhu $1, 1($4) sb $4, 0($1) TAG686: lb $4, 0($1) lui $1, 0 lh $1, 0($1) mult $4, $1 TAG687: sh $1, -255($1) bne $1, $1, TAG688 lui $1, 0 bne $1, $1, TAG688 TAG688: multu $1, $1 multu $1, $1 mflo $1 mflo $4 TAG689: srl $1, $4, 2 bne $4, $4, TAG690 sb $4, 0($1) blez $4, TAG690 TAG690: and $1, $1, $1 bgez $1, TAG691 nor $1, $1, $1 sb $1, 0($1) TAG691: lui $1, 14 lui $3, 14 mthi $1 mfhi $1 TAG692: mthi $1 sll $0, $0, 0 mflo $2 mtlo $2 TAG693: mtlo $2 mult $2, $2 lh $3, 0($2) blez $3, TAG694 TAG694: xori $1, $3, 14 beq $1, $1, TAG695 sb $1, 0($3) sltu $4, $1, $3 TAG695: beq $4, $4, TAG696 add $1, $4, $4 beq $4, $1, TAG696 mult $1, $4 TAG696: sb $1, 0($1) mflo $2 sb $2, 0($1) sb $2, 0($2) TAG697: addu $3, $2, $2 mflo $4 mult $2, $3 bgez $3, TAG698 TAG698: mult $4, $4 mfhi $1 lui $4, 3 beq $1, $1, TAG699 TAG699: mfhi $2 mult $4, $2 srl $3, $4, 8 mtlo $2 TAG700: mtlo $3 mult $3, $3 mtlo $3 beq $3, $3, TAG701 TAG701: sll $0, $0, 0 slti $4, $4, 4 lui $2, 4 mthi $2 TAG702: lui $3, 2 lui $1, 5 addu $2, $1, $3 sll $0, $0, 0 TAG703: sllv $1, $2, $2 mflo $2 sll $0, $0, 0 mfhi $4 TAG704: ori $2, $4, 11 beq $4, $4, TAG705 sll $0, $0, 0 div $4, $4 TAG705: multu $2, $2 sll $0, $0, 0 sll $4, $2, 11 sll $0, $0, 0 TAG706: bne $4, $4, TAG707 addiu $1, $4, 15 lui $1, 9 srlv $3, $4, $1 TAG707: mtlo $3 bltz $3, TAG708 lui $3, 14 bgez $3, TAG708 TAG708: mult $3, $3 mflo $2 bne $3, $3, TAG709 multu $2, $3 TAG709: lui $2, 14 addiu $3, $2, 2 bgez $3, TAG710 mtlo $2 TAG710: andi $3, $3, 4 lui $2, 0 beq $3, $3, TAG711 lui $1, 1 TAG711: sll $0, $0, 0 mflo $4 andi $2, $3, 11 lbu $1, 0($3) TAG712: lui $1, 6 sll $0, $0, 0 mflo $4 mthi $4 TAG713: lui $4, 7 mflo $2 mtlo $4 mtlo $2 TAG714: divu $2, $2 sll $0, $0, 0 lui $1, 15 bne $1, $2, TAG715 TAG715: sltu $3, $1, $1 multu $1, $3 sll $0, $0, 0 lui $1, 5 TAG716: blez $1, TAG717 lui $3, 0 mult $1, $1 mtlo $1 TAG717: beq $3, $3, TAG718 mthi $3 lui $2, 4 bltz $2, TAG718 TAG718: div $2, $2 bne $2, $2, TAG719 sll $0, $0, 0 mfhi $1 TAG719: beq $1, $1, TAG720 sb $1, 0($1) bne $1, $1, TAG720 multu $1, $1 TAG720: mflo $1 mfhi $2 lw $4, 0($2) divu $2, $1 TAG721: xor $2, $4, $4 sll $0, $0, 0 sll $0, $0, 0 bgtz $2, TAG722 TAG722: mfhi $1 addu $4, $3, $1 slt $2, $1, $1 mult $3, $2 TAG723: beq $2, $2, TAG724 multu $2, $2 lbu $2, 0($2) mflo $3 TAG724: lui $1, 14 sw $3, 0($3) lui $4, 1 lui $2, 10 TAG725: subu $2, $2, $2 mult $2, $2 lui $3, 10 bgez $3, TAG726 TAG726: sll $0, $0, 0 mult $3, $3 sll $0, $0, 0 sll $2, $1, 13 TAG727: mthi $2 mfhi $3 bne $2, $3, TAG728 and $2, $2, $3 TAG728: blez $2, TAG729 mtlo $2 beq $2, $2, TAG729 srav $2, $2, $2 TAG729: mtlo $2 lui $2, 9 bgtz $2, TAG730 lui $1, 12 TAG730: mflo $3 sll $0, $0, 0 sll $0, $0, 0 mfhi $2 TAG731: mfhi $1 mtlo $1 beq $1, $2, TAG732 mflo $1 TAG732: mfhi $3 xori $2, $3, 13 mtlo $1 bgtz $2, TAG733 TAG733: mtlo $2 div $2, $2 mthi $2 subu $2, $2, $2 TAG734: lui $3, 4 bgez $2, TAG735 mthi $3 bne $2, $2, TAG735 TAG735: mfhi $2 div $2, $3 sll $2, $2, 1 sll $0, $0, 0 TAG736: beq $2, $2, TAG737 mflo $4 mflo $4 mtlo $2 TAG737: lui $1, 2 mtlo $1 mthi $4 bltz $4, TAG738 TAG738: lui $1, 12 beq $1, $1, TAG739 mflo $2 lh $3, 0($2) TAG739: sll $0, $0, 0 subu $1, $3, $3 sw $3, 0($1) srl $4, $1, 11 TAG740: lui $3, 14 sb $3, 0($4) bne $3, $4, TAG741 xori $2, $4, 1 TAG741: sll $4, $2, 5 lui $4, 0 bne $2, $4, TAG742 mflo $3 TAG742: sll $0, $0, 0 mthi $3 mfhi $4 bltz $4, TAG743 TAG743: sll $0, $0, 0 sll $0, $0, 0 bltz $2, TAG744 mflo $4 TAG744: mflo $1 mflo $2 lui $4, 9 srlv $2, $2, $4 TAG745: bne $2, $2, TAG746 xori $2, $2, 11 or $2, $2, $2 addiu $1, $2, 15 TAG746: sll $0, $0, 0 mult $1, $1 sll $4, $1, 11 or $3, $1, $4 TAG747: mtlo $3 mthi $3 bne $3, $3, TAG748 xori $3, $3, 1 TAG748: sll $0, $0, 0 sra $1, $4, 10 mult $1, $4 bne $1, $3, TAG749 TAG749: sll $0, $0, 0 blez $3, TAG750 andi $4, $1, 15 bne $3, $3, TAG750 TAG750: nop nop test_end: beq $0, $0, test_end nop
; A123854: Denominators in an asymptotic expansion for the cubic recurrence sequence A123851. ; 1,4,32,128,2048,8192,65536,262144,8388608,33554432,268435456,1073741824,17179869184,68719476736,549755813888,2199023255552,140737488355328,562949953421312,4503599627370496,18014398509481984,288230376151711744,1152921504606846976,9223372036854775808,36893488147419103232,1180591620717411303424,4722366482869645213696,37778931862957161709568,151115727451828646838272,2417851639229258349412352,9671406556917033397649408,77371252455336267181195264,309485009821345068724781056,39614081257132168796771975168,158456325028528675187087900672,1267650600228229401496703205376,5070602400912917605986812821504,81129638414606681695789005144064,324518553658426726783156020576256,2596148429267413814265248164610048,10384593717069655257060992658440192,332306998946228968225951765070086144 add $0,2 mov $1,2 mov $2,$0 lpb $1 mov $1,$0 sub $1,2 lpb $2 add $0,$1 div $1,2 lpb $2 mov $2,$1 lpe lpe lpe add $1,1 lpb $0 sub $0,1 mul $1,2 lpe sub $1,4 div $1,4 add $1,1 mov $0,$1
SECTION code_clib PUBLIC generic_console_cls PUBLIC generic_console_printc PUBLIC generic_console_scrollup PUBLIC generic_console_set_ink PUBLIC generic_console_set_paper PUBLIC generic_console_set_attribute PUBLIC __laser500_mode PUBLIC __laser500_attr EXTERN CONSOLE_COLUMNS EXTERN CONSOLE_ROWS EXTERN __console_w EXTERN conio_map_colour EXTERN generic_console_flags EXTERN generic_console_font32 EXTERN generic_console_udg32 EXTERN generic_console_xypos EXTERN screendollar EXTERN screendollar_with_count INCLUDE "target/laser500/def/laser500.def" defc DISPLAY = 0xf800 - 0x8000 generic_console_set_attribute: ret generic_console_set_paper: call conio_map_colour and 15 ld b,a ld a,(__laser500_attr) and 0xf0 or b ld (__laser500_attr),a ret generic_console_set_ink: call conio_map_colour and 15 rlca rlca rlca rlca ld b,a ld a,(__laser500_attr) and 0x0f or b ld (__laser500_attr),a ret generic_console_cls: ld a,(SYSVAR_bank1) push af ld a,7 ld (SYSVAR_bank1),a out ($41),a ld a,(__laser500_mode) cp 2 jr z,cls_hires ld hl, DISPLAY ld bc,+( 2032 / 2) ld de,(__laser500_attr) ld a,e out ($45),a ;set 80 column colour ld d,32 ld a,(__laser500_mode) and a jr z,loop ld e,d ;80 column, need spaces loop: ld (hl),d inc hl ld (hl),e inc hl dec bc ld a,b or c jr nz,loop cls_return: pop af ld (SYSVAR_bank1),a out ($41),a ret cls_hires: ld bc, 8192 ld hl, 16384 ld de,(__laser500_attr) ld d,0 cls_hires_loop: ld (hl),d inc hl ld (hl),e inc hl dec bc ld a,b or c jr nz,cls_hires_loop jr cls_return ; c = x ; b = y ; a = character to print ; e = raw generic_console_printc: ex af,af ld a,(SYSVAR_bank1) push af ld a,7 ld (SYSVAR_bank1),a out ($41),a ex af,af call generic_console_xypos ld d,a ;Save character ld a,(__laser500_mode) cp 2 jr z,printc_hires ld a,(generic_console_flags) and 128 ;bit 7 = inverse or d ld d,a ld a,(__laser500_mode) and a jr z,text_40col_printc ld (hl),d ;80 column mode, no __laser500_attributes jr printc_return text_40col_printc: add hl,bc ;40 column mode, we have __laser500_attribtues ld (hl),d inc hl ld a,(__laser500_attr) ld (hl),a printc_return: pop af ld (SYSVAR_bank1),a out ($41),a ret printc_hires: add hl,bc ;We need to get 40 column offset ld a,d ex de,hl ;de = screen ld bc,(generic_console_font32) bit 7,a jr z,not_udg ld bc,(generic_console_udg32) res 7,a inc b not_udg: ld l,a ld h,0 add hl,hl add hl,hl add hl,hl add hl,bc dec h ex de,hl ;hl = screen, de = font ld a,(generic_console_flags) rlca sbc a ld c,a ;c = 0 / c = 255 ld b,8 printc_hires_loop: push bc ld a,(generic_console_flags) bit 4,a ld a,(de) ld b,a jr z,not_bold rrca or b not_bold: xor c ; Display is morrored, so mirror the byte ld c,a rlca rlca xor c and 0xaa xor c ld c,a rlca rlca rlca rrc c xor c and 0x66 xor c ld (hl),a inc hl ld a,(__laser500_attr) ld (hl),a inc de ld bc,$800 - 1 add hl,bc pop bc djnz printc_hires_loop ld a,(generic_console_flags) bit 3,a jr z,printc_return ld bc,-$800 add hl,bc ld (hl),255 jr printc_return generic_console_scrollup: ld a,(SYSVAR_bank1) push af ld a,7 ld (SYSVAR_bank1),a out ($41),a push de push bc ld a,23 ld bc, $0000 scrollup_1: push af push bc call generic_console_xypos pop bc push bc push hl ;dest inc b call generic_console_xypos ;hl=source pop de ; For hires we need to copy 8 rows.. ld b,1 ld a,(__laser500_mode) cp 2 jr nz,mode_0_1 ld b,8 mode_0_1: ld a,b scroll_loop: push hl push de ld bc,80 ldir pop hl ld bc,$800 add hl,bc ex de,hl pop hl add hl,bc dec a jr nz,scroll_loop pop bc inc b pop af dec a jr nz,scrollup_1 ld a,(__console_w) ld bc,$1700 ;Last row scrollup_2: push af push bc ld a,' ' ld e,0 call generic_console_printc pop bc inc c pop af dec a jr nz,scrollup_2 scrollup_return: pop bc pop de pop af ld (SYSVAR_bank1),a out ($41),a ret scrollup_hires: jr scrollup_return SECTION bss_clib __laser500_mode: defb 0 SECTION data_clib __laser500_attr: defb 0xf0
; A051539: a(n) = least common multiple of {1, 5, 9, 13, 17 ..., 4n+1} (A016813). ; Submitted by Jamie Morken(s4) ; 1,5,45,585,9945,69615,348075,10094175,111035925,4108329225,168441498225,168441498225,1179090487575,62491795841475,1187344120988025,72427991380269525,72427991380269525,1665843801746199075,121606597527472532475,121606597527472532475,1094459377747252792275,1094459377747252792275,97406884619505498512475,3019613423204670453886725,292902502050853034027012325,29583152707136156436728244825,29583152707136156436728244825,3224563645077841051603378685925,364375691893796038831181791509525 mov $1,1 mov $2,1 lpb $0 mov $3,$2 lpb $3 add $2,4 mov $4,$1 gcd $4,$2 div $1,$4 mov $3,$5 lpe sub $0,1 mul $1,2 mul $1,$2 div $1,2 lpe mov $0,$1
dnl Intel Pentium mpn_mul_1 -- mpn by limb multiplication. dnl dnl P5: 13.0 cycles/limb dnl Copyright (C) 1992, 1994, 1996, 1999, 2000 Free Software Foundation, dnl Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 59 Temple Place - dnl Suite 330, Boston, MA 02111-1307, USA. */ include(`../config.m4') C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, C mp_limb_t multiplier); defframe(PARAM_MULTIPLIER,16) defframe(PARAM_SIZE, 12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) .text ALIGN(8) PROLOGUE(mpn_mul_1) pushl %edi pushl %esi pushl %ebx pushl %ebp deflit(`FRAME',16) movl PARAM_DST, %edi movl PARAM_SRC, %esi movl PARAM_SIZE, %ecx movl PARAM_MULTIPLIER, %ebp leal (%edi,%ecx,4), %edi leal (%esi,%ecx,4), %esi negl %ecx xorl %ebx, %ebx ALIGN(8) L(oop): adcl $0, %ebx movl (%esi,%ecx,4), %eax mull %ebp addl %eax, %ebx movl %ebx, (%edi,%ecx,4) incl %ecx movl %edx, %ebx jnz L(oop) adcl $0, %ebx movl %ebx, %eax popl %ebp popl %ebx popl %esi popl %edi ret EPILOGUE()
.section __TEXT,__text,regular,pure_instructions .align 4, 0x90 .globl _main _main: pushl %ebp movl %esp, %ebp pushl %ebx pushl %eax call L0000000A L0000000A: popl %eax movl $0, -8(%ebp) movl _F-L0000000A(%eax), %ecx movl %ecx, _E-L0000000A(%eax) movw %cx, %dx movw %dx, _D-L0000000A(%eax) movw %dx, _C-L0000000A(%eax) movb %dl, %bl movb %bl, _B-L0000000A(%eax) movb %bl, _A-L0000000A(%eax) movsbl %bl, %eax addl $4, %esp popl %ebx popl %ebp ret # ---------------------- .section __DATA,__data,regular .globl _A _A: .value 2 # ---------------------- .globl _C _C: .value 3 # ---------------------- .align 2 .globl _E _E: .long 5 # ---------------------- .globl _B .zerofill __DATA,__common,_B,2,1 # ---------------------- .globl _D .zerofill __DATA,__common,_D,2,1 # ---------------------- .globl _F .zerofill __DATA,__common,_F,4,2 # ---------------------- .subsections_via_symbols
.data .text jmp @main main: sw $0 0[$ebp] ld $8 0x0001 ld $9 0x0001 ld $10 0x0001 ld $11 0x0001 ld $12 0x0001 ld $13 0x0001 ld $14 0x0001 ld $15 0x0001 ld $16 0x0001 ld $17 0x0001 ld $18 0x0001 ld $19 0x0001 ld $20 0x0001 ld $21 0x0001 ld $22 0x0001 ld $23 0x0001 ld $24 0x0001 ld $25 0x0001 ld $26 0x0001 ld $27 0x0001 ld $28 0x0001 ld $29 0x0001 ld $30 0x0001 ld $31 0x0001 ld $7 0x0001 pushw $7 ld $7 0x0001 pushw $7 ld $7 0x0001 pushw $7 popw $0 popw $1 add $1 $0 $0 pushw $0 popw $0 popw $1 add $1 $0 $0 pushw $0 popw $0 add $31 $0 $31 add $30 $31 $30 add $29 $30 $29 add $28 $29 $28 add $27 $28 $27 add $26 $27 $26 add $25 $26 $25 add $24 $25 $24 add $23 $24 $23 add $22 $23 $22 add $21 $22 $21 add $20 $21 $20 add $19 $20 $19 add $18 $19 $18 add $17 $18 $17 add $16 $17 $16 add $15 $16 $15 add $14 $15 $14 add $13 $14 $13 add $12 $13 $12 add $11 $12 $11 add $10 $11 $10 add $9 $10 $9 add $8 $9 $8 sw $8 0[$ebp] popw $0 ld $v0 0x0002 syscall
; ; AngelCode Scripting Library ; Copyright (c) 2003-2013 Andreas Jonsson ; ; This software is provided 'as-is', without any express or implied ; warranty. In no event will the authors be held liable for any ; damages arising from the use of this software. ; ; Permission is granted to anyone to use this software for any ; purpose, including commercial applications, and to alter it and ; redistribute it freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you ; must not claim that you wrote the original software. If you use ; this software in a product, an acknowledgment in the product ; documentation would be appreciated but is not required. ; ; 2. Altered source versions must be plainly marked as such, and ; must not be misrepresented as being the original software. ; ; 3. This notice may not be removed or altered from any source ; distribution. ; ; The original version of this library can be located at: ; http://www.angelcode.com/angelscript/ ; ; Andreas Jonsson ; andreas@angelcode.com ; ; Assembly routines for the ARM call convention ; Written by Fredrik Ehnbom in June 2009 ; MSVC currently doesn't support inline assembly for the ARM platform ; so this separate file is needed. ; Compile with Microsoft ARM assembler (armasm) ; http://msdn.microsoft.com/en-us/library/hh873190.aspx AREA |.rdata|, DATA, READONLY EXPORT armFunc EXPORT armFuncR0 EXPORT armFuncR0R1 EXPORT armFuncObjLast EXPORT armFuncR0ObjLast AREA |.text|, CODE, ARM, ALIGN=3 ALIGN 8 armFunc PROC stmdb sp!, {r4-r8, lr} mov r6, r0 ; arg table movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments) mov r4, r2 ; function address mov r8, #0 beq |nomoreargs| ; Load the first 4 arguments into r0-r3 cmp r7, #4 ldrge r0, [r6],#4 cmp r7, #2*4 ldrge r1, [r6],#4 cmp r7, #3*4 ldrge r2, [r6],#4 cmp r7, #4*4 ldrge r3, [r6],#4 ble |nomoreargs| ; Load the rest of the arguments onto the stack sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3 sub sp, sp, r7 mov r8, r7 |stackargsloop| ldr r5, [r6], #4 str r5, [sp], #4 subs r7, r7, #4 bne |stackargsloop| |nomoreargs| sub sp, sp, r8 blx r4 add sp, sp, r8 ldmia sp!, {r4-r8, pc} ENDP ALIGN 8 armFuncObjLast PROC stmdb sp!, {r4-r8, lr} mov r6, r0 ; arg table movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments) mov r4, r2 ; function address mov r8, #0 mov r0, r3 ; objlast. might get overwritten str r3, [sp, #-4]! ; objlast again. beq |nomoreargs@armFuncObjLast| ; Load the first 4 arguments into r0-r3 cmp r7, #4 ldrge r0, [r6],#4 cmp r7, #2*4 ldrge r1, [r6],#4 ldrlt r1, [sp] cmp r7, #3*4 ldrge r2, [r6],#4 ldrlt r2, [sp] cmp r7, #4*4 ldrge r3, [r6],#4 ldrlt r3, [sp] ble |nomoreargs@armFuncObjLast| ; Load the rest of the arguments onto the stack sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3 sub sp, sp, r7 mov r8, r7 |stackargsloop@armFuncObjLast| ldr r5, [r6], #4 str r5, [sp], #4 subs r7, r7, #4 bne |stackargsloop@armFuncObjLast| |nomoreargs@armFuncObjLast| sub sp, sp, r8 blx r4 add sp, sp, r8 add sp, sp, #4 ldmia sp!, {r4-r8, pc} ENDP ALIGN 8 armFuncR0ObjLast PROC stmdb sp!, {r4-r8, lr} ldr r7, [sp,#6*4] str r7, [sp,#-4]! mov r6, r0 ; arg table movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments) mov r4, r2 ; function address mov r8, #0 mov r0, r3 ; r0 explicitly set ldr r1, [sp] ; objlast. might get overwritten beq |nomoreargs@armFuncR0ObjLast| ; Load the first 3 arguments into r1-r3 cmp r7, #1*4 ldrge r1, [r6],#4 cmp r7, #2*4 ldrge r2, [r6],#4 ldrlt r2, [sp] cmp r7, #3*4 ldrge r3, [r6],#4 ldrlt r3, [sp] ble |nomoreargs@armFuncR0ObjLast| ; Load the rest of the arguments onto the stack sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3 sub sp, sp, r7 mov r8, r7 |stackargsloop@armFuncR0ObjLast| ldr r5, [r6], #4 str r5, [sp], #4 subs r7, r7, #4 bne |stackargsloop@armFuncR0ObjLast| |nomoreargs@armFuncR0ObjLast| sub sp, sp, r8 blx r4 add sp, sp, r8 add sp, sp, #4 ldmia sp!, {r4-r8, pc} ENDP ALIGN 8 armFuncR0 PROC stmdb sp!, {r4-r8, lr} mov r6, r0 ; arg table movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments) mov r4, r2 ; function address mov r8, #0 mov r0, r3 ; r0 explicitly set beq |nomoreargs@armFuncR0| ; Load the first 3 arguments into r1-r3 cmp r7, #1*4 ldrge r1, [r6],#4 cmp r7, #2*4 ldrge r2, [r6],#4 cmp r7, #3*4 ldrge r3, [r6],#4 ble |nomoreargs@armFuncR0| ; Load the rest of the arguments onto the stack sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3 sub sp, sp, r7 mov r8, r7 |stackargsloop@armFuncR0| ldr r5, [r6], #4 str r5, [sp], #4 subs r7, r7, #4 bne |stackargsloop@armFuncR0| |nomoreargs@armFuncR0| sub sp, sp, r8 blx r4 add sp, sp, r8 ldmia sp!, {r4-r8, pc} ENDP ALIGN 8 armFuncR0R1 PROC stmdb sp!, {r4-r8, lr} mov r6, r0 ; arg table movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments) mov r4, r2 ; function address mov r8, #0 mov r0, r3 ; r0 explicitly set ldr r1, [sp, #6*4] ; r1 explicitly set too beq |nomoreargs@armFuncR0R1| ; Load the first 2 arguments into r2-r3 cmp r7, #1*4 ldrge r2, [r6],#4 cmp r7, #2*4 ldrge r3, [r6],#4 ble |nomoreargs@armFuncR0R1| ; Load the rest of the arguments onto the stack sub r7, r7, #2*4 ; skip the 2 registers already loaded into r2-r3 sub sp, sp, r7 mov r8, r7 |stackargsloop@armFuncR0R1| ldr r5, [r6], #4 str r5, [sp], #4 subs r7, r7, #4 bne |stackargsloop@armFuncR0R1| |nomoreargs@armFuncR0R1| sub sp, sp, r8 blx r4 add sp, sp, r8 ldmia sp!, {r4-r8, pc} ENDP END
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="fd, level, optname, optval, optlen"/> <%docstring> Invokes the syscall getsockopt. See 'man 2 getsockopt' for more information. Arguments: fd(int): fd level(int): level optname(int): optname optval(void): optval optlen(socklen_t): optlen </%docstring> ${syscall('SYS_getsockopt', fd, level, optname, optval, optlen)}
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_FPU_C1|FLAG_FPU_PE ;TEST_FILE_META_END ; set up st0 to be 3.141593 FLDPI FLD1 ;TEST_BEGIN_RECORDING lea edi, [esp-08] FSTP qword [edi] FDIVR qword [edi] mov edi, 0 ;TEST_END_RECORDING
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: FSM FILE: fsmManager.asm AUTHOR: Dennis Chow, September 8, 1989 REVISION HISTORY: Name Date Description ---- ---- ----------- dc 9/ 8/89 Initial revision. DESCRIPTION: Manager for this module. $Id: fsmManager.asm,v 1.1 97/04/04 16:56:29 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ _FSM = 1 ;set to include extra EC code EXTRA_EC equ 0 ;------------------------------------------------------------------------------ ; Include definitions. ;------------------------------------------------------------------------------ include fsmInclude.def ;------------------------------------------------------------------------------ ; Local variables. ;------------------------------------------------------------------------------ idata segment include fsmVariable.def idata ends ;------------------------------------------------------------------------------ ; Here comes the code... ;------------------------------------------------------------------------------ FSM segment resource include fsmMain.asm ; External functions for this module include fsmMakeTables.asm ; Internal functions for this module FSM ends end
;; ;; Copyright (c) 2012-2022, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; ; routine to do AES cbc decrypt on 16n bytes doing AES by 8 ; XMM registers are clobbered. Saving/restoring must be done at a higher level ; void aes_cbc_dec_128_by8_sse(void *in, ; UINT128 *IV, ; UINT128 keys[11], ; void *out, ; UINT64 len_bytes); ; ; arg 1: IN: pointer to input (cipher text) ; arg 2: IV: pointer to IV ; arg 3: KEYS: pointer to keys ; arg 4: OUT: pointer to output (plain text) ; arg 5: LEN: length in bytes (multiple of 16) ; %include "include/os.asm" %include "include/clear_regs.asm" %include "include/cet.inc" %ifndef AES_CBC_DEC_128 %define AES_CBC_DEC_128 aes_cbc_dec_128_by8_sse %endif %define CONCAT(a,b) a %+ b %define MOVDQ movdqu %define xdata0 xmm0 %define xdata1 xmm1 %define xdata2 xmm2 %define xdata3 xmm3 %define xdata4 xmm4 %define xdata5 xmm5 %define xdata6 xmm6 %define xdata7 xmm7 %define xIV xmm8 %define xkey0 xmm9 %define xkey2 xmm10 %define xkey4 xmm11 %define xkey6 xmm12 %define xkey8 xmm13 %define xkey10 xmm14 %define xkeytmp xmm15 %ifdef LINUX %define p_in rdi %define p_IV rsi %define p_keys rdx %define p_out rcx %define num_bytes r8 %else %define p_in rcx %define p_IV rdx %define p_keys r8 %define p_out r9 %define num_bytes rax %endif %define tmp r10 %macro do_aes_load 1 do_aes %1, 1 %endmacro %macro do_aes_noload 1 do_aes %1, 0 %endmacro ; do_aes num_in_par load_keys ; This increments p_in, but not p_out %macro do_aes 2 %define %%by %1 %define %%load_keys %2 %if (%%load_keys) movdqa xkey0, [p_keys + 0*16] %endif %assign i 0 %rep %%by MOVDQ CONCAT(xdata,i), [p_in + i*16] %assign i (i+1) %endrep %if (%%load_keys) movdqa xkey2, [p_keys + 2*16] %endif %assign i 0 %rep %%by pxor CONCAT(xdata,i), xkey0 %assign i (i+1) %endrep add p_in, 16*%%by movdqa xkeytmp, [p_keys + 1*16] %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkeytmp %assign i (i+1) %endrep %if (%%load_keys) movdqa xkey4, [p_keys + 4*16] %endif %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkey2 %assign i (i+1) %endrep movdqa xkeytmp, [p_keys + 3*16] %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkeytmp %assign i (i+1) %endrep %if (%%load_keys) movdqa xkey6, [p_keys + 6*16] %endif %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkey4 %assign i (i+1) %endrep movdqa xkeytmp, [p_keys + 5*16] %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkeytmp %assign i (i+1) %endrep %if (%%load_keys) movdqa xkey8, [p_keys + 8*16] %endif %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkey6 %assign i (i+1) %endrep movdqa xkeytmp, [p_keys + 7*16] %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkeytmp %assign i (i+1) %endrep %if (%%load_keys) movdqa xkey10, [p_keys + 10*16] %endif %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkey8 %assign i (i+1) %endrep movdqa xkeytmp, [p_keys + 9*16] %assign i 0 %rep %%by aesdec CONCAT(xdata,i), xkeytmp %assign i (i+1) %endrep %assign i 0 %rep %%by aesdeclast CONCAT(xdata,i), xkey10 %assign i (i+1) %endrep pxor xdata0, xIV %assign i 1 %if (%%by > 1) %rep (%%by - 1) MOVDQ xIV, [p_in + (i-1)*16 - 16*%%by] pxor CONCAT(xdata,i), xIV %assign i (i+1) %endrep %endif MOVDQ xIV, [p_in + (i-1)*16 - 16*%%by] %assign i 0 %rep %%by MOVDQ [p_out + i*16], CONCAT(xdata,i) %assign i (i+1) %endrep %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mksection .text ;; AES_CBC_DEC_128(void *in, void *IV, void *keys, void *out, UINT64 num_bytes) align 32 MKGLOBAL(AES_CBC_DEC_128,function,internal) AES_CBC_DEC_128: endbranch64 %ifndef LINUX mov num_bytes, [rsp + 8*5] %endif movdqu xIV, [p_IV] mov tmp, num_bytes and tmp, 7*16 jz mult_of_8_blks ; 1 <= tmp <= 7 cmp tmp, 4*16 jg gt4 je eq4 lt4: cmp tmp, 2*16 jg eq3 je eq2 eq1: do_aes_load 1 add p_out, 1*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 eq2: do_aes_load 2 add p_out, 2*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 eq3: do_aes_load 3 add p_out, 3*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 eq4: do_aes_load 4 add p_out, 4*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 gt4: cmp tmp, 6*16 jg eq7 je eq6 eq5: do_aes_load 5 add p_out, 5*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 eq6: do_aes_load 6 add p_out, 6*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 eq7: do_aes_load 7 add p_out, 7*16 and num_bytes, ~7*16 jz do_return2 jmp main_loop2 mult_of_8_blks: movdqa xkey0, [p_keys + 0*16] movdqa xkey2, [p_keys + 2*16] movdqa xkey4, [p_keys + 4*16] movdqa xkey6, [p_keys + 6*16] movdqa xkey8, [p_keys + 8*16] movdqa xkey10, [p_keys + 10*16] main_loop2: endbranch64 main_loop3: ; num_bytes is a multiple of 8 and >0 do_aes_noload 8 add p_out, 8*16 sub num_bytes, 8*16 jne main_loop3 do_return2: %ifdef SAFE_DATA clear_all_xmms_sse_asm %endif ;; SAFE_DATA ret mksection stack-noexec
[bits 64] ; Get the APIC ID for this core get_thread_id: mov rax, 0xFEE00020 mov eax, dword [rax] shr rax, (32 - 8) ret ; rcx <- Node ID get_current_node: push rax push rbx push rdx mov eax, 0x8000001E cpuid and ecx, (MAX_NODES - 1) pop rdx pop rbx pop rax ret ; rdi -> Haystack ; rdx -> Haystack size ; rsi -> Needle ; rcx -> Needle size ; rax <- Found location memmem: push rcx push rdx push rdi push rsi sub rdx, rcx jl short .not_found .lewp: push rdi push rsi push rcx mov rax, rdi rep cmpsb pop rcx pop rsi pop rdi je .found add rdi, 1 sub rdx, 1 cmp rdx, 0 jge short .lewp .not_found: xor rax, rax .found: pop rsi pop rdi pop rdx pop rcx ret ; rdi -> memory to zero ; rcx -> size in bytes of memory to zero bzero: push rax push rcx push rdx push rdi ; Zero out rax for stosq xor eax, eax mov rdx, rcx and edx, 0x7 ; Get remainder of bytes to do individually shr rcx, 3 ; Get number of 8-byte chunks jz short .individual rep stosq .individual: ; We know rcx is 0, so this is effectively a 'mov' that sets flags xor rcx, rdx jz short .done rep stosb .done: pop rdi pop rdx pop rcx pop rax ret ; Allocate 1MB and store the address to it in GS-base ; ; rax -> Core ID init_per_core_storage: push rax push rbx push rcx push rdx push rax mov rbx, (1024 * 1024) bamp_alloc rbx ; Zero out the structure push rdi mov rdi, rbx mov rcx, (1024 * 1024) xor eax, eax rep stosb pop rdi mov eax, ebx bextr rdx, rbx, 0x2020 mov ecx, 0xC0000101 ; gs_base wrmsr mov qword [gs:thread_local.gs_base], rbx call get_current_node mov qword [gs:thread_local.node_id], rcx pop rax mov qword [gs:thread_local.core_id], rax pop rdx pop rcx pop rbx pop rax ret ; rbx -> Node struct to initialize ; rsi -> Source data ; rbp -> Size of data (in bytes) init_node_data: push rcx mov rcx, qword [gs:thread_local.node_id] mov qword [rbx + node_struct.node_data + rcx*8], rsi mov qword [rbx + node_struct.orig_data], rsi mov qword [rbx + node_struct.data_len], rbp pop rcx ret ; rbx -> node_struct ; rax <- Pointer to data local to this node ; ; This is thread safe. You can call this before the orig_data and data_len ; are set, as it will wait until they are set! ; per_node_data: push rcx push rdi ; Wait for the initial data and length to be populated .wait_for_data: pause cmp qword [rbx + node_struct.orig_data], 0 je short .wait_for_data .wait_for_len: pause cmp qword [rbx + node_struct.data_len], 0 je short .wait_for_len mov rcx, qword [gs:thread_local.node_id] ; Check if we already have a local data pointer cmp qword [rbx + node_struct.node_data + rcx*8], 0 jne short .done ; Acquire a lock on the per node data. This will only occur when two ; threads both race to initialize an empty node pointer. mov rax, 1 lock xadd qword [rbx + node_struct.node_race + rcx*8], rax test rax, rax jnz short .poll_for_done ; If we're not the first, wait for the first to ; finish setting up the copy. ; Check again for presence of node data. This is possible if we didn't see ; data above, then the guy populating the node released the lock and then ; we got lock #0 cmp qword [rbx + node_struct.node_data + rcx*8], 0 jne short .release_lock ; Allocate on this node mov rdi, qword [rbx + node_struct.data_len] bamp_alloc rdi ; Copy from the master data source to our local allocation push rcx push rsi push rdi mov rcx, qword [rbx + node_struct.data_len] mov rsi, qword [rbx + node_struct.orig_data] rep movsb pop rdi pop rsi pop rcx ; Save the data pointer! mov qword [rbx + node_struct.node_data + rcx*8], rdi jmp short .release_lock ; Wait for the winner of the race to populate the node data .poll_for_done: pause cmp qword [rbx + node_struct.node_data + rcx*8], 0 je short .poll_for_done .release_lock: ; Release the lock lock dec qword [rbx + node_struct.node_race + rcx*8] .done: mov rax, qword [rbx + node_struct.node_data + rcx*8] pop rdi pop rcx ret ; rsi -> Size to allocate ; rsi <- Pointer bamp_alloc_int: push rax push rbx push rcx push rdx push rdi call get_current_node ; rcx now contains the node id mov rbx, [fs:globals.fs_base] lea rbx, [rbx + globals.bamp_addr + rcx*8] add rsi, 0xFFF and rsi, ~0xFFF mov rdx, rsi lock xadd qword [rbx], rsi ; Check for OOM push rdx add rdx, rsi cmp rdx, [fs:globals.bamp_ends + rcx*8] pop rdx jbe short .not_oom int3 .not_oom: lock add qword [fs:globals.fuzz_status + fuzz_status.alloc_charge + rcx*8], rdx pop rdi pop rdx pop rcx pop rbx pop rax ret ; rsi -> Size to allocate ; rsi <- Pointer rand_alloc_int: push rax push rbx push rcx push rdx push rdi XMMPUSH xmm15 call falkrand movq rcx, xmm15 and rcx, 0x7 ; rcx now contains the node id mov rbx, [fs:globals.fs_base] lea rbx, [rbx + globals.bamp_addr + rcx*8] add rsi, 0xFFF and rsi, ~0xFFF mov rdx, rsi lock xadd qword [rbx], rsi ; Check for OOM push rdx add rdx, rsi cmp rdx, [fs:globals.bamp_ends + rcx*8] pop rdx jbe short .not_oom int3 .not_oom: lock add qword [fs:globals.fuzz_status + fuzz_status.alloc_charge + rcx*8], rdx XMMPOP xmm15 pop rdi pop rdx pop rcx pop rbx pop rax ret ; bamp_get_phys ; ; Summary: ; ; This performs a manual page table lookup to get the physical address for ; a virtual address. Bounds are not checked. A valid vaddr must be provided! ; ; Parameters: ; ; rbx - Virtual address to look up ; ; Alignment: ; ; None ; ; Returns: ; ; rax - Physical address ; ; Smashes: ; ; rax - Return value ; ; Optimization ; ; Readability ; bamp_get_phys: push rdx mov rdx, cr3 call mm_get_phys pop rdx ret alloc_zero_4k: push rcx push rdi call mm_alloc_phys_4k push rax mov rdi, rax mov ecx, 4096 xor eax, eax rep stosb pop rax pop rdi pop rcx ret ; rbx -> vaddr ; rcx -> Mark present? (zero - mark not present, nonzero - mark present) ; rdx -> cr3 bamp_mark_pte_present: push rax push rbx push rdx ; Save the virtual address mov rax, rbx ; Get CR3 shr rdx, 12 shl rdx, 12 ; Get the PML4E shr rbx, 39 and rbx, 0x1FF mov rdx, [rdx + rbx * 8] bt rdx, 0 jnc .fail shr rdx, 12 shl rdx, 12 ; Get the PDPTE mov rbx, rax shr rbx, 30 and rbx, 0x1FF mov rdx, [rdx + rbx * 8] bt rdx, 0 jnc .fail shr rdx, 12 shl rdx, 12 btr rdx, 63 ; Get the PDE mov rbx, rax shr rbx, 21 and rbx, 0x1FF mov rdx, [rdx + rbx * 8] bt rdx, 0 jnc .fail shr rdx, 12 shl rdx, 12 btr rdx, 63 ; Get the PTE mov rbx, rax shr rbx, 12 and rbx, 0x1FF test rcx, rcx jnz short .mark_present ; Mark the PTE not present btr qword [rdx + rbx * 8], 0 jmp short .fail .mark_present: ; Mark the PTE present bts qword [rdx + rbx * 8], 0 .fail: pop rdx pop rbx pop rax ret ; rbx -> Physical address to probe ; rdx <- Zero if DRAM, nonzero if MMIO probe_memory_dest: push rax push rbx push rcx push rbp lea rax, [rel mmio_routing_table] mov rcx, 12 .lewp: mov rdx, qword [rax + 0] ; Base mov rbp, qword [rax + 8] ; Limit ; If the limit does not exist then go to the next table test rbp, rbp jz short .next_table ; If we're < the base, we can't possibly be in this region cmp rbx, rdx jb short .next_table ; If we're <= the limit, then we're MMIO cmp rbx, rbp jbe short .is_mmio .next_table: add rax, 0x10 dec rcx jnz short .lewp xor rdx, rdx jmp short .done .is_mmio: mov rdx, 1 .done: pop rbp pop rcx pop rbx pop rax ret ; rax <- Physical address to 4k page mm_alloc_phys_4k: push rbx push rcx ; Get the per node entry mov rbx, qword [gs:thread_local.phys_4k_freelist] ; If the list is dead, allocate a new entry from the global pool test rbx, rbx jz short .alloc_new ; Get the next free element and set it as the next free entry mov rcx, [rbx] mov qword [gs:thread_local.phys_4k_freelist], rcx jmp short .done .alloc_new: mov rbx, 4096 bamp_alloc rbx .done: call bamp_get_phys pop rcx pop rbx ret ; rax <- Physical address to 4k page mm_rand_alloc_phys_4k: push rbx push rcx ; Get the per node entry mov rbx, qword [gs:thread_local.phys_4k_freelist] ; If the list is dead, allocate a new entry from the global pool test rbx, rbx jz short .alloc_new ; Get the next free element and set it as the next free entry mov rcx, [rbx] mov qword [gs:thread_local.phys_4k_freelist], rcx jmp short .done .alloc_new: mov rbx, 4096 rand_alloc rbx .done: call bamp_get_phys pop rcx pop rbx ret ; rax -> Physical address to 4k page to free mm_free_phys_4k: push rbx ; Get the current free list mov rbx, qword [gs:thread_local.phys_4k_freelist] ; Put the free list link after us mov [rax], rbx ; Make us the head of the free list mov qword [gs:thread_local.phys_4k_freelist], rax pop rbx ret ; rcx -> Number of bytes to allocate ; rax <- Allocation mm_mixed_alloc: push rbx push rcx push rdx push rbp push r10 push r13 push r14 push r15 ; Zero out the return value xor r15, r15 ; Page align the length add rcx, 0xFFF and rcx, ~0xFFF ; If there is no length, fail test rcx, rcx jz short .done ; Get a vaddr to map to and update the current pointer mov r10, rcx lock xadd qword [fs:globals.next_free_vaddr], r10 ; Save off the base virtual address mov r15, r10 ; For each page, create a map .lewp: call mm_rand_alloc_phys_4k mov rbx, r10 mov rdx, cr3 lea rbp, [rax + 3] ; Map as R/W call mm_map_4k add r10, 4096 sub rcx, 4096 jnz short .lewp .done: mov rax, r15 pop r15 pop r14 pop r13 pop r10 pop rbp pop rdx pop rcx pop rbx ret ; rbx -> Address to linearlly map (rounded down to page boundry) ; rcx -> Number of bytes to linearlly map (rounded up to page boundry) ; rdx -> cr3 of the source ; rax <- Mapping mm_linear_map: push rbx push rcx push rdx push rbp push r10 push r13 push r14 push r15 ; Zero out the return value xor r15, r15 ; Get the rounding amount on the address mov r13, rbx and r13, 0xFFF ; Round down the address and rbx, ~0xFFF ; Add the length to the rounded amount and then round it up lea rcx, [rcx + r13 + 0xFFF] and rcx, ~0xFFF ; If there is no length, fail test rcx, rcx jz short .done ; Get a vaddr to map to and update the current pointer mov r10, rcx lock xadd qword [fs:globals.next_free_vaddr], r10 ; Save off the base virtual address mov r14, r10 ; For each page, create a map .lewp: ; Get the physical memory backing this page call mm_get_phys ; Check if this memory is present test rax, rax jnz short .mapped jmp panic .mapped: push rbx push rdx push rbp mov rbx, r10 mov rdx, cr3 lea rbp, [rax + 3] ; Map as R/W call mm_map_4k pop rbp pop rdx pop rbx add r10, 4096 add rbx, 4096 sub rcx, 4096 jnz short .lewp lea r15, [r14 + r13] .done: mov rax, r15 pop r15 pop r14 pop r13 pop r10 pop rbp pop rdx pop rcx pop rbx ret ; rbx -> Guest physical memory to access for write ; rdx -> Guest n_cr3 ; rax <- Host physical address for write (zero on failure) mm_get_phys_with_cow: push rcx push rdi push rsi push rbp push r10 ; First get the mapping call mm_get_phys_int test rax, rax jz .done ; If the mapping is already writable do nothing bt rcx, 1 jc .done ; Mapping is not writeable, make a new allocation and map it as writable ; then copy the memory here. ; Get the base address of the original page mov rsi, rax mov r10, rax and rsi, ~0xFFF and r10, 0xFFF ; Allocate a new page and copy the old contents to it call mm_alloc_phys_4k mov rdi, rax mov rcx, (4096 / 8) rep movsq ; Create the new mapping lea rbp, [rax + 7] call mm_map_4k ; Return the pointer to the new mapping plus the original offset add rax, r10 .done: pop r10 pop rbp pop rsi pop rdi pop rcx ret ; rbx -> Virtual Address ; rdx -> CR3 to use for mapping ; rax <- Physical Address (zero on failure) mm_get_phys: push rcx call mm_get_phys_int pop rcx ret ; rbx -> Virtual Address ; rdx -> CR3 to use for mapping ; rax <- Physical Address (zero on failure) ; rcx <- Raw entry mm_get_phys_int: push rdx ; ------ PML4 ------------------------------------------------- ; Extract the PML4 base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PML4 offset from bits 47:39 of the vaddr bextr rax, rbx, 0x0927 ; Fetch the PML4E and check for presence mov rdx, qword [rdx + rax*8] bt rdx, 0 jnc .not_present ; ------ PDP ------------------------------------------------- ; Extract the PDP base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PDP offset from bits 38:30 of the vaddr bextr rax, rbx, 0x091e ; Fetch the PDPE and check for presence mov rdx, qword [rdx + rax*8] bt rdx, 0 jnc short .not_present ; Check for 1GB paging mov eax, (30 << 8) ; Virtual address bextr mask to get physical page offset bt rdx, 7 jc short .present ; ------ PD ------------------------------------------------- ; Extract the PD base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PD offset from bits 29:21 of the vaddr bextr rax, rbx, 0x0915 ; Fetch the PDE and check for presence mov rdx, qword [rdx + rax*8] bt rdx, 0 jnc short .not_present ; Check for 2MB paging mov eax, (21 << 8) ; Virtual address bextr mask to get physical page offset bt rdx, 7 jc short .present ; ------ PT ------------------------------------------------- ; Extract the PT base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PT offset from bits 20:12 of the vaddr bextr rax, rbx, 0x090c ; Fetch the PTE and check for presence mov rdx, qword [rdx + rax*8] bt rdx, 0 jnc short .not_present ; We're using 4KB paging mov eax, (12 << 8) ; Virtual address bextr mask to get physical page offset .present: ; At this point ; rax - Mask for bextr to get physical address offset ; (12 for 4KB, 21 for 2MB, and 30 for 1GB) ; rdx - Raw entry from the page table mov rcx, rdx ; Extract the physical page base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the n number of bits from the virtual address to get our offset bextr rax, rbx, rax ; Calculate the physical address + offset for our final result add rax, rdx jmp short .done .not_present: xor eax, eax .done: pop rdx ret ; rbx -> Virtual Address ; rdx -> Guest cr3 ; rbp -> Guest nested page table ; rax <- Physical Address mm_guest_virt_to_host_phys: push rcx push r10 mov r10, 0 call mm_guest_virt_to_host_phys_int pop r10 pop rcx ret ; rbx -> Virtual Address ; rdx -> Guest cr3 ; rbp -> Guest nested page table ; rax <- Physical Address mm_guest_virt_to_host_phys_cow: push rcx push r10 mov r10, 1 call mm_guest_virt_to_host_phys_int pop r10 pop rcx ret ; rbx -> Virtual Address ; rdx -> Guest cr3 ; rbp -> Guest nested page table ; r10 -> 0 - read access, 1 - write access ; rax <- Physical Address ; rcx <- Raw page table entry (in a failure case, it's the contents of the non ; present data) mm_guest_virt_to_host_phys_int: push rdx xor rcx, rcx ; ------ PML4 ------------------------------------------------- ; Extract the PML4 base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Translate guest physical into host physical via ncr3 push rax push rbx mov rbx, rdx mov rdx, rbp call mm_get_phys mov rdx, rax pop rbx pop rax ; Validate that the guest physical to host physical was successful test rdx, rdx jz .not_present ; Extract the PML4 offset from bits 47:39 of the vaddr bextr rax, rbx, 0x0927 ; Fetch the PML4E and check for presence mov rdx, qword [rdx + rax*8] mov rcx, rdx bt rdx, 0 jnc .not_present ; ------ PDP ------------------------------------------------- ; Extract the PDP base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Translate guest physical into host physical via ncr3 push rax push rbx mov rbx, rdx mov rdx, rbp call mm_get_phys mov rdx, rax pop rbx pop rax ; Validate that the guest physical to host physical was successful test rdx, rdx jz .not_present ; Extract the PDP offset from bits 38:30 of the vaddr bextr rax, rbx, 0x091e ; Fetch the PDPE and check for presence mov rdx, qword [rdx + rax*8] mov rcx, rdx bt rdx, 0 jnc .not_present ; Check for 1GB paging mov eax, (30 << 8) ; Virtual address bextr mask to get physical page offset bt rdx, 7 jc .present ; ------ PD ------------------------------------------------- ; Extract the PD base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Translate guest physical into host physical via ncr3 push rax push rbx mov rbx, rdx mov rdx, rbp call mm_get_phys mov rdx, rax pop rbx pop rax ; Validate that the guest physical to host physical was successful test rdx, rdx jz .not_present ; Extract the PD offset from bits 29:21 of the vaddr bextr rax, rbx, 0x0915 ; Fetch the PDE and check for presence mov rdx, qword [rdx + rax*8] mov rcx, rdx bt rdx, 0 jnc .not_present ; Check for 2MB paging mov eax, (21 << 8) ; Virtual address bextr mask to get physical page offset bt rdx, 7 jc short .present ; ------ PT ------------------------------------------------- ; Extract the PT base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Translate guest physical into host physical via ncr3 push rax push rbx mov rbx, rdx mov rdx, rbp call mm_get_phys mov rdx, rax pop rbx pop rax ; Validate that the guest physical to host physical was successful test rdx, rdx jz .not_present ; Extract the PT offset from bits 20:12 of the vaddr bextr rax, rbx, 0x090c ; Fetch the PTE and check for presence mov rdx, qword [rdx + rax*8] mov rcx, rdx bt rdx, 0 jnc short .not_present ; We're using 4KB paging mov eax, (12 << 8) ; Virtual address bextr mask to get physical page offset .present: ; At this point ; rax - Mask for bextr to get physical address offset ; (12 for 4KB, 21 for 2MB, and 30 for 1GB) ; rdx - Raw entry from the page table ; Extract the physical page base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the n number of bits from the virtual address to get our offset bextr rax, rbx, rax ; Calculate the physical address + offset for our final result add rax, rdx ; Translate guest physical into host physical via ncr3 push rbx mov rbx, rax mov rdx, rbp test r10, r10 jnz short .cow call mm_get_phys jmp short .done_cow .cow: call mm_get_phys_with_cow .done_cow: pop rbx ; Validate that the guest physical to host physical was successful test rax, rax jz .not_present jmp short .done .not_present: xor eax, eax .done: pop rdx ret ; rbx -> Virtual address to make a map for ; rdx -> Page table base address (what you would have in cr3) [allocated already] ; rbp -> Physical page to describe with this vaddr mm_map_4k: push rax push rcx push rdx push rsi ; ------ PML4 ------------------------------------------------- ; Extract the PML4 base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PML4 offset from bits 47:39 of the vaddr bextr rcx, rbx, 0x0927 ; Fetch the PML4E and check for presence mov rsi, qword [rdx + rcx*8] bt rsi, 0 jc .already_mapped_pml4 ; Allocate PML4E as RW, present, and user call alloc_zero_4k or rax, 7 | (3 << 9) bts rax, 62 bts rax, 61 mov qword [rdx + rcx*8], rax mov rsi, rax ; ------ PDP ------------------------------------------------- .already_mapped_pml4: ; Extract the PDP base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PDP offset from bits 38:30 of the vaddr bextr rcx, rbx, 0x091e ; Fetch the PDPE and check for presence mov rsi, qword [rdx + rcx*8] bt rsi, 0 jc .already_mapped_pdp ; Allocate PDPE as RW, present, and user call alloc_zero_4k or rax, 7 | (2 << 9) bts rax, 62 bts rax, 61 mov qword [rdx + rcx*8], rax mov rsi, rax ; ------ PD ------------------------------------------------- .already_mapped_pdp: ; Extract the PD base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PD offset from bits 29:21 of the vaddr bextr rcx, rbx, 0x0915 ; Fetch the PDE and check for presence mov rsi, qword [rdx + rcx*8] bt rsi, 0 jc .already_mapped_pde ; Allocate PDE as RW, present, and user call alloc_zero_4k or rax, 7 | (1 << 9) bts rax, 62 bts rax, 61 mov qword [rdx + rcx*8], rax mov rsi, rax ; ------ PT ------------------------------------------------- .already_mapped_pde: ; Extract the PT base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PT offset from bits 20:12 of the vaddr bextr rcx, rbx, 0x090c ; Fetch the PTE and check for presence ;mov rsi, qword [rdx + rcx*8] ;bt rsi, 0 ;jc .already_mapped_pte ; Move in specified value as PTE bts rbp, 62 bts rbp, 61 mov qword [rdx + rcx*8], rbp .already_mapped_pte: pop rsi pop rdx pop rcx pop rax ret ; Allocate contiguous physical memory by discarding anything that isn't. This ; can very dangerously exhaust memory!!! For anything <= 4K, simply call ; mm_alloc_phys_4k ; ; rcx -> Number of physically contiguous bytes needed ; rax <- Physical address to memory ; mm_alloc_contig_phys: push rbx push rcx push rdx push rdi push rsi push rbp ; Round up bytes requested to next 4k boundry add rcx, 0xFFF and rcx, ~0xFFF ; Prevent an infinite loop on the zero case test rcx, rcx jz short .fail ; Save off the aligned number of bytes needed mov rbp, rcx ; Store cr3 in rdx for mm_get_phys calls mov rdx, cr3 .try_another_allocation: ; Restore number of bytes needed mov rcx, rbp ; Allocate! mov rbx, rcx bamp_alloc rbx ; Get the number of contiguous pages we need shr rcx, 12 ; Get the physical address of the first page call mm_get_phys mov rsi, rax mov rdi, rax .for_each_page: add rbx, 4096 dec rcx jz short .done ; Get the physical address of the next page call mm_get_phys ; Did our next page follow directly after the previous? If not, try again! add rsi, 4096 cmp rsi, rax jne short .try_another_allocation jmp short .for_each_page .done: ; Get the original physical address mov rax, rdi jmp short .end .fail: xor eax, eax .end: pop rbp pop rsi pop rdi pop rdx pop rcx pop rbx ret ; rdx -> CR3 to use for mapping ; rbp -> Function to call with each dirty page ; r13 -> Pointer to page entry ; rbx -> Virtual address mm_for_each_dirty_4k: push rax push rbx push r10 push r11 push r12 push r13 push r14 ; Extract the PML4 base address, bits 51:12 bextr r10, rdx, 0x280c shl r10, 12 .for_each_pml4: ; Fetch the PML4E and check for presence mov r11, qword [r10] bt r11, 0 jnc .next_pml4 ; If the entry is not accessed, ignore bt r11, 5 jnc .next_pml4 ; Extract the PDP base address, bits 51:12 bextr r11, r11, 0x280c shl r11, 12 .for_each_pdpe: ; Fetch the PDPE and check for presence mov r12, qword [r11] bt r12, 0 jnc .next_pdpe ; If the entry is not accessed, ignore bt r12, 5 jnc .next_pdpe ; Extract the PD base address, bits 51:12 bextr r12, r12, 0x280c shl r12, 12 .for_each_pde: ; Fetch the PDPE and check for presence mov r13, qword [r12] bt r13, 0 jnc .next_pde ; If the entry is not accessed, ignore bt r13, 5 jnc .next_pde ; Extract the PT base address, bits 51:12 bextr r13, r13, 0x280c shl r13, 12 .for_each_pte: ; Fetch the PTE and check for presence mov r14, qword [r13] bt r14, 0 jnc .next_pte ; If the entry is not dirty, ignore bt r14, 6 jnc .next_pte ; Compute the virtual address for this map xor rbx, rbx bextr rax, r10, 0x0c00 shl rax, (39 - 3) or rbx, rax bextr rax, r11, 0x0c00 shl rax, (30 - 3) or rbx, rax bextr rax, r12, 0x0c00 shl rax, (21 - 3) or rbx, rax bextr rax, r13, 0x0c00 shl rax, (12 - 3) or rbx, rax call rbp .next_pte: btr qword [r13], 5 ; Clear accessed btr qword [r13], 6 ; Clear dirty add r13, 8 test r13, 0xfff jnz short .for_each_pte .next_pde: btr qword [r12], 5 ; Clear accessed btr qword [r12], 6 ; Clear dirty add r12, 8 test r12, 0xfff jnz .for_each_pde .next_pdpe: btr qword [r11], 5 ; Clear accessed btr qword [r11], 6 ; Clear dirty add r11, 8 test r11, 0xfff jnz .for_each_pdpe .next_pml4: btr qword [r10], 5 ; Clear accessed btr qword [r10], 6 ; Clear dirty add r10, 8 test r10, 0xfff jnz .for_each_pml4 .done: pop r14 pop r13 pop r12 pop r11 pop r10 pop rbx pop rax ret ; rdx -> CR3 to clean mm_clean_all_pages: push r10 push r11 push r12 push r13 push r14 ; Extract the PML4 base address, bits 51:12 bextr r10, rdx, 0x280c shl r10, 12 .for_each_pml4: ; Fetch the PML4E and check for presence mov r11, qword [r10] bt r11, 0 jnc .next_pml4 ; Clear both the accessed and dirty flags and qword [r10], ~((1 << 6) | (1 << 5)) ; Extract the PDP base address, bits 51:12 bextr r11, r11, 0x280c shl r11, 12 .for_each_pdpe: ; Fetch the PDPE and check for presence mov r12, qword [r11] bt r12, 0 jnc .next_pdpe ; Clear both the accessed and dirty flags and qword [r11], ~((1 << 6) | (1 << 5)) ; Extract the PD base address, bits 51:12 bextr r12, r12, 0x280c shl r12, 12 .for_each_pde: ; Fetch the PDPE and check for presence mov r13, qword [r12] bt r13, 0 jnc .next_pde ; Clear both the accessed and dirty flags and qword [r12], ~((1 << 6) | (1 << 5)) ; Extract the PT base address, bits 51:12 bextr r13, r13, 0x280c shl r13, 12 .for_each_pte: ; Fetch the PTE and check for presence mov r14, qword [r13] bt r14, 0 jnc .next_pte ; Clear both the accessed and dirty flags and qword [r13], ~((1 << 6) | (1 << 5)) .next_pte: add r13, 8 test r13, 0xfff jnz short .for_each_pte .next_pde: add r12, 8 test r12, 0xfff jnz short .for_each_pde .next_pdpe: add r11, 8 test r11, 0xfff jnz short .for_each_pdpe .next_pml4: add r10, 8 test r10, 0xfff jnz .for_each_pml4 .done: pop r14 pop r13 pop r12 pop r11 pop r10 ret ; rsi -> Host resident vaddr to copy from ; rdi -> Guest resident vaddr to copy to ; rcx -> Number of bytes to copy ; rdx -> Guest CR3 ; rbp -> Nested CR3 mm_copy_to_guest_vm: push rax push rbx push rcx push rsi push rdi push r8 ; Bail on the nothing to copy case test rcx, rcx jz short .done ; Fetch a host physical mapping to the guest memory mov rbx, rdi call mm_guest_virt_to_host_phys_cow test rax, rax jz short .done .lewp: ; Check if we're on a new page boundry test rdi, 0xFFF jnz short .not_new_page ; If we're on a new page boundry, get the new page address mov rbx, rdi call mm_guest_virt_to_host_phys_cow test rax, rax jz short .done .not_new_page: mov r8b, byte [rsi] mov byte [rax], r8b inc rax ; Increment guest paddr inc rsi ; Increment host vaddr inc rdi ; Increment guest vaddr dec rcx ; Decrement count jnz short .lewp .done: pop r8 pop rdi pop rsi pop rcx pop rbx pop rax ret ; rsi -> Host resident vaddr to copy from ; rdi -> Guest resident vaddr to copy to ; rcx -> Number of bytes to copy mm_copy_to_guest_vm_vmcb: push rax push rdx push rbp mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] mov rbp, [rax + VMCB.n_cr3] call mm_copy_to_guest_vm pop rbp pop rdx pop rax ret ; rdx -> Address to read qword from ; rdx <- Result mm_read_guest_qword: push rax push rsi push rdi push rcx push rbp sub rsp, 0x8 mov rdi, rsp mov rsi, rdx mov rcx, 0x8 mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] mov rbp, [rax + VMCB.n_cr3] call mm_copy_from_guest_vm mov rdx, qword [rsp] add rsp, 0x8 pop rbp pop rcx pop rdi pop rsi pop rax ret ; rdx -> Address to write qword to ; rbx -> Value to write mm_write_guest_qword: push rax push rsi push rdi push rcx push rdx push rbp sub rsp, 0x8 mov qword [rsp], rbx mov rsi, rsp mov rdi, rdx mov rcx, 0x8 mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] mov rbp, [rax + VMCB.n_cr3] call mm_copy_to_guest_vm add rsp, 0x8 pop rbp pop rdx pop rcx pop rdi pop rsi pop rax ret ; rdx -> Address to read qword from ; rdx <- Result mm_read_guest_qword_phys: push rax push rbx push rbp mov rbx, rdx mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.n_cr3] call mm_get_phys test rax, rax jz short .fail mov rdx, [rax] .fail: pop rbp pop rbx pop rax ret ; rdx -> Address to write qword to ; rbx -> Value to write mm_write_guest_qword_phys: push rax push rbx push rcx push rbp push rbx mov rbx, rdx mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.n_cr3] call mm_get_phys_with_cow test rax, rax pop rbx jz short .fail mov [rax], rbx .fail: pop rbp pop rcx pop rbx pop rax ret ; rsi -> Guest resident vaddr to copy from ; rdi -> Host resident vaddr to copy to ; rcx -> Number of bytes to copy mm_copy_from_guest_vm_vmcb: push rax push rdx push rbp mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] mov rbp, [rax + VMCB.n_cr3] call mm_copy_from_guest_vm pop rbp pop rdx pop rax ret ; rsi -> Guest resident vaddr to copy from ; rdi -> Host resident vaddr to copy to ; rcx -> Number of bytes to copy ; rdx -> Guest CR3 ; rbp -> Nested CR3 mm_copy_from_guest_vm: push rax push rbx push rcx push rsi push rdi push r8 ; Bail on the nothing to copy case test rcx, rcx jz short .done ; Fetch a host physical mapping to the guest memory mov rbx, rsi call mm_guest_virt_to_host_phys test rax, rax jz short .done .lewp: ; Check if we're on a new page boundry test rsi, 0xFFF jnz short .not_new_page ; If we're on a new page boundry, get the new page address mov rbx, rsi call mm_guest_virt_to_host_phys test rax, rax jz short .done .not_new_page: mov r8b, byte [rax] mov byte [rdi], r8b inc rax ; Increment guest paddr inc rsi ; Increment guest vaddr inc rdi ; Increment host vaddr dec rcx ; Decrement count jnz short .lewp .done: pop r8 pop rdi pop rsi pop rcx pop rbx pop rax ret ; sil -> Byte to set (second argument to memset()) ; rdi -> Guest resident vaddr to copy to ; rcx -> Number of bytes to copy ; rdx -> Guest CR3 ; rbp -> Nested CR3 mm_memset: push rax push rbx push rcx push rdi push r8 ; Bail on the nothing to copy case test rcx, rcx jz short .done ; Fetch a host physical mapping to the guest memory mov rbx, rdi call mm_guest_virt_to_host_phys test rax, rax jz short .done .lewp: ; Check if we're on a new page boundry test rdi, 0xFFF jnz short .not_new_page ; If we're on a new page boundry, get the new page address mov rbx, rdi call mm_guest_virt_to_host_phys test rax, rax jz short .done .not_new_page: mov byte [rax], sil inc rax ; Increment guest paddr inc rdi ; Increment guest vaddr dec rcx ; Decrement count jnz short .lewp .done: pop r8 pop rdi pop rcx pop rbx pop rax ret ; sil -> Byte to set (second argument to memset()) ; rdi -> Guest resident vaddr to copy to ; rcx -> Number of bytes to copy ; rdx -> Guest CR3 ; rbp -> Nested CR3 mm_memset_backwards: push rax push rbx push rcx push rdi push r8 push r9 ; Bail on the nothing to copy case test rcx, rcx jz short .done ; Fetch a host physical mapping to the guest memory mov rbx, rdi call mm_guest_virt_to_host_phys test rax, rax jz short .done .lewp: ; Check if we're on a new page boundry mov r9, rdi and r9, 0xFFF cmp r9, 0xFFF jne short .not_new_page ; If we're on a new page boundry, get the new page address mov rbx, rdi call mm_guest_virt_to_host_phys test rax, rax jz short .done .not_new_page: mov byte [rax], sil dec rax ; Decrement guest paddr dec rdi ; Decrement guest vaddr dec rcx ; Decrement count jnz short .lewp .done: pop r9 pop r8 pop rdi pop rcx pop rbx pop rax ret ; rcx -> Size in bytes to allocate in the guest ; rcx <- Guest physical address of the allocation mm_guest_allocate_phys: push rax push rbx push rdx push rbp push r15 add rcx, 0xFFF and rcx, ~0xFFF jz .done .try_alloc_phys: call xorshift64 mov rbx, 0x7FFFFFFFF000 and r15, rbx ; Get the number of pages to allocate mov rbp, rcx shr rbp, 12 mov rbx, r15 .next_phys_page: ; Get the current mapping. If this page is present, try all over again mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.n_cr3] call mm_get_phys test rax, rax jnz short .try_alloc_phys add rbx, 4096 dec rbp jnz short .next_phys_page ; rcx - Size to allocate, in bytes ; r15 - Physical memory location to map to mov rbp, rcx shr rbp, 12 mov rbx, r15 .alloc_phys_page: push rbp call mm_alloc_phys_4k push rax mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.n_cr3] pop rax lea rbp, [rax + 7] call mm_map_4k pop rbp add rbx, 4096 dec rbp jnz short .alloc_phys_page mov rcx, r15 .done: pop r15 pop rbp pop rdx pop rbx pop rax ret ; rcx -> Size to allocate in guest (in bytes) ; rcx <- Guest virtual address of the buffer ; The buffer returned from this function is present in both host and guest ; virtual memory. Meaning the host can access this memory directly as well. mm_guest_allocate_virt: push rax push rbx push rdx push rbp push r12 push r13 push r14 push r15 add rcx, 0xFFF and rcx, ~0xFFF jz .done push rcx call mm_guest_allocate_phys mov r14, rcx pop rcx ; Now we try to find room in the virtual mapping .try_alloc_virt: call xorshift64 mov rbx, 0x7FFFFFFFF000 and r15, rbx ; Get the number of pages to allocate mov rbp, rcx shr rbp, 12 mov rbx, r15 .next_virt_page: ; Get the current mapping. If this page is present, try all over again mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] bextr rax, rbx, 0x0927 lea rdx, [rdx + rax*8] call mm_read_guest_qword_phys bt rdx, 0 jc .try_alloc_virt mov rdx, cr3 call mm_get_phys test rax, rax jnz short .try_alloc_virt add rbx, 4096 dec rbp jnz short .next_virt_page ; At this point we know that the guest virtual space has enough room for ; rcx bytes at virtual address r15 mov r13, rcx shr r13, 12 mov rbx, r15 mov r12, r14 .map_virt_page: lea rbp, [r12 + 7] call mm_guest_map_4k test rax, rax jz .try_alloc_virt mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] mov rbp, [rax + VMCB.n_cr3] call mm_guest_virt_to_host_phys test rax, rax jz .try_alloc_virt mov rdx, cr3 lea rbp, [rax + 7] call mm_map_4k add rbx, 4096 add r12, 4096 dec r13 jnz .map_virt_page mov rcx, r15 .done: pop r15 pop r14 pop r13 pop r12 pop rbp pop rdx pop rbx pop rax ret ; rax <- Guest physical address guest_alloc_zero_4k: push rbx push rcx push rdx push rdi mov rax, [gs:thread_local.VMCB] mov rcx, 4096 call mm_guest_allocate_phys mov rbx, rcx mov rdx, [rax + VMCB.n_cr3] call mm_get_phys test rax, rax jz panic mov rdi, rax mov rcx, (4096 / 8) xor eax, eax rep stosq mov rax, rbx pop rdi pop rdx pop rcx pop rbx ret ; rbx -> Virtual address to map ; rbp -> Entry to place in for the mapping mm_guest_map_4k: push rcx push rdx push rsi mov rax, [gs:thread_local.VMCB] mov rdx, [rax + VMCB.cr3] ; ------ PML4 ------------------------------------------------- ; Extract the PML4 base address, bits 51:12 bextr rdx, rdx, 0x280c shl rdx, 12 ; Extract the PML4 offset from bits 47:39 of the vaddr bextr rcx, rbx, 0x0927 ; Fetch the PML4E and check for presence push rdx lea rdx, [rdx + rcx*8] call mm_read_guest_qword_phys mov rsi, rdx pop rdx bt rsi, 0 jc .already_mapped_pml4 ; Allocate PML4E as RW, present, and user call guest_alloc_zero_4k or rax, 7 push rbx push rdx lea rdx, [rdx + rcx*8] mov rbx, rax call mm_write_guest_qword_phys pop rdx pop rbx mov rsi, rax ; ------ PDP ------------------------------------------------- .already_mapped_pml4: ; Make sure the memory is user and writable and not a large page bt rsi, 1 jnc .unmapable_memory bt rsi, 2 jnc .unmapable_memory bt rsi, 7 jc .unmapable_memory ; Extract the PDP base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PDP offset from bits 38:30 of the vaddr bextr rcx, rbx, 0x091e ; Fetch the PDPE and check for presence push rdx lea rdx, [rdx + rcx*8] call mm_read_guest_qword_phys mov rsi, rdx pop rdx bt rsi, 0 jc .already_mapped_pdp ; Allocate PDPE as RW, present, and user call guest_alloc_zero_4k or rax, 7 push rbx push rdx lea rdx, [rdx + rcx*8] mov rbx, rax call mm_write_guest_qword_phys pop rdx pop rbx mov rsi, rax ; ------ PD ------------------------------------------------- .already_mapped_pdp: ; Make sure the memory is user and writable and not a large page bt rsi, 1 jnc .unmapable_memory bt rsi, 2 jnc .unmapable_memory bt rsi, 7 jc .unmapable_memory ; Extract the PD base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PD offset from bits 29:21 of the vaddr bextr rcx, rbx, 0x0915 ; Fetch the PDE and check for presence push rdx lea rdx, [rdx + rcx*8] call mm_read_guest_qword_phys mov rsi, rdx pop rdx bt rsi, 0 jc .already_mapped_pde ; Allocate PDE as RW, present, and user call guest_alloc_zero_4k or rax, 7 push rbx push rdx lea rdx, [rdx + rcx*8] mov rbx, rax call mm_write_guest_qword_phys pop rdx pop rbx mov rsi, rax ; ------ PT ------------------------------------------------- .already_mapped_pde: ; Make sure the memory is user and writable and not a large page bt rsi, 1 jnc .unmapable_memory bt rsi, 2 jnc .unmapable_memory bt rsi, 7 jc .unmapable_memory ; Extract the PT base address, bits 51:12 bextr rdx, rsi, 0x280c shl rdx, 12 ; Extract the PT offset from bits 20:12 of the vaddr bextr rcx, rbx, 0x090c ; Move in specified value as PTE push rbx push rdx lea rdx, [rdx + rcx*8] mov rbx, rbp call mm_write_guest_qword_phys pop rdx pop rbx mov eax, 1 jmp short .done .unmapable_memory: xor eax, eax .done: pop rsi pop rdx pop rcx ret ; rbx -> nested page table to use iommu_init: push rax push rbx push rcx push rdx push rbp push rdi ; get the low 32-bits of the IOMMU base address mov eax, (0x00 << 16) | (0x00 << 11) | (0x02 << 8) | (1 << 31) | 0x44 mov dx, 0x0CF8 out dx, eax mov dx, 0x0CFC in eax, dx mov ebp, eax and ebp, ~0x3FFF ; get the high 32-bits of the IOMMU base address mov eax, (0x00 << 16) | (0x00 << 11) | (0x02 << 8) | (1 << 31) | 0x48 mov dx, 0x0CF8 out dx, eax mov dx, 0x0CFC in eax, dx shl rax, 32 or rbp, rax ; rbp now contains the IOMMU base address ; Allocate the device table mov rcx, (2 * 1024 * 1024) call mm_alloc_contig_phys ; Zero out the device table mov rdi, rax mov rcx, (2 * 1024 * 1024) call bzero ; Create our device table entry template ; IW - Enable DMA writes ; IR - Enable DMA reads ; Mode - 4 level page table ; TV - Translation information valid ; V - DTE valid mov rdx, (1 << 62) | (1 << 61) | (4 << 9) | (1 << 1) | (1 << 0) or rdx, rbx ; Add in the page table root pointer ; Fill in the device table xor ecx, ecx .lewp: mov qword [rdi + rcx], rdx add ecx, 32 cmp ecx, (2 * 1024 * 1024) jb short .lewp ; Set up the device table base (with maximum size of 0x1ff) or rdi, 0x1ff mov qword [rbp + 0x00], rdi ; Enable the IOMMU :) bts qword [rbp + 0x18], 0 pop rdi pop rbp pop rdx pop rcx pop rbx pop rax ret ; rdi -> Dest ; rsi -> Source ; rcx -> Length memmove: memcpy: push rcx push rsi push rdi ; If there is nothing to be copied, do nothing. test rcx, rcx jz short .done ; If the dest and source are the same, there is no effect, don't copy. cmp rsi, rdi je short .done ja short .copy_forwards .copy_backwards: std lea rsi, [rsi + rcx - 1] lea rdi, [rdi + rcx - 1] .copy_forwards: rep movsb .done: cld pop rdi pop rsi pop rcx ret
; A061803: Sum of n-th row of triangle of 4th powers: 1; 1 16 1; 1 16 81 16 1; 1 16 81 256 81 16 1; ... ; 1,18,115,452,1333,3254,6951,13448,24105,40666,65307,100684,149981,216958,305999,422160,571217,759714,995011,1285332,1639813,2068550,2582647,3194264,3916665,4764266,5752683,6898780,8220717,9737998,11471519,13443616,15678113,18200370,21037331,24217572,27771349,31730646,36129223,41002664,46388425,52325882,58856379,66023276,73871997,82450078,91807215,101995312,113068529,125083330,138098531,152175348,167377445,183770982,201424663,220409784,240800281,262672778,286106635,311183996,337989837,366612014,397141311,429671488,464299329,501124690,540250547,581783044,625831541,672508662,721930343,774215880,829487977,887872794,949499995,1014502796,1083018013,1155186110,1231151247,1311061328,1395068049,1483326946,1575997443,1673242900,1775230661,1882132102,1994122679,2111381976,2234093753,2362445994,2496630955,2636845212,2783289709,2936169806,3095695327,3262080608,3435544545,3616310642,3804607059,4000666660 lpb $0 mov $2,$0 sub $0,1 seq $2,8514 ; 4-dimensional centered cube numbers. add $1,$2 lpe add $1,1 mov $0,$1
; CRT0 for the Sharp X1 ; ; Karl Von Dyson (for X1s.org) ; ; $Id: x1_crt0.asm,v 1.7 2015/01/21 07:05:01 stefano Exp $ ; MODULE x1_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main EXTERN _x1_printf PUBLIC cleanup PUBLIC l_dcal PUBLIC _std_seed PUBLIC _vfprintf PUBLIC exitsp PUBLIC exitcount PUBLIC heaplast PUBLIC heapblocks PUBLIC __sgoioblk ; X1 stdio support variables PUBLIC _x1_cursor_coords PUBLIC _x1_keyboard_io ; X1 stdio support entry functions PUBLIC _wait_sub_cpu ;-------- ; Non-zero origins must be >=32768 (startup=2 must be used for this) ;-------- IF !myzorg IF (startup=2) defc myzorg = 32768 ELSE defc myzorg = 0 ENDIF ENDIF org myzorg ;-------- ; Execution starts here ;-------- start: di IF (!DEFINED_startup | (startup=1)) if (myzorg > 0) defs ZORG_NOT_ZERO endif ld sp,$FFFF im 1 ei ENDIF IF (startup=2) if (myzorg < 32768) defs ZORG_TOO_LOW endif ld sp,$FDFF ; re-activate IPL ld bc,$1D00 xor a out (c),a ld hl,$FE00 push hl EXTERN im2_Init call im2_Init pop hl EXTERN im2_EmptyISR ld hl,im2_EmptyISR ld b,128 isr_table_fill: ld ($FE00),hl inc hl inc hl djnz isr_table_fill ld hl,_kbd_isr ld ($FE52),hl im 2 ei ENDIF call _wait_sub_cpu ld bc, $1900 ld a, $E4 ; Interrupt vector set out (c), a call _wait_sub_cpu ld bc, $1900 ld a, $52 ; out (c), a ;IF !DEFINED_x1_no_clrscr ; EXTERN _x1_cls ; call _x1_cls ;ENDIF IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ; INIT math identify platform IF NEED_floatpack EXTERN init_floatpack call init_floatpack ENDIF ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc ld hl,0 add hl,sp INCLUDE "amalloc.def" ENDIF call _main cleanup: IF !DEFINED_nostreams IF DEFINED_ANSIstdio EXTERN closeall call closeall ENDIF ENDIF push hl ; return code rst 0 cleanup_exit: ret IF (!DEFINED_startup | (startup=1)) defs 56-cleanup_exit-1 if (ASMPC<>$0038) defs CODE_ALIGNMENT_ERROR endif ENDIF ; ------------------------------------------- ; Don't move the following block ! ; It must be aligned when startup=1 !! _kbd_isr: push af push bc ;push de push hl ld bc, $1A01 .iiki1 in a, (c) and $20 jr nz, iiki1 ld bc, $1900 in a, (c) ld hl, _x1_keyboard_io+1 ld (hl), a dec hl ld bc, $1A01 .iiki2 in a, (c) and $20 jr nz, iiki2 ld bc, $1900 in a, (c) ld (hl), a pop hl ;pop de pop bc pop af ei reti ; ------------------------------------------- l_dcal: jp (hl) ; Now, define some values for stdin, stdout, stderr __sgoioblk: IF DEFINED_ANSIstdio INCLUDE "stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? _vfprintf: IF DEFINED_floatstdio EXTERN vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio EXTERN vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio EXTERN vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines IF !DEFINED_HAVESEED PUBLIC _std_seed ; Integer rand() seed _std_seed: defw 0 ; Seed for integer rand() routines ENDIF exitsp: defw $FDFF exitcount: defb 0 ; Heap stuff heaplast: defw 0 heapblocks:defw 0 ; X1 stdio support variables _x1_cursor_coords: defw 0 _x1_keyboard_io: defw 0 _wait_sub_cpu: ld bc, $1A01 .ii_w1 in a, (c) bit 6, a jp nz, ii_w1 ret IF DEFINED_USING_amalloc EXTERN ASMTAIL PUBLIC _heap ; The heap pointer will be wiped at startup, ; but first its value (based on ASMTAIL) ; will be kept for sbrk() to setup the malloc area _heap: defw ASMTAIL ; Location of the last program byte defw 0 ENDIF IF NEED_floatpack INCLUDE "float.asm" ;seed for random number generator - not used yet.. fp_seed: defb $80,$80,0,0,0,0 ;Floating point registers... extra: defs 6 fa: defs 6 fasign: defb 0 ENDIF
PowerPlant_h: db FACILITY ; tileset db POWER_PLANT_HEIGHT, POWER_PLANT_WIDTH ; dimensions (y, x) dw PowerPlant_Blocks ; blocks dw PowerPlant_TextPointers ; texts dw PowerPlant_Script ; scripts db 0 ; connections dw PowerPlant_Object ; objects
; SMSQ_CACHE Cache Handling Fiddles 68040 copyback V2.0  1994 Tony Tebby ; 2005-11-12 2.01 fix bugs in COPYBACK mode. (TG) ; This module is checked after the main SMSQ OS module has been loaded ; There is no permanent cade and the select routine always returns 0. ; As a side effect, however, it sets up the cache routines in the base area ; and, if required, moves the trap #0 to #3 entry points. section header xref smsq_end include 'dev8_mac_creg' include 'dev8_keys_68000' include 'dev8_keys_stella_bl' include 'dev8_smsq_smsq_base_keys' header_base dc.l cache_set-header_base ; length of header dc.l 0 ; module length unknown dc.l smsq_end-cache_set ; loaded length dc.l 0 ; checksum dc.l 0 ; always select dc.b 0 ; main level dc.b 0 dc.w smsq_name-* smsq_name dc.w 33,'SMSQ Copyback Cache Handling Code ' dc.l '2.01' dc.w $200a section base ; this version sets only 68040 caches for copyback cache_set lea cache_40c,a1 ; cache defs move.l a5,-(sp) lea sms.cinvd,a5 moveq #($10*7)/2-1,d1 ; copy seven lots of $10 bytes cache_copy move.w (a1)+,d0 ; data to write jsr sms.wbase ; write it dbra d1,cache_copy lea sms.cenab,a5 move.w #$4ef9,d0 jsr sms.wbase lea enable_caches,a1 move.l a1,d0 swap d0 jsr sms.wbase lea enable_caches,a1 move.l a1,d0 jsr sms.wbase lea sms.cenai,a5 move.w #$4ef9,d0 jsr sms.wbase lea enable_caches,a1 move.l a1,d0 swap d0 jsr sms.wbase lea enable_caches,a1 move.l a1,d0 jsr sms.wbase move.l (sp)+,a5 moveq #0,d0 ; nothing to load rts * Before we enable a cache, we must make sure that the data previously * stored in it is either saved (for the data cache, in the event it was * already enabled before the call) or invalidated. * * The previous versions of the routines didn't ensure for this and a call to * them while the data cache was already enabled resulted in invlidating data * that was not yet copied back (in copyback mode) ! Also, as there is no * distinction between instruction and data cache disabling (both are disabled * together), there should be none at enable time: the previous version of the * routine invalidated the instruction cache only when re-enabling it, but * didn't make sure that the data cache was enabled or invalidated ! enable_caches move.w sr,-(sp) ; save status register. ori.w #$0700,sr ; disable interrupts. gcreg cacr ; get cacr in d0. btst #31,d0 ; data cache enabled ? beq.s no_cpushd ; if no, skip... cpushd ; save our data ! no_cpushd cinva ; invalidate both caches. move.l #$a0c08000,d0 ; enable all caches, invalidate branch pcreg cacr move.w (sp)+,sr ; restore status register. rts cache_40c rts dc.w 0,0,0,0,0,0,0 ; pad to 16 bytes cpusha ; (push data and) invalidate inst cache rts dc.w 0,0,0,0,0,0 ; pad to 16 bytes moveq #0,d0 ; disable everything pcreg cacr cpusha ; then push rts dc.w 0,0,0 ; pad to 16 bytes moveq #0,d0 ; in copyback mode disable instruction pcreg cacr ; does not ensure that the instruction cpusha ; cache will be re-filled correctly rts ; so we must disable both dc.w 0,0,0 rts ; this will be replaced with a jmp dc.w 0,0,0,0,0,0,0 ; pad to 16 bytes. rts ; this will be replaced with a jmp dc.w 0,0,0,0,0,0,0 ; pad to 16 bytes. dc.w 0,0,0,0,0,0,0 ; no tricks on trap cpusha ; push data, invalidate instruction cache on load cache_end end
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2003 Ferdinando Ametrano This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email <quantlib-dev@lists.sf.net>. The license is also available online at <http://quantlib.org/license.shtml>. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /*! \file localvolsurface.hpp \brief Local volatility surface derived from a Black vol surface */ #ifndef quantlib_localvolsurface_hpp #define quantlib_localvolsurface_hpp #include <ql/termstructures/volatility/equityfx/localvoltermstructure.hpp> namespace QuantLib { class BlackVolTermStructure; class YieldTermStructure; class Quote; //! Local volatility surface derived from a Black vol surface /*! For details about this implementation refer to "Stochastic Volatility and Local Volatility," in "Case Studies and Financial Modelling Course Notes," by Jim Gatheral, Fall Term, 2003 see www.math.nyu.edu/fellows_fin_math/gatheral/Lecture1_Fall02.pdf \bug this class is untested, probably unreliable. */ class LocalVolSurface : public LocalVolTermStructure { public: LocalVolSurface(const Handle<BlackVolTermStructure>& blackTS, const Handle<YieldTermStructure>& riskFreeTS, const Handle<YieldTermStructure>& dividendTS, const Handle<Quote>& underlying); LocalVolSurface(const Handle<BlackVolTermStructure>& blackTS, const Handle<YieldTermStructure>& riskFreeTS, const Handle<YieldTermStructure>& dividendTS, Real underlying); //! \name TermStructure interface //@{ const Date& referenceDate() const; DayCounter dayCounter() const; Date maxDate() const; //@} //! \name VolatilityTermStructure interface //@{ Real minStrike() const; Real maxStrike() const; //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} protected: Volatility localVolImpl(Time, Real) const; private: Handle<BlackVolTermStructure> blackTS_; Handle<YieldTermStructure> riskFreeTS_, dividendTS_; Handle<Quote> underlying_; }; } #endif
; A279512: Sierpinski octahedron numbers a(n) = 2*6^n + 3*2^n + 1. ; Submitted by Jamie Morken(s4) ; 6,19,85,457,2641,15649,93505,560257,3360001,20156929,120935425,725600257,4353576961,26121412609,156728377345,940370067457,5642220011521,33853319282689,203119914123265,1218719481593857,7312316883271681,43873901287047169,263243407697117185,1579460446132371457,9476762676693565441,56860576059960066049,341163456359357743105,2046980738155341152257,12281884428930436300801,73691306573579396579329,442147839441469937025025,2652887036648806737248257,15917322219892814653685761,95503933319356836382507009 mov $1,6 pow $1,$0 mov $2,2 pow $2,$0 add $1,$2 mul $1,2 add $2,$1 mov $0,$2 add $0,1
; Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ReadDr4.Asm ; ; Abstract: ; ; AsmReadDr4 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; AsmReadDr4 ( ; VOID ; ); ;------------------------------------------------------------------------------ AsmReadDr4 PROC ; ; There's no obvious reason to access this register, since it's aliased to ; DR7 when DE=0 or an exception generated when DE=1 ; DB 0fh, 21h, 0e0h ret AsmReadDr4 ENDP END
copyright zengfr site:http://github.com/zengfr/romhack 003CCE move.b #$1, ($17,A3) 003CCE[FF9AA6] 007A18 rts [boss+3E, enemy+3E] 007A36 rts [boss+3E, container+3E, enemy+3E] copyright zengfr site:http://github.com/zengfr/romhack
// This file was generated using Parlex's cpp_generator #ifndef INCLUDED_IMPLICATION_HPP #define INCLUDED_IMPLICATION_HPP #include <optional> #include <variant> #include <vector> #include "erased.hpp" #include "parlex/detail/abstract_syntax_tree.hpp" #include "parlex/detail/builtins.hpp" #include "parlex/detail/document.hpp" #include "plange_grammar.hpp" namespace plc { struct EXPRESSION; struct IC; struct IMPLICATION { erased<EXPRESSION> field_1; std::vector<erased<IC>> field_2; std::variant< parlex::detail::document::text<literal_0xE20x870x92_t>, parlex::detail::document::text<literal_0x3D0x3E_t> > field_3; std::vector<erased<IC>> field_4; erased<EXPRESSION> field_5; explicit IMPLICATION( erased<EXPRESSION> && field_1, std::vector<erased<IC>> && field_2, std::variant< parlex::detail::document::text<literal_0xE20x870x92_t>, parlex::detail::document::text<literal_0x3D0x3E_t> > && field_3, std::vector<erased<IC>> && field_4, erased<EXPRESSION> && field_5) : field_1(std::move(field_1)), field_2(std::move(field_2)), field_3(std::move(field_3)), field_4(std::move(field_4)), field_5(std::move(field_5)) {} IMPLICATION(IMPLICATION const & other) = default; IMPLICATION(IMPLICATION && move) = default; static IMPLICATION build(parlex::detail::ast_node const & n); static parlex::detail::state_machine const & state_machine(); }; } // namespace plc #endif //INCLUDED_IMPLICATION_HPP
; A156868: 729000n + 180. ; 729180,1458180,2187180,2916180,3645180,4374180,5103180,5832180,6561180,7290180,8019180,8748180,9477180,10206180,10935180,11664180,12393180,13122180,13851180,14580180,15309180,16038180,16767180,17496180,18225180,18954180,19683180,20412180,21141180,21870180,22599180,23328180,24057180,24786180,25515180,26244180,26973180,27702180,28431180,29160180,29889180,30618180,31347180,32076180,32805180,33534180,34263180,34992180,35721180,36450180,37179180,37908180,38637180,39366180,40095180,40824180,41553180,42282180,43011180,43740180,44469180,45198180,45927180,46656180,47385180,48114180,48843180,49572180,50301180,51030180,51759180,52488180,53217180,53946180,54675180,55404180,56133180,56862180,57591180,58320180,59049180,59778180,60507180,61236180,61965180,62694180,63423180,64152180,64881180,65610180,66339180,67068180,67797180,68526180,69255180,69984180,70713180,71442180,72171180,72900180 mul $0,729000 add $0,729180
<% import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft %> <%docstring>pciconfig_iobase(which, bus, devfn) -> str Invokes the syscall pciconfig_iobase. See 'man 2 pciconfig_iobase' for more information. Arguments: which(long): which bus(unsigned): bus devfn(unsigned): devfn Returns: int </%docstring> <%page args="which=0, bus=0, devfn=0"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack regs = abi.register_arguments[1:] allregs = pwnlib.shellcraft.registers.current() can_pushstr = [] can_pushstr_array = [] argument_names = ['which', 'bus', 'devfn'] argument_values = [which, bus, devfn] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() stack_arguments = collections.OrderedDict() string_arguments = dict() dict_arguments = dict() array_arguments = dict() syscall_repr = [] for name, arg in zip(argument_names, argument_values): if arg is not None: syscall_repr.append('%s=%r' % (name, arg)) # If the argument itself (input) is a register... if arg in allregs: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[index] = arg # The argument is not a register. It is a string value, and we # are expecting a string value elif name in can_pushstr and isinstance(arg, str): string_arguments[name] = arg # The argument is not a register. It is a dictionary, and we are # expecting K:V paris. elif name in can_pushstr_array and isinstance(arg, dict): array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] # The arguent is not a register. It is a list, and we are expecting # a list of arguments. elif name in can_pushstr_array and isinstance(arg, (list, tuple)): array_arguments[name] = arg # The argument is not a register, string, dict, or list. # It could be a constant string ('O_RDONLY') for an integer argument, # an actual integer value, or a constant. else: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[target] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. for syscall in ['SYS_pciconfig_iobase']: if hasattr(pwnlib.constants, syscall): break else: raise Exception("Could not locate any syscalls: %r" % syscalls) %> /* pciconfig_iobase(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): ${pwnlib.shellcraft.pushstr(arg, append_null=('\x00' not in arg))} ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} %endfor %for name, arg in array_arguments.items(): ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} %endfor %for name, arg in stack_arguments.items(): ${pwnlib.shellcraft.push(arg)} %endfor ${pwnlib.shellcraft.setregs(register_arguments)} ${pwnlib.shellcraft.syscall(syscall)}
#ifndef _ML_VERTEX_ARRAY_HPP_ #define _ML_VERTEX_ARRAY_HPP_ #include <ML/Graphics/Export.hpp> #include <ML/Graphics/GL.hpp> #include <ML/Core/MemoryTracker.hpp> #include <ML/Core/Handle.hpp> namespace ml { /* * * * * * * * * * * * * * * * * * * * */ struct ML_GRAPHICS_API VertexArrayObject final : public Trackable, public Handle<uint32_t> { /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ VertexArrayObject(); VertexArrayObject(VertexArrayObject const & copy); ~VertexArrayObject(); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ VertexArrayObject & clean(); VertexArrayObject & create(GL::Mode mode); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ VertexArrayObject const & bind() const; VertexArrayObject const & unbind() const; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ inline auto mode() const -> GL::Mode const & { return m_mode; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ private: GL::Mode m_mode; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ }; /* * * * * * * * * * * * * * * * * * * * */ ML_USING VAO = typename VertexArrayObject; /* * * * * * * * * * * * * * * * * * * * */ } #endif // !_ML_VERTEX_ARRAY_HPP_
PUBLIC _z180_rst_20h EXTERN _system_rst defc _z180_rst_20h = _system_rst
print_start: pusha mov ah, 0x0e jmp print_do print_do: mov al, [bx] cmp al, 0 je print_end int 0x10 add bx, 1 jmp print_do print_end: popa ret
; A142363: Primes congruent to 12 mod 47. ; Submitted by Jon Maiga ; 59,811,1093,1187,1657,2221,2503,2879,3067,3631,4007,4289,4759,5323,5417,5981,6263,6451,6733,6827,7109,7297,7673,8237,8707,9929,10211,10399,11057,11527,11621,11903,12373,13219,13313,13877,14159,14347,14629,14723,15193,15287,15569,16603,16979,17167,17449,18013,18671,18859,19141,19423,20269,20551,21397,21491,21773,21961,22619,22807,22901,23371,23747,24029,24499,24593,24781,25439,26003,26849,27883,28447,28541,28729,29387,29669,30139,30703,31079,31267,31643,32771,33053,33617,34369,34651,35027,35591 mov $1,29 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,1 mov $3,$1 add $1,13 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,34 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,93
/******************************************************************************* * Filename : usart7fieldvalues.hpp * * Details : Enumerations related with USART7 peripheral. This header file * is auto-generated for STM32F0x1 device. * * *******************************************************************************/ #if !defined(USART7ENUMS_HPP) #define USART7ENUMS_HPP #include "fieldvalue.hpp" //for FieldValues template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_UE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_UE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_UE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_UESM_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_UESM_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_UESM_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_RE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_RE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_RE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_TE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_TE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_TE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_IDLEIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_IDLEIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_IDLEIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_RXNEIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_RXNEIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_RXNEIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_TCIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_TCIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_TCIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_TXEIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_TXEIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_TXEIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_PEIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_PEIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_PEIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_PS_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_PS_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_PS_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_PCE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_PCE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_PCE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_WAKE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_WAKE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_WAKE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_M_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_M_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_M_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_MME_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_MME_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_MME_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_CMIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_CMIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_CMIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_OVER8_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_OVER8_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_OVER8_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_DEDT_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 7U> ; using Value8 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 8U> ; using Value9 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 9U> ; using Value10 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 10U> ; using Value11 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 11U> ; using Value12 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 12U> ; using Value13 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 13U> ; using Value14 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 14U> ; using Value15 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 15U> ; using Value16 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 16U> ; using Value17 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 17U> ; using Value18 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 18U> ; using Value19 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 19U> ; using Value20 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 20U> ; using Value21 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 21U> ; using Value22 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 22U> ; using Value23 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 23U> ; using Value24 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 24U> ; using Value25 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 25U> ; using Value26 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 26U> ; using Value27 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 27U> ; using Value28 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 28U> ; using Value29 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 29U> ; using Value30 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 30U> ; using Value31 = FieldValue<USART7_CR1_DEDT_Values, BaseType, 31U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_DEAT_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 7U> ; using Value8 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 8U> ; using Value9 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 9U> ; using Value10 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 10U> ; using Value11 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 11U> ; using Value12 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 12U> ; using Value13 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 13U> ; using Value14 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 14U> ; using Value15 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 15U> ; using Value16 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 16U> ; using Value17 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 17U> ; using Value18 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 18U> ; using Value19 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 19U> ; using Value20 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 20U> ; using Value21 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 21U> ; using Value22 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 22U> ; using Value23 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 23U> ; using Value24 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 24U> ; using Value25 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 25U> ; using Value26 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 26U> ; using Value27 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 27U> ; using Value28 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 28U> ; using Value29 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 29U> ; using Value30 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 30U> ; using Value31 = FieldValue<USART7_CR1_DEAT_Values, BaseType, 31U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_RTOIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_RTOIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_RTOIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_EOBIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_EOBIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_EOBIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR1_M1_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR1_M1_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR1_M1_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_ADD4_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 7U> ; using Value8 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 8U> ; using Value9 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 9U> ; using Value10 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 10U> ; using Value11 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 11U> ; using Value12 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 12U> ; using Value13 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 13U> ; using Value14 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 14U> ; using Value15 = FieldValue<USART7_CR2_ADD4_Values, BaseType, 15U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_ADD0_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 7U> ; using Value8 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 8U> ; using Value9 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 9U> ; using Value10 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 10U> ; using Value11 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 11U> ; using Value12 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 12U> ; using Value13 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 13U> ; using Value14 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 14U> ; using Value15 = FieldValue<USART7_CR2_ADD0_Values, BaseType, 15U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_RTOEN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_RTOEN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_RTOEN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_ABRMOD_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_ABRMOD_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_ABRMOD_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR2_ABRMOD_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR2_ABRMOD_Values, BaseType, 3U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_ABREN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_ABREN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_ABREN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_MSBFIRST_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_MSBFIRST_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_MSBFIRST_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_DATAINV_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_DATAINV_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_DATAINV_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_TXINV_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_TXINV_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_TXINV_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_RXINV_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_RXINV_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_RXINV_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_SWAP_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_SWAP_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_SWAP_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_LINEN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_LINEN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_LINEN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_STOP_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_STOP_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_STOP_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR2_STOP_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR2_STOP_Values, BaseType, 3U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_CLKEN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_CLKEN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_CLKEN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_CPOL_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_CPOL_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_CPOL_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_CPHA_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_CPHA_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_CPHA_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_LBCL_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_LBCL_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_LBCL_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_LBDIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_LBDIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_LBDIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_LBDL_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_LBDL_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_LBDL_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR2_ADDM7_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR2_ADDM7_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR2_ADDM7_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_WUFIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_WUFIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_WUFIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_WUS_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_WUS_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_WUS_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR3_WUS_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR3_WUS_Values, BaseType, 3U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_SCARCNT_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_CR3_SCARCNT_Values, BaseType, 7U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_DEP_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_DEP_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_DEP_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_DEM_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_DEM_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_DEM_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_DDRE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_DDRE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_DDRE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_OVRDIS_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_OVRDIS_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_OVRDIS_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_ONEBIT_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_ONEBIT_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_ONEBIT_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_CTSIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_CTSIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_CTSIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_CTSE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_CTSE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_CTSE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_RTSE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_RTSE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_RTSE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_DMAT_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_DMAT_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_DMAT_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_DMAR_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_DMAR_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_DMAR_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_SCEN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_SCEN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_SCEN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_NACK_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_NACK_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_NACK_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_HDSEL_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_HDSEL_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_HDSEL_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_IRLP_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_IRLP_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_IRLP_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_IREN_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_IREN_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_IREN_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_CR3_EIE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_CR3_EIE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_CR3_EIE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_BRR_DIV_Mantissa_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_BRR_DIV_Fraction_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 1U> ; using Value2 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 2U> ; using Value3 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 3U> ; using Value4 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 4U> ; using Value5 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 5U> ; using Value6 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 6U> ; using Value7 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 7U> ; using Value8 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 8U> ; using Value9 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 9U> ; using Value10 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 10U> ; using Value11 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 11U> ; using Value12 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 12U> ; using Value13 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 13U> ; using Value14 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 14U> ; using Value15 = FieldValue<USART7_BRR_DIV_Fraction_Values, BaseType, 15U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_GTPR_GT_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_GTPR_PSC_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RTOR_BLEN_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RTOR_RTO_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RQR_TXFRQ_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_RQR_TXFRQ_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_RQR_TXFRQ_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RQR_RXFRQ_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_RQR_RXFRQ_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_RQR_RXFRQ_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RQR_MMRQ_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_RQR_MMRQ_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_RQR_MMRQ_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RQR_SBKRQ_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_RQR_SBKRQ_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_RQR_SBKRQ_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RQR_ABRRQ_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_RQR_ABRRQ_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_RQR_ABRRQ_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_REACK_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_REACK_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_REACK_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_TEACK_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_TEACK_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_TEACK_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_WUF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_WUF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_WUF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_RWU_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_RWU_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_RWU_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_SBKF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_SBKF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_SBKF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_CMF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_CMF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_CMF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_BUSY_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_BUSY_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_BUSY_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_ABRF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_ABRF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_ABRF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_ABRE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_ABRE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_ABRE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_EOBF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_EOBF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_EOBF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_RTOF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_RTOF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_RTOF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_CTS_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_CTS_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_CTS_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_CTSIF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_CTSIF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_CTSIF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_LBDF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_LBDF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_LBDF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_TXE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_TXE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_TXE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_TC_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_TC_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_TC_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_RXNE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_RXNE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_RXNE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_IDLE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_IDLE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_IDLE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_ORE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_ORE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_ORE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_NF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_NF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_NF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_FE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_FE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_FE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ISR_PE_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ISR_PE_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ISR_PE_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_WUCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_WUCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_WUCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_CMCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_CMCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_CMCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_EOBCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_EOBCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_EOBCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_RTOCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_RTOCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_RTOCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_CTSCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_CTSCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_CTSCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_LBDCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_LBDCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_LBDCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_TCCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_TCCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_TCCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_IDLECF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_IDLECF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_IDLECF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_ORECF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_ORECF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_ORECF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_NCF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_NCF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_NCF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_FECF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_FECF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_FECF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_ICR_PECF_Values: public RegisterField<Reg, offset, size, AccessMode> { using Value0 = FieldValue<USART7_ICR_PECF_Values, BaseType, 0U> ; using Value1 = FieldValue<USART7_ICR_PECF_Values, BaseType, 1U> ; } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_RDR_RDR_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; template <typename Reg, size_t offset, size_t size, typename AccessMode, typename BaseType> struct USART7_TDR_TDR_Values: public RegisterField<Reg, offset, size, AccessMode> { } ; #endif //#if !defined(USART7ENUMS_HPP)
; A084558: a(0) = 0; for n >= 1: a(n) = largest m such that n >= m!. ; 0,1,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 mov $1,2 lpb $0 div $0,$1 add $1,1 lpe sub $1,2
LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $22E, $22E, $000, $000, $000, $000, $000, $000, $000, $000, $000, $22E, $22E, $000 LN_DATA $000, $EEE, $EEE, $22E, $000, $000, $000, $22E, $22E, $22E, $000, $22E, $22E, $EEE, $000 LN_DATA $000, $EEE, $EEE, $EEE, $22E, $000, $22E, $22E, $008, $008, $22E, $22E, $EEE, $EEE, $000 LN_DATA $000, $22E, $EEE, $22E, $22E, $22E, $22E, $22E, $22E, $008, $22E, $22E, $22E, $22E, $000 LN_DATA $000, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $000 LN_DATA $000, $22E, $22E, $22E, $EEE, $EEE, $EEE, $22E, $22E, $EEE, $EEE, $EEE, $22E, $22E, $000 LN_DATA $000, $22E, $000, $22E, $EEE, $000, $EEE, $22E, $22E, $EEE, $000, $EEE, $22E, $22E, $000 LN_DATA $000, $EEE, $000, $22E, $EEE, $000, $EEE, $22E, $22E, $EEE, $000, $EEE, $22E, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $EEE, $000, $EEE, $EEE, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $EEE, $000, $000, $EEE, $EEE, $EEE, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $EEE, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $EEE, $EEE, $EEE, $000, $000, $000, $EEE, $EEE, $EEE, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $EEE, $000, $EEE, $EEE, $EEE, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $EEE, $EEE, $EEE, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $EEE, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $EEE, $EEE, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $EEE, $EEE, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000, $000, $EEE, $EEE, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $22E, $22E, $000, $000, $000, $000, $000, $000, $000, $000, $000, $22E, $22E, $000 LN_DATA $000, $EEE, $EEE, $22E, $000, $000, $000, $22E, $22E, $22E, $000, $22E, $22E, $EEE, $000 LN_DATA $000, $EEE, $EEE, $EEE, $22E, $000, $22E, $22E, $008, $008, $22E, $22E, $EEE, $EEE, $000 LN_DATA $000, $22E, $EEE, $22E, $22E, $22E, $22E, $22E, $22E, $008, $22E, $22E, $22E, $22E, $000 LN_DATA $000, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $22E, $000 LN_DATA $000, $22E, $22E, $22E, $EEE, $EEE, $EEE, $22E, $22E, $EEE, $EEE, $EEE, $22E, $22E, $000 LN_DATA $000, $22E, $000, $22E, $EEE, $000, $EEE, $22E, $22E, $EEE, $000, $EEE, $22E, $22E, $000 LN_DATA $000, $EEE, $000, $22E, $EEE, $000, $EEE, $22E, $22E, $EEE, $000, $EEE, $22E, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $000 LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $EEE, $000, $EEE, $EEE, $000, $EEE, $EEE, $EEE LN_DATA $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $000, $EEE, $000, $000, $EEE, $EEE, $EEE, $000 LN_DATA $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE LN_DATA $000, $000, $EEE, $000, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $EEE, $000, $EEE, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000 LN_DATA $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000, $000
;------------------------------------------------------------------------------ ; ; Copyright (c) 2007, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; CopyMem.asm ; ; Abstract: ; ; CopyMem function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; VOID ; EfiCommonLibCopyMem ( ; OUT VOID *Destination, ; IN VOID *Source, ; IN UINTN Count ; ); ;------------------------------------------------------------------------------ EfiCommonLibCopyMem PROC USES rsi rdi cmp rdx, rcx ; if Source == Destination, do nothing je @CopyMemDone cmp r8, 0 ; if Count == 0, do nothing je @CopyMemDone mov rsi, rdx ; rsi <- Source mov rdi, rcx ; rdi <- Destination lea r9, [rsi + r8 - 1] ; r9 <- End of Source cmp rsi, rdi mov rax, rdi ; rax <- Destination as return value jae @F ; Copy forward if Source > Destination cmp r9, rdi ; Overlapped? jae @CopyBackward ; Copy backward if overlapped @@: xor rcx, rcx sub rcx, rdi ; rcx <- -rdi and rcx, 15 ; rcx + rsi should be 16 bytes aligned jz @F ; skip if rcx == 0 cmp rcx, r8 cmova rcx, r8 sub r8, rcx rep movsb @@: mov rcx, r8 and r8, 15 shr rcx, 4 ; rcx <- # of DQwords to copy jz @CopyBytes @@: movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned movdqa [rdi], xmm0 ; rdi should be 16-byte aligned add rsi, 16 add rdi, 16 loop @B jmp @CopyBytes ; copy remaining bytes @CopyBackward: mov rsi, r9 ; rsi <- Last byte of Source lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination std @CopyBytes: mov rcx, r8 rep movsb cld @CopyMemDone: ret EfiCommonLibCopyMem ENDP END
; Provided under the CC0 license. See the included LICENSE.txt for details. minikernel ; display up to 6 lives on screen sta WSYNC ldx #$20 stx HMP1 stx VDELP0 lda lives lsr lsr lsr lsr lsr sta RESP0 sta RESP1 stx VDELP1 tax lda lifenusiz0table,x sta NUSIZ0 lda lifenusiz1table,x sta NUSIZ1 lda lifecolor sta COLUP0 sta COLUP1 lda #$10 sta HMP0 lda statusbarlength lsr lsr lsr ; 0-31 ; 3 cases: 0-7, 8-15, 16-24 ; if 0-7, temp1=val, temp2=0, temp3=0 ; if 8-15, temp1=255, temp2=val (rev), temp3=0 ; if 16-23, temp1=255, temp2=255, temp3=val tay sta HMOVE ;cycle 74? ifconst statusbarcolor ; only write COLUPF if color variable exists, otherwise use existing PF color lda statusbarcolor sta COLUPF endif cpy #8 bcc zero_7 cpy #16 bcc eight_15 lda #255 sta temp1 sta temp2 lda statustable-16,y sta temp3 lda statustable,y sta temp4 jmp startlifedisplay zero_7 lda #0 sta temp4 sta temp3 sta temp2 lda statustable,y sta temp1 jmp startlifedisplay eight_15 lda #255 sta temp1 lda #0 sta temp4 sta temp3 lda statustable+16,y sta temp2 startlifedisplay ldy #7 lifeloop sta WSYNC stx PF0 lda (lifepointer),y cpx #0 bne onelife .byte $0C onelife sta GRP0 cpx #2 bcs nolives .byte $0C nolives sta GRP1 lda temp4 sta PF0 lda temp1 sta PF2 lda temp3 sta PF1 lda temp2 sta PF2 ;cycle 48! pla ; waste 14 cycles in 4 bytes pha ; pla ; pha ; Shouldn't hurt anything! lda #0 dey sta PF1 bpl lifeloop sta WSYNC iny sty PF0 sty PF2 sty PF1 sty GRP0 sty GRP1 rts if (<*) > $F5 align 256 endif lifenusiz1table .byte 0 lifenusiz0table .byte 0,0,0,1,1,3,3,3 statustable ; warning: page-wrapping might cause issues ;0-7 and 16+ .byte %00000000 .byte %00000001 .byte %00000011 .byte %00000111 .byte %00001111 .byte %00011111 .byte %00111111 .byte %01111111 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 ; 8-15 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte %00000000 .byte %10000000 .byte %11000000 .byte %11100000 .byte %11110000 .byte %11111000 .byte %11111100 .byte %11111110
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <gtk/gtk.h> #include <memory> #include <string> #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" #include "base/i18n/message_formatter.h" #include "base/location.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "remoting/base/string_resources.h" #include "remoting/host/it2me/it2me_confirmation_dialog.h" #include "ui/base/glib/glib_signal.h" #include "ui/base/l10n/l10n_util.h" namespace remoting { namespace { // Time to wait before closing the dialog and cancelling the connection. constexpr base::TimeDelta kDialogTimeout = base::TimeDelta::FromMinutes(1); class It2MeConfirmationDialogLinux : public It2MeConfirmationDialog { public: It2MeConfirmationDialogLinux(); ~It2MeConfirmationDialogLinux() override; // It2MeConfirmationDialog implementation. void Show(const std::string& remote_user_email, const ResultCallback& callback) override; private: // Creates a dialog window and makes it visible. void CreateWindow(const std::string& remote_user_email); // Destroys the dialog window (if created) and stop |dialog_timer_|. void Hide(); // Handles user input from the dialog. CHROMEG_CALLBACK_1(It2MeConfirmationDialogLinux, void, OnResponse, GtkDialog*, int); GtkWidget* confirmation_window_ = nullptr; ResultCallback result_callback_; base::OneShotTimer dialog_timer_; DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogLinux); }; It2MeConfirmationDialogLinux::It2MeConfirmationDialogLinux() {} It2MeConfirmationDialogLinux::~It2MeConfirmationDialogLinux() { Hide(); } void It2MeConfirmationDialogLinux::Show(const std::string& remote_user_email, const ResultCallback& callback) { DCHECK(!remote_user_email.empty()); DCHECK(callback); DCHECK(!result_callback_); result_callback_ = callback; CreateWindow(remote_user_email); dialog_timer_.Start(FROM_HERE, kDialogTimeout, base::Bind(&It2MeConfirmationDialogLinux::OnResponse, base::Unretained(this), /*dialog=*/nullptr, GTK_RESPONSE_NONE)); } void It2MeConfirmationDialogLinux::Hide() { dialog_timer_.Stop(); if (confirmation_window_) { gtk_widget_destroy(confirmation_window_); confirmation_window_ = nullptr; } } void It2MeConfirmationDialogLinux::CreateWindow( const std::string& remote_user_email) { DCHECK(!confirmation_window_); confirmation_window_ = gtk_dialog_new_with_buttons( l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str(), /*parent=*/nullptr, static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL), l10n_util::GetStringUTF8(IDS_SHARE_CONFIRM_DIALOG_DECLINE).c_str(), GTK_RESPONSE_CANCEL, l10n_util::GetStringUTF8(IDS_SHARE_CONFIRM_DIALOG_CONFIRM).c_str(), GTK_RESPONSE_OK, /*next_button=*/nullptr); gtk_dialog_set_default_response(GTK_DIALOG(confirmation_window_), GTK_RESPONSE_CANCEL); gtk_window_set_resizable(GTK_WINDOW(confirmation_window_), false); gtk_window_set_keep_above(GTK_WINDOW(confirmation_window_), true); g_signal_connect(confirmation_window_, "response", G_CALLBACK(OnResponseThunk), this); GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(confirmation_window_)); base::string16 dialog_text = base::i18n::MessageFormatter::FormatWithNumberedArgs( l10n_util::GetStringUTF16( IDS_SHARE_CONFIRM_DIALOG_MESSAGE_WITH_USERNAME), remote_user_email); GtkWidget* text_label = gtk_label_new(base::UTF16ToUTF8(dialog_text).c_str()); gtk_label_set_line_wrap(GTK_LABEL(text_label), true); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_container_add(GTK_CONTAINER(content_area), text_label); gtk_widget_show_all(content_area); gtk_window_set_urgency_hint(GTK_WINDOW(confirmation_window_), true); gtk_window_present(GTK_WINDOW(confirmation_window_)); } void It2MeConfirmationDialogLinux::OnResponse(GtkDialog* dialog, int response_id) { DCHECK(result_callback_); Hide(); base::ResetAndReturn(&result_callback_).Run( (response_id == GTK_RESPONSE_OK) ? Result::OK : Result::CANCEL); } } // namespace std::unique_ptr<It2MeConfirmationDialog> It2MeConfirmationDialogFactory::Create() { return base::MakeUnique<It2MeConfirmationDialogLinux>(); } } // namespace remoting
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "orc/OrcFile.hh" #include "Adaptor.hh" #include "orc/Exceptions.hh" #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include "hdfspp/hdfspp.h" namespace orc { class HdfsFileInputStream : public InputStream { private: std::string filename; std::unique_ptr<hdfs::FileHandle> file; std::unique_ptr<hdfs::FileSystem> file_system; uint64_t totalLength; const uint64_t READ_SIZE = 1024 * 1024; //1 MB public: HdfsFileInputStream(std::string _filename) { filename = _filename ; //Building a URI object from the given uri_path hdfs::URI uri; try { uri = hdfs::URI::parse_from_string(filename); } catch (const hdfs::uri_parse_error&) { throw ParseError("Malformed URI: " + filename); } //This sets conf path to default "$HADOOP_CONF_DIR" or "/etc/hadoop/conf" //and loads configs core-site.xml and hdfs-site.xml from the conf path hdfs::ConfigParser parser; if(!parser.LoadDefaultResources()){ throw ParseError("Could not load default resources. "); } auto stats = parser.ValidateResources(); //validating core-site.xml if(!stats[0].second.ok()){ throw ParseError(stats[0].first + " is invalid: " + stats[0].second.ToString()); } //validating hdfs-site.xml if(!stats[1].second.ok()){ throw ParseError(stats[1].first + " is invalid: " + stats[1].second.ToString()); } hdfs::Options options; if(!parser.get_options(options)){ throw ParseError("Could not load Options object. "); } hdfs::IoService * io_service = hdfs::IoService::New(); //Wrapping file_system into a unique pointer to guarantee deletion file_system = std::unique_ptr<hdfs::FileSystem>( hdfs::FileSystem::New(io_service, "", options)); if (file_system.get() == nullptr) { throw ParseError("Can't create FileSystem object. "); } hdfs::Status status; //Checking if the user supplied the host if(!uri.get_host().empty()){ //Using port if supplied, otherwise using "" to look up port in configs std::string port = uri.has_port() ? std::to_string(uri.get_port()) : ""; status = file_system->Connect(uri.get_host(), port); if (!status.ok()) { throw ParseError("Can't connect to " + uri.get_host() + ":" + port + ". " + status.ToString()); } } else { status = file_system->ConnectToDefaultFs(); if (!status.ok()) { if(!options.defaultFS.get_host().empty()){ throw ParseError("Error connecting to " + options.defaultFS.str() + ". " + status.ToString()); } else { throw ParseError( "Error connecting to the cluster: defaultFS is empty. " + status.ToString()); } } } if (file_system.get() == nullptr) { throw ParseError("Can't connect the file system. "); } hdfs::FileHandle *file_raw = nullptr; status = file_system->Open(uri.get_path(), &file_raw); if (!status.ok()) { throw ParseError("Can't open " + uri.get_path() + ". " + status.ToString()); } //Wrapping file_raw into a unique pointer to guarantee deletion file.reset(file_raw); hdfs::StatInfo stat_info; status = file_system->GetFileInfo(uri.get_path(), stat_info); if (!status.ok()) { throw ParseError("Can't stat " + uri.get_path() + ". " + status.ToString()); } totalLength = stat_info.length; } uint64_t getLength() const override { return totalLength; } uint64_t getNaturalReadSize() const override { return READ_SIZE; } void read(void* buf, uint64_t length, uint64_t offset) override { if (!buf) { throw ParseError("Buffer is null"); } char* buf_ptr = reinterpret_cast<char*>(buf); hdfs::Status status; size_t total_bytes_read = 0; size_t last_bytes_read = 0; do { status = file->PositionRead(buf_ptr, static_cast<size_t>(length) - total_bytes_read, static_cast<off_t>(offset + total_bytes_read), &last_bytes_read); if(!status.ok()) { throw ParseError("Error reading the file: " + status.ToString()); } total_bytes_read += last_bytes_read; buf_ptr += last_bytes_read; } while (total_bytes_read < length); } const std::string& getName() const override { return filename; } ~HdfsFileInputStream() override; }; HdfsFileInputStream::~HdfsFileInputStream() { } std::unique_ptr<InputStream> readHdfsFile(const std::string& path) { return std::unique_ptr<InputStream>(new HdfsFileInputStream(path)); } }
ori $1, $0, 6 ori $2, $0, 2 ori $3, $0, 11 ori $4, $0, 3 sw $2, 0($0) sw $3, 4($0) sw $1, 8($0) sw $4, 12($0) sw $2, 16($0) sw $4, 20($0) sw $3, 24($0) sw $1, 28($0) sw $3, 32($0) sw $4, 36($0) sw $3, 40($0) sw $3, 44($0) sw $2, 48($0) sw $1, 52($0) sw $2, 56($0) sw $2, 60($0) sw $4, 64($0) sw $2, 68($0) sw $1, 72($0) sw $1, 76($0) sw $2, 80($0) sw $1, 84($0) sw $3, 88($0) sw $4, 92($0) sw $1, 96($0) sw $4, 100($0) sw $2, 104($0) sw $1, 108($0) sw $2, 112($0) sw $2, 116($0) sw $4, 120($0) sw $2, 124($0) lui $1, 5 sh $1, 0($2) and $3, $1, $1 lui $4, 2 TAG1: mflo $1 sb $1, 0($1) subu $2, $1, $4 addu $3, $1, $1 TAG2: sll $2, $3, 0 mthi $3 lh $1, 0($3) addi $1, $3, 3 TAG3: multu $1, $1 sllv $4, $1, $1 mflo $2 lui $3, 12 TAG4: beq $3, $3, TAG5 sra $4, $3, 14 lb $2, 0($4) sw $2, 0($3) TAG5: sb $2, 0($2) bne $2, $2, TAG6 lb $3, 0($2) slti $3, $3, 8 TAG6: srav $3, $3, $3 slt $2, $3, $3 sltu $3, $3, $3 sw $3, 0($3) TAG7: mtlo $3 sw $3, 0($3) nor $4, $3, $3 sh $3, 1($4) TAG8: sh $4, 1($4) andi $3, $4, 11 lb $4, 1($4) beq $4, $3, TAG9 TAG9: sll $2, $4, 13 sltu $3, $2, $4 mfhi $1 andi $1, $1, 6 TAG10: sw $1, 0($1) bne $1, $1, TAG11 lui $2, 14 sll $0, $0, 0 TAG11: div $2, $2 div $2, $2 sll $0, $0, 0 sll $0, $0, 0 TAG12: mflo $4 multu $2, $4 div $2, $4 blez $2, TAG13 TAG13: lbu $1, 0($4) sra $4, $1, 0 mfhi $3 mfhi $2 TAG14: lui $4, 6 lw $4, 0($2) mult $4, $2 lui $1, 11 TAG15: xori $4, $1, 15 div $1, $4 sll $0, $0, 0 mtlo $1 TAG16: xor $1, $4, $4 mthi $1 lui $3, 2 mtlo $1 TAG17: andi $4, $3, 3 mfhi $3 bne $3, $3, TAG18 mflo $3 TAG18: multu $3, $3 sw $3, 0($3) mfhi $2 sub $1, $3, $3 TAG19: mult $1, $1 and $2, $1, $1 bne $1, $2, TAG20 mtlo $2 TAG20: mthi $2 mthi $2 mflo $2 sll $1, $2, 14 TAG21: lb $2, 0($1) srl $2, $1, 2 lui $2, 9 divu $2, $2 TAG22: mflo $3 addiu $4, $2, 9 bgez $4, TAG23 sltiu $4, $3, 1 TAG23: sb $4, 0($4) add $2, $4, $4 mtlo $4 mflo $1 TAG24: multu $1, $1 andi $3, $1, 4 multu $1, $1 subu $4, $3, $1 TAG25: lbu $4, 0($4) sw $4, 0($4) lui $1, 8 lui $2, 12 TAG26: lui $2, 10 and $1, $2, $2 mtlo $1 mthi $1 TAG27: mflo $1 bgez $1, TAG28 mfhi $1 mtlo $1 TAG28: sll $0, $0, 0 addu $3, $1, $1 mthi $3 mthi $1 TAG29: divu $3, $3 subu $1, $3, $3 beq $1, $3, TAG30 mtlo $3 TAG30: blez $1, TAG31 sll $3, $1, 10 bne $3, $1, TAG31 mtlo $1 TAG31: bne $3, $3, TAG32 mtlo $3 bgez $3, TAG32 mthi $3 TAG32: lw $1, 0($3) lb $1, 0($1) mflo $1 mult $3, $1 TAG33: sh $1, 0($1) beq $1, $1, TAG34 mfhi $3 mtlo $1 TAG34: addi $1, $3, 6 xori $4, $3, 7 divu $4, $4 lui $1, 10 TAG35: beq $1, $1, TAG36 sltiu $2, $1, 14 lui $2, 4 bne $1, $1, TAG36 TAG36: lui $3, 5 bltz $3, TAG37 mfhi $1 beq $3, $3, TAG37 TAG37: lbu $1, 0($1) beq $1, $1, TAG38 mult $1, $1 mtlo $1 TAG38: sh $1, 0($1) lh $3, 0($1) mthi $3 bgtz $1, TAG39 TAG39: lh $2, 0($3) mtlo $3 or $2, $3, $2 lui $3, 7 TAG40: multu $3, $3 sll $0, $0, 0 sra $3, $4, 11 andi $1, $3, 14 TAG41: bgtz $1, TAG42 lw $2, 0($1) lui $3, 2 lw $1, 0($1) TAG42: mflo $1 bgez $1, TAG43 lui $4, 13 bgez $1, TAG43 TAG43: lui $3, 8 xori $1, $3, 0 mthi $3 bgtz $4, TAG44 TAG44: lui $2, 8 addu $2, $2, $2 beq $2, $2, TAG45 divu $1, $2 TAG45: lui $4, 11 mult $2, $4 nor $2, $2, $2 sll $3, $4, 13 TAG46: divu $3, $3 bne $3, $3, TAG47 sll $0, $0, 0 sll $0, $0, 0 TAG47: sra $1, $2, 9 ori $2, $1, 6 sw $1, 2049($1) sh $2, 2049($2) TAG48: sb $2, 2049($2) mfhi $2 sb $2, 0($2) mult $2, $2 TAG49: sb $2, 0($2) lh $1, 0($2) lbu $3, 2304($1) mfhi $3 TAG50: sra $4, $3, 2 mthi $4 slti $1, $3, 13 mflo $3 TAG51: mflo $3 addiu $2, $3, 5 srav $1, $3, $3 sll $3, $3, 6 TAG52: srlv $4, $3, $3 mflo $2 mfhi $1 bne $2, $1, TAG53 TAG53: mult $1, $1 lh $1, 0($1) slt $2, $1, $1 sll $1, $1, 0 TAG54: beq $1, $1, TAG55 divu $1, $1 beq $1, $1, TAG55 lw $3, 0($1) TAG55: multu $3, $3 sb $3, 0($3) sb $3, 0($3) sll $2, $3, 7 TAG56: add $1, $2, $2 bne $2, $1, TAG57 srl $3, $1, 9 sw $1, 0($3) TAG57: multu $3, $3 bgtz $3, TAG58 lui $1, 11 ori $4, $3, 14 TAG58: bgtz $4, TAG59 mthi $4 lui $1, 2 mfhi $2 TAG59: bltz $2, TAG60 and $3, $2, $2 bgtz $2, TAG60 mtlo $2 TAG60: mfhi $1 mfhi $4 bgtz $1, TAG61 sllv $4, $4, $4 TAG61: mfhi $2 bne $2, $2, TAG62 divu $4, $4 div $2, $2 TAG62: multu $2, $2 beq $2, $2, TAG63 sb $2, 0($2) sb $2, 0($2) TAG63: sra $2, $2, 13 mfhi $4 mult $2, $4 lui $2, 7 TAG64: bne $2, $2, TAG65 sll $0, $0, 0 sltiu $3, $2, 5 beq $2, $2, TAG65 TAG65: mfhi $2 beq $2, $2, TAG66 multu $3, $2 andi $2, $2, 5 TAG66: lbu $4, 0($2) bne $4, $4, TAG67 sb $2, 0($4) mtlo $2 TAG67: and $2, $4, $4 multu $4, $4 lb $1, 0($4) mtlo $4 TAG68: mtlo $1 bne $1, $1, TAG69 slti $3, $1, 14 sw $1, 0($1) TAG69: or $3, $3, $3 mthi $3 mfhi $3 lbu $1, 0($3) TAG70: bgez $1, TAG71 lw $1, 0($1) bltz $1, TAG71 mfhi $3 TAG71: beq $3, $3, TAG72 sb $3, 0($3) mthi $3 sb $3, 0($3) TAG72: bgtz $3, TAG73 mfhi $2 bgtz $3, TAG73 sb $3, 0($3) TAG73: srl $4, $2, 5 mtlo $2 lw $3, 0($4) sb $2, 0($2) TAG74: beq $3, $3, TAG75 sh $3, -256($3) bne $3, $3, TAG75 andi $4, $3, 1 TAG75: ori $1, $4, 9 ori $4, $4, 0 lb $2, 0($4) mult $4, $2 TAG76: mthi $2 mflo $3 lh $1, 0($3) bne $2, $1, TAG77 TAG77: lui $4, 11 sll $0, $0, 0 andi $3, $4, 9 mflo $4 TAG78: multu $4, $4 lw $1, 0($4) mthi $4 mthi $1 TAG79: mfhi $4 bne $4, $1, TAG80 lui $4, 14 sw $1, -256($1) TAG80: beq $4, $4, TAG81 sra $3, $4, 15 mfhi $4 ori $1, $4, 15 TAG81: mtlo $1 or $4, $1, $1 lw $1, -256($1) lui $3, 4 TAG82: sll $0, $0, 0 div $3, $3 beq $3, $3, TAG83 sltiu $2, $3, 10 TAG83: mtlo $2 sh $2, 0($2) slti $3, $2, 15 sltiu $3, $3, 13 TAG84: mtlo $3 sb $3, 0($3) beq $3, $3, TAG85 lui $3, 3 TAG85: bne $3, $3, TAG86 mtlo $3 sll $0, $0, 0 subu $4, $3, $3 TAG86: sub $2, $4, $4 blez $2, TAG87 sra $1, $2, 0 sw $4, 0($2) TAG87: lui $2, 9 sll $0, $0, 0 bne $2, $2, TAG88 multu $1, $2 TAG88: mflo $4 mflo $2 nor $3, $2, $2 addiu $4, $4, 15 TAG89: subu $4, $4, $4 multu $4, $4 sh $4, 0($4) lui $1, 0 TAG90: beq $1, $1, TAG91 mtlo $1 bltz $1, TAG91 add $2, $1, $1 TAG91: sh $2, 0($2) andi $3, $2, 2 bne $3, $3, TAG92 xor $3, $3, $2 TAG92: lb $4, 0($3) sb $3, 0($3) bne $3, $3, TAG93 lbu $1, 0($3) TAG93: mfhi $2 sb $1, 0($2) multu $1, $1 ori $3, $2, 11 TAG94: sb $3, 0($3) mtlo $3 mtlo $3 lui $2, 10 TAG95: sll $0, $0, 0 sll $3, $2, 15 mfhi $1 srl $4, $3, 0 TAG96: beq $4, $4, TAG97 slti $3, $4, 10 sw $3, 0($3) lbu $1, 0($3) TAG97: bne $1, $1, TAG98 sltiu $4, $1, 15 mthi $4 srlv $1, $4, $4 TAG98: lui $4, 4 lui $2, 6 mfhi $1 bne $4, $1, TAG99 TAG99: mult $1, $1 addu $4, $1, $1 bne $1, $1, TAG100 slti $4, $4, 8 TAG100: sb $4, 0($4) and $4, $4, $4 srlv $3, $4, $4 sb $4, 0($4) TAG101: mthi $3 nor $3, $3, $3 addiu $3, $3, 6 lbu $2, 0($3) TAG102: sll $4, $2, 5 sb $4, 0($4) lui $4, 2 sw $4, 0($2) TAG103: sll $0, $0, 0 xori $3, $3, 4 beq $3, $4, TAG104 mflo $1 TAG104: srl $2, $1, 6 sltiu $2, $2, 8 sb $1, 0($2) lui $1, 0 TAG105: mflo $2 mflo $4 beq $2, $1, TAG106 mthi $1 TAG106: mthi $4 lb $4, 0($4) lbu $4, 0($4) lui $1, 11 TAG107: mfhi $2 mthi $1 beq $1, $1, TAG108 mtlo $1 TAG108: lb $2, 0($2) lbu $1, 0($2) bgtz $1, TAG109 sb $1, 0($1) TAG109: sltiu $1, $1, 15 sll $2, $1, 5 bne $1, $1, TAG110 addiu $4, $2, 6 TAG110: bne $4, $4, TAG111 mfhi $1 blez $4, TAG111 nor $1, $1, $1 TAG111: beq $1, $1, TAG112 lui $1, 7 beq $1, $1, TAG112 lui $2, 4 TAG112: lui $4, 13 slt $2, $4, $2 sll $0, $0, 0 sll $0, $0, 0 TAG113: beq $3, $3, TAG114 mfhi $4 sw $4, 0($3) lui $4, 3 TAG114: nor $2, $4, $4 sra $3, $4, 8 divu $2, $3 bgtz $4, TAG115 TAG115: mfhi $3 lui $3, 11 beq $3, $3, TAG116 sll $0, $0, 0 TAG116: mthi $3 sll $0, $0, 0 subu $1, $3, $3 blez $1, TAG117 TAG117: sh $1, 0($1) sllv $2, $1, $1 mflo $4 srlv $4, $1, $4 TAG118: sltiu $1, $4, 6 mthi $1 addu $4, $1, $1 blez $4, TAG119 TAG119: lhu $1, 0($4) bltz $1, TAG120 srav $2, $1, $1 sb $2, 0($2) TAG120: xori $4, $2, 0 beq $2, $2, TAG121 mflo $4 div $4, $4 TAG121: srl $2, $4, 7 bne $2, $2, TAG122 lhu $4, -11913($2) mult $4, $4 TAG122: lh $3, 0($4) bne $4, $4, TAG123 mult $4, $4 xori $1, $3, 2 TAG123: sb $1, 0($1) blez $1, TAG124 lhu $3, 0($1) sltu $4, $3, $1 TAG124: mtlo $4 mtlo $4 bne $4, $4, TAG125 mthi $4 TAG125: sw $4, 0($4) sh $4, 0($4) bne $4, $4, TAG126 srav $1, $4, $4 TAG126: lw $4, 0($1) mthi $4 beq $1, $4, TAG127 multu $4, $4 TAG127: beq $4, $4, TAG128 sb $4, 0($4) beq $4, $4, TAG128 mfhi $1 TAG128: sb $1, 0($1) lui $4, 13 sll $0, $0, 0 sll $0, $0, 0 TAG129: sra $3, $4, 15 bltz $4, TAG130 mflo $1 blez $3, TAG130 TAG130: mult $1, $1 bne $1, $1, TAG131 mflo $2 srl $2, $1, 1 TAG131: sw $2, 0($2) lbu $4, 0($2) sra $2, $4, 10 blez $2, TAG132 TAG132: lui $2, 15 sll $0, $0, 0 lui $1, 11 xori $4, $2, 13 TAG133: slt $2, $4, $4 mtlo $4 blez $2, TAG134 lui $4, 0 TAG134: nor $2, $4, $4 div $2, $2 sb $4, 1($2) bltz $4, TAG135 TAG135: srlv $3, $2, $2 andi $1, $3, 6 slt $4, $2, $1 bne $2, $2, TAG136 TAG136: lui $1, 6 bltz $4, TAG137 lb $1, 0($4) div $1, $4 TAG137: lbu $2, 0($1) sw $1, 0($2) mult $2, $2 slt $3, $2, $2 TAG138: bgtz $3, TAG139 mthi $3 sll $4, $3, 7 beq $4, $3, TAG139 TAG139: lhu $4, 0($4) sltiu $3, $4, 10 mult $4, $4 lb $4, 0($3) TAG140: mthi $4 lb $2, 0($4) lhu $4, 0($4) add $4, $4, $2 TAG141: mfhi $3 beq $3, $3, TAG142 mtlo $3 lui $4, 9 TAG142: sub $3, $4, $4 mtlo $3 lh $4, 0($4) andi $4, $4, 9 TAG143: bgtz $4, TAG144 mult $4, $4 mfhi $4 mtlo $4 TAG144: sh $4, 0($4) lbu $1, 0($4) lui $4, 3 mthi $1 TAG145: srav $1, $4, $4 bne $1, $4, TAG146 divu $4, $4 beq $4, $1, TAG146 TAG146: lui $2, 13 mflo $3 divu $1, $1 mthi $2 TAG147: srav $1, $3, $3 mthi $1 lhu $1, 0($1) lbu $4, 0($1) TAG148: sh $4, 0($4) sw $4, 0($4) mtlo $4 lui $4, 4 TAG149: mfhi $3 andi $3, $4, 4 divu $3, $4 lui $3, 0 TAG150: lui $3, 6 mfhi $4 sll $0, $0, 0 mfhi $1 TAG151: lui $4, 12 mflo $4 mtlo $1 mfhi $4 TAG152: multu $4, $4 mflo $3 sb $3, 0($4) beq $3, $3, TAG153 TAG153: lw $4, 0($3) addu $4, $4, $4 bne $3, $3, TAG154 mult $4, $4 TAG154: slti $2, $4, 5 sb $2, 0($2) sh $2, 0($4) mfhi $3 TAG155: lw $2, 0($3) sra $1, $2, 0 lbu $3, 0($1) sw $2, 0($3) TAG156: multu $3, $3 mthi $3 lhu $4, 0($3) sh $4, 0($3) TAG157: sb $4, 0($4) sb $4, 0($4) lui $2, 8 mfhi $3 TAG158: sll $4, $3, 8 xori $2, $3, 6 ori $1, $2, 8 mflo $4 TAG159: bgez $4, TAG160 mflo $1 bne $1, $1, TAG160 lui $3, 8 TAG160: lbu $4, 0($3) sllv $2, $4, $3 bgez $2, TAG161 mflo $4 TAG161: mult $4, $4 mtlo $4 blez $4, TAG162 or $1, $4, $4 TAG162: bne $1, $1, TAG163 lui $2, 7 mthi $2 nor $4, $1, $1 TAG163: addu $1, $4, $4 mflo $3 lui $2, 14 slti $4, $2, 8 TAG164: add $3, $4, $4 lw $1, 0($3) mfhi $2 sb $2, -257($1) TAG165: mfhi $4 sll $0, $0, 0 beq $4, $2, TAG166 lui $2, 12 TAG166: xori $1, $2, 11 divu $1, $2 sll $0, $0, 0 srl $4, $2, 15 TAG167: sll $3, $4, 11 mtlo $4 mult $4, $4 sra $3, $3, 3 TAG168: blez $3, TAG169 xor $1, $3, $3 lui $2, 0 lui $1, 8 TAG169: blez $1, TAG170 lui $1, 10 srav $1, $1, $1 sll $0, $0, 0 TAG170: lui $4, 10 beq $4, $1, TAG171 sll $0, $0, 0 mfhi $1 TAG171: beq $1, $1, TAG172 sll $0, $0, 0 mult $1, $1 blez $2, TAG172 TAG172: sll $3, $2, 7 mfhi $2 mthi $2 multu $3, $2 TAG173: lui $1, 5 mflo $3 srlv $3, $2, $2 subu $3, $2, $3 TAG174: bne $3, $3, TAG175 lui $3, 10 lui $2, 14 bne $2, $2, TAG175 TAG175: sll $0, $0, 0 bltz $2, TAG176 mtlo $2 lui $2, 10 TAG176: bne $2, $2, TAG177 srlv $4, $2, $2 sra $2, $2, 14 mthi $2 TAG177: mthi $2 sh $2, 0($2) lbu $2, 0($2) andi $2, $2, 2 TAG178: nor $4, $2, $2 beq $4, $2, TAG179 sll $4, $4, 5 mthi $2 TAG179: sll $0, $0, 0 slti $2, $2, 11 mtlo $2 sll $4, $2, 15 TAG180: divu $4, $4 sll $0, $0, 0 mfhi $4 multu $4, $4 TAG181: lui $2, 3 sll $0, $0, 0 sll $0, $0, 0 blez $4, TAG182 TAG182: multu $2, $2 sll $0, $0, 0 mtlo $2 bgez $2, TAG183 TAG183: sll $0, $0, 0 mflo $2 sll $0, $0, 0 sltu $2, $1, $1 TAG184: mflo $3 blez $2, TAG185 sltiu $2, $2, 5 and $2, $2, $2 TAG185: mtlo $2 sra $2, $2, 15 lb $1, 0($2) bne $1, $2, TAG186 TAG186: slti $4, $1, 2 bgtz $1, TAG187 lui $4, 3 lui $3, 3 TAG187: bltz $3, TAG188 div $3, $3 multu $3, $3 mfhi $3 TAG188: mult $3, $3 sra $1, $3, 12 sllv $1, $3, $3 beq $3, $1, TAG189 TAG189: sltu $1, $1, $1 bltz $1, TAG190 mfhi $1 sltiu $4, $1, 2 TAG190: bgez $4, TAG191 mfhi $3 mtlo $3 div $4, $4 TAG191: beq $3, $3, TAG192 lui $2, 6 sll $1, $3, 14 blez $1, TAG192 TAG192: lui $4, 6 lui $1, 4 mtlo $1 sll $0, $0, 0 TAG193: sll $0, $0, 0 sll $0, $0, 0 mflo $3 sll $0, $0, 0 TAG194: mfhi $1 mflo $2 mtlo $3 sll $0, $0, 0 TAG195: subu $3, $2, $2 bne $2, $3, TAG196 xor $3, $2, $2 lhu $1, 0($2) TAG196: lh $4, 0($1) sra $3, $4, 6 div $3, $3 sw $3, 0($1) TAG197: or $3, $3, $3 multu $3, $3 mfhi $4 sltiu $3, $4, 5 TAG198: lb $2, 0($3) beq $3, $3, TAG199 or $4, $3, $3 beq $3, $2, TAG199 TAG199: sb $4, 0($4) beq $4, $4, TAG200 nor $2, $4, $4 mult $4, $2 TAG200: sw $2, 2($2) bgez $2, TAG201 lui $1, 4 beq $1, $1, TAG201 TAG201: sltu $1, $1, $1 andi $3, $1, 0 mtlo $1 lui $4, 10 TAG202: sll $0, $0, 0 xor $3, $4, $4 mflo $2 mflo $1 TAG203: sh $1, 0($1) multu $1, $1 bgtz $1, TAG204 lw $3, 0($1) TAG204: divu $3, $3 sll $0, $0, 0 lui $2, 13 mflo $1 TAG205: lbu $1, 0($1) lbu $2, 0($1) blez $1, TAG206 add $1, $1, $2 TAG206: mtlo $1 blez $1, TAG207 sb $1, 0($1) lui $1, 15 TAG207: bltz $1, TAG208 lui $1, 9 mflo $3 sll $0, $0, 0 TAG208: xori $1, $4, 0 bgez $4, TAG209 multu $1, $4 slti $1, $1, 2 TAG209: nor $4, $1, $1 mult $4, $1 srav $3, $4, $1 mfhi $2 TAG210: sra $3, $2, 1 mflo $1 sll $0, $0, 0 blez $2, TAG211 TAG211: sll $4, $1, 10 lui $1, 4 bne $4, $1, TAG212 sll $0, $0, 0 TAG212: mthi $2 lui $2, 11 sll $2, $2, 5 addu $4, $2, $2 TAG213: sll $0, $0, 0 mflo $4 sll $0, $0, 0 div $4, $4 TAG214: mthi $4 bgez $4, TAG215 lui $2, 15 lui $1, 2 TAG215: sll $0, $0, 0 bne $1, $1, TAG216 mfhi $3 mflo $1 TAG216: bgtz $1, TAG217 divu $1, $1 srl $1, $1, 5 slt $2, $1, $1 TAG217: subu $1, $2, $2 sltiu $3, $2, 6 mult $2, $1 srl $3, $1, 4 TAG218: bgtz $3, TAG219 lh $4, 0($3) mfhi $2 lui $4, 1 TAG219: blez $4, TAG220 addu $3, $4, $4 sll $0, $0, 0 blez $4, TAG220 TAG220: sb $1, 0($1) sub $3, $1, $1 beq $3, $1, TAG221 lh $4, 0($3) TAG221: mthi $4 srl $1, $4, 11 lw $3, 0($4) multu $4, $4 TAG222: bgez $3, TAG223 sll $0, $0, 0 lui $3, 12 sra $1, $3, 2 TAG223: lui $3, 4 lui $1, 6 lui $2, 1 sll $0, $0, 0 TAG224: mtlo $2 beq $2, $2, TAG225 mflo $4 srl $2, $4, 7 TAG225: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG226: mtlo $1 or $3, $1, $1 nor $1, $3, $3 mfhi $4 TAG227: bltz $4, TAG228 mthi $4 beq $4, $4, TAG228 sltu $2, $4, $4 TAG228: lui $4, 4 lui $1, 15 mtlo $4 mtlo $1 TAG229: xori $2, $1, 2 beq $2, $2, TAG230 mflo $4 mthi $2 TAG230: sllv $3, $4, $4 mtlo $3 slt $1, $3, $4 mflo $1 TAG231: sll $0, $0, 0 blez $1, TAG232 multu $1, $1 mfhi $4 TAG232: lui $2, 7 subu $1, $2, $2 xor $1, $1, $1 mflo $4 TAG233: beq $4, $4, TAG234 multu $4, $4 bne $4, $4, TAG234 sra $1, $4, 4 TAG234: lui $1, 5 mflo $2 beq $1, $1, TAG235 sll $0, $0, 0 TAG235: lh $1, 0($2) beq $1, $1, TAG236 mtlo $2 multu $1, $1 TAG236: beq $1, $1, TAG237 mthi $1 addiu $3, $1, 13 div $1, $3 TAG237: beq $3, $3, TAG238 sra $4, $3, 11 lui $4, 14 mflo $4 TAG238: lui $4, 3 sll $0, $0, 0 blez $4, TAG239 sll $0, $0, 0 TAG239: bltz $4, TAG240 lui $4, 12 mthi $4 mtlo $4 TAG240: sll $0, $0, 0 mflo $3 mthi $3 beq $4, $3, TAG241 TAG241: sll $0, $0, 0 slti $4, $3, 6 and $3, $4, $4 sw $4, 0($3) TAG242: bne $3, $3, TAG243 mthi $3 mthi $3 bne $3, $3, TAG243 TAG243: srl $3, $3, 3 lh $2, 0($3) lbu $4, 0($3) lui $3, 14 TAG244: bgtz $3, TAG245 sll $0, $0, 0 lui $3, 6 lh $3, 0($3) TAG245: addiu $1, $3, 14 mtlo $1 sll $1, $3, 10 bgtz $1, TAG246 TAG246: mult $1, $1 lui $2, 6 bltz $1, TAG247 sll $0, $0, 0 TAG247: beq $2, $2, TAG248 slti $4, $2, 7 lui $4, 11 beq $4, $4, TAG248 TAG248: mtlo $4 lh $3, 0($4) multu $3, $4 srl $2, $4, 12 TAG249: bgez $2, TAG250 srl $1, $2, 9 mflo $2 bltz $2, TAG250 TAG250: sb $2, 0($2) mfhi $4 sllv $4, $2, $2 sw $4, 0($4) TAG251: mthi $4 mtlo $4 lbu $4, 0($4) lbu $2, 0($4) TAG252: lb $3, 0($2) mflo $4 mult $4, $3 lui $1, 3 TAG253: sll $0, $0, 0 bltz $1, TAG254 multu $1, $1 mtlo $1 TAG254: mthi $1 lui $3, 15 mthi $1 beq $3, $3, TAG255 TAG255: ori $2, $3, 13 sll $2, $3, 12 beq $3, $2, TAG256 mflo $1 TAG256: divu $1, $1 sll $0, $0, 0 mfhi $3 bltz $3, TAG257 TAG257: mtlo $3 lb $1, 0($3) lui $1, 4 ori $3, $3, 6 TAG258: lhu $3, 0($3) subu $2, $3, $3 multu $3, $3 mthi $2 TAG259: addi $1, $2, 13 divu $2, $1 bgez $2, TAG260 sra $3, $2, 4 TAG260: sh $3, 0($3) mflo $1 multu $3, $3 multu $1, $1 TAG261: nor $3, $1, $1 divu $3, $3 xori $2, $1, 4 lui $3, 11 TAG262: sll $0, $0, 0 lui $4, 5 mtlo $3 mflo $1 TAG263: srl $3, $1, 10 beq $1, $3, TAG264 mult $3, $3 sll $0, $0, 0 TAG264: xori $1, $1, 9 mthi $1 sll $0, $0, 0 multu $1, $4 TAG265: mfhi $2 sll $0, $0, 0 sb $2, 0($2) lui $1, 11 TAG266: bne $1, $1, TAG267 sll $0, $0, 0 lui $1, 14 blez $1, TAG267 TAG267: multu $1, $1 mthi $1 mtlo $1 mtlo $1 TAG268: mfhi $4 bltz $4, TAG269 mthi $4 beq $1, $4, TAG269 TAG269: divu $4, $4 bgez $4, TAG270 sll $0, $0, 0 bne $4, $4, TAG270 TAG270: mthi $4 sll $0, $0, 0 lui $3, 7 ori $1, $3, 5 TAG271: mtlo $1 bne $1, $1, TAG272 and $4, $1, $1 or $2, $4, $4 TAG272: sll $0, $0, 0 sll $0, $0, 0 mthi $2 slt $4, $2, $2 TAG273: and $2, $4, $4 blez $2, TAG274 ori $1, $4, 10 bgez $4, TAG274 TAG274: lh $4, 0($1) nor $1, $1, $4 bne $1, $1, TAG275 srl $3, $4, 7 TAG275: mtlo $3 slti $2, $3, 4 blez $3, TAG276 andi $4, $3, 13 TAG276: mflo $2 multu $2, $4 lui $3, 12 addiu $2, $2, 10 TAG277: slt $4, $2, $2 bne $2, $4, TAG278 lhu $2, 0($4) mtlo $4 TAG278: lw $1, 0($2) slt $2, $2, $2 lui $1, 3 sltu $4, $2, $2 TAG279: blez $4, TAG280 sllv $4, $4, $4 sub $3, $4, $4 mthi $3 TAG280: addiu $3, $3, 12 subu $1, $3, $3 lui $4, 11 sll $0, $0, 0 TAG281: blez $4, TAG282 lui $3, 13 div $4, $4 bltz $4, TAG282 TAG282: andi $4, $3, 6 divu $4, $3 subu $2, $4, $3 mult $2, $3 TAG283: mtlo $2 beq $2, $2, TAG284 ori $3, $2, 5 blez $2, TAG284 TAG284: xori $3, $3, 2 sll $0, $0, 0 lui $1, 9 beq $3, $3, TAG285 TAG285: mflo $4 mflo $4 mfhi $4 mult $4, $4 TAG286: sll $1, $4, 13 divu $4, $1 lh $1, 169($4) mflo $2 TAG287: sra $4, $2, 10 mthi $4 sw $2, 0($4) mthi $4 TAG288: blez $4, TAG289 mtlo $4 mtlo $4 mtlo $4 TAG289: addiu $3, $4, 10 lhu $1, 0($4) mtlo $1 mthi $3 TAG290: lui $1, 1 mult $1, $1 sll $0, $0, 0 mflo $4 TAG291: multu $4, $4 beq $4, $4, TAG292 lui $2, 4 slti $4, $2, 1 TAG292: lui $2, 6 beq $2, $4, TAG293 sb $4, 0($4) mfhi $4 TAG293: sw $4, 0($4) bne $4, $4, TAG294 xor $4, $4, $4 multu $4, $4 TAG294: addi $3, $4, 8 bltz $4, TAG295 lh $2, 0($4) addu $2, $3, $3 TAG295: addiu $2, $2, 13 subu $2, $2, $2 bltz $2, TAG296 lui $3, 12 TAG296: bltz $3, TAG297 mfhi $2 mtlo $2 xori $2, $2, 7 TAG297: mtlo $2 sb $2, 0($2) mflo $1 div $1, $1 TAG298: div $1, $1 bgtz $1, TAG299 lbu $3, 0($1) sh $1, 0($1) TAG299: bgez $3, TAG300 sb $3, 0($3) sltiu $1, $3, 7 beq $1, $1, TAG300 TAG300: sra $4, $1, 0 lui $2, 13 sll $0, $0, 0 bgez $2, TAG301 TAG301: mthi $2 sllv $1, $2, $2 bne $2, $2, TAG302 sll $0, $0, 0 TAG302: xori $4, $2, 2 lui $3, 5 sll $0, $0, 0 sll $0, $0, 0 TAG303: bltz $4, TAG304 multu $4, $4 sll $0, $0, 0 srl $2, $4, 12 TAG304: sll $0, $0, 0 sb $2, -208($2) mfhi $2 sll $0, $0, 0 TAG305: bgez $2, TAG306 lh $2, -169($2) sh $2, 0($2) lb $2, 0($2) TAG306: sll $0, $0, 0 lui $3, 0 lui $3, 3 mflo $3 TAG307: mult $3, $3 subu $2, $3, $3 lui $3, 1 mtlo $2 TAG308: sll $0, $0, 0 mthi $3 mfhi $4 lui $1, 13 TAG309: mflo $3 bne $3, $1, TAG310 sub $3, $1, $3 lui $4, 1 TAG310: sll $0, $0, 0 mtlo $4 divu $4, $4 sllv $3, $4, $4 TAG311: sll $0, $0, 0 addiu $3, $3, 5 bltz $3, TAG312 sll $0, $0, 0 TAG312: bgez $3, TAG313 mthi $3 or $4, $3, $3 beq $4, $4, TAG313 TAG313: and $3, $4, $4 or $1, $4, $3 lui $1, 10 lui $3, 9 TAG314: lui $2, 8 addu $1, $2, $2 blez $1, TAG315 lui $2, 2 TAG315: mthi $2 sll $1, $2, 12 beq $1, $1, TAG316 mflo $4 TAG316: sb $4, 0($4) ori $2, $4, 14 beq $2, $2, TAG317 divu $2, $2 TAG317: mtlo $2 srlv $4, $2, $2 andi $3, $2, 13 sb $2, 0($3) TAG318: sb $3, 0($3) srlv $3, $3, $3 lui $1, 7 multu $1, $3 TAG319: lui $3, 1 sll $0, $0, 0 sll $0, $0, 0 mfhi $2 TAG320: slt $2, $2, $2 lui $1, 13 bgez $1, TAG321 mflo $3 TAG321: mtlo $3 bne $3, $3, TAG322 mflo $4 lh $1, 0($3) TAG322: sh $1, -464($1) subu $1, $1, $1 sra $1, $1, 6 mtlo $1 TAG323: blez $1, TAG324 multu $1, $1 srav $1, $1, $1 bgez $1, TAG324 TAG324: sub $1, $1, $1 mfhi $4 bne $1, $4, TAG325 mult $4, $4 TAG325: lh $1, 0($4) lw $3, -464($1) lui $1, 11 sll $0, $0, 0 TAG326: lui $1, 3 mthi $1 subu $3, $1, $1 div $1, $1 TAG327: mult $3, $3 beq $3, $3, TAG328 mtlo $3 mtlo $3 TAG328: mult $3, $3 lui $1, 8 mfhi $3 bgez $3, TAG329 TAG329: sw $3, 0($3) sw $3, 0($3) bne $3, $3, TAG330 lw $2, 0($3) TAG330: addi $4, $2, 14 ori $2, $2, 12 lb $4, 0($4) lb $1, 0($4) TAG331: mfhi $4 sb $1, 0($1) bne $4, $4, TAG332 multu $4, $4 TAG332: mflo $3 sh $3, 0($3) lw $3, 0($4) bltz $3, TAG333 TAG333: mflo $3 lh $2, 0($3) add $3, $3, $3 mthi $3 TAG334: sltiu $2, $3, 9 lui $1, 6 beq $1, $3, TAG335 sll $0, $0, 0 TAG335: mthi $1 bne $1, $1, TAG336 sll $0, $0, 0 sllv $4, $1, $1 TAG336: mthi $4 sll $0, $0, 0 lui $2, 1 divu $2, $4 TAG337: bltz $2, TAG338 sll $0, $0, 0 sll $0, $0, 0 multu $1, $2 TAG338: srlv $1, $1, $1 mfhi $4 xor $1, $1, $1 multu $1, $4 TAG339: sll $3, $1, 11 mfhi $4 bgez $1, TAG340 sltiu $3, $1, 0 TAG340: mflo $3 mult $3, $3 bne $3, $3, TAG341 multu $3, $3 TAG341: bne $3, $3, TAG342 sw $3, 0($3) mflo $1 lh $1, 0($3) TAG342: mfhi $4 multu $4, $1 addi $1, $4, 8 bne $4, $1, TAG343 TAG343: mtlo $1 sb $1, 0($1) mfhi $3 lb $3, 0($3) TAG344: mflo $2 sllv $1, $3, $2 sb $3, 0($2) mtlo $3 TAG345: sltu $2, $1, $1 sltiu $4, $1, 3 beq $2, $2, TAG346 sb $1, 0($4) TAG346: slt $2, $4, $4 beq $4, $4, TAG347 srlv $2, $2, $2 mthi $2 TAG347: andi $2, $2, 13 lui $4, 11 addi $2, $2, 3 xori $1, $4, 0 TAG348: subu $4, $1, $1 mthi $1 slti $3, $1, 0 sltiu $4, $3, 15 TAG349: lui $4, 9 sll $0, $0, 0 andi $4, $4, 10 mthi $4 TAG350: bne $4, $4, TAG351 sb $4, 0($4) lbu $3, 0($4) sh $4, 0($4) TAG351: multu $3, $3 mthi $3 beq $3, $3, TAG352 andi $1, $3, 4 TAG352: sw $1, 0($1) sw $1, 0($1) lui $1, 9 sltiu $2, $1, 9 TAG353: bgtz $2, TAG354 or $2, $2, $2 multu $2, $2 sw $2, 0($2) TAG354: andi $4, $2, 2 mfhi $2 nor $1, $2, $4 addi $4, $2, 2 TAG355: mfhi $3 addiu $3, $4, 3 mtlo $3 lb $3, 0($3) TAG356: subu $4, $3, $3 lbu $3, 0($4) slti $2, $3, 8 mfhi $2 TAG357: lw $4, 0($2) lui $3, 13 lbu $4, 0($2) addi $2, $2, 3 TAG358: addiu $3, $2, 11 lh $4, 0($3) bltz $3, TAG359 sb $2, 0($2) TAG359: sb $4, 0($4) xori $1, $4, 13 bne $4, $4, TAG360 sh $4, 0($4) TAG360: lui $1, 7 addu $4, $1, $1 mfhi $3 nor $2, $3, $1 TAG361: mfhi $1 blez $1, TAG362 lui $2, 9 mult $2, $2 TAG362: divu $2, $2 mult $2, $2 sll $0, $0, 0 slt $2, $2, $2 TAG363: lui $1, 3 sll $1, $1, 1 mthi $2 andi $1, $1, 13 TAG364: bltz $1, TAG365 mult $1, $1 lh $4, 0($1) multu $4, $1 TAG365: lbu $4, 0($4) mtlo $4 sw $4, 0($4) mflo $3 TAG366: sw $3, 0($3) mult $3, $3 beq $3, $3, TAG367 sllv $1, $3, $3 TAG367: bne $1, $1, TAG368 mfhi $1 blez $1, TAG368 lbu $1, 0($1) TAG368: lw $2, 0($1) mtlo $1 andi $3, $2, 13 beq $3, $2, TAG369 TAG369: mult $3, $3 srav $3, $3, $3 mfhi $3 addi $4, $3, 14 TAG370: lui $4, 13 sll $0, $0, 0 bltz $4, TAG371 mtlo $4 TAG371: mtlo $4 sll $0, $0, 0 mult $4, $4 sll $0, $0, 0 TAG372: mfhi $1 sb $1, -169($1) bgtz $1, TAG373 lui $1, 15 TAG373: mflo $2 lui $1, 11 multu $2, $2 mtlo $1 TAG374: lui $2, 14 sll $0, $0, 0 lui $2, 6 lui $4, 5 TAG375: mflo $1 ori $2, $4, 6 subu $2, $2, $2 srav $2, $4, $1 TAG376: bgtz $2, TAG377 xori $3, $2, 1 lui $3, 8 mthi $2 TAG377: bne $3, $3, TAG378 addiu $1, $3, 15 sll $0, $0, 0 div $3, $3 TAG378: lui $1, 3 slti $2, $1, 8 sll $0, $0, 0 or $3, $1, $1 TAG379: blez $3, TAG380 sll $0, $0, 0 bltz $3, TAG380 sll $0, $0, 0 TAG380: or $1, $3, $3 mflo $1 mfhi $3 mflo $2 TAG381: beq $2, $2, TAG382 ori $2, $2, 1 mfhi $3 lw $1, 0($2) TAG382: sb $1, 0($1) addiu $2, $1, 5 sb $2, 0($2) lui $4, 11 TAG383: sll $0, $0, 0 mflo $3 lui $4, 0 blez $4, TAG384 TAG384: andi $4, $4, 8 mthi $4 beq $4, $4, TAG385 lw $3, 0($4) TAG385: mtlo $3 sw $3, -425($3) lui $3, 12 blez $3, TAG386 TAG386: div $3, $3 sll $0, $0, 0 beq $3, $3, TAG387 sll $0, $0, 0 TAG387: multu $3, $3 lui $1, 6 sll $0, $0, 0 sltu $3, $1, $1 TAG388: mult $3, $3 bne $3, $3, TAG389 add $2, $3, $3 sw $2, 0($2) TAG389: lui $4, 4 lui $3, 3 mult $3, $2 mthi $4 TAG390: ori $4, $3, 7 sll $0, $0, 0 sll $0, $0, 0 mult $3, $3 TAG391: lui $4, 6 mthi $4 sll $0, $0, 0 bne $4, $4, TAG392 TAG392: mflo $2 sb $1, 0($2) andi $4, $2, 6 sh $1, 0($4) TAG393: lui $1, 9 mthi $1 mfhi $3 lhu $1, 0($4) TAG394: mtlo $1 sltiu $2, $1, 4 lui $4, 9 sll $0, $0, 0 TAG395: blez $4, TAG396 sll $0, $0, 0 mflo $1 addi $2, $1, 14 TAG396: lb $2, 0($2) sh $2, 0($2) sh $2, 0($2) sh $2, 0($2) TAG397: mflo $1 lb $1, 0($1) mfhi $1 bne $1, $1, TAG398 TAG398: sll $0, $0, 0 mthi $1 sll $2, $1, 4 sll $0, $0, 0 TAG399: lui $1, 8 srlv $3, $1, $2 lui $4, 11 mflo $2 TAG400: nor $4, $2, $2 sltiu $2, $4, 1 mflo $2 sh $4, 0($2) TAG401: mult $2, $2 xori $1, $2, 8 srlv $2, $2, $1 mfhi $2 TAG402: mtlo $2 slt $1, $2, $2 sw $1, 0($1) sb $1, 0($2) TAG403: sh $1, 0($1) blez $1, TAG404 sllv $1, $1, $1 lh $4, 0($1) TAG404: mtlo $4 mtlo $4 slt $4, $4, $4 mtlo $4 TAG405: sltiu $3, $4, 6 lui $4, 15 bgtz $4, TAG406 sll $0, $0, 0 TAG406: blez $2, TAG407 lui $2, 1 bne $2, $2, TAG407 lbu $3, 0($2) TAG407: sb $3, 0($3) sb $3, 0($3) or $1, $3, $3 mult $3, $3 TAG408: sll $3, $1, 0 mult $1, $1 bne $1, $3, TAG409 sb $1, 0($3) TAG409: sb $3, 0($3) sb $3, 0($3) mfhi $1 mtlo $3 TAG410: sub $1, $1, $1 lbu $2, 0($1) mflo $1 beq $1, $1, TAG411 TAG411: andi $3, $1, 15 mfhi $3 sra $2, $3, 14 lui $1, 0 TAG412: multu $1, $1 add $4, $1, $1 bgtz $1, TAG413 mult $1, $4 TAG413: mfhi $1 beq $4, $4, TAG414 lui $4, 15 mthi $1 TAG414: mult $4, $4 sll $0, $0, 0 mthi $2 mult $4, $2 TAG415: sw $2, 0($2) mtlo $2 lui $3, 12 slti $4, $2, 13 TAG416: sll $3, $4, 12 bne $3, $4, TAG417 mult $3, $3 bltz $4, TAG417 TAG417: lui $4, 5 mtlo $3 beq $4, $4, TAG418 sw $3, -4096($3) TAG418: srlv $1, $4, $4 mflo $3 sllv $1, $4, $1 bgtz $3, TAG419 TAG419: sll $0, $0, 0 mflo $2 blez $1, TAG420 ori $1, $1, 3 TAG420: mflo $4 mthi $4 beq $4, $1, TAG421 lui $4, 0 TAG421: multu $4, $4 mthi $4 sll $2, $4, 13 bne $2, $4, TAG422 TAG422: sh $2, 0($2) mtlo $2 lw $3, 0($2) bgez $3, TAG423 TAG423: lw $3, 0($3) mult $3, $3 beq $3, $3, TAG424 sltiu $2, $3, 7 TAG424: multu $2, $2 sb $2, 0($2) mfhi $4 bne $4, $4, TAG425 TAG425: mflo $2 bgez $2, TAG426 lbu $1, 0($2) mult $4, $1 TAG426: mthi $1 subu $3, $1, $1 multu $3, $3 mtlo $1 TAG427: lb $3, 0($3) sllv $4, $3, $3 mult $3, $3 mtlo $3 TAG428: lui $2, 15 sll $0, $0, 0 mult $3, $3 sll $0, $0, 0 TAG429: blez $2, TAG430 lui $4, 10 lui $3, 7 lui $1, 0 TAG430: multu $1, $1 mult $1, $1 nor $4, $1, $1 bne $1, $1, TAG431 TAG431: mthi $4 addiu $1, $4, 7 lui $3, 13 mfhi $3 TAG432: addu $4, $3, $3 slti $2, $3, 1 sra $4, $2, 2 lhu $4, 0($4) TAG433: sll $0, $0, 0 lh $4, -256($4) bgez $4, TAG434 div $4, $4 TAG434: lui $3, 2 bgtz $4, TAG435 multu $3, $3 srlv $2, $4, $4 TAG435: bgez $2, TAG436 sra $3, $2, 9 sw $2, 0($2) multu $3, $2 TAG436: bgtz $3, TAG437 mtlo $3 addu $2, $3, $3 sllv $4, $3, $3 TAG437: mflo $2 blez $2, TAG438 mflo $3 addi $1, $3, 14 TAG438: lhu $2, 0($1) lh $1, -1798($2) mthi $1 div $1, $1 TAG439: addu $4, $1, $1 bgtz $1, TAG440 lui $3, 6 lui $1, 4 TAG440: addiu $3, $1, 14 bgtz $3, TAG441 lui $4, 8 lw $2, 0($4) TAG441: sltiu $3, $2, 12 mtlo $2 lui $4, 3 mtlo $2 TAG442: addu $4, $4, $4 mflo $4 div $4, $4 sb $4, -1798($4) TAG443: mthi $4 divu $4, $4 mtlo $4 bgez $4, TAG444 TAG444: lui $3, 14 divu $3, $3 div $4, $4 mflo $1 TAG445: sra $3, $1, 13 mult $1, $3 mtlo $3 mfhi $1 TAG446: lui $1, 6 xori $1, $1, 6 sllv $3, $1, $1 andi $4, $1, 3 TAG447: sh $4, 0($4) bne $4, $4, TAG448 multu $4, $4 bgez $4, TAG448 TAG448: mfhi $3 beq $4, $3, TAG449 andi $4, $4, 7 multu $4, $3 TAG449: sh $4, 0($4) addiu $2, $4, 8 lui $3, 8 lui $4, 11 TAG450: sltu $2, $4, $4 bgtz $4, TAG451 mult $4, $4 bltz $2, TAG451 TAG451: lw $1, 0($2) bgtz $1, TAG452 mult $1, $2 bgez $2, TAG452 TAG452: sll $0, $0, 0 mthi $1 mflo $4 sb $1, 0($4) TAG453: bne $4, $4, TAG454 mtlo $4 beq $4, $4, TAG454 xor $2, $4, $4 TAG454: mtlo $2 mthi $2 lhu $1, 0($2) bne $1, $2, TAG455 TAG455: lui $3, 13 addu $1, $3, $1 mult $1, $1 sll $0, $0, 0 TAG456: lhu $3, 0($4) bltz $3, TAG457 sllv $2, $3, $4 lhu $1, -262($3) TAG457: beq $1, $1, TAG458 lbu $4, -262($1) mfhi $2 addi $4, $2, 0 TAG458: mflo $2 sb $2, 0($4) mtlo $4 divu $4, $2 TAG459: lui $1, 12 lui $3, 15 sll $0, $0, 0 multu $1, $2 TAG460: mflo $3 mthi $2 subu $3, $3, $3 sll $0, $0, 0 TAG461: mthi $3 mfhi $4 lbu $3, 0($3) bgez $3, TAG462 TAG462: lui $3, 9 sll $0, $0, 0 bgtz $3, TAG463 mult $3, $4 TAG463: lui $2, 5 addiu $1, $2, 12 bltz $4, TAG464 lui $4, 9 TAG464: lui $1, 3 lui $3, 4 bne $1, $3, TAG465 lui $3, 4 TAG465: blez $3, TAG466 mult $3, $3 mult $3, $3 lui $4, 11 TAG466: sll $0, $0, 0 bne $4, $4, TAG467 mtlo $3 sll $0, $0, 0 TAG467: bne $3, $3, TAG468 div $3, $3 nor $4, $3, $3 sll $4, $3, 10 TAG468: beq $4, $4, TAG469 mtlo $4 beq $4, $4, TAG469 srav $3, $4, $4 TAG469: beq $3, $3, TAG470 mfhi $1 mflo $4 sllv $4, $1, $3 TAG470: mfhi $3 mtlo $4 addi $1, $3, 14 bltz $1, TAG471 TAG471: lb $1, 0($1) srlv $3, $1, $1 mult $1, $1 lh $4, 0($1) TAG472: addiu $2, $4, 7 andi $3, $2, 2 lb $3, 0($2) mfhi $3 TAG473: bne $3, $3, TAG474 sltu $3, $3, $3 multu $3, $3 mthi $3 TAG474: sh $3, 0($3) addi $3, $3, 14 mfhi $2 lb $4, 0($2) TAG475: mthi $4 slti $4, $4, 11 divu $4, $4 addiu $1, $4, 6 TAG476: lui $3, 6 bltz $3, TAG477 addu $2, $1, $3 mthi $2 TAG477: bne $2, $2, TAG478 multu $2, $2 sltiu $2, $2, 13 or $2, $2, $2 TAG478: bgtz $2, TAG479 mflo $3 bne $3, $2, TAG479 sh $3, 0($2) TAG479: sllv $3, $3, $3 multu $3, $3 lui $3, 4 lui $3, 14 TAG480: beq $3, $3, TAG481 srl $4, $3, 7 ori $1, $3, 1 mfhi $3 TAG481: addu $4, $3, $3 mthi $4 sll $0, $0, 0 sll $0, $0, 0 TAG482: bgez $4, TAG483 lui $3, 7 div $4, $4 mflo $4 TAG483: or $4, $4, $4 mfhi $2 mthi $2 mtlo $4 TAG484: sll $0, $0, 0 lui $1, 9 ori $1, $2, 2 addiu $3, $3, 4 TAG485: mult $3, $3 div $3, $3 mflo $4 addu $2, $3, $4 TAG486: mtlo $2 bne $2, $2, TAG487 sll $0, $0, 0 lui $3, 14 TAG487: bne $3, $3, TAG488 ori $4, $3, 13 bne $3, $3, TAG488 mthi $4 TAG488: sll $0, $0, 0 mthi $2 beq $2, $2, TAG489 slt $3, $2, $4 TAG489: lb $3, 0($3) and $3, $3, $3 sb $3, 0($3) sh $3, 0($3) TAG490: nor $4, $3, $3 bgez $4, TAG491 addiu $3, $4, 7 mthi $3 TAG491: mtlo $3 xor $4, $3, $3 lui $1, 2 mtlo $1 TAG492: bne $1, $1, TAG493 div $1, $1 sll $4, $1, 5 bne $4, $4, TAG493 TAG493: sll $0, $0, 0 sll $0, $0, 0 lui $4, 7 sll $0, $0, 0 TAG494: lui $1, 12 mtlo $4 bltz $1, TAG495 sll $0, $0, 0 TAG495: bne $2, $2, TAG496 sra $4, $2, 13 lui $2, 4 lui $4, 5 TAG496: bltz $4, TAG497 mflo $4 mtlo $4 sll $0, $0, 0 TAG497: mthi $4 div $4, $4 bne $4, $4, TAG498 mthi $4 TAG498: sll $0, $0, 0 mthi $3 sll $0, $0, 0 xor $4, $4, $4 TAG499: sllv $3, $4, $4 mtlo $4 xor $4, $4, $4 bgez $3, TAG500 TAG500: mthi $4 bne $4, $4, TAG501 xor $3, $4, $4 srav $1, $4, $3 TAG501: lbu $2, 0($1) mult $1, $1 mfhi $2 sw $2, 0($2) TAG502: bne $2, $2, TAG503 sub $2, $2, $2 bgez $2, TAG503 lui $2, 8 TAG503: srl $3, $2, 11 divu $3, $3 lui $4, 7 mfhi $4 TAG504: lui $3, 12 sh $3, 0($4) blez $3, TAG505 lh $3, 0($4) TAG505: beq $3, $3, TAG506 mflo $1 mflo $1 div $1, $3 TAG506: bgtz $1, TAG507 mtlo $1 subu $3, $1, $1 div $3, $3 TAG507: lui $1, 2 lui $2, 9 bne $2, $2, TAG508 lui $4, 2 TAG508: multu $4, $4 lui $4, 10 mtlo $4 lui $4, 9 TAG509: mthi $4 andi $4, $4, 3 mfhi $2 sll $2, $4, 5 TAG510: bgtz $2, TAG511 lui $4, 6 beq $2, $2, TAG511 lui $4, 15 TAG511: beq $4, $4, TAG512 sll $0, $0, 0 mtlo $3 sb $3, 0($3) TAG512: mtlo $3 sw $3, 0($3) mult $3, $3 sw $3, 0($3) TAG513: mflo $2 lh $2, 0($2) multu $3, $2 slt $4, $3, $2 TAG514: addiu $2, $4, 14 lui $3, 2 bne $4, $2, TAG515 or $4, $2, $3 TAG515: bgez $4, TAG516 multu $4, $4 mflo $4 mtlo $4 TAG516: mtlo $4 mult $4, $4 mthi $4 blez $4, TAG517 TAG517: mthi $4 lui $3, 8 sll $0, $0, 0 beq $3, $3, TAG518 TAG518: lui $1, 8 sll $0, $0, 0 mtlo $4 addu $4, $3, $1 TAG519: sll $0, $0, 0 mflo $2 mtlo $2 beq $4, $4, TAG520 TAG520: mfhi $2 lui $2, 6 mfhi $1 lui $1, 14 TAG521: mtlo $1 srlv $2, $1, $1 mthi $1 blez $2, TAG522 TAG522: sll $0, $0, 0 mfhi $1 lui $4, 2 sltiu $1, $1, 6 TAG523: multu $1, $1 sltu $2, $1, $1 lb $2, 0($2) lh $3, 0($1) TAG524: multu $3, $3 mfhi $1 beq $3, $1, TAG525 mthi $1 TAG525: bne $1, $1, TAG526 mult $1, $1 bgtz $1, TAG526 lui $3, 0 TAG526: slt $3, $3, $3 sll $1, $3, 8 mflo $4 mthi $3 TAG527: lui $3, 5 sll $0, $0, 0 beq $4, $3, TAG528 mtlo $3 TAG528: andi $2, $3, 11 bltz $2, TAG529 sw $3, 0($2) sll $0, $0, 0 TAG529: xor $1, $2, $2 sh $1, 0($1) lbu $4, 0($2) mult $4, $4 TAG530: multu $4, $4 mtlo $4 add $1, $4, $4 mult $4, $1 TAG531: mtlo $1 mult $1, $1 bne $1, $1, TAG532 nor $4, $1, $1 TAG532: sll $0, $0, 0 lui $3, 3 lh $4, 1($4) mflo $3 TAG533: bgez $3, TAG534 sh $3, 0($3) bne $3, $3, TAG534 addi $4, $3, 14 TAG534: blez $4, TAG535 lb $2, 0($4) bne $2, $2, TAG535 divu $2, $2 TAG535: mflo $3 srav $4, $3, $3 bgtz $3, TAG536 multu $2, $3 TAG536: bltz $4, TAG537 sw $4, 0($4) or $4, $4, $4 lhu $4, 0($4) TAG537: mult $4, $4 mfhi $3 mult $3, $4 mflo $3 TAG538: subu $2, $3, $3 sh $3, 0($2) sw $2, 0($3) sllv $4, $3, $3 TAG539: sb $4, 0($4) lhu $1, 0($4) mult $1, $4 sltiu $4, $1, 3 TAG540: sltiu $2, $4, 7 sb $2, 0($2) lui $2, 8 mtlo $2 TAG541: beq $2, $2, TAG542 sll $0, $0, 0 lhu $2, 0($2) mthi $2 TAG542: xor $3, $2, $2 bne $3, $3, TAG543 mthi $2 bgtz $3, TAG543 TAG543: sb $3, 0($3) mthi $3 multu $3, $3 sb $3, 0($3) TAG544: add $4, $3, $3 bgez $4, TAG545 lb $1, 0($4) divu $4, $4 TAG545: andi $1, $1, 1 beq $1, $1, TAG546 lh $1, 0($1) mflo $4 TAG546: lui $3, 14 addiu $3, $4, 1 addiu $4, $3, 11 addiu $2, $4, 7 TAG547: mflo $3 bgez $2, TAG548 sw $2, 0($3) div $3, $2 TAG548: sltu $3, $3, $3 sb $3, 0($3) beq $3, $3, TAG549 mfhi $4 TAG549: blez $4, TAG550 sllv $4, $4, $4 lh $4, 0($4) mthi $4 TAG550: bne $4, $4, TAG551 lui $2, 2 beq $4, $2, TAG551 mfhi $3 TAG551: multu $3, $3 mult $3, $3 lbu $2, 0($3) sb $3, 0($3) TAG552: mtlo $2 blez $2, TAG553 ori $2, $2, 0 or $3, $2, $2 TAG553: addiu $1, $3, 1 div $3, $1 beq $1, $3, TAG554 mtlo $3 TAG554: mtlo $1 sb $1, 0($1) lui $4, 7 sb $4, 0($1) TAG555: mfhi $1 bltz $1, TAG556 slti $1, $4, 3 ori $1, $1, 5 TAG556: lui $3, 9 bgtz $3, TAG557 mthi $1 ori $4, $1, 4 TAG557: bltz $4, TAG558 multu $4, $4 xor $1, $4, $4 divu $4, $4 TAG558: sb $1, 0($1) lui $1, 1 mfhi $3 sll $0, $0, 0 TAG559: sll $0, $0, 0 addiu $4, $4, 2 sll $0, $0, 0 sll $0, $0, 0 TAG560: sll $0, $0, 0 slti $4, $4, 6 lui $4, 15 lui $2, 2 TAG561: sll $0, $0, 0 or $1, $2, $2 lui $2, 15 bne $2, $1, TAG562 TAG562: lui $4, 5 mtlo $4 mthi $2 mfhi $4 TAG563: mthi $4 bgez $4, TAG564 sll $0, $0, 0 sll $4, $4, 9 TAG564: mult $4, $4 addu $1, $4, $4 beq $1, $1, TAG565 sll $0, $0, 0 TAG565: sll $0, $0, 0 mthi $1 lui $1, 11 sll $0, $0, 0 TAG566: sll $0, $0, 0 bne $3, $3, TAG567 multu $3, $1 srlv $2, $1, $1 TAG567: beq $2, $2, TAG568 mthi $2 mthi $2 srl $4, $2, 12 TAG568: mthi $4 div $4, $4 mtlo $4 subu $4, $4, $4 TAG569: slti $4, $4, 5 sb $4, 0($4) bltz $4, TAG570 lui $2, 1 TAG570: sll $0, $0, 0 multu $2, $3 mfhi $2 mthi $3 TAG571: xori $1, $2, 14 beq $1, $2, TAG572 sw $1, 0($2) mult $2, $2 TAG572: beq $1, $1, TAG573 sb $1, 0($1) bgtz $1, TAG573 mflo $2 TAG573: multu $2, $2 blez $2, TAG574 addiu $1, $2, 5 mtlo $2 TAG574: srav $2, $1, $1 bltz $1, TAG575 sb $2, 0($1) sb $2, 0($1) TAG575: bgtz $2, TAG576 lui $2, 5 or $3, $2, $2 sra $1, $2, 15 TAG576: mthi $1 lui $4, 12 lui $4, 4 addiu $2, $1, 10 TAG577: mfhi $4 mfhi $3 lbu $1, 0($3) and $2, $3, $1 TAG578: bgez $2, TAG579 lui $3, 3 bgez $3, TAG579 and $2, $2, $2 TAG579: sb $2, 0($2) blez $2, TAG580 mthi $2 lhu $3, 0($2) TAG580: sll $0, $0, 0 mfhi $4 lui $2, 2 lui $3, 7 TAG581: sll $0, $0, 0 lui $3, 7 mtlo $4 sll $0, $0, 0 TAG582: lui $1, 6 mthi $1 lui $4, 15 subu $2, $4, $3 TAG583: bne $2, $2, TAG584 andi $4, $2, 0 multu $2, $4 sll $0, $0, 0 TAG584: bgez $3, TAG585 mflo $3 divu $3, $3 mtlo $3 TAG585: addu $3, $3, $3 mtlo $3 beq $3, $3, TAG586 sb $3, 0($3) TAG586: mfhi $3 xori $2, $3, 12 mfhi $3 mult $3, $3 TAG587: bgtz $3, TAG588 add $1, $3, $3 mthi $3 mult $3, $1 TAG588: mtlo $1 mthi $1 sltiu $1, $1, 0 multu $1, $1 TAG589: mfhi $1 bne $1, $1, TAG590 lui $2, 15 sll $0, $0, 0 TAG590: mthi $2 sll $0, $0, 0 div $2, $2 mtlo $3 TAG591: mult $3, $3 beq $3, $3, TAG592 lui $4, 2 lui $1, 12 TAG592: lui $2, 0 mtlo $1 multu $1, $2 mtlo $1 TAG593: mthi $2 bne $2, $2, TAG594 mtlo $2 xori $3, $2, 7 TAG594: srav $3, $3, $3 beq $3, $3, TAG595 lui $4, 10 sb $3, 0($3) TAG595: sll $1, $4, 9 lui $4, 2 sllv $4, $4, $4 sll $0, $0, 0 TAG596: lui $2, 14 sw $3, 0($3) lui $3, 6 mthi $3 TAG597: sll $0, $0, 0 mthi $3 sll $0, $0, 0 mthi $3 TAG598: xori $1, $1, 8 mflo $4 mult $4, $1 addi $1, $4, 8 TAG599: slti $3, $1, 3 mult $3, $1 lbu $2, 0($3) lhu $3, 0($3) TAG600: mult $3, $3 mtlo $3 bne $3, $3, TAG601 mult $3, $3 TAG601: lw $2, 0($3) mthi $2 mthi $2 lui $1, 10 TAG602: sll $0, $0, 0 bltz $1, TAG603 mtlo $1 sll $0, $0, 0 TAG603: sll $0, $0, 0 blez $1, TAG604 sll $0, $0, 0 lh $2, 0($4) TAG604: sw $2, 0($2) mflo $4 bgtz $4, TAG605 xori $2, $2, 4 TAG605: slti $3, $2, 3 lhu $2, 0($3) sh $2, 0($2) bgez $3, TAG606 TAG606: sh $2, 0($2) lb $1, 0($2) multu $2, $1 lhu $1, 0($2) TAG607: sub $1, $1, $1 sw $1, 0($1) bltz $1, TAG608 sw $1, 0($1) TAG608: lhu $3, 0($1) lui $1, 6 div $1, $1 mtlo $3 TAG609: lui $2, 1 subu $4, $2, $1 sll $0, $0, 0 slt $4, $4, $4 TAG610: mtlo $4 bgtz $4, TAG611 mthi $4 sb $4, 0($4) TAG611: lbu $2, 0($4) sw $2, 0($2) lhu $2, 0($4) lw $1, 0($2) TAG612: mfhi $1 andi $4, $1, 7 add $4, $4, $1 beq $1, $1, TAG613 TAG613: lh $4, 0($4) mflo $1 lhu $3, 0($4) mtlo $1 TAG614: mflo $4 blez $3, TAG615 mult $4, $3 lb $1, 0($3) TAG615: srlv $4, $1, $1 mult $1, $4 multu $1, $1 mtlo $4 TAG616: sw $4, 0($4) bgez $4, TAG617 ori $2, $4, 0 blez $4, TAG617 TAG617: srl $3, $2, 14 beq $2, $2, TAG618 xor $2, $2, $2 lui $2, 14 TAG618: lw $3, 0($2) lui $4, 14 sb $2, 0($2) sll $0, $0, 0 TAG619: mthi $4 beq $4, $4, TAG620 lui $4, 1 lhu $3, 0($4) TAG620: addu $4, $3, $3 beq $3, $3, TAG621 lui $4, 0 bne $4, $4, TAG621 TAG621: srlv $4, $4, $4 srav $1, $4, $4 sltiu $1, $4, 0 srl $4, $4, 4 TAG622: blez $4, TAG623 mult $4, $4 mflo $1 bgez $1, TAG623 TAG623: mflo $2 beq $2, $2, TAG624 lui $4, 9 xor $3, $2, $1 TAG624: mflo $1 multu $3, $3 mult $1, $1 mflo $3 TAG625: lh $4, 0($3) sll $3, $3, 3 lui $3, 7 bne $3, $4, TAG626 TAG626: addu $1, $3, $3 nor $1, $1, $3 mfhi $1 lbu $1, 0($1) TAG627: sw $1, 0($1) lui $3, 11 mflo $3 bne $3, $3, TAG628 TAG628: ori $3, $3, 1 sra $2, $3, 2 beq $2, $3, TAG629 mtlo $3 TAG629: blez $2, TAG630 xori $3, $2, 13 sra $2, $3, 3 andi $2, $2, 6 TAG630: mflo $4 lui $2, 14 sll $0, $0, 0 sra $1, $4, 6 TAG631: mult $1, $1 blez $1, TAG632 slt $3, $1, $1 bgez $1, TAG632 TAG632: lui $2, 11 sll $0, $0, 0 add $2, $3, $3 lbu $4, 0($3) TAG633: lui $4, 4 mthi $4 bltz $4, TAG634 multu $4, $4 TAG634: bne $4, $4, TAG635 div $4, $4 mtlo $4 sll $0, $0, 0 TAG635: mflo $4 mtlo $4 mthi $4 divu $4, $4 TAG636: bne $4, $4, TAG637 addiu $1, $4, 15 divu $1, $1 mfhi $3 TAG637: beq $3, $3, TAG638 lui $4, 2 bne $3, $3, TAG638 lhu $3, 0($3) TAG638: mflo $4 mult $3, $3 slti $4, $3, 15 beq $3, $3, TAG639 TAG639: ori $2, $4, 6 bne $4, $4, TAG640 mtlo $2 subu $1, $2, $2 TAG640: mtlo $1 mthi $1 sub $2, $1, $1 mflo $1 TAG641: sll $3, $1, 6 mflo $2 beq $1, $3, TAG642 mthi $1 TAG642: beq $2, $2, TAG643 lhu $3, 0($2) mtlo $2 mthi $3 TAG643: lui $1, 2 mfhi $2 srav $4, $1, $3 ori $4, $3, 0 TAG644: subu $2, $4, $4 blez $4, TAG645 lui $1, 2 sb $1, 0($2) TAG645: mfhi $1 bne $1, $1, TAG646 add $2, $1, $1 mtlo $1 TAG646: bltz $2, TAG647 mflo $3 bgtz $2, TAG647 andi $4, $3, 3 TAG647: bltz $4, TAG648 sh $4, 0($4) mult $4, $4 bgtz $4, TAG648 TAG648: mthi $4 sw $4, 0($4) mtlo $4 mthi $4 TAG649: mthi $4 multu $4, $4 mthi $4 mtlo $4 TAG650: lui $4, 14 mflo $2 mfhi $4 mthi $2 TAG651: bltz $4, TAG652 lhu $2, 0($4) blez $4, TAG652 sllv $2, $4, $4 TAG652: bne $2, $2, TAG653 slti $4, $2, 1 slt $1, $2, $4 div $2, $1 TAG653: sb $1, 0($1) multu $1, $1 sb $1, 0($1) mflo $1 TAG654: mthi $1 mthi $1 sb $1, 0($1) mflo $2 TAG655: mfhi $1 bne $2, $1, TAG656 mfhi $4 xori $3, $2, 4 TAG656: lbu $2, 0($3) ori $4, $2, 4 addu $1, $2, $2 mult $2, $3 TAG657: mthi $1 mflo $4 bne $1, $1, TAG658 lui $4, 3 TAG658: bgez $4, TAG659 mtlo $4 lw $4, 0($4) mthi $4 TAG659: sll $0, $0, 0 addiu $3, $1, 0 mtlo $3 bltz $3, TAG660 TAG660: sh $3, 0($3) bgez $3, TAG661 sllv $1, $3, $3 lbu $2, 0($3) TAG661: sh $2, 0($2) mfhi $4 lui $2, 10 lui $4, 15 TAG662: mthi $4 beq $4, $4, TAG663 multu $4, $4 divu $4, $4 TAG663: lui $3, 8 andi $2, $3, 13 bltz $4, TAG664 andi $3, $4, 6 TAG664: or $4, $3, $3 bgez $3, TAG665 lui $3, 3 beq $3, $3, TAG665 TAG665: addiu $1, $3, 15 bne $1, $3, TAG666 mult $1, $1 ori $2, $1, 8 TAG666: sltiu $4, $2, 4 srl $3, $4, 12 lui $1, 0 mthi $4 TAG667: mfhi $2 sll $4, $1, 13 nor $3, $1, $2 ori $1, $3, 15 TAG668: bgtz $1, TAG669 sh $1, 1($1) lui $2, 9 mthi $2 TAG669: or $1, $2, $2 sll $0, $0, 0 addi $2, $4, 15 mult $2, $4 TAG670: sb $2, 0($2) sll $2, $2, 8 lui $3, 3 sltiu $1, $2, 12 TAG671: sll $4, $1, 10 sw $1, 0($4) sll $1, $4, 1 sh $1, 0($1) TAG672: sh $1, 0($1) lb $2, 0($1) bne $2, $2, TAG673 mfhi $3 TAG673: andi $3, $3, 8 multu $3, $3 beq $3, $3, TAG674 sw $3, 0($3) TAG674: multu $3, $3 beq $3, $3, TAG675 mthi $3 lhu $4, 0($3) TAG675: mflo $2 sh $4, 0($4) mfhi $3 mult $3, $3 TAG676: lbu $4, 0($3) bne $4, $4, TAG677 lw $4, 0($4) srav $1, $4, $3 TAG677: lui $1, 9 mflo $1 srl $2, $1, 7 lw $2, 0($1) TAG678: or $3, $2, $2 srl $1, $3, 0 mthi $3 add $3, $2, $3 TAG679: lui $2, 10 lui $3, 0 bne $3, $3, TAG680 sb $3, 0($3) TAG680: mtlo $3 mfhi $4 slt $3, $3, $4 mtlo $3 TAG681: srl $1, $3, 1 mthi $3 bltz $1, TAG682 lh $3, 0($3) TAG682: sb $3, 0($3) sub $2, $3, $3 mthi $3 mtlo $2 TAG683: mthi $2 multu $2, $2 multu $2, $2 sub $4, $2, $2 TAG684: and $2, $4, $4 mflo $3 sw $3, 0($4) sra $3, $4, 15 TAG685: blez $3, TAG686 ori $3, $3, 11 lui $2, 6 bne $3, $2, TAG686 TAG686: mtlo $2 beq $2, $2, TAG687 sltu $4, $2, $2 lui $4, 4 TAG687: lui $4, 8 subu $2, $4, $4 multu $2, $4 sw $2, 0($2) TAG688: blez $2, TAG689 lui $2, 5 blez $2, TAG689 div $2, $2 TAG689: srlv $3, $2, $2 mult $3, $2 bgtz $2, TAG690 sll $0, $0, 0 TAG690: mtlo $3 divu $3, $3 mtlo $3 xori $2, $3, 2 TAG691: sll $0, $0, 0 sll $0, $0, 0 sllv $3, $2, $2 lui $2, 1 TAG692: bltz $2, TAG693 lui $3, 5 mthi $3 sll $0, $0, 0 TAG693: mtlo $4 div $4, $4 sll $0, $0, 0 mthi $4 TAG694: multu $4, $4 div $4, $4 mtlo $4 mtlo $4 TAG695: mthi $4 sll $0, $0, 0 bne $4, $4, TAG696 lui $3, 12 TAG696: lui $3, 7 mfhi $1 addiu $4, $1, 15 bgtz $3, TAG697 TAG697: lui $1, 7 sll $0, $0, 0 mthi $4 mfhi $2 TAG698: sll $3, $2, 8 subu $1, $2, $3 mthi $1 mfhi $3 TAG699: bltz $3, TAG700 and $1, $3, $3 sll $3, $1, 6 bltz $3, TAG700 TAG700: mult $3, $3 beq $3, $3, TAG701 multu $3, $3 bgez $3, TAG701 TAG701: sll $0, $0, 0 mflo $3 sll $0, $0, 0 bgez $3, TAG702 TAG702: sll $0, $0, 0 andi $1, $3, 8 mtlo $1 blez $1, TAG703 TAG703: mult $1, $1 mfhi $4 lui $4, 1 addiu $3, $1, 11 TAG704: bgez $3, TAG705 sb $3, 0($3) div $3, $3 mfhi $4 TAG705: slti $3, $4, 2 srl $3, $3, 12 lb $3, 0($3) mthi $3 TAG706: beq $3, $3, TAG707 mtlo $3 sh $3, 0($3) divu $3, $3 TAG707: mtlo $3 multu $3, $3 sll $4, $3, 10 srav $2, $4, $3 TAG708: sh $2, 0($2) slti $4, $2, 2 bgtz $2, TAG709 multu $4, $2 TAG709: mflo $3 xor $1, $3, $4 bne $1, $3, TAG710 addu $4, $1, $4 TAG710: sh $4, 0($4) sh $4, 0($4) sltu $2, $4, $4 slt $1, $4, $4 TAG711: lhu $1, 0($1) bne $1, $1, TAG712 lui $4, 5 sll $0, $0, 0 TAG712: bltz $3, TAG713 addi $1, $3, 1 sb $3, 0($3) bgtz $3, TAG713 TAG713: lb $4, 0($1) mthi $4 sllv $4, $4, $4 sb $4, 0($1) TAG714: sw $4, 0($4) lhu $2, 0($4) sltu $2, $4, $4 blez $4, TAG715 TAG715: slt $2, $2, $2 mtlo $2 lb $4, 0($2) addi $2, $2, 7 TAG716: bne $2, $2, TAG717 sb $2, 0($2) mult $2, $2 mthi $2 TAG717: lui $3, 12 mflo $1 srav $3, $3, $1 divu $3, $1 TAG718: mfhi $3 mthi $3 sb $3, 0($3) bgez $3, TAG719 TAG719: addiu $2, $3, 14 srl $3, $2, 12 sra $2, $3, 4 slt $3, $2, $3 TAG720: lui $3, 3 addu $1, $3, $3 sll $0, $0, 0 ori $2, $3, 13 TAG721: blez $2, TAG722 mult $2, $2 mflo $2 lui $3, 1 TAG722: sll $0, $0, 0 slti $3, $3, 13 sh $3, 0($3) add $1, $3, $3 TAG723: lui $4, 7 mfhi $4 mtlo $1 bne $1, $4, TAG724 TAG724: mtlo $4 lui $3, 6 lbu $2, 0($4) mfhi $1 TAG725: mtlo $1 sb $1, 0($1) beq $1, $1, TAG726 lui $4, 0 TAG726: mflo $2 sllv $2, $2, $2 lb $2, -4608($2) sll $1, $2, 6 TAG727: lui $4, 1 ori $3, $4, 14 sltu $3, $4, $3 addi $1, $1, 10 TAG728: subu $4, $1, $1 mtlo $4 mthi $4 lui $4, 7 TAG729: mfhi $3 slt $4, $3, $3 sra $2, $4, 7 srav $3, $3, $2 TAG730: mflo $4 mthi $3 bne $4, $4, TAG731 sw $4, 0($3) TAG731: lhu $4, 0($4) mthi $4 mthi $4 lui $1, 7 TAG732: addu $3, $1, $1 sll $1, $3, 9 lui $3, 4 bltz $3, TAG733 TAG733: sll $0, $0, 0 slti $2, $1, 10 sb $2, 0($2) addi $3, $2, 4 TAG734: mflo $3 lbu $3, 0($3) mtlo $3 bgtz $3, TAG735 TAG735: lh $1, 0($3) addiu $4, $1, 4 mtlo $4 lui $2, 5 TAG736: beq $2, $2, TAG737 mthi $2 mult $2, $2 mfhi $2 TAG737: div $2, $2 mult $2, $2 sll $0, $0, 0 multu $2, $2 TAG738: sll $0, $0, 0 mflo $2 mflo $3 mfhi $2 TAG739: lui $4, 8 lbu $2, 0($2) mflo $2 mthi $4 TAG740: lui $3, 7 bgtz $3, TAG741 mult $2, $3 sllv $1, $2, $3 TAG741: multu $1, $1 lui $4, 11 mfhi $4 lbu $2, 0($4) TAG742: mfhi $1 bne $1, $2, TAG743 multu $2, $2 mtlo $1 TAG743: sltiu $4, $1, 2 lui $3, 4 mflo $1 div $3, $4 TAG744: bne $1, $1, TAG745 multu $1, $1 mthi $1 mflo $2 TAG745: sh $2, 0($2) mflo $1 bne $1, $2, TAG746 sra $2, $2, 4 TAG746: mthi $2 andi $1, $2, 11 sw $2, 0($1) bgez $2, TAG747 TAG747: lui $4, 0 andi $2, $1, 12 blez $1, TAG748 lb $4, 0($2) TAG748: mtlo $4 mflo $1 bne $4, $4, TAG749 addi $1, $1, 4 TAG749: bltz $1, TAG750 sh $1, 0($1) xor $4, $1, $1 lhu $1, 0($4) TAG750: nop nop test_end: beq $0, $0, test_end nop
/*========================================================================= * * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkHessianToObjectnessMeasureImageFilter_hxx #define itkHessianToObjectnessMeasureImageFilter_hxx #include "itkImageRegionIterator.h" #include "itkSymmetricEigenAnalysis.h" #include "itkProgressReporter.h" #include "itkTotalProgressReporter.h" #include "itkMath.h" #include <algorithm> namespace itk { template <typename TInputImage, typename TOutputImage> HessianToObjectnessMeasureImageFilter<TInputImage, TOutputImage>::HessianToObjectnessMeasureImageFilter() { this->DynamicMultiThreadingOn(); this->ThreaderUpdateProgressOff(); } template <typename TInputImage, typename TOutputImage> void HessianToObjectnessMeasureImageFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST { Superclass::VerifyPreconditions(); if (m_ObjectDimension >= ImageDimension) { itkExceptionMacro("ObjectDimension must be lower than ImageDimension."); } } template <typename TInputImage, typename TOutputImage> void HessianToObjectnessMeasureImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData( const OutputImageRegionType & outputRegionForThread) { OutputImageType * output = this->GetOutput(); const InputImageType * input = this->GetInput(); TotalProgressReporter progress(this, output->GetRequestedRegion().GetNumberOfPixels(), 1000); // Calculator for computation of the eigen values using CalculatorType = SymmetricEigenAnalysisFixedDimension<ImageDimension, InputPixelType, EigenValueArrayType>; CalculatorType eigenCalculator; // Walk the region of eigen values and get the objectness measure ImageRegionConstIterator<InputImageType> it(input, outputRegionForThread); ImageRegionIterator<OutputImageType> oit(output, outputRegionForThread); oit.GoToBegin(); it.GoToBegin(); while (!it.IsAtEnd()) { // Compute eigen values EigenValueArrayType eigenValues; eigenCalculator.ComputeEigenValues(it.Get(), eigenValues); // Sort the eigenvalues by magnitude but retain their sign. // The eigenvalues are to be sorted |e1|<=|e2|<=...<=|eN| EigenValueArrayType sortedEigenValues = eigenValues; std::sort(sortedEigenValues.Begin(), sortedEigenValues.End(), AbsLessCompare()); // Check whether eigenvalues have the right sign bool signConstraintsSatisfied = true; for (unsigned int i = m_ObjectDimension; i < ImageDimension; ++i) { if ((m_BrightObject && sortedEigenValues[i] > 0.0) || (!m_BrightObject && sortedEigenValues[i] < 0.0)) { signConstraintsSatisfied = false; break; } } if (!signConstraintsSatisfied) { oit.Set(NumericTraits<OutputPixelType>::ZeroValue()); ++it; ++oit; progress.CompletedPixel(); continue; } EigenValueArrayType sortedAbsEigenValues; for (unsigned int i = 0; i < ImageDimension; ++i) { sortedAbsEigenValues[i] = itk::Math::abs(sortedEigenValues[i]); } // Initialize the objectness measure double objectnessMeasure = 1.0; // Compute objectness from eigenvalue ratios and second-order structureness if (m_ObjectDimension < ImageDimension - 1) { double rA = sortedAbsEigenValues[m_ObjectDimension]; double rADenominatorBase = 1.0; for (unsigned int j = m_ObjectDimension + 1; j < ImageDimension; ++j) { rADenominatorBase *= sortedAbsEigenValues[j]; } if (itk::Math::abs(rADenominatorBase) > 0.0) { if (itk::Math::abs(m_Alpha) > 0.0) { rA /= std::pow(rADenominatorBase, 1.0 / (ImageDimension - m_ObjectDimension - 1)); objectnessMeasure *= 1.0 - std::exp(-0.5 * itk::Math::sqr(rA) / itk::Math::sqr(m_Alpha)); } } else { objectnessMeasure = 0.0; } } if (m_ObjectDimension > 0) { double rB = sortedAbsEigenValues[m_ObjectDimension - 1]; double rBDenominatorBase = 1.0; for (unsigned int j = m_ObjectDimension; j < ImageDimension; ++j) { rBDenominatorBase *= sortedAbsEigenValues[j]; } if (itk::Math::abs(rBDenominatorBase) > 0.0 && itk::Math::abs(m_Beta) > 0.0) { rB /= std::pow(rBDenominatorBase, 1.0 / (ImageDimension - m_ObjectDimension)); objectnessMeasure *= std::exp(-0.5 * itk::Math::sqr(rB) / itk::Math::sqr(m_Beta)); } else { objectnessMeasure = 0.0; } } if (itk::Math::abs(m_Gamma) > 0.0) { double frobeniusNormSquared = 0.0; for (unsigned int i = 0; i < ImageDimension; ++i) { frobeniusNormSquared += itk::Math::sqr(sortedAbsEigenValues[i]); } objectnessMeasure *= 1.0 - std::exp(-0.5 * frobeniusNormSquared / itk::Math::sqr(m_Gamma)); } // Just in case, scale by largest absolute eigenvalue if (m_ScaleObjectnessMeasure) { objectnessMeasure *= sortedAbsEigenValues[ImageDimension - 1]; } oit.Set(static_cast<OutputPixelType>(objectnessMeasure)); ++it; ++oit; progress.CompletedPixel(); } } template <typename TInputImage, typename TOutputImage> void HessianToObjectnessMeasureImageFilter<TInputImage, TOutputImage>::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Alpha: " << m_Alpha << std::endl; os << indent << "Beta: " << m_Beta << std::endl; os << indent << "Gamma: " << m_Gamma << std::endl; os << indent << "ScaleObjectnessMeasure: " << m_ScaleObjectnessMeasure << std::endl; os << indent << "ObjectDimension: " << m_ObjectDimension << std::endl; os << indent << "BrightObject: " << m_BrightObject << std::endl; } } // end namespace itk #endif
; A270803: Formal inverse of Thue-Morse sequence A010060. ; 0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $2,2 lpb $0 add $0,1 pow $2,2 add $0,$2 div $0,$2 mov $1,2 trn $1,$0 mov $2,$0 sub $0,1 add $2,5 gcd $2,2 lpe mov $0,$1
/* CS580 Homework 3 */ #include "stdafx.h" #include "stdio.h" #include "math.h" #include "Gz.h" #include "rend.h" #define PI (float) 3.14159265358979323846 float GzRender::degreesToRadians(float degree) { return degree * (PI / 180); } void GzRender::Multiply4x4(GzMatrix mat1, GzMatrix mat2) { GzMatrix tempM; tempM[0][0] = mat1[0][0] * mat2[0][0] + mat1[0][1] * mat2[1][0] + mat1[0][2] * mat2[2][0] + mat1[0][3] * mat2[3][0]; tempM[0][1] = mat1[0][0] * mat2[0][1] + mat1[0][1] * mat2[1][1] + mat1[0][2] * mat2[2][1] + mat1[0][3] * mat2[3][1]; tempM[0][2] = mat1[0][0] * mat2[0][2] + mat1[0][1] * mat2[1][2] + mat1[0][2] * mat2[2][2] + mat1[0][3] * mat2[3][2]; tempM[0][3] = mat1[0][0] * mat2[0][3] + mat1[0][1] * mat2[1][3] + mat1[0][2] * mat2[2][3] + mat1[0][3] * mat2[3][3]; tempM[1][0] = mat1[1][0] * mat2[0][0] + mat1[1][1] * mat2[1][0] + mat1[1][2] * mat2[2][0] + mat1[1][3] * mat2[3][0]; tempM[1][1] = mat1[1][0] * mat2[0][1] + mat1[1][1] * mat2[1][1] + mat1[1][2] * mat2[2][1] + mat1[1][3] * mat2[3][1]; tempM[1][2] = mat1[1][0] * mat2[0][2] + mat1[1][1] * mat2[1][2] + mat1[1][2] * mat2[2][2] + mat1[1][3] * mat2[3][2]; tempM[1][3] = mat1[1][0] * mat2[0][3] + mat1[1][1] * mat2[1][3] + mat1[1][2] * mat2[2][3] + mat1[1][3] * mat2[3][3]; tempM[2][0] = mat1[2][0] * mat2[0][0] + mat1[2][1] * mat2[1][0] + mat1[2][2] * mat2[2][0] + mat1[2][3] * mat2[3][0]; tempM[2][1] = mat1[2][0] * mat2[0][1] + mat1[2][1] * mat2[1][1] + mat1[2][2] * mat2[2][1] + mat1[2][3] * mat2[3][1]; tempM[2][2] = mat1[2][0] * mat2[0][2] + mat1[2][1] * mat2[1][2] + mat1[2][2] * mat2[2][2] + mat1[2][3] * mat2[3][2]; tempM[2][3] = mat1[2][0] * mat2[0][3] + mat1[2][1] * mat2[1][3] + mat1[2][2] * mat2[2][3] + mat1[2][3] * mat2[3][3]; tempM[3][0] = mat1[3][0] * mat2[0][0] + mat1[3][1] * mat2[1][0] + mat1[3][2] * mat2[2][0] + mat1[3][3] * mat2[3][0]; tempM[3][1] = mat1[3][0] * mat2[0][1] + mat1[3][1] * mat2[1][1] + mat1[3][2] * mat2[2][1] + mat1[3][3] * mat2[3][1]; tempM[3][2] = mat1[3][0] * mat2[0][2] + mat1[3][1] * mat2[1][2] + mat1[3][2] * mat2[2][2] + mat1[3][3] * mat2[3][2]; tempM[3][3] = mat1[3][0] * mat2[0][3] + mat1[3][1] * mat2[1][3] + mat1[3][2] * mat2[2][3] + mat1[3][3] * mat2[3][3]; mat1[0][0] = tempM[0][0]; mat1[0][1] = tempM[0][1]; mat1[0][2] = tempM[0][2]; mat1[0][3] = tempM[0][3]; mat1[1][0] = tempM[1][0]; mat1[1][1] = tempM[1][1]; mat1[1][2] = tempM[1][2]; mat1[1][3] = tempM[1][3]; mat1[2][0] = tempM[2][0]; mat1[2][1] = tempM[2][1]; mat1[2][2] = tempM[2][2]; mat1[2][3] = tempM[2][3]; mat1[3][0] = tempM[3][0]; mat1[3][1] = tempM[3][1]; mat1[3][2] = tempM[3][2]; mat1[3][3] = tempM[3][3]; } int GzRender::GzRotXMat(float degree, GzMatrix mat) { /* HW 3.1 // Create rotate matrix : rotate along x axis // Pass back the matrix using mat value */ float rad = degreesToRadians(degree); // rotation matrix GzMatrix rMat = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, cos(rad), -sin(rad), 0.0f, 0.0f, sin(rad), cos(rad), 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; Multiply4x4(mat, rMat); return GZ_SUCCESS; } int GzRender::GzRotYMat(float degree, GzMatrix mat) { /* HW 3.2 // Create rotate matrix : rotate along y axis // Pass back the matrix using mat value */ float rad = degreesToRadians(degree); GzMatrix rMat = { cos(rad), 0.0f, sin(rad), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -sin(rad), 0.0f, cos(rad), 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; Multiply4x4(mat, rMat); return GZ_SUCCESS; } int GzRender::GzRotZMat(float degree, GzMatrix mat) { /* HW 3.3 // Create rotate matrix : rotate along z axis // Pass back the matrix using mat value */ float rad = degreesToRadians(degree); GzMatrix rMat = { cos(rad), -sin(rad), 0.0f, 0.0f, sin(rad), cos(rad), 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; Multiply4x4(mat, rMat); return GZ_SUCCESS; } int GzRender::GzTrxMat(GzCoord translate, GzMatrix mat) { /* HW 3.4 // Create translation matrix // Pass back the matrix using mat value */ GzMatrix tMat = { 1.0f, 0.0f, 0.0f, translate[X], 0.0f, 1.0f, 0.0f, translate[Y], 0.0f, 0.0f, 1.0f, translate[Z], 0.0f, 0.0f, 0.0f, 1.0f }; Multiply4x4(mat, tMat); return GZ_SUCCESS; } int GzRender::GzScaleMat(GzCoord scale, GzMatrix mat) { /* HW 3.5 // Create scaling matrix // Pass back the matrix using mat value */ GzMatrix sMat = { scale[X], 0.0f, 0.0f, 0.0f, 0.0f, scale[Y], 0.0f, 0.0f, 0.0f, 0.0f, scale[Z], 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; Multiply4x4(mat, sMat); return GZ_SUCCESS; } GzRender::GzRender(int xRes, int yRes) { /* HW1.1 create a framebuffer for MS Windows display: -- set display resolution -- allocate memory for framebuffer : 3 bytes(b, g, r) x width x height -- allocate memory for pixel buffer */ // Store Props & set defaults xres = xRes; yres = yRes; pixelDepthInBytes = 3; // Storaging RGB values, 1 byte per color. totalPixels = xRes * yRes; int frameBufferSize = pixelDepthInBytes * totalPixels; pixelbuffer = new GzPixel[totalPixels]; framebuffer = (char*)malloc(3 * sizeof(char) * xRes * yRes); /* HW 3.6 - setup Xsp and anything only done once - init default camera */ Xsp[0][0] = xRes/2.0f; Xsp[0][1] = 0.0f; Xsp[0][2] = 0.0f; Xsp[0][3] = xRes/2.0f; Xsp[1][0] = 0.0f; Xsp[1][1] = -yRes/2.0f; Xsp[1][2] = 0.0f; Xsp[1][3] = yRes/2.0f; Xsp[2][0] = 0.0f; Xsp[2][1] = 0.0f; Xsp[2][2] = MAXINT; Xsp[2][3] = 0.0f; Xsp[3][0] = 0.0f; Xsp[3][1] = 0.0f; Xsp[3][2] = 0.0f; Xsp[3][3] = 1.0f; m_camera.FOV = DEFAULT_FOV; m_camera.lookat[X] = 0; m_camera.lookat[Y] = 0; m_camera.lookat[Z] = 0; m_camera.position[X] = DEFAULT_IM_X; m_camera.position[Y] = DEFAULT_IM_Y; m_camera.position[Z] = DEFAULT_IM_Z; m_camera.worldup[X] = 0.0f; m_camera.worldup[Y] = 1.0f; m_camera.worldup[Z] = 0.0f; // default top of empty position in Ximage & Xnorm stack matlevel = -1; numlights = 0; } GzRender::~GzRender() { /* HW1.2 clean up, free buffer memory */ delete[] framebuffer; delete[] pixelbuffer; } int GzRender::GzDefault() { /* HW1.3 set pixel buffer to some default values - start a new frame */ for (unsigned int key = 0; key < totalPixels; ++key) { pixelbuffer[key].red = 3000; pixelbuffer[key].green = 3000; pixelbuffer[key].blue = 4000; pixelbuffer[key].alpha = 1; pixelbuffer[key].z = MAXINT; } return GZ_SUCCESS; } int GzRender::GzBeginRender() { /* HW 3.7 - setup for start of each frame - init frame buffer color,alpha,z - compute Xiw and projection xform Xpi from camera definition - init Ximage - put Xsp at base of stack, push on Xpi and Xiw - now stack contains Xsw and app can push model Xforms when needed */ GzCoord normX; GzCoord normY; GzCoord normZ; GzCoord CLVector = { m_camera.lookat[X] - m_camera.position[X], m_camera.lookat[Y] - m_camera.position[Y], m_camera.lookat[Z] - m_camera.position[Z] }; GzMatrix identityMatrix = { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; float magnitudeCLVector = sqrt(CLVector[X] * CLVector[X] + CLVector[Y] * CLVector[Y] + CLVector[Z] * CLVector[Z]); // calculate normal Z = cam. normZ[X] = CLVector[X] / magnitudeCLVector; normZ[Y] = CLVector[Y] / magnitudeCLVector; normZ[Z] = CLVector[Z] / magnitudeCLVector; float dotProdOfUpAndNormZ = m_camera.worldup[X] * normZ[X] + m_camera.worldup[Y] * normZ[Y] + m_camera.worldup[Z] * normZ[Z]; GzCoord upPrime = { m_camera.worldup[X] - dotProdOfUpAndNormZ * normZ[X], m_camera.worldup[Y] - dotProdOfUpAndNormZ * normZ[Y], m_camera.worldup[Z] - dotProdOfUpAndNormZ * normZ[Z] }; float magnitudeUpPrime = sqrt(upPrime[X] * upPrime[X] + upPrime[Y] * upPrime[Y] + upPrime[Z] * upPrime[Z]); // calculate normal Y = upPrime / ||upPrime|| normY[X] = upPrime[X] / magnitudeUpPrime; normY[Y] = upPrime[Y] / magnitudeUpPrime;; normY[Z] = upPrime[Z] / magnitudeUpPrime;; // calculate normal X = Y x Z normX[X] = normY[Y] * normZ[Z] - normY[Z] * normZ[Y]; normX[Y] = normY[Z] * normZ[X] - normY[X] * normZ[Z]; normX[Z] = normY[X] * normZ[Y] - normY[Y] * normZ[X]; float FOVinRadians = degreesToRadians(m_camera.FOV); m_camera.Xiw[0][0] = normX[X]; m_camera.Xiw[0][1] = normX[Y]; m_camera.Xiw[0][2] = normX[Z]; m_camera.Xiw[0][3] = -1.0f * (normX[X] * m_camera.position[X] + normX[Y] * m_camera.position[Y] + normX[Z] * m_camera.position[Z]); m_camera.Xiw[1][0] = normY[X]; m_camera.Xiw[1][1] = normY[Y]; m_camera.Xiw[1][2] = normY[Z]; m_camera.Xiw[1][3] = -1.0f * (normY[X] * m_camera.position[X] + normY[Y] * m_camera.position[Y] + normY[Z] * m_camera.position[Z]); m_camera.Xiw[2][0] = normZ[X]; m_camera.Xiw[2][1] = normZ[Y]; m_camera.Xiw[2][2] = normZ[Z]; m_camera.Xiw[2][3] = -1.0f * (normZ[X] * m_camera.position[X] + normZ[Y] * m_camera.position[Y] + normZ[Z] * m_camera.position[Z]); m_camera.Xiw[3][0] = 0.0f; m_camera.Xiw[3][1] = 0.0f; m_camera.Xiw[3][2] = 0.0f; m_camera.Xiw[3][3] = 1.0f; m_camera.Xpi[0][0] = 1.0f; m_camera.Xpi[0][1] = 0.0f; m_camera.Xpi[0][2] = 0.0f; m_camera.Xpi[0][3] = 0.0f; m_camera.Xpi[1][0] = 0.0f; m_camera.Xpi[1][1] = 1.0f; m_camera.Xpi[1][2] = 0.0f; m_camera.Xpi[1][3] = 0.0f; m_camera.Xpi[2][0] = 0.0f; m_camera.Xpi[2][1] = 0.0f; m_camera.Xpi[2][2] = tan(FOVinRadians / 2.0); m_camera.Xpi[2][3] = 0.0f; m_camera.Xpi[3][0] = 0.0f; m_camera.Xpi[3][1] = 0.0f; m_camera.Xpi[3][2] = tan(FOVinRadians / 2.0); m_camera.Xpi[3][3] = 1.0f; // Push Xform matrices onto Ximage stack. The top of the stack will screen space to world space transform matrix GzPushMatrix(Xsp); setToIdentity(Xnorm[matlevel]); GzPushMatrix(m_camera.Xpi); setToIdentity(Xnorm[matlevel]); GzPushMatrix(m_camera.Xiw); return GZ_SUCCESS; } int GzRender::GzPutCamera(GzCamera camera) { /* HW 3.8 /*- overwrite renderer camera structure with new camera definition */ m_camera.FOV = camera.FOV; m_camera.lookat[X] = camera.lookat[X]; m_camera.lookat[Y] = camera.lookat[Y]; m_camera.lookat[Z] = camera.lookat[Z]; m_camera.position[X] = camera.position[X]; m_camera.position[Y] = camera.position[Y]; m_camera.position[Z] = camera.position[Z]; m_camera.worldup[X] = camera.worldup[X]; m_camera.worldup[Y] = camera.worldup[Y]; m_camera.worldup[Z] = camera.worldup[Z]; return GZ_SUCCESS; } int GzRender::GzPushMatrix(GzMatrix matrix) { /* HW 3.9 - push a matrix onto the Ximage stack - check for stack overflow */ int newLevel = matlevel + 1; if (matlevel < 0) { // Build Ximage Ximage[newLevel][0][0] = matrix[0][0]; Ximage[newLevel][0][1] = matrix[0][1]; Ximage[newLevel][0][2] = matrix[0][2]; Ximage[newLevel][0][3] = matrix[0][3]; Ximage[newLevel][1][0] = matrix[1][0]; Ximage[newLevel][1][1] = matrix[1][1]; Ximage[newLevel][1][2] = matrix[1][2]; Ximage[newLevel][1][3] = matrix[1][3]; Ximage[newLevel][2][0] = matrix[2][0]; Ximage[newLevel][2][1] = matrix[2][1]; Ximage[newLevel][2][2] = matrix[2][2]; Ximage[newLevel][2][3] = matrix[2][3]; Ximage[newLevel][3][0] = matrix[3][0]; Ximage[newLevel][3][1] = matrix[3][1]; Ximage[newLevel][3][2] = matrix[3][2]; Ximage[newLevel][3][3] = matrix[3][3]; } else if (matlevel < MATLEVELS) { // multiply the new matrix by the top of the stack matrix setToIdentity(Ximage[newLevel]); Multiply4x4(Ximage[newLevel], Ximage[matlevel]); Multiply4x4(Ximage[newLevel], matrix); setToIdentity(Xnorm[newLevel]); Multiply4x4(Xnorm[newLevel], Xnorm[matlevel]); Multiply4x4(Xnorm[newLevel], matrix); // remove translation from Xnorm top of stack (TOS) removeTranslation(Xnorm[newLevel]); // Remove scale from Xnorm TOS removeScale(Xnorm[newLevel]); } // increment to new top of the Ximage stack matlevel += 1; return GZ_SUCCESS; } int GzRender::GzPopMatrix() { /* HW 3.10 - pop a matrix off the Ximage stack - check for stack underflow */ if (matlevel >= 0) { --matlevel; } return GZ_SUCCESS; } int GzRender::GzPut(int pixelX, int pixelY, GzIntensity red, GzIntensity green, GzIntensity blue, GzIntensity alpha, GzDepth z) { /* HW1.4 write pixel values into the buffer */ int pixelIsOnScreen = (pixelX > -1 && pixelX < xres) && (pixelY > -1 && pixelY < yres); if (pixelIsOnScreen) { int pixelBufferIndex = ARRAY(pixelX, pixelY); pixelbuffer[pixelBufferIndex].red = clampColorRange(red); pixelbuffer[pixelBufferIndex].green = clampColorRange(green); pixelbuffer[pixelBufferIndex].blue = clampColorRange(blue); pixelbuffer[pixelBufferIndex].alpha = alpha; pixelbuffer[pixelBufferIndex].z = z; } return GZ_SUCCESS; } int GzRender::GzGet(int pixelX, int pixelY, GzIntensity *red, GzIntensity *green, GzIntensity *blue, GzIntensity *alpha, GzDepth *z) { /* HW1.5 retrieve a pixel information from the pixel buffer */ int pixelIsOnScreen = (pixelX > -1 && pixelX < xres) && (pixelY > -1 && pixelY < yres); if (pixelIsOnScreen) { int pixelBufferIndex = ARRAY(pixelX, pixelY); *red = pixelbuffer[pixelBufferIndex].red; *green = pixelbuffer[pixelBufferIndex].green; *blue = pixelbuffer[pixelBufferIndex].blue; *alpha = pixelbuffer[pixelBufferIndex].alpha; *z = pixelbuffer[pixelBufferIndex].z; } return GZ_SUCCESS; } int GzRender::GzFlushDisplay2File(FILE* outfile) { /* HW1.6 write image to ppm file -- "P6 %d %d 255\r" */ // Print ppm file header fprintf(outfile, "P6 %d %d 255\n", xres, yres); // Append all 8-bit binary pixel color values in raster order. for (unsigned int key = 0; key < totalPixels; ++key) { unsigned char pixelColor[] = { convertGzIntensityTo8bitRGB(pixelbuffer[key].red), convertGzIntensityTo8bitRGB(pixelbuffer[key].green), convertGzIntensityTo8bitRGB(pixelbuffer[key].blue) }; fwrite( pixelColor, sizeof(unsigned char), sizeof(pixelColor), outfile ); } return GZ_SUCCESS; } int GzRender::GzFlushDisplay2FrameBuffer() { /* HW1.7 write pixels to framebuffer: - put the pixels into the frame buffer - CAUTION: when storing the pixels into the frame buffer, the order is blue, green, and red - NOT red, green, and blue !!! */ for (unsigned int key = 0; key < totalPixels; ++key) { framebuffer[key * pixelDepthInBytes + RED] = convertGzIntensityTo8bitRGB(pixelbuffer[key].blue); framebuffer[key * pixelDepthInBytes + GREEN] = convertGzIntensityTo8bitRGB(pixelbuffer[key].green); framebuffer[key * pixelDepthInBytes + BLUE] = convertGzIntensityTo8bitRGB(pixelbuffer[key].red); } return GZ_SUCCESS; } int GzRender::GzPutAttribute(int numAttributes, GzToken *nameList, GzPointer *valueList) { /* HW 2.1 -- Set renderer attribute states (e.g.: GZ_RGB_COLOR default color) -- In later homeworks set shaders, interpolaters, texture maps, and lights */ for (unsigned int token = 0; token < numAttributes; ++token) { float *color; GzColor *colorCoefficient; switch (nameList[token]) { case GZ_RGB_COLOR: color = (float*)valueList[token]; flatcolor[RED] = boundFloat(color[RED], 0.0, 1.0); flatcolor[GREEN] = boundFloat(color[GREEN], 0.0, 1.0); flatcolor[BLUE] = boundFloat(color[BLUE], 0.0, 1.0); break; case GZ_INTERPOLATE: interp_mode = *(int *)valueList[token]; break; case GZ_DIRECTIONAL_LIGHT: if (numlights < MAX_LIGHTS) { lights[numlights] = *(GzLight *)valueList[token]; numlights += 1; } break; case GZ_AMBIENT_LIGHT: if (numlights < MAX_LIGHTS) { ambientlight = *(GzLight *)valueList[token]; } break; case GZ_AMBIENT_COEFFICIENT: colorCoefficient = (GzColor*)valueList[token]; Ka[RED] = colorCoefficient[0][RED]; Ka[GREEN] = colorCoefficient[0][GREEN]; Ka[BLUE] = colorCoefficient[0][BLUE]; break; case GZ_DIFFUSE_COEFFICIENT: colorCoefficient = (GzColor*)valueList[token]; Kd[RED] = colorCoefficient[0][RED]; Kd[GREEN] = colorCoefficient[0][GREEN]; Kd[BLUE] = colorCoefficient[0][BLUE]; break; case GZ_SPECULAR_COEFFICIENT: colorCoefficient = (GzColor*)valueList[token]; Ks[RED] = colorCoefficient[0][RED]; Ks[GREEN] = colorCoefficient[0][GREEN]; Ks[BLUE] = colorCoefficient[0][BLUE]; break; case GZ_DISTRIBUTION_COEFFICIENT: spec = *(float*)valueList[token]; break; case GZ_TEXTURE_INDEX: break; default: break; } } return GZ_SUCCESS; } float GzRender::dotProduct(GzCoord m, GzCoord n) { return m[0] * n[0] + m[1] * n[1] + m[2] * n[2]; } int GzRender::GzPutTriangle(int numParts, GzToken *nameList, GzPointer *valueList) /* numParts - how many names and values */ { /* HW 2.2 -- Pass in a triangle description with tokens and values corresponding to GZ_NULL_TOKEN: do nothing - no values GZ_POSITION: 3 vert positions in model space -- Invoke the rastrizer/scanline framework -- Return error code */ bool isZCoordsAllPositive = false; for (unsigned int token = 0; token < numParts; ++token) { switch (nameList[token]) { case GZ_POSITION: { GzMatrix vert4x4; GzCoord *vertex = (GzCoord*)valueList[0]; // multiply Xsw vert4x4[0][0] = vertex[one][X]; vert4x4[0][1] = vertex[two][X]; vert4x4[0][2] = vertex[three][X]; vert4x4[0][3] = 0; vert4x4[1][0] = vertex[one][Y]; vert4x4[1][1] = vertex[two][Y]; vert4x4[1][2] = vertex[three][Y]; vert4x4[1][3] = 0; vert4x4[2][0] = vertex[one][Z]; vert4x4[2][1] = vertex[two][Z]; vert4x4[2][2] = vertex[three][Z]; vert4x4[2][3] = 0; vert4x4[3][0] = 1; vert4x4[3][1] = 1; vert4x4[3][2] = 1; vert4x4[3][3] = 1; // push triangle vertices model matrix on transformation stack GzPushMatrix(vert4x4); // ignore triangles with negative z-coord isZCoordsAllPositive = Ximage[matlevel][2][0] >= 0 && Ximage[matlevel][2][1] >= 0 && Ximage[matlevel][2][2] >= 0; if (isZCoordsAllPositive) { for (unsigned int i = 0; i < 3; ++i) { for (unsigned int j = 0; j < 3; ++j) { // normalize coords by dividing by w Ximage[matlevel][i][j] /= Ximage[matlevel][3][j]; // update valueList for passing to rasterizer vertex[j][i] = Ximage[matlevel][i][j]; } } } // Pop model matrix off transformation stack GzPopMatrix(); } break; case GZ_NORMAL: { GzMatrix norm4x4; GzCoord *normal = (GzCoord*)valueList[1]; // multiply Xiw norm4x4[0][0] = normal[one][X]; norm4x4[0][1] = normal[two][X]; norm4x4[0][2] = normal[three][X]; norm4x4[0][3] = 0; norm4x4[1][0] = normal[one][Y]; norm4x4[1][1] = normal[two][Y]; norm4x4[1][2] = normal[three][Y]; norm4x4[1][3] = 0; norm4x4[2][0] = normal[one][Z]; norm4x4[2][1] = normal[two][Z]; norm4x4[2][2] = normal[three][Z]; norm4x4[2][3] = 0; norm4x4[3][0] = 1; norm4x4[3][1] = 1; norm4x4[3][2] = 1; norm4x4[3][3] = 1; GzPushMatrix(norm4x4); for (unsigned int i = 0; i < 3; ++i) { for (unsigned int j = 0; j < 3; ++j) { // normalize coords by dividing by w Xnorm[matlevel][i][j] /= Xnorm[matlevel][3][j]; // update valueList for passing to rasterizer normal[i][j] = Xnorm[matlevel][j][i]; } } //transpose(Xnorm[matlevel]); GzPopMatrix(); } break; case GZ_NULL_TOKEN: break; default: break; } } scanLineRender(valueList); return GZ_SUCCESS; } void GzRender::setupEdgeDDAs(GzPointer *valueList) { GzCoord * vertex = (GzCoord*)valueList[0]; int totalEdges = 3; // set DDA edge vertices edgeDDA[one].edgeVertices[one] = one; edgeDDA[one].edgeVertices[two] = two; edgeDDA[two].edgeVertices[one] = two; edgeDDA[two].edgeVertices[two] = three; edgeDDA[three].edgeVertices[one] = one; edgeDDA[three].edgeVertices[two] = three; // complete edge DDA for (int edgeNum = 0; edgeNum < totalEdges; ++edgeNum) { // set start int *vertNum = edgeDDA[edgeNum].edgeVertices; edgeDDA[edgeNum].start[X] = vertex[vertNum[one]][X]; edgeDDA[edgeNum].start[Y] = vertex[vertNum[one]][Y]; edgeDDA[edgeNum].start[Z] = vertex[vertNum[one]][Z]; // set end edgeDDA[edgeNum].end[X] = vertex[vertNum[two]][X]; edgeDDA[edgeNum].end[Y] = vertex[vertNum[two]][Y]; edgeDDA[edgeNum].end[Z] = vertex[vertNum[two]][Z]; // set current edgeDDA[edgeNum].current[X] = vertex[vertNum[one]][X]; edgeDDA[edgeNum].current[Y] = vertex[vertNum[one]][Y]; edgeDDA[edgeNum].current[Z] = vertex[vertNum[one]][Z]; // set slope x edgeDDA[edgeNum].slopeX = slope(edgeDDA[edgeNum].start, edgeDDA[edgeNum].end, X, Y); // set slope z edgeDDA[edgeNum].slopeZ = slope(edgeDDA[edgeNum].start, edgeDDA[edgeNum].end, Z, Y); } } void GzRender::sortEdgesLeftOrRight() { float calulatedX = getXCoord(edgeDDA[three].start, edgeDDA[three].end, edgeDDA[one].end[Y]); if (!edgeDDA[one].slopeX) { // check if top of triangle has 0 slope if (edgeDDA[one].start[X] < edgeDDA[one].end[X]) { edgeDDA[two].edgeOnLeft = false; edgeDDA[three].edgeOnLeft = true; } else { edgeDDA[two].edgeOnLeft = true; edgeDDA[three].edgeOnLeft = false; } } else if (!edgeDDA[two].slopeX) { // check if base of triangle has 0 slope if (edgeDDA[two].start[X] < edgeDDA[two].end[X]) { edgeDDA[one].edgeOnLeft = true; edgeDDA[three].edgeOnLeft = false; } else { edgeDDA[one].edgeOnLeft = false; edgeDDA[three].edgeOnLeft = true; } } else if (calulatedX < edgeDDA[one].end[X]) { edgeDDA[one].edgeOnLeft = false; edgeDDA[two].edgeOnLeft = false; edgeDDA[three].edgeOnLeft = true; } else { edgeDDA[one].edgeOnLeft = true; edgeDDA[two].edgeOnLeft = true; edgeDDA[three].edgeOnLeft = false; } } void GzRender::shadingEquation(GzCoord N) { // normalize N normalizeVector(N); // Set E (should be the negation of the camera's lookat vector) GzCoord E = { 0, 0, -1 }; GzColor diffuseComponent = { 0.0f, 0.0f, 0.0f }; GzColor specularComponent = { 0.0f, 0.0f, 0.0f }; GzColor ambientComponent; bool computeLightModel; GzCoord R; float RdotE; float NdotL; GzCoord nPrime = { N[X], N[Y], N[Z] }; // Calculate Normal dot eye vector float NdotE = dotProduct(N, E); diffuseComponent[RED] = 0.0f; diffuseComponent[GREEN] = 0.0f; diffuseComponent[BLUE] = 0.0f; specularComponent[RED] = 0.0f; specularComponent[GREEN] = 0.0f; specularComponent[BLUE] = 0.0f; for (unsigned int lightIndex = 0; lightIndex < numlights; ++lightIndex) { computeLightModel = false; // normaize light direction vector normalizeVector(lights[lightIndex].direction); // Calculate Normal dot Light vector direction NdotL = dotProduct(N, lights[lightIndex].direction); // If signs of NdotL and NdotE are negative flip the normal direction if (NdotL < 0 && NdotE < 0) { nPrime[X] = -N[X]; nPrime[Y] = -N[Y]; nPrime[Z] = -N[Z]; computeLightModel = true; } else if (NdotL > 0 && NdotE > 0) { computeLightModel = true; } if (computeLightModel) { // Calculate Normal dot Light vector direction NdotL = dotProduct(nPrime, lights[lightIndex].direction); // Calculate R (reflection vector) for each light // R = 2(N.L)N - L R[X] = 2 * NdotL * nPrime[X] - lights[lightIndex].direction[X]; R[Y] = 2 * NdotL * nPrime[Y] - lights[lightIndex].direction[Y]; R[Z] = 2 * NdotL * nPrime[Z] - lights[lightIndex].direction[Z]; // normalize R normalizeVector(R); // R.E RdotE = dotProduct(R, E); // Calculate specular component sum[le(R.E)s] specularComponent[RED] += lights[lightIndex].color[RED] * powf(boundFloat(RdotE, 0, 1), spec); specularComponent[GREEN] += lights[lightIndex].color[GREEN] * powf(boundFloat(RdotE, 0, 1), spec); specularComponent[BLUE] += lights[lightIndex].color[BLUE] * powf(boundFloat(RdotE, 0, 1), spec); // Calculate diffuse component sum[le(N.L)] diffuseComponent[RED] += lights[lightIndex].color[RED] * NdotL; diffuseComponent[GREEN] += lights[lightIndex].color[GREEN] * NdotL; diffuseComponent[BLUE] += lights[lightIndex].color[BLUE] * NdotL; } } // Complete specular component (Ks sum[le(R.E)s]) specularComponent[RED] = Ks[RED] * specularComponent[RED]; specularComponent[GREEN] = Ks[GREEN] * specularComponent[GREEN]; specularComponent[BLUE] = Ks[BLUE] * specularComponent[BLUE]; // Complete diffuse component (Kd sum[le(N.L)]) diffuseComponent[RED] = Kd[RED] * diffuseComponent[RED]; diffuseComponent[GREEN] = Kd[GREEN] * diffuseComponent[GREEN]; diffuseComponent[BLUE] = Kd[BLUE] * diffuseComponent[BLUE]; // Complete ambient component (Ka Ia) ambientComponent[RED] = Ka[RED] * ambientlight.color[RED]; ambientComponent[GREEN] = Ka[GREEN] * ambientlight.color[GREEN]; ambientComponent[BLUE] = Ka[BLUE] * ambientlight.color[BLUE]; // C = (Ks sum[le(R.E)s]) + (Kd sum[le(N.L)]) + (Ka Ia) C[RED] = boundFloat(specularComponent[RED] + diffuseComponent[RED] + ambientComponent[RED], 0, 1); C[GREEN] = boundFloat(specularComponent[GREEN] + diffuseComponent[GREEN] + ambientComponent[GREEN], 0, 1); C[BLUE] = boundFloat(specularComponent[BLUE] + diffuseComponent[BLUE] + ambientComponent[BLUE], 0, 1); } void GzRender::advanceSpan(GzPointer *valueList) { // Get vertice list GzCoord *vertex = (GzCoord *)valueList[0]; GzCoord *normal = (GzCoord *)valueList[1]; spanDDA.current[X] = spanDDA.start[X]; spanDDA.current[Y] = spanDDA.start[Y]; spanDDA.current[Z] = spanDDA.start[Z]; // Advance span current position to left - most covered pixel(ceiling) float newX = ceil(spanDDA.start[X]); spanDDA.current[X] = newX; spanDDA.current[Z] = getZCoord(spanDDA.start, spanDDA.end, newX); // current triangle color GzIntensity red = ctoi(flatcolor[RED]); GzIntensity green = ctoi(flatcolor[GREEN]); GzIntensity blue = ctoi(flatcolor[BLUE]); // interpoluate color GzColor interpColor; GzCoord interpNormal; // Interpolate span position and parameters (Z) until current position > end while (spanDDA.current[X] <= spanDDA.end[X]) { // Test interpolated-Z against FB-Z for each pixel - low Z wins int currentPixelIndex = ARRAY(spanDDA.current[X], spanDDA.current[Y]); if (currentPixelIndex < totalPixels && spanDDA.current[Z] < pixelbuffer[currentPixelIndex].z) { switch (interp_mode) { case GZ_FLAT: shadingEquation(normal[0]); red = ctoi(C[RED]); green = ctoi(C[GREEN]); blue = ctoi(C[BLUE]); break; case GZ_COLOR: { // interpolate color GzColor vertColor[3]; for (unsigned int i = 0; i < 3; ++i) { shadingEquation(normal[i]); vertColor[i][RED] = C[RED]; vertColor[i][GREEN] = C[GREEN]; vertColor[i][BLUE] = C[BLUE]; } for (unsigned int color = 0; color < 3; ++color) { // Calculate normal <A, B, C> GzCoord c1 = { vertex[three][X] - vertex[one][X], vertex[three][Y] - vertex[one][Y], vertColor[three][color] - vertColor[one][color] }; GzCoord c2 = { vertex[two][X] - vertex[three][X], vertex[two][Y] - vertex[three][Y], vertColor[two][color] - vertColor[three][color] }; // r1 x r2 GzCoord colorNormal = { c1[Y] * c2[Z] - c1[Z] * c2[Y], c1[Z] * c2[X] - c1[X] * c2[Z], c1[X] * c2[Y] - c1[Y] * c2[X] }; float A = colorNormal[X]; float B = colorNormal[Y]; float C = colorNormal[Z]; float D = -(A * vertex[one][X]) - B * vertex[one][Y] - C * vertColor[one][color]; interpColor[color] = (-(A * spanDDA.current[X]) - (B * spanDDA.current[Y]) - D) / C; } red = ctoi(interpColor[RED]); green = ctoi(interpColor[GREEN]); blue = ctoi(interpColor[BLUE]); } break; case GZ_NORMALS: { // interpolate normals for (unsigned int norm = 0; norm < 3; ++norm) { // Calculate normal <A, B, C> GzCoord c1 = { vertex[three][X] - vertex[one][X], vertex[three][Y] - vertex[one][Y], normal[three][norm] - normal[one][norm] }; GzCoord c2 = { vertex[two][X] - vertex[three][X], vertex[two][Y] - vertex[three][Y], normal[two][norm] - normal[three][norm] }; // r1 x r2 GzCoord normNormal = { c1[Y] * c2[Z] - c1[Z] * c2[Y], c1[Z] * c2[X] - c1[X] * c2[Z], c1[X] * c2[Y] - c1[Y] * c2[X] }; float A = normNormal[X]; float B = normNormal[Y]; float C = normNormal[Z]; float D = -(A * vertex[one][X] + B * vertex[one][Y] + C * normal[one][norm]); interpNormal[norm] = -(A * spanDDA.current[X] + B * spanDDA.current[Y] + D) / C; } // interpolate color GzColor vertColor[3]; for (unsigned int i = 0; i < 3; ++i) { normalizeVector(interpNormal); shadingEquation(interpNormal); vertColor[i][RED] = C[RED]; vertColor[i][GREEN] = C[GREEN]; vertColor[i][BLUE] = C[BLUE]; } for (unsigned int color = 0; color < 3; ++color) { // Calculate normal <A, B, C> GzCoord c1 = { vertex[three][X] - vertex[one][X], vertex[three][Y] - vertex[one][Y], vertColor[three][color] - vertColor[one][color] }; GzCoord c2 = { vertex[two][X] - vertex[three][X], vertex[two][Y] - vertex[three][Y], vertColor[two][color] - vertColor[three][color] }; // r1 x r2 GzCoord colorNormal = { c1[Y] * c2[Z] - c1[Z] * c2[Y], c1[Z] * c2[X] - c1[X] * c2[Z], c1[X] * c2[Y] - c1[Y] * c2[X] }; // normalizeVector(colorNormal); float A = colorNormal[X]; float B = colorNormal[Y]; float C = colorNormal[Z]; float D = -(A * vertex[one][X]) - B * vertex[one][Y] - C * vertColor[one][color]; interpColor[color] = (-(A * spanDDA.current[X]) - (B * spanDDA.current[Y]) - D) / C; } red = ctoi(interpColor[RED]); green = ctoi(interpColor[GREEN]); blue = ctoi(interpColor[BLUE]); } break; default: break; } GzPut(spanDDA.current[X], spanDDA.current[Y], red, green, blue, 1, spanDDA.current[Z]); } // Advance span current position newX += 1; spanDDA.current[X] = newX; spanDDA.current[Z] = getZCoord(spanDDA.start, spanDDA.end, newX); } } void GzRender::advanceEdges(GzPointer *valueList) { // Advance (1-2) and (1-3) DDA current positions to top y-scan line (ceiling) float newY = ceil(edgeDDA[one].start[Y]); edgeDDA[one].current[X] = getXCoord(edgeDDA[one].start, edgeDDA[one].end, newY); edgeDDA[one].current[Y] = newY; edgeDDA[one].current[Z] = getZCoord(edgeDDA[one].start, edgeDDA[one].end, edgeDDA[one].current[X]); edgeDDA[three].current[X] = getXCoord(edgeDDA[three].start, edgeDDA[three].end, newY); edgeDDA[three].current[Y] = newY; edgeDDA[three].current[Z] = getZCoord(edgeDDA[three].start, edgeDDA[three].end, edgeDDA[three].current[X]); // Switch from 1 - 2 edge to 2 - 3 edge when current 1 - 2 edge position > Y(2) while (edgeDDA[one].current[Y] < edgeDDA[one].end[Y]) { // Setup span DDA on successive lines based on edge DDA position values // Set span DDA current and end positions to right and left edge values spanDDA.start[X] = edgeDDA[one].edgeOnLeft ? edgeDDA[one].current[X] : edgeDDA[three].current[X]; spanDDA.start[Y] = edgeDDA[one].edgeOnLeft ? edgeDDA[one].current[Y] : edgeDDA[three].current[Y]; spanDDA.start[Z] = edgeDDA[one].edgeOnLeft ? edgeDDA[one].current[Z] : edgeDDA[three].current[Z]; spanDDA.end[X] = edgeDDA[one].edgeOnLeft ? edgeDDA[three].current[X] : edgeDDA[one].current[X]; spanDDA.end[Y] = edgeDDA[one].edgeOnLeft ? edgeDDA[three].current[Y] : edgeDDA[one].current[Y]; spanDDA.end[Z] = edgeDDA[one].edgeOnLeft ? edgeDDA[three].current[Z] : edgeDDA[one].current[Z]; advanceSpan(valueList); // Advance (1-2) and (1-3) DDA current positions newY += 1; edgeDDA[one].current[X] = getXCoord(edgeDDA[one].start, edgeDDA[one].end, newY); edgeDDA[one].current[Y] = newY; edgeDDA[one].current[Z] = getZCoord(edgeDDA[one].start, edgeDDA[one].end, edgeDDA[one].current[X]); edgeDDA[three].current[X] = getXCoord(edgeDDA[three].start, edgeDDA[three].end, newY); edgeDDA[three].current[Y] = newY; edgeDDA[three].current[Z] = getZCoord(edgeDDA[three].start, edgeDDA[three].end, edgeDDA[three].current[X]); } // Advance (2-3) and (1-3) DDA current positions to top y-scan line (ceiling) newY = ceil(edgeDDA[two].start[Y]); edgeDDA[two].current[X] = getXCoord(edgeDDA[two].start, edgeDDA[two].end, newY); edgeDDA[two].current[Y] = newY; edgeDDA[two].current[Z] = getZCoord(edgeDDA[two].start, edgeDDA[two].end, edgeDDA[two].current[X]); edgeDDA[three].current[X] = getXCoord(edgeDDA[three].start, edgeDDA[three].end, newY); edgeDDA[three].current[Y] = newY; edgeDDA[three].current[Z] = getZCoord(edgeDDA[three].start, edgeDDA[three].end, edgeDDA[three].current[X]); // End advance when current 2 - 3 edge position > Y(3) while (edgeDDA[two].current[Y] < edgeDDA[two].end[Y]) { // Setup span DDA on successive lines based on edge DDA position values // Set span DDA current and end positions to right and left edge values spanDDA.start[X] = edgeDDA[two].edgeOnLeft ? edgeDDA[two].current[X] : edgeDDA[three].current[X]; spanDDA.start[Y] = edgeDDA[two].edgeOnLeft ? edgeDDA[two].current[Y] : edgeDDA[three].current[Y]; spanDDA.start[Z] = edgeDDA[two].edgeOnLeft ? edgeDDA[two].current[Z] : edgeDDA[three].current[Z]; spanDDA.end[X] = edgeDDA[two].edgeOnLeft ? edgeDDA[three].current[X] : edgeDDA[two].current[X]; spanDDA.end[Y] = edgeDDA[two].edgeOnLeft ? edgeDDA[three].current[Y] : edgeDDA[two].current[Y]; spanDDA.end[Z] = edgeDDA[two].edgeOnLeft ? edgeDDA[three].current[Z] : edgeDDA[two].current[Z]; advanceSpan(valueList); // Advance (1-2) and (1-3) DDA current positions newY += 1; edgeDDA[two].current[X] = getXCoord(edgeDDA[two].start, edgeDDA[two].end, newY); edgeDDA[two].current[Y] = newY; edgeDDA[two].current[Z] = getZCoord(edgeDDA[two].start, edgeDDA[two].end, edgeDDA[two].current[X]); edgeDDA[three].current[X] = getXCoord(edgeDDA[three].start, edgeDDA[three].end, newY); edgeDDA[three].current[Y] = newY; edgeDDA[three].current[Z] = getZCoord(edgeDDA[three].start, edgeDDA[three].end, edgeDDA[three].current[X]); } } void GzRender::scanLineRender(GzPointer *valueList) { sortVerticesByY(valueList); setupEdgeDDAs(valueList); sortEdgesLeftOrRight(); advanceEdges(valueList); }
#include "llvm/Support/BlockFrequency.h" #include "llvm/Support/BranchProbability.h" #include "llvm/Support/DataTypes.h" #include "gtest/gtest.h" #include <climits> using namespace llvm; namespace { TEST(BlockFrequencyTest, OneToZero) { BlockFrequency Freq(1); BranchProbability Prob(UINT32_MAX - 1, UINT32_MAX); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), 0u); Freq = BlockFrequency(1); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), 0u); EXPECT_EQ(Remainder, UINT32_MAX - 1); } TEST(BlockFrequencyTest, OneToOne) { BlockFrequency Freq(1); BranchProbability Prob(UINT32_MAX, UINT32_MAX); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), 1u); Freq = BlockFrequency(1); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), 1u); EXPECT_EQ(Remainder, 0u); } TEST(BlockFrequencyTest, ThreeToOne) { BlockFrequency Freq(3); BranchProbability Prob(3000000, 9000000); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), 1u); Freq = BlockFrequency(3); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), 1u); EXPECT_EQ(Remainder, 0u); } TEST(BlockFrequencyTest, MaxToHalfMax) { BlockFrequency Freq(UINT64_MAX); BranchProbability Prob(UINT32_MAX / 2, UINT32_MAX); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), 9223372034707292159ULL); Freq = BlockFrequency(UINT64_MAX); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), 9223372034707292159ULL); EXPECT_EQ(Remainder, 0u); } TEST(BlockFrequencyTest, BigToBig) { const uint64_t Big = 387246523487234346LL; const uint32_t P = 123456789; BlockFrequency Freq(Big); BranchProbability Prob(P, P); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), Big); Freq = BlockFrequency(Big); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), Big); EXPECT_EQ(Remainder, 0u); } TEST(BlockFrequencyTest, MaxToMax) { BlockFrequency Freq(UINT64_MAX); BranchProbability Prob(UINT32_MAX, UINT32_MAX); Freq *= Prob; EXPECT_EQ(Freq.getFrequency(), UINT64_MAX); // This additionally makes sure if we have a value equal to our saturating // value, we do not signal saturation if the result equals said value, but // saturating does not occur. Freq = BlockFrequency(UINT64_MAX); uint32_t Remainder = Freq.scale(Prob); EXPECT_EQ(Freq.getFrequency(), UINT64_MAX); EXPECT_EQ(Remainder, 0u); } TEST(BlockFrequencyTest, ScaleResultRemainderTest) { struct { uint64_t Freq; uint32_t Prob[2]; uint64_t ExpectedFreq; uint32_t ExpectedRemainder; } Tests[80] = { // Data for scaling that results in <= 64 bit division. { 0x1423e2a50ULL, { 0x64819521, 0x7765dd13 }, 0x10f418889ULL, 0x92b9d25 }, { 0x35ef14ceULL, { 0x28ade3c7, 0x304532ae }, 0x2d73c33aULL, 0x2c0fd0b6 }, { 0xd03dbfbe24ULL, { 0x790079, 0xe419f3 }, 0x6e776fc1fdULL, 0x4a06dd }, { 0x21d67410bULL, { 0x302a9dc2, 0x3ddb4442 }, 0x1a5948fd6ULL, 0x265d1c2a }, { 0x8664aeadULL, { 0x3d523513, 0x403523b1 }, 0x805a04cfULL, 0x324c27b8 }, { 0x201db0cf4ULL, { 0x35112a7b, 0x79fc0c74 }, 0xdf8b07f6ULL, 0x490c1dc4 }, { 0x13f1e4430aULL, { 0x21c92bf, 0x21e63aae }, 0x13e0cba15ULL, 0x1df47c30 }, { 0x16c83229ULL, { 0x3793f66f, 0x53180dea }, 0xf3ce7b6ULL, 0x1d0c1b6b }, { 0xc62415be8ULL, { 0x9cc4a63, 0x4327ae9b }, 0x1ce8b71caULL, 0x3f2c696a }, { 0x6fac5e434ULL, { 0xe5f9170, 0x1115e10b }, 0x5df23dd4cULL, 0x4dafc7c }, { 0x1929375f2ULL, { 0x3a851375, 0x76c08456 }, 0xc662b082ULL, 0x343589ee }, { 0x243c89db6ULL, { 0x354ebfc0, 0x450ef197 }, 0x1bf8c1661ULL, 0x4948e49 }, { 0x310e9b31aULL, { 0x1b1b8acf, 0x2d3629f0 }, 0x1d69c93f9ULL, 0x73e3b96 }, { 0xa1fae921dULL, { 0xa7a098c, 0x10469f44 }, 0x684413d6cULL, 0x86a882c }, { 0xc1582d957ULL, { 0x498e061, 0x59856bc }, 0x9edc5f4e7ULL, 0x29b0653 }, { 0x57cfee75ULL, { 0x1d061dc3, 0x7c8bfc17 }, 0x1476a220ULL, 0x2383d33f }, { 0x139220080ULL, { 0x294a6c71, 0x2a2b07c9 }, 0x1329e1c76ULL, 0x7aa5da }, { 0x1665d353cULL, { 0x7080db5, 0xde0d75c }, 0xb590d9fbULL, 0x7ba8c38 }, { 0xe8f14541ULL, { 0x5188e8b2, 0x736527ef }, 0xa4971be5ULL, 0x6b612167 }, { 0x2f4775f29ULL, { 0x254ef0fe, 0x435fcf50 }, 0x1a2e449c1ULL, 0x28bbf5e }, { 0x27b85d8d7ULL, { 0x304c8220, 0x5de678f2 }, 0x146e3bef9ULL, 0x4b27097e }, { 0x1d362e36bULL, { 0x36c85b12, 0x37a66f55 }, 0x1cc19b8e6ULL, 0x688e828 }, { 0x155fd48c7ULL, { 0xf5894d, 0x1256108 }, 0x11e383602ULL, 0x111f0cb }, { 0xb5db2d15ULL, { 0x39bb26c5, 0x5bdcda3e }, 0x72499259ULL, 0x59c4939b }, { 0x153990298ULL, { 0x48921c09, 0x706eb817 }, 0xdb3268e8ULL, 0x66bb8a80 }, { 0x28a7c3ed7ULL, { 0x1f776fd7, 0x349f7a70 }, 0x184f73ae1ULL, 0x28910321 }, { 0x724dbeabULL, { 0x1bd149f5, 0x253a085e }, 0x5569c0b3ULL, 0xff8e2ed }, { 0xd8f0c513ULL, { 0x18c8cc4c, 0x1b72bad0 }, 0xc3e30643ULL, 0xd85e134 }, { 0x17ce3dcbULL, { 0x1e4c6260, 0x233b359e }, 0x1478f4afULL, 0x49ea31e }, { 0x1ce036ce0ULL, { 0x29e3c8af, 0x5318dd4a }, 0xe8e76196ULL, 0x11d5b9c4 }, { 0x1473ae2aULL, { 0x29b897ba, 0x2be29378 }, 0x13718185ULL, 0x6f93b2c }, { 0x1dd41aa68ULL, { 0x3d0a4441, 0x5a0e8f12 }, 0x1437b6bbfULL, 0x54b09ffa }, { 0x1b49e4a53ULL, { 0x3430c1fe, 0x5a204aed }, 0xfcd6852fULL, 0x15ad6ed7 }, { 0x217941b19ULL, { 0x12ced2bd, 0x21b68310 }, 0x12aca65b1ULL, 0x1b2a9565 }, { 0xac6a4dc8ULL, { 0x3ed68da8, 0x6fdca34c }, 0x60da926dULL, 0x22ff53e4 }, { 0x1c503a4e7ULL, { 0xfcbbd32, 0x11e48d17 }, 0x18fec7d38ULL, 0xa8aa816 }, { 0x1c885855ULL, { 0x213e919d, 0x25941897 }, 0x193de743ULL, 0x4ea09c }, { 0x29b9c168eULL, { 0x2b644aea, 0x45725ee7 }, 0x1a122e5d5ULL, 0xbee1099 }, { 0x806a33f2ULL, { 0x30a80a23, 0x5063733a }, 0x4db9a264ULL, 0x1eaed76e }, { 0x282afc96bULL, { 0x143ae554, 0x1a9863ff }, 0x1e8de5204ULL, 0x158d9020 }, // Data for scaling that results in > 64 bit division. { 0x23ca5f2f672ca41cULL, { 0xecbc641, 0x111373f7 }, 0x1f0301e5e8295ab5ULL, 0xf627f79 }, { 0x5e4f2468142265e3ULL, { 0x1ddf5837, 0x32189233 }, 0x383ca7ba9fdd2c8cULL, 0x1c8f33e1 }, { 0x277a1a6f6b266bf6ULL, { 0x415d81a8, 0x61eb5e1e }, 0x1a5a3e1d41b30c0fULL, 0x29cde3ae }, { 0x1bdbb49a237035cbULL, { 0xea5bf17, 0x1d25ffb3 }, 0xdffc51c53d44b93ULL, 0x5170574 }, { 0x2bce6d29b64fb8ULL, { 0x3bfd5631, 0x7525c9bb }, 0x166ebedda7ac57ULL, 0x3026dfab }, { 0x3a02116103df5013ULL, { 0x2ee18a83, 0x3299aea8 }, 0x35be8922ab1e2a84ULL, 0x298d9919 }, { 0x7b5762390799b18cULL, { 0x12f8e5b9, 0x2563bcd4 }, 0x3e960077aca01209ULL, 0x93afeb8 }, { 0x69cfd72537021579ULL, { 0x4c35f468, 0x6a40feee }, 0x4be4cb3848be98a3ULL, 0x4ff96b9e }, { 0x49dfdf835120f1c1ULL, { 0x8cb3759, 0x559eb891 }, 0x79663f7120edadeULL, 0x51b1fb5b }, { 0x74b5be5c27676381ULL, { 0x47e4c5e0, 0x7c7b19ff }, 0x4367d2dff36a1028ULL, 0x7a7b5608 }, { 0x4f50f97075e7f431ULL, { 0x9a50a17, 0x11cd1185 }, 0x2af952b34c032df4ULL, 0xfddc6a3 }, { 0x2f8b0d712e393be4ULL, { 0x1487e386, 0x15aa356e }, 0x2d0df36478a776aaULL, 0x14e2564c }, { 0x224c1c75999d3deULL, { 0x3b2df0ea, 0x4523b100 }, 0x1d5b481d145f08aULL, 0x15145eec }, { 0x2bcbcea22a399a76ULL, { 0x28b58212, 0x48dd013e }, 0x187814d084c47cabULL, 0x3a38ebe2 }, { 0x1dbfca91257cb2d1ULL, { 0x1a8c04d9, 0x5e92502c }, 0x859cf7d00f77545ULL, 0x7431f4d }, { 0x7f20039b57cda935ULL, { 0xeccf651, 0x323f476e }, 0x25720cd976461a77ULL, 0x202817a3 }, { 0x40512c6a586aa087ULL, { 0x113b0423, 0x398c9eab }, 0x1341c03de8696a7eULL, 0x1e27284b }, { 0x63d802693f050a11ULL, { 0xf50cdd6, 0xfce2a44 }, 0x60c0177bb5e46846ULL, 0xf7ad89e }, { 0x2d956b422838de77ULL, { 0xb2d345b, 0x1321e557 }, 0x1aa0ed16b6aa5319ULL, 0xfe1a5ce }, { 0x5a1cdf0c1657bc91ULL, { 0x1d77bb0c, 0x1f991ff1 }, 0x54097ee94ff87560ULL, 0x11c4a26c }, { 0x3801b26d7e00176bULL, { 0xeed25da, 0x1a819d8b }, 0x1f89e96a3a639526ULL, 0xcd51e7c }, { 0x37655e74338e1e45ULL, { 0x300e170a, 0x5a1595fe }, 0x1d8cfb55fddc0441ULL, 0x3df05434 }, { 0x7b38703f2a84e6ULL, { 0x66d9053, 0xc79b6b9 }, 0x3f7d4c91774094ULL, 0x26d939e }, { 0x2245063c0acb3215ULL, { 0x30ce2f5b, 0x610e7271 }, 0x113b916468389235ULL, 0x1b588512 }, { 0x6bc195877b7b8a7eULL, { 0x392004aa, 0x4a24e60c }, 0x530594fb17db6ba5ULL, 0x35c0a5f0 }, { 0x40a3fde23c7b43dbULL, { 0x4e712195, 0x6553e56e }, 0x320a799bc76a466aULL, 0x5e23a5eb }, { 0x1d3dfc2866fbccbaULL, { 0x5075b517, 0x5fc42245 }, 0x18917f0061595bc3ULL, 0x3fcf4527 }, { 0x19aeb14045a61121ULL, { 0x1bf6edec, 0x707e2f4b }, 0x6626672a070bcc7ULL, 0x3607801f }, { 0x44ff90486c531e9fULL, { 0x66598a, 0x8a90dc }, 0x32f6f2b0525199b0ULL, 0x5ab576 }, { 0x3f3e7121092c5bcbULL, { 0x1c754df7, 0x5951a1b9 }, 0x14267f50b7ef375dULL, 0x221220a8 }, { 0x60e2dafb7e50a67eULL, { 0x4d96c66e, 0x65bd878d }, 0x49e31715ac393f8bULL, 0x4e97b195 }, { 0x656286667e0e6e29ULL, { 0x9d971a2, 0xacda23b }, 0x5c6ee315ead6cb4fULL, 0x516f5bd }, { 0x1114e0974255d507ULL, { 0x1c693, 0x2d6ff }, 0xaae42e4b35f6e60ULL, 0x8b65 }, { 0x508c8baf3a70ff5aULL, { 0x3b26b779, 0x6ad78745 }, 0x2c98387636c4b365ULL, 0x11dc6a51 }, { 0x5b47bc666bf1f9cfULL, { 0x10a87ed6, 0x187d358a }, 0x3e1767155848368bULL, 0xfb871c }, { 0x50954e3744460395ULL, { 0x7a42263, 0xcdaa048 }, 0x2fe739f0aee1fee1ULL, 0xb8add57 }, { 0x20020b406550dd8fULL, { 0x3318539, 0x42eead0 }, 0x186f326325fa346bULL, 0x10d3ae7 }, { 0x5bcb0b872439ffd5ULL, { 0x6f61fb2, 0x9af7344 }, 0x41fa1e3bec3c1b30ULL, 0x4fee45a }, { 0x7a670f365db87a53ULL, { 0x417e102, 0x3bb54c67 }, 0x8642a558304fd9eULL, 0x3b65f514 }, { 0x1ef0db1e7bab1cd0ULL, { 0x2b60cf38, 0x4188f78f }, 0x147ae0d6226b2ee6ULL, 0x336b6106 } }; for (unsigned i = 0; i < 80; i++) { BlockFrequency Freq(Tests[i].Freq); uint32_t Remainder = Freq.scale(BranchProbability(Tests[i].Prob[0], Tests[i].Prob[1])); EXPECT_EQ(Tests[i].ExpectedFreq, Freq.getFrequency()); EXPECT_EQ(Tests[i].ExpectedRemainder, Remainder); } } TEST(BlockFrequency, Divide) { BlockFrequency Freq(0x3333333333333333ULL); Freq /= BranchProbability(1, 2); EXPECT_EQ(Freq.getFrequency(), 0x6666666666666666ULL); } TEST(BlockFrequencyTest, Saturate) { BlockFrequency Freq(0x3333333333333333ULL); Freq /= BranchProbability(100, 300); EXPECT_EQ(Freq.getFrequency(), 0x9999999999999999ULL); Freq /= BranchProbability(1, 2); EXPECT_EQ(Freq.getFrequency(), UINT64_MAX); Freq = 0x1000000000000000ULL; Freq /= BranchProbability(10000, 160000); EXPECT_EQ(Freq.getFrequency(), UINT64_MAX); // Try to cheat the multiplication overflow check. Freq = 0x00000001f0000001ull; Freq /= BranchProbability(1000, 0xf000000f); EXPECT_EQ(33506781356485509ULL, Freq.getFrequency()); } TEST(BlockFrequencyTest, ProbabilityCompare) { BranchProbability A(4, 5); BranchProbability B(4U << 29, 5U << 29); BranchProbability C(3, 4); EXPECT_TRUE(A == B); EXPECT_FALSE(A != B); EXPECT_FALSE(A < B); EXPECT_FALSE(A > B); EXPECT_TRUE(A <= B); EXPECT_TRUE(A >= B); EXPECT_FALSE(B == C); EXPECT_TRUE(B != C); EXPECT_FALSE(B < C); EXPECT_TRUE(B > C); EXPECT_FALSE(B <= C); EXPECT_TRUE(B >= C); BranchProbability BigZero(0, UINT32_MAX); BranchProbability BigOne(UINT32_MAX, UINT32_MAX); EXPECT_FALSE(BigZero == BigOne); EXPECT_TRUE(BigZero != BigOne); EXPECT_TRUE(BigZero < BigOne); EXPECT_FALSE(BigZero > BigOne); EXPECT_TRUE(BigZero <= BigOne); EXPECT_FALSE(BigZero >= BigOne); } }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/chromeos/crosapi/file_manager_ash.h" #include "base/bind.h" #include "base/callback.h" #include "base/files/file_path.h" #include "base/notreached.h" #include "chrome/browser/chromeos/file_manager/open_util.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chromeos/crosapi/mojom/file_manager.mojom.h" namespace crosapi { namespace { // Adapts a platform_util::OpenOperationResult to a crosapi::mojom::OpenResult // when running a |callback|. void RunWithOpenResult(base::OnceCallback<void(mojom::OpenResult)> callback, platform_util::OpenOperationResult result) { mojom::OpenResult mojo_result; switch (result) { case platform_util::OPEN_SUCCEEDED: mojo_result = mojom::OpenResult::kSucceeded; break; case platform_util::OPEN_FAILED_PATH_NOT_FOUND: mojo_result = mojom::OpenResult::kFailedPathNotFound; break; case platform_util::OPEN_FAILED_INVALID_TYPE: mojo_result = mojom::OpenResult::kFailedInvalidType; break; case platform_util::OPEN_FAILED_NO_HANLDER_FOR_FILE_TYPE: mojo_result = mojom::OpenResult::kFailedNoHandlerForFileType; break; case platform_util::OPEN_FAILED_FILE_ERROR: mojo_result = mojom::OpenResult::kFailedFileError; break; } std::move(callback).Run(mojo_result); } // Opens an item of |type| at |path| and runs |callback| with the result. void OpenItem(const base::FilePath& path, platform_util::OpenItemType item_type, base::OnceCallback<void(mojom::OpenResult)> callback) { Profile* primary_profile = ProfileManager::GetPrimaryUserProfile(); file_manager::util::OpenItem( primary_profile, path, item_type, base::BindOnce(&RunWithOpenResult, std::move(callback))); } } // namespace FileManagerAsh::FileManagerAsh() = default; FileManagerAsh::~FileManagerAsh() = default; void FileManagerAsh::BindReceiver( mojo::PendingReceiver<mojom::FileManager> receiver) { receivers_.Add(this, std::move(receiver)); } void FileManagerAsh::DeprecatedShowItemInFolder(const base::FilePath& path) { // As of OS M89 all lacros clients now use ShowItemInFolder() below. NOTIMPLEMENTED(); } void FileManagerAsh::ShowItemInFolder(const base::FilePath& path, ShowItemInFolderCallback callback) { Profile* primary_profile = ProfileManager::GetPrimaryUserProfile(); file_manager::util::ShowItemInFolder( primary_profile, path, base::BindOnce(&RunWithOpenResult, std::move(callback))); } void FileManagerAsh::OpenFolder(const base::FilePath& path, OpenFolderCallback callback) { OpenItem(path, platform_util::OPEN_FOLDER, std::move(callback)); } void FileManagerAsh::OpenFile(const base::FilePath& path, OpenFileCallback callback) { OpenItem(path, platform_util::OPEN_FILE, std::move(callback)); } } // namespace crosapi
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .text .p2align 5, 0x90 Lpoly: .quad 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFF00000000, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFEFFFFFFFF LRR: .quad 0x200000003, 0x2ffffffff, 0x100000001, 0x400000002 LOne: .long 1,1,1,1,1,1,1,1 LTwo: .long 2,2,2,2,2,2,2,2 LThree: .long 3,3,3,3,3,3,3,3 .p2align 5, 0x90 .globl _l9_sm2_mul_by_2 _l9_sm2_mul_by_2: push %r12 push %r13 xor %r13, %r13 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 shld $(1), %r11, %r13 shld $(1), %r10, %r11 shld $(1), %r9, %r10 shld $(1), %r8, %r9 shl $(1), %r8 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 subq Lpoly+0(%rip), %rax sbbq Lpoly+8(%rip), %rdx sbbq Lpoly+16(%rip), %rcx sbbq Lpoly+24(%rip), %r12 sbb $(0), %r13 cmove %rax, %r8 cmove %rdx, %r9 cmove %rcx, %r10 cmove %r12, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r13 pop %r12 ret .p2align 5, 0x90 .globl _l9_sm2_div_by_2 _l9_sm2_div_by_2: push %r12 push %r13 push %r14 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 xor %r13, %r13 xor %r14, %r14 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 addq Lpoly+0(%rip), %rax adcq Lpoly+8(%rip), %rdx adcq Lpoly+16(%rip), %rcx adcq Lpoly+24(%rip), %r12 adc $(0), %r13 test $(1), %r8 cmovne %rax, %r8 cmovne %rdx, %r9 cmovne %rcx, %r10 cmovne %r12, %r11 cmovne %r13, %r14 shrd $(1), %r9, %r8 shrd $(1), %r10, %r9 shrd $(1), %r11, %r10 shrd $(1), %r14, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r14 pop %r13 pop %r12 ret .p2align 5, 0x90 .globl _l9_sm2_mul_by_3 _l9_sm2_mul_by_3: push %r12 push %r13 xor %r13, %r13 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 shld $(1), %r11, %r13 shld $(1), %r10, %r11 shld $(1), %r9, %r10 shld $(1), %r8, %r9 shl $(1), %r8 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 subq Lpoly+0(%rip), %rax sbbq Lpoly+8(%rip), %rdx sbbq Lpoly+16(%rip), %rcx sbbq Lpoly+24(%rip), %r12 sbb $(0), %r13 cmove %rax, %r8 cmove %rdx, %r9 cmove %rcx, %r10 cmove %r12, %r11 xor %r13, %r13 addq (%rsi), %r8 adcq (8)(%rsi), %r9 adcq (16)(%rsi), %r10 adcq (24)(%rsi), %r11 adc $(0), %r13 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 subq Lpoly+0(%rip), %rax sbbq Lpoly+8(%rip), %rdx sbbq Lpoly+16(%rip), %rcx sbbq Lpoly+24(%rip), %r12 sbb $(0), %r13 cmove %rax, %r8 cmove %rdx, %r9 cmove %rcx, %r10 cmove %r12, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r13 pop %r12 ret .p2align 5, 0x90 .globl _l9_sm2_add _l9_sm2_add: push %r12 push %r13 xor %r13, %r13 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 addq (%rdx), %r8 adcq (8)(%rdx), %r9 adcq (16)(%rdx), %r10 adcq (24)(%rdx), %r11 adc $(0), %r13 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 subq Lpoly+0(%rip), %rax sbbq Lpoly+8(%rip), %rdx sbbq Lpoly+16(%rip), %rcx sbbq Lpoly+24(%rip), %r12 sbb $(0), %r13 cmove %rax, %r8 cmove %rdx, %r9 cmove %rcx, %r10 cmove %r12, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r13 pop %r12 ret .p2align 5, 0x90 .globl _l9_sm2_sub _l9_sm2_sub: push %r12 push %r13 xor %r13, %r13 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 subq (%rdx), %r8 sbbq (8)(%rdx), %r9 sbbq (16)(%rdx), %r10 sbbq (24)(%rdx), %r11 sbb $(0), %r13 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 addq Lpoly+0(%rip), %rax adcq Lpoly+8(%rip), %rdx adcq Lpoly+16(%rip), %rcx adcq Lpoly+24(%rip), %r12 test %r13, %r13 cmovne %rax, %r8 cmovne %rdx, %r9 cmovne %rcx, %r10 cmovne %r12, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r13 pop %r12 ret .p2align 5, 0x90 .globl _l9_sm2_neg _l9_sm2_neg: push %r12 push %r13 xor %r13, %r13 xor %r8, %r8 xor %r9, %r9 xor %r10, %r10 xor %r11, %r11 subq (%rsi), %r8 sbbq (8)(%rsi), %r9 sbbq (16)(%rsi), %r10 sbbq (24)(%rsi), %r11 sbb $(0), %r13 mov %r8, %rax mov %r9, %rdx mov %r10, %rcx mov %r11, %r12 addq Lpoly+0(%rip), %rax adcq Lpoly+8(%rip), %rdx adcq Lpoly+16(%rip), %rcx adcq Lpoly+24(%rip), %r12 test %r13, %r13 cmovne %rax, %r8 cmovne %rdx, %r9 cmovne %rcx, %r10 cmovne %r12, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r13 pop %r12 ret .p2align 5, 0x90 sm2_mmull: xor %r13, %r13 movq (%rbx), %rax mulq (%rsi) mov %rax, %r8 mov %rdx, %r9 movq (%rbx), %rax mulq (8)(%rsi) add %rax, %r9 adc $(0), %rdx mov %rdx, %r10 movq (%rbx), %rax mulq (16)(%rsi) add %rax, %r10 adc $(0), %rdx mov %rdx, %r11 movq (%rbx), %rax mulq (24)(%rsi) add %rax, %r11 adc $(0), %rdx mov %rdx, %r12 mov %r8, %r14 shl $(32), %r14 mov %r8, %r15 shr $(32), %r15 mov %r8, %rcx mov %r8, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r9 adc %rbp, %r10 adc %rdx, %r11 adc %rax, %r12 adc $(0), %r13 xor %r8, %r8 movq (8)(%rbx), %rax mulq (%rsi) add %rax, %r9 adc $(0), %rdx mov %rdx, %rcx movq (8)(%rbx), %rax mulq (8)(%rsi) add %rcx, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %rcx movq (8)(%rbx), %rax mulq (16)(%rsi) add %rcx, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx movq (8)(%rbx), %rax mulq (24)(%rsi) add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc %rdx, %r13 adc $(0), %r8 mov %r9, %r14 shl $(32), %r14 mov %r9, %r15 shr $(32), %r15 mov %r9, %rcx mov %r9, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r10 adc %rbp, %r11 adc %rdx, %r12 adc %rax, %r13 adc $(0), %r8 xor %r9, %r9 movq (16)(%rbx), %rax mulq (%rsi) add %rax, %r10 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rbx), %rax mulq (8)(%rsi) add %rcx, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rbx), %rax mulq (16)(%rsi) add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rbx), %rax mulq (24)(%rsi) add %rcx, %r13 adc $(0), %rdx add %rax, %r13 adc %rdx, %r8 adc $(0), %r9 mov %r10, %r14 shl $(32), %r14 mov %r10, %r15 shr $(32), %r15 mov %r10, %rcx mov %r10, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r11 adc %rbp, %r12 adc %rdx, %r13 adc %rax, %r8 adc $(0), %r9 xor %r10, %r10 movq (24)(%rbx), %rax mulq (%rsi) add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rbx), %rax mulq (8)(%rsi) add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rbx), %rax mulq (16)(%rsi) add %rcx, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rbx), %rax mulq (24)(%rsi) add %rcx, %r8 adc $(0), %rdx add %rax, %r8 adc %rdx, %r9 adc $(0), %r10 mov %r11, %r14 shl $(32), %r14 mov %r11, %r15 shr $(32), %r15 mov %r11, %rcx mov %r11, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r12 adc %rbp, %r13 adc %rdx, %r8 adc %rax, %r9 adc $(0), %r10 xor %r11, %r11 movq Lpoly+0(%rip), %rcx movq Lpoly+8(%rip), %rbp movq Lpoly+16(%rip), %rbx movq Lpoly+24(%rip), %rdx mov %r12, %rax mov %r13, %r11 mov %r8, %r14 mov %r9, %r15 sub %rcx, %rax sbb %rbp, %r11 sbb %rbx, %r14 sbb %rdx, %r15 sbb $(0), %r10 cmovnc %rax, %r12 cmovnc %r11, %r13 cmovnc %r14, %r8 cmovnc %r15, %r9 movq %r12, (%rdi) movq %r13, (8)(%rdi) movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) ret .p2align 5, 0x90 .globl _l9_sm2_mul_montl _l9_sm2_mul_montl: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 mov %rdx, %rbx call sm2_mmull vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 .globl _l9_sm2_to_mont _l9_sm2_to_mont: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 lea LRR(%rip), %rbx call sm2_mmull vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 sm2_mmulx: xor %r13, %r13 xor %rdx, %rdx movq (%rbx), %rdx mulxq (%rsi), %r8, %r9 mulxq (8)(%rsi), %rcx, %r10 add %rcx, %r9 mulxq (16)(%rsi), %rcx, %r11 adc %rcx, %r10 mulxq (24)(%rsi), %rcx, %r12 adc %rcx, %r11 adc $(0), %r12 mov %r8, %r14 shl $(32), %r14 mov %r8, %r15 shr $(32), %r15 mov %r8, %rax mov %r8, %rbp xor %rdx, %rdx xor %rcx, %rcx sub %r14, %rax sbb %r15, %rdx sbb %r14, %rcx sbb %r15, %rbp add %rax, %r9 adc %rdx, %r10 adc %rcx, %r11 adc %rbp, %r12 adc $(0), %r13 xor %r8, %r8 movq (8)(%rbx), %rdx mulxq (%rsi), %rcx, %rbp adcx %rcx, %r9 adox %rbp, %r10 mulxq (8)(%rsi), %rcx, %rbp adcx %rcx, %r10 adox %rbp, %r11 mulxq (16)(%rsi), %rcx, %rbp adcx %rcx, %r11 adox %rbp, %r12 mulxq (24)(%rsi), %rcx, %rbp adcx %rcx, %r12 adox %rbp, %r13 adcx %r8, %r13 adox %r8, %r8 adc $(0), %r8 mov %r9, %r14 shl $(32), %r14 mov %r9, %r15 shr $(32), %r15 mov %r9, %rax mov %r9, %rbp xor %rdx, %rdx xor %rcx, %rcx sub %r14, %rax sbb %r15, %rdx sbb %r14, %rcx sbb %r15, %rbp add %rax, %r10 adc %rdx, %r11 adc %rcx, %r12 adc %rbp, %r13 adc $(0), %r8 xor %r9, %r9 movq (16)(%rbx), %rdx mulxq (%rsi), %rcx, %rbp adcx %rcx, %r10 adox %rbp, %r11 mulxq (8)(%rsi), %rcx, %rbp adcx %rcx, %r11 adox %rbp, %r12 mulxq (16)(%rsi), %rcx, %rbp adcx %rcx, %r12 adox %rbp, %r13 mulxq (24)(%rsi), %rcx, %rbp adcx %rcx, %r13 adox %rbp, %r8 adcx %r9, %r8 adox %r9, %r9 adc $(0), %r9 mov %r10, %r14 shl $(32), %r14 mov %r10, %r15 shr $(32), %r15 mov %r10, %rax mov %r10, %rbp xor %rdx, %rdx xor %rcx, %rcx sub %r14, %rax sbb %r15, %rdx sbb %r14, %rcx sbb %r15, %rbp add %rax, %r11 adc %rdx, %r12 adc %rcx, %r13 adc %rbp, %r8 adc $(0), %r9 xor %r10, %r10 movq (24)(%rbx), %rdx mulxq (%rsi), %rcx, %rbp adcx %rcx, %r11 adox %rbp, %r12 mulxq (8)(%rsi), %rcx, %rbp adcx %rcx, %r12 adox %rbp, %r13 mulxq (16)(%rsi), %rcx, %rbp adcx %rcx, %r13 adox %rbp, %r8 mulxq (24)(%rsi), %rcx, %rbp adcx %rcx, %r8 adox %rbp, %r9 adcx %r10, %r9 adox %r10, %r10 adc $(0), %r10 mov %r11, %r14 shl $(32), %r14 mov %r11, %r15 shr $(32), %r15 mov %r11, %rax mov %r11, %rbp xor %rdx, %rdx xor %rcx, %rcx sub %r14, %rax sbb %r15, %rdx sbb %r14, %rcx sbb %r15, %rbp add %rax, %r12 adc %rdx, %r13 adc %rcx, %r8 adc %rbp, %r9 adc $(0), %r10 xor %r11, %r11 movq Lpoly+0(%rip), %rax movq Lpoly+8(%rip), %rdx movq Lpoly+16(%rip), %rbx movq Lpoly+24(%rip), %rcx mov %r12, %rbp mov %r13, %r11 mov %r8, %r14 mov %r9, %r15 sub %rax, %rbp sbb %rdx, %r11 sbb %rbx, %r14 sbb %rcx, %r15 sbb $(0), %r10 cmovnc %rbp, %r12 cmovnc %r11, %r13 cmovnc %r14, %r8 cmovnc %r15, %r9 movq %r12, (%rdi) movq %r13, (8)(%rdi) movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) ret .p2align 5, 0x90 .globl _l9_sm2_mul_montx _l9_sm2_mul_montx: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 mov %rdx, %rbx call sm2_mmulx vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 .globl _l9_sm2_sqr_montl _l9_sm2_sqr_montl: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 movq (%rsi), %rbx movq (8)(%rsi), %rax mul %rbx mov %rax, %r9 mov %rdx, %r10 movq (16)(%rsi), %rax mul %rbx add %rax, %r10 adc $(0), %rdx mov %rdx, %r11 movq (24)(%rsi), %rax mul %rbx add %rax, %r11 adc $(0), %rdx mov %rdx, %r12 movq (8)(%rsi), %rbx movq (16)(%rsi), %rax mul %rbx add %rax, %r11 adc $(0), %rdx mov %rdx, %rbp movq (24)(%rsi), %rax mul %rbx add %rax, %r12 adc $(0), %rdx add %rbp, %r12 adc $(0), %rdx mov %rdx, %r13 movq (16)(%rsi), %rbx movq (24)(%rsi), %rax mul %rbx add %rax, %r13 adc $(0), %rdx mov %rdx, %r14 xor %r15, %r15 shld $(1), %r14, %r15 shld $(1), %r13, %r14 shld $(1), %r12, %r13 shld $(1), %r11, %r12 shld $(1), %r10, %r11 shld $(1), %r9, %r10 shl $(1), %r9 movq (%rsi), %rax mul %rax mov %rax, %r8 add %rdx, %r9 adc $(0), %r10 movq (8)(%rsi), %rax mul %rax add %rax, %r10 adc %rdx, %r11 adc $(0), %r12 movq (16)(%rsi), %rax mul %rax add %rax, %r12 adc %rdx, %r13 adc $(0), %r14 movq (24)(%rsi), %rax mul %rax add %rax, %r14 adc %rdx, %r15 mov %r8, %rax mov %r8, %rcx mov %r8, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r8 shr $(32), %rax sub %r8, %rcx sbb %rax, %rbp sbb %r8, %rbx sbb %rax, %rdx xor %r8, %r8 add %rcx, %r9 adc %rbp, %r10 adc %rbx, %r11 adc %rdx, %r12 adc $(0), %r8 mov %r9, %rax mov %r9, %rcx mov %r9, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r9 shr $(32), %rax sub %r9, %rcx sbb %rax, %rbp sbb %r9, %rbx sbb %rax, %rdx xor %r9, %r9 add %rcx, %r10 adc %rbp, %r11 adc %rbx, %r12 adc %rdx, %r13 adc $(0), %r9 add %r8, %r13 adc $(0), %r9 mov %r10, %rax mov %r10, %rcx mov %r10, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r10 shr $(32), %rax sub %r10, %rcx sbb %rax, %rbp sbb %r10, %rbx sbb %rax, %rdx xor %r10, %r10 add %rcx, %r11 adc %rbp, %r12 adc %rbx, %r13 adc %rdx, %r14 adc $(0), %r10 add %r9, %r14 adc $(0), %r10 mov %r11, %rax mov %r11, %rcx mov %r11, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r11 shr $(32), %rax sub %r11, %rcx sbb %rax, %rbp sbb %r11, %rbx sbb %rax, %rdx xor %r11, %r11 add %rcx, %r12 adc %rbp, %r13 adc %rbx, %r14 adc %rdx, %r15 adc $(0), %r11 add %r10, %r15 adc $(0), %r11 movq Lpoly+0(%rip), %rcx movq Lpoly+8(%rip), %rbp movq Lpoly+16(%rip), %rbx movq Lpoly+24(%rip), %rdx mov %r12, %rax mov %r13, %r8 mov %r14, %r9 mov %r15, %r10 sub %rcx, %rax sbb %rbp, %r8 sbb %rbx, %r9 sbb %rdx, %r10 sbb $(0), %r11 cmovnc %rax, %r12 cmovnc %r8, %r13 cmovnc %r9, %r14 cmovnc %r10, %r15 movq %r12, (%rdi) movq %r13, (8)(%rdi) movq %r14, (16)(%rdi) movq %r15, (24)(%rdi) vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 .globl _l9_sm2_sqr_montx _l9_sm2_sqr_montx: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 movq (%rsi), %rdx mulxq (8)(%rsi), %r9, %r10 mulxq (16)(%rsi), %rcx, %r11 add %rcx, %r10 mulxq (24)(%rsi), %rcx, %r12 adc %rcx, %r11 adc $(0), %r12 movq (8)(%rsi), %rdx xor %r13, %r13 mulxq (16)(%rsi), %rcx, %rbp adcx %rcx, %r11 adox %rbp, %r12 mulxq (24)(%rsi), %rcx, %rbp adcx %rcx, %r12 adox %rbp, %r13 adc $(0), %r13 movq (16)(%rsi), %rdx mulxq (24)(%rsi), %rcx, %r14 add %rcx, %r13 adc $(0), %r14 xor %r15, %r15 shld $(1), %r14, %r15 shld $(1), %r13, %r14 shld $(1), %r12, %r13 shld $(1), %r11, %r12 shld $(1), %r10, %r11 shld $(1), %r9, %r10 shl $(1), %r9 xor %r8, %r8 movq (%rsi), %rdx mulx %rdx, %r8, %rbp adcx %rbp, %r9 movq (8)(%rsi), %rdx mulx %rdx, %rcx, %rbp adcx %rcx, %r10 adcx %rbp, %r11 movq (16)(%rsi), %rdx mulx %rdx, %rcx, %rbp adcx %rcx, %r12 adcx %rbp, %r13 movq (24)(%rsi), %rdx mulx %rdx, %rcx, %rbp adcx %rcx, %r14 adcx %rbp, %r15 mov %r8, %rax mov %r8, %rcx mov %r8, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r8 shr $(32), %rax sub %r8, %rcx sbb %rax, %rbp sbb %r8, %rbx sbb %rax, %rdx xor %r8, %r8 add %rcx, %r9 adc %rbp, %r10 adc %rbx, %r11 adc %rdx, %r12 adc $(0), %r8 mov %r9, %rax mov %r9, %rcx mov %r9, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r9 shr $(32), %rax sub %r9, %rcx sbb %rax, %rbp sbb %r9, %rbx sbb %rax, %rdx xor %r9, %r9 add %rcx, %r10 adc %rbp, %r11 adc %rbx, %r12 adc %rdx, %r13 adc $(0), %r9 add %r8, %r13 adc $(0), %r9 mov %r10, %rax mov %r10, %rcx mov %r10, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r10 shr $(32), %rax sub %r10, %rcx sbb %rax, %rbp sbb %r10, %rbx sbb %rax, %rdx xor %r10, %r10 add %rcx, %r11 adc %rbp, %r12 adc %rbx, %r13 adc %rdx, %r14 adc $(0), %r10 add %r9, %r14 adc $(0), %r10 mov %r11, %rax mov %r11, %rcx mov %r11, %rdx xor %rbp, %rbp xor %rbx, %rbx shl $(32), %r11 shr $(32), %rax sub %r11, %rcx sbb %rax, %rbp sbb %r11, %rbx sbb %rax, %rdx xor %r11, %r11 add %rcx, %r12 adc %rbp, %r13 adc %rbx, %r14 adc %rdx, %r15 adc $(0), %r11 add %r10, %r15 adc $(0), %r11 movq Lpoly+0(%rip), %rcx movq Lpoly+8(%rip), %rbp movq Lpoly+16(%rip), %rbx movq Lpoly+24(%rip), %rdx mov %r12, %rax mov %r13, %r8 mov %r14, %r9 mov %r15, %r10 sub %rcx, %rax sbb %rbp, %r8 sbb %rbx, %r9 sbb %rdx, %r10 sbb $(0), %r11 cmovnc %rax, %r12 cmovnc %r8, %r13 cmovnc %r9, %r14 cmovnc %r10, %r15 movq %r12, (%rdi) movq %r13, (8)(%rdi) movq %r14, (16)(%rdi) movq %r15, (24)(%rdi) vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 .globl _l9_sm2_mont_back _l9_sm2_mont_back: push %rbp push %rbx push %r12 push %r13 push %r14 push %r15 movq (%rsi), %r10 movq (8)(%rsi), %r11 movq (16)(%rsi), %r12 movq (24)(%rsi), %r13 xor %r8, %r8 xor %r9, %r9 mov %r10, %r14 shl $(32), %r14 mov %r10, %r15 shr $(32), %r15 mov %r10, %rcx mov %r10, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r11 adc %rbp, %r12 adc %rdx, %r13 adc %rax, %r8 adc $(0), %r9 xor %r10, %r10 mov %r11, %r14 shl $(32), %r14 mov %r11, %r15 shr $(32), %r15 mov %r11, %rcx mov %r11, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r12 adc %rbp, %r13 adc %rdx, %r8 adc %rax, %r9 adc $(0), %r10 xor %r11, %r11 mov %r12, %r14 shl $(32), %r14 mov %r12, %r15 shr $(32), %r15 mov %r12, %rcx mov %r12, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r13 adc %rbp, %r8 adc %rdx, %r9 adc %rax, %r10 adc $(0), %r11 xor %r12, %r12 mov %r13, %r14 shl $(32), %r14 mov %r13, %r15 shr $(32), %r15 mov %r13, %rcx mov %r13, %rax xor %rbp, %rbp xor %rdx, %rdx sub %r14, %rcx sbb %r15, %rbp sbb %r14, %rdx sbb %r15, %rax add %rcx, %r8 adc %rbp, %r9 adc %rdx, %r10 adc %rax, %r11 adc $(0), %r12 xor %r13, %r13 mov %r8, %rcx mov %r9, %rbp mov %r10, %rbx mov %r11, %rdx subq Lpoly+0(%rip), %rcx sbbq Lpoly+8(%rip), %rbp sbbq Lpoly+16(%rip), %rbx sbbq Lpoly+24(%rip), %rdx sbb $(0), %r12 cmovnc %rcx, %r8 cmovnc %rbp, %r9 cmovnc %rbx, %r10 cmovnc %rdx, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret .p2align 5, 0x90 .globl _l9_sm2_select_pp_w5 _l9_sm2_select_pp_w5: push %r12 push %r13 movdqa LOne(%rip), %xmm0 movdqa %xmm0, %xmm8 movd %edx, %xmm1 pshufd $(0), %xmm1, %xmm1 pxor %xmm2, %xmm2 pxor %xmm3, %xmm3 pxor %xmm4, %xmm4 pxor %xmm5, %xmm5 pxor %xmm6, %xmm6 pxor %xmm7, %xmm7 mov $(16), %rcx .Lselect_loop_sse_w5gas_13: movdqa %xmm8, %xmm15 pcmpeqd %xmm1, %xmm15 paddd %xmm0, %xmm8 movdqa (%rsi), %xmm9 movdqa (16)(%rsi), %xmm10 movdqa (32)(%rsi), %xmm11 movdqa (48)(%rsi), %xmm12 movdqa (64)(%rsi), %xmm13 movdqa (80)(%rsi), %xmm14 add $(96), %rsi pand %xmm15, %xmm9 pand %xmm15, %xmm10 pand %xmm15, %xmm11 pand %xmm15, %xmm12 pand %xmm15, %xmm13 pand %xmm15, %xmm14 por %xmm9, %xmm2 por %xmm10, %xmm3 por %xmm11, %xmm4 por %xmm12, %xmm5 por %xmm13, %xmm6 por %xmm14, %xmm7 dec %rcx jnz .Lselect_loop_sse_w5gas_13 movdqu %xmm2, (%rdi) movdqu %xmm3, (16)(%rdi) movdqu %xmm4, (32)(%rdi) movdqu %xmm5, (48)(%rdi) movdqu %xmm6, (64)(%rdi) movdqu %xmm7, (80)(%rdi) vzeroupper pop %r13 pop %r12 ret
; A210677: a(n)=a(n-1)+a(n-2)+n+1, a(0)=a(1)=1. ; 1,1,5,10,20,36,63,107,179,296,486,794,1293,2101,3409,5526,8952,14496,23467,37983,61471,99476,160970,260470,421465,681961,1103453,1785442,2888924,4674396,7563351,12237779,19801163,32038976,51840174,83879186,135719397,219598621,355318057 mov $2,$0 add $2,1 mov $5,$0 lpb $2,1 mov $0,$5 sub $2,1 sub $0,$2 mov $9,$0 mov $11,2 lpb $11,1 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mov $4,0 mov $7,1 trn $7,$8 lpb $0,1 sub $0,1 mov $6,1 add $7,5 mov $8,$4 add $4,$7 add $6,$8 mov $7,$6 lpe add $6,$7 add $6,2 mov $3,$6 add $3,2 mov $4,$3 mov $8,7 mov $12,$11 lpb $12,1 mov $10,$4 sub $12,1 lpe lpe lpb $9,1 mov $9,0 sub $10,$4 lpe mov $4,$10 trn $4,2 div $4,2 add $1,$4 lpe
; float ldexp(float x, int exp) __z88dk_callee SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sdccix_ldexp_callee, l0_cm48_sdccix_ldexp_callee EXTERN cm48_sdccixp_d2m48, am48_ldexp, cm48_sdccixp_m482d cm48_sdccix_ldexp_callee: pop af pop de pop hl ; hlde'= float x exx pop hl ; hl = exp push af l0_cm48_sdccix_ldexp_callee: exx call cm48_sdccixp_d2m48 call am48_ldexp jp cm48_sdccixp_m482d
global _start ; String routines global _sprint ; Int16 routines ; Float routines global _f2s_scientific ; ; BSS and DATA sections ; section .bss ; Floating point number printing buffer fsbuffer: resb 256 section .data ; debug stuff ftest: db 0x3D,0x00,0x00,0x00,0x04,0x00,0x00,0x71 stest: db 0x0C,'Ana are mere' section .text ; ; STRING OPERATIONS ; ; Print a CBASIC string ; Structure of string: ; str[0] = length (0..255) ; str[1..str[0]] = actual string ; Param1: pointer to string (stack) ; Returns: always zero _sprint: ; Get string address mov ecx, dword [esp+4] ; Get string size mov eax, 0 mov al, byte [ecx] cmp eax, 0 jz .exit ; Kernel write mov edx, eax ; character count mov eax, 4 ; sys_write mov ebx, 1 ; stdout inc ecx ; pointer+1 int 0x80 .exit: ; All ok mov eax, 0 ret ; ; 16BIT INTEGER NUMBER OPERATIONS ; ; Inline convert a 16bit integer into string ; Word is in AX ; String pointer is in ECX; function alters ECX accordingly ; Function will mess up AX, BX, DX and DI _inline_w2s: ; Print sign mov bx, ax and bx, 0x8000 jz .print_digits mov bl, '-' mov [ecx], byte bl inc ecx neg ax .print_digits: ; Initialize context for digits mov bx, 10000 ; upper range divisor mov di, 0 ; flag for first non-zero encountered .loop: mov dx, 0 ; ax = ax / bx; dx = ax % bx idiv bx ; check if first non-zero encountered or di, ax jnz .write_digit ; Skip over digit ; bx = bx / 10 mov ax, bx mov bx, dx mov dx, 0 mov di, 10 idiv di mov dx, bx mov bx, ax mov ax, dx mov di, 0 cmp bx, 0 jnz .loop ; This falls trough if all digits are zero and prints just one zero .write_digit: ; Write digit (assume ax < 10) add al, 0x30 mov [ecx], byte al inc ecx ; bx = bx / 10 mov ax, bx mov bx, dx mov dx, 0 mov di, 10 ; from now on it will always jump to .write_digit idiv di mov dx, bx mov bx, ax mov ax, dx ; Loop cmp bx, 0 jnz .loop ret ; ; FLOATING POINT NUMBERS OPERATIONS ; ; Print a CBASIC floating point number ; Param1: 8byte floating point number (stack) ; Returns: error code of _f2s _fprint: ; Fetch float mov eax, dword [esp+4] mov ebx, dword [esp+8] ; Convert to string push dword fsbuffer push ebx push eax call _f2s add esp, 12 cmp eax, 0 jnz .end ; Print string push dword fsbuffer call _sprint add esp, 4 mov eax, 0 .end: ret ; Print a CBASIC floating point number (scientific format) ; Param1: 8byte floating point number (stack) ; Returns: error code of _f2s_scientific _fprint_scientific: ; Fetch float mov eax, dword [esp+4] mov ebx, dword [esp+8] ; Convert to string push dword fsbuffer push ebx push eax call _f2s_scientific add esp, 12 cmp eax, 0 jnz .end ; Print string push dword fsbuffer call _sprint add esp, 4 mov eax, 0 .end: ret ; Convert a CBASIC floating point number to a string ; Param1: 8byte floating point number (stack) ; Param2: address to string buffer (stack) ; Returns: 0 on success, 1 on failure _f2s: ; Clear EAX ; AL = buffer for digits mov eax, 0 ; String iterator mov ecx, dword [esp+12] ; 4 (eip) + 8 (param1) mov [ecx], byte 0 ; initialize size to zero (in case of error) inc ecx ; skip size byte ; Float reverse iterator mov edx, esp add edx, 11 ; last byte of param1 ; EDI will hold pointer in string to last non-zero digit after first two digits ; Initialize in case of shitstorm mov edi, ecx ; Print sign mov al, byte [esp+4] test al, 0x80 jz .fetch_exp mov al, '-' mov [ecx], al inc ecx .fetch_exp: and al, 0x7F mov ebx, eax sub ebx, 0x40 .leading_zeros: ; E-? case, print leading zeros test ebx, ebx jns .loop mov al, 0x30 mov [ecx], byte al inc ecx inc ebx jmp .leading_zeros .loop: ; Fetch byte mov al, byte [edx] test ebx, 0x1 jz .check_range shr al, 4 dec edx .check_range: and al, 0xF ; Check 0-9 range cmp al, 9 ;jg .error ; Print digit add al, 0x30 ; '0' + al mov [ecx], byte al inc ecx ; Print dot after first digit cmp ebx, 0 jnz .fractional_part mov [ecx], byte '.' inc ecx mov edi, ecx jmp .loop_next .fractional_part: cmp ebx, 1 jz .save_digit_as_nonzero ; If digit is non-zero, save ECX as last true non-zero digit sub al, 0x30 jz .loop_next .save_digit_as_nonzero: mov edi, ecx .loop_next: ; Advance and loop inc ebx cmp ebx, 14 jnz .loop ; Re-initialize ECX ;mov ecx, edi ; Put string size mov eax, ecx mov ecx, dword [esp+12] sub eax, ecx dec eax mov [ecx], al ; All ok mov eax, 0 ret .error: ; An error occured mov eax, 1 ret ; Convert a CBASIC floating point number to a string (scientific format) ; Param1: 8byte floating point number (stack) ; Param2: address to string buffer (stack) ; Returns: 0 on success, 1 on failure _f2s_scientific: ; Clear EAX ; AL = buffer for digits mov eax, 0 ; Current digit mov ebx, 0 ; String iterator mov ecx, dword [esp+12] ; 4 (eip) + 8 (param1) mov [ecx], byte 0 ; initialize size to zero (in case of error) inc ecx ; skip size byte ; Float reverse iterator mov edx, esp add edx, 11 ; last byte of param1 ; EDI will hold pointer in string to last non-zero digit after first two digits ; Initialize in case of shitstorm mov edi, ecx ; Print sign mov al, byte [esp+4] and al, 0x80 jz .loop mov al, '-' mov [ecx], al inc ecx .loop: ; Fetch byte mov al, byte [edx] test ebx, 0x1 jz .check_range shr al, 4 dec edx .check_range: and al, 0xF ; Check 0-9 range cmp al, 9 jg .error ; Print digit add al, 0x30 ; '0' + al mov [ecx], byte al inc ecx ; Print dot after first digit cmp ebx, 0 jnz .fractional_part mov [ecx], byte '.' inc ecx mov edi, ecx jmp .loop_next .fractional_part: cmp ebx, 1 jz .save_digit_as_nonzero ; If digit is non-zero, save ECX as last true non-zero digit sub al, 0x30 jz .loop_next .save_digit_as_nonzero: mov edi, ecx .loop_next: ; Advance and loop inc ebx cmp ebx, 14 jnz .loop ; Re-initialize ECX mov ecx, edi ; Print E mov [ecx], byte 'E' inc ecx ; Extract exponent mov eax, 0 mov al, [esp+4] ; MSB of float and al, 0x7F ; ignore sign sub ax, 0x40 ; normalize excess64 ; Print exponent call _inline_w2s ; Put string size mov eax, ecx mov ecx, dword [esp+12] sub eax, ecx dec eax mov [ecx], al ; All ok mov eax, 0 ret .error: ; An error occured mov eax, 1 ret _start: ; Wrint float push dword [ftest+4] push dword [ftest] call _fprint add esp, 8 mov ebx, 0 mov eax, 1 int 0x80
$NOMOD51 ; ; *** <<< Use Configuration Wizard in Context Menu >>> *** ;------------------------------------------------------------------------------ ; Startu32.a51 ; ; Version: ; September 2004 Version 0.7 - Removed code that disables the DDC SRAM as it is ; disabled by default upon reset. ; July 2004 Version 0.6 - Comments edited, added note about DDC SRAM related to ; date code. ; June 2004 Version 0.5 - Comments edited, code to disable DDC SRAM corrected. ; March 2005 Version 0.6 - Added comments for Keil Configuration Wizard ; Dependencies: None ; ; ; Description: ; This code is executed after a reset. Besides the usual C51 startup ; settings, other uPSD Turbo initializations can be added here. When ; the startup code execution is complete, this code jumps to C_START that is ; typically the main() function in the C code. ; ; Notes: ; - Watchdog timer is disabled - should be enabled at beginning of user's code ; - DDC and its RAM is disabled ; - Various IP prescalers are set to large values (lowers power consumption) ; The IP device drivers must initialize the prescalers appropriately. ; ; Copyright (c) 2004 STMicroelectronics Inc. ; ; This example demo code is provided as is and has no warranty, ; implied or otherwise. You are free to use/modify any of the provided ; code at your own risk in your applications with the expressed limitation ; of liability (see below) so long as your product using the code contains ; at least one uPSD product (device). ; ; LIMITATION OF LIABILITY: NEITHER STMicroelectronics NOR ITS VENDORS OR ; AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, ; INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR ; CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR ; OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ;------------------------------------------------------------------------------ ; User-defined <h> Power-On Initialization of Memory (Clear Memory) ; ; With the following EQU statements the initialization of memory ; at processor reset can be defined: ; ; the absolute start-address of IDATA memory is always 0 ; <o> IDATALEN: IDATA memory size <0x0-0x1FF> ; <i> Note: The absolute start address of IDATA memory is always 0 ; <i> The IDATA space overlaps physically the DATA and BIT areas. IDATALEN EQU 100H ; the length of IDATA memory in bytes. ; *** NOTE: uPSD users need to fill in the following based on where SRAM memory mapped. ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF> ; <i> The absolute start address of XDATA memory ; <i> *** NOTE: uPSD users need to fill this in based on where SRAM memory mapped. XDATASTART EQU 0 ; ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF> ; <i> The length of XDATA memory in bytes. ; <i> *** NOTE: uPSD users need to fill this in based on where SRAM memory mapped. XDATALEN EQU 0 ; ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF> ; <i> The absolute start address of PDATA memory ; <i> *** NOTE: uPSD users need to fill this in based on where SRAM memory mapped. PDATASTART EQU 0H ; ; <o> PDATALEN: PDATA memory size <0x0-0xFF> ; <i> The length of PDATA memory in bytes. ; <i> *** NOTE: uPSD users need to fill this in based on where SRAM memory mapped. PDATALEN EQU 0H ; ;</h> ; Notes: The IDATA space overlaps physically the DATA and BIT areas of the ; 8051 CPU. At minimum the memory space occupied from the C51 ; run-time routines must be set to zero. ;------------------------------------------------------------------------------ ; ;<h> Reentrant Stack Initialization ; ; The following EQU statements define the stack pointer for reentrant ; functions and initialized it: ; ; <h> Stack Space for reentrant functions in the SMALL model. ; <q> IBPSTACK: Enable SMALL model reentrant stack ; <i> Stack space for reentrant functions in the SMALL model. IBPSTACK EQU 0 ; set to 1 if small reentrant is used. ; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF> ; <i> Set the top of the stack to the highest location. IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1 ; </h> ; ; <h> Stack Space for reentrant functions in the LARGE model. ; <q> XBPSTACK: Enable LARGE model reentrant stack ; <i> Stack space for reentrant functions in the LARGE model. XBPSTACK EQU 0 ; set to 1 if large reentrant is used. ; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF> ; <i> Set the top of the stack to the highest location. XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1 ; </h> ; ; <h> Stack Space for reentrant functions in the COMPACT model. ; <q> PBPSTACK: Enable COMPACT model reentrant stack ; <i> Stack space for reentrant functions in the COMPACT model. PBPSTACK EQU 0 ; set to 1 if compact reentrant is used. ; ; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF> ; <i> Set the top of the stack to the highest location. PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1 ; </h> ;</h> ;------------------------------------------------------------------------------ ; ; Page Definition for Using the Compact Model with 64 KByte xdata RAM ; ; The following EQU statements define the xdata page used for pdata ; variables. The EQU PPAGE must conform with the PPAGE control used ; in the linker invocation. ; ;<e> PPAGEENABLE: Compact Model Page Definition ; <i>Define the XDATA page used for PDATA variables. ; <i>PPAGE must conform with the PPAGE set in the linker invocation. ; ; Enable pdata memory page initalization PPAGEENABLE EQU 0 ; set to 1 if pdata object are used. ; ; <o> PPAGE: PDATA Page number <0x0-0xFF> ; <i> Uppermost 256-byte address of the page used for pdata variables. PPAGE EQU 0 ; define PPAGE number. ; ; <o> PPAGE_SFR: SFR address containing PPAGE value <0x0-0xFF> ; <i> NOTE: Most 8051 variants use P2 as uppermost address byte. PPAGE_SFR DATA 0A0H ; ;</e> ;------------------------------------------------------------------------------ ; Standard SFR Symbols ACC DATA 0E0H B DATA 0F0H SP DATA 81H DPL DATA 82H DPH DATA 83H WDKEY DATA 0AEH ASCL DATA 095H PSCL0L DATA 0B1H PSCL0H DATA 0B2H PSCL1L DATA 0B3H PSCL1H DATA 0B4H USCL DATA 0E1H DDCCON DATA 0D7H S1CON DATA 0D8H NAME ?C_STARTUP ?C_C51STARTUP SEGMENT CODE ?STACK SEGMENT IDATA RSEG ?STACK DS 1 EXTRN CODE (?C_START) PUBLIC ?C_STARTUP CSEG AT 0 ?C_STARTUP: LJMP STARTUP1 RSEG ?C_C51STARTUP STARTUP1: ; uPSD specific initialization MOV A, #0FEH ; Load pre-scalars with large value MOV ASCL, A ; Slow down ADC Logic MOV PSCL0L, A ; Slow down PWM Logic MOV PSCL0H, A MOV PSCL1L, A MOV PSCL1H, A MOV USCL, A ; Slow down USB Logic MOV A, #055H ; Disable Watch Dog Reset MOV WDKEY, A IF IDATALEN <> 0 MOV R0,#IDATALEN - 1 CLR A IDATALOOP: MOV @R0,A DJNZ R0,IDATALOOP ENDIF IF XDATALEN <> 0 MOV DPTR,#XDATASTART MOV R7,#LOW (XDATALEN) IF (LOW (XDATALEN)) <> 0 MOV R6,#(HIGH (XDATALEN)) +1 ELSE MOV R6,#HIGH (XDATALEN) ENDIF CLR A XDATALOOP: MOVX @DPTR,A INC DPTR DJNZ R7,XDATALOOP DJNZ R6,XDATALOOP ENDIF IF PPAGEENABLE <> 0 MOV PPAGE_SFR,#PPAGE ENDIF IF PDATALEN <> 0 MOV R0,#LOW (PDATASTART) MOV R7,#LOW (PDATALEN) CLR A PDATALOOP: MOVX @R0,A INC R0 DJNZ R7,PDATALOOP ENDIF IF IBPSTACK <> 0 EXTRN DATA (?C_IBP) MOV ?C_IBP,#LOW IBPSTACKTOP ENDIF IF XBPSTACK <> 0 EXTRN DATA (?C_XBP) MOV ?C_XBP,#HIGH XBPSTACKTOP MOV ?C_XBP+1,#LOW XBPSTACKTOP ENDIF IF PBPSTACK <> 0 EXTRN DATA (?C_PBP) MOV ?C_PBP,#LOW PBPSTACKTOP ENDIF MOV SP,#?STACK-1 ; This code is required if you use L51_BANK.A51 with Banking Mode 4 ;<h> Code Banking ; <q> Select Bank 0 for L51_BANK.A51 Mode 4 #if 0 ; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4. EXTRN CODE (?B_SWITCH0) CALL ?B_SWITCH0 ; init bank mechanism to code bank 0 #endif ;</h> LJMP ?C_START END
/* * MMM"""AMV db `7MM"""Yp, * M' AMV ;MM: MM Yb * ' AMV ,V^MM. MM dP * AMV ,M `MM MM"""bg. * AMV , AbmmmqMA MM `Y * AMV ,M A' VML MM ,9 * AMVmmmmMM .AMA. .AMMA..JMMmmmd9 * * * MIT License * * Copyright (c) 2021 Donald-Rupin * * 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. * * * @file tcp_strean.hpp * */ #ifndef ZAB_TCP_STREAM_HPP_ #define ZAB_TCP_STREAM_HPP_ #include <cstdint> #include <limits> #include <memory> #include <span> #include <stdint.h> #include "zab/async_function.hpp" #include "zab/async_mutex.hpp" #include "zab/defer_block_promise.hpp" #include "zab/engine_enabled.hpp" #include "zab/event_loop.hpp" #include "zab/memory_type.hpp" #include "zab/network_operation.hpp" #include "zab/simple_future.hpp" #include "zab/stateful_awaitable.hpp" #include "zab/strong_types.hpp" namespace zab { /** * @brief This class represents the a duplex network stream for writing and reading * data. * * @tparam DataType The MemoryType this stream reads and writes. */ template <MemoryType DataType = std::byte> class tcp_stream { public: using net_op = network_operation::net_op; /** * @brief The maximum a write_some operation will write to a stream. * */ static constexpr auto kMaxWrite = std::numeric_limits<std::uint16_t>::max(); /** * @brief The maximum a read_some operation will write to a stream. * */ static constexpr auto kMaxRead = std::numeric_limits<int>::max() - 2; /** * @brief Construct a tcp stream object in an empty state. * * @details Using this object from this constructor is undefined behaviour * unless you are writing to it via a swap, a move or move assignment. */ tcp_stream() : write_cancel_(nullptr) { } /** * @brief Construct a new tcp stream object associated with a engine and an socket * descriptor. * * @details This interface assumes the socket was created in blocking mode. * * @param _engine The engine to used. * @param _fd The socket to used. */ tcp_stream(engine* _engine, int _fd) : net_op_(_engine, _fd), write_cancel_(nullptr) { } /** * @brief There is no copy constructor for a tcp_stream. * */ tcp_stream(const tcp_stream&) = delete; /** * @brief Construct a new tcp stream object by swapping the resources owned by * _move. * * @param _move The tcp stream to move. */ tcp_stream(tcp_stream&& _move) : tcp_stream() { swap(*this, _move); } /** * @brief Destroy the tcp stream object. * * @details It is far more efficient to manually shutdown, cancel reads and writes * and close the socket before the object is deconstructed. Failure to do so * will spawn background fibres to do this in the background. * * We first try to cancel any pending writes in the background. * The clear any errors from the socket. * * The deconstruction of net_op_ will cancel any pending reads * and close the socket in the background. * */ ~tcp_stream() { if (write_cancel_) { background_cancel_write(); } if (net_op_.descriptor()) { /* Clear any errors. */ int result; socklen_t result_len = sizeof(result); ::getsockopt( net_op_.descriptor(), SOL_SOCKET, SO_ERROR, (char*) &result, &result_len); } } /** * @brief Swaps two tcp streams. * * @tparam DT1 The memory type of the first one. * @tparam DT2 The memory type of the second one. * @param _first The first stream. * @param _second The second stream. */ template <MemoryType DT1, MemoryType DT2> friend void swap(tcp_stream<DT1>& _first, tcp_stream<DT2>& _second) noexcept { using std::swap; swap(_first.net_op_, _second.net_op_); swap(_first.write_cancel_, _second.write_cancel_); } /** * @brief Swaps two tcp streams. * * @tparam DT1 The memory type of the first one. * @param _first The first stream. * @param _second The second stream. */ template <MemoryType DT1> friend void swap(tcp_stream<DT1>& _first, tcp_stream<DT1>& _second) noexcept { using std::swap; swap(_first.net_op_, _second.net_op_); swap(_first.write_cancel_, _second.write_cancel_); } /** * @brief Move operator for a tcp stream. This will just swap to two streams. * * @param tcp_stream The stream to swap. * @return tcp_stream& this. */ tcp_stream& operator=(tcp_stream&& tcp_stream) { swap(*this, tcp_stream); return *this; } /** * @brief Rebinds the memory type of the stream via a swap. * * @tparam DT1 The memory type of the resulting stream. * @tparam DT2 The memory type of the resulting to swap. * @param _other The stream to rebind. * @return tcp_stream<DT1> The newly typed stream. */ template <MemoryType DT1, MemoryType DT2> friend tcp_stream<DT1> rebind(tcp_stream<DT2>& _other) { tcp_stream<DT1> new_stream; swap(new_stream, _other); return new_stream; } /** * @brief Get the underlying socket descriptor. * * @return int */ [[nodiscard]] inline int descriptor() const noexcept { return net_op_.descriptor(); } /** * @brief Get the last error. * * @details This clears the error. * * @return int */ [[nodiscard]] inline int last_error() noexcept { return net_op_.last_error(); } /** * @brief Set the error for the stream. * * @param _error The error to set for the stream. */ inline void set_error(int _error) noexcept { net_op_.set_error(_error); } /** * @brief Attempt to cancel the current read operation. * * @details This function only suspends if there is a pending read operation. * * @co_return void Resumes after cancelation. */ [[nodiscard]] auto cancel_read() noexcept { return net_op_.cancel(); } /** * @brief Attempt to cancel the current write operation. * * @details This function only suspends if there is a pending write operation. * * @co_return void Resumes after cancelation. */ [[nodiscard]] auto cancel_write() noexcept { return network_operation::cancel(net_op_.get_engine(), write_cancel_); } /** * @brief Attempt to close the socket. * * @details This function only suspends if there is a socket to close. * * @co_return true The socket was successfully closed. * @co_return false The socket failed to close. * */ [[nodiscard]] auto close() noexcept { /* Clear any errors. */ int result; socklen_t result_len = sizeof(result); ::getsockopt( net_op_.descriptor(), SOL_SOCKET, SO_ERROR, (char*) &result, &result_len); return net_op_.close(); } /** * @brief Shutdown the stream by cancelling any pending operations and signalling * shutdown. * * @co_return void on shutdown completion. */ [[nodiscard]] simple_future<> shutdown() noexcept { co_await cancel_read(); co_await cancel_write(); /* Intiate shut down */ if (::shutdown(net_op_.descriptor(), SHUT_WR) != -1) { /* Attempt to deplete read buffer and wait for client to ack */ std::vector<DataType> data(1028); for (int i = 0; i < 5; ++i) { auto res = co_await read_some(data); if (res <= 0) { /* Error or 0 is good here */ break; } } } } /** * @brief Attempt to read up to `_data.size() - _offset` bytes into the span at the * given offset. * * @details If _data.size() - _offset is larger then kMaxRead, then kMaxRead is used as * the max. * * @param _data The buffer to read into. * @param _offset The offset from where to start reading in. * @param _flags Any flags to pass to recv. * @co_return int The amount of bytes read or -1 if an error occurred. */ [[nodiscard]] auto read_some(std::span<DataType> _data, size_t _offset = 0, int _flags = 0) noexcept { return suspension_point( [this, ret = net_op{}, _data, _offset, _flags]<typename T>( T _handle) mutable noexcept { if constexpr (is_ready<T>()) { return !_data.size(); } else if constexpr (is_suspend<T>()) { auto amount_to_read = std::min<std::size_t>(_data.size() - _offset, kMaxRead); ret.handle_ = _handle; net_op_.set_cancel(&ret); net_op_.get_engine()->get_event_loop().recv( &ret, net_op_.descriptor(), std::span<std::byte>( (std::byte*) _data.data() + _offset, amount_to_read), _flags); } else if constexpr (is_resume<T>()) { net_op_.clear_cancel(); if (ret.result_ > 0) { return ret.result_; } else { net_op_.set_error(-ret.result_); return -1; } } }); } /** * @brief Attempts to `_data.size() - _offset` bytes into the span at the given * offset. Blocks until the amount is read, a signal interupts the call or an * error occurs. * * @details If _data.size() - _offset is larger then kMaxRead, then kMaxRead is used as * the max. * * * @param _data The buffer to read into. * @param _offset The offset from where to start reading in. * @param _flags Any flags to pass to recv. * @co_return long long The amount of bytes read. */ [[nodiscard]] auto read(std::span<DataType> _data, size_t _offset = 0, int _flags = 0) noexcept { return stateful_suspension_point<int>( [this, so_far = 0ll, _data, _offset, _flags]<typename T>( T _handle) mutable noexcept { if constexpr (is_ready<T>()) { return so_far == (ssize_t) _data.size(); } if constexpr (is_notify<int, T>()) { if (_handle > 0) { so_far += _handle; return notify_ctl::kReady; } else { net_op_.set_error(-_handle); return notify_ctl::kResume; } } else if constexpr (is_stateful_suspend<int, T>()) { auto amount_to_read = std::min<std::size_t>(_data.size() - so_far - _offset, kMaxRead); net_op_.set_cancel(_handle); net_op_.get_engine()->get_event_loop().recv( _handle, net_op_.descriptor(), std::span<std::byte>( (std::byte*) _data.data() + so_far + _offset, amount_to_read), _flags | MSG_WAITALL); } else if constexpr (is_resume<T>()) { net_op_.clear_cancel(); if (so_far > 0) { return so_far; } else { return -1ll; } } }); } /** * @brief Attempt to write up to `_data.size() - _offset` bytes from the span at the * given offset. * * @details If _data.size() - _offset is larger then kMaxWrite, then kMaxWrite is used * as the max. * * @param _data The buffer to write from. * @param _offset The offset from where to start writing from. * @param _flags Any flags to pass to send. MSG_NOSIGNAL is always set additionally. * @co_return int The amount of bytes written or -1 if an error occurred. */ [[nodiscard]] auto write_some( std::span<const DataType> _data, size_t _offset = 0, int _flags = MSG_NOSIGNAL) noexcept { return suspension_point( [this, ret = net_op{}, _data, _offset, _flags]<typename T>( T _handle) mutable noexcept { if constexpr (is_ready<T>()) { return !_data.size(); } else if constexpr (is_suspend<T>()) { auto amount_to_write = std::min<std::size_t>(_data.size() - _offset, kMaxWrite); ret.handle_ = _handle; write_cancel_ = &ret; net_op_.get_engine()->get_event_loop().send( &ret, net_op_.descriptor(), std::span<std::byte>( (std::byte*) _data.data() + _offset, amount_to_write), _flags); } else if constexpr (is_resume<T>()) { write_cancel_ = nullptr; if (ret.result_ > 0) { return ret.result_; } else { net_op_.set_error(-ret.result_); return -1; } } }); } /** * @brief Attempt to write up to `_data.size() - _offset` bytes from the span at the * given offset. Blocks until the amount is written or an error occurs. * * @details If _data.size() - _offset is larger then kMaxWrite, then kMaxWrite is used * as the max. * * Coroutine chaining can be expensive exspecially if the call to `write()` is * within a hotpath. As such, if the writing is not in a hotpath or are in not * performance critical parts of the program `write()` is encrouaged for * readability an maintainabilty. Otherwise authors are encoruged to use * write_some and handle their own logic for when the incorrect amount is * written. * * @param _data The buffer to write from. * @param _offset The offset from where to start writing from. * @param _flags Any flags to pass to send. MSG_NOSIGNAL is always set additionaly. * @co_return long long The amount of bytes written. */ [[nodiscard]] auto write( std::span<const DataType> _data, size_t _offset = 0, int _flags = MSG_NOSIGNAL) noexcept { return stateful_suspension_point<int>( [this, so_far = 0ll, _data, _offset, _flags]<typename T>( T _handle) mutable noexcept { if constexpr (is_ready<T>()) { return so_far == (ssize_t) _data.size(); } if constexpr (is_notify<int, T>()) { if (_handle > 0) { so_far += _handle; return notify_ctl::kReady; } else { net_op_.set_error(-_handle); return notify_ctl::kResume; } } else if constexpr (is_stateful_suspend<int, T>()) { auto amount_to_write = std::min<std::size_t>(_data.size() - so_far - _offset, kMaxRead); write_cancel_ = _handle; net_op_.get_engine()->get_event_loop().send( _handle, net_op_.descriptor(), std::span<std::byte>( (std::byte*) _data.data() + _offset + so_far, amount_to_write), _flags); } else if constexpr (is_resume<T>()) { write_cancel_ = nullptr; if (so_far > 0) { return so_far; } else { return -1ll; } } }); } private: /** * @brief Cancel any pending writes in the background. * * @return async_function<> */ async_function<> background_cancel_write() { co_await cancel_write(); } network_operation net_op_; net_op* write_cancel_; }; } // namespace zab #endif /* ZAB_TCP_STREAM_HPP_ */
dnl AMD64 mpn_addmul_1 and mpn_submul_1 for CPUs with mulx. dnl Copyright 2012, 2013 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C AMD K8,K9 - C AMD K10 - C AMD bd1 - C AMD bd2 ? C AMD bobcat - C AMD jaguar ? C Intel P4 - C Intel PNR - C Intel NHM - C Intel SBR - C Intel HWL ? C Intel BWL ? C Intel atom - C VIA nano - define(`rp', `%rdi') C rcx define(`up', `%rsi') C rdx define(`n_param', `%rdx') C r8 define(`v0_param',`%rcx') C r9 define(`n', `%rcx') define(`v0', `%rdx') ifdef(`OPERATION_addmul_1',` define(`ADDSUB', `add') define(`ADCSBB', `adc') define(`func', `mpn_addmul_1') ') ifdef(`OPERATION_submul_1',` define(`ADDSUB', `sub') define(`ADCSBB', `sbb') define(`func', `mpn_submul_1') ') MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1) IFDOS(` define(`up', ``%rsi'') ') dnl IFDOS(` define(`rp', ``%rcx'') ') dnl IFDOS(` define(`vl', ``%r9'') ') dnl IFDOS(` define(`r9', ``rdi'') ') dnl IFDOS(` define(`n', ``%r8'') ') dnl IFDOS(` define(`r8', ``r11'') ') dnl ASM_START() TEXT ALIGN(16) PROLOGUE(func) mov (up), %r8 push %rbx push %r12 push %r13 lea (up,n_param,8), up lea -32(rp,n_param,8), rp mov R32(n_param), R32(%rax) xchg v0_param, v0 C FIXME: is this insn fast? neg n and $3, R8(%rax) jz L(b0) cmp $2, R8(%rax) jz L(b2) jg L(b3) L(b1): mulx %r8, %rbx, %rax sub $-1, n jz L(wd1) mulx (up,n,8), %r9, %r8 mulx 8(up,n,8), %r11, %r10 test R32(%rax), R32(%rax) C clear cy jmp L(lo1) L(b0): mulx %r8, %r9, %r8 mulx 8(up,n,8), %r11, %r10 mulx 16(up,n,8), %r13, %r12 xor R32(%rax), R32(%rax) jmp L(lo0) L(b3): mulx %r8, %r11, %r10 mulx 8(up,n,8), %r13, %r12 mulx 16(up,n,8), %rbx, %rax add %r10, %r13 adc %r12, %rbx adc $0, %rax sub $-3, n jz L(wd3) test R32(%rax), R32(%rax) C clear cy jmp L(lo3) L(b2): mulx %r8, %r13, %r12 mulx 8(up,n,8), %rbx, %rax add %r12, %rbx adc $0, %rax sub $-2, n jz L(wd2) mulx (up,n,8), %r9, %r8 test R32(%rax), R32(%rax) C clear cy jmp L(lo2) L(top): ADDSUB %r9, (rp,n,8) L(lo3): mulx (up,n,8), %r9, %r8 ADCSBB %r11, 8(rp,n,8) L(lo2): mulx 8(up,n,8), %r11, %r10 ADCSBB %r13, 16(rp,n,8) L(lo1): mulx 16(up,n,8), %r13, %r12 ADCSBB %rbx, 24(rp,n,8) adc %rax, %r9 L(lo0): mulx 24(up,n,8), %rbx, %rax adc %r8, %r11 adc %r10, %r13 adc %r12, %rbx adc $0, %rax C rax = carry limb add $4, n js L(top) L(end): ADDSUB %r9, (rp) L(wd3): ADCSBB %r11, 8(rp) L(wd2): ADCSBB %r13, 16(rp) L(wd1): ADCSBB %rbx, 24(rp) adc n, %rax pop %r13 pop %r12 pop %rbx ret EPILOGUE() ASM_END()
#include <QtGlobal> // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif static const char UNUSED *mrclassic_strings[] = { QT_TRANSLATE_NOOP("mrclassic-core", "" "(1 = keep tx meta data e.g. account owner and payment request information, 2 " "= drop tx meta data)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "-fallbackfee is set very high! This is the transaction fee you may pay when " "fee estimates are not available."), QT_TRANSLATE_NOOP("mrclassic-core", "" "-maxtxfee is set very high! Fees this large could be paid on a single " "transaction."), QT_TRANSLATE_NOOP("mrclassic-core", "" "-paytxfee is set very high! This is the transaction fee you will pay if you " "send a transaction."), QT_TRANSLATE_NOOP("mrclassic-core", "" "A fee rate (in %s/kB) that will be used when fee estimation has insufficient " "data (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Accept relayed transactions received from whitelisted peers even when not " "relaying transactions (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Allow JSON-RPC connections from specified source. Valid for <ip> are a " "single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or " "a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Bind to given address and whitelist peers connecting to it. Use [host]:port " "notation for IPv6"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Bind to given address to listen for JSON-RPC connections. Use [host]:port " "notation for IPv6. This option can be specified multiple times (default: " "bind to all interfaces)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Cannot obtain a lock on data directory %s. Mrclassic Core is probably already " "running."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Create new files with system default permissions, instead of umask 077 (only " "effective with disabled wallet functionality)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Delete all wallet transactions and only recover those parts of the " "blockchain through -rescan on startup"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Disable all Mrclassic specific functionality (Masternodes, PrivateSend, " "InstantSend, Governance) (0-1, default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Discover own IP addresses (default: 1 when listening and no -externalip or -" "proxy)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Distributed under the MIT software license, see the accompanying file " "COPYING or <http://www.opensource.org/licenses/mit-license.php>."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Do not keep transactions in the mempool longer than <n> hours (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Enable InstantSend, show confirmations for locked transactions (0-1, " "default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Enable multiple PrivateSend mixing sessions per block, experimental (0-1, " "default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Enable use of automated PrivateSend for funds stored in this wallet (0-1, " "default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Error loading %s: You can't enable HD on a already existing non-HD wallet"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Error reading wallet.dat! All keys read correctly, but transaction data or " "address book entries might be missing or incorrect."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Error: Listening for incoming connections failed (listen returned error %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Execute command when a relevant alert is received or we see a really long " "fork (%s in cmd is replaced by message)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Execute command when a wallet InstantSend transaction is successfully locked " "(%s in cmd is replaced by TxID)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Execute command when the best block changes (%s in cmd is replaced by block " "hash)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Failed to create backup, file already exists! This could happen if you " "restarted wallet in less than 60 seconds. You can continue if you are ok " "with this."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Fees (in %s/kB) smaller than this are considered zero fee for relaying, " "mining and transaction creation (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Fees (in %s/kB) smaller than this are considered zero fee for transaction " "creation (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Force relay of transactions from whitelisted peers even they violate local " "relay policy (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Found unconfirmed denominated outputs, will wait till they confirm to " "continue."), QT_TRANSLATE_NOOP("mrclassic-core", "" "How thorough the block verification of -checkblocks is (0-4, default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "If <category> is not supplied or if <category> = 1, output all debugging " "information."), QT_TRANSLATE_NOOP("mrclassic-core", "" "If paytxfee is not set, include enough fee so transactions begin " "confirmation on average within n blocks (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "If this block is in the chain assume that it and its ancestors are valid and " "potentially skip their script verification (0 to verify all, default: %s, " "testnet: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "InstantSend doesn't support sending values that high yet. Transactions are " "currently limited to %1 MRC."), QT_TRANSLATE_NOOP("mrclassic-core", "" "InstantSend requires inputs with at least %d confirmations, you might need " "to wait a few minutes and try again."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay " "fee of %s to prevent stuck transactions)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maintain a full address index, used to query for the balance, txids and " "unspent outputs for addresses (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maintain a full spent index, used to query the spending txid and input index " "for an outpoint (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maintain a full transaction index, used by the getrawtransaction rpc call " "(default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maintain a timestamp index for block hashes, used to query blocks hashes by " "a range of timestamps (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maintain at most <n> connections to peers (temporary service connections " "excluded) (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Make sure to encrypt your wallet and delete all non-encrypted backups after " "you verified that wallet works!"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maximum size of data in data carrier transactions we relay and mine " "(default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Maximum total fees (in %s) to use in a single wallet transaction; setting " "this too low may abort large transactions (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Name to construct url for KeePass entry that stores the wallet passphrase"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Output debugging information (default: %u, supplying <category> is optional)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Please check that your computer's date and time are correct! If your clock " "is wrong Mrclassic Core will not work properly."), QT_TRANSLATE_NOOP("mrclassic-core", "" "PrivateSend uses exact denominated amounts to send funds, you might simply " "need to anonymize some more coins."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Provide liquidity to PrivateSend by infrequently mixing coins on a continual " "basis (0-100, default: %u, 1=very frequent, high fees, 100=very infrequent, " "low fees)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Prune configured below the minimum of %d MiB. Please use a higher number."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Prune: last wallet synchronisation goes beyond pruned data. You need to -" "reindex (download the whole blockchain again in case of pruned node)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Query for peer addresses via DNS lookup, if low on addresses (default: 1 " "unless -connect)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Randomize credentials for every proxy connection. This enables Tor stream " "isolation (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Reduce storage requirements by pruning (deleting) old blocks. This mode is " "incompatible with -txindex and -rescan. Warning: Reverting this setting " "requires re-downloading the entire blockchain. (default: 0 = disable pruning " "blocks, >%u = target size in MiB to use for block files)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Rescans are not possible in pruned mode. You will need to use -reindex which " "will download the whole blockchain again."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Set the number of script verification threads (%u to %d, 0 = auto, <0 = " "leave that many cores free, default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Set the number of threads for coin generation if enabled (-1 = all cores, " "default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Show N confirmations for a successfully locked transaction (0-9999, default: " "%u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Specify full path to directory for automatic wallet backups (must exist)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Support filtering of blocks and transaction with bloom filters (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "The block database contains a block which appears to be from the future. " "This may be due to your computer's date and time being set incorrectly. Only " "rebuild the block database if you are sure that your computer's date and " "time are correct"), QT_TRANSLATE_NOOP("mrclassic-core", "" "The transaction amount is too small to send after the fee has been deducted"), QT_TRANSLATE_NOOP("mrclassic-core", "" "This is a pre-release test build - use at your own risk - do not use for " "mining or merchant applications"), QT_TRANSLATE_NOOP("mrclassic-core", "" "This product includes software developed by the OpenSSL Project for use in " "the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software " "written by Eric Young and UPnP software written by Thomas Bernard."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Total length of network version string (%i) exceeds maximum length (%i). " "Reduce the number or size of uacomments."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = " "no limit (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unable to bind to %s on this computer. Mrclassic Core is probably already running."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unable to locate enough PrivateSend denominated funds for this transaction."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unable to locate enough PrivateSend non-denominated funds for this " "transaction that are not equal 1000 MRC."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unable to locate enough funds for this transaction that are not equal 1000 " "MRC."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unsupported argument -socks found. Setting SOCKS version isn't possible " "anymore, only SOCKS5 proxies are supported."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Unsupported argument -whitelistalwaysrelay ignored, use -whitelistrelay and/" "or -whitelistforcerelay."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Use N separate masternodes for each denominated input to mix funds (2-16, " "default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Use UPnP to map the listening port (default: 1 when listening and no -proxy)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Use hierarchical deterministic key generation (HD) after bip39/bip44. Only " "has effect during wallet creation/first start"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: " "%s)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "User defined mnemonic for HD wallet (bip39). Only has effect during wallet " "creation/first start (default: randomly generated)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "User defined mnemonic passphrase for HD wallet (bip39). Only has effect " "during wallet creation/first start (default: empty string)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "User defined seed for HD wallet (should be in hex). Only has effect during " "wallet creation/first start (default: randomly generated)"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Username and hashed password for JSON-RPC connections. The field <userpw> " "comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is " "included in share/rpcuser. This option can be specified multiple times"), QT_TRANSLATE_NOOP("mrclassic-core", "" "WARNING! Failed to replenish keypool, please unlock your wallet to do so."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Wallet is locked, can't replenish keypool! Automatic backups and mixing are " "disabled, please unlock your wallet to replenish keypool."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Warning: The network does not appear to fully agree! Some miners appear to " "be experiencing issues."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Warning: Unknown block versions being mined! It's possible unknown rules are " "in effect"), QT_TRANSLATE_NOOP("mrclassic-core", "" "Warning: We do not appear to fully agree with our peers! You may need to " "upgrade, or other nodes may need to upgrade."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Warning: incorrect parameter -walletbackupsdir, path must exist! Using " "default path."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as " "wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect " "you should restore from a backup."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Whitelist peers connecting from the given netmask or IP address. Can be " "specified multiple times."), QT_TRANSLATE_NOOP("mrclassic-core", "" "Whitelisted peers cannot be DoS banned and their transactions are always " "relayed, even if they are already in the mempool, useful e.g. for a gateway"), QT_TRANSLATE_NOOP("mrclassic-core", "" "You must specify a masternodeprivkey in the configuration. Please see " "documentation for help."), QT_TRANSLATE_NOOP("mrclassic-core", "" "You need to rebuild the database using -reindex to go back to unpruned " "mode. This will redownload the entire blockchain"), QT_TRANSLATE_NOOP("mrclassic-core", "" "You need to rebuild the database using -reindex-chainstate to change -txindex"), QT_TRANSLATE_NOOP("mrclassic-core", "" "masternodeaddr option is deprecated. Please use masternode.conf to manage " "your remote masternodes."), QT_TRANSLATE_NOOP("mrclassic-core", "%s - %d confirmations"), QT_TRANSLATE_NOOP("mrclassic-core", "(%d could be used only on mainnet)"), QT_TRANSLATE_NOOP("mrclassic-core", "(default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "(default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "(must be %d for mainnet)"), QT_TRANSLATE_NOOP("mrclassic-core", "-maxmempool must be at least %d MB"), QT_TRANSLATE_NOOP("mrclassic-core", "<category> can be:"), QT_TRANSLATE_NOOP("mrclassic-core", "Accept command line and JSON-RPC commands"), QT_TRANSLATE_NOOP("mrclassic-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), QT_TRANSLATE_NOOP("mrclassic-core", "Accept public REST requests (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Add a node to connect to and attempt to keep the connection open"), QT_TRANSLATE_NOOP("mrclassic-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("mrclassic-core", "Already have that input."), QT_TRANSLATE_NOOP("mrclassic-core", "Always query for peer addresses via DNS lookup (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Append comment to the user agent string"), QT_TRANSLATE_NOOP("mrclassic-core", "Attempt to recover private keys from a corrupt wallet.dat on startup"), QT_TRANSLATE_NOOP("mrclassic-core", "Automatic backups disabled"), QT_TRANSLATE_NOOP("mrclassic-core", "Automatically create Tor hidden service (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "Block creation options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Can't find random Masternode."), QT_TRANSLATE_NOOP("mrclassic-core", "Can't mix while sync in progress."), QT_TRANSLATE_NOOP("mrclassic-core", "Can't mix: no compatible inputs found!"), QT_TRANSLATE_NOOP("mrclassic-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("mrclassic-core", "Cannot resolve -bind address: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Cannot resolve -whitebind address: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Cannot write default address"), QT_TRANSLATE_NOOP("mrclassic-core", "Chain selection options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Collateral not valid."), QT_TRANSLATE_NOOP("mrclassic-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Connect through SOCKS5 proxy"), QT_TRANSLATE_NOOP("mrclassic-core", "Connect to KeePassHttp on port <port> (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("mrclassic-core", "Connection options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Copyright (C) 2009-%i The Bitcoin Core Developers"), QT_TRANSLATE_NOOP("mrclassic-core", "Copyright (C) 2014-%i The Mrclassic Core Developers"), QT_TRANSLATE_NOOP("mrclassic-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("mrclassic-core", "Could not parse masternode.conf"), QT_TRANSLATE_NOOP("mrclassic-core", "Debugging/Testing options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Do not load the wallet and disable wallet RPC calls"), QT_TRANSLATE_NOOP("mrclassic-core", "Do you want to rebuild the block database now?"), QT_TRANSLATE_NOOP("mrclassic-core", "Done loading"), QT_TRANSLATE_NOOP("mrclassic-core", "ERROR! Failed to create automatic backup"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish hash block in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish hash transaction (locked via InstantSend) in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish hash transaction in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish raw block in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish raw transaction (locked via InstantSend) in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable publish raw transaction in <address>"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable the client to act as a masternode (0-1, default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Enable transaction replacement in the memory pool (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Entries are full."), QT_TRANSLATE_NOOP("mrclassic-core", "Entry exceeds maximum size."), QT_TRANSLATE_NOOP("mrclassic-core", "Error connecting to Masternode."), QT_TRANSLATE_NOOP("mrclassic-core", "Error initializing block database"), QT_TRANSLATE_NOOP("mrclassic-core", "Error initializing wallet database environment %s!"), QT_TRANSLATE_NOOP("mrclassic-core", "Error loading %s: You can't disable HD on a already existing HD wallet"), QT_TRANSLATE_NOOP("mrclassic-core", "Error loading block database"), QT_TRANSLATE_NOOP("mrclassic-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("mrclassic-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("mrclassic-core", "Error loading wallet.dat: Wallet requires newer version of Mrclassic Core"), QT_TRANSLATE_NOOP("mrclassic-core", "Error opening block database"), QT_TRANSLATE_NOOP("mrclassic-core", "Error reading from database, shutting down."), QT_TRANSLATE_NOOP("mrclassic-core", "Error"), QT_TRANSLATE_NOOP("mrclassic-core", "Error: A fatal internal error occurred, see debug.log for details"), QT_TRANSLATE_NOOP("mrclassic-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to create backup %s!"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to create backup, error: %s"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to delete backup, error: %s"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to listen on any port. Use -listen=0 if you want this."), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to load fulfilled requests cache from"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to load governance cache from"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to load masternode cache from"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to load masternode payments cache from"), QT_TRANSLATE_NOOP("mrclassic-core", "Failed to parse host:port string"), QT_TRANSLATE_NOOP("mrclassic-core", "Fee (in %s/kB) to add to transactions you send (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Found enough users, signing ( waiting %s )"), QT_TRANSLATE_NOOP("mrclassic-core", "Found enough users, signing ..."), QT_TRANSLATE_NOOP("mrclassic-core", "Generate coins (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "How many blocks to check at startup (default: %u, 0 = all)"), QT_TRANSLATE_NOOP("mrclassic-core", "Importing..."), QT_TRANSLATE_NOOP("mrclassic-core", "Imports blocks from external blk000??.dat file on startup"), QT_TRANSLATE_NOOP("mrclassic-core", "Include IP addresses in debug output (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Incompatible mode."), QT_TRANSLATE_NOOP("mrclassic-core", "Incompatible version."), QT_TRANSLATE_NOOP("mrclassic-core", "Incorrect or no genesis block found. Wrong datadir for network?"), QT_TRANSLATE_NOOP("mrclassic-core", "Information"), QT_TRANSLATE_NOOP("mrclassic-core", "Initialization sanity check failed. Mrclassic Core is shutting down."), QT_TRANSLATE_NOOP("mrclassic-core", "Input is not valid."), QT_TRANSLATE_NOOP("mrclassic-core", "InstantSend options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Insufficient funds."), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid -onion address: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid -proxy address: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -fallbackfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -maxtxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -mintxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid amount for -paytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid masternodeprivkey. Please see documenation."), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid netmask specified in -whitelist: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid port detected in masternode.conf"), QT_TRANSLATE_NOOP("mrclassic-core", "Invalid script detected."), QT_TRANSLATE_NOOP("mrclassic-core", "KeePassHttp id for the established association"), QT_TRANSLATE_NOOP("mrclassic-core", "KeePassHttp key for AES encrypted communication with KeePass"), QT_TRANSLATE_NOOP("mrclassic-core", "Keep N MRC anonymized (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Keep the transaction memory pool below <n> megabytes (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Keypool ran out, please call keypoolrefill first"), QT_TRANSLATE_NOOP("mrclassic-core", "Last PrivateSend was too recent."), QT_TRANSLATE_NOOP("mrclassic-core", "Last successful PrivateSend action was too recent."), QT_TRANSLATE_NOOP("mrclassic-core", "Line: %d"), QT_TRANSLATE_NOOP("mrclassic-core", "Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Listen for connections on <port> (default: %u or testnet: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Loading addresses..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading banlist..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading block index..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading fulfilled requests cache..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading governance cache..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading masternode cache..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading masternode payment cache..."), QT_TRANSLATE_NOOP("mrclassic-core", "Loading wallet... (%3.2f %%)"), QT_TRANSLATE_NOOP("mrclassic-core", "Loading wallet..."), QT_TRANSLATE_NOOP("mrclassic-core", "Location of the auth cookie (default: data dir)"), QT_TRANSLATE_NOOP("mrclassic-core", "Lock is already in place."), QT_TRANSLATE_NOOP("mrclassic-core", "Lock masternodes from masternode configuration file (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Make the wallet broadcast transactions"), QT_TRANSLATE_NOOP("mrclassic-core", "Masternode cache is empty, skipping payments and governance cache..."), QT_TRANSLATE_NOOP("mrclassic-core", "Masternode options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Masternode queue is full."), QT_TRANSLATE_NOOP("mrclassic-core", "Masternode:"), QT_TRANSLATE_NOOP("mrclassic-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Minimum bytes per sigop in transactions we relay and mine (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Missing input transaction information."), QT_TRANSLATE_NOOP("mrclassic-core", "Mixing in progress..."), QT_TRANSLATE_NOOP("mrclassic-core", "Mnemonic passphrase is too long, must be at most 256 characters"), QT_TRANSLATE_NOOP("mrclassic-core", "Need to specify a port with -whitebind: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "No Masternodes detected."), QT_TRANSLATE_NOOP("mrclassic-core", "No compatible Masternode found."), QT_TRANSLATE_NOOP("mrclassic-core", "No errors detected."), QT_TRANSLATE_NOOP("mrclassic-core", "No matching denominations found for mixing."), QT_TRANSLATE_NOOP("mrclassic-core", "Node relay options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Non-standard public key detected."), QT_TRANSLATE_NOOP("mrclassic-core", "Not compatible with existing transactions."), QT_TRANSLATE_NOOP("mrclassic-core", "Not enough file descriptors available."), QT_TRANSLATE_NOOP("mrclassic-core", "Not enough funds to anonymize."), QT_TRANSLATE_NOOP("mrclassic-core", "Not in the Masternode list."), QT_TRANSLATE_NOOP("mrclassic-core", "Number of automatic wallet backups (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Only connect to nodes in network <net> (ipv4, ipv6 or onion)"), QT_TRANSLATE_NOOP("mrclassic-core", "Options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Password for JSON-RPC connections"), QT_TRANSLATE_NOOP("mrclassic-core", "Port: %d"), QT_TRANSLATE_NOOP("mrclassic-core", "Prepend debug output with timestamp (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Print version and exit"), QT_TRANSLATE_NOOP("mrclassic-core", "PrivateSend is idle."), QT_TRANSLATE_NOOP("mrclassic-core", "PrivateSend options:"), QT_TRANSLATE_NOOP("mrclassic-core", "PrivateSend request complete:"), QT_TRANSLATE_NOOP("mrclassic-core", "PrivateSend request incomplete:"), QT_TRANSLATE_NOOP("mrclassic-core", "Prune cannot be configured with a negative value."), QT_TRANSLATE_NOOP("mrclassic-core", "Prune mode is incompatible with -txindex."), QT_TRANSLATE_NOOP("mrclassic-core", "Pruning blockstore..."), QT_TRANSLATE_NOOP("mrclassic-core", "RPC server options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Rebuild chain state and block index from the blk*.dat files on disk"), QT_TRANSLATE_NOOP("mrclassic-core", "Rebuild chain state from the currently indexed blocks"), QT_TRANSLATE_NOOP("mrclassic-core", "Receive and display P2P network alerts (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Reducing -maxconnections from %d to %d, because of system limitations."), QT_TRANSLATE_NOOP("mrclassic-core", "Relay and mine data carrier transactions (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Relay non-P2SH multisig (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Rescan the block chain for missing wallet transactions on startup"), QT_TRANSLATE_NOOP("mrclassic-core", "Rescanning..."), QT_TRANSLATE_NOOP("mrclassic-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("mrclassic-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("mrclassic-core", "Send trace/debug info to debug.log file (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Send transactions as zero-fee transactions if possible (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Session not complete!"), QT_TRANSLATE_NOOP("mrclassic-core", "Session timed out."), QT_TRANSLATE_NOOP("mrclassic-core", "Set database cache size in megabytes (%d to %d, default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "Set key pool size to <n> (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Set maximum block size in bytes (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "Set minimum block size in bytes (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Set the masternode private key"), QT_TRANSLATE_NOOP("mrclassic-core", "Set the number of threads to service RPC calls (default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "Show all debugging options (usage: --help -help-debug)"), QT_TRANSLATE_NOOP("mrclassic-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("mrclassic-core", "Signing transaction failed"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify configuration file (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify connection timeout in milliseconds (minimum: 1, default: %d)"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify data directory"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify masternode configuration file (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify pid file (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify wallet file (within data directory)"), QT_TRANSLATE_NOOP("mrclassic-core", "Specify your own public address"), QT_TRANSLATE_NOOP("mrclassic-core", "Spend unconfirmed change when sending transactions (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Submitted following entries to masternode: %u / %d"), QT_TRANSLATE_NOOP("mrclassic-core", "Submitted to masternode, waiting for more entries ( %u / %d ) %s"), QT_TRANSLATE_NOOP("mrclassic-core", "Submitted to masternode, waiting in queue %s"), QT_TRANSLATE_NOOP("mrclassic-core", "Synchroning blockchain..."), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronization failed"), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronization finished"), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronization pending..."), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronizing governance objects..."), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronizing masternode payments..."), QT_TRANSLATE_NOOP("mrclassic-core", "Synchronizing masternodes..."), QT_TRANSLATE_NOOP("mrclassic-core", "The transaction amount is too small to pay the fee"), QT_TRANSLATE_NOOP("mrclassic-core", "This help message"), QT_TRANSLATE_NOOP("mrclassic-core", "This is experimental software."), QT_TRANSLATE_NOOP("mrclassic-core", "This is not a Masternode."), QT_TRANSLATE_NOOP("mrclassic-core", "Threshold for disconnecting misbehaving peers (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Too many %f denominations, removing."), QT_TRANSLATE_NOOP("mrclassic-core", "Tor control port password (default: empty)"), QT_TRANSLATE_NOOP("mrclassic-core", "Tor control port to use if onion listening enabled (default: %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction amount too small"), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction amounts must be positive"), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction created successfully."), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction fees are too high."), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction not valid."), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction too large for fee policy"), QT_TRANSLATE_NOOP("mrclassic-core", "Transaction too large"), QT_TRANSLATE_NOOP("mrclassic-core", "Unable to bind to %s on this computer (bind returned error %s)"), QT_TRANSLATE_NOOP("mrclassic-core", "Unable to sign spork message, wrong key?"), QT_TRANSLATE_NOOP("mrclassic-core", "Unable to start HTTP server. See debug log for details."), QT_TRANSLATE_NOOP("mrclassic-core", "Unknown network specified in -onlynet: '%s'"), QT_TRANSLATE_NOOP("mrclassic-core", "Unknown response."), QT_TRANSLATE_NOOP("mrclassic-core", "Unknown state: id = %u"), QT_TRANSLATE_NOOP("mrclassic-core", "Unsupported argument -benchmark ignored, use -debug=bench."), QT_TRANSLATE_NOOP("mrclassic-core", "Unsupported argument -debugnet ignored, use -debug=net."), QT_TRANSLATE_NOOP("mrclassic-core", "Unsupported argument -tor found, use -onion."), QT_TRANSLATE_NOOP("mrclassic-core", "Upgrade wallet to latest format on startup"), QT_TRANSLATE_NOOP("mrclassic-core", "Use KeePass 2 integration using KeePassHttp plugin (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Use UPnP to map the listening port (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Use the test chain"), QT_TRANSLATE_NOOP("mrclassic-core", "User Agent comment (%s) contains unsafe characters."), QT_TRANSLATE_NOOP("mrclassic-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("mrclassic-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("mrclassic-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("mrclassic-core", "Very low number of keys left: %d"), QT_TRANSLATE_NOOP("mrclassic-core", "Wallet %s resides outside data directory %s"), QT_TRANSLATE_NOOP("mrclassic-core", "Wallet is locked."), QT_TRANSLATE_NOOP("mrclassic-core", "Wallet needed to be rewritten: restart Mrclassic Core to complete"), QT_TRANSLATE_NOOP("mrclassic-core", "Wallet options:"), QT_TRANSLATE_NOOP("mrclassic-core", "Wallet window title"), QT_TRANSLATE_NOOP("mrclassic-core", "Warning"), QT_TRANSLATE_NOOP("mrclassic-core", "Warning: unknown new rules activated (versionbit %i)"), QT_TRANSLATE_NOOP("mrclassic-core", "Wasn't able to create wallet backup folder %s!"), QT_TRANSLATE_NOOP("mrclassic-core", "Whether to operate in a blocks only mode (default: %u)"), QT_TRANSLATE_NOOP("mrclassic-core", "Will retry..."), QT_TRANSLATE_NOOP("mrclassic-core", "Your entries added successfully."), QT_TRANSLATE_NOOP("mrclassic-core", "Your transaction was accepted into the pool!"), QT_TRANSLATE_NOOP("mrclassic-core", "Zapping all transactions from wallet..."), QT_TRANSLATE_NOOP("mrclassic-core", "ZeroMQ notification options:"), QT_TRANSLATE_NOOP("mrclassic-core", "no mixing available."), QT_TRANSLATE_NOOP("mrclassic-core", "see debug.log for details."), QT_TRANSLATE_NOOP("mrclassic-core", "wallet.dat corrupt, salvage failed"), };
; Execute a thing ; section utility xdef ut_thex include win1_keys_qdos_sms include win1_keys_thg include win1_keys_err include win1_keys_sys ;+++ ; Execute a thing ; ; Entry Exit ; d1 owner Job ID ; d2 priority/timeout preserved ; a0 thing name preserved ; a1 parameter string preserved ; ; condition codes set ;--- ut_thex movem.l a4,-(sp) bsr.s ut_thvec2 ; find th_exec bne.s xx jsr (a4) xx movem.l (sp)+,a4 tst.l d0 rts ut_thvec2 movem.l d1-d2/d7/a0,-(sp) moveq #sms.info,d0 ; get system variables trap #do.sms2 move.w sr,d7 ; save current sr trap #0 ; into supervisor mode move.l sys_thgl(a0),d1 ; this is the Thing list beq.s thvec_nf ; empty list, very bad! move.l d1,a0 thvec_lp move.l (a0),d1 ; get next list entry beq.s th_found ; end of list? Here should be THING! move.l d1,a0 ; next link bra thvec_lp thvec_nf moveq #err.nimp,d0 ; THING does not exist bra.s thvec_rt th_found move.l th_thing(a0),a0 ; get start of Thing cmp.l #-1,thh_type(a0) ; is it our special THING? bne.s thvec_nf ; sorry, it isn't move.l 12(a0),a4 ; this is the vector we look for thvec_rt move.w d7,sr movem.l (sp)+,d1-d2/d7/a0 tst.l d0 rts end
/************************************************************************/ /* */ /* Copyright 2008-2009 by Ullrich Koethe and Rahul Nair */ /* */ /* This file is part of the VIGRA computer vision library. */ /* The VIGRA Website is */ /* http://hci.iwr.uni-heidelberg.de/vigra/ */ /* Please direct questions, bug reports, and contributions to */ /* ullrich.koethe@iwr.uni-heidelberg.de or */ /* vigra@informatik.uni-hamburg.de */ /* */ /* 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. */ /* */ /************************************************************************/ #ifndef VIGRA_RANDOM_FOREST_HXX #define VIGRA_RANDOM_FOREST_HXX #include <iostream> #include <algorithm> #include <map> #include <set> #include <list> #include <numeric> #include "mathutil.hxx" #include "array_vector.hxx" #include "sized_int.hxx" #include "matrix.hxx" #include "metaprogramming.hxx" #include "random.hxx" #include "functorexpression.hxx" #include "random_forest/rf_common.hxx" #include "random_forest/rf_nodeproxy.hxx" #include "random_forest/rf_split.hxx" #include "random_forest/rf_decisionTree.hxx" #include "random_forest/rf_visitors.hxx" #include "random_forest/rf_region.hxx" #include "sampling.hxx" #include "random_forest/rf_preprocessing.hxx" #include "random_forest/rf_online_prediction_set.hxx" #include "random_forest/rf_earlystopping.hxx" #include "random_forest/rf_ridge_split.hxx" namespace vigra { /** \addtogroup MachineLearning Machine Learning This module provides classification algorithms that map features to labels or label probabilities. Look at the \ref vigra::RandomForest class (for implementation version 2) or the \ref vigra::rf3::random_forest() factory function (for implementation version 3) for an overview of the functionality as well as use cases. **/ namespace detail { /* \brief sampling option factory function */ inline SamplerOptions make_sampler_opt ( RandomForestOptions & RF_opt) { SamplerOptions return_opt; return_opt.withReplacement(RF_opt.sample_with_replacement_); return_opt.stratified(RF_opt.stratification_method_ == RF_EQUAL); return return_opt; } }//namespace detail /** \brief Random forest version 2 (see also \ref vigra::rf3::RandomForest for version 3) * * \ingroup MachineLearning * * \tparam <LabelType = double> Type used for predicted labels. * \tparam <PreprocessorTag = ClassificationTag> Class used to preprocess * the input while learning and predicting. Currently Available: * ClassificationTag and RegressionTag. It is recommended to use * Splitfunctor::Preprocessor_t while using custom splitfunctors * as they may need the data to be in a different format. * \sa Preprocessor * * Simple usage for classification (regression is not yet supported): * look at RandomForest::learn() as well as RandomForestOptions() for additional * options. * * \code * using namespace vigra; * using namespace rf; * typedef xxx feature_t; \\ replace xxx with whichever type * typedef yyy label_t; \\ likewise * * // allocate the training data * MultiArrayView<2, feature_t> f = get_training_features(); * MultiArrayView<2, label_t> l = get_training_labels(); * * RandomForest<label_t> rf; * * // construct visitor to calculate out-of-bag error * visitors::OOB_Error oob_v; * * // perform training * rf.learn(f, l, visitors::create_visitor(oob_v)); * * std::cout << "the out-of-bag error is: " << oob_v.oob_breiman << "\n"; * * // get features for new data to be used for prediction * MultiArrayView<2, feature_t> pf = get_features(); * * // allocate space for the response (pf.shape(0) is the number of samples) * MultiArrayView<2, label_t> prediction(pf.shape(0), 1); * MultiArrayView<2, double> prob(pf.shape(0), rf.class_count()); * * // perform prediction on new data * rf.predictLabels(pf, prediction); * rf.predictProbabilities(pf, prob); * * \endcode * * Additional information such as Variable Importance measures are accessed * via Visitors defined in rf::visitors. * Have a look at rf::split for other splitting methods. * */ template <class LabelType = double , class PreprocessorTag = ClassificationTag > class RandomForest { public: //public typedefs typedef RandomForestOptions Options_t; typedef detail::DecisionTree DecisionTree_t; typedef ProblemSpec<LabelType> ProblemSpec_t; typedef GiniSplit Default_Split_t; typedef EarlyStoppStd Default_Stop_t; typedef rf::visitors::StopVisiting Default_Visitor_t; typedef DT_StackEntry<ArrayVectorView<Int32>::iterator> StackEntry_t; typedef LabelType LabelT; //problem independent data. Options_t options_; //problem dependent data members - is only set if //a copy constructor, some sort of import //function or the learn function is called ArrayVector<DecisionTree_t> trees_; ProblemSpec_t ext_param_; /*mutable ArrayVector<int> tree_indices_;*/ rf::visitors::OnlineLearnVisitor online_visitor_; void reset() { ext_param_.clear(); trees_.clear(); } public: /** \name Constructors * Note: No copy constructor specified as no pointers are manipulated * in this class * @{ */ /**\brief default constructor * * \param options general options to the Random Forest. Must be of Type * Options_t * \param ext_param problem specific values that can be supplied * additionally. (class weights , labels etc) * \sa RandomForestOptions, ProblemSpec * */ RandomForest(Options_t const & options = Options_t(), ProblemSpec_t const & ext_param = ProblemSpec_t()) : options_(options), ext_param_(ext_param)/*, tree_indices_(options.tree_count_,0)*/ { /*for(int ii = 0 ; ii < int(tree_indices_.size()); ++ii) tree_indices_[ii] = ii;*/ } /**\brief Create RF from external source * \param treeCount Number of trees to add. * \param topology_begin * Iterator to a Container where the topology_ data * of the trees are stored. * Iterator should support at least treeCount forward * iterations. (i.e. topology_end - topology_begin >= treeCount * \param parameter_begin * iterator to a Container where the parameters_ data * of the trees are stored. Iterator should support at * least treeCount forward iterations. * \param problem_spec * Extrinsic parameters that specify the problem e.g. * ClassCount, featureCount etc. * \param options (optional) specify options used to train the original * Random forest. This parameter is not used anywhere * during prediction and thus is optional. * */ template<class TopologyIterator, class ParameterIterator> RandomForest(int treeCount, TopologyIterator topology_begin, ParameterIterator parameter_begin, ProblemSpec_t const & problem_spec, Options_t const & options = Options_t()) : trees_(treeCount, DecisionTree_t(problem_spec)), ext_param_(problem_spec), options_(options) { /* TODO: This constructor may be replaced by a Constructor using * NodeProxy iterators to encapsulate the underlying data type. */ for(int k=0; k<treeCount; ++k, ++topology_begin, ++parameter_begin) { trees_[k].topology_ = *topology_begin; trees_[k].parameters_ = *parameter_begin; } } /** @} */ /** \name Data Access * data access interface - usage of member variables is deprecated * * @{ */ /**\brief return external parameters for viewing * \return ProblemSpec_t */ ProblemSpec_t const & ext_param() const { vigra_precondition(ext_param_.used() == true, "RandomForest::ext_param(): " "Random forest has not been trained yet."); return ext_param_; } /**\brief set external parameters * * \param in external parameters to be set * * set external parameters explicitly. * If Random Forest has not been trained the preprocessor will * either ignore filling values set this way or will throw an exception * if values specified manually do not match the value calculated & during the preparation step. */ void set_ext_param(ProblemSpec_t const & in) { ignore_argument(in); vigra_precondition(ext_param_.used() == false, "RandomForest::set_ext_param():" "Random forest has been trained! Call reset()" "before specifying new extrinsic parameters."); } /**\brief access random forest options * * \return random forest options */ Options_t & set_options() { return options_; } /**\brief access const random forest options * * \return const Option_t */ Options_t const & options() const { return options_; } /**\brief access const trees */ DecisionTree_t const & tree(int index) const { return trees_[index]; } /**\brief access trees */ DecisionTree_t & tree(int index) { return trees_[index]; } /**\brief return number of features used while * training. */ int feature_count() const { return ext_param_.column_count_; } /**\brief return number of features used while * training. * * deprecated. Use feature_count() instead. */ int column_count() const { return ext_param_.column_count_; } /**\brief return number of classes used while * training. */ int class_count() const { return ext_param_.class_count_; } /**\brief return number of trees */ int tree_count() const { return options_.tree_count_; } /** @} */ /**\name Learning * Following functions differ in the degree of customization * allowed * * @{ */ /**\brief learn on data with custom config and random number generator * * \param features a N x M matrix containing N samples with M * features * \param response a N x D matrix containing the corresponding * response. Current split functors assume D to * be 1 and ignore any additional columns. * This is not enforced to allow future support * for uncertain labels, label independent strata etc. * The Preprocessor specified during construction * should be able to handle features and labels * features and the labels. * see also: SplitFunctor, Preprocessing * * \param visitor visitor which is to be applied after each split, * tree and at the end. Use rf_default() for using * default value. (No Visitors) * see also: rf::visitors * \param split split functor to be used to calculate each split * use rf_default() for using default value. (GiniSplit) * see also: rf::split * \param stop * predicate to be used to calculate each split * use rf_default() for using default value. (EarlyStoppStd) * \param random RandomNumberGenerator to be used. Use * rf_default() to use default value.(RandomMT19337) * * */ template <class U, class C1, class U2,class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & response, Visitor_t visitor, Split_t split, Stop_t stop, Random_t const & random); template <class U, class C1, class U2,class C2, class Split_t, class Stop_t, class Visitor_t> void learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & response, Visitor_t visitor, Split_t split, Stop_t stop) { RandomNumberGenerator<> rnd = RandomNumberGenerator<>(RandomSeed); learn( features, response, visitor, split, stop, rnd); } template <class U, class C1, class U2,class C2, class Visitor_t> void learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & labels, Visitor_t visitor) { learn( features, labels, visitor, rf_default(), rf_default()); } template <class U, class C1, class U2,class C2, class Visitor_t, class Split_t> void learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & labels, Visitor_t visitor, Split_t split) { learn( features, labels, visitor, split, rf_default()); } /**\brief learn on data with default configuration * * \param features a N x M matrix containing N samples with M * features * \param labels a N x D matrix containing the corresponding * N labels. Current split functors assume D to * be 1 and ignore any additional columns. * this is not enforced to allow future support * for uncertain labels. * * learning is done with: * * \sa rf::split, EarlyStoppStd * * - Randomly seeded random number generator * - default gini split functor as described by Breiman * - default The standard early stopping criterion */ template <class U, class C1, class U2,class C2> void learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & labels) { learn( features, labels, rf_default(), rf_default(), rf_default()); } template<class U,class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void onlineLearn( MultiArrayView<2,U,C1> const & features, MultiArrayView<2,U2,C2> const & response, int new_start_index, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t & random, bool adjust_thresholds=false); template <class U, class C1, class U2,class C2> void onlineLearn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & labels,int new_start_index,bool adjust_thresholds=false) { RandomNumberGenerator<> rnd = RandomNumberGenerator<>(RandomSeed); onlineLearn(features, labels, new_start_index, rf_default(), rf_default(), rf_default(), rnd, adjust_thresholds); } template<class U,class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void reLearnTree(MultiArrayView<2,U,C1> const & features, MultiArrayView<2,U2,C2> const & response, int treeId, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t & random); template<class U, class C1, class U2, class C2> void reLearnTree(MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2, C2> const & labels, int treeId) { RandomNumberGenerator<> rnd = RandomNumberGenerator<>(RandomSeed); reLearnTree(features, labels, treeId, rf_default(), rf_default(), rf_default(), rnd); } /** @} */ /**\name Prediction * * @{ */ /** \brief predict a label given a feature. * * \param features: a 1 by featureCount matrix containing * data point to be predicted (this only works in * classification setting) * \param stop: early stopping criterion * \return double value representing class. You can use the * predictLabels() function together with the * rf.external_parameter().class_type_ attribute * to get back the same type used during learning. */ template <class U, class C, class Stop> LabelType predictLabel(MultiArrayView<2, U, C>const & features, Stop & stop) const; template <class U, class C> LabelType predictLabel(MultiArrayView<2, U, C>const & features) { return predictLabel(features, rf_default()); } /** \brief predict a label with features and class priors * * \param features: same as above. * \param prior: iterator to prior weighting of classes * \return sam as above. */ template <class U, class C> LabelType predictLabel(MultiArrayView<2, U, C> const & features, ArrayVectorView<double> prior) const; /** \brief predict multiple labels with given features * * \param features: a n by featureCount matrix containing * data point to be predicted (this only works in * classification setting) * \param labels: a n by 1 matrix passed by reference to store * output. * * If the input contains an NaN value, an precondition exception is thrown. */ template <class U, class C1, class T, class C2> void predictLabels(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & labels) const { vigra_precondition(features.shape(0) == labels.shape(0), "RandomForest::predictLabels(): Label array has wrong size."); for(int k=0; k<features.shape(0); ++k) { vigra_precondition(!detail::contains_nan(rowVector(features, k)), "RandomForest::predictLabels(): NaN in feature matrix."); labels(k,0) = detail::RequiresExplicitCast<T>::cast(predictLabel(rowVector(features, k), rf_default())); } } /** \brief predict multiple labels with given features * * \param features: a n by featureCount matrix containing * data point to be predicted (this only works in * classification setting) * \param labels: a n by 1 matrix passed by reference to store * output. * \param nanLabel: label to be returned for the row of the input that * contain an NaN value. */ template <class U, class C1, class T, class C2> void predictLabels(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & labels, LabelType nanLabel) const { vigra_precondition(features.shape(0) == labels.shape(0), "RandomForest::predictLabels(): Label array has wrong size."); for(int k=0; k<features.shape(0); ++k) { if(detail::contains_nan(rowVector(features, k))) labels(k,0) = nanLabel; else labels(k,0) = detail::RequiresExplicitCast<T>::cast(predictLabel(rowVector(features, k), rf_default())); } } /** \brief predict multiple labels with given features * * \param features: a n by featureCount matrix containing * data point to be predicted (this only works in * classification setting) * \param labels: a n by 1 matrix passed by reference to store * output. * \param stop: an early stopping criterion. */ template <class U, class C1, class T, class C2, class Stop> void predictLabels(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & labels, Stop & stop) const { vigra_precondition(features.shape(0) == labels.shape(0), "RandomForest::predictLabels(): Label array has wrong size."); for(int k=0; k<features.shape(0); ++k) labels(k,0) = detail::RequiresExplicitCast<T>::cast(predictLabel(rowVector(features, k), stop)); } /** \brief predict the class probabilities for multiple labels * * \param features same as above * \param prob a n x class_count_ matrix. passed by reference to * save class probabilities * \param stop earlystopping criterion * \sa EarlyStopping When a row of the feature array contains an NaN, the corresponding instance cannot belong to any of the classes. The corresponding row in the probability array will therefore contain all zeros. */ template <class U, class C1, class T, class C2, class Stop> void predictProbabilities(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & prob, Stop & stop) const; template <class T1,class T2, class C> void predictProbabilities(OnlinePredictionSet<T1> & predictionSet, MultiArrayView<2, T2, C> & prob); /** \brief predict the class probabilities for multiple labels * * \param features same as above * \param prob a n x class_count_ matrix. passed by reference to * save class probabilities */ template <class U, class C1, class T, class C2> void predictProbabilities(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & prob) const { predictProbabilities(features, prob, rf_default()); } template <class U, class C1, class T, class C2> void predictRaw(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & prob) const; /** @} */ }; template <class LabelType, class PreprocessorTag> template<class U,class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void RandomForest<LabelType, PreprocessorTag>::onlineLearn(MultiArrayView<2,U,C1> const & features, MultiArrayView<2,U2,C2> const & response, int new_start_index, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t & random, bool adjust_thresholds) { online_visitor_.activate(); online_visitor_.adjust_thresholds=adjust_thresholds; using namespace rf; //typedefs typedef Processor<PreprocessorTag,LabelType,U,C1,U2,C2> Preprocessor_t; typedef UniformIntRandomFunctor<Random_t> RandFunctor_t; // default values and initialization // Value Chooser chooses second argument as value if first argument // is of type RF_DEFAULT. (thanks to template magic - don't care about // it - just smile and wave. #define RF_CHOOSER(type_) detail::Value_Chooser<type_, Default_##type_> Default_Stop_t default_stop(options_); typename RF_CHOOSER(Stop_t)::type stop = RF_CHOOSER(Stop_t)::choose(stop_, default_stop); Default_Split_t default_split; typename RF_CHOOSER(Split_t)::type split = RF_CHOOSER(Split_t)::choose(split_, default_split); rf::visitors::StopVisiting stopvisiting; typedef rf::visitors::detail::VisitorNode <rf::visitors::OnlineLearnVisitor, typename RF_CHOOSER(Visitor_t)::type> IntermedVis; IntermedVis visitor(online_visitor_, RF_CHOOSER(Visitor_t)::choose(visitor_, stopvisiting)); #undef RF_CHOOSER vigra_precondition(options_.prepare_online_learning_,"onlineLearn: online learning must be enabled on RandomForest construction"); // Preprocess the data to get something the split functor can work // with. Also fill the ext_param structure by preprocessing // option parameters that could only be completely evaluated // when the training data is known. ext_param_.class_count_=0; Preprocessor_t preprocessor( features, response, options_, ext_param_); // Make stl compatible random functor. RandFunctor_t randint ( random); // Give the Split functor information about the data. split.set_external_parameters(ext_param_); stop.set_external_parameters(ext_param_); //Create poisson samples PoissonSampler<RandomTT800> poisson_sampler(1.0,vigra::Int32(new_start_index),vigra::Int32(ext_param().row_count_)); //TODO: visitors for online learning //visitor.visit_at_beginning(*this, preprocessor); // THE MAIN EFFING RF LOOP - YEAY DUDE! for(int ii = 0; ii < static_cast<int>(trees_.size()); ++ii) { online_visitor_.tree_id=ii; poisson_sampler.sample(); std::map<int,int> leaf_parents; leaf_parents.clear(); //Get all the leaf nodes for that sample for(int s=0;s<poisson_sampler.numOfSamples();++s) { int sample=poisson_sampler[s]; online_visitor_.current_label=preprocessor.response()(sample,0); online_visitor_.last_node_id=StackEntry_t::DecisionTreeNoParent; int leaf=trees_[ii].getToLeaf(rowVector(features,sample),online_visitor_); //Add to the list for that leaf online_visitor_.add_to_index_list(ii,leaf,sample); //TODO: Class count? //Store parent if(Node<e_ConstProbNode>(trees_[ii].topology_,trees_[ii].parameters_,leaf).prob_begin()[preprocessor.response()(sample,0)]!=1.0) { leaf_parents[leaf]=online_visitor_.last_node_id; } } std::map<int,int>::iterator leaf_iterator; for(leaf_iterator=leaf_parents.begin();leaf_iterator!=leaf_parents.end();++leaf_iterator) { int leaf=leaf_iterator->first; int parent=leaf_iterator->second; int lin_index=online_visitor_.trees_online_information[ii].exterior_to_index[leaf]; ArrayVector<Int32> indeces; indeces.clear(); indeces.swap(online_visitor_.trees_online_information[ii].index_lists[lin_index]); StackEntry_t stack_entry(indeces.begin(), indeces.end(), ext_param_.class_count_); if(parent!=-1) { if(NodeBase(trees_[ii].topology_,trees_[ii].parameters_,parent).child(0)==leaf) { stack_entry.leftParent=parent; } else { vigra_assert(NodeBase(trees_[ii].topology_,trees_[ii].parameters_,parent).child(1)==leaf,"last_node_id seems to be wrong"); stack_entry.rightParent=parent; } } //trees_[ii].continueLearn(preprocessor.features(),preprocessor.response(),stack_entry,split,stop,visitor,randint,leaf); trees_[ii].continueLearn(preprocessor.features(),preprocessor.response(),stack_entry,split,stop,visitor,randint,-1); //Now, the last one moved onto leaf online_visitor_.move_exterior_node(ii,trees_[ii].topology_.size(),ii,leaf); //Now it should be classified correctly! } /*visitor .visit_after_tree( *this, preprocessor, poisson_sampler, stack_entry, ii);*/ } //visitor.visit_at_end(*this, preprocessor); online_visitor_.deactivate(); } template<class LabelType, class PreprocessorTag> template<class U,class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void RandomForest<LabelType, PreprocessorTag>::reLearnTree(MultiArrayView<2,U,C1> const & features, MultiArrayView<2,U2,C2> const & response, int treeId, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t & random) { using namespace rf; typedef UniformIntRandomFunctor<Random_t> RandFunctor_t; // See rf_preprocessing.hxx for more info on this ext_param_.class_count_=0; typedef Processor<PreprocessorTag,LabelType, U, C1, U2, C2> Preprocessor_t; // default values and initialization // Value Chooser chooses second argument as value if first argument // is of type RF_DEFAULT. (thanks to template magic - don't care about // it - just smile and wave. #define RF_CHOOSER(type_) detail::Value_Chooser<type_, Default_##type_> Default_Stop_t default_stop(options_); typename RF_CHOOSER(Stop_t)::type stop = RF_CHOOSER(Stop_t)::choose(stop_, default_stop); Default_Split_t default_split; typename RF_CHOOSER(Split_t)::type split = RF_CHOOSER(Split_t)::choose(split_, default_split); rf::visitors::StopVisiting stopvisiting; typedef rf::visitors::detail::VisitorNode <rf::visitors::OnlineLearnVisitor, typename RF_CHOOSER(Visitor_t)::type> IntermedVis; IntermedVis visitor(online_visitor_, RF_CHOOSER(Visitor_t)::choose(visitor_, stopvisiting)); #undef RF_CHOOSER vigra_precondition(options_.prepare_online_learning_,"reLearnTree: Re learning trees only makes sense, if online learning is enabled"); online_visitor_.activate(); // Make stl compatible random functor. RandFunctor_t randint ( random); // Preprocess the data to get something the split functor can work // with. Also fill the ext_param structure by preprocessing // option parameters that could only be completely evaluated // when the training data is known. Preprocessor_t preprocessor( features, response, options_, ext_param_); // Give the Split functor information about the data. split.set_external_parameters(ext_param_); stop.set_external_parameters(ext_param_); /**\todo replace this crappy class out. It uses function pointers. * and is making code slower according to me. * Comment from Nathan: This is copied from Rahul, so me=Rahul */ Sampler<Random_t > sampler(preprocessor.strata().begin(), preprocessor.strata().end(), detail::make_sampler_opt(options_) .sampleSize(ext_param().actual_msample_), &random); //initialize First region/node/stack entry sampler .sample(); StackEntry_t first_stack_entry( sampler.sampledIndices().begin(), sampler.sampledIndices().end(), ext_param_.class_count_); first_stack_entry .set_oob_range( sampler.oobIndices().begin(), sampler.oobIndices().end()); online_visitor_.reset_tree(treeId); online_visitor_.tree_id=treeId; trees_[treeId].reset(); trees_[treeId] .learn( preprocessor.features(), preprocessor.response(), first_stack_entry, split, stop, visitor, randint); visitor .visit_after_tree( *this, preprocessor, sampler, first_stack_entry, treeId); online_visitor_.deactivate(); } template <class LabelType, class PreprocessorTag> template <class U, class C1, class U2,class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t> void RandomForest<LabelType, PreprocessorTag>:: learn( MultiArrayView<2, U, C1> const & features, MultiArrayView<2, U2,C2> const & response, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t const & random) { using namespace rf; //this->reset(); //typedefs typedef UniformIntRandomFunctor<Random_t> RandFunctor_t; // See rf_preprocessing.hxx for more info on this typedef Processor<PreprocessorTag,LabelType, U, C1, U2, C2> Preprocessor_t; vigra_precondition(features.shape(0) == response.shape(0), "RandomForest::learn(): shape mismatch between features and response."); // default values and initialization // Value Chooser chooses second argument as value if first argument // is of type RF_DEFAULT. (thanks to template magic - don't care about // it - just smile and wave). #define RF_CHOOSER(type_) detail::Value_Chooser<type_, Default_##type_> Default_Stop_t default_stop(options_); typename RF_CHOOSER(Stop_t)::type stop = RF_CHOOSER(Stop_t)::choose(stop_, default_stop); Default_Split_t default_split; typename RF_CHOOSER(Split_t)::type split = RF_CHOOSER(Split_t)::choose(split_, default_split); rf::visitors::StopVisiting stopvisiting; typedef rf::visitors::detail::VisitorNode< rf::visitors::OnlineLearnVisitor, typename RF_CHOOSER(Visitor_t)::type> IntermedVis; IntermedVis visitor(online_visitor_, RF_CHOOSER(Visitor_t)::choose(visitor_, stopvisiting)); #undef RF_CHOOSER if(options_.prepare_online_learning_) online_visitor_.activate(); else online_visitor_.deactivate(); // Make stl compatible random functor. RandFunctor_t randint ( random); // Preprocess the data to get something the split functor can work // with. Also fill the ext_param structure by preprocessing // option parameters that could only be completely evaluated // when the training data is known. Preprocessor_t preprocessor( features, response, options_, ext_param_); // Give the Split functor information about the data. split.set_external_parameters(ext_param_); stop.set_external_parameters(ext_param_); //initialize trees. trees_.resize(options_.tree_count_ , DecisionTree_t(ext_param_)); Sampler<Random_t > sampler(preprocessor.strata().begin(), preprocessor.strata().end(), detail::make_sampler_opt(options_) .sampleSize(ext_param().actual_msample_), &random); visitor.visit_at_beginning(*this, preprocessor); // THE MAIN EFFING RF LOOP - YEAY DUDE! for(int ii = 0; ii < static_cast<int>(trees_.size()); ++ii) { //initialize First region/node/stack entry sampler .sample(); StackEntry_t first_stack_entry( sampler.sampledIndices().begin(), sampler.sampledIndices().end(), ext_param_.class_count_); first_stack_entry .set_oob_range( sampler.oobIndices().begin(), sampler.oobIndices().end()); trees_[ii] .learn( preprocessor.features(), preprocessor.response(), first_stack_entry, split, stop, visitor, randint); visitor .visit_after_tree( *this, preprocessor, sampler, first_stack_entry, ii); } visitor.visit_at_end(*this, preprocessor); // Only for online learning? online_visitor_.deactivate(); } template <class LabelType, class Tag> template <class U, class C, class Stop> LabelType RandomForest<LabelType, Tag> ::predictLabel(MultiArrayView<2, U, C> const & features, Stop & stop) const { vigra_precondition(columnCount(features) >= ext_param_.column_count_, "RandomForestn::predictLabel():" " Too few columns in feature matrix."); vigra_precondition(rowCount(features) == 1, "RandomForestn::predictLabel():" " Feature matrix must have a singlerow."); MultiArray<2, double> probabilities(Shape2(1, ext_param_.class_count_), 0.0); LabelType d; predictProbabilities(features, probabilities, stop); ext_param_.to_classlabel(argMax(probabilities), d); return d; } //Same thing as above with priors for each label !!! template <class LabelType, class PreprocessorTag> template <class U, class C> LabelType RandomForest<LabelType, PreprocessorTag> ::predictLabel( MultiArrayView<2, U, C> const & features, ArrayVectorView<double> priors) const { using namespace functor; vigra_precondition(columnCount(features) >= ext_param_.column_count_, "RandomForestn::predictLabel(): Too few columns in feature matrix."); vigra_precondition(rowCount(features) == 1, "RandomForestn::predictLabel():" " Feature matrix must have a single row."); Matrix<double> prob(1,ext_param_.class_count_); predictProbabilities(features, prob); std::transform( prob.begin(), prob.end(), priors.begin(), prob.begin(), Arg1()*Arg2()); LabelType d; ext_param_.to_classlabel(argMax(prob), d); return d; } template<class LabelType,class PreprocessorTag> template <class T1,class T2, class C> void RandomForest<LabelType,PreprocessorTag> ::predictProbabilities(OnlinePredictionSet<T1> & predictionSet, MultiArrayView<2, T2, C> & prob) { //Features are n xp //prob is n x NumOfLabel probability for each feature in each class vigra_precondition(rowCount(predictionSet.features) == rowCount(prob), "RandomFroest::predictProbabilities():" " Feature matrix and probability matrix size mismatch."); // num of features must be bigger than num of features in Random forest training // but why bigger? vigra_precondition( columnCount(predictionSet.features) >= ext_param_.column_count_, "RandomForestn::predictProbabilities():" " Too few columns in feature matrix."); vigra_precondition( columnCount(prob) == static_cast<MultiArrayIndex>(ext_param_.class_count_), "RandomForestn::predictProbabilities():" " Probability matrix must have as many columns as there are classes."); prob.init(0.0); //store total weights std::vector<T1> totalWeights(predictionSet.indices[0].size(),0.0); //Go through all trees int set_id=-1; for(int k=0; k<options_.tree_count_; ++k) { set_id=(set_id+1) % predictionSet.indices[0].size(); typedef std::set<SampleRange<T1> > my_set; typedef typename my_set::iterator set_it; //typedef std::set<std::pair<int,SampleRange<T1> > >::iterator set_it; //Build a stack with all the ranges we have std::vector<std::pair<int,set_it> > stack; stack.clear(); for(set_it i=predictionSet.ranges[set_id].begin(); i!=predictionSet.ranges[set_id].end();++i) stack.push_back(std::pair<int,set_it>(2,i)); //get weights predicted by single tree int num_decisions=0; while(!stack.empty()) { set_it range=stack.back().second; int index=stack.back().first; stack.pop_back(); ++num_decisions; if(trees_[k].isLeafNode(trees_[k].topology_[index])) { ArrayVector<double>::iterator weights=Node<e_ConstProbNode>(trees_[k].topology_, trees_[k].parameters_, index).prob_begin(); for(int i=range->start;i!=range->end;++i) { //update votecount. for(int l=0; l<ext_param_.class_count_; ++l) { prob(predictionSet.indices[set_id][i], l) += static_cast<T2>(weights[l]); //every weight in totalWeight. totalWeights[predictionSet.indices[set_id][i]] += static_cast<T1>(weights[l]); } } } else { if(trees_[k].topology_[index]!=i_ThresholdNode) { throw std::runtime_error("predicting with online prediction sets is only supported for RFs with threshold nodes"); } Node<i_ThresholdNode> node(trees_[k].topology_,trees_[k].parameters_,index); if(range->min_boundaries[node.column()]>=node.threshold()) { //Everything goes to right child stack.push_back(std::pair<int,set_it>(node.child(1),range)); continue; } if(range->max_boundaries[node.column()]<node.threshold()) { //Everything goes to the left child stack.push_back(std::pair<int,set_it>(node.child(0),range)); continue; } //We have to split at this node SampleRange<T1> new_range=*range; new_range.min_boundaries[node.column()]=FLT_MAX; range->max_boundaries[node.column()]=-FLT_MAX; new_range.start=new_range.end=range->end; int i=range->start; while(i!=range->end) { //Decide for range->indices[i] if(predictionSet.features(predictionSet.indices[set_id][i],node.column())>=node.threshold()) { new_range.min_boundaries[node.column()]=std::min(new_range.min_boundaries[node.column()], predictionSet.features(predictionSet.indices[set_id][i],node.column())); --range->end; --new_range.start; std::swap(predictionSet.indices[set_id][i],predictionSet.indices[set_id][range->end]); } else { range->max_boundaries[node.column()]=std::max(range->max_boundaries[node.column()], predictionSet.features(predictionSet.indices[set_id][i],node.column())); ++i; } } //The old one ... if(range->start==range->end) { predictionSet.ranges[set_id].erase(range); } else { stack.push_back(std::pair<int,set_it>(node.child(0),range)); } //And the new one ... if(new_range.start!=new_range.end) { std::pair<set_it,bool> new_it=predictionSet.ranges[set_id].insert(new_range); stack.push_back(std::pair<int,set_it>(node.child(1),new_it.first)); } } } predictionSet.cumulativePredTime[k]=num_decisions; } for(unsigned int i=0;i<totalWeights.size();++i) { double test=0.0; //Normalise votes in each row by total VoteCount (totalWeight for(int l=0; l<ext_param_.class_count_; ++l) { test+=prob(i,l); prob(i, l) /= totalWeights[i]; } assert(test==totalWeights[i]); assert(totalWeights[i]>0.0); } } template <class LabelType, class PreprocessorTag> template <class U, class C1, class T, class C2, class Stop_t> void RandomForest<LabelType, PreprocessorTag> ::predictProbabilities(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & prob, Stop_t & stop_) const { //Features are n xp //prob is n x NumOfLabel probability for each feature in each class vigra_precondition(rowCount(features) == rowCount(prob), "RandomForestn::predictProbabilities():" " Feature matrix and probability matrix size mismatch."); // num of features must be bigger than num of features in Random forest training // but why bigger? vigra_precondition( columnCount(features) >= ext_param_.column_count_, "RandomForestn::predictProbabilities():" " Too few columns in feature matrix."); vigra_precondition( columnCount(prob) == static_cast<MultiArrayIndex>(ext_param_.class_count_), "RandomForestn::predictProbabilities():" " Probability matrix must have as many columns as there are classes."); #define RF_CHOOSER(type_) detail::Value_Chooser<type_, Default_##type_> Default_Stop_t default_stop(options_); typename RF_CHOOSER(Stop_t)::type & stop = RF_CHOOSER(Stop_t)::choose(stop_, default_stop); #undef RF_CHOOSER stop.set_external_parameters(ext_param_, tree_count()); prob.init(NumericTraits<T>::zero()); /* This code was originally there for testing early stopping * - we wanted the order of the trees to be randomized if(tree_indices_.size() != 0) { std::random_shuffle(tree_indices_.begin(), tree_indices_.end()); } */ //Classify for each row. for(int row=0; row < rowCount(features); ++row) { MultiArrayView<2, U, StridedArrayTag> currentRow(rowVector(features, row)); // when the features contain an NaN, the instance doesn't belong to any class // => indicate this by returning a zero probability array. if(detail::contains_nan(currentRow)) { rowVector(prob, row).init(0.0); continue; } ArrayVector<double>::const_iterator weights; //totalWeight == totalVoteCount! double totalWeight = 0.0; //Let each tree classify... for(int k=0; k<options_.tree_count_; ++k) { //get weights predicted by single tree weights = trees_[k /*tree_indices_[k]*/].predict(currentRow); //update votecount. int weighted = options_.predict_weighted_; for(int l=0; l<ext_param_.class_count_; ++l) { double cur_w = weights[l] * (weighted * (*(weights-1)) + (1-weighted)); prob(row, l) += static_cast<T>(cur_w); //every weight in totalWeight. totalWeight += cur_w; } if(stop.after_prediction(weights, k, rowVector(prob, row), totalWeight)) { break; } } //Normalise votes in each row by total VoteCount (totalWeight for(int l=0; l< ext_param_.class_count_; ++l) { prob(row, l) /= detail::RequiresExplicitCast<T>::cast(totalWeight); } } } template <class LabelType, class PreprocessorTag> template <class U, class C1, class T, class C2> void RandomForest<LabelType, PreprocessorTag> ::predictRaw(MultiArrayView<2, U, C1>const & features, MultiArrayView<2, T, C2> & prob) const { //Features are n xp //prob is n x NumOfLabel probability for each feature in each class vigra_precondition(rowCount(features) == rowCount(prob), "RandomForestn::predictProbabilities():" " Feature matrix and probability matrix size mismatch."); // num of features must be bigger than num of features in Random forest training // but why bigger? vigra_precondition( columnCount(features) >= ext_param_.column_count_, "RandomForestn::predictProbabilities():" " Too few columns in feature matrix."); vigra_precondition( columnCount(prob) == static_cast<MultiArrayIndex>(ext_param_.class_count_), "RandomForestn::predictProbabilities():" " Probability matrix must have as many columns as there are classes."); #define RF_CHOOSER(type_) detail::Value_Chooser<type_, Default_##type_> prob.init(NumericTraits<T>::zero()); /* This code was originally there for testing early stopping * - we wanted the order of the trees to be randomized if(tree_indices_.size() != 0) { std::random_shuffle(tree_indices_.begin(), tree_indices_.end()); } */ //Classify for each row. for(int row=0; row < rowCount(features); ++row) { ArrayVector<double>::const_iterator weights; //totalWeight == totalVoteCount! double totalWeight = 0.0; //Let each tree classify... for(int k=0; k<options_.tree_count_; ++k) { //get weights predicted by single tree weights = trees_[k /*tree_indices_[k]*/].predict(rowVector(features, row)); //update votecount. int weighted = options_.predict_weighted_; for(int l=0; l<ext_param_.class_count_; ++l) { double cur_w = weights[l] * (weighted * (*(weights-1)) + (1-weighted)); prob(row, l) += static_cast<T>(cur_w); //every weight in totalWeight. totalWeight += cur_w; } } } prob/= options_.tree_count_; } } // namespace vigra #include "random_forest/rf_algorithm.hxx" #endif // VIGRA_RANDOM_FOREST_HXX
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : utility.asm ; Purpose : General Utility functions ; Date : 6th June 2019 ; Author : paul@robsons.org.uk ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; Report Error, at return address ; ; ******************************************************************************************* ErrorHandler: rep #$30 ; in case we changed it. plx ; address of error message -1 inx ; error message. jsr PrintROMMessage ; print message in ROM lda DLineNumber ; is it line 0 (e.g. typed in) beq _EHEndMessage ldx #_EHAt & $FFFF ; print " at " jsr PrintROMMessage lda DLineNumber ; Line# in YA ldy #0 ldx #10 ; base 10 jsr ConvertToString ; convert and print it. tay jsr PrintBASICString _EHEndMessage: jsr HWNewLine jmp NextCommand ; get next command. _EHAt: .text " at ",$00 ; ******************************************************************************************* ; ; Default handler for keywords, produces error if not implemented ; ; ******************************************************************************************* IllegalToken: #error "Illegal Token" ; ******************************************************************************************* ; ; Report Syntax Error ; ; ******************************************************************************************* SyntaxError: #error "Syntax Error" ; ******************************************************************************************* ; ; Report Memory Error ; ; ******************************************************************************************* OutOfMemoryError: #error "Out of memory" ; ******************************************************************************************* ; ; Check what the next token is ; ; ******************************************************************************************* ExpectToken: cmp (DCodePtr) ; does it match the next token bne _CTKError ; error if not inc DCodePtr ; skip the token inc DCodePtr rts _CTKError: #error "Missing token" ; ******************************************************************************************* ExpectRightBracket: ; shorthand because right parenthesis common pha lda #rparenTokenID jsr ExpectToken pla rts ExpectComma: pha lda #commaTokenID ; shorthand because comma is used a fair bit. jsr ExpectToken pla rts ; ******************************************************************************************* ; ; Check if both L + R values are Numeric ; ; ******************************************************************************************* CheckBothNumeric: lda EXSPrecType+0,x ; OR together their prec/type ora EXSPrecType+EXSNext,x bmi _CBNFail ; need to both be zero in bit 15 rts _CBNFail: #error "Operator integer only" ; ******************************************************************************************* ; ; Set the return type as integer ; ; ******************************************************************************************* ResetTypeInteger: lda EXSPrecType+0,x ; clear bit 15 and #$7FFF sta EXSPrecType+0,x rts ; ******************************************************************************************* ; ; Set the return type as string ; ; ******************************************************************************************* ResetTypeString: lda EXSPrecType+0,x ; clear bit 15 ora #$8000 sta EXSPrecType+0,x rts ; ******************************************************************************************* ; ; Print ROM message prints the message in the "ROM Image" at X ; ; ******************************************************************************************* PrintROMMessage: pha phx _PRMLoop: lda StartOfBasicCode,x ; print characters until $00 found. and #$00FF beq _PRMExit cmp #13 bne _PRMChar jsr HWNewLine bra _PRMNext _PRMChar: jsr HWPrintChar _PRMNext: inx bra _PRMLoop _PRMExit: plx pla rts ; ******************************************************************************************* ; ; Print a BASIC String in the data page at Y (e.g. preceded with length) ; ; ******************************************************************************************* PrintBASICString: pha phx phy lda $0000,y ; get length and #$00FF beq _PBSExit ; null string tax _PBSLoop: ; print X characters out iny lda $0000,y jsr HWPrintChar dex bne _PBSLoop _PBSExit: ply plx pla rts
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : varcreate.asm ; Purpose : Create variable whose description is in the variable slot. ; Date : 20th August 2019 ; Author : Paul Robson (paul@robsons.org.uk) ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; Create variable and default array, if it's an array. ; ; ******************************************************************************************* VariableCreate: phx phy lda VarMemPtr ; get address of next free into zTemp1 sta zTemp1 lda VarMemPtr+1 sta zTemp1+1 ; lda Var_DataSize ; bytes for the data bit clc adc Var_Length ; add the length of the name adc #3 ; 3 for the link and the hash. ; adc VarMemPtr ; add to variable memory pointer sta VarMemPtr bcc _VCNoCarry inc VarMemPtr+1 _VCNoCarry: ; lda Var_HashAddress ; hash table pointer in zTemp2 sta zTemp2 lda #HashTableBase >> 8 sta zTemp2+1 ; ldy #0 ; put current hash link in position. lda (zTemp2),y sta (zTemp1),y iny lda (zTemp2),y sta (zTemp1),y iny ; lda Var_Hash ; write the hash out. sta (zTemp1),y iny ; ldx #0 ; copy the name out. _VCCopyName: lda Var_Buffer,x sta (zTemp1),y inx iny cpx Var_Length bne _VCCopyName ; phy ; save the data offset. ldx Var_DataSize ; and write the data out. lda #0 ; which is all zeroes. _VCClearData: sta (zTemp1),y iny dex bne _VCClearData ; pla ; offset to the data clc adc zTemp1 ; add to start and save as data pointer. sta zVarDataPtr lda zTemp1+1 adc #0 sta zVarDataPtr+1 ; lda Var_Type ; and set the type. sta zVarType ; lda zTemp1 ; fix hash link to point to new record ldy #0 sta (zTemp2),y iny lda zTemp1+1 sta (zTemp2),y lda Var_Type ; array ? if so create the empty one. and #1 cmp #(token_DollarLParen & 1) bne _VCNotArray ; ldx #0 ; call recursive array creator jsr ArrayCreate ; phy ; save YA at zVarDataPtr ldy #0 sta (zVarDataPtr),y iny pla sta (zVarDataPtr),y ; _VCNotArray: ply plx rts
#ifndef GREGORIAN_HPP__ #define GREGORIAN_HPP__ /* Copyright (c) 2002-2004 CrystalClear Software, Inc. * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst * $Date: 2008-02-27 21:00:24 +0100 (mer., 27 févr. 2008) $ */ /*! @file gregorian.hpp Single file header that provides overall include for all elements of the gregorian date-time system. This includes the various types defined, but also other functions for formatting and parsing. */ #include "boost/date_time/compiler_config.hpp" #include "boost/date_time/gregorian/gregorian_types.hpp" #include "boost/date_time/gregorian/conversion.hpp" #if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) #include "boost/date_time/gregorian/formatters_limited.hpp" #else #include "boost/date_time/gregorian/formatters.hpp" #endif #if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) #include "boost/date_time/gregorian/greg_facet.hpp" #else #include "boost/date_time/gregorian/gregorian_io.hpp" #endif // USE_DATE_TIME_PRE_1_33_FACET_IO #include "boost/date_time/gregorian/parsers.hpp" #endif
;================================================================================ ; Dialog Pointer Override ;-------------------------------------------------------------------------------- DialogOverride: LDA $7F5035 : BEQ .skip LDA $7F5700, X ; use alternate buffer RTL .skip LDA $7F1200, X RTL ;-------------------------------------------------------------------------------- ; $7F5035 - Alternate Text Pointer Flag ; 0=Disable ; $7F5036 - Padding Byte (Must be Zero) ; $7F5700 - $7F57FF - Dialog Buffer ;-------------------------------------------------------------------------------- ResetDialogPointer: STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$00 : STA $7F5035 ; zero out the alternate flag LDA.b #$1C : STA $1CE9 ; thing we wrote over RTL ;-------------------------------------------------------------------------------- ;macro LoadDialog(index,table) ; PHA : PHX : PHY ; PHB : PHK : PLB ; LDA $00 : PHA ; LDA $01 : PHA ; LDA $02 : PHA ; LDA.b #$01 : STA $7F5035 ; set flag ; ; LDA <index> : ASL : !ADD.l <index> : TAX ; get quote offset *3, move to X ; LDA <table>, X : STA $00 ; write pointer to direct page ; LDA <table>+1, X : STA $01 ; LDA <table>+2, X : STA $02 ; ; LDX.b #$00 : LDY.b #$00 ; - ; LDA [$00], Y ; load the next character from the pointer ; STA $7F5700, X ; write to the buffer ; INX : INY ; CMP.b #$7F : BNE - ; PLA : STA $02 ; PLA : STA $01 ; PLA : STA $00 ; PLB ; PLY : PLX : PLA ;endmacro ;-------------------------------------------------------------------------------- ;macro LoadDialogAddress(address) ; PHA : PHX : PHY ; PHP ; PHB : PHK : PLB ; SEP #$30 ; set 8-bit accumulator and index registers ; LDA $00 : PHA ; LDA $01 : PHA ; LDA $02 : PHA ; LDA.b #$01 : STA $7F5035 ; set flag ; ; LDA.b #<address> : STA $00 ; write pointer to direct page ; LDA.b #<address>>>8 : STA $01 ; LDA.b #<address>>>16 : STA $02 ; ; LDX.b #$00 : LDY.b #$00 ; - ; LDA [$00], Y ; load the next character from the pointer ; STA $7F5700, X ; write to the buffer ; INX : INY ; CMP.b #$7F : BNE - ; PLA : STA $02 ; PLA : STA $01 ; PLA : STA $00 ; PLB ; PLP ; PLY : PLX : PLA ;endmacro ;-------------------------------------------------------------------------------- !OFFSET_POINTER = "$7F5094" !OFFSET_RETURN = "$7F5096" !DIALOG_BUFFER = "$7F5700" macro LoadDialogAddress(address) PHA : PHX : PHY PHP PHB : PHK : PLB SEP #$20 ; set 8-bit accumulator REP #$10 ; set 16-bit index registers PEI ($00) LDA $02 : PHA STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$01 : STA $7F5035 ; set flag %CopyDialog(<address>) PLA : STA $02 REP #$20 PLA : STA $00 PLB PLP PLY : PLX : PLA endmacro ;-------------------------------------------------------------------------------- macro CopyDialog(address) LDA.b #<address> : STA $00 ; write pointer to direct page LDA.b #<address>>>8 : STA $01 LDA.b #<address>>>16 : STA $02 %CopyDialogIndirect() endmacro ;-------------------------------------------------------------------------------- macro CopyDialogIndirect() REP #$20 : LDA !OFFSET_POINTER : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0 ?loop: LDA [$00], Y ; load the next character from the pointer STA !DIALOG_BUFFER, X ; write to the buffer INX : INY CMP.b #$7F : BNE ?loop REP #$20 ; set 16-bit accumulator TXA : INC : STA !OFFSET_RETURN ; copy out X into LDA.w #$0000 : STA !OFFSET_POINTER SEP #$20 ; set 8-bit accumulator endmacro ;-------------------------------------------------------------------------------- LoadDialogAddressIndirect: STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$01 : STA $7F5035 ; set flag %CopyDialogIndirect() ;%LoadDialogAddress(UncleText) RTL ;-------------------------------------------------------------------------------- !ITEM_TEMPORARY = "$7F5040" FreeDungeonItemNotice: STA !ITEM_TEMPORARY PHA : PHX : PHY PHP PHB : PHK : PLB SEP #$20 ; set 8-bit accumulator REP #$10 ; set 16-bit index registers PEI ($00) LDA $02 : PHA ;-------------------------------- LDA.l FreeItemText : BNE + : JMP .skip : + LDA #$00 : STA $7F5010 ; initialize scratch LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key LDA !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key %CopyDialog(Notice_SmallKeyOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass LDA !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass %CopyDialog(Notice_CompassOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done + : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map LDA !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map %CopyDialog(Notice_MapOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key LDA !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key %CopyDialog(Notice_BigKeyOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done + LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map LDA !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only CMP.b #$70 : BNE + ; map of... %CopyDialog(Notice_MapOf) JMP .dungeon + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of... %CopyDialog(Notice_CompassOf) JMP .dungeon + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of... %CopyDialog(Notice_BigKeyOf) BRA .dungeon + : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of... LDA !ITEM_TEMPORARY : CMP.b #$AF : BNE ++ : JMP .skip : ++ %CopyDialog(Notice_SmallKeyOf) PLA : AND.b #$0F : STA $7F5020 : LDA.b #$0F : !SUB $7F5020 : PHA LDA #$01 : STA $7F5010 ; set up a flip for small keys BRA .dungeon + JMP .skip ; it's not something we are going to give a notice for .dungeon LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA !ITEM_TEMPORARY AND.b #$0F ; looking at low bits only STA $7F5011 LDA $7F5010 : BEQ + LDA $7F5010 LDA #$0F : !SUB $7F5011 : STA $7F5011 ; flip the values for small keys + LDA $7F5011 CMP.b #$00 : BNE + ; ...light world %CopyDialog(Notice_LightWorld) : JMP .done + : CMP.b #$01 : BNE + ; ...dark world %CopyDialog(Notice_DarkWorld) : JMP .done + : CMP.b #$02 : BNE + ; ...ganon's tower %CopyDialog(Notice_GTower) : JMP .done + : CMP.b #$03 : BNE + ; ...turtle rock %CopyDialog(Notice_TRock) : JMP .done + : CMP.b #$04 : BNE + ; ...thieves' town %CopyDialog(Notice_Thieves) : JMP .done + : CMP.b #$05 : BNE + ; ...tower of hera %CopyDialog(Notice_Hera) : JMP .done + : CMP.b #$06 : BNE + ; ...ice palace %CopyDialog(Notice_Ice) : JMP .done + : CMP.b #$07 : BNE + ; ...skull woods %CopyDialog(Notice_Skull) : JMP .done + : CMP.b #$08 : BNE + ; ...misery mire %CopyDialog(Notice_Mire) : JMP .done + : CMP.b #$09 : BNE + ; ...dark palace %CopyDialog(Notice_PoD) : JMP .done + : CMP.b #$0A : BNE + ; ...swamp palace %CopyDialog(Notice_Swamp) : JMP .done + : CMP.b #$0B : BNE + ; ...agahnim's tower %CopyDialog(Notice_AgaTower) : JMP .done + : CMP.b #$0C : BNE + ; ...desert palace %CopyDialog(Notice_Desert) : JMP .done + : CMP.b #$0D : BNE + ; ...eastern palace %CopyDialog(Notice_Eastern) : BRA .done + : CMP.b #$0E : BNE + ; ...hyrule castle %CopyDialog(Notice_Castle) : BRA .done + : CMP.b #$0F : BNE + ; ...sewers %CopyDialog(Notice_Sewers) + .done STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$01 : STA $7F5035 ; set alternate dialog flag STA $7F509F ;-------------------------------- .skip PLA : STA $02 REP #$20 PLA : STA $00 PLB PLP PLY : PLX : PLA ;JSL.l Main_ShowTextMessage_Alt ; .skip can be here so long as this line remains commented out RTL ;-------------------------------------------------------------------------------- DialogResetSelectionIndex: JSL.l Attract_DecompressStoryGfx ; what we wrote over STZ $1CE8 RTL ;-------------------------------------------------------------------------------- DialogItemReceive: BCS .nomessage ; if doubling the item value overflowed it must be a rando item CPY #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item .nomessage LDA.w #$FFFF BRA .done ++ LDA.w Ancilla_ReceiveItem_item_messages, Y .done CMP.w #$FFFF RTL ;-------------------------------------------------------------------------------- DialogFairyThrow: LDA.l Restrict_Ponds : BEQ .normal LDA $7EF35C : ORA $7EF35D : ORA $7EF35E : ORA $7EF35F : BNE .normal .noInventory LDA $0D80, X : !ADD #$08 : STA $0D80, X LDA.b #$51 LDY.b #$01 RTL .normal LDA.b #$88 LDY.b #$00 RTL ;-------------------------------------------------------------------------------- DialogGanon1: JSL.l CheckGanonVulnerability REP #$20 LDA.w #$018C BCC + LDA.w #$016D + STA $1CF0 SEP #$20 JSL.l Sprite_ShowMessageMinimal_Alt RTL ;-------------------------------------------------------------------------------- ; #$0192 - no bow ; #$0193 - no silvers alternate ; #$0194 - no silvers ; #$0195 - silvers ; $7EF38E - bsp-- --- ; b = bow ; s = silver arrow bow ; p = 2nd progressive bow DialogGanon2: JSL.l CheckGanonVulnerability REP #$20 BCS + LDA.w #$018D : BRA ++ + LDA.l $7EF38E BIT.w #$0080 : BNE + ; branch if bow LDA.w #$0192 : BRA ++ + BIT.w #$0040 : BEQ + ; branch if no silvers LDA.w #$0195 : BRA ++ + BIT.w #$0020 : BNE + ; branch if p bow LDA.w #$0194 : BRA ++ + BIT.w #$0080 : BEQ + ; branch if no bow LDA.w #$0193 : BRA ++ + LDA.w #$016E ++ STA $1CF0 SEP #$20 JSL.l Sprite_ShowMessageMinimal_Alt RTL ;-------------------------------------------------------------------------------- DialogEtherTablet: PHA LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped - PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ LDA $7EF34B : BEQ .yesText : BRA .noText ++ LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText ;++ .yesText PLA LDA.b #$0C LDY.b #$01 JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) .noText PLA RTL ;-------------------------------------------------------------------------------- DialogBombosTablet: PHA LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped - PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ LDA $7EF34B : BEQ .yesText : BRA .noText ++ LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText ;++ .yesText PLA LDA.b #$0D LDY.b #$01 JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) .noText PLA RTL ;-------------------------------------------------------------------------------- DialogSahasrahla: LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant LDA.b #$2F LDY.b #$00 JML Sprite_ShowMessageUnconditional + RTL ;-------------------------------------------------------------------------------- DialogBombShopGuy: LDY.b #$15 LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 INY ; from 15 to 16 + TYA LDY.b #$01 JSL.l Sprite_ShowMessageUnconditional RTL ;--------------------------------------------------------------------------------------------------- AgahnimAsksAboutPed: LDA.l InvincibleGanon CMP.b #$06 : BNE .vanilla LDA.l $7EF300 ; check ped flag AND.b #$40 BNE .vanilla LDA.b #$8C ; message 018C for no ped STA.w $1CF0 .vanilla JML $05FA8E ; Sprite_ShowMessageMinimal ;-------------------------------------------------------------------------------- Main_ShowTextMessage_Alt: ; Are we in text mode? If so then end the routine. LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode Sprite_ShowMessageMinimal_Alt: STZ $11 PHX : PHY PEI ($00) LDA.b $02 : PHA LDA.b #$1C : STA.b $02 REP #$30 LDA.w $1CF0 : ASL : TAX LDA.l $7F71C0, X STA.b $00 SEP #$30 LDY.b #$00 LDA [$00], Y : CMP.b #$FE : BNE + INY : LDA [$00], Y : CMP.b #$6E : BNE + INY : LDA [$00], Y : : BNE + INY : LDA [$00], Y : CMP.b #$FE : BNE + INY : LDA [$00], Y : CMP.b #$6B : BNE + INY : LDA [$00], Y : CMP.b #$04 : BNE + STZ $1CE8 JMP .end + STZ $0223 ; Otherwise set it so we are in text mode. STZ $1CD8 ; Initialize the step in the submodule ; Go to text display mode (as opposed to maps, etc) LDA.b #$02 : STA $11 ; Store the current module in the temporary location. LDA $10 : STA $010C ; Switch the main module ($10) to text mode. LDA.b #$0E : STA $10 .end PLA : STA.b $02 PLA : STA.b $01 PLA : STA.b $00 PLY : PLX Main_ShowTextMessage_Alt_already_in_text_mode: RTL CalculateSignIndex: ; for the big 1024x1024 screens we are calculating link's effective ; screen area, as though the screen was 4 different 512x512 screens. ; And we do this in a way that will likely give the right value even ; with major glitches. LDA $8A : ASL A : TAY ;what we wrote over LDA $0712 : BEQ .done ; If a small map, we can skip these calculations. LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ + TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen. + LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ + TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen. + ; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash: TYA : AND.w #$00FF : TAY .done RTL ;-------------------------------------------------------------------------------- ; A0 - A9 - 0 - 9 ; AA - C3 - A - Z ; C6 - ? ; C7 - ! ; C8 - , ; C9 - - Hyphen ; CD - Japanese period ; CE - ~ ; D8 - ` apostraphe ;;-------------------------------------------------------------------------------- ;DialogUncleData: ;;-------------------------------------------------------------------------------- ; .pointers ; dl #DialogUncleData_weetabix ; dl #DialogUncleData_bootlessUntilBoots ; dl #DialogUncleData_onlyOneBed ; dl #DialogUncleData_onlyTextBox ; dl #DialogUncleData_mothTutorial ; dl #DialogUncleData_seedWorst ; dl #DialogUncleData_chasingTail ; dl #DialogUncleData_doneBefore ; dl #DialogUncleData_capeCanPass ; dl #DialogUncleData_bootsAtRace ; dl #DialogUncleData_kanzeonSeed ; dl #DialogUncleData_notRealUncle ; dl #DialogUncleData_haveAVeryBadTime ; dl #DialogUncleData_todayBadLuck ; dl #DialogUncleData_leavingGoodbye ; dl #DialogUncleData_iGotThis ; dl #DialogUncleData_raceToCastle ; dl #DialogUncleData_69BlazeIt ; dl #DialogUncleData_hi ; dl #DialogUncleData_gettingSmokes ; dl #DialogUncleData_dangerousSeeYa ; dl #DialogUncleData_badEnoughDude ; dl #DialogUncleData_iAmError ; dl #DialogUncleData_sub2Guaranteed ; dl #DialogUncleData_chestSecretEverybody ; dl #DialogUncleData_findWindFish ; dl #DialogUncleData_shortcutToGanon ; dl #DialogUncleData_moonCrashing ; dl #DialogUncleData_fightVoldemort ; dl #DialogUncleData_redMailForCowards ; dl #DialogUncleData_heyListen ; dl #DialogUncleData_excuseMePrincess ;;-------------------------------------------------------------------------------- ; .weetabix ; ; We’re out of / Weetabix. To / the store! ; db $00, $c0, $00, $ae, $00, $d8, $00, $bb, $00, $ae, $00, $ff, $00, $b8, $00, $be, $00, $bd, $00, $ff, $00, $b8, $00, $af ; db $75, $00, $c0, $00, $ae, $00, $ae, $00, $bd, $00, $aa, $00, $ab, $00, $b2, $00, $c1, $00, $cD, $00, $ff, $00, $bd, $00, $b8 ; db $76, $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $bc, $00, $bd, $00, $b8, $00, $bb, $00, $ae, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .bootlessUntilBoots ; ; This seed is / bootless / until boots. ; db $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $bc, $00, $ae, $00, $ae, $00, $ad, $00, $ff, $00, $b2, $00, $bc ; db $75, $00, $ab, $00, $b8, $00, $b8, $00, $bd, $00, $b5, $00, $ae, $00, $bc, $00, $bc ; db $76, $00, $be, $00, $b7, $00, $bd, $00, $b2, $00, $b5, $00, $ff, $00, $ab, $00, $b8, $00, $b8, $00, $bd, $00, $bc, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .onlyOneBed ; ; Why do we only / have one bed? ; db $00, $c0, $00, $b1, $00, $c2, $00, $ff, $00, $ad, $00, $b8, $00, $ff, $00, $c0, $00, $ae, $00, $ff, $00, $b8, $00, $b7, $00, $b5, $00, $c2 ; db $75, $00, $b1, $00, $aa, $00, $bf, $00, $ae, $00, $ff, $00, $b8, $00, $b7, $00, $ae, $00, $ff, $00, $ab, $00, $ae, $00, $ad, $00, $c6 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .onlyTextBox ; ; This is the / only textbox. ; db $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $b2, $00, $bc, $00, $ff, $00, $bd, $00, $b1, $00, $ae ; db $75, $00, $b8, $00, $b7, $00, $b5, $00, $c2, $00, $ff, $00, $bd, $00, $ae, $00, $c1, $00, $bd, $00, $ab, $00, $b8, $00, $c1, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .mothTutorial ; ; I'm going to / go watch the / Moth tutorial. ; db $00, $b2, $00, $d8, $00, $b6, $00, $ff, $00, $b0, $00, $b8, $00, $b2, $00, $b7, $00, $b0, $00, $ff, $00, $bd, $00, $b8 ; db $75, $00, $b0, $00, $b8, $00, $ff, $00, $c0, $00, $aa, $00, $bd, $00, $ac, $00, $b1, $00, $ff, $00, $bd, $00, $b1, $00, $ae ; db $76, $00, $b6, $00, $b8, $00, $bd, $00, $b1, $00, $ff, $00, $bd, $00, $be, $00, $bd, $00, $b8, $00, $bb, $00, $b2, $00, $aa, $00, $b5, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .seedWorst ; ; This seed is / the worst. ; db $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $bc, $00, $ae, $00, $ae, $00, $ad, $00, $ff, $00, $b2, $00, $bc ; db $75, $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $c0, $00, $b8, $00, $bb, $00, $bc, $00, $bd, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .chasingTail ; ; Chasing tail. / Fly ladies. / Do not follow. ; db $00, $ac, $00, $b1, $00, $aa, $00, $bc, $00, $b2, $00, $b7, $00, $b0, $00, $ff, $00, $bd, $00, $aa, $00, $b2, $00, $b5, $00, $cD ; db $75, $00, $af, $00, $b5, $00, $c2, $00, $ff, $00, $b5, $00, $aa, $00, $ad, $00, $b2, $00, $ae, $00, $bc, $00, $cD ; db $76, $00, $ad, $00, $b8, $00, $ff, $00, $b7, $00, $b8, $00, $bd, $00, $ff, $00, $af, $00, $b8, $00, $b5, $00, $b5, $00, $b8, $00, $c0, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .doneBefore ; ; I feel like / I’ve done this / before… ; db $00, $b2, $00, $ff, $00, $af, $00, $ae, $00, $ae, $00, $b5, $00, $ff, $00, $b5, $00, $b2, $00, $b4, $00, $ae ; db $75, $00, $b2, $00, $d8, $00, $bf, $00, $ae, $00, $ff, $00, $ad, $00, $b8, $00, $b7, $00, $ae, $00, $ff, $00, $bd, $00, $b1, $00, $b2, $00, $bc ; db $76, $00, $ab, $00, $ae, $00, $af, $00, $b8, $00, $bb, $00, $ae, $00, $cD, $00, $cD, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .capeCanPass ; ; Magic cape can / pass through / the barrier! ; db $00, $b6, $00, $aa, $00, $b0, $00, $b2, $00, $ac, $00, $ff, $00, $ac, $00, $aa, $00, $b9, $00, $ae, $00, $ff, $00, $ac, $00, $aa, $00, $b7 ; db $75, $00, $b9, $00, $aa, $00, $bc, $00, $bc, $00, $ff, $00, $bd, $00, $b1, $00, $bb, $00, $b8, $00, $be, $00, $b0, $00, $b1 ; db $76, $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $ab, $00, $aa, $00, $bb, $00, $bb, $00, $b2, $00, $ae, $00, $bb, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .bootsAtRace ; ; Boots at race? / Seed confirmed / impossible. ; db $00, $ab, $00, $b8, $00, $b8, $00, $bd, $00, $bc, $00, $ff, $00, $aa, $00, $bd, $00, $ff, $00, $bb, $00, $aa, $00, $ac, $00, $ae, $00, $c6 ; db $75, $00, $bc, $00, $ae, $00, $ae, $00, $ad, $00, $ff, $00, $ac, $00, $b8, $00, $b7, $00, $af, $00, $b2, $00, $bb, $00, $b6, $00, $ae, $00, $ad ; db $76, $00, $b2, $00, $b6, $00, $b9, $00, $b8, $00, $bc, $00, $bc, $00, $b2, $00, $ab, $00, $b5, $00, $ae, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .kanzeonSeed ; ; If this is a / Kanzeon seed, / I'm quitting. ; db $00, $b2, $00, $af, $00, $ff, $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $b2, $00, $bc, $00, $ff, $00, $aa ; db $75, $00, $b4, $00, $aa, $00, $b7, $00, $c3, $00, $ae, $00, $b8, $00, $b7, $00, $ff, $00, $bc, $00, $ae, $00, $ae, $00, $ad, $00, $c8 ; db $76, $00, $b2, $00, $d8, $00, $b6, $00, $ff, $00, $ba, $00, $be, $00, $b2, $00, $bd, $00, $bd, $00, $b2, $00, $b7, $00, $b0, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .notRealUncle ; ; I am not your / real uncle. ; db $00, $b2, $00, $ff, $00, $aa, $00, $b6, $00, $ff, $00, $b7, $00, $b8, $00, $bd, $00, $ff, $00, $c2, $00, $b8, $00, $be, $00, $bb ; db $75, $00, $bb, $00, $ae, $00, $aa, $00, $b5, $00, $ff, $00, $be, $00, $b7, $00, $ac, $00, $b5, $00, $ae, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .haveAVeryBadTime ; ; You're going / to have a very / bad time. ; db $00, $c2, $00, $b8, $00, $be, $00, $d8, $00, $bb, $00, $ae, $00, $ff, $00, $b0, $00, $b8, $00, $b2, $00, $b7, $00, $b0 ; db $75, $00, $bd, $00, $b8, $00, $ff, $00, $b1, $00, $aa, $00, $bf, $00, $ae, $00, $ff, $00, $aa, $00, $ff, $00, $bf, $00, $ae, $00, $bb, $00, $c2 ; db $76, $00, $ab, $00, $aa, $00, $ad, $00, $ff, $00, $bd, $00, $b2, $00, $b6, $00, $ae, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .todayBadLuck ; ; Today you / will have / bad luck. ; db $00, $bd, $00, $b8, $00, $ad, $00, $aa, $00, $c2, $00, $ff, $00, $c2, $00, $b8, $00, $be, $00, $ff, $00, $c0, $00, $b2, $00, $b5, $00, $b5 ; db $75, $00, $b1, $00, $aa, $00, $bf, $00, $ae, $00, $ff, $00, $ab, $00, $aa, $00, $ad, $00, $ff, $00, $b5, $00, $be, $00, $ac, $00, $b4, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .leavingGoodbye ; ; I am leaving / forever. / Goodbye. ; db $00, $b2, $00, $ff, $00, $aa, $00, $b6, $00, $ff, $00, $b5, $00, $ae, $00, $aa, $00, $bf, $00, $b2, $00, $b7, $00, $b0 ; db $75, $00, $af, $00, $b8, $00, $bb, $00, $ae, $00, $bf, $00, $ae, $00, $bb, $00, $cD ; db $76, $00, $b0, $00, $b8, $00, $b8, $00, $ad, $00, $ab, $00, $c2, $00, $ae, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .iGotThis ; ; Don’t worry. / I got this / covered. ; db $00, $ad, $00, $b8, $00, $b7, $00, $d8, $00, $bd, $00, $ff, $00, $c0, $00, $b8, $00, $bb, $00, $bb, $00, $c2, $00, $cD ; db $75, $00, $b2, $00, $ff, $00, $b0, $00, $b8, $00, $bd, $00, $ff, $00, $bd, $00, $b1, $00, $b2, $00, $bc ; db $76, $00, $ac, $00, $b8, $00, $bf, $00, $ae, $00, $bb, $00, $ae, $00, $ad, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .raceToCastle ; ; Race you to / the castle! ; db $00, $bb, $00, $aa, $00, $ac, $00, $ae, $00, $ff, $00, $c2, $00, $b8, $00, $be, $00, $ff, $00, $bd, $00, $b8 ; db $75, $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $ac, $00, $aa, $00, $bc, $00, $bd, $00, $b5, $00, $ae, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .69BlazeIt ; ; ~69 Blaze It!~ ; db $75, $00, $cE, $00, $a6, $00, $a9, $00, $ff, $00, $ab, $00, $b5, $00, $aa, $00, $c3, $00, $ae, $00, $ff, $00, $b2, $00, $bd, $00, $c7, $00, $cE ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .hi ; ; hi ; db $75, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $b1, $00, $b2 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .gettingSmokes ; ; I'M JUST GOING / OUT FOR A / PACK OF SMOKES. ; db $00, $b2, $00, $d8, $00, $b6, $00, $ff, $00, $b3, $00, $be, $00, $bc, $00, $bd, $00, $ff, $00, $b0, $00, $b8, $00, $b2, $00, $b7, $00, $b0 ; db $75, $00, $b8, $00, $be, $00, $bd, $00, $ff, $00, $af, $00, $b8, $00, $bb, $00, $ff, $00, $aa ; db $76, $00, $b9, $00, $aa, $00, $ac, $00, $b4, $00, $ff, $00, $b8, $00, $af, $00, $ff, $00, $bc, $00, $b6, $00, $b8, $00, $b4, $00, $ae, $00, $bc, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .dangerousSeeYa ; ; It's dangerous / to go alone. / See ya! ; db $00, $b2, $00, $bd, $00, $d8, $00, $bc, $00, $ff, $00, $ad, $00, $aa, $00, $b7, $00, $b0, $00, $ae, $00, $bb, $00, $b8, $00, $be, $00, $bc ; db $75, $00, $bd, $00, $b8, $00, $ff, $00, $b0, $00, $b8, $00, $ff, $00, $aa, $00, $b5, $00, $b8, $00, $b7, $00, $ae, $00, $cD ; db $76, $00, $bc, $00, $ae, $00, $ae, $00, $ff, $00, $c2, $00, $aa, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .badEnoughDude ; ; ARE YOU A BAD / ENOUGH DUDE TO / RESCUE ZELDA? ; db $00, $aa, $00, $bb, $00, $ae, $00, $ff, $00, $c2, $00, $b8, $00, $be, $00, $ff, $00, $aa, $00, $ff, $00, $ab, $00, $aa, $00, $ad ; db $75, $00, $ae, $00, $b7, $00, $b8, $00, $be, $00, $b0, $00, $b1, $00, $ff, $00, $ad, $00, $be, $00, $ad, $00, $ae, $00, $ff, $00, $bd, $00, $b8 ; db $76, $00, $bb, $00, $ae, $00, $bc, $00, $ac, $00, $be, $00, $ae, $00, $ff, $00, $c3, $00, $ae, $00, $b5, $00, $ad, $00, $aa, $00, $c6 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .iAmError ; ; I AM ERROR ; db $76, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $b2, $00, $ff, $00, $aa, $00, $b6, $00, $ff, $00, $ae, $00, $bb, $00, $bb, $00, $b8, $00, $bb ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .sub2Guaranteed ; ; This seed is / sub 2 hours, / guaranteed. ; db $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $bc, $00, $ae, $00, $ae, $00, $ad, $00, $ff, $00, $b2, $00, $bc ; db $75, $00, $bc, $00, $be, $00, $ab, $00, $ff, $00, $a2, $00, $ff, $00, $b1, $00, $b8, $00, $be, $00, $bb, $00, $bc, $00, $c8 ; db $76, $00, $b0, $00, $be, $00, $aa, $00, $bb, $00, $aa, $00, $b7, $00, $bd, $00, $ae, $00, $ae, $00, $ad, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .chestSecretEverybody ; ; The chest is / a secret to / everybody. ; db $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $ac, $00, $b1, $00, $ae, $00, $bc, $00, $bd, $00, $ff, $00, $b2, $00, $bc ; db $75, $00, $aa, $00, $ff, $00, $bc, $00, $ae, $00, $ac, $00, $bb, $00, $ae, $00, $bd, $00, $ff, $00, $bd, $00, $b8 ; db $76, $00, $ae, $00, $bf, $00, $ae, $00, $bb, $00, $c2, $00, $ab, $00, $b8, $00, $ad, $00, $c2, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .findWindFish ; ; I'm off to / find the / wind fish. ; db $00, $b2, $00, $d8, $00, $b6, $00, $ff, $00, $b8, $00, $af, $00, $af, $00, $ff, $00, $bd, $00, $b8 ; db $75, $00, $af, $00, $b2, $00, $b7, $00, $ad, $00, $ff, $00, $bd, $00, $b1, $00, $ae ; db $76, $00, $c0, $00, $b2, $00, $b7, $00, $ad, $00, $ff, $00, $af, $00, $b2, $00, $bc, $00, $b1, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .shortcutToGanon ; ; The shortcut / to Ganon / is this way! ; db $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $bc, $00, $b1, $00, $b8, $00, $bb, $00, $bd, $00, $ac, $00, $be, $00, $bd ; db $75, $00, $bd, $00, $b8, $00, $ff, $00, $b0, $00, $aa, $00, $b7, $00, $b8, $00, $b7 ; db $76, $00, $b2, $00, $bc, $00, $ff, $00, $bd, $00, $b1, $00, $b2, $00, $bc, $00, $ff, $00, $c0, $00, $aa, $00, $c2, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .moonCrashing ; ; THE MOON IS / CRASHING! RUN / FOR YOUR LIFE! ; db $00, $bd, $00, $b1, $00, $ae, $00, $ff, $00, $b6, $00, $b8, $00, $b8, $00, $b7, $00, $ff, $00, $b2, $00, $bc ; db $75, $00, $ac, $00, $bb, $00, $aa, $00, $bc, $00, $b1, $00, $b2, $00, $b7, $00, $b0, $00, $c7, $00, $ff, $00, $bb, $00, $be, $00, $b7 ; db $76, $00, $af, $00, $b8, $00, $bb, $00, $ff, $00, $c2, $00, $b8, $00, $be, $00, $bb, $00, $ff, $00, $b5, $00, $b2, $00, $af, $00, $ae, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .fightVoldemort ; ; Time to fight / he who must / not be named. ; db $00, $bd, $00, $b2, $00, $b6, $00, $ae, $00, $ff, $00, $bd, $00, $b8, $00, $ff, $00, $af, $00, $b2, $00, $b0, $00, $b1, $00, $bd ; db $75, $00, $b1, $00, $ae, $00, $ff, $00, $c0, $00, $b1, $00, $b8, $00, $ff, $00, $b6, $00, $be, $00, $bc, $00, $bd ; db $76, $00, $b7, $00, $b8, $00, $bd, $00, $ff, $00, $ab, $00, $ae, $00, $ff, $00, $b7, $00, $aa, $00, $b6, $00, $ae, $00, $ad, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .redMailForCowards ; ; RED MAIL / IS FOR / COWARDS. ; db $00, $bb, $00, $ae, $00, $ad, $00, $ff, $00, $b6, $00, $aa, $00, $b2, $00, $b5 ; db $75, $00, $b2, $00, $bc, $00, $ff, $00, $af, $00, $b8, $00, $bb ; db $76, $00, $ac, $00, $b8, $00, $c0, $00, $aa, $00, $bb, $00, $ad, $00, $bc, $00, $cD ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .heyListen ; ; HEY! / / LISTEN! ; db $00, $b1, $00, $ae, $00, $c2, $00, $c7 ; db $76, $00, $b5, $00, $b2, $00, $bc, $00, $bd, $00, $ae, $00, $b7, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ; .excuseMePrincess ; ; Well / excuuuuuse me, / princess! ; db $00, $c0, $00, $ae, $00, $b5, $00, $b5 ; db $75, $00, $ae, $00, $c1, $00, $ac, $00, $be, $00, $be, $00, $be, $00, $be, $00, $be, $00, $bc, $00, $ae, $00, $ff, $00, $b6, $00, $ae, $00, $c8 ; db $76, $00, $b9, $00, $bb, $00, $b2, $00, $b7, $00, $ac, $00, $ae, $00, $bc, $00, $bc, $00, $c7 ; db $7f, $7f ;;-------------------------------------------------------------------------------- ^32nd
#include <stan/math/rev/mat.hpp> #include <gtest/gtest.h> #include <test/unit/math/rev/mat/fun/util.hpp> #include <test/unit/math/prim/mat/fun/sort_test_util.hpp> #include <test/unit/math/rev/mat/util.hpp> #include <vector> void test_sort_asc(VEC val) { using stan::math::sort_asc; using stan::math::sort_asc; AVEC x; for (size_t i = 0U; i < val.size(); i++) x.push_back(AVAR(val[i])); VEC val_sorted = sort_asc(val); AVEC x_sorted = sort_asc(x); for (size_t i = 0U; i < val.size(); i++) EXPECT_EQ(val_sorted[i], x_sorted[i].val()); for (size_t i = 0U; i < val.size(); i++) for (size_t j = 0U; j < val.size(); j++) if (val_sorted[i] == val[j]) EXPECT_EQ(x_sorted[i], x[j]); else EXPECT_FALSE(x_sorted[i] == x[j]); } void test_sort_desc(VEC val) { using stan::math::sort_desc; using stan::math::sort_desc; AVEC x; for (size_t i = 0U; i < val.size(); i++) x.push_back(AVAR(val[i])); VEC val_sorted = sort_desc(val); AVEC x_sorted = sort_desc(x); for (size_t i = 0U; i < val.size(); i++) EXPECT_EQ(val_sorted[i], x_sorted[i].val()); for (size_t i = 0U; i < val.size(); i++) for (size_t j = 0U; j < val.size(); j++) if (val_sorted[i] == val[j]) EXPECT_EQ(x_sorted[i], x[j]); else EXPECT_FALSE(x_sorted[i] == x[j]); } template <typename T, int R, int C> void test_sort_asc(Eigen::Matrix<T, R, C> val) { using stan::math::sort_asc; using stan::math::sort_asc; typedef Eigen::Matrix<AVAR, R, C> AVEC; typedef Eigen::Matrix<double, R, C> VEC; const size_t size = val.size(); AVEC x(size); for (size_t i = 0U; i < size; i++) x.data()[i] = AVAR(val[i]); VEC val_sorted = sort_asc(val); AVEC x_sorted = sort_asc(x); for (size_t i = 0U; i < size; i++) EXPECT_EQ(val_sorted.data()[i], x_sorted.data()[i].val()); for (size_t i = 0U; i < size; i++) for (size_t j = 0U; j < size; j++) if (val_sorted.data()[i] == val.data()[j]) EXPECT_EQ(x_sorted.data()[i], x.data()[j]); else EXPECT_FALSE(x_sorted.data()[i] == x.data()[j]); } template <typename T, int R, int C> void test_sort_desc(Eigen::Matrix<T, R, C> val) { using stan::math::sort_desc; using stan::math::sort_desc; typedef Eigen::Matrix<AVAR, R, C> AVEC; typedef Eigen::Matrix<double, R, C> VEC; const size_t size = val.size(); AVEC x(size); for (size_t i = 0U; i < size; i++) x.data()[i] = AVAR(val[i]); VEC val_sorted = sort_desc(val); AVEC x_sorted = sort_desc(x); for (size_t i = 0U; i < size; i++) EXPECT_EQ(val_sorted.data()[i], x_sorted.data()[i].val()); for (size_t i = 0U; i < size; i++) for (size_t j = 0U; j < size; j++) if (val_sorted.data()[i] == val.data()[j]) EXPECT_EQ(x_sorted.data()[i], x.data()[j]); else EXPECT_FALSE(x_sorted.data()[i] == x.data()[j]); } TEST(AgradRev, sort) { VEC a; a.push_back(1); a.push_back(2); a.push_back(2); a.push_back(3); test_sort_asc(a); test_sort_desc(a); VEC b; b.push_back(1.1); b.push_back(2.2); b.push_back(33.1); b.push_back(-12.1); b.push_back(33.1); test_sort_asc(b); test_sort_desc(b); VEC c; c.push_back(1.1); c.push_back(-2); c.push_back(2.1); c.push_back(3); c.push_back(2.1); test_sort_asc(c); test_sort_desc(c); Eigen::RowVectorXd vec1(4); vec1 << 1, -33.1, 2.1, -33.1; test_sort_asc(vec1); test_sort_desc(vec1); Eigen::RowVectorXd vec2(5); vec2 << 1.1e-6, -2.3, 31.1, 1, -10.1; test_sort_asc(vec2); test_sort_desc(vec2); Eigen::VectorXd vec3(4); vec3 << -11.1, 2.2, -3.6, 2.2; test_sort_asc(vec3); test_sort_desc(vec3); Eigen::VectorXd vec4(3); vec4 << -10.1, 2.12, 3.102; test_sort_asc(vec4); test_sort_desc(vec4); Eigen::RowVectorXd vec5 = Eigen::RowVectorXd::Random(1, 10); test_sort_asc(vec5); test_sort_desc(vec5); Eigen::VectorXd vec6 = Eigen::VectorXd::Random(20, 1); test_sort_asc(vec6); test_sort_desc(vec6); } TEST(AgradRev, sort_no_thrown) { AVEC vec0; EXPECT_EQ(0U, vec0.size()); EXPECT_NO_THROW(sort_asc(vec0)); EXPECT_NO_THROW(sort_desc(vec0)); Eigen::Matrix<AVAR, Eigen::Dynamic, 1> vec1; EXPECT_EQ(0, vec1.size()); EXPECT_NO_THROW(sort_asc(vec1)); EXPECT_NO_THROW(sort_desc(vec1)); Eigen::Matrix<AVAR, 1, Eigen::Dynamic> vec2; EXPECT_EQ(0, vec2.size()); EXPECT_NO_THROW(sort_asc(vec2)); EXPECT_NO_THROW(sort_desc(vec2)); } TEST(MathMatrix, sortAscStdVecNan) { test_sort_asc_throws<std::vector<stan::math::var> >(); } TEST(MathMatrix, sortDescStdVecNan) { test_sort_desc_throws<std::vector<stan::math::var> >(); } TEST(MathMatrix, sortAscEigenVecNan) { test_sort_asc_throws<Eigen::Matrix<stan::math::var, -1, 1> >(); } TEST(MathMatrix, sortAscEigenRowVecNan) { test_sort_asc_throws<Eigen::Matrix<stan::math::var, 1, -1> >(); } TEST(MathMatrix, sortDescEigenVecNan) { test_sort_desc_throws<Eigen::Matrix<stan::math::var, -1, 1> >(); } TEST(MathMatrix, sortDescEigenRowVecNan) { test_sort_desc_throws<Eigen::Matrix<stan::math::var, 1, -1> >(); } TEST(AgradRevMatrix, check_varis_on_stack) { using stan::math::to_var; using stan::math::var; std::vector<stan::math::var> x(3); x[0] = 0; x[1] = 2; x[2] = 100; test::check_varis_on_stack(stan::math::sort_asc(x)); test::check_varis_on_stack(stan::math::sort_desc(x)); }
; A333718: a(n) = L(8*n+4)/7, where L=A000032 (the Lucas sequence). ; Submitted by Jon Maiga ; 1,46,2161,101521,4769326,224056801,10525900321,494493258286,23230657239121,1091346396980401,51270050000839726,2408601003642486721,113152977121196036161,5315781323692571212846,249728569236429650967601,11731926972788501024264401,551150839151823118489459246 seq $0,49685 ; a(n) = L(4*n+2)/3, where L=A000032 (the Lucas sequence). pow $0,2 div $0,35 mul $0,45 add $0,1
dnl Intel P5 mpn_sqr_basecase -- square an mpn number. dnl Copyright 1999-2002 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C P5: approx 8 cycles per crossproduct, or 15.5 cycles per triangular C product at around 20x20 limbs. C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size); C C Calculate src,size squared, storing the result in dst,2*size. C C The algorithm is basically the same as mpn/generic/sqr_basecase.c, but a C lot of function call overheads are avoided, especially when the size is C small. defframe(PARAM_SIZE,12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) TEXT ALIGN(8) PROLOGUE(mpn_sqr_basecase) deflit(`FRAME',0) movl PARAM_SIZE, %edx movl PARAM_SRC, %eax cmpl $2, %edx movl PARAM_DST, %ecx je L(two_limbs) movl (%eax), %eax ja L(three_or_more) C ----------------------------------------------------------------------------- C one limb only C eax src C ebx C ecx dst C edx mull %eax movl %eax, (%ecx) movl %edx, 4(%ecx) ret C ----------------------------------------------------------------------------- ALIGN(8) L(two_limbs): C eax src C ebx C ecx dst C edx size pushl %ebp pushl %edi pushl %esi pushl %ebx movl %eax, %ebx movl (%eax), %eax mull %eax C src[0]^2 movl %eax, (%ecx) C dst[0] movl %edx, %esi C dst[1] movl 4(%ebx), %eax mull %eax C src[1]^2 movl %eax, %edi C dst[2] movl %edx, %ebp C dst[3] movl (%ebx), %eax mull 4(%ebx) C src[0]*src[1] addl %eax, %esi popl %ebx adcl %edx, %edi adcl $0, %ebp addl %esi, %eax adcl %edi, %edx movl %eax, 4(%ecx) adcl $0, %ebp popl %esi movl %edx, 8(%ecx) movl %ebp, 12(%ecx) popl %edi popl %ebp ret C ----------------------------------------------------------------------------- ALIGN(8) L(three_or_more): C eax src low limb C ebx C ecx dst C edx size cmpl $4, %edx pushl %ebx deflit(`FRAME',4) movl PARAM_SRC, %ebx jae L(four_or_more) C ----------------------------------------------------------------------------- C three limbs C eax src low limb C ebx src C ecx dst C edx size pushl %ebp pushl %edi mull %eax C src[0] ^ 2 movl %eax, (%ecx) movl %edx, 4(%ecx) movl 4(%ebx), %eax xorl %ebp, %ebp mull %eax C src[1] ^ 2 movl %eax, 8(%ecx) movl %edx, 12(%ecx) movl 8(%ebx), %eax pushl %esi C risk of cache bank clash mull %eax C src[2] ^ 2 movl %eax, 16(%ecx) movl %edx, 20(%ecx) movl (%ebx), %eax mull 4(%ebx) C src[0] * src[1] movl %eax, %esi movl %edx, %edi movl (%ebx), %eax mull 8(%ebx) C src[0] * src[2] addl %eax, %edi movl %edx, %ebp adcl $0, %ebp movl 4(%ebx), %eax mull 8(%ebx) C src[1] * src[2] xorl %ebx, %ebx addl %eax, %ebp C eax C ebx zero, will be dst[5] C ecx dst C edx dst[4] C esi dst[1] C edi dst[2] C ebp dst[3] adcl $0, %edx addl %esi, %esi adcl %edi, %edi adcl %ebp, %ebp adcl %edx, %edx movl 4(%ecx), %eax adcl $0, %ebx addl %esi, %eax movl %eax, 4(%ecx) movl 8(%ecx), %eax adcl %edi, %eax movl 12(%ecx), %esi adcl %ebp, %esi movl 16(%ecx), %edi movl %eax, 8(%ecx) movl %esi, 12(%ecx) adcl %edx, %edi popl %esi movl 20(%ecx), %eax movl %edi, 16(%ecx) popl %edi popl %ebp adcl %ebx, %eax C no carry out of this popl %ebx movl %eax, 20(%ecx) ret C ----------------------------------------------------------------------------- ALIGN(8) L(four_or_more): C eax src low limb C ebx src C ecx dst C edx size C esi C edi C ebp C C First multiply src[0]*src[1..size-1] and store at dst[1..size]. deflit(`FRAME',4) pushl %edi FRAME_pushl() pushl %esi FRAME_pushl() pushl %ebp FRAME_pushl() leal (%ecx,%edx,4), %edi C dst end of this mul1 leal (%ebx,%edx,4), %esi C src end movl %ebx, %ebp C src negl %edx C -size xorl %ebx, %ebx C clear carry limb and carry flag leal 1(%edx), %ecx C -(size-1) L(mul1): C eax scratch C ebx carry C ecx counter, negative C edx scratch C esi &src[size] C edi &dst[size] C ebp src adcl $0, %ebx movl (%esi,%ecx,4), %eax mull (%ebp) addl %eax, %ebx movl %ebx, (%edi,%ecx,4) incl %ecx movl %edx, %ebx jnz L(mul1) C Add products src[n]*src[n+1..size-1] at dst[2*n-1...], for C n=1..size-2. C C The last two products, which are the end corner of the product C triangle, are handled separately to save looping overhead. These C are src[size-3]*src[size-2,size-1] and src[size-2]*src[size-1]. C If size is 4 then it's only these that need to be done. C C In the outer loop %esi is a constant, and %edi just advances by 1 C limb each time. The size of the operation decreases by 1 limb C each time. C eax C ebx carry (needing carry flag added) C ecx C edx C esi &src[size] C edi &dst[size] C ebp adcl $0, %ebx movl PARAM_SIZE, %edx movl %ebx, (%edi) subl $4, %edx negl %edx jz L(corner) L(outer): C ebx previous carry limb to store C edx outer loop counter (negative) C esi &src[size] C edi dst, pointing at stored carry limb of previous loop pushl %edx C new outer loop counter leal -2(%edx), %ecx movl %ebx, (%edi) addl $4, %edi addl $4, %ebp xorl %ebx, %ebx C initial carry limb, clear carry flag L(inner): C eax scratch C ebx carry (needing carry flag added) C ecx counter, negative C edx scratch C esi &src[size] C edi dst end of this addmul C ebp &src[j] adcl $0, %ebx movl (%esi,%ecx,4), %eax mull (%ebp) addl %ebx, %eax movl (%edi,%ecx,4), %ebx adcl $0, %edx addl %eax, %ebx movl %ebx, (%edi,%ecx,4) incl %ecx movl %edx, %ebx jnz L(inner) adcl $0, %ebx popl %edx C outer loop counter incl %edx jnz L(outer) movl %ebx, (%edi) L(corner): C esi &src[size] C edi &dst[2*size-4] movl -8(%esi), %eax movl -4(%edi), %ebx C risk of data cache bank clash here mull -12(%esi) C src[size-2]*src[size-3] addl %eax, %ebx movl %edx, %ecx adcl $0, %ecx movl -4(%esi), %eax mull -12(%esi) C src[size-1]*src[size-3] addl %ecx, %eax movl (%edi), %ecx adcl $0, %edx movl %ebx, -4(%edi) addl %eax, %ecx movl %edx, %ebx adcl $0, %ebx movl -4(%esi), %eax mull -8(%esi) C src[size-1]*src[size-2] movl %ecx, (%edi) addl %eax, %ebx adcl $0, %edx movl PARAM_SIZE, %eax negl %eax movl %ebx, 4(%edi) addl $1, %eax C -(size-1) and clear carry movl %edx, 8(%edi) C ----------------------------------------------------------------------------- C Left shift of dst[1..2*size-2], high bit shifted out becomes dst[2*size-1]. L(lshift): C eax counter, negative C ebx next limb C ecx C edx C esi C edi &dst[2*size-4] C ebp movl 12(%edi,%eax,8), %ebx rcll %ebx movl 16(%edi,%eax,8), %ecx rcll %ecx movl %ebx, 12(%edi,%eax,8) movl %ecx, 16(%edi,%eax,8) incl %eax jnz L(lshift) adcl %eax, %eax C high bit out movl PARAM_SRC, %esi movl PARAM_SIZE, %ecx C risk of cache bank clash movl %eax, 12(%edi) C dst most significant limb C ----------------------------------------------------------------------------- C Now add in the squares on the diagonal, namely src[0]^2, src[1]^2, ..., C src[size-1]^2. dst[0] hasn't yet been set at all yet, and just gets the C low limb of src[0]^2. movl (%esi), %eax C src[0] leal (%esi,%ecx,4), %esi C src end negl %ecx mull %eax movl %eax, 16(%edi,%ecx,8) C dst[0] movl %edx, %ebx addl $1, %ecx C size-1 and clear carry L(diag): C eax scratch (low product) C ebx carry limb C ecx counter, negative C edx scratch (high product) C esi &src[size] C edi &dst[2*size-4] C ebp scratch (fetched dst limbs) movl (%esi,%ecx,4), %eax adcl $0, %ebx mull %eax movl 16-4(%edi,%ecx,8), %ebp addl %ebp, %ebx movl 16(%edi,%ecx,8), %ebp adcl %eax, %ebp movl %ebx, 16-4(%edi,%ecx,8) movl %ebp, 16(%edi,%ecx,8) incl %ecx movl %edx, %ebx jnz L(diag) adcl $0, %edx movl 16-4(%edi), %eax C dst most significant limb addl %eax, %edx popl %ebp movl %edx, 16-4(%edi) popl %esi C risk of cache bank clash popl %edi popl %ebx ret EPILOGUE()
%ifdef CONFIG { "RegData": { "XMM0": ["0xc0800000bf800000", "0xc2800000c1800000"] }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rdx, 0xe0000000 mov rax, 0x400000003f800000 ; 2.0, 1.0 mov [rdx + 8 * 0], rax mov rax, 0x4100000040800000 ; 8.0, 4.0 mov [rdx + 8 * 1], rax mov rax, 0x4200000041800000 ; 32.0, 16.0 mov [rdx + 8 * 2], rax mov rax, 0x4300000042800000 ; 128.0, 64.0 mov [rdx + 8 * 3], rax movapd xmm0, [rdx] movapd xmm1, [rdx + 8 * 2] hsubps xmm0, xmm1 hlt
/* * Copyright (c) 2017, Intel Corporation * * 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. */ L0: (W&~f0.1)jmpi L256 L16: add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x48EC100:ud mov (1|M0) r16.2<1>:ud 0x0:ud and (1|M0) r16.3<1>:ud r0.3<0;1,0>:ud 0xFFFFFFFE:ud mov (8|M0) r17.0<1>:ud r25.0<8;8,1>:ud mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f mov (1|M0) r17.3<1>:f r10.7<0;1,0>:f send (1|M0) r112:uw r16:ub 0x2 a0.0 mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f mov (1|M0) r17.3<1>:f r10.7<0;1,0>:f send (1|M0) r120:uw r16:ub 0x2 a0.0 mov (1|M0) a0.8<1>:uw 0xE00:uw mov (1|M0) a0.9<1>:uw 0xE40:uw mov (1|M0) a0.10<1>:uw 0xE80:uw mov (1|M0) a0.11<1>:uw 0xEC0:uw add (4|M0) a0.12<1>:uw a0.8<4;4,1>:uw 0x100:uw L256: nop
.586 .model flat .code _conta_vocali_consonanti proc PUSH EBP MOV EBP, ESP PUSH EDI PUSH ESI PUSH EBX MOV EBX, dword ptr[EBP + 8] ;EBX - indirizzo vettore MOV ESI, 0 ;ESI - index MOV ECX, 0 ;ECX - numero vocali MOV EDX, 0 ;EDX - numero consonanti MOV EDI, 1 conta: MOV AL, byte ptr[EBX + ESI] ;AL - char corrente CMP AL, 0 JE fine_ciclo CMP AL, 64 JA potrebbe_essere_maiusc ;else: non e' una lettera riprendi_ciclo: INC ESI JMP conta potrebbe_essere_maiusc: CMP AL, 91 JB maiuscola CMP AL, 96 JA potrebbe_essere_min JMP riprendi_ciclo maiuscola: CMP AL, 65 JE incrementa_vocali CMP AL, 69 JE incrementa_vocali CMP AL, 73 JE incrementa_vocali CMP AL, 79 JE incrementa_vocali CMP AL, 85 JE incrementa_vocali JMP incrementa_consonanti potrebbe_essere_min: CMP AL, 123 JB minuscola JMP riprendi_ciclo minuscola: MOV EDI, 0 CMP AL, 97 JE incrementa_vocali CMP AL, 101 JE incrementa_vocali CMP AL, 105 JE incrementa_vocali CMP AL, 111 JE incrementa_vocali CMP AL, 117 JE incrementa_vocali JMP incrementa_consonanti incrementa_vocali: INC ECX JMP riprendi_ciclo incrementa_consonanti: INC EDX JMP riprendi_ciclo fine_ciclo: MOV EAX, 0 MOV EBX, dword ptr[EBP + 12] ;valori di ritorno MOV [EBX], ECX MOV EBX, dword ptr[EBP + 16] MOV [EBX], EDX ADD ECX, EDX ;ECX - lettere contate CMP ECX, 0 JE non_ci_sono_lettere CMP ECX, ESI JE ci_sono_solo_lettere JMP fine non_ci_sono_lettere: MOV EAX, -1 JMP fine ci_sono_solo_lettere: CMP EDI, 0 JE solo_lettere_con_min MOV EAX, -3 JMP fine solo_lettere_con_min: MOV EAX, -2 JMP fine fine: POP EBX POP ESI POP EDI MOV ESP, EBP POP EBP RET _conta_vocali_consonanti endp end
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ; convert 3 to a double precision float and store in xmm0 mov ecx, 3 cvtsi2sd xmm0, ecx ; convert 1 to a double precision float and store in xmm1 mov ecx, 1 cvtsi2sd xmm1, ecx ;TEST_BEGIN_RECORDING subsd xmm0, xmm1 ;TEST_END_RECORDING xor ecx, ecx cvtsi2sd xmm0, ecx cvtsi2sd xmm1, ecx
#include "TBDataFormats/HcalTBObjects/interface/HcalTBRunData.h" using namespace std; HcalTBRunData::HcalTBRunData() : runType_(""), beamMode_(""), beamEnergyGeV_(0.0) {} void HcalTBRunData::setRunData(const char* run_type, const char* beam_mode, double beam_energy_gev) { runType_ = run_type; beamMode_ = beam_mode; beamEnergyGeV_ = beam_energy_gev; } ostream& operator<<(ostream& s, const HcalTBRunData& htbrd) { s << "Run type = " << htbrd.runType() << endl; s << "Beam Mode = " << htbrd.beamMode() << endl; s << "Beam Energy = " << htbrd.beamEnergyGeV() << " GeV" << endl; return s; }
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1438c, %rsi lea addresses_A_ht+0x9f84, %rdi clflush (%rdi) nop nop nop xor $24997, %r15 mov $20, %rcx rep movsq nop nop nop cmp %rdx, %rdx lea addresses_D_ht+0x1359a, %rsi lea addresses_A_ht+0x2e5c, %rdi nop nop nop sub $51662, %r11 mov $97, %rcx rep movsw and $8517, %rdi lea addresses_normal_ht+0x135b0, %rdx nop nop nop cmp $29467, %r11 mov $0x6162636465666768, %rdi movq %rdi, %xmm2 vmovups %ymm2, (%rdx) nop nop nop nop dec %r15 lea addresses_WT_ht+0x1384, %r15 nop nop nop nop cmp %r9, %r9 movl $0x61626364, (%r15) nop nop mfence lea addresses_D_ht+0x123d4, %rsi lea addresses_A_ht+0x1b944, %rdi nop nop and %r8, %r8 mov $83, %rcx rep movsl nop cmp %rdi, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r9 push %rbp push %rcx push %rdi push %rsi // Faulty Load lea addresses_PSE+0xdf84, %rdi nop and %r9, %r9 mov (%rdi), %cx lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
; A273387: First differences of number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 659", based on the 5-celled von Neumann neighborhood. ; 4,12,32,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432,440,448,456,464,472,480,488,496,504,512,520,528,536,544,552,560,568,576,584,592,600,608,616,624,632,640,648,656,664,672,680,688,696,704,712,720,728,736,744,752,760,768,776,784,792,800 mov $1,$0 lpb $1 max $0,3 mul $0,2 mov $1,1 lpe add $0,$1 mul $0,4 add $0,4
<% from pwnlib.shellcraft.i386.linux import syscall %> <%page args="fd, name, flag"/> <%docstring> Invokes the syscall unlinkat. See 'man 2 unlinkat' for more information. Arguments: fd(int): fd name(char): name flag(int): flag </%docstring> ${syscall('SYS_unlinkat', fd, name, flag)}
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld b, 91 call lwaitly_b ld a, b1 ldff(40), a ld a, 07 ldff(4b), a ld c, 41 ld b, 03 lbegin_waitm3: ldff a, (c) and a, b cmp a, b jrnz lbegin_waitm3 ld a, 20 ldff(c), a ld a, 02 ldff(ff), a ei .text@1000 lstatint: nop .text@1025 ld a, 91 ldff(40), a .text@1076 ldff a, (c) and a, b jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
; ; jidctint.asm - accurate integer IDCT (AVX2) ; ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB ; Copyright (C) 2009, 2016, 2018, D. R. Commander. ; ; Based on the x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; This file contains a slow-but-accurate integer implementation of the ; inverse DCT (Discrete Cosine Transform). The following code is based ; directly on the IJG's original jidctint.c; see the jidctint.c for ; more details. ; ; [TAB8] %include "jsimdext.inc" %include "jdct.inc" ; -------------------------------------------------------------------------- %define CONST_BITS 13 %define PASS1_BITS 2 %define DESCALE_P1 (CONST_BITS - PASS1_BITS) %define DESCALE_P2 (CONST_BITS + PASS1_BITS + 3) %if CONST_BITS == 13 F_0_298 equ 2446 ; FIX(0.298631336) F_0_390 equ 3196 ; FIX(0.390180644) F_0_541 equ 4433 ; FIX(0.541196100) F_0_765 equ 6270 ; FIX(0.765366865) F_0_899 equ 7373 ; FIX(0.899976223) F_1_175 equ 9633 ; FIX(1.175875602) F_1_501 equ 12299 ; FIX(1.501321110) F_1_847 equ 15137 ; FIX(1.847759065) F_1_961 equ 16069 ; FIX(1.961570560) F_2_053 equ 16819 ; FIX(2.053119869) F_2_562 equ 20995 ; FIX(2.562915447) F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS) ; FIX(0.298631336) F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS) ; FIX(0.390180644) F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100) F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS) ; FIX(1.175875602) F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS) ; FIX(1.501321110) F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS) ; FIX(1.961570560) F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS) ; FIX(2.053119869) F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- ; In-place 8x8x16-bit inverse matrix transpose using AVX2 instructions ; %1-%4: Input/output registers ; %5-%8: Temp registers %macro dotranspose 8 ; %5=(00 10 20 30 40 50 60 70 01 11 21 31 41 51 61 71) ; %6=(03 13 23 33 43 53 63 73 02 12 22 32 42 52 62 72) ; %7=(04 14 24 34 44 54 64 74 05 15 25 35 45 55 65 75) ; %8=(07 17 27 37 47 57 67 77 06 16 26 36 46 56 66 76) vpermq %5, %1, 0xD8 vpermq %6, %2, 0x72 vpermq %7, %3, 0xD8 vpermq %8, %4, 0x72 ; transpose coefficients(phase 1) ; %5=(00 10 20 30 01 11 21 31 40 50 60 70 41 51 61 71) ; %6=(02 12 22 32 03 13 23 33 42 52 62 72 43 53 63 73) ; %7=(04 14 24 34 05 15 25 35 44 54 64 74 45 55 65 75) ; %8=(06 16 26 36 07 17 27 37 46 56 66 76 47 57 67 77) vpunpcklwd %1, %5, %6 vpunpckhwd %2, %5, %6 vpunpcklwd %3, %7, %8 vpunpckhwd %4, %7, %8 ; transpose coefficients(phase 2) ; %1=(00 02 10 12 20 22 30 32 40 42 50 52 60 62 70 72) ; %2=(01 03 11 13 21 23 31 33 41 43 51 53 61 63 71 73) ; %3=(04 06 14 16 24 26 34 36 44 46 54 56 64 66 74 76) ; %4=(05 07 15 17 25 27 35 37 45 47 55 57 65 67 75 77) vpunpcklwd %5, %1, %2 vpunpcklwd %6, %3, %4 vpunpckhwd %7, %1, %2 vpunpckhwd %8, %3, %4 ; transpose coefficients(phase 3) ; %5=(00 01 02 03 10 11 12 13 40 41 42 43 50 51 52 53) ; %6=(04 05 06 07 14 15 16 17 44 45 46 47 54 55 56 57) ; %7=(20 21 22 23 30 31 32 33 60 61 62 63 70 71 72 73) ; %8=(24 25 26 27 34 35 36 37 64 65 66 67 74 75 76 77) vpunpcklqdq %1, %5, %6 vpunpckhqdq %2, %5, %6 vpunpcklqdq %3, %7, %8 vpunpckhqdq %4, %7, %8 ; transpose coefficients(phase 4) ; %1=(00 01 02 03 04 05 06 07 40 41 42 43 44 45 46 47) ; %2=(10 11 12 13 14 15 16 17 50 51 52 53 54 55 56 57) ; %3=(20 21 22 23 24 25 26 27 60 61 62 63 64 65 66 67) ; %4=(30 31 32 33 34 35 36 37 70 71 72 73 74 75 76 77) %endmacro ; -------------------------------------------------------------------------- ; In-place 8x8x16-bit slow integer inverse DCT using AVX2 instructions ; %1-%4: Input/output registers ; %5-%12: Temp registers ; %9: Pass (1 or 2) %macro dodct 13 ; -- Even part ; (Original) ; z1 = (z2 + z3) * 0.541196100; ; tmp2 = z1 + z3 * -1.847759065; ; tmp3 = z1 + z2 * 0.765366865; ; ; (This implementation) ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; vperm2i128 %6, %3, %3, 0x01 ; %6=in6_2 vpunpcklwd %5, %3, %6 ; %5=in26_62L vpunpckhwd %6, %3, %6 ; %6=in26_62H vpmaddwd %5, %5, [GOTOFF(ebx,PW_F130_F054_MF130_F054)] ; %5=tmp3_2L vpmaddwd %6, %6, [GOTOFF(ebx,PW_F130_F054_MF130_F054)] ; %6=tmp3_2H vperm2i128 %7, %1, %1, 0x01 ; %7=in4_0 vpsignw %1, %1, [GOTOFF(ebx,PW_1_NEG1)] vpaddw %7, %7, %1 ; %7=(in0+in4)_(in0-in4) vpxor %1, %1, %1 vpunpcklwd %8, %1, %7 ; %8=tmp0_1L vpunpckhwd %1, %1, %7 ; %1=tmp0_1H vpsrad %8, %8, (16-CONST_BITS) ; vpsrad %8,16 & vpslld %8,CONST_BITS vpsrad %1, %1, (16-CONST_BITS) ; vpsrad %1,16 & vpslld %1,CONST_BITS vpsubd %3, %8, %5 vmovdqu %11, %3 ; %11=tmp0_1L-tmp3_2L=tmp13_12L vpaddd %3, %8, %5 vmovdqu %9, %3 ; %9=tmp0_1L+tmp3_2L=tmp10_11L vpsubd %3, %1, %6 vmovdqu %12, %3 ; %12=tmp0_1H-tmp3_2H=tmp13_12H vpaddd %3, %1, %6 vmovdqu %10, %3 ; %10=tmp0_1H+tmp3_2H=tmp10_11H ; -- Odd part vpaddw %1, %4, %2 ; %1=in7_5+in3_1=z3_4 ; (Original) ; z5 = (z3 + z4) * 1.175875602; ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; ; z3 += z5; z4 += z5; ; ; (This implementation) ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); vperm2i128 %8, %1, %1, 0x01 ; %8=z4_3 vpunpcklwd %7, %1, %8 ; %7=z34_43L vpunpckhwd %8, %1, %8 ; %8=z34_43H vpmaddwd %7, %7, [GOTOFF(ebx,PW_MF078_F117_F078_F117)] ; %7=z3_4L vpmaddwd %8, %8, [GOTOFF(ebx,PW_MF078_F117_F078_F117)] ; %8=z3_4H ; (Original) ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; ; tmp0 += z1 + z3; tmp1 += z2 + z4; ; tmp2 += z2 + z3; tmp3 += z1 + z4; ; ; (This implementation) ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); ; tmp0 += z3; tmp1 += z4; ; tmp2 += z3; tmp3 += z4; vperm2i128 %2, %2, %2, 0x01 ; %2=in1_3 vpunpcklwd %3, %4, %2 ; %3=in71_53L vpunpckhwd %4, %4, %2 ; %4=in71_53H vpmaddwd %5, %3, [GOTOFF(ebx,PW_MF060_MF089_MF050_MF256)] ; %5=tmp0_1L vpmaddwd %6, %4, [GOTOFF(ebx,PW_MF060_MF089_MF050_MF256)] ; %6=tmp0_1H vpaddd %5, %5, %7 ; %5=tmp0_1L+z3_4L=tmp0_1L vpaddd %6, %6, %8 ; %6=tmp0_1H+z3_4H=tmp0_1H vpmaddwd %3, %3, [GOTOFF(ebx,PW_MF089_F060_MF256_F050)] ; %3=tmp3_2L vpmaddwd %4, %4, [GOTOFF(ebx,PW_MF089_F060_MF256_F050)] ; %4=tmp3_2H vperm2i128 %7, %7, %7, 0x01 ; %7=z4_3L vperm2i128 %8, %8, %8, 0x01 ; %8=z4_3H vpaddd %7, %3, %7 ; %7=tmp3_2L+z4_3L=tmp3_2L vpaddd %8, %4, %8 ; %8=tmp3_2H+z4_3H=tmp3_2H ; -- Final output stage vmovdqu %3, %9 vmovdqu %4, %10 vpaddd %1, %3, %7 ; %1=tmp10_11L+tmp3_2L=data0_1L vpaddd %2, %4, %8 ; %2=tmp10_11H+tmp3_2H=data0_1H vpaddd %1, %1, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpaddd %2, %2, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpsrad %1, %1, DESCALE_P %+ %13 vpsrad %2, %2, DESCALE_P %+ %13 vpackssdw %1, %1, %2 ; %1=data0_1 vpsubd %3, %3, %7 ; %3=tmp10_11L-tmp3_2L=data7_6L vpsubd %4, %4, %8 ; %4=tmp10_11H-tmp3_2H=data7_6H vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpaddd %4, %4, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpsrad %3, %3, DESCALE_P %+ %13 vpsrad %4, %4, DESCALE_P %+ %13 vpackssdw %4, %3, %4 ; %4=data7_6 vmovdqu %7, %11 vmovdqu %8, %12 vpaddd %2, %7, %5 ; %7=tmp13_12L+tmp0_1L=data3_2L vpaddd %3, %8, %6 ; %8=tmp13_12H+tmp0_1H=data3_2H vpaddd %2, %2, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpsrad %2, %2, DESCALE_P %+ %13 vpsrad %3, %3, DESCALE_P %+ %13 vpackssdw %2, %2, %3 ; %2=data3_2 vpsubd %3, %7, %5 ; %7=tmp13_12L-tmp0_1L=data4_5L vpsubd %6, %8, %6 ; %8=tmp13_12H-tmp0_1H=data4_5H vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpaddd %6, %6, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] vpsrad %3, %3, DESCALE_P %+ %13 vpsrad %6, %6, DESCALE_P %+ %13 vpackssdw %3, %3, %6 ; %3=data4_5 %endmacro ; -------------------------------------------------------------------------- SECTION SEG_CONST alignz 32 GLOBAL_DATA(jconst_idct_islow_avx2) EXTN(jconst_idct_islow_avx2): PW_F130_F054_MF130_F054 times 4 dw (F_0_541 + F_0_765), F_0_541 times 4 dw (F_0_541 - F_1_847), F_0_541 PW_MF078_F117_F078_F117 times 4 dw (F_1_175 - F_1_961), F_1_175 times 4 dw (F_1_175 - F_0_390), F_1_175 PW_MF060_MF089_MF050_MF256 times 4 dw (F_0_298 - F_0_899), -F_0_899 times 4 dw (F_2_053 - F_2_562), -F_2_562 PW_MF089_F060_MF256_F050 times 4 dw -F_0_899, (F_1_501 - F_0_899) times 4 dw -F_2_562, (F_3_072 - F_2_562) PD_DESCALE_P1 times 8 dd 1 << (DESCALE_P1 - 1) PD_DESCALE_P2 times 8 dd 1 << (DESCALE_P2 - 1) PB_CENTERJSAMP times 32 db CENTERJSAMPLE PW_1_NEG1 times 8 dw 1 times 8 dw -1 alignz 32 ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; ; GLOBAL(void) ; jsimd_idct_islow_avx2(void *dct_table, JCOEFPTR coef_block, ; JSAMPARRAY output_buf, JDIMENSION output_col) ; %define dct_table(b) (b) + 8 ; jpeg_component_info *compptr %define coef_block(b) (b) + 12 ; JCOEFPTR coef_block %define output_buf(b) (b) + 16 ; JSAMPARRAY output_buf %define output_col(b) (b) + 20 ; JDIMENSION output_col %define original_ebp ebp + 0 %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD ; ymmword wk[WK_NUM] %define WK_NUM 4 align 32 GLOBAL_FUNCTION(jsimd_idct_islow_avx2) EXTN(jsimd_idct_islow_avx2): push ebp mov eax, esp ; eax = original ebp sub esp, byte 4 and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits mov [esp], eax mov ebp, esp ; ebp = aligned ebp lea esp, [wk(0)] pushpic ebx ; push ecx ; unused ; push edx ; need not be preserved push esi push edi get_GOT ebx ; get GOT address ; ---- Pass 1: process columns. ; mov eax, [original_ebp] mov edx, POINTER [dct_table(eax)] ; quantptr mov esi, JCOEFPTR [coef_block(eax)] ; inptr %ifndef NO_ZERO_COLUMN_TEST_ISLOW_AVX2 mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] jnz near .columnDCT movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] vpor xmm0, xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] vpor xmm1, xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] vpor xmm0, xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] vpor xmm1, xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] vpor xmm0, xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] vpor xmm1, xmm1, xmm0 vpacksswb xmm1, xmm1, xmm1 vpacksswb xmm1, xmm1, xmm1 movd eax, xmm1 test eax, eax jnz short .columnDCT ; -- AC terms all zero movdqa xmm5, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] vpmullw xmm5, xmm5, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] vpsllw xmm5, xmm5, PASS1_BITS vpunpcklwd xmm4, xmm5, xmm5 ; xmm4=(00 00 01 01 02 02 03 03) vpunpckhwd xmm5, xmm5, xmm5 ; xmm5=(04 04 05 05 06 06 07 07) vinserti128 ymm4, ymm4, xmm5, 1 vpshufd ymm0, ymm4, 0x00 ; ymm0=col0_4=(00 00 00 00 00 00 00 00 04 04 04 04 04 04 04 04) vpshufd ymm1, ymm4, 0x55 ; ymm1=col1_5=(01 01 01 01 01 01 01 01 05 05 05 05 05 05 05 05) vpshufd ymm2, ymm4, 0xAA ; ymm2=col2_6=(02 02 02 02 02 02 02 02 06 06 06 06 06 06 06 06) vpshufd ymm3, ymm4, 0xFF ; ymm3=col3_7=(03 03 03 03 03 03 03 03 07 07 07 07 07 07 07 07) jmp near .column_end alignx 16, 7 %endif .columnDCT: vmovdqu ymm4, YMMWORD [YMMBLOCK(0,0,esi,SIZEOF_JCOEF)] ; ymm4=in0_1 vmovdqu ymm5, YMMWORD [YMMBLOCK(2,0,esi,SIZEOF_JCOEF)] ; ymm5=in2_3 vmovdqu ymm6, YMMWORD [YMMBLOCK(4,0,esi,SIZEOF_JCOEF)] ; ymm6=in4_5 vmovdqu ymm7, YMMWORD [YMMBLOCK(6,0,esi,SIZEOF_JCOEF)] ; ymm7=in6_7 vpmullw ymm4, ymm4, YMMWORD [YMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] vpmullw ymm5, ymm5, YMMWORD [YMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] vpmullw ymm6, ymm6, YMMWORD [YMMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] vpmullw ymm7, ymm7, YMMWORD [YMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] vperm2i128 ymm0, ymm4, ymm6, 0x20 ; ymm0=in0_4 vperm2i128 ymm1, ymm5, ymm4, 0x31 ; ymm1=in3_1 vperm2i128 ymm2, ymm5, ymm7, 0x20 ; ymm2=in2_6 vperm2i128 ymm3, ymm7, ymm6, 0x31 ; ymm3=in7_5 dodct ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, XMMWORD [wk(0)], XMMWORD [wk(1)], XMMWORD [wk(2)], XMMWORD [wk(3)], 1 ; ymm0=data0_1, ymm1=data3_2, ymm2=data4_5, ymm3=data7_6 dotranspose ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7 ; ymm0=data0_4, ymm1=data1_5, ymm2=data2_6, ymm3=data3_7 .column_end: ; -- Prefetch the next coefficient block prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] ; ---- Pass 2: process rows. mov eax, [original_ebp] mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) mov eax, JDIMENSION [output_col(eax)] vperm2i128 ymm4, ymm3, ymm1, 0x31 ; ymm3=in7_5 vperm2i128 ymm1, ymm3, ymm1, 0x20 ; ymm1=in3_1 dodct ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7, XMMWORD [wk(0)], XMMWORD [wk(1)], XMMWORD [wk(2)], XMMWORD [wk(3)], 2 ; ymm0=data0_1, ymm1=data3_2, ymm2=data4_5, ymm4=data7_6 dotranspose ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7 ; ymm0=data0_4, ymm1=data1_5, ymm2=data2_6, ymm4=data3_7 vpacksswb ymm0, ymm0, ymm1 ; ymm0=data01_45 vpacksswb ymm1, ymm2, ymm4 ; ymm1=data23_67 vpaddb ymm0, ymm0, [GOTOFF(ebx,PB_CENTERJSAMP)] vpaddb ymm1, ymm1, [GOTOFF(ebx,PB_CENTERJSAMP)] vextracti128 xmm6, ymm1, 1 ; xmm3=data67 vextracti128 xmm4, ymm0, 1 ; xmm2=data45 vextracti128 xmm2, ymm1, 0 ; xmm1=data23 vextracti128 xmm0, ymm0, 0 ; xmm0=data01 vpshufd xmm1, xmm0, 0x4E ; xmm1=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) vpshufd xmm3, xmm2, 0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) vpshufd xmm5, xmm4, 0x4E ; xmm5=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) vpshufd xmm7, xmm6, 0x4E ; xmm7=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) vzeroupper mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm0 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm1 mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm2 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov esi, JSAMPROW [edi+5*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm5 mov edx, JSAMPROW [edi+6*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm7 pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; unused poppic ebx mov esp, ebp ; esp <- aligned ebp pop esp ; esp <- original ebp pop ebp ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. align 32
_forktest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "fork test OK\n"); } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp forktest(); 11: e8 3a 00 00 00 call 50 <forktest> exit(); 16: e8 87 03 00 00 call 3a2 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <printf>: { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx 24: 83 ec 10 sub $0x10,%esp 27: 8b 5d 0c mov 0xc(%ebp),%ebx write(fd, s, strlen(s)); 2a: 53 push %ebx 2b: e8 a0 01 00 00 call 1d0 <strlen> 30: 83 c4 0c add $0xc,%esp 33: 50 push %eax 34: 53 push %ebx 35: ff 75 08 pushl 0x8(%ebp) 38: e8 85 03 00 00 call 3c2 <write> } 3d: 83 c4 10 add $0x10,%esp 40: 8b 5d fc mov -0x4(%ebp),%ebx 43: c9 leave 44: c3 ret 45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000050 <forktest>: { 50: 55 push %ebp 51: 89 e5 mov %esp,%ebp 53: 53 push %ebx for(n=0; n<N; n++){ 54: 31 db xor %ebx,%ebx { 56: 83 ec 10 sub $0x10,%esp write(fd, s, strlen(s)); 59: 68 44 04 00 00 push $0x444 5e: e8 6d 01 00 00 call 1d0 <strlen> 63: 83 c4 0c add $0xc,%esp 66: 50 push %eax 67: 68 44 04 00 00 push $0x444 6c: 6a 01 push $0x1 6e: e8 4f 03 00 00 call 3c2 <write> 73: 83 c4 10 add $0x10,%esp 76: eb 19 jmp 91 <forktest+0x41> 78: 90 nop 79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(pid == 0) 80: 0f 84 7c 00 00 00 je 102 <forktest+0xb2> for(n=0; n<N; n++){ 86: 83 c3 01 add $0x1,%ebx 89: 81 fb e8 03 00 00 cmp $0x3e8,%ebx 8f: 74 4f je e0 <forktest+0x90> pid = fork(); 91: e8 04 03 00 00 call 39a <fork> if(pid < 0) 96: 85 c0 test %eax,%eax 98: 79 e6 jns 80 <forktest+0x30> for(; n > 0; n--){ 9a: 85 db test %ebx,%ebx 9c: 74 10 je ae <forktest+0x5e> 9e: 66 90 xchg %ax,%ax if(wait() < 0){ a0: e8 05 03 00 00 call 3aa <wait> a5: 85 c0 test %eax,%eax a7: 78 5e js 107 <forktest+0xb7> for(; n > 0; n--){ a9: 83 eb 01 sub $0x1,%ebx ac: 75 f2 jne a0 <forktest+0x50> if(wait() != -1){ ae: e8 f7 02 00 00 call 3aa <wait> b3: 83 f8 ff cmp $0xffffffff,%eax b6: 75 71 jne 129 <forktest+0xd9> write(fd, s, strlen(s)); b8: 83 ec 0c sub $0xc,%esp bb: 68 76 04 00 00 push $0x476 c0: e8 0b 01 00 00 call 1d0 <strlen> c5: 83 c4 0c add $0xc,%esp c8: 50 push %eax c9: 68 76 04 00 00 push $0x476 ce: 6a 01 push $0x1 d0: e8 ed 02 00 00 call 3c2 <write> } d5: 8b 5d fc mov -0x4(%ebp),%ebx d8: c9 leave d9: c3 ret da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi write(fd, s, strlen(s)); e0: 83 ec 0c sub $0xc,%esp e3: 68 84 04 00 00 push $0x484 e8: e8 e3 00 00 00 call 1d0 <strlen> ed: 83 c4 0c add $0xc,%esp f0: 50 push %eax f1: 68 84 04 00 00 push $0x484 f6: 6a 01 push $0x1 f8: e8 c5 02 00 00 call 3c2 <write> exit(); fd: e8 a0 02 00 00 call 3a2 <exit> exit(); 102: e8 9b 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 107: 83 ec 0c sub $0xc,%esp 10a: 68 4f 04 00 00 push $0x44f 10f: e8 bc 00 00 00 call 1d0 <strlen> 114: 83 c4 0c add $0xc,%esp 117: 50 push %eax 118: 68 4f 04 00 00 push $0x44f 11d: 6a 01 push $0x1 11f: e8 9e 02 00 00 call 3c2 <write> exit(); 124: e8 79 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 129: 83 ec 0c sub $0xc,%esp 12c: 68 63 04 00 00 push $0x463 131: e8 9a 00 00 00 call 1d0 <strlen> 136: 83 c4 0c add $0xc,%esp 139: 50 push %eax 13a: 68 63 04 00 00 push $0x463 13f: 6a 01 push $0x1 141: e8 7c 02 00 00 call 3c2 <write> exit(); 146: e8 57 02 00 00 call 3a2 <exit> 14b: 66 90 xchg %ax,%ax 14d: 66 90 xchg %ax,%ax 14f: 90 nop 00000150 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 15a: 89 c2 mov %eax,%edx 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 160: 83 c1 01 add $0x1,%ecx 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 167: 83 c2 01 add $0x1,%edx 16a: 84 db test %bl,%bl 16c: 88 5a ff mov %bl,-0x1(%edx) 16f: 75 ef jne 160 <strcpy+0x10> ; return os; } 171: 5b pop %ebx 172: 5d pop %ebp 173: c3 ret 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000180 <strcmp>: int strcmp(const char *p, const char *q) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 53 push %ebx 184: 8b 55 08 mov 0x8(%ebp),%edx 187: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 18a: 0f b6 02 movzbl (%edx),%eax 18d: 0f b6 19 movzbl (%ecx),%ebx 190: 84 c0 test %al,%al 192: 75 1c jne 1b0 <strcmp+0x30> 194: eb 2a jmp 1c0 <strcmp+0x40> 196: 8d 76 00 lea 0x0(%esi),%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1a0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 1a3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1a6: 83 c1 01 add $0x1,%ecx 1a9: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 1ac: 84 c0 test %al,%al 1ae: 74 10 je 1c0 <strcmp+0x40> 1b0: 38 d8 cmp %bl,%al 1b2: 74 ec je 1a0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 1b4: 29 d8 sub %ebx,%eax } 1b6: 5b pop %ebx 1b7: 5d pop %ebp 1b8: c3 ret 1b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1c0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 1c2: 29 d8 sub %ebx,%eax } 1c4: 5b pop %ebx 1c5: 5d pop %ebp 1c6: c3 ret 1c7: 89 f6 mov %esi,%esi 1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001d0 <strlen>: uint strlen(char *s) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 1d6: 80 39 00 cmpb $0x0,(%ecx) 1d9: 74 15 je 1f0 <strlen+0x20> 1db: 31 d2 xor %edx,%edx 1dd: 8d 76 00 lea 0x0(%esi),%esi 1e0: 83 c2 01 add $0x1,%edx 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 1e7: 89 d0 mov %edx,%eax 1e9: 75 f5 jne 1e0 <strlen+0x10> ; return n; } 1eb: 5d pop %ebp 1ec: c3 ret 1ed: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 1f0: 31 c0 xor %eax,%eax } 1f2: 5d pop %ebp 1f3: c3 ret 1f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000200 <memset>: void* memset(void *dst, int c, uint n) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 57 push %edi 204: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 207: 8b 4d 10 mov 0x10(%ebp),%ecx 20a: 8b 45 0c mov 0xc(%ebp),%eax 20d: 89 d7 mov %edx,%edi 20f: fc cld 210: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 212: 89 d0 mov %edx,%eax 214: 5f pop %edi 215: 5d pop %ebp 216: c3 ret 217: 89 f6 mov %esi,%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000220 <strchr>: char* strchr(const char *s, char c) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 53 push %ebx 224: 8b 45 08 mov 0x8(%ebp),%eax 227: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 22a: 0f b6 10 movzbl (%eax),%edx 22d: 84 d2 test %dl,%dl 22f: 74 1d je 24e <strchr+0x2e> if(*s == c) 231: 38 d3 cmp %dl,%bl 233: 89 d9 mov %ebx,%ecx 235: 75 0d jne 244 <strchr+0x24> 237: eb 17 jmp 250 <strchr+0x30> 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 240: 38 ca cmp %cl,%dl 242: 74 0c je 250 <strchr+0x30> for(; *s; s++) 244: 83 c0 01 add $0x1,%eax 247: 0f b6 10 movzbl (%eax),%edx 24a: 84 d2 test %dl,%dl 24c: 75 f2 jne 240 <strchr+0x20> return (char*)s; return 0; 24e: 31 c0 xor %eax,%eax } 250: 5b pop %ebx 251: 5d pop %ebp 252: c3 ret 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000260 <gets>: char* gets(char *buf, int max) { 260: 55 push %ebp 261: 89 e5 mov %esp,%ebp 263: 57 push %edi 264: 56 push %esi 265: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 266: 31 f6 xor %esi,%esi 268: 89 f3 mov %esi,%ebx { 26a: 83 ec 1c sub $0x1c,%esp 26d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 270: eb 2f jmp 2a1 <gets+0x41> 272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 278: 8d 45 e7 lea -0x19(%ebp),%eax 27b: 83 ec 04 sub $0x4,%esp 27e: 6a 01 push $0x1 280: 50 push %eax 281: 6a 00 push $0x0 283: e8 32 01 00 00 call 3ba <read> if(cc < 1) 288: 83 c4 10 add $0x10,%esp 28b: 85 c0 test %eax,%eax 28d: 7e 1c jle 2ab <gets+0x4b> break; buf[i++] = c; 28f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 293: 83 c7 01 add $0x1,%edi 296: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 299: 3c 0a cmp $0xa,%al 29b: 74 23 je 2c0 <gets+0x60> 29d: 3c 0d cmp $0xd,%al 29f: 74 1f je 2c0 <gets+0x60> for(i=0; i+1 < max; ){ 2a1: 83 c3 01 add $0x1,%ebx 2a4: 3b 5d 0c cmp 0xc(%ebp),%ebx 2a7: 89 fe mov %edi,%esi 2a9: 7c cd jl 278 <gets+0x18> 2ab: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 2ad: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 2b0: c6 03 00 movb $0x0,(%ebx) } 2b3: 8d 65 f4 lea -0xc(%ebp),%esp 2b6: 5b pop %ebx 2b7: 5e pop %esi 2b8: 5f pop %edi 2b9: 5d pop %ebp 2ba: c3 ret 2bb: 90 nop 2bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2c0: 8b 75 08 mov 0x8(%ebp),%esi 2c3: 8b 45 08 mov 0x8(%ebp),%eax 2c6: 01 de add %ebx,%esi 2c8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 2ca: c6 03 00 movb $0x0,(%ebx) } 2cd: 8d 65 f4 lea -0xc(%ebp),%esp 2d0: 5b pop %ebx 2d1: 5e pop %esi 2d2: 5f pop %edi 2d3: 5d pop %ebp 2d4: c3 ret 2d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002e0 <stat>: int stat(char *n, struct stat *st) { 2e0: 55 push %ebp 2e1: 89 e5 mov %esp,%ebp 2e3: 56 push %esi 2e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 2e5: 83 ec 08 sub $0x8,%esp 2e8: 6a 00 push $0x0 2ea: ff 75 08 pushl 0x8(%ebp) 2ed: e8 f0 00 00 00 call 3e2 <open> if(fd < 0) 2f2: 83 c4 10 add $0x10,%esp 2f5: 85 c0 test %eax,%eax 2f7: 78 27 js 320 <stat+0x40> return -1; r = fstat(fd, st); 2f9: 83 ec 08 sub $0x8,%esp 2fc: ff 75 0c pushl 0xc(%ebp) 2ff: 89 c3 mov %eax,%ebx 301: 50 push %eax 302: e8 f3 00 00 00 call 3fa <fstat> close(fd); 307: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 30a: 89 c6 mov %eax,%esi close(fd); 30c: e8 b9 00 00 00 call 3ca <close> return r; 311: 83 c4 10 add $0x10,%esp } 314: 8d 65 f8 lea -0x8(%ebp),%esp 317: 89 f0 mov %esi,%eax 319: 5b pop %ebx 31a: 5e pop %esi 31b: 5d pop %ebp 31c: c3 ret 31d: 8d 76 00 lea 0x0(%esi),%esi return -1; 320: be ff ff ff ff mov $0xffffffff,%esi 325: eb ed jmp 314 <stat+0x34> 327: 89 f6 mov %esi,%esi 329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000330 <atoi>: int atoi(const char *s) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 53 push %ebx 334: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 337: 0f be 11 movsbl (%ecx),%edx 33a: 8d 42 d0 lea -0x30(%edx),%eax 33d: 3c 09 cmp $0x9,%al n = 0; 33f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 344: 77 1f ja 365 <atoi+0x35> 346: 8d 76 00 lea 0x0(%esi),%esi 349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 350: 8d 04 80 lea (%eax,%eax,4),%eax 353: 83 c1 01 add $0x1,%ecx 356: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 35a: 0f be 11 movsbl (%ecx),%edx 35d: 8d 5a d0 lea -0x30(%edx),%ebx 360: 80 fb 09 cmp $0x9,%bl 363: 76 eb jbe 350 <atoi+0x20> return n; } 365: 5b pop %ebx 366: 5d pop %ebp 367: c3 ret 368: 90 nop 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000370 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 56 push %esi 374: 53 push %ebx 375: 8b 5d 10 mov 0x10(%ebp),%ebx 378: 8b 45 08 mov 0x8(%ebp),%eax 37b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 37e: 85 db test %ebx,%ebx 380: 7e 14 jle 396 <memmove+0x26> 382: 31 d2 xor %edx,%edx 384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 388: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 38c: 88 0c 10 mov %cl,(%eax,%edx,1) 38f: 83 c2 01 add $0x1,%edx while(n-- > 0) 392: 39 d3 cmp %edx,%ebx 394: 75 f2 jne 388 <memmove+0x18> return vdst; } 396: 5b pop %ebx 397: 5e pop %esi 398: 5d pop %ebp 399: c3 ret 0000039a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 39a: b8 01 00 00 00 mov $0x1,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <exit>: SYSCALL(exit) 3a2: b8 02 00 00 00 mov $0x2,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <wait>: SYSCALL(wait) 3aa: b8 03 00 00 00 mov $0x3,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <pipe>: SYSCALL(pipe) 3b2: b8 04 00 00 00 mov $0x4,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <read>: SYSCALL(read) 3ba: b8 05 00 00 00 mov $0x5,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <write>: SYSCALL(write) 3c2: b8 10 00 00 00 mov $0x10,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <close>: SYSCALL(close) 3ca: b8 15 00 00 00 mov $0x15,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <kill>: SYSCALL(kill) 3d2: b8 06 00 00 00 mov $0x6,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <exec>: SYSCALL(exec) 3da: b8 07 00 00 00 mov $0x7,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <open>: SYSCALL(open) 3e2: b8 0f 00 00 00 mov $0xf,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <mknod>: SYSCALL(mknod) 3ea: b8 11 00 00 00 mov $0x11,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <unlink>: SYSCALL(unlink) 3f2: b8 12 00 00 00 mov $0x12,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <fstat>: SYSCALL(fstat) 3fa: b8 08 00 00 00 mov $0x8,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <link>: SYSCALL(link) 402: b8 13 00 00 00 mov $0x13,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <mkdir>: SYSCALL(mkdir) 40a: b8 14 00 00 00 mov $0x14,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <chdir>: SYSCALL(chdir) 412: b8 09 00 00 00 mov $0x9,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <dup>: SYSCALL(dup) 41a: b8 0a 00 00 00 mov $0xa,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <getpid>: SYSCALL(getpid) 422: b8 0b 00 00 00 mov $0xb,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <sbrk>: SYSCALL(sbrk) 42a: b8 0c 00 00 00 mov $0xc,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <sleep>: SYSCALL(sleep) 432: b8 0d 00 00 00 mov $0xd,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <uptime>: SYSCALL(uptime) 43a: b8 0e 00 00 00 mov $0xe,%eax 43f: cd 40 int $0x40 441: c3 ret
#pragma once #include "quadraticequationworker.hpp" /** * \brief Consumer. It takes task from the task queue and executes it. * For this particular program, it takes parameters of quadratic equation * from the queue and delegates solving of this equation to the Solver class. */ class Consumer final : QuadraticEquationWorker { public: /** * \brief Generic constructor for forwarding all arguments to base class. * Example taken from here https://stackoverflow.com/a/14122944/8369974 */ template<typename... Args> explicit Consumer(Args&&... args) : QuadraticEquationWorker{ std::forward<Args>(args)... } {} void run() override; };
user/_grind: 文件格式 elf64-littleriscv Disassembly of section .text: 0000000000000000 <do_rand>: #include "kernel/riscv.h" // from FreeBSD. int do_rand(unsigned long *ctx) { 0: 1141 addi sp,sp,-16 2: e422 sd s0,8(sp) 4: 0800 addi s0,sp,16 * October 1988, p. 1195. */ long hi, lo, x; /* Transform to [1, 0x7ffffffe] range. */ x = (*ctx % 0x7ffffffe) + 1; 6: 611c ld a5,0(a0) 8: 80000737 lui a4,0x80000 c: ffe74713 xori a4,a4,-2 10: 02e7f7b3 remu a5,a5,a4 14: 0785 addi a5,a5,1 hi = x / 127773; lo = x % 127773; 16: 66fd lui a3,0x1f 18: 31d68693 addi a3,a3,797 # 1f31d <__global_pointer$+0x1d4c4> 1c: 02d7e733 rem a4,a5,a3 x = 16807 * lo - 2836 * hi; 20: 6611 lui a2,0x4 22: 1a760613 addi a2,a2,423 # 41a7 <__global_pointer$+0x234e> 26: 02c70733 mul a4,a4,a2 hi = x / 127773; 2a: 02d7c7b3 div a5,a5,a3 x = 16807 * lo - 2836 * hi; 2e: 76fd lui a3,0xfffff 30: 4ec68693 addi a3,a3,1260 # fffffffffffff4ec <__global_pointer$+0xffffffffffffd693> 34: 02d787b3 mul a5,a5,a3 38: 97ba add a5,a5,a4 if (x < 0) 3a: 0007c963 bltz a5,4c <do_rand+0x4c> x += 0x7fffffff; /* Transform to [0, 0x7ffffffd] range. */ x--; 3e: 17fd addi a5,a5,-1 *ctx = x; 40: e11c sd a5,0(a0) return (x); } 42: 0007851b sext.w a0,a5 46: 6422 ld s0,8(sp) 48: 0141 addi sp,sp,16 4a: 8082 ret x += 0x7fffffff; 4c: 80000737 lui a4,0x80000 50: fff74713 not a4,a4 54: 97ba add a5,a5,a4 56: b7e5 j 3e <do_rand+0x3e> 0000000000000058 <rand>: unsigned long rand_next = 1; int rand(void) { 58: 1141 addi sp,sp,-16 5a: e406 sd ra,8(sp) 5c: e022 sd s0,0(sp) 5e: 0800 addi s0,sp,16 return (do_rand(&rand_next)); 60: 00001517 auipc a0,0x1 64: 60050513 addi a0,a0,1536 # 1660 <rand_next> 68: 00000097 auipc ra,0x0 6c: f98080e7 jalr -104(ra) # 0 <do_rand> } 70: 60a2 ld ra,8(sp) 72: 6402 ld s0,0(sp) 74: 0141 addi sp,sp,16 76: 8082 ret 0000000000000078 <go>: void go(int which_child) { 78: 7159 addi sp,sp,-112 7a: f486 sd ra,104(sp) 7c: f0a2 sd s0,96(sp) 7e: eca6 sd s1,88(sp) 80: e8ca sd s2,80(sp) 82: e4ce sd s3,72(sp) 84: e0d2 sd s4,64(sp) 86: fc56 sd s5,56(sp) 88: f85a sd s6,48(sp) 8a: 1880 addi s0,sp,112 8c: 84aa mv s1,a0 int fd = -1; static char buf[999]; char *break0 = sbrk(0); 8e: 4501 li a0,0 90: 00001097 auipc ra,0x1 94: e56080e7 jalr -426(ra) # ee6 <sbrk> 98: 8a2a mv s4,a0 uint64 iters = 0; mkdir("grindir"); 9a: 00001517 auipc a0,0x1 9e: 2de50513 addi a0,a0,734 # 1378 <malloc+0xe4> a2: 00001097 auipc ra,0x1 a6: e24080e7 jalr -476(ra) # ec6 <mkdir> if(chdir("grindir") != 0){ aa: 00001517 auipc a0,0x1 ae: 2ce50513 addi a0,a0,718 # 1378 <malloc+0xe4> b2: 00001097 auipc ra,0x1 b6: e1c080e7 jalr -484(ra) # ece <chdir> ba: cd11 beqz a0,d6 <go+0x5e> printf("chdir grindir failed\n"); bc: 00001517 auipc a0,0x1 c0: 2c450513 addi a0,a0,708 # 1380 <malloc+0xec> c4: 00001097 auipc ra,0x1 c8: 112080e7 jalr 274(ra) # 11d6 <printf> exit(1); cc: 4505 li a0,1 ce: 00001097 auipc ra,0x1 d2: d90080e7 jalr -624(ra) # e5e <exit> } chdir("/"); d6: 00001517 auipc a0,0x1 da: 2c250513 addi a0,a0,706 # 1398 <malloc+0x104> de: 00001097 auipc ra,0x1 e2: df0080e7 jalr -528(ra) # ece <chdir> while(1){ iters++; if((iters % 500) == 0) e6: 00001997 auipc s3,0x1 ea: 2c298993 addi s3,s3,706 # 13a8 <malloc+0x114> ee: c489 beqz s1,f8 <go+0x80> f0: 00001997 auipc s3,0x1 f4: 2b098993 addi s3,s3,688 # 13a0 <malloc+0x10c> iters++; f8: 4485 li s1,1 int fd = -1; fa: 597d li s2,-1 printf("grind: fork failed\n"); exit(1); } wait(0); } else if(what == 15){ sbrk(6011); fc: 6a85 lui s5,0x1 fe: 77ba8a93 addi s5,s5,1915 # 177b <buf.1231+0x10b> 102: a825 j 13a <go+0xc2> close(open("grindir/../a", O_CREATE|O_RDWR)); 104: 20200593 li a1,514 108: 00001517 auipc a0,0x1 10c: 2a850513 addi a0,a0,680 # 13b0 <malloc+0x11c> 110: 00001097 auipc ra,0x1 114: d8e080e7 jalr -626(ra) # e9e <open> 118: 00001097 auipc ra,0x1 11c: d6e080e7 jalr -658(ra) # e86 <close> iters++; 120: 0485 addi s1,s1,1 if((iters % 500) == 0) 122: 1f400793 li a5,500 126: 02f4f7b3 remu a5,s1,a5 12a: eb81 bnez a5,13a <go+0xc2> write(1, which_child?"B":"A", 1); 12c: 4605 li a2,1 12e: 85ce mv a1,s3 130: 4505 li a0,1 132: 00001097 auipc ra,0x1 136: d4c080e7 jalr -692(ra) # e7e <write> int what = rand() % 23; 13a: 00000097 auipc ra,0x0 13e: f1e080e7 jalr -226(ra) # 58 <rand> 142: 47dd li a5,23 144: 02f5653b remw a0,a0,a5 if(what == 1){ 148: 4785 li a5,1 14a: faf50de3 beq a0,a5,104 <go+0x8c> } else if(what == 2){ 14e: 4789 li a5,2 150: 16f50e63 beq a0,a5,2cc <go+0x254> } else if(what == 3){ 154: 478d li a5,3 156: 18f50a63 beq a0,a5,2ea <go+0x272> } else if(what == 4){ 15a: 4791 li a5,4 15c: 1af50063 beq a0,a5,2fc <go+0x284> } else if(what == 5){ 160: 4795 li a5,5 162: 1ef50463 beq a0,a5,34a <go+0x2d2> } else if(what == 6){ 166: 4799 li a5,6 168: 20f50263 beq a0,a5,36c <go+0x2f4> } else if(what == 7){ 16c: 479d li a5,7 16e: 22f50063 beq a0,a5,38e <go+0x316> } else if(what == 8){ 172: 47a1 li a5,8 174: 22f50963 beq a0,a5,3a6 <go+0x32e> } else if(what == 9){ 178: 47a5 li a5,9 17a: 24f50263 beq a0,a5,3be <go+0x346> } else if(what == 10){ 17e: 47a9 li a5,10 180: 26f50e63 beq a0,a5,3fc <go+0x384> } else if(what == 11){ 184: 47ad li a5,11 186: 2af50a63 beq a0,a5,43a <go+0x3c2> } else if(what == 12){ 18a: 47b1 li a5,12 18c: 2cf50c63 beq a0,a5,464 <go+0x3ec> } else if(what == 13){ 190: 47b5 li a5,13 192: 2ef50e63 beq a0,a5,48e <go+0x416> } else if(what == 14){ 196: 47b9 li a5,14 198: 32f50963 beq a0,a5,4ca <go+0x452> } else if(what == 15){ 19c: 47bd li a5,15 19e: 36f50d63 beq a0,a5,518 <go+0x4a0> } else if(what == 16){ 1a2: 47c1 li a5,16 1a4: 38f50063 beq a0,a5,524 <go+0x4ac> if(sbrk(0) > break0) sbrk(-(sbrk(0) - break0)); } else if(what == 17){ 1a8: 47c5 li a5,17 1aa: 3af50063 beq a0,a5,54a <go+0x4d2> printf("chdir failed\n"); exit(1); } kill(pid); wait(0); } else if(what == 18){ 1ae: 47c9 li a5,18 1b0: 42f50663 beq a0,a5,5dc <go+0x564> } else if(pid < 0){ printf("grind: fork failed\n"); exit(1); } wait(0); } else if(what == 19){ 1b4: 47cd li a5,19 1b6: 46f50a63 beq a0,a5,62a <go+0x5b2> exit(1); } close(fds[0]); close(fds[1]); wait(0); } else if(what == 20){ 1ba: 47d1 li a5,20 1bc: 54f50b63 beq a0,a5,712 <go+0x69a> } else if(pid < 0){ printf("fork failed\n"); exit(1); } wait(0); } else if(what == 21){ 1c0: 47d5 li a5,21 1c2: 5ef50963 beq a0,a5,7b4 <go+0x73c> printf("fstat reports crazy i-number %d\n", st.ino); exit(1); } close(fd1); unlink("c"); } else if(what == 22){ 1c6: 47d9 li a5,22 1c8: f4f51ce3 bne a0,a5,120 <go+0xa8> // echo hi | cat int aa[2], bb[2]; if(pipe(aa) < 0){ 1cc: f9840513 addi a0,s0,-104 1d0: 00001097 auipc ra,0x1 1d4: c9e080e7 jalr -866(ra) # e6e <pipe> 1d8: 6e054263 bltz a0,8bc <go+0x844> fprintf(2, "pipe failed\n"); exit(1); } if(pipe(bb) < 0){ 1dc: fa040513 addi a0,s0,-96 1e0: 00001097 auipc ra,0x1 1e4: c8e080e7 jalr -882(ra) # e6e <pipe> 1e8: 6e054863 bltz a0,8d8 <go+0x860> fprintf(2, "pipe failed\n"); exit(1); } int pid1 = fork(); 1ec: 00001097 auipc ra,0x1 1f0: c6a080e7 jalr -918(ra) # e56 <fork> if(pid1 == 0){ 1f4: 70050063 beqz a0,8f4 <go+0x87c> close(aa[1]); char *args[3] = { "echo", "hi", 0 }; exec("grindir/../echo", args); fprintf(2, "echo: not found\n"); exit(2); } else if(pid1 < 0){ 1f8: 7a054863 bltz a0,9a8 <go+0x930> fprintf(2, "fork failed\n"); exit(3); } int pid2 = fork(); 1fc: 00001097 auipc ra,0x1 200: c5a080e7 jalr -934(ra) # e56 <fork> if(pid2 == 0){ 204: 7c050063 beqz a0,9c4 <go+0x94c> close(bb[1]); char *args[2] = { "cat", 0 }; exec("/cat", args); fprintf(2, "cat: not found\n"); exit(6); } else if(pid2 < 0){ 208: 08054ce3 bltz a0,aa0 <go+0xa28> fprintf(2, "fork failed\n"); exit(7); } close(aa[0]); 20c: f9842503 lw a0,-104(s0) 210: 00001097 auipc ra,0x1 214: c76080e7 jalr -906(ra) # e86 <close> close(aa[1]); 218: f9c42503 lw a0,-100(s0) 21c: 00001097 auipc ra,0x1 220: c6a080e7 jalr -918(ra) # e86 <close> close(bb[1]); 224: fa442503 lw a0,-92(s0) 228: 00001097 auipc ra,0x1 22c: c5e080e7 jalr -930(ra) # e86 <close> char buf[3] = { 0, 0, 0 }; 230: f8041823 sh zero,-112(s0) 234: f8040923 sb zero,-110(s0) read(bb[0], buf+0, 1); 238: 4605 li a2,1 23a: f9040593 addi a1,s0,-112 23e: fa042503 lw a0,-96(s0) 242: 00001097 auipc ra,0x1 246: c34080e7 jalr -972(ra) # e76 <read> read(bb[0], buf+1, 1); 24a: 4605 li a2,1 24c: f9140593 addi a1,s0,-111 250: fa042503 lw a0,-96(s0) 254: 00001097 auipc ra,0x1 258: c22080e7 jalr -990(ra) # e76 <read> close(bb[0]); 25c: fa042503 lw a0,-96(s0) 260: 00001097 auipc ra,0x1 264: c26080e7 jalr -986(ra) # e86 <close> int st1, st2; wait(&st1); 268: f9440513 addi a0,s0,-108 26c: 00001097 auipc ra,0x1 270: bfa080e7 jalr -1030(ra) # e66 <wait> wait(&st2); 274: fa840513 addi a0,s0,-88 278: 00001097 auipc ra,0x1 27c: bee080e7 jalr -1042(ra) # e66 <wait> if(st1 != 0 || st2 != 0 || strcmp(buf, "hi") != 0){ 280: f9442783 lw a5,-108(s0) 284: fa842703 lw a4,-88(s0) 288: 8fd9 or a5,a5,a4 28a: 2781 sext.w a5,a5 28c: ef89 bnez a5,2a6 <go+0x22e> 28e: 00001597 auipc a1,0x1 292: 33a58593 addi a1,a1,826 # 15c8 <malloc+0x334> 296: f9040513 addi a0,s0,-112 29a: 00001097 auipc ra,0x1 29e: 96a080e7 jalr -1686(ra) # c04 <strcmp> 2a2: e6050fe3 beqz a0,120 <go+0xa8> printf("exec pipeline failed %d %d \"%s\"\n", st1, st2, buf); 2a6: f9040693 addi a3,s0,-112 2aa: fa842603 lw a2,-88(s0) 2ae: f9442583 lw a1,-108(s0) 2b2: 00001517 auipc a0,0x1 2b6: 36650513 addi a0,a0,870 # 1618 <malloc+0x384> 2ba: 00001097 auipc ra,0x1 2be: f1c080e7 jalr -228(ra) # 11d6 <printf> exit(1); 2c2: 4505 li a0,1 2c4: 00001097 auipc ra,0x1 2c8: b9a080e7 jalr -1126(ra) # e5e <exit> close(open("grindir/../grindir/../b", O_CREATE|O_RDWR)); 2cc: 20200593 li a1,514 2d0: 00001517 auipc a0,0x1 2d4: 0f050513 addi a0,a0,240 # 13c0 <malloc+0x12c> 2d8: 00001097 auipc ra,0x1 2dc: bc6080e7 jalr -1082(ra) # e9e <open> 2e0: 00001097 auipc ra,0x1 2e4: ba6080e7 jalr -1114(ra) # e86 <close> 2e8: bd25 j 120 <go+0xa8> unlink("grindir/../a"); 2ea: 00001517 auipc a0,0x1 2ee: 0c650513 addi a0,a0,198 # 13b0 <malloc+0x11c> 2f2: 00001097 auipc ra,0x1 2f6: bbc080e7 jalr -1092(ra) # eae <unlink> 2fa: b51d j 120 <go+0xa8> if(chdir("grindir") != 0){ 2fc: 00001517 auipc a0,0x1 300: 07c50513 addi a0,a0,124 # 1378 <malloc+0xe4> 304: 00001097 auipc ra,0x1 308: bca080e7 jalr -1078(ra) # ece <chdir> 30c: e115 bnez a0,330 <go+0x2b8> unlink("../b"); 30e: 00001517 auipc a0,0x1 312: 0ca50513 addi a0,a0,202 # 13d8 <malloc+0x144> 316: 00001097 auipc ra,0x1 31a: b98080e7 jalr -1128(ra) # eae <unlink> chdir("/"); 31e: 00001517 auipc a0,0x1 322: 07a50513 addi a0,a0,122 # 1398 <malloc+0x104> 326: 00001097 auipc ra,0x1 32a: ba8080e7 jalr -1112(ra) # ece <chdir> 32e: bbcd j 120 <go+0xa8> printf("chdir grindir failed\n"); 330: 00001517 auipc a0,0x1 334: 05050513 addi a0,a0,80 # 1380 <malloc+0xec> 338: 00001097 auipc ra,0x1 33c: e9e080e7 jalr -354(ra) # 11d6 <printf> exit(1); 340: 4505 li a0,1 342: 00001097 auipc ra,0x1 346: b1c080e7 jalr -1252(ra) # e5e <exit> close(fd); 34a: 854a mv a0,s2 34c: 00001097 auipc ra,0x1 350: b3a080e7 jalr -1222(ra) # e86 <close> fd = open("/grindir/../a", O_CREATE|O_RDWR); 354: 20200593 li a1,514 358: 00001517 auipc a0,0x1 35c: 08850513 addi a0,a0,136 # 13e0 <malloc+0x14c> 360: 00001097 auipc ra,0x1 364: b3e080e7 jalr -1218(ra) # e9e <open> 368: 892a mv s2,a0 36a: bb5d j 120 <go+0xa8> close(fd); 36c: 854a mv a0,s2 36e: 00001097 auipc ra,0x1 372: b18080e7 jalr -1256(ra) # e86 <close> fd = open("/./grindir/./../b", O_CREATE|O_RDWR); 376: 20200593 li a1,514 37a: 00001517 auipc a0,0x1 37e: 07650513 addi a0,a0,118 # 13f0 <malloc+0x15c> 382: 00001097 auipc ra,0x1 386: b1c080e7 jalr -1252(ra) # e9e <open> 38a: 892a mv s2,a0 38c: bb51 j 120 <go+0xa8> write(fd, buf, sizeof(buf)); 38e: 3e700613 li a2,999 392: 00001597 auipc a1,0x1 396: 2de58593 addi a1,a1,734 # 1670 <buf.1231> 39a: 854a mv a0,s2 39c: 00001097 auipc ra,0x1 3a0: ae2080e7 jalr -1310(ra) # e7e <write> 3a4: bbb5 j 120 <go+0xa8> read(fd, buf, sizeof(buf)); 3a6: 3e700613 li a2,999 3aa: 00001597 auipc a1,0x1 3ae: 2c658593 addi a1,a1,710 # 1670 <buf.1231> 3b2: 854a mv a0,s2 3b4: 00001097 auipc ra,0x1 3b8: ac2080e7 jalr -1342(ra) # e76 <read> 3bc: b395 j 120 <go+0xa8> mkdir("grindir/../a"); 3be: 00001517 auipc a0,0x1 3c2: ff250513 addi a0,a0,-14 # 13b0 <malloc+0x11c> 3c6: 00001097 auipc ra,0x1 3ca: b00080e7 jalr -1280(ra) # ec6 <mkdir> close(open("a/../a/./a", O_CREATE|O_RDWR)); 3ce: 20200593 li a1,514 3d2: 00001517 auipc a0,0x1 3d6: 03650513 addi a0,a0,54 # 1408 <malloc+0x174> 3da: 00001097 auipc ra,0x1 3de: ac4080e7 jalr -1340(ra) # e9e <open> 3e2: 00001097 auipc ra,0x1 3e6: aa4080e7 jalr -1372(ra) # e86 <close> unlink("a/a"); 3ea: 00001517 auipc a0,0x1 3ee: 02e50513 addi a0,a0,46 # 1418 <malloc+0x184> 3f2: 00001097 auipc ra,0x1 3f6: abc080e7 jalr -1348(ra) # eae <unlink> 3fa: b31d j 120 <go+0xa8> mkdir("/../b"); 3fc: 00001517 auipc a0,0x1 400: 02450513 addi a0,a0,36 # 1420 <malloc+0x18c> 404: 00001097 auipc ra,0x1 408: ac2080e7 jalr -1342(ra) # ec6 <mkdir> close(open("grindir/../b/b", O_CREATE|O_RDWR)); 40c: 20200593 li a1,514 410: 00001517 auipc a0,0x1 414: 01850513 addi a0,a0,24 # 1428 <malloc+0x194> 418: 00001097 auipc ra,0x1 41c: a86080e7 jalr -1402(ra) # e9e <open> 420: 00001097 auipc ra,0x1 424: a66080e7 jalr -1434(ra) # e86 <close> unlink("b/b"); 428: 00001517 auipc a0,0x1 42c: 01050513 addi a0,a0,16 # 1438 <malloc+0x1a4> 430: 00001097 auipc ra,0x1 434: a7e080e7 jalr -1410(ra) # eae <unlink> 438: b1e5 j 120 <go+0xa8> unlink("b"); 43a: 00001517 auipc a0,0x1 43e: fc650513 addi a0,a0,-58 # 1400 <malloc+0x16c> 442: 00001097 auipc ra,0x1 446: a6c080e7 jalr -1428(ra) # eae <unlink> link("../grindir/./../a", "../b"); 44a: 00001597 auipc a1,0x1 44e: f8e58593 addi a1,a1,-114 # 13d8 <malloc+0x144> 452: 00001517 auipc a0,0x1 456: fee50513 addi a0,a0,-18 # 1440 <malloc+0x1ac> 45a: 00001097 auipc ra,0x1 45e: a64080e7 jalr -1436(ra) # ebe <link> 462: b97d j 120 <go+0xa8> unlink("../grindir/../a"); 464: 00001517 auipc a0,0x1 468: ff450513 addi a0,a0,-12 # 1458 <malloc+0x1c4> 46c: 00001097 auipc ra,0x1 470: a42080e7 jalr -1470(ra) # eae <unlink> link(".././b", "/grindir/../a"); 474: 00001597 auipc a1,0x1 478: f6c58593 addi a1,a1,-148 # 13e0 <malloc+0x14c> 47c: 00001517 auipc a0,0x1 480: fec50513 addi a0,a0,-20 # 1468 <malloc+0x1d4> 484: 00001097 auipc ra,0x1 488: a3a080e7 jalr -1478(ra) # ebe <link> 48c: b951 j 120 <go+0xa8> int pid = fork(); 48e: 00001097 auipc ra,0x1 492: 9c8080e7 jalr -1592(ra) # e56 <fork> if(pid == 0){ 496: c909 beqz a0,4a8 <go+0x430> } else if(pid < 0){ 498: 00054c63 bltz a0,4b0 <go+0x438> wait(0); 49c: 4501 li a0,0 49e: 00001097 auipc ra,0x1 4a2: 9c8080e7 jalr -1592(ra) # e66 <wait> 4a6: b9ad j 120 <go+0xa8> exit(0); 4a8: 00001097 auipc ra,0x1 4ac: 9b6080e7 jalr -1610(ra) # e5e <exit> printf("grind: fork failed\n"); 4b0: 00001517 auipc a0,0x1 4b4: fc050513 addi a0,a0,-64 # 1470 <malloc+0x1dc> 4b8: 00001097 auipc ra,0x1 4bc: d1e080e7 jalr -738(ra) # 11d6 <printf> exit(1); 4c0: 4505 li a0,1 4c2: 00001097 auipc ra,0x1 4c6: 99c080e7 jalr -1636(ra) # e5e <exit> int pid = fork(); 4ca: 00001097 auipc ra,0x1 4ce: 98c080e7 jalr -1652(ra) # e56 <fork> if(pid == 0){ 4d2: c909 beqz a0,4e4 <go+0x46c> } else if(pid < 0){ 4d4: 02054563 bltz a0,4fe <go+0x486> wait(0); 4d8: 4501 li a0,0 4da: 00001097 auipc ra,0x1 4de: 98c080e7 jalr -1652(ra) # e66 <wait> 4e2: b93d j 120 <go+0xa8> fork(); 4e4: 00001097 auipc ra,0x1 4e8: 972080e7 jalr -1678(ra) # e56 <fork> fork(); 4ec: 00001097 auipc ra,0x1 4f0: 96a080e7 jalr -1686(ra) # e56 <fork> exit(0); 4f4: 4501 li a0,0 4f6: 00001097 auipc ra,0x1 4fa: 968080e7 jalr -1688(ra) # e5e <exit> printf("grind: fork failed\n"); 4fe: 00001517 auipc a0,0x1 502: f7250513 addi a0,a0,-142 # 1470 <malloc+0x1dc> 506: 00001097 auipc ra,0x1 50a: cd0080e7 jalr -816(ra) # 11d6 <printf> exit(1); 50e: 4505 li a0,1 510: 00001097 auipc ra,0x1 514: 94e080e7 jalr -1714(ra) # e5e <exit> sbrk(6011); 518: 8556 mv a0,s5 51a: 00001097 auipc ra,0x1 51e: 9cc080e7 jalr -1588(ra) # ee6 <sbrk> 522: befd j 120 <go+0xa8> if(sbrk(0) > break0) 524: 4501 li a0,0 526: 00001097 auipc ra,0x1 52a: 9c0080e7 jalr -1600(ra) # ee6 <sbrk> 52e: beaa79e3 bgeu s4,a0,120 <go+0xa8> sbrk(-(sbrk(0) - break0)); 532: 4501 li a0,0 534: 00001097 auipc ra,0x1 538: 9b2080e7 jalr -1614(ra) # ee6 <sbrk> 53c: 40aa053b subw a0,s4,a0 540: 00001097 auipc ra,0x1 544: 9a6080e7 jalr -1626(ra) # ee6 <sbrk> 548: bee1 j 120 <go+0xa8> int pid = fork(); 54a: 00001097 auipc ra,0x1 54e: 90c080e7 jalr -1780(ra) # e56 <fork> 552: 8b2a mv s6,a0 if(pid == 0){ 554: c51d beqz a0,582 <go+0x50a> } else if(pid < 0){ 556: 04054963 bltz a0,5a8 <go+0x530> if(chdir("../grindir/..") != 0){ 55a: 00001517 auipc a0,0x1 55e: f2e50513 addi a0,a0,-210 # 1488 <malloc+0x1f4> 562: 00001097 auipc ra,0x1 566: 96c080e7 jalr -1684(ra) # ece <chdir> 56a: ed21 bnez a0,5c2 <go+0x54a> kill(pid); 56c: 855a mv a0,s6 56e: 00001097 auipc ra,0x1 572: 920080e7 jalr -1760(ra) # e8e <kill> wait(0); 576: 4501 li a0,0 578: 00001097 auipc ra,0x1 57c: 8ee080e7 jalr -1810(ra) # e66 <wait> 580: b645 j 120 <go+0xa8> close(open("a", O_CREATE|O_RDWR)); 582: 20200593 li a1,514 586: 00001517 auipc a0,0x1 58a: eca50513 addi a0,a0,-310 # 1450 <malloc+0x1bc> 58e: 00001097 auipc ra,0x1 592: 910080e7 jalr -1776(ra) # e9e <open> 596: 00001097 auipc ra,0x1 59a: 8f0080e7 jalr -1808(ra) # e86 <close> exit(0); 59e: 4501 li a0,0 5a0: 00001097 auipc ra,0x1 5a4: 8be080e7 jalr -1858(ra) # e5e <exit> printf("grind: fork failed\n"); 5a8: 00001517 auipc a0,0x1 5ac: ec850513 addi a0,a0,-312 # 1470 <malloc+0x1dc> 5b0: 00001097 auipc ra,0x1 5b4: c26080e7 jalr -986(ra) # 11d6 <printf> exit(1); 5b8: 4505 li a0,1 5ba: 00001097 auipc ra,0x1 5be: 8a4080e7 jalr -1884(ra) # e5e <exit> printf("chdir failed\n"); 5c2: 00001517 auipc a0,0x1 5c6: ed650513 addi a0,a0,-298 # 1498 <malloc+0x204> 5ca: 00001097 auipc ra,0x1 5ce: c0c080e7 jalr -1012(ra) # 11d6 <printf> exit(1); 5d2: 4505 li a0,1 5d4: 00001097 auipc ra,0x1 5d8: 88a080e7 jalr -1910(ra) # e5e <exit> int pid = fork(); 5dc: 00001097 auipc ra,0x1 5e0: 87a080e7 jalr -1926(ra) # e56 <fork> if(pid == 0){ 5e4: c909 beqz a0,5f6 <go+0x57e> } else if(pid < 0){ 5e6: 02054563 bltz a0,610 <go+0x598> wait(0); 5ea: 4501 li a0,0 5ec: 00001097 auipc ra,0x1 5f0: 87a080e7 jalr -1926(ra) # e66 <wait> 5f4: b635 j 120 <go+0xa8> kill(getpid()); 5f6: 00001097 auipc ra,0x1 5fa: 8e8080e7 jalr -1816(ra) # ede <getpid> 5fe: 00001097 auipc ra,0x1 602: 890080e7 jalr -1904(ra) # e8e <kill> exit(0); 606: 4501 li a0,0 608: 00001097 auipc ra,0x1 60c: 856080e7 jalr -1962(ra) # e5e <exit> printf("grind: fork failed\n"); 610: 00001517 auipc a0,0x1 614: e6050513 addi a0,a0,-416 # 1470 <malloc+0x1dc> 618: 00001097 auipc ra,0x1 61c: bbe080e7 jalr -1090(ra) # 11d6 <printf> exit(1); 620: 4505 li a0,1 622: 00001097 auipc ra,0x1 626: 83c080e7 jalr -1988(ra) # e5e <exit> if(pipe(fds) < 0){ 62a: fa840513 addi a0,s0,-88 62e: 00001097 auipc ra,0x1 632: 840080e7 jalr -1984(ra) # e6e <pipe> 636: 02054b63 bltz a0,66c <go+0x5f4> int pid = fork(); 63a: 00001097 auipc ra,0x1 63e: 81c080e7 jalr -2020(ra) # e56 <fork> if(pid == 0){ 642: c131 beqz a0,686 <go+0x60e> } else if(pid < 0){ 644: 0a054a63 bltz a0,6f8 <go+0x680> close(fds[0]); 648: fa842503 lw a0,-88(s0) 64c: 00001097 auipc ra,0x1 650: 83a080e7 jalr -1990(ra) # e86 <close> close(fds[1]); 654: fac42503 lw a0,-84(s0) 658: 00001097 auipc ra,0x1 65c: 82e080e7 jalr -2002(ra) # e86 <close> wait(0); 660: 4501 li a0,0 662: 00001097 auipc ra,0x1 666: 804080e7 jalr -2044(ra) # e66 <wait> 66a: bc5d j 120 <go+0xa8> printf("grind: pipe failed\n"); 66c: 00001517 auipc a0,0x1 670: e3c50513 addi a0,a0,-452 # 14a8 <malloc+0x214> 674: 00001097 auipc ra,0x1 678: b62080e7 jalr -1182(ra) # 11d6 <printf> exit(1); 67c: 4505 li a0,1 67e: 00000097 auipc ra,0x0 682: 7e0080e7 jalr 2016(ra) # e5e <exit> fork(); 686: 00000097 auipc ra,0x0 68a: 7d0080e7 jalr 2000(ra) # e56 <fork> fork(); 68e: 00000097 auipc ra,0x0 692: 7c8080e7 jalr 1992(ra) # e56 <fork> if(write(fds[1], "x", 1) != 1) 696: 4605 li a2,1 698: 00001597 auipc a1,0x1 69c: e2858593 addi a1,a1,-472 # 14c0 <malloc+0x22c> 6a0: fac42503 lw a0,-84(s0) 6a4: 00000097 auipc ra,0x0 6a8: 7da080e7 jalr 2010(ra) # e7e <write> 6ac: 4785 li a5,1 6ae: 02f51363 bne a0,a5,6d4 <go+0x65c> if(read(fds[0], &c, 1) != 1) 6b2: 4605 li a2,1 6b4: fa040593 addi a1,s0,-96 6b8: fa842503 lw a0,-88(s0) 6bc: 00000097 auipc ra,0x0 6c0: 7ba080e7 jalr 1978(ra) # e76 <read> 6c4: 4785 li a5,1 6c6: 02f51063 bne a0,a5,6e6 <go+0x66e> exit(0); 6ca: 4501 li a0,0 6cc: 00000097 auipc ra,0x0 6d0: 792080e7 jalr 1938(ra) # e5e <exit> printf("grind: pipe write failed\n"); 6d4: 00001517 auipc a0,0x1 6d8: df450513 addi a0,a0,-524 # 14c8 <malloc+0x234> 6dc: 00001097 auipc ra,0x1 6e0: afa080e7 jalr -1286(ra) # 11d6 <printf> 6e4: b7f9 j 6b2 <go+0x63a> printf("grind: pipe read failed\n"); 6e6: 00001517 auipc a0,0x1 6ea: e0250513 addi a0,a0,-510 # 14e8 <malloc+0x254> 6ee: 00001097 auipc ra,0x1 6f2: ae8080e7 jalr -1304(ra) # 11d6 <printf> 6f6: bfd1 j 6ca <go+0x652> printf("grind: fork failed\n"); 6f8: 00001517 auipc a0,0x1 6fc: d7850513 addi a0,a0,-648 # 1470 <malloc+0x1dc> 700: 00001097 auipc ra,0x1 704: ad6080e7 jalr -1322(ra) # 11d6 <printf> exit(1); 708: 4505 li a0,1 70a: 00000097 auipc ra,0x0 70e: 754080e7 jalr 1876(ra) # e5e <exit> int pid = fork(); 712: 00000097 auipc ra,0x0 716: 744080e7 jalr 1860(ra) # e56 <fork> if(pid == 0){ 71a: c909 beqz a0,72c <go+0x6b4> } else if(pid < 0){ 71c: 06054f63 bltz a0,79a <go+0x722> wait(0); 720: 4501 li a0,0 722: 00000097 auipc ra,0x0 726: 744080e7 jalr 1860(ra) # e66 <wait> 72a: badd j 120 <go+0xa8> unlink("a"); 72c: 00001517 auipc a0,0x1 730: d2450513 addi a0,a0,-732 # 1450 <malloc+0x1bc> 734: 00000097 auipc ra,0x0 738: 77a080e7 jalr 1914(ra) # eae <unlink> mkdir("a"); 73c: 00001517 auipc a0,0x1 740: d1450513 addi a0,a0,-748 # 1450 <malloc+0x1bc> 744: 00000097 auipc ra,0x0 748: 782080e7 jalr 1922(ra) # ec6 <mkdir> chdir("a"); 74c: 00001517 auipc a0,0x1 750: d0450513 addi a0,a0,-764 # 1450 <malloc+0x1bc> 754: 00000097 auipc ra,0x0 758: 77a080e7 jalr 1914(ra) # ece <chdir> unlink("../a"); 75c: 00001517 auipc a0,0x1 760: c5c50513 addi a0,a0,-932 # 13b8 <malloc+0x124> 764: 00000097 auipc ra,0x0 768: 74a080e7 jalr 1866(ra) # eae <unlink> fd = open("x", O_CREATE|O_RDWR); 76c: 20200593 li a1,514 770: 00001517 auipc a0,0x1 774: d5050513 addi a0,a0,-688 # 14c0 <malloc+0x22c> 778: 00000097 auipc ra,0x0 77c: 726080e7 jalr 1830(ra) # e9e <open> unlink("x"); 780: 00001517 auipc a0,0x1 784: d4050513 addi a0,a0,-704 # 14c0 <malloc+0x22c> 788: 00000097 auipc ra,0x0 78c: 726080e7 jalr 1830(ra) # eae <unlink> exit(0); 790: 4501 li a0,0 792: 00000097 auipc ra,0x0 796: 6cc080e7 jalr 1740(ra) # e5e <exit> printf("fork failed\n"); 79a: 00001517 auipc a0,0x1 79e: d6e50513 addi a0,a0,-658 # 1508 <malloc+0x274> 7a2: 00001097 auipc ra,0x1 7a6: a34080e7 jalr -1484(ra) # 11d6 <printf> exit(1); 7aa: 4505 li a0,1 7ac: 00000097 auipc ra,0x0 7b0: 6b2080e7 jalr 1714(ra) # e5e <exit> unlink("c"); 7b4: 00001517 auipc a0,0x1 7b8: d6450513 addi a0,a0,-668 # 1518 <malloc+0x284> 7bc: 00000097 auipc ra,0x0 7c0: 6f2080e7 jalr 1778(ra) # eae <unlink> int fd1 = open("c", O_CREATE|O_RDWR); 7c4: 20200593 li a1,514 7c8: 00001517 auipc a0,0x1 7cc: d5050513 addi a0,a0,-688 # 1518 <malloc+0x284> 7d0: 00000097 auipc ra,0x0 7d4: 6ce080e7 jalr 1742(ra) # e9e <open> 7d8: 8b2a mv s6,a0 if(fd1 < 0){ 7da: 04054f63 bltz a0,838 <go+0x7c0> if(write(fd1, "x", 1) != 1){ 7de: 4605 li a2,1 7e0: 00001597 auipc a1,0x1 7e4: ce058593 addi a1,a1,-800 # 14c0 <malloc+0x22c> 7e8: 00000097 auipc ra,0x0 7ec: 696080e7 jalr 1686(ra) # e7e <write> 7f0: 4785 li a5,1 7f2: 06f51063 bne a0,a5,852 <go+0x7da> if(fstat(fd1, &st) != 0){ 7f6: fa840593 addi a1,s0,-88 7fa: 855a mv a0,s6 7fc: 00000097 auipc ra,0x0 800: 6ba080e7 jalr 1722(ra) # eb6 <fstat> 804: e525 bnez a0,86c <go+0x7f4> if(st.size != 1){ 806: fb843583 ld a1,-72(s0) 80a: 4785 li a5,1 80c: 06f59d63 bne a1,a5,886 <go+0x80e> if(st.ino > 200){ 810: fac42583 lw a1,-84(s0) 814: 0c800793 li a5,200 818: 08b7e563 bltu a5,a1,8a2 <go+0x82a> close(fd1); 81c: 855a mv a0,s6 81e: 00000097 auipc ra,0x0 822: 668080e7 jalr 1640(ra) # e86 <close> unlink("c"); 826: 00001517 auipc a0,0x1 82a: cf250513 addi a0,a0,-782 # 1518 <malloc+0x284> 82e: 00000097 auipc ra,0x0 832: 680080e7 jalr 1664(ra) # eae <unlink> 836: b0ed j 120 <go+0xa8> printf("create c failed\n"); 838: 00001517 auipc a0,0x1 83c: ce850513 addi a0,a0,-792 # 1520 <malloc+0x28c> 840: 00001097 auipc ra,0x1 844: 996080e7 jalr -1642(ra) # 11d6 <printf> exit(1); 848: 4505 li a0,1 84a: 00000097 auipc ra,0x0 84e: 614080e7 jalr 1556(ra) # e5e <exit> printf("write c failed\n"); 852: 00001517 auipc a0,0x1 856: ce650513 addi a0,a0,-794 # 1538 <malloc+0x2a4> 85a: 00001097 auipc ra,0x1 85e: 97c080e7 jalr -1668(ra) # 11d6 <printf> exit(1); 862: 4505 li a0,1 864: 00000097 auipc ra,0x0 868: 5fa080e7 jalr 1530(ra) # e5e <exit> printf("fstat failed\n"); 86c: 00001517 auipc a0,0x1 870: cdc50513 addi a0,a0,-804 # 1548 <malloc+0x2b4> 874: 00001097 auipc ra,0x1 878: 962080e7 jalr -1694(ra) # 11d6 <printf> exit(1); 87c: 4505 li a0,1 87e: 00000097 auipc ra,0x0 882: 5e0080e7 jalr 1504(ra) # e5e <exit> printf("fstat reports wrong size %d\n", (int)st.size); 886: 2581 sext.w a1,a1 888: 00001517 auipc a0,0x1 88c: cd050513 addi a0,a0,-816 # 1558 <malloc+0x2c4> 890: 00001097 auipc ra,0x1 894: 946080e7 jalr -1722(ra) # 11d6 <printf> exit(1); 898: 4505 li a0,1 89a: 00000097 auipc ra,0x0 89e: 5c4080e7 jalr 1476(ra) # e5e <exit> printf("fstat reports crazy i-number %d\n", st.ino); 8a2: 00001517 auipc a0,0x1 8a6: cd650513 addi a0,a0,-810 # 1578 <malloc+0x2e4> 8aa: 00001097 auipc ra,0x1 8ae: 92c080e7 jalr -1748(ra) # 11d6 <printf> exit(1); 8b2: 4505 li a0,1 8b4: 00000097 auipc ra,0x0 8b8: 5aa080e7 jalr 1450(ra) # e5e <exit> fprintf(2, "pipe failed\n"); 8bc: 00001597 auipc a1,0x1 8c0: ce458593 addi a1,a1,-796 # 15a0 <malloc+0x30c> 8c4: 4509 li a0,2 8c6: 00001097 auipc ra,0x1 8ca: 8e2080e7 jalr -1822(ra) # 11a8 <fprintf> exit(1); 8ce: 4505 li a0,1 8d0: 00000097 auipc ra,0x0 8d4: 58e080e7 jalr 1422(ra) # e5e <exit> fprintf(2, "pipe failed\n"); 8d8: 00001597 auipc a1,0x1 8dc: cc858593 addi a1,a1,-824 # 15a0 <malloc+0x30c> 8e0: 4509 li a0,2 8e2: 00001097 auipc ra,0x1 8e6: 8c6080e7 jalr -1850(ra) # 11a8 <fprintf> exit(1); 8ea: 4505 li a0,1 8ec: 00000097 auipc ra,0x0 8f0: 572080e7 jalr 1394(ra) # e5e <exit> close(bb[0]); 8f4: fa042503 lw a0,-96(s0) 8f8: 00000097 auipc ra,0x0 8fc: 58e080e7 jalr 1422(ra) # e86 <close> close(bb[1]); 900: fa442503 lw a0,-92(s0) 904: 00000097 auipc ra,0x0 908: 582080e7 jalr 1410(ra) # e86 <close> close(aa[0]); 90c: f9842503 lw a0,-104(s0) 910: 00000097 auipc ra,0x0 914: 576080e7 jalr 1398(ra) # e86 <close> close(1); 918: 4505 li a0,1 91a: 00000097 auipc ra,0x0 91e: 56c080e7 jalr 1388(ra) # e86 <close> if(dup(aa[1]) != 1){ 922: f9c42503 lw a0,-100(s0) 926: 00000097 auipc ra,0x0 92a: 5b0080e7 jalr 1456(ra) # ed6 <dup> 92e: 4785 li a5,1 930: 02f50063 beq a0,a5,950 <go+0x8d8> fprintf(2, "dup failed\n"); 934: 00001597 auipc a1,0x1 938: c7c58593 addi a1,a1,-900 # 15b0 <malloc+0x31c> 93c: 4509 li a0,2 93e: 00001097 auipc ra,0x1 942: 86a080e7 jalr -1942(ra) # 11a8 <fprintf> exit(1); 946: 4505 li a0,1 948: 00000097 auipc ra,0x0 94c: 516080e7 jalr 1302(ra) # e5e <exit> close(aa[1]); 950: f9c42503 lw a0,-100(s0) 954: 00000097 auipc ra,0x0 958: 532080e7 jalr 1330(ra) # e86 <close> char *args[3] = { "echo", "hi", 0 }; 95c: 00001797 auipc a5,0x1 960: c6478793 addi a5,a5,-924 # 15c0 <malloc+0x32c> 964: faf43423 sd a5,-88(s0) 968: 00001797 auipc a5,0x1 96c: c6078793 addi a5,a5,-928 # 15c8 <malloc+0x334> 970: faf43823 sd a5,-80(s0) 974: fa043c23 sd zero,-72(s0) exec("grindir/../echo", args); 978: fa840593 addi a1,s0,-88 97c: 00001517 auipc a0,0x1 980: c5450513 addi a0,a0,-940 # 15d0 <malloc+0x33c> 984: 00000097 auipc ra,0x0 988: 512080e7 jalr 1298(ra) # e96 <exec> fprintf(2, "echo: not found\n"); 98c: 00001597 auipc a1,0x1 990: c5458593 addi a1,a1,-940 # 15e0 <malloc+0x34c> 994: 4509 li a0,2 996: 00001097 auipc ra,0x1 99a: 812080e7 jalr -2030(ra) # 11a8 <fprintf> exit(2); 99e: 4509 li a0,2 9a0: 00000097 auipc ra,0x0 9a4: 4be080e7 jalr 1214(ra) # e5e <exit> fprintf(2, "fork failed\n"); 9a8: 00001597 auipc a1,0x1 9ac: b6058593 addi a1,a1,-1184 # 1508 <malloc+0x274> 9b0: 4509 li a0,2 9b2: 00000097 auipc ra,0x0 9b6: 7f6080e7 jalr 2038(ra) # 11a8 <fprintf> exit(3); 9ba: 450d li a0,3 9bc: 00000097 auipc ra,0x0 9c0: 4a2080e7 jalr 1186(ra) # e5e <exit> close(aa[1]); 9c4: f9c42503 lw a0,-100(s0) 9c8: 00000097 auipc ra,0x0 9cc: 4be080e7 jalr 1214(ra) # e86 <close> close(bb[0]); 9d0: fa042503 lw a0,-96(s0) 9d4: 00000097 auipc ra,0x0 9d8: 4b2080e7 jalr 1202(ra) # e86 <close> close(0); 9dc: 4501 li a0,0 9de: 00000097 auipc ra,0x0 9e2: 4a8080e7 jalr 1192(ra) # e86 <close> if(dup(aa[0]) != 0){ 9e6: f9842503 lw a0,-104(s0) 9ea: 00000097 auipc ra,0x0 9ee: 4ec080e7 jalr 1260(ra) # ed6 <dup> 9f2: cd19 beqz a0,a10 <go+0x998> fprintf(2, "dup failed\n"); 9f4: 00001597 auipc a1,0x1 9f8: bbc58593 addi a1,a1,-1092 # 15b0 <malloc+0x31c> 9fc: 4509 li a0,2 9fe: 00000097 auipc ra,0x0 a02: 7aa080e7 jalr 1962(ra) # 11a8 <fprintf> exit(4); a06: 4511 li a0,4 a08: 00000097 auipc ra,0x0 a0c: 456080e7 jalr 1110(ra) # e5e <exit> close(aa[0]); a10: f9842503 lw a0,-104(s0) a14: 00000097 auipc ra,0x0 a18: 472080e7 jalr 1138(ra) # e86 <close> close(1); a1c: 4505 li a0,1 a1e: 00000097 auipc ra,0x0 a22: 468080e7 jalr 1128(ra) # e86 <close> if(dup(bb[1]) != 1){ a26: fa442503 lw a0,-92(s0) a2a: 00000097 auipc ra,0x0 a2e: 4ac080e7 jalr 1196(ra) # ed6 <dup> a32: 4785 li a5,1 a34: 02f50063 beq a0,a5,a54 <go+0x9dc> fprintf(2, "dup failed\n"); a38: 00001597 auipc a1,0x1 a3c: b7858593 addi a1,a1,-1160 # 15b0 <malloc+0x31c> a40: 4509 li a0,2 a42: 00000097 auipc ra,0x0 a46: 766080e7 jalr 1894(ra) # 11a8 <fprintf> exit(5); a4a: 4515 li a0,5 a4c: 00000097 auipc ra,0x0 a50: 412080e7 jalr 1042(ra) # e5e <exit> close(bb[1]); a54: fa442503 lw a0,-92(s0) a58: 00000097 auipc ra,0x0 a5c: 42e080e7 jalr 1070(ra) # e86 <close> char *args[2] = { "cat", 0 }; a60: 00001797 auipc a5,0x1 a64: b9878793 addi a5,a5,-1128 # 15f8 <malloc+0x364> a68: faf43423 sd a5,-88(s0) a6c: fa043823 sd zero,-80(s0) exec("/cat", args); a70: fa840593 addi a1,s0,-88 a74: 00001517 auipc a0,0x1 a78: b8c50513 addi a0,a0,-1140 # 1600 <malloc+0x36c> a7c: 00000097 auipc ra,0x0 a80: 41a080e7 jalr 1050(ra) # e96 <exec> fprintf(2, "cat: not found\n"); a84: 00001597 auipc a1,0x1 a88: b8458593 addi a1,a1,-1148 # 1608 <malloc+0x374> a8c: 4509 li a0,2 a8e: 00000097 auipc ra,0x0 a92: 71a080e7 jalr 1818(ra) # 11a8 <fprintf> exit(6); a96: 4519 li a0,6 a98: 00000097 auipc ra,0x0 a9c: 3c6080e7 jalr 966(ra) # e5e <exit> fprintf(2, "fork failed\n"); aa0: 00001597 auipc a1,0x1 aa4: a6858593 addi a1,a1,-1432 # 1508 <malloc+0x274> aa8: 4509 li a0,2 aaa: 00000097 auipc ra,0x0 aae: 6fe080e7 jalr 1790(ra) # 11a8 <fprintf> exit(7); ab2: 451d li a0,7 ab4: 00000097 auipc ra,0x0 ab8: 3aa080e7 jalr 938(ra) # e5e <exit> 0000000000000abc <iter>: } } void iter() { abc: 7179 addi sp,sp,-48 abe: f406 sd ra,40(sp) ac0: f022 sd s0,32(sp) ac2: ec26 sd s1,24(sp) ac4: e84a sd s2,16(sp) ac6: 1800 addi s0,sp,48 unlink("a"); ac8: 00001517 auipc a0,0x1 acc: 98850513 addi a0,a0,-1656 # 1450 <malloc+0x1bc> ad0: 00000097 auipc ra,0x0 ad4: 3de080e7 jalr 990(ra) # eae <unlink> unlink("b"); ad8: 00001517 auipc a0,0x1 adc: 92850513 addi a0,a0,-1752 # 1400 <malloc+0x16c> ae0: 00000097 auipc ra,0x0 ae4: 3ce080e7 jalr 974(ra) # eae <unlink> int pid1 = fork(); ae8: 00000097 auipc ra,0x0 aec: 36e080e7 jalr 878(ra) # e56 <fork> if(pid1 < 0){ af0: 00054e63 bltz a0,b0c <iter+0x50> af4: 84aa mv s1,a0 printf("grind: fork failed\n"); exit(1); } if(pid1 == 0){ af6: e905 bnez a0,b26 <iter+0x6a> rand_next = 31; af8: 47fd li a5,31 afa: 00001717 auipc a4,0x1 afe: b6f73323 sd a5,-1178(a4) # 1660 <rand_next> go(0); b02: 4501 li a0,0 b04: fffff097 auipc ra,0xfffff b08: 574080e7 jalr 1396(ra) # 78 <go> printf("grind: fork failed\n"); b0c: 00001517 auipc a0,0x1 b10: 96450513 addi a0,a0,-1692 # 1470 <malloc+0x1dc> b14: 00000097 auipc ra,0x0 b18: 6c2080e7 jalr 1730(ra) # 11d6 <printf> exit(1); b1c: 4505 li a0,1 b1e: 00000097 auipc ra,0x0 b22: 340080e7 jalr 832(ra) # e5e <exit> exit(0); } int pid2 = fork(); b26: 00000097 auipc ra,0x0 b2a: 330080e7 jalr 816(ra) # e56 <fork> b2e: 892a mv s2,a0 if(pid2 < 0){ b30: 00054f63 bltz a0,b4e <iter+0x92> printf("grind: fork failed\n"); exit(1); } if(pid2 == 0){ b34: e915 bnez a0,b68 <iter+0xac> rand_next = 7177; b36: 6789 lui a5,0x2 b38: c0978793 addi a5,a5,-1015 # 1c09 <__BSS_END__+0x1a1> b3c: 00001717 auipc a4,0x1 b40: b2f73223 sd a5,-1244(a4) # 1660 <rand_next> go(1); b44: 4505 li a0,1 b46: fffff097 auipc ra,0xfffff b4a: 532080e7 jalr 1330(ra) # 78 <go> printf("grind: fork failed\n"); b4e: 00001517 auipc a0,0x1 b52: 92250513 addi a0,a0,-1758 # 1470 <malloc+0x1dc> b56: 00000097 auipc ra,0x0 b5a: 680080e7 jalr 1664(ra) # 11d6 <printf> exit(1); b5e: 4505 li a0,1 b60: 00000097 auipc ra,0x0 b64: 2fe080e7 jalr 766(ra) # e5e <exit> exit(0); } int st1 = -1; b68: 57fd li a5,-1 b6a: fcf42e23 sw a5,-36(s0) wait(&st1); b6e: fdc40513 addi a0,s0,-36 b72: 00000097 auipc ra,0x0 b76: 2f4080e7 jalr 756(ra) # e66 <wait> if(st1 != 0){ b7a: fdc42783 lw a5,-36(s0) b7e: ef99 bnez a5,b9c <iter+0xe0> kill(pid1); kill(pid2); } int st2 = -1; b80: 57fd li a5,-1 b82: fcf42c23 sw a5,-40(s0) wait(&st2); b86: fd840513 addi a0,s0,-40 b8a: 00000097 auipc ra,0x0 b8e: 2dc080e7 jalr 732(ra) # e66 <wait> exit(0); b92: 4501 li a0,0 b94: 00000097 auipc ra,0x0 b98: 2ca080e7 jalr 714(ra) # e5e <exit> kill(pid1); b9c: 8526 mv a0,s1 b9e: 00000097 auipc ra,0x0 ba2: 2f0080e7 jalr 752(ra) # e8e <kill> kill(pid2); ba6: 854a mv a0,s2 ba8: 00000097 auipc ra,0x0 bac: 2e6080e7 jalr 742(ra) # e8e <kill> bb0: bfc1 j b80 <iter+0xc4> 0000000000000bb2 <main>: } int main() { bb2: 1141 addi sp,sp,-16 bb4: e406 sd ra,8(sp) bb6: e022 sd s0,0(sp) bb8: 0800 addi s0,sp,16 bba: a811 j bce <main+0x1c> while(1){ int pid = fork(); if(pid == 0){ iter(); bbc: 00000097 auipc ra,0x0 bc0: f00080e7 jalr -256(ra) # abc <iter> exit(0); } if(pid > 0){ wait(0); } sleep(20); bc4: 4551 li a0,20 bc6: 00000097 auipc ra,0x0 bca: 328080e7 jalr 808(ra) # eee <sleep> int pid = fork(); bce: 00000097 auipc ra,0x0 bd2: 288080e7 jalr 648(ra) # e56 <fork> if(pid == 0){ bd6: d17d beqz a0,bbc <main+0xa> if(pid > 0){ bd8: fea056e3 blez a0,bc4 <main+0x12> wait(0); bdc: 4501 li a0,0 bde: 00000097 auipc ra,0x0 be2: 288080e7 jalr 648(ra) # e66 <wait> be6: bff9 j bc4 <main+0x12> 0000000000000be8 <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { be8: 1141 addi sp,sp,-16 bea: e422 sd s0,8(sp) bec: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) bee: 87aa mv a5,a0 bf0: 0585 addi a1,a1,1 bf2: 0785 addi a5,a5,1 bf4: fff5c703 lbu a4,-1(a1) bf8: fee78fa3 sb a4,-1(a5) bfc: fb75 bnez a4,bf0 <strcpy+0x8> ; return os; } bfe: 6422 ld s0,8(sp) c00: 0141 addi sp,sp,16 c02: 8082 ret 0000000000000c04 <strcmp>: int strcmp(const char *p, const char *q) { c04: 1141 addi sp,sp,-16 c06: e422 sd s0,8(sp) c08: 0800 addi s0,sp,16 while(*p && *p == *q) c0a: 00054783 lbu a5,0(a0) c0e: cb91 beqz a5,c22 <strcmp+0x1e> c10: 0005c703 lbu a4,0(a1) c14: 00f71763 bne a4,a5,c22 <strcmp+0x1e> p++, q++; c18: 0505 addi a0,a0,1 c1a: 0585 addi a1,a1,1 while(*p && *p == *q) c1c: 00054783 lbu a5,0(a0) c20: fbe5 bnez a5,c10 <strcmp+0xc> return (uchar)*p - (uchar)*q; c22: 0005c503 lbu a0,0(a1) } c26: 40a7853b subw a0,a5,a0 c2a: 6422 ld s0,8(sp) c2c: 0141 addi sp,sp,16 c2e: 8082 ret 0000000000000c30 <strlen>: uint strlen(const char *s) { c30: 1141 addi sp,sp,-16 c32: e422 sd s0,8(sp) c34: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) c36: 00054783 lbu a5,0(a0) c3a: cf91 beqz a5,c56 <strlen+0x26> c3c: 0505 addi a0,a0,1 c3e: 87aa mv a5,a0 c40: 4685 li a3,1 c42: 9e89 subw a3,a3,a0 c44: 00f6853b addw a0,a3,a5 c48: 0785 addi a5,a5,1 c4a: fff7c703 lbu a4,-1(a5) c4e: fb7d bnez a4,c44 <strlen+0x14> ; return n; } c50: 6422 ld s0,8(sp) c52: 0141 addi sp,sp,16 c54: 8082 ret for(n = 0; s[n]; n++) c56: 4501 li a0,0 c58: bfe5 j c50 <strlen+0x20> 0000000000000c5a <memset>: void* memset(void *dst, int c, uint n) { c5a: 1141 addi sp,sp,-16 c5c: e422 sd s0,8(sp) c5e: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ c60: ce09 beqz a2,c7a <memset+0x20> c62: 87aa mv a5,a0 c64: fff6071b addiw a4,a2,-1 c68: 1702 slli a4,a4,0x20 c6a: 9301 srli a4,a4,0x20 c6c: 0705 addi a4,a4,1 c6e: 972a add a4,a4,a0 cdst[i] = c; c70: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ c74: 0785 addi a5,a5,1 c76: fee79de3 bne a5,a4,c70 <memset+0x16> } return dst; } c7a: 6422 ld s0,8(sp) c7c: 0141 addi sp,sp,16 c7e: 8082 ret 0000000000000c80 <strchr>: char* strchr(const char *s, char c) { c80: 1141 addi sp,sp,-16 c82: e422 sd s0,8(sp) c84: 0800 addi s0,sp,16 for(; *s; s++) c86: 00054783 lbu a5,0(a0) c8a: cb99 beqz a5,ca0 <strchr+0x20> if(*s == c) c8c: 00f58763 beq a1,a5,c9a <strchr+0x1a> for(; *s; s++) c90: 0505 addi a0,a0,1 c92: 00054783 lbu a5,0(a0) c96: fbfd bnez a5,c8c <strchr+0xc> return (char*)s; return 0; c98: 4501 li a0,0 } c9a: 6422 ld s0,8(sp) c9c: 0141 addi sp,sp,16 c9e: 8082 ret return 0; ca0: 4501 li a0,0 ca2: bfe5 j c9a <strchr+0x1a> 0000000000000ca4 <gets>: char* gets(char *buf, int max) { ca4: 711d addi sp,sp,-96 ca6: ec86 sd ra,88(sp) ca8: e8a2 sd s0,80(sp) caa: e4a6 sd s1,72(sp) cac: e0ca sd s2,64(sp) cae: fc4e sd s3,56(sp) cb0: f852 sd s4,48(sp) cb2: f456 sd s5,40(sp) cb4: f05a sd s6,32(sp) cb6: ec5e sd s7,24(sp) cb8: 1080 addi s0,sp,96 cba: 8baa mv s7,a0 cbc: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ cbe: 892a mv s2,a0 cc0: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') cc2: 4aa9 li s5,10 cc4: 4b35 li s6,13 for(i=0; i+1 < max; ){ cc6: 89a6 mv s3,s1 cc8: 2485 addiw s1,s1,1 cca: 0344d863 bge s1,s4,cfa <gets+0x56> cc = read(0, &c, 1); cce: 4605 li a2,1 cd0: faf40593 addi a1,s0,-81 cd4: 4501 li a0,0 cd6: 00000097 auipc ra,0x0 cda: 1a0080e7 jalr 416(ra) # e76 <read> if(cc < 1) cde: 00a05e63 blez a0,cfa <gets+0x56> buf[i++] = c; ce2: faf44783 lbu a5,-81(s0) ce6: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') cea: 01578763 beq a5,s5,cf8 <gets+0x54> cee: 0905 addi s2,s2,1 cf0: fd679be3 bne a5,s6,cc6 <gets+0x22> for(i=0; i+1 < max; ){ cf4: 89a6 mv s3,s1 cf6: a011 j cfa <gets+0x56> cf8: 89a6 mv s3,s1 break; } buf[i] = '\0'; cfa: 99de add s3,s3,s7 cfc: 00098023 sb zero,0(s3) return buf; } d00: 855e mv a0,s7 d02: 60e6 ld ra,88(sp) d04: 6446 ld s0,80(sp) d06: 64a6 ld s1,72(sp) d08: 6906 ld s2,64(sp) d0a: 79e2 ld s3,56(sp) d0c: 7a42 ld s4,48(sp) d0e: 7aa2 ld s5,40(sp) d10: 7b02 ld s6,32(sp) d12: 6be2 ld s7,24(sp) d14: 6125 addi sp,sp,96 d16: 8082 ret 0000000000000d18 <stat>: int stat(const char *n, struct stat *st) { d18: 1101 addi sp,sp,-32 d1a: ec06 sd ra,24(sp) d1c: e822 sd s0,16(sp) d1e: e426 sd s1,8(sp) d20: e04a sd s2,0(sp) d22: 1000 addi s0,sp,32 d24: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); d26: 4581 li a1,0 d28: 00000097 auipc ra,0x0 d2c: 176080e7 jalr 374(ra) # e9e <open> if(fd < 0) d30: 02054563 bltz a0,d5a <stat+0x42> d34: 84aa mv s1,a0 return -1; r = fstat(fd, st); d36: 85ca mv a1,s2 d38: 00000097 auipc ra,0x0 d3c: 17e080e7 jalr 382(ra) # eb6 <fstat> d40: 892a mv s2,a0 close(fd); d42: 8526 mv a0,s1 d44: 00000097 auipc ra,0x0 d48: 142080e7 jalr 322(ra) # e86 <close> return r; } d4c: 854a mv a0,s2 d4e: 60e2 ld ra,24(sp) d50: 6442 ld s0,16(sp) d52: 64a2 ld s1,8(sp) d54: 6902 ld s2,0(sp) d56: 6105 addi sp,sp,32 d58: 8082 ret return -1; d5a: 597d li s2,-1 d5c: bfc5 j d4c <stat+0x34> 0000000000000d5e <atoi>: int atoi(const char *s) { d5e: 1141 addi sp,sp,-16 d60: e422 sd s0,8(sp) d62: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') d64: 00054603 lbu a2,0(a0) d68: fd06079b addiw a5,a2,-48 d6c: 0ff7f793 andi a5,a5,255 d70: 4725 li a4,9 d72: 02f76963 bltu a4,a5,da4 <atoi+0x46> d76: 86aa mv a3,a0 n = 0; d78: 4501 li a0,0 while('0' <= *s && *s <= '9') d7a: 45a5 li a1,9 n = n*10 + *s++ - '0'; d7c: 0685 addi a3,a3,1 d7e: 0025179b slliw a5,a0,0x2 d82: 9fa9 addw a5,a5,a0 d84: 0017979b slliw a5,a5,0x1 d88: 9fb1 addw a5,a5,a2 d8a: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') d8e: 0006c603 lbu a2,0(a3) d92: fd06071b addiw a4,a2,-48 d96: 0ff77713 andi a4,a4,255 d9a: fee5f1e3 bgeu a1,a4,d7c <atoi+0x1e> return n; } d9e: 6422 ld s0,8(sp) da0: 0141 addi sp,sp,16 da2: 8082 ret n = 0; da4: 4501 li a0,0 da6: bfe5 j d9e <atoi+0x40> 0000000000000da8 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { da8: 1141 addi sp,sp,-16 daa: e422 sd s0,8(sp) dac: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { dae: 02b57663 bgeu a0,a1,dda <memmove+0x32> while(n-- > 0) db2: 02c05163 blez a2,dd4 <memmove+0x2c> db6: fff6079b addiw a5,a2,-1 dba: 1782 slli a5,a5,0x20 dbc: 9381 srli a5,a5,0x20 dbe: 0785 addi a5,a5,1 dc0: 97aa add a5,a5,a0 dst = vdst; dc2: 872a mv a4,a0 *dst++ = *src++; dc4: 0585 addi a1,a1,1 dc6: 0705 addi a4,a4,1 dc8: fff5c683 lbu a3,-1(a1) dcc: fed70fa3 sb a3,-1(a4) while(n-- > 0) dd0: fee79ae3 bne a5,a4,dc4 <memmove+0x1c> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } dd4: 6422 ld s0,8(sp) dd6: 0141 addi sp,sp,16 dd8: 8082 ret dst += n; dda: 00c50733 add a4,a0,a2 src += n; dde: 95b2 add a1,a1,a2 while(n-- > 0) de0: fec05ae3 blez a2,dd4 <memmove+0x2c> de4: fff6079b addiw a5,a2,-1 de8: 1782 slli a5,a5,0x20 dea: 9381 srli a5,a5,0x20 dec: fff7c793 not a5,a5 df0: 97ba add a5,a5,a4 *--dst = *--src; df2: 15fd addi a1,a1,-1 df4: 177d addi a4,a4,-1 df6: 0005c683 lbu a3,0(a1) dfa: 00d70023 sb a3,0(a4) while(n-- > 0) dfe: fee79ae3 bne a5,a4,df2 <memmove+0x4a> e02: bfc9 j dd4 <memmove+0x2c> 0000000000000e04 <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { e04: 1141 addi sp,sp,-16 e06: e422 sd s0,8(sp) e08: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { e0a: ca05 beqz a2,e3a <memcmp+0x36> e0c: fff6069b addiw a3,a2,-1 e10: 1682 slli a3,a3,0x20 e12: 9281 srli a3,a3,0x20 e14: 0685 addi a3,a3,1 e16: 96aa add a3,a3,a0 if (*p1 != *p2) { e18: 00054783 lbu a5,0(a0) e1c: 0005c703 lbu a4,0(a1) e20: 00e79863 bne a5,a4,e30 <memcmp+0x2c> return *p1 - *p2; } p1++; e24: 0505 addi a0,a0,1 p2++; e26: 0585 addi a1,a1,1 while (n-- > 0) { e28: fed518e3 bne a0,a3,e18 <memcmp+0x14> } return 0; e2c: 4501 li a0,0 e2e: a019 j e34 <memcmp+0x30> return *p1 - *p2; e30: 40e7853b subw a0,a5,a4 } e34: 6422 ld s0,8(sp) e36: 0141 addi sp,sp,16 e38: 8082 ret return 0; e3a: 4501 li a0,0 e3c: bfe5 j e34 <memcmp+0x30> 0000000000000e3e <memcpy>: void * memcpy(void *dst, const void *src, uint n) { e3e: 1141 addi sp,sp,-16 e40: e406 sd ra,8(sp) e42: e022 sd s0,0(sp) e44: 0800 addi s0,sp,16 return memmove(dst, src, n); e46: 00000097 auipc ra,0x0 e4a: f62080e7 jalr -158(ra) # da8 <memmove> } e4e: 60a2 ld ra,8(sp) e50: 6402 ld s0,0(sp) e52: 0141 addi sp,sp,16 e54: 8082 ret 0000000000000e56 <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork e56: 4885 li a7,1 ecall e58: 00000073 ecall ret e5c: 8082 ret 0000000000000e5e <exit>: .global exit exit: li a7, SYS_exit e5e: 4889 li a7,2 ecall e60: 00000073 ecall ret e64: 8082 ret 0000000000000e66 <wait>: .global wait wait: li a7, SYS_wait e66: 488d li a7,3 ecall e68: 00000073 ecall ret e6c: 8082 ret 0000000000000e6e <pipe>: .global pipe pipe: li a7, SYS_pipe e6e: 4891 li a7,4 ecall e70: 00000073 ecall ret e74: 8082 ret 0000000000000e76 <read>: .global read read: li a7, SYS_read e76: 4895 li a7,5 ecall e78: 00000073 ecall ret e7c: 8082 ret 0000000000000e7e <write>: .global write write: li a7, SYS_write e7e: 48c1 li a7,16 ecall e80: 00000073 ecall ret e84: 8082 ret 0000000000000e86 <close>: .global close close: li a7, SYS_close e86: 48d5 li a7,21 ecall e88: 00000073 ecall ret e8c: 8082 ret 0000000000000e8e <kill>: .global kill kill: li a7, SYS_kill e8e: 4899 li a7,6 ecall e90: 00000073 ecall ret e94: 8082 ret 0000000000000e96 <exec>: .global exec exec: li a7, SYS_exec e96: 489d li a7,7 ecall e98: 00000073 ecall ret e9c: 8082 ret 0000000000000e9e <open>: .global open open: li a7, SYS_open e9e: 48bd li a7,15 ecall ea0: 00000073 ecall ret ea4: 8082 ret 0000000000000ea6 <mknod>: .global mknod mknod: li a7, SYS_mknod ea6: 48c5 li a7,17 ecall ea8: 00000073 ecall ret eac: 8082 ret 0000000000000eae <unlink>: .global unlink unlink: li a7, SYS_unlink eae: 48c9 li a7,18 ecall eb0: 00000073 ecall ret eb4: 8082 ret 0000000000000eb6 <fstat>: .global fstat fstat: li a7, SYS_fstat eb6: 48a1 li a7,8 ecall eb8: 00000073 ecall ret ebc: 8082 ret 0000000000000ebe <link>: .global link link: li a7, SYS_link ebe: 48cd li a7,19 ecall ec0: 00000073 ecall ret ec4: 8082 ret 0000000000000ec6 <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir ec6: 48d1 li a7,20 ecall ec8: 00000073 ecall ret ecc: 8082 ret 0000000000000ece <chdir>: .global chdir chdir: li a7, SYS_chdir ece: 48a5 li a7,9 ecall ed0: 00000073 ecall ret ed4: 8082 ret 0000000000000ed6 <dup>: .global dup dup: li a7, SYS_dup ed6: 48a9 li a7,10 ecall ed8: 00000073 ecall ret edc: 8082 ret 0000000000000ede <getpid>: .global getpid getpid: li a7, SYS_getpid ede: 48ad li a7,11 ecall ee0: 00000073 ecall ret ee4: 8082 ret 0000000000000ee6 <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk ee6: 48b1 li a7,12 ecall ee8: 00000073 ecall ret eec: 8082 ret 0000000000000eee <sleep>: .global sleep sleep: li a7, SYS_sleep eee: 48b5 li a7,13 ecall ef0: 00000073 ecall ret ef4: 8082 ret 0000000000000ef6 <uptime>: .global uptime uptime: li a7, SYS_uptime ef6: 48b9 li a7,14 ecall ef8: 00000073 ecall ret efc: 8082 ret 0000000000000efe <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { efe: 1101 addi sp,sp,-32 f00: ec06 sd ra,24(sp) f02: e822 sd s0,16(sp) f04: 1000 addi s0,sp,32 f06: feb407a3 sb a1,-17(s0) write(fd, &c, 1); f0a: 4605 li a2,1 f0c: fef40593 addi a1,s0,-17 f10: 00000097 auipc ra,0x0 f14: f6e080e7 jalr -146(ra) # e7e <write> } f18: 60e2 ld ra,24(sp) f1a: 6442 ld s0,16(sp) f1c: 6105 addi sp,sp,32 f1e: 8082 ret 0000000000000f20 <printint>: static void printint(int fd, int xx, int base, int sgn) { f20: 7139 addi sp,sp,-64 f22: fc06 sd ra,56(sp) f24: f822 sd s0,48(sp) f26: f426 sd s1,40(sp) f28: f04a sd s2,32(sp) f2a: ec4e sd s3,24(sp) f2c: 0080 addi s0,sp,64 f2e: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ f30: c299 beqz a3,f36 <printint+0x16> f32: 0805c863 bltz a1,fc2 <printint+0xa2> neg = 1; x = -xx; } else { x = xx; f36: 2581 sext.w a1,a1 neg = 0; f38: 4881 li a7,0 f3a: fc040693 addi a3,s0,-64 } i = 0; f3e: 4701 li a4,0 do{ buf[i++] = digits[x % base]; f40: 2601 sext.w a2,a2 f42: 00000517 auipc a0,0x0 f46: 70650513 addi a0,a0,1798 # 1648 <digits> f4a: 883a mv a6,a4 f4c: 2705 addiw a4,a4,1 f4e: 02c5f7bb remuw a5,a1,a2 f52: 1782 slli a5,a5,0x20 f54: 9381 srli a5,a5,0x20 f56: 97aa add a5,a5,a0 f58: 0007c783 lbu a5,0(a5) f5c: 00f68023 sb a5,0(a3) }while((x /= base) != 0); f60: 0005879b sext.w a5,a1 f64: 02c5d5bb divuw a1,a1,a2 f68: 0685 addi a3,a3,1 f6a: fec7f0e3 bgeu a5,a2,f4a <printint+0x2a> if(neg) f6e: 00088b63 beqz a7,f84 <printint+0x64> buf[i++] = '-'; f72: fd040793 addi a5,s0,-48 f76: 973e add a4,a4,a5 f78: 02d00793 li a5,45 f7c: fef70823 sb a5,-16(a4) f80: 0028071b addiw a4,a6,2 while(--i >= 0) f84: 02e05863 blez a4,fb4 <printint+0x94> f88: fc040793 addi a5,s0,-64 f8c: 00e78933 add s2,a5,a4 f90: fff78993 addi s3,a5,-1 f94: 99ba add s3,s3,a4 f96: 377d addiw a4,a4,-1 f98: 1702 slli a4,a4,0x20 f9a: 9301 srli a4,a4,0x20 f9c: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); fa0: fff94583 lbu a1,-1(s2) fa4: 8526 mv a0,s1 fa6: 00000097 auipc ra,0x0 faa: f58080e7 jalr -168(ra) # efe <putc> while(--i >= 0) fae: 197d addi s2,s2,-1 fb0: ff3918e3 bne s2,s3,fa0 <printint+0x80> } fb4: 70e2 ld ra,56(sp) fb6: 7442 ld s0,48(sp) fb8: 74a2 ld s1,40(sp) fba: 7902 ld s2,32(sp) fbc: 69e2 ld s3,24(sp) fbe: 6121 addi sp,sp,64 fc0: 8082 ret x = -xx; fc2: 40b005bb negw a1,a1 neg = 1; fc6: 4885 li a7,1 x = -xx; fc8: bf8d j f3a <printint+0x1a> 0000000000000fca <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { fca: 7119 addi sp,sp,-128 fcc: fc86 sd ra,120(sp) fce: f8a2 sd s0,112(sp) fd0: f4a6 sd s1,104(sp) fd2: f0ca sd s2,96(sp) fd4: ecce sd s3,88(sp) fd6: e8d2 sd s4,80(sp) fd8: e4d6 sd s5,72(sp) fda: e0da sd s6,64(sp) fdc: fc5e sd s7,56(sp) fde: f862 sd s8,48(sp) fe0: f466 sd s9,40(sp) fe2: f06a sd s10,32(sp) fe4: ec6e sd s11,24(sp) fe6: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ fe8: 0005c903 lbu s2,0(a1) fec: 18090f63 beqz s2,118a <vprintf+0x1c0> ff0: 8aaa mv s5,a0 ff2: 8b32 mv s6,a2 ff4: 00158493 addi s1,a1,1 state = 0; ff8: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ ffa: 02500a13 li s4,37 if(c == 'd'){ ffe: 06400c13 li s8,100 printint(fd, va_arg(ap, int), 10, 1); } else if(c == 'l') { 1002: 06c00c93 li s9,108 printint(fd, va_arg(ap, uint64), 10, 0); } else if(c == 'x') { 1006: 07800d13 li s10,120 printint(fd, va_arg(ap, int), 16, 0); } else if(c == 'p') { 100a: 07000d93 li s11,112 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 100e: 00000b97 auipc s7,0x0 1012: 63ab8b93 addi s7,s7,1594 # 1648 <digits> 1016: a839 j 1034 <vprintf+0x6a> putc(fd, c); 1018: 85ca mv a1,s2 101a: 8556 mv a0,s5 101c: 00000097 auipc ra,0x0 1020: ee2080e7 jalr -286(ra) # efe <putc> 1024: a019 j 102a <vprintf+0x60> } else if(state == '%'){ 1026: 01498f63 beq s3,s4,1044 <vprintf+0x7a> for(i = 0; fmt[i]; i++){ 102a: 0485 addi s1,s1,1 102c: fff4c903 lbu s2,-1(s1) 1030: 14090d63 beqz s2,118a <vprintf+0x1c0> c = fmt[i] & 0xff; 1034: 0009079b sext.w a5,s2 if(state == 0){ 1038: fe0997e3 bnez s3,1026 <vprintf+0x5c> if(c == '%'){ 103c: fd479ee3 bne a5,s4,1018 <vprintf+0x4e> state = '%'; 1040: 89be mv s3,a5 1042: b7e5 j 102a <vprintf+0x60> if(c == 'd'){ 1044: 05878063 beq a5,s8,1084 <vprintf+0xba> } else if(c == 'l') { 1048: 05978c63 beq a5,s9,10a0 <vprintf+0xd6> } else if(c == 'x') { 104c: 07a78863 beq a5,s10,10bc <vprintf+0xf2> } else if(c == 'p') { 1050: 09b78463 beq a5,s11,10d8 <vprintf+0x10e> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ 1054: 07300713 li a4,115 1058: 0ce78663 beq a5,a4,1124 <vprintf+0x15a> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 105c: 06300713 li a4,99 1060: 0ee78e63 beq a5,a4,115c <vprintf+0x192> putc(fd, va_arg(ap, uint)); } else if(c == '%'){ 1064: 11478863 beq a5,s4,1174 <vprintf+0x1aa> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 1068: 85d2 mv a1,s4 106a: 8556 mv a0,s5 106c: 00000097 auipc ra,0x0 1070: e92080e7 jalr -366(ra) # efe <putc> putc(fd, c); 1074: 85ca mv a1,s2 1076: 8556 mv a0,s5 1078: 00000097 auipc ra,0x0 107c: e86080e7 jalr -378(ra) # efe <putc> } state = 0; 1080: 4981 li s3,0 1082: b765 j 102a <vprintf+0x60> printint(fd, va_arg(ap, int), 10, 1); 1084: 008b0913 addi s2,s6,8 1088: 4685 li a3,1 108a: 4629 li a2,10 108c: 000b2583 lw a1,0(s6) 1090: 8556 mv a0,s5 1092: 00000097 auipc ra,0x0 1096: e8e080e7 jalr -370(ra) # f20 <printint> 109a: 8b4a mv s6,s2 state = 0; 109c: 4981 li s3,0 109e: b771 j 102a <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 10a0: 008b0913 addi s2,s6,8 10a4: 4681 li a3,0 10a6: 4629 li a2,10 10a8: 000b2583 lw a1,0(s6) 10ac: 8556 mv a0,s5 10ae: 00000097 auipc ra,0x0 10b2: e72080e7 jalr -398(ra) # f20 <printint> 10b6: 8b4a mv s6,s2 state = 0; 10b8: 4981 li s3,0 10ba: bf85 j 102a <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 10bc: 008b0913 addi s2,s6,8 10c0: 4681 li a3,0 10c2: 4641 li a2,16 10c4: 000b2583 lw a1,0(s6) 10c8: 8556 mv a0,s5 10ca: 00000097 auipc ra,0x0 10ce: e56080e7 jalr -426(ra) # f20 <printint> 10d2: 8b4a mv s6,s2 state = 0; 10d4: 4981 li s3,0 10d6: bf91 j 102a <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 10d8: 008b0793 addi a5,s6,8 10dc: f8f43423 sd a5,-120(s0) 10e0: 000b3983 ld s3,0(s6) putc(fd, '0'); 10e4: 03000593 li a1,48 10e8: 8556 mv a0,s5 10ea: 00000097 auipc ra,0x0 10ee: e14080e7 jalr -492(ra) # efe <putc> putc(fd, 'x'); 10f2: 85ea mv a1,s10 10f4: 8556 mv a0,s5 10f6: 00000097 auipc ra,0x0 10fa: e08080e7 jalr -504(ra) # efe <putc> 10fe: 4941 li s2,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 1100: 03c9d793 srli a5,s3,0x3c 1104: 97de add a5,a5,s7 1106: 0007c583 lbu a1,0(a5) 110a: 8556 mv a0,s5 110c: 00000097 auipc ra,0x0 1110: df2080e7 jalr -526(ra) # efe <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 1114: 0992 slli s3,s3,0x4 1116: 397d addiw s2,s2,-1 1118: fe0914e3 bnez s2,1100 <vprintf+0x136> printptr(fd, va_arg(ap, uint64)); 111c: f8843b03 ld s6,-120(s0) state = 0; 1120: 4981 li s3,0 1122: b721 j 102a <vprintf+0x60> s = va_arg(ap, char*); 1124: 008b0993 addi s3,s6,8 1128: 000b3903 ld s2,0(s6) if(s == 0) 112c: 02090163 beqz s2,114e <vprintf+0x184> while(*s != 0){ 1130: 00094583 lbu a1,0(s2) 1134: c9a1 beqz a1,1184 <vprintf+0x1ba> putc(fd, *s); 1136: 8556 mv a0,s5 1138: 00000097 auipc ra,0x0 113c: dc6080e7 jalr -570(ra) # efe <putc> s++; 1140: 0905 addi s2,s2,1 while(*s != 0){ 1142: 00094583 lbu a1,0(s2) 1146: f9e5 bnez a1,1136 <vprintf+0x16c> s = va_arg(ap, char*); 1148: 8b4e mv s6,s3 state = 0; 114a: 4981 li s3,0 114c: bdf9 j 102a <vprintf+0x60> s = "(null)"; 114e: 00000917 auipc s2,0x0 1152: 4f290913 addi s2,s2,1266 # 1640 <malloc+0x3ac> while(*s != 0){ 1156: 02800593 li a1,40 115a: bff1 j 1136 <vprintf+0x16c> putc(fd, va_arg(ap, uint)); 115c: 008b0913 addi s2,s6,8 1160: 000b4583 lbu a1,0(s6) 1164: 8556 mv a0,s5 1166: 00000097 auipc ra,0x0 116a: d98080e7 jalr -616(ra) # efe <putc> 116e: 8b4a mv s6,s2 state = 0; 1170: 4981 li s3,0 1172: bd65 j 102a <vprintf+0x60> putc(fd, c); 1174: 85d2 mv a1,s4 1176: 8556 mv a0,s5 1178: 00000097 auipc ra,0x0 117c: d86080e7 jalr -634(ra) # efe <putc> state = 0; 1180: 4981 li s3,0 1182: b565 j 102a <vprintf+0x60> s = va_arg(ap, char*); 1184: 8b4e mv s6,s3 state = 0; 1186: 4981 li s3,0 1188: b54d j 102a <vprintf+0x60> } } } 118a: 70e6 ld ra,120(sp) 118c: 7446 ld s0,112(sp) 118e: 74a6 ld s1,104(sp) 1190: 7906 ld s2,96(sp) 1192: 69e6 ld s3,88(sp) 1194: 6a46 ld s4,80(sp) 1196: 6aa6 ld s5,72(sp) 1198: 6b06 ld s6,64(sp) 119a: 7be2 ld s7,56(sp) 119c: 7c42 ld s8,48(sp) 119e: 7ca2 ld s9,40(sp) 11a0: 7d02 ld s10,32(sp) 11a2: 6de2 ld s11,24(sp) 11a4: 6109 addi sp,sp,128 11a6: 8082 ret 00000000000011a8 <fprintf>: void fprintf(int fd, const char *fmt, ...) { 11a8: 715d addi sp,sp,-80 11aa: ec06 sd ra,24(sp) 11ac: e822 sd s0,16(sp) 11ae: 1000 addi s0,sp,32 11b0: e010 sd a2,0(s0) 11b2: e414 sd a3,8(s0) 11b4: e818 sd a4,16(s0) 11b6: ec1c sd a5,24(s0) 11b8: 03043023 sd a6,32(s0) 11bc: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 11c0: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 11c4: 8622 mv a2,s0 11c6: 00000097 auipc ra,0x0 11ca: e04080e7 jalr -508(ra) # fca <vprintf> } 11ce: 60e2 ld ra,24(sp) 11d0: 6442 ld s0,16(sp) 11d2: 6161 addi sp,sp,80 11d4: 8082 ret 00000000000011d6 <printf>: void printf(const char *fmt, ...) { 11d6: 711d addi sp,sp,-96 11d8: ec06 sd ra,24(sp) 11da: e822 sd s0,16(sp) 11dc: 1000 addi s0,sp,32 11de: e40c sd a1,8(s0) 11e0: e810 sd a2,16(s0) 11e2: ec14 sd a3,24(s0) 11e4: f018 sd a4,32(s0) 11e6: f41c sd a5,40(s0) 11e8: 03043823 sd a6,48(s0) 11ec: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 11f0: 00840613 addi a2,s0,8 11f4: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 11f8: 85aa mv a1,a0 11fa: 4505 li a0,1 11fc: 00000097 auipc ra,0x0 1200: dce080e7 jalr -562(ra) # fca <vprintf> } 1204: 60e2 ld ra,24(sp) 1206: 6442 ld s0,16(sp) 1208: 6125 addi sp,sp,96 120a: 8082 ret 000000000000120c <free>: static Header base; static Header *freep; void free(void *ap) { 120c: 1141 addi sp,sp,-16 120e: e422 sd s0,8(sp) 1210: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 1212: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1216: 00000797 auipc a5,0x0 121a: 4527b783 ld a5,1106(a5) # 1668 <freep> 121e: a805 j 124e <free+0x42> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 1220: 4618 lw a4,8(a2) 1222: 9db9 addw a1,a1,a4 1224: feb52c23 sw a1,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 1228: 6398 ld a4,0(a5) 122a: 6318 ld a4,0(a4) 122c: fee53823 sd a4,-16(a0) 1230: a091 j 1274 <free+0x68> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 1232: ff852703 lw a4,-8(a0) 1236: 9e39 addw a2,a2,a4 1238: c790 sw a2,8(a5) p->s.ptr = bp->s.ptr; 123a: ff053703 ld a4,-16(a0) 123e: e398 sd a4,0(a5) 1240: a099 j 1286 <free+0x7a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1242: 6398 ld a4,0(a5) 1244: 00e7e463 bltu a5,a4,124c <free+0x40> 1248: 00e6ea63 bltu a3,a4,125c <free+0x50> { 124c: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 124e: fed7fae3 bgeu a5,a3,1242 <free+0x36> 1252: 6398 ld a4,0(a5) 1254: 00e6e463 bltu a3,a4,125c <free+0x50> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1258: fee7eae3 bltu a5,a4,124c <free+0x40> if(bp + bp->s.size == p->s.ptr){ 125c: ff852583 lw a1,-8(a0) 1260: 6390 ld a2,0(a5) 1262: 02059713 slli a4,a1,0x20 1266: 9301 srli a4,a4,0x20 1268: 0712 slli a4,a4,0x4 126a: 9736 add a4,a4,a3 126c: fae60ae3 beq a2,a4,1220 <free+0x14> bp->s.ptr = p->s.ptr; 1270: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 1274: 4790 lw a2,8(a5) 1276: 02061713 slli a4,a2,0x20 127a: 9301 srli a4,a4,0x20 127c: 0712 slli a4,a4,0x4 127e: 973e add a4,a4,a5 1280: fae689e3 beq a3,a4,1232 <free+0x26> } else p->s.ptr = bp; 1284: e394 sd a3,0(a5) freep = p; 1286: 00000717 auipc a4,0x0 128a: 3ef73123 sd a5,994(a4) # 1668 <freep> } 128e: 6422 ld s0,8(sp) 1290: 0141 addi sp,sp,16 1292: 8082 ret 0000000000001294 <malloc>: return freep; } void* malloc(uint nbytes) { 1294: 7139 addi sp,sp,-64 1296: fc06 sd ra,56(sp) 1298: f822 sd s0,48(sp) 129a: f426 sd s1,40(sp) 129c: f04a sd s2,32(sp) 129e: ec4e sd s3,24(sp) 12a0: e852 sd s4,16(sp) 12a2: e456 sd s5,8(sp) 12a4: e05a sd s6,0(sp) 12a6: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 12a8: 02051493 slli s1,a0,0x20 12ac: 9081 srli s1,s1,0x20 12ae: 04bd addi s1,s1,15 12b0: 8091 srli s1,s1,0x4 12b2: 0014899b addiw s3,s1,1 12b6: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 12b8: 00000517 auipc a0,0x0 12bc: 3b053503 ld a0,944(a0) # 1668 <freep> 12c0: c515 beqz a0,12ec <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 12c2: 611c ld a5,0(a0) if(p->s.size >= nunits){ 12c4: 4798 lw a4,8(a5) 12c6: 02977f63 bgeu a4,s1,1304 <malloc+0x70> 12ca: 8a4e mv s4,s3 12cc: 0009871b sext.w a4,s3 12d0: 6685 lui a3,0x1 12d2: 00d77363 bgeu a4,a3,12d8 <malloc+0x44> 12d6: 6a05 lui s4,0x1 12d8: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 12dc: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 12e0: 00000917 auipc s2,0x0 12e4: 38890913 addi s2,s2,904 # 1668 <freep> if(p == (char*)-1) 12e8: 5afd li s5,-1 12ea: a88d j 135c <malloc+0xc8> base.s.ptr = freep = prevp = &base; 12ec: 00000797 auipc a5,0x0 12f0: 76c78793 addi a5,a5,1900 # 1a58 <base> 12f4: 00000717 auipc a4,0x0 12f8: 36f73a23 sd a5,884(a4) # 1668 <freep> 12fc: e39c sd a5,0(a5) base.s.size = 0; 12fe: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 1302: b7e1 j 12ca <malloc+0x36> if(p->s.size == nunits) 1304: 02e48b63 beq s1,a4,133a <malloc+0xa6> p->s.size -= nunits; 1308: 4137073b subw a4,a4,s3 130c: c798 sw a4,8(a5) p += p->s.size; 130e: 1702 slli a4,a4,0x20 1310: 9301 srli a4,a4,0x20 1312: 0712 slli a4,a4,0x4 1314: 97ba add a5,a5,a4 p->s.size = nunits; 1316: 0137a423 sw s3,8(a5) freep = prevp; 131a: 00000717 auipc a4,0x0 131e: 34a73723 sd a0,846(a4) # 1668 <freep> return (void*)(p + 1); 1322: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 1326: 70e2 ld ra,56(sp) 1328: 7442 ld s0,48(sp) 132a: 74a2 ld s1,40(sp) 132c: 7902 ld s2,32(sp) 132e: 69e2 ld s3,24(sp) 1330: 6a42 ld s4,16(sp) 1332: 6aa2 ld s5,8(sp) 1334: 6b02 ld s6,0(sp) 1336: 6121 addi sp,sp,64 1338: 8082 ret prevp->s.ptr = p->s.ptr; 133a: 6398 ld a4,0(a5) 133c: e118 sd a4,0(a0) 133e: bff1 j 131a <malloc+0x86> hp->s.size = nu; 1340: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 1344: 0541 addi a0,a0,16 1346: 00000097 auipc ra,0x0 134a: ec6080e7 jalr -314(ra) # 120c <free> return freep; 134e: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 1352: d971 beqz a0,1326 <malloc+0x92> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1354: 611c ld a5,0(a0) if(p->s.size >= nunits){ 1356: 4798 lw a4,8(a5) 1358: fa9776e3 bgeu a4,s1,1304 <malloc+0x70> if(p == freep) 135c: 00093703 ld a4,0(s2) 1360: 853e mv a0,a5 1362: fef719e3 bne a4,a5,1354 <malloc+0xc0> p = sbrk(nu * sizeof(Header)); 1366: 8552 mv a0,s4 1368: 00000097 auipc ra,0x0 136c: b7e080e7 jalr -1154(ra) # ee6 <sbrk> if(p == (char*)-1) 1370: fd5518e3 bne a0,s5,1340 <malloc+0xac> return 0; 1374: 4501 li a0,0 1376: bf45 j 1326 <malloc+0x92>
LJMP STATE_255 STATE_0: MOV 0xF0,#0xFF CJNE A,#0,STATE_1 LJMP FINAL STATE_1: MOV 0xF0,#0x01 CJNE A,#0x01,STATE_0 STATE_2: MOV 0xF0,#0x02 CJNE A,#0x02,STATE_1 STATE_3: MOV 0xF0,#0x03 CJNE A,#0x03,STATE_2 STATE_4: MOV 0xF0,#0x04 CJNE A,#0x04,STATE_3 STATE_5: MOV 0xF0,#0x05 CJNE A,#0x05,STATE_4 STATE_6: MOV 0xF0,#0x06 CJNE A,#0x06,STATE_5 STATE_7: MOV 0xF0,#0x07 CJNE A,#0x07,STATE_6 STATE_8: MOV 0xF0,#0x08 CJNE A,#0x08,STATE_7 STATE_9: MOV 0xF0,#0x09 CJNE A,#0x09,STATE_8 STATE_10: MOV 0xF0,#0x0A CJNE A,#0x0A,STATE_9 STATE_11: MOV 0xF0,#0x0B CJNE A,#0x0B,STATE_10 STATE_12: MOV 0xF0,#0x0C CJNE A,#0x0C,STATE_11 STATE_13: MOV 0xF0,#0x0D CJNE A,#0x0D,STATE_12 STATE_14: MOV 0xF0,#0x0E CJNE A,#0x0E,STATE_13 STATE_15: MOV 0xF0,#0x0F CJNE A,#0x0F,STATE_14 STATE_16: MOV 0xF0,#0x10 CJNE A,#0x10,STATE_15 STATE_17: MOV 0xF0,#0x11 CJNE A,#0x11,STATE_16 STATE_18: MOV 0xF0,#0x12 CJNE A,#0x12,STATE_17 STATE_19: MOV 0xF0,#0x13 CJNE A,#0x13,STATE_18 STATE_20: MOV 0xF0,#0x14 CJNE A,#0x14,STATE_19 STATE_21: MOV 0xF0,#0x15 CJNE A,#0x15,STATE_20 STATE_22: MOV 0xF0,#0x16 CJNE A,#0x16,STATE_21 STATE_23: MOV 0xF0,#0x17 CJNE A,#0x17,STATE_22 STATE_24: MOV 0xF0,#0x18 CJNE A,#0x18,STATE_23 STATE_25: MOV 0xF0,#0x19 CJNE A,#0x19,STATE_24 STATE_26: MOV 0xF0,#0x1A CJNE A,#0x1A,STATE_25 STATE_27: MOV 0xF0,#0x1B CJNE A,#0x1B,STATE_26 STATE_28: MOV 0xF0,#0x1C CJNE A,#0x1C,STATE_27 STATE_29: MOV 0xF0,#0x1D CJNE A,#0x1D,STATE_28 STATE_30: MOV 0xF0,#0x1E CJNE A,#0x1E,STATE_29 STATE_31: MOV 0xF0,#0x1F CJNE A,#0x1F,STATE_30 STATE_32: MOV 0xF0,#0x20 CJNE A,#0x20,STATE_31 STATE_33: MOV 0xF0,#0x21 CJNE A,#0x21,STATE_32 STATE_34: MOV 0xF0,#0x22 CJNE A,#0x22,STATE_33 STATE_35: MOV 0xF0,#0x23 CJNE A,#0x23,STATE_34 STATE_36: MOV 0xF0,#0x24 CJNE A,#0x24,STATE_35 STATE_37: MOV 0xF0,#0x25 CJNE A,#0x25,STATE_36 STATE_38: MOV 0xF0,#0x26 CJNE A,#0x26,STATE_37 STATE_39: MOV 0xF0,#0x27 CJNE A,#0x27,STATE_38 STATE_40: MOV 0xF0,#0x28 CJNE A,#0x28,STATE_39 STATE_41: MOV 0xF0,#0x29 CJNE A,#0x29,STATE_40 STATE_42: MOV 0xF0,#0x2A CJNE A,#0x2A,STATE_41 STATE_43: MOV 0xF0,#0x2B CJNE A,#0x2B,STATE_42 STATE_44: MOV 0xF0,#0x2C CJNE A,#0x2C,STATE_43 STATE_45: MOV 0xF0,#0x2D CJNE A,#0x2D,STATE_44 STATE_46: MOV 0xF0,#0x2E CJNE A,#0x2E,STATE_45 STATE_47: MOV 0xF0,#0x2F CJNE A,#0x2F,STATE_46 STATE_48: MOV 0xF0,#0x30 CJNE A,#0x30,STATE_47 STATE_49: MOV 0xF0,#0x31 CJNE A,#0x31,STATE_48 STATE_50: MOV 0xF0,#0x32 CJNE A,#0x32,STATE_49 STATE_51: MOV 0xF0,#0x33 CJNE A,#0x33,STATE_50 STATE_52: MOV 0xF0,#0x34 CJNE A,#0x34,STATE_51 STATE_53: MOV 0xF0,#0x35 CJNE A,#0x35,STATE_52 STATE_54: MOV 0xF0,#0x36 CJNE A,#0x36,STATE_53 STATE_55: MOV 0xF0,#0x37 CJNE A,#0x37,STATE_54 STATE_56: MOV 0xF0,#0x38 CJNE A,#0x38,STATE_55 STATE_57: MOV 0xF0,#0x39 CJNE A,#0x39,STATE_56 STATE_58: MOV 0xF0,#0x3A CJNE A,#0x3A,STATE_57 STATE_59: MOV 0xF0,#0x3B CJNE A,#0x3B,STATE_58 STATE_60: MOV 0xF0,#0x3C CJNE A,#0x3C,STATE_59 STATE_61: MOV 0xF0,#0x3D CJNE A,#0x3D,STATE_60 STATE_62: MOV 0xF0,#0x3E CJNE A,#0x3E,STATE_61 STATE_63: MOV 0xF0,#0x3F CJNE A,#0x3F,STATE_62 STATE_64: MOV 0xF0,#0x40 CJNE A,#0x40,STATE_63 STATE_65: MOV 0xF0,#0x41 CJNE A,#0x41,STATE_64 STATE_66: MOV 0xF0,#0x42 CJNE A,#0x42,STATE_65 STATE_67: MOV 0xF0,#0x43 CJNE A,#0x43,STATE_66 STATE_68: MOV 0xF0,#0x44 CJNE A,#0x44,STATE_67 STATE_69: MOV 0xF0,#0x45 CJNE A,#0x45,STATE_68 STATE_70: MOV 0xF0,#0x46 CJNE A,#0x46,STATE_69 STATE_71: MOV 0xF0,#0x47 CJNE A,#0x47,STATE_70 STATE_72: MOV 0xF0,#0x48 CJNE A,#0x48,STATE_71 STATE_73: MOV 0xF0,#0x49 CJNE A,#0x49,STATE_72 STATE_74: MOV 0xF0,#0x4A CJNE A,#0x4A,STATE_73 STATE_75: MOV 0xF0,#0x4B CJNE A,#0x4B,STATE_74 STATE_76: MOV 0xF0,#0x4C CJNE A,#0x4C,STATE_75 STATE_77: MOV 0xF0,#0x4D CJNE A,#0x4D,STATE_76 STATE_78: MOV 0xF0,#0x4E CJNE A,#0x4E,STATE_77 STATE_79: MOV 0xF0,#0x4F CJNE A,#0x4F,STATE_78 STATE_80: MOV 0xF0,#0x50 CJNE A,#0x50,STATE_79 STATE_81: MOV 0xF0,#0x51 CJNE A,#0x51,STATE_80 STATE_82: MOV 0xF0,#0x52 CJNE A,#0x52,STATE_81 STATE_83: MOV 0xF0,#0x53 CJNE A,#0x53,STATE_82 STATE_84: MOV 0xF0,#0x54 CJNE A,#0x54,STATE_83 STATE_85: MOV 0xF0,#0x55 CJNE A,#0x55,STATE_84 STATE_86: MOV 0xF0,#0x56 CJNE A,#0x56,STATE_85 STATE_87: MOV 0xF0,#0x57 CJNE A,#0x57,STATE_86 STATE_88: MOV 0xF0,#0x58 CJNE A,#0x58,STATE_87 STATE_89: MOV 0xF0,#0x59 CJNE A,#0x59,STATE_88 STATE_90: MOV 0xF0,#0x5A CJNE A,#0x5A,STATE_89 STATE_91: MOV 0xF0,#0x5B CJNE A,#0x5B,STATE_90 STATE_92: MOV 0xF0,#0x5C CJNE A,#0x5C,STATE_91 STATE_93: MOV 0xF0,#0x5D CJNE A,#0x5D,STATE_92 STATE_94: MOV 0xF0,#0x5E CJNE A,#0x5E,STATE_93 STATE_95: MOV 0xF0,#0x5F CJNE A,#0x5F,STATE_94 STATE_96: MOV 0xF0,#0x60 CJNE A,#0x60,STATE_95 STATE_97: MOV 0xF0,#0x61 CJNE A,#0x61,STATE_96 STATE_98: MOV 0xF0,#0x62 CJNE A,#0x62,STATE_97 STATE_99: MOV 0xF0,#0x63 CJNE A,#0x63,STATE_98 STATE_100: MOV 0xF0,#0x64 CJNE A,#0x64,STATE_99 STATE_101: MOV 0xF0,#0x65 CJNE A,#0x65,STATE_100 STATE_102: MOV 0xF0,#0x66 CJNE A,#0x66,STATE_101 STATE_103: MOV 0xF0,#0x67 CJNE A,#0x67,STATE_102 STATE_104: MOV 0xF0,#0x68 CJNE A,#0x68,STATE_103 STATE_105: MOV 0xF0,#0x69 CJNE A,#0x69,STATE_104 STATE_106: MOV 0xF0,#0x6A CJNE A,#0x6A,STATE_105 STATE_107: MOV 0xF0,#0x6B CJNE A,#0x6B,STATE_106 STATE_108: MOV 0xF0,#0x6C CJNE A,#0x6C,STATE_107 STATE_109: MOV 0xF0,#0x6D CJNE A,#0x6D,STATE_108 STATE_110: MOV 0xF0,#0x6E CJNE A,#0x6E,STATE_109 STATE_111: MOV 0xF0,#0x6F CJNE A,#0x6F,STATE_110 STATE_112: MOV 0xF0,#0x70 CJNE A,#0x70,STATE_111 STATE_113: MOV 0xF0,#0x71 CJNE A,#0x71,STATE_112 STATE_114: MOV 0xF0,#0x72 CJNE A,#0x72,STATE_113 STATE_115: MOV 0xF0,#0x73 CJNE A,#0x73,STATE_114 STATE_116: MOV 0xF0,#0x74 CJNE A,#0x74,STATE_115 STATE_117: MOV 0xF0,#0x75 CJNE A,#0x75,STATE_116 STATE_118: MOV 0xF0,#0x76 CJNE A,#0x76,STATE_117 STATE_119: MOV 0xF0,#0x77 CJNE A,#0x77,STATE_118 STATE_120: MOV 0xF0,#0x78 CJNE A,#0x78,STATE_119 STATE_121: MOV 0xF0,#0x79 CJNE A,#0x79,STATE_120 STATE_122: MOV 0xF0,#0x7A CJNE A,#0x7A,STATE_121 STATE_123: MOV 0xF0,#0x7B CJNE A,#0x7B,STATE_122 STATE_124: MOV 0xF0,#0x7C CJNE A,#0x7C,STATE_123 STATE_125: MOV 0xF0,#0x7D CJNE A,#0x7D,STATE_124 STATE_126: MOV 0xF0,#0x7E CJNE A,#0x7E,STATE_125 STATE_127: MOV 0xF0,#0x7F CJNE A,#0x7F,STATE_126 STATE_128: MOV 0xF0,#0x80 CJNE A,#0x80,STATE_127 STATE_129: MOV 0xF0,#0x81 CJNE A,#0x81,STATE_128 STATE_130: MOV 0xF0,#0x82 CJNE A,#0x82,STATE_129 STATE_131: MOV 0xF0,#0x83 CJNE A,#0x83,STATE_130 STATE_132: MOV 0xF0,#0x84 CJNE A,#0x84,STATE_131 STATE_133: MOV 0xF0,#0x85 CJNE A,#0x85,STATE_132 STATE_134: MOV 0xF0,#0x86 CJNE A,#0x86,STATE_133 STATE_135: MOV 0xF0,#0x87 CJNE A,#0x87,STATE_134 STATE_136: MOV 0xF0,#0x88 CJNE A,#0x88,STATE_135 STATE_137: MOV 0xF0,#0x89 CJNE A,#0x89,STATE_136 STATE_138: MOV 0xF0,#0x8A CJNE A,#0x8A,STATE_137 STATE_139: MOV 0xF0,#0x8B CJNE A,#0x8B,STATE_138 STATE_140: MOV 0xF0,#0x8C CJNE A,#0x8C,STATE_139 STATE_141: MOV 0xF0,#0x8D CJNE A,#0x8D,STATE_140 STATE_142: MOV 0xF0,#0x8E CJNE A,#0x8E,STATE_141 STATE_143: MOV 0xF0,#0x8F CJNE A,#0x8F,STATE_142 STATE_144: MOV 0xF0,#0x90 CJNE A,#0x90,STATE_143 STATE_145: MOV 0xF0,#0x91 CJNE A,#0x91,STATE_144 STATE_146: MOV 0xF0,#0x92 CJNE A,#0x92,STATE_145 STATE_147: MOV 0xF0,#0x93 CJNE A,#0x93,STATE_146 STATE_148: MOV 0xF0,#0x94 CJNE A,#0x94,STATE_147 STATE_149: MOV 0xF0,#0x95 CJNE A,#0x95,STATE_148 STATE_150: MOV 0xF0,#0x96 CJNE A,#0x96,STATE_149 STATE_151: MOV 0xF0,#0x97 CJNE A,#0x97,STATE_150 STATE_152: MOV 0xF0,#0x98 CJNE A,#0x98,STATE_151 STATE_153: MOV 0xF0,#0x99 CJNE A,#0x99,STATE_152 STATE_154: MOV 0xF0,#0x9A CJNE A,#0x9A,STATE_153 STATE_155: MOV 0xF0,#0x9B CJNE A,#0x9B,STATE_154 STATE_156: MOV 0xF0,#0x9C CJNE A,#0x9C,STATE_155 STATE_157: MOV 0xF0,#0x9D CJNE A,#0x9D,STATE_156 STATE_158: MOV 0xF0,#0x9E CJNE A,#0x9E,STATE_157 STATE_159: MOV 0xF0,#0x9F CJNE A,#0x9F,STATE_158 STATE_160: MOV 0xF0,#0xA0 CJNE A,#0xA0,STATE_159 STATE_161: MOV 0xF0,#0xA1 CJNE A,#0xA1,STATE_160 STATE_162: MOV 0xF0,#0xA2 CJNE A,#0xA2,STATE_161 STATE_163: MOV 0xF0,#0xA3 CJNE A,#0xA3,STATE_162 STATE_164: MOV 0xF0,#0xA4 CJNE A,#0xA4,STATE_163 STATE_165: MOV 0xF0,#0xA5 CJNE A,#0xA5,STATE_164 STATE_166: MOV 0xF0,#0xA6 CJNE A,#0xA6,STATE_165 STATE_167: MOV 0xF0,#0xA7 CJNE A,#0xA7,STATE_166 STATE_168: MOV 0xF0,#0xA8 CJNE A,#0xA8,STATE_167 STATE_169: MOV 0xF0,#0xA9 CJNE A,#0xA9,STATE_168 STATE_170: MOV 0xF0,#0xAA CJNE A,#0xAA,STATE_169 STATE_171: MOV 0xF0,#0xAB CJNE A,#0xAB,STATE_170 STATE_172: MOV 0xF0,#0xAC CJNE A,#0xAC,STATE_171 STATE_173: MOV 0xF0,#0xAD CJNE A,#0xAD,STATE_172 STATE_174: MOV 0xF0,#0xAE CJNE A,#0xAE,STATE_173 STATE_175: MOV 0xF0,#0xAF CJNE A,#0xAF,STATE_174 STATE_176: MOV 0xF0,#0xB0 CJNE A,#0xB0,STATE_175 STATE_177: MOV 0xF0,#0xB1 CJNE A,#0xB1,STATE_176 STATE_178: MOV 0xF0,#0xB2 CJNE A,#0xB2,STATE_177 STATE_179: MOV 0xF0,#0xB3 CJNE A,#0xB3,STATE_178 STATE_180: MOV 0xF0,#0xB4 CJNE A,#0xB4,STATE_179 STATE_181: MOV 0xF0,#0xB5 CJNE A,#0xB5,STATE_180 STATE_182: MOV 0xF0,#0xB6 CJNE A,#0xB6,STATE_181 STATE_183: MOV 0xF0,#0xB7 CJNE A,#0xB7,STATE_182 STATE_184: MOV 0xF0,#0xB8 CJNE A,#0xB8,STATE_183 STATE_185: MOV 0xF0,#0xB9 CJNE A,#0xB9,STATE_184 STATE_186: MOV 0xF0,#0xBA CJNE A,#0xBA,STATE_185 STATE_187: MOV 0xF0,#0xBB CJNE A,#0xBB,STATE_186 STATE_188: MOV 0xF0,#0xBC CJNE A,#0xBC,STATE_187 STATE_189: MOV 0xF0,#0xBD CJNE A,#0xBD,STATE_188 STATE_190: MOV 0xF0,#0xBE CJNE A,#0xBE,STATE_189 STATE_191: MOV 0xF0,#0xBF CJNE A,#0xBF,STATE_190 STATE_192: MOV 0xF0,#0xC0 CJNE A,#0xC0,STATE_191 STATE_193: MOV 0xF0,#0xC1 CJNE A,#0xC1,STATE_192 STATE_194: MOV 0xF0,#0xC2 CJNE A,#0xC2,STATE_193 STATE_195: MOV 0xF0,#0xC3 CJNE A,#0xC3,STATE_194 STATE_196: MOV 0xF0,#0xC4 CJNE A,#0xC4,STATE_195 STATE_197: MOV 0xF0,#0xC5 CJNE A,#0xC5,STATE_196 STATE_198: MOV 0xF0,#0xC6 CJNE A,#0xC6,STATE_197 STATE_199: MOV 0xF0,#0xC7 CJNE A,#0xC7,STATE_198 STATE_200: MOV 0xF0,#0xC8 CJNE A,#0xC8,STATE_199 STATE_201: MOV 0xF0,#0xC9 CJNE A,#0xC9,STATE_200 STATE_202: MOV 0xF0,#0xCA CJNE A,#0xCA,STATE_201 STATE_203: MOV 0xF0,#0xCB CJNE A,#0xCB,STATE_202 STATE_204: MOV 0xF0,#0xCC CJNE A,#0xCC,STATE_203 STATE_205: MOV 0xF0,#0xCD CJNE A,#0xCD,STATE_204 STATE_206: MOV 0xF0,#0xCE CJNE A,#0xCE,STATE_205 STATE_207: MOV 0xF0,#0xCF CJNE A,#0xCF,STATE_206 STATE_208: MOV 0xF0,#0xD0 CJNE A,#0xD0,STATE_207 STATE_209: MOV 0xF0,#0xD1 CJNE A,#0xD1,STATE_208 STATE_210: MOV 0xF0,#0xD2 CJNE A,#0xD2,STATE_209 STATE_211: MOV 0xF0,#0xD3 CJNE A,#0xD3,STATE_210 STATE_212: MOV 0xF0,#0xD4 CJNE A,#0xD4,STATE_211 STATE_213: MOV 0xF0,#0xD5 CJNE A,#0xD5,STATE_212 STATE_214: MOV 0xF0,#0xD6 CJNE A,#0xD6,STATE_213 STATE_215: MOV 0xF0,#0xD7 CJNE A,#0xD7,STATE_214 STATE_216: MOV 0xF0,#0xD8 CJNE A,#0xD8,STATE_215 STATE_217: MOV 0xF0,#0xD9 CJNE A,#0xD9,STATE_216 STATE_218: MOV 0xF0,#0xDA CJNE A,#0xDA,STATE_217 STATE_219: MOV 0xF0,#0xDB CJNE A,#0xDB,STATE_218 STATE_220: MOV 0xF0,#0xDC CJNE A,#0xDC,STATE_219 STATE_221: MOV 0xF0,#0xDD CJNE A,#0xDD,STATE_220 STATE_222: MOV 0xF0,#0xDE CJNE A,#0xDE,STATE_221 STATE_223: MOV 0xF0,#0xDF CJNE A,#0xDF,STATE_222 STATE_224: MOV 0xF0,#0xE0 CJNE A,#0xE0,STATE_223 STATE_225: MOV 0xF0,#0xE1 CJNE A,#0xE1,STATE_224 STATE_226: MOV 0xF0,#0xE2 CJNE A,#0xE2,STATE_225 STATE_227: MOV 0xF0,#0xE3 CJNE A,#0xE3,STATE_226 STATE_228: MOV 0xF0,#0xE4 CJNE A,#0xE4,STATE_227 STATE_229: MOV 0xF0,#0xE5 CJNE A,#0xE5,STATE_228 STATE_230: MOV 0xF0,#0xE6 CJNE A,#0xE6,STATE_229 STATE_231: MOV 0xF0,#0xE7 CJNE A,#0xE7,STATE_230 STATE_232: MOV 0xF0,#0xE8 CJNE A,#0xE8,STATE_231 STATE_233: MOV 0xF0,#0xE9 CJNE A,#0xE9,STATE_232 STATE_234: MOV 0xF0,#0xEA CJNE A,#0xEA,STATE_233 STATE_235: MOV 0xF0,#0xEB CJNE A,#0xEB,STATE_234 STATE_236: MOV 0xF0,#0xEC CJNE A,#0xEC,STATE_235 STATE_237: MOV 0xF0,#0xED CJNE A,#0xED,STATE_236 STATE_238: MOV 0xF0,#0xEE CJNE A,#0xEE,STATE_237 STATE_239: MOV 0xF0,#0xEF CJNE A,#0xEF,STATE_238 STATE_240: MOV 0xF0,#0xF0 CJNE A,#0xF0,STATE_239 STATE_241: MOV 0xF0,#0xF1 CJNE A,#0xF1,STATE_240 STATE_242: MOV 0xF0,#0xF2 CJNE A,#0xF2,STATE_241 STATE_243: MOV 0xF0,#0xF3 CJNE A,#0xF3,STATE_242 STATE_244: MOV 0xF0,#0xF4 CJNE A,#0xF4,STATE_243 STATE_245: MOV 0xF0,#0xF5 CJNE A,#0xF5,STATE_244 STATE_246: MOV 0xF0,#0xF6 CJNE A,#0xF6,STATE_245 STATE_247: MOV 0xF0,#0xF7 CJNE A,#0xF7,STATE_246 STATE_248: MOV 0xF0,#0xF8 CJNE A,#0xF8,STATE_247 STATE_249: MOV 0xF0,#0xF9 CJNE A,#0xF9,STATE_248 STATE_250: MOV 0xF0,#0xFA CJNE A,#0xFA,STATE_249 STATE_251: MOV 0xF0,#0xFB CJNE A,#0xFB,STATE_250 STATE_252: MOV 0xF0,#0xFC CJNE A,#0xFC,STATE_251 STATE_253: MOV 0xF0,#0xFD CJNE A,#0xFD,STATE_252 STATE_254: MOV 0xF0,#0xFE CJNE A,#0xFE,STATE_253 STATE_255: MOV 0xF0,#0xFF CJNE A,#0xFF,STATE_254 FINAL: MOV A,#0xFF
Sound_B7_Header: smpsHeaderStartSong 3, 1 smpsHeaderVoice Sound_B7_Voices smpsHeaderTempoSFX $01 smpsHeaderChanSFX $02 smpsHeaderSFXChannel cFM4, Sound_B7_FM4, $00, $02 smpsHeaderSFXChannel cFM5, Sound_B7_FM5, $00, $02 ; FM4 Data Sound_B7_FM4: smpsAlterNote $03 dc.b nRst, $02 ; FM5 Data Sound_B7_FM5: smpsSetvoice $00 dc.b nG5, $16 smpsStop Sound_B7_Voices: ; Voice $00 ; $14 ; $25, $33, $36, $11, $1F, $1F, $1F, $1F, $15, $18, $1C, $13 ; $0B, $08, $0D, $09, $0F, $9F, $8F, $0F, $24, $05, $0A, $80 smpsVcAlgorithm $04 smpsVcFeedback $02 smpsVcUnusedBits $00 smpsVcDetune $01, $03, $03, $02 smpsVcCoarseFreq $01, $06, $03, $05 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $13, $1C, $18, $15 smpsVcDecayRate2 $09, $0D, $08, $0B smpsVcDecayLevel $00, $08, $09, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $80, $0A, $05, $24
; ; BIGREM.ASM ; ; Implementation for for signed and unsigned division of a 64 bit integer ; by a 32 bit integer, returning the remainder (ie., mod.) ; ; Copyright (c) 2017 Malcolm J. Smith ; ; 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. ; .386 .MODEL FLAT, C .CODE ; LARGE_INTEGER [High EDX, Low EAX] ; _aullrem( ; LARGE_INTEGER Dividend, [High ESP + 8, Low ESP + 4], ; LARGE_INTEGER Divisor [High ESP + 16, Low ESP + 12] ; ); public _aullrem _aullrem proc ; This implementation doesn't support 64 bit divisors. If one is specified, ; fail. mov eax, [esp + 16] test eax, eax jnz aullrem_overflow ; Divide the high 32 bits by the low 32 bits and leave the ; remainder in edx. Then, divide the low 32 bits plus the ; remainder, which must fit in a 32 bit value, putting the ; remainder into edx. To satisfy the calling convention, ; move this to eax and clear edx, and return. mov ecx, [esp + 12] xor edx, edx mov eax, [esp + 8] div ecx mov eax, [esp + 4] div ecx mov eax, edx xor edx, edx ret 16 aullrem_overflow: int 3 xor edx, edx xor eax, eax ret 16 _aullrem endp ; LARGE_INTEGER [High EDX, Low EAX] ; _allrem( ; LARGE_INTEGER Dividend, [High ESP + 8, Low ESP + 4], ; LARGE_INTEGER Divisor [High ESP + 16, Low ESP + 12] ; ); public _allrem _allrem proc push ebx xor ebx,ebx ; Check if the divisor is positive or negative. If negative, increment ; ebx to indicate another negative number was found, and convert it to ; positive allrem_test_divisor: mov edx, [esp + 20] mov eax, [esp + 16] bt edx, 31 jnc allrem_positive_divisor inc ebx neg edx neg eax sbb edx, 0 ; Push the now positive divisor onto the stack, thus moving esp allrem_positive_divisor: push edx push eax ; Check if the dividend is positive or negative. If negative, increment ; ebx to indicate another negative number was found, and convert it to ; positive mov edx, [esp + 20] mov eax, [esp + 16] bt edx, 31 jnc allrem_positive_dividend inc ebx neg edx neg eax sbb edx, 0 ; Push the now positive dividend onto the stack, thus moving esp allrem_positive_dividend: push edx push eax ; Call the positive version of this routine call _aullrem ; Test if an odd number of negative numbers were found. If so, convert the ; result back to negative, otherwise return the result as is. bt ebx, 0 jnc allrem_return_positive neg edx neg eax sbb edx, 0 allrem_return_positive: pop ebx ret 16 _allrem endp END
; trying to enable Z80N in i8080 mode is instant fatal error OPT reset --zxnext=cspect
SECTION smc_clib SECTION smc_sound_bit PUBLIC _bitfx_7 INCLUDE "clib_target_cfg.asm" EXTERN asm_bit_beep_raw _bitfx_7: ; sound for warp ld hl,1600 ld (warps + 1),hl ld hl,-800 ld (warps1 + 1),hl ld hl,-100 ld (warps2 + 1),hl ld b,20 warpcall1: push bc call warps pop bc djnz warpcall1 scf ret warps: ld hl,1600 ld de,6 call asm_bit_beep_raw warps1: ld hl,-800 warps2: ld de,-100 or a sbc hl,de ld (warps1 + 1),hl jr nz, warps3 ld de,100 ld (warps2 + 1),de warps3: ex de,hl ld hl,1600 add hl,de ld (warps + 1),hl scf ret
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin developers // Copyright (c) 2009-2015 The Dash developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2018-2019 The PrimeStone developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparamsbase.h" #include "clientversion.h" #include "rpcclient.h" #include "rpcprotocol.h" #include "util.h" #include "utilstrencodings.h" #include <boost/filesystem/operations.hpp> #include <stdio.h> #include <event2/event.h> #include <event2/http.h> #include <event2/buffer.h> #include <event2/keyvalq_struct.h> #include <univalue.h> #define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */ using namespace std; static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900; std::string HelpMessageCli() { string strUsage; strUsage += HelpMessageGroup(_("Options:")); strUsage += HelpMessageOpt("-?", _("This help message")); strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), "primestone.conf")); strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory")); strUsage += HelpMessageOpt("-testnet", _("Use the test network")); strUsage += HelpMessageOpt("-regtest", _("Enter regression test mode, which uses a special chain in which blocks can be " "solved instantly. This is intended for regression testing tools and app development.")); strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), "127.0.0.1")); strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), 34126, 41995)); strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start")); strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections")); strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections")); strUsage += HelpMessageOpt("-rpcclienttimeout=<n>", strprintf(_("Timeout during HTTP requests (default: %d)"), DEFAULT_HTTP_CLIENT_TIMEOUT)); return strUsage; } ////////////////////////////////////////////////////////////////////////////// // // Start // // // Exception thrown on connection error. This error is used to determine // when to wait if -rpcwait is given. // class CConnectionFailed : public std::runtime_error { public: explicit inline CConnectionFailed(const std::string& msg) : std::runtime_error(msg) { } }; static bool AppInitRPC(int argc, char* argv[]) { // // Parameters // ParseParameters(argc, argv); if (argc < 2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("PrimeStone RPC client version") + " " + FormatFullVersion() + "\n"; if (!mapArgs.count("-version")) { strUsage += "\n" + _("Usage:") + "\n" + " primestone-cli [options] <command> [params] " + _("Send command to PrimeStone") + "\n" + " primestone-cli [options] help " + _("List commands") + "\n" + " primestone-cli [options] help <command> " + _("Get help for a command") + "\n"; strUsage += "\n" + HelpMessageCli(); } fprintf(stdout, "%s", strUsage.c_str()); return false; } if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); return false; } try { ReadConfigFile(mapArgs, mapMultiArgs); } catch (std::exception& e) { fprintf(stderr, "Error reading configuration file: %s\n", e.what()); return false; } // Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause) if (!SelectBaseParamsFromCommandLine()) { fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); return false; } if (GetBoolArg("-rpcssl", false)) { fprintf(stderr, "Error: SSL mode for RPC (-rpcssl) is no longer supported.\n"); return false; } return true; } /** Reply structure for request_done to fill in */ struct HTTPReply { int status; std::string body; }; static void http_request_done(struct evhttp_request *req, void *ctx) { HTTPReply *reply = static_cast<HTTPReply*>(ctx); if (req == NULL) { /* If req is NULL, it means an error occurred while connecting, but * I'm not sure how to find out which one. We also don't really care. */ reply->status = 0; return; } reply->status = evhttp_request_get_response_code(req); struct evbuffer *buf = evhttp_request_get_input_buffer(req); if (buf) { size_t size = evbuffer_get_length(buf); const char *data = (const char*)evbuffer_pullup(buf, size); if (data) reply->body = std::string(data, size); evbuffer_drain(buf, size); } } UniValue CallRPC(const string& strMethod, const UniValue& params) { std::string host = GetArg("-rpcconnect", "127.0.0.1"); int port = GetArg("-rpcport", BaseParams().RPCPort()); // Create event base struct event_base *base = event_base_new(); // TODO RAII if (!base) throw runtime_error("cannot create event_base"); // Synchronously look up hostname struct evhttp_connection *evcon = evhttp_connection_base_new(base, NULL, host.c_str(), port); // TODO RAII if (evcon == NULL) throw runtime_error("create connection failed"); evhttp_connection_set_timeout(evcon, GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT)); HTTPReply response; struct evhttp_request *req = evhttp_request_new(http_request_done, (void*)&response); // TODO RAII if (req == NULL) throw runtime_error("create http request failed"); // Get credentials std::string strRPCUserColonPass; if (mapArgs["-rpcpassword"] == "") { // Try fall back to cookie-based authentication if no password is provided if (!GetAuthCookie(&strRPCUserColonPass)) { throw runtime_error(strprintf( _("Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (%s)"), GetConfigFile().string().c_str())); } } else { strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]; } struct evkeyvalq *output_headers = evhttp_request_get_output_headers(req); assert(output_headers); evhttp_add_header(output_headers, "Host", host.c_str()); evhttp_add_header(output_headers, "Connection", "close"); evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str()); // Attach request data std::string strRequest = JSONRPCRequest(strMethod, params, 1); struct evbuffer * output_buffer = evhttp_request_get_output_buffer(req); assert(output_buffer); evbuffer_add(output_buffer, strRequest.data(), strRequest.size()); int r = evhttp_make_request(evcon, req, EVHTTP_REQ_POST, "/"); if (r != 0) { evhttp_connection_free(evcon); event_base_free(base); throw CConnectionFailed("send http request failed"); } event_base_dispatch(base); evhttp_connection_free(evcon); event_base_free(base); if (response.status == 0) throw CConnectionFailed("couldn't connect to server"); else if (response.status == HTTP_UNAUTHORIZED) throw runtime_error("incorrect rpcuser or rpcpassword (authorization failed)"); else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR) throw runtime_error(strprintf("server returned HTTP error %d", response.status)); else if (response.body.empty()) throw runtime_error("no response from server"); // Parse reply UniValue valReply(UniValue::VSTR); if (!valReply.read(response.body)) throw runtime_error("couldn't parse reply from server"); const UniValue& reply = valReply.get_obj(); if (reply.empty()) throw runtime_error("expected reply to have result, error and id properties"); return reply; } int CommandLineRPC(int argc, char* argv[]) { string strPrint; int nRet = 0; try { // Skip switches while (argc > 1 && IsSwitchChar(argv[1][0])) { argc--; argv++; } // Method if (argc < 2) throw runtime_error("too few parameters"); string strMethod = argv[1]; // Parameters default to strings std::vector<std::string> strParams(&argv[2], &argv[argc]); UniValue params = RPCConvertValues(strMethod, strParams); // Execute and handle connection failures with -rpcwait const bool fWait = GetBoolArg("-rpcwait", false); do { try { const UniValue reply = CallRPC(strMethod, params); // Parse reply const UniValue& result = find_value(reply, "result"); const UniValue& error = find_value(reply, "error"); if (!error.isNull()) { // Error int code = error["code"].get_int(); if (fWait && code == RPC_IN_WARMUP) throw CConnectionFailed("server in warmup"); strPrint = "error: " + error.write(); nRet = abs(code); } else { // Result if (result.isNull()) strPrint = ""; else if (result.isStr()) strPrint = result.get_str(); else strPrint = result.write(2); } // Connection succeeded, no need to retry. break; } catch (const CConnectionFailed& e) { if (fWait) MilliSleep(1000); else throw; } } while (fWait); } catch (boost::thread_interrupted) { throw; } catch (std::exception& e) { strPrint = string("error: ") + e.what(); nRet = EXIT_FAILURE; } catch (...) { PrintExceptionContinue(NULL, "CommandLineRPC()"); throw; } if (strPrint != "") { fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str()); } return nRet; } int main(int argc, char* argv[]) { SetupEnvironment(); if (!SetupNetworking()) { fprintf(stderr, "Error: Initializing networking failed\n"); exit(1); } try { if (!AppInitRPC(argc, argv)) return EXIT_FAILURE; } catch (std::exception& e) { PrintExceptionContinue(&e, "AppInitRPC()"); return EXIT_FAILURE; } catch (...) { PrintExceptionContinue(NULL, "AppInitRPC()"); return EXIT_FAILURE; } int ret = EXIT_FAILURE; try { ret = CommandLineRPC(argc, argv); } catch (std::exception& e) { PrintExceptionContinue(&e, "CommandLineRPC()"); } catch (...) { PrintExceptionContinue(NULL, "CommandLineRPC()"); } return ret; }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; File : jo_f_status.asm /_________/ ;; ;; Author : Joe | ;; ;; Date : 04/2020 | ;; ;; Info : Gets batt status | ;; ;; / | ;; ;; \ / ;; ;; \_____/ ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; apm status ;; ---------- ;; 0: high ;; 1: low ;; 2: critical ;; 3: charging section .text extern system global jo_f_status jo_f_status: mov rdi, f_cmd call system mov rdi, st_file mov rsi, 0x0 mov rax, 0x5 syscall jc err mov rdi, rax mov rsi, buff mov rdx, 0x1 mov rax, 0x3 syscall jc err mov rax, 0x6 syscall movsx rax, byte [rsi + 0x0] sub rax, 0x30 retq err: mov rax, 0xfe retq section .data f_cmd: db "apm -b > /tmp/lowbat.status", 0x0 st_file: db "/tmp/lowbat.status", 0x0 buff: db 0x0, 0x0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2015 Intel Corporation All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in ; the documentation and/or other materials provided with the ; distribution. ; * Neither the name of Intel Corporation nor the names of its ; contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; gf_4vect_dot_prod_sse(len, vec, *g_tbls, **buffs, **dests); ;;; %ifidn __OUTPUT_FORMAT__, elf64 %define arg0 rdi %define arg1 rsi %define arg2 rdx %define arg3 rcx %define arg4 r8 %define arg5 r9 %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r12 ; must be saved and restored %define tmp5 r14 ; must be saved and restored %define tmp6 r15 ; must be saved and restored %define return rax %macro SLDR 2 %endmacro %define SSTR SLDR %define PS 8 %define LOG_PS 3 %define func(x) x: %macro FUNC_SAVE 0 push r12 push r13 push r14 push r15 %endmacro %macro FUNC_RESTORE 0 pop r15 pop r14 pop r13 pop r12 %endmacro %endif %ifidn __OUTPUT_FORMAT__, win64 %define arg0 rcx %define arg1 rdx %define arg2 r8 %define arg3 r9 %define arg4 r12 ; must be saved, loaded and restored %define arg5 r15 ; must be saved and restored %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r14 ; must be saved and restored %define tmp5 rdi ; must be saved and restored %define tmp6 rsi ; must be saved and restored %define return rax %macro SLDR 2 %endmacro %define SSTR SLDR %define PS 8 %define LOG_PS 3 %define stack_size 9*16 + 7*8 ; must be an odd multiple of 8 %define arg(x) [rsp + stack_size + PS + PS*x] %define func(x) proc_frame x %macro FUNC_SAVE 0 alloc_stack stack_size save_xmm128 xmm6, 0*16 save_xmm128 xmm7, 1*16 save_xmm128 xmm8, 2*16 save_xmm128 xmm9, 3*16 save_xmm128 xmm10, 4*16 save_xmm128 xmm11, 5*16 save_xmm128 xmm12, 6*16 save_xmm128 xmm13, 7*16 save_xmm128 xmm14, 8*16 save_reg r12, 9*16 + 0*8 save_reg r13, 9*16 + 1*8 save_reg r14, 9*16 + 2*8 save_reg r15, 9*16 + 3*8 save_reg rdi, 9*16 + 4*8 save_reg rsi, 9*16 + 5*8 end_prolog mov arg4, arg(4) %endmacro %macro FUNC_RESTORE 0 movdqa xmm6, [rsp + 0*16] movdqa xmm7, [rsp + 1*16] movdqa xmm8, [rsp + 2*16] movdqa xmm9, [rsp + 3*16] movdqa xmm10, [rsp + 4*16] movdqa xmm11, [rsp + 5*16] movdqa xmm12, [rsp + 6*16] movdqa xmm13, [rsp + 7*16] movdqa xmm14, [rsp + 8*16] mov r12, [rsp + 9*16 + 0*8] mov r13, [rsp + 9*16 + 1*8] mov r14, [rsp + 9*16 + 2*8] mov r15, [rsp + 9*16 + 3*8] mov rdi, [rsp + 9*16 + 4*8] mov rsi, [rsp + 9*16 + 5*8] add rsp, stack_size %endmacro %endif %ifidn __OUTPUT_FORMAT__, elf32 ;;;================== High Address; ;;; arg4 ;;; arg3 ;;; arg2 ;;; arg1 ;;; arg0 ;;; return ;;;<================= esp of caller ;;; ebp ;;;<================= ebp = esp ;;; var0 ;;; var1 ;;; var2 ;;; var3 ;;; esi ;;; edi ;;; ebx ;;;<================= esp of callee ;;; ;;;================== Low Address; %define PS 4 %define LOG_PS 2 %define func(x) x: %define arg(x) [ebp + PS*2 + PS*x] %define var(x) [ebp - PS - PS*x] %define trans ecx %define trans2 esi %define arg0 trans ;trans and trans2 are for the variables in stack %define arg0_m arg(0) %define arg1 ebx %define arg2 arg2_m %define arg2_m arg(2) %define arg3 trans %define arg3_m arg(3) %define arg4 trans %define arg4_m arg(4) %define arg5 trans2 %define tmp edx %define tmp2 edi %define tmp3 trans2 %define tmp3_m var(0) %define tmp4 trans2 %define tmp4_m var(1) %define tmp5 trans2 %define tmp5_m var(2) %define tmp6 trans2 %define tmp6_m var(3) %define return eax %macro SLDR 2 ;stack load/restore mov %1, %2 %endmacro %define SSTR SLDR %macro FUNC_SAVE 0 push ebp mov ebp, esp sub esp, PS*4 ;4 local variables push esi push edi push ebx mov arg1, arg(1) %endmacro %macro FUNC_RESTORE 0 pop ebx pop edi pop esi add esp, PS*4 ;4 local variables pop ebp %endmacro %endif ; output formats %define len arg0 %define vec arg1 %define mul_array arg2 %define src arg3 %define dest1 arg4 %define ptr arg5 %define vec_i tmp2 %define dest2 tmp3 %define dest3 tmp4 %define dest4 tmp5 %define vskip3 tmp6 %define pos return %ifidn PS,4 ;32-bit code %define len_m arg0_m %define src_m arg3_m %define dest1_m arg4_m %define dest2_m tmp3_m %define dest3_m tmp4_m %define dest4_m tmp5_m %define vskip3_m tmp6_m %endif %ifndef EC_ALIGNED_ADDR ;;; Use Un-aligned load/store %define XLDR movdqu %define XSTR movdqu %else ;;; Use Non-temporal load/stor %ifdef NO_NT_LDST %define XLDR movdqa %define XSTR movdqa %else %define XLDR movntdqa %define XSTR movntdq %endif %endif %ifidn PS,8 ; 64-bit code default rel [bits 64] %endif section .text %ifidn PS,8 ;64-bit code %define xmask0f xmm14 %define xgft1_lo xmm2 %define xgft1_hi xmm3 %define xgft2_lo xmm11 %define xgft2_hi xmm4 %define xgft3_lo xmm9 %define xgft3_hi xmm5 %define xgft4_lo xmm7 %define xgft4_hi xmm6 %define x0 xmm0 %define xtmpa xmm1 %define xp1 xmm8 %define xp2 xmm10 %define xp3 xmm12 %define xp4 xmm13 %else %define xmm_trans xmm7 ;reuse xmask0f and xgft1_lo %define xmask0f xmm_trans %define xgft1_lo xmm_trans %define xgft1_hi xmm6 %define xgft2_lo xgft1_lo %define xgft2_hi xgft1_hi %define xgft3_lo xgft1_lo %define xgft3_hi xgft1_hi %define xgft4_lo xgft1_lo %define xgft4_hi xgft1_hi %define x0 xmm0 %define xtmpa xmm1 %define xp1 xmm2 %define xp2 xmm3 %define xp3 xmm4 %define xp4 xmm5 %endif align 16 global gf_4vect_dot_prod_sse:function func(gf_4vect_dot_prod_sse) FUNC_SAVE SLDR len, len_m sub len, 16 SSTR len_m, len jl .return_fail xor pos, pos movdqa xmask0f, [mask0f] ;Load mask of lower nibble in each byte mov vskip3, vec imul vskip3, 96 SSTR vskip3_m, vskip3 sal vec, LOG_PS ;vec *= PS. Make vec_i count by PS SLDR dest1, dest1_m mov dest2, [dest1+PS] SSTR dest2_m, dest2 mov dest3, [dest1+2*PS] SSTR dest3_m, dest3 mov dest4, [dest1+3*PS] SSTR dest4_m, dest4 mov dest1, [dest1] SSTR dest1_m, dest1 .loop16: pxor xp1, xp1 pxor xp2, xp2 pxor xp3, xp3 pxor xp4, xp4 mov tmp, mul_array xor vec_i, vec_i .next_vect: SLDR src, src_m mov ptr, [src+vec_i] %ifidn PS,8 ;64-bit code movdqu xgft1_lo, [tmp] ;Load array Ax{00}, Ax{01}, ..., Ax{0f} movdqu xgft1_hi, [tmp+16] ; " Ax{00}, Ax{10}, ..., Ax{f0} movdqu xgft2_lo, [tmp+vec*(32/PS)] ;Load array Bx{00}, Bx{01}, ..., Bx{0f} movdqu xgft2_hi, [tmp+vec*(32/PS)+16] ; " Bx{00}, Bx{10}, ..., Bx{f0} movdqu xgft3_lo, [tmp+vec*(64/PS)] ;Load array Cx{00}, Cx{01}, ..., Cx{0f} movdqu xgft3_hi, [tmp+vec*(64/PS)+16] ; " Cx{00}, Cx{10}, ..., Cx{f0} movdqu xgft4_lo, [tmp+vskip3] ;Load array Dx{00}, Dx{01}, ..., Dx{0f} movdqu xgft4_hi, [tmp+vskip3+16] ; " Dx{00}, Dx{10}, ..., Dx{f0} XLDR x0, [ptr+pos] ;Get next source vector add tmp, 32 add vec_i, PS movdqa xtmpa, x0 ;Keep unshifted copy of src psraw x0, 4 ;Shift to put high nibble into bits 4-0 pand x0, xmask0f ;Mask high src nibble in bits 4-0 pand xtmpa, xmask0f ;Mask low src nibble in bits 4-0 %else ;32-bit code XLDR x0, [ptr+pos] ;Get next source vector movdqa xmask0f, [mask0f] ;Load mask of lower nibble in each byte movdqa xtmpa, x0 ;Keep unshifted copy of src psraw x0, 4 ;Shift to put high nibble into bits 4-0 pand x0, xmask0f ;Mask high src nibble in bits 4-0 pand xtmpa, xmask0f ;Mask low src nibble in bits 4-0 movdqu xgft1_lo, [tmp] ;Load array Ax{00}, Ax{01}, ..., Ax{0f} movdqu xgft1_hi, [tmp+16] ; " Ax{00}, Ax{10}, ..., Ax{f0} %endif pshufb xgft1_hi, x0 ;Lookup mul table of high nibble pshufb xgft1_lo, xtmpa ;Lookup mul table of low nibble pxor xgft1_hi, xgft1_lo ;GF add high and low partials pxor xp1, xgft1_hi ;xp1 += partial %ifidn PS,4 ;32-bit code movdqu xgft2_lo, [tmp+vec*(32/PS)] ;Load array Bx{00}, Bx{01}, ..., Bx{0f} movdqu xgft2_hi, [tmp+vec*(32/PS)+16] ; " Bx{00}, Bx{10}, ..., Bx{f0} %endif pshufb xgft2_hi, x0 ;Lookup mul table of high nibble pshufb xgft2_lo, xtmpa ;Lookup mul table of low nibble pxor xgft2_hi, xgft2_lo ;GF add high and low partials pxor xp2, xgft2_hi ;xp2 += partial %ifidn PS,4 ;32-bit code sal vec, 1 movdqu xgft3_lo, [tmp+vec*(32/PS)] ;Load array Cx{00}, Cx{01}, ..., Cx{0f} movdqu xgft3_hi, [tmp+vec*(32/PS)+16] ; " Cx{00}, Cx{10}, ..., Cx{f0} sar vec, 1 %endif pshufb xgft3_hi, x0 ;Lookup mul table of high nibble pshufb xgft3_lo, xtmpa ;Lookup mul table of low nibble pxor xgft3_hi, xgft3_lo ;GF add high and low partials pxor xp3, xgft3_hi ;xp3 += partial %ifidn PS,4 ;32-bit code SLDR vskip3, vskip3_m movdqu xgft4_lo, [tmp+vskip3] ;Load array Dx{00}, Dx{01}, ..., Dx{0f} movdqu xgft4_hi, [tmp+vskip3+16] ; " Dx{00}, Dx{10}, ..., Dx{f0} add tmp, 32 add vec_i, PS %endif pshufb xgft4_hi, x0 ;Lookup mul table of high nibble pshufb xgft4_lo, xtmpa ;Lookup mul table of low nibble pxor xgft4_hi, xgft4_lo ;GF add high and low partials pxor xp4, xgft4_hi ;xp4 += partial cmp vec_i, vec jl .next_vect SLDR dest1, dest1_m SLDR dest2, dest2_m XSTR [dest1+pos], xp1 XSTR [dest2+pos], xp2 SLDR dest3, dest3_m XSTR [dest3+pos], xp3 SLDR dest4, dest4_m XSTR [dest4+pos], xp4 SLDR len, len_m add pos, 16 ;Loop on 16 bytes at a time cmp pos, len jle .loop16 lea tmp, [len + 16] cmp pos, tmp je .return_pass ;; Tail len mov pos, len ;Overlapped offset length-16 jmp .loop16 ;Do one more overlap pass .return_pass: mov return, 0 FUNC_RESTORE ret .return_fail: mov return, 1 FUNC_RESTORE ret endproc_frame section .data align 16 mask0f: ddq 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f %macro slversion 4 global %1_slver_%2%3%4 global %1_slver %1_slver: %1_slver_%2%3%4: dw 0x%4 db 0x%3, 0x%2 %endmacro ;;; func core, ver, snum slversion gf_4vect_dot_prod_sse, 00, 05, 0064
; ; ANSI Video handling for the VZ200 ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.2 2015/01/19 01:33:19 pauloscustodio Exp $ ; PUBLIC ansi_SCROLLUP .ansi_SCROLLUP LD HL,0101h CALL 11CDh ; L2A - convert location to screen address push hl ex de,hl ld h,d ld l,$20 ld bc,480 ldir ld b,32 dec hl .cfill ld (hl),32 ;' ' dec hl djnz cfill pop de ld a,$E0 and d ld d,a ld h,d ld l,$20 ld bc,480 ldir ld b,32 dec hl .afill ld (hl),0 dec hl djnz afill ret
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sync/notifier/push_client_channel.h" #include <cstddef> #include <string> #include "base/compiler_specific.h" #include "jingle/notifier/listener/fake_push_client.h" #include "jingle/notifier/listener/notification_defines.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { namespace { class PushClientChannelTest : public ::testing::Test { protected: PushClientChannelTest() : fake_push_client_(new notifier::FakePushClient()), push_client_channel_( scoped_ptr<notifier::PushClient>(fake_push_client_)), connected_(false) { push_client_channel_.SetMessageReceiver( invalidation::NewPermanentCallback( this, &PushClientChannelTest::OnIncomingMessage)); push_client_channel_.AddNetworkStatusReceiver( invalidation::NewPermanentCallback( this, &PushClientChannelTest::OnNetworkStatusChange)); push_client_channel_.SetSystemResources(NULL); } virtual ~PushClientChannelTest() {} void OnIncomingMessage(std::string incoming_message) { last_message_ = incoming_message; } void OnNetworkStatusChange(bool connected) { connected_ = connected; } notifier::FakePushClient* fake_push_client_; PushClientChannel push_client_channel_; std::string last_message_; bool connected_; }; const char kMessage[] = "message"; const char kServiceContext[] = "service context"; const int64 kSchedulingHash = 100; // Encode a message with some context into a notification and then // decode it. The decoded info should match the original info. TEST_F(PushClientChannelTest, EncodeDecode) { const notifier::Notification& notification = PushClientChannel::EncodeMessageForTest( kMessage, kServiceContext, kSchedulingHash); std::string message; std::string service_context; int64 scheduling_hash = 0LL; EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( notification, &message, &service_context, &scheduling_hash)); EXPECT_EQ(kMessage, message); EXPECT_EQ(kServiceContext, service_context); EXPECT_EQ(kSchedulingHash, scheduling_hash); } // Encode a message with no context into a notification and then // decode it. The decoded message should match the original message, // but the context and hash should be untouched. TEST_F(PushClientChannelTest, EncodeDecodeNoContext) { const notifier::Notification& notification = PushClientChannel::EncodeMessageForTest( kMessage, "", kSchedulingHash); std::string message; std::string service_context = kServiceContext; int64 scheduling_hash = kSchedulingHash + 1; EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( notification, &message, &service_context, &scheduling_hash)); EXPECT_EQ(kMessage, message); EXPECT_EQ(kServiceContext, service_context); EXPECT_EQ(kSchedulingHash + 1, scheduling_hash); } // Decode an empty notification. It should result in an empty message // but should leave the context and hash untouched. TEST_F(PushClientChannelTest, DecodeEmpty) { std::string message = kMessage; std::string service_context = kServiceContext; int64 scheduling_hash = kSchedulingHash; EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( notifier::Notification(), &message, &service_context, &scheduling_hash)); EXPECT_TRUE(message.empty()); EXPECT_EQ(kServiceContext, service_context); EXPECT_EQ(kSchedulingHash, scheduling_hash); } // Try to decode a garbage notification. It should leave all its // arguments untouched and return false. TEST_F(PushClientChannelTest, DecodeGarbage) { notifier::Notification notification; notification.data = "garbage"; std::string message = kMessage; std::string service_context = kServiceContext; int64 scheduling_hash = kSchedulingHash; EXPECT_FALSE(PushClientChannel::DecodeMessageForTest( notification, &message, &service_context, &scheduling_hash)); EXPECT_EQ(kMessage, message); EXPECT_EQ(kServiceContext, service_context); EXPECT_EQ(kSchedulingHash, scheduling_hash); } // Make sure the channel subscribes to the correct notifications // channel on construction. TEST_F(PushClientChannelTest, Subscriptions) { notifier::Subscription expected_subscription; expected_subscription.channel = "tango_raw"; EXPECT_TRUE(notifier::SubscriptionListsEqual( fake_push_client_->subscriptions(), notifier::SubscriptionList(1, expected_subscription))); } // Call UpdateCredentials on the channel. It should propagate it to // the push client. TEST_F(PushClientChannelTest, UpdateCredentials) { const char kEmail[] = "foo@bar.com"; const char kToken[] = "token"; EXPECT_TRUE(fake_push_client_->email().empty()); EXPECT_TRUE(fake_push_client_->token().empty()); push_client_channel_.UpdateCredentials(kEmail, kToken); EXPECT_EQ(kEmail, fake_push_client_->email()); EXPECT_EQ(kToken, fake_push_client_->token()); } // Call SendMessage on the channel. It should propagate it to the // push client. TEST_F(PushClientChannelTest, SendMessage) { EXPECT_TRUE(fake_push_client_->sent_notifications().empty()); push_client_channel_.SendMessage(kMessage); const notifier::Notification expected_notification = PushClientChannel::EncodeMessageForTest( kMessage, push_client_channel_.GetServiceContextForTest(), push_client_channel_.GetSchedulingHashForTest()); ASSERT_EQ(1u, fake_push_client_->sent_notifications().size()); EXPECT_TRUE( fake_push_client_->sent_notifications()[0].Equals( expected_notification)); } // Simulate push client state changes on the push client. It should // propagate to the channel. TEST_F(PushClientChannelTest, OnPushClientStateChange) { EXPECT_FALSE(connected_); fake_push_client_->EnableNotifications(); EXPECT_TRUE(connected_); fake_push_client_->DisableNotifications( notifier::TRANSIENT_NOTIFICATION_ERROR); EXPECT_FALSE(connected_); fake_push_client_->EnableNotifications(); EXPECT_TRUE(connected_); fake_push_client_->DisableNotifications( notifier::NOTIFICATION_CREDENTIALS_REJECTED); EXPECT_FALSE(connected_); } // Simulate an incoming notification. It should be decoded properly // by the channel. TEST_F(PushClientChannelTest, OnIncomingNotification) { const notifier::Notification notification = PushClientChannel::EncodeMessageForTest( kMessage, kServiceContext, kSchedulingHash); fake_push_client_->SimulateIncomingNotification(notification); EXPECT_EQ(kServiceContext, push_client_channel_.GetServiceContextForTest()); EXPECT_EQ(kSchedulingHash, push_client_channel_.GetSchedulingHashForTest()); EXPECT_EQ(kMessage, last_message_); } // Simulate an incoming notification with no receiver. It should be // dropped by the channel. TEST_F(PushClientChannelTest, OnIncomingNotificationNoReceiver) { const notifier::Notification notification = PushClientChannel::EncodeMessageForTest( kMessage, kServiceContext, kSchedulingHash); push_client_channel_.SetMessageReceiver(NULL); fake_push_client_->SimulateIncomingNotification(notification); EXPECT_TRUE(push_client_channel_.GetServiceContextForTest().empty()); EXPECT_EQ(static_cast<int64>(0), push_client_channel_.GetSchedulingHashForTest()); EXPECT_TRUE(last_message_.empty()); } // Simulate an incoming garbage notification. It should be dropped by // the channel. TEST_F(PushClientChannelTest, OnIncomingNotificationGarbage) { notifier::Notification notification; notification.data = "garbage"; fake_push_client_->SimulateIncomingNotification(notification); EXPECT_TRUE(push_client_channel_.GetServiceContextForTest().empty()); EXPECT_EQ(static_cast<int64>(0), push_client_channel_.GetSchedulingHashForTest()); EXPECT_TRUE(last_message_.empty()); } // Send a message, simulate an incoming message with context, and then // send the same message again. The first sent message should not // have any context, but the second sent message should have the // context from the incoming emssage. TEST_F(PushClientChannelTest, PersistedMessageState) { push_client_channel_.SendMessage(kMessage); ASSERT_EQ(1u, fake_push_client_->sent_notifications().size()); { std::string message; std::string service_context; int64 scheduling_hash = 0LL; EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( fake_push_client_->sent_notifications()[0], &message, &service_context, &scheduling_hash)); EXPECT_EQ(kMessage, message); EXPECT_TRUE(service_context.empty()); EXPECT_EQ(0LL, scheduling_hash); } const notifier::Notification notification = PushClientChannel::EncodeMessageForTest( kMessage, kServiceContext, kSchedulingHash); fake_push_client_->SimulateIncomingNotification(notification); push_client_channel_.SendMessage(kMessage); ASSERT_EQ(2u, fake_push_client_->sent_notifications().size()); { std::string message; std::string service_context; int64 scheduling_hash = 0LL; EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( fake_push_client_->sent_notifications()[1], &message, &service_context, &scheduling_hash)); EXPECT_EQ(kMessage, message); EXPECT_EQ(kServiceContext, service_context); EXPECT_EQ(kSchedulingHash, scheduling_hash); } } } // namespace } // namespace syncer