max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
oeis/014/A014097.asm
neoneye/loda-programs
11
169972
; A014097: a(n) = a(n-1)+a(n-4). ; Submitted by <NAME> ; 1,1,1,5,6,7,8,13,19,26,34,47,66,92,126,173,239,331,457,630,869,1200,1657,2287,3156,4356,6013,8300,11456,15812,21825,30125,41581,57393,79218,109343,150924,208317,287535,396878,547802,756119,1043654,1440532,1988334,2744453,3788107,5228639,7216973,9961426,13749533,18978172,26195145,36156571,49906104,68884276,95079421,131235992,181142096,250026372,345105793,476341785,657483881,907510253,1252616046,1728957831,2386441712,3293951965,4546568011,6275525842,8661967554,11955919519,16502487530,22778013372 mov $2,3 lpb $0 sub $0,1 sub $1,$2 sub $3,$4 mov $4,$2 add $2,$1 mov $1,$3 add $4,1 add $5,$4 mov $3,$5 lpe mov $0,$1 add $0,1
ada/src/afrl/cmasi/afrl-cmasi-abstractgeometry.ads
joffreyhuguet/LmcpGen
0
7931
<reponame>joffreyhuguet/LmcpGen<gh_stars>0 with afrl.cmasi.object; use afrl.cmasi.object; with afrl.cmasi.enumerations; use afrl.cmasi.enumerations; with avtas.lmcp.types; use avtas.lmcp.types; package afrl.cmasi.abstractGeometry is type AbstractGeometry is new afrl.cmasi.object.Object with private; type AbstractGeometry_Acc is access all AbstractGeometry; type AbstractGeometry_Class_Acc is access all AbstractGeometry'Class; function getFullLmcpTypeName(this : AbstractGeometry) return String; function getLmcpTypeName(this : AbstractGeometry) return String; function getLmcpType(this : AbstractGeometry) return UInt32_t; private type AbstractGeometry is new afrl.cmasi.object.Object with null record; end afrl.cmasi.abstractGeometry;
models/tests/test58.als
transclosure/Amalgam
4
3763
<reponame>transclosure/Amalgam module tests/test // Fancy sequence example written by Felix abstract sig Obj { } sig Name { } sig File extends Obj { } sig Dir extends Obj { map: Name->lone Obj, children: set Obj } one sig Root extends Dir { } sig Path { names: seq Name, target: lone Obj, parent: lone Path } // This defines "Dir.children" based on the values of "Dir.map" fact { all d:Dir | d.children = Name.(d.map) } // This defines "Path.target" and "Path.parent" based on the values of "Dir.map" fact { all p:Path { (no p.names) => p.target=Root (one p.names) => p.target=Root.map[p.names.first] (!lone p.names) => p.target=(p.parent.target).map[p.names.last] (no p.names) => (no p.parent) (some p.names) => (one p.parent && p.names = p.parent.names + (#p.parent.names)->(p.names.last)) } } // This makes more efficient use of the scope, by ensuring that any two distinct Path atoms will have distinct sequence of Names fact { all p1, p2: Path | (p1.names=p2.names => p1=p2) } // This explicitly rejects any instance in which there is a cycle fact { no x:Obj | x in x.^children } // This explicitly rejects any instance in which there is a File or Dir not reachable from Root fact { all x:Obj | x in Root.*children } // Let's try to force a simulation of an interesting situation run { some p:Path | no p.target some p1,p2:Path | { #(p1.names)=2 && #(p2.names)=2 && some p1.target && some p2.target && p1.target!=p2.target } some d:Dir | #(d.children)>1 } for 3 but 4 Obj, 7 Path expect 1
externals/mpir-3.0.0/mpn/x86_64/atom/copyi.asm
JaminChan/eos_win
12
161946
<reponame>JaminChan/eos_win dnl mpn_copyi dnl Copyright 2009 <NAME> dnl This file is part of the MPIR Library. dnl The MPIR Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 2.1 of the License, or (at dnl your option) any later version. dnl The MPIR 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 Lesser General Public dnl License for more details. dnl You should have received a copy of the GNU Lesser General Public License dnl along with the MPIR Library; see the file COPYING.LIB. If not, write dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, dnl Boston, MA 02110-1301, USA. include(`../config.m4') C ret mpn_copyi(mp_ptr,mp_ptr,mp_size_t) C rax rdi, rsi, rdx ASM_START() PROLOGUE(mpn_copyi) cmp $0,%rdx #needed for case n=0 jz endfn #needed for case n=0 mov %rdi,%rax sub %rsi,%rax test $0xF,%rax jz aligned test $0xF,%rdi jz srcisodd mov $5,%rcx sub %rdx,%rcx lea -40(%rsi,%rdx,8),%rsi lea -40(%rdi,%rdx,8),%rdi movapd (%rsi,%rcx,8),%xmm1 movq %xmm1,(%rdi,%rcx,8) add $8,%rdi cmp $1,%rdx #needed for case n=1 jz endfn #needed for case n=1 cmp $0,%rcx jge skiplpud ALIGN(16) lpud: movapd 16(%rsi,%rcx,8),%xmm0 add $4,%rcx shufpd $1,%xmm0,%xmm1 movapd %xmm1,-32(%rdi,%rcx,8) movapd 32-32(%rsi,%rcx,8),%xmm1 shufpd $1,%xmm1,%xmm0 movapd %xmm0,16-32(%rdi,%rcx,8) jnc lpud skiplpud: cmp $2,%rcx ja case0d jz case1d jp case2d ALIGN(16) case3d: movapd 16(%rsi,%rcx,8),%xmm0 shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) movapd 32(%rsi,%rcx,8),%xmm1 # top is read past shufpd $1,%xmm1,%xmm0 movapd %xmm0,16(%rdi,%rcx,8) ret ALIGN(16) case2d: movapd 16(%rsi,%rcx,8),%xmm0 shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) movhpd %xmm0,16(%rdi,%rcx,8) ret ALIGN(16) case1d: movapd 16(%rsi,%rcx,8),%xmm0 # top read past shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) ret ALIGN(16) case0d: movhpd %xmm1,(%rdi,%rcx,8) endfn: ret srcisodd: mov $4,%rcx sub %rdx,%rcx lea -32(%rsi,%rdx,8),%rsi lea -32(%rdi,%rdx,8),%rdi movapd -8(%rsi,%rcx,8),%xmm1 sub $8,%rsi cmp $0,%rcx jge skiplpus ALIGN(16) lpus: movapd 16(%rsi,%rcx,8),%xmm0 add $4,%rcx shufpd $1,%xmm0,%xmm1 movapd %xmm1,-32(%rdi,%rcx,8) movapd 32-32(%rsi,%rcx,8),%xmm1 shufpd $1,%xmm1,%xmm0 movapd %xmm0,16-32(%rdi,%rcx,8) jnc lpus skiplpus: cmp $2,%rcx ja case0s jz case1s jp case2s ALIGN(16) case3s: movapd 16(%rsi,%rcx,8),%xmm0 shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) movapd 32(%rsi,%rcx,8),%xmm1 # read past shufpd $1,%xmm1,%xmm0 movapd %xmm0,16(%rdi,%rcx,8) ret ALIGN(16) case2s: movapd 16(%rsi,%rcx,8),%xmm0 shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) movhpd %xmm0,16(%rdi,%rcx,8) ret ALIGN(16) case1s: movapd 16(%rsi,%rcx,8),%xmm0 # read past shufpd $1,%xmm0,%xmm1 movapd %xmm1,(%rdi,%rcx,8) ret ALIGN(16) case0s: movhpd %xmm1,(%rdi,%rcx,8) ret ALIGN(16) aligned: sub $4,%rdx test $0xF,%rdi jz notodda mov (%rsi),%rax mov %rax,(%rdi) sub $1,%rdx lea 8(%rsi),%rsi lea 8(%rdi),%rdi notodda: cmp $0,%rdx jl skiplpa ALIGN(16) lpa: movdqa (%rsi),%xmm0 sub $4,%rdx movdqa 16(%rsi),%xmm1 lea 32(%rsi),%rsi movdqa %xmm0,(%rdi) lea 32(%rdi),%rdi movdqa %xmm1,16-32(%rdi) jnc lpa skiplpa: cmp $-2,%rdx jg casea3 je casea2 jnp casea0 casea1: mov (%rsi),%rax mov %rax,(%rdi) ret casea3: movdqa (%rsi),%xmm0 mov 16(%rsi),%rax movdqa %xmm0,(%rdi) mov %rax,16(%rdi) casea0: ret casea2: movdqa (%rsi),%xmm0 movdqa %xmm0,(%rdi) ret EPILOGUE()
programs/oeis/114/A114390.asm
neoneye/loda
22
172370
; A114390: A065621(n^2). ; 1,4,25,16,41,100,81,64,241,164,137,400,505,324,289,256,865,964,953,656,713,548,1585,1600,1681,2020,1897,1296,1497,1156,1089,1024,3265,3460,3417,3856,4073,3812,3601,2624,2993,2852,2377,2192,2105,6340 mul $0,2 add $0,2 pow $0,2 sub $0,1 seq $0,105081 ; a(n) = 1 + A003188(n - 1), n>=1. div $0,2
programs/oeis/269/A269352.asm
karttu/loda
1
13445
; A269352: Kolakoski-(1,10) sequence: a(n) is length of n-th run. ; 1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1 add $0,909 mov $1,$0 div $1,10 mod $1,2 mul $1,9 add $1,1
vendor/stdlib/Everything.agda
isabella232/Lemmachine
56
16805
------------------------------------------------------------------------ -- All library modules, along with short descriptions ------------------------------------------------------------------------ -- Note that core modules are not included. module Everything where -- Definitions of algebraic structures like monoids and rings -- (packed in records together with sets, operations, etc.) import Algebra -- Properties of functions, such as associativity and commutativity import Algebra.FunctionProperties -- Morphisms between algebraic structures import Algebra.Morphism -- Some defined operations (multiplication by natural number and -- exponentiation) import Algebra.Operations -- Some derivable properties import Algebra.Props.AbelianGroup -- Some derivable properties import Algebra.Props.BooleanAlgebra -- Some derivable properties import Algebra.Props.DistributiveLattice -- Some derivable properties import Algebra.Props.Group -- Some derivable properties import Algebra.Props.Lattice -- Some derivable properties import Algebra.Props.Ring -- Solver for commutative ring or semiring equalities import Algebra.RingSolver -- Commutative semirings with some additional structure ("almost" -- commutative rings), used by the ring solver import Algebra.RingSolver.AlmostCommutativeRing -- Some boring lemmas used by the ring solver import Algebra.RingSolver.Lemmas -- Instantiates the ring solver with two copies of the same ring import Algebra.RingSolver.Simple -- Some algebraic structures (not packed up with sets, operations, -- etc.) import Algebra.Structures -- Applicative functors import Category.Applicative -- Indexed applicative functors import Category.Applicative.Indexed -- Functors import Category.Functor -- Monads import Category.Monad -- A delimited continuation monad import Category.Monad.Continuation -- The identity monad import Category.Monad.Identity -- Indexed monads import Category.Monad.Indexed -- The partiality monad import Category.Monad.Partiality -- The state monad import Category.Monad.State -- Types used to make recursive arguments coinductive import Coinduction -- AVL trees import Data.AVL -- Finite maps with indexed keys and values, based on AVL trees import Data.AVL.IndexedMap -- Finite sets, based on AVL trees import Data.AVL.Sets -- A binary representation of natural numbers import Data.Bin -- Booleans import Data.Bool -- A bunch of properties import Data.Bool.Properties -- Showing booleans import Data.Bool.Show -- Bounded vectors import Data.BoundedVec -- Bounded vectors (inefficient, concrete implementation) import Data.BoundedVec.Inefficient -- Characters import Data.Char -- "Finite" sets indexed on coinductive "natural" numbers import Data.Cofin -- Coinductive lists import Data.Colist -- Coinductive "natural" numbers import Data.Conat -- Coinductive vectors import Data.Covec -- Lists with fast append import Data.DifferenceList -- Natural numbers with fast addition (for use together with -- DifferenceVec) import Data.DifferenceNat -- Vectors with fast append import Data.DifferenceVec -- Digits and digit expansions import Data.Digit -- Empty type import Data.Empty -- Empty type (in Set₁) import Data.Empty1 -- Finite sets import Data.Fin -- Decision procedures for finite sets and subsets of finite sets import Data.Fin.Dec -- Properties related to Fin, and operations making use of these -- properties (or other properties not available in Data.Fin) import Data.Fin.Props -- Subsets of finite sets import Data.Fin.Subset -- Some properties about subsets import Data.Fin.Subset.Props -- Substitutions import Data.Fin.Substitution -- An example of how Data.Fin.Substitution can be used: a definition -- of substitution for the untyped λ-calculus, along with some lemmas import Data.Fin.Substitution.Example -- Substitution lemmas import Data.Fin.Substitution.Lemmas -- Application of substitutions to lists, along with various lemmas import Data.Fin.Substitution.List -- Simple combinators working solely on and with functions import Data.Function -- Directed acyclic multigraphs import Data.Graph.Acyclic -- Integers import Data.Integer -- Divisibility and coprimality import Data.Integer.Divisibility -- Some properties about integers import Data.Integer.Properties -- Lists import Data.List -- Lists where all elements satisfy a given property import Data.List.All -- Properties relating All to various list functions import Data.List.All.Properties -- Lists where at least one element satisfies a given property import Data.List.Any -- Properties relating Any to various list functions import Data.List.Any.Properties -- A data structure which keeps track of an upper bound on the number -- of elements /not/ in a given list import Data.List.Countdown -- List equality import Data.List.Equality -- Non-empty lists import Data.List.NonEmpty -- Properties of non-empty lists import Data.List.NonEmpty.Properties -- List-related properties import Data.List.Properties -- Lists parameterised on things in Set₁ import Data.List1 -- Finite maps, i.e. lookup tables (currently only some type -- signatures) import Data.Map -- The Maybe type import Data.Maybe -- Natural numbers import Data.Nat -- Coprimality import Data.Nat.Coprimality -- Integer division import Data.Nat.DivMod -- Divisibility import Data.Nat.Divisibility -- Greatest common divisor import Data.Nat.GCD -- Boring lemmas used in Data.Nat.GCD and Data.Nat.Coprimality import Data.Nat.GCD.Lemmas -- Least common multiple import Data.Nat.LCM -- A bunch of properties about natural number operations import Data.Nat.Properties -- Showing natural numbers import Data.Nat.Show -- Products import Data.Product -- Products implemented using records import Data.Product.Record -- Products (variants for Set₁) import Data.Product1 -- Rational numbers import Data.Rational -- Finite sets (currently only some type signatures) import Data.Sets -- Signs import Data.Sign -- Some properties about signs import Data.Sign.Properties -- The reflexive transitive closures of McBride, Norell and Jansson import Data.Star -- Bounded vectors (inefficient implementation) import Data.Star.BoundedVec -- Decorated star-lists import Data.Star.Decoration -- Environments (heterogeneous collections) import Data.Star.Environment -- Finite sets defined in terms of Data.Star import Data.Star.Fin -- Lists defined in terms of Data.Star import Data.Star.List -- Natural numbers defined in terms of Data.Star import Data.Star.Nat -- Pointers into star-lists import Data.Star.Pointer -- Some properties related to Data.Star import Data.Star.Properties -- Vectors defined in terms of Data.Star import Data.Star.Vec -- Streams import Data.Stream -- Strings import Data.String -- Sums (disjoint unions) import Data.Sum -- The unit type import Data.Unit -- The unit type (in Set₁) import Data.Unit1 -- Vectors import Data.Vec -- Semi-heterogeneous vector equality import Data.Vec.Equality -- Code for converting Vec n A → B to and from n-ary functions import Data.Vec.N-ary -- Code for converting Vec₁ n A → B to and from n-ary functions import Data.Vec.N-ary1 -- Some Vec-related properties import Data.Vec.Properties -- Vectors parameterised on types in Set₁ import Data.Vec1 -- Types used (only) when calling out to Haskell via the FFI import Foreign.Haskell -- IO import IO -- Primitive IO: simple bindings to Haskell types and functions import IO.Primitive -- An abstraction of various forms of recursion/induction import Induction -- Lexicographic induction import Induction.Lexicographic -- Various forms of induction for natural numbers import Induction.Nat -- Well-founded induction import Induction.WellFounded -- A variant of Induction for Set₁ import Induction1 -- One form of induction for natural numbers import Induction1.Nat -- Well-founded induction import Induction1.WellFounded -- Properties of homogeneous binary relations import Relation.Binary -- Some properties imply others import Relation.Binary.Consequences -- Convenient syntax for equational reasoning import Relation.Binary.EqReasoning -- Many properties which hold for _∼_ also hold for flip₁ _∼_ import Relation.Binary.Flip -- Function setoids and related constructions import Relation.Binary.FunctionSetoid -- Heterogeneous equality import Relation.Binary.HeterogeneousEquality -- Conversion of ≤ to <, along with a number of properties import Relation.Binary.NonStrictToStrict -- Many properties which hold for _∼_ also hold for _∼_ on₁ f import Relation.Binary.On -- Order morphisms import Relation.Binary.OrderMorphism -- Convenient syntax for "equational reasoning" using a partial order import Relation.Binary.PartialOrderReasoning -- Convenient syntax for "equational reasoning" using a preorder import Relation.Binary.PreorderReasoning -- Lexicographic products of binary relations import Relation.Binary.Product.NonStrictLex -- Pointwise products of binary relations import Relation.Binary.Product.Pointwise -- Lexicographic products of binary relations import Relation.Binary.Product.StrictLex -- Propositional (intensional) equality import Relation.Binary.PropositionalEquality -- Propositional equality import Relation.Binary.PropositionalEquality1 -- Properties satisfied by decidable total orders import Relation.Binary.Props.DecTotalOrder -- Properties satisfied by posets import Relation.Binary.Props.Poset -- Properties satisfied by strict partial orders import Relation.Binary.Props.StrictPartialOrder -- Properties satisfied by strict partial orders import Relation.Binary.Props.StrictTotalOrder -- Properties satisfied by total orders import Relation.Binary.Props.TotalOrder -- Helpers intended to ease the development of "tactics" which use -- proof by reflection import Relation.Binary.Reflection -- Some simple binary relations import Relation.Binary.Simple -- Convenient syntax for "equational reasoning" using a strict partial -- order import Relation.Binary.StrictPartialOrderReasoning -- Conversion of < to ≤, along with a number of properties import Relation.Binary.StrictToNonStrict -- Sums of binary relations import Relation.Binary.Sum -- Operations on nullary relations (like negation and decidability) import Relation.Nullary -- Operations on and properties of decidable relations import Relation.Nullary.Decidable -- Properties related to negation import Relation.Nullary.Negation -- Products of nullary relations import Relation.Nullary.Product -- Sums of nullary relations import Relation.Nullary.Sum -- A universe of proposition functors, along with some properties import Relation.Nullary.Universe -- Unary relations import Relation.Unary -- Unary relations (variant for Set₁) import Relation.Unary1 -- Sizes for Agda's sized types import Size
source/s-shaloc.ads
ytomino/drake
33
30145
<reponame>ytomino/drake pragma License (Unrestricted); -- implementation unit package System.Shared_Locking is pragma Preelaborate; -- no-operation procedure Nop is null; type Enter_Handler is access procedure; pragma Favor_Top_Level (Enter_Handler); Enter_Hook : not null Enter_Handler := Nop'Access; procedure Enter; type Leave_Handler is access procedure; pragma Favor_Top_Level (Leave_Handler); Leave_Hook : not null Leave_Handler := Nop'Access; procedure Leave; end System.Shared_Locking;
test/Succeed/fol-theorems/Eta2.agda
asr/apia
10
8684
------------------------------------------------------------------------------ -- Testing the η-expansion ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module Eta2 where postulate D : Set ∃ : (A : D → Set) → Set _≡_ : D → D → Set -- Due to η-contraction the Agda internal representation of foo and -- bar are the same. We η-expand the internal types before the -- translation to FOL. postulate foo : ∀ d → ∃ (λ e → d ≡ e) bar : ∀ d → ∃ (_≡_ d) {-# ATP prove foo #-} {-# ATP prove bar #-}
programs/oeis/033/A033826.asm
neoneye/loda
22
25814
; A033826: Critical dimensions for N-modular lattices. ; 24,16,12,8,8,6,4,4,4,2 pow $0,2 mul $0,15 mov $2,$0 add $2,$0 mov $0,9194 mov $1,9194 lpb $0 mov $0,$2 trn $0,1 sub $1,72 div $2,2 lpe sub $1,8402 div $1,36 add $1,4 mov $0,$1
SmartScreenshot/AppDelegate.applescript
garrettwesley/SmartScreenshot
1
866
<filename>SmartScreenshot/AppDelegate.applescript -- -- AppDelegate.applescript -- SmartScreenshot -- -- Created by <NAME> on 12/30/18. -- Copyright © 2018 <NAME>. All rights reserved. -- script AppDelegate property parent : class "NSObject" property StatusItem : missing value property selectedMenu : "" property bar: missing value property theDisplay : "" property newMenu : class "NSMenu" on applicationWillFinishLaunching_(aNotification) my makeStatusBar() end applicationWillFinishLaunching_ on applicationShouldTerminate_(sender) return current application's NSTerminateNow end applicationShouldTerminate_ on makeStatusBar() set bar to current application's NSStatusBar's systemStatusBar set StatusItem to bar's statusItemWithLength:-1.0 StatusItem's setTitle:"💾" set newMenu to current application's NSMenu's alloc()'s initWithTitle:"Custom" my makeMenus() StatusItem's setMenu:newMenu end makeStatusBar on makeMenus() set menuItems to {"SaveLocation", "Screenshot", "ScreenCapture", "Quit"} set commands to {"", "3", "4", ""} repeat with i from 1 to number of items in menuItems set this_item to item i of menuItems set command to item i of commands set thisMenuItem to (current application's NSMenuItem's alloc()'s initWithTitle:this_item action:"onClick:" keyEquivalent:command) (newMenu's addItem:thisMenuItem) (thisMenuItem's setTarget:me) -- required for enabling the menu item -- add a seperator after first and third item if (i is equal to 3) or (i is equal to 1) then (newMenu's addItem:(current application's NSMenuItem's separatorItem)) end if end repeat end makeMenus on onClick:sender set aTag to tag of sender as integer set aTitle to title of sender as string if aTitle is equal to "Quit" then current application's NSStatusBar's systemStatusBar()'s removeStatusItem:StatusItem else display dialog aTitle as string end if end onClick: end script
src/morphology.ads
sebsgit/textproc
0
7038
<filename>src/morphology.ads with PixelArray; package Morphology is function erode(image: PixelArray.ImagePlane; size: Positive) return PixelArray.ImagePlane with Pre => size mod 2 /= 0; function dilate(image: PixelArray.ImagePlane; size: Positive) return PixelArray.ImagePlane with Pre => size mod 2 /= 0; end Morphology;
oeis/090/A090016.asm
neoneye/loda-programs
11
11774
; A090016: Permanent of (0,1)-matrix of size n X (n+d) with d=6 and n-1 zeros not on a line. ; Submitted by <NAME> ; 7,49,399,3689,38087,433713,5394991,72737161,1056085191,16423175153,272275569167,4792916427369,89267526953479,1753598009244529,36232438035285807,785431570870425353,17822981129678644871,422495471116535637681,10442881986001392267151,268676968130132448157033,7184015929117470105158727,199341969448774341802426289,5732439479077148442676269359,170626268221110340357265189769,5250634154652084624899509888327,166864689231521271540459171092593,5470935909274982804917181222171151 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $2,$0 mul $3,7 add $3,$1 mov $1,$2 add $3,$2 lpe mov $0,$3 mul $0,7
FormalAnalyzer/models/apps/ID11SensitiveDataLeak+.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
3791
module app_ID11SensitiveDataLeak open IoTBottomUp as base open cap_motionSensor open cap_location open cap_switch open cap_runIn one sig app_ID11SensitiveDataLeak extends IoTApp { runIn : one cap_state, motionSensors : some cap_motionSensor, state : one cap_state, location : one cap_location, newMode : one cap_location_attr_mode_val, switches : some cap_switch, } { rules = r } one sig cap_state extends cap_runIn {} { attributes = cap_state_attr + cap_runIn_attr } abstract sig cap_state_attr extends Attribute {} one sig cap_state_attr_mode extends cap_state_attr {} { values = cap_state_attr_mode_val } abstract sig cap_state_attr_mode_val extends AttrValue {} one sig cap_state_attr_mode_val_newMode extends cap_state_attr_mode_val {} one sig cap_state_attr_msg extends cap_state_attr {} { values = cap_state_attr_msg_val } abstract sig cap_state_attr_msg_val extends AttrValue {} //one sig cap_state_attr_msg_val_switch is on, alert extends cap_state_attr_msg_val {} one sig cap_state_attr_modeStartTime extends cap_state_attr {} { values = cap_state_attr_modeStartTime_val } abstract sig cap_state_attr_modeStartTime_val extends AttrValue {} one sig cap_state_attr_modeStartTime_val_0 extends cap_state_attr_modeStartTime_val {} one sig cap_state_attr_modeStartTime_val_null extends cap_state_attr_modeStartTime_val {} // application rules base class abstract sig r extends Rule {} one sig r0 extends r {}{ triggers = r0_trig conditions = r0_cond commands = r0_comm } abstract sig r0_trig extends Trigger {} one sig r0_trig0 extends r0_trig {} { capabilities = app_ID11SensitiveDataLeak.motionSensors attribute = cap_motionSensor_attr_motion value = cap_motionSensor_attr_motion_val_inactive } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_ID11SensitiveDataLeak.state attribute = cap_state_attr_modeStartTime value = cap_state_attr_modeStartTime_val_null } abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_ID11SensitiveDataLeak.state attribute = cap_state_attr_modeStartTime value = cap_state_attr_modeStartTime_val_0 } one sig r1 extends r {}{ triggers = r1_trig conditions = r1_cond commands = r1_comm } abstract sig r1_trig extends Trigger {} one sig r1_trig0 extends r1_trig {} { capabilities = app_ID11SensitiveDataLeak.switches attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } abstract sig r1_cond extends Condition {} abstract sig r1_comm extends Command {} one sig r1_comm0 extends r1_comm {} { capability = app_ID11SensitiveDataLeak.location attribute = cap_location_attr_mode value = app_ID11SensitiveDataLeak.newMode } one sig r2 extends r {}{ triggers = r2_trig conditions = r2_cond commands = r2_comm } abstract sig r2_trig extends Trigger {} one sig r2_trig0 extends r2_trig {} { capabilities = app_ID11SensitiveDataLeak.motionSensors attribute = cap_motionSensor_attr_motion value = cap_motionSensor_attr_motion_val_inactive } abstract sig r2_cond extends Condition {} one sig r2_cond0 extends r2_cond {} { capabilities = app_ID11SensitiveDataLeak.state attribute = cap_state_attr_modeStartTime value = cap_state_attr_modeStartTime_val_null } abstract sig r2_comm extends Command {} one sig r2_comm0 extends r2_comm {} { capability = app_ID11SensitiveDataLeak.runIn attribute = cap_runIn_attr_runIn value = cap_runIn_attr_runIn_val_on } one sig r3 extends r {}{ no triggers no conditions commands = r3_comm } abstract sig r3_comm extends Command {} one sig r3_comm0 extends r3_comm {} { capability = app_ID11SensitiveDataLeak.state attribute = cap_state_attr_modeStartTime value = cap_state_attr_modeStartTime_val }
tests/14_strace_analysis_tests/src/smk-runs-strace_analyzer-test_strace_analysis.adb
LionelDraghi/smk
10
19716
-- ----------------------------------------------------------------------------- -- smk, the smart make (http://lionel.draghi.free.fr/smk/) -- © 2018, 2019 <NAME> <<EMAIL>> -- SPDX-License-Identifier: APSL-2.0 -- ----------------------------------------------------------------------------- -- 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 -- 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. -- ----------------------------------------------------------------------------- with Smk.Files; use Smk.Files; with Smk.Runs.Strace_Analyzer; use Smk.Runs.Strace_Analyzer; with Ada.Command_Line; with Ada.Strings.Equal_Case_Insensitive; with Ada.Text_IO; use Ada.Text_IO; procedure Smk.Runs.Strace_Analyzer.Test_Strace_Analysis is Failure_Count : Natural := 0; -- -------------------------------------------------------------------------- procedure New_Test (Title : String; Line : String) is begin New_Line; Put_Line ("## " & Title); Put_Line (" Line: " & Line); end New_Test; -- -------------------------------------------------------------------------- procedure Check (Title : String; Result : String; Expected : String) is begin Put (" - Expected " & Title & ": "); Put ("""" & Expected & """"); if Ada.Strings.Equal_Case_Insensitive (Result, Expected) then Put_Line (", OK"); else Put_Line (", got """ & Result & """, " & "**Failed**"); Failure_Count := Failure_Count + 1; end if; end Check; Test_Data : Ada.Text_IO.File_Type; begin -- -------------------------------------------------------------------------- New_Line; Put_Line ("# Analyze_Line unit tests"); New_Line; Open (File => Test_Data, Name => "test_data.txt", Mode => In_File); -- Smk.Settings.Verbosity := Debug; while not End_Of_File (Test_Data) loop declare Title : constant String := Get_Line (Test_Data); Line : constant String := Get_Line (Test_Data); Call : constant String := Get_Line (Test_Data); Read_File_Name : constant String := Get_Line (Test_Data); Write_File_Name : constant String := Get_Line (Test_Data); Operation : Operation_Type; begin New_Test (Title, Line); Smk.Runs.Strace_Analyzer.Analyze_Line (Line, Operation); case Operation.Kind is when None => Check (Title => "Call_Type", Result => "Ignored", Expected => Call); when Read => Check (Title => "Read file", Result => +Operation.Name, Expected => Read_File_Name); when Write | Delete => Check (Title => "Write file", Result => +Operation.Name, Expected => Write_File_Name); when Move => Check (Title => "Source file", Result => +Operation.Source_Name, Expected => Read_File_Name); Check (Title => "Target file", Result => +Operation.Target_Name, Expected => Write_File_Name); end case; end; end loop; Close (File => Test_Data); -- To Add To data_test when unfinished line processing is implemented: -- Unfinished -- 6911 openat(AT_FDCWD, "/etc/ld.so.cache", \ -- O_RDONLY|O_CLOEXEC <unfinished ...> -- Ignored -- -- -- -------------------------------------------------------------------------- New_Line; if Failure_Count /= 0 then Put_Line (Natural'Image (Failure_Count) & " tests fails [Failed](tests_status.md#failed)"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); else Put_Line ("All tests OK [Successful](tests_status.md#successful)"); end if; end Smk.Runs.Strace_Analyzer.Test_Strace_Analysis;
Task/Rock-paper-scissors/Ada/rock-paper-scissors.ada
LaudateCorpus1/RosettaCodeData
1
662
with Ada.Text_IO; with Ada.Numerics.Float_Random; procedure Rock_Paper_Scissors is package Rand renames Ada.Numerics.Float_Random; Gen: Rand.Generator; type Choice is (Rock, Paper, Scissors); Cnt: array (Choice) of Natural := (1, 1, 1); -- for the initialization: pretend that each of Rock, Paper, -- and Scissors, has been played once by the human -- else the first computer choice would be deterministic function Computer_Choice return Choice is Random_Number: Natural := Integer(Rand.Random(Gen) * (Float(Cnt(Rock)) + Float(Cnt(Paper)) + Float(Cnt(Scissors)))); begin if Random_Number < Cnt(Rock) then -- guess the human will choose Rock return Paper; elsif Random_Number - Cnt(Rock) < Cnt(Paper) then -- guess the human will choose Paper return Scissors; else -- guess the human will choose Scissors return Rock; end if; end Computer_Choice; Finish_The_Game: exception; function Human_Choice return Choice is Done: Boolean := False; T: constant String := "enter ""r"" for Rock, ""p"" for Paper, or ""s"" for Scissors""!"; U: constant String := "or enter ""q"" to Quit the game"; Result: Choice; begin Ada.Text_IO.Put_Line(T); Ada.Text_IO.Put_Line(U); while not Done loop Done := True; declare S: String := Ada.Text_IO.Get_Line; begin if S="r" or S="R" then Result := Rock; elsif S="p" or S = "P" then Result := Paper; elsif S="s" or S="S" then Result := Scissors; elsif S="q" or S="Q" then raise Finish_The_Game; else Done := False; end if; end; end loop; return Result; end Human_Choice; type Result is (Human_Wins, Draw, Computer_Wins); function "<" (X, Y: Choice) return Boolean is -- X < Y if X looses against Y begin case X is when Rock => return (Y = Paper); when Paper => return (Y = Scissors); when Scissors => return (Y = Rock); end case; end "<"; Score: array(Result) of Natural := (0, 0, 0); C,H: Choice; Res: Result; begin -- play the game loop C := Computer_Choice; -- the computer makes its choice first H := Human_Choice; -- now ask the player for his/her choice Cnt(H) := Cnt(H) + 1; -- update the counts for the AI if C < H then Res := Human_Wins; elsif H < C then Res := Computer_Wins; else Res := Draw; end if; Ada.Text_IO.Put_Line("COMPUTER'S CHOICE: " & Choice'Image(C) & " RESULT: " & Result'Image(Res)); Ada.Text_IO.New_Line; Score(Res) := Score(Res) + 1; end loop; exception when Finish_The_Game => Ada.Text_IO.New_Line; for R in Score'Range loop Ada.Text_IO.Put_Line(Result'Image(R) & Natural'Image(Score(R))); end loop; end Rock_Paper_Scissors;
src/shields.asm
howprice/specnext-invaders
17
18430
SHIELD_IMAGE_WIDTH_PIXELS EQU 22 SHIELD_IMAGE_WIDTH_BYTES EQU 3 ASSERT (SHIELD_IMAGE_WIDTH_PIXELS + 7) / 8 == SHIELD_IMAGE_WIDTH_BYTES ; pixes should round up to bytes SHIELD_IMAGE_HEIGHT_PIXELS EQU 16 SHIELD_IMAGE_SIZE_BYTES EQU SHIELD_IMAGE_WIDTH_BYTES*SHIELD_IMAGE_HEIGHT_PIXELS ; 22 pixels wide x 16 pixels high ; n.b. image is not symmetrical! shieldImage DB %01111111, %11111111, %11111000 DB %11111111, %11111111, %11111100 DB %11101010, %10101010, %01011100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11011111, %11111111, %11101100 DB %11010111, %11111111, %11101100 DB %11010111, %11111111, %10101100 DB %11010111, %11111111, %10101100 DB %11010111, %11111111, %10101100 DB %11010111, %11111111, %10101100 DB %01111111, %11111111, %11111000 ASSERT $-shieldImage == SHIELD_IMAGE_SIZE_BYTES SHIELD_COUNT EQU 4 SHIELD0_X_ULA_SPACE EQU 32 ; ULA x coord of left most shield SHIELD_SPACING_X EQU 52 ; from left hand side to left hand side SHIELD1_X_ULA_SPACE EQU SHIELD0_X_ULA_SPACE + SHIELD_SPACING_X SHIELD2_X_ULA_SPACE EQU SHIELD1_X_ULA_SPACE + SHIELD_SPACING_X SHIELD3_X_ULA_SPACE EQU SHIELD2_X_ULA_SPACE + SHIELD_SPACING_X SHIELD0_X_SCREEN_SPACE EQU 32 + SHIELD0_X_ULA_SPACE ; screen-space x coord of left-most shield SHIELD1_X_SCREEN_SPACE EQU 32 + SHIELD1_X_ULA_SPACE SHIELD2_X_SCREEN_SPACE EQU 32 + SHIELD2_X_ULA_SPACE SHIELD3_X_SCREEN_SPACE EQU 32 + SHIELD3_X_ULA_SPACE ; screen-space x coord of right-most shield SHIELD_Y_ULA_SPACE EQU 160 ; all shields are at the same height SHIELD_Y_SCREEN_SPACE EQU 32 + SHIELD_Y_ULA_SPACE ; Shield hitboxes in sprite screen space (ULA space with extra 32 pixel border around it) shieldHitboxes Hitbox { SHIELD0_X_SCREEN_SPACE, SHIELD0_X_SCREEN_SPACE + SHIELD_IMAGE_WIDTH_PIXELS - 1, ; x0, x1 (left shield) SHIELD_Y_SCREEN_SPACE, SHIELD_Y_SCREEN_SPACE + SHIELD_IMAGE_HEIGHT_PIXELS - 1 } ; y0, y1 ; y0, y1 Hitbox { SHIELD1_X_SCREEN_SPACE, SHIELD1_X_SCREEN_SPACE + SHIELD_IMAGE_WIDTH_PIXELS - 1, SHIELD_Y_SCREEN_SPACE, SHIELD_Y_SCREEN_SPACE + SHIELD_IMAGE_HEIGHT_PIXELS - 1 } Hitbox { SHIELD2_X_SCREEN_SPACE, SHIELD2_X_SCREEN_SPACE + SHIELD_IMAGE_WIDTH_PIXELS - 1, SHIELD_Y_SCREEN_SPACE, SHIELD_Y_SCREEN_SPACE + SHIELD_IMAGE_HEIGHT_PIXELS - 1 } Hitbox { SHIELD3_X_SCREEN_SPACE, SHIELD3_X_SCREEN_SPACE + SHIELD_IMAGE_WIDTH_PIXELS - 1, ; right shield SHIELD_Y_SCREEN_SPACE, SHIELD_Y_SCREEN_SPACE + SHIELD_IMAGE_HEIGHT_PIXELS - 1 } ASSERT $-shieldHitboxes == (SHIELD_COUNT * Hitbox) ; colour vertical strip of the ULA screen SHIELD_Y0_ULA_ATTRIBUTE_SPACE EQU SHIELD_Y_ULA_SPACE / 8 ; 8 pixels per byte SHIELD_Y1_ULA_ATTRIBUTE_SPACE EQU (SHIELD_Y_ULA_SPACE + SHIELD_IMAGE_HEIGHT_PIXELS - 1) / 8 ; 8 pixels per byte SHIELD_HEIGHT_ATTRIBUTE_SPACE EQU SHIELD_Y1_ULA_ATTRIBUTE_SPACE - SHIELD_Y0_ULA_ATTRIBUTE_SPACE + 1 SHIELD_ATTRIBUTES_START_ADDRESS EQU ULA_ATTRIBUTES_ADDRESS + (SHIELD_Y0_ULA_ATTRIBUTE_SPACE * ULA_ATTRIBUTES_WIDTH_BYTES) SHIELD_ATTRIBUTES_SIZE_BYTES EQU ULA_ATTRIBUTES_WIDTH_BYTES * SHIELD_HEIGHT_ATTRIBUTE_SPACE ; In a one player game the shield pixel state is stored directly on screen in the ULA ; bitmap data. In a two player game the shield pixel state needs to be stored per-player. ; While a player is playing the state is in the ULA. When the game switches player the ULA ; data is copied into the outgoing player's off screen buffer, and the incoming player's ; off-screen buffer is copied back into the ULA memory player1ShieldBitmaps DS SHIELD_IMAGE_SIZE_BYTES * SHIELD_COUNT player2ShieldBitmaps DS SHIELD_IMAGE_SIZE_BYTES * SHIELD_COUNT ;---------------------------------------------------------------------------------------- ; ; Draws all four shields to the ULA screen ; Modifies: AF, BC, DE, HL, IX, IY ; RestoreFullShields: ; TODO: Could put this in a loop to save few bytes ld hl,shieldImage ld a,SHIELD0_X_ULA_SPACE call drawShieldBitmap ld hl,shieldImage ld a,SHIELD1_X_ULA_SPACE call drawShieldBitmap ld hl,shieldImage ld a,SHIELD2_X_ULA_SPACE call drawShieldBitmap ld hl,shieldImage ld a,SHIELD3_X_ULA_SPACE call drawShieldBitmap ; set attribute cell values for the vertical strip of the screen containing the shields ld a,ATTR_PAPER_BLACK|ATTR_INK_WHITE ; n.b. not bright ld hl,SHIELD_ATTRIBUTES_START_ADDRESS ld de,SHIELD_ATTRIBUTES_START_ADDRESS+1 ld (hl),a ; set first attribute ld bc,SHIELD_ATTRIBUTES_SIZE_BYTES-1 ; number of attributes to loop over ldir ; set the rest ld a,$0f ; set bits 0-3 to indicate that shields 0-3 are intact ld (shieldState),a ret ; ; HL = address of off-screen buffer (array) ; Modifies: AF, BC, DE, HL, IX, IY ; StoreShields: push hl ld a,SHIELD0_X_ULA_SPACE call copyShieldULAToBuffer pop hl add hl,SHIELD_IMAGE_SIZE_BYTES push hl ld a,SHIELD1_X_ULA_SPACE call copyShieldULAToBuffer pop hl add hl,SHIELD_IMAGE_SIZE_BYTES push hl ld a,SHIELD2_X_ULA_SPACE call copyShieldULAToBuffer pop hl add hl,SHIELD_IMAGE_SIZE_BYTES ld a,SHIELD3_X_ULA_SPACE call copyShieldULAToBuffer ret DrawPlayer1Shields: ld hl,player1ShieldBitmaps jp drawBufferedShields DrawPlayer2Shields: ld hl,player2ShieldBitmaps jp drawBufferedShields ; ; HL = address of off-screen buffer (array) ; Modifies: AF, BC, DE, HL, IX, IY ; drawBufferedShields: push hl ld a,SHIELD0_X_ULA_SPACE call drawShieldBitmap pop hl add hl,SHIELD_IMAGE_SIZE_BYTES push hl ld a,SHIELD1_X_ULA_SPACE call drawShieldBitmap pop hl add hl,SHIELD_IMAGE_SIZE_BYTES push hl ld a,SHIELD2_X_ULA_SPACE call drawShieldBitmap pop hl add hl,SHIELD_IMAGE_SIZE_BYTES ld a,SHIELD3_X_ULA_SPACE call drawShieldBitmap ret ; ; Draws a shield to the ULA bitmap at a specified pixel coordinate ; ; n.b. The shield image is 3 bytes wide, but when not 8 pixel aligned in x it requires ; four bytes to be written to screen ; ; HL = shield bitmap image data, which could be either hardcoded or per-player data ; A = ULA x coord ; Modifies: AF, BC, DE, HL, IX, IY ; drawShieldBitmap: push hl ; push image address ld e,a ; E <- ULA x coord ld d,SHIELD_Y_ULA_SPACE ; D <- ULA y coord pixelad ; HL <- ULA pixel address ; calculate and store the right bit shift value [0,7] and 7 ; keep lower 3 bits ld ixl,a ; IXL <- shift value pop de ; DE <- address of image ld b,SHIELD_IMAGE_HEIGHT_PIXELS ; row loop counter .rowLoop ; 22 horizontal pixels requires three bytes storage but when shifted right it can require up ; to four bytes to be written to the screen. ; Use C, D, E and A for the four bytes. ld a,(de) ; A <- first byte ld c,a ; C <- first byte inc de ; advance DE to second byte ld a,(de) ; A <- second byte ld iyh,a ; IYH <- second byte inc de ; advance DE to third byte ld a,(de) ; A <- third byte ld iyl,a ; IYL <- third byte inc de ; advance DE to next row of image data push de ld d,iyh ; D <- second byte ld e,iyl ; E <- third byte ; do we need to shift right? ld a,ixl ; A <- right bit shift value and a ; set Z flag if shift is 0 jp z,.noshift ; jump if no shift required n.b. A (right byte) will be zero ; shift ld ixh,b ; IXH <- row loop count ld b,a ; B <- right shift count (loop count) xor a ; A <- 0, CF <- 0 .shiftLoop rr c ; rotate zero into bit 7 of C and bit 0 of C into CF rr d ; rotate CY into bit 7 of D and bit 0 of D into CF rr e ; rotate CY into bit 7 of E and bit 0 of E into CF rra ; rotate CY into bit 7 of A and 0 into CF (A initialised to zero) djnz .shiftLoop ld b,ixh ; B <- row loop count .noshift ; write the four bytes to screen ld (hl),c ; write first byte to screen inc hl ; step right ld (hl),d ; write second byte to screen inc hl ; step right ld (hl),e ; write third byte to screen inc hl ; step right ld (hl),a ; write fourth byte to screen add hl,-3 ; step back to first byte pixeldn ; step down pop de ; DE <- address of next row of sprite data djnz .rowLoop ret ; ; Erases a shield from the ULA bitmap screen ; A = ULA x coord ; Modifies: AF, B, DE, HL ; eraseShieldBitmap: ; Shield x pos means it straddles wither 3 or 4 bytes horizontally ; There's nothing inbeteen right now, so let's just clear 4 bytes per row ld e,a ; A <- ULA x coord ld d,SHIELD_Y_ULA_SPACE pixelad ; HL <- address of top-left byte xor a ; A <- 0 ld b,SHIELD_IMAGE_HEIGHT_PIXELS ; row loop counter .loop ld e,l ; E <- low byte of ULA address (no need to store high byte because doesn't change in a row) ld (hl),a ; clear first byte of row inc hl ld (hl),a ; clear second byte of row inc hl ld (hl),a ; clear third byte of row inc hl ld (hl),a ; clear fourth byte of row ld l,e ; L <- low byte of first byte pixeldn ; HL <- address of first byte on next row djnz .loop ret ; ; A = shield x coord (ULA space) ; HL = address of off-screen buffer of size SHIELD_IMAGE_SIZE_BYTES ; Modifies: AF, BC, DE, HL, IX, IY ; copyShieldULAToBuffer: push hl ; IX <- address of buffer .. pop ix ; .. (using Index Registers is slow, but this isn't performance-critical) ld e,a ; E <- ULA x coord ld d,SHIELD_Y_ULA_SPACE ; D <- ULA y coord pixelad ; HL <- ULA pixel address ; calculate offset into ULA bitmap byte and 7 ; A <- x & 7 ld iyh,a ; IYH <- x & 7 ; SHIELD_IMAGE_WIDTH_BYTES == 3 so if (x & 7) > 0 then need to read 4 ULA bytes ; We read a pair from left to right three times, shifting left by the shield's x&7 offset ; and storing a byte into the off-screen buffer ; n.b. This does not clip so may fail if shield against right screen edge ASSERT SHIELD_IMAGE_WIDTH_BYTES == 3 ; code assumes this ld b,SHIELD_IMAGE_HEIGHT_PIXELS .loopY push hl ; push ULA bitmap byte address ; load first ULA bytes into DE ld d,(hl) inc l ; next horizontal byte push bc ; push loopY counter ld b,3 ; B <- loopX counter - read 3 pairs of bytes per row .loopX ld c,b ; C <- loopX counter ; load next byte to the right ld e,(hl) inc l ; ulaBitmapAddress++ ; barrel shift left (Z80N instruction) ld iyl,e ; preserve second byte for next iteration ld b,iyh ; B <- shift bsla de,b ; DE <- DE << b ; store in off-screen buffer ld (ix+0),d ; store byte in buffer inc ix ; pBuffer++ ld d,iyl ; D <- next byte over for next iteration (rotate) ; next byte in row ld b,c ; B <- loopX counter djnz .loopX ; next row pop bc ; BC <- loopY counter pop hl ; HL <- ULA coord pixeldn ; HL <- next row down djnz .loopY ; next row ret ; 2D Gaussian kernel to use a destruction pattern ; Generated at http://dev.theomader.com/gaussian-kernel-calculator/ with sigma=2.0 ; Designed to do maximum damage at hitpoint and less with increasing distance ; Almost certainly overkill gaussianKernel7x7: DB 28,52, 75, 85, 75, 52, 28 DB 52,96, 139,157,139,96, 52 DB 75,139,200,227,200,139,75 DB 85,157,227,255,227,157,85 DB 75,139,200,227,200,139,75 DB 52,96, 139,157,139,96, 52 DB 28,52, 75, 85, 75, 52, 28 ASSERT $ - gaussianKernel7x7 == 7*7 ; ; E = point of impact ULA x coord ; D = point of impact ULA y coord ; Modifies: AF, BC, DE, HL, IXH ; BlowHoleInShields: ; Affect pixels in a 7x7 square centred around around the point of impact ; Remove the pixels pseudo-randomly using a 2D Gaussian kernel for more damage near centre. dec d ; y -=3 dec d ; .. dec d ; .. dec e ; x -= 3 dec e ; .. dec e ; .. ld hl,gaussianKernel7x7 ld ixl,e ; store x0 for looping ld ixh,7 ; y loop counter .loopY ld e,ixl ; E <- x0 ld b,7 ; x loop counter .loopX call CalcRandomByte ; A <- random byte ld c,a ; C <- random ld a,(hl) ; A <- Gaussian 7x7 filter kernel element value inc hl ; next kernel element cp c ; kernel - random, set CF if random > kernel jp c,.nextX ; jumpf and leave pixel intact if random > kernel ; clear the pixel push hl ; push kernel address pixelad ; HL <- ULA pixel address ld c,(hl) ; C <- shield pixels setae ; HL <- pixel mask e.g. 00010000 cpl ; A <= ~A e.g. 11101111 and c ; C <- shield pixels with pixel removed ld (hl),a ; write ULA byte pop hl ; HL <- kernel address .nextX inc e ; x++ djnz .loopX dec ixh ld b,ixh inc d ; y++ djnz .loopY ret ; ; Erases a shield image from the ULA bitmap and resets its "intact" bit ; A = value with bit set for shield index to erase e.g. $1 = shield 0, $2 = shield 1, $4 = shield 2, $8 = shield 3 ; Modifies: AF, B, DE, HL ; DestroyShield: ; reset the active bit for this shield ld b,a ; store original value cpl ; invert bits ld hl,shieldState and (hl) ; shieldState &= ~shieldBit ld (hl),a ld a,b cp 1 jp z,eraseShield0Bitmap cp 2 jp z,eraseShield1Bitmap cp 4 jp z,eraseShield2Bitmap cp 8 jp z,eraseShield3Bitmap ret eraseShield0Bitmap: ld a,SHIELD0_X_ULA_SPACE call eraseShieldBitmap ret eraseShield1Bitmap: ld a,SHIELD1_X_ULA_SPACE call eraseShieldBitmap ret eraseShield2Bitmap: ld a,SHIELD2_X_ULA_SPACE call eraseShieldBitmap ret eraseShield3Bitmap: ld a,SHIELD3_X_ULA_SPACE call eraseShieldBitmap ret ; ; Erases the bitmap image data from the ULA screen for all shields ; Modifies: AF, B, DE, HL ; EraseAllShieldBitmaps: ld a,SHIELD0_X_ULA_SPACE call eraseShieldBitmap ld a,SHIELD1_X_ULA_SPACE call eraseShieldBitmap ld a,SHIELD2_X_ULA_SPACE call eraseShieldBitmap ld a,SHIELD3_X_ULA_SPACE call eraseShieldBitmap ret
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_aaddr2cy_fastcall.asm
jpoikela/z88dk
640
99946
; uchar tshc_aaddr2cy(void *aaddr) SECTION code_clib SECTION code_arch PUBLIC _tshc_aaddr2cy_fastcall EXTERN _zx_saddr2cy_fastcall defc _tshc_aaddr2cy_fastcall = _zx_saddr2cy_fastcall
programs/cpu.asm
jonicho/joke16
0
168224
#bits 16 #subruledef reg { ra => 0`3 rb => 1`3 rc => 2`3 rd => 3`3 rx => 4`3 ry => 5`3 bp => 6`3 sp => 7`3 } #subruledef addr_mode { {reg: reg} => 0b00 @ reg [{reg: reg}] => 0b01 @ reg [{reg: reg}+{offset: i16}] => { assert(offset==0) 0b01 @ reg } [{reg: reg}-{offset: i16}] => { assert(offset==0) 0b01 @ reg } [{reg: reg}+{offset: i16}] => { assert(offset!=0) offset @ 0b10 @ reg } [{reg: reg}-{offset: i16}] => { assert(offset!=0) (-offset)`16 @ 0b10 @ reg } [{addr: u16}] => addr @ 0b11000 {val: i16} => val @ 0b11001 } #subruledef addr_mode_dest { {dest: addr_mode} => { assert(dest`5 != 0b11001) dest } } #subruledef condition { {} => 0b000 @ 0b0 ; always z => 0b001 @ 0b0 ; zero c => 0b010 @ 0b0 ; carry n => 0b011 @ 0b0 ; negative o => 0b100 @ 0b0 ; overflow be => 0b101 @ 0b0 ; below or equal (not carry or zero) l => 0b110 @ 0b0 ; less than (overflow != negative) le => 0b111 @ 0b0 ; less than or equal ((overflow != negative) or zero) nz => 0b001 @ 0b1 ; not zero nc => 0b010 @ 0b1 ; not carry nn => 0b011 @ 0b1 ; not negative no => 0b100 @ 0b1 ; not overflow a => 0b101 @ 0b1 ; above (not zero and carry) ge => 0b110 @ 0b1 ; greater than or equal (overflow == negative) g => 0b111 @ 0b1 ; greater than ((overflow == negative) and not zero) e => 0b001 @ 0b0 ; equal (zero) ne => 0b001 @ 0b1 ; not equal (not zero) ae => 0b010 @ 0b0 ; above or equal (carry) b => 0b010 @ 0b1 ; below (not carry) } #ruledef { reset => 0`16 ; resets the cpu nop => 1`16 ; no operation } #ruledef mov { ; moves the value at src to dest if condition is true mov{cond: condition} {dest: addr_mode_dest}, {src: addr_mode} => { assert(dest != src) assert(dest`5 < 0b10000 && src`5 < 0b10000) 0b00 @ dest`5 @ src`5 @ cond`4 } mov{cond: condition} {dest: addr_mode_dest}, {src: addr_mode} => { assert(dest != src) assert(dest`5 < 0b10000 && src`5 >= 0b10000) 0b00 @ dest`5 @ src`5 @ cond`4 @ src[20:5] } mov{cond: condition} {dest: addr_mode_dest}, {src: addr_mode} => { assert(dest != src) assert(dest`5 >= 0b10000 && src`5 < 0b10000) 0b00 @ dest`5 @ src`5 @ cond`4 @ dest[20:5] } mov{cond: condition} {dest: addr_mode_dest}, {src: addr_mode} => { assert(dest != src) assert(dest`5 >= 0b10000 && src`5 >= 0b10000) 0b00 @ dest`5 @ src`5 @ cond`4 @ src[20:5] @ dest[20:5] } } #ruledef push { ; pushes the value at src onto the stack if condition is true push{cond: condition} {src: addr_mode} => { assert(src`5 < 0b10000) 0b00 @ 0b11010 @ src`5 @ cond`4 } push{cond: condition} {src: addr_mode} => { assert(src`5 >= 0b10000) 0b00 @ 0b11010 @ src`5 @ cond`4 @ src[20:5] } push{cond: condition} fr => { 0b00 @ 0b11010 @ 0b11100 @ cond`4 } } #ruledef pop { ; pops a value off the stack into dest pop{cond: condition} {dest: addr_mode_dest} => { assert(dest`5 < 0b10000) 0b00 @ dest`5 @ 0b11011 @ cond`4 } pop{cond: condition} {dest: addr_mode_dest} => { assert(dest`5 >= 0b10000) 0b00 @ dest`5 @ 0b11011 @ cond`4 @ dest[20:5] } pop{cond: condition} fr => { 0b00 @ 0b11100 @ 0b11011 @ cond`4 } } #ruledef jmp { ; jumps to addr if condition is true jmp{cond: condition} {addr: addr_mode} => { assert(addr`5 < 0b10000) 0b00 @ 0b11101 @ addr`5 @ cond`4 } jmp{cond: condition} {addr: addr_mode} => { assert(addr`5 >= 0b10000) 0b00 @ 0b11101 @ addr`5 @ cond`4 @ addr[20:5] } jmp{cond: condition} pc+{offset: i16} => { 0b00 @ 0b11101 @ 0b11110 @ cond`4 @ offset } } #ruledef call { ; calls the subroutine at addr if condition is true call{cond: condition} {addr: addr_mode} => { assert(addr`5 < 0b10000) 0b00 @ 0b11111 @ addr`5 @ cond`4 } call{cond: condition} {addr: addr_mode} => { assert(addr`5 >= 0b10000) 0b00 @ 0b11111 @ addr`5 @ cond`4 @ addr[20:5] } call{cond: condition} pc+{offset: i16} => { 0b00 @ 0b11111 @ 0b11110 @ cond`4 @ offset } } #ruledef ret { ; returns from subroutine if condition is true ret{cond: condition} => { 0b00 @ 0b11101 @ 0b11011 @ cond`4 } } #subruledef flag { z => 0 ; zero flag c => 1 ; carry flag n => 2 ; negative flag o => 3 ; overflow flag i => 4 ; interrupt enable flag } #ruledef { set{flag: flag} => ; sets the flag 0b01 @ 0`9 @ 0b1 @ flag`3 @ 0b0 clear{flag: flag} => ; clears the flag 0b01 @ 0`9 @ 0b0 @ flag`3 @ 0b0 } #ruledef test { ; sets zero and negative flags based on the value in src test {src: addr_mode} => { assert(src`5 < 0b10000) 0b011 @ 0`7 @ src`5 @ 0b0 } test {src: addr_mode} => { assert(src`5 >= 0b10000) 0b011 @ 0`7 @ src`5 @ 0b0 @ src[20:5] } } ; binary alu instructions: ; performs a binary alu operation on op0 and op1 and saves the result in op0 ; operations with the postfix "_r" have a reversed operand order while the result is still saved in op1 #subruledef alu_op_binary { add => 0 ; op0 <- op0 + op1 addc => 1 ; op0 <- op0 + op1 + c sub => 2 ; op0 <- op0 - op1 sub_r => 3 ; op0 <- op1 - op0 subc => 4 ; op0 <- op0 - op1 - c subc_r => 5 ; op0 <- op1 - op0 - c and => 6 ; op0 <- op0 & op1 or => 7 ; op0 <- op0 | op1 xor => 8 ; op0 <- op0 ^ op1 nand => 9 ; op0 <- ~(op0 & op1) nor => 10 ; op0 <- ~(op0 | op1) nxor => 11 ; op0 <- ~(op0 ^ op1) cmp => 12 ; op0 - op1 (no result is saved, only affects flags) cmp_r => 13 ; op1 - op0 (no result is saved, only affects flags) bits => 14 ; op0 & op1 (no result is saved, only affects flags) } #ruledef { {alu_op: alu_op_binary} {op0: addr_mode_dest}, {op1: addr_mode} => { assert(op0`5 < 0b10000 && op1`5 < 0b10000) 0b1 @ alu_op`4 @ op0`5 @ op1`5 @ 0b0 } {alu_op: alu_op_binary} {op0: addr_mode_dest}, {op1: addr_mode} => { assert(op0`5 < 0b10000 && op1`5 >= 0b10000) 0b1 @ alu_op`4 @ op0`5 @ op1`5 @ 0b0 @ op1[20:5] } {alu_op: alu_op_binary} {op0: addr_mode_dest}, {op1: addr_mode} => { assert(op0`5 == 0b11000 && op1`5 < 0b10000) 0b1 @ alu_op`4 @ op0`5 @ op1`5 @ 0b0 @ op0[20:5] } {alu_op: alu_op_binary} {op0: addr_mode_dest}, {op1: addr_mode} => { assert(op0`5 == 0b11000 && op1`5 >= 0b10000) 0b1 @ alu_op`4 @ op0`5 @ op1`5 @ 0b0 @ op1[20:5] @ op0[20:5] } } ; shift instructions: ; shifts the value in op by the specified amount and saves the result back in op #subruledef alu_op_shift { shl => 0 ; shift left rol => 1 ; rotate left rolc => 2 ; rotate left through carry shrl => 3 ; shift right logical shra => 4 ; shift right arithmetic ror => 5 ; rotate right rorc => 6 ; rotate right through carry } #ruledef { {alu_op: alu_op_shift} {op: addr_mode_dest} => { assert(op`5 < 0b10000) 0b1 @ 0b1111 @ alu_op`3 @ 0b00 @ op`5 @ 0b0 } {alu_op: alu_op_shift} {op: addr_mode_dest} => { assert(op`5 >= 0b10000) 0b1 @ 0b1111 @ alu_op`3 @ 0b00 @ op`5 @ 0b0 @ op[20:5] } {alu_op: alu_op_shift} {op: addr_mode_dest}, {amount: u4} => { assert(amount >= 1 && amount <= 4) assert(op`5 < 0b10000) 0b1 @ 0b1111 @ alu_op`3 @ (amount-1)`2 @ op`5 @ 0b0 } {alu_op: alu_op_shift} {op: addr_mode_dest}, {amount: u4} => { assert(amount >= 1 && amount <= 4) assert(op`5 >= 0b10000) 0b1 @ 0b1111 @ alu_op`3 @ (amount-1)`2 @ op`5 @ 0b0 @ op[20:5] } } ; unary alu instructions: ; performs a unary alu operation on op and saves the result in op #subruledef alu_op_unary { not => 0 ; op <- ~op neg => 1 ; op <- -op inc => 2 ; op <- op + 1 dec => 3 ; op <- op - 1 } #ruledef { {alu_op: alu_op_unary} {op: addr_mode_dest} => { assert(op`5 < 0b10000) 0b1 @ 0b1111 @ 0b111 @ alu_op`2 @ op`5 @ 0b0 } {alu_op: alu_op_unary} {op: addr_mode_dest} => { assert(op`5 >= 0b10000) 0b1 @ 0b1111 @ 0b111 @ alu_op`2 @ op`5 @ 0b0 @ op[20:5] } }
oeis/017/A017133.asm
neoneye/loda-programs
11
22474
; A017133: a(n) = (8*n + 5)^9. ; 1953125,10604499373,794280046581,14507145975869,129961739795077,756680642578125,3299763591802133,11694146092834141,35452087835576229,95151694449171437,231616946283203125,520411082988487293,1093685272684360901,2171893279442309389,4108400332687853397,7450580596923828125,13021612539908538853,22027845102081762861,36197319879620191349,57955795548021664957,90647430472564453125,138808137876363860813,208500535066053616021,307720364049353798109,446885265417950510117,639417840613205078125 mul $0,8 add $0,5 pow $0,9
oeis/141/A141978.asm
neoneye/loda-programs
11
14517
<filename>oeis/141/A141978.asm<gh_stars>10-100 ; A141978: Primes congruent to 2 mod 29. ; Submitted by <NAME>(s1) ; 2,31,89,263,379,727,1249,1307,1423,1481,1597,2003,2293,2351,2467,2699,3163,3221,3511,3917,4091,4729,4787,4903,5077,5309,5483,5657,6121,6353,6469,6701,6991,7687,7919,8093,8209,8731,8963,9137,9311,9601,9833,9949,10007,10181,10529,10993,11399,11689,11863,12037,12211,12269,12791,12907,13313,13487,14009,14821,14879,15053,15227,15401,15749,15923,16097,16561,16619,17257,17431,17489,17837,18127,18301,19403,19577,19751,19867,20389,20563,21143,21317,21433,21491,21839,22013,22129,22303,22651,22709,23057 lpb $0 sub $0,1 mov $2,$0 mov $0,0 max $2,0 seq $2,108978 ; Numbers k such that 29*k + 31 is prime. add $3,$2 add $4,$3 add $4,1 lpe mov $0,$4 mul $0,29 add $0,2
oeis/022/A022536.asm
neoneye/loda-programs
11
243062
<gh_stars>10-100 ; A022536: Nexus numbers (n+1)^20 - n^20. ; 1,1048575,3485735825,1096024843375,94267920012849,3560791008422351,76136107857549025,1073129238309234975,11004743954450081825,87842334540943071199,572749994932560009201,3161009997514915112975,15171203782433324316625,64663291650404002121775,248857417582680286330049,876400146606664086815551,2855305587032943347695425,8684004809748505652035775,24841737241149880018918225,67267626542454041806644399,173360829446951548637196401,427211069239452495570751375,1010726332648182298715947425 sub $2,$0 add $0,1 pow $0,20 pow $2,20 sub $0,$2
test/Succeed/TacticModality.agda
cruhland/agda
1,989
15316
module _ where open import Agda.Builtin.Reflection open import Agda.Builtin.Unit open import Agda.Builtin.Nat open import Agda.Builtin.Equality variable A : Set super-tac : Term → TC ⊤ super-tac hole = unify hole (lit (nat 101)) solver : Nat → Term → TC ⊤ solver n hole = unify hole (lit (nat (n + 1))) foo : {@(tactic super-tac) n : Nat} {@(tactic solver n) x : A} → A foo {n = n} {x = x} = x number : Nat number = foo check : number ≡ 102 check = refl
controller/drv-isr.asm
eyalabraham/differential-pan-tilt
1
18480
<gh_stars>1-10 ; ;===================================================== ; file: drv-isr.asm ; ; Large (memory model) stepper motor driver interrupt routine. ; NOTE: ; - Assumes IDB is default 0ffh ; - IO ports are configured for the application ; ; * Port-0 bit assignment ; * ; * b7 b6 b5 b4 b3 b2 b1 b0 ; * | | | | | | | | ; * | | | | | | | +--- 'o' Pan step pulse ; * | | | | | | +------ 'o' Pan direction 0=CW, 1=CCW ; * | | | | | +--------- 'o' Tilt step pulse ; * | | | | +------------ 'o' Tilt direction 0=CW, 1=CCW ; * | | | +--------------- 'i' ; * | | +------------------ 'i' ; * | +--------------------- 'i' ; * +------------------------ 'o' Interrupt time-base test point ; * ; * Port-2 bit assignment ; * ; * b7 b6 b5 b4 b3 b2 b1 b0 ; * | | | | | | | | ; * | | | | | | | +--- 'o' Pan MS0 00=1/4, 10=1/8, 11=1/16 ; * | | | | | | +------ 'o' MS1 ; * | | | | | +--------- 'o' Tilt MS0 00=1/4, 10=1/8, 11=1/16 ; * | | | | +------------ 'o' MS1 ; * | | | +--------------- 'i' ; * | | +------------------ 'i' ; * | +--------------------- 'i' ; * +------------------------ 'i' A/D SSTB (A/D pin.16) ; ; April 2020 - Created ; ;===================================================== ; .8086 .model small ; ;---------------------------------------- ; Externals ;---------------------------------------- ; extern _timer_ticks : word ; Timer tick uint16_t extern _motors : word ; Array of motor_t structure ; ;---------------------------------------- ; Motor data structure ;---------------------------------------- ; stepctrl_t struct ; C-type rate dw ? ; (int ) Motor run rate steps per second [1..RATE_LIMIT] isr_rate dw ? ; (uint16_t) ISR step pulse cycle counter dw ? ; (uint16_t) Motor is stepped when counter == 0, decrement every time ISR runs dir dw ? ; (int ) Direction, '-1' to CCW, '+1' to CW, '0' stop steps dw ? ; (int ) Steps to move, if '-1' then move until stopped or limit reached curr_pos dw ? ; (int ) Current position limit_high dw ? ; (int ) High limit step count limit_low dw ? ; (int ) Low limit step count step_ctrl_bit db ? ; (uint8_t ) Motor driver 'step' IO pin dummy db ? ; (uint8_t ) Alignment byte ; stepctrl_t ends ; ;---------------------------------------- ; IO ;---------------------------------------- ; PORT0 equ 000h PORT1 equ 008h PORT2 equ 010h MOTOR_COUNT equ 2 HEARTBEAT_SET equ 080h HEARTBEAT_CLR equ 07fh ; ;---------------------------------------- ; End-Of-Interrupt macro ; Signals NEC V25 interrupt controller of an EOI ;---------------------------------------- ; FINT macro db 0fh db 092h endm ; ; .code assume ds:DGROUP, ss:nothing, es:nothing ; ;===================================================== ; driver_isr_ ; ; Interrupt service routine. ; Invoked every clock tick and sequences stepper motors. ; ; Measured timing profile @ 5,000Hz interrupt clock rate: ; 200uSec repetition interval ; 20uSec minimum execution time (10%) ; 75uSec maximum execution time (38%) ; ;===================================================== ; public driver_isr_ ; driver_isr_ proc far ; push ax push cx push si push di push es ; mov di, 0f000h ; [ES:DI] pointer to NEC V25 SFR mov es, di mov di, 0ff00h ; or byte ptr es:[di+PORT0], HEARTBEAT_SET ; Set heartbeat line ; inc _timer_ticks ; Increment timer ticks ; mov si, offset _motors mov cx, MOTOR_COUNT motor_loop: cmp word ptr [si+dir], 0 ; When 'dir' is 0 then motor should not move jz next_motor ; dec word ptr [si+counter] ; When a motor's 'counter' is 0 it is time to move one step jnz next_motor ; No move at this time slot ; ; Check position against limits 'limit_high' and 'limit_low' ; TODO This level of protection is not sufficient and requires actively ; moving the motor back into safe limits. Active step back is ; required after stopping the motor specifically for the tilt axis ; that is linked to the pan movement. ; mov ax, word ptr [si+curr_pos] ; Get current position cmp ax, word ptr [si+limit_high] ; Compare position to high limit jg over_high_limit cmp ax, word ptr [si+limit_low] ; Compare position to lower limit jl under_low_limit jmp check_step_count ; Within high/low limits, continue over_high_limit: cmp word ptr [si+dir], 0 jl check_step_count ; Allow motor to move if direction is CCW (dir = -1) mov word ptr [si+dir], 0 ; otherwise stop motor jmp next_motor under_low_limit: cmp word ptr [si+dir], 0 jg check_step_count ; Allow motor to move if direction is CW (dir = +1) mov word ptr [si+dir], 0 ; otherwise stop motor jmp next_motor ; ; If a 'step' count was specified then only move that number of steps until the value is 0. ; Decrement step count if 'steps' were specified (i.e. 'steps' != -1) ; check_step_count: cmp word ptr [si+steps], 0 jl move_motor ; Steps is '-1', no step limit, skip everything jg have_step_count ; Steps specified, go update step count mov word ptr [si+dir], 0 ; Limit reached, stop motor jmp next_motor ; have_step_count: dec word ptr [si+steps] ; Decrement step count ; ; Move the motor one step ; Direction is already set on the port pins outside of the ISR ; move_motor: mov al, byte ptr [si+step_ctrl_bit] ; Get 'step' bit position or byte ptr es:[di+PORT0], al ; Set A4988 step bit (can also do XOR) not al ; a little bit of delay and byte ptr es:[di+PORT0], al ; Clear A4988 step bit ; ; Update motor position ; mov ax, word ptr [si+curr_pos] ; Adjust current motor position add ax, word ptr [si+dir] ; as a relative step count mov word ptr [si+curr_pos], ax ; ; Special handling on tilt position ; In a differential drive, panning steps cause tilt steps in the opposite direction ; cmp cx, 2 ; Did we just update the pan motor? jne not_pan_motor ; No, skip tilt step position adjustment mov ax, word ptr [si+dir] ; Yes, get pan direction neg ax ; and reverse it add ax, word ptr [si+(sizeof stepctrl_t)+curr_pos] ; Adjust the tilt step position mov word ptr [si+(sizeof stepctrl_t)+curr_pos], ax ; ; Refresh 'counter' based on movement calculated 'isr_rate' ; not_pan_motor: mov ax, word ptr [si+isr_rate] ; Get step rate counter mov word ptr [si+counter], ax ; and refresh counter ; next_motor: add si, sizeof stepctrl_t loop motor_loop ; and byte ptr es:[di+PORT0], HEARTBEAT_CLR ; Clear heartbeat line ; pop es pop di pop si pop cx pop ax ; FINT iret ; driver_isr_ endp ; end
src/Examples/Gcd/Euclid.agda
jonsterling/agda-calf
29
5078
<gh_stars>10-100 {-# OPTIONS --prop --rewriting #-} module Examples.Gcd.Euclid where open import Calf.CostMonoid import Calf.CostMonoids as CM {- This file defines the parameters of the analysis of Euclid's algorithm for gcd and its cost recurrence relation. -} open import Calf CM.ℕ-CostMonoid open import Calf.Types.Nat open import Data.Nat open import Relation.Binary.PropositionalEquality as P open import Induction.WellFounded open import Induction open import Data.Nat.Properties open import Data.Nat.DivMod open import Relation.Nullary.Decidable using (False) open import Data.Nat.Induction using (<-wellFounded) open import Data.Product open import Agda.Builtin.Nat using (div-helper; mod-helper) open import Relation.Binary using (Rel) open import Relation.Unary using (Pred; _⊆′_) mod-tp : (x y : val nat) → cmp (meta (False (y ≟ 0))) → tp pos mod-tp x y h = Σ++ nat λ z → (U (meta (z ≡ _%_ x y {h}))) mod : cmp ( Π nat λ x → Π nat λ y → Π (U (meta (False (y ≟ 0)))) λ h → F (mod-tp x y h)) mod x y h = step (F (mod-tp x y h)) 1 (ret {mod-tp x y h} (_%_ x y {h} , refl)) gcd/depth/helper : ∀ n → ((m : ℕ) → m < n → (k : ℕ) → (k > m) → ℕ) → (m : ℕ) → (m > n) → ℕ gcd/depth/helper zero h m h' = 0 gcd/depth/helper n@(suc n') h m h' = suc (h (m % n) (m%n<n m n') n (m%n<n m n')) gcd/i = Σ++ nat λ x → Σ++ nat λ y → U (meta (x > y)) m>n = val gcd/i gcd/depth : m>n → ℕ gcd/depth (x , (y , g)) = All.wfRec <-wellFounded _ (λ y → (x : ℕ) → x > y → ℕ) gcd/depth/helper y x g gcd/depth/helper-ext : (x₁ : ℕ) {IH IH′ : WfRec _<_ (λ y₁ → (x₂ : ℕ) → x₂ > y₁ → ℕ) x₁} → ({y = y₁ : ℕ} (y<x : y₁ < x₁) → IH y₁ y<x ≡ IH′ y₁ y<x) → gcd/depth/helper x₁ IH ≡ gcd/depth/helper x₁ IH′ gcd/depth/helper-ext zero h = refl gcd/depth/helper-ext (suc x) h = funext λ m → funext λ h1 → P.cong suc ( let g = h {m % suc x} (m%n<n m x) in P.cong-app (P.cong-app g _) _ ) module irr {a r ℓ} {A : Set a} {_<_ : Rel A r} (wf : WellFounded _<_) (P : Pred A ℓ) (f : WfRec _<_ P ⊆′ P) (f-ext : (x : A) {IH IH′ : WfRec _<_ P x} → (∀ {y} y<x → IH y y<x ≡ IH′ y y<x) → f x IH ≡ f x IH′) where some-wfRecBuilder-irrelevant : ∀ x → (q q′ : Acc _<_ x) → Some.wfRecBuilder P f x q ≡ Some.wfRecBuilder P f x q′ some-wfRecBuilder-irrelevant = All.wfRec wf _ ((λ x → (q q′ : Acc _<_ x) → Some.wfRecBuilder P f x q ≡ Some.wfRecBuilder P f x q′)) ((λ { x IH (acc rs) (acc rs') → funext λ y → funext λ h → f-ext y λ {y'} h' → let g = IH y h (rs y h) (rs' y h) in P.cong-app (P.cong-app g y') h' })) gcd/depth-unfold-zero : ∀ {x h} → gcd/depth (x , 0 , h) ≡ 0 gcd/depth-unfold-zero = refl gcd/depth-unfold-suc : ∀ {x y h} → gcd/depth (x , suc y , h) ≡ suc (gcd/depth (suc y , x % suc y , m%n<n x y)) gcd/depth-unfold-suc {x} {y} {h} = P.cong suc ( P.subst (λ ih → gcd/depth/helper (mod-helper 0 y x y) (ih) (suc y) (m%n<n x y) ≡ gcd/depth/helper (mod-helper 0 y x y) (All.wfRecBuilder <-wellFounded _ (λ y₁ → (x₁ : ℕ) → x₁ > y₁ → ℕ) gcd/depth/helper (mod-helper 0 y x y)) (suc y) (m%n<n x y)) (irr.some-wfRecBuilder-irrelevant <-wellFounded (λ y → (x : ℕ) → x > y → ℕ) gcd/depth/helper (gcd/depth/helper-ext) (x % suc y) (<-wellFounded (mod-helper 0 y x y)) (Subrelation.accessible ≤⇒≤′ (Data.Nat.Induction.<′-wellFounded′ (suc y) (mod-helper 0 y x y) (≤⇒≤′ (m%n<n x y))))) refl ) m%n<n' : ∀ m n h → _%_ m n {h} < n m%n<n' m (suc n) h = m%n<n m n
codes/oop/exampleDIV.asm
urandu/oop-assignments
1
88512
;ExampleDIV.ASM THIS program divides large numbers section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point ; display the product ; now divide things ; xor edx, edx; clear edx in case some large number is used in division(edx:eax) mov eax, [v1]; load v1 the dividend into ax mov ecx, [v2]; load v2 the divisor into cx div ecx; perform the division mov [rquotient], eax; save the quotient mov [rremainder], edx; save the remainder ; ;===================Display values================================ ;Display quotient ; the quotient message mov edx,lenQuotient ;message length mov ecx,dispQuotient ;quotient mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; display the actual value of the product mov edx,4 ;message length mov ecx,rquotient ;quotient as a number mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;display new line mov edx,1 ;message length mov ecx,newLine ;carriage return mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; ; display remainder mov edx,lenRemainder ;remainder message length mov ecx,dispRemainder ;remainder mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; remainder as a number mov edx,4 ;message length mov ecx,rremainder ;remainder as a number mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;display new line mov edx,1 ;message length mov ecx,newLine ;carriage return mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; now exit mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel ; section .data newLine db 10 ; carriage return; v1 dd 27d; first number v2 dd 7d; second number ; ;strings for displying values dispQuotient db "The quotient is : "; lenQuotient equ $-dispQuotient; find length dispRemainder db "The remainder is: "; lenRemainder equ $-dispRemainder; find length ; section .bss; for other values- results rquotient resd 1; one byte for storing the quotient rremainder resd 1; one byte for storing the remainder ; end of data section
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_lbb.asm
meesokim/z88dk
0
89570
<filename>libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_lbb.asm SECTION code_stdio PUBLIC __stdio_scanf_lbb EXTERN __stdio_scanf_sm_binary, __stdio_scanf_number_head EXTERN l_inc_sp, asm_strtoul, __stdio_scanf_number_tail_long __stdio_scanf_lbb: ; %lB converter called from vfscanf() ; non-standard, reads binary number ; ; enter : ix = FILE * ; de = void *buffer ; bc = field width (0 means default) ; hl = unsigned long *p ; ; exit : carry set if error ; ; uses : all except ix ; EAT WHITESPACE AND READ NUMBER INTO BUFFER push hl ; save int *p push de ; save void *buffer ld a,35 ; thirty five binary digits + prefix needed to reach overflow ld hl,__stdio_scanf_sm_binary ; binary number state machine call __stdio_scanf_number_head jp c, l_inc_sp - 4 ; if stream error, pop twice and exit ; ASC-II BINARY TO 32-BIT INTEGER pop hl ; hl = void *buffer ld bc,2 ; base 2 conversion ld e,b ld d,b ; de = 0 = char **endp push ix call asm_strtoul ; dehl = long result pop ix pop bc ; bc = long *p ; WRITE RESULT TO UNSIGNED LONG *P jp __stdio_scanf_number_tail_long
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_21829_1689.asm
ljhsiun2/medusa
9
87190
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x14c3d, %rdx sub $24842, %r15 vmovups (%rdx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %r12 nop xor $44756, %rax lea addresses_normal_ht+0xeaad, %rsi lea addresses_A_ht+0x19d1d, %rdi nop nop nop nop nop and $24651, %r11 mov $122, %rcx rep movsw nop nop nop nop sub %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r8 push %rax push %rbp push %rbx // Load lea addresses_A+0x1cc1d, %r10 nop nop nop dec %r8 mov (%r10), %r11w nop nop xor %r10, %r10 // Store lea addresses_WT+0x9e1d, %rbx clflush (%rbx) nop nop nop add $29359, %rbp movb $0x51, (%rbx) nop nop nop xor %r10, %r10 // Faulty Load lea addresses_US+0xa81d, %rbx clflush (%rbx) sub $10823, %rax mov (%rbx), %r11 lea oracles, %r8 and $0xff, %r11 shlq $12, %r11 mov (%r8,%r11,1), %r11 pop %rbx pop %rbp pop %rax pop %r8 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
echo.asm
jhyunleehi/xv6-public
0
18321
<filename>echo.asm _echo: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: f3 0f 1e fb endbr32 4: 8d 4c 24 04 lea 0x4(%esp),%ecx 8: 83 e4 f0 and $0xfffffff0,%esp b: ff 71 fc pushl -0x4(%ecx) e: 55 push %ebp f: 89 e5 mov %esp,%ebp 11: 53 push %ebx 12: 51 push %ecx 13: 83 ec 10 sub $0x10,%esp 16: 89 cb mov %ecx,%ebx int i; for(i = 1; i < argc; i++) 18: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 1f: eb 3c jmp 5d <main+0x5d> printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); 21: 8b 45 f4 mov -0xc(%ebp),%eax 24: 83 c0 01 add $0x1,%eax 27: 39 03 cmp %eax,(%ebx) 29: 7e 07 jle 32 <main+0x32> 2b: b9 37 08 00 00 mov $0x837,%ecx 30: eb 05 jmp 37 <main+0x37> 32: b9 39 08 00 00 mov $0x839,%ecx 37: 8b 45 f4 mov -0xc(%ebp),%eax 3a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 41: 8b 43 04 mov 0x4(%ebx),%eax 44: 01 d0 add %edx,%eax 46: 8b 00 mov (%eax),%eax 48: 51 push %ecx 49: 50 push %eax 4a: 68 3b 08 00 00 push $0x83b 4f: 6a 01 push $0x1 51: e8 1a 04 00 00 call 470 <printf> 56: 83 c4 10 add $0x10,%esp for(i = 1; i < argc; i++) 59: 83 45 f4 01 addl $0x1,-0xc(%ebp) 5d: 8b 45 f4 mov -0xc(%ebp),%eax 60: 3b 03 cmp (%ebx),%eax 62: 7c bd jl 21 <main+0x21> exit(); 64: e8 7b 02 00 00 call 2e4 <exit> 00000069 <stosb>: : "cc"); } static inline void stosb(void *addr, int data, int cnt) { 69: 55 push %ebp 6a: 89 e5 mov %esp,%ebp 6c: 57 push %edi 6d: 53 push %ebx asm volatile("cld; rep stosb" 6e: 8b 4d 08 mov 0x8(%ebp),%ecx 71: 8b 55 10 mov 0x10(%ebp),%edx 74: 8b 45 0c mov 0xc(%ebp),%eax 77: 89 cb mov %ecx,%ebx 79: 89 df mov %ebx,%edi 7b: 89 d1 mov %edx,%ecx 7d: fc cld 7e: f3 aa rep stos %al,%es:(%edi) 80: 89 ca mov %ecx,%edx 82: 89 fb mov %edi,%ebx 84: 89 5d 08 mov %ebx,0x8(%ebp) 87: 89 55 10 mov %edx,0x10(%ebp) : "=D"(addr), "=c"(cnt) : "0"(addr), "1"(cnt), "a"(data) : "memory", "cc"); } 8a: 90 nop 8b: 5b pop %ebx 8c: 5f pop %edi 8d: 5d pop %ebp 8e: c3 ret 0000008f <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 8f: f3 0f 1e fb endbr32 93: 55 push %ebp 94: 89 e5 mov %esp,%ebp 96: 83 ec 10 sub $0x10,%esp char *os; os = s; 99: 8b 45 08 mov 0x8(%ebp),%eax 9c: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 9f: 90 nop a0: 8b 55 0c mov 0xc(%ebp),%edx a3: 8d 42 01 lea 0x1(%edx),%eax a6: 89 45 0c mov %eax,0xc(%ebp) a9: 8b 45 08 mov 0x8(%ebp),%eax ac: 8d 48 01 lea 0x1(%eax),%ecx af: 89 4d 08 mov %ecx,0x8(%ebp) b2: 0f b6 12 movzbl (%edx),%edx b5: 88 10 mov %dl,(%eax) b7: 0f b6 00 movzbl (%eax),%eax ba: 84 c0 test %al,%al bc: 75 e2 jne a0 <strcpy+0x11> ; return os; be: 8b 45 fc mov -0x4(%ebp),%eax } c1: c9 leave c2: c3 ret 000000c3 <strcmp>: int strcmp(const char *p, const char *q) { c3: f3 0f 1e fb endbr32 c7: 55 push %ebp c8: 89 e5 mov %esp,%ebp while(*p && *p == *q) ca: eb 08 jmp d4 <strcmp+0x11> p++, q++; cc: 83 45 08 01 addl $0x1,0x8(%ebp) d0: 83 45 0c 01 addl $0x1,0xc(%ebp) while(*p && *p == *q) d4: 8b 45 08 mov 0x8(%ebp),%eax d7: 0f b6 00 movzbl (%eax),%eax da: 84 c0 test %al,%al dc: 74 10 je ee <strcmp+0x2b> de: 8b 45 08 mov 0x8(%ebp),%eax e1: 0f b6 10 movzbl (%eax),%edx e4: 8b 45 0c mov 0xc(%ebp),%eax e7: 0f b6 00 movzbl (%eax),%eax ea: 38 c2 cmp %al,%dl ec: 74 de je cc <strcmp+0x9> return (uchar)*p - (uchar)*q; ee: 8b 45 08 mov 0x8(%ebp),%eax f1: 0f b6 00 movzbl (%eax),%eax f4: 0f b6 d0 movzbl %al,%edx f7: 8b 45 0c mov 0xc(%ebp),%eax fa: 0f b6 00 movzbl (%eax),%eax fd: 0f b6 c0 movzbl %al,%eax 100: 29 c2 sub %eax,%edx 102: 89 d0 mov %edx,%eax } 104: 5d pop %ebp 105: c3 ret 00000106 <strlen>: uint strlen(const char *s) { 106: f3 0f 1e fb endbr32 10a: 55 push %ebp 10b: 89 e5 mov %esp,%ebp 10d: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 110: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 117: eb 04 jmp 11d <strlen+0x17> 119: 83 45 fc 01 addl $0x1,-0x4(%ebp) 11d: 8b 55 fc mov -0x4(%ebp),%edx 120: 8b 45 08 mov 0x8(%ebp),%eax 123: 01 d0 add %edx,%eax 125: 0f b6 00 movzbl (%eax),%eax 128: 84 c0 test %al,%al 12a: 75 ed jne 119 <strlen+0x13> ; return n; 12c: 8b 45 fc mov -0x4(%ebp),%eax } 12f: c9 leave 130: c3 ret 00000131 <memset>: void* memset(void *dst, int c, uint n) { 131: f3 0f 1e fb endbr32 135: 55 push %ebp 136: 89 e5 mov %esp,%ebp stosb(dst, c, n); 138: 8b 45 10 mov 0x10(%ebp),%eax 13b: 50 push %eax 13c: ff 75 0c pushl 0xc(%ebp) 13f: ff 75 08 pushl 0x8(%ebp) 142: e8 22 ff ff ff call 69 <stosb> 147: 83 c4 0c add $0xc,%esp return dst; 14a: 8b 45 08 mov 0x8(%ebp),%eax } 14d: c9 leave 14e: c3 ret 0000014f <strchr>: char* strchr(const char *s, char c) { 14f: f3 0f 1e fb endbr32 153: 55 push %ebp 154: 89 e5 mov %esp,%ebp 156: 83 ec 04 sub $0x4,%esp 159: 8b 45 0c mov 0xc(%ebp),%eax 15c: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 15f: eb 14 jmp 175 <strchr+0x26> if(*s == c) 161: 8b 45 08 mov 0x8(%ebp),%eax 164: 0f b6 00 movzbl (%eax),%eax 167: 38 45 fc cmp %al,-0x4(%ebp) 16a: 75 05 jne 171 <strchr+0x22> return (char*)s; 16c: 8b 45 08 mov 0x8(%ebp),%eax 16f: eb 13 jmp 184 <strchr+0x35> for(; *s; s++) 171: 83 45 08 01 addl $0x1,0x8(%ebp) 175: 8b 45 08 mov 0x8(%ebp),%eax 178: 0f b6 00 movzbl (%eax),%eax 17b: 84 c0 test %al,%al 17d: 75 e2 jne 161 <strchr+0x12> return 0; 17f: b8 00 00 00 00 mov $0x0,%eax } 184: c9 leave 185: c3 ret 00000186 <gets>: char* gets(char *buf, int max) { 186: f3 0f 1e fb endbr32 18a: 55 push %ebp 18b: 89 e5 mov %esp,%ebp 18d: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 190: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 197: eb 42 jmp 1db <gets+0x55> cc = read(0, &c, 1); 199: 83 ec 04 sub $0x4,%esp 19c: 6a 01 push $0x1 19e: 8d 45 ef lea -0x11(%ebp),%eax 1a1: 50 push %eax 1a2: 6a 00 push $0x0 1a4: e8 53 01 00 00 call 2fc <read> 1a9: 83 c4 10 add $0x10,%esp 1ac: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1af: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1b3: 7e 33 jle 1e8 <gets+0x62> break; buf[i++] = c; 1b5: 8b 45 f4 mov -0xc(%ebp),%eax 1b8: 8d 50 01 lea 0x1(%eax),%edx 1bb: 89 55 f4 mov %edx,-0xc(%ebp) 1be: 89 c2 mov %eax,%edx 1c0: 8b 45 08 mov 0x8(%ebp),%eax 1c3: 01 c2 add %eax,%edx 1c5: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c9: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1cb: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1cf: 3c 0a cmp $0xa,%al 1d1: 74 16 je 1e9 <gets+0x63> 1d3: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1d7: 3c 0d cmp $0xd,%al 1d9: 74 0e je 1e9 <gets+0x63> for(i=0; i+1 < max; ){ 1db: 8b 45 f4 mov -0xc(%ebp),%eax 1de: 83 c0 01 add $0x1,%eax 1e1: 39 45 0c cmp %eax,0xc(%ebp) 1e4: 7f b3 jg 199 <gets+0x13> 1e6: eb 01 jmp 1e9 <gets+0x63> break; 1e8: 90 nop break; } buf[i] = '\0'; 1e9: 8b 55 f4 mov -0xc(%ebp),%edx 1ec: 8b 45 08 mov 0x8(%ebp),%eax 1ef: 01 d0 add %edx,%eax 1f1: c6 00 00 movb $0x0,(%eax) return buf; 1f4: 8b 45 08 mov 0x8(%ebp),%eax } 1f7: c9 leave 1f8: c3 ret 000001f9 <stat>: int stat(const char *n, struct stat *st) { 1f9: f3 0f 1e fb endbr32 1fd: 55 push %ebp 1fe: 89 e5 mov %esp,%ebp 200: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 203: 83 ec 08 sub $0x8,%esp 206: 6a 00 push $0x0 208: ff 75 08 pushl 0x8(%ebp) 20b: e8 14 01 00 00 call 324 <open> 210: 83 c4 10 add $0x10,%esp 213: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 216: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 21a: 79 07 jns 223 <stat+0x2a> return -1; 21c: b8 ff ff ff ff mov $0xffffffff,%eax 221: eb 25 jmp 248 <stat+0x4f> r = fstat(fd, st); 223: 83 ec 08 sub $0x8,%esp 226: ff 75 0c pushl 0xc(%ebp) 229: ff 75 f4 pushl -0xc(%ebp) 22c: e8 0b 01 00 00 call 33c <fstat> 231: 83 c4 10 add $0x10,%esp 234: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 237: 83 ec 0c sub $0xc,%esp 23a: ff 75 f4 pushl -0xc(%ebp) 23d: e8 ca 00 00 00 call 30c <close> 242: 83 c4 10 add $0x10,%esp return r; 245: 8b 45 f0 mov -0x10(%ebp),%eax } 248: c9 leave 249: c3 ret 0000024a <atoi>: int atoi(const char *s) { 24a: f3 0f 1e fb endbr32 24e: 55 push %ebp 24f: 89 e5 mov %esp,%ebp 251: 83 ec 10 sub $0x10,%esp int n; n = 0; 254: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 25b: eb 25 jmp 282 <atoi+0x38> n = n*10 + *s++ - '0'; 25d: 8b 55 fc mov -0x4(%ebp),%edx 260: 89 d0 mov %edx,%eax 262: c1 e0 02 shl $0x2,%eax 265: 01 d0 add %edx,%eax 267: 01 c0 add %eax,%eax 269: 89 c1 mov %eax,%ecx 26b: 8b 45 08 mov 0x8(%ebp),%eax 26e: 8d 50 01 lea 0x1(%eax),%edx 271: 89 55 08 mov %edx,0x8(%ebp) 274: 0f b6 00 movzbl (%eax),%eax 277: 0f be c0 movsbl %al,%eax 27a: 01 c8 add %ecx,%eax 27c: 83 e8 30 sub $0x30,%eax 27f: 89 45 fc mov %eax,-0x4(%ebp) while('0' <= *s && *s <= '9') 282: 8b 45 08 mov 0x8(%ebp),%eax 285: 0f b6 00 movzbl (%eax),%eax 288: 3c 2f cmp $0x2f,%al 28a: 7e 0a jle 296 <atoi+0x4c> 28c: 8b 45 08 mov 0x8(%ebp),%eax 28f: 0f b6 00 movzbl (%eax),%eax 292: 3c 39 cmp $0x39,%al 294: 7e c7 jle 25d <atoi+0x13> return n; 296: 8b 45 fc mov -0x4(%ebp),%eax } 299: c9 leave 29a: c3 ret 0000029b <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 29b: f3 0f 1e fb endbr32 29f: 55 push %ebp 2a0: 89 e5 mov %esp,%ebp 2a2: 83 ec 10 sub $0x10,%esp char *dst; const char *src; dst = vdst; 2a5: 8b 45 08 mov 0x8(%ebp),%eax 2a8: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 2ab: 8b 45 0c mov 0xc(%ebp),%eax 2ae: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 2b1: eb 17 jmp 2ca <memmove+0x2f> *dst++ = *src++; 2b3: 8b 55 f8 mov -0x8(%ebp),%edx 2b6: 8d 42 01 lea 0x1(%edx),%eax 2b9: 89 45 f8 mov %eax,-0x8(%ebp) 2bc: 8b 45 fc mov -0x4(%ebp),%eax 2bf: 8d 48 01 lea 0x1(%eax),%ecx 2c2: 89 4d fc mov %ecx,-0x4(%ebp) 2c5: 0f b6 12 movzbl (%edx),%edx 2c8: 88 10 mov %dl,(%eax) while(n-- > 0) 2ca: 8b 45 10 mov 0x10(%ebp),%eax 2cd: 8d 50 ff lea -0x1(%eax),%edx 2d0: 89 55 10 mov %edx,0x10(%ebp) 2d3: 85 c0 test %eax,%eax 2d5: 7f dc jg 2b3 <memmove+0x18> return vdst; 2d7: 8b 45 08 mov 0x8(%ebp),%eax } 2da: c9 leave 2db: c3 ret 000002dc <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2dc: b8 01 00 00 00 mov $0x1,%eax 2e1: cd 40 int $0x40 2e3: c3 ret 000002e4 <exit>: SYSCALL(exit) 2e4: b8 02 00 00 00 mov $0x2,%eax 2e9: cd 40 int $0x40 2eb: c3 ret 000002ec <wait>: SYSCALL(wait) 2ec: b8 03 00 00 00 mov $0x3,%eax 2f1: cd 40 int $0x40 2f3: c3 ret 000002f4 <pipe>: SYSCALL(pipe) 2f4: b8 04 00 00 00 mov $0x4,%eax 2f9: cd 40 int $0x40 2fb: c3 ret 000002fc <read>: SYSCALL(read) 2fc: b8 05 00 00 00 mov $0x5,%eax 301: cd 40 int $0x40 303: c3 ret 00000304 <write>: SYSCALL(write) 304: b8 10 00 00 00 mov $0x10,%eax 309: cd 40 int $0x40 30b: c3 ret 0000030c <close>: SYSCALL(close) 30c: b8 15 00 00 00 mov $0x15,%eax 311: cd 40 int $0x40 313: c3 ret 00000314 <kill>: SYSCALL(kill) 314: b8 06 00 00 00 mov $0x6,%eax 319: cd 40 int $0x40 31b: c3 ret 0000031c <exec>: SYSCALL(exec) 31c: b8 07 00 00 00 mov $0x7,%eax 321: cd 40 int $0x40 323: c3 ret 00000324 <open>: SYSCALL(open) 324: b8 0f 00 00 00 mov $0xf,%eax 329: cd 40 int $0x40 32b: c3 ret 0000032c <mknod>: SYSCALL(mknod) 32c: b8 11 00 00 00 mov $0x11,%eax 331: cd 40 int $0x40 333: c3 ret 00000334 <unlink>: SYSCALL(unlink) 334: b8 12 00 00 00 mov $0x12,%eax 339: cd 40 int $0x40 33b: c3 ret 0000033c <fstat>: SYSCALL(fstat) 33c: b8 08 00 00 00 mov $0x8,%eax 341: cd 40 int $0x40 343: c3 ret 00000344 <link>: SYSCALL(link) 344: b8 13 00 00 00 mov $0x13,%eax 349: cd 40 int $0x40 34b: c3 ret 0000034c <mkdir>: SYSCALL(mkdir) 34c: b8 14 00 00 00 mov $0x14,%eax 351: cd 40 int $0x40 353: c3 ret 00000354 <chdir>: SYSCALL(chdir) 354: b8 09 00 00 00 mov $0x9,%eax 359: cd 40 int $0x40 35b: c3 ret 0000035c <dup>: SYSCALL(dup) 35c: b8 0a 00 00 00 mov $0xa,%eax 361: cd 40 int $0x40 363: c3 ret 00000364 <getpid>: SYSCALL(getpid) 364: b8 0b 00 00 00 mov $0xb,%eax 369: cd 40 int $0x40 36b: c3 ret 0000036c <sbrk>: SYSCALL(sbrk) 36c: b8 0c 00 00 00 mov $0xc,%eax 371: cd 40 int $0x40 373: c3 ret 00000374 <sleep>: SYSCALL(sleep) 374: b8 0d 00 00 00 mov $0xd,%eax 379: cd 40 int $0x40 37b: c3 ret 0000037c <uptime>: SYSCALL(uptime) 37c: b8 0e 00 00 00 mov $0xe,%eax 381: cd 40 int $0x40 383: c3 ret 00000384 <cps>: SYSCALL(cps) 384: b8 16 00 00 00 mov $0x16,%eax 389: cd 40 int $0x40 38b: c3 ret 0000038c <cdate>: 38c: b8 17 00 00 00 mov $0x17,%eax 391: cd 40 int $0x40 393: c3 ret 00000394 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 394: f3 0f 1e fb endbr32 398: 55 push %ebp 399: 89 e5 mov %esp,%ebp 39b: 83 ec 18 sub $0x18,%esp 39e: 8b 45 0c mov 0xc(%ebp),%eax 3a1: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 3a4: 83 ec 04 sub $0x4,%esp 3a7: 6a 01 push $0x1 3a9: 8d 45 f4 lea -0xc(%ebp),%eax 3ac: 50 push %eax 3ad: ff 75 08 pushl 0x8(%ebp) 3b0: e8 4f ff ff ff call 304 <write> 3b5: 83 c4 10 add $0x10,%esp } 3b8: 90 nop 3b9: c9 leave 3ba: c3 ret 000003bb <printint>: static void printint(int fd, int xx, int base, int sgn) { 3bb: f3 0f 1e fb endbr32 3bf: 55 push %ebp 3c0: 89 e5 mov %esp,%ebp 3c2: 83 ec 28 sub $0x28,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3c5: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 3cc: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3d0: 74 17 je 3e9 <printint+0x2e> 3d2: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3d6: 79 11 jns 3e9 <printint+0x2e> neg = 1; 3d8: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3df: 8b 45 0c mov 0xc(%ebp),%eax 3e2: f7 d8 neg %eax 3e4: 89 45 ec mov %eax,-0x14(%ebp) 3e7: eb 06 jmp 3ef <printint+0x34> } else { x = xx; 3e9: 8b 45 0c mov 0xc(%ebp),%eax 3ec: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 3ef: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 3f6: 8b 4d 10 mov 0x10(%ebp),%ecx 3f9: 8b 45 ec mov -0x14(%ebp),%eax 3fc: ba 00 00 00 00 mov $0x0,%edx 401: f7 f1 div %ecx 403: 89 d1 mov %edx,%ecx 405: 8b 45 f4 mov -0xc(%ebp),%eax 408: 8d 50 01 lea 0x1(%eax),%edx 40b: 89 55 f4 mov %edx,-0xc(%ebp) 40e: 0f b6 91 90 0a 00 00 movzbl 0xa90(%ecx),%edx 415: 88 54 05 dc mov %dl,-0x24(%ebp,%eax,1) }while((x /= base) != 0); 419: 8b 4d 10 mov 0x10(%ebp),%ecx 41c: 8b 45 ec mov -0x14(%ebp),%eax 41f: ba 00 00 00 00 mov $0x0,%edx 424: f7 f1 div %ecx 426: 89 45 ec mov %eax,-0x14(%ebp) 429: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 42d: 75 c7 jne 3f6 <printint+0x3b> if(neg) 42f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 433: 74 2d je 462 <printint+0xa7> buf[i++] = '-'; 435: 8b 45 f4 mov -0xc(%ebp),%eax 438: 8d 50 01 lea 0x1(%eax),%edx 43b: 89 55 f4 mov %edx,-0xc(%ebp) 43e: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 443: eb 1d jmp 462 <printint+0xa7> putc(fd, buf[i]); 445: 8d 55 dc lea -0x24(%ebp),%edx 448: 8b 45 f4 mov -0xc(%ebp),%eax 44b: 01 d0 add %edx,%eax 44d: 0f b6 00 movzbl (%eax),%eax 450: 0f be c0 movsbl %al,%eax 453: 83 ec 08 sub $0x8,%esp 456: 50 push %eax 457: ff 75 08 pushl 0x8(%ebp) 45a: e8 35 ff ff ff call 394 <putc> 45f: 83 c4 10 add $0x10,%esp while(--i >= 0) 462: 83 6d f4 01 subl $0x1,-0xc(%ebp) 466: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 46a: 79 d9 jns 445 <printint+0x8a> } 46c: 90 nop 46d: 90 nop 46e: c9 leave 46f: c3 ret 00000470 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 470: f3 0f 1e fb endbr32 474: 55 push %ebp 475: 89 e5 mov %esp,%ebp 477: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 47a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 481: 8d 45 0c lea 0xc(%ebp),%eax 484: 83 c0 04 add $0x4,%eax 487: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 48a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 491: e9 59 01 00 00 jmp 5ef <printf+0x17f> c = fmt[i] & 0xff; 496: 8b 55 0c mov 0xc(%ebp),%edx 499: 8b 45 f0 mov -0x10(%ebp),%eax 49c: 01 d0 add %edx,%eax 49e: 0f b6 00 movzbl (%eax),%eax 4a1: 0f be c0 movsbl %al,%eax 4a4: 25 ff 00 00 00 and $0xff,%eax 4a9: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 4ac: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 4b0: 75 2c jne 4de <printf+0x6e> if(c == '%'){ 4b2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 4b6: 75 0c jne 4c4 <printf+0x54> state = '%'; 4b8: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 4bf: e9 27 01 00 00 jmp 5eb <printf+0x17b> } else { putc(fd, c); 4c4: 8b 45 e4 mov -0x1c(%ebp),%eax 4c7: 0f be c0 movsbl %al,%eax 4ca: 83 ec 08 sub $0x8,%esp 4cd: 50 push %eax 4ce: ff 75 08 pushl 0x8(%ebp) 4d1: e8 be fe ff ff call 394 <putc> 4d6: 83 c4 10 add $0x10,%esp 4d9: e9 0d 01 00 00 jmp 5eb <printf+0x17b> } } else if(state == '%'){ 4de: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 4e2: 0f 85 03 01 00 00 jne 5eb <printf+0x17b> if(c == 'd'){ 4e8: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 4ec: 75 1e jne 50c <printf+0x9c> printint(fd, *ap, 10, 1); 4ee: 8b 45 e8 mov -0x18(%ebp),%eax 4f1: 8b 00 mov (%eax),%eax 4f3: 6a 01 push $0x1 4f5: 6a 0a push $0xa 4f7: 50 push %eax 4f8: ff 75 08 pushl 0x8(%ebp) 4fb: e8 bb fe ff ff call 3bb <printint> 500: 83 c4 10 add $0x10,%esp ap++; 503: 83 45 e8 04 addl $0x4,-0x18(%ebp) 507: e9 d8 00 00 00 jmp 5e4 <printf+0x174> } else if(c == 'x' || c == 'p'){ 50c: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 510: 74 06 je 518 <printf+0xa8> 512: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 516: 75 1e jne 536 <printf+0xc6> printint(fd, *ap, 16, 0); 518: 8b 45 e8 mov -0x18(%ebp),%eax 51b: 8b 00 mov (%eax),%eax 51d: 6a 00 push $0x0 51f: 6a 10 push $0x10 521: 50 push %eax 522: ff 75 08 pushl 0x8(%ebp) 525: e8 91 fe ff ff call 3bb <printint> 52a: 83 c4 10 add $0x10,%esp ap++; 52d: 83 45 e8 04 addl $0x4,-0x18(%ebp) 531: e9 ae 00 00 00 jmp 5e4 <printf+0x174> } else if(c == 's'){ 536: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 53a: 75 43 jne 57f <printf+0x10f> s = (char*)*ap; 53c: 8b 45 e8 mov -0x18(%ebp),%eax 53f: 8b 00 mov (%eax),%eax 541: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 544: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 548: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 54c: 75 25 jne 573 <printf+0x103> s = "(null)"; 54e: c7 45 f4 40 08 00 00 movl $0x840,-0xc(%ebp) while(*s != 0){ 555: eb 1c jmp 573 <printf+0x103> putc(fd, *s); 557: 8b 45 f4 mov -0xc(%ebp),%eax 55a: 0f b6 00 movzbl (%eax),%eax 55d: 0f be c0 movsbl %al,%eax 560: 83 ec 08 sub $0x8,%esp 563: 50 push %eax 564: ff 75 08 pushl 0x8(%ebp) 567: e8 28 fe ff ff call 394 <putc> 56c: 83 c4 10 add $0x10,%esp s++; 56f: 83 45 f4 01 addl $0x1,-0xc(%ebp) while(*s != 0){ 573: 8b 45 f4 mov -0xc(%ebp),%eax 576: 0f b6 00 movzbl (%eax),%eax 579: 84 c0 test %al,%al 57b: 75 da jne 557 <printf+0xe7> 57d: eb 65 jmp 5e4 <printf+0x174> } } else if(c == 'c'){ 57f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 583: 75 1d jne 5a2 <printf+0x132> putc(fd, *ap); 585: 8b 45 e8 mov -0x18(%ebp),%eax 588: 8b 00 mov (%eax),%eax 58a: 0f be c0 movsbl %al,%eax 58d: 83 ec 08 sub $0x8,%esp 590: 50 push %eax 591: ff 75 08 pushl 0x8(%ebp) 594: e8 fb fd ff ff call 394 <putc> 599: 83 c4 10 add $0x10,%esp ap++; 59c: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5a0: eb 42 jmp 5e4 <printf+0x174> } else if(c == '%'){ 5a2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 5a6: 75 17 jne 5bf <printf+0x14f> putc(fd, c); 5a8: 8b 45 e4 mov -0x1c(%ebp),%eax 5ab: 0f be c0 movsbl %al,%eax 5ae: 83 ec 08 sub $0x8,%esp 5b1: 50 push %eax 5b2: ff 75 08 pushl 0x8(%ebp) 5b5: e8 da fd ff ff call 394 <putc> 5ba: 83 c4 10 add $0x10,%esp 5bd: eb 25 jmp 5e4 <printf+0x174> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 5bf: 83 ec 08 sub $0x8,%esp 5c2: 6a 25 push $0x25 5c4: ff 75 08 pushl 0x8(%ebp) 5c7: e8 c8 fd ff ff call 394 <putc> 5cc: 83 c4 10 add $0x10,%esp putc(fd, c); 5cf: 8b 45 e4 mov -0x1c(%ebp),%eax 5d2: 0f be c0 movsbl %al,%eax 5d5: 83 ec 08 sub $0x8,%esp 5d8: 50 push %eax 5d9: ff 75 08 pushl 0x8(%ebp) 5dc: e8 b3 fd ff ff call 394 <putc> 5e1: 83 c4 10 add $0x10,%esp } state = 0; 5e4: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) for(i = 0; fmt[i]; i++){ 5eb: 83 45 f0 01 addl $0x1,-0x10(%ebp) 5ef: 8b 55 0c mov 0xc(%ebp),%edx 5f2: 8b 45 f0 mov -0x10(%ebp),%eax 5f5: 01 d0 add %edx,%eax 5f7: 0f b6 00 movzbl (%eax),%eax 5fa: 84 c0 test %al,%al 5fc: 0f 85 94 fe ff ff jne 496 <printf+0x26> } } } 602: 90 nop 603: 90 nop 604: c9 leave 605: c3 ret 00000606 <free>: static Header base; static Header *freep; void free(void *ap) { 606: f3 0f 1e fb endbr32 60a: 55 push %ebp 60b: 89 e5 mov %esp,%ebp 60d: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 610: 8b 45 08 mov 0x8(%ebp),%eax 613: 83 e8 08 sub $0x8,%eax 616: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 619: a1 ac 0a 00 00 mov 0xaac,%eax 61e: 89 45 fc mov %eax,-0x4(%ebp) 621: eb 24 jmp 647 <free+0x41> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 623: 8b 45 fc mov -0x4(%ebp),%eax 626: 8b 00 mov (%eax),%eax 628: 39 45 fc cmp %eax,-0x4(%ebp) 62b: 72 12 jb 63f <free+0x39> 62d: 8b 45 f8 mov -0x8(%ebp),%eax 630: 3b 45 fc cmp -0x4(%ebp),%eax 633: 77 24 ja 659 <free+0x53> 635: 8b 45 fc mov -0x4(%ebp),%eax 638: 8b 00 mov (%eax),%eax 63a: 39 45 f8 cmp %eax,-0x8(%ebp) 63d: 72 1a jb 659 <free+0x53> for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 63f: 8b 45 fc mov -0x4(%ebp),%eax 642: 8b 00 mov (%eax),%eax 644: 89 45 fc mov %eax,-0x4(%ebp) 647: 8b 45 f8 mov -0x8(%ebp),%eax 64a: 3b 45 fc cmp -0x4(%ebp),%eax 64d: 76 d4 jbe 623 <free+0x1d> 64f: 8b 45 fc mov -0x4(%ebp),%eax 652: 8b 00 mov (%eax),%eax 654: 39 45 f8 cmp %eax,-0x8(%ebp) 657: 73 ca jae 623 <free+0x1d> break; if(bp + bp->s.size == p->s.ptr){ 659: 8b 45 f8 mov -0x8(%ebp),%eax 65c: 8b 40 04 mov 0x4(%eax),%eax 65f: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 666: 8b 45 f8 mov -0x8(%ebp),%eax 669: 01 c2 add %eax,%edx 66b: 8b 45 fc mov -0x4(%ebp),%eax 66e: 8b 00 mov (%eax),%eax 670: 39 c2 cmp %eax,%edx 672: 75 24 jne 698 <free+0x92> bp->s.size += p->s.ptr->s.size; 674: 8b 45 f8 mov -0x8(%ebp),%eax 677: 8b 50 04 mov 0x4(%eax),%edx 67a: 8b 45 fc mov -0x4(%ebp),%eax 67d: 8b 00 mov (%eax),%eax 67f: 8b 40 04 mov 0x4(%eax),%eax 682: 01 c2 add %eax,%edx 684: 8b 45 f8 mov -0x8(%ebp),%eax 687: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 68a: 8b 45 fc mov -0x4(%ebp),%eax 68d: 8b 00 mov (%eax),%eax 68f: 8b 10 mov (%eax),%edx 691: 8b 45 f8 mov -0x8(%ebp),%eax 694: 89 10 mov %edx,(%eax) 696: eb 0a jmp 6a2 <free+0x9c> } else bp->s.ptr = p->s.ptr; 698: 8b 45 fc mov -0x4(%ebp),%eax 69b: 8b 10 mov (%eax),%edx 69d: 8b 45 f8 mov -0x8(%ebp),%eax 6a0: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 6a2: 8b 45 fc mov -0x4(%ebp),%eax 6a5: 8b 40 04 mov 0x4(%eax),%eax 6a8: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 6af: 8b 45 fc mov -0x4(%ebp),%eax 6b2: 01 d0 add %edx,%eax 6b4: 39 45 f8 cmp %eax,-0x8(%ebp) 6b7: 75 20 jne 6d9 <free+0xd3> p->s.size += bp->s.size; 6b9: 8b 45 fc mov -0x4(%ebp),%eax 6bc: 8b 50 04 mov 0x4(%eax),%edx 6bf: 8b 45 f8 mov -0x8(%ebp),%eax 6c2: 8b 40 04 mov 0x4(%eax),%eax 6c5: 01 c2 add %eax,%edx 6c7: 8b 45 fc mov -0x4(%ebp),%eax 6ca: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6cd: 8b 45 f8 mov -0x8(%ebp),%eax 6d0: 8b 10 mov (%eax),%edx 6d2: 8b 45 fc mov -0x4(%ebp),%eax 6d5: 89 10 mov %edx,(%eax) 6d7: eb 08 jmp 6e1 <free+0xdb> } else p->s.ptr = bp; 6d9: 8b 45 fc mov -0x4(%ebp),%eax 6dc: 8b 55 f8 mov -0x8(%ebp),%edx 6df: 89 10 mov %edx,(%eax) freep = p; 6e1: 8b 45 fc mov -0x4(%ebp),%eax 6e4: a3 ac 0a 00 00 mov %eax,0xaac } 6e9: 90 nop 6ea: c9 leave 6eb: c3 ret 000006ec <morecore>: static Header* morecore(uint nu) { 6ec: f3 0f 1e fb endbr32 6f0: 55 push %ebp 6f1: 89 e5 mov %esp,%ebp 6f3: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 6f6: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 6fd: 77 07 ja 706 <morecore+0x1a> nu = 4096; 6ff: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 706: 8b 45 08 mov 0x8(%ebp),%eax 709: c1 e0 03 shl $0x3,%eax 70c: 83 ec 0c sub $0xc,%esp 70f: 50 push %eax 710: e8 57 fc ff ff call 36c <sbrk> 715: 83 c4 10 add $0x10,%esp 718: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 71b: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 71f: 75 07 jne 728 <morecore+0x3c> return 0; 721: b8 00 00 00 00 mov $0x0,%eax 726: eb 26 jmp 74e <morecore+0x62> hp = (Header*)p; 728: 8b 45 f4 mov -0xc(%ebp),%eax 72b: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 72e: 8b 45 f0 mov -0x10(%ebp),%eax 731: 8b 55 08 mov 0x8(%ebp),%edx 734: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 737: 8b 45 f0 mov -0x10(%ebp),%eax 73a: 83 c0 08 add $0x8,%eax 73d: 83 ec 0c sub $0xc,%esp 740: 50 push %eax 741: e8 c0 fe ff ff call 606 <free> 746: 83 c4 10 add $0x10,%esp return freep; 749: a1 ac 0a 00 00 mov 0xaac,%eax } 74e: c9 leave 74f: c3 ret 00000750 <malloc>: void* malloc(uint nbytes) { 750: f3 0f 1e fb endbr32 754: 55 push %ebp 755: 89 e5 mov %esp,%ebp 757: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 75a: 8b 45 08 mov 0x8(%ebp),%eax 75d: 83 c0 07 add $0x7,%eax 760: c1 e8 03 shr $0x3,%eax 763: 83 c0 01 add $0x1,%eax 766: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 769: a1 ac 0a 00 00 mov 0xaac,%eax 76e: 89 45 f0 mov %eax,-0x10(%ebp) 771: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 775: 75 23 jne 79a <malloc+0x4a> base.s.ptr = freep = prevp = &base; 777: c7 45 f0 a4 0a 00 00 movl $0xaa4,-0x10(%ebp) 77e: 8b 45 f0 mov -0x10(%ebp),%eax 781: a3 ac 0a 00 00 mov %eax,0xaac 786: a1 ac 0a 00 00 mov 0xaac,%eax 78b: a3 a4 0a 00 00 mov %eax,0xaa4 base.s.size = 0; 790: c7 05 a8 0a 00 00 00 movl $0x0,0xaa8 797: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 79a: 8b 45 f0 mov -0x10(%ebp),%eax 79d: 8b 00 mov (%eax),%eax 79f: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 7a2: 8b 45 f4 mov -0xc(%ebp),%eax 7a5: 8b 40 04 mov 0x4(%eax),%eax 7a8: 39 45 ec cmp %eax,-0x14(%ebp) 7ab: 77 4d ja 7fa <malloc+0xaa> if(p->s.size == nunits) 7ad: 8b 45 f4 mov -0xc(%ebp),%eax 7b0: 8b 40 04 mov 0x4(%eax),%eax 7b3: 39 45 ec cmp %eax,-0x14(%ebp) 7b6: 75 0c jne 7c4 <malloc+0x74> prevp->s.ptr = p->s.ptr; 7b8: 8b 45 f4 mov -0xc(%ebp),%eax 7bb: 8b 10 mov (%eax),%edx 7bd: 8b 45 f0 mov -0x10(%ebp),%eax 7c0: 89 10 mov %edx,(%eax) 7c2: eb 26 jmp 7ea <malloc+0x9a> else { p->s.size -= nunits; 7c4: 8b 45 f4 mov -0xc(%ebp),%eax 7c7: 8b 40 04 mov 0x4(%eax),%eax 7ca: 2b 45 ec sub -0x14(%ebp),%eax 7cd: 89 c2 mov %eax,%edx 7cf: 8b 45 f4 mov -0xc(%ebp),%eax 7d2: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7d5: 8b 45 f4 mov -0xc(%ebp),%eax 7d8: 8b 40 04 mov 0x4(%eax),%eax 7db: c1 e0 03 shl $0x3,%eax 7de: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 7e1: 8b 45 f4 mov -0xc(%ebp),%eax 7e4: 8b 55 ec mov -0x14(%ebp),%edx 7e7: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 7ea: 8b 45 f0 mov -0x10(%ebp),%eax 7ed: a3 ac 0a 00 00 mov %eax,0xaac return (void*)(p + 1); 7f2: 8b 45 f4 mov -0xc(%ebp),%eax 7f5: 83 c0 08 add $0x8,%eax 7f8: eb 3b jmp 835 <malloc+0xe5> } if(p == freep) 7fa: a1 ac 0a 00 00 mov 0xaac,%eax 7ff: 39 45 f4 cmp %eax,-0xc(%ebp) 802: 75 1e jne 822 <malloc+0xd2> if((p = morecore(nunits)) == 0) 804: 83 ec 0c sub $0xc,%esp 807: ff 75 ec pushl -0x14(%ebp) 80a: e8 dd fe ff ff call 6ec <morecore> 80f: 83 c4 10 add $0x10,%esp 812: 89 45 f4 mov %eax,-0xc(%ebp) 815: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 819: 75 07 jne 822 <malloc+0xd2> return 0; 81b: b8 00 00 00 00 mov $0x0,%eax 820: eb 13 jmp 835 <malloc+0xe5> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 822: 8b 45 f4 mov -0xc(%ebp),%eax 825: 89 45 f0 mov %eax,-0x10(%ebp) 828: 8b 45 f4 mov -0xc(%ebp),%eax 82b: 8b 00 mov (%eax),%eax 82d: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 830: e9 6d ff ff ff jmp 7a2 <malloc+0x52> } } 835: c9 leave 836: c3 ret
openal-extension-float32.adb
io7m/coreland-openal-ada
1
3534
with OpenAL.Extension.Float32_Thin; with OpenAL.Global; with OpenAL.Thin; with System; package body OpenAL.Extension.Float32 is use type Types.Size_t; function Is_Present return Boolean is begin return Global.Is_Extension_Present ("AL_EXT_FLOAT32"); end Is_Present; procedure Set_Data_Mono_Float_32 (Buffer : in OpenAL.Buffer.Buffer_t; Data : in Sample_Array_Float_32_t; Frequency : in Types.Frequency_t) is begin Thin.Buffer_Data (Buffer_ID => OpenAL.Buffer.To_Integer (Buffer), Format => Float32_Thin.AL_FORMAT_MONO_FLOAT32, Data => Data (Data'First)'Address, Size => Data'Size / System.Storage_Unit, Frequency => Types.Size_t (Frequency)); end Set_Data_Mono_Float_32; procedure Set_Data_Stereo_Float_32 (Buffer : in OpenAL.Buffer.Buffer_t; Data : in Sample_Array_Float_32_t; Frequency : in Types.Frequency_t) is begin Thin.Buffer_Data (Buffer_ID => OpenAL.Buffer.To_Integer (Buffer), Format => Float32_Thin.AL_FORMAT_STEREO_FLOAT32, Data => Data (Data'First)'Address, Size => Data'Size / System.Storage_Unit, Frequency => Types.Size_t (Frequency)); end Set_Data_Stereo_Float_32; end OpenAL.Extension.Float32;
alloy4fun_models/trainstlt/models/8/9CfRZqACwk4b8KCb6.als
Kaixi26/org.alloytools.alloy
0
2321
<filename>alloy4fun_models/trainstlt/models/8/9CfRZqACwk4b8KCb6.als open main pred id9CfRZqACwk4b8KCb6_prop9 { all t:Train | eventually t.pos in Entry } pred __repair { id9CfRZqACwk4b8KCb6_prop9 } check __repair { id9CfRZqACwk4b8KCb6_prop9 <=> prop9o }
models/IDesc.agda
mietek/epigram
48
14629
{-# OPTIONS --universe-polymorphism #-} module IDesc where --******************************************** -- Prelude --******************************************** -- Some preliminary stuffs, to avoid relying on the stdlib --**************** -- Universe polymorphism --**************** data Level : Set where zero : Level suc : Level -> Level {-# BUILTIN LEVEL Level #-} {-# BUILTIN LEVELZERO zero #-} {-# BUILTIN LEVELSUC suc #-} max : Level -> Level -> Level max zero m = m max (suc n) zero = suc n max (suc n) (suc m) = suc (max n m) {-# BUILTIN LEVELMAX max #-} data Lifted {l : Level} (A : Set l) : Set (suc l) where lifter : A → Lifted A lift : {i : Level} -> Set i -> Set (suc i) lift x = Lifted x unlift : {l : Level}{A : Set l} -> Lifted A -> A unlift (lifter a) = a --**************** -- Sigma and friends --**************** data Sigma {i j : Level}(A : Set i) (B : A -> Set j) : Set (max i j) where _,_ : (x : A) (y : B x) -> Sigma A B pair : {i j : Level}{A : Set i}{B : A -> Set j} -> (x : A) (y : B x) -> Sigma {i = i}{j = j} A B pair x y = x , y _*_ : {i j : Level}(A : Set i)(B : Set j) -> Set (max i j) A * B = Sigma A \_ -> B fst : {i j : Level}{A : Set i}{B : A -> Set j} -> Sigma A B -> A fst (a , _) = a snd : {i j : Level}{A : Set i}{B : A -> Set j} (p : Sigma A B) -> B (fst p) snd (a , b) = b data Zero {i : Level} : Set i where data Unit {i : Level} : Set i where Void : Unit --**************** -- Sum and friends --**************** data _+_ {i j : Level}(A : Set i)(B : Set j) : Set (max i j) where l : A -> A + B r : B -> A + B --**************** -- Equality --**************** data _==_ {l : Level}{A : Set l}(x : A) : A -> Set l where refl : x == x cong : {l m : Level}{A : Set l}{B : Set m} (f : A -> B){x y : A} -> x == y -> f x == f y cong f refl = refl cong2 : {l m n : Level}{A : Set l}{B : Set m}{C : Set n} (f : A -> B -> C){x y : A}{z t : B} -> x == y -> z == t -> f x z == f y t cong2 f refl refl = refl trans : {l : Level}{A : Set l}{x y z : A} -> x == y -> y == z -> x == z trans refl refl = refl proof-lift-unlift-eq : {l : Level}{A : Set l}(x : Lifted A) -> lifter (unlift x) == x proof-lift-unlift-eq (lifter a) = refl postulate reflFun : {l m : Level}{A : Set l}{B : Set m}(f : A -> B)(g : A -> B)-> ((a : A) -> f a == g a) -> f == g --******************************************** -- Desc code --******************************************** data IDesc {l : Level}(I : Set (suc l)) : Set (suc l) where var : I -> IDesc I const : Set l -> IDesc I prod : IDesc I -> IDesc I -> IDesc I sigma : (S : Set l) -> (S -> IDesc I) -> IDesc I pi : (S : Set l) -> (S -> IDesc I) -> IDesc I --******************************************** -- Desc interpretation --******************************************** desc : {l : Level}{I : Set (suc l)} -> IDesc I -> (I -> Set l) -> Set l desc (var i) P = P i desc (const X) P = X desc (prod D D') P = desc D P * desc D' P desc (sigma S T) P = Sigma S (\s -> desc (T s) P) desc (pi S T) P = (s : S) -> desc (T s) P --******************************************** -- Fixpoint construction --******************************************** data IMu {l : Level}{I : Set (suc l)}(R : I -> IDesc {l = l} I)(i : I) : Set l where con : desc (R i) (\j -> IMu R j) -> IMu R i --******************************************** -- Predicate: Box --******************************************** box : {l : Level}{I : Set (suc l)}(D : IDesc I)(X : I -> Set l) -> desc D X -> IDesc (Sigma I X) box (var i) X x = var (i , x) box (const _) X x = const Unit box (prod D D') X (d , d') = prod (box D X d) (box D' X d') box (sigma S T) X (a , b) = box (T a) X b box (pi S T) X f = pi S (\s -> box (T s) X (f s)) --******************************************** -- Elimination principle: induction --******************************************** module Elim {l : Level} {I : Set (suc l)} (R : I -> IDesc I) (P : Sigma I (IMu R) -> Set l) (m : (i : I) (xs : desc (R i) (IMu R)) (hs : desc (box (R i) (IMu R) xs) P) -> P ( i , con xs )) where mutual induction : (i : I)(x : IMu R i) -> P (i , x) induction i (con xs) = m i xs (hyps (R i) xs) hyps : (D : IDesc I) -> (xs : desc D (IMu R)) -> desc (box D (IMu R) xs) P hyps (var i) x = induction i x hyps (const X) x = Void hyps (prod D D') (d , d') = hyps D d , hyps D' d' hyps (pi S R) f = \ s -> hyps (R s) (f s) hyps (sigma S R) ( a , b ) = hyps (R a) b induction : {l : Level} {I : Set (suc l)} (R : I -> IDesc I) (P : Sigma I (IMu R) -> Set l) (m : (i : I) (xs : desc (R i) (IMu R)) (hs : desc (box (R i) (IMu R) xs) P) -> P ( i , con xs)) -> (i : I)(x : IMu R i) -> P ( i , x ) induction = Elim.induction --******************************************** -- DescD --******************************************** data DescDConst {l : Level} : Set l where lvar : DescDConst lconst : DescDConst lprod : DescDConst lpi : DescDConst lsigma : DescDConst descDChoice : {l : Level} -> Set (suc l) -> DescDConst -> IDesc Unit descDChoice I lvar = const I descDChoice _ lconst = const (Set _) descDChoice _ lprod = prod (var Void) (var Void) descDChoice _ lpi = sigma (Set _) (\S -> pi (lift S) (\s -> var Void)) descDChoice _ lsigma = sigma (Set _) (\S -> pi (lift S) (\s -> var Void)) IDescD : {l : Level}(I : Set (suc l)) -> IDesc {l = suc l} Unit IDescD I = sigma DescDConst (descDChoice I) IDescl0 : {l : Level}(I : Set (suc l)) -> Unit -> Set (suc l) IDescl0 {x} I = IMu {l = suc x} (\_ -> IDescD {l = x} I) IDescl : {l : Level}(I : Set (suc l)) -> Set (suc l) IDescl I = IDescl0 I Void varl : {l : Level}{I : Set (suc l)}(i : I) -> IDescl I varl {x} i = con (lvar {l = suc x} , i) constl : {l : Level}{I : Set (suc l)}(X : Set l) -> IDescl I constl {x} X = con (lconst {l = suc x} , X) prodl : {l : Level}{I : Set (suc l)}(D D' : IDescl I) -> IDescl I prodl {x} D D' = con (lprod {l = suc x} , (D , D')) pil : {l : Level}{I : Set (suc l)}(S : Set l)(T : S -> IDescl I) -> IDescl I pil {x} S T = con (lpi {l = suc x} , pair {i = suc x}{j = suc x} S (\s -> T (unlift s))) sigmal : {l : Level}{I : Set (suc l)}(S : Set l)(T : S -> IDescl I) -> IDescl I sigmal {x} S T = con (lsigma {l = suc x} , pair {i = suc x}{j = suc x} S (\s -> T (unlift s))) --******************************************** -- From the embedding to the host --******************************************** cases : {l : Level} {I : Set (suc l)} (xs : desc (IDescD I) (IMu (λ _ -> IDescD I))) (hs : desc (box (IDescD I) (IMu (λ _ -> IDescD I)) xs) (λ _ -> IDesc I)) -> IDesc I cases ( lvar , i ) hs = var i cases ( lconst , X ) hs = const X cases ( lprod , (D , D') ) ( d , d' ) = prod d d' cases ( lpi , ( S , T ) ) hs = pi S (\s -> hs (lifter s) ) cases ( lsigma , ( S , T ) ) hs = sigma S (\s -> hs (lifter s)) phi : {l : Level}{I : Set (suc l)} -> IDescl I -> IDesc I phi {x} {I} d = induction (\_ -> IDescD I) (\_ -> IDesc I) (\_ -> cases) Void d --******************************************** -- From the host to the embedding --******************************************** psi : {l : Level}{I : Set (suc l)} -> IDesc I -> IDescl I psi (var i) = varl i psi (const X) = constl X psi (prod D D') = prodl (psi D) (psi D') psi (pi S T) = pil S (\s -> psi (T s)) psi (sigma S T) = sigmal S (\s -> psi (T s)) --******************************************** -- Isomorphism proof --******************************************** -- From host to host proof-phi-psi : {l : Level}{I : Set (suc l)} -> (D : IDesc I) -> phi (psi D) == D proof-phi-psi (var i) = refl proof-phi-psi (const x) = refl proof-phi-psi (prod D D') with proof-phi-psi D | proof-phi-psi D' ... | p | q = cong2 prod p q proof-phi-psi {x} (pi S T) = cong (pi S) (reflFun (\s -> phi (psi (T s))) T (\s -> proof-phi-psi (T s))) proof-phi-psi (sigma S T) = cong (sigma S) (reflFun (\ s -> phi (psi (T s))) T (\s -> proof-phi-psi (T s))) -- From embedding to embedding proof-psi-phi : {l : Level}(I : Set (suc l)) -> (D : IDescl I) -> psi (phi D) == D proof-psi-phi {x} I D = induction (\ _ -> IDescD I) P proof-psi-phi-cases Void D where P : Sigma Unit (IMu (\ x -> IDescD I)) -> Set (suc x) P ( Void , D ) = psi (phi D) == D proof-psi-phi-cases : (i : Unit) (xs : desc (IDescD I) (IDescl0 I)) (hs : desc (box (IDescD I) (IDescl0 I) xs) P) -> P (i , con xs) proof-psi-phi-cases Void (lvar , i) hs = refl proof-psi-phi-cases Void (lconst , x) hs = refl proof-psi-phi-cases Void (lprod , ( D , D' )) ( p , q ) = cong2 prodl p q proof-psi-phi-cases Void (lpi , ( S , T )) hs = cong (\T -> con (lpi {l = suc x} , ( S , T ) )) (trans (reflFun (\ s -> psi (phi (T (lifter (unlift s))))) (\ s -> psi (phi (T (s)))) (\s -> cong (\ s -> psi (phi (T (s)))) (proof-lift-unlift-eq s))) (reflFun (\s -> psi (phi (T s))) T hs)) proof-psi-phi-cases Void (lsigma , ( S , T )) hs = cong (\T -> con (lsigma {l = suc x} , ( S , T ) )) (trans (reflFun (\ s → psi (phi (T (lifter (unlift s))))) (\ s → psi (phi (T (s)))) (\s -> cong (\ s -> psi (phi (T (s)))) (proof-lift-unlift-eq s))) (reflFun (\s -> psi (phi (T s))) T hs))
45/beef/cw/cover.asm
minblock/msdos
0
82859
;* * CW : Cover.asm : Code Coverage kludge module _data segment byte public 'data' dgroup GROUP _data assume cs:dgroup assume ds:dgroup public crefCow crefCow DW 0 _data ends core segment byte public 'code' assume cs:core public GetCodeHandle GetCodeHandle: public GetCodeInfo GetCodeInfo: int 3 core ends ;******************************** end
src/Fragment/Algebra/Signature.agda
yallop/agda-fragment
18
17260
<reponame>yallop/agda-fragment {-# OPTIONS --without-K --exact-split --safe #-} module Fragment.Algebra.Signature where open import Data.Nat using (ℕ) record Signature : Set₁ where field ops : ℕ → Set open Signature public data ExtendedOp (Σ : Signature) (O : ℕ → Set) : ℕ → Set where newₒ : ∀ {n} → O n → ExtendedOp Σ O n oldₒ : ∀ {n} → ops Σ n → ExtendedOp Σ O n _⦅_⦆ : (Σ : Signature) → (ℕ → Set) → Signature Σ ⦅ O ⦆ = record { ops = ExtendedOp Σ O }
common/src/main/antlr/org/anti_ad/mc/common/prifiles/ProfilesLexer.g4
Fijiisland/Inventory-Profiles
0
7242
lexer grammar ProfilesLexer; WS : [\p{white_space}]+ -> skip ; PROFILE : 'profile'; ACTIVATE : 'activate'; HOT1 : 'HOT1'; HOT2 : 'HOT2'; HOT3 : 'HOT3'; HOT4 : 'HOT4'; HOT5 : 'HOT5'; HOT6 : 'HOT6'; HOT7 : 'HOT7'; HOT8 : 'HOT8'; HOT9 : 'HOT9'; CHESTPLATE : 'CHEST'; LEGS : 'LEGS'; FEET : 'FEET'; HEAD : 'HEAD'; OFFHAND : 'OFFHAND'; //ENCHANTMENTS: '"Enchantments"'; COMMA : ',' ; //fragment LBRACK : '['; //LBrack : WS? LBRACK; LBRACK : '[' ; RBRACK : ']' ; LBRACE : '{' ; RBRACE : '}' ; DQUOTE : '"' ; LID : 'id'; LVL : 'lvl'; S : 's'; COLON : ':'; SEMICOLON : ';'; //fragment ENCHANTMENTS : 'Enchantments'; ENCHANTMENTS : '"Enchantments" :'; POTION : '"Potion" :'; ARROW : '->'; //Arrow: WS? ARROW ; fragment ID: [a-zA-Z0-9_\-]+; fragment NUMBER: [0-9]+([a-z])?; Level: NUMBER; Id : ID; NamespacedId: DQUOTE ID ':' ID DQUOTE; STRING : '"' (ESC | SAFECODEPOINT)* '"' ; fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [0-9a-fA-F] ; fragment SAFECODEPOINT : ~ ["\\\u0000-\u001F] ;
test/Succeed/NoBlockOnLevel.agda
cruhland/agda
1,989
6651
<filename>test/Succeed/NoBlockOnLevel.agda -- {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v tc.meta:25 #-} module NoBlockOnLevel where open import Common.Level open import Common.Product BSetoid : ∀ c → Set (lsuc c) BSetoid c = Set c infixr 0 _⟶_ postulate _⟶_ : ∀ {f t} → BSetoid f → BSetoid t → Set (f ⊔ t) →-to-⟶ : ∀ {a b} {A : Set a} {B : BSetoid b} → (A → B) → A ⟶ B postulate a b p : Level A : Set a B : Set b P : A → B → Set p -- This will leave unsolved metas if we give up on an unsolved level constraint -- when checking argument spines. Since we can't match on levels it's safe to keep -- checking later constraints even if they depend on the unsolved levels. f : (∃ λ x → ∃ λ y → P x y) ⟶ (∃ λ y → ∃ λ x → P x y) f = →-to-⟶ λ p → proj₁ (proj₂ p) , proj₁ p , proj₂ (proj₂ p)
formalization/Data/Nat/Literal.agda
brunoczim/Celeste
1
17239
module Data.Nat.Literal where open import Data.Nat using (ℕ; suc; zero) open import Data.Fin using (Fin; suc; zero) open import Data.Unit using (⊤) open import Data.Empty using (⊥) open import Agda.Builtin.FromNat using (Number; fromNat) public _≤_ : ℕ → ℕ → Set zero ≤ n = ⊤ suc m ≤ zero = ⊥ suc m ≤ suc n = m ≤ n instance ℕ-num : Number ℕ ℕ-num .Number.Constraint _ = ⊤ ℕ-num .Number.fromNat n = n instance Fin-num : {n : ℕ} → Number (Fin (suc n)) Fin-num {n} .Number.Constraint m = m ≤ n Fin-num {n} .Number.fromNat m ⦃ p ⦄ = from m n p where from : (m n : ℕ) → m ≤ n → Fin (suc n) from zero _ _ = zero from (suc _) zero () from (suc m) (suc n) p = suc (from m n p)
src/fot/FOTC/Program/Division/ConversionRulesI.agda
asr/fotc
11
4683
<reponame>asr/fotc ------------------------------------------------------------------------------ -- Conversion rules for the division ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.Division.ConversionRulesI where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Data.Nat open import FOTC.Data.Nat.Inequalities open import FOTC.Program.Division.Division ------------------------------------------------------------------------------ -- Division properties private -- Before to prove some properties for div it is convenient -- to have a proof for each possible execution step. -- Initially, we define the possible states (div-s₁, div-s₂, ...) -- and after that, we write down the proof for the execution step -- from the state p to the state q, e.g. -- -- proof₂₋₃ : ∀ i j → div-s₂ i j ≡ div-s₃ i j. -- Initially, the conversion rule div-eq is applied. div-s₁ : D → D → D div-s₁ i j = if (lt i j) then zero else succ₁ (div (i ∸ j) j) -- lt i j ≡ true. div-s₂ : D → D → D div-s₂ i j = if true then zero else succ₁ (div (i ∸ j) j) -- lt i j ≡ false. div-s₃ : D → D → D div-s₃ i j = if false then zero else succ₁ (div (i ∸ j) j) -- The conditional is true. div-s₄ : D div-s₄ = zero -- The conditional is false. div-s₅ : D → D → D div-s₅ i j = succ₁ (div (i ∸ j) j) {- To prove the execution steps, e.g. proof₃₋₄ : ∀ i j → div-s₃ i j → divh_s₄ i j, we usually need to prove that ... m ... ≡ ... n ... (1) given that m ≡ n, (2) where (2) is a conversion rule usually. We prove (1) using subst : ∀ {x y} (A : D → Set) → x ≡ y → A x → A y where • P is given by \m → ... m ... ≡ ... n ..., • x ≡ y is given n ≡ m (actually, we use ≡-sym (m ≡ n)) and • P x is given by ... n ... ≡ ... n ... (i.e. ≡-refl) -} -- From div i j to div-s₁ using the equation div-eq. proof₀₋₁ : ∀ i j → div i j ≡ div-s₁ i j proof₀₋₁ i j = div-eq i j -- From div-s₁ to div-s₂ using the proof i<j. proof₁₋₂ : ∀ i j → i < j → div-s₁ i j ≡ div-s₂ i j proof₁₋₂ i j i<j = subst (λ t → (if t then zero else succ₁ (div (i ∸ j) j)) ≡ (if true then zero else succ₁ (div (i ∸ j) j)) ) (sym i<j) refl -- From div-s₁ to div-s₃ using the proof i≮j. proof₁₋₃ : ∀ i j → i ≮ j → div-s₁ i j ≡ div-s₃ i j proof₁₋₃ i j i≮j = subst (λ t → (if t then zero else succ₁ (div (i ∸ j) j)) ≡ (if false then zero else succ₁ (div (i ∸ j) j)) ) (sym i≮j) refl -- From div-s₂ to div-s₄ using the conversion rule if-true. proof₂₋₄ : ∀ i j → div-s₂ i j ≡ div-s₄ proof₂₋₄ i j = if-true zero -- From div-s₃ to div-s₅ using the conversion rule if-false. proof₃₋₅ : ∀ i j → div-s₃ i j ≡ div-s₅ i j proof₃₋₅ i j = if-false (succ₁ (div (i ∸ j) j)) ---------------------------------------------------------------------- -- The division result when the dividend is minor than the -- the divisor. div-x<y : ∀ {i j} → i < j → div i j ≡ zero div-x<y {i} {j} i<j = div i j ≡⟨ proof₀₋₁ i j ⟩ div-s₁ i j ≡⟨ proof₁₋₂ i j i<j ⟩ div-s₂ i j ≡⟨ proof₂₋₄ i j ⟩ div-s₄ ∎ ---------------------------------------------------------------------- -- The division result when the dividend is greater or equal than the -- the divisor. div-x≮y : ∀ {i j} → i ≮ j → div i j ≡ succ₁ (div (i ∸ j) j) div-x≮y {i} {j} i≮j = div i j ≡⟨ proof₀₋₁ i j ⟩ div-s₁ i j ≡⟨ proof₁₋₃ i j i≮j ⟩ div-s₃ i j ≡⟨ proof₃₋₅ i j ⟩ div-s₅ i j ∎
oeis/127/A127919.asm
neoneye/loda-programs
11
95435
; A127919: 1/3 of product of three numbers: the n-th prime, the previous number and the following number. ; Submitted by <NAME> ; 2,8,40,112,440,728,1632,2280,4048,8120,9920,16872,22960,26488,34592,49608,68440,75640,100232,119280,129648,164320,190568,234960,304192,343400,364208,408312,431640,480928,682752,749320,857072,895160,1102600,1147600,1289912,1443528,1552432,1725848,1911720,1976520,2322560,2396288,2548392,2626800,3131240,3696448,3898952,4002920,4216368,4550560,4665760,5271000,5658112,6063728,6488280,6634080,7084552,7395920,7554968,8384488,9644712,10026640,10221328,10618232,12088120,12757472,13927192,14169400 seq $0,40 ; The prime numbers. mov $2,$0 pow $2,3 sub $2,$0 mov $0,$2 div $0,3
oeis/002/A002586.asm
neoneye/loda-programs
11
18021
; A002586: Smallest prime factor of 2^n + 1. ; Submitted by <NAME> ; 3,5,3,17,3,5,3,257,3,5,3,17,3,5,3,65537,3,5,3,17,3,5,3,97,3,5,3,17,3,5,3,641,3,5,3,17,3,5,3,257,3,5,3,17,3,5,3,193,3,5,3,17,3,5,3,257,3,5,3,17,3,5,3,274177,3,5,3,17,3,5,3,97,3,5,3,17,3,5,3,65537,3,5,3,17,3,5,3,257,3,5,3,17,3,5,3,641,3,5,3,17 add $0,1 mov $1,2 pow $1,$0 mov $0,$1 seq $0,20639 ; Lpf(n): least prime dividing n (when n > 1); a(1) = 1. Or, smallest prime factor of n, or smallest prime divisor of n.
experiments/blink_rjmp.asm
daltonmatos/avrgcc-mixed-with-avrasm2
2
15732
<reponame>daltonmatos/avrgcc-mixed-with-avrasm2<gh_stars>1-10 .include "m328Pdef.inc" .org 0x0000 _blinks: rjmp _add _ret: ret _add: ldi r23, 0xa add r24, r23 rjmp _clear _clear: clr r1 clr r25 rjmp _ret
source/amf/uml/amf-uml-use_cases.ads
svn2github/matreshka
24
8312
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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 the Vadim Godunko, IE 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 -- -- HOLDER 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. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A use case is the specification of a set of actions performed by a system, -- which yields an observable result that is, typically, of value for one or -- more actors or other stakeholders of the system. ------------------------------------------------------------------------------ with AMF.UML.Behaviored_Classifiers; limited with AMF.UML.Classifiers.Collections; limited with AMF.UML.Extends.Collections; limited with AMF.UML.Extension_Points.Collections; limited with AMF.UML.Includes.Collections; limited with AMF.UML.Use_Cases.Collections; package AMF.UML.Use_Cases is pragma Preelaborate; type UML_Use_Case is limited interface and AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier; type UML_Use_Case_Access is access all UML_Use_Case'Class; for UML_Use_Case_Access'Storage_Size use 0; not overriding function Get_Extend (Self : not null access constant UML_Use_Case) return AMF.UML.Extends.Collections.Set_Of_UML_Extend is abstract; -- Getter of UseCase::extend. -- -- References the Extend relationships owned by this use case. not overriding function Get_Extension_Point (Self : not null access constant UML_Use_Case) return AMF.UML.Extension_Points.Collections.Set_Of_UML_Extension_Point is abstract; -- Getter of UseCase::extensionPoint. -- -- References the ExtensionPoints owned by the use case. not overriding function Get_Include (Self : not null access constant UML_Use_Case) return AMF.UML.Includes.Collections.Set_Of_UML_Include is abstract; -- Getter of UseCase::include. -- -- References the Include relationships owned by this use case. not overriding function Get_Subject (Self : not null access constant UML_Use_Case) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of UseCase::subject. -- -- References the subjects to which this use case applies. The subject or -- its parts realize all the use cases that apply to this subject. Use -- cases need not be attached to any specific subject, however. The -- subject may, but need not, own the use cases that apply to it. not overriding function All_Included_Use_Cases (Self : not null access constant UML_Use_Case) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is abstract; -- Operation UseCase::allIncludedUseCases. -- -- The query allIncludedUseCases() returns the transitive closure of all -- use cases (directly or indirectly) included by this use case. end AMF.UML.Use_Cases;
testData/parse/agda/ConstSquare.agda
dubinsky/intellij-dtlc
30
8190
{-# OPTIONS --cubical #-} open import Cubical.Core.Everything Sq : {A : Set} {a0 a1 b0 b1 : A} (u : a0 ≡ a1) (v : b0 ≡ b1) (r0 : a0 ≡ b0) (r1 : a1 ≡ b1) → Set Sq u v r0 r1 = PathP (λ i → r0 i ≡ r1 i) u v ConstSq : {A : Set} {a : A} (p : a ≡ a) → Sq p p p p ConstSq {A} p i j = compCCHM (λ _ → A) (~ i ∨ i ∨ ~ j ∨ j) (λ k → λ { (i = i0) → p j ; (i = i1) → p (k ∧ j) ; (j = i0) → p i ; (j = i1) → p (k ∧ i) }) (p (i ∨ j))
gcc-gcc-7_3_0-release/gcc/ada/a-numaux-darwin.adb
best08618/asylo
7
21736
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . N U M E R I C S . A U X -- -- -- -- B o d y -- -- (Apple OS X Version) -- -- -- -- Copyright (C) 1998-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Ada.Numerics.Aux is ----------------------- -- Local subprograms -- ----------------------- procedure Reduce (X : in out Double; Q : out Natural); -- Implements reduction of X by Pi/2. Q is the quadrant of the final -- result in the range 0 .. 3. The absolute value of X is at most Pi/4. -- The following three functions implement Chebishev approximations -- of the trigonometric functions in their reduced domain. -- These approximations have been computed using Maple. function Sine_Approx (X : Double) return Double; function Cosine_Approx (X : Double) return Double; pragma Inline (Reduce); pragma Inline (Sine_Approx); pragma Inline (Cosine_Approx); function Cosine_Approx (X : Double) return Double is XX : constant Double := X * X; begin return (((((16#8.DC57FBD05F640#E-08 * XX - 16#4.9F7D00BF25D80#E-06) * XX + 16#1.A019F7FDEFCC2#E-04) * XX - 16#5.B05B058F18B20#E-03) * XX + 16#A.AAAAAAAA73FA8#E-02) * XX - 16#7.FFFFFFFFFFDE4#E-01) * XX - 16#3.655E64869ECCE#E-14 + 1.0; end Cosine_Approx; function Sine_Approx (X : Double) return Double is XX : constant Double := X * X; begin return (((((16#A.EA2D4ABE41808#E-09 * XX - 16#6.B974C10F9D078#E-07) * XX + 16#2.E3BC673425B0E#E-05) * XX - 16#D.00D00CCA7AF00#E-04) * XX + 16#2.222222221B190#E-02) * XX - 16#2.AAAAAAAAAAA44#E-01) * (XX * X) + X; end Sine_Approx; ------------ -- Reduce -- ------------ procedure Reduce (X : in out Double; Q : out Natural) is Half_Pi : constant := Pi / 2.0; Two_Over_Pi : constant := 2.0 / Pi; HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size); M : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant P1 : constant Double := Double'Leading_Part (Half_Pi, HM); P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM); P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM); P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM); P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3 - P4, HM); P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5); K : Double; begin -- For X < 2.0**HM, all products below are computed exactly. -- Due to cancellation effects all subtractions are exact as well. -- As no double extended floating-point number has more than 75 -- zeros after the binary point, the result will be the correctly -- rounded result of X - K * (Pi / 2.0). K := X * Two_Over_Pi; while abs K >= 2.0 ** HM loop K := K * M - (K * M - K); X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6; K := X * Two_Over_Pi; end loop; -- If K is not a number (because X was not finite) raise exception if K /= K then raise Constraint_Error; end if; K := Double'Rounding (K); Q := Integer (K) mod 4; X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6; end Reduce; --------- -- Cos -- --------- function Cos (X : Double) return Double is Reduced_X : Double := abs X; Quadrant : Natural range 0 .. 3; begin if Reduced_X > Pi / 4.0 then Reduce (Reduced_X, Quadrant); case Quadrant is when 0 => return Cosine_Approx (Reduced_X); when 1 => return Sine_Approx (-Reduced_X); when 2 => return -Cosine_Approx (Reduced_X); when 3 => return Sine_Approx (Reduced_X); end case; end if; return Cosine_Approx (Reduced_X); end Cos; --------- -- Sin -- --------- function Sin (X : Double) return Double is Reduced_X : Double := X; Quadrant : Natural range 0 .. 3; begin if abs X > Pi / 4.0 then Reduce (Reduced_X, Quadrant); case Quadrant is when 0 => return Sine_Approx (Reduced_X); when 1 => return Cosine_Approx (Reduced_X); when 2 => return Sine_Approx (-Reduced_X); when 3 => return -Cosine_Approx (Reduced_X); end case; end if; return Sine_Approx (Reduced_X); end Sin; end Ada.Numerics.Aux;
src/q_bingo-q_gtk-q_intl.ads
jfuica/bingada
4
3155
--***************************************************************************** --* --* PROJECT: Bingada --* --* FILE: q_bingo-q_gtk-q_intl.ads --* --* AUTHOR: <NAME> --* --***************************************************************************** package Q_Bingo.Q_Gtk.Q_Intl is procedure P_Initialise; end Q_Bingo.Q_Gtk.Q_Intl;
src/main/antlr/com/deflatedpickle/red/RedParser.g4
DeflatedPickles-Old-Repositories/intellij-red
0
5200
/* Parser */ parser grammar RedParser; options { language=Java; tokenVocab=RedLexer; } program: header line* EOF; line: statement; header: TITLE OPEN_BRKT header_assignment* CLOSE_BRKT; statement: print_stmt | assignment | header_assignment; value: STRING | NUMBER | ID; assignment: ID TYPE? ASSIGN value; header_assignment: OPTION ASSIGN value; print_stmt: PRINT value;
tests/maps-test_data-tests.ads
thindil/steamsky
80
3423
-- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with Gnattest_Generated; package Maps.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.Maps.Test_Data .Test with null record; procedure Test_CountDistance_ecd188_2a2146(Gnattest_T: in out Test); -- maps.ads:63:4:CountDistance:Test_CountDistance procedure Test_NormalizeCoord_6338a5_1a8ae8(Gnattest_T: in out Test); -- maps.ads:77:4:NormalizeCoord:Test_NormalizeCoord end Maps.Test_Data.Tests; -- end read only
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt50.adb
best08618/asylo
7
24356
-- { dg-do run } -- { dg-options "-O3 -gnatn" } with Opt50_Pkg; use Opt50_Pkg; procedure Opt50 is B : Boolean; E : Enum; begin Get ("four", E, B); if B = True then raise Program_Error; end if; Get ("three", E, B); if B = False then raise Program_Error; end if; declare A : Enum_Boolean_Array (One .. E) := (others => True); begin Set (A); end; end Opt50;
src/draw_ball.asm
tina-hoeflich/pong
0
20607
# Authors: <NAME>, <NAME>, <NAME> # Draws the ball of the pong game using the draw_circle function. # Note: This only acts as an init function on startup. draw_ball: #----Inputs:---- # a1: x coordinate of center # a2: y coordinate of center #Save all necessary values to the stack addi sp, sp, -12 sw ra, (sp) sw a1, 4 (sp) sw a2, 8 (sp) # calc start & end point addi a3, a1, -3 # x = a1 - radius // left boundary of rectangle addi a4, a2, -3 addi a5, a1, 3 addi a6, a2, 3 li a7, 0xffffff jal draw_rectangle #Restore and jump back lw ra, 0 (sp) lw a1, 4 (sp) lw a2, 8 (sp) addi sp, sp, 12 ret li a7, 10 ecall #.include "draw_rectangle.asm"
src/diskio.asm
poletaevvlad/http-asm
7
16058
%include "bufferutils.asm" %define open_sc 2 %define fstat_sc 5 %define getdents_sc 78 %define write_sc 1 %define close_sc 3 %define S_IFDIR 0040000o %define S_IFREG 0100000o %define S_IFMT 0170000o %define EACCESS 13 %define ENOENT 2 section .bss path resq 1 pathLength resq 1 section .data respFile db "HTTP/1.0 200 OK", 13, 10, "Connection: Closed", 13, 10, 13, 10 respFileLength equ $ - respFile dirTemplatePrefix incbin "res/dir-template-prefix" db 0 dirTemplatePostfix incbin "res/dir-template-postfix" dirTemplatePostfixLength equ $ - dirTemplatePostfix dirTemplateEntry db ' <a href="/%%">%</a><br>', 13, 10, 0 error400 db "400 Bad Request", 0 error403 db "403 Forbidden", 0 error404 db "404 Not Found", 0 error405 db "405 Method Not Allowed", 0 errorTemplate incbin "res/error-template" db 0 rootDirectory db "[root]", 0 section .text ; input: rdi - pointer to error description ; rsi - file descriptor _send_error: push rbp mov rbp, rsp push rdi push rdi push rdi mov rdi, errorTemplate mov rdx, rsi lea rsi, [rbp - 24] call _write_template add rsp, 24 pop rbp ret ; input: rdi - file descripor ; output: rax - mode_t of a file ; mutates: rsi _get_file_type: push rbp mov rbp, rsp mov rax, fstat_sc lea rsi, [rbp - 144] syscall mov eax, [rbp - 120] cdqe pop rbp ret ; input: rdi - destination file descriptor ; rsi - source file descriptor ; output: none ; mutates: rdx, rsi _send_file_contents: push rbp push rbx mov rbp, rsp sub rsp, 1024 mov rbx, rsi mov eax, write_sc mov rsi, respFile mov rdx, respFileLength syscall lea rsi, [rbp - 1024] .loop: xchg rdi, rbx xor rax, rax ; read_sc mov rdx, 1024 syscall test rax, rax jz .end xchg rbx, rdi mov rdx, rax mov rax, write_sc syscall jmp .loop .end: mov rsp, rbp pop rbx pop rbp ret ; input: rdi - buffer start pointer ; rsi - buffer end pointer ; rdx - file descriptor that the buffer will be flushed into ; rcx - data to be pushed into the buffer ; r8 - parent path ; output: rax - new buffer end point ; mutates: r8, rsi _push_dir_entry: push rcx push rcx push r8 mov rcx, dirTemplateEntry mov r8, rsp call _buffer_push_template_values add rsp, 16 pop rcx ret ; input: rdi - pointer to file path ; output: rax - poitner to the file name ; r13 - end of directory name _get_file_name: push rcx mov cl, [rdi] test cl, cl jz .root .loop_to_end: mov cl, [rdi] test cl, cl jz .end_found inc rdi jmp .loop_to_end .end_found: dec rdi mov [rdi], WORD 0 mov r13, rdi dec rdi .loop_name: dec rdi mov cl, [rdi] cmp cl, '/' jne .loop_name inc rdi mov rax, rdi jmp .end .root: mov rax, rootDirectory lea r13, [rdi - 1] .end: pop rcx ret ; input: rdi - destination file descriptor ; rsi - source file descriptor ; rdx - file path ; output: none _send_directory_contents: push rbp mov rbp, rsp sub rsp, 4096 + BUFFER_SIZE mov rbx, rdi mov rdi, rdx mov rax, [pathLength] add rdx, rax mov r14, rdx mov rdi, rdx call _get_file_name push rax push rax mov rax, getdents_sc mov rdi, rsi lea rsi, [rbp - 4096] mov rdx, 4096 syscall lea r10, [rbp - 4096] add r10, rax lea rdi, [rbp - 4096 - BUFFER_SIZE] mov rsi, rdi mov rdx, rbx mov rcx, dirTemplatePrefix mov r8, rsp call _buffer_push_template_values mov r9, rax mov [r13], WORD '/' add rsp, 16 lea rsi, [rbp - 4096] .loop: mov cl, [rsi + 18] cmp cl, '.' je .skip_print xor rcx, rcx mov cx, [rsi + 16] sub cx, 20 push rsi lea rdi, [rbp - 4096 - BUFFER_SIZE] mov rdx, rbx lea rcx, [rsi + 18] mov rsi, r9 mov r8, r14 call _push_dir_entry mov r9, rax pop rsi .skip_print: xor rax, rax mov ax, [rsi + 16] add rsi, rax cmp rsi, r10 jb .loop lea rdi, [rbp - 4096 - BUFFER_SIZE] mov rsi, r9 mov rdx, rbx mov rcx, dirTemplatePostfix mov r8, dirTemplatePostfixLength call _buffer_push mov rsi, rax call _buffer_flush mov rsp, rbp pop rbp ret ; input: rdi - address of zero-terminated file name ; rsi - socket descriptor ; output: none _serve_file: mov rbx, rsi mov rax, open_sc xor rsi, rsi syscall cmp eax, 0 jl .error mov r9, rdi push rax mov rdi, rax call _get_file_type and rax, S_IFMT test eax, S_IFDIR jnz .directory test eax, S_IFREG jnz .regular_file ; Unsupported file type jmp .error_no_access .regular_file: mov rsi, rdi mov rdi, rbx call _send_file_contents jmp .end .directory: mov rsi, rdi mov rdi, rbx mov rdx, r9 xor rbx, rbx .dir_end_loop: mov cl, [rdx + rbx] test cl, cl jz .dir_end_found inc rbx jmp .dir_end_loop .dir_end_found: mov cl, [rdx + rbx - 1] cmp cl, '/' je .skip_add_slash mov BYTE [rdx + rbx], '/' mov BYTE [rdx + rbx + 1], 0 .skip_add_slash: call _send_directory_contents jmp .end .error: push 0 neg eax cmp eax, EACCESS je .error_no_access cmp eax, ENOENT je .error_no_file ; `open` system call has failed for unexpected reason ; defaulting to "403 Forbidden" .error_no_access: mov rdi, error403 mov rsi, rbx call _send_error jmp .end .error_no_file: mov rdi, error404 mov rsi, rbx call _send_error .end: pop rdi test rdi, rdi jz .skip_close mov rax, close_sc syscall .skip_close: ret
programs/oeis/256/A256818.asm
jmorken/loda
1
3593
; A256818: Number of length n+3 0..1 arrays with at most two downsteps in every n consecutive neighbor pairs. ; 16,32,64,128,245,442,753,1220,1894,2836,4118,5824,8051,10910,14527,19044,24620,31432,39676,49568,61345,75266,91613,110692,132834,158396,187762,221344,259583,302950,351947,407108,469000,538224,615416,701248 mov $2,$0 add $2,5 bin $2,$0 mov $4,$0 mul $0,10 add $0,$2 add $0,6 mov $5,11 add $5,$0 mov $1,$5 sub $1,2 mov $3,$4 mul $3,$4 mul $3,$4 add $1,$3
src/Experimental/AlgebraFormalization.agda
cilinder/formaltt
21
11537
open import Agda.Primitive open import Agda.Builtin.Equality renaming (_≡_ to _==_) --(( If I want to rename the built-in equality )) module AlgebraFormalization where -- Here is an attempt to translate (part of) the Coq formalization. I did not translate the definition of the free algebra, the proof, and the part concerning the groups yet. I hope I did not do too weird things with the levels. -- ** Formalization of single-sorted algebraic theories ** -- Function extensionality postulate funext : ∀ {X : Set} {Y : X → Set} {f g : ∀ (x : X) → (Y x)} → (∀ (x : X) → ((f x) == (g x))) → (f == g) -- Operation Signature record OpSignature {l : Level} : Set (lsuc l) where field operation : Set l arity : operation → Set l -- I used the things with the levels of the hierachy of types because Agda was unhappy with what I was doing (and I did not want to define it only with Set₀ and Set₁ beacause I wanted to avoid weird things if we then want to define an OpSignature with an operation OpSignature) -- Here is a attempt (partial for the moment) to add context and terms, based on the same principles as in the file "ManySortedAlgebra.agda" -- Contexts record Context {l : Level} (Σ : OpSignature {l}) : Set (lsuc l) where field var : Set l open Context -- Terms on an operation signature data Term {l : Level} {Σ : OpSignature {l}} (Γ : Context Σ) : Set l where tm-var : ∀ (x : var Γ) → Term Γ tm-op : ∀ (f : OpSignature.operation Σ) → (OpSignature.arity Σ f → Term Γ) → Term Γ substitution : ∀ {l : Level} {Σ : OpSignature {l}} (Γ Δ : Context Σ) → Set l substitution Γ Δ = ∀ (x : var Γ) → Term Δ -- the action of a substitution on a term _·_ : ∀ {l : Level} {Σ : OpSignature {l}} {Γ Δ : Context Σ} → substitution Γ Δ → Term Γ → Term Δ σ · (tm-var x) = σ x σ · (tm-op f x) = tm-op f (λ i → σ · x i) infixr 6 _·_ -- composition of substitutions _○_ : ∀ {l : Level} {Σ : OpSignature {l}} {Γ Δ Θ : Context Σ} → substitution Δ Θ → substitution Γ Δ → substitution Γ Θ (σ ○ τ) x = σ · τ x infixl 7 _○_ -- End of the attempt -- Operation Algebra record OpAlgebra {l : Level} (S : OpSignature {l}) : Set (lsuc l) where field carrier : Set l op : ∀ (o : OpSignature.operation S) (f : OpSignature.arity S o → carrier) → carrier -- Homomorphisms record Hom {l : Level} {S : OpSignature {l}} (A : OpAlgebra {l} S) (B : OpAlgebra {l} S) : Set (lsuc l) where field map : (OpAlgebra.carrier A) → (OpAlgebra.carrier B) op-commute : ∀ (o : OpSignature.operation S) (args : OpSignature.arity S o → OpAlgebra.carrier A) → (map (OpAlgebra.op A o args) == OpAlgebra.op B o (λ x → map (args x) )) -- For the moment I skip the translation of the part concerning the free algebra -- Attempt to formalize the Equational theories diffenrently, based on what is done in the file "ManySortedAglebra.agda" -- Equational Theory (equations are seen as "in a context" and not with arities anymore) record EquationalTheory {l : Level} (Σ : OpSignature {l}) : Set (lsuc l) where field eq : Set l eq-ctx : ∀ (ε : eq) → Context {l} Σ eq-lhs : ∀ (ε : eq) → Term (eq-ctx ε) eq-rhs : ∀ (ε : eq) → Term (eq-ctx ε) open EquationalTheory -- Equality of terms infix 4 _≡_ data _≡_ {l : Level} {Σ : OpSignature {l}} {T : EquationalTheory {l} Σ } : {Γ : Context Σ} → Term Γ → Term Γ → Set (lsuc l) where -- general rules eq-refl : ∀ {Γ} {t : Term Γ } → t ≡ t eq-symm : ∀ {Γ} {s t : Term {l} {Σ} Γ } → _≡_ {T = T} s t → t ≡ s eq-tran : ∀ {Γ} {s t u : Term Γ } → _≡_ {T = T} s t → _≡_ {T = T} t u → s ≡ u -- congruence rule eq-congr : ∀ {Γ} {f : OpSignature.operation Σ} (x y : ∀ (i : OpSignature.arity Σ f) → Term Γ) → (∀ i → _≡_ {_} {_} {T} (x i) (y i)) → ((tm-op f x) ≡ (tm-op f y)) -- equational axiom eq-axiom : ∀ (ε : eq T) {Δ : Context {l} Σ} (σ : substitution (eq-ctx T ε) Δ) → ((σ · eq-lhs T ε) ≡ (σ · eq-rhs T ε)) -- composition is functorial subst-○ : ∀ {l : Level} {Σ : OpSignature {l}} {T : EquationalTheory Σ} {Γ Δ Θ : Context Σ} (σ : substitution Δ Θ) (τ : substitution Γ Δ) → ∀ (t : Term Γ ) → _≡_ {T = T} (σ · τ · t) (σ ○ τ · t) subst-○ σ τ (tm-var x) = eq-refl subst-○ σ τ (tm-op f x) = eq-congr (λ i → σ · τ · x i) (λ i → σ ○ τ · x i) λ i → subst-○ σ τ (x i) -- substitution preserves equality eq-subst : ∀ {l : Level} {Σ : OpSignature {l}} {T : EquationalTheory Σ} {Γ Δ : Context Σ} (σ : substitution Γ Δ) {s t : Term Γ} → _≡_ {T = T} s t → _≡_ {T = T} (σ · s) (σ · t) eq-subst σ eq-refl = eq-refl eq-subst σ (eq-symm ξ) = eq-symm (eq-subst σ ξ) eq-subst σ (eq-tran ζ ξ) = eq-tran (eq-subst σ ζ) (eq-subst σ ξ) eq-subst σ (eq-congr x y ξ) = eq-congr (λ i → σ · x i) (λ i → σ · y i) λ i → eq-subst σ (ξ i) eq-subst {T = T} σ (eq-axiom ε τ) = eq-tran (subst-○ σ τ (eq-lhs T ε)) (eq-tran (eq-axiom ε (σ ○ τ)) (eq-symm (subst-○ σ τ (eq-rhs T ε)))) -- End of the attempt -- Equation Signature record EqSignature {l : Level} (S : OpSignature {l}) : Set (lsuc l) where field eq : Set l eq-arity : eq → Set l -- the two sides of the equation lhs : ∀ {A : OpAlgebra {l} S} {e : eq} → ((eq-arity e) → (OpAlgebra.carrier A)) → (OpAlgebra.carrier A) rhs : ∀ {A : OpAlgebra {l} S} {e : eq} → ((eq-arity e) → (OpAlgebra.carrier A)) → (OpAlgebra.carrier A) -- naturality / commutation lhs-natural : ∀ (A B : OpAlgebra {l} S) (f : Hom A B) (e : eq) (args : eq-arity e → OpAlgebra.carrier A) → ( (Hom.map f) (lhs {A} {e} args) == lhs {B} {e} (λ i → (Hom.map f) (args i))) rhs-natural : ∀ (A B : OpAlgebra {l} S) (f : Hom A B) (e : eq) (args : eq-arity e → OpAlgebra.carrier A) → ( (Hom.map f) (rhs {A} {e} args) == rhs {B} {e} (λ i → (Hom.map f) (args i))) -- Algebra record Algebra {l : Level} (S : OpSignature {l}) (E : EqSignature {l} S) : Set (lsuc l) where field alg : OpAlgebra S equations : ∀ (e : EqSignature.eq E) (args : EqSignature.eq-arity E e → OpAlgebra.carrier alg) → (EqSignature.rhs E {alg} {e} args == EqSignature.lhs E {alg} {e} args) -- For the moment, I think that we did not talk about terms in contexts, did we ? Should we generalize the things we did in Lambda.agda (using De Bruijn indices for the variables) ? -> I tried things -- ** Other things ** -- Useful arities data nullary : Set where data unary : Set where only : unary data binary : Set where fst : binary snd : binary -- Definition of groups data GroupOperation : Set where one : GroupOperation mul : GroupOperation inv : GroupOperation GroupArity : (o : GroupOperation) → Set GroupArity one = nullary GroupArity mul = binary GroupArity inv = unary GroupOp : OpSignature GroupOp = record { operation = GroupOperation ; arity = GroupArity}
src/Container/List.agda
nad/equality
3
836
------------------------------------------------------------------------ -- The list container ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Equality module Container.List {c⁺} (eq : ∀ {a p} → Equality-with-J a p c⁺) where open Derived-definitions-and-properties eq open import Logical-equivalence using (_⇔_; module _⇔_) open import Prelude as P hiding (List; []; _∷_; id; _∘_) open import Bag-equivalence eq using () renaming (_≈-bag_ to _≈-bagL_; _∈_ to _∈L_; Any to AnyL) open import Bijection eq using (_↔_; module _↔_; Σ-≡,≡↔≡) open import Container eq open import Fin eq open import Function-universe eq open import H-level.Closure eq import List eq as L open import Surjection eq using (_↠_) ------------------------------------------------------------------------ -- The type -- Lists. List : Container lzero List = ℕ ▷ Fin ------------------------------------------------------------------------ -- The definitions of lists and bag equivalence for lists given in -- Container/Container.List and in Prelude/Bag-equivalence are closely -- related -- There is a split surjection from ⟦ List ⟧ A to P.List A. List↠List : {A : Type} → ⟦ List ⟧ A ↠ P.List A List↠List {A} = record { logical-equivalence = record { to = uncurry to ; from = from } ; right-inverse-of = to∘from } where to : (n : ℕ) → (Fin n → A) → P.List A to zero f = P.[] to (suc n) f = P._∷_ (f fzero) (to n (f ∘ fsuc)) from = λ xs → (L.length xs , L.index xs) to∘from : ∀ xs → uncurry to (from xs) ≡ xs to∘from P.[] = refl _ to∘from (P._∷_ x xs) = cong (P._∷_ x) (to∘from xs) -- If we assume that equality of functions is extensional, then we can -- also prove that the two definitions are isomorphic. List↔List : Extensionality lzero lzero → {A : Type} → ⟦ List ⟧ A ↔ P.List A List↔List ext {A} = record { surjection = List↠List ; left-inverse-of = uncurry from∘to } where open _↠_ List↠List from∘to : ∀ n f → from (to (n , f)) ≡ (n , f) from∘to zero f = cong (_,_ _) (apply-ext ext λ ()) from∘to (suc n) f = (suc (L.length (to xs)) , L.index (P._∷_ x (to xs))) ≡⟨ elim¹ (λ {ys} _ → _≡_ {A = ⟦ List ⟧ A} (suc (L.length (to xs)) , L.index (P._∷_ x (to xs))) (suc (proj₁ ys) , [ (λ _ → x) , proj₂ ys ])) (cong (suc (L.length (to xs)) ,_) $ apply-ext ext [ (λ _ → refl _) , (λ _ → refl _) ]) (from∘to n (f ∘ inj₂)) ⟩ (suc n , [ (λ _ → x) , f ∘ inj₂ ]) ≡⟨ cong (_,_ _) (apply-ext ext [ (λ _ → refl _) , (λ _ → refl _) ]) ⟩∎ (suc n , f) ∎ where x = f (inj₁ tt) xs = (n , f ∘ inj₂) -- The two definitions of Any are isomorphic (both via "to" and -- "from"). Any↔Any-to : {A : Type} (P : A → Type) (xs : ⟦ List ⟧ A) → Any P xs ↔ AnyL P (_↠_.to List↠List xs) Any↔Any-to {A} P = uncurry Any↔Any-to′ where Any↔Any-to′ : (n : ℕ) (lkup : Fin n → A) → Any {C = List} P (n , lkup) ↔ AnyL P (_↠_.to List↠List (n , lkup)) Any↔Any-to′ zero lkup = (∃ λ (p : Fin zero) → P (lkup p)) ↔⟨ ∃-Fin-zero _ ⟩ ⊥ □ Any↔Any-to′ (suc n) lkup = (∃ λ (p : Fin (suc n)) → P (lkup p)) ↔⟨ ∃-Fin-suc _ ⟩ P (lkup fzero) ⊎ Any {C = List} P (n , lkup ∘ fsuc) ↔⟨ id ⊎-cong Any↔Any-to′ n (lkup ∘ fsuc) ⟩ P (lkup fzero) ⊎ AnyL P (_↠_.to List↠List (n , lkup ∘ fsuc)) □ Any-from↔Any : {A : Type} (P : A → Type) (xs : P.List A) → Any P (_↠_.from List↠List xs) ↔ AnyL P xs Any-from↔Any P P.[] = (∃ λ (p : Fin zero) → P (L.index P.[] p)) ↔⟨ ∃-Fin-zero _ ⟩ ⊥ □ Any-from↔Any P (P._∷_ x xs) = (∃ λ (p : Fin (suc (L.length xs))) → P (L.index (P._∷_ x xs) p)) ↔⟨ ∃-Fin-suc _ ⟩ P x ⊎ Any {C = List} P (_↠_.from List↠List xs) ↔⟨ id ⊎-cong Any-from↔Any P xs ⟩ P x ⊎ AnyL P xs □ -- The definition of bag equivalence in Bag-equivalence and the one in -- Container, instantiated with the List container, are logically -- equivalent (both via "to" and "from"). ≈-⇔-to-≈-to : {A : Type} {xs ys : ⟦ List ⟧ A} → xs ≈-bag ys ⇔ _↠_.to List↠List xs ≈-bagL _↠_.to List↠List ys ≈-⇔-to-≈-to {xs = xs} {ys} = record { to = λ xs≈ys z → z ∈L (_↠_.to List↠List xs) ↔⟨ inverse $ Any↔Any-to _ xs ⟩ z ∈ xs ↔⟨ xs≈ys z ⟩ z ∈ ys ↔⟨ Any↔Any-to _ ys ⟩ z ∈L (_↠_.to List↠List ys) □ ; from = λ xs≈ys z → z ∈ xs ↔⟨ Any↔Any-to _ xs ⟩ z ∈L (_↠_.to List↠List xs) ↔⟨ xs≈ys z ⟩ z ∈L (_↠_.to List↠List ys) ↔⟨ inverse $ Any↔Any-to _ ys ⟩ z ∈ ys □ } ≈-⇔-from-≈-from : {A : Type} {xs ys : P.List A} → xs ≈-bagL ys ⇔ _↠_.from List↠List xs ≈-bag _↠_.from List↠List ys ≈-⇔-from-≈-from {xs = xs} {ys} = record { to = λ xs≈ys z → z ∈ (_↠_.from List↠List xs) ↔⟨ Any-from↔Any _ xs ⟩ z ∈L xs ↔⟨ xs≈ys z ⟩ z ∈L ys ↔⟨ inverse $ Any-from↔Any _ ys ⟩ z ∈ (_↠_.from List↠List ys) □ ; from = λ xs≈ys z → z ∈L xs ↔⟨ inverse $ Any-from↔Any _ xs ⟩ z ∈ (_↠_.from List↠List xs) ↔⟨ xs≈ys z ⟩ z ∈ (_↠_.from List↠List ys) ↔⟨ Any-from↔Any _ ys ⟩ z ∈L ys □ } ------------------------------------------------------------------------ -- Constructors [] : {A : Type} → ⟦ List ⟧ A [] = (zero , λ ()) infixr 5 _∷_ _∷_ : {A : Type} → A → ⟦ List ⟧ A → ⟦ List ⟧ A x ∷ (n , lkup) = (suc n , [ (λ _ → x) , lkup ]) -- Even if we don't assume extensionality we can prove that -- intensionally distinct implementations of the constructors are bag -- equivalent. []≈ : {A : Type} {lkup : _ → A} → _≈-bag_ {C₂ = List} [] (zero , lkup) []≈ _ = record { surjection = record { logical-equivalence = record { to = λ { (() , _) } ; from = λ { (() , _) } } ; right-inverse-of = λ { (() , _) } } ; left-inverse-of = λ { (() , _) } } ∷≈ : ∀ {A : Type} {n} {lkup : _ → A} → _≈-bag_ {C₂ = List} (lkup (inj₁ tt) ∷ (n , lkup ∘ inj₂)) (suc n , lkup) ∷≈ _ = record { surjection = record { logical-equivalence = record { to = λ { (inj₁ tt , eq) → (inj₁ tt , eq) ; (inj₂ s , eq) → (inj₂ s , eq) } ; from = λ { (inj₁ tt , eq) → (inj₁ tt , eq) ; (inj₂ s , eq) → (inj₂ s , eq) } } ; right-inverse-of = λ { (inj₁ tt , eq) → refl _ ; (inj₂ s , eq) → refl _ } } ; left-inverse-of = λ { (inj₁ tt , eq) → refl _ ; (inj₂ s , eq) → refl _ } } -- Any lemmas for the constructors. Any-[] : {A : Type} (P : A → Type) → Any P [] ↔ ⊥₀ Any-[] _ = record { surjection = record { logical-equivalence = record { to = λ { (() , _) } ; from = λ () } ; right-inverse-of = λ () } ; left-inverse-of = λ { (() , _) } } Any-∷ : ∀ {A : Type} (P : A → Type) {x xs} → Any P (x ∷ xs) ↔ P x ⊎ Any P xs Any-∷ _ = record { surjection = record { logical-equivalence = record { to = λ { (inj₁ tt , eq) → inj₁ eq ; (inj₂ s , eq) → inj₂ (s , eq) } ; from = λ { (inj₁ eq) → (inj₁ tt , eq) ; (inj₂ (s , eq)) → (inj₂ s , eq) } } ; right-inverse-of = λ { (inj₁ eq) → refl _ ; (inj₂ (s , eq)) → refl _ } } ; left-inverse-of = λ { (inj₁ tt , eq) → refl _ ; (inj₂ s , eq) → refl _ } } ------------------------------------------------------------------------ -- More functions -- A fold for lists. (Well, this is not a catamorphism, it is a -- paramorphism.) fold : {A B : Type} → B → (A → ⟦ List ⟧ A → B → B) → ⟦ List ⟧ A → B fold {A} {B} nl cns = uncurry fold′ where fold′ : (n : ℕ) → (Fin n → A) → B fold′ zero lkup = nl fold′ (suc n) lkup = cns (lkup fzero) (n , lkup ∘ fsuc) (fold′ n (lkup ∘ fsuc)) -- A lemma which can be used to prove properties about fold. -- -- The "respects bag equivalence" argument could be omitted if -- equality of functions were extensional. fold-lemma : ∀ {A B : Type} {nl : B} {cns : A → ⟦ List ⟧ A → B → B} (P : ⟦ List ⟧ A → B → Type) → (∀ xs ys → xs ≈-bag ys → ∀ b → P xs b → P ys b) → P [] nl → (∀ x xs b → P xs b → P (x ∷ xs) (cns x xs b)) → ∀ xs → P xs (fold nl cns xs) fold-lemma {A} {nl = nl} {cns} P resp P-nl P-cns = uncurry fold′-lemma where fold′-lemma : ∀ n (lkup : Fin n → A) → P (n , lkup) (fold nl cns (n , lkup)) fold′-lemma zero lkup = resp _ _ []≈ _ P-nl fold′-lemma (suc n) lkup = resp _ _ ∷≈ _ $ P-cns _ _ _ $ fold′-lemma n (lkup ∘ fsuc) -- Why have I included both fold and fold-lemma rather than simply a -- dependent eliminator? I tried this, and could easily define the -- functions I wanted to define. However, the functions were defined -- together with (partial) correctness proofs, and were unnecessarily -- hard to read. I wanted to be able to define functions which were -- easy to read, like the _++_ function below, and then have the -- option to prove properties about them, like Any-++. -- -- Unfortunately this turned out to be harder than expected. When -- proving the Any-++ lemma it seemed as if I had to prove that _++_ -- preserves bag equivalence in its first argument in order to -- instantiate the "respects bag equivalence" argument. However, my -- preferred proof of this property uses Any-++… -- -- An alternative could be to assume that equality of functions is -- extensional, in which case the "respects bag equivalence" argument -- could be removed. Another option would be to listen to Conor -- McBride and avoid higher-order representations of first-order data. -- Append. infixr 5 _++_ _++_ : {A : Type} → ⟦ List ⟧ A → ⟦ List ⟧ A → ⟦ List ⟧ A xs ++ ys = fold ys (λ z _ zs → z ∷ zs) xs -- An Any lemma for append. Any-++ : ∀ {A : Type} (P : A → Type) xs ys → Any P (xs ++ ys) ↔ Any P xs ⊎ Any P ys Any-++ P xs ys = fold-lemma (λ xs xs++ys → Any P xs++ys ↔ Any P xs ⊎ Any P ys) (λ us vs us≈vs us++ys hyp → Any P us++ys ↔⟨ hyp ⟩ Any P us ⊎ Any P ys ↔⟨ _⇔_.to (∼⇔∼″ us vs) us≈vs P ⊎-cong id ⟩ Any P vs ⊎ Any P ys □) (Any P ys ↔⟨ inverse ⊎-left-identity ⟩ ⊥ ⊎ Any P ys ↔⟨ inverse (Any-[] P) ⊎-cong id ⟩ Any P [] ⊎ Any P ys □) (λ x xs xs++ys ih → Any P (x ∷ xs++ys) ↔⟨ Any-∷ P ⟩ P x ⊎ Any P xs++ys ↔⟨ id ⊎-cong ih ⟩ P x ⊎ Any P xs ⊎ Any P ys ↔⟨ ⊎-assoc ⟩ (P x ⊎ Any P xs) ⊎ Any P ys ↔⟨ inverse (Any-∷ P) ⊎-cong id ⟩ Any P (x ∷ xs) ⊎ Any P ys □) xs
data/mapHeaders/route25.asm
adhi-thirumala/EvoYellow
16
244144
<reponame>adhi-thirumala/EvoYellow<gh_stars>10-100 Route25_h: db OVERWORLD ; tileset db ROUTE_25_HEIGHT, ROUTE_25_WIDTH ; dimensions (y, x) dw Route25Blocks, Route25TextPointers, Route25Script ; blocks, texts, scripts db WEST ; connections WEST_MAP_CONNECTION ROUTE_25, ROUTE_24, 0, 0, Route24Blocks dw Route25Object ; objects
a51test/(74)MOV.a51
Aimini/51cpu
0
178545
<filename>a51test/(74)MOV.a51 ;test for MOV A, #immed (74) MOV A,#0 MOV A,#1 MOV A,#2 MOV A,#3 MOV A,#4 MOV A,#5 MOV A,#6 MOV A,#7 MOV A,#8 MOV A,#9 MOV A,#10 MOV A,#11 MOV A,#12 MOV A,#13 MOV A,#14 MOV A,#15 MOV A,#16 MOV A,#17 MOV A,#18 MOV A,#19 MOV A,#20 MOV A,#21 MOV A,#22 MOV A,#23 MOV A,#24 MOV A,#25 MOV A,#26 MOV A,#27 MOV A,#28 MOV A,#29 MOV A,#30 MOV A,#31 MOV A,#32 MOV A,#33 MOV A,#34 MOV A,#35 MOV A,#36 MOV A,#37 MOV A,#38 MOV A,#39 MOV A,#40 MOV A,#41 MOV A,#42 MOV A,#43 MOV A,#44 MOV A,#45 MOV A,#46 MOV A,#47 MOV A,#48 MOV A,#49 MOV A,#50 MOV A,#51 MOV A,#52 MOV A,#53 MOV A,#54 MOV A,#55 MOV A,#56 MOV A,#57 MOV A,#58 MOV A,#59 MOV A,#60 MOV A,#61 MOV A,#62 MOV A,#63 MOV A,#64 MOV A,#65 MOV A,#66 MOV A,#67 MOV A,#68 MOV A,#69 MOV A,#70 MOV A,#71 MOV A,#72 MOV A,#73 MOV A,#74 MOV A,#75 MOV A,#76 MOV A,#77 MOV A,#78 MOV A,#79 MOV A,#80 MOV A,#81 MOV A,#82 MOV A,#83 MOV A,#84 MOV A,#85 MOV A,#86 MOV A,#87 MOV A,#88 MOV A,#89 MOV A,#90 MOV A,#91 MOV A,#92 MOV A,#93 MOV A,#94 MOV A,#95 MOV A,#96 MOV A,#97 MOV A,#98 MOV A,#99 MOV A,#100 MOV A,#101 MOV A,#102 MOV A,#103 MOV A,#104 MOV A,#105 MOV A,#106 MOV A,#107 MOV A,#108 MOV A,#109 MOV A,#110 MOV A,#111 MOV A,#112 MOV A,#113 MOV A,#114 MOV A,#115 MOV A,#116 MOV A,#117 MOV A,#118 MOV A,#119 MOV A,#120 MOV A,#121 MOV A,#122 MOV A,#123 MOV A,#124 MOV A,#125 MOV A,#126 MOV A,#127 MOV A,#128 MOV A,#129 MOV A,#130 MOV A,#131 MOV A,#132 MOV A,#133 MOV A,#134 MOV A,#135 MOV A,#136 MOV A,#137 MOV A,#138 MOV A,#139 MOV A,#140 MOV A,#141 MOV A,#142 MOV A,#143 MOV A,#144 MOV A,#145 MOV A,#146 MOV A,#147 MOV A,#148 MOV A,#149 MOV A,#150 MOV A,#151 MOV A,#152 MOV A,#153 MOV A,#154 MOV A,#155 MOV A,#156 MOV A,#157 MOV A,#158 MOV A,#159 MOV A,#160 MOV A,#161 MOV A,#162 MOV A,#163 MOV A,#164 MOV A,#165 MOV A,#166 MOV A,#167 MOV A,#168 MOV A,#169 MOV A,#170 MOV A,#171 MOV A,#172 MOV A,#173 MOV A,#174 MOV A,#175 MOV A,#176 MOV A,#177 MOV A,#178 MOV A,#179 MOV A,#180 MOV A,#181 MOV A,#182 MOV A,#183 MOV A,#184 MOV A,#185 MOV A,#186 MOV A,#187 MOV A,#188 MOV A,#189 MOV A,#190 MOV A,#191 MOV A,#192 MOV A,#193 MOV A,#194 MOV A,#195 MOV A,#196 MOV A,#197 MOV A,#198 MOV A,#199 MOV A,#200 MOV A,#201 MOV A,#202 MOV A,#203 MOV A,#204 MOV A,#205 MOV A,#206 MOV A,#207 MOV A,#208 MOV A,#209 MOV A,#210 MOV A,#211 MOV A,#212 MOV A,#213 MOV A,#214 MOV A,#215 MOV A,#216 MOV A,#217 MOV A,#218 MOV A,#219 MOV A,#220 MOV A,#221 MOV A,#222 MOV A,#223 MOV A,#224 MOV A,#225 MOV A,#226 MOV A,#227 MOV A,#228 MOV A,#229 MOV A,#230 MOV A,#231 MOV A,#232 MOV A,#233 MOV A,#234 MOV A,#235 MOV A,#236 MOV A,#237 MOV A,#238 MOV A,#239 MOV A,#240 MOV A,#241 MOV A,#242 MOV A,#243 MOV A,#244 MOV A,#245 MOV A,#246 MOV A,#247 MOV A,#248 MOV A,#249 MOV A,#250 MOV A,#251 MOV A,#252 MOV A,#253 MOV A,#254 MOV A,#255
oeis/047/A047564.asm
neoneye/loda-programs
11
168436
<filename>oeis/047/A047564.asm ; A047564: Numbers that are congruent to {1, 3, 4, 5, 6, 7} mod 8. ; Submitted by <NAME>(s4) ; 1,3,4,5,6,7,9,11,12,13,14,15,17,19,20,21,22,23,25,27,28,29,30,31,33,35,36,37,38,39,41,43,44,45,46,47,49,51,52,53,54,55,57,59,60,61,62,63,65,67,68,69,70,71,73,75,76,77,78,79,81,83,84,85,86,87,89,91,92,93,94,95,97,99,100,101,102,103,105,107,108,109,110,111,113,115,116,117,118,119,121,123,124,125,126,127,129,131,132,133 mov $2,$0 seq $0,99480 ; Count from 1, repeating 2n five times. add $0,$2
programs/oeis/106/A106388.asm
karttu/loda
0
9078
; A106388: Numbers k such that 11k = 6j^2 + 6j + 1. ; 11,23,131,167,383,443,767,851,1283,1391,1931,2063,2711,2867,3623,3803,4667,4871,5843,6071,7151,7403,8591,8867,10163,10463,11867,12191,13703,14051,15671,16043,17771,18167,20003,20423,22367,22811,24863,25331,27491,27983,30251,30767,33143,33683,36167,36731,39323,39911,42611,43223,46031,46667,49583,50243,53267,53951,57083,57791,61031,61763,65111,65867,69323,70103,73667,74471,78143,78971,82751,83603,87491,88367,92363,93263,97367,98291,102503,103451,107771,108743,113171,114167,118703,119723,124367,125411,130163,131231,136091,137183,142151,143267,148343,149483,154667,155831,161123,162311,167711,168923,174431,175667,181283,182543,188267,189551,195383,196691,202631,203963,210011,211367,217523,218903,225167,226571,232943,234371,240851,242303,248891,250367,257063,258563,265367,266891,273803,275351,282371,283943,291071,292667,299903,301523,308867,310511,317963,319631,327191,328883,336551,338267,346043,347783,355667,357431,365423,367211,375311,377123,385331,387167,395483,397343,405767,407651,416183,418091,426731,428663,437411,439367,448223,450203,459167,461171,470243,472271,481451,483503,492791,494867,504263,506363,515867,517991,527603,529751,539471,541643,551471,553667,563603,565823,575867,578111,588263,590531,600791,603083,613451,615767,626243,628583,639167,641531,652223,654611,665411,667823,678731,681167,692183,694643,705767,708251,719483,721991,733331,735863,747311,749867,761423,764003,775667,778271,790043,792671,804551,807203,819191,821867,833963,836663,848867,851591,863903,866651,879071,881843,894371,897167,909803,912623,925367,928211,941063,943931,956891,959783,972851,975767,988943,991883,1005167,1008131,1021523,1024511 add $0,1 mov $2,2 add $2,$0 lpb $0,1 sub $0,1 mov $1,4 mov $3,$2 add $2,9 add $3,2 add $3,$0 trn $0,1 bin $3,2 add $3,4 lpe add $1,$3 sub $1,18 div $1,11 mul $1,12 add $1,11
src/signals.adb
jfouquart/synth
263
14561
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Text_IO; with Ada.Characters.Latin_1; package body Signals is package TIO renames Ada.Text_IO; package LAT renames Ada.Characters.Latin_1; ----------------------------------- -- graceful_shutdown_requested -- ----------------------------------- function graceful_shutdown_requested return Boolean is caught_char : Character; got_one : Boolean; begin TIO.Get_Immediate (Item => caught_char, Available => got_one); -- Although the variable is called control_c, it's Control-Q that -- we are catching. It was the ESCAPE key after control-C, but that -- one was getting triggered by terminal ANSI codes. Control-Q -- requires the IXON TTY flag off (disabled output flow control). if got_one and then caught_char = LAT.DC1 then control_c_break := True; end if; return control_c_break; exception when others => return control_c_break; end graceful_shutdown_requested; --------------------------------------- -- immediate_termination_requested -- --------------------------------------- function immediate_termination_requested return Boolean is begin return seriously_break; end immediate_termination_requested; -- ---------------------- -- -- Signal_Handler -- -- ---------------------- -- protected body Signal_Handler is -- -- ------------------------- -- -- capture_control_c -- -- ------------------------- -- procedure capture_control_c is -- begin -- if control_c_break then -- seriously_break := True; -- else -- control_c_break := True; -- end if; -- end capture_control_c; -- -- end Signal_Handler; end Signals;
STRINGEXAMPLE.asm
TashinAhmed/ASSEMBLY-LANGUAGE
0
171414
; AUTHOR : <NAME> .MODEL SMALL .STACK 100H .DATA NM DB 'TASHIN AHMED$' ID DB '011153109$' CN DB 'ASSEMBLY PROGRAMMING LABORATORY$' CID DB 'CSE 236$' UN DB 'UNITED INTERNATIONAL UNIVERSITY$' BTHP DB 'DHAKA$' NEWLINE DB 0AH,0DH,'$' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX LEA DX,NM MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H LEA DX,ID MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H LEA DX,CN MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H LEA DX,CID MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H LEA DX,UN MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H LEA DX,BTHP MOV AH,9 INT 21H LEA DX,NEWLINE MOV AH,9 INT 21H MOV AH,4CH INT 21H MAIN ENDP END MAIN
Cubical/Induction/Everything.agda
borsiemir/cubical
0
12550
{-# OPTIONS --cubical --safe #-} module Cubical.Induction.Everything where open import Cubical.Induction.WellFounded public
programs/oeis/185/A185152.asm
neoneye/loda
22
90646
; A185152: Expansion of (q/2) * phi(q)^3 (d/dq) phi(q) in powers of q. ; 1,6,12,12,30,72,56,24,117,180,132,144,182,336,360,48,306,702,380,360,672,792,552,288,775,1092,1080,672,870,2160,992,96,1584,1836,1680,1404,1406,2280,2184,720,1722,4032,1892,1584,3510,3312,2256,576,2793,4650,3672,2184,2862,6480,3960,1344,4560,5220,3540,4320,3782,5952,6552,192,5460,9504,4556,3672,6624,10080,5112,2808,5402,8436,9300,4560,7392,13104,6320,1440,9801,10332,6972,8064,9180,11352,10440,3168,8010,21060,10192,6624,11904,13536,11400,1152,9506,16758,15444,9300 mov $1,$0 seq $1,46897 ; Sum of divisors of n that are not divisible by 4. mul $0,$1 add $0,$1
programs/oeis/097/A097814.asm
neoneye/loda
22
14558
<reponame>neoneye/loda<gh_stars>10-100 ; A097814: E.g.f. exp(3x)/(1-3x). ; 1,6,45,432,5265,79218,1426653,29961900,719092161,19415508030,582465299949,19221355075464,691968783248145,26986782548271978,1133444867032206045,51005019016463620932,2448240912790296851457 add $0,1 mov $2,1 lpb $0 sub $0,1 mul $2,3 add $1,$2 mul $1,3 mul $2,$0 lpe div $1,9 mov $0,$1
source/ada83/unchdeal.ads
ytomino/drake
33
26789
pragma License (Unrestricted); with Ada.Unchecked_Deallocation; generic procedure Unchecked_Deallocation renames Ada.Unchecked_Deallocation;
programs/oeis/001/A001106.asm
karttu/loda
1
100796
<filename>programs/oeis/001/A001106.asm ; A001106: 9-gonal (or enneagonal or nonagonal) numbers: a(n) = n*(7*n-5)/2. ; 0,1,9,24,46,75,111,154,204,261,325,396,474,559,651,750,856,969,1089,1216,1350,1491,1639,1794,1956,2125,2301,2484,2674,2871,3075,3286,3504,3729,3961,4200,4446,4699,4959,5226,5500,5781,6069,6364,6666,6975,7291,7614,7944,8281,8625,8976,9334,9699,10071,10450,10836,11229,11629,12036,12450,12871,13299,13734,14176,14625,15081,15544,16014,16491,16975,17466,17964,18469,18981,19500,20026,20559,21099,21646,22200,22761,23329,23904,24486,25075,25671,26274,26884,27501,28125,28756,29394,30039,30691,31350,32016,32689,33369,34056,34750,35451,36159,36874,37596,38325,39061,39804,40554,41311,42075,42846,43624,44409,45201,46000,46806,47619,48439,49266,50100,50941,51789,52644,53506,54375,55251,56134,57024,57921,58825,59736,60654,61579,62511,63450,64396,65349,66309,67276,68250,69231,70219,71214,72216,73225,74241,75264,76294,77331,78375,79426,80484,81549,82621,83700,84786,85879,86979,88086,89200,90321,91449,92584,93726,94875,96031,97194,98364,99541,100725,101916,103114,104319,105531,106750,107976,109209,110449,111696,112950,114211,115479,116754,118036,119325,120621,121924,123234,124551,125875,127206,128544,129889,131241,132600,133966,135339,136719,138106,139500,140901,142309,143724,145146,146575,148011,149454,150904,152361,153825,155296,156774,158259,159751,161250,162756,164269,165789,167316,168850,170391,171939,173494,175056,176625,178201,179784,181374,182971,184575,186186,187804,189429,191061,192700,194346,195999,197659,199326,201000,202681,204369,206064,207766,209475,211191,212914,214644,216381 mov $1,$0 bin $0,2 mul $0,7 add $1,$0
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2627.asm
ljhsiun2/medusa
9
179950
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2627.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xa091, %rsi lea addresses_WT_ht+0x1cb91, %rdi nop nop nop nop nop mfence mov $114, %rcx rep movsb nop nop nop dec %rsi lea addresses_normal_ht+0xaf09, %rsi lea addresses_A_ht+0xe419, %rdi nop nop nop nop xor %r8, %r8 mov $66, %rcx rep movsq nop sub $3710, %rdi lea addresses_A_ht+0x111bf, %r12 nop nop nop nop inc %rdx mov $0x6162636465666768, %rbx movq %rbx, (%r12) add %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r9 push %rax push %rdi push %rsi // Store lea addresses_UC+0x18721, %r9 nop nop nop nop xor %rdi, %rdi mov $0x5152535455565758, %r13 movq %r13, (%r9) nop nop nop nop nop and $26856, %r13 // Store lea addresses_A+0x18b2b, %r10 nop nop nop inc %r14 movl $0x51525354, (%r10) nop nop xor $37974, %r9 // Store lea addresses_normal+0xbb91, %r9 nop sub %r13, %r13 movl $0x51525354, (%r9) nop xor $2156, %rax // Load mov $0x672c520000000111, %r14 nop nop nop xor %r13, %r13 movaps (%r14), %xmm0 vpextrq $0, %xmm0, %r9 nop cmp $52758, %rax // Faulty Load lea addresses_RW+0x11791, %r9 nop nop nop nop sub %r14, %r14 mov (%r9), %r10 lea oracles, %r9 and $0xff, %r10 shlq $12, %r10 mov (%r9,%r10,1), %r10 pop %rsi pop %rdi pop %rax pop %r9 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_RW', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i7-7700_9_0x48.log_21829_2894.asm
ljhsiun2/medusa
9
12462
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x2a3f, %rsi lea addresses_UC_ht+0x15fbf, %rdi nop nop sub $7401, %r8 mov $34, %rcx rep movsb nop nop xor $15252, %rdx lea addresses_WT_ht+0x16fbf, %rsi lea addresses_WC_ht+0xa73f, %rdi nop nop nop nop sub $43127, %r11 mov $31, %rcx rep movsl nop nop xor $52011, %r11 lea addresses_WC_ht+0x115bf, %r11 nop nop inc %r15 movl $0x61626364, (%r11) nop xor %r15, %r15 lea addresses_UC_ht+0xf81b, %r8 nop nop nop nop nop cmp $4841, %r15 mov (%r8), %ecx nop inc %rdi lea addresses_D_ht+0x1de0f, %rsi nop nop nop and %r8, %r8 movb $0x61, (%rsi) nop nop xor %rdx, %rdx lea addresses_UC_ht+0x6d3f, %rdi nop nop add %rdx, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 vmovups %ymm1, (%rdi) nop xor $63092, %rdi lea addresses_A_ht+0x19437, %rsi lea addresses_A_ht+0x1437f, %rdi nop nop nop nop nop and %rbx, %rbx mov $64, %rcx rep movsq nop nop nop nop nop and $29722, %rsi lea addresses_A_ht+0x1687f, %rsi lea addresses_A_ht+0xf38c, %rdi clflush (%rdi) nop nop nop nop nop add %r8, %r8 mov $30, %rcx rep movsw nop nop cmp %r8, %r8 lea addresses_WT_ht+0xe937, %rsi lea addresses_UC_ht+0x145bf, %rdi clflush (%rsi) and %r15, %r15 mov $113, %rcx rep movsb nop nop nop add $7202, %r11 lea addresses_D_ht+0x1902f, %rsi nop nop dec %r8 and $0xffffffffffffffc0, %rsi movaps (%rsi), %xmm3 vpextrq $1, %xmm3, %rcx add $59441, %r11 lea addresses_WT_ht+0x1beff, %rsi lea addresses_UC_ht+0xcfbf, %rdi nop nop xor $13753, %rdx mov $83, %rcx rep movsq nop nop cmp %r8, %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rax push %rcx push %rdi push %rsi // Store lea addresses_A+0x1e875, %r12 nop sub $32364, %rax mov $0x5152535455565758, %rdi movq %rdi, %xmm2 movups %xmm2, (%r12) nop nop dec %rdi // Load lea addresses_PSE+0x2545, %r11 nop nop sub %rcx, %rcx mov (%r11), %rdi xor $9381, %rdi // Store lea addresses_US+0x1182b, %r12 nop nop xor %rsi, %rsi movl $0x51525354, (%r12) nop nop cmp %rdi, %rdi // Store lea addresses_PSE+0x1e54b, %rax nop nop nop nop dec %rcx mov $0x5152535455565758, %r12 movq %r12, (%rax) nop nop nop nop add $51684, %r11 // Store lea addresses_UC+0x111cf, %rdi clflush (%rdi) nop nop nop sub $41252, %rsi mov $0x5152535455565758, %rcx movq %rcx, (%rdi) nop nop nop nop nop dec %rax // Store lea addresses_D+0x1ffbf, %r8 nop nop xor $60231, %rdi movb $0x51, (%r8) nop nop nop nop sub $18888, %rdi // Faulty Load lea addresses_D+0x1ffbf, %rsi nop nop nop nop cmp $61689, %rdi movntdqa (%rsi), %xmm2 vpextrq $1, %xmm2, %r11 lea oracles, %r8 and $0xff, %r11 shlq $12, %r11 mov (%r8,%r11,1), %r11 pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'35': 1, '08': 8, '46': 15, '3c': 1, '45': 14789, '00': 6831, 'ed': 1, '49': 177, 'f1': 1, 'ff': 3, '25': 2} 00 35 45 45 45 45 45 00 00 45 45 45 00 00 45 45 00 00 45 45 00 45 45 45 00 45 00 45 45 45 45 00 45 00 45 00 00 45 45 45 45 45 45 00 45 45 45 00 45 45 45 00 45 45 45 45 45 00 00 45 45 45 00 00 00 00 45 45 45 45 00 00 45 45 45 45 00 45 45 45 00 45 00 45 45 45 45 45 00 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 00 00 00 45 45 00 45 45 00 45 00 00 45 00 45 00 45 45 45 00 00 45 45 00 00 45 45 45 45 45 45 45 00 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 00 00 45 45 00 45 45 45 45 45 00 00 45 45 45 45 00 00 00 45 00 45 45 00 45 49 00 45 00 45 45 45 00 45 45 00 45 45 00 00 00 00 45 45 45 49 00 00 45 00 45 45 45 00 45 45 45 45 45 00 00 45 45 45 00 45 00 45 45 00 00 45 45 45 45 45 00 00 00 00 00 45 45 00 45 45 45 00 45 00 45 45 00 00 45 45 45 45 00 45 45 00 45 45 00 00 00 00 00 45 00 00 45 45 00 45 45 45 00 00 00 45 45 00 45 00 00 45 45 49 45 45 45 00 45 45 45 00 45 45 45 45 45 45 45 00 00 45 45 45 49 45 00 00 45 00 45 45 45 45 45 00 45 45 00 45 45 45 45 00 45 00 00 00 45 45 00 45 45 45 45 45 45 00 00 45 45 45 45 45 00 45 00 45 45 45 45 00 45 00 45 45 00 45 45 45 45 00 45 45 45 45 45 49 00 45 45 45 00 45 45 45 00 45 00 00 00 45 45 00 00 00 45 45 00 45 45 00 00 45 45 00 45 45 00 45 45 00 45 45 00 45 45 45 45 00 45 45 45 45 45 45 00 00 45 00 45 45 45 45 00 00 45 45 45 00 00 45 45 45 00 45 00 45 45 45 00 00 45 00 45 45 00 45 45 00 45 00 45 00 45 45 45 00 45 45 45 45 45 45 00 00 45 45 45 45 45 00 45 45 00 45 45 45 00 45 45 45 00 45 00 45 45 45 45 00 45 45 45 45 45 45 00 45 00 00 00 00 00 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 00 00 45 00 00 00 00 45 45 45 00 45 00 00 45 45 45 00 45 45 00 00 00 00 45 45 00 45 45 00 00 00 45 45 45 45 45 00 00 00 45 45 45 00 00 45 45 00 00 45 00 45 45 45 45 45 45 00 00 45 00 00 00 45 45 45 45 45 49 45 45 00 00 45 45 45 45 00 45 00 45 45 45 45 45 00 00 00 45 00 45 45 45 00 45 00 00 45 00 45 45 45 00 45 45 45 45 00 45 45 00 45 45 45 00 45 45 00 00 00 00 00 45 45 45 45 45 00 00 00 45 49 45 45 45 00 45 45 00 45 45 45 45 00 45 45 00 45 45 00 00 00 45 45 45 49 45 00 00 45 45 00 45 00 45 45 45 45 00 00 45 45 00 00 45 45 45 00 00 00 00 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 00 45 45 45 00 00 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 00 45 45 00 00 00 45 00 45 45 45 45 45 49 00 45 45 45 45 00 45 00 00 00 45 00 45 45 45 45 00 45 45 45 45 45 45 00 00 00 45 45 45 45 45 45 45 45 00 00 00 45 45 00 45 45 45 45 00 45 45 45 45 00 00 45 45 00 45 00 45 45 00 45 00 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 00 45 45 00 00 45 45 45 45 00 45 45 45 00 45 45 45 45 00 45 45 45 00 45 45 00 45 00 45 45 45 00 45 45 00 45 45 45 00 00 45 45 45 00 45 45 00 00 00 45 45 45 00 00 00 45 00 45 45 45 00 45 45 00 00 45 45 45 00 45 45 00 45 00 00 00 00 45 00 00 45 45 45 45 45 00 00 45 45 00 00 00 45 45 45 45 00 45 00 00 45 45 45 45 45 45 45 45 00 00 45 00 45 00 45 45 45 00 00 45 45 45 00 00 45 45 00 45 45 00 45 45 00 00 45 45 00 45 00 49 45 00 00 45 45 00 45 00 45 00 00 */
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_1868.asm
ljhsiun2/medusa
9
100759
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x6f6e, %rsi lea addresses_A_ht+0xff6e, %rdi sub $22928, %r12 mov $32, %rcx rep movsq nop nop nop and %r9, %r9 lea addresses_UC_ht+0x1bc4e, %rsi nop nop xor %r12, %r12 movb (%rsi), %cl nop nop nop nop nop cmp $20114, %r9 lea addresses_UC_ht+0x1335e, %r15 nop nop nop nop cmp %r13, %r13 movb (%r15), %r9b nop nop nop nop dec %r12 lea addresses_WC_ht+0x1886e, %r13 nop nop nop nop and $17988, %rdi movl $0x61626364, (%r13) nop nop cmp %r12, %r12 lea addresses_WC_ht+0xb8ae, %r9 nop nop dec %rcx movl $0x61626364, (%r9) nop add $50096, %rcx lea addresses_A_ht+0x1ed4e, %r9 inc %r13 mov $0x6162636465666768, %r12 movq %r12, (%r9) nop inc %r9 lea addresses_D_ht+0xea6, %rsi lea addresses_A_ht+0xef6e, %rdi sub $24262, %rdx mov $36, %rcx rep movsb nop add $56823, %r9 lea addresses_WT_ht+0x1b25a, %r13 nop nop dec %rcx vmovups (%r13), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r12 nop nop nop nop add %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r9 push %rax push %rbp push %rdi // Store lea addresses_A+0xdf6e, %rdi nop nop nop nop xor %r13, %r13 movb $0x51, (%rdi) nop nop nop nop nop cmp $12408, %r13 // Load lea addresses_UC+0x62b8, %rbp nop nop and %r9, %r9 mov (%rbp), %r11d lfence // Store lea addresses_UC+0xb1d2, %r11 nop nop nop cmp %rbp, %rbp mov $0x5152535455565758, %r13 movq %r13, %xmm5 movups %xmm5, (%r11) nop cmp %rdi, %rdi // Store lea addresses_UC+0x442e, %rbp nop xor %r9, %r9 mov $0x5152535455565758, %r13 movq %r13, (%rbp) nop cmp %r9, %r9 // Store lea addresses_RW+0x1ca0e, %rax nop nop add $7704, %rdi movb $0x51, (%rax) nop nop nop sub %r15, %r15 // Store lea addresses_A+0xdf6e, %r9 clflush (%r9) add %rbp, %rbp movb $0x51, (%r9) nop cmp $62523, %r13 // Store lea addresses_UC+0x1e76e, %rbp nop nop xor $12856, %rax movw $0x5152, (%rbp) nop sub %r13, %r13 // Store lea addresses_A+0xdf6e, %r15 nop nop nop cmp %r13, %r13 mov $0x5152535455565758, %r9 movq %r9, %xmm4 vmovups %ymm4, (%r15) nop nop nop cmp %r9, %r9 // Store lea addresses_UC+0xd8ee, %r11 clflush (%r11) nop nop nop sub $4287, %r15 movw $0x5152, (%r11) sub %r15, %r15 // Store lea addresses_A+0xdf6e, %rdi nop nop nop nop nop cmp $3541, %r11 mov $0x5152535455565758, %r15 movq %r15, %xmm4 vmovaps %ymm4, (%rdi) nop nop nop nop nop add %rax, %rax // Faulty Load lea addresses_A+0xdf6e, %rax nop nop add %r9, %r9 mov (%rax), %bp lea oracles, %rdi and $0xff, %rbp shlq $12, %rbp mov (%rdi,%rbp,1), %rbp pop %rdi pop %rbp pop %rax pop %r9 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
programs/oeis/074/A074943.asm
neoneye/loda
22
177348
<gh_stars>10-100 ; A074943: tau(n) (mod 3). ; 1,2,2,0,2,1,2,1,0,1,2,0,2,1,1,2,2,0,2,0,1,1,2,2,0,1,1,0,2,2,2,0,1,1,1,0,2,1,1,2,2,2,2,0,0,1,2,1,0,0,1,0,2,2,1,2,1,1,2,0,2,1,0,1,1,2,2,0,1,2,2,0,2,1,0,0,1,2,2,1,2,1,2,0,1,1,1,2,2,0,1,0,1,1,1,0,2,0,0,0 seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. mod $0,3
test/Fail/Issue4373.agda
cruhland/agda
1,989
7621
module _ where import Issue4373.A as A hiding (t) postulate search : ⦃ x : A.T ⦄ → Set fail : Set fail = search
programs/oeis/070/A070627.asm
karttu/loda
1
174322
<reponame>karttu/loda<gh_stars>1-10 ; A070627: n^5 mod 44. ; 0,1,32,23,12,1,32,43,32,1,32,11,12,21,12,23,12,21,32,43,12,21,0,23,32,1,12,23,32,21,32,23,32,33,12,43,12,1,12,43,32,21,12,43,0,1,32,23,12,1,32,43,32,1,32,11,12,21,12,23,12,21,32,43,12,21,0,23,32,1,12,23,32,21 pow $0,5 mod $0,44 mov $1,$0
Experiment/Expr/Expr.agda
rei1024/agda-misc
3
533
<filename>Experiment/Expr/Expr.agda module Experiment.Expr.Expr where open import Data.Fin open import Data.Empty open import Level open import Data.Bool open import Data.Nat hiding (_⊔_) open import Data.Product open import Data.List as List hiding (or; and) data Expr {v} (V : Set v) : Set v where var : V -> Expr V or and : Expr V -> Expr V -> Expr V neg : Expr V -> Expr V foldExpr : ∀ {a v} {V : Set v} {A : Set a} → (V → A) → (A → A → A) → (A → A → A) → (A → A) → Expr V → A foldExpr v o a n (var v′) = v v′ foldExpr v o a n (or e₁ e₂) = o (foldExpr v o a n e₁) (foldExpr v o a n e₂) foldExpr v o a n (and e₁ e₂) = a (foldExpr v o a n e₁) (foldExpr v o a n e₂) foldExpr v o a n (neg e) = n (foldExpr v o a n e) evalExpr : ∀ {v} {V : Set v} → (V → Bool) → Expr V → Bool evalExpr v = foldExpr v _∨_ _∧_ not data Sign : Set where pos : Sign neg : Sign Literal : ∀ {a} → Set a → Set a Literal V = Sign × V data NNF {v} (V : Set v) : Set v where lit : Literal V → NNF V and or : NNF V → NNF V → NNF V data GExpr {v t₁ t₂ tₙ} (T₁ : Set t₁) (T₂ : Set t₂) (Tₙ : Set tₙ) (V : Set v) : Set (v ⊔ t₁ ⊔ t₂ ⊔ tₙ) where var : (v : V) → GExpr T₁ T₂ Tₙ V op₁ : T₁ → (e : GExpr T₁ T₂ Tₙ V) → GExpr T₁ T₂ Tₙ V op₂ : T₂ → (e₁ e₂ : GExpr T₁ T₂ Tₙ V) → GExpr T₁ T₂ Tₙ V opₙ : Tₙ → (es : List (GExpr T₁ T₂ Tₙ V)) → GExpr T₁ T₂ Tₙ V data AndOr : Set where and : AndOr or : AndOr data Neg : Set where neg : Neg ExprAndOrNeg : ℕ → Set ExprAndOrNeg n = GExpr AndOr Neg ⊥ (Fin n) evalAndOr : AndOr → Bool → Bool → Bool evalAndOr and = _∧_ evalAndOr or = _∨_ module _ {v t₁ t₂ tₙ a} {V : Set v} {T₁ : Set t₁} {T₂ : Set t₂} {Tₙ : Set tₙ} {A : Set a} (var* : V → A) (op₁* : T₁ → A → A) (op₂* : T₂ → A → A → A) (opₙ* : Tₙ → List A → A) where foldGExpr : GExpr T₁ T₂ Tₙ V → A foldGExpr (var v) = var* v foldGExpr (op₁ t₁ e) = op₁* t₁ (foldGExpr e) foldGExpr (op₂ t₂ e₁ e₂) = op₂* t₂ (foldGExpr e₁) (foldGExpr e₂) foldGExpr (opₙ tₙ es) = opₙ* tₙ (List.map foldGExpr es)
tests/test build script and options/opt stdin/srcStdIn.i.asm
cizo2000/sjasmplus
220
247307
<gh_stars>100-1000 DZ 'data to include from real file' DB '#' ;; 32 bytes in total
specs/ada/common/tkmrpc-request-ike-isa_auth.ads
DrenfongWong/tkm-rpc
0
27069
<reponame>DrenfongWong/tkm-rpc with Tkmrpc.Types; with Tkmrpc.Operations.Ike; package Tkmrpc.Request.Ike.Isa_Auth is Data_Size : constant := 1908; type Data_Type is record Isa_Id : Types.Isa_Id_Type; Cc_Id : Types.Cc_Id_Type; Init_Message : Types.Init_Message_Type; Signature : Types.Signature_Type; end record; for Data_Type use record Isa_Id at 0 range 0 .. (8 * 8) - 1; Cc_Id at 8 range 0 .. (8 * 8) - 1; Init_Message at 16 range 0 .. (1504 * 8) - 1; Signature at 1520 range 0 .. (388 * 8) - 1; end record; for Data_Type'Size use Data_Size * 8; Padding_Size : constant := Request.Body_Size - Data_Size; subtype Padding_Range is Natural range 1 .. Padding_Size; subtype Padding_Type is Types.Byte_Sequence (Padding_Range); type Request_Type is record Header : Request.Header_Type; Data : Data_Type; Padding : Padding_Type; end record; for Request_Type use record Header at 0 range 0 .. (Request.Header_Size * 8) - 1; Data at Request.Header_Size range 0 .. (Data_Size * 8) - 1; Padding at Request.Header_Size + Data_Size range 0 .. (Padding_Size * 8) - 1; end record; for Request_Type'Size use Request.Request_Size * 8; Null_Request : constant Request_Type := Request_Type' (Header => Request.Header_Type'(Operation => Operations.Ike.Isa_Auth, Request_Id => 0), Data => Data_Type'(Isa_Id => Types.Isa_Id_Type'First, Cc_Id => Types.Cc_Id_Type'First, Init_Message => Types.Null_Init_Message_Type, Signature => Types.Null_Signature_Type), Padding => Padding_Type'(others => 0)); end Tkmrpc.Request.Ike.Isa_Auth;
MIPS Assembly/question2.asm
StevenThomi/Computer-Science
0
12141
<reponame>StevenThomi/Computer-Science<gh_stars>0 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Write an assembly program (question2.asm) to compute a simple integer sum. # Assume that the input sum has no whitespace and that it is suffixed with # an equals sign ‘=’ and that each element of the sum is an integer in [-9..9]. # Sample input/output: # Enter a sum: 1+4+5+6-9= # 7 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# .data prompt: .asciiz "Enter a sum: \n" sum: .space 100 .text main: # input prompt la $a0, prompt li $v0, 4 syscall # input stream li $v0, 8 li $a1, 100 la $a0, sum syscall # location of first input memory li $t0, 0x1001000e # address li $t2, 0 # sum # value of first digit lb $a0, ($t0) # store in t1 move $t1, $a0 Loop: # signs beq $t1, 0x02d, negative beq $t1, 0x03d, equal b positive positive: # signs # beq $t1, 0x030, pzero beq $t1, 0x031, pone beq $t1, 0x032, ptwo beq $t1, 0x033, pthree beq $t1, 0x034, pfour beq $t1, 0x035, pfive beq $t1, 0x036, psix beq $t1, 0x037, pseven beq $t1, 0x038, peight beq $t1, 0x039, pnine beq $t1, 0x02d, plus # get next number if zero addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pone: addi $t2, $t2, 1 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop ptwo: addi $t2, $t2, 2 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pthree: addi $t2, $t2, 3 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pfour: addi $t2, $t2, 4 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pfive: addi $t2, $t2, 5 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop psix: addi $t2, $t2, 6 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pseven: addi $t2, $t2, 7 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop peight: addi $t2, $t2, 8 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop pnine: addi $t2, $t2, 9 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop plus: # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j positive negative: # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 # signs # beq $t1, 0x030, pzero beq $t1, 0x031, none beq $t1, 0x032, ntwo beq $t1, 0x033, nthree beq $t1, 0x034, nfour beq $t1, 0x035, nfive beq $t1, 0x036, nsix beq $t1, 0x037, nseven beq $t1, 0x038, neight beq $t1, 0x039, nnine # get next number if zero addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop none: addi $t2, $t2, -1 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop ntwo: addi $t2, $t2, -2 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nthree: addi $t2, $t2, -3 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nfour: addi $t2, $t2, -4 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nfive: addi $t2, $t2, -5 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nsix: addi $t2, $t2, -6 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nseven: addi $t2, $t2, -7 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop neight: addi $t2, $t2, -8 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop nnine: addi $t2, $t2, -9 # get next number addi $t0, $t0, 0x01 lb $a0, ($t0) # store in t1 move $t1, $a0 j Loop equal: # print number li $v0, 1 move $a0, $t2 syscall # end program li $v0, 10 syscall
src/Expansion/Delay-monad.agda
nad/up-to
0
1233
<reponame>nad/up-to ------------------------------------------------------------------------ -- Some results related to expansion for the delay monad ------------------------------------------------------------------------ {-# OPTIONS --sized-types #-} open import Prelude module Expansion.Delay-monad {a} {A : Type a} where open import Delay-monad open import Delay-monad.Bisimilarity as D using (force) import Delay-monad.Bisimilarity.Negative as DN open import Equality.Propositional open import Logical-equivalence using (_⇔_) open import Prelude.Size open import Function-universe equality-with-J hiding (id; _∘_) open import Function-universe.Size equality-with-J import Bisimilarity.Delay-monad as SD open import Equational-reasoning import Expansion.Equational-reasoning-instances open import Labelled-transition-system.Delay-monad A open import Bisimilarity delay-monad using ([_]_∼_) open import Expansion delay-monad ------------------------------------------------------------------------ -- The direct and the indirect definitions of expansion are pointwise -- logically equivalent -- Emulations of the constructors D.later and D.laterˡ. later-cong : ∀ {i x y} → [ i ] force x ≳′ force y → [ i ] later x ≳ later y later-cong x≳′y = ⟨ (λ { later → _ , ⟶→⟶̂ later , x≳′y }) , (λ { later → _ , ⟶→[]⇒ later , x≳′y }) ⟩ laterˡ : ∀ {i x y} → [ i ] force x ≳ y → [ i ] later x ≳ y laterˡ x≳y = ⟨ (λ { later → _ , done _ , convert {a = a} x≳y }) , Σ-map id (Σ-map later[]⇒ id) ∘ right-to-left x≳y ⟩ -- The direct definition of expansion is contained in the one -- obtained from the transition relation. direct→indirect : ∀ {i x y} → D.[ i ] x ≳ y → [ i ] x ≳ y direct→indirect D.now = reflexive direct→indirect (D.later p) = later-cong λ { .force → direct→indirect (force p) } direct→indirect (D.laterˡ p) = laterˡ (direct→indirect p) -- If x makes a sequence of zero or more silent transitions to y, then -- x is an expansion of y. ⇒→≳ : ∀ {i x y} → x ⇒ y → D.[ i ] x ≳ y ⇒→≳ done = D.reflexive _ ⇒→≳ (step _ later tr) = D.laterˡ (⇒→≳ tr) ⇒→≳ (step () now tr) -- If x makes a non-silent transition with the label y, then x is an -- expansion of now y. [just]⟶→≳now : ∀ {i x x′ y} → x [ just y ]⟶ x′ → D.[ i ] x ≳ now y [just]⟶→≳now now = D.reflexive _ [just]⇒→≳now : ∀ {i x x′ y} → x [ just y ]⇒ x′ → D.[ i ] x ≳ now y [just]⇒→≳now (steps tr now _) = ⇒→≳ tr [just]⇒̂→≳now : ∀ {i x x′ y} → x [ just y ]⇒̂ x′ → D.[ i ] x ≳ now y [just]⇒̂→≳now (silent () _) [just]⇒̂→≳now (non-silent _ tr) = [just]⇒→≳now tr [just]⟶̂→≳now : ∀ {i x x′ y} → x [ just y ]⟶̂ x′ → D.[ i ] x ≳ now y [just]⟶̂→≳now (done ()) [just]⟶̂→≳now (step tr) = [just]⇒̂→≳now (⟶→⇒̂ tr) -- The definition of expansion obtained from the transition relation -- is contained in the direct one. indirect→direct : ∀ {i} x y → [ i ] x ≳ y → D.[ i ] x ≳ y indirect→direct {i} (now x) y = ([ i ] now x ≳ y) ↝⟨ (λ p → left-to-right p now) ⟩ (∃ λ y′ → y [ just x ]⟶̂ y′ × [ i ] now x ≳′ y′) ↝⟨ sym ∘ [just]⟶̂→≡now ∘ proj₁ ∘ proj₂ ⟩ now x ≡ y ↝⟨ (λ { refl → D.reflexive _ }) ⟩□ D.[ i ] now x ≳ y □ indirect→direct {i} x (now y) = [ i ] x ≳ now y ↝⟨ (λ p → right-to-left p now) ⟩ (∃ λ x′ → x [ just y ]⇒ x′ × [ i ] x′ ≳′ now y) ↝⟨ [just]⇒→≳now ∘ proj₁ ∘ proj₂ ⟩□ D.[ i ] x ≳ now y □ indirect→direct (later x) (later y) lx≳ly = case left-to-right lx≳ly later of λ where (_ , step later , x≳′y) → D.later λ { .force {j} → indirect→direct _ _ (force x≳′y {j = j}) } (_ , done _ , x≳′ly) → let x′ , lx⇒x′ , x′≳′y = right-to-left lx≳ly later in lemma x≳′ly ([]⇒→⇒ _ lx⇒x′) x′≳′y where indirect→direct′ : ∀ {i x x′ y} → x ⇒ x′ → [ i ] x′ ≳ y → D.[ i ] x ≳ y indirect→direct′ done p = indirect→direct _ _ p indirect→direct′ (step _ later tr) p = D.laterˡ (indirect→direct′ tr p) indirect→direct′ (step () now _) lemma : ∀ {i x x′} → [ i ] force x ≳′ later y → later x ⇒ x′ → [ i ] x′ ≳′ force y → D.[ i ] later x ≳ later y lemma x≳′ly done lx≳′y = D.later λ { .force → D.laterˡʳ⁻¹ (indirect→direct _ _ (force lx≳′y)) (indirect→direct _ _ (force x≳′ly)) } lemma x≳′ly (step _ later x⇒x′) x′≳′y = D.later λ { .force → indirect→direct′ x⇒x′ (force x′≳′y) } -- The direct definition of the expansion relation is logically -- equivalent to the one obtained from the transition relation. -- -- TODO: Are the two definitions isomorphic? direct⇔indirect : ∀ {i x y} → D.[ i ] x ≳ y ⇔ [ i ] x ≳ y direct⇔indirect = record { to = direct→indirect ; from = indirect→direct _ _ } ------------------------------------------------------------------------ -- Some non-existence results Now≳later-now = ∀ x → now x ≳ later (record { force = now x }) now≳later-now⇔uninhabited : Now≳later-now ⇔ ¬ A now≳later-now⇔uninhabited = Now≳later-now ↝⟨ inverse $ ∀-cong _ (λ _ → direct⇔indirect) ⟩ DN.Now≳later-now ↝⟨ DN.now≳later-now⇔uninhabited ⟩□ ¬ A □ Laterˡ⁻¹ = ∀ {x y} → later x ≳ y → force x ≳ y laterˡ⁻¹⇔uninhabited : Laterˡ⁻¹ ⇔ ¬ A laterˡ⁻¹⇔uninhabited = Laterˡ⁻¹ ↝⟨ inverse $ implicit-∀-cong _ $ implicit-∀-cong _ $ →-cong _ direct⇔indirect direct⇔indirect ⟩ DN.Laterˡ⁻¹-≳ ↝⟨ DN.laterˡ⁻¹-≳⇔uninhabited ⟩□ ¬ A □ Laterʳ⁻¹-∼≳ = ∀ {i x} → [ i ] never ∼ later (record { force = now x }) → [ i ] never ≳ now x size-preserving-laterʳ⁻¹-∼≳⇔uninhabited : Laterʳ⁻¹-∼≳ ⇔ ¬ A size-preserving-laterʳ⁻¹-∼≳⇔uninhabited = Laterʳ⁻¹-∼≳ ↝⟨ inverse $ implicit-∀-size-cong _ $ implicit-∀-cong _ $ →-cong _ SD.direct⇔indirect direct⇔indirect ⟩ DN.Laterʳ⁻¹-∼≳ ↝⟨ DN.size-preserving-laterʳ⁻¹-∼≳⇔uninhabited ⟩□ ¬ A □ Laterʳ⁻¹ = ∀ {i x y} → [ i ] x ≳ later y → [ i ] x ≳ force y size-preserving-laterʳ⁻¹⇔uninhabited : Laterʳ⁻¹ ⇔ ¬ A size-preserving-laterʳ⁻¹⇔uninhabited = Laterʳ⁻¹ ↝⟨ inverse $ implicit-∀-size-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ →-cong _ direct⇔indirect direct⇔indirect ⟩ DN.Laterʳ⁻¹-≳ ↝⟨ DN.size-preserving-laterʳ⁻¹-≳⇔uninhabited ⟩□ ¬ A □ Transitivity-∼≳ˡ = ∀ {i} {x y z : Delay A ∞} → [ i ] x ∼ y → y ≳ z → [ i ] x ≳ z size-preserving-transitivity-∼≳ˡ⇔uninhabited : Transitivity-∼≳ˡ ⇔ ¬ A size-preserving-transitivity-∼≳ˡ⇔uninhabited = Transitivity-∼≳ˡ ↝⟨ inverse $ implicit-∀-size-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ →-cong _ SD.direct⇔indirect (→-cong _ direct⇔indirect direct⇔indirect) ⟩ DN.Transitivity-∼≳ˡ ↝⟨ DN.size-preserving-transitivity-∼≳ˡ⇔uninhabited ⟩□ ¬ A □ Transitivityˡ = ∀ {i} {x y z : Delay A ∞} → [ i ] x ≳ y → y ≳ z → [ i ] x ≳ z size-preserving-transitivityˡ⇔uninhabited : Transitivityˡ ⇔ ¬ A size-preserving-transitivityˡ⇔uninhabited = Transitivityˡ ↝⟨ inverse $ implicit-∀-size-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ →-cong _ direct⇔indirect (→-cong _ direct⇔indirect direct⇔indirect) ⟩ DN.Transitivity-≳ˡ ↝⟨ DN.size-preserving-transitivity-≳ˡ⇔uninhabited ⟩□ ¬ A □ Transitivity = ∀ {i} {x y z : Delay A ∞} → [ i ] x ≳ y → [ i ] y ≳ z → [ i ] x ≳ z size-preserving-transitivity⇔uninhabited : Transitivity ⇔ ¬ A size-preserving-transitivity⇔uninhabited = Transitivity ↝⟨ inverse $ implicit-∀-size-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ implicit-∀-cong _ $ →-cong _ direct⇔indirect $ →-cong _ direct⇔indirect direct⇔indirect ⟩ DN.Transitivity-≳ ↝⟨ DN.size-preserving-transitivity-≳⇔uninhabited ⟩□ ¬ A □
doc/shellcode_before_execution.asm
wzw19890321/kindle-5.6.5-jailbreak
466
160712
<filename>doc/shellcode_before_execution.asm ; IDA dump before execution. Older version of shellcode. ; Segment type: Pure code AREA ROM, CODE, READWRITE, ALIGN=0 CODE32 RSBVS R6, R2, #0x20000006 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 loc_4C ; DATA XREF: ROM:00000074o SUBPL R3, R1, #0x38 loc_50 ; DATA XREF: ROM:00000078o SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 SUBPL R3, R1, #0x38 ADRMI R3, loc_4C ADRPL R3, loc_50 LDRPLB R3, [R3,#-0x30] LDRMIB R3, [R3,#-0x30] SUBMIS R5, R3, #0x39 SUBPLS R5, R3, #0x39 SUBMI R7, SP, #0x30 SUBMIS R3, R3, #0x38 SUBPL R6, R3, R3,ROR#2 SUBPL R4, PC, R3,ROR#2 STMPLDB R7, {R0,R4-R6,R8,LR}^ SUBPL R4, R3, R3,ROR#2 SUBPL R5, R4, #0x79 SUBPL R6, PC, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 SUBPL R6, R6, R5,ROR#2 STRPLB R3, [R6,#-0x52] STRPLB R3, [R6,#-0x53] STRPLB R3, [R6,#-0x54] EORPLS R3, R3, #0x38 SUBPL R7, R3, #0x39 EORPLS R5, R7, #0x50 SUBMI R5, R3, #0x36 EORMIS R5, R3, #0x42 EORPLS R5, R5, #0x6C STRPLB R5, [R6,#-0x48] EORPLS R5, R3, #0x56 EORPLS R5, R5, #0x41 STRPLB R5, [R6,#-0x46] STRPLB R7, [R6,#-0x47] SUBPL R3, R7, #0x78 SUBPL R3, R3, #0x78 SUBPL R3, R3, #0x78 SUBPL R6, R6, R3,ROR#2 SUBPL R6, R6, R3,ROR#2 EORPLS R5, R7, #0x61 EORMIS R5, R5, #0x41 STRMIB R5, [R6,#-0x71] EORMIS R7, R4, #0x38 SUBPL R5, SP, #0x30 LDMPLDA R5!, {R0-R2,R6,R8,LR} SUBPL R7, R7, #0x38 SUBPL R5, R4, R4,ROR#2 RSBPLS R5, R5, #0xF0000004 EORMIS R5, R5, #0x30 SUBMIS R3, R5, #0xF0000004 SUBPL R5, R5, #0x34 EORPLS R7, R7, R5,ROR#12 EORPLS R7, R7, #0x32 EORPLS R7, R7, #0x30 EORPLS R5, R5, #0x30 SVCMI 0x414141 EORMIS R5, R4, #0x38 SUBPL R6, PC, R1,ROR#2 TEQPL R0, R0,LSR R0 SUBCCS R4, R2, R8,ROR R6 SUBMI R3, R6, #0x350000 ; --------------------------------------------------------------------------- DCB 0x76 ; v DCB 0x42 ; B DCB 0x30 ; 0 DCB 0x47 ; G DCB 0x30 ; 0 DCB 0x62 ; b DCB 0x69 ; i DCB 0x6E ; n DCB 0x30 ; 0 DCB 0x73 ; s DCB 0x68 ; h DCB 0x30 ; 0 DCB 0x30 ; 0 DCB 0x6D ; m DCB 0x6E ; n DCB 0x74 ; t DCB 0x30 ; 0 DCB 0x75 ; u DCB 0x73 ; s DCB 0x30 ; 0 DCB 0x6A ; j DCB 0x62 ; b DCB 0x30 ; 0 DCB 0x30 ; 0 DCB 0x4D ; M DCB 0x30 ; 0 DCB 0x62 ; b DCB 0x38 ; 8 DCB 0x51 ; Q DCB 0x43 ; C DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x73 ; s DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x6F ; o DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x51 ; Q DCB 0x43 ; C DCB 0x61 ; a DCB 0x31 ; 1 DCB 0x32 ; 2 DCB 0x39 ; 9 DCB 0x4A ; J DCB 0x42 ; B DCB 0x52 ; R DCB 0x42 ; B DCB 0x61 ; a DCB 0x43 ; C DCB 0x42 ; B DCB 0x54 ; T DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x76 ; v DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x76 ; v DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x76 ; v DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x77 ; w DCB 0x39 ; 9 DCB 0x42 ; B DCB 0x54 ; T DCB 0x61 ; a DCB 0x43 ; C DCB 0x30 ; 0 DCB 0x31 ; 1 DCB 0x31 ; 1 DCB 0x39 ; 9 DCB 0x4F ; O DCB 0x42 ; B DCB 0x61 ; a DCB 0x43 ; C DCB 0x41 ; A DCB 0x31 ; 1 DCB 0x36 ; 6 DCB 0x39 ; 9 DCB 0x4F ; O DCB 0x43 ; C DCB 0x6A ; j DCB 0x46 ; F DCB 0x61 ; a DCB 0x43 ; C DCB 0x50 ; P DCB 0x50 ; P DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x76 ; v DCB 0x39 ; 9 DCB 0x7A ; z DCB 0x30 ; 0 DCB 0x72 ; r DCB 0x38 ; 8 DCB 0x50 ; P DCB 0x50 ; P DCB 0x7A ; z DCB 0x31 ; 1 DCB 0x76 ; v DCB 0x39 ; 9 DCB 0x54 ; T DCB 0x50 ; P DCB 0x51 ; Q DCB 0x42 ; B DCB 0x49 ; I DCB 0x42 ; B DCB 0x72 ; r DCB 0x30 ; 0 DCB 0x7A ; z DCB 0x38 ; 8 DCB 0x62 ; b DCB 0x43 ; C DCB 0x30, 0x30, ; ROM ends END
oeis/033/A033127.asm
neoneye/loda-programs
11
21459
<reponame>neoneye/loda-programs<filename>oeis/033/A033127.asm ; A033127: Base 9 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,1. ; Submitted by <NAME> ; 1,9,82,739,6651,59860,538741,4848669,43638022,392742199,3534679791,31812118120,286309063081,2576781567729,23191034109562,208719306986059,1878473762874531,16906263865870780,152156374792837021,1369407373135533189,12324666358219798702,110921997223978188319,998297975015803694871,8984681775142233253840,80862135976280099284561,727759223786520893561049,6549833014078688042049442,58948497126708192378444979,530536474140373731406004811,4774828267263363582654043300,42973454405370272243886389701 mov $2,1 lpb $0 sub $0,1 mul $2,9 mod $3,2 add $2,$3 add $3,$2 lpe mov $0,$2
notes/fixed-points/GFPs/Colist.agda
asr/fotc
11
8512
------------------------------------------------------------------------------ -- Co-lists ------------------------------------------------------------------------------ {-# OPTIONS --allow-unsolved-metas #-} {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module GFPs.Colist where open import FOTC.Base open import FOTC.Base.List ------------------------------------------------------------------------------ -- Colist is a greatest fixed-point of a functor -- The functor. ListF : (D → Set) → D → Set ListF A xs = xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs') -- Colist is the greatest fixed-point of ListF. postulate Colist : D → Set -- Colist is a post-fixed point of ListF, i.e. -- -- Colist ≤ ListF Colist. Colist-out-ho : ∀ {n} → Colist n → ListF Colist n -- Colist is the greatest post-fixed point of ListF, i.e. -- -- ∀ A. A ≤ ListF A ⇒ A ≤ Colist. Colist-coind-ho : (A : D → Set) → -- A is post-fixed point of ListF. (∀ {xs} → A xs → ListF A xs) → -- Colist is greater than A. ∀ {xs} → A xs → Colist xs ------------------------------------------------------------------------------ -- First-order versions Colist-out : ∀ {xs} → Colist xs → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Colist xs') Colist-out = Colist-out-ho Colist-coind : (A : D → Set) → (∀ {xs} → A xs → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs')) → ∀ {xs} → A xs → Colist xs Colist-coind = Colist-coind-ho ------------------------------------------------------------------------------ -- Because a greatest post-fixed point is a fixed-point, then the -- Colist predicate is also a pre-fixed point of the functional ListF, -- i.e. -- -- ListF Colist ≤ Colist. Colist-in-ho : ∀ {xs} → ListF Colist xs → Colist xs Colist-in-ho h = Colist-coind-ho A h' h where A : D → Set A xs = ListF Colist xs h' : ∀ {xs} → A xs → ListF A xs h' (inj₁ xs≡0) = inj₁ xs≡0 h' (inj₂ (x' , xs' , prf , CLxs' )) = inj₂ (x' , xs' , prf , Colist-out CLxs') -- The first-order version. Colist-in : ∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Colist xs') → Colist xs Colist-in = Colist-in-ho ------------------------------------------------------------------------------ -- A stronger co-induction principle -- -- From (Paulson, 1997. p. 16). postulate Colist-coind-stronger-ho : (A : D → Set) → (∀ {xs} → A xs → ListF A xs ∨ Colist xs) → ∀ {xs} → A xs → Colist xs Colist-coind-ho' : (A : D → Set) → (∀ {xs} → A xs → ListF A xs) → ∀ {xs} → A xs → Colist xs Colist-coind-ho' A h Axs = Colist-coind-stronger-ho A (λ Ays → inj₁ (h Ays)) Axs -- The first-order version. Colist-coind-stronger : (A : D → Set) → (∀ {xs} → A xs → (xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs')) ∨ Colist xs) → ∀ {xs} → A xs → Colist xs Colist-coind-stronger = Colist-coind-stronger-ho -- 13 January 2014. As expected, we cannot prove -- Colist-coind-stronger-ho from Colist-coind-ho. Colist-coind-stronger-ho' : (A : D → Set) → (∀ {xs} → A xs → ListF A xs ∨ Colist xs) → ∀ {xs} → A xs → Colist xs Colist-coind-stronger-ho' A h {xs} Axs = case prf (λ h' → h') (h Axs) where prf : ListF A xs → Colist xs prf h' = Colist-coind-ho A {!!} Axs ------------------------------------------------------------------------------ -- References -- -- <NAME>. (1997). Mechanizing Coinduction and Corecursion in -- Higher-order Logic. Journal of Logic and Computation 7.2, -- pp. 175–204.
lib/x86_64/poly1305.asm
jkivilin/intel-ipsec-mb
1
15257
<filename>lib/x86_64/poly1305.asm ;; ;; Copyright (c) 2020-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. ;; ;; Useful links for understanding Poly1305: ;; "ChaCha20 and Poly1305 for IETF Protocols" ;; https://tools.ietf.org/html/rfc7539 ;; "A GO IMPLEMENTATION OF POLY1305 THAT MAKES SENSE" ;; https://blog.filippo.io/a-literate-go-implementation-of-poly1305/ ;; "The design of Poly1305" ;; http://loup-vaillant.fr/tutorials/poly1305-design %include "include/os.asm" %include "include/reg_sizes.asm" %include "include/memcpy.asm" %include "include/imb_job.asm" %include "include/clear_regs.asm" [bits 64] default rel %ifdef LINUX %define arg1 rdi %define arg2 rsi %define arg3 rdx %define arg4 rcx %define job arg1 %define gp1 rsi %define gp2 rcx %else %define arg1 rcx %define arg2 rdx %define arg3 r8 %define arg4 r9 %define job rdi %define gp1 rcx ;; 'arg1' copied to 'job' at start %define gp2 rsi %endif ;; don't use rdx and rax - they are needed for multiply operation %define gp3 rbp %define gp4 r8 %define gp5 r9 %define gp6 r10 %define gp7 r11 %define gp8 r12 %define gp9 r13 %define gp10 r14 %define gp11 r15 %xdefine len gp11 %xdefine msg gp10 %define POLY1305_BLOCK_SIZE 16 struc STACKFRAME _gpr_save: resq 8 endstruc mksection .text ;; ============================================================================= ;; ============================================================================= ;; Initializes POLY1305 context structure ;; ============================================================================= %macro POLY1305_INIT 6 %define %%KEY %1 ; [in] pointer to 32-byte key %define %%A0 %2 ; [out] GPR with accumulator bits 63..0 %define %%A1 %3 ; [out] GPR with accumulator bits 127..64 %define %%A2 %4 ; [out] GPR with accumulator bits 195..128 %define %%R0 %5 ; [out] GPR with R constant bits 63..0 %define %%R1 %6 ; [out] GPR with R constant bits 127..64 ;; R = KEY[0..15] & 0xffffffc0ffffffc0ffffffc0fffffff mov %%R0, 0x0ffffffc0fffffff and %%R0, [%%KEY + (0 * 8)] mov %%R1, 0x0ffffffc0ffffffc and %%R1, [%%KEY + (1 * 8)] ;; set accumulator to 0 xor %%A0, %%A0 xor %%A1, %%A1 xor %%A2, %%A2 %endmacro ;; ============================================================================= ;; ============================================================================= ;; Computes hash for message length being multiple of block size ;; ============================================================================= %macro POLY1305_MUL_REDUCE 11 %define %%A0 %1 ; [in/out] GPR with accumulator bits 63:0 %define %%A1 %2 ; [in/out] GPR with accumulator bits 127:64 %define %%A2 %3 ; [in/out] GPR with accumulator bits 195:128 %define %%R0 %4 ; [in] GPR with R constant bits 63:0 %define %%R1 %5 ; [in] GPR with R constant bits 127:64 %define %%C1 %6 ; [in] C1 = R1 + (R1 >> 2) %define %%T1 %7 ; [clobbered] GPR register %define %%T2 %8 ; [clobbered] GPR register %define %%T3 %9 ; [clobbered] GPR register %define %%GP_RAX %10 ; [clobbered] RAX register %define %%GP_RDX %11 ; [clobbered] RDX register ;; Combining 64-bit x 64-bit multiplication with reduction steps ;; ;; NOTES: ;; 1) A2 here is only two bits so anything above is subject of reduction. ;; Constant C1 = R1 + (R1 >> 2) simplifies multiply with less operations ;; 2) Magic 5x comes from mod 2^130-5 property and incorporating ;; reduction into multiply phase. ;; See "Cheating at modular arithmetic" and "Poly1305's prime: 2^130 - 5" ;; paragraphs at https://loup-vaillant.fr/tutorials/poly1305-design for more details. ;; ;; Flow of the code below is as follows: ;; ;; A2 A1 A0 ;; x R1 R0 ;; ----------------------------- ;; A2×R0 A1×R0 A0×R0 ;; + A0×R1 ;; + 5xA2xR1 5xA1xR1 ;; ----------------------------- ;; [0|L2L] [L1H|L1L] [L0H|L0L] ;; ;; Registers: T3:T2 T1:A0 ;; ;; Completing the multiply and adding (with carry) 3x128-bit limbs into ;; 192-bits again (3x64-bits): ;; A0 = L0L ;; A1 = L0H + L1L ;; T3 = L1H + L2L mov %%GP_RAX, %%R1 mul %%A0 mov %%T2, %%GP_RAX mov %%GP_RAX, %%R0 mov %%T3, %%GP_RDX ;; T1:A0 = (A0 * R0) mul %%A0 mov %%A0, %%GP_RAX ;; A0 not used in other operations mov %%GP_RAX, %%R0 mov %%T1, %%GP_RDX ;; T3:T2 += (A1 * R0) mul %%A1 add %%T2, %%GP_RAX mov %%GP_RAX, %%C1 adc %%T3, %%GP_RDX ;; T1:A0 += (A1 * R1x5) mul %%A1 mov %%A1, %%A2 ;; use A1 for A2 add %%A0, %%GP_RAX adc %%T1, %%GP_RDX ;; NOTE: A2 is clamped to 2-bits, ;; R1/R0 is clamped to 60-bits, ;; their product is less than 2^64. ;; T3:T2 += (A2 * R1x5) imul %%A1, %%C1 add %%T2, %%A1 mov %%A1, %%T1 ;; T1:A0 => A1:A0 adc %%T3, 0 ;; T3:A1 += (A2 * R0) imul %%A2, %%R0 add %%A1, %%T2 adc %%T3, %%A2 ;; At this point, 3 64-bit limbs are in T3:A1:A0 ;; T3 can span over more than 2 bits so final partial reduction step is needed. ;; ;; Partial reduction (just to fit into 130 bits) ;; A2 = T3 & 3 ;; k = (T3 & ~3) + (T3 >> 2) ;; Y x4 + Y x1 ;; A2:A1:A0 += k ;; ;; Result will be in A2:A1:A0 mov %%T1, %%T3 mov DWORD(%%A2), DWORD(%%T3) and %%T1, ~3 shr %%T3, 2 and DWORD(%%A2), 3 add %%T1, %%T3 ;; A2:A1:A0 += k (kept in T1) add %%A0, %%T1 adc %%A1, 0 adc DWORD(%%A2), 0 %endmacro ;; ============================================================================= ;; ============================================================================= ;; Computes hash for message length being multiple of block size ;; ============================================================================= %macro POLY1305_BLOCKS 13 %define %%MSG %1 ; [in/out] GPR pointer to input message (updated) %define %%LEN %2 ; [in/out] GPR in: length in bytes / out: length mod 16 %define %%A0 %3 ; [in/out] accumulator bits 63..0 %define %%A1 %4 ; [in/out] accumulator bits 127..64 %define %%A2 %5 ; [in/out] accumulator bits 195..128 %define %%R0 %6 ; [in] R constant bits 63..0 %define %%R1 %7 ; [in] R constant bits 127..64 %define %%T0 %8 ; [clobbered] GPR register %define %%T1 %9 ; [clobbered] GPR register %define %%T2 %10 ; [clobbered] GPR register %define %%T3 %11 ; [clobbered] GPR register %define %%GP_RAX %12 ; [clobbered] RAX register %define %%GP_RDX %13 ; [clobbered] RDX register mov %%T0, %%R1 shr %%T0, 2 add %%T0, %%R1 ;; T0 = R1 + (R1 >> 2) %%_poly1305_blocks_loop: cmp %%LEN, POLY1305_BLOCK_SIZE jb %%_poly1305_blocks_loop_end ;; A += MSG[i] add %%A0, [%%MSG + (0 * 8)] adc %%A1, [%%MSG + (1 * 8)] adc %%A2, 1 ;; padding bit POLY1305_MUL_REDUCE %%A0, %%A1, %%A2, %%R0, %%R1, \ %%T0, %%T1, %%T2, %%T3, %%GP_RAX, %%GP_RDX add %%MSG, POLY1305_BLOCK_SIZE sub %%LEN, POLY1305_BLOCK_SIZE jmp %%_poly1305_blocks_loop %%_poly1305_blocks_loop_end: %endmacro ;; ============================================================================= ;; ============================================================================= ;; Computes hash for the final partial block ;; ============================================================================= %macro POLY1305_PARTIAL_BLOCK 15 %define %%BUF %1 ; [in/clobbered] pointer to 16 byte scratch buffer %define %%MSG %2 ; [in] GPR pointer to input message %define %%LEN %3 ; [in] GPR message length %define %%A0 %4 ; [in/out] accumulator bits 63..0 %define %%A1 %5 ; [in/out] accumulator bits 127..64 %define %%A2 %6 ; [in/out] accumulator bits 195..128 %define %%R0 %7 ; [in] R constant bits 63..0 %define %%R1 %8 ; [in] R constant bits 127..64 %define %%T0 %9 ; [clobbered] GPR register %define %%T1 %10 ; [clobbered] GPR register %define %%T2 %11 ; [clobbered] GPR register %define %%T3 %12 ; [clobbered] GPR register %define %%GP_RAX %13 ; [clobbered] RAX register %define %%GP_RDX %14 ; [clobbered] RDX register %define %%PAD_16 %15 ; [in] text "pad_to_16" or "no_padding" ;; clear the scratch buffer xor %%T1, %%T1 mov [%%BUF + 0], %%T1 mov [%%BUF + 8], %%T1 ;; copy message bytes into the scratch buffer memcpy_sse_16_1 %%BUF, %%MSG, %%LEN, %%T1, %%T2 %ifnidn %%PAD_16,pad_to_16 ;; pad the message in the scratch buffer mov byte [%%BUF + %%LEN], 0x01 %endif ;; A += MSG[i] add %%A0, [%%BUF + 0] adc %%A1, [%%BUF + 8] %ifnidn %%PAD_16,pad_to_16 adc %%A2, 0 ;; no padding bit %else adc %%A2, 1 ;; padding bit please %endif mov %%T0, %%R1 shr %%T0, 2 add %%T0, %%R1 ;; T0 = R1 + (R1 >> 2) POLY1305_MUL_REDUCE %%A0, %%A1, %%A2, %%R0, %%R1, \ %%T0, %%T1, %%T2, %%T3, %%GP_RAX, %%GP_RDX %ifdef SAFE_DATA ;; clear the scratch buffer xor %%T1, %%T1 mov [%%BUF + 0], %%T1 mov [%%BUF + 8], %%T1 %endif %endmacro ;; ============================================================================= ;; ============================================================================= ;; Finalizes Poly1305 hash calculation on a message ;; ============================================================================= %macro POLY1305_FINALIZE 8 %define %%KEY %1 ; [in] pointer to 32 byte key %define %%MAC %2 ; [in/out] pointer to store MAC value into (16 bytes) %define %%A0 %3 ; [in/out] accumulator bits 63..0 %define %%A1 %4 ; [in/out] accumulator bits 127..64 %define %%A2 %5 ; [in/out] accumulator bits 195..128 %define %%T0 %6 ; [clobbered] GPR register %define %%T1 %7 ; [clobbered] GPR register %define %%T2 %8 ; [clobbered] GPR register ;; T = A - P, where P = 2^130 - 5 ;; P[63..0] = 0xFFFFFFFFFFFFFFFB ;; P[127..64] = 0xFFFFFFFFFFFFFFFF ;; P[195..128] = 0x0000000000000003 mov %%T0, %%A0 mov %%T1, %%A1 mov %%T2, %%A2 sub %%T0, -5 ;; 0xFFFFFFFFFFFFFFFB sbb %%T1, -1 ;; 0xFFFFFFFFFFFFFFFF sbb %%T2, 0x3 ;; if A > (2^130 - 5) then A = T ;; - here, if borrow/CF == false then A = T cmovnc %%A0, %%T0 cmovnc %%A1, %%T1 ;; MAC = (A + S) mod 2^128 (S = key[16..31]) add %%A0, [%%KEY + (2 * 8)] adc %%A1, [%%KEY + (3 * 8)] ;; store MAC mov [%%MAC + (0 * 8)], %%A0 mov [%%MAC + (1 * 8)], %%A1 %endmacro ;; ============================================================================= ;; ============================================================================= ;; Creates stack frame and saves registers ;; ============================================================================= %macro FUNC_ENTRY 0 sub rsp, STACKFRAME_size mov [rsp + _gpr_save + 8*0], rbx mov [rsp + _gpr_save + 8*1], rbp mov [rsp + _gpr_save + 8*2], r12 mov [rsp + _gpr_save + 8*3], r13 mov [rsp + _gpr_save + 8*4], r14 mov [rsp + _gpr_save + 8*5], r15 %ifndef LINUX mov [rsp + _gpr_save + 8*6], rsi mov [rsp + _gpr_save + 8*7], rdi %endif %endmacro ; FUNC_ENTRY ;; ============================================================================= ;; ============================================================================= ;; Restores registers and removes the stack frame ;; ============================================================================= %macro FUNC_EXIT 0 mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] mov r12, [rsp + _gpr_save + 8*2] mov r13, [rsp + _gpr_save + 8*3] mov r14, [rsp + _gpr_save + 8*4] mov r15, [rsp + _gpr_save + 8*5] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*6] mov rdi, [rsp + _gpr_save + 8*7] %endif add rsp, STACKFRAME_size %ifdef SAFE_DATA clear_scratch_gps_asm %endif ;; SAFE_DATA %endmacro ;; ============================================================================= ;; ============================================================================= ;; void poly1305_mac_scalar(IMB_JOB *job) ;; arg1 - job structure align 32 MKGLOBAL(poly1305_mac_scalar,function,internal) poly1305_mac_scalar: FUNC_ENTRY %ifndef LINUX mov job, arg1 %endif %ifdef SAFE_PARAM or job, job jz .poly1305_mac_exit %endif %xdefine _a0 gp1 %xdefine _a1 gp2 %xdefine _a2 gp3 %xdefine _r0 gp4 %xdefine _r1 gp5 mov gp6, [job + _poly1305_key] POLY1305_INIT gp6, _a0, _a1, _a2, _r0, _r1 mov msg, [job + _src] add msg, [job + _hash_start_src_offset_in_bytes] mov len, [job + _msg_len_to_hash] POLY1305_BLOCKS msg, len, _a0, _a1, _a2, _r0, _r1, \ gp6, gp7, gp8, gp9, rax, rdx or len, len jz .poly1305_no_partial_block ;; create stack frame for the partial block scratch buffer sub rsp, 16 POLY1305_PARTIAL_BLOCK rsp, msg, len, _a0, _a1, _a2, _r0, _r1, \ gp6, gp7, gp8, gp9, rax, rdx, no_padding ;; remove the stack frame (memory is cleared as part of the macro) add rsp, 16 .poly1305_no_partial_block: mov rax, [job + _poly1305_key] mov rdx, [job + _auth_tag_output] POLY1305_FINALIZE rax, rdx, _a0, _a1, _a2, gp6, gp7, gp8 .poly1305_mac_exit: FUNC_EXIT ret ;; ============================================================================= ;; ============================================================================= ;; void poly1305_aead_update_scalar(const void *msg, const uint64_t msg_len, ;; void *hash, const void *key) ;; arg1 - message pointer ;; arg2 - message length in bytes ;; arg3 - pointer to current hash value (size 24 bytes) ;; arg4 - key pointer (size 32 bytes) align 32 MKGLOBAL(poly1305_aead_update_scalar,function,internal) poly1305_aead_update_scalar: %ifdef SAFE_PARAM or arg1, arg1 jz .poly1305_update_exit or arg3, arg3 jz .poly1305_update_exit or arg4, arg4 jz .poly1305_update_exit %endif FUNC_ENTRY %ifdef LINUX %xdefine _a0 gp3 %xdefine _a1 gp4 %xdefine _a2 gp5 %xdefine _r0 gp6 %xdefine _r1 gp7 %xdefine _len arg2 %xdefine _arg3 arg4 ; use rcx, arg3 = rdx %else %xdefine _a0 gp3 %xdefine _a1 rdi %xdefine _a2 gp5 ; = arg4 / r9 %xdefine _r0 gp6 %xdefine _r1 gp7 %xdefine _len gp2 ; rsi %xdefine _arg3 arg3 ; arg %endif ;; load R mov _r0, [arg4 + 0 * 8] mov _r1, [arg4 + 1 * 8] ;; load accumulator / current hash value ;; note: arg4 can't be used beyond this point %ifdef LINUX mov _arg3, arg3 ; note: _arg3 = arg4 (linux) %endif mov _a0, [_arg3 + 0 * 8] mov _a1, [_arg3 + 1 * 8] mov _a2, [_arg3 + 2 * 8] ; note: _a2 = arg4 (win) %ifndef LINUX mov _len, arg2 ;; arg2 = rdx on Windows %endif POLY1305_BLOCKS arg1, _len, _a0, _a1, _a2, _r0, _r1, \ gp10, gp11, gp8, gp9, rax, rdx or _len, _len jz .poly1305_update_no_partial_block ;; create stack frame for the partial block scratch buffer sub rsp, 16 POLY1305_PARTIAL_BLOCK rsp, arg1, _len, _a0, _a1, _a2, _r0, _r1, \ gp10, gp11, gp8, gp9, rax, rdx, pad_to_16 ;; remove the stack frame (memory is cleared as part of the macro) add rsp, 16 .poly1305_update_no_partial_block: ;; save accumulator back mov [_arg3 + 0 * 8], _a0 mov [_arg3 + 1 * 8], _a1 mov [_arg3 + 2 * 8], _a2 FUNC_EXIT .poly1305_update_exit: ret ;; ============================================================================= ;; ============================================================================= ;; void poly1305_aead_complete_scalar(const void *hash, const void *key, void *tag) ;; arg1 - pointer to current hash value (size 24 bytes) ;; arg2 - key pointer (size 32 bytes) ;; arg3 - pointer to store computed authentication tag (16 bytes) align 32 MKGLOBAL(poly1305_aead_complete_scalar,function,internal) poly1305_aead_complete_scalar: %ifdef SAFE_PARAM or arg1, arg1 jz .poly1305_complete_exit or arg2, arg2 jz .poly1305_complete_exit or arg3, arg3 jz .poly1305_complete_exit %endif FUNC_ENTRY %xdefine _a0 gp6 %xdefine _a1 gp7 %xdefine _a2 gp8 ;; load accumulator / current hash value mov _a0, [arg1 + 0 * 8] mov _a1, [arg1 + 1 * 8] mov _a2, [arg1 + 2 * 8] POLY1305_FINALIZE arg2, arg3, _a0, _a1, _a2, gp9, gp10, gp11 ;; clear Poly key %ifdef SAFE_DATA xor rax, rax mov [arg2], rax mov [arg2 + 8], rax mov [arg2 + 16], rax mov [arg2 + 24], rax %endif FUNC_EXIT .poly1305_complete_exit: ret mksection stack-noexec
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-powflt.ads
JCGobbi/Nucleo-STM32G474RE
0
25655
<filename>bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-powflt.ads ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . P O W T E N _ F L T -- -- -- -- S p e c -- -- -- -- Copyright (C) 2020-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a powers of ten table used for real conversions package System.Powten_Flt is pragma Pure; Maxpow_Exact : constant := 10; -- Largest power of ten exactly representable with Float. It is equal to -- floor (M * log 2 / log 5), when M is the size of the mantissa (24). Maxpow : constant := Maxpow_Exact * 2; -- Largest power of ten exactly representable with a double Float Powten : constant array (0 .. Maxpow, 1 .. 2) of Float := (00 => (1.0E+00, 0.0), 01 => (1.0E+01, 0.0), 02 => (1.0E+02, 0.0), 03 => (1.0E+03, 0.0), 04 => (1.0E+04, 0.0), 05 => (1.0E+05, 0.0), 06 => (1.0E+06, 0.0), 07 => (1.0E+07, 0.0), 08 => (1.0E+08, 0.0), 09 => (1.0E+09, 0.0), 10 => (1.0E+10, 0.0), 11 => (1.0E+11, 1.0E+11 - Float'Machine (1.0E+11)), 12 => (1.0E+12, 1.0E+12 - Float'Machine (1.0E+12)), 13 => (1.0E+13, 1.0E+13 - Float'Machine (1.0E+13)), 14 => (1.0E+14, 1.0E+14 - Float'Machine (1.0E+14)), 15 => (1.0E+15, 1.0E+15 - Float'Machine (1.0E+15)), 16 => (1.0E+16, 1.0E+16 - Float'Machine (1.0E+16)), 17 => (1.0E+17, 1.0E+17 - Float'Machine (1.0E+17)), 18 => (1.0E+18, 1.0E+18 - Float'Machine (1.0E+18)), 19 => (1.0E+19, 1.0E+19 - Float'Machine (1.0E+19)), 20 => (1.0E+20, 1.0E+20 - Float'Machine (1.0E+20))); end System.Powten_Flt;
notes/extra/swap.asm
feliposz/nand2tetris
0
28478
<reponame>feliposz/nand2tetris // Swap values from RAM[0] and RAM[1] // Uses RAM[2] as temporary swap @R1 D=M // D=RAM[1] @R2 M=D // RAM[2]=D @R0 D=M // D=RAM[0] @R1 M=D // RAM[1]=D @R2 D=M // D=RAM[2] @R0 M=D // RAM[0]=D @13 0;JMP // JMP 13 (BREAK)
Sets.agda
thibautbenjamin/catt-formalization
2
997
<reponame>thibautbenjamin/catt-formalization<gh_stars>1-10 {-# OPTIONS --without-K #-} -- -- Implementation of Sets using lists -- open import Prelude module Sets {i} (A : Set i) (eqdecA : eqdec A) where valid : list A → Set i valid l = ∀ x → has-all-paths (x ∈-list l) set = Σ (list A) (λ l → valid l) valid-nil : valid nil valid-nil _ () Ø : set Ø = nil , valid-nil valid-singleton : ∀ (x : A) → valid (nil :: x) valid-singleton x y (inr p) (inr q) = ap inr (is-prop-has-all-paths (eqdec-is-set eqdecA y x) p q) singleton : ∀ A → set singleton x = (nil :: x) , valid-singleton x add-carrier : list A → A → list A add-carrier l a with dec-∈-list eqdecA a l ... | inl _ = l ... | inr _ = l :: a add-valid : ∀ (s : set) a → valid (add-carrier (fst s) a) add-valid (l , valid-l) a x b b' with dec-∈-list eqdecA a l ... | inl x∈l = valid-l x b b' ... | inr x∉l with eqdecA x a add-valid (l , valid-l) a .a (inl x∈l) b' | inr x∉l | inl idp = ⊥-elim (x∉l x∈l) add-valid (l , valid-l) a .a (inr _) (inl x∈l) | inr x∉l | inl idp = ⊥-elim (x∉l x∈l) add-valid (l , valid-l) a .a (inr p) (inr q) | inr x∉l | inl idp = ap inr (is-prop-has-all-paths (eqdec-is-set eqdecA a a) p q) add-valid (l , valid-l) a x (inl x∈l) (inl x∈'l) | inr x∉l | inr _ = ap inl (valid-l x x∈l x∈'l) add-valid (l , valid-l) a x (inl x∈l) (inr x=a) | inr x∉l | inr x≠a = ⊥-elim (x≠a x=a) add-valid (l , valid-l) a x (inr x=a) b' | inr x∉l | inr x≠a = ⊥-elim (x≠a x=a) add : ∀ (s : set) → A → set add s a = add-carrier (fst s) a , add-valid s a _∈-set_ : A → set → Set i a ∈-set s = a ∈-list (fst s) has-all-paths-∈-set : ∀ a s → has-all-paths (a ∈-set s) has-all-paths-∈-set a s = snd s a is-prop-∈-set : ∀ a s → is-prop (a ∈-set s) is-prop-∈-set a s = has-all-paths-is-prop (has-all-paths-∈-set a s) add+ : set → list A → set add+ s nil = s add+ s (l :: a) = add (add+ s l) a -- -- Very inefficient implementation of the union of sets -- _∪-set_ : set → set → set -- s ∪-set s' = add+ s (fst s') set-of-list : list A → set set-of-list l = add+ Ø l -- -- being in the list or in its set are logically equivalent -- -- but being in the set is a proposition -- -- achieves the construction of propositional truncation in a reduced way ∈-set-∈-list : ∀ a l → a ∈-set set-of-list l → a ∈-list l ∈-set-∈-list a (l :: b) a∈s with dec-∈-list eqdecA b (fst (add+ Ø l)) ... | inl _ = inl (∈-set-∈-list a l a∈s) ... | inr _ with eqdecA a b ... | inl idp = inr idp ∈-set-∈-list a (l :: b) (inl a∈s) | inr _ | inr _ = inl (∈-set-∈-list a l a∈s) ∈-set-∈-list a (l :: b) (inr idp) | inr _ | inr b≠b = inl (⊥-elim (b≠b idp)) ∈-list-∈-set : ∀ a l → a ∈-list l → a ∈-set (set-of-list l) ∈-list-∈-set a (l :: b) a∈l+ with eqdecA a b ∈-list-∈-set a (l :: b) (inr a=b) | inr a≠b = ⊥-elim (a≠b a=b) ∈-list-∈-set a (l :: b) (inl a∈l) | inr a≠b with dec-∈-list eqdecA b (fst (add+ Ø l)) ... | inl _ = ∈-list-∈-set a l a∈l ... | inr _ = inl (∈-list-∈-set a l a∈l) ∈-list-∈-set a (l :: b) a∈l+ | inl idp with dec-∈-list eqdecA b (fst (add+ Ø l)) ... | inl a∈l = a∈l ... | inr _ = inr idp -- Note that these are not *really* sets : the order matters -- In particular the identity types are not correct _∪-set_ : set → set → set (s , _) ∪-set (s' , _) = set-of-list (s ++ s') _⊂_ : set → set → Set i A ⊂ B = ∀ x → x ∈-set A → x ∈-set B has-all-paths-→ : ∀ {i} (A B : Set i) → has-all-paths B → has-all-paths (A → B) has-all-paths-→ A B paths-B f g = funext f g (λ x → paths-B (f x) (g x)) has-all-paths-∀ : ∀ {i} (A : Set i) (B : A → Set i) → (∀ a → has-all-paths (B a)) → has-all-paths (∀ a → B a) has-all-paths-∀ A B paths-B f g = funext-dep f g λ a → paths-B a (f a) (g a) is-prop-→ : ∀ {i} A B → is-prop {i} B → is-prop (A → B) is-prop-→ A B prop-B = has-all-paths-is-prop (has-all-paths-→ A B (is-prop-has-all-paths prop-B)) is-prop-∀ : ∀ {i} (A : Set i) (B : A → Set i) → (∀ a → is-prop (B a)) → is-prop (∀ a → B a) is-prop-∀ A B prop-B = has-all-paths-is-prop (has-all-paths-∀ A B (λ a → is-prop-has-all-paths (prop-B a))) is-prop-⊂ : ∀ A B → is-prop (A ⊂ B) is-prop-⊂ A B = is-prop-∀ _ _ λ a → is-prop-→ _ _ (is-prop-∈-set a B) _≗_ : set → set → Set i A ≗ B = (A ⊂ B) × (B ⊂ A) has-all-paths-≗ : ∀ A B → has-all-paths (A ≗ B) has-all-paths-≗ A B (A⊂B , B⊂A) (A⊂'B , B⊂'A) = ,= (is-prop-has-all-paths (is-prop-⊂ A B) A⊂B A⊂'B) ((is-prop-has-all-paths (is-prop-⊂ B A) B⊂A B⊂'A)) is-prop-≗ : ∀ A B → is-prop (A ≗ B) is-prop-≗ A B = has-all-paths-is-prop (has-all-paths-≗ A B) dec-∈ : ∀ A a → dec (a ∈-set A) dec-∈ (A , _) a with dec-∈-list eqdecA a A ... | inl a∈A = inl a∈A ... | inr a∉A = inr a∉A ∈++₁ : ∀ l l' (a : A) → a ∈-list l → a ∈-list (l ++ l') ∈++₁ l nil a x = x ∈++₁ l (l' :: a₁) a x = inl (∈++₁ l l' a x) ∈++₂ : ∀ l l' (a : A) → a ∈-list l' → a ∈-list (l ++ l') ∈++₂ l (l' :: a₁) a (inl a∈l') = inl (∈++₂ l l' a a∈l') ∈++₂ l (l' :: a₁) a (inr idp) = inr idp ∈++ : ∀ l l' (a : A) → a ∈-list (l ++ l') → (a ∈-list l) + (a ∈-list l') ∈++ l nil a x = inl x ∈++ l (l' :: a₁) a (inl x) with ∈++ l l' a x ... | inl a∈l = inl a∈l ... | inr a∈l' = inr (inl a∈l') ∈++ l (l' :: a₁) a (inr p) = inr (inr p) ∈-∪₁ : ∀ {A B a} → a ∈-set A → (a ∈-set (A ∪-set B)) ∈-∪₁ {A , _} {B = nil , _} {a} a∈A = ∈-list-∈-set a (A ++ nil) a∈A ∈-∪₁ {A , _} {(B :: b) , _} {a} a∈A = ∈-list-∈-set a (A ++ (B :: b)) (inl (∈++₁ A B a a∈A)) ∈-∪₂ : ∀ {A B a} → a ∈-set B → (a ∈-set (A ∪-set B)) ∈-∪₂ {A , _} {B = nil , _} {a} () ∈-∪₂ {A , _} {(B :: b) , _} {a} (inl a∈B) = ∈-list-∈-set a (A ++ (B :: b)) (inl (∈++₂ A B a a∈B)) ∈-∪₂ {A , _} {(B :: b) , _} {a} (inr idp) = ∈-list-∈-set a (A ++ (B :: b)) (inr idp) ∉-∪ : ∀ {A B a} → ¬ (a ∈-set A) → ¬ (a ∈-set B) → ¬ (a ∈-set (A ∪-set B)) ∉-∪ {A , _} {B , _} {a} a∉A a∉B a∈A∪B with ∈++ A B a (∈-set-∈-list _ _ a∈A∪B) ... | inl x = a∉A x ... | inr x = a∉B x ∈-∪ : ∀ {A B a} → a ∈-set (A ∪-set B) → (a ∈-set A) + (a ∈-set B) ∈-∪ {A , _} {B , _} {a} a∈A∪B with ∈++ A B a (∈-set-∈-list _ _ a∈A∪B) ... | inl x = inl x ... | inr x = inr x ⊂-∪ : ∀ {A B C D} → A ⊂ B → C ⊂ D → (A ∪-set C) ⊂ (B ∪-set D) ⊂-∪ {A} {B} {C} {D} A⊂B C⊂D a a∈A∪C with dec-∈ A a | dec-∈ C a ... | inl a∈A | _ = ∈-∪₁ {B} {D} {a} (A⊂B _ a∈A) ... | inr a∉A | inl a∈C = ∈-∪₂ {B} {D} {a} (C⊂D _ a∈C) ... | inr a∉A | inr a∉C = ⊥-elim (∉-∪ {A} {C} {a} a∉A a∉C a∈A∪C) ∪-factor : ∀ A B C → (A ∪-set (B ∪-set C)) ≗ ((A ∪-set B) ∪-set (A ∪-set C)) fst (∪-factor A B C) x x∈A∪B∪C with ∈-∪ {A} {B ∪-set C} {x} x∈A∪B∪C ... | inl x∈A = ∈-∪₁ {A ∪-set B} {A ∪-set C} {x} (∈-∪₁ {A} {B} {x} x∈A) ... | inr x∈A∪B with ∈-∪ {B} {C} {x} x∈A∪B ... | inl x∈B = ∈-∪₁ {A ∪-set B} {A ∪-set C} {x} (∈-∪₂ {A} {B} {x} x∈B) ... | inr x∈C = ∈-∪₂ {A ∪-set B} {A ∪-set C} {x} (∈-∪₂ {A} {C} {x} x∈C) snd (∪-factor A B C) x x∈A∪B∪A∪C with ∈-∪ {A ∪-set B} {A ∪-set C} {x} x∈A∪B∪A∪C snd (∪-factor A B C) x x∈A∪B∪A∪C | inl x∈A∪B with ∈-∪ {A} {B} {x} x∈A∪B ... | inl x∈A = ∈-∪₁ {A} {B ∪-set C} {x} x∈A ... | inr x∈B = ∈-∪₂ {A} {B ∪-set C} {x} (∈-∪₁ {B} {C} {x} x∈B) snd (∪-factor A B C) x x∈A∪B∪A∪C | inr x∈A∪C with ∈-∪ {A} {C} {x} x∈A∪C ... | inl x∈A = ∈-∪₁ {A} {B ∪-set C} {x} x∈A ... | inr x∈C = ∈-∪₂ {A} {B ∪-set C} {x} (∈-∪₂ {B} {C} {x} x∈C) ≗-⊂ : ∀ {A B C} → A ≗ B → B ⊂ C → A ⊂ C ≗-⊂ (A⊂B , _) B⊂C _ a∈A = B⊂C _ (A⊂B _ a∈A) ⊂-trans : ∀ {A B C} → A ⊂ B → B ⊂ C → A ⊂ C ⊂-trans A⊂B B⊂C _ a∈A = B⊂C _ (A⊂B _ a∈A) ∈-singleton : ∀ a → a ∈-set (singleton a) ∈-singleton a = inr idp ∈-Ø : ∀ {x} → ¬ (x ∈-set Ø) ∈-Ø () A∪B⊂A∪B∪C : ∀ A B C → (A ∪-set B) ⊂ (A ∪-set (B ∪-set C)) A∪B⊂A∪B∪C A B C x x∈A∪B with ∈-∪ {A} {B} x∈A∪B ... | inl x∈A = ∈-∪₁ {A} {B ∪-set C} x∈A ... | inr x∈B = ∈-∪₂ {A} {B ∪-set C} (∈-∪₁ {B} {C} x∈B)
src/file/xtrim.asm
fourstix/Elfos-utils
3
90865
; ------------------------------------------------------------------- ; Truncate an executable file to it's runtime size. Used to remove ; padding bytes added by XMODEM transfer. Trimmed file has the ; .tr extension added. ; ; Copyright 2021 by <NAME> ; ------------------------------------------------------------------- ; Based on software written by <NAME> ; Thanks to the author for making this code available. ; Original author copyright notice: ; ******************************************************************* ; *** This software is copyright 2004 by <NAME> *** ; *** You have permission to use, modify, copy, and distribute *** ; *** this software so long as this copyright notice is retained. *** ; *** This software may not be used in commercial applications *** ; *** without express written permission from the author. *** ; ******************************************************************* #include ops.inc #include bios.inc #include kernel.inc ; ************************************************************ ; This block generates the Execution header ; It occurs 6 bytes before the program start. ; ************************************************************ org 02000h-6 ; Header starts at 01ffah dw 02000h ; Program load address dw endrom-2000h ; Program size dw 02000h ; Program execution address org 02000h ; Program code starts here br start ; Jump past build information ; Build date date: db 80H+9 ; Month, 80H offset means extended info db 23 ; Day dw 2021 ; Year ; Current build number build: dw 5 ; Must end with 0 (null) db 'Copyright 2021 <NAME>',0 start: LOAD rf, k_ver ; get pointer to kernel version lda rf ; if major is non-zero we are good lbnz setup lda rf ; if major is zero and minor is 4 smi 4 ; or higher we are good lbdf setup CALL o_inmsg ; Show bad kernel message and exit db 'Requires Elf/OS v0.4.0 or higher',13,10,0 lbr goodbye ; show msg and exit setup: lda ra ; move past any spaces smi ' ' lbz start dec ra ; move back to non-space character ldn ra ; get character lbnz good ; jump if non-zero CALL o_inmsg ; otherwise display usage information db 'Usage: xtrim filename, where filename is an executable file.',10,13,0 CALL o_inmsg db 'Trim an executable file to header size and save with .tr extension.',10,13,0 lbr goodbye ; and return to os good: LOAD rf, source ; point to source filename good1: lda ra ; get byte from argument plo re ; save for a moment smi '!' ; check for space or less lbnf good2 ; jump if termination of filename found glo re ; recover byte str rf ; write to source buffer inc rf lbr good1 ; loop back for more characters good2: ldi 0 ; need to write terminator str rf ; source filename is now complete LOAD rf, source ; move back to point to source LOAD rd, dest ; point to destination filename lda rf ; get the first character of filename copy: str rd ; save character in destination filename inc rd lda rf ; get next character lbnz copy ; copy up to zero at the end ldi '.' ; add extension '.tr' to destination name str rd inc rd ldi 't' str rd inc rd ldi 'r' str rd inc rd ldi 0 ; end name string with a null str rd ; Set the allocation low memory value to $3000 to prevent ; programs from allocating down into program buffers. LOAD rf, k_lowmem ; Point RF to lowmem location in kernel ldi 30h ; load lowmem with floor of $6000 str rf ; Elf/OS will not allocate a block inc rf ; of memory below this floor value ldi 00h str rf LOAD rf, source ; point to source filename LOAD rd, fildes ; get file descriptor ldi 0 ; flags for open plo r7 CALL o_open ; attempt to open file lbnf opened ; jump if file was opened LOAD rf, errmsg ; get error message CALL o_msg ; display it lbr goodbye ; and return to os opened: LOAD rf, flags ; check for executable ldn rf ; get the flag byte from file descriptor ani 040h ; Test executable bit is set lbnz opendest ; if executable file, continue on CALL o_close ; close file LOAD rf, errmsg3 ; show error message CALL o_msg lbr goodbye ; exit opendest: LOAD rf, dest ; point to destination filename LOAD rd, dfildes ; get file descriptor ldi 11 ; flags for open, executable, create if nonexist plo r7 CALL o_open ; attempt to open file lbnf opened2 LOAD rf, errmsg2 ; point to error message CALL o_msg ; and display it lbr goodbye opened2: LOAD rc, 6 ; want to read 6 bytes LOAD rf, header ; buffer to for header LOAD rd, fildes ; get file descriptor CALL o_read ; read the header lbdf showerr ; DF = 1 means read error LOAD rf, header ; buffer to retrieve data LOAD rd, dfildes ; get file descriptor CALL o_write ; write to destination file lbdf showerr ; DF = 1 means write error LOAD rf, header ; point rf at header inc rf inc rf ; point rf at size lda rf ; get size phi rc ldn rf ; put size in rc plo rc LOAD r7, 00H ; no alignment, temporary allocation CALL o_alloc ; allocate a block of memory lbdf bad_blk ; DF = 1 means allocation failed COPY rf, r8 ; save copy of buffer pointer LOAD rd, fildes ; get source file descriptor CALL o_read ; read the header lbdf showerr COPY r8, rf ; set rf to point back to buffer LOAD rd, dfildes ; get destination file descriptor CALL o_write ; write to destination file lbnf done ; finished if no errors showerr: CALL o_inmsg ; otherwise display error db 'File write error',10,13,0 lbr done bad_blk: CALL o_inmsg ; otherwise display error db 'Allocation failed.',13,10,0 lbr done done: LOAD rd, fildes ; get source file descriptor CALL o_close ; close the source file LOAD rd, dfildes ; get detination file descriptor CALL o_close ; and close destination file goodbye: lbr o_wrmboot ; return to os errmsg: db 'File not found',10,13,0 errmsg2: db 'Could not open destination',10,13,0 errmsg3: db 'Not an executable file',10,13,0 fildes: db 0,0,0,0 dw dta db 0,0 flags: db 0 db 0,0,0,0 dw 0,0 db 0,0,0,0 dfildes: db 0,0,0,0 dw ddta db 0,0 db 0 db 0,0,0,0 dw 0,0 db 0,0,0,0 header: db 0,0,0,0,0,0 endrom: equ $ source: ds 256 dest: ds 256 dta: ds 512 ddta: ds 512 buffer: db 0
_inc/Debug list - SBZ.asm
vladjester2020/Sonic1TMR
0
102634
; --------------------------------------------------------------------------- ; Debug list - Scrap Brain ; --------------------------------------------------------------------------- dc.w $1D dc.l Map_obj25+$25000000 dc.b 0, 0, $27, $B2 dc.l Map_obj26+$26000000 dc.b 0, 0, 6, $80 dc.l Map_obj5F+$5F000000 dc.b 0, 0, 4, 0 dc.l Map_obj60+$60000000 dc.b 0, 0, 4, $29 dc.l Map_obj78+$78000000 dc.b 0, 0, $22, $B0 dc.l Map_obj15b+$15000000 dc.b 7, 2, $43, $91 dc.l Map_obj67+$67000000 dc.b $E0, 0, $C3, $44 dc.l Map_obj52+$52000000 dc.b $28, 2, $22, $C0 dc.l Map_obj32+$32000000 dc.b 0, 0, 5, $13 dc.l Map_obj69+$69000000 dc.b 3, 0, $44, $92 dc.l Map_obj69a+$69000000 dc.b $83, 0, 4, $DF dc.l Map_obj6A+$6A000000 dc.b 2, 0, $43, $B5 dc.l Map_obj53+$53000000 dc.b 0, 0, $43, $F5 dc.l Map_obj52+$52000000 dc.b $39, 3, $44, $60 dc.l Map_obj6B+$6B000000 dc.b 0, 0, $22, $C0 dc.l Map_obj2A+$2A000000 dc.b 0, 0, $42, $E8 dc.l Map_obj6B+$6B000000 dc.b $13, 1, $22, $C0 dc.l Map_obj6A+$6A000000 dc.b 1, 0, $43, $B5 dc.l Map_obj6B+$6B000000 dc.b $24, 1, $22, $C0 dc.l Map_obj6A+$6A000000 dc.b 4, 2, $43, $B5 dc.l Map_obj6B+$6B000000 dc.b $34, 1, $22, $C0 dc.l Map_obj6C+$6C000000 dc.b 0, 0, $44, $C3 dc.l Map_obj6D+$6D000000 dc.b $64, 0, $83, $D9 dc.l Map_obj6D+$6D000000 dc.b $64, $B, $83, $D9 dc.l Map_obj6E+$6E000000 dc.b 4, 0, 4, $7E dc.l Map_obj70+$70000000 dc.b 0, 0, $42, $F0 dc.l Map_obj71+$71000000 dc.b $11, 0, $86, $80 dc.l Map_obj1E+$1E000000 dc.b 4, 0, $23, 2 dc.l Map_obj79+$79000000 dc.b 1, 0, 7, $A0 even
Question 3 - Convert str to an int/q3.asm
vinerodrigues/assembly
0
98889
;Aruivo fonte base para todos os outros programa ;Declaração de Variáveis ;Crie um programa para converter uma string que representa um valor numérico em um inteiro. Por exemplo, dada a string terminada em ;NULL “41275” (um total de 6 bytes), converta a string em um número inteiro de palavra dupla (0x0000A13B). Você pode assumir que a ;string e o inteiro resultante não têm sinal. Use o depurador para executar o programa e exibir os resultados finais. Crie um arquivo ;de entrada do depurador para mostrar os resultados. section .data sstr1 db '41275',0 ;Palavra que será verfiicada qaux dd 0 qaux2 dd 0 ;Constantes EXIT_SUCCESS equ 0 ; successful operation SYS_exit equ 60 ; call code for terminate ;** ; Code Section section .text global _start _start: ;-------------------criando o len do numero------------------------------------------ mov rbx, 0 ; len mov rax, sstr1; mov rdx, 1 ; variavel do potencia de dez looplen: cmp byte[rax +rbx*1], 0 je loopconvert inc rbx jmp looplen ;-------------------convertendo---------------------------------------------------- loopconvert: dec rbx cmp rbx, 0 jl converthexa mov cl, byte[rax+rbx*1] sub cl, 48 movzx ecx, cl ;--------------------------------------------botar em uma variavel de maior capacidade ;;;;;;;;;;;mov byte[qaux2], cl ;----------------------------------------------------------------------------------------- imul ecx, edx imul edx, 10 ;---------------------------------------------------------------------------- add ecx, dword[qaux] mov dword[qaux], ecx ;--------------------------------------------------------------------------------- ;mov ecx, 0 jmp loopconvert converthexa: mov ecx, dword[qaux] last: mov rax, SYS_exit ; successful operation mov rdi, EXIT_SUCCESS ; call code for terminate syscall
oeis/025/A025225.asm
neoneye/loda-programs
11
177789
; A025225: a(n) = a(1)*a(n-1) + a(2)*a(n-2) + ...+ a(n-1)*a(1) for n >= 2. Also a(n) = (2^n)*C(n-1), where C = A000108 (Catalan numbers). ; 2,4,16,80,448,2688,16896,109824,732160,4978688,34398208,240787456,1704034304,12171673600,87636049920,635361361920,4634400522240,33985603829760,250420238745600,1853109766717440,13765958267043840,102618961627054080,767411365211013120,5755585239082598400,43282000997901139968,326279699830331670528,2465224398718061510656,18665270447436751437824,141598603394347769528320,1076149385797043048415232,8192621130583940626644992,62468736120702547278168064,477033984921728542851465216 mov $1,$0 seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). lpb $1 mul $0,2 sub $1,1 lpe mul $0,2
oeis/020/A020336.asm
neoneye/loda-programs
11
178503
; A020336: Numbers whose base-8 representation is the juxtaposition of two identical strings. ; Submitted by <NAME> ; 9,18,27,36,45,54,63,520,585,650,715,780,845,910,975,1040,1105,1170,1235,1300,1365,1430,1495,1560,1625,1690,1755,1820,1885,1950,2015,2080,2145,2210,2275,2340,2405,2470,2535,2600,2665,2730,2795,2860,2925,2990,3055,3120,3185,3250,3315,3380,3445,3510,3575,3640,3705,3770,3835,3900,3965,4030,4095,32832,33345,33858,34371,34884,35397,35910,36423,36936,37449,37962,38475,38988,39501,40014,40527,41040,41553,42066,42579,43092,43605,44118,44631,45144,45657,46170,46683,47196,47709,48222,48735,49248,49761 mov $2,$0 add $0,1 mov $1,$0 lpb $1 mul $0,8 div $1,8 lpe add $0,1 add $0,$2
alloy4fun_models/trashltl/models/7/62ipFbaKuvkhD2AMC.als
Kaixi26/org.alloytools.alloy
0
2096
open main pred id62ipFbaKuvkhD2AMC_prop8 { always(eventually (File.link in Trash and link.File in Trash)) } pred __repair { id62ipFbaKuvkhD2AMC_prop8 } check __repair { id62ipFbaKuvkhD2AMC_prop8 <=> prop8o }
rewrite-hcl/src/main/antlr/HCLParser.g4
kevinvandervlist/rewrite
457
296
parser grammar HCLParser; options { tokenVocab=HCLLexer; } // Config file // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#structural-elements configFile : body ; body : bodyContent* ; bodyContent : attribute | block ; attribute : Identifier ASSIGN expression ; block : Identifier blockLabel* blockExpr ; blockLabel : QUOTE stringLiteral QUOTE | Identifier ; // Expressions // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#expressions expression : exprTerm #ExpressionTerm | operation #OperationExpression | expression QUESTION expression COLON expression #ConditionalExpression ; exprTerm : templateExpr #TemplateExpression | literalValue #LiteralExpression // There is a syntax ambiguity between for expressions and collection values whose // first element is a reference to a variable named for. // The for expression interpretation has priority. | forExpr #ForExpression | collectionValue #CollectionValueExpression | variableExpr #VariableExpression | functionCall #FunctionCallExpression | exprTerm index #IndexAccessExpression | exprTerm getAttr #AttributeAccessExpression | exprTerm splat #SplatExpression | LPAREN expression RPAREN #ParentheticalExpression | blockExpr #BlockExpression ; blockExpr : LBRACE body RBRACE ; // Literal Values // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#literal-values literalValue : NumericLiteral | BooleanLiteral | NULL ; // Collection Values // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#collection-values collectionValue : tuple | object ; tuple : LBRACK (expression (COMMA expression)* COMMA?)? RBRACK ; object : LBRACE (objectelem (COMMA objectelem)* COMMA?)? RBRACE ; objectelem : (Identifier | LPAREN Identifier RPAREN) (ASSIGN | COLON) expression ; // For Expressions // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#for-expressions forExpr : forTupleExpr | forObjectExpr ; forTupleExpr : FOR_BRACK forIntro COLON expression forCond? RBRACK ; forObjectExpr : FOR_BRACE forIntro COLON expression ARROW expression ELLIPSIS? forCond? RBRACE ; forIntro : Identifier (COMMA Identifier)? IN expression ; forCond : IF expression ; // Variable Expressions // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#variables-and-variable-expressions variableExpr : Identifier ; // Functions and Function Calls // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#functions-and-function-calls functionCall : Identifier LPAREN arguments? RPAREN; arguments : expression (COMMA expression)* (COMMA | ELLIPSIS)? ; // Index Operator // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#index-operator index : LBRACK expression RBRACK ; // Attribute Access Operator // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#attribute-access-operator getAttr : DOT Identifier ; // Splat Operators // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#splat-operators splat : attrSplat | fullSplat ; attrSplat : DOT MUL getAttr* ; fullSplat : LBRACK MUL RBRACK (getAttr | index)*; // Operations // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#operations operation : unaryOp | binaryOp ; unaryOp : (MINUS | NOT) exprTerm ; binaryOp : exprTerm binaryOperator exprTerm ; binaryOperator : compareOperator | arithmeticOperator | logicOperator ; compareOperator : (EQ | NEQ | LT | GT | LEQ | GEQ); arithmeticOperator : PLUS | MINUS | MUL | DIV | MOD; logicOperator : AND | OR; // Template Expressions // https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#template-expressions templateExpr : HEREDOC_START Identifier (NEWLINE heredocTemplatePart*)+ Identifier #Heredoc | QUOTE quotedTemplatePart* QUOTE #QuotedTemplate ; heredocTemplatePart : templateInterpolation | heredocLiteral ; heredocLiteral : HTemplateLiteral ; quotedTemplatePart : templateInterpolation | stringLiteral ; stringLiteral : TemplateStringLiteral ; templateInterpolation : TEMPLATE_INTERPOLATION_START expression RBRACE;
Logic/IntroInstances.agda
Lolirofle/stuff-in-agda
6
17441
module Logic.IntroInstances where import Data.Tuple as Tuple import Lvl open import Logic.Predicate open import Logic.Propositional open import Type private variable ℓ : Lvl.Level private variable A B Obj : Type{ℓ} private variable P : Obj → Type{ℓ} private variable x : Obj instance [∧]-intro-instance : ⦃ _ : A ⦄ → ⦃ _ : B ⦄ → (A ∧ B) [∧]-intro-instance ⦃ a ⦄ ⦃ b ⦄ = [∧]-intro a b instance [∨]-introₗ-instance : ⦃ _ : A ⦄ → (A ∨ B) [∨]-introₗ-instance ⦃ a ⦄ = [∨]-introₗ a instance [∨]-introᵣ-instance : ⦃ _ : B ⦄ → (A ∨ B) [∨]-introᵣ-instance ⦃ b ⦄ = [∨]-introᵣ b instance [∃]-intro-instance : ⦃ _ : P(x) ⦄ → ∃(P) [∃]-intro-instance {x = x} ⦃ proof ⦄ = [∃]-intro (x) ⦃ proof ⦄
dino/lcs/scr3.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
170976
<filename>dino/lcs/scr3.asm copyright zengfr site:http://github.com/zengfr/romhack 000BA0 move.w D0, (A0)+ 000BA2 move.w D1, (A0)+ [scr1, scr2, scr3] 0205AC move.l (A1)+, (A0)+ 0205AE dbra D4, $205ac [scr3] 023066 move.l (A1)+, (A0)+ 023068 move.w D1, D6 [scr3] 092104 move.w D0, ($0,A4) 092108 move.w D3, ($2,A4) [scr3] 092128 move.w D0, ($0,A4) 09212C move.w D3, ($2,A4) [scr3] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
echo.asm
phung001/xv6_lab2_mark
0
7094
<reponame>phung001/xv6_lab2_mark _echo: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 e4 f0 and $0xfffffff0,%esp 6: 83 ec 20 sub $0x20,%esp int i; for(i = 1; i < argc; i++) 9: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp) 10: 00 11: eb 45 jmp 58 <main+0x58> printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); 13: 8b 44 24 1c mov 0x1c(%esp),%eax 17: 83 c0 01 add $0x1,%eax 1a: 3b 45 08 cmp 0x8(%ebp),%eax 1d: 7d 07 jge 26 <main+0x26> 1f: b8 6e 0b 00 00 mov $0xb6e,%eax 24: eb 05 jmp 2b <main+0x2b> 26: b8 70 0b 00 00 mov $0xb70,%eax 2b: 8b 54 24 1c mov 0x1c(%esp),%edx 2f: c1 e2 02 shl $0x2,%edx 32: 03 55 0c add 0xc(%ebp),%edx 35: 8b 12 mov (%edx),%edx 37: 89 44 24 0c mov %eax,0xc(%esp) 3b: 89 54 24 08 mov %edx,0x8(%esp) 3f: c7 44 24 04 72 0b 00 movl $0xb72,0x4(%esp) 46: 00 47: c7 04 24 01 00 00 00 movl $0x1,(%esp) 4e: e8 1a 04 00 00 call 46d <printf> int main(int argc, char *argv[]) { int i; for(i = 1; i < argc; i++) 53: 83 44 24 1c 01 addl $0x1,0x1c(%esp) 58: 8b 44 24 1c mov 0x1c(%esp),%eax 5c: 3b 45 08 cmp 0x8(%ebp),%eax 5f: 7c b2 jl 13 <main+0x13> printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); exit(); 61: e8 66 02 00 00 call 2cc <exit> 66: 90 nop 67: 90 nop 00000068 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 68: 55 push %ebp 69: 89 e5 mov %esp,%ebp 6b: 57 push %edi 6c: 53 push %ebx asm volatile("cld; rep stosb" : 6d: 8b 4d 08 mov 0x8(%ebp),%ecx 70: 8b 55 10 mov 0x10(%ebp),%edx 73: 8b 45 0c mov 0xc(%ebp),%eax 76: 89 cb mov %ecx,%ebx 78: 89 df mov %ebx,%edi 7a: 89 d1 mov %edx,%ecx 7c: fc cld 7d: f3 aa rep stos %al,%es:(%edi) 7f: 89 ca mov %ecx,%edx 81: 89 fb mov %edi,%ebx 83: 89 5d 08 mov %ebx,0x8(%ebp) 86: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 89: 5b pop %ebx 8a: 5f pop %edi 8b: 5d pop %ebp 8c: c3 ret 0000008d <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 8d: 55 push %ebp 8e: 89 e5 mov %esp,%ebp 90: 83 ec 10 sub $0x10,%esp char *os; os = s; 93: 8b 45 08 mov 0x8(%ebp),%eax 96: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 99: 8b 45 0c mov 0xc(%ebp),%eax 9c: 0f b6 10 movzbl (%eax),%edx 9f: 8b 45 08 mov 0x8(%ebp),%eax a2: 88 10 mov %dl,(%eax) a4: 8b 45 08 mov 0x8(%ebp),%eax a7: 0f b6 00 movzbl (%eax),%eax aa: 84 c0 test %al,%al ac: 0f 95 c0 setne %al af: 83 45 08 01 addl $0x1,0x8(%ebp) b3: 83 45 0c 01 addl $0x1,0xc(%ebp) b7: 84 c0 test %al,%al b9: 75 de jne 99 <strcpy+0xc> ; return os; bb: 8b 45 fc mov -0x4(%ebp),%eax } be: c9 leave bf: c3 ret 000000c0 <strcmp>: int strcmp(const char *p, const char *q) { c0: 55 push %ebp c1: 89 e5 mov %esp,%ebp while(*p && *p == *q) c3: eb 08 jmp cd <strcmp+0xd> p++, q++; c5: 83 45 08 01 addl $0x1,0x8(%ebp) c9: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) cd: 8b 45 08 mov 0x8(%ebp),%eax d0: 0f b6 00 movzbl (%eax),%eax d3: 84 c0 test %al,%al d5: 74 10 je e7 <strcmp+0x27> d7: 8b 45 08 mov 0x8(%ebp),%eax da: 0f b6 10 movzbl (%eax),%edx dd: 8b 45 0c mov 0xc(%ebp),%eax e0: 0f b6 00 movzbl (%eax),%eax e3: 38 c2 cmp %al,%dl e5: 74 de je c5 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; e7: 8b 45 08 mov 0x8(%ebp),%eax ea: 0f b6 00 movzbl (%eax),%eax ed: 0f b6 d0 movzbl %al,%edx f0: 8b 45 0c mov 0xc(%ebp),%eax f3: 0f b6 00 movzbl (%eax),%eax f6: 0f b6 c0 movzbl %al,%eax f9: 89 d1 mov %edx,%ecx fb: 29 c1 sub %eax,%ecx fd: 89 c8 mov %ecx,%eax } ff: 5d pop %ebp 100: c3 ret 00000101 <strlen>: uint strlen(char *s) { 101: 55 push %ebp 102: 89 e5 mov %esp,%ebp 104: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 107: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 10e: eb 04 jmp 114 <strlen+0x13> 110: 83 45 fc 01 addl $0x1,-0x4(%ebp) 114: 8b 45 fc mov -0x4(%ebp),%eax 117: 03 45 08 add 0x8(%ebp),%eax 11a: 0f b6 00 movzbl (%eax),%eax 11d: 84 c0 test %al,%al 11f: 75 ef jne 110 <strlen+0xf> ; return n; 121: 8b 45 fc mov -0x4(%ebp),%eax } 124: c9 leave 125: c3 ret 00000126 <memset>: void* memset(void *dst, int c, uint n) { 126: 55 push %ebp 127: 89 e5 mov %esp,%ebp 129: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 12c: 8b 45 10 mov 0x10(%ebp),%eax 12f: 89 44 24 08 mov %eax,0x8(%esp) 133: 8b 45 0c mov 0xc(%ebp),%eax 136: 89 44 24 04 mov %eax,0x4(%esp) 13a: 8b 45 08 mov 0x8(%ebp),%eax 13d: 89 04 24 mov %eax,(%esp) 140: e8 23 ff ff ff call 68 <stosb> return dst; 145: 8b 45 08 mov 0x8(%ebp),%eax } 148: c9 leave 149: c3 ret 0000014a <strchr>: char* strchr(const char *s, char c) { 14a: 55 push %ebp 14b: 89 e5 mov %esp,%ebp 14d: 83 ec 04 sub $0x4,%esp 150: 8b 45 0c mov 0xc(%ebp),%eax 153: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 156: eb 14 jmp 16c <strchr+0x22> if(*s == c) 158: 8b 45 08 mov 0x8(%ebp),%eax 15b: 0f b6 00 movzbl (%eax),%eax 15e: 3a 45 fc cmp -0x4(%ebp),%al 161: 75 05 jne 168 <strchr+0x1e> return (char*)s; 163: 8b 45 08 mov 0x8(%ebp),%eax 166: eb 13 jmp 17b <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 168: 83 45 08 01 addl $0x1,0x8(%ebp) 16c: 8b 45 08 mov 0x8(%ebp),%eax 16f: 0f b6 00 movzbl (%eax),%eax 172: 84 c0 test %al,%al 174: 75 e2 jne 158 <strchr+0xe> if(*s == c) return (char*)s; return 0; 176: b8 00 00 00 00 mov $0x0,%eax } 17b: c9 leave 17c: c3 ret 0000017d <gets>: char* gets(char *buf, int max) { 17d: 55 push %ebp 17e: 89 e5 mov %esp,%ebp 180: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 183: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 18a: eb 44 jmp 1d0 <gets+0x53> cc = read(0, &c, 1); 18c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 193: 00 194: 8d 45 ef lea -0x11(%ebp),%eax 197: 89 44 24 04 mov %eax,0x4(%esp) 19b: c7 04 24 00 00 00 00 movl $0x0,(%esp) 1a2: e8 3d 01 00 00 call 2e4 <read> 1a7: 89 45 f4 mov %eax,-0xc(%ebp) if(cc < 1) 1aa: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1ae: 7e 2d jle 1dd <gets+0x60> break; buf[i++] = c; 1b0: 8b 45 f0 mov -0x10(%ebp),%eax 1b3: 03 45 08 add 0x8(%ebp),%eax 1b6: 0f b6 55 ef movzbl -0x11(%ebp),%edx 1ba: 88 10 mov %dl,(%eax) 1bc: 83 45 f0 01 addl $0x1,-0x10(%ebp) if(c == '\n' || c == '\r') 1c0: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c4: 3c 0a cmp $0xa,%al 1c6: 74 16 je 1de <gets+0x61> 1c8: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1cc: 3c 0d cmp $0xd,%al 1ce: 74 0e je 1de <gets+0x61> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1d0: 8b 45 f0 mov -0x10(%ebp),%eax 1d3: 83 c0 01 add $0x1,%eax 1d6: 3b 45 0c cmp 0xc(%ebp),%eax 1d9: 7c b1 jl 18c <gets+0xf> 1db: eb 01 jmp 1de <gets+0x61> cc = read(0, &c, 1); if(cc < 1) break; 1dd: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1de: 8b 45 f0 mov -0x10(%ebp),%eax 1e1: 03 45 08 add 0x8(%ebp),%eax 1e4: c6 00 00 movb $0x0,(%eax) return buf; 1e7: 8b 45 08 mov 0x8(%ebp),%eax } 1ea: c9 leave 1eb: c3 ret 000001ec <stat>: int stat(char *n, struct stat *st) { 1ec: 55 push %ebp 1ed: 89 e5 mov %esp,%ebp 1ef: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 1f2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1f9: 00 1fa: 8b 45 08 mov 0x8(%ebp),%eax 1fd: 89 04 24 mov %eax,(%esp) 200: e8 07 01 00 00 call 30c <open> 205: 89 45 f0 mov %eax,-0x10(%ebp) if(fd < 0) 208: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 20c: 79 07 jns 215 <stat+0x29> return -1; 20e: b8 ff ff ff ff mov $0xffffffff,%eax 213: eb 23 jmp 238 <stat+0x4c> r = fstat(fd, st); 215: 8b 45 0c mov 0xc(%ebp),%eax 218: 89 44 24 04 mov %eax,0x4(%esp) 21c: 8b 45 f0 mov -0x10(%ebp),%eax 21f: 89 04 24 mov %eax,(%esp) 222: e8 fd 00 00 00 call 324 <fstat> 227: 89 45 f4 mov %eax,-0xc(%ebp) close(fd); 22a: 8b 45 f0 mov -0x10(%ebp),%eax 22d: 89 04 24 mov %eax,(%esp) 230: e8 bf 00 00 00 call 2f4 <close> return r; 235: 8b 45 f4 mov -0xc(%ebp),%eax } 238: c9 leave 239: c3 ret 0000023a <atoi>: int atoi(const char *s) { 23a: 55 push %ebp 23b: 89 e5 mov %esp,%ebp 23d: 83 ec 10 sub $0x10,%esp int n; n = 0; 240: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 247: eb 24 jmp 26d <atoi+0x33> n = n*10 + *s++ - '0'; 249: 8b 55 fc mov -0x4(%ebp),%edx 24c: 89 d0 mov %edx,%eax 24e: c1 e0 02 shl $0x2,%eax 251: 01 d0 add %edx,%eax 253: 01 c0 add %eax,%eax 255: 89 c2 mov %eax,%edx 257: 8b 45 08 mov 0x8(%ebp),%eax 25a: 0f b6 00 movzbl (%eax),%eax 25d: 0f be c0 movsbl %al,%eax 260: 8d 04 02 lea (%edx,%eax,1),%eax 263: 83 e8 30 sub $0x30,%eax 266: 89 45 fc mov %eax,-0x4(%ebp) 269: 83 45 08 01 addl $0x1,0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 26d: 8b 45 08 mov 0x8(%ebp),%eax 270: 0f b6 00 movzbl (%eax),%eax 273: 3c 2f cmp $0x2f,%al 275: 7e 0a jle 281 <atoi+0x47> 277: 8b 45 08 mov 0x8(%ebp),%eax 27a: 0f b6 00 movzbl (%eax),%eax 27d: 3c 39 cmp $0x39,%al 27f: 7e c8 jle 249 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 281: 8b 45 fc mov -0x4(%ebp),%eax } 284: c9 leave 285: c3 ret 00000286 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 286: 55 push %ebp 287: 89 e5 mov %esp,%ebp 289: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 28c: 8b 45 08 mov 0x8(%ebp),%eax 28f: 89 45 f8 mov %eax,-0x8(%ebp) src = vsrc; 292: 8b 45 0c mov 0xc(%ebp),%eax 295: 89 45 fc mov %eax,-0x4(%ebp) while(n-- > 0) 298: eb 13 jmp 2ad <memmove+0x27> *dst++ = *src++; 29a: 8b 45 fc mov -0x4(%ebp),%eax 29d: 0f b6 10 movzbl (%eax),%edx 2a0: 8b 45 f8 mov -0x8(%ebp),%eax 2a3: 88 10 mov %dl,(%eax) 2a5: 83 45 f8 01 addl $0x1,-0x8(%ebp) 2a9: 83 45 fc 01 addl $0x1,-0x4(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 2ad: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 2b1: 0f 9f c0 setg %al 2b4: 83 6d 10 01 subl $0x1,0x10(%ebp) 2b8: 84 c0 test %al,%al 2ba: 75 de jne 29a <memmove+0x14> *dst++ = *src++; return vdst; 2bc: 8b 45 08 mov 0x8(%ebp),%eax } 2bf: c9 leave 2c0: c3 ret 2c1: 90 nop 2c2: 90 nop 2c3: 90 nop 000002c4 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2c4: b8 01 00 00 00 mov $0x1,%eax 2c9: cd 40 int $0x40 2cb: c3 ret 000002cc <exit>: SYSCALL(exit) 2cc: b8 02 00 00 00 mov $0x2,%eax 2d1: cd 40 int $0x40 2d3: c3 ret 000002d4 <wait>: SYSCALL(wait) 2d4: b8 03 00 00 00 mov $0x3,%eax 2d9: cd 40 int $0x40 2db: c3 ret 000002dc <pipe>: SYSCALL(pipe) 2dc: b8 04 00 00 00 mov $0x4,%eax 2e1: cd 40 int $0x40 2e3: c3 ret 000002e4 <read>: SYSCALL(read) 2e4: b8 05 00 00 00 mov $0x5,%eax 2e9: cd 40 int $0x40 2eb: c3 ret 000002ec <write>: SYSCALL(write) 2ec: b8 10 00 00 00 mov $0x10,%eax 2f1: cd 40 int $0x40 2f3: c3 ret 000002f4 <close>: SYSCALL(close) 2f4: b8 15 00 00 00 mov $0x15,%eax 2f9: cd 40 int $0x40 2fb: c3 ret 000002fc <kill>: SYSCALL(kill) 2fc: b8 06 00 00 00 mov $0x6,%eax 301: cd 40 int $0x40 303: c3 ret 00000304 <exec>: SYSCALL(exec) 304: b8 07 00 00 00 mov $0x7,%eax 309: cd 40 int $0x40 30b: c3 ret 0000030c <open>: SYSCALL(open) 30c: b8 0f 00 00 00 mov $0xf,%eax 311: cd 40 int $0x40 313: c3 ret 00000314 <mknod>: SYSCALL(mknod) 314: b8 11 00 00 00 mov $0x11,%eax 319: cd 40 int $0x40 31b: c3 ret 0000031c <unlink>: SYSCALL(unlink) 31c: b8 12 00 00 00 mov $0x12,%eax 321: cd 40 int $0x40 323: c3 ret 00000324 <fstat>: SYSCALL(fstat) 324: b8 08 00 00 00 mov $0x8,%eax 329: cd 40 int $0x40 32b: c3 ret 0000032c <link>: SYSCALL(link) 32c: b8 13 00 00 00 mov $0x13,%eax 331: cd 40 int $0x40 333: c3 ret 00000334 <mkdir>: SYSCALL(mkdir) 334: b8 14 00 00 00 mov $0x14,%eax 339: cd 40 int $0x40 33b: c3 ret 0000033c <chdir>: SYSCALL(chdir) 33c: b8 09 00 00 00 mov $0x9,%eax 341: cd 40 int $0x40 343: c3 ret 00000344 <dup>: SYSCALL(dup) 344: b8 0a 00 00 00 mov $0xa,%eax 349: cd 40 int $0x40 34b: c3 ret 0000034c <getpid>: SYSCALL(getpid) 34c: b8 0b 00 00 00 mov $0xb,%eax 351: cd 40 int $0x40 353: c3 ret 00000354 <sbrk>: SYSCALL(sbrk) 354: b8 0c 00 00 00 mov $0xc,%eax 359: cd 40 int $0x40 35b: c3 ret 0000035c <sleep>: SYSCALL(sleep) 35c: b8 0d 00 00 00 mov $0xd,%eax 361: cd 40 int $0x40 363: c3 ret 00000364 <uptime>: SYSCALL(uptime) 364: b8 0e 00 00 00 mov $0xe,%eax 369: cd 40 int $0x40 36b: c3 ret 0000036c <clone>: SYSCALL(clone) 36c: b8 16 00 00 00 mov $0x16,%eax 371: cd 40 int $0x40 373: c3 ret 00000374 <texit>: SYSCALL(texit) 374: b8 17 00 00 00 mov $0x17,%eax 379: cd 40 int $0x40 37b: c3 ret 0000037c <tsleep>: SYSCALL(tsleep) 37c: b8 18 00 00 00 mov $0x18,%eax 381: cd 40 int $0x40 383: c3 ret 00000384 <twakeup>: SYSCALL(twakeup) 384: b8 19 00 00 00 mov $0x19,%eax 389: cd 40 int $0x40 38b: c3 ret 0000038c <thread_yield>: SYSCALL(thread_yield) 38c: b8 1a 00 00 00 mov $0x1a,%eax 391: cd 40 int $0x40 393: c3 ret 00000394 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 394: 55 push %ebp 395: 89 e5 mov %esp,%ebp 397: 83 ec 28 sub $0x28,%esp 39a: 8b 45 0c mov 0xc(%ebp),%eax 39d: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 3a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 3a7: 00 3a8: 8d 45 f4 lea -0xc(%ebp),%eax 3ab: 89 44 24 04 mov %eax,0x4(%esp) 3af: 8b 45 08 mov 0x8(%ebp),%eax 3b2: 89 04 24 mov %eax,(%esp) 3b5: e8 32 ff ff ff call 2ec <write> } 3ba: c9 leave 3bb: c3 ret 000003bc <printint>: static void printint(int fd, int xx, int base, int sgn) { 3bc: 55 push %ebp 3bd: 89 e5 mov %esp,%ebp 3bf: 53 push %ebx 3c0: 83 ec 44 sub $0x44,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3c3: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 3ca: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3ce: 74 17 je 3e7 <printint+0x2b> 3d0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3d4: 79 11 jns 3e7 <printint+0x2b> neg = 1; 3d6: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3dd: 8b 45 0c mov 0xc(%ebp),%eax 3e0: f7 d8 neg %eax 3e2: 89 45 f4 mov %eax,-0xc(%ebp) char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 3e5: eb 06 jmp 3ed <printint+0x31> neg = 1; x = -xx; } else { x = xx; 3e7: 8b 45 0c mov 0xc(%ebp),%eax 3ea: 89 45 f4 mov %eax,-0xc(%ebp) } i = 0; 3ed: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) do{ buf[i++] = digits[x % base]; 3f4: 8b 4d ec mov -0x14(%ebp),%ecx 3f7: 8b 5d 10 mov 0x10(%ebp),%ebx 3fa: 8b 45 f4 mov -0xc(%ebp),%eax 3fd: ba 00 00 00 00 mov $0x0,%edx 402: f7 f3 div %ebx 404: 89 d0 mov %edx,%eax 406: 0f b6 80 c4 0b 00 00 movzbl 0xbc4(%eax),%eax 40d: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) 411: 83 45 ec 01 addl $0x1,-0x14(%ebp) }while((x /= base) != 0); 415: 8b 45 10 mov 0x10(%ebp),%eax 418: 89 45 d4 mov %eax,-0x2c(%ebp) 41b: 8b 45 f4 mov -0xc(%ebp),%eax 41e: ba 00 00 00 00 mov $0x0,%edx 423: f7 75 d4 divl -0x2c(%ebp) 426: 89 45 f4 mov %eax,-0xc(%ebp) 429: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 42d: 75 c5 jne 3f4 <printint+0x38> if(neg) 42f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 433: 74 28 je 45d <printint+0xa1> buf[i++] = '-'; 435: 8b 45 ec mov -0x14(%ebp),%eax 438: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) 43d: 83 45 ec 01 addl $0x1,-0x14(%ebp) while(--i >= 0) 441: eb 1a jmp 45d <printint+0xa1> putc(fd, buf[i]); 443: 8b 45 ec mov -0x14(%ebp),%eax 446: 0f b6 44 05 dc movzbl -0x24(%ebp,%eax,1),%eax 44b: 0f be c0 movsbl %al,%eax 44e: 89 44 24 04 mov %eax,0x4(%esp) 452: 8b 45 08 mov 0x8(%ebp),%eax 455: 89 04 24 mov %eax,(%esp) 458: e8 37 ff ff ff call 394 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 45d: 83 6d ec 01 subl $0x1,-0x14(%ebp) 461: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 465: 79 dc jns 443 <printint+0x87> putc(fd, buf[i]); } 467: 83 c4 44 add $0x44,%esp 46a: 5b pop %ebx 46b: 5d pop %ebp 46c: c3 ret 0000046d <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 46d: 55 push %ebp 46e: 89 e5 mov %esp,%ebp 470: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 473: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) ap = (uint*)(void*)&fmt + 1; 47a: 8d 45 0c lea 0xc(%ebp),%eax 47d: 83 c0 04 add $0x4,%eax 480: 89 45 f4 mov %eax,-0xc(%ebp) for(i = 0; fmt[i]; i++){ 483: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 48a: e9 7e 01 00 00 jmp 60d <printf+0x1a0> c = fmt[i] & 0xff; 48f: 8b 55 0c mov 0xc(%ebp),%edx 492: 8b 45 ec mov -0x14(%ebp),%eax 495: 8d 04 02 lea (%edx,%eax,1),%eax 498: 0f b6 00 movzbl (%eax),%eax 49b: 0f be c0 movsbl %al,%eax 49e: 25 ff 00 00 00 and $0xff,%eax 4a3: 89 45 e8 mov %eax,-0x18(%ebp) if(state == 0){ 4a6: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 4aa: 75 2c jne 4d8 <printf+0x6b> if(c == '%'){ 4ac: 83 7d e8 25 cmpl $0x25,-0x18(%ebp) 4b0: 75 0c jne 4be <printf+0x51> state = '%'; 4b2: c7 45 f0 25 00 00 00 movl $0x25,-0x10(%ebp) 4b9: e9 4b 01 00 00 jmp 609 <printf+0x19c> } else { putc(fd, c); 4be: 8b 45 e8 mov -0x18(%ebp),%eax 4c1: 0f be c0 movsbl %al,%eax 4c4: 89 44 24 04 mov %eax,0x4(%esp) 4c8: 8b 45 08 mov 0x8(%ebp),%eax 4cb: 89 04 24 mov %eax,(%esp) 4ce: e8 c1 fe ff ff call 394 <putc> 4d3: e9 31 01 00 00 jmp 609 <printf+0x19c> } } else if(state == '%'){ 4d8: 83 7d f0 25 cmpl $0x25,-0x10(%ebp) 4dc: 0f 85 27 01 00 00 jne 609 <printf+0x19c> if(c == 'd'){ 4e2: 83 7d e8 64 cmpl $0x64,-0x18(%ebp) 4e6: 75 2d jne 515 <printf+0xa8> printint(fd, *ap, 10, 1); 4e8: 8b 45 f4 mov -0xc(%ebp),%eax 4eb: 8b 00 mov (%eax),%eax 4ed: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 4f4: 00 4f5: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 4fc: 00 4fd: 89 44 24 04 mov %eax,0x4(%esp) 501: 8b 45 08 mov 0x8(%ebp),%eax 504: 89 04 24 mov %eax,(%esp) 507: e8 b0 fe ff ff call 3bc <printint> ap++; 50c: 83 45 f4 04 addl $0x4,-0xc(%ebp) 510: e9 ed 00 00 00 jmp 602 <printf+0x195> } else if(c == 'x' || c == 'p'){ 515: 83 7d e8 78 cmpl $0x78,-0x18(%ebp) 519: 74 06 je 521 <printf+0xb4> 51b: 83 7d e8 70 cmpl $0x70,-0x18(%ebp) 51f: 75 2d jne 54e <printf+0xe1> printint(fd, *ap, 16, 0); 521: 8b 45 f4 mov -0xc(%ebp),%eax 524: 8b 00 mov (%eax),%eax 526: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 52d: 00 52e: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 535: 00 536: 89 44 24 04 mov %eax,0x4(%esp) 53a: 8b 45 08 mov 0x8(%ebp),%eax 53d: 89 04 24 mov %eax,(%esp) 540: e8 77 fe ff ff call 3bc <printint> ap++; 545: 83 45 f4 04 addl $0x4,-0xc(%ebp) } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 549: e9 b4 00 00 00 jmp 602 <printf+0x195> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 54e: 83 7d e8 73 cmpl $0x73,-0x18(%ebp) 552: 75 46 jne 59a <printf+0x12d> s = (char*)*ap; 554: 8b 45 f4 mov -0xc(%ebp),%eax 557: 8b 00 mov (%eax),%eax 559: 89 45 e4 mov %eax,-0x1c(%ebp) ap++; 55c: 83 45 f4 04 addl $0x4,-0xc(%ebp) if(s == 0) 560: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 564: 75 27 jne 58d <printf+0x120> s = "(null)"; 566: c7 45 e4 77 0b 00 00 movl $0xb77,-0x1c(%ebp) while(*s != 0){ 56d: eb 1f jmp 58e <printf+0x121> putc(fd, *s); 56f: 8b 45 e4 mov -0x1c(%ebp),%eax 572: 0f b6 00 movzbl (%eax),%eax 575: 0f be c0 movsbl %al,%eax 578: 89 44 24 04 mov %eax,0x4(%esp) 57c: 8b 45 08 mov 0x8(%ebp),%eax 57f: 89 04 24 mov %eax,(%esp) 582: e8 0d fe ff ff call 394 <putc> s++; 587: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 58b: eb 01 jmp 58e <printf+0x121> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 58d: 90 nop 58e: 8b 45 e4 mov -0x1c(%ebp),%eax 591: 0f b6 00 movzbl (%eax),%eax 594: 84 c0 test %al,%al 596: 75 d7 jne 56f <printf+0x102> 598: eb 68 jmp 602 <printf+0x195> putc(fd, *s); s++; } } else if(c == 'c'){ 59a: 83 7d e8 63 cmpl $0x63,-0x18(%ebp) 59e: 75 1d jne 5bd <printf+0x150> putc(fd, *ap); 5a0: 8b 45 f4 mov -0xc(%ebp),%eax 5a3: 8b 00 mov (%eax),%eax 5a5: 0f be c0 movsbl %al,%eax 5a8: 89 44 24 04 mov %eax,0x4(%esp) 5ac: 8b 45 08 mov 0x8(%ebp),%eax 5af: 89 04 24 mov %eax,(%esp) 5b2: e8 dd fd ff ff call 394 <putc> ap++; 5b7: 83 45 f4 04 addl $0x4,-0xc(%ebp) 5bb: eb 45 jmp 602 <printf+0x195> } else if(c == '%'){ 5bd: 83 7d e8 25 cmpl $0x25,-0x18(%ebp) 5c1: 75 17 jne 5da <printf+0x16d> putc(fd, c); 5c3: 8b 45 e8 mov -0x18(%ebp),%eax 5c6: 0f be c0 movsbl %al,%eax 5c9: 89 44 24 04 mov %eax,0x4(%esp) 5cd: 8b 45 08 mov 0x8(%ebp),%eax 5d0: 89 04 24 mov %eax,(%esp) 5d3: e8 bc fd ff ff call 394 <putc> 5d8: eb 28 jmp 602 <printf+0x195> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 5da: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 5e1: 00 5e2: 8b 45 08 mov 0x8(%ebp),%eax 5e5: 89 04 24 mov %eax,(%esp) 5e8: e8 a7 fd ff ff call 394 <putc> putc(fd, c); 5ed: 8b 45 e8 mov -0x18(%ebp),%eax 5f0: 0f be c0 movsbl %al,%eax 5f3: 89 44 24 04 mov %eax,0x4(%esp) 5f7: 8b 45 08 mov 0x8(%ebp),%eax 5fa: 89 04 24 mov %eax,(%esp) 5fd: e8 92 fd ff ff call 394 <putc> } state = 0; 602: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 609: 83 45 ec 01 addl $0x1,-0x14(%ebp) 60d: 8b 55 0c mov 0xc(%ebp),%edx 610: 8b 45 ec mov -0x14(%ebp),%eax 613: 8d 04 02 lea (%edx,%eax,1),%eax 616: 0f b6 00 movzbl (%eax),%eax 619: 84 c0 test %al,%al 61b: 0f 85 6e fe ff ff jne 48f <printf+0x22> putc(fd, c); } state = 0; } } } 621: c9 leave 622: c3 ret 623: 90 nop 00000624 <free>: static Header base; static Header *freep; void free(void *ap) { 624: 55 push %ebp 625: 89 e5 mov %esp,%ebp 627: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 62a: 8b 45 08 mov 0x8(%ebp),%eax 62d: 83 e8 08 sub $0x8,%eax 630: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 633: a1 e0 0b 00 00 mov 0xbe0,%eax 638: 89 45 fc mov %eax,-0x4(%ebp) 63b: eb 24 jmp 661 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 63d: 8b 45 fc mov -0x4(%ebp),%eax 640: 8b 00 mov (%eax),%eax 642: 3b 45 fc cmp -0x4(%ebp),%eax 645: 77 12 ja 659 <free+0x35> 647: 8b 45 f8 mov -0x8(%ebp),%eax 64a: 3b 45 fc cmp -0x4(%ebp),%eax 64d: 77 24 ja 673 <free+0x4f> 64f: 8b 45 fc mov -0x4(%ebp),%eax 652: 8b 00 mov (%eax),%eax 654: 3b 45 f8 cmp -0x8(%ebp),%eax 657: 77 1a ja 673 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 659: 8b 45 fc mov -0x4(%ebp),%eax 65c: 8b 00 mov (%eax),%eax 65e: 89 45 fc mov %eax,-0x4(%ebp) 661: 8b 45 f8 mov -0x8(%ebp),%eax 664: 3b 45 fc cmp -0x4(%ebp),%eax 667: 76 d4 jbe 63d <free+0x19> 669: 8b 45 fc mov -0x4(%ebp),%eax 66c: 8b 00 mov (%eax),%eax 66e: 3b 45 f8 cmp -0x8(%ebp),%eax 671: 76 ca jbe 63d <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 673: 8b 45 f8 mov -0x8(%ebp),%eax 676: 8b 40 04 mov 0x4(%eax),%eax 679: c1 e0 03 shl $0x3,%eax 67c: 89 c2 mov %eax,%edx 67e: 03 55 f8 add -0x8(%ebp),%edx 681: 8b 45 fc mov -0x4(%ebp),%eax 684: 8b 00 mov (%eax),%eax 686: 39 c2 cmp %eax,%edx 688: 75 24 jne 6ae <free+0x8a> bp->s.size += p->s.ptr->s.size; 68a: 8b 45 f8 mov -0x8(%ebp),%eax 68d: 8b 50 04 mov 0x4(%eax),%edx 690: 8b 45 fc mov -0x4(%ebp),%eax 693: 8b 00 mov (%eax),%eax 695: 8b 40 04 mov 0x4(%eax),%eax 698: 01 c2 add %eax,%edx 69a: 8b 45 f8 mov -0x8(%ebp),%eax 69d: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 6a0: 8b 45 fc mov -0x4(%ebp),%eax 6a3: 8b 00 mov (%eax),%eax 6a5: 8b 10 mov (%eax),%edx 6a7: 8b 45 f8 mov -0x8(%ebp),%eax 6aa: 89 10 mov %edx,(%eax) 6ac: eb 0a jmp 6b8 <free+0x94> } else bp->s.ptr = p->s.ptr; 6ae: 8b 45 fc mov -0x4(%ebp),%eax 6b1: 8b 10 mov (%eax),%edx 6b3: 8b 45 f8 mov -0x8(%ebp),%eax 6b6: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 6b8: 8b 45 fc mov -0x4(%ebp),%eax 6bb: 8b 40 04 mov 0x4(%eax),%eax 6be: c1 e0 03 shl $0x3,%eax 6c1: 03 45 fc add -0x4(%ebp),%eax 6c4: 3b 45 f8 cmp -0x8(%ebp),%eax 6c7: 75 20 jne 6e9 <free+0xc5> p->s.size += bp->s.size; 6c9: 8b 45 fc mov -0x4(%ebp),%eax 6cc: 8b 50 04 mov 0x4(%eax),%edx 6cf: 8b 45 f8 mov -0x8(%ebp),%eax 6d2: 8b 40 04 mov 0x4(%eax),%eax 6d5: 01 c2 add %eax,%edx 6d7: 8b 45 fc mov -0x4(%ebp),%eax 6da: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6dd: 8b 45 f8 mov -0x8(%ebp),%eax 6e0: 8b 10 mov (%eax),%edx 6e2: 8b 45 fc mov -0x4(%ebp),%eax 6e5: 89 10 mov %edx,(%eax) 6e7: eb 08 jmp 6f1 <free+0xcd> } else p->s.ptr = bp; 6e9: 8b 45 fc mov -0x4(%ebp),%eax 6ec: 8b 55 f8 mov -0x8(%ebp),%edx 6ef: 89 10 mov %edx,(%eax) freep = p; 6f1: 8b 45 fc mov -0x4(%ebp),%eax 6f4: a3 e0 0b 00 00 mov %eax,0xbe0 } 6f9: c9 leave 6fa: c3 ret 000006fb <morecore>: static Header* morecore(uint nu) { 6fb: 55 push %ebp 6fc: 89 e5 mov %esp,%ebp 6fe: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 701: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 708: 77 07 ja 711 <morecore+0x16> nu = 4096; 70a: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 711: 8b 45 08 mov 0x8(%ebp),%eax 714: c1 e0 03 shl $0x3,%eax 717: 89 04 24 mov %eax,(%esp) 71a: e8 35 fc ff ff call 354 <sbrk> 71f: 89 45 f0 mov %eax,-0x10(%ebp) if(p == (char*)-1) 722: 83 7d f0 ff cmpl $0xffffffff,-0x10(%ebp) 726: 75 07 jne 72f <morecore+0x34> return 0; 728: b8 00 00 00 00 mov $0x0,%eax 72d: eb 22 jmp 751 <morecore+0x56> hp = (Header*)p; 72f: 8b 45 f0 mov -0x10(%ebp),%eax 732: 89 45 f4 mov %eax,-0xc(%ebp) hp->s.size = nu; 735: 8b 45 f4 mov -0xc(%ebp),%eax 738: 8b 55 08 mov 0x8(%ebp),%edx 73b: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 73e: 8b 45 f4 mov -0xc(%ebp),%eax 741: 83 c0 08 add $0x8,%eax 744: 89 04 24 mov %eax,(%esp) 747: e8 d8 fe ff ff call 624 <free> return freep; 74c: a1 e0 0b 00 00 mov 0xbe0,%eax } 751: c9 leave 752: c3 ret 00000753 <malloc>: void* malloc(uint nbytes) { 753: 55 push %ebp 754: 89 e5 mov %esp,%ebp 756: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 759: 8b 45 08 mov 0x8(%ebp),%eax 75c: 83 c0 07 add $0x7,%eax 75f: c1 e8 03 shr $0x3,%eax 762: 83 c0 01 add $0x1,%eax 765: 89 45 f4 mov %eax,-0xc(%ebp) if((prevp = freep) == 0){ 768: a1 e0 0b 00 00 mov 0xbe0,%eax 76d: 89 45 f0 mov %eax,-0x10(%ebp) 770: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 774: 75 23 jne 799 <malloc+0x46> base.s.ptr = freep = prevp = &base; 776: c7 45 f0 d8 0b 00 00 movl $0xbd8,-0x10(%ebp) 77d: 8b 45 f0 mov -0x10(%ebp),%eax 780: a3 e0 0b 00 00 mov %eax,0xbe0 785: a1 e0 0b 00 00 mov 0xbe0,%eax 78a: a3 d8 0b 00 00 mov %eax,0xbd8 base.s.size = 0; 78f: c7 05 dc 0b 00 00 00 movl $0x0,0xbdc 796: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 799: 8b 45 f0 mov -0x10(%ebp),%eax 79c: 8b 00 mov (%eax),%eax 79e: 89 45 ec mov %eax,-0x14(%ebp) if(p->s.size >= nunits){ 7a1: 8b 45 ec mov -0x14(%ebp),%eax 7a4: 8b 40 04 mov 0x4(%eax),%eax 7a7: 3b 45 f4 cmp -0xc(%ebp),%eax 7aa: 72 4d jb 7f9 <malloc+0xa6> if(p->s.size == nunits) 7ac: 8b 45 ec mov -0x14(%ebp),%eax 7af: 8b 40 04 mov 0x4(%eax),%eax 7b2: 3b 45 f4 cmp -0xc(%ebp),%eax 7b5: 75 0c jne 7c3 <malloc+0x70> prevp->s.ptr = p->s.ptr; 7b7: 8b 45 ec mov -0x14(%ebp),%eax 7ba: 8b 10 mov (%eax),%edx 7bc: 8b 45 f0 mov -0x10(%ebp),%eax 7bf: 89 10 mov %edx,(%eax) 7c1: eb 26 jmp 7e9 <malloc+0x96> else { p->s.size -= nunits; 7c3: 8b 45 ec mov -0x14(%ebp),%eax 7c6: 8b 40 04 mov 0x4(%eax),%eax 7c9: 89 c2 mov %eax,%edx 7cb: 2b 55 f4 sub -0xc(%ebp),%edx 7ce: 8b 45 ec mov -0x14(%ebp),%eax 7d1: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7d4: 8b 45 ec mov -0x14(%ebp),%eax 7d7: 8b 40 04 mov 0x4(%eax),%eax 7da: c1 e0 03 shl $0x3,%eax 7dd: 01 45 ec add %eax,-0x14(%ebp) p->s.size = nunits; 7e0: 8b 45 ec mov -0x14(%ebp),%eax 7e3: 8b 55 f4 mov -0xc(%ebp),%edx 7e6: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 7e9: 8b 45 f0 mov -0x10(%ebp),%eax 7ec: a3 e0 0b 00 00 mov %eax,0xbe0 return (void*)(p + 1); 7f1: 8b 45 ec mov -0x14(%ebp),%eax 7f4: 83 c0 08 add $0x8,%eax 7f7: eb 38 jmp 831 <malloc+0xde> } if(p == freep) 7f9: a1 e0 0b 00 00 mov 0xbe0,%eax 7fe: 39 45 ec cmp %eax,-0x14(%ebp) 801: 75 1b jne 81e <malloc+0xcb> if((p = morecore(nunits)) == 0) 803: 8b 45 f4 mov -0xc(%ebp),%eax 806: 89 04 24 mov %eax,(%esp) 809: e8 ed fe ff ff call 6fb <morecore> 80e: 89 45 ec mov %eax,-0x14(%ebp) 811: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 815: 75 07 jne 81e <malloc+0xcb> return 0; 817: b8 00 00 00 00 mov $0x0,%eax 81c: eb 13 jmp 831 <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 81e: 8b 45 ec mov -0x14(%ebp),%eax 821: 89 45 f0 mov %eax,-0x10(%ebp) 824: 8b 45 ec mov -0x14(%ebp),%eax 827: 8b 00 mov (%eax),%eax 829: 89 45 ec mov %eax,-0x14(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 82c: e9 70 ff ff ff jmp 7a1 <malloc+0x4e> } 831: c9 leave 832: c3 ret 833: 90 nop 00000834 <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 834: 55 push %ebp 835: 89 e5 mov %esp,%ebp 837: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 83a: 8b 55 08 mov 0x8(%ebp),%edx 83d: 8b 45 0c mov 0xc(%ebp),%eax 840: 8b 4d 08 mov 0x8(%ebp),%ecx 843: f0 87 02 lock xchg %eax,(%edx) 846: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 849: 8b 45 fc mov -0x4(%ebp),%eax } 84c: c9 leave 84d: c3 ret 0000084e <lock_init>: #include "x86.h" #include "proc.h" void lock_init(lock_t *lock){ 84e: 55 push %ebp 84f: 89 e5 mov %esp,%ebp lock->locked = 0; 851: 8b 45 08 mov 0x8(%ebp),%eax 854: c7 00 00 00 00 00 movl $0x0,(%eax) } 85a: 5d pop %ebp 85b: c3 ret 0000085c <lock_acquire>: void lock_acquire(lock_t *lock){ 85c: 55 push %ebp 85d: 89 e5 mov %esp,%ebp 85f: 83 ec 08 sub $0x8,%esp while(xchg(&lock->locked,1) != 0); 862: 8b 45 08 mov 0x8(%ebp),%eax 865: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 86c: 00 86d: 89 04 24 mov %eax,(%esp) 870: e8 bf ff ff ff call 834 <xchg> 875: 85 c0 test %eax,%eax 877: 75 e9 jne 862 <lock_acquire+0x6> } 879: c9 leave 87a: c3 ret 0000087b <lock_release>: void lock_release(lock_t *lock){ 87b: 55 push %ebp 87c: 89 e5 mov %esp,%ebp 87e: 83 ec 08 sub $0x8,%esp xchg(&lock->locked,0); 881: 8b 45 08 mov 0x8(%ebp),%eax 884: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 88b: 00 88c: 89 04 24 mov %eax,(%esp) 88f: e8 a0 ff ff ff call 834 <xchg> } 894: c9 leave 895: c3 ret 00000896 <thread_create>: void *thread_create(void(*start_routine)(void*), void *arg){ 896: 55 push %ebp 897: 89 e5 mov %esp,%ebp 899: 83 ec 28 sub $0x28,%esp int tid; void * stack = malloc(2 * 4096); 89c: c7 04 24 00 20 00 00 movl $0x2000,(%esp) 8a3: e8 ab fe ff ff call 753 <malloc> 8a8: 89 45 f0 mov %eax,-0x10(%ebp) void *garbage_stack = stack; 8ab: 8b 45 f0 mov -0x10(%ebp),%eax 8ae: 89 45 f4 mov %eax,-0xc(%ebp) // printf(1,"start routine addr : %d\n",(uint)start_routine); if((uint)stack % 4096){ 8b1: 8b 45 f0 mov -0x10(%ebp),%eax 8b4: 25 ff 0f 00 00 and $0xfff,%eax 8b9: 85 c0 test %eax,%eax 8bb: 74 15 je 8d2 <thread_create+0x3c> stack = stack + (4096 - (uint)stack % 4096); 8bd: 8b 45 f0 mov -0x10(%ebp),%eax 8c0: 89 c2 mov %eax,%edx 8c2: 81 e2 ff 0f 00 00 and $0xfff,%edx 8c8: b8 00 10 00 00 mov $0x1000,%eax 8cd: 29 d0 sub %edx,%eax 8cf: 01 45 f0 add %eax,-0x10(%ebp) } if (stack == 0){ 8d2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8d6: 75 1b jne 8f3 <thread_create+0x5d> printf(1,"malloc fail \n"); 8d8: c7 44 24 04 7e 0b 00 movl $0xb7e,0x4(%esp) 8df: 00 8e0: c7 04 24 01 00 00 00 movl $0x1,(%esp) 8e7: e8 81 fb ff ff call 46d <printf> return 0; 8ec: b8 00 00 00 00 mov $0x0,%eax 8f1: eb 6f jmp 962 <thread_create+0xcc> } tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg); 8f3: 8b 4d 0c mov 0xc(%ebp),%ecx 8f6: 8b 55 08 mov 0x8(%ebp),%edx 8f9: 8b 45 f0 mov -0x10(%ebp),%eax 8fc: 89 4c 24 0c mov %ecx,0xc(%esp) 900: 89 54 24 08 mov %edx,0x8(%esp) 904: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) 90b: 00 90c: 89 04 24 mov %eax,(%esp) 90f: e8 58 fa ff ff call 36c <clone> 914: 89 45 ec mov %eax,-0x14(%ebp) if(tid < 0){ 917: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 91b: 79 1b jns 938 <thread_create+0xa2> printf(1,"clone fails\n"); 91d: c7 44 24 04 8c 0b 00 movl $0xb8c,0x4(%esp) 924: 00 925: c7 04 24 01 00 00 00 movl $0x1,(%esp) 92c: e8 3c fb ff ff call 46d <printf> return 0; 931: b8 00 00 00 00 mov $0x0,%eax 936: eb 2a jmp 962 <thread_create+0xcc> } if(tid > 0){ 938: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 93c: 7e 05 jle 943 <thread_create+0xad> //store threads on thread table return garbage_stack; 93e: 8b 45 f4 mov -0xc(%ebp),%eax 941: eb 1f jmp 962 <thread_create+0xcc> } if(tid == 0){ 943: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 947: 75 14 jne 95d <thread_create+0xc7> printf(1,"tid = 0 return \n"); 949: c7 44 24 04 99 0b 00 movl $0xb99,0x4(%esp) 950: 00 951: c7 04 24 01 00 00 00 movl $0x1,(%esp) 958: e8 10 fb ff ff call 46d <printf> } // wait(); // free(garbage_stack); return 0; 95d: b8 00 00 00 00 mov $0x0,%eax } 962: c9 leave 963: c3 ret 00000964 <init_q>: #include "queue.h" #include "types.h" #include "user.h" void init_q(struct queue *q){ 964: 55 push %ebp 965: 89 e5 mov %esp,%ebp q->size = 0; 967: 8b 45 08 mov 0x8(%ebp),%eax 96a: c7 00 00 00 00 00 movl $0x0,(%eax) q->head = 0; 970: 8b 45 08 mov 0x8(%ebp),%eax 973: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 97a: 8b 45 08 mov 0x8(%ebp),%eax 97d: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 984: 5d pop %ebp 985: c3 ret 00000986 <add_q>: void add_q(struct queue *q, int v){ 986: 55 push %ebp 987: 89 e5 mov %esp,%ebp 989: 83 ec 28 sub $0x28,%esp //printf(1, "here \n"); struct node * n = malloc(sizeof(struct node)); 98c: c7 04 24 08 00 00 00 movl $0x8,(%esp) 993: e8 bb fd ff ff call 753 <malloc> 998: 89 45 f4 mov %eax,-0xc(%ebp) n->next = 0; 99b: 8b 45 f4 mov -0xc(%ebp),%eax 99e: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) n->value = v; 9a5: 8b 45 f4 mov -0xc(%ebp),%eax 9a8: 8b 55 0c mov 0xc(%ebp),%edx 9ab: 89 10 mov %edx,(%eax) if(q->head == 0){ 9ad: 8b 45 08 mov 0x8(%ebp),%eax 9b0: 8b 40 04 mov 0x4(%eax),%eax 9b3: 85 c0 test %eax,%eax 9b5: 75 0b jne 9c2 <add_q+0x3c> q->head = n; 9b7: 8b 45 08 mov 0x8(%ebp),%eax 9ba: 8b 55 f4 mov -0xc(%ebp),%edx 9bd: 89 50 04 mov %edx,0x4(%eax) 9c0: eb 0c jmp 9ce <add_q+0x48> }else{ q->tail->next = n; 9c2: 8b 45 08 mov 0x8(%ebp),%eax 9c5: 8b 40 08 mov 0x8(%eax),%eax 9c8: 8b 55 f4 mov -0xc(%ebp),%edx 9cb: 89 50 04 mov %edx,0x4(%eax) } q->tail = n; 9ce: 8b 45 08 mov 0x8(%ebp),%eax 9d1: 8b 55 f4 mov -0xc(%ebp),%edx 9d4: 89 50 08 mov %edx,0x8(%eax) q->size++; 9d7: 8b 45 08 mov 0x8(%ebp),%eax 9da: 8b 00 mov (%eax),%eax 9dc: 8d 50 01 lea 0x1(%eax),%edx 9df: 8b 45 08 mov 0x8(%ebp),%eax 9e2: 89 10 mov %edx,(%eax) } 9e4: c9 leave 9e5: c3 ret 000009e6 <empty_q>: int empty_q(struct queue *q){ 9e6: 55 push %ebp 9e7: 89 e5 mov %esp,%ebp if(q->size == 0) 9e9: 8b 45 08 mov 0x8(%ebp),%eax 9ec: 8b 00 mov (%eax),%eax 9ee: 85 c0 test %eax,%eax 9f0: 75 07 jne 9f9 <empty_q+0x13> return 1; 9f2: b8 01 00 00 00 mov $0x1,%eax 9f7: eb 05 jmp 9fe <empty_q+0x18> else return 0; 9f9: b8 00 00 00 00 mov $0x0,%eax } 9fe: 5d pop %ebp 9ff: c3 ret 00000a00 <pop_q>: int pop_q(struct queue *q){ a00: 55 push %ebp a01: 89 e5 mov %esp,%ebp a03: 83 ec 28 sub $0x28,%esp int val; struct node *destroy; if(!empty_q(q)){ a06: 8b 45 08 mov 0x8(%ebp),%eax a09: 89 04 24 mov %eax,(%esp) a0c: e8 d5 ff ff ff call 9e6 <empty_q> a11: 85 c0 test %eax,%eax a13: 75 5d jne a72 <pop_q+0x72> val = q->head->value; a15: 8b 45 08 mov 0x8(%ebp),%eax a18: 8b 40 04 mov 0x4(%eax),%eax a1b: 8b 00 mov (%eax),%eax a1d: 89 45 f0 mov %eax,-0x10(%ebp) destroy = q->head; a20: 8b 45 08 mov 0x8(%ebp),%eax a23: 8b 40 04 mov 0x4(%eax),%eax a26: 89 45 f4 mov %eax,-0xc(%ebp) q->head = q->head->next; a29: 8b 45 08 mov 0x8(%ebp),%eax a2c: 8b 40 04 mov 0x4(%eax),%eax a2f: 8b 50 04 mov 0x4(%eax),%edx a32: 8b 45 08 mov 0x8(%ebp),%eax a35: 89 50 04 mov %edx,0x4(%eax) free(destroy); a38: 8b 45 f4 mov -0xc(%ebp),%eax a3b: 89 04 24 mov %eax,(%esp) a3e: e8 e1 fb ff ff call 624 <free> q->size--; a43: 8b 45 08 mov 0x8(%ebp),%eax a46: 8b 00 mov (%eax),%eax a48: 8d 50 ff lea -0x1(%eax),%edx a4b: 8b 45 08 mov 0x8(%ebp),%eax a4e: 89 10 mov %edx,(%eax) if(q->size == 0){ a50: 8b 45 08 mov 0x8(%ebp),%eax a53: 8b 00 mov (%eax),%eax a55: 85 c0 test %eax,%eax a57: 75 14 jne a6d <pop_q+0x6d> q->head = 0; a59: 8b 45 08 mov 0x8(%ebp),%eax a5c: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; a63: 8b 45 08 mov 0x8(%ebp),%eax a66: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } return val; a6d: 8b 45 f0 mov -0x10(%ebp),%eax a70: eb 05 jmp a77 <pop_q+0x77> } return -1; a72: b8 ff ff ff ff mov $0xffffffff,%eax } a77: c9 leave a78: c3 ret a79: 90 nop a7a: 90 nop a7b: 90 nop 00000a7c <init_semaphore>: #include "semaphore.h" #include "user.h" //lab 2 //Semaphore void init_semaphore(struct Semaphore *s, int count_num) { a7c: 55 push %ebp a7d: 89 e5 mov %esp,%ebp a7f: 83 ec 18 sub $0x18,%esp s->count = count_num; a82: 8b 45 08 mov 0x8(%ebp),%eax a85: 8b 55 0c mov 0xc(%ebp),%edx a88: 89 10 mov %edx,(%eax) init_q(&s->threads); a8a: 8b 45 08 mov 0x8(%ebp),%eax a8d: 83 c0 04 add $0x4,%eax a90: 89 04 24 mov %eax,(%esp) a93: e8 cc fe ff ff call 964 <init_q> lock_init(&s->lock); a98: 8b 45 08 mov 0x8(%ebp),%eax a9b: 83 c0 10 add $0x10,%eax a9e: 89 04 24 mov %eax,(%esp) aa1: e8 a8 fd ff ff call 84e <lock_init> } aa6: c9 leave aa7: c3 ret 00000aa8 <sem_acquire>: void sem_acquire(struct Semaphore *s) { aa8: 55 push %ebp aa9: 89 e5 mov %esp,%ebp aab: 83 ec 18 sub $0x18,%esp while(1) { if (s->count > 0) { //if there are available resources aae: 8b 45 08 mov 0x8(%ebp),%eax ab1: 8b 00 mov (%eax),%eax ab3: 85 c0 test %eax,%eax ab5: 7e 2c jle ae3 <sem_acquire+0x3b> //printf(1, "COUNT IS = %d\n", s->count); //printf(1, "acquiring lock\n"); lock_acquire(&s->lock); //acquire count lock ab7: 8b 45 08 mov 0x8(%ebp),%eax aba: 83 c0 10 add $0x10,%eax abd: 89 04 24 mov %eax,(%esp) ac0: e8 97 fd ff ff call 85c <lock_acquire> //printf(1, "acquired lock\n"); s->count = s->count - 1; //decrement resource by one ac5: 8b 45 08 mov 0x8(%ebp),%eax ac8: 8b 00 mov (%eax),%eax aca: 8d 50 ff lea -0x1(%eax),%edx acd: 8b 45 08 mov 0x8(%ebp),%eax ad0: 89 10 mov %edx,(%eax) //printf(1, "DECREMENT! COUNT IS = %d\n", s->count); lock_release(&s->lock); //release count lock ad2: 8b 45 08 mov 0x8(%ebp),%eax ad5: 83 c0 10 add $0x10,%eax ad8: 89 04 24 mov %eax,(%esp) adb: e8 9b fd ff ff call 87b <lock_release> break; ae0: 90 nop add_q(&s->threads, getpid()); //add thread to sleep queueu //printf(1, "asleep \n"); tsleep(); } } } ae1: c9 leave ae2: c3 ret //printf(1, "DECREMENT! COUNT IS = %d\n", s->count); lock_release(&s->lock); //release count lock break; } else { //if there are no available resources printf(1, "Waiting for semaphore\n"); ae3: c7 44 24 04 aa 0b 00 movl $0xbaa,0x4(%esp) aea: 00 aeb: c7 04 24 01 00 00 00 movl $0x1,(%esp) af2: e8 76 f9 ff ff call 46d <printf> //printf(1, "%d", getpid()); add_q(&s->threads, getpid()); //add thread to sleep queueu af7: e8 50 f8 ff ff call 34c <getpid> afc: 8b 55 08 mov 0x8(%ebp),%edx aff: 83 c2 04 add $0x4,%edx b02: 89 44 24 04 mov %eax,0x4(%esp) b06: 89 14 24 mov %edx,(%esp) b09: e8 78 fe ff ff call 986 <add_q> //printf(1, "asleep \n"); tsleep(); b0e: e8 69 f8 ff ff call 37c <tsleep> } } b13: eb 99 jmp aae <sem_acquire+0x6> 00000b15 <sem_signal>: } void sem_signal(struct Semaphore *s) { b15: 55 push %ebp b16: 89 e5 mov %esp,%ebp b18: 83 ec 18 sub $0x18,%esp lock_acquire(&s->lock); b1b: 8b 45 08 mov 0x8(%ebp),%eax b1e: 83 c0 10 add $0x10,%eax b21: 89 04 24 mov %eax,(%esp) b24: e8 33 fd ff ff call 85c <lock_acquire> s->count++; b29: 8b 45 08 mov 0x8(%ebp),%eax b2c: 8b 00 mov (%eax),%eax b2e: 8d 50 01 lea 0x1(%eax),%edx b31: 8b 45 08 mov 0x8(%ebp),%eax b34: 89 10 mov %edx,(%eax) lock_release(&s->lock); b36: 8b 45 08 mov 0x8(%ebp),%eax b39: 83 c0 10 add $0x10,%eax b3c: 89 04 24 mov %eax,(%esp) b3f: e8 37 fd ff ff call 87b <lock_release> if (!empty_q(&s->threads)) { b44: 8b 45 08 mov 0x8(%ebp),%eax b47: 83 c0 04 add $0x4,%eax b4a: 89 04 24 mov %eax,(%esp) b4d: e8 94 fe ff ff call 9e6 <empty_q> b52: 85 c0 test %eax,%eax b54: 75 16 jne b6c <sem_signal+0x57> twakeup(pop_q(&s->threads)); //remove thread from queue and wake up b56: 8b 45 08 mov 0x8(%ebp),%eax b59: 83 c0 04 add $0x4,%eax b5c: 89 04 24 mov %eax,(%esp) b5f: e8 9c fe ff ff call a00 <pop_q> b64: 89 04 24 mov %eax,(%esp) b67: e8 18 f8 ff ff call 384 <twakeup> } } b6c: c9 leave b6d: c3 ret
libsrc/stdio/nc100/fputc_cons.asm
meesokim/z88dk
0
91944
<reponame>meesokim/z88dk<filename>libsrc/stdio/nc100/fputc_cons.asm ; ; Put character to console ; ; fputc_cons(char c) ; ; ; $Id: fputc_cons.asm,v 1.4 2015/01/19 01:33:20 pauloscustodio Exp $ ; PUBLIC fputc_cons .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 13 jr nz,fputc_cons1 call $B833 ;txtoutput ld a,10 .fputc_cons1 jp $B833 ;txtoutput
src/xpf_core/windows/vt_hv.asm
fengjixuchui/NoirVisor
1
93760
<filename>src/xpf_core/windows/vt_hv.asm ; NoirVisor - Hardware-Accelerated Hypervisor solution ; ; Copyright 2018-2021, <NAME>. All rights reserved. ; ; This file is part of NoirVisor VT Core written in assembly language. ; ; This program is distributed in the hope that it will be successful, but ; without any warranty (no matter implied warranty of merchantability or ; fitness for a particular purpose, etc.). ; ; File location: ./xpf_core/windows/vt_hv.asm ifdef _ia32 .686p .model flat,stdcall endif .code include noirhv.inc extern nvc_vt_subvert_processor_i:proc extern nvc_vt_exit_handler:proc ifdef _amd64 ;Implement VMX instructions noir_vt_invept proc invept rcx,xmmword ptr [rdx] setc al setz cl adc al,cl ret noir_vt_invept endp noir_vt_invvpid proc invvpid rcx,xmmword ptr [rdx] setc al setz cl adc al,cl ret noir_vt_invvpid endp noir_vt_vmcall proc vmcall setc al setz cl adc al,cl ret noir_vt_vmcall endp nvc_vt_resume_without_entry proc mov rsp,rcx popaq ; In the restored GPR layout, we have: ; rax=rip ; rcx=rflags ; rdx=rsp mov rsp,rdx ; Restore stack pointer push rcx popfq ; Restore flags register jmp rax ; Restore instruction pointer nvc_vt_resume_without_entry endp nvc_vt_exit_handler_a proc ; pushax pushaq ; Load the Guest GPR State to the first parameter. mov rcx,rsp ; Load vcpu to second parameter. mov rdx,qword ptr [rsp+80h] sub rsp,20h call nvc_vt_exit_handler add rsp,20h popaq ; popax vmresume nvc_vt_exit_handler_a endp nvc_vt_subvert_processor_a proc pushfq xor rax,rax ; Make sure it would return zero if vmlaunch succeeds. pushaq mov r8,rsp mov r9,vt_launched sub rsp,20h call nvc_vt_subvert_processor_i ;At this moment, VM-Entry resulted failure. add rsp,20h mov qword ptr [rsp],rax vt_launched: ; There are four conditions why we are here: ; 1. al=0. VM-Entry is successful (Expected condition) ; 2. al=1. VM-Entry failed by valid vm-fail ; 3. al=2. VM-Entry failed by invalid vm-fail (Not possible, though) ; 4. al=3. VM-Entry failed due to invalid guest state popaq popfq ; Things will be handled in code written in C. ret nvc_vt_subvert_processor_a endp else noir_vt_invept proc inv_type:dword,descriptor:dword mov ecx,dword ptr [inv_type] mov edx,dword ptr [descriptor] invept xmmword ptr [edx],ecx setc al setz cl adc al,cl ret noir_vt_invept endp noir_vt_invvpid proc inv_type:dword,descriptor:dword mov ecx,dword ptr [inv_type] mov edx,dword ptr [descriptor] invvpid xmmword ptr [edx],ecx setc al setz cl adc al,cl ret noir_vt_invvpid endp noir_vt_vmcall proc index:dword,context:dword mov ecx,dword ptr [index] mov edx,dword ptr [context] vmcall setc al setz cl adc al,cl ret noir_vt_vmcall endp noir_vt_vmxon proc vmxon_region:dword vmxon qword ptr[vmxon_region] setc al setz cl adc al,cl ret noir_vt_vmxon endp noir_vt_vmptrld proc vmcs_pa:dword vmptrld qword ptr[vmcs_pa] setc al setz cl adc al,cl ret noir_vt_vmptrld endp noir_vt_vmclear proc vmcs_pa:dword vmclear qword ptr[vmcs_pa] setc al setz cl adc al,cl ret noir_vt_vmclear endp noir_vt_vmread proc field:dword,value:dword mov ecx,dword ptr[field] vmread dword ptr[value],ecx setc al setz cl adc al,cl ret noir_vt_vmread endp noir_vt_vmwrite proc field:dword,value:dword mov ecx,dword ptr[field] vmwrite ecx,dword ptr[value] setc al setz cl adc al,cl ret noir_vt_vmwrite endp noir_vt_vmread64 proc field:dword,value:dword mov ecx,dword ptr[field] vmread dword ptr[value],ecx inc ecx vmread dword ptr[value+4],edx setc al setz cl adc al,cl ret noir_vt_vmread64 endp noir_vt_vmwrite64 proc field:dword,val_lo:dword,val_hi:dword mov ecx,dword ptr[field] vmwrite ecx,dword ptr[val_lo] inc ecx vmwrite ecx,dword ptr[val_hi] setc al setz cl adc al,cl ret noir_vt_vmwrite64 endp noir_vt_vmlaunch proc vmlaunch setc al setz cl adc al,cl ret noir_vt_vmlaunch endp noir_vt_vmresume proc vmresume setc al setz cl adc al,cl ret noir_vt_vmresume endp endif end
programs/oeis/313/A313692.asm
jmorken/loda
1
89368
; A313692: Coordination sequence Gal.5.136.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,5,10,15,19,24,29,33,38,43,48,53,58,63,67,72,77,81,86,91,96,101,106,111,115,120,125,129,134,139,144,149,154,159,163,168,173,177,182,187,192,197,202,207,211,216,221,225,230,235 mov $3,$0 mov $4,1 lpb $0 mov $2,$0 mul $0,8 sub $4,$5 mul $4,2 sub $0,$4 mod $2,10 trn $2,2 sub $0,$2 add $5,$0 div $0,10 lpe mov $1,$0 add $1,1 mov $6,$3 mul $6,4 add $1,$6
test/src/yaml-parser-event_test.ads
robdaemon/AdaYaml
32
17538
<reponame>robdaemon/AdaYaml -- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with AUnit; use AUnit; with AUnit.Test_Cases; use AUnit.Test_Cases; with Ada.Containers.Indefinite_Vectors; package Yaml.Parser.Event_Test is subtype Test_Case_Name is String (1 .. 4); package Test_Case_Vectors is new Ada.Containers.Indefinite_Vectors (Positive, Test_Case_Name); type TC is new Test_Cases.Test_Case with record Test_Cases : Test_Case_Vectors.Vector; Cur : Positive; end record; overriding procedure Register_Tests (T : in out TC); function Name (T : TC) return Message_String; procedure Execute_Next_Test (T : in out Test_Cases.Test_Case'Class); procedure Execute_Error_Test (T : in out Test_Cases.Test_Case'Class); end Yaml.Parser.Event_Test;
test/bags.agda
jonaprieto/agda-prop
13
7350
<reponame>jonaprieto/agda-prop<filename>test/bags.agda module bags where open import Data.PropFormula.Syntax 4 open import Data.PropFormula.SyntaxExperiment 4 public open import Data.Fin using (suc; zero; #_) open import Relation.Binary.PropositionalEquality using (_≡_) p : PropFormula p = Var (# 0) q : PropFormula q = Var (# 1) pq : PropFormula pq = p ∧ q qp : PropFormula qp = q ∧ p listpq : List PropFormula listpq = toList pq listqp : List PropFormula listqp = toList qp
oeis/176/A176401.asm
neoneye/loda-programs
11
93999
<gh_stars>10-100 ; A176401: Decimal expansion of (6+sqrt(39))/2. ; Submitted by <NAME> ; 6,1,2,2,4,9,8,9,9,9,1,9,9,1,9,9,1,0,2,9,2,3,4,4,6,5,6,0,4,6,9,8,9,7,2,3,0,5,3,6,4,7,9,9,8,8,9,9,5,8,2,8,1,5,4,2,2,6,4,8,5,9,6,5,3,0,4,8,0,5,6,0,0,2,9,1,7,5,7,2,5,0,3,1,6,6,6,8,0,5,6,1,1,0,6,7,0,2,9,3 mov $2,1 mov $3,$0 mul $3,4 mov $5,2 lpb $3 add $1,$2 add $5,$2 add $1,$5 mul $1,12 add $2,$1 mov $1,1 sub $3,2 lpe add $1,$5 mul $1,3 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
src/firmware-tests/Platform/Smps/EnableDisable/EnableDisableSmpsRmwTestFixture.asm
pete-restall/Cluck2Sesame-Prototype
1
164711
<reponame>pete-restall/Cluck2Sesame-Prototype #include "Platform.inc" #include "FarCalls.inc" #include "Smps.inc" #include "TestFixture.inc" radix decimal extern doEnableCall extern doDisableCall udata global numberOfEnableCalls global numberOfDisableCalls global expectedPortValue global portValue numberOfEnableCalls res 1 numberOfDisableCalls res 1 expectedPortValue res 1 portValue res 1 EnableDisableSmpsRmwTestFixture code global testArrange testArrange: fcall initialiseSmps call triggerReadModifyWriteOnPortc fcall doDisableCall call triggerReadModifyWriteOnPortc testAct: banksel numberOfEnableCalls movf numberOfEnableCalls btfsc STATUS, Z goto callDisableSmps callEnableSmps: fcall doEnableCall banksel numberOfEnableCalls decfsz numberOfEnableCalls goto testAct call triggerReadModifyWriteOnPortc callDisableSmps: banksel numberOfDisableCalls movf numberOfDisableCalls btfsc STATUS, Z goto afterEnableAndDisableCalls callDisableSmpsInLoop: fcall doDisableCall banksel numberOfDisableCalls decfsz numberOfDisableCalls goto callDisableSmpsInLoop afterEnableAndDisableCalls: call triggerReadModifyWriteOnPortc testAssert: banksel ANSELH bcf ANSELH, ANS9 banksel PORTC movlw 0 btfsc PORTC, RC7 movlw 1 banksel portValue movwf portValue .assert "portValue == expectedPortValue, 'PORTC expectation failure.'" return triggerReadModifyWriteOnPortc: banksel PORTC movf PORTC return end
third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm
Fimbure/icebox-1
521
100671
<filename>third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm<gh_stars>100-1000 ; $Id: bs3-cmn-PrintU32.asm $ ;; @file ; BS3Kit - Bs3PrintU32, Common. ; ; ; Copyright (C) 2007-2017 Oracle Corporation ; ; This file is part of VirtualBox Open Source Edition (OSE), as ; available from http://www.virtualbox.org. This file is free software; ; you can redistribute it and/or modify it under the terms of the GNU ; General Public License (GPL) as published by the Free Software ; Foundation, in version 2 as it comes in the "COPYING" file of the ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ; ; The contents of this file may alternatively be used under the terms ; of the Common Development and Distribution License Version 1.0 ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the ; VirtualBox OSE distribution, in which case the provisions of the ; CDDL are applicable instead of those of the GPL. ; ; You may elect to license modified versions of this file under the ; terms and conditions of either the GPL or the CDDL or both. ; %include "bs3kit-template-header.mac" BS3_EXTERN_CMN Bs3PrintStr ;; ; Prints a 32-bit unsigned integer value. ; ; @param [xBP + xCB*2] 32-bit value to format and print. ; BS3_PROC_BEGIN_CMN Bs3PrintU32, BS3_PBC_HYBRID BS3_CALL_CONV_PROLOG 1 push xBP mov xBP, xSP push sAX push sDX push sCX push sBX BONLY16 push ds mov eax, [xBP + xCB + cbCurRetAddr] ; Allocate a stack buffer and terminate it. ds:bx points ot the end. sub xSP, 30h BONLY16 mov bx, ss BONLY16 mov ds, bx mov xBX, xSP add xBX, 2fh mov byte [xBX], 0 mov ecx, 10 ; what to divide by .next: xor edx, edx div ecx ; edx:eax / ecx -> eax and rest in edx. add dl, '0' dec xBX mov [BS3_ONLY_16BIT(ss:)xBX], dl cmp eax, 0 jnz .next ; Print the string. BONLY64 add rsp, 18h BONLY16 push ss push xBX BS3_CALL Bs3PrintStr, 1 add xSP, 30h + BS3_IF_16_32_64BIT(2, 0, 18h) + xCB BONLY16 pop ds pop sBX pop sCX pop sDX pop sAX leave BS3_CALL_CONV_EPILOG 1 BS3_HYBRID_RET BS3_PROC_END_CMN Bs3PrintU32