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
alloy4fun_models/trashltl/models/9/qdt9m7a49jDm9LjKd.als
Kaixi26/org.alloytools.alloy
0
479
<reponame>Kaixi26/org.alloytools.alloy open main pred idqdt9m7a49jDm9LjKd_prop10 { all f : (File & Protected) | always (f in Protected) } pred __repair { idqdt9m7a49jDm9LjKd_prop10 } check __repair { idqdt9m7a49jDm9LjKd_prop10 <=> prop10o }
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/extended_sna_load.asm
Toysoft/z88dk
0
11173
<reponame>Toysoft/z88dk ; unsigned char extended_sna_load(unsigned char handle) SECTION code_esxdos PUBLIC extended_sna_load EXTERN asm_extended_sna_load defc extended_sna_load = asm_extended_sna_load
Source/L8WAIT.asm
walmartlabs/zFAM
21
3522
<reponame>walmartlabs/zFAM<filename>Source/L8WAIT.asm * * PROGRAM: L8WAIT * AUTHOR: <NAME>. * COMMENTS: zFAM - z/OS File Access Manager. * * Issue z/OS STIMERM macro. * This program must be defined as Threadsafe (Required), * OpenAPI and CICSKey to execeute on an L8 TCB. * * Default wait is 2.5 milliseconds * *********************************************************************** * Dynamic Storage Area (start) * *********************************************************************** DFHEISTG DSECT STIMERID DS CL04 STIMERM ID MS_WAIT DS F Fullword 01ms to 900ms WAIT * *********************************************************************** * Dynamic Storage Area (end ) * *********************************************************************** * *********************************************************************** * DFHCOMMAREA from requesting program (start) * *********************************************************************** CACBAR EQU 12 DFHCA DSECT CA_RC DS CL04 RETURN CODE CA_WAIT DS F Fullword from 1 (10ms) to 90 (900ms) CA_LEN EQU *-DFHCA *********************************************************************** * DFHCOMMAREA from requesting program (end ) * *********************************************************************** * *********************************************************************** * Control Section * *********************************************************************** L8WAIT DFHEIENT CODEREG=(2),DATAREG=10,EIBREG=11 L8WAIT AMODE 31 L8WAIT RMODE ANY B SYSDATE BRANCH AROUND LITERALS DC CL08'L8WAIT ' DC CL48' -- z/OS STIMERM running on an L8 TCB ' DC CL08' ' DC CL08'&SYSDATE' DC CL08' ' DC CL08'&SYSTIME' SYSDATE DS 0H *********************************************************************** * ENTER TRACENUM before STIMERM * *********************************************************************** SY_0010 DS 0H EXEC CICS ENTER TRACENUM(T_35) X FROM(T_35_M) X FROMLENGTH(T_LEN) X RESOURCE(T_RES) X NOHANDLE *********************************************************************** * Address DFHCOMMAREA. If not present, use 2.5 millisecond default. * *********************************************************************** SY_0020 DS 0H LA R1,CA_LEN Load DSECT length LH R15,EIBCALEN Load DFHCOMMAREA length CR R1,R15 Valid length? BC B'0111',SY_0800 ... no, use 2.5ms default L R12,DFHEICAP Load DFHCOMMAREA USING DFHCA,R12 ... tell assembler *********************************************************************** * The valid range accepted is 1, which equates to 10 milliseconds * * thru 90, which equates to 900 milliseconds. Any value less than 1 * * will be set to 1 and any value greater than 90 will be set to 90. * *********************************************************************** SY_0030 DS 0H MVC CA_RC,RC_0001 Set RC for default MVC MS_WAIT,=F'1' Set default 10 milliseconds CLC CA_WAIT,=F'0' Zero or less? BC B'1100',SY_0100 ... yes, use 10ms default MVC CA_RC,RC_0090 Set RC for default MVC MS_WAIT,=F'90' Set maximum 900 milliseconds CLC CA_WAIT,=F'90' Greater than 900 milliseconds? BC B'0011',SY_0100 ... yes, use 900ms default MVC MS_WAIT,CA_WAIT Use requested interval MVC CA_RC,RC_0000 Set RC for requested wait *********************************************************************** * Issue z/OS STIMERM. * * Using fullword binary value of 1 (10ms) thru 90 (900ms) * *********************************************************************** SY_0100 DS 0H LA R3,STIMERID Load STIMER ID LA R4,MS_WAIT Load wait time STIMERM SET,BINTVL=(R4),WAIT=YES,ID=(R3) BC B'1111',SY_0900 Exit trace *********************************************************************** * Issue z/OS STIMERM. * * 2.5 milliseconds (2500 microseconds) * *********************************************************************** SY_0800 DS 0H LA R3,STIMERID Load STIMER ID STIMERM SET,MICVL=MIC2500,WAIT=YES,ID=(R3) *********************************************************************** * ENTER TRACE after STIMERM * *********************************************************************** SY_0900 DS 0H * EXEC CICS ENTER TRACENUM(T_46) X FROM(T_46_M) X FROMLENGTH(T_LEN) X RESOURCE(T_RES) X NOHANDLE *********************************************************************** * Return to calling program * *********************************************************************** RETURN DS 0H EXEC CICS RETURN *********************************************************************** * Literal Pool * *********************************************************************** LTORG * RC_0001 DC CL04'0010' Default RC for 10MS RC_0090 DC CL04'0900' Default RC for 900MS RC_0000 DC CL04'0000' Default RC for requested wait * T_35 DC H'35' TRACE number before STIMERM T_46 DC H'46' TRACE number after STIMERM T_35_M DC CL08'GoodNite' TRACE message before STIMERM T_46_M DC CL08'Wake-Up!' TRACE message after STIMERM T_RES DC CL08'L8WAIT ' TRACE resource T_LEN DC H'08' TRACE message length DS 0D MIC0256 DC F'0' 1st word DC F'01048576' 0.2 milliseconds DS 0D MIC1024 DC F'0' 1st word DC F'04194304' 1.0 milliseconds DS 0D MIC2500 DC F'0' 1st word DC F'10240000' 2.5 milliseconds DS 0F R0 EQU 0 R1 EQU 1 R2 EQU 2 R3 EQU 3 R4 EQU 4 R5 EQU 5 R6 EQU 6 R7 EQU 7 R8 EQU 8 R9 EQU 9 R10 EQU 10 R11 EQU 11 R12 EQU 12 R13 EQU 13 R14 EQU 14 R15 EQU 15 * *********************************************************************** * End of Program * *********************************************************************** END L8WAIT
assembler/tests/t_kcpsm3/t_kcpsm3.asm
paulscottrobson/RCA-Cosmac-VIP-III
1
80356
<filename>assembler/tests/t_kcpsm3/t_kcpsm3.asm cpu kcpsm3 CONSTANT const1, 02 NAMEREG s8, treg load treg, const1 nop load s0, 1 jump test1 jump Z, test1 jump NZ, test1 jump C, test1 jump NC, test1 test1: call test2 call Z, test2 call NZ, test2 call C, test2 call NC, test2 test2: return return Z return NZ return C return NC load s3, 21 and sC, 03 or s4, 19 xor s7, 71 load s1, s5 and s1, s5 or s1, s5 xor s1, s5 add s9, 21 addcy s9, 03 sub s9, 19 subcy s9, 71 add s1, s4 addcy s1, s4 sub s1, s4 subcy s1, s4 sr0 sC sr1 sC srx sC sra sC rr sC sl0 sC sl1 sC slx sC sla sC rl sC input s6, 21 input sB, (s1) output sE, 21 output sF, (s1) returni enable returni disable enable interrupt disable interrupt ; new KCPSM3 instructions compare s1,s7 compare s6,-3 fetch s2,vari fetch s9,(s4) store s3,vari store s6,(sE) test s8,0aah test sC,s3 segment data org 01ah vari:
programs/oeis/092/A092434.asm
neoneye/loda
22
96191
; A092434: Number of words X=x(1)x(2)x(3)...x(n) of length n in three digits {0,1,2} that are invariant under the mapping X -> Y, where y(i)=((AD)^(i-1))x(1) and where (AD) denotes the absolute difference (AD)x(i)=abs(x(i+1)-x(i)) (in other words, y(i) is the i-th element in the diagonal of leading entries in the table of absolute differences of {x(1), x(2),...,x(n)). ; 3,4,10,12,28,32,72,80,176,192,416,448,960,1024 mov $1,$0 lpb $1 mul $0,2 add $0,3 sub $1,2 lpe add $0,3
oeis/178/A178936.asm
neoneye/loda-programs
11
240655
<reponame>neoneye/loda-programs ; A178936: Floor((2*3^n+3*2^n)/5). ; Submitted by <NAME> ; 1,2,6,15,42,116,330,951,2778,8180,24234,72087,215034,642644,1923018,5759223,17258010,51734708,155125482,465219159,1395342906,4185399572,12554940426,37662304695,112981880922,338935576436,1016786596650,3050319524631,9150878043258,27452473068500,82357097082954,247070647003767,741210652521114,2223629380582964,6670882987788138,20012638655442903,60037895350485690,180113644819771028,540340851995941002,1621022391061078839,4863066843329748186,14589199870282267892,43767598291432850346 mov $1,3 pow $1,$0 mov $2,2 pow $2,$0 add $1,$2 mul $1,2 add $1,$2 mov $0,$1 div $0,5
src/NTypes/Negation.agda
vituscze/HoTT-lectures
0
16861
<filename>src/NTypes/Negation.agda {-# OPTIONS --without-K #-} module NTypes.Negation where open import FunExt open import NTypes open import Types ¬-isProp : ∀ {a} {A : Set a} → isProp (¬ A) ¬-isProp ¬a _ = funext λ a → 0-elim (¬a a)
libsrc/msx/msx_text.asm
dex4er/deb-z88dk
1
9120
; ; MSX specific routines ; by <NAME>, 30/11/2007 ; ; int msx_text(); ; ; Switch to text mode ; ; $Id: msx_text.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_text LIB msxbios INCLUDE "#msxbios.def" msx_text: ld ix,TOTEXT jp msxbios
libsrc/graphics/drawto.asm
grancier/z180
0
82180
<filename>libsrc/graphics/drawto.asm ; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by <NAME> - 30/9/98 ; ; ; $Id: drawto.asm,v 1.8 2016/07/02 09:01:35 dom Exp $ ; ;Usage: drawto(struct *pixels) SECTION code_clib PUBLIC drawto PUBLIC _drawto EXTERN swapgfxbk EXTERN __graphics_end EXTERN __gfx_coords EXTERN Line EXTERN plotpixel .drawto ._drawto push ix ld ix,2 add ix,sp ld hl,(__gfx_coords) ld e,(ix+2) ;y ld d,(ix+4) ;x call swapgfxbk ld ix,plotpixel call Line jp __graphics_end
sfx_engine/SFXs-Mod-LFD_NLM.asm
GSoftwareDevelopment/sfx-tracker
9
20455
; ; Low Frequency Divider Modulator/Note Value Modulator LFD_NLM_mode lda (dataPtr),y ; get modulate value sta chnModVal ; store in loop register bne decode_LFD_NLM ; check modulation value jmp modMode_notDefined ; if =0, means no modulation decode_LFD_NLM bmi LFD_NLM_JumpTo ; jump to position in SFX definition, if 7th bit is set cmp #MODFN_NLM_NOTE bpl LFD_NLM_note_mod ; frequency modulation ;$2a5b cmp #$20 ; VAL<32 means positive value, otherwise negative bmi LFD_NLM_inc_freq ora #%11100000 ; set 7th-5th bit to get oposite value LFD_NLM_inc_freq jmp change_freq ; return frequency in register A ; note modulation LFD_NLM_note_mod and #%00111111 cmp #32 ; VAL<32 means positive value, otherwise negative bmi LFD_NLM_inc_note ora #%11100000 ; set 7th-5th bit to get oposite value LFD_NLM_inc_note clc adc chnNote sta chnNote ; get frequency representation of note sty _regTemp tay lda SFX_CHANNELS_ADDR+_sfxNoteTabOfs,x ; get SFX note table preset sta self_SFXnoteAddr+1 self_SFXnoteAddr lda NOTE_TABLE_ADDR,y ldy _regTemp jmp setChannelFreq ; Jump to LFD_NLM_JumpTo and #%01111111 ; clear 7th bit bne LFD_NLM_setSFXofs ldy #SFX_OFF ; end of SFX definition jmp SFX_Set_Offset LFD_NLM_setSFXofs asl @ tay ; set value to SFX offset register jmp modulators ;LFD_NLM_mode ; one more iteration
Task/Create-a-file/AppleScript/create-a-file-4.applescript
LaudateCorpus1/RosettaCodeData
1
261
tell application "Finder" to make new folder at window 1 with properties {name:"docs"}
oeis/111/A111108.asm
neoneye/loda-programs
11
163569
; A111108: a(n) = A001333(n) - (-2)^(n-1), n > 0. ; Submitted by <NAME> ; 0,5,3,25,25,131,175,705,1137,3875,7095,21649,43225,122435,259423,698625,1541985,4011971,9107175,23143825,53559817,133933475,314086735,776787009,1838300625,4512108515,10745077143,26237143825,62749602745,152675873411,366222301375,888878572545,2136463253697,5176837465475,12460073413575,30157113834769,72654041998825,175705716000995,423584437663663,1023836664002625,2469333620320305,5966352195340451,14394341429606775,34770428217342865,83904411538714777,202640823945927875,489062914128259615 mov $2,2 lpb $0 sub $0,1 div $1,2 mul $2,2 mov $3,1 add $3,$1 add $4,$1 mov $1,$2 mov $2,$4 add $3,$1 mov $4,$3 mul $4,2 lpe mov $0,$3
src/main/antlr4/io/github/ssoloff/polyhedra/Expression.g4
ssoloff/polyhedra-jvm
0
913
/* * Copyright (c) 2015 <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ grammar Expression; DICE_ROLL_LITERAL : [1-9][0-9]*'d'([1-9][0-9]*|'%')([-+]([1-9][0-9]*)?[HL])?; DIE_LITERAL : 'd'([1-9][0-9]*|'%'); IDENTIFIER : [_A-Za-z][_0-9A-Za-z]*; INTEGER_LITERAL : [0-9]+; WS : [ \t\r\n]+ -> skip; COMMA : ','; LPAREN : '('; LSQUAREBRACE : '['; MINUS : '-'; PERCENT : '%'; PLUS : '+'; RPAREN : ')'; RSQUAREBRACE : ']'; SLASH : '/'; SLASH_MINUS : '/-'; SLASH_PLUS : '/+'; SLASH_SLASH : '//'; SLASH_TILDE : '/~'; STAR : '*'; additive_expression : additive_expression PLUS multiplicative_expression # Addition | additive_expression MINUS multiplicative_expression # Subtraction | multiplicative_expression # ToMultiplicativeExpression ; array_literal : LSQUAREBRACE expression_list RSQUAREBRACE # ArrayLiteral ; expression : additive_expression # ToAdditiveExpression ; expression_list : /* empty */ # EmptyExpressionList | expression # SingleElementExpressionList | expression_list COMMA expression # MultiElementExpressionList ; function_call : IDENTIFIER LPAREN expression_list RPAREN # FunctionCall ; literal : DICE_ROLL_LITERAL # DiceRollLiteral | DIE_LITERAL # DieLiteral | INTEGER_LITERAL # IntegerLiteral ; multiplicative_expression : multiplicative_expression STAR unary_expression # Multiplication | multiplicative_expression SLASH unary_expression # Division | multiplicative_expression SLASH_MINUS unary_expression # DivisionAndRoundDown | multiplicative_expression SLASH_PLUS unary_expression # DivisionAndRoundUp | multiplicative_expression SLASH_SLASH unary_expression # DivisionAndRoundTowardsZero | multiplicative_expression SLASH_TILDE unary_expression # DivisionAndRound | multiplicative_expression PERCENT unary_expression # Modulo | unary_expression # ToUnaryExpression ; primary_expression : literal # ToLiteral | array_literal # ToArrayLiteral | function_call # ToFunctionCall | LPAREN expression RPAREN # Group ; program : expression EOF ; unary_expression : PLUS primary_expression # Positive | MINUS primary_expression # Negative | primary_expression # ToPrimaryExpression ;
programs/oeis/005/A005359.asm
karttu/loda
0
15615
; A005359: a(n) = n! if n is even, otherwise 0 (from Taylor series for cos x). ; 1,0,2,0,24,0,720,0,40320,0,3628800,0,479001600,0,87178291200,0,20922789888000,0,6402373705728000,0 sub $1,$0 fac $1 trn $1,0
iod/history/cnam.asm
olifink/smsqe
0
170316
; Setup name of HISTORY Channel V2.00  1996 <NAME> section history xdef history_cnam xref history_name include 'dev8_keys_err' include 'dev8_iod_history_data' ;+++ ; Set up history channel name in (a1) ;--- history_cnam move.w d2,d4 subq.w #8,d4 ; space for name ble.s hcn_ipar ; none clr.w (a1)+ ; no name move.l a1,a2 move.l history_name,(a2)+ move.l history_name+4,(a2)+ subq.l #1,a2 move.l hic_hist(a0),a4 ; the history lea hid_name(a4),a4 ; the name move.w (a4)+,d0 ; the length beq.s hcn_done move.b #'_',(a2)+ ; the separator cmp.w d4,d0 ; max length ble.s hcn_copy move.w d4,d0 hcn_copy move.b (a4)+,(a2)+ subq.w #1,d0 bgt.s hcn_copy hcn_done sub.l a1,a2 ; set length of name move.w a2,-(a1) moveq #0,d0 rts hcn_ipar moveq #err.ipar,d0 rts end
programs/oeis/129/A129889.asm
neoneye/loda
22
28020
; A129889: Write down n, then n*(n+1). ; 0,0,1,2,2,6,3,12,4,20,5,30,6,42,7,56,8,72,9,90,10,110,11,132,12,156,13,182,14,210,15,240,16,272,17,306,18,342,19,380,20,420,21,462,22,506,23,552,24,600,25,650,26,702,27,756,28,812,29,870,30,930,31,992,32,1056,33,1122,34,1190,35,1260,36,1332,37,1406,38,1482,39,1560,40,1640,41,1722,42,1806,43,1892,44,1980,45,2070,46,2162,47,2256,48,2352,49,2450 mov $1,$0 pow $0,2 div $0,2 mov $2,$1 lpb $2 mov $0,$1 mul $2,3 dif $2,6 lpe div $0,2
Categories/Coend.agda
copumpkin/categories
98
12239
module Categories.Coend where
programs/oeis/163/A163833.asm
neoneye/loda
22
171864
; A163833: a(n) = n*(6*n^2 + 15*n + 5)/2. ; 0,13,59,156,322,575,933,1414,2036,2817,3775,4928,6294,7891,9737,11850,14248,16949,19971,23332,27050,31143,35629,40526,45852,51625,57863,64584,71806,79547,87825,96658,106064,116061,126667,137900,149778,162319,175541,189462,204100,219473,235599,252496,270182,288675,307993,328154,349176,371077,393875,417588,442234,467831,494397,521950,550508,580089,610711,642392,675150,709003,743969,780066,817312,855725,895323,936124,978146,1021407,1065925,1111718,1158804,1207201,1256927,1308000,1360438,1414259,1469481,1526122,1584200,1643733,1704739,1767236,1831242,1896775,1963853,2032494,2102716,2174537,2247975,2323048,2399774,2478171,2558257,2640050,2723568,2808829,2895851,2984652 mov $2,$0 mov $5,$0 lpb $2 add $0,$2 sub $2,1 lpe add $0,$5 mov $4,$5 mul $4,$5 mov $3,$4 mul $3,7 add $0,$3 mul $4,$5 mov $3,$4 mul $3,3 add $0,$3
SOAS/Metatheory/Traversal.agda
k4rtik/agda-soas
0
9329
<reponame>k4rtik/agda-soas open import SOAS.Common open import SOAS.Families.Core open import Categories.Object.Initial open import SOAS.Coalgebraic.Strength import SOAS.Metatheory.MetaAlgebra -- Traversals parametrised by a pointed coalgebra module SOAS.Metatheory.Traversal {T : Set} (⅀F : Functor 𝔽amiliesₛ 𝔽amiliesₛ) (⅀:Str : Strength ⅀F) (𝔛 : Familyₛ) (open SOAS.Metatheory.MetaAlgebra ⅀F 𝔛) (𝕋:Init : Initial 𝕄etaAlgebras) where open import SOAS.Context open import SOAS.Variable open import SOAS.Abstract.Hom import SOAS.Abstract.Coalgebra as →□ ; open →□.Sorted import SOAS.Abstract.Box as □ ; open □.Sorted open import SOAS.Metatheory.Algebra ⅀F open import SOAS.Metatheory.Semantics ⅀F ⅀:Str 𝔛 𝕋:Init open Strength ⅀:Str private variable Γ Δ Θ Π : Ctx α β : T 𝒫 𝒬 𝒜 : Familyₛ -- Parametrised interpretation into an internal hom module Traversal (𝒫ᴮ : Coalgₚ 𝒫)(𝑎𝑙𝑔 : ⅀ 𝒜 ⇾̣ 𝒜) (φ : 𝒫 ⇾̣ 𝒜)(χ : 𝔛 ⇾̣ 〖 𝒜 , 𝒜 〗) where open Coalgₚ 𝒫ᴮ -- Under the assumptions 𝒜 and 〖 𝒫 , 𝒜 〗 are both meta-algebras 𝒜ᵃ : MetaAlg 𝒜 𝒜ᵃ = record { 𝑎𝑙𝑔 = 𝑎𝑙𝑔 ; 𝑣𝑎𝑟 = λ x → φ (η x) ; 𝑚𝑣𝑎𝑟 = χ } Travᵃ : MetaAlg 〖 𝒫 , 𝒜 〗 Travᵃ = record { 𝑎𝑙𝑔 = λ t σ → 𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 t σ) ; 𝑣𝑎𝑟 = λ x σ → φ (σ x) ; 𝑚𝑣𝑎𝑟 = λ 𝔪 ε σ → χ 𝔪 (λ 𝔫 → ε 𝔫 σ) } -- 〖 𝒫 , 𝒜 〗 is also a pointed □-coalgebra Travᵇ : Coalg 〖 𝒫 , 𝒜 〗 Travᵇ = record { r = λ h ρ σ → h (σ ∘ ρ) ; counit = refl ; comult = refl } Travᴮ : Coalgₚ 〖 𝒫 , 𝒜 〗 Travᴮ = record { ᵇ = Travᵇ ; η = λ x σ → φ (σ x) ; r∘η = refl } open Semantics Travᵃ public renaming (𝕤𝕖𝕞 to 𝕥𝕣𝕒𝕧) -- Traversal-specific homomorphism properties that incorporate a substitution 𝕥⟨𝕧⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{x : ℐ α Γ} → 𝕥𝕣𝕒𝕧 (𝕧𝕒𝕣 x) σ ≡ φ (σ x) 𝕥⟨𝕧⟩ {σ = σ} = cong (λ - → - σ) ⟨𝕧⟩ 𝕥⟨𝕞⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → 𝕥𝕣𝕒𝕧 (𝕞𝕧𝕒𝕣 𝔪 ε) σ ≡ χ 𝔪 (λ p → 𝕥𝕣𝕒𝕧 (ε p) σ) 𝕥⟨𝕞⟩ {σ = σ} = cong (λ - → - σ) ⟨𝕞⟩ 𝕥⟨𝕒⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{t : ⅀ 𝕋 α Γ} → 𝕥𝕣𝕒𝕧 (𝕒𝕝𝕘 t) σ ≡ 𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 (⅀₁ 𝕥𝕣𝕒𝕧 t) σ) 𝕥⟨𝕒⟩ {σ = σ} = cong (λ - → - σ) ⟨𝕒⟩ -- Congruence in the two arguments of 𝕥𝕣𝕒𝕧 𝕥≈₁ : {σ : Γ ~[ 𝒫 ]↝ Δ}{t₁ t₂ : 𝕋 α Γ} → t₁ ≡ t₂ → 𝕥𝕣𝕒𝕧 t₁ σ ≡ 𝕥𝕣𝕒𝕧 t₂ σ 𝕥≈₁ {σ = σ} p = cong (λ - → 𝕥𝕣𝕒𝕧 - σ) p 𝕥≈₂ : {σ₁ σ₂ : Γ ~[ 𝒫 ]↝ Δ}{t : 𝕋 α Γ} → ({τ : T}{x : ℐ τ Γ} → σ₁ x ≡ σ₂ x) → 𝕥𝕣𝕒𝕧 t σ₁ ≡ 𝕥𝕣𝕒𝕧 t σ₂ 𝕥≈₂ {t = t} p = cong (𝕥𝕣𝕒𝕧 t) (dext′ p) -- A pointed meta-Λ-algebra induces 𝕒𝕝𝕘 traversal into □ 𝒜 module □Traversal {𝒜} (𝒜ᵃ : MetaAlg 𝒜) = Traversal ℐᴮ (MetaAlg.𝑎𝑙𝑔 𝒜ᵃ) (MetaAlg.𝑣𝑎𝑟 𝒜ᵃ) (MetaAlg.𝑚𝑣𝑎𝑟 𝒜ᵃ) -- Corollary: □ lifts to an endofunctor on pointed meta-Λ-algebras □ᵃ : (𝒜ᵃ : MetaAlg 𝒜) → MetaAlg (□ 𝒜) □ᵃ = □Traversal.Travᵃ -- Helper records for proving equality of maps f, g out of 𝕋, -- with 0, 1 or 2 parameters record MapEq₀ (𝒜 : Familyₛ)(f g : 𝕋 ⇾̣ 𝒜) : Set where field ᵃ : MetaAlg 𝒜 open Semantics ᵃ open 𝒜 field f⟨𝑣⟩ : {x : ℐ α Γ} → f (𝕧𝕒𝕣 x) ≡ 𝑣𝑎𝑟 x f⟨𝑚⟩ : {𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → f (𝕞𝕧𝕒𝕣 𝔪 ε) ≡ 𝑚𝑣𝑎𝑟 𝔪 (f ∘ ε) f⟨𝑎⟩ : {t : ⅀ 𝕋 α Γ} → f (𝕒𝕝𝕘 t) ≡ 𝑎𝑙𝑔 (⅀₁ f t) g⟨𝑣⟩ : {x : ℐ α Γ} → g (𝕧𝕒𝕣 x) ≡ 𝑣𝑎𝑟 x g⟨𝑚⟩ : {𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → g (𝕞𝕧𝕒𝕣 𝔪 ε) ≡ 𝑚𝑣𝑎𝑟 𝔪 (g ∘ ε) g⟨𝑎⟩ : {t : ⅀ 𝕋 α Γ} → g (𝕒𝕝𝕘 t) ≡ 𝑎𝑙𝑔 (⅀₁ g t) fᵃ : MetaAlg⇒ 𝕋ᵃ ᵃ f fᵃ = record { ⟨𝑎𝑙𝑔⟩ = f⟨𝑎⟩ ; ⟨𝑣𝑎𝑟⟩ = f⟨𝑣⟩ ; ⟨𝑚𝑣𝑎𝑟⟩ = f⟨𝑚⟩ } gᵃ : MetaAlg⇒ 𝕋ᵃ ᵃ g gᵃ = record { ⟨𝑎𝑙𝑔⟩ = g⟨𝑎⟩ ; ⟨𝑣𝑎𝑟⟩ = g⟨𝑣⟩ ; ⟨𝑚𝑣𝑎𝑟⟩ = g⟨𝑚⟩ } ≈ : (t : 𝕋 α Γ) → f t ≡ g t ≈ t = eq fᵃ gᵃ t record MapEq₁ (𝒫ᴮ : Coalgₚ 𝒫)(𝑎𝑙𝑔 : ⅀ 𝒜 ⇾̣ 𝒜) (f g : 𝕋 ⇾̣ 〖 𝒫 , 𝒜 〗) : Set where field φ : 𝒫 ⇾̣ 𝒜 χ : 𝔛 ⇾̣ 〖 𝒜 , 𝒜 〗 open Traversal 𝒫ᴮ 𝑎𝑙𝑔 φ χ field f⟨𝑣⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{x : ℐ α Γ} → f (𝕧𝕒𝕣 x) σ ≡ φ (σ x) f⟨𝑚⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → f (𝕞𝕧𝕒𝕣 𝔪 ε) σ ≡ χ 𝔪 (λ p → f (ε p) σ) f⟨𝑎⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{t : ⅀ 𝕋 α Γ} → f (𝕒𝕝𝕘 t) σ ≡ 𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 (⅀₁ f t) σ) g⟨𝑣⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{x : ℐ α Γ} → g (𝕧𝕒𝕣 x) σ ≡ φ (σ x) g⟨𝑚⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → g (𝕞𝕧𝕒𝕣 𝔪 ε) σ ≡ χ 𝔪 (λ p → g (ε p) σ) g⟨𝑎⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{t : ⅀ 𝕋 α Γ} → g (𝕒𝕝𝕘 t) σ ≡ 𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 (⅀₁ g t) σ) fᵃ : MetaAlg⇒ 𝕋ᵃ Travᵃ f fᵃ = record { ⟨𝑎𝑙𝑔⟩ = dext′ f⟨𝑎⟩ ; ⟨𝑣𝑎𝑟⟩ = dext′ f⟨𝑣⟩ ; ⟨𝑚𝑣𝑎𝑟⟩ = dext′ f⟨𝑚⟩ } gᵃ : MetaAlg⇒ 𝕋ᵃ Travᵃ g gᵃ = record { ⟨𝑎𝑙𝑔⟩ = dext′ g⟨𝑎⟩ ; ⟨𝑣𝑎𝑟⟩ = dext′ g⟨𝑣⟩ ; ⟨𝑚𝑣𝑎𝑟⟩ = dext′ g⟨𝑚⟩ } ≈ : {σ : Γ ~[ 𝒫 ]↝ Δ}(t : 𝕋 α Γ) → f t σ ≡ g t σ ≈ {σ = σ} t = cong (λ - → - σ) (eq fᵃ gᵃ t) record MapEq₂ (𝒫ᴮ : Coalgₚ 𝒫)(𝒬ᴮ : Coalgₚ 𝒬)(𝑎𝑙𝑔 : ⅀ 𝒜 ⇾̣ 𝒜) (f g : 𝕋 ⇾̣ 〖 𝒫 , 〖 𝒬 , 𝒜 〗 〗) : Set where field φ : 𝒬 ⇾̣ 𝒜 ϕ : 𝒫 ⇾̣ 〖 𝒬 , 𝒜 〗 χ : 𝔛 ⇾̣ 〖 𝒜 , 𝒜 〗 open Traversal 𝒫ᴮ (Traversal.𝒜.𝑎𝑙𝑔 𝒬ᴮ 𝑎𝑙𝑔 φ χ) ϕ (λ 𝔪 ε σ → χ 𝔪 (λ 𝔫 → ε 𝔫 σ)) field f⟨𝑣⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{x : ℐ α Γ} → f (𝕧𝕒𝕣 x) σ ς ≡ ϕ (σ x) ς f⟨𝑚⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → f (𝕞𝕧𝕒𝕣 𝔪 ε) σ ς ≡ χ 𝔪 (λ 𝔫 → f (ε 𝔫) σ ς) f⟨𝑎⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{t : ⅀ 𝕋 α Γ} → f (𝕒𝕝𝕘 t) σ ς ≡ 𝑎𝑙𝑔 (str 𝒬ᴮ 𝒜 (str 𝒫ᴮ 〖 𝒬 , 𝒜 〗 (⅀₁ f t) σ) ς) g⟨𝑣⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{x : ℐ α Γ} → g (𝕧𝕒𝕣 x) σ ς ≡ ϕ (σ x) ς g⟨𝑚⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{𝔪 : 𝔛 α Π}{ε : Π ~[ 𝕋 ]↝ Γ} → g (𝕞𝕧𝕒𝕣 𝔪 ε) σ ς ≡ χ 𝔪 (λ 𝔫 → g (ε 𝔫) σ ς) g⟨𝑎⟩ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}{t : ⅀ 𝕋 α Γ} → g (𝕒𝕝𝕘 t) σ ς ≡ 𝑎𝑙𝑔 (str 𝒬ᴮ 𝒜 (str 𝒫ᴮ 〖 𝒬 , 𝒜 〗 (⅀₁ g t) σ) ς) fᵃ : MetaAlg⇒ 𝕋ᵃ Travᵃ f fᵃ = record { ⟨𝑎𝑙𝑔⟩ = dext′ (dext′ f⟨𝑎⟩) ; ⟨𝑣𝑎𝑟⟩ = dext′ (dext′ f⟨𝑣⟩) ; ⟨𝑚𝑣𝑎𝑟⟩ = dext′ (dext′ f⟨𝑚⟩) } gᵃ : MetaAlg⇒ 𝕋ᵃ Travᵃ g gᵃ = record { ⟨𝑎𝑙𝑔⟩ = dext′ (dext′ g⟨𝑎⟩) ; ⟨𝑣𝑎𝑟⟩ = dext′ (dext′ g⟨𝑣⟩) ; ⟨𝑚𝑣𝑎𝑟⟩ = dext′ (dext′ g⟨𝑚⟩) } ≈ : {σ : Γ ~[ 𝒫 ]↝ Δ}{ς : Δ ~[ 𝒬 ]↝ Θ}(t : 𝕋 α Γ) → f t σ ς ≡ g t σ ς ≈ {σ = σ}{ς} t = cong (λ - → - σ ς) (eq fᵃ gᵃ t) -- Interaction of traversal and interpretation module _ (𝒫ᴮ : Coalgₚ 𝒫)(𝒜ᵃ : MetaAlg 𝒜)(φ : 𝒫 ⇾̣ 𝒜) where open MetaAlg 𝒜ᵃ open Coalgₚ 𝒫ᴮ open Semantics 𝒜ᵃ open Traversal 𝒫ᴮ 𝑎𝑙𝑔 φ 𝑚𝑣𝑎𝑟 using (𝕥𝕣𝕒𝕧 ; 𝕥⟨𝕒⟩ ; 𝕥⟨𝕧⟩ ; 𝕥⟨𝕞⟩) open ≡-Reasoning -- Traversal with the point of 𝒫 is the same as direct interpretation 𝕥𝕣𝕒𝕧-η≈𝕤𝕖𝕞 : (φ∘η≈𝑣𝑎𝑟 : ∀{α Γ}{v : ℐ α Γ} → φ (η v) ≡ 𝑣𝑎𝑟 v){t : 𝕋 α Γ} → 𝕥𝕣𝕒𝕧 t η ≡ 𝕤𝕖𝕞 t 𝕥𝕣𝕒𝕧-η≈𝕤𝕖𝕞 φ∘η≈𝑣𝑎𝑟 {t = t} = Semantics.eq 𝒜ᵃ (record { ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → trans 𝕥⟨𝕒⟩ (cong 𝑎𝑙𝑔 (begin str 𝒫ᴮ 𝒜 (⅀₁ 𝕥𝕣𝕒𝕧 t) η ≡⟨ str-nat₁ (ηᴮ⇒ 𝒫ᴮ) (⅀₁ 𝕥𝕣𝕒𝕧 t) id ⟩ str ℐᴮ 𝒜 (⅀₁ (λ{ h ρ → h (η ∘ ρ)}) ((⅀₁ 𝕥𝕣𝕒𝕧 t))) id ≡⟨ str-unit 𝒜 ((⅀₁ (λ{ h ρ → h (η ∘ ρ)}) ((⅀₁ 𝕥𝕣𝕒𝕧 t)))) ⟩ ⅀₁ (i 𝒜) (⅀₁ (λ { h ρ → h (η ∘ ρ) }) (⅀₁ 𝕥𝕣𝕒𝕧 t)) ≡˘⟨ trans ⅀.homomorphism ⅀.homomorphism ⟩ ⅀₁ (λ t → 𝕥𝕣𝕒𝕧 t η) t ∎))} ; ⟨𝑣𝑎𝑟⟩ = λ{ {v = v} → trans 𝕥⟨𝕧⟩ φ∘η≈𝑣𝑎𝑟 } ; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪}{ε} → 𝕥⟨𝕞⟩ } }) 𝕤𝕖𝕞ᵃ⇒ t -- Traversal with the point of 𝒫 into 𝕋 is the identity 𝕥𝕣𝕒𝕧-η≈id : (𝒫ᴮ : Coalgₚ 𝒫)(open Coalgₚ 𝒫ᴮ)(φ : 𝒫 ⇾̣ 𝕋) (φ∘η≈𝑣𝑎𝑟 : ∀{α Γ}{v : ℐ α Γ} → φ (η v) ≡ 𝕧𝕒𝕣 v){t : 𝕋 α Γ} → Traversal.𝕥𝕣𝕒𝕧 𝒫ᴮ 𝕒𝕝𝕘 φ 𝕞𝕧𝕒𝕣 t η ≡ t 𝕥𝕣𝕒𝕧-η≈id 𝒫ᴮ φ φ∘η≈𝑣𝑎𝑟 = trans (𝕥𝕣𝕒𝕧-η≈𝕤𝕖𝕞 𝒫ᴮ 𝕋ᵃ φ φ∘η≈𝑣𝑎𝑟) 𝕤𝕖𝕞-id -- Corollaries for ℐ-parametrised traversals □𝕥𝕣𝕒𝕧-id≈𝕤𝕖𝕞 : (𝒜ᵃ : MetaAlg 𝒜){t : 𝕋 α Γ} → □Traversal.𝕥𝕣𝕒𝕧 𝒜ᵃ t id ≡ Semantics.𝕤𝕖𝕞 𝒜ᵃ t □𝕥𝕣𝕒𝕧-id≈𝕤𝕖𝕞 𝒜ᵃ {t} = 𝕥𝕣𝕒𝕧-η≈𝕤𝕖𝕞 ℐᴮ 𝒜ᵃ (MetaAlg.𝑣𝑎𝑟 𝒜ᵃ) refl □𝕥𝕣𝕒𝕧-id≈id : {t : 𝕋 α Γ} → □Traversal.𝕥𝕣𝕒𝕧 𝕋ᵃ t id ≡ t □𝕥𝕣𝕒𝕧-id≈id = 𝕥𝕣𝕒𝕧-η≈id ℐᴮ 𝕧𝕒𝕣 refl
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2.log_21829_1449.asm
ljhsiun2/medusa
9
13558
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x7217, %rcx nop nop nop nop add $41967, %r12 movups (%rcx), %xmm3 vpextrq $0, %xmm3, %r11 dec %rdi lea addresses_WC_ht+0xd3af, %rsi lea addresses_normal_ht+0x1936f, %rdi clflush (%rsi) nop nop xor $57929, %r15 mov $117, %rcx rep movsw nop nop nop nop and %r11, %r11 lea addresses_A_ht+0x17a6f, %rsi lea addresses_A_ht+0x17b6f, %rdi add $18353, %r9 mov $120, %rcx rep movsw nop nop nop nop nop inc %rcx lea addresses_normal_ht+0x1bd2f, %rsi nop nop nop nop xor %r12, %r12 mov $0x6162636465666768, %rdi movq %rdi, (%rsi) nop nop nop and %rsi, %rsi lea addresses_WT_ht+0x15c2f, %rsi lea addresses_normal_ht+0x69cb, %rdi nop nop nop nop sub %rbp, %rbp mov $121, %rcx rep movsl nop nop nop nop cmp $13916, %r11 lea addresses_A_ht+0x1ec67, %rdi nop nop nop nop nop cmp $49698, %rbp mov $0x6162636465666768, %rcx movq %rcx, (%rdi) nop nop nop and %rdi, %rdi lea addresses_normal_ht+0x789, %rcx nop nop mfence mov (%rcx), %rbp xor %r12, %r12 lea addresses_D_ht+0x646f, %rsi lea addresses_WC_ht+0x636f, %rdi nop sub $51509, %rbp mov $50, %rcx rep movsq nop nop sub $21834, %r12 lea addresses_WC_ht+0x336f, %r9 nop nop nop sub %rbp, %rbp and $0xffffffffffffffc0, %r9 vmovaps (%r9), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rsi xor %r15, %r15 lea addresses_normal_ht+0x36f, %rsi lea addresses_A_ht+0x136f, %rdi clflush (%rsi) nop add %r12, %r12 mov $23, %rcx rep movsl nop nop nop nop xor $9827, %r15 lea addresses_WT_ht+0x12ab9, %rbp clflush (%rbp) nop nop nop nop nop cmp $53888, %rcx mov (%rbp), %r11w nop nop nop xor %rsi, %rsi lea addresses_A_ht+0x11bcf, %rsi lea addresses_UC_ht+0x1cb6f, %rdi nop cmp %r9, %r9 mov $59, %rcx rep movsl nop nop nop nop add %r15, %r15 lea addresses_normal_ht+0x10f2f, %rcx nop nop nop nop and $52907, %r12 mov (%rcx), %esi nop nop nop dec %r11 lea addresses_D_ht+0x1ac6f, %r11 nop nop nop add $33771, %rcx movups (%r11), %xmm0 vpextrq $1, %xmm0, %rsi nop nop nop xor $40056, %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rbp push %rbx push %rdi // Store lea addresses_A+0x1edaf, %rdi inc %r14 movb $0x51, (%rdi) nop nop nop cmp $53723, %r14 // Store lea addresses_A+0x82df, %rdi nop nop nop cmp %rbx, %rbx mov $0x5152535455565758, %r13 movq %r13, (%rdi) nop nop nop nop inc %r8 // Load lea addresses_D+0x1515f, %r13 nop nop nop nop xor %rbp, %rbp mov (%r13), %di nop nop nop nop dec %r8 // Faulty Load mov $0x6aa5da0000000b6f, %rbx nop nop and %r13, %r13 mov (%rbx), %r8 lea oracles, %rdi and $0xff, %r8 shlq $12, %r8 mov (%rdi,%r8,1), %r8 pop %rdi pop %rbx pop %rbp pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'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 */
src/legacy/loadpe.asm
amindlost/wdosx
7
8683
<reponame>amindlost/wdosx ; ############################################################################ ; ## WDOSX DOS Extender Copyright (c) 1996, 1999, <NAME> ## ; ## ## ; ## Released under the terms of the WDOSX license agreement. ## ; ############################################################################ ; ; $Header: E:/RCS/WDOSX/0.95/SRC/legacy/LOADPE.ASM 1.1 1999/02/07 18:13:00 MikeT Exp $ ; ; ---------------------------------------------------------------------------- ; ; $Log: LOADPE.ASM $ ; Revision 1.1 1999/02/07 18:13:00 MikeT ; Initial check in. ; ; ; ---------------------------------------------------------------------------- ; ; Old floating segment PE code which I'm too lazy to maintain any longer or to ; even comment on. It should stay as is and eventually die. ; ; This includes the Win32 API Emulation ;WIN32API = 1 .386p IFDEF WIN32API include w32struc.inc include except.inc ENDIF code segment use32 assume cs:code,ds:code segbegin label near IFDEF WIN32API ; thread information block MUST BE AT OFFSET 0 !!! TIB label near TIBErecord dd -1 StackBase dd ? org 02ch TlsArray dd ? ENDIF femsg db 'Error reading executable',0dh,0ah,'$' fomsg db 'Wrong executable format',0dh,0ah,'$' memsg db 'Not enough extended memory',0dh,0ah,'$' IFDEF WIN32API dmmsg db 'DPMI host returned an error',0dh,0ah,'$' impmsg db 'Import by ordinal not supported',0dh,0ah,'$' todomsg db 'This dynalink is not supported yet',0dh,0ah,'$' ENDIF file_error: mov edx,offset femsg jmp short errormsg format_error: mov edx,offset fomsg jmp short errormsg mem_error: mov edx,offset memsg IFDEF WIN32API jmp short errormsg import_error: mov edx,offset impmsg jmp short errormsg dpmi_error: mov edx,offset dmmsg jmp short errormsg todo_error: push esi call output0string mov edx,offset todomsg ENDIF errormsg: mov ah,9 int 21h mov ax,4cffh int 21h IFDEF WIN32API include imports.inc include win32api.inc include console.asi ENDIF align dword FlatDataSel dd 0 ZeroDataSelector dd 0 OldExcHandlers label dword start_it_up: ;-------------- enable virtual interrupts ------------- mov ax,0901h int 31h IFDEF WIN32API ;-------------- Allocate the 0 - 4g descriptor -------- sub eax,eax mov ecx,1 int 31h jc dpmi_error mov ebx,eax mov eax,8 stc sbb ecx,ecx sbb edx,edx int 31h jc dpmi_error lar cx,bx mov cl,ch and cl,60h or cl,92h mov ch,0cfh mov eax,9 int 31h jc dpmi_error sub ecx,ecx sub edx,edx mov ax,7 int 31h jc dpmi_error mov ZeroDataSelector,ebx ENDIF ;-------------- expand segment a bit ----------------- mov ax,-1 mov edx,20000h ;128k, should be enough int 21h jc mem_error mov esp,edx ;-------------- save PSP selector --------------------- mov pspsel,es ;-------------- get environment selector -------------- mov es,es:[2ch] ;-------------- scan for filename --------------------- sub ebp,ebp cld mov ecx,0fff4h sub edi,edi sub eax,eax mov ebp,4 next_env: add ebp,4 repne scasb scasb jne short next_env ;ebp bytes needed for *environm[] lea edx,[edi+2] push edx push ebp ;-------------- copy environment ---------------------- ;find end of filename mov edi,edx repne scasb ; lea ecx,[edi+1] ;bugfix mov ecx,edi ; mov edi,offset freemem sub esi,esi mov ebp,ds push es mov es,ebp pop ds IFDEF DEBUG mov eax,esi call ccc mov eax,edi call ccc mov eax,ecx call ccc mov ax,es call ccc mov ax,ds call ccc pushfd pop eax call ccc ENDIF cld rep movs byte ptr es:[edi],ds:[esi] ;-------------- open exe ------------------------------ mov ax,3d00h int 21h mov ds,ebp pop ebp pop edx jc file_error add edx,offset freemem mov argv[0],edx mov handle,eax IFDEF DEBUG pushad mov edx,offset succ1 mov ah,9 int 21h popad ENDIF ;-------------- copy command line args ---------------- push edi mov ds,pspsel movzx ecx,byte ptr ds:[80h] mov esi,81h push ecx rep movs byte ptr es:[edi],ds:[esi] push ss pop ds mov [edi],cl pop ecx ;-------------- determine start of loader space ------- lea edi,[edi+4] and edi,0fffffffch mov EnvArray,edi add ebp,edi mov ImageBase,ebp pop edi ;-------------- Get yet another copy of the CmdTail --- IFDEF WIN32API push edi mov esi,edi ; get a pointer to filename ( argv[0] already set ) sub eax,eax mov edx,argv[0] mov edi,offset CmdTail CmdTail2Fname: mov ah,[edx] inc edx mov [edi],ah inc edi inc al test ah,ah jnz short CmdTail2Fname cmp byte ptr [esi],20h jc CmdTail2Done mov byte ptr [edi-1],20h jnz CmdTail2Copy dec edi CmdTail2Copy: mov ecx,80h rep movsb CmdTail2Done: mov ApiFnameLen,eax pop edi ENDIF ;-------------- Fixup command tail -------------------- sub edx,edx mov argc,1 ;? mov esi,offset Argv+4 jecxz FixCmdDone FixCmdTail: cmp byte ptr [edi],20h jna short IsSeparator test edx,edx jnz short NoArgument or edx,1 inc argc mov [esi],edi add esi,4 jmp short NoArgument IsSeparator: mov byte ptr [edi],0 sub edx,edx NoArgument: inc edi loop short FixCmdTail FixCmdDone: mov dword ptr [esi],0 ;-------------- build *evironment[] ------------------- mov edi,offset freemem mov esi,EnvArray sub eax,eax stc sbb ecx,ecx mov [esi],edi nextenvptr: add esi,4 repne scasb mov [esi],edi scasb jne nextenvptr mov [esi],eax ;-------------- read wdosx header --------------------- mov ebx,handle mov ecx,6 mov ah,3fh mov edx,ebp int 21h jc file_error ;-------------- get offset to next header ------------- sub edx,edx mov ecx,[ebp+2] shld edx,ecx,16+9 neg ecx and ecx,511 and edx,0ffffffe0h sub edx,ecx sub ecx,ecx push edx mov ax,4200h int 21h ;-------------- read peloader header ------------------ mov ecx,6 mov ah,3fh mov edx,ebp int 21h jc file_error ;-------------- get offset to user exe header --------- sub edx,edx mov ecx,[ebp+2] shld edx,ecx,16+9 neg ecx and ecx,511 and edx,0fffffe00h sub edx,ecx sub ecx,ecx pop eax add edx,eax ;we'll have to do something if wdosx+peloader gets > 64k mov image2filepos,edx mov ax,4200h int 21h ;-------------- read header -------------------------- mov ecx,64 mov ah,3fh mov edx,ebp int 21h jc file_error cmp eax,64 jnz file_error ;-------------- check for MZ signature --------------- mov eax,[ebp] cmp ax,5A4Dh jnz format_error ;-------------- get offset to PE header -------------- mov edx,dword ptr [ebp+60] IFDEF WIN32API mov SizeOfMzExe,edx ENDIF sub edx,64 ;-------------- read headers struct ------------------ sub ecx,ecx shld ecx,edx,16 mov ax,4201h int 21h ;sig = 4 ;image_file_header = 20 mov ecx,24 mov ah,3fh mov edx,ebp int 21h jc file_error cmp eax,ecx jnz file_error cmp dword ptr [ebp],'EP' jnz format_error ;-------------- get optional header -------------------------- add edx,24 movzx ecx,word ptr [ebp+20] mov ah,3fh int 21h jc file_error cmp eax,ecx jnz file_error ;-------------- load section table --------------------------- mov ecx,[edx+92] ;get directory size add edx,eax ;set pointer where to store ;ecx*=40... shl ecx,3 ;ecx*=8 lea ecx,[ecx*4+ecx] ;ecx*=5 mov ah,3fh int 21h jc file_error cmp eax,ecx jnz file_error ;-------------- now basic structures in memory --------------- ;-------------- check, how much mem we finally need ---------- ;assumtion is that there is at least one empty entry in image section header mov edi,edx ;first section = end of table + first rva add ecx,edi ;ecx->free mem ;edi->start of ISH mov rva2offset,ecx ;get imagesize mov edx,dword ptr [50h+ebp] ;add start of first section - rva add edx,ecx ;add stack size add edx,dword ptr[76+24+ebp] ;align on 4k boundary (Page granular) add edx,0fffh and edx,0fffff000h IFDEF WIN32API mov start_of_heap,edx ; add size of heap to commit and align on 64k add edx,[ebp+84+24] add edx,0ffffh and edx,0ffff0000h mov end_of_heap,edx mov segment_size,edx mov initial_top,edx ENDIF mov ax,-1 int 21h IFDEF WIN32API mov edx,start_of_heap ENDIF jc mem_error mov esp,edx sub eax,eax ; quick'n dirty: zero out all that mem push ds pop es IFDEF WIN32API ; zero out local heap push edi mov edx,ecx mov edi,start_of_heap mov ecx,end_of_heap sub ecx,edi shr ecx,2 rep stosd pop edi mov ecx,edx ENDIF push edi mov edi,ecx ;start mov edx,ecx neg ecx add ecx,esp ;ecx=esp-ecx shr ecx,2 ;eax=0! rep stosd pop edi ;now safe to load sections (a broken image will crash this!) load_section: ; check first letter of section name cmp byte ptr [edi],0 jz short load_done ; get virtual size mov eax,[edi+8] or eax,[edi+16] jz short load_next ;nothing to load mov edx,[edi+20] ;get filepos add edx,image2filepos ;adjust shld ecx,edx,16 mov ax,4200h int 21h mov edx,[edi+12] ;get rva mov ecx,[edi+16] ;get size add edx,rva2offset ;adjust rva mov ah,3fh int 21h jc file_error cmp eax,ecx jnz file_error load_next: add edi,40 jmp short load_section load_done: ;-------------- now all that stuff in memory ------------ mov ah,3eh int 21h ;-------------- close handle ---------------------------- ;get fixups from array of interesting rvas mov edi,dword ptr ds:[0a0h+ebp] ;rva mov ecx,dword ptr ds:[0a4h+ebp] ;size mov eax,rva2offset add edi,eax sub eax,dword ptr [34h+ebp] ;imagebase ;eax=delta ;get page rva do_a_page: mov edx,[edi] test edx,edx jz short reloc_done add edx,rva2offset ;get blocksize mov esi,8 ;start ;read item do_a_fixup: movzx ebp,word ptr [edi+esi] ;get type ror ebp,12 mov ebx,ebp shr ebx,20 cmp bp,2 jnz short no_low add [edx+ebx],ax jmp short lookup_next no_low: cmp bp,1 jnz short no_high push eax shl eax,16 add [edx+ebx],ax pop eax jmp short lookup_next no_high: cmp bp,3 jnz short no_hilow add [edx+ebx],eax jmp short lookup_next no_hilow: ;next one sux cmp bp,4 jnz short lookup_next ;ignore others add esi,2 mov ebp,[edx+ebx-2] ;get high word mov bp,[edi+esi] ;get low word lea ebp,[ebp+eax+8000h] ;do as M$ says shr ebp,16 ;only high word matters mov [edx+ebx],bp ;what is this for??? lookup_next: add esi,2 cmp esi,[edi+4] jnz short do_a_fixup add edi,esi jmp short do_a_page reloc_done: IFDEF WIN32API call process_imports ; get approx. initial free memory size sub esp,30h mov edi,esp mov eax,500h int 31h pop ApiInitialFree add esp,2ch mov eax,start_of_heap add ApiInitialFree,eax mov edx,offset NewDTA mov ah,1ah int 21h call InitSeh mov eax,cs lar eax,eax test ah,60h jnz short @@FpuCheck mov eax,cr0 and al,NOT 6 ; reset EM + MP mov cr0,eax @@FpuCheck: fninit push 5a5ah fstsw [esp] mov eax,[esp] test al,al jnz short @@NoFpu fstcw [esp] pop eax and eax,103fh cmp eax,3fh jnz short @@NoFpu1 ; This is a horrible kludge since Windows does not allow us to use exception 10 ; It allowes setting the exception handler, though, but it doesn't trigger it. mov eax,400h int 31h cmp cl,4 jc short TheHardWay mov eax,cs lar eax,eax test ah,60h jnz short TheHardWay mov eax,cr0 or eax,80000022h mov cr0,eax TheHardWay: mov bl,dl add bl,5 mov ecx,cs mov edx,offset FPUHandlerPIC mov eax,205h int 31h in al,0a1h and al,NOT 20h out 0a1h,al in al,21h and al,NOT 4 out 21h,al jmp short @@FpuDone @@NoFpu: pop eax @@NoFpu1: ; remove the comments to raise an exception if there's no FPU present ; mov eax,cs ; lar eax,eax ; test ah,60h ; jnz short @@FpuDone ; mov eax,cr0 ; or al,4 ; and al,NOT 2 ; mov cr0,eax @@FpuDone: ENDIF ;launch the proggy mov eax,ImageBase IFDEF WIN32API mov ebx,[eax+0c0h] add ebx,rva2offset add ebx,0ch mov TlsArray,ebx ENDIF mov eax,dword ptr [16+24+eax] add eax,rva2offset mov esi,argc mov edi,offset argv mov ebp,EnvArray push ds pop fs push ds pop gs IFDEF WIN32API ; I'm not sure if this is correct... mov StackBase,esp lea ebp,[esp-30h] push ebp push ebp push ebp sub esp,30h-12 ELSE ;get dpmi style es - selector (PSP) mov es,pspsel ENDIF jmp eax ;entry conditions: ; VI enabled ; es=fs=gs=ds=ss alias cs ; esi->Argc ; edi->*Argv[Argc] ; ebp->*Environment[] IFDEF DEBUG succ1 db 'environment copy done',0dh,0ah,'$' ENDIF align 4 IFDEF WIN32API va_space MemBlock blockcount dup (<0,0>) free_handles dd blockcount ConsoleMode dd ENABLE_LINE_INPUT + ENABLE_ECHO_INPUT ffhandles dd 0 ENDIF ;globals rva2offset dd ? image2filepos dd ? pspsel dw ? dw ? ;align handle dd ? ImageBase dd ? Argc dd ? EnvArray dd ? Argv dd 40h dup (?) IFDEF WIN32API ApiFnameLen dd ? LastError dd ? SizeOfMzExe dd ? initial_top dd ? start_of_heap dd ? end_of_heap dd ? segment_size dd ? ApiInitialFree dd ? NewDTA db 80h * 32 dup (?) DummyTime systime <?,?,?,?,?,?,?,?> CmdTail db 260 dup (?) Cntx ContextRecord <> Erec ExceptionRecord <> dd 15 dup (?) align 4 TlsSpace dd 64 dup (?) ENDIF freemem label near code ends end start_it_up
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1241.asm
ljhsiun2/medusa
9
97558
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1241.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x13c82, %rbx sub %r13, %r13 mov $0x6162636465666768, %rdx movq %rdx, (%rbx) nop nop nop nop nop sub %r13, %r13 lea addresses_WT_ht+0x1bf42, %rsi lea addresses_normal_ht+0x19282, %rdi nop nop nop add %rbx, %rbx mov $18, %rcx rep movsq nop nop nop add $24258, %rcx lea addresses_A_ht+0x9c2, %r13 nop nop xor %r14, %r14 movw $0x6162, (%r13) nop nop add %rsi, %rsi lea addresses_normal_ht+0x59d2, %rdx nop nop nop nop nop xor $63733, %rsi mov (%rdx), %r13d nop nop nop nop add %r14, %r14 lea addresses_normal_ht+0x149d2, %rsi lea addresses_UC_ht+0xb182, %rdi nop and %r15, %r15 mov $76, %rcx rep movsb nop nop nop sub %r14, %r14 lea addresses_UC_ht+0x10282, %r15 add %rsi, %rsi movb (%r15), %r14b nop nop nop nop xor $1795, %rdx lea addresses_WC_ht+0x1e5ea, %rsi lea addresses_WT_ht+0xde82, %rdi clflush (%rsi) nop nop nop nop xor %rdx, %rdx mov $76, %rcx rep movsq nop sub $65212, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %r9 push %rbx push %rsi // Store lea addresses_RW+0x8b92, %rsi nop cmp %r15, %r15 mov $0x5152535455565758, %r10 movq %r10, %xmm4 vmovups %ymm4, (%rsi) nop inc %rsi // Store lea addresses_A+0x13a82, %r13 nop nop nop nop sub %r11, %r11 mov $0x5152535455565758, %rsi movq %rsi, %xmm3 movups %xmm3, (%r13) nop nop add $61410, %r10 // Load lea addresses_A+0x4a82, %r15 nop nop inc %r9 mov (%r15), %ebx dec %r9 // Store lea addresses_normal+0x13a82, %rsi nop nop nop nop inc %r11 movb $0x51, (%rsi) nop nop nop add %r15, %r15 // Store lea addresses_UC+0x1b2e2, %r13 nop nop nop sub $2077, %r10 movw $0x5152, (%r13) nop nop nop nop nop and $22673, %r15 // Faulty Load lea addresses_RW+0x3282, %r15 nop nop nop nop add %rsi, %rsi movb (%r15), %r9b lea oracles, %rbx and $0xff, %r9 shlq $12, %r9 mov (%rbx,%r9,1), %r9 pop %rsi pop %rbx pop %r9 pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_UC', 'size': 2, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 6, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}} {'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}} {'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 */
programs/oeis/133/A133647.asm
jmorken/loda
1
95527
; A133647: A133566 * A000244. ; 1,3,12,27,108,243,972,2187,8748,19683,78732,177147,708588,1594323,6377292,14348907,57395628,129140163,516560652,1162261467,4649045868,10460353203,41841412812,94143178827,376572715308,847288609443,3389154437772,7625597484987,30502389939948,68630377364883,274521509459532,617673396283947,2470693585135788,5559060566555523 mov $1,$0 gcd $1,2 add $1,2 mov $2,$0 lpb $2 mul $1,3 sub $2,1 lpe sub $1,3 div $1,3 add $1,1
Miscaner.g4
kevin12cama/compiladores-e-interpretes-P1
1
7100
lexer grammar Miscaner; // palabras reservadas IF : ('if'|'IF'|'If')Alin; Then:('Then'|'then'|'THEN')Alin; Else:('Else'|'else'|'ELSE')Alin; While:('While'|'while'|'WHILE')Alin; Do:('Do'|'do'|'DO')Alin; Let:('Ler'|'let'|'LET')Alin; In:('IN'|'in'|'In')Alin; End:('End'|'END'|'end')Alin; Const:('Const'|'CONST'|'const')Alin; Var:('Var'|'VAR'|'var')Alin; Begin:('begin'|'BEGIN'|'Begin')Alin; Estruc:'struct'|'STRUCT'|'Struct'; Function:'FUNCTION'|'Function'|'function'; //simbolos Identifier : Letter ((Letter|Digit)*|Alin); Literal: Digit((Digit)*|Alin); Float:Digit+ (','|'.')Digit+ Alin; Operator:('+'|'-'|'*'|'/'|'%'| '>='|'<='|'=='|'='|'<'|'>'|'!=')Alin; Char:'\''('\\'(Letter|Digit|Float)|(Letter|Digit|Float)) '"'; String:'"'Char+'"'; Pyc:';'; Parnt:('(' |')')Alin; Dpig:':='Alin; Lin:'~'Alin; Dp:':'Alin; Com:'//'Alin; Comf:'*/'Alin; Comi:'/*'Alin; Pc:('['|']')Alin; Llave:('{'|'{')Alin; fragment Letter : 'a'..'z' | 'A' ..'Z'; fragment Digit : '0' ..'9'; //complejas NEXT:[\n]; TEXT : (CharContenido|[\n])+; Lines : Com CharContenido+; Alin:([\n\r\t]|' ')*; fragment CharContenido :'0'..'9' | 'A'..'Z' | 'a'..'z' | '_' | '\u00C0'..'\u00D6' | '\u00D8'..'\u00F6' | '\u00F8'..'\u02FF' | '\u0300'..'\u036F' | '\u0370'..'\u037D' | '\u037F'..'\u1FFF' | '\u200C'..'\u200D' | '\u203F'..'\u2040' | '\u2070'..'\u218F' | '\u2C00'..'\u2FEF' | '\u3001'..'\uD7FF' | '\uF900'..'\uFDCF' | '\uFDF0'..'\uFFFD' | [ \t\r]+ ; WS : [ \t\n\r] + -> skip;
src/keystore-io-headers.ads
thierr26/ada-keystore
25
12833
<reponame>thierr26/ada-keystore ----------------------------------------------------------------------- -- keystore-io-headers -- Keystore file header operations -- Copyright (C) 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Util.Encoders.SHA256; with Keystore.Buffers; package Keystore.IO.Headers is type Wallet_Storage is record Identifier : Storage_Identifier; Pos : Block_Index; Kind : Interfaces.Unsigned_16; Readonly : Boolean := False; Sealed : Boolean := False; Max_Block : Natural := 0; HMAC : Util.Encoders.SHA256.Hash_Array; end record; type Wallet_Header is limited record UUID : UUID_Type; Identifier : Storage_Identifier; Version : Natural := 0; Block_Size : Natural := 0; Data_Count : Keystore.Header_Slot_Count_Type := 0; Header_Last_Pos : Block_Index; Storage_Count : Natural := 0; HMAC : Util.Encoders.SHA256.Hash_Array; Buffer : Keystore.Buffers.Storage_Buffer; end record; -- Build a new header with the given UUID and for the storage. -- The header buffer is allocated and filled so that it can be written by Write_Header. procedure Build_Header (UUID : in UUID_Type; Storage : in Storage_Identifier; Header : in out Wallet_Header); -- Read the header block and verify its integrity. procedure Read_Header (Header : in out Wallet_Header); -- Scan the header block for the storage and call the Process procedure for each -- storage information found in the header block. procedure Scan_Storage (Header : in out Wallet_Header; Process : not null access procedure (Storage : in Wallet_Storage)); -- Sign the header block for the storage. procedure Sign_Header (Header : in out Wallet_Header; Sign : in Secret_Key); -- Set some header data in the keystore file. procedure Set_Header_Data (Header : in out Wallet_Header; Index : in Header_Slot_Index_Type; Kind : in Header_Slot_Type; Data : in Ada.Streams.Stream_Element_Array); -- Get the header data information from the keystore file. procedure Get_Header_Data (Header : in out Wallet_Header; Index : in Header_Slot_Index_Type; Kind : out Header_Slot_Type; Data : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); -- Add a new storage reference in the header and return its position in the header. -- Raises the No_Header_Slot if there is no room in the header. procedure Add_Storage (Header : in out Wallet_Header; Identifier : in Storage_Identifier; Max_Block : in Positive; Pos : out Block_Index); end Keystore.IO.Headers;
programs/oeis/239/A239745.asm
neoneye/loda
22
14938
; A239745: a(n) = (3*2^(n+2) + n*(n+5))/2 - 6. ; 0,9,25,54,108,211,411,804,1582,3129,6213,12370,24672,49263,98431,196752,393378,786613,1573065,3145950,6291700,12583179,25166115,50331964,100663638,201326961,402653581,805306794,1610613192,3221225959,6442451463,12884902440,25769804362,51539608173,103079215761,206158430902,412316861148,824633721603,1649267442475,3298534884180,6597069767550,13194139534249,26388279067605,52776558134274,105553116267568,211106232534111,422212465067151,844424930133184,1688849860265202,3377699720529189,6755399441057113,13510798882112910,27021597764224452,54043195528447483,108086391056893491,216172782113785452,432345564227569318,864691128455136993,1729382256910272285,3458764513820542810,6917529027641083800,13835058055282165719,27670116110564329495,55340232221128656984,110680464442257311898,221360928884514621661,442721857769029241121,885443715538058479974,1770887431076116957612,3541774862152233912819,7083549724304467823163,14167099448608935643780,28334198897217871284942,56668397794435742567193,113336795588871485131621,226673591177742970260402,453347182355485940517888,906694364710971881032783,1813388729421943762062495,3626777458843887524121840,7253554917687775048240450,14507109835375550096477589,29014219670751100192951785,58028439341502200385900094,116056878683004400771796628,232113757366008801543589611,464227514732017603087175491,928455029464035206174347164,1856910058928070412348690422,3713820117856140824697376849,7427640235712281649394749613,14855280471424563298789495050,29710560942849126597578985832,59421121885698253195157967303,118842243771396506390315930151,237684487542793012780631855752,475368975085586025561263706858,950737950171172051122527408973,1901475900342344102245054813105,3802951800684688204490109621270 lpb $0 add $1,$2 add $1,$0 sub $0,1 add $1,8 add $2,3 mul $2,2 lpe mov $0,$1
deps/openssl/asm_obsolete/x86-win32-masm/aes/aesni-x86.asm
nodejs/node.js-convergence
144
24827
<filename>deps/openssl/asm_obsolete/x86-win32-masm/aes/aesni-x86.asm TITLE ../openssl/crypto/aes/asm/aesni-x86.asm IF @Version LT 800 ECHO MASM version 8.00 or later is strongly recommended. ENDIF .686 .XMM IF @Version LT 800 XMMWORD STRUCT 16 DQ 2 dup (?) XMMWORD ENDS ENDIF .MODEL FLAT OPTION DOTNAME IF @Version LT 800 .text$ SEGMENT PAGE 'CODE' ELSE .text$ SEGMENT ALIGN(64) 'CODE' ENDIF ALIGN 16 _aesni_encrypt PROC PUBLIC $L_aesni_encrypt_begin:: mov eax,DWORD PTR 4[esp] mov edx,DWORD PTR 12[esp] movups xmm2,XMMWORD PTR [eax] mov ecx,DWORD PTR 240[edx] mov eax,DWORD PTR 8[esp] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L000enc1_loop_1: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L000enc1_loop_1 DB 102,15,56,221,209 movups XMMWORD PTR [eax],xmm2 ret _aesni_encrypt ENDP ALIGN 16 _aesni_decrypt PROC PUBLIC $L_aesni_decrypt_begin:: mov eax,DWORD PTR 4[esp] mov edx,DWORD PTR 12[esp] movups xmm2,XMMWORD PTR [eax] mov ecx,DWORD PTR 240[edx] mov eax,DWORD PTR 8[esp] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L001dec1_loop_2: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L001dec1_loop_2 DB 102,15,56,223,209 movups XMMWORD PTR [eax],xmm2 ret _aesni_decrypt ENDP ALIGN 16 __aesni_encrypt2 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx add ecx,16 $L002enc2_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L002enc2_loop DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,221,208 DB 102,15,56,221,216 ret __aesni_encrypt2 ENDP ALIGN 16 __aesni_decrypt2 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx add ecx,16 $L003dec2_loop: DB 102,15,56,222,209 DB 102,15,56,222,217 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,222,208 DB 102,15,56,222,216 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L003dec2_loop DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,223,208 DB 102,15,56,223,216 ret __aesni_decrypt2 ENDP ALIGN 16 __aesni_encrypt3 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx add ecx,16 $L004enc3_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 DB 102,15,56,220,224 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L004enc3_loop DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 DB 102,15,56,221,208 DB 102,15,56,221,216 DB 102,15,56,221,224 ret __aesni_encrypt3 ENDP ALIGN 16 __aesni_decrypt3 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx add ecx,16 $L005dec3_loop: DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,222,208 DB 102,15,56,222,216 DB 102,15,56,222,224 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L005dec3_loop DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 DB 102,15,56,223,208 DB 102,15,56,223,216 DB 102,15,56,223,224 ret __aesni_decrypt3 ENDP ALIGN 16 __aesni_encrypt4 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] shl ecx,4 xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 pxor xmm5,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx DB 15,31,64,0 add ecx,16 $L006enc4_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 DB 102,15,56,220,233 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 DB 102,15,56,220,224 DB 102,15,56,220,232 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L006enc4_loop DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 DB 102,15,56,220,233 DB 102,15,56,221,208 DB 102,15,56,221,216 DB 102,15,56,221,224 DB 102,15,56,221,232 ret __aesni_encrypt4 ENDP ALIGN 16 __aesni_decrypt4 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] shl ecx,4 xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 pxor xmm5,xmm0 movups xmm0,XMMWORD PTR 32[edx] lea edx,DWORD PTR 32[ecx*1+edx] neg ecx DB 15,31,64,0 add ecx,16 $L007dec4_loop: DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 DB 102,15,56,222,233 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,222,208 DB 102,15,56,222,216 DB 102,15,56,222,224 DB 102,15,56,222,232 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L007dec4_loop DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 DB 102,15,56,222,233 DB 102,15,56,223,208 DB 102,15,56,223,216 DB 102,15,56,223,224 DB 102,15,56,223,232 ret __aesni_decrypt4 ENDP ALIGN 16 __aesni_encrypt6 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 DB 102,15,56,220,209 pxor xmm5,xmm0 pxor xmm6,xmm0 DB 102,15,56,220,217 lea edx,DWORD PTR 32[ecx*1+edx] neg ecx DB 102,15,56,220,225 pxor xmm7,xmm0 add ecx,16 DB 102,15,56,220,233 DB 102,15,56,220,241 DB 102,15,56,220,249 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jmp $L_aesni_encrypt6_enter ALIGN 16 $L008enc6_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 DB 102,15,56,220,233 DB 102,15,56,220,241 DB 102,15,56,220,249 $L_aesni_encrypt6_enter:: movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 DB 102,15,56,220,224 DB 102,15,56,220,232 DB 102,15,56,220,240 DB 102,15,56,220,248 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L008enc6_loop DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 DB 102,15,56,220,233 DB 102,15,56,220,241 DB 102,15,56,220,249 DB 102,15,56,221,208 DB 102,15,56,221,216 DB 102,15,56,221,224 DB 102,15,56,221,232 DB 102,15,56,221,240 DB 102,15,56,221,248 ret __aesni_encrypt6 ENDP ALIGN 16 __aesni_decrypt6 PROC PRIVATE movups xmm0,XMMWORD PTR [edx] shl ecx,4 movups xmm1,XMMWORD PTR 16[edx] xorps xmm2,xmm0 pxor xmm3,xmm0 pxor xmm4,xmm0 DB 102,15,56,222,209 pxor xmm5,xmm0 pxor xmm6,xmm0 DB 102,15,56,222,217 lea edx,DWORD PTR 32[ecx*1+edx] neg ecx DB 102,15,56,222,225 pxor xmm7,xmm0 add ecx,16 DB 102,15,56,222,233 DB 102,15,56,222,241 DB 102,15,56,222,249 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jmp $L_aesni_decrypt6_enter ALIGN 16 $L009dec6_loop: DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 DB 102,15,56,222,233 DB 102,15,56,222,241 DB 102,15,56,222,249 $L_aesni_decrypt6_enter:: movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,222,208 DB 102,15,56,222,216 DB 102,15,56,222,224 DB 102,15,56,222,232 DB 102,15,56,222,240 DB 102,15,56,222,248 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L009dec6_loop DB 102,15,56,222,209 DB 102,15,56,222,217 DB 102,15,56,222,225 DB 102,15,56,222,233 DB 102,15,56,222,241 DB 102,15,56,222,249 DB 102,15,56,223,208 DB 102,15,56,223,216 DB 102,15,56,223,224 DB 102,15,56,223,232 DB 102,15,56,223,240 DB 102,15,56,223,248 ret __aesni_decrypt6 ENDP ALIGN 16 _aesni_ecb_encrypt PROC PUBLIC $L_aesni_ecb_encrypt_begin:: push ebp push ebx push esi push edi mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebx,DWORD PTR 36[esp] and eax,-16 jz $L010ecb_ret mov ecx,DWORD PTR 240[edx] test ebx,ebx jz $L011ecb_decrypt mov ebp,edx mov ebx,ecx cmp eax,96 jb $L012ecb_enc_tail movdqu xmm2,XMMWORD PTR [esi] movdqu xmm3,XMMWORD PTR 16[esi] movdqu xmm4,XMMWORD PTR 32[esi] movdqu xmm5,XMMWORD PTR 48[esi] movdqu xmm6,XMMWORD PTR 64[esi] movdqu xmm7,XMMWORD PTR 80[esi] lea esi,DWORD PTR 96[esi] sub eax,96 jmp $L013ecb_enc_loop6_enter ALIGN 16 $L014ecb_enc_loop6: movups XMMWORD PTR [edi],xmm2 movdqu xmm2,XMMWORD PTR [esi] movups XMMWORD PTR 16[edi],xmm3 movdqu xmm3,XMMWORD PTR 16[esi] movups XMMWORD PTR 32[edi],xmm4 movdqu xmm4,XMMWORD PTR 32[esi] movups XMMWORD PTR 48[edi],xmm5 movdqu xmm5,XMMWORD PTR 48[esi] movups XMMWORD PTR 64[edi],xmm6 movdqu xmm6,XMMWORD PTR 64[esi] movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] movdqu xmm7,XMMWORD PTR 80[esi] lea esi,DWORD PTR 96[esi] $L013ecb_enc_loop6_enter: call __aesni_encrypt6 mov edx,ebp mov ecx,ebx sub eax,96 jnc $L014ecb_enc_loop6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] add eax,96 jz $L010ecb_ret $L012ecb_enc_tail: movups xmm2,XMMWORD PTR [esi] cmp eax,32 jb $L015ecb_enc_one movups xmm3,XMMWORD PTR 16[esi] je $L016ecb_enc_two movups xmm4,XMMWORD PTR 32[esi] cmp eax,64 jb $L017ecb_enc_three movups xmm5,XMMWORD PTR 48[esi] je $L018ecb_enc_four movups xmm6,XMMWORD PTR 64[esi] xorps xmm7,xmm7 call __aesni_encrypt6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 jmp $L010ecb_ret ALIGN 16 $L015ecb_enc_one: movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L019enc1_loop_3: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L019enc1_loop_3 DB 102,15,56,221,209 movups XMMWORD PTR [edi],xmm2 jmp $L010ecb_ret ALIGN 16 $L016ecb_enc_two: call __aesni_encrypt2 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 jmp $L010ecb_ret ALIGN 16 $L017ecb_enc_three: call __aesni_encrypt3 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 jmp $L010ecb_ret ALIGN 16 $L018ecb_enc_four: call __aesni_encrypt4 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 jmp $L010ecb_ret ALIGN 16 $L011ecb_decrypt: mov ebp,edx mov ebx,ecx cmp eax,96 jb $L020ecb_dec_tail movdqu xmm2,XMMWORD PTR [esi] movdqu xmm3,XMMWORD PTR 16[esi] movdqu xmm4,XMMWORD PTR 32[esi] movdqu xmm5,XMMWORD PTR 48[esi] movdqu xmm6,XMMWORD PTR 64[esi] movdqu xmm7,XMMWORD PTR 80[esi] lea esi,DWORD PTR 96[esi] sub eax,96 jmp $L021ecb_dec_loop6_enter ALIGN 16 $L022ecb_dec_loop6: movups XMMWORD PTR [edi],xmm2 movdqu xmm2,XMMWORD PTR [esi] movups XMMWORD PTR 16[edi],xmm3 movdqu xmm3,XMMWORD PTR 16[esi] movups XMMWORD PTR 32[edi],xmm4 movdqu xmm4,XMMWORD PTR 32[esi] movups XMMWORD PTR 48[edi],xmm5 movdqu xmm5,XMMWORD PTR 48[esi] movups XMMWORD PTR 64[edi],xmm6 movdqu xmm6,XMMWORD PTR 64[esi] movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] movdqu xmm7,XMMWORD PTR 80[esi] lea esi,DWORD PTR 96[esi] $L021ecb_dec_loop6_enter: call __aesni_decrypt6 mov edx,ebp mov ecx,ebx sub eax,96 jnc $L022ecb_dec_loop6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] add eax,96 jz $L010ecb_ret $L020ecb_dec_tail: movups xmm2,XMMWORD PTR [esi] cmp eax,32 jb $L023ecb_dec_one movups xmm3,XMMWORD PTR 16[esi] je $L024ecb_dec_two movups xmm4,XMMWORD PTR 32[esi] cmp eax,64 jb $L025ecb_dec_three movups xmm5,XMMWORD PTR 48[esi] je $L026ecb_dec_four movups xmm6,XMMWORD PTR 64[esi] xorps xmm7,xmm7 call __aesni_decrypt6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 jmp $L010ecb_ret ALIGN 16 $L023ecb_dec_one: movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L027dec1_loop_4: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L027dec1_loop_4 DB 102,15,56,223,209 movups XMMWORD PTR [edi],xmm2 jmp $L010ecb_ret ALIGN 16 $L024ecb_dec_two: call __aesni_decrypt2 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 jmp $L010ecb_ret ALIGN 16 $L025ecb_dec_three: call __aesni_decrypt3 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 jmp $L010ecb_ret ALIGN 16 $L026ecb_dec_four: call __aesni_decrypt4 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 $L010ecb_ret: pop edi pop esi pop ebx pop ebp ret _aesni_ecb_encrypt ENDP ALIGN 16 _aesni_ccm64_encrypt_blocks PROC PUBLIC $L_aesni_ccm64_encrypt_blocks_begin:: push ebp push ebx push esi push edi mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebx,DWORD PTR 36[esp] mov ecx,DWORD PTR 40[esp] mov ebp,esp sub esp,60 and esp,-16 mov DWORD PTR 48[esp],ebp movdqu xmm7,XMMWORD PTR [ebx] movdqu xmm3,XMMWORD PTR [ecx] mov ecx,DWORD PTR 240[edx] mov DWORD PTR [esp],202182159 mov DWORD PTR 4[esp],134810123 mov DWORD PTR 8[esp],67438087 mov DWORD PTR 12[esp],66051 mov ebx,1 xor ebp,ebp mov DWORD PTR 16[esp],ebx mov DWORD PTR 20[esp],ebp mov DWORD PTR 24[esp],ebp mov DWORD PTR 28[esp],ebp shl ecx,4 mov ebx,16 lea ebp,DWORD PTR [edx] movdqa xmm5,XMMWORD PTR [esp] movdqa xmm2,xmm7 lea edx,DWORD PTR 32[ecx*1+edx] sub ebx,ecx DB 102,15,56,0,253 $L028ccm64_enc_outer: movups xmm0,XMMWORD PTR [ebp] mov ecx,ebx movups xmm6,XMMWORD PTR [esi] xorps xmm2,xmm0 movups xmm1,XMMWORD PTR 16[ebp] xorps xmm0,xmm6 xorps xmm3,xmm0 movups xmm0,XMMWORD PTR 32[ebp] $L029ccm64_enc2_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L029ccm64_enc2_loop DB 102,15,56,220,209 DB 102,15,56,220,217 paddq xmm7,XMMWORD PTR 16[esp] dec eax DB 102,15,56,221,208 DB 102,15,56,221,216 lea esi,DWORD PTR 16[esi] xorps xmm6,xmm2 movdqa xmm2,xmm7 movups XMMWORD PTR [edi],xmm6 DB 102,15,56,0,213 lea edi,DWORD PTR 16[edi] jnz $L028ccm64_enc_outer mov esp,DWORD PTR 48[esp] mov edi,DWORD PTR 40[esp] movups XMMWORD PTR [edi],xmm3 pop edi pop esi pop ebx pop ebp ret _aesni_ccm64_encrypt_blocks ENDP ALIGN 16 _aesni_ccm64_decrypt_blocks PROC PUBLIC $L_aesni_ccm64_decrypt_blocks_begin:: push ebp push ebx push esi push edi mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebx,DWORD PTR 36[esp] mov ecx,DWORD PTR 40[esp] mov ebp,esp sub esp,60 and esp,-16 mov DWORD PTR 48[esp],ebp movdqu xmm7,XMMWORD PTR [ebx] movdqu xmm3,XMMWORD PTR [ecx] mov ecx,DWORD PTR 240[edx] mov DWORD PTR [esp],202182159 mov DWORD PTR 4[esp],134810123 mov DWORD PTR 8[esp],67438087 mov DWORD PTR 12[esp],66051 mov ebx,1 xor ebp,ebp mov DWORD PTR 16[esp],ebx mov DWORD PTR 20[esp],ebp mov DWORD PTR 24[esp],ebp mov DWORD PTR 28[esp],ebp movdqa xmm5,XMMWORD PTR [esp] movdqa xmm2,xmm7 mov ebp,edx mov ebx,ecx DB 102,15,56,0,253 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L030enc1_loop_5: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L030enc1_loop_5 DB 102,15,56,221,209 shl ebx,4 mov ecx,16 movups xmm6,XMMWORD PTR [esi] paddq xmm7,XMMWORD PTR 16[esp] lea esi,QWORD PTR 16[esi] sub ecx,ebx lea edx,DWORD PTR 32[ebx*1+ebp] mov ebx,ecx jmp $L031ccm64_dec_outer ALIGN 16 $L031ccm64_dec_outer: xorps xmm6,xmm2 movdqa xmm2,xmm7 movups XMMWORD PTR [edi],xmm6 lea edi,DWORD PTR 16[edi] DB 102,15,56,0,213 sub eax,1 jz $L032ccm64_dec_break movups xmm0,XMMWORD PTR [ebp] mov ecx,ebx movups xmm1,XMMWORD PTR 16[ebp] xorps xmm6,xmm0 xorps xmm2,xmm0 xorps xmm3,xmm6 movups xmm0,XMMWORD PTR 32[ebp] $L033ccm64_dec2_loop: DB 102,15,56,220,209 DB 102,15,56,220,217 movups xmm1,XMMWORD PTR [ecx*1+edx] add ecx,32 DB 102,15,56,220,208 DB 102,15,56,220,216 movups xmm0,XMMWORD PTR [ecx*1+edx-16] jnz $L033ccm64_dec2_loop movups xmm6,XMMWORD PTR [esi] paddq xmm7,XMMWORD PTR 16[esp] DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,221,208 DB 102,15,56,221,216 lea esi,QWORD PTR 16[esi] jmp $L031ccm64_dec_outer ALIGN 16 $L032ccm64_dec_break: mov ecx,DWORD PTR 240[ebp] mov edx,ebp movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] xorps xmm6,xmm0 lea edx,DWORD PTR 32[edx] xorps xmm3,xmm6 $L034enc1_loop_6: DB 102,15,56,220,217 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L034enc1_loop_6 DB 102,15,56,221,217 mov esp,DWORD PTR 48[esp] mov edi,DWORD PTR 40[esp] movups XMMWORD PTR [edi],xmm3 pop edi pop esi pop ebx pop ebp ret _aesni_ccm64_decrypt_blocks ENDP ALIGN 16 _aesni_ctr32_encrypt_blocks PROC PUBLIC $L_aesni_ctr32_encrypt_blocks_begin:: push ebp push ebx push esi push edi mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebx,DWORD PTR 36[esp] mov ebp,esp sub esp,88 and esp,-16 mov DWORD PTR 80[esp],ebp cmp eax,1 je $L035ctr32_one_shortcut movdqu xmm7,XMMWORD PTR [ebx] mov DWORD PTR [esp],202182159 mov DWORD PTR 4[esp],134810123 mov DWORD PTR 8[esp],67438087 mov DWORD PTR 12[esp],66051 mov ecx,6 xor ebp,ebp mov DWORD PTR 16[esp],ecx mov DWORD PTR 20[esp],ecx mov DWORD PTR 24[esp],ecx mov DWORD PTR 28[esp],ebp DB 102,15,58,22,251,3 DB 102,15,58,34,253,3 mov ecx,DWORD PTR 240[edx] bswap ebx pxor xmm0,xmm0 pxor xmm1,xmm1 movdqa xmm2,XMMWORD PTR [esp] DB 102,15,58,34,195,0 lea ebp,DWORD PTR 3[ebx] DB 102,15,58,34,205,0 inc ebx DB 102,15,58,34,195,1 inc ebp DB 102,15,58,34,205,1 inc ebx DB 102,15,58,34,195,2 inc ebp DB 102,15,58,34,205,2 movdqa XMMWORD PTR 48[esp],xmm0 DB 102,15,56,0,194 movdqu xmm6,XMMWORD PTR [edx] movdqa XMMWORD PTR 64[esp],xmm1 DB 102,15,56,0,202 pshufd xmm2,xmm0,192 pshufd xmm3,xmm0,128 cmp eax,6 jb $L036ctr32_tail pxor xmm7,xmm6 shl ecx,4 mov ebx,16 movdqa XMMWORD PTR 32[esp],xmm7 mov ebp,edx sub ebx,ecx lea edx,DWORD PTR 32[ecx*1+edx] sub eax,6 jmp $L037ctr32_loop6 ALIGN 16 $L037ctr32_loop6: pshufd xmm4,xmm0,64 movdqa xmm0,XMMWORD PTR 32[esp] pshufd xmm5,xmm1,192 pxor xmm2,xmm0 pshufd xmm6,xmm1,128 pxor xmm3,xmm0 pshufd xmm7,xmm1,64 movups xmm1,XMMWORD PTR 16[ebp] pxor xmm4,xmm0 pxor xmm5,xmm0 DB 102,15,56,220,209 pxor xmm6,xmm0 pxor xmm7,xmm0 DB 102,15,56,220,217 movups xmm0,XMMWORD PTR 32[ebp] mov ecx,ebx DB 102,15,56,220,225 DB 102,15,56,220,233 DB 102,15,56,220,241 DB 102,15,56,220,249 call $L_aesni_encrypt6_enter movups xmm1,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR 16[esi] xorps xmm2,xmm1 movups xmm1,XMMWORD PTR 32[esi] xorps xmm3,xmm0 movups XMMWORD PTR [edi],xmm2 movdqa xmm0,XMMWORD PTR 16[esp] xorps xmm4,xmm1 movdqa xmm1,XMMWORD PTR 64[esp] movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 paddd xmm1,xmm0 paddd xmm0,XMMWORD PTR 48[esp] movdqa xmm2,XMMWORD PTR [esp] movups xmm3,XMMWORD PTR 48[esi] movups xmm4,XMMWORD PTR 64[esi] xorps xmm5,xmm3 movups xmm3,XMMWORD PTR 80[esi] lea esi,DWORD PTR 96[esi] movdqa XMMWORD PTR 48[esp],xmm0 DB 102,15,56,0,194 xorps xmm6,xmm4 movups XMMWORD PTR 48[edi],xmm5 xorps xmm7,xmm3 movdqa XMMWORD PTR 64[esp],xmm1 DB 102,15,56,0,202 movups XMMWORD PTR 64[edi],xmm6 pshufd xmm2,xmm0,192 movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] pshufd xmm3,xmm0,128 sub eax,6 jnc $L037ctr32_loop6 add eax,6 jz $L038ctr32_ret movdqu xmm7,XMMWORD PTR [ebp] mov edx,ebp pxor xmm7,XMMWORD PTR 32[esp] mov ecx,DWORD PTR 240[ebp] $L036ctr32_tail: por xmm2,xmm7 cmp eax,2 jb $L039ctr32_one pshufd xmm4,xmm0,64 por xmm3,xmm7 je $L040ctr32_two pshufd xmm5,xmm1,192 por xmm4,xmm7 cmp eax,4 jb $L041ctr32_three pshufd xmm6,xmm1,128 por xmm5,xmm7 je $L042ctr32_four por xmm6,xmm7 call __aesni_encrypt6 movups xmm1,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR 16[esi] xorps xmm2,xmm1 movups xmm1,XMMWORD PTR 32[esi] xorps xmm3,xmm0 movups xmm0,XMMWORD PTR 48[esi] xorps xmm4,xmm1 movups xmm1,XMMWORD PTR 64[esi] xorps xmm5,xmm0 movups XMMWORD PTR [edi],xmm2 xorps xmm6,xmm1 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 jmp $L038ctr32_ret ALIGN 16 $L035ctr32_one_shortcut: movups xmm2,XMMWORD PTR [ebx] mov ecx,DWORD PTR 240[edx] $L039ctr32_one: movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L043enc1_loop_7: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L043enc1_loop_7 DB 102,15,56,221,209 movups xmm6,XMMWORD PTR [esi] xorps xmm6,xmm2 movups XMMWORD PTR [edi],xmm6 jmp $L038ctr32_ret ALIGN 16 $L040ctr32_two: call __aesni_encrypt2 movups xmm5,XMMWORD PTR [esi] movups xmm6,XMMWORD PTR 16[esi] xorps xmm2,xmm5 xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 jmp $L038ctr32_ret ALIGN 16 $L041ctr32_three: call __aesni_encrypt3 movups xmm5,XMMWORD PTR [esi] movups xmm6,XMMWORD PTR 16[esi] xorps xmm2,xmm5 movups xmm7,XMMWORD PTR 32[esi] xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 xorps xmm4,xmm7 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 jmp $L038ctr32_ret ALIGN 16 $L042ctr32_four: call __aesni_encrypt4 movups xmm6,XMMWORD PTR [esi] movups xmm7,XMMWORD PTR 16[esi] movups xmm1,XMMWORD PTR 32[esi] xorps xmm2,xmm6 movups xmm0,XMMWORD PTR 48[esi] xorps xmm3,xmm7 movups XMMWORD PTR [edi],xmm2 xorps xmm4,xmm1 movups XMMWORD PTR 16[edi],xmm3 xorps xmm5,xmm0 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 $L038ctr32_ret: mov esp,DWORD PTR 80[esp] pop edi pop esi pop ebx pop ebp ret _aesni_ctr32_encrypt_blocks ENDP ALIGN 16 _aesni_xts_encrypt PROC PUBLIC $L_aesni_xts_encrypt_begin:: push ebp push ebx push esi push edi mov edx,DWORD PTR 36[esp] mov esi,DWORD PTR 40[esp] mov ecx,DWORD PTR 240[edx] movups xmm2,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L044enc1_loop_8: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L044enc1_loop_8 DB 102,15,56,221,209 mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebp,esp sub esp,120 mov ecx,DWORD PTR 240[edx] and esp,-16 mov DWORD PTR 96[esp],135 mov DWORD PTR 100[esp],0 mov DWORD PTR 104[esp],1 mov DWORD PTR 108[esp],0 mov DWORD PTR 112[esp],eax mov DWORD PTR 116[esp],ebp movdqa xmm1,xmm2 pxor xmm0,xmm0 movdqa xmm3,XMMWORD PTR 96[esp] pcmpgtd xmm0,xmm1 and eax,-16 mov ebp,edx mov ebx,ecx sub eax,96 jc $L045xts_enc_short shl ecx,4 mov ebx,16 sub ebx,ecx lea edx,DWORD PTR 32[ecx*1+edx] jmp $L046xts_enc_loop6 ALIGN 16 $L046xts_enc_loop6: pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR [esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 16[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 32[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 48[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm7,xmm0,19 movdqa XMMWORD PTR 64[esp],xmm1 paddq xmm1,xmm1 movups xmm0,XMMWORD PTR [ebp] pand xmm7,xmm3 movups xmm2,XMMWORD PTR [esi] pxor xmm7,xmm1 mov ecx,ebx movdqu xmm3,XMMWORD PTR 16[esi] xorps xmm2,xmm0 movdqu xmm4,XMMWORD PTR 32[esi] pxor xmm3,xmm0 movdqu xmm5,XMMWORD PTR 48[esi] pxor xmm4,xmm0 movdqu xmm6,XMMWORD PTR 64[esi] pxor xmm5,xmm0 movdqu xmm1,XMMWORD PTR 80[esi] pxor xmm6,xmm0 lea esi,DWORD PTR 96[esi] pxor xmm2,XMMWORD PTR [esp] movdqa XMMWORD PTR 80[esp],xmm7 pxor xmm7,xmm1 movups xmm1,XMMWORD PTR 16[ebp] pxor xmm3,XMMWORD PTR 16[esp] pxor xmm4,XMMWORD PTR 32[esp] DB 102,15,56,220,209 pxor xmm5,XMMWORD PTR 48[esp] pxor xmm6,XMMWORD PTR 64[esp] DB 102,15,56,220,217 pxor xmm7,xmm0 movups xmm0,XMMWORD PTR 32[ebp] DB 102,15,56,220,225 DB 102,15,56,220,233 DB 102,15,56,220,241 DB 102,15,56,220,249 call $L_aesni_encrypt6_enter movdqa xmm1,XMMWORD PTR 80[esp] pxor xmm0,xmm0 xorps xmm2,XMMWORD PTR [esp] pcmpgtd xmm0,xmm1 xorps xmm3,XMMWORD PTR 16[esp] movups XMMWORD PTR [edi],xmm2 xorps xmm4,XMMWORD PTR 32[esp] movups XMMWORD PTR 16[edi],xmm3 xorps xmm5,XMMWORD PTR 48[esp] movups XMMWORD PTR 32[edi],xmm4 xorps xmm6,XMMWORD PTR 64[esp] movups XMMWORD PTR 48[edi],xmm5 xorps xmm7,xmm1 movups XMMWORD PTR 64[edi],xmm6 pshufd xmm2,xmm0,19 movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] movdqa xmm3,XMMWORD PTR 96[esp] pxor xmm0,xmm0 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 sub eax,96 jnc $L046xts_enc_loop6 mov ecx,DWORD PTR 240[ebp] mov edx,ebp mov ebx,ecx $L045xts_enc_short: add eax,96 jz $L047xts_enc_done6x movdqa xmm5,xmm1 cmp eax,32 jb $L048xts_enc_one pshufd xmm2,xmm0,19 pxor xmm0,xmm0 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 je $L049xts_enc_two pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa xmm6,xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 cmp eax,64 jb $L050xts_enc_three pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa xmm7,xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 movdqa XMMWORD PTR [esp],xmm5 movdqa XMMWORD PTR 16[esp],xmm6 je $L051xts_enc_four movdqa XMMWORD PTR 32[esp],xmm7 pshufd xmm7,xmm0,19 movdqa XMMWORD PTR 48[esp],xmm1 paddq xmm1,xmm1 pand xmm7,xmm3 pxor xmm7,xmm1 movdqu xmm2,XMMWORD PTR [esi] movdqu xmm3,XMMWORD PTR 16[esi] movdqu xmm4,XMMWORD PTR 32[esi] pxor xmm2,XMMWORD PTR [esp] movdqu xmm5,XMMWORD PTR 48[esi] pxor xmm3,XMMWORD PTR 16[esp] movdqu xmm6,XMMWORD PTR 64[esi] pxor xmm4,XMMWORD PTR 32[esp] lea esi,DWORD PTR 80[esi] pxor xmm5,XMMWORD PTR 48[esp] movdqa XMMWORD PTR 64[esp],xmm7 pxor xmm6,xmm7 call __aesni_encrypt6 movaps xmm1,XMMWORD PTR 64[esp] xorps xmm2,XMMWORD PTR [esp] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,XMMWORD PTR 32[esp] movups XMMWORD PTR [edi],xmm2 xorps xmm5,XMMWORD PTR 48[esp] movups XMMWORD PTR 16[edi],xmm3 xorps xmm6,xmm1 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 lea edi,DWORD PTR 80[edi] jmp $L052xts_enc_done ALIGN 16 $L048xts_enc_one: movups xmm2,XMMWORD PTR [esi] lea esi,DWORD PTR 16[esi] xorps xmm2,xmm5 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L053enc1_loop_9: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L053enc1_loop_9 DB 102,15,56,221,209 xorps xmm2,xmm5 movups XMMWORD PTR [edi],xmm2 lea edi,DWORD PTR 16[edi] movdqa xmm1,xmm5 jmp $L052xts_enc_done ALIGN 16 $L049xts_enc_two: movaps xmm6,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] lea esi,DWORD PTR 32[esi] xorps xmm2,xmm5 xorps xmm3,xmm6 call __aesni_encrypt2 xorps xmm2,xmm5 xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 lea edi,DWORD PTR 32[edi] movdqa xmm1,xmm6 jmp $L052xts_enc_done ALIGN 16 $L050xts_enc_three: movaps xmm7,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] movups xmm4,XMMWORD PTR 32[esi] lea esi,DWORD PTR 48[esi] xorps xmm2,xmm5 xorps xmm3,xmm6 xorps xmm4,xmm7 call __aesni_encrypt3 xorps xmm2,xmm5 xorps xmm3,xmm6 xorps xmm4,xmm7 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 lea edi,DWORD PTR 48[edi] movdqa xmm1,xmm7 jmp $L052xts_enc_done ALIGN 16 $L051xts_enc_four: movaps xmm6,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] movups xmm4,XMMWORD PTR 32[esi] xorps xmm2,XMMWORD PTR [esp] movups xmm5,XMMWORD PTR 48[esi] lea esi,DWORD PTR 64[esi] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,xmm7 xorps xmm5,xmm6 call __aesni_encrypt4 xorps xmm2,XMMWORD PTR [esp] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,xmm7 movups XMMWORD PTR [edi],xmm2 xorps xmm5,xmm6 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 lea edi,DWORD PTR 64[edi] movdqa xmm1,xmm6 jmp $L052xts_enc_done ALIGN 16 $L047xts_enc_done6x: mov eax,DWORD PTR 112[esp] and eax,15 jz $L054xts_enc_ret movdqa xmm5,xmm1 mov DWORD PTR 112[esp],eax jmp $L055xts_enc_steal ALIGN 16 $L052xts_enc_done: mov eax,DWORD PTR 112[esp] pxor xmm0,xmm0 and eax,15 jz $L054xts_enc_ret pcmpgtd xmm0,xmm1 mov DWORD PTR 112[esp],eax pshufd xmm5,xmm0,19 paddq xmm1,xmm1 pand xmm5,XMMWORD PTR 96[esp] pxor xmm5,xmm1 $L055xts_enc_steal: movzx ecx,BYTE PTR [esi] movzx edx,BYTE PTR [edi-16] lea esi,DWORD PTR 1[esi] mov BYTE PTR [edi-16],cl mov BYTE PTR [edi],dl lea edi,DWORD PTR 1[edi] sub eax,1 jnz $L055xts_enc_steal sub edi,DWORD PTR 112[esp] mov edx,ebp mov ecx,ebx movups xmm2,XMMWORD PTR [edi-16] xorps xmm2,xmm5 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L056enc1_loop_10: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L056enc1_loop_10 DB 102,15,56,221,209 xorps xmm2,xmm5 movups XMMWORD PTR [edi-16],xmm2 $L054xts_enc_ret: mov esp,DWORD PTR 116[esp] pop edi pop esi pop ebx pop ebp ret _aesni_xts_encrypt ENDP ALIGN 16 _aesni_xts_decrypt PROC PUBLIC $L_aesni_xts_decrypt_begin:: push ebp push ebx push esi push edi mov edx,DWORD PTR 36[esp] mov esi,DWORD PTR 40[esp] mov ecx,DWORD PTR 240[edx] movups xmm2,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L057enc1_loop_11: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L057enc1_loop_11 DB 102,15,56,221,209 mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov eax,DWORD PTR 28[esp] mov edx,DWORD PTR 32[esp] mov ebp,esp sub esp,120 and esp,-16 xor ebx,ebx test eax,15 setnz bl shl ebx,4 sub eax,ebx mov DWORD PTR 96[esp],135 mov DWORD PTR 100[esp],0 mov DWORD PTR 104[esp],1 mov DWORD PTR 108[esp],0 mov DWORD PTR 112[esp],eax mov DWORD PTR 116[esp],ebp mov ecx,DWORD PTR 240[edx] mov ebp,edx mov ebx,ecx movdqa xmm1,xmm2 pxor xmm0,xmm0 movdqa xmm3,XMMWORD PTR 96[esp] pcmpgtd xmm0,xmm1 and eax,-16 sub eax,96 jc $L058xts_dec_short shl ecx,4 mov ebx,16 sub ebx,ecx lea edx,DWORD PTR 32[ecx*1+edx] jmp $L059xts_dec_loop6 ALIGN 16 $L059xts_dec_loop6: pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR [esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 16[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 32[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa XMMWORD PTR 48[esp],xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 pshufd xmm7,xmm0,19 movdqa XMMWORD PTR 64[esp],xmm1 paddq xmm1,xmm1 movups xmm0,XMMWORD PTR [ebp] pand xmm7,xmm3 movups xmm2,XMMWORD PTR [esi] pxor xmm7,xmm1 mov ecx,ebx movdqu xmm3,XMMWORD PTR 16[esi] xorps xmm2,xmm0 movdqu xmm4,XMMWORD PTR 32[esi] pxor xmm3,xmm0 movdqu xmm5,XMMWORD PTR 48[esi] pxor xmm4,xmm0 movdqu xmm6,XMMWORD PTR 64[esi] pxor xmm5,xmm0 movdqu xmm1,XMMWORD PTR 80[esi] pxor xmm6,xmm0 lea esi,DWORD PTR 96[esi] pxor xmm2,XMMWORD PTR [esp] movdqa XMMWORD PTR 80[esp],xmm7 pxor xmm7,xmm1 movups xmm1,XMMWORD PTR 16[ebp] pxor xmm3,XMMWORD PTR 16[esp] pxor xmm4,XMMWORD PTR 32[esp] DB 102,15,56,222,209 pxor xmm5,XMMWORD PTR 48[esp] pxor xmm6,XMMWORD PTR 64[esp] DB 102,15,56,222,217 pxor xmm7,xmm0 movups xmm0,XMMWORD PTR 32[ebp] DB 102,15,56,222,225 DB 102,15,56,222,233 DB 102,15,56,222,241 DB 102,15,56,222,249 call $L_aesni_decrypt6_enter movdqa xmm1,XMMWORD PTR 80[esp] pxor xmm0,xmm0 xorps xmm2,XMMWORD PTR [esp] pcmpgtd xmm0,xmm1 xorps xmm3,XMMWORD PTR 16[esp] movups XMMWORD PTR [edi],xmm2 xorps xmm4,XMMWORD PTR 32[esp] movups XMMWORD PTR 16[edi],xmm3 xorps xmm5,XMMWORD PTR 48[esp] movups XMMWORD PTR 32[edi],xmm4 xorps xmm6,XMMWORD PTR 64[esp] movups XMMWORD PTR 48[edi],xmm5 xorps xmm7,xmm1 movups XMMWORD PTR 64[edi],xmm6 pshufd xmm2,xmm0,19 movups XMMWORD PTR 80[edi],xmm7 lea edi,DWORD PTR 96[edi] movdqa xmm3,XMMWORD PTR 96[esp] pxor xmm0,xmm0 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 sub eax,96 jnc $L059xts_dec_loop6 mov ecx,DWORD PTR 240[ebp] mov edx,ebp mov ebx,ecx $L058xts_dec_short: add eax,96 jz $L060xts_dec_done6x movdqa xmm5,xmm1 cmp eax,32 jb $L061xts_dec_one pshufd xmm2,xmm0,19 pxor xmm0,xmm0 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 je $L062xts_dec_two pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa xmm6,xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 cmp eax,64 jb $L063xts_dec_three pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa xmm7,xmm1 paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 movdqa XMMWORD PTR [esp],xmm5 movdqa XMMWORD PTR 16[esp],xmm6 je $L064xts_dec_four movdqa XMMWORD PTR 32[esp],xmm7 pshufd xmm7,xmm0,19 movdqa XMMWORD PTR 48[esp],xmm1 paddq xmm1,xmm1 pand xmm7,xmm3 pxor xmm7,xmm1 movdqu xmm2,XMMWORD PTR [esi] movdqu xmm3,XMMWORD PTR 16[esi] movdqu xmm4,XMMWORD PTR 32[esi] pxor xmm2,XMMWORD PTR [esp] movdqu xmm5,XMMWORD PTR 48[esi] pxor xmm3,XMMWORD PTR 16[esp] movdqu xmm6,XMMWORD PTR 64[esi] pxor xmm4,XMMWORD PTR 32[esp] lea esi,DWORD PTR 80[esi] pxor xmm5,XMMWORD PTR 48[esp] movdqa XMMWORD PTR 64[esp],xmm7 pxor xmm6,xmm7 call __aesni_decrypt6 movaps xmm1,XMMWORD PTR 64[esp] xorps xmm2,XMMWORD PTR [esp] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,XMMWORD PTR 32[esp] movups XMMWORD PTR [edi],xmm2 xorps xmm5,XMMWORD PTR 48[esp] movups XMMWORD PTR 16[edi],xmm3 xorps xmm6,xmm1 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 movups XMMWORD PTR 64[edi],xmm6 lea edi,DWORD PTR 80[edi] jmp $L065xts_dec_done ALIGN 16 $L061xts_dec_one: movups xmm2,XMMWORD PTR [esi] lea esi,DWORD PTR 16[esi] xorps xmm2,xmm5 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L066dec1_loop_12: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L066dec1_loop_12 DB 102,15,56,223,209 xorps xmm2,xmm5 movups XMMWORD PTR [edi],xmm2 lea edi,DWORD PTR 16[edi] movdqa xmm1,xmm5 jmp $L065xts_dec_done ALIGN 16 $L062xts_dec_two: movaps xmm6,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] lea esi,DWORD PTR 32[esi] xorps xmm2,xmm5 xorps xmm3,xmm6 call __aesni_decrypt2 xorps xmm2,xmm5 xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 lea edi,DWORD PTR 32[edi] movdqa xmm1,xmm6 jmp $L065xts_dec_done ALIGN 16 $L063xts_dec_three: movaps xmm7,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] movups xmm4,XMMWORD PTR 32[esi] lea esi,DWORD PTR 48[esi] xorps xmm2,xmm5 xorps xmm3,xmm6 xorps xmm4,xmm7 call __aesni_decrypt3 xorps xmm2,xmm5 xorps xmm3,xmm6 xorps xmm4,xmm7 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 lea edi,DWORD PTR 48[edi] movdqa xmm1,xmm7 jmp $L065xts_dec_done ALIGN 16 $L064xts_dec_four: movaps xmm6,xmm1 movups xmm2,XMMWORD PTR [esi] movups xmm3,XMMWORD PTR 16[esi] movups xmm4,XMMWORD PTR 32[esi] xorps xmm2,XMMWORD PTR [esp] movups xmm5,XMMWORD PTR 48[esi] lea esi,DWORD PTR 64[esi] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,xmm7 xorps xmm5,xmm6 call __aesni_decrypt4 xorps xmm2,XMMWORD PTR [esp] xorps xmm3,XMMWORD PTR 16[esp] xorps xmm4,xmm7 movups XMMWORD PTR [edi],xmm2 xorps xmm5,xmm6 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 lea edi,DWORD PTR 64[edi] movdqa xmm1,xmm6 jmp $L065xts_dec_done ALIGN 16 $L060xts_dec_done6x: mov eax,DWORD PTR 112[esp] and eax,15 jz $L067xts_dec_ret mov DWORD PTR 112[esp],eax jmp $L068xts_dec_only_one_more ALIGN 16 $L065xts_dec_done: mov eax,DWORD PTR 112[esp] pxor xmm0,xmm0 and eax,15 jz $L067xts_dec_ret pcmpgtd xmm0,xmm1 mov DWORD PTR 112[esp],eax pshufd xmm2,xmm0,19 pxor xmm0,xmm0 movdqa xmm3,XMMWORD PTR 96[esp] paddq xmm1,xmm1 pand xmm2,xmm3 pcmpgtd xmm0,xmm1 pxor xmm1,xmm2 $L068xts_dec_only_one_more: pshufd xmm5,xmm0,19 movdqa xmm6,xmm1 paddq xmm1,xmm1 pand xmm5,xmm3 pxor xmm5,xmm1 mov edx,ebp mov ecx,ebx movups xmm2,XMMWORD PTR [esi] xorps xmm2,xmm5 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L069dec1_loop_13: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L069dec1_loop_13 DB 102,15,56,223,209 xorps xmm2,xmm5 movups XMMWORD PTR [edi],xmm2 $L070xts_dec_steal: movzx ecx,BYTE PTR 16[esi] movzx edx,BYTE PTR [edi] lea esi,DWORD PTR 1[esi] mov BYTE PTR [edi],cl mov BYTE PTR 16[edi],dl lea edi,DWORD PTR 1[edi] sub eax,1 jnz $L070xts_dec_steal sub edi,DWORD PTR 112[esp] mov edx,ebp mov ecx,ebx movups xmm2,XMMWORD PTR [edi] xorps xmm2,xmm6 movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L071dec1_loop_14: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L071dec1_loop_14 DB 102,15,56,223,209 xorps xmm2,xmm6 movups XMMWORD PTR [edi],xmm2 $L067xts_dec_ret: mov esp,DWORD PTR 116[esp] pop edi pop esi pop ebx pop ebp ret _aesni_xts_decrypt ENDP ALIGN 16 _aesni_cbc_encrypt PROC PUBLIC $L_aesni_cbc_encrypt_begin:: push ebp push ebx push esi push edi mov esi,DWORD PTR 20[esp] mov ebx,esp mov edi,DWORD PTR 24[esp] sub ebx,24 mov eax,DWORD PTR 28[esp] and ebx,-16 mov edx,DWORD PTR 32[esp] mov ebp,DWORD PTR 36[esp] test eax,eax jz $L072cbc_abort cmp DWORD PTR 40[esp],0 xchg ebx,esp movups xmm7,XMMWORD PTR [ebp] mov ecx,DWORD PTR 240[edx] mov ebp,edx mov DWORD PTR 16[esp],ebx mov ebx,ecx je $L073cbc_decrypt movaps xmm2,xmm7 cmp eax,16 jb $L074cbc_enc_tail sub eax,16 jmp $L075cbc_enc_loop ALIGN 16 $L075cbc_enc_loop: movups xmm7,XMMWORD PTR [esi] lea esi,DWORD PTR 16[esi] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] xorps xmm7,xmm0 lea edx,DWORD PTR 32[edx] xorps xmm2,xmm7 $L076enc1_loop_15: DB 102,15,56,220,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L076enc1_loop_15 DB 102,15,56,221,209 mov ecx,ebx mov edx,ebp movups XMMWORD PTR [edi],xmm2 lea edi,DWORD PTR 16[edi] sub eax,16 jnc $L075cbc_enc_loop add eax,16 jnz $L074cbc_enc_tail movaps xmm7,xmm2 jmp $L077cbc_ret $L074cbc_enc_tail: mov ecx,eax DD 2767451785 mov ecx,16 sub ecx,eax xor eax,eax DD 2868115081 lea edi,DWORD PTR [edi-16] mov ecx,ebx mov esi,edi mov edx,ebp jmp $L075cbc_enc_loop ALIGN 16 $L073cbc_decrypt: cmp eax,80 jbe $L078cbc_dec_tail movaps XMMWORD PTR [esp],xmm7 sub eax,80 jmp $L079cbc_dec_loop6_enter ALIGN 16 $L080cbc_dec_loop6: movaps XMMWORD PTR [esp],xmm0 movups XMMWORD PTR [edi],xmm7 lea edi,DWORD PTR 16[edi] $L079cbc_dec_loop6_enter: movdqu xmm2,XMMWORD PTR [esi] movdqu xmm3,XMMWORD PTR 16[esi] movdqu xmm4,XMMWORD PTR 32[esi] movdqu xmm5,XMMWORD PTR 48[esi] movdqu xmm6,XMMWORD PTR 64[esi] movdqu xmm7,XMMWORD PTR 80[esi] call __aesni_decrypt6 movups xmm1,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR 16[esi] xorps xmm2,XMMWORD PTR [esp] xorps xmm3,xmm1 movups xmm1,XMMWORD PTR 32[esi] xorps xmm4,xmm0 movups xmm0,XMMWORD PTR 48[esi] xorps xmm5,xmm1 movups xmm1,XMMWORD PTR 64[esi] xorps xmm6,xmm0 movups xmm0,XMMWORD PTR 80[esi] xorps xmm7,xmm1 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 lea esi,DWORD PTR 96[esi] movups XMMWORD PTR 32[edi],xmm4 mov ecx,ebx movups XMMWORD PTR 48[edi],xmm5 mov edx,ebp movups XMMWORD PTR 64[edi],xmm6 lea edi,DWORD PTR 80[edi] sub eax,96 ja $L080cbc_dec_loop6 movaps xmm2,xmm7 movaps xmm7,xmm0 add eax,80 jle $L081cbc_dec_tail_collected movups XMMWORD PTR [edi],xmm2 lea edi,DWORD PTR 16[edi] $L078cbc_dec_tail: movups xmm2,XMMWORD PTR [esi] movaps xmm6,xmm2 cmp eax,16 jbe $L082cbc_dec_one movups xmm3,XMMWORD PTR 16[esi] movaps xmm5,xmm3 cmp eax,32 jbe $L083cbc_dec_two movups xmm4,XMMWORD PTR 32[esi] cmp eax,48 jbe $L084cbc_dec_three movups xmm5,XMMWORD PTR 48[esi] cmp eax,64 jbe $L085cbc_dec_four movups xmm6,XMMWORD PTR 64[esi] movaps XMMWORD PTR [esp],xmm7 movups xmm2,XMMWORD PTR [esi] xorps xmm7,xmm7 call __aesni_decrypt6 movups xmm1,XMMWORD PTR [esi] movups xmm0,XMMWORD PTR 16[esi] xorps xmm2,XMMWORD PTR [esp] xorps xmm3,xmm1 movups xmm1,XMMWORD PTR 32[esi] xorps xmm4,xmm0 movups xmm0,XMMWORD PTR 48[esi] xorps xmm5,xmm1 movups xmm7,XMMWORD PTR 64[esi] xorps xmm6,xmm0 movups XMMWORD PTR [edi],xmm2 movups XMMWORD PTR 16[edi],xmm3 movups XMMWORD PTR 32[edi],xmm4 movups XMMWORD PTR 48[edi],xmm5 lea edi,DWORD PTR 64[edi] movaps xmm2,xmm6 sub eax,80 jmp $L081cbc_dec_tail_collected ALIGN 16 $L082cbc_dec_one: movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR 16[edx] lea edx,DWORD PTR 32[edx] xorps xmm2,xmm0 $L086dec1_loop_16: DB 102,15,56,222,209 dec ecx movups xmm1,XMMWORD PTR [edx] lea edx,DWORD PTR 16[edx] jnz $L086dec1_loop_16 DB 102,15,56,223,209 xorps xmm2,xmm7 movaps xmm7,xmm6 sub eax,16 jmp $L081cbc_dec_tail_collected ALIGN 16 $L083cbc_dec_two: call __aesni_decrypt2 xorps xmm2,xmm7 xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 movaps xmm2,xmm3 lea edi,DWORD PTR 16[edi] movaps xmm7,xmm5 sub eax,32 jmp $L081cbc_dec_tail_collected ALIGN 16 $L084cbc_dec_three: call __aesni_decrypt3 xorps xmm2,xmm7 xorps xmm3,xmm6 xorps xmm4,xmm5 movups XMMWORD PTR [edi],xmm2 movaps xmm2,xmm4 movups XMMWORD PTR 16[edi],xmm3 lea edi,DWORD PTR 32[edi] movups xmm7,XMMWORD PTR 32[esi] sub eax,48 jmp $L081cbc_dec_tail_collected ALIGN 16 $L085cbc_dec_four: call __aesni_decrypt4 movups xmm1,XMMWORD PTR 16[esi] movups xmm0,XMMWORD PTR 32[esi] xorps xmm2,xmm7 movups xmm7,XMMWORD PTR 48[esi] xorps xmm3,xmm6 movups XMMWORD PTR [edi],xmm2 xorps xmm4,xmm1 movups XMMWORD PTR 16[edi],xmm3 xorps xmm5,xmm0 movups XMMWORD PTR 32[edi],xmm4 lea edi,DWORD PTR 48[edi] movaps xmm2,xmm5 sub eax,64 $L081cbc_dec_tail_collected: and eax,15 jnz $L087cbc_dec_tail_partial movups XMMWORD PTR [edi],xmm2 jmp $L077cbc_ret ALIGN 16 $L087cbc_dec_tail_partial: movaps XMMWORD PTR [esp],xmm2 mov ecx,16 mov esi,esp sub ecx,eax DD 2767451785 $L077cbc_ret: mov esp,DWORD PTR 16[esp] mov ebp,DWORD PTR 36[esp] movups XMMWORD PTR [ebp],xmm7 $L072cbc_abort: pop edi pop esi pop ebx pop ebp ret _aesni_cbc_encrypt ENDP ALIGN 16 __aesni_set_encrypt_key PROC PRIVATE test eax,eax jz $L088bad_pointer test edx,edx jz $L088bad_pointer movups xmm0,XMMWORD PTR [eax] xorps xmm4,xmm4 lea edx,DWORD PTR 16[edx] cmp ecx,256 je $L08914rounds cmp ecx,192 je $L09012rounds cmp ecx,128 jne $L091bad_keybits ALIGN 16 $L09210rounds: mov ecx,9 movups XMMWORD PTR [edx-16],xmm0 DB 102,15,58,223,200,1 call $L093key_128_cold DB 102,15,58,223,200,2 call $L094key_128 DB 102,15,58,223,200,4 call $L094key_128 DB 102,15,58,223,200,8 call $L094key_128 DB 102,15,58,223,200,16 call $L094key_128 DB 102,15,58,223,200,32 call $L094key_128 DB 102,15,58,223,200,64 call $L094key_128 DB 102,15,58,223,200,128 call $L094key_128 DB 102,15,58,223,200,27 call $L094key_128 DB 102,15,58,223,200,54 call $L094key_128 movups XMMWORD PTR [edx],xmm0 mov DWORD PTR 80[edx],ecx xor eax,eax ret ALIGN 16 $L094key_128: movups XMMWORD PTR [edx],xmm0 lea edx,DWORD PTR 16[edx] $L093key_128_cold: shufps xmm4,xmm0,16 xorps xmm0,xmm4 shufps xmm4,xmm0,140 xorps xmm0,xmm4 shufps xmm1,xmm1,255 xorps xmm0,xmm1 ret ALIGN 16 $L09012rounds: movq xmm2,QWORD PTR 16[eax] mov ecx,11 movups XMMWORD PTR [edx-16],xmm0 DB 102,15,58,223,202,1 call $L095key_192a_cold DB 102,15,58,223,202,2 call $L096key_192b DB 102,15,58,223,202,4 call $L097key_192a DB 102,15,58,223,202,8 call $L096key_192b DB 102,15,58,223,202,16 call $L097key_192a DB 102,15,58,223,202,32 call $L096key_192b DB 102,15,58,223,202,64 call $L097key_192a DB 102,15,58,223,202,128 call $L096key_192b movups XMMWORD PTR [edx],xmm0 mov DWORD PTR 48[edx],ecx xor eax,eax ret ALIGN 16 $L097key_192a: movups XMMWORD PTR [edx],xmm0 lea edx,DWORD PTR 16[edx] ALIGN 16 $L095key_192a_cold: movaps xmm5,xmm2 $L098key_192b_warm: shufps xmm4,xmm0,16 movdqa xmm3,xmm2 xorps xmm0,xmm4 shufps xmm4,xmm0,140 pslldq xmm3,4 xorps xmm0,xmm4 pshufd xmm1,xmm1,85 pxor xmm2,xmm3 pxor xmm0,xmm1 pshufd xmm3,xmm0,255 pxor xmm2,xmm3 ret ALIGN 16 $L096key_192b: movaps xmm3,xmm0 shufps xmm5,xmm0,68 movups XMMWORD PTR [edx],xmm5 shufps xmm3,xmm2,78 movups XMMWORD PTR 16[edx],xmm3 lea edx,DWORD PTR 32[edx] jmp $L098key_192b_warm ALIGN 16 $L08914rounds: movups xmm2,XMMWORD PTR 16[eax] mov ecx,13 lea edx,DWORD PTR 16[edx] movups XMMWORD PTR [edx-32],xmm0 movups XMMWORD PTR [edx-16],xmm2 DB 102,15,58,223,202,1 call $L099key_256a_cold DB 102,15,58,223,200,1 call $L100key_256b DB 102,15,58,223,202,2 call $L101key_256a DB 102,15,58,223,200,2 call $L100key_256b DB 102,15,58,223,202,4 call $L101key_256a DB 102,15,58,223,200,4 call $L100key_256b DB 102,15,58,223,202,8 call $L101key_256a DB 102,15,58,223,200,8 call $L100key_256b DB 102,15,58,223,202,16 call $L101key_256a DB 102,15,58,223,200,16 call $L100key_256b DB 102,15,58,223,202,32 call $L101key_256a DB 102,15,58,223,200,32 call $L100key_256b DB 102,15,58,223,202,64 call $L101key_256a movups XMMWORD PTR [edx],xmm0 mov DWORD PTR 16[edx],ecx xor eax,eax ret ALIGN 16 $L101key_256a: movups XMMWORD PTR [edx],xmm2 lea edx,DWORD PTR 16[edx] $L099key_256a_cold: shufps xmm4,xmm0,16 xorps xmm0,xmm4 shufps xmm4,xmm0,140 xorps xmm0,xmm4 shufps xmm1,xmm1,255 xorps xmm0,xmm1 ret ALIGN 16 $L100key_256b: movups XMMWORD PTR [edx],xmm0 lea edx,DWORD PTR 16[edx] shufps xmm4,xmm2,16 xorps xmm2,xmm4 shufps xmm4,xmm2,140 xorps xmm2,xmm4 shufps xmm1,xmm1,170 xorps xmm2,xmm1 ret ALIGN 4 $L088bad_pointer: mov eax,-1 ret ALIGN 4 $L091bad_keybits: mov eax,-2 ret __aesni_set_encrypt_key ENDP ALIGN 16 _aesni_set_encrypt_key PROC PUBLIC $L_aesni_set_encrypt_key_begin:: mov eax,DWORD PTR 4[esp] mov ecx,DWORD PTR 8[esp] mov edx,DWORD PTR 12[esp] call __aesni_set_encrypt_key ret _aesni_set_encrypt_key ENDP ALIGN 16 _aesni_set_decrypt_key PROC PUBLIC $L_aesni_set_decrypt_key_begin:: mov eax,DWORD PTR 4[esp] mov ecx,DWORD PTR 8[esp] mov edx,DWORD PTR 12[esp] call __aesni_set_encrypt_key mov edx,DWORD PTR 12[esp] shl ecx,4 test eax,eax jnz $L102dec_key_ret lea eax,DWORD PTR 16[ecx*1+edx] movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR [eax] movups XMMWORD PTR [eax],xmm0 movups XMMWORD PTR [edx],xmm1 lea edx,DWORD PTR 16[edx] lea eax,DWORD PTR [eax-16] $L103dec_key_inverse: movups xmm0,XMMWORD PTR [edx] movups xmm1,XMMWORD PTR [eax] DB 102,15,56,219,192 DB 102,15,56,219,201 lea edx,DWORD PTR 16[edx] lea eax,DWORD PTR [eax-16] movups XMMWORD PTR 16[eax],xmm0 movups XMMWORD PTR [edx-16],xmm1 cmp eax,edx ja $L103dec_key_inverse movups xmm0,XMMWORD PTR [edx] DB 102,15,56,219,192 movups XMMWORD PTR [edx],xmm0 xor eax,eax $L102dec_key_ret: ret _aesni_set_decrypt_key ENDP DB 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69 DB 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83 DB 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 DB 115,108,46,111,114,103,62,0 .text$ ENDS END
programs/oeis/037/A037620.asm
karttu/loda
1
163420
; A037620: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 2,0,3. ; 2,12,75,452,2712,16275,97652,585912,3515475,21092852,126557112,759342675,4556056052,27336336312,164018017875,984108107252,5904648643512,35427891861075,212567351166452,1275404106998712,7652424641992275 cal $0,33142 ; Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,0. mul $0,50 div $0,24 mov $1,$0
norm.asm
zevladnit/normalize-vector
0
85891
<filename>norm.asm #{ ~label 'X' 0x0 ~label 'Y' 0x1 ~label 'Z' 0x2 ~label 'length' 0x6 ~label 'norm' 0x7 ~label 'one' 0xA ~label 'three' 0xB } ;power on .warm ;float mode on .ldx &(0x18) <| $(0x1) ;next 5 value in stack .orb &(0x5) ;X .val @float_t("5.0") ;Y .val @float_t("2.0") ;Z .val @float_t("3.0") ;one .val @float_t("1.0") ;three .val @float_t("3.0") ;pulling values from stack to L1-CPU cache (inverted) .pull &(![~three]) .pull &(![~one]) .pull &(![~Z]) .pull &(![~Y]) .pull &(![~X]) ;Math.Sqrt((X * X) + (Y * Y) + (Z * Z)) .mul &(0x3) &(![~X])&(![~X]) .mul &(0x4) &(![~Y])&(![~Y]) .mul &(0x5) &(![~Z])&(![~Z]) .add &(![~length]) &(0x3)&(0x4) .add &(![~length]) &(![~length])&(0x5) .sqrt &(![~length])&(![~length]) ;end ;inv_length = 1 / Length .div &(![~length]) &(![~one]) &(![~length]) ;(x,y,z) *= inv_length .mul &(![~X]) &(![~X])&(![~length]) .mul &(![~Y]) &(![~Y])&(![~length]) .mul &(![~Z]) &(![~Z])&(![~length]) ;sum vector .add &(![~norm])&(![~norm])&(![~X]) .add &(![~norm])&(![~norm])&(![~Y]) .add &(![~norm])&(![~norm])&(![~Z]) ;sum/3 .div &(![~norm])&(![~norm])&(![~three]) ;print result to terminal .mvj &(0x1) &(0x5) <| @string_t("Normalize value: ") .mvx &(0x1) &(0x5) |> &(![~norm]) .mva &(0x1) &(0x5) <| $(0x20) ;power off .halt
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_6496_394.asm
ljhsiun2/medusa
9
29076
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_6496_394.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x1adbb, %rbx nop nop nop sub $43111, %r13 movl $0x61626364, (%rbx) nop nop nop sub $39564, %r12 lea addresses_WC_ht+0xbb3b, %rsi nop nop nop xor $45241, %rdi mov $0x6162636465666768, %rdx movq %rdx, %xmm3 and $0xffffffffffffffc0, %rsi movntdq %xmm3, (%rsi) nop and $22275, %r13 lea addresses_A_ht+0x773b, %rsi nop nop nop nop nop xor $29640, %r13 mov (%rsi), %ebx nop sub $63877, %r11 lea addresses_WC_ht+0x5fbb, %r11 nop nop nop nop xor $33116, %rdi and $0xffffffffffffffc0, %r11 vmovaps (%r11), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %rsi nop add $19756, %r11 lea addresses_A_ht+0xdc1b, %rsi lea addresses_WT_ht+0x1cfbb, %rdi nop nop nop nop cmp $42951, %rbx mov $37, %rcx rep movsq nop nop nop dec %rbx lea addresses_normal_ht+0xf3b, %rdi nop nop nop nop xor %rsi, %rsi mov (%rdi), %r11w nop nop nop nop nop add $20889, %rdi lea addresses_D_ht+0xf0bb, %rsi lea addresses_A_ht+0x1b6bb, %rdi nop nop nop inc %r11 mov $112, %rcx rep movsw nop nop nop nop nop and %r11, %r11 lea addresses_normal_ht+0x182bb, %rsi lea addresses_UC_ht+0x1077b, %rdi nop nop nop nop cmp %r13, %r13 mov $31, %rcx rep movsb nop nop nop nop inc %rsi lea addresses_normal_ht+0x12223, %rsi clflush (%rsi) nop nop dec %r12 movups (%rsi), %xmm5 vpextrq $0, %xmm5, %rdx nop nop nop nop nop and %rdx, %rdx lea addresses_WT_ht+0x307b, %r13 nop nop nop nop nop cmp $50370, %rbx mov $0x6162636465666768, %r11 movq %r11, (%r13) nop nop nop nop add $60985, %rcx lea addresses_A_ht+0x14cbb, %rdi xor %r11, %r11 movb (%rdi), %r13b nop nop add %rbx, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %rax push %rbp push %rcx push %rdi push %rsi // Store mov $0x33b, %rsi xor %rbp, %rbp mov $0x5152535455565758, %rax movq %rax, (%rsi) nop nop nop add $62449, %r11 // Store lea addresses_US+0x1ee3b, %rcx nop nop nop sub %r15, %r15 movw $0x5152, (%rcx) nop nop nop nop nop dec %r15 // Store lea addresses_UC+0x5cab, %rdi nop nop add %rcx, %rcx movl $0x51525354, (%rdi) nop nop xor $44965, %rcx // Load lea addresses_WT+0xc9bb, %r15 clflush (%r15) nop nop and %rsi, %rsi movb (%r15), %al nop nop nop nop nop and %rcx, %rcx // Faulty Load lea addresses_D+0x1cbb, %rcx and $63006, %rsi mov (%rcx), %eax lea oracles, %rsi and $0xff, %rax shlq $12, %rax mov (%rsi,%rax,1), %rax pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 2, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'36': 6496} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
3-mid/impact/source/3d/collision/narrowphase/impact-d3-collision-convex_penetration_depth_solver-minkowski.adb
charlie5/lace
20
10592
<reponame>charlie5/lace with impact.d3.collision.Detector.discrete; with impact.d3.Transform; with impact.d3.Vector; with impact.d3.collision.Detector.discrete.gjk_pair; -- #include "impact.d3.collision.convex_penetration_depth_Solver.minkowski.h" -- #include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h" -- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.simplex_Solver.voronoi.h" -- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.Detector.discrete.gjk_pair.h" -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.h" package body impact.d3.collision.convex_penetration_depth_Solver.minkowski is NUM_UNITSPHERE_POINTS : constant := 42; --- btIntermediateResult -- type btIntermediateResult is new impact.d3.collision.Detector.discrete.Result with record m_normalOnBInWorld, m_pointInWorld : math.Vector_3; m_depth : math.Real; m_hasResult : Boolean := False; end record; overriding procedure addContactPoint (Self : in out btIntermediateResult; normalOnBInWorld : in math.Vector_3; pointInWorld : in math.Vector_3; depth : in math.Real ) is begin Self.m_normalOnBInWorld := normalOnBInWorld; Self.m_pointInWorld := pointInWorld; Self.m_depth := depth; Self.m_hasResult := True; end addContactPoint; --- Operations -- overriding function calcPenDepth (Self : access Item; simplexSolver : access impact.d3.collision.simplex_Solver.Item'Class; convexA, convexB : in impact.d3.Shape.convex.view; transA, transB : in Transform_3d; v : access math.Vector_3; pa, pb : access math.Vector_3) return Boolean is pragma Unreferenced (Self); use impact.d3.Transform; check2d : constant Boolean := convexA.isConvex2d and then convexB.isConvex2d; -- just take fixed number of orientation, and sample the penetration depth in that direction -- minProj : math.Real := BT_LARGE_FLOAT; minNorm : math.Vector_3 := (0.0, 0.0, 0.0); minA, minB : math.Vector_3; seperatingAxisInA, seperatingAxisInB : math.Vector_3; pragma Unreferenced (seperatingAxisInA, seperatingAxisInB); pInA, qInB, pWorld, qWorld, w : math.Vector_3; supportVerticesABatch : Vector_3_array (1 .. NUM_UNITSPHERE_POINTS + impact.d3.Shape.convex.MAX_PREFERRED_PENETRATION_DIRECTIONS * 2); supportVerticesBBatch : Vector_3_array (1 .. NUM_UNITSPHERE_POINTS + impact.d3.Shape.convex.MAX_PREFERRED_PENETRATION_DIRECTIONS * 2); seperatingAxisInABatch : Vector_3_array (1 .. NUM_UNITSPHERE_POINTS + impact.d3.Shape.convex.MAX_PREFERRED_PENETRATION_DIRECTIONS * 2); seperatingAxisInBBatch : Vector_3_array (1 .. NUM_UNITSPHERE_POINTS + impact.d3.Shape.convex.MAX_PREFERRED_PENETRATION_DIRECTIONS * 2); numSampleDirections : Integer := NUM_UNITSPHERE_POINTS; begin for i in 1 .. numSampleDirections loop declare norm : constant math.Vector_3 := getPenetrationDirections (i).all; begin seperatingAxisInABatch (i) := (-norm) * getBasis (transA); seperatingAxisInBBatch (i) := norm * getBasis (transB); end; end loop; declare numPDA : constant Integer := convexA.getNumPreferredPenetrationDirections; norm : math.Vector_3; begin if numPDA /= 0 then for i in 1 .. numPDA loop convexA.getPreferredPenetrationDirection (i, norm); norm := getBasis (transA) * norm; getPenetrationDirections (numSampleDirections).all := norm; seperatingAxisInABatch (numSampleDirections) := (-norm) * getBasis (transA); seperatingAxisInBBatch (numSampleDirections) := norm * getBasis (transB); numSampleDirections := numSampleDirections + 1; end loop; end if; end; declare numPDB : constant Integer := convexB.getNumPreferredPenetrationDirections; norm : math.Vector_3; begin if numPDB /= 0 then for i in 1 .. numPDB loop convexB.getPreferredPenetrationDirection (i, norm); norm := getBasis (transB) * norm; getPenetrationDirections (numSampleDirections).all := norm; seperatingAxisInABatch (numSampleDirections) := (-norm) * getBasis (transA); seperatingAxisInBBatch (numSampleDirections) := norm * getBasis (transB); numSampleDirections := numSampleDirections + 1; end loop; end if; end; convexA.batchedUnitVectorGetSupportingVertexWithoutMargin (seperatingAxisInABatch, supportVerticesABatch, numSampleDirections); convexB.batchedUnitVectorGetSupportingVertexWithoutMargin (seperatingAxisInBBatch, supportVerticesBBatch, numSampleDirections); for i in 1 .. numSampleDirections loop declare use linear_Algebra_3d, impact.d3.Vector; norm : math.Vector_3 := getPenetrationDirections (i).all; the_delta : math.Real; begin if check2d then norm (3) := 0.0; end if; if length2 (norm) > 0.01 then seperatingAxisInA := seperatingAxisInABatch (i); seperatingAxisInB := seperatingAxisInBBatch (i); pInA := supportVerticesABatch (i); qInB := supportVerticesBBatch (i); pWorld := transA * pInA; qWorld := transB * qInB; if check2d then pWorld (3) := 0.0; qWorld (3) := 0.0; end if; w := qWorld - pWorld; the_delta := dot (norm, w); -- find smallest delta if the_delta < minProj then minProj := the_delta; minNorm := norm; minA := pWorld; minB := qWorld; end if; end if; end; end loop; -- add the margins -- minA := minA + minNorm * convexA.getMarginNonVirtual; minB := minB - minNorm * convexB.getMarginNonVirtual; -- no penetration if minProj < 0.0 then return False; end if; minProj := minProj + 0.5 -- 'extraSeparation' ~ scale dependent + (convexA.getMarginNonVirtual + convexB.getMarginNonVirtual); declare use impact.d3.collision.Detector.discrete.gjk_pair; gjkdet : impact.d3.collision.Detector.discrete.gjk_pair.item := to_gjk_pair_Detector (convexA, convexB, simplexSolver, null); offsetDist : constant math.Real := minProj; offset : constant math.Vector_3 := minNorm * offsetDist; input : impact.d3.collision.Detector.discrete.ClosestPointInput; newOrg : constant math.Vector_3 := getOrigin (transA) + offset; displacedTrans : Transform_3d := transA; penetration_relaxation : constant math.Real := 1.0; res : btIntermediateResult; correctedMinNorm : math.Real; begin setOrigin (displacedTrans, newOrg); input.m_transformA := displacedTrans; input.m_transformB := transB; input.m_maximumDistanceSquared := BT_LARGE_FLOAT; -- minProj; gjkdet.setCachedSeperatingAxis (-minNorm); gjkdet.getClosestPoints (input, res); correctedMinNorm := minProj - res.m_depth; minNorm := minNorm * penetration_relaxation; -- the penetration depth is over-estimated, relax it if res.m_hasResult then pa.all := res.m_pointInWorld - minNorm * correctedMinNorm; pb.all := res.m_pointInWorld; v .all := minNorm; end if; return res.m_hasResult; end; end calcPenDepth; sPenetrationDirections : Vector_3_array (1 .. NUM_UNITSPHERE_POINTS + impact.d3.Shape.convex.MAX_PREFERRED_PENETRATION_DIRECTIONS*2) := ((0.000000, -0.000000, -1.000000), -- these defaults are for UNITSPHERE_POINTS ! (0.723608, -0.525725, -0.447219), (-0.276388, -0.850649, -0.447219), (-0.894426, -0.000000, -0.447216), (-0.276388, 0.850649, -0.447220), (0.723608, 0.525725, -0.447219), (0.276388, -0.850649, 0.447220), (-0.723608, -0.525725, 0.447219), (-0.723608, 0.525725, 0.447219), (0.276388, 0.850649, 0.447219), (0.894426, 0.000000, 0.447216), (-0.000000, 0.000000, 1.000000), (0.425323, -0.309011, -0.850654), (-0.162456, -0.499995, -0.850654), (0.262869, -0.809012, -0.525738), (0.425323, 0.309011, -0.850654), (0.850648, -0.000000, -0.525736), (-0.525730, -0.000000, -0.850652), (-0.688190, -0.499997, -0.525736), (-0.162456, 0.499995, -0.850654), (-0.688190, 0.499997, -0.525736), (0.262869, 0.809012, -0.525738), (0.951058, 0.309013, 0.000000), (0.951058, -0.309013, 0.000000), (0.587786, -0.809017, 0.000000), (0.000000, -1.000000, 0.000000), (-0.587786, -0.809017, 0.000000), (-0.951058, -0.309013, -0.000000), (-0.951058, 0.309013, -0.000000), (-0.587786, 0.809017, -0.000000), (-0.000000, 1.000000, -0.000000), (0.587786, 0.809017, -0.000000), (0.688190, -0.499997, 0.525736), (-0.262869, -0.809012, 0.525738), (-0.850648, 0.000000, 0.525736), (-0.262869, 0.809012, 0.525738), (0.688190, 0.499997, 0.525736), (0.525730, 0.000000, 0.850652), (0.162456, -0.499995, 0.850654), (-0.425323, -0.309011, 0.850654), (-0.425323, 0.309011, 0.850654), (0.162456, 0.499995, 0.850654), others => (0.0, 0.0, 0.0 )); -- remaining ones following 1 .. UNITSPHERE_POINTS. function getPenetrationDirections (i : in Integer) return access math.Vector_3 is begin return sPenetrationDirections (i)'Access; end getPenetrationDirections; end impact.d3.collision.convex_penetration_depth_Solver.minkowski; -- bool impact.d3.collision.convex_penetration_depth_Solver.minkowski::calcPenDepth(impact.d3.collision.simplex_Solver& simplexSolver, -- const impact.d3.Shape.convex* convexA,const impact.d3.Shape.convex* convexB, -- const impact.d3.Transform& transA,const impact.d3.Transform& transB, -- impact.d3.Vector& v, impact.d3.Vector& pa, impact.d3.Vector& pb, -- class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc -- ) -- { -- -- (void)stackAlloc; -- (void)v; -- -- bool check2d= convexA->isConvex2d() && convexB->isConvex2d(); -- -- //just take fixed number of orientation, and sample the penetration depth in that direction -- impact.d3.Scalar minProj = impact.d3.Scalar(BT_LARGE_FLOAT); -- impact.d3.Vector minNorm(impact.d3.Scalar(0.), impact.d3.Scalar(0.), impact.d3.Scalar(0.)); -- impact.d3.Vector minA,minB; -- impact.d3.Vector seperatingAxisInA,seperatingAxisInB; -- impact.d3.Vector pInA,qInB,pWorld,qWorld,w; -- -- -- impact.d3.Vector supportVerticesABatch[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2]; -- impact.d3.Vector supportVerticesBBatch[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2]; -- impact.d3.Vector seperatingAxisInABatch[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2]; -- impact.d3.Vector seperatingAxisInBBatch[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2]; -- int i; -- -- int numSampleDirections = NUM_UNITSPHERE_POINTS; -- -- for (i=0;i<numSampleDirections;i++) -- { -- impact.d3.Vector norm = getPenetrationDirections()[i]; -- seperatingAxisInABatch[i] = (-norm) * transA.getBasis() ; -- seperatingAxisInBBatch[i] = norm * transB.getBasis() ; -- } -- -- { -- int numPDA = convexA->getNumPreferredPenetrationDirections(); -- if (numPDA) -- { -- for (int i=0;i<numPDA;i++) -- { -- impact.d3.Vector norm; -- convexA->getPreferredPenetrationDirection(i,norm); -- norm = transA.getBasis() * norm; -- getPenetrationDirections()[numSampleDirections] = norm; -- seperatingAxisInABatch[numSampleDirections] = (-norm) * transA.getBasis(); -- seperatingAxisInBBatch[numSampleDirections] = norm * transB.getBasis(); -- numSampleDirections++; -- } -- } -- } -- -- { -- int numPDB = convexB->getNumPreferredPenetrationDirections(); -- if (numPDB) -- { -- for (int i=0;i<numPDB;i++) -- { -- impact.d3.Vector norm; -- convexB->getPreferredPenetrationDirection(i,norm); -- norm = transB.getBasis() * norm; -- getPenetrationDirections()[numSampleDirections] = norm; -- seperatingAxisInABatch[numSampleDirections] = (-norm) * transA.getBasis(); -- seperatingAxisInBBatch[numSampleDirections] = norm * transB.getBasis(); -- numSampleDirections++; -- } -- } -- } -- -- -- -- -- convexA->batchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInABatch,supportVerticesABatch,numSampleDirections); -- convexB->batchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInBBatch,supportVerticesBBatch,numSampleDirections); -- -- for (i=0;i<numSampleDirections;i++) -- { -- impact.d3.Vector norm = getPenetrationDirections()[i]; -- if (check2d) -- { -- norm[2] = 0.f; -- } -- if (norm.length2()>0.01) -- { -- -- seperatingAxisInA = seperatingAxisInABatch[i]; -- seperatingAxisInB = seperatingAxisInBBatch[i]; -- -- pInA = supportVerticesABatch[i]; -- qInB = supportVerticesBBatch[i]; -- -- pWorld = transA(pInA); -- qWorld = transB(qInB); -- if (check2d) -- { -- pWorld[2] = 0.f; -- qWorld[2] = 0.f; -- } -- -- w = qWorld - pWorld; -- impact.d3.Scalar delta = norm.dot(w); -- //find smallest delta -- if (delta < minProj) -- { -- minProj = delta; -- minNorm = norm; -- minA = pWorld; -- minB = qWorld; -- } -- } -- } -- -- //add the margins -- -- minA += minNorm*convexA->getMarginNonVirtual(); -- minB -= minNorm*convexB->getMarginNonVirtual(); -- //no penetration -- if (minProj < impact.d3.Scalar(0.)) -- return false; -- -- impact.d3.Scalar extraSeparation = 0.5f;///scale dependent -- minProj += extraSeparation+(convexA->getMarginNonVirtual() + convexB->getMarginNonVirtual()); -- -- -- -- impact.d3.collision.Detector.discrete.gjk_pair gjkdet(convexA,convexB,&simplexSolver,0); -- -- impact.d3.Scalar offsetDist = minProj; -- impact.d3.Vector offset = minNorm * offsetDist; -- -- -- -- impact.d3.collision.Detector.discrete.gjk_pair::ClosestPointInput input; -- -- impact.d3.Vector newOrg = transA.getOrigin() + offset; -- -- impact.d3.Transform displacedTrans = transA; -- displacedTrans.setOrigin(newOrg); -- -- input.m_transformA = displacedTrans; -- input.m_transformB = transB; -- input.m_maximumDistanceSquared = impact.d3.Scalar(BT_LARGE_FLOAT);//minProj; -- -- btIntermediateResult res; -- gjkdet.setCachedSeperatingAxis(-minNorm); -- gjkdet.getClosestPoints(input,res,debugDraw); -- -- impact.d3.Scalar correctedMinNorm = minProj - res.m_depth; -- -- -- //the penetration depth is over-estimated, relax it -- impact.d3.Scalar penetration_relaxation= impact.d3.Scalar(1.); -- minNorm*=penetration_relaxation; -- -- -- if (res.m_hasResult) -- { -- -- pa = res.m_pointInWorld - minNorm * correctedMinNorm; -- pb = res.m_pointInWorld; -- v = minNorm; -- -- } -- return res.m_hasResult; -- } -- impact.d3.Vector* impact.d3.collision.convex_penetration_depth_Solver.minkowski::getPenetrationDirections() -- { -- static impact.d3.Vector sPenetrationDirections[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] = -- { -- impact.d3.Vector(impact.d3.Scalar(0.000000) , impact.d3.Scalar(-0.000000),impact.d3.Scalar(-1.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.723608) , impact.d3.Scalar(-0.525725),impact.d3.Scalar(-0.447219)), -- impact.d3.Vector(impact.d3.Scalar(-0.276388) , impact.d3.Scalar(-0.850649),impact.d3.Scalar(-0.447219)), -- impact.d3.Vector(impact.d3.Scalar(-0.894426) , impact.d3.Scalar(-0.000000),impact.d3.Scalar(-0.447216)), -- impact.d3.Vector(impact.d3.Scalar(-0.276388) , impact.d3.Scalar(0.850649),impact.d3.Scalar(-0.447220)), -- impact.d3.Vector(impact.d3.Scalar(0.723608) , impact.d3.Scalar(0.525725),impact.d3.Scalar(-0.447219)), -- impact.d3.Vector(impact.d3.Scalar(0.276388) , impact.d3.Scalar(-0.850649),impact.d3.Scalar(0.447220)), -- impact.d3.Vector(impact.d3.Scalar(-0.723608) , impact.d3.Scalar(-0.525725),impact.d3.Scalar(0.447219)), -- impact.d3.Vector(impact.d3.Scalar(-0.723608) , impact.d3.Scalar(0.525725),impact.d3.Scalar(0.447219)), -- impact.d3.Vector(impact.d3.Scalar(0.276388) , impact.d3.Scalar(0.850649),impact.d3.Scalar(0.447219)), -- impact.d3.Vector(impact.d3.Scalar(0.894426) , impact.d3.Scalar(0.000000),impact.d3.Scalar(0.447216)), -- impact.d3.Vector(impact.d3.Scalar(-0.000000) , impact.d3.Scalar(0.000000),impact.d3.Scalar(1.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.425323) , impact.d3.Scalar(-0.309011),impact.d3.Scalar(-0.850654)), -- impact.d3.Vector(impact.d3.Scalar(-0.162456) , impact.d3.Scalar(-0.499995),impact.d3.Scalar(-0.850654)), -- impact.d3.Vector(impact.d3.Scalar(0.262869) , impact.d3.Scalar(-0.809012),impact.d3.Scalar(-0.525738)), -- impact.d3.Vector(impact.d3.Scalar(0.425323) , impact.d3.Scalar(0.309011),impact.d3.Scalar(-0.850654)), -- impact.d3.Vector(impact.d3.Scalar(0.850648) , impact.d3.Scalar(-0.000000),impact.d3.Scalar(-0.525736)), -- impact.d3.Vector(impact.d3.Scalar(-0.525730) , impact.d3.Scalar(-0.000000),impact.d3.Scalar(-0.850652)), -- impact.d3.Vector(impact.d3.Scalar(-0.688190) , impact.d3.Scalar(-0.499997),impact.d3.Scalar(-0.525736)), -- impact.d3.Vector(impact.d3.Scalar(-0.162456) , impact.d3.Scalar(0.499995),impact.d3.Scalar(-0.850654)), -- impact.d3.Vector(impact.d3.Scalar(-0.688190) , impact.d3.Scalar(0.499997),impact.d3.Scalar(-0.525736)), -- impact.d3.Vector(impact.d3.Scalar(0.262869) , impact.d3.Scalar(0.809012),impact.d3.Scalar(-0.525738)), -- impact.d3.Vector(impact.d3.Scalar(0.951058) , impact.d3.Scalar(0.309013),impact.d3.Scalar(0.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.951058) , impact.d3.Scalar(-0.309013),impact.d3.Scalar(0.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.587786) , impact.d3.Scalar(-0.809017),impact.d3.Scalar(0.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.000000) , impact.d3.Scalar(-1.000000),impact.d3.Scalar(0.000000)), -- impact.d3.Vector(impact.d3.Scalar(-0.587786) , impact.d3.Scalar(-0.809017),impact.d3.Scalar(0.000000)), -- impact.d3.Vector(impact.d3.Scalar(-0.951058) , impact.d3.Scalar(-0.309013),impact.d3.Scalar(-0.000000)), -- impact.d3.Vector(impact.d3.Scalar(-0.951058) , impact.d3.Scalar(0.309013),impact.d3.Scalar(-0.000000)), -- impact.d3.Vector(impact.d3.Scalar(-0.587786) , impact.d3.Scalar(0.809017),impact.d3.Scalar(-0.000000)), -- impact.d3.Vector(impact.d3.Scalar(-0.000000) , impact.d3.Scalar(1.000000),impact.d3.Scalar(-0.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.587786) , impact.d3.Scalar(0.809017),impact.d3.Scalar(-0.000000)), -- impact.d3.Vector(impact.d3.Scalar(0.688190) , impact.d3.Scalar(-0.499997),impact.d3.Scalar(0.525736)), -- impact.d3.Vector(impact.d3.Scalar(-0.262869) , impact.d3.Scalar(-0.809012),impact.d3.Scalar(0.525738)), -- impact.d3.Vector(impact.d3.Scalar(-0.850648) , impact.d3.Scalar(0.000000),impact.d3.Scalar(0.525736)), -- impact.d3.Vector(impact.d3.Scalar(-0.262869) , impact.d3.Scalar(0.809012),impact.d3.Scalar(0.525738)), -- impact.d3.Vector(impact.d3.Scalar(0.688190) , impact.d3.Scalar(0.499997),impact.d3.Scalar(0.525736)), -- impact.d3.Vector(impact.d3.Scalar(0.525730) , impact.d3.Scalar(0.000000),impact.d3.Scalar(0.850652)), -- impact.d3.Vector(impact.d3.Scalar(0.162456) , impact.d3.Scalar(-0.499995),impact.d3.Scalar(0.850654)), -- impact.d3.Vector(impact.d3.Scalar(-0.425323) , impact.d3.Scalar(-0.309011),impact.d3.Scalar(0.850654)), -- impact.d3.Vector(impact.d3.Scalar(-0.425323) , impact.d3.Scalar(0.309011),impact.d3.Scalar(0.850654)), -- impact.d3.Vector(impact.d3.Scalar(0.162456) , impact.d3.Scalar(0.499995),impact.d3.Scalar(0.850654)) -- }; -- -- return sPenetrationDirections; -- }
Assembly/CH07N05/CH07N05.asm
IceNerd/hogwarts
0
18836
<filename>Assembly/CH07N05/CH07N05.asm TITLE Fast Multiply (CH07N05.asm) ;Program Description: This program will multiply two integers ; using shifts and adds only. ; ;Author: <NAME> ;Date Created: 10.26.03 ;Last Modification Date: 10.26.03 INCLUDE Irvine32.inc .data StartMSG BYTE "This program will multiply two positive integers.",0 .code main PROC mov edx, OFFSET StartMSG call WriteString Call CRLF call ReadINT mov ebx,eax call CRLF Call ReadINT call CRLF mov cl,0 mov edx,0 push ebx push 0 L1: shr eax,1 jnc L2 shl ebx,cl pop edx add edx,ebx pop ebx push ebx push edx L2: inc cl cmp cl,32 jne L1 pop eax pop ebx call WriteINT call Crlf exit main ENDP END main
unittests/ASM/Primary/Primary_D7.asm
cobalt2727/FEX
628
162573
<reponame>cobalt2727/FEX<gh_stars>100-1000 %ifdef CONFIG { "RegData": { "R15": "0xFFFFFFFFFFFFFF47", "R14": "0xFFFFFFFFFFFFFF57", "R13": "0xFFFFFFFFFFFFFF67" }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rbx, 0xe0000000 lea r9, [rbx + 8 * 1] wrfsbase r9 lea r9, [rbx + 8 * 2] wrgsbase r9 mov rcx, 0x4142434445464748 mov [rbx + 8 * 0], rcx mov rcx, 0x5152535455565758 mov [rbx + 8 * 1], rcx mov rcx, 0x6162636465666768 mov [rbx + 8 * 2], rcx ; Base mov rax, 0xFFFFFFFFFFFFFF01 xlatb mov r15, rax ; FS mov rax, 0xFFFFFFFFFFFFFF01 mov rbx, 0 fs xlat mov r14, rax ; GS mov rax, 0xFFFFFFFFFFFFFF01 mov rbx, 0 gs xlat mov r13, rax hlt
src/Generic/Lib/Equality/Congn.agda
turion/Generic
30
13037
<filename>src/Generic/Lib/Equality/Congn.agda module Generic.Lib.Equality.Congn where open import Generic.Lib.Intro open import Generic.Lib.Equality.Propositional open import Generic.Lib.Data.Product open import Generic.Lib.Data.Nat open import Generic.Lib.Data.Pow open import Generic.Lib.Data.Sets zip≡ : ∀ {n αs} {As : Sets {n} αs} -> HList As -> HList As -> Sets (replicatePow n lzero) zip≡ {0} tt tt = tt zip≡ {suc _} (x , xs) (y , ys) = (x ≡ y) , zip≡ xs ys congn : ∀ {β} {B : Set β} n {αs} {As : Sets {n} αs} {xs ys : HList As} -> (f : FoldSets As B) -> FoldSets (zip≡ xs ys) (applyFoldSets f xs ≡ applyFoldSets f ys) congn 0 y = refl congn (suc n) f refl = congn n (f _) private module Test where cong′ : ∀ {α β} {A : Set α} {B : Set β} {x y} -> (f : A -> B) -> x ≡ y -> f x ≡ f y cong′ = congn 1 cong₂′ : ∀ {α β γ} {A : Set α} {B : Set β} {C : Set γ} {x₁ x₂ y₁ y₂} -> (g : A -> B -> C) -> x₁ ≡ x₂ -> y₁ ≡ y₂ -> g x₁ y₁ ≡ g x₂ y₂ cong₂′ = congn 2
cards/bn5/ModCards/136-A038 FlameMan.asm
RockmanEXEZone/MMBN-Mod-Card-Kit
10
22869
.include "defaults_mod.asm" table_file_jp equ "exe5-utf8.tbl" table_file_en equ "bn5-utf8.tbl" game_code_len equ 3 game_code equ 0x4252424A // BRBJ game_code_2 equ 0x42524245 // BRBE game_code_3 equ 0x42524250 // BRBP card_type equ 1 card_id equ 38 card_no equ "038" card_sub equ "Mod Card 038" card_sub_x equ 64 card_desc_len equ 2 card_desc_1 equ "FlameMan" card_desc_2 equ "45MB" card_desc_3 equ "" card_name_jp_full equ "フレイムマン" card_name_jp_game equ "フレイムマン" card_name_en_full equ "FlameMan" card_name_en_game equ "FlameMan" card_address equ "" card_address_id equ 0 card_bug equ 0 card_wrote_en equ "" card_wrote_jp equ ""
crypto/bn/asm/x86w32.asm
rstokes149/RedLobster
0
169610
; Static Name Aliases ; TITLE bn_mulw.c .386 F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE' F_TEXT ENDS _DATA SEGMENT WORD USE16 PUBLIC 'DATA' _DATA ENDS _CONST SEGMENT WORD USE16 PUBLIC 'CONST' _CONST ENDS _BSS SEGMENT WORD USE16 PUBLIC 'BSS' _BSS ENDS DGROUP GROUP _CONST, _BSS, _DATA ASSUME DS: DGROUP, SS: DGROUP F_TEXT SEGMENT ASSUME CS: F_TEXT PUBLIC _bn_mul_add_words _bn_mul_add_words PROC FAR ; Line 58 push bp push bx push esi push di push ds push es mov bp,sp ; w = 28 ; num = 26 ; ap = 22 ; rp = 18 xor esi,esi ;c=0; mov di,WORD PTR [bp+18] ; load r mov ds,WORD PTR [bp+20] ; load r mov bx,WORD PTR [bp+22] ; load a mov es,WORD PTR [bp+24] ; load a mov ecx,DWORD PTR [bp+28] ; load w mov bp,WORD PTR [bp+26] ; load num shr bp,1 ; div count by 4 and do groups of 4 shr bp,1 je $L555 $L546: mov eax,ecx mul DWORD PTR es:[bx] ; w* *a add eax,DWORD PTR ds:[di] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di],eax mov esi,edx ; mov eax,ecx mul DWORD PTR es:[bx+4] ; w* *a add eax,DWORD PTR ds:[di+4] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di+4],eax mov esi,edx ; mov eax,ecx mul DWORD PTR es:[bx+8] ; w* *a add eax,DWORD PTR ds:[di+8] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di+8],eax mov esi,edx ; mov eax,ecx mul DWORD PTR es:[bx+12] ; w* *a add eax,DWORD PTR ds:[di+12] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di+12],eax mov esi,edx ; add bx,16 add di,16 ; dec bp je $L555 jmp $L546 ; ; $L555: mov bp,sp mov bp,WORD PTR [bp+26] ; load num and bp,3 dec bp js $L547m mov eax,ecx mul DWORD PTR es:[bx] ; w* *a add eax,DWORD PTR ds:[di] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di],eax mov esi,edx dec bp js $L547m ; Note that we are now testing for -1 ; mov eax,ecx mul DWORD PTR es:[bx+4] ; w* *a add eax,DWORD PTR ds:[di+4] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di+4],eax mov esi,edx dec bp js $L547m ; mov eax,ecx mul DWORD PTR es:[bx+8] ; w* *a add eax,DWORD PTR ds:[di+8] ; + *r adc edx,0 adc eax,esi adc edx,0 mov DWORD PTR ds:[di+8],eax mov esi,edx $L547m: mov eax,esi mov edx,esi shr edx,16 pop es pop ds pop di pop esi pop bx pop bp ret nop _bn_mul_add_words ENDP PUBLIC _bn_mul_words _bn_mul_words PROC FAR ; Line 76 push bp push bx push esi push di push ds push es xor esi,esi mov bp,sp mov di,WORD PTR [bp+18] ; r mov ds,WORD PTR [bp+20] mov bx,WORD PTR [bp+22] ; a mov es,WORD PTR [bp+24] mov ecx,DWORD PTR [bp+28] ; w mov bp,WORD PTR [bp+26] ; num $FC743: mov eax,ecx mul DWORD PTR es:[bx] add eax,esi adc edx,0 mov DWORD PTR ds:[di],eax mov esi,edx dec bp je $L764 ; mov eax,ecx mul DWORD PTR es:[bx+4] add eax,esi adc edx,0 mov DWORD PTR ds:[di+4],eax mov esi,edx dec bp je $L764 ; mov eax,ecx mul DWORD PTR es:[bx+8] add eax,esi adc edx,0 mov DWORD PTR ds:[di+8],eax mov esi,edx dec bp je $L764 ; mov eax,ecx mul DWORD PTR es:[bx+12] add eax,esi adc edx,0 mov DWORD PTR ds:[di+12],eax mov esi,edx dec bp je $L764 ; add bx,16 add di,16 jmp $FC743 nop $L764: mov eax,esi mov edx,esi shr edx,16 pop es pop ds pop di pop esi pop bx pop bp ret nop _bn_mul_words ENDP PUBLIC _bn_sqr_words _bn_sqr_words PROC FAR ; Line 92 push bp push bx push si push di push ds push es mov bp,sp mov si,WORD PTR [bp+16] mov ds,WORD PTR [bp+18] mov di,WORD PTR [bp+20] mov es,WORD PTR [bp+22] mov bx,WORD PTR [bp+24] mov bp,bx ; save a memory lookup later shr bx,1 ; div count by 4 and do groups of 4 shr bx,1 je $L666 $L765: mov eax,DWORD PTR es:[di] mul eax mov DWORD PTR ds:[si],eax mov DWORD PTR ds:[si+4],edx ; mov eax,DWORD PTR es:[di+4] mul eax mov DWORD PTR ds:[si+8],eax mov DWORD PTR ds:[si+12],edx ; mov eax,DWORD PTR es:[di+8] mul eax mov DWORD PTR ds:[si+16],eax mov DWORD PTR ds:[si+20],edx ; mov eax,DWORD PTR es:[di+12] mul eax mov DWORD PTR ds:[si+24],eax mov DWORD PTR ds:[si+28],edx ; add di,16 add si,32 dec bx je $L666 jmp $L765 $L666: and bp,3 dec bp ; The copied value of bx (num) js $L645 ; mov eax,DWORD PTR es:[di] mul eax mov DWORD PTR ds:[si],eax mov DWORD PTR ds:[si+4],edx dec bp js $L645 ; mov eax,DWORD PTR es:[di+4] mul eax mov DWORD PTR ds:[si+8],eax mov DWORD PTR ds:[si+12],edx dec bp js $L645 ; mov eax,DWORD PTR es:[di+8] mul eax mov DWORD PTR ds:[si+16],eax mov DWORD PTR ds:[si+20],edx $L645: pop es pop ds pop di pop si pop bx pop bp ret _bn_sqr_words ENDP PUBLIC _bn_div64 _bn_div64 PROC FAR push bp mov bp,sp mov edx, DWORD PTR [bp+6] mov eax, DWORD PTR [bp+10] div DWORD PTR [bp+14] mov edx,eax shr edx,16 pop bp ret _bn_div64 ENDP PUBLIC _bn_add_words _bn_add_words PROC FAR ; Line 58 push bp push bx push esi push di push ds push es mov bp,sp ; w = 28 ; num = 26 ; ap = 22 ; rp = 18 xor esi,esi ;c=0; mov bx,WORD PTR [bp+18] ; load low r mov si,WORD PTR [bp+22] ; load a mov es,WORD PTR [bp+24] ; load a mov di,WORD PTR [bp+26] ; load b mov ds,WORD PTR [bp+28] ; load b mov dx,WORD PTR [bp+30] ; load num xor ecx,ecx dec dx js $L547a $L5477: mov eax,DWORD PTR es:[si] ; *a add eax,ecx mov ecx,0 adc ecx,0 add si,4 ; a++ add eax,DWORD PTR ds:[di] ; + *b adc ecx,0 mov ds,WORD PTR [bp+20] add di,4 mov DWORD PTR ds:[bx],eax mov ds,WORD PTR [bp+28] add bx,4 dec dx js $L547a ; Note that we are now testing for -1 jmp $L5477 ; $L547a: mov eax,ecx mov edx,ecx shr edx,16 pop es pop ds pop di pop esi pop bx pop bp ret nop _bn_add_words ENDP F_TEXT ENDS END
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_33_815.asm
ljhsiun2/medusa
9
2238
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r13 push %r14 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x43c4, %rbx nop nop nop nop nop and %r10, %r10 mov $0x6162636465666768, %r14 movq %r14, (%rbx) nop nop nop nop cmp %r11, %r11 lea addresses_UC_ht+0x1e4c0, %rsi sub %r13, %r13 movb (%rsi), %r12b nop sub $59225, %r14 lea addresses_D_ht+0xd6c0, %rsi lea addresses_UC_ht+0x12e80, %rdi nop nop nop xor %r10, %r10 mov $40, %rcx rep movsq nop nop xor %r10, %r10 lea addresses_A_ht+0x14680, %r10 nop sub %r12, %r12 mov $0x6162636465666768, %rdi movq %rdi, %xmm0 movups %xmm0, (%r10) nop nop sub $65284, %r14 lea addresses_D_ht+0x1aef0, %rsi lea addresses_A_ht+0x2a64, %rdi clflush (%rdi) nop nop nop cmp $37366, %r12 mov $69, %rcx rep movsw nop nop nop nop nop sub %r14, %r14 lea addresses_D_ht+0x6ac0, %r10 clflush (%r10) nop nop nop nop nop lfence movw $0x6162, (%r10) nop nop nop sub $32462, %rsi lea addresses_A_ht+0x17fbc, %rsi lea addresses_WT_ht+0x12b90, %rdi nop nop nop nop add $44915, %r11 mov $7, %rcx rep movsw nop sub %rbx, %rbx lea addresses_A_ht+0x86c0, %rcx nop nop and $48305, %rsi mov $0x6162636465666768, %r12 movq %r12, (%rcx) xor $10980, %rdi lea addresses_WT_ht+0x4a5a, %rcx nop cmp %rdi, %rdi movb (%rcx), %r10b nop nop xor %rsi, %rsi lea addresses_D_ht+0x1dac0, %r11 clflush (%r11) nop sub $62244, %rsi vmovups (%r11), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %r14 nop nop nop nop inc %rsi lea addresses_D_ht+0xc8d0, %r12 clflush (%r12) nop nop nop nop nop and %rdi, %rdi movb (%r12), %r13b add $34162, %r13 lea addresses_normal_ht+0x4656, %rsi and %rcx, %rcx movb (%rsi), %r11b nop nop nop dec %r10 lea addresses_normal_ht+0x1e1b4, %r12 nop nop nop dec %r14 movb $0x61, (%r12) and $24224, %r10 pop %rsi pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %rax push %rbp // Store lea addresses_PSE+0x162c0, %rbp nop nop nop nop sub $22066, %r14 movb $0x51, (%rbp) nop nop nop nop nop xor %rax, %rax // Load lea addresses_UC+0x1c9aa, %rbp nop nop add %r13, %r13 movups (%rbp), %xmm6 vpextrq $0, %xmm6, %r10 nop add $27806, %rbp // Faulty Load lea addresses_PSE+0x162c0, %r11 nop nop nop nop xor %rax, %rax mov (%r11), %rbp lea oracles, %r13 and $0xff, %rbp shlq $12, %rbp mov (%r13,%rbp,1), %rbp pop %rbp pop %rax pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'51': 33} 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 */
applet/aide/source/palettes/attic/aide-palette-of_types_package.ads
charlie5/aIDE
3
3827
with aIDE.Palette.of_types, gtk.Widget; private with gtk.Frame, gtk.Scrolled_Window; with Gtk.Box; with Gtk.Button; with Gtk.Notebook; package aIDE.Palette.of_types_package is type Item is new Palette.item with private; type View is access all Item'Class; function to_types_Palette_package return View; function new_Button (Named : in String; package_Name : in String; types_Palette : in palette.of_types.view; use_simple_Name : in Boolean) return Gtk.Button.gtk_Button; procedure Parent_is (Self : in out Item; Now : in aIDE.Palette.of_types.view); function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; function children_Notebook (Self : in Item) return gtk.Notebook.gtk_Notebook; procedure add_Type (Self : access Item; Named : in String; package_Name : in String); private use --gtk.Window, gtk.Button, gtk.Box, gtk.Notebook, gtk.Frame, gtk.Scrolled_Window; type Item is new Palette.item with record Parent : Palette.of_types.view; Top : gtk_Frame; children_Notebook : gtk_Notebook; types_Box : gtk_Box; types_Window : Gtk_Scrolled_Window; end record; end aIDE.Palette.of_types_package;
legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/connection/modelConnection/ModelConnectionParserGrammar.g4
markseavers/legend-engine
0
2691
<reponame>markseavers/legend-engine<filename>legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/connection/modelConnection/ModelConnectionParserGrammar.g4 parser grammar ModelConnectionParserGrammar; import CoreParserGrammar; options { tokenVocab = ModelConnectionLexerGrammar; } // -------------------------------------- IDENTIFIER ------------------------------------- identifier: VALID_STRING | STRING | MODEL_CONNECTION_CLASS | URL ; // -------------------------------------- DEFINITION ------------------------------------- definition: (modelConnectionClass | connectionUrl)* EOF ; connectionUrl: URL COLON STRING SEMI_COLON ; modelConnectionClass: MODEL_CONNECTION_CLASS COLON qualifiedName SEMI_COLON ;
bounce.adb
MatrixMike/AdaDemo1
1
30078
<filename>bounce.adb with Display; use Display; with Display.Basic; use Display.Basic; procedure bounce is Ball : Shape_Id := new_Circle (X => 0.0, Y => 0.0, Radius => 10.0, Color => Blue); begin loop if Get_X (ball) > 100.0 then Step := -0.05; elsif Get_X (ball) < -100.0 then Step := -0.05; end if; Set_X (Ball, Get_X(Ball) + Step); delay 0.001; end loop; end bounce;
programs/oeis/024/A024147.asm
neoneye/loda
22
241725
; A024147: a(n) = 12^n - n^7. ; 1,11,16,-459,4352,170707,2706048,35008265,427884544,5154997383,61907364224,742988883517,8916064616448,106993142630555,1283918359135360,15407021403726993,184884258626600960,2218611106330098319,26623333280273023872,319479999369729055109,3833759992446195122176,46005119909367900377571,552061438912433923235456,6624737266949233606294681,79496847203390839546970112,953962166440690123497782807,11447545997288281547183771008,137370551967459378652126621005,1648446623609512543937550761984,19781359483314150527395274409643,237376313799769806328928421431424,2848515765597237675947375984562977,34182189187166852111368807606386688,410186270246002225336426060975057695 mov $1,12 pow $1,$0 pow $0,7 sub $1,$0 mov $0,$1
programs/oeis/001/A001303.asm
neoneye/loda
22
246872
<gh_stars>10-100 ; A001303: Stirling numbers of first kind, s(n+3, n), negated. ; 6,50,225,735,1960,4536,9450,18150,32670,55770,91091,143325,218400,323680,468180,662796,920550,1256850,1689765,2240315,2932776,3795000,4858750,6160050,7739550,9642906,11921175,14631225,17836160,21605760,26016936,31154200,37110150,43985970,51891945,60947991,71284200,83041400,96371730,111439230,128420446,147505050,168896475,192812565,219486240,249166176,282117500,318622500,358981350,403512850,452555181,506466675,565626600,630435960,701318310,778720586,863113950,954994650,1054884895,1163333745,1280918016,1408243200,1545944400,1694687280,1855169030,2028119346,2214301425,2414512975,2629587240,2860394040,3107840826,3372873750,3656478750,3959682650,4283554275,4629205581,4997792800,5390517600,5808628260,6253420860,6726240486,7228482450,7761593525,8327073195,8926474920,9561407416,10233535950,10944583650,11696332830,12490626330,13329368871,14214528425,15148137600,16132295040,17169166840,18260987976,19410063750,20618771250,21889560825,23224957575 add $0,2 mov $1,-3 bin $1,$0 bin $0,2 mul $0,2 pow $1,2 mul $1,$0 sub $1,72 div $1,12 add $1,6 mov $0,$1
tools/xml2ayacc/xml_io/xml_io-base_readers_streams.ads
faelys/gela-asis
4
9958
------------------------------------------------------------------------------ -- <NAME> A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Text_Streams; with XML_IO.Internals; with XML_IO.Base_Readers; generic with package Implementation is new XML_IO.Internals.Implementation (<>); type Input_Stream (Input : access Text_Streams.Text_Stream'Class) is limited private; with procedure Read (Input : in out Input_Stream; Buffer : in out Implementation.XML_String; Free : out Natural); package XML_IO.Base_Readers_Streams is package Base_Readers renames Implementation.Readers; subtype XML_String is Implementation.XML_String; type Reader (Input : access Text_Streams.Text_Stream'Class; Buffer_Size : Positive) is new Base_Readers.Reader with private; function More_Pieces (Parser : in Reader) return Boolean; function Piece_Kind (Parser : in Reader) return Piece_Kinds; function Encoding (Parser : in Reader) return XML_String; function Standalone (Parser : in Reader) return Boolean; function Text (Parser : in Reader) return XML_String; function Name (Parser : in Reader) return XML_String; function Attribute_Count (Parser : in Reader) return List_Count; procedure Initialize (Parser : in out Reader); procedure Next (Parser : in out Reader); function Attribute_Name (Parser : in Reader; Index : in List_Index) return XML_String; function Attribute_Value (Parser : in Reader; Index : in List_Index) return XML_String; function Attribute_Value (Parser : in Reader; Name : in XML_String; Default : in XML_String := Implementation.Nil_Literal; Raise_Error : in Boolean := False) return XML_String; Default_Buffer_Size : constant Positive := 8192; private type Reader (Input : access Text_Streams.Text_Stream'Class; Buffer_Size : Positive) is new Implementation.Reader with record Stream : Input_Stream (Input); Buffer : Xml_String (1 .. Buffer_Size); end record; procedure Read (Parser : in out Reader; Buffer : in out XML_String; Last : out Natural); end XML_IO.Base_Readers_Streams; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- 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 Maxim Reznik, 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 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. ------------------------------------------------------------------------------
oeis/154/A154152.asm
neoneye/loda-programs
11
104106
<gh_stars>10-100 ; A154152: Indices k such that 26 plus the k-th triangular number is a perfect square. ; Submitted by <NAME>(s1) ; 4,10,37,67,220,394,1285,2299,7492,13402,43669,78115,254524,455290,1483477,2653627,8646340,15466474,50394565,90145219,293721052,525404842,1711931749,3062283835,9977869444,17848298170,58155284917,104027505187,338953840060,606316732954,1975567755445,3533872892539,11514452692612,20596920622282,67111148400229,120047650841155,391152437708764,699688984424650,2279803477852357,4078086255706747,13287668429405380,23768828549815834,77446207098579925,138534885043188259,451389574162074172,807440481709313722 mov $2,1 lpb $0 sub $0,1 add $1,1 mov $3,$0 add $3,$0 mod $3,4 mul $3,$2 add $1,$3 add $2,$1 lpe add $2,$1 mov $0,$2 sub $0,1 mul $0,3 add $0,4
problems/ModusPonens/Verifier.agda
danr/agder
1
1009
module Verifier where open import ModusPonens using (modusPonens) check : ∀ {P Q : Set} → (P → Q) → P → Q check = modusPonens
libsrc/zx81/tape/tape_load_block.asm
andydansby/z88dk-mk2
1
88294
<reponame>andydansby/z88dk-mk2 ; int tape_load_block(void *addr, size_t len, unsigned char type) ; CALLER linkage for function pointers XLIB tape_load_block LIB tape_load_block_callee XREF ASMDISP_TAPE_LOAD_BLOCK_CALLEE .tape_load_block pop de pop bc ld a,c pop bc pop hl push hl push bc push bc ; altered ! push de jp tape_load_block_callee + ASMDISP_TAPE_LOAD_BLOCK_CALLEE
progs/chap04p09-realadd.asm
HKhademian/AssemblyDandamudi
1
82900
<gh_stars>1-10 %include "lib.asm" extern ExitProcess ; windows syscall to exit section .text MSG_INP_SEG db "Please Enter segment Address: ", 0 MSG_INP_OFF db "Please Enter offset Address: ", 0 MSG_REAL db "Real Address is: ", 0 section .data section .bss buffer resb 25 section .code global _start _start: puts MSG_INP_SEG fgets buffer, 12 a2i 12, buffer mov EBX, EAX puts MSG_INP_OFF fgets buffer, 12 a2i 12, buffer and EBX, 0FFFFH shl EBX, 4 and EAX, 0FFFFH add EAX, EBX puts MSG_REAL i2a EAX, buffer puts buffer ;jmp _start _end: push 0 call ExitProcess
programs/oeis/081/A081421.asm
neoneye/loda
22
97633
<filename>programs/oeis/081/A081421.asm ; A081421: Quotient after one division by 2 of numbers of the form 3^(2n) + 5^(2n). ; 1,17,353,8177,198593,4912337,122336033,3054149297,76315468673,1907542343057,47685459212513,1192108586037617,29802463602463553,745059330625296977,18626462930705797793,465661390253305305137 mul $0,2 mov $1,5 pow $1,$0 mov $2,3 pow $2,$0 add $1,$2 div $1,2 mov $0,$1
object-handle.ads
jrcarter/Ada_GUI
19
23363
-- -- -- package Object.Handle Copyright (c) <NAME> -- -- Interface Luebeck -- -- Winter, 2002 -- -- -- -- Last revision : 20:41 21 Jul 2017 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- -- -- The generic package Object.Handle provides the the type Handle used -- to reference decendants of the type Entity (declared in the package -- Object). An object is not destroyed as long as at least one handle of -- a object exists. The object is destoyed upon finalization of the last -- handle to it. Handles can be copied. -- -- Object_Type - A type derived from Object.Entity -- Object_Type_Ptr - A class-wide access type for Object_Type'Class -- generic type Object_Type (<>) is abstract new Entity with private; type Object_Type_Ptr is access Object_Type'Class; package Object.Handle is type Handle is new Ada.Finalization.Controlled with private; Null_Handle : constant Handle; -- -- Adjust -- Assignment -- -- Reference - The handle -- -- This procedure increases the reference count the object. -- procedure Adjust (Reference : in out Handle); -- -- Finalize -- Destructor -- -- Reference - The handle -- -- When the last handle to the object is finalized, the object is -- destroyed. -- procedure Finalize (Reference : in out Handle); -- -- Invalidate -- Detach handle from the object -- -- Reference - The handle -- -- This procedure makes handle pointing to nothing. If it was the last -- reference to the object, the later is destroyed. -- procedure Invalidate (Reference : in out Handle); -- -- Is_Valid -- Check if the handle is associated with an object -- -- Reference - The handle -- -- Returns : -- -- True if the handle can de dereferenced -- function Is_Valid (Reference : Handle) return Boolean; -- -- Ptr -- Get the pointer to the object by the handle -- -- Reference - The handle -- -- Returns : -- -- The referenced object or null if Reference is invalid -- function Ptr (Reference : Handle) return Object_Type_Ptr; -- -- Ref -- Get handle to an object -- -- Thing - A pointer to the object -- -- Returns : -- -- Handle to the object -- function Ref (Thing : Object_Type_Ptr) return Handle; -- -- Set -- Handle to an object -- -- Reference - A handle to set -- Thing - A pointer to the object -- procedure Set (Reference : in out Handle; Thing : Object_Type_Ptr); -- -- <, <=, =, >=, > -- Comparisons -- -- Left - The first argument -- Right - The second argument -- -- Only valid handles are comparable. However it is exception-safe to -- compare Null_Handle for equality. In all other cases Constraint_Error -- is propagated. -- -- Returns : -- -- The result of comparison of the objects -- -- Exceptions : -- -- Constraint_Error - One of arguments is Null_Handle -- function "<" (Left, Right : Handle) return Boolean; function "<=" (Left, Right : Handle) return Boolean; function "=" (Left, Right : Handle) return Boolean; function ">=" (Left, Right : Handle) return Boolean; function ">" (Left, Right : Handle) return Boolean; -- -- = -- Equality (handle and object) -- -- Left - The first argument -- Right - The second argument -- -- Returns : -- -- The result of comparison -- function "=" (Left : Handle; Right : access Object_Type'Class) return Boolean; function "=" (Left : access Object_Type'Class; Right : Handle) return Boolean; private pragma Inline (Adjust); pragma Inline (Finalize); pragma Inline (Invalidate); pragma Inline (Is_Valid); pragma Inline (Ptr); pragma Inline (Ref); pragma Inline (Set); pragma Inline ("<=", "<", "=", ">", ">="); pragma Inline ("="); type Handle is new Ada.Finalization.Controlled with record Ptr : Object_Type_Ptr := null; end record; -- -- Release -- Decrement object's use count -- -- Ptr - To the object -- -- The object pointed by Ptr is deleted if its use count in 1. Otherwise -- the use count is decremented. Nothing happens if Ptr is null. -- -- Exceptions : -- -- Program_Error - Use count is already zero -- procedure Release (Ptr : in out Object_Type_Ptr); pragma Inline (Release); Null_Handle : constant Handle := (Ada.Finalization.Controlled with null); end Object.Handle;
oeis/062/A062112.asm
neoneye/loda-programs
11
18964
<gh_stars>10-100 ; A062112: a(0)=0; a(1)=1; a(n) = a(n-1) + (3 + (-1)^n)*a(n-2)/2. ; Submitted by <NAME>(s2) ; 0,1,1,2,4,6,14,20,48,68,164,232,560,792,1912,2704,6528,9232,22288,31520,76096,107616,259808,367424,887040,1254464,3028544,4283008,10340096,14623104,35303296,49926400,120532992,170459392,411525376,581984768,1405035520,1987020288,4797091328,6784111616,16378294272,23162405888,55918994432,79081400320,190919389184,270000789504,651839567872,921840357376,2225519493120,3147359850496,7598398836736,10745758687232,25942556360704,36688315047936,88573427769344,125261742817280,302408598355968,427670341173248 mov $1,1 lpb $0 sub $0,2 add $1,$2 mul $2,2 add $2,$1 lpe lpb $0 sub $0,1 add $2,$1 lpe mov $0,$2
registrar-executive-unit_entry-execute-parse_pack.adb
annexi-strayline/AURA
13
13028
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- 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 copyright holder 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. -- -- -- ------------------------------------------------------------------------------ separate (Registrar.Executive.Unit_Entry.Execute) package body Parse_Pack is Source: Source_Buffer (Source_Pack.Stream'Access); -- The parse buffer E: Lexical_Element; -- Last element parsed ------------- -- Content -- ------------- function Content return Wide_Wide_String is (WWU.To_Wide_Wide_String (E.Content)); -------------- -- Category -- -------------- function Category return Lexical_Category is (E.Category); ------------------ -- Next_Element -- ------------------ procedure Next_Element is begin loop -- Also skip comments E := Next_Element (Source); exit when Category /= Comment; end loop; end Next_Element; ----------------------- -- Skip_To_Semicolon -- ----------------------- procedure Skip_To_Semicolon is begin -- Keep going until we find a ';' delimiter loop Next_Element; exit when Category = Delimiter and then Content = ";"; end loop; end Skip_To_Semicolon; ----------------------- -- File_And_Position -- ----------------------- function File_And_Position return String is Pos: Source_Position := Last_Position (Source); begin return UBS.To_String (Order.File_Full_Name) & ':' & Positive'Image (Pos.Line) & ':' & Positive'Image (Pos.Column); end File_And_Position; ----------------- -- Abort_Parse -- ----------------- procedure Abort_Parse is begin raise Invalid_Unit with "Unexpected " & Lexical_Category'Image (E.Category) & " element " & '"' & Ada.Characters.Conversions.To_String (WWU.To_Wide_Wide_String (E.Content)) & '"' & " at " & File_And_Position; end Abort_Parse; end Parse_Pack;
programs/oeis/194/A194826.asm
karttu/loda
0
83855
; A194826: Units' digits of the nonzero 9-gonal (nonagonal) numbers. ; 1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5 mov $3,$0 sub $3,$0 add $0,4 bin $0,2 sub $3,3 mul $0,$3 lpb $0,1 mov $2,$0 mod $2,10 add $2,1 mov $0,$2 div $0,10 mov $1,$2 lpe add $1,8
src/asm/defs.asm
GeekJoystick/mmagedit
9
90050
<reponame>GeekJoystick/mmagedit<filename>src/asm/defs.asm ; ------------------------------------------------------------------------------ ; memory address values ENUM $0 BASE $BC current_level: BASE $BD current_world: BASE $72 current_lives: BASE $71 game_state: ; 01 -> normal, 05 -> star-spin flying? BASE $6F game_state_b: ; bit 7: hard mode. bit 6: hell mode. BASE $D0 camera_speed: BASE $7F item_drop_counter: ; ----------------------------------------------------------------------------- ; buffer of length 0x20. First four entries are reserved for the players. BASE $200 object_ids: ; object x: BASE $4A object_x: BASE $360 object_y: BASE $2E0 object_state_a: BASE $3F0 object_state_b: ; used as a timer by skeleton BASE $300 object_state_c: BASE $2A0 object_yspeed_int: BASE $2C0 object_yspeed_frac: BASE $260 object_xspeed_int: BASE $280 object_xspeed_frac: BASE $440 object_hp: ; ------------------------------------------------------------------------------ ; music BASE $17 mus_tempo: ; number of frames between notes. BASE $18 mus_tempo_timer: ; current frame mod mus_tempo. BASE $4C4 mus_current_song: ; these are each arrays of length 6. The first 4 indices are for each channel, the second two are for sfx. ; the following two define the current "nibble" position of the track, as an offset in nibbles BASE $8000. BASE $466 mus_pattern_l: BASE $46C mus_pattern_u: ; how many tempo units to wait until proceeding to next command. BASE $472 mus_wait: ; second nibble is remaining duration this note will be held for (in frames). F means no release. BASE $478 mus_hold_duration: BASE $47E mus_note_articulation: ; the style of note articulation used. BASE $484 mus_pitch_l: ; the pitch for this note (least-significant digits) BASE $48a mus_pitch_h: ; the pitch for this note (most-significant digit) BASE $490 mus_dynamics: ; the dynamics (volume) for this note BASE $496 mus_key: ; this is transforms (adds to?) the note's pitch. Effectively, this is the "key" of the current pattern. BASE $49C mus_slide: ; this is a slide effect applied to the note BASE $4A2 mus_var8: ; number of times current "repeat" section has executed. BASE $4A8 mus_repeat_idx: ; return address for music subroutine BASE $4AE mus_reta_l: BASE $4B2 mus_reta_u: ; these are each arrays of length 4 BASE $4B2 mus_var9: ; the number of times the subroutine has repeated. BASE $4B6 mus_subrepeat_idx: ; unknown ; every note played, this resets to 0 and increments until a cap. BASE $4BA mus_varC: BASE $4C6 mus_varD: ; length not known BASE $4CA mus_varE: ; the amount of time this note has been playing so far ; every note, this resets to 0. BASE $4BE mus_note_timer: BASE $4F5 mus_varA: BASE $4F9 mus_varB: BASE $580 text_ppuAddr: ; ------------------------------------------------------------------------------ ; points to next 4 (8 when mirrored) macro-tiles. BASE $C0 level_data: ; when loading macro tiles, this value stores the seam (mirror) position. ; this address has other uses too. BASE $E3 seam_accumulator: ; these contain the minitile data per medtile. BASE $EB medtile_data_a: BASE $ED medtile_data_b: BASE $EF medtile_data_c: BASE $F1 medtile_data_d: ; ------------------------------------------------------------------------------ ; NES peripheral registers BASE $2002 PPUSTATUS: BASE $2005 PPUSCROLL: BASE $2006 PPUADDR: BASE $2007 PPUDATA: ENDE
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_377_1210.asm
ljhsiun2/medusa
9
179913
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x4d35, %rsi lea addresses_WC_ht+0x4d55, %rdi nop nop sub $48143, %rbp mov $7, %rcx rep movsq dec %rbx lea addresses_A_ht+0x10985, %r12 nop nop nop nop nop and $2749, %r8 movl $0x61626364, (%r12) nop nop sub $5383, %rbp lea addresses_D_ht+0x1eab5, %rbx nop nop nop and $56379, %rbp mov (%rbx), %rcx nop nop cmp %r8, %r8 lea addresses_WC_ht+0x1175, %r12 clflush (%r12) nop nop nop cmp $38239, %rbp mov (%r12), %rcx nop nop nop nop add $40535, %rcx lea addresses_WT_ht+0x13264, %rsi lea addresses_normal_ht+0x1d0f5, %rdi nop nop nop nop cmp %r15, %r15 mov $86, %rcx rep movsw nop inc %r12 lea addresses_D_ht+0x10c35, %rsi lea addresses_WT_ht+0x15c35, %rdi and $40100, %rbx mov $9, %rcx rep movsw nop nop nop add %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r9 push %rbp push %rbx push %rcx // Store lea addresses_PSE+0x1e0a9, %rbx nop sub $6203, %rcx movl $0x51525354, (%rbx) nop add $58963, %rcx // Store lea addresses_PSE+0xddb5, %rbp nop nop add %r9, %r9 movb $0x51, (%rbp) nop nop sub %r13, %r13 // Load lea addresses_D+0x15c35, %r14 nop nop nop add $49007, %r11 vmovups (%r14), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rcx nop xor %r11, %r11 // Load mov $0xc35, %r11 nop nop nop nop nop dec %rcx movb (%r11), %r9b nop xor $13095, %rbx // Load lea addresses_US+0x5e35, %r9 nop nop xor %rcx, %rcx movb (%r9), %bl inc %r9 // Store lea addresses_WT+0xc8b5, %r9 nop cmp %rcx, %rcx movl $0x51525354, (%r9) nop nop nop xor %r11, %r11 // Faulty Load lea addresses_D+0x15c35, %r9 nop nop sub %rbx, %rbx mov (%r9), %r11w lea oracles, %r14 and $0xff, %r11 shlq $12, %r11 mov (%r14,%r11,1), %r11 pop %rcx pop %rbx pop %rbp pop %r9 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}} {'36': 377} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
choices/minlist-is-correct.agda
mihanus/curry-agda
0
12280
<reponame>mihanus/curry-agda -- Proof: if we non-deterministically select an element -- which is less-than-or-equal than all other elements, -- such a result is the minimum of the list. -- This holds for any non-deterministically selected element. -- Basically, this is the translation of the Curry rule: -- -- min-nd xs@(_++[x]++_) | all (x<=) xs = x -- open import bool module minlist-is-correct (Choice : Set) (choose : Choice → 𝔹) (lchoice : Choice → Choice) (rchoice : Choice → Choice) where open import eq open import bool-thms open import bool-thms2 open import nat open import nat-thms open import list open import maybe open import inspect ---------------------------------------------------------------------- -- Some auxiliaries: -- We define our own less-or-equal since the standard definition with -- if-then-else produces too many branches: _<=_ : ℕ → ℕ → 𝔹 0 <= y = tt (suc x) <= 0 = ff (suc x) <= (suc y) = x <= y -- Some properties about less-or-equal: <=-refl : ∀ (x : ℕ) → x <= x ≡ tt <=-refl 0 = refl <=-refl (suc x) = <=-refl x <=-trans : ∀ (x y z : ℕ) → x <= y ≡ tt → y <= z ≡ tt → x <= z ≡ tt <=-trans zero y z p1 p2 = refl <=-trans (suc x) zero z p1 p2 = 𝔹-contra p1 <=-trans (suc x) (suc y) zero p1 p2 = 𝔹-contra p2 <=-trans (suc x) (suc y) (suc z) p1 p2 = <=-trans x y z p1 p2 <=-< : ∀ (x y : ℕ) → x <= y ≡ ff → y < x ≡ tt <=-< zero x () <=-< (suc x) zero p = refl <=-< (suc x) (suc y) p = <=-< x y p <-<= : ∀ (x y : ℕ) → x < y ≡ tt → y <= x ≡ ff <-<= x zero p rewrite <-0 x = 𝔹-contra p <-<= zero (suc y) p = refl <-<= (suc x) (suc y) p = <-<= x y p <-<=-ff : ∀ (x y : ℕ) → x < y ≡ ff → y <= x ≡ tt <-<=-ff zero zero p = refl <-<=-ff zero (suc y) p = 𝔹-contra (sym p) <-<=-ff (suc x) zero p = refl <-<=-ff (suc x) (suc y) p = <-<=-ff x y p <-<=-trans : ∀ (x y z : ℕ) → x < y ≡ tt → y <= z ≡ tt → x < z ≡ tt <-<=-trans zero zero z p1 p2 = 𝔹-contra p1 <-<=-trans zero (suc y) zero p1 p2 = 𝔹-contra p2 <-<=-trans zero (suc y) (suc z) p1 p2 = refl <-<=-trans (suc x) zero z p1 p2 = 𝔹-contra p1 <-<=-trans (suc x) (suc y) zero p1 p2 = 𝔹-contra p2 <-<=-trans (suc x) (suc y) (suc z) p1 p2 = <-<=-trans x y z p1 p2 ---------------------------------------------------------------------- -- More lemmas about ordering relations: leq-if : ∀ (x y z : ℕ) → y <= x && y <= z ≡ (if x <= z then y <= x else y <= z) leq-if x y z with inspect (y <= x) leq-if x y z | it tt p1 with inspect (x <= z) ... | it tt p2 rewrite p1 | p2 | <=-trans y x z p1 p2 = refl ... | it ff p2 rewrite p1 | p2 = refl leq-if x y z | it ff p1 with inspect (x <= z) ... | it tt p2 rewrite p1 | p2 = refl ... | it ff p2 rewrite p1 | p2 | <-<= z y (<-trans {z} {x} {y} (<=-< x z p2) (<=-< y x p1)) = refl le-if : ∀ (x y z : ℕ) → y < x && y < z ≡ (if x <= z then y < x else y < z) le-if x y z with inspect (y < x) le-if x y z | it tt p1 with inspect (x <= z) ... | it tt p2 rewrite p1 | p2 | <-<=-trans y x z p1 p2 = refl ... | it ff p2 rewrite p1 | p2 = refl le-if x y z | it ff p1 with inspect (x <= z) ... | it tt p2 rewrite p1 | p2 = refl ... | it ff p2 rewrite p1 | p2 | <-asym {z} {y} (<-<=-trans z x y (<=-< x z p2) (<-<=-ff y x p1)) = refl ---------------------------------------------------------------------- -- A lemma relating equality and orderings: =ℕ-not-le : ∀ (m n : ℕ) → m =ℕ n ≡ ~ (m < n) && m <= n =ℕ-not-le zero zero = refl =ℕ-not-le zero (suc m) = refl =ℕ-not-le (suc n) zero = refl =ℕ-not-le (suc n) (suc m) = =ℕ-not-le n m ---------------------------------------------------------------------- -- This is the translation of the Curry program: -- Check whether all elements of a list satisfy a given predicate: all : {A : Set} → (A → 𝔹) → 𝕃 A → 𝔹 all _ [] = tt all p (x :: xs) = p x && all p xs -- Deterministic min-d: min-d : (l : 𝕃 ℕ) → is-empty l ≡ ff → ℕ min-d [] () min-d (x :: []) _ = x min-d (x :: y :: xs) _ = --if x <= min-d (y :: xs) refl then x else min-d (y :: xs) refl let z = min-d (y :: xs) refl in if x <= z then x else z -- Select some element from a list: select : {A : Set} → Choice → 𝕃 A -> maybe A select _ [] = nothing select ch (x :: xs) = if choose ch then just x else select (lchoice ch) xs -- Select elements with a property from a list: select-with : {A : Set} → Choice → (A → 𝔹) → 𝕃 A → maybe A select-with _ p [] = nothing select-with ch p (x :: xs) = if choose ch then (if p x then just x else nothing) else select-with (lchoice ch) p xs {- -- more or less original definition: min-nd : Choice → 𝕃 ℕ -> maybe ℕ min-nd ch xs = (select ch xs) ≫=maybe (λ y → if all (_<=_ y) xs then just y else nothing) -} min-nd : Choice → (xs : 𝕃 ℕ) → maybe ℕ min-nd ch xs = select-with ch (λ x → all (_<=_ x) xs) xs ---------------------------------------------------------------------- -- Proof of the correctness of the operation select-with: select-with-correct : ∀ {A : Set} → (ch : Choice) (p : A → 𝔹) (xs : 𝕃 A) (z : A) → select-with ch p xs ≡ just z → p z ≡ tt select-with-correct ch p [] z () select-with-correct ch p (x :: xs) z u with choose ch select-with-correct ch p (x :: xs) z u | tt with inspect (p x) select-with-correct ch p (x :: xs) z u | tt | it tt v rewrite v | u | down-≡ u = v select-with-correct ch p (x :: xs) z u | tt | it ff v rewrite v with u select-with-correct ch p (x :: xs) z u | tt | it ff v | () select-with-correct ch p (x :: xs) z u | ff = select-with-correct (lchoice ch) p xs z u ---------------------------------------------------------------------- -- First step: if y smaller than all elements, y is smaller than the minimum: all-leq-min : ∀ (y x : ℕ) (xs : 𝕃 ℕ) → all (_<=_ y) (x :: xs) ≡ y <= min-d (x :: xs) refl all-leq-min y x [] = &&-tt (y <= x) all-leq-min y x (z :: zs) rewrite all-leq-min y z zs | ite-arg (_<=_ y) (x <= min-d (z :: zs) refl) x (min-d (z :: zs) refl) = leq-if x y (min-d (z :: zs) refl) -- Now we can prove: -- if min-nd selects an element, it is smaller or equal than the minimum: min-nd-select-min-d : ∀ (ch : Choice) (x : ℕ) (xs : 𝕃 ℕ) (z : ℕ) → min-nd ch (x :: xs) ≡ just z → z <= min-d (x :: xs) refl ≡ tt min-nd-select-min-d ch x xs z u rewrite sym (all-leq-min z x xs) | select-with-correct ch (λ y → all (_<=_ y) (x :: xs)) (x :: xs) z u = refl ---------------------------------------------------------------------- -- Next step: if y smaller than all elements, y is smaller than the minimum: all-less-min : ∀ (y x : ℕ) (xs : 𝕃 ℕ) → all (_<_ y) (x :: xs) ≡ y < min-d (x :: xs) refl all-less-min y x [] rewrite &&-tt (y < x) = refl all-less-min y x (z :: zs) rewrite all-less-min y z zs | ite-arg (_<_ y) (x <= min-d (z :: zs) refl) x (min-d (z :: zs) refl) = le-if x y (min-d (z :: zs) refl) -- Next want to prove that the element selected by min-nd cannot be smaller -- than the minimum. -- For this purpose, we prove an auxiliary lemma: -- If an element is selected from a list, it cannot be smaller than all elements select-with-all<-ff : ∀ (ch : Choice) (p : ℕ → 𝔹) (xs : 𝕃 ℕ) (z : ℕ) → select-with ch p xs ≡ just z → all (_<_ z) xs ≡ ff select-with-all<-ff ch _ [] z () select-with-all<-ff ch p (x :: xs) z u with (choose ch) select-with-all<-ff ch p (x :: xs) z u | tt with (p x) select-with-all<-ff ch p (x :: xs) z u | tt | tt rewrite down-≡ u | <-irrefl z = refl select-with-all<-ff ch p (x :: xs) z () | tt | ff select-with-all<-ff ch p (x :: xs) z u | ff rewrite select-with-all<-ff (lchoice ch) p xs z u | &&-ff (z < x) = refl -- Now we can prove: if min-nd selects an element, it cannot be smaller -- than all other elements: min-nd-select-all<-ff : ∀ (ch : Choice) (xs : 𝕃 ℕ) (z : ℕ) → min-nd ch xs ≡ just z → all (_<_ z) xs ≡ ff min-nd-select-all<-ff ch xs z u rewrite select-with-all<-ff ch (λ y → all (_<=_ y) xs) xs z u = refl ---------------------------------------------------------------------- -- This is the main theorem: min-nd-theorem : ∀ (ch : Choice) (x : ℕ) (xs : 𝕃 ℕ) (z : ℕ) → min-nd ch (x :: xs) ≡ just z → z =ℕ min-d (x :: xs) refl ≡ tt min-nd-theorem ch x xs z u rewrite =ℕ-not-le z (min-d (x :: xs) refl) -- split equality into no less and leq | min-nd-select-min-d ch x xs z u -- min-nd selects leq min. elements | sym (all-less-min z x xs) -- less-than min. elements satisfy all< | min-nd-select-all<-ff ch (x :: xs) z u -- min-nd can't select any all< element = refl ----------------------------------------------------------------------
Task/Queue-Definition/Ada/queue-definition-8.ada
LaudateCorpus1/RosettaCodeData
1
25636
<reponame>LaudateCorpus1/RosettaCodeData package body Synchronous_Fifo is ---------- -- Fifo -- ---------- protected body Fifo is --------- -- Push -- --------- entry Push (Item : Element_Type) when not Is_New is begin Value := Item; Is_New := True; end Push; --------- -- Pop -- --------- entry Pop (Item : out Element_Type) when Is_New is begin Item := Value; Is_New := False; end Pop; end Fifo; end Synchronous_Fifo;
programs/oeis/078/A078582.asm
karttu/loda
0
684
; A078582: Duplicate of A051336. ; 1,3,7,13,22,33,48,65,86,110,138,168,204,242,284,330,381,434,493,554 mov $1,1 mov $2,$0 lpb $2,1 add $3,1 mov $4,$2 lpb $4,1 add $1,$4 trn $4,$3 lpe add $1,1 sub $2,1 lpe
Engine Hacks/Strmag/Strmag/Str Mag Split/Autolevelling and Saves/Class Mag Autolevel.asm
sme23/Christmas2
3
163372
.thumb .org 0x0 push {r14} ldrb r1,[r4,#0x17] add r1,r1,r0 strb r1,[r4,#0x17] ldr r0,GetGrowthChance mov r14,r0 ldr r0,[r4,#0x4] ldrb r0,[r0,#0x4] @class number lsl r0,#0x2 ldr r1,MagClassGrowth add r0,r1 ldrb r0,[r0,#0x1] mov r1,r5 .short 0xF800 mov r1,r4 add r1,#0x3A ldrb r2,[r1] add r2,r0,r2 strb r2,[r1] ldr r0,[r4,#0x4] add r0,#0x20 ldrb r0,[r0] lsl r0 ,r0 ,#0x18 asr r0 ,r0 ,#0x18 pop {r1} bx r1 .align GetGrowthChance: .long 0x0802B9C4 MagClassGrowth:
regression/symtab2gb/multiple_symtabs/library.ads
tobireinhard/cbmc
412
7027
<filename>regression/symtab2gb/multiple_symtabs/library.ads<gh_stars>100-1000 procedure Library (X : Integer);
oeis/108/A108673.asm
neoneye/loda-programs
11
175331
; A108673: a(n) = (n+1)(n+2)(n+3)(2n+3)(10n^2 + 27n + 20)/360. ; Submitted by <NAME> ; 1,19,133,573,1848,4914,11382,23766,45771,82621,141427,231595,365274,557844,828444,1200540,1702533,2368407,3238417,4359817,5787628,7585446,9826290,12593490,15981615,20097441,25060959,31006423,38083438,46458088 add $0,1 mov $2,$0 lpb $0 add $2,1 mov $3,$2 mul $3,$0 sub $0,1 add $4,$3 mul $3,$4 add $1,$3 lpe mov $0,$1 sub $0,4 div $0,4 add $0,1
libsrc/_DEVELOPMENT/alloc/malloc/c/sdcc_ix/heap_info_unlocked.asm
meesokim/z88dk
0
12752
; void heap_info_unlocked(void *heap, void *callback) SECTION code_alloc_malloc PUBLIC heap_info_unlocked EXTERN l0_heap_info_unlocked_callee heap_info_unlocked: pop af pop de pop bc push bc push de push af jp l0_heap_info_unlocked_callee
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
clbigdata/shardingsphere
0
1994
<reponame>clbigdata/shardingsphere<gh_stars>0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ grammar DCLStatement; import BaseRule; grant : GRANT (grantClassPrivilegesClause | grantClassTypePrivilegesClause) ; grantClassPrivilegesClause : classPrivileges (ON onClassClause)? TO principal (COMMA_ principal)* (WITH GRANT OPTION)? (AS principal)? ; grantClassTypePrivilegesClause : classTypePrivileges (ON onClassTypeClause)? TO principal (COMMA_ principal)* (WITH GRANT OPTION)? ; classPrivileges : privilegeType columnNames? (COMMA_ privilegeType columnNames?)* ; onClassClause : (classItem COLON_ COLON_)? securable ; classTypePrivileges : privilegeType (COMMA_ privilegeType)* ; onClassTypeClause : (classType COLON_ COLON_)? securable ; securable : (owner DOT_)? name ; principal : userName ; revoke : REVOKE (optionForClause? revokeClassPrivilegesClause | revokeClassTypePrivilegesClause) ; revokeClassPrivilegesClause : classPrivileges (ON onClassClause)? (TO | FROM) principal (COMMA_ principal)* (CASCADE)? (AS principal)? ; revokeClassTypePrivilegesClause : classTypePrivileges (ON onClassTypeClause)? (TO | FROM) principal (COMMA_ principal)* (CASCADE)? ; deny : DENY (denyClassPrivilegesClause | denyClassTypePrivilegesClause) ; denyClassPrivilegesClause : classPrivileges (ON onClassClause)? TO principal (COMMA_ principal)* (CASCADE)? (AS principal)? ; denyClassTypePrivilegesClause : classTypePrivileges (ON onClassTypeClause)? TO principal (COMMA_ principal)* (CASCADE)? ; optionForClause : GRANT OPTION FOR ; privilegeType : ALL PRIVILEGES? | assemblyPermission | asymmetricKeyPermission | availabilityGroupPermission | certificatePermission | objectPermission | systemObjectPermission | databasePermission | databasePrincipalPermission | databaseScopedCredentialPermission | endpointPermission | fullTextPermission | schemaPermission | searchPropertyListPermission | serverPermission | serverPrincipalPermission | serviceBrokerPermission | symmetricKeyPermission | typePermission | xmlSchemaCollectionPermission ; objectPermission : ALTER | CONTROL | DELETE | EXECUTE | INSERT | RECEIVE | REFERENCES | SELECT | TAKE OWNERSHIP | UPDATE | VIEW CHANGE TRACKING | VIEW DEFINITION ; serverPermission : ADMINISTER BULK OPERATIONS | ALTER (RESOURCES | SETTINGS | TRACE | SERVER STATE) | ALTER ANY (AVAILABILITY GROUP | CONNECTION | CREDENTIAL | DATABASE | ENDPOINT | EVENT NOTIFICATION | EVENT SESSION | LINKED SERVER | LOGIN | SERVER AUDIT | SERVER ROLE) | AUTHENTICATE SERVER | CONNECT ANY DATABASE | CONNECT SQL | CONTROL SERVER | CREATE ANY DATABASE | CREATE (AVAILABILITY GROUP | DDL EVENT NOTIFICATION | ENDPOINT | SERVER ROLE | TRACE EVENT NOTIFICATION) | EXTERNAL ACCESS ASSEMBLY | IMPERSONATE ANY LOGIN | SELECT ALL USER SECURABLES | SHUTDOWN | UNSAFE ASSEMBLY | VIEW ANY (DATABASE | DEFINITION) | VIEW SERVER STATE ; serverPrincipalPermission : CONTROL SERVER? | IMPERSONATE | VIEW ANY? DEFINITION | ALTER | ALTER ANY (LOGIN | SERVER ROLE) ; databasePermission : ADMINISTER DATABASE BULK OPERATIONS | ALTER | ALTER TRACE | ALTER ANY (APPLICATION ROLE | ASSEMBLY | (SYMMETRIC | ASYMMETRIC | COLUMN ENCRYPTION) KEY | CERTIFICATE | CONNECTION | COLUMN MASTER KEY DEFINITION | CONTRACT | DATABASE (AUDIT | DDL TRIGGER | EVENT NOTIFICATION | EVENT SESSION | SCOPED CONFIGURATION)? | DATASPACE | EVENT (NOTIFICATION | SESSION) | EXTERNAL (DATA SOURCE | FILE FORMAT | LIBRARY) | FULLTEXT CATALOG | MASK | MESSAGE TYPE | REMOTE SERVICE BINDING | ROLE | ROUTE | SERVER AUDIT | SCHEMA | SECURITY POLICY | SERVICE | USER) | AUTHENTICATE SERVER? | BACKUP (DATABASE | LOG) | CHECKPOINT | CONNECT | CONNECT REPLICATION? | CONTROL SERVER? | CREATE (AGGREGATE | ASSEMBLY | (SYMMETRIC | ASYMMETRIC) KEY | CERTIFICATE | CONTRACT | DATABASE | DATABASE? DDL EVENT NOTIFICATION | DEFAULT | FULLTEXT CATALOG | FUNCTION | MESSAGE TYPE | PROCEDURE | QUEUE | REMOTE SERVICE BINDING | ROLE | ROUTE | RULE | SCHEMA | SERVICE | SYNONYM | TABLE | TYPE | VIEW | XML SCHEMA COLLECTION) | DELETE | EXECUTE | EXECUTE ANY? EXTERNAL SCRIPT | INSERT | KILL DATABASE CONNECTION | REFERENCES | SELECT | SHOWPLAN | SUBSCRIBE QUERY NOTIFICATIONS | TAKE OWNERSHIP | UNMASK | UPDATE | VIEW ANY COLUMN (MASTER | ENCRYPTION) KEY DEFINITION | CREATE ANY (DATABASE | EXTERNAL LIBRARY) | VIEW (DATABASE | SERVER) STATE | VIEW ANY? DEFINITION | ; databasePrincipalPermission : databaseUserPermission | databaseRolePermission | applicationRolePermission ; databaseUserPermission : CONTROL | IMPERSONATE | ALTER | VIEW DEFINITION | ALTER ANY USER ; databaseRolePermission : CONTROL | TAKE OWNERSHIP | ALTER | VIEW DEFINITION | ALTER ANY ROLE ; applicationRolePermission : CONTROL | ALTER | VIEW DEFINITION | ALTER ANY APPLICATION ROLE ; databaseScopedCredentialPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION ; schemaPermission : ALTER | CONTROL | CREATE SEQUENCE | DELETE | EXECUTE | INSERT | REFERENCES | SELECT | TAKE OWNERSHIP | UPDATE | VIEW CHANGE TRACKING | VIEW DEFINITION | ALTER ANY SCHEMA ; searchPropertyListPermission : ALTER | CONTROL | REFERENCES | TAKE OWNERSHIP | VIEW DEFINITION | ALTER ANY FULLTEXT CATALOG ; serviceBrokerPermission : serviceBrokerContractsPermission | serviceBrokerMessageTypesPermission | serviceBrokerRemoteServiceBindingsPermission | serviceBrokerRoutesPermission | serviceBrokerServicesPermission ; serviceBrokerContractsPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY CONTRACT ; serviceBrokerMessageTypesPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY MESSAGE TYPE ; serviceBrokerRemoteServiceBindingsPermission : CONTROL | TAKE OWNERSHIP | ALTER | VIEW DEFINITION | ALTER ANY REMOTE SERVICE BINDING ; serviceBrokerRoutesPermission : CONTROL | TAKE OWNERSHIP | ALTER | VIEW DEFINITION | ALTER ANY ROUTE ; serviceBrokerServicesPermission : CONTROL | TAKE OWNERSHIP | SEND | ALTER | VIEW DEFINITION | ALTER ANY SERVICE ; endpointPermission : ALTER | CONNECT | CONTROL SERVER? | TAKE OWNERSHIP | VIEW ANY? DEFINITION | ALTER ANY ENDPOINT ; certificatePermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY CERTIFICATE ; symmetricKeyPermission : ALTER | CONTROL | REFERENCES | TAKE OWNERSHIP | VIEW DEFINITION | ALTER ANY SYMMETRIC KEY ; asymmetricKeyPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY ASYMMETRIC KEY ; assemblyPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY ASSEMBLY ; availabilityGroupPermission : ALTER | CONNECT | CONTROL SERVER? | TAKE OWNERSHIP | VIEW ANY? DEFINITION | ALTER ANY AVAILABILITY GROUP ; fullTextPermission : fullTextCatalogPermission | fullTextStoplistPermission ; fullTextCatalogPermission : CONTROL | TAKE OWNERSHIP | ALTER | REFERENCES | VIEW DEFINITION | ALTER ANY FULLTEXT CATALOG ; fullTextStoplistPermission : ALTER | CONTROL | REFERENCES | TAKE OWNERSHIP | VIEW DEFINITION | ALTER ANY FULLTEXT CATALOG ; typePermission : CONTROL | EXECUTE | REFERENCES | TAKE OWNERSHIP | VIEW DEFINITION ; xmlSchemaCollectionPermission : ALTER | CONTROL | EXECUTE | REFERENCES | TAKE OWNERSHIP | VIEW DEFINITION ; systemObjectPermission : SELECT | EXECUTE ; class_ : IDENTIFIER_ COLON_ COLON_ ; classItem : ASSEMBLY | ASYMMETRIC KEY | AVAILABILITY GROUP | CERTIFICATE | USER | ROLE | APPLICATION ROLE | DATABASE SCOPED CREDENTIAL | ENDPOINT | FULLTEXT (CATALOG | STOPLIST) | OBJECT | SCHEMA | SEARCH PROPERTY LIST | LOGIN | SERVER ROLE | CONTRACT | MESSAGE TYPE | REMOTE SERVICE BINDING | ROUTE | SERVICE | SYMMETRIC KEY | SELECT | EXECUTE | TYPE | XML SCHEMA COLLECTION ; classType : LOGIN | DATABASE | OBJECT | ROLE | SCHEMA | USER ; roleClause : ignoredIdentifiers ; setUser : SETUSER (stringLiterals (WITH NORESET)?)? ; createUser : CREATE USER (createUserLoginClause | createUserWindowsPrincipalClause | createUserLoginWindowsPrincipalClause | createUserWithoutLoginClause | createUserFromExternalProviderClause | createUserWithDefaultSchema | createUserWithAzureActiveDirectoryPrincipalClause | userName)? ; createUserLoginClause : userName ((FOR | FROM) LOGIN identifier)? (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)? ; createUserWindowsPrincipalClause : windowsPrincipal (WITH optionsList (COMMA_ optionsList)*)? | userName WITH PASSWORD EQ_ stringLiterals (COMMA_ optionsList (COMMA_ optionsList)*)? | azureActiveDirectoryPrincipal FROM EXTERNAL PROVIDER ; createUserLoginWindowsPrincipalClause : ((windowsPrincipal ((FOR | FROM) LOGIN windowsPrincipal)?) | (userName (FOR | FROM) LOGIN windowsPrincipal)) (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)? ; createUserWithoutLoginClause : userName (WITHOUT LOGIN (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)? | (FOR | FROM) CERTIFICATE identifier | (FOR | FROM) ASYMMETRIC KEY identifier) ; optionsList : DEFAULT_SCHEMA EQ_ schemaName | DEFAULT_LANGUAGE EQ_ (NONE | identifier) | SID EQ_ sid | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)? ; limitedOptionsList : DEFAULT_SCHEMA EQ_ schemaName | DEFAULT_LANGUAGE EQ_ (NONE | identifier) | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)? ; createUserFromExternalProviderClause : userName ((FOR | FROM) LOGIN identifier)? | FROM EXTERNAL PROVIDER (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)? ; createUserWithDefaultSchema : userName ((FOR | FROM) LOGIN identifier | WITHOUT LOGIN)? (WITH DEFAULT_SCHEMA EQ_ schemaName)? ; createUserWithAzureActiveDirectoryPrincipalClause : azureActiveDirectoryPrincipal FROM EXTERNAL PROVIDER (WITH DEFAULT_SCHEMA EQ_ schemaName)? ; windowsPrincipal : userName ; azureActiveDirectoryPrincipal : userName ; userName : ignoredNameIdentifier ; ignoredNameIdentifier : identifier (DOT_ identifier)? ; dropUser : DROP USER ; alterUser : ALTER USER userName (WITH setItem (COMMA_ setItem)* | FROM EXTERNAL PROVIDER) ; setItem : NAME EQ_ userName | DEFAULT_SCHEMA EQ_ (schemaName | NULL) | LOGIN EQ_ identifier | PASSWORD EQ_ stringLiterals (OLD_PASSWORD EQ_ stringLiterals)? | DEFAULT_LANGUAGE EQ_ (NONE | identifier) | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)? ; createRole : CREATE ROLE name (AUTHORIZATION name)? ; dropRole : DROP ROLE (IF EXISTS)? name ; alterRole : ALTER ROLE name (ADD MEMBER principal | DROP MEMBER principal | WITH NAME EQ_ name) ; createLogin : CREATE LOGIN ignoredNameIdentifier (createLoginForSQLServerClause | createLoginForAzureSQLDatabaseClause | createLoginForAzureManagedInstanceClause | createLoginForAzureSynapseAnalyticsClause | createLoginForAnalyticsPlatformSystemClause) ; createLoginForSQLServerClause : WITH createLoginForSQLServerOptionList | FROM sources ; createLoginForSQLServerOptionList : PASSWORD EQ_ (stringLiterals | hashedPassword HASHED) (MUST_CHANGE)? (COMMA_ createLoginForSQLServerOptionListClause (COMMA_ createLoginForSQLServerOptionListClause)*)? ; createLoginForSQLServerOptionListClause : SID EQ_ sid | DEFAULT_DATABASE EQ_ databaseName | DEFAULT_LANGUAGE EQ_ identifier | CHECK_EXPIRATION EQ_ (ON | OFF) | CHECK_POLICY EQ_ (ON | OFF) | CREDENTIAL EQ_ identifier ; hashedPassword : HEX_DIGIT_ ; sid : NCHAR_TEXT | HEX_DIGIT_ ; sources : WINDOWS (WITH windowsOptions (COMMA_ windowsOptions)*)? | CERTIFICATE identifier | ASYMMETRIC KEY identifier ; windowsOptions : DEFAULT_DATABASE EQ_ databaseName | DEFAULT_LANGUAGE EQ_ identifier ; createLoginForAzureSQLDatabaseClause : FROM EXTERNAL PROVIDER | WITH createLoginForAzureSQLDatabaseOptionList (COMMA_ createLoginForAzureSQLDatabaseOptionList)* ; createLoginForAzureSQLDatabaseOptionList : PASSWORD EQ_ stringLiterals (COMMA_ SID EQ_ sid)? ; createLoginForAzureManagedInstanceClause : (FROM EXTERNAL PROVIDER)? WITH azureManagedInstanceOptionList (COMMA_ azureManagedInstanceOptionList)* ; azureManagedInstanceOptionList : PASSWORD EQ_ stringLiterals | SID EQ_ sid | DEFAULT_DATABASE EQ_ databaseName | DEFAULT_LANGUAGE EQ_ identifier ; createLoginForAzureSynapseAnalyticsClause : WITH createLoginForAzureSynapseAnalyticsOptionList ; createLoginForAzureSynapseAnalyticsOptionList : PASSWORD EQ_ stringLiterals (COMMA_ SID EQ_ sid)? ; createLoginForAnalyticsPlatformSystemClause : WITH createLoginForAnalyticsPlatformSystemOptionList | FROM WINDOWS ; createLoginForAnalyticsPlatformSystemOptionList : PASSWORD EQ_ stringLiterals (MUST_CHANGE)? (COMMA_ createLoginForAnalyticsPlatformSystemOptionListClause (COMMA_ createLoginForAnalyticsPlatformSystemOptionListClause)*)? ; createLoginForAnalyticsPlatformSystemOptionListClause : CHECK_EXPIRATION EQ_ (ON | OFF) | CHECK_POLICY EQ_ (ON | OFF) ; dropLogin : DROP LOGIN ; alterLogin : ALTER LOGIN ;
src/strchr.asm
areltfc/ASM-MiniLibC
0
1805
; ASM MiniLibC ; strchr ; <EMAIL> %ifndef __MINILIBC_STRCHR__ %define __MINILIBC_STRCHR__ __MINILIBC_STRCHR__ [BITS 64] SECTION .text global strchr:function ;; char *strchr(const char *s, int c); strchr: push r11 mov rax, rdi ; Move s into RAX so that we don't have to later xor r11, r11 .check_char: cmp byte [rax+r11], 0 je .check_eos ; If s[i] == 0, c was not found inside s cmp byte [rax+r11], sil je .found ; s[i] == c inc r11 jmp .check_char .check_eos: cmp sil, 0h ; Maybe c == '\0', in which case NULL mustn't be returned jne .not_found add rax, r11 jmp .ret .not_found: xor rax, rax jmp .ret .found: add rax, r11 jmp .ret .ret: pop r11 ret %else %warning "attempting to redeclare strchr" %endif
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c43204f.ada
best08618/asylo
7
27338
<reponame>best08618/asylo -- C43204F.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT AN AGGREGATE WITH AN OTHERS CLAUSE CAN APPEAR AS A -- CONSTRAINED FORMAL PARAMETER OF A SUBPROGRAM AND THAT THE BOUNDS -- OF THE AGGREGATE ARE DETERMINED CORRECTLY. -- HISTORY: -- JET 08/15/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C43204F IS TYPE ARR11 IS ARRAY (INTEGER RANGE -3 .. 3) OF INTEGER; TYPE ARR12 IS ARRAY (IDENT_INT(-3) .. IDENT_INT(3)) OF INTEGER; TYPE ARR13 IS ARRAY (IDENT_INT(1) .. IDENT_INT(-1)) OF INTEGER; TYPE ARR21 IS ARRAY (INTEGER RANGE -1 .. 1, INTEGER RANGE -1 .. 1) OF INTEGER; TYPE ARR22 IS ARRAY (IDENT_INT(-1) .. IDENT_INT(1), IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; TYPE ARR23 IS ARRAY (INTEGER RANGE -1 .. 1, IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; TYPE ARR24 IS ARRAY (IDENT_INT(1) .. IDENT_INT(-1), IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; PROCEDURE PROC (PA11 : ARR11 := (1,1,1,1,1,1, OTHERS => IDENT_INT(2)); PA12 : ARR12 := (OTHERS => IDENT_INT(2)); PA13 : ARR13 := (OTHERS => IDENT_INT(2)); PA21 : ARR21 := ((1,1,1), (1,1,1), (1, OTHERS => IDENT_INT(2))); PA22 : ARR22 := ((1,1,1), (1,1,1), (OTHERS => IDENT_INT(2))); PA23 : ARR23 := ((1,1,1), (1,1,1), (1,1,1), OTHERS => (OTHERS => IDENT_INT(2))); PA24 : ARR24 := (OTHERS => (OTHERS => IDENT_INT(2)))) IS BEGIN IF PA11 /= (1, 1, 1, 1, 1, 1, 2) THEN FAILED("INCORRECT VALUE OF PA11"); END IF; IF PA12 /= (2, 2, 2, 2, 2, 2, 2) THEN FAILED("INCORRECT VALUE OF PA12"); END IF; IF PA13'LENGTH /= 0 THEN FAILED("INCORRECT VALUE OF PA13"); END IF; IF PA21 /= ((1,1,1), (1,1,1), (1,2,2)) THEN FAILED("INCORRECT VALUE OF PA21"); END IF; IF PA22 /= ((1,1,1), (1,1,1), (2,2,2)) THEN FAILED("INCORRECT VALUE OF PA22"); END IF; IF PA23 /= ((1,1,1), (1,1,1), (1,1,1)) THEN FAILED("INCORRECT VALUE OF PA23"); END IF; IF PA24'LENGTH /= 0 OR PA24'LENGTH(2) /= 3 THEN FAILED("INCORRECT VALUE OF PA24"); END IF; END PROC; BEGIN TEST ("C43204F", "CHECK THAT AN AGGREGATE WITH AN OTHERS CLAUSE " & "CAN APPEAR AS A CONSTRAINED FORMAL PARAMETER " & "OF A SUBPROGRAM AND THAT THE BOUNDS OF THE " & "AGGREGATE ARE DETERMINED CORRECTLY"); PROC; RESULT; EXCEPTION WHEN OTHERS => FAILED ("UNEXPECTED CONSTRAINT_ERROR OR OTHER EXCEPTION " & "RAISED"); RESULT; END C43204F;
src/str/set.asm
beckadamtheinventor/BOSos
1
104388
;@DOES set the bytes of null-terminated string ;@INPUT HL pointer to string ;@INPUT C value to set bytes to ;@OUTPUT HL HL+strlen(HL) ;@DESTROYS AF strset: xor a,a .loop: cp a,(hl) ret z ld (hl),c inc hl jr .loop
linear_algebra/givens_qr_tst_1.adb
jscparker/math_packages
30
26137
<filename>linear_algebra/givens_qr_tst_1.adb -- Test QR decomposition real valued square matrices. with Ada.Numerics.Generic_elementary_functions; with Givens_QR; with Test_Matrices; With Text_IO; use Text_IO; procedure givens_qr_tst_1 is type Real is digits 15; subtype Index is Integer range 1..137; -- in this test, matrix is a square-shaped matrix on Index x Index. -- eg Hilbert's matrix is a square matrix with unique elements on the range -- Index'First .. Index'Last. However, you have the option to QR any rectangular -- sub-block of the matrix that is defined on Index x Index (provided -- number of rows is >= number of cols). -- To do that you choose new values for Starting_Row, Starting_Col, Final_Row -- Final_Col just below. subtype Row_Index is Index; subtype Col_Index is Index; Starting_Row : constant Row_Index := Index'First + 0; Starting_Col : constant Col_Index := Index'First + 0; Final_Row : constant Row_Index := Index'Last- 0; Final_Col : constant Col_Index := Index'Last- 0; type Matrix is array(Row_Index, Col_Index) of Real; --pragma Convention (Fortran, Matrix); --No! This QR prefers Ada convention. package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math; package QR is new Givens_QR (Real => Real, R_Index => Index, C_Index => Index, A_Matrix => Matrix); use QR; -- QR exports Row_Vector and Col_Vector package Make_Square_Matrix is new test_matrices (Real, Index, Matrix); use Make_Square_Matrix; package rio is new Float_IO(Real); use rio; --subtype Real_Extended is Real; -- general case, and for best speed type Real_Extended is digits 18; -- 18 ok on intel Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; A, R : Matrix; Q : Q_Matrix; Max_Error : Real; Frobenius_QR_Err_0 : Real; Max_Error_qq, Max_Error_qr : Real; Frobenius_QQ_Err, Frobenius_QR_Err : Real; Scale : Col_Vector; Permute : Permutation; -------------------- -- Frobenius_Norm -- -------------------- function Frobenius_Norm (A : in Matrix) --Final_Row : in Index; --Final_Col : in Index; --Starting_Row : in Index; --Starting_Col : in Index) return Real is Max_A_Val : Real := Zero; Sum, Scaling, tmp : Real := Zero; begin Max_A_Val := Zero; for Row in Starting_Row .. Final_Row loop for Col in Starting_Col .. Final_Col loop if Max_A_Val < Abs A(Row, Col) then Max_A_Val := Abs A(Row, Col); end if; end loop; end loop; Max_A_Val := Max_A_Val + Two ** (Real'Machine_Emin + 4); Scaling := One / Max_A_Val; Sum := Zero; for Row in Starting_Row .. Final_Row loop for Col in Starting_Col .. Final_Col loop tmp := Scaling * A(Row, Col); Sum := Sum + tmp * tmp; end loop; end loop; return Sqrt (Sum) * Max_A_Val; end Frobenius_Norm; ------------------------------------ -- Get_Error_in_QR_Decomposition -- ------------------------------------ procedure Get_Error_in_QR_Decomposition (A : in Matrix; R : in Matrix; Q : in Q_Matrix; Scale : in Col_Vector; Permute : in Permutation; Max_Error : out Real; Max_Error_F : out Real) is Err : Real; Min_Real : constant Real := 2.0 ** (Real'Machine_Emin + 2); Product_Vector, Col_of_R : Col_Vector := (others => Zero); Err_Matrix : Matrix; begin -- find error in A - Q*R -- The Columns of R have been permuted; unpermute before comparison of A with Q*R -- The Columns of R have been scaled. Before comparison of A with Q*R -- Must unscale each col of R by multiplying them with 1/Scale(Permute(Col). Max_Error := Zero; for Col in Starting_Col .. Final_Col loop Col_of_R := (others => Zero); for Row in Starting_Row .. Final_Row loop Col_of_R(Row) := R(Row, Col); end loop; Product_Vector := Q_x_Col_Vector (Q, Col_of_R); for Row in Starting_Row .. Final_Row loop Err := Abs (A(Row, Permute(Col)) - --Product_Vector(Row) / (Scale(Permute(Col)) + Min_Real)); Product_Vector(Row) / (Scale(Row) + Min_Real)); if Err > Max_Error then Max_Error := Err; end if; Err_Matrix(Row, Col) := Err; end loop; end loop; -- Froebenius norm fractional error = ||Err_Matrix|| / ||M|| Max_Error_F := Frobenius_Norm (Err_Matrix) / (Frobenius_Norm (A) + Min_Real); end Get_Error_in_QR_Decomposition; ------------------------------------ -- Get_Err_in_Reassembled_Q_and_A -- ------------------------------------ -- Get an explicit matrix version of the matrix Q. Call it V. procedure Get_Err_in_Reassembled_Q_and_A (A : in Matrix; R : in Matrix; Q : in Q_Matrix; Scale : in Col_Vector; Permute : in Permutation; Final_Row : in Row_Index; Final_Col : in Col_Index; Starting_Row : in Row_Index; Starting_Col : in Col_Index; Frobenius_QQ_Err : out Real; Frobenius_QR_Err : out Real; Max_Error_QQ : out Real; Max_Error_QR : out Real) is Err, S : Real; Min_Real : constant Real := +2.0 **(Real'Machine_Emin + 4); V, V_tr, Identity, Product_QQ : V_Matrix := (others => (others => Zero)); Sum : Real_Extended; Product_A : Matrix; subtype Row_Index_Subrange is Row_Index range Starting_Row .. Final_Row; begin for r in Row_Index_Subrange loop Identity(r, r) := 1.0; end loop; -- Find error in I - V*V' etc. -- Start V as identity matrix (V should be square. MxM == R_Index x R_Index) -- Turn V into and explicit version of Q by calling Q_x_V_Matrix -- (Q is an array of 2x2 rotation matrices.) V := Identity; Q_x_V_Matrix (Q, V); -- Turn V_tr into and explicit version of Q_tr by calling Q_trans..x_V_Matrix V_tr := Identity; Q_transpose_x_V_Matrix (Q, V_tr); -- Usually find that orthonormality of *Rows of V* and *Cols of V_tr* is best. -- Notation: V' == V_tr == transpose of V. for Col in Row_Index_Subrange loop for Row in Row_Index_Subrange loop Sum := 0.0; for j in Row_Index_Subrange loop --Sum := Sum + Real_Extended(V(j, Row)) * Real_Extended(V(j, Col)); --V'*V Sum := Sum + Real_Extended(V(Row, j)) * Real_Extended(V(Col, j)); --V*V' --Sum := Sum + V(Row, j) * V(Col, j); --V*V' has least err; rows of Q ortho --Sum := Sum + V_tr(j, Row)*V_tr(j, Col); --V_tr'*V_tr also least err; cols V_tr --Sum := Sum + V(Row, j) * V_tr(j, Col); --least err; --Sum := Sum + V_tr(Row, j) * V(j, Col); end loop; Product_QQ(Row, Col) := Real (Sum); end loop; end loop; -- get Product_QQ - Identity Max_Error_QQ := Zero; for Col in Row_Index_Subrange loop for Row in Row_Index_Subrange loop Err := Abs (Identity(Row, Col) - Product_QQ(Row, Col)); if Err > Max_Error_QQ then Max_Error_QQ := Err; end if; end loop; end loop; -- Get Frobenius norm of: Product_QQ - I: S := Zero; for Col in Row_Index_Subrange loop for Row in Row_Index_Subrange loop Err := Identity(Row, Col) - Product_QQ(Row, Col); S := S + Err * Err; end loop; end loop; Frobenius_QQ_Err := Sqrt(S) / Sqrt (-Real(Starting_Row) + Real(Final_Row) + 1.0); -- explicitly calculate Q*R by getting V*R == Q*R (V==Q). for Col in Starting_Col .. Final_Col loop for Row in Starting_Row .. Final_Row loop Sum := 0.0; for j in Starting_Row .. Final_Row loop Sum := Sum + Real_Extended(V(Row, j)) * Real_Extended(R(j, Col)); --V*R end loop; Product_A(Row, Col) := Real (Sum); end loop; end loop; -- recall that the actual decomposition is: A*Scale*Permute = Q*R Max_Error_QR := Zero; for Col in Starting_Col .. Final_Col loop for Row in Starting_Row .. Final_Row loop Err := Abs (A(Row, Permute(Col)) -- - Product_A(Row, Col) / (Scale(Permute(Col)) + Min_Real)); -- Scale > 0 - Product_A(Row, Col) / (Scale(Row) + Min_Real)); -- Scale > 0 if Err > Max_Error_QR then Max_Error_QR := Err; end if; end loop; end loop; -- resuse array Product_A to get error matrix Error := Product_A - A: for Col in Starting_Col .. Final_Col loop for Row in Starting_Row .. Final_Row loop Product_A(Row, Col) := A(Row, Permute(Col)) -- - Product_A(Row, Col) / (Scale(Permute(Col)) + Min_Real); -- Scale > 0 - Product_A(Row, Col) / (Scale(Row) + Min_Real); -- Scale > 0 end loop; end loop; Frobenius_QR_Err := Frobenius_Norm (Product_A) / (Frobenius_Norm (A) + Min_Real); end Get_Err_in_Reassembled_Q_and_A; ----------- -- Pause -- ----------- procedure Pause (s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12 : string := "") is Continue : Character := ' '; begin New_Line; if S0 /= "" then put_line (S0); end if; if S1 /= "" then put_line (S1); end if; if S2 /= "" then put_line (S2); end if; if S3 /= "" then put_line (S3); end if; if S4 /= "" then put_line (S4); end if; if S5 /= "" then put_line (S5); end if; if S6 /= "" then put_line (S6); end if; if S7 /= "" then put_line (S7); end if; if S8 /= "" then put_line (S8); end if; if S9 /= "" then put_line (S9); end if; if S10 /= "" then put_line (S10); end if; if S11 /= "" then put_line (S11); end if; if S12 /= "" then put_line (S12); end if; new_line; begin Put ("Enter a character to continue: "); Get_Immediate (Continue); exception when others => null; end; end pause; begin Pause( "Test 1: QR decomposition of matrix A. The QR decomposition of A is", "successful if two identities are satisfied: Q'*Q = I and Q*R = A. If 15", "digit Reals are used, then we expect the error in the calculation of A = Q*R to", "be about 1 part in 10**15. In other words ||Q*R - A|| / ||A|| should be", "around 10**(-15). Here ||*|| denotes the Frobenius Norm. Other matrix norms", "give slightly different answers, so its an order of magnitude estimate. The", "Q matrix is a list of 2x2 Givens rotations. Most operations (eg. equation", "solving) use this representation of Q for best accuracy.", " ", "The tests are repeated using an explicit matrix for Q. The error in the", "QR decomposition of A, i.e. ||Q*R - A|| / ||A|| is recalculated and printed", "below so that you can see the increase in error." ); for Chosen_Matrix in Matrix_Id loop --for Chosen_Matrix in kahan .. kahan loop --for Chosen_Matrix in kahan_col_scaled_2 .. kahan_col_scaled_2 loop --for Chosen_Matrix in kahan .. kahan_col_scaled_2 loop --for Chosen_Matrix in kahan .. kahan_row_scaled loop Init_Matrix (A, Chosen_Matrix, Index'First, Index'Last); R := A; -- A remains original A. Only R is input. QR_Decompose (A => R, -- A has now been tranformed into the R matrix Q => Q, Row_Scalings => Scale, Col_Permutation => Permute, Final_Row => Final_Row, Final_Col => Final_Col, Starting_Row => Starting_Row, Starting_Col => Starting_Col); --declare Row : Row_Index := Starting_Row; begin --for Col in Starting_Col .. Final_Col loop --put(R(Col, Col)); -- this is the R matrix but it has not been unscaled yet. --if Row < Row_Index'Last then Row := Row + 1; end if; --end loop; --end; if true then new_line; put("For matrix A of type "); put(Matrix_id'Image(Chosen_Matrix)); put(":"); new_line; put ("Min 3 diag elements:"); --for i in Starting_Col .. Final_Col loop for i in Final_Col-2 .. Final_Col loop put (r(i,i)); end loop; new_line(1); end if; --goto endies; Get_Err_in_Reassembled_Q_and_A (A, R, Q, Scale, Permute, Final_Row, Final_Col, Starting_Row, Starting_Col, Frobenius_QQ_Err, Frobenius_QR_Err, Max_Error_qq, Max_Error_qr); Get_Error_in_QR_Decomposition (A, R, Q, Scale, Permute, Max_Error, Frobenius_QR_Err_0); -- Froebenius norm fractional error: -- Max_Error_F = ||Err_Matrix|| / ||A|| new_line; put("For matrix A of type "); put(Matrix_id'Image(Chosen_Matrix)); put(":"); new_line; put(" Err in I-Q'*Q (Q = explicit matrix) is ||I-Q'*Q|| / ||I|| ="); put(Frobenius_QQ_Err); new_line; put(" Err in A-Q*R (Q = explicit matrix) is ||A-Q*R || / ||A|| ="); put(Frobenius_QR_Err); new_line; put(" Err in A-Q*R (Q = Givens rotation) is ||A-Q*R || / ||A|| ="); put(Frobenius_QR_Err_0); new_line; <<endies>> null; end loop; end givens_qr_tst_1;
attract.asm
mssarts128/tetris.c64
1
95706
<gh_stars>1-10 // attrack mode steps .const STEP_TITLE = 0 .const STEP_CREDITS = 1 .const STEP_CONTROLS = 2 .const ATTRACT_DELAY = 50 * 5 attractStep: .byte 0 attractDelay: .byte 0 // ----------------------------------------- StartAttractMode: lda #ATTRACT_DELAY sta attractDelay lda #STEP_TITLE sta attractStep // set the screen size // this is the same for all steps // so doing it once is enough // set data dimensions lda #21 sta dataWidth lda #20 sta dataHeight // set start of area to print to lda #04 sta dataDestinationHi lda #10 sta dataDestinationLo // print the first screen lda #<titleScreenData sta dataSourceLo lda #>titleScreenData sta dataSourceHi jmp WriteScreenData // ----------------------------------------- UpdateAttractMode: dec attractDelay beq triggered // swap screen when triggered // check for key or joy button press jsr GetKeyInput lda inputResult cmp #DOWN // enter pressed? beq !skip+ // yes jsr GetJoyInput lda inputResult cmp #TURNCLOCK // joy button pressed? beq !skip+ // yes rts !skip: jmp EndAttractMode // start the game triggered: lda #ATTRACT_DELAY // reset the delay sta attractDelay inc attractStep // go to next screen lda attractStep cmp #3 // have we done 3 screens? bne !skip+ // no. continue cycle lda #STEP_TITLE // yes. reset cycle sta attractStep !skip: // set data dimensions lda #21 sta dataWidth lda #21 sta dataHeight // reset the screen pointer lda #04 sta dataDestinationHi lda #10 sta dataDestinationLo // set start of data // dependent on attract step lda attractStep cmp #STEP_TITLE bne !nextstep+ lda #<titleScreenData sta dataSourceLo lda #>titleScreenData sta dataSourceHi jmp WriteScreenData !nextstep: cmp #STEP_CREDITS bne !nextstep+ lda #<creditsScreenData sta dataSourceLo lda #>creditsScreenData sta dataSourceHi jmp WriteScreenData !nextstep: cmp #STEP_CONTROLS bne !nextstep+ lda #<keysScreenData sta dataSourceLo lda #>keysScreenData sta dataSourceHi jmp WriteScreenData !nextstep: rts // ----------------------------------------- EndAttractMode: lda #MODE_SELECTLEVEL sta gameMode jsr StartLevelSelectMode rts
llvm-gcc-4.2-2.9/gcc/ada/s-osinte-hpux-dce.adb
vidkidz/crossbridge
1
27378
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2005, AdaCore -- -- -- -- GNARL 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 2, or (at your option) any later ver- -- -- sion. GNARL 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a DCE version of this package. -- Currently HP-UX and SNI use this file pragma Polling (Off); -- Turn off polling, we do not want ATC polling to take place during -- tasking operations. It causes infinite loops and other problems. -- This package encapsulates all direct interfaces to OS services -- that are needed by children of System. with Interfaces.C; use Interfaces.C; package body System.OS_Interface is ----------------- -- To_Duration -- ----------------- function To_Duration (TS : timespec) return Duration is begin return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; ----------------- -- To_Timespec -- ----------------- function To_Timespec (D : Duration) return timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return timespec'(tv_sec => S, tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; function To_Duration (TV : struct_timeval) return Duration is begin return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; end To_Duration; function To_Timeval (D : Duration) return struct_timeval is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timeval' (tv_sec => S, tv_usec => time_t (Long_Long_Integer (F * 10#1#E6))); end To_Timeval; ------------------------- -- POSIX.1c Section 3 -- ------------------------- function sigwait (set : access sigset_t; sig : access Signal) return int is Result : int; begin Result := sigwait (set); if Result = -1 then sig.all := 0; return errno; end if; sig.all := Signal (Result); return 0; end sigwait; -- DCE_THREADS does not have pthread_kill. Instead, we just ignore it. function pthread_kill (thread : pthread_t; sig : Signal) return int is pragma Unreferenced (thread, sig); begin return 0; end pthread_kill; -------------------------- -- POSIX.1c Section 11 -- -------------------------- -- For all following functions, DCE Threads has a non standard behavior. -- It sets errno but the standard Posix requires it to be returned. function pthread_mutexattr_init (attr : access pthread_mutexattr_t) return int is function pthread_mutexattr_create (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_create, "pthread_mutexattr_create"); begin if pthread_mutexattr_create (attr) /= 0 then return errno; else return 0; end if; end pthread_mutexattr_init; function pthread_mutexattr_destroy (attr : access pthread_mutexattr_t) return int is function pthread_mutexattr_delete (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_delete, "pthread_mutexattr_delete"); begin if pthread_mutexattr_delete (attr) /= 0 then return errno; else return 0; end if; end pthread_mutexattr_destroy; function pthread_mutex_init (mutex : access pthread_mutex_t; attr : access pthread_mutexattr_t) return int is function pthread_mutex_init_base (mutex : access pthread_mutex_t; attr : pthread_mutexattr_t) return int; pragma Import (C, pthread_mutex_init_base, "pthread_mutex_init"); begin if pthread_mutex_init_base (mutex, attr.all) /= 0 then return errno; else return 0; end if; end pthread_mutex_init; function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int is function pthread_mutex_destroy_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_destroy_base, "pthread_mutex_destroy"); begin if pthread_mutex_destroy_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_destroy; function pthread_mutex_lock (mutex : access pthread_mutex_t) return int is function pthread_mutex_lock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_lock_base, "pthread_mutex_lock"); begin if pthread_mutex_lock_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_lock; function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int is function pthread_mutex_unlock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_unlock_base, "pthread_mutex_unlock"); begin if pthread_mutex_unlock_base (mutex) /= 0 then return errno; else return 0; end if; end pthread_mutex_unlock; function pthread_condattr_init (attr : access pthread_condattr_t) return int is function pthread_condattr_create (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_create, "pthread_condattr_create"); begin if pthread_condattr_create (attr) /= 0 then return errno; else return 0; end if; end pthread_condattr_init; function pthread_condattr_destroy (attr : access pthread_condattr_t) return int is function pthread_condattr_delete (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_delete, "pthread_condattr_delete"); begin if pthread_condattr_delete (attr) /= 0 then return errno; else return 0; end if; end pthread_condattr_destroy; function pthread_cond_init (cond : access pthread_cond_t; attr : access pthread_condattr_t) return int is function pthread_cond_init_base (cond : access pthread_cond_t; attr : pthread_condattr_t) return int; pragma Import (C, pthread_cond_init_base, "pthread_cond_init"); begin if pthread_cond_init_base (cond, attr.all) /= 0 then return errno; else return 0; end if; end pthread_cond_init; function pthread_cond_destroy (cond : access pthread_cond_t) return int is function pthread_cond_destroy_base (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_destroy_base, "pthread_cond_destroy"); begin if pthread_cond_destroy_base (cond) /= 0 then return errno; else return 0; end if; end pthread_cond_destroy; function pthread_cond_signal (cond : access pthread_cond_t) return int is function pthread_cond_signal_base (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_signal_base, "pthread_cond_signal"); begin if pthread_cond_signal_base (cond) /= 0 then return errno; else return 0; end if; end pthread_cond_signal; function pthread_cond_wait (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int is function pthread_cond_wait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_cond_wait_base, "pthread_cond_wait"); begin if pthread_cond_wait_base (cond, mutex) /= 0 then return errno; else return 0; end if; end pthread_cond_wait; function pthread_cond_timedwait (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int is function pthread_cond_timedwait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int; pragma Import (C, pthread_cond_timedwait_base, "pthread_cond_timedwait"); begin if pthread_cond_timedwait_base (cond, mutex, abstime) /= 0 then if errno = EAGAIN then return ETIMEDOUT; else return errno; end if; else return 0; end if; end pthread_cond_timedwait; ---------------------------- -- POSIX.1c Section 13 -- ---------------------------- function pthread_setschedparam (thread : pthread_t; policy : int; param : access struct_sched_param) return int is function pthread_setscheduler (thread : pthread_t; policy : int; priority : int) return int; pragma Import (C, pthread_setscheduler, "pthread_setscheduler"); begin if pthread_setscheduler (thread, policy, param.sched_priority) = -1 then return errno; else return 0; end if; end pthread_setschedparam; function sched_yield return int is procedure pthread_yield; pragma Import (C, pthread_yield, "pthread_yield"); begin pthread_yield; return 0; end sched_yield; ----------------------------- -- P1003.1c - Section 16 -- ----------------------------- function pthread_attr_init (attributes : access pthread_attr_t) return int is function pthread_attr_create (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_create, "pthread_attr_create"); begin if pthread_attr_create (attributes) /= 0 then return errno; else return 0; end if; end pthread_attr_init; function pthread_attr_destroy (attributes : access pthread_attr_t) return int is function pthread_attr_delete (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_delete, "pthread_attr_delete"); begin if pthread_attr_delete (attributes) /= 0 then return errno; else return 0; end if; end pthread_attr_destroy; function pthread_attr_setstacksize (attr : access pthread_attr_t; stacksize : size_t) return int is function pthread_attr_setstacksize_base (attr : access pthread_attr_t; stacksize : size_t) return int; pragma Import (C, pthread_attr_setstacksize_base, "pthread_attr_setstacksize"); begin if pthread_attr_setstacksize_base (attr, stacksize) /= 0 then return errno; else return 0; end if; end pthread_attr_setstacksize; function pthread_create (thread : access pthread_t; attributes : access pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int is function pthread_create_base (thread : access pthread_t; attributes : pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int; pragma Import (C, pthread_create_base, "pthread_create"); begin if pthread_create_base (thread, attributes.all, start_routine, arg) /= 0 then return errno; else return 0; end if; end pthread_create; -------------------------- -- POSIX.1c Section 17 -- -------------------------- function pthread_setspecific (key : pthread_key_t; value : System.Address) return int is function pthread_setspecific_base (key : pthread_key_t; value : System.Address) return int; pragma Import (C, pthread_setspecific_base, "pthread_setspecific"); begin if pthread_setspecific_base (key, value) /= 0 then return errno; else return 0; end if; end pthread_setspecific; function pthread_getspecific (key : pthread_key_t) return System.Address is function pthread_getspecific_base (key : pthread_key_t; value : access System.Address) return int; pragma Import (C, pthread_getspecific_base, "pthread_getspecific"); Addr : aliased System.Address; begin if pthread_getspecific_base (key, Addr'Access) /= 0 then return System.Null_Address; else return Addr; end if; end pthread_getspecific; function pthread_key_create (key : access pthread_key_t; destructor : destructor_pointer) return int is function pthread_keycreate (key : access pthread_key_t; destructor : destructor_pointer) return int; pragma Import (C, pthread_keycreate, "pthread_keycreate"); begin if pthread_keycreate (key, destructor) /= 0 then return errno; else return 0; end if; end pthread_key_create; function Get_Stack_Base (thread : pthread_t) return Address is pragma Warnings (Off, thread); begin return Null_Address; end Get_Stack_Base; procedure pthread_init is begin null; end pthread_init; function intr_attach (sig : int; handler : isr_address) return long is function c_signal (sig : int; handler : isr_address) return long; pragma Import (C, c_signal, "signal"); begin return c_signal (sig, handler); end intr_attach; end System.OS_Interface;
oeis/276/A276123.asm
neoneye/loda-programs
11
104882
<gh_stars>10-100 ; A276123: a(0) = a(1) = a(2) = 1; for n > 2, a(n) = (a(n-1) + 1)*(a(n-2) + 1) / a(n-3). ; Submitted by <NAME> ; 1,1,1,4,10,55,154,868,2449,13825,39025,220324,621946,3511351,9912106,55961284,157971745,891869185,2517635809,14213945668,40124201194,226531261495,639469583290,3610286238244,10191389131441,57538048550401,162422756519761,916998490568164,2588572715184730,14614437800540215,41254740686435914,232914006318075268,657487278267789889,3712009663288664065,10478541711598202305,59159240606300549764,166999180107303446986,942835840037520132151,2661508340005256949466,15026214199994021564644 sub $0,1 mul $0,2 mov $1,4 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,4 add $3,$2 lpe mov $0,$1 div $0,28 mul $0,3 add $0,1
src/protinit.asm
DosWorld/zrdx
12
20671
; This file is part of the ZRDX 0.50 project ; (C) 1998, <NAME> ;protected init code Segm Text ;assume cs:dgroup, ds:dgroup, es:nothing, ss:dgroup assume cs:Text, ds:nothing, es:nothing, ss:nothing LLabel PMInit push Data0Selector pop eax mov ss, eax mov esp, OffKernelStack pushfd or byte ptr [esp][1], 30h ;set protected mode IOPL to 3 popfd mov al, Data1Selector mov ds, eax mov fs, eax mov gs, eax mov es, eax mov SwitchTableEIP, OffRMS_PMHandler RRT 4 push eax ;Data1Selector push OffKernelStack1End ;OffUserStackEnd;-size DC_Struct; OffLockedStack-800h push Code1Selector push OffPL3Entry mov eax, cr0 mov RMCR0, eax ;save original CR0 for Real(or VM) Mode RRT and eax, not 05002Ch ;clear AM & WP & TS & EM & NE mov PMCR0, eax RRT mov cr0, eax retf DPROC PL3Entry push Data3Selector push OffUserStackEnd ;push eax mov al, NExitPages+NLoaderPages sub al, NExtraRPages $ifnot ja mov al, 0 $endif cmp al, NExitPages $ifnot jb mov al, NExitPages $endif mov esi, ((OffLastInit+0FFFh) and not 0FFFh)-4 mov ebx, OffPage2+NExitPages*4 mov nEntriesInTable[4], 2 ;prevent page table 2 from free $do dec al mov ecx, 1024 $break js sub ebx, 4 push eax call Alloc1Page jnc @@MemErr1 @@MovePage: mov edi, OffFreePageWin+1000h-4 std mov FreePageEntry, edx DB CallFarCode ;PageMoveTrap DD 0 DW PageMoveGateSelector @@Lo: NExitPages = (OffLastInit-KernelBase+4095)/4096 NLoaderPages = WinSize shr 12 pop eax $enddo jmp IFNDEF VMM and byte ptr PageDir[4], not 2;disable client write access to server area ENDIF cld @@NExtraRPages equ ecx @@Counter equ ebx @@CounterB equ bl movzx @@NExtraRPages, NExtraRPages $ifnot jecxz mov esi, OffPage0+4 LLabel PatchPoint5 mov edi, Offfplist xor @@Counter, @@Counter $do cmp @@Counter, @@NExtraRPages $break jae lodsd ;load phisical page address cmp @@Counter, NLoaderPages-1 $ifnot jb cmp @@Counter, NLoaderPages+NExitPages-1 jbe @@L5 $endif and ah, 0F0h mov al, 67h inc nFreePages or @@Counter, @@Counter $ifnot jnz mov FpListEntry, eax InvalidateTLB xor eax, eax mov nEntriesInFplist, eax jmp @@L4 $endif inc nEntriesInFplist ;FreePagesOnDir @@L4: stosd @@L5: inc @@Counter $loop jmp $enddo sub @@Counter, NLoaderPages+NExitPages + 15 ;!!!!!!!!!!!!!! $ifnot jae cmp @@Counter, -15 $ifnot ja mov @@CounterB, -15 $endif $do call Alloc1Page cld jnc @@MemErr xchg eax, edx stosd inc nFreePages inc nEntriesInFplist ;FreePagesOnDir ;inc nFreePagesOnDir inc @@Counter $enddo jne $endif $endif sti ;push OffGDT+40h 20 10 ;+(InvalidateTLBGateSelector and not 7) 8 10 ;call MemDump IFDEF VMM mov eax, PageDirAliasPte mov PageDir[8], eax mov eax, PageExtinfoTablePte mov PageDir[12], eax mov eax, PageDir[4] mov PageDirAlias[4], eax InvalidateTLB ;push 10000 ;push OffGDT ;call d_write_page mov edi, Offswap_file_bitmap push 800h push edi push 0 call alloc_pages or eax, -1 cld mov ecx, 800h shr 5 rep stosd ENDIF ;hlt mov ebx, ROffILoaderEntry+LS @@L09: xor eax, eax mov al, (17+1)*8+7 ;data selector mov ds, eax push eax push WinSize-80h mov al, ((17+3)*8+7) and 0FFh ;PSP selector mov es, eax mov al, (17*8+7) and 0FFh ;CS selector push eax push ebx xchg eax, edi retf @@MemErr1: @@MemErr: mov ebx, ROffPInitErrorE+LS mov si, ROffErrNoDPMIMemoryEM+LS jmp @@L09 DPROC PageMoveHandler mov ebp, cr3 mov cr3, ebp rep movsd cmp ebx, offset Page2Entry $ifnot jne mov PageDir[4], edx mov FreePageWin[Page2Index*4], edx $else jmp mov [ebx], edx $endif cmp ebx, offset PageDirEntry $ifnot jne and dx, not 0FFFh mov SwitchTableCR3, edx RRT mov ebp, edx $endif mov cr3, ebp retf ENDP IFNDEF Release ;parameters: linear address, word count, display line MemDump PROC NEAR pushad imul edi, dword ptr ss:[esp+9*4], 160 add edi, 0B8000h mov esi, [esp+11*4] mov ecx, [esp+10*4] push ds es mov ax, Data3Selector mov ds, ax mov es, ax xor dl, dl xchg dl, PrintToMem $do push dword ptr ss:[esi] add esi, 4 push 8 call PrintNX $enddo loop mov PrintToMem, dl pop es ds popad retn 12 ENDP DispLog PROC NEAR pushfd push ebp edi esi edx ecx ebx eax push ds es cld mov ax, Data3Selector mov ds, ax mov es, ax imul edi, LogLine, 160 mov word ptr [0B8000h+edi], 0E00h+' ';mark prev line off inc LogLine cmp LogLine, 25 $ifnot jb and LogLine, 0 $endif imul edi, LogLine, 160 add edi, 0B8000h mov ax, 0E00h + '*' stosw push dword ptr ss:[esp+10*4] push 4 call PrintNX ;print lo part of EIP mov ecx, 8 lea esi, [esp+8] $do push dword ptr ss:[esi] add esi, 4 push 8 call PrintNX $enddo loop pop es ds pop eax ebx ecx edx esi edi ebp popfd ret ENDP RegDump PROC NEAR pushfd push ebp edi esi edx ecx ebx eax push esp push 8 push dword ptr ss:[esp+11*4] call MemDump pop eax ebx ecx edx esi edi ebp popfd retn 4 ENDP ENDIF ESeg Text
ProcessProgress.agda
danelahman/aeff-agda
4
10523
<reponame>danelahman/aeff-agda open import Data.Empty open import Data.List renaming (_∷_ to _∷ₗ_ ; [_] to [_]ₗ) open import Data.Maybe open import Data.Product open import Data.Sum open import Data.Unit open import AEff open import AwaitingComputations open import EffectAnnotations open import Preservation open import ProcessPreservation open import Progress open import Renamings open import Substitutions open import Types open import Relation.Binary.PropositionalEquality hiding ([_]) open import Relation.Nullary open import Relation.Nullary.Negation module ProcessProgress where -- PROCESS RESULTS data ParResult⟨_⟩ : {o : O} {PP : PType o} → [] ⊢P⦂ PP → Set where run : {X : VType} {o : O} {i : I} → {M : [] ⊢M⦂ X ! (o , i)} → RunResult⟨ [] ∣ M ⟩ → -------------------------- ParResult⟨ run M ⟩ par : {o o' : O} {PP : PType o} {QQ : PType o'} {P : [] ⊢P⦂ PP} {Q : [] ⊢P⦂ QQ} → ParResult⟨ P ⟩ → ParResult⟨ Q ⟩ → ------------------ ParResult⟨ P ∥ Q ⟩ data ProcResult⟨_⟩ : {o : O} {PP : PType o} → [] ⊢P⦂ PP → Set where proc : {o : O} {PP : PType o} {P : [] ⊢P⦂ PP} → ParResult⟨ P ⟩ → ----------------- ProcResult⟨ P ⟩ signal : {o : O} {PP : PType o} {op : Σₛ} {p : op ∈ₒ o} {V : [] ⊢V⦂ ``(payload op)} {P : [] ⊢P⦂ PP} → ProcResult⟨ P ⟩ → --------------------------- ProcResult⟨ ↑ op p V P ⟩ -- PROGRESS THEOREM FOR PROCESSES {- THEOREM 4.3 -} proc-progress : {o : O} {PP : PType o} → (P : [] ⊢P⦂ PP) → ------------------------------------------------------------------------------- (Σ[ o' ∈ O ] Σ[ QQ ∈ PType o' ] Σ[ r ∈ PP ⇝ QQ ] Σ[ Q ∈ [] ⊢P⦂ QQ ] (P [ r ]↝ Q) ⊎ ProcResult⟨ P ⟩) proc-progress (run {X} {o} {i} M) with progress M ... | inj₁ (M' , r) = inj₁ (_ , _ , _ , _ , run r) ... | inj₂ (comp R) = inj₂ (proc (run R)) ... | inj₂ (signal {_} {_} {_} {_} {p} {V} {Q} R) = inj₁ (_ , _ , _ , _ , ↑ p V Q) proc-progress (P ∥ Q) with proc-progress P ... | inj₁ (o' , PP' , r , P' , r') = inj₁ (_ , _ , _ , _ , context ([-] ∥ₗ Q) r') ... | inj₂ R with proc-progress Q ... | inj₁ (o' , QQ' , r , Q' , r') = inj₁ (_ , _ , _ , _ , context (P ∥ᵣ [-]) r') proc-progress (P ∥ Q) | inj₂ (proc R) | inj₂ (proc R') = inj₂ (proc (par R R')) proc-progress (P ∥ .(↑ _ _ _ _)) | inj₂ R | inj₂ (signal {_} {_} {_} {p} {V} {Q} R') = inj₁ (_ , _ , _ , _ , ↑-∥ᵣ p V P Q) proc-progress (.(↑ _ _ _ _) ∥ Q) | inj₂ (signal {_} {_} {_} {p} {V} {P} R) | inj₂ R' = inj₁ (_ , _ , _ , _ , ↑-∥ₗ p V P Q) proc-progress (↑ op p V P) with proc-progress P ... | inj₁ (o' , PP' , r , P' , r') = inj₁ (_ , _ , _ , _ , context (↑ op p V [-]) r') ... | inj₂ R = inj₂ (signal R) proc-progress (↓ op V P) with proc-progress P ... | inj₁ (o' , OO' , r , P' , r') = inj₁ (_ , _ , _ , _ , context (↓ op V [-]) r') ... | inj₂ (proc (run {_} {_} {_} {M} R)) = inj₁ (_ , _ , _ , _ , ↓-run V M) ... | inj₂ (proc (par {_} {_} {_} {_} {Q} {Q'} R R')) = inj₁ (_ , _ , _ , _ , ↓-∥ V Q Q') ... | inj₂ (signal {_} {_} {_} {p} {W} {Q} R) = inj₁ (_ , _ , _ , _ , ↓-↑ p V W Q)
Library/Trans/Graphics/Vector/EPS/Export/exportFontMap.asm
steakknife/pcgeos
504
99286
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: PostScript Translation Library FILE: Export/exportFontMap.asm AUTHOR: <NAME>, 15 April 1991 ROUTINES: Name Description ---- ----------- CalcFontDiff return a number giving the relative distance between two fontIDs REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 4/15/91 Initial revision DESCRIPTION: This routine implements a font-mapping algorithm that returns the difference between two fontIDs $Id: exportFontMap.asm,v 1.1 97/04/07 11:25:14 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontMapping segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CalcFontDiff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Determine the difference between two fontIDs CALLED BY: GLOBAL PASS: ax - fontID desired bx - fontID to test against RETURN: cl - "distance" between the two. (FontMap enum) The smaller the number, the closer the typefaces. This result should be treated as an unsigned byte. Special values: FM_EXACT (0x00) - exact match FM_DONT_USE (0xff) - do not sub test fontID DESTROYED: ch PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: FM_DONT_USE is returned under two circumstances: * The fonts are in different families * There is no mapping rules for the family ( this is true, currently, for ORNAMENT, SYMBOL and MONO fonts) REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 03/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NO_MAPPING_TABLE equ 0xffff ANY_MAPPING_OK equ 0xfffe FID_MAKER_BITS equ 0xf0 ; hi byte of fontID FID_FAMILY_BITS equ 0x0e ; hi byte of fontID CalcFontDiff proc far uses ax, bx, si .enter ; remove the manufacturer codes and ah, not FID_MAKER_BITS and bh, not FID_MAKER_BITS ; see if they are the same mov cx, ax sub cx, bx jcxz done ; all done, exact match ; see if they are in the same family mov ch, ah mov cl, bh and ch, FID_FAMILY_BITS ; isolate family bits and cl, FID_FAMILY_BITS ; isolate family bits cmp ch, cl ; if not the same, quit je sameFamily ; not the same familty, quit ; not same family, so we don't want to map them. A slight ; modification, however. If one of the families is MONO, then ; modify the return value to be slightly better than ; FM_DONT_USE. The effect will be to map fonts that have no ; good mapping to a MONO font. cmp ch, FG_MONO shr 8 ; see if 1st matches mono je haveMono cmp cl, FG_MONO shr 8 jne badFamily ; neither, return error haveMono: mov cl, FM_DONT_USE-1 jmp done ; same family, calculate difference sameFamily: clr ch ; only need one of the fams and bh, 1 ; isolate 9-bits of faceID and ah, 1 mov si, cx ; use as table index ; make sure there is a mapping table for this family ; NO_MAPPING_TABLE is found for fonts like ornament and symbol ; fonts, where it really doesn't make sense to map between ; fonts in these families. ; ANY_MAPPING_OK is found (currently) only for MONO spaced ; fonts. The idea is that it really doesn't matter which two ; fonts we map between here. cmp cs:[familyTable][si], NO_MAPPING_TABLE je badFamily cmp cs:[familyTable][si], ANY_MAPPING_OK je notExactButOK ; make sure we're not hanging off the end of the table cmp ax, cs:[numMappings][si] ja badFamily cmp bx, cs:[numMappings][si] ja badFamily ; do the mapping, man ; At this point, we know that the font is not an exact match. ; After this next sequence of instructions, we'll end up with ; a font difference between 1 and 0xfd (about) mov si, cs:[familyTable][si] ; get pointer mov cx, ax ; cx = first faceID push ds push bx mov bx, handle FontMapping ; lock resource call MemLock ; lock it down mov ds, ax mov ax, cx ; restore first faceID pop bx mov cl, ds:[si][bx] ; get font magic number mov bx, ax ; setup second faceID sub cl, ds:[si][bx] ; calc magic number diff jns haveAnswer neg cl ; return absolute value haveAnswer: inc cl ; one more, so we can reserve ; zero for exact matches mov bx, handle FontMapping call MemUnlock pop ds ; restore segreg done: .leave ret ; different family badFamily: mov cl, FM_DONT_USE jmp done ; not exact font, but any mapping for MONO is ok. notExactButOK: mov cl, 1 ; return code that is not jmp done ; FM_EXACT, but is OK CalcFontDiff endp familyTable label nptr.byte nptr serifTable nptr sansTable nptr scriptTable nptr NO_MAPPING_TABLE ; no mapping for ORNAMENT nptr NO_MAPPING_TABLE ; no mapping for SYMBOL nptr ANY_MAPPING_OK ; any mapping OK for MONO numMappings label word word NUM_AFTER_SERIF ; constant set in fontID.def word NUM_AFTER_SANS - NUM_AFTER_SERIF word NUM_AFTER_SCRIPT - NUM_AFTER_SANS word 0 ; no mapping for ORNAMENT word 0 ; no mapping for SYMBOL word 0 ; no mapping for MONO FontMapping ends
oeis/093/A093645.asm
neoneye/loda-programs
11
84216
<gh_stars>10-100 ; A093645: (10,1) Pascal triangle. ; Submitted by <NAME> ; 1,10,1,10,11,1,10,21,12,1,10,31,33,13,1,10,41,64,46,14,1,10,51,105,110,60,15,1,10,61,156,215,170,75,16,1,10,71,217,371,385,245,91,17,1,10,81,288,588,756,630,336,108,18,1,10,91,369,876,1344,1386,966,444,126,19,1,10,101,460,1245,2220,2730,2352,1410,570,145,20,1,10,111,561,1705,3465,4950,5082,3762,1980,715,165,21,1,10,121,672,2266,5170,8415,10032,8844,5742 lpb $0 add $2,$1 add $1,1 sub $0,$1 bin $2,$0 lpe bin $1,$0 mul $2,9 add $1,$2 mov $0,$1
include/bits_types_struct_file_h.ads
docandrew/troodon
5
19632
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; with bits_types_h; with stddef_h; package bits_types_struct_FILE_h is -- Copyright (C) 1991-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- Caution: The contents of this file are not part of the official -- stdio.h API. However, much of it is part of the official *binary* -- interface, and therefore cannot be changed. type u_IO_marker is null record; -- incomplete struct type u_IO_codecvt is null record; -- incomplete struct type u_IO_wide_data is null record; -- incomplete struct -- During the build of glibc itself, _IO_lock_t will already have been -- defined by internal headers. subtype u_IO_lock_t is System.Address; -- /usr/include/bits/types/struct_FILE.h:43 -- The tag name of this struct is _IO_FILE to preserve historic -- C++ mangled names for functions taking FILE* arguments. -- That name should not be used in new code. -- High-order word is _IO_MAGIC; rest is flags. type u_IO_FILE; subtype u_IO_FILE_array1135 is Interfaces.C.char_array (0 .. 0); subtype u_IO_FILE_array1140 is Interfaces.C.char_array (0 .. 19); type u_IO_FILE is record u_flags : aliased int; -- /usr/include/bits/types/struct_FILE.h:51 u_IO_read_ptr : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:54 u_IO_read_end : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:55 u_IO_read_base : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:56 u_IO_write_base : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:57 u_IO_write_ptr : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:58 u_IO_write_end : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:59 u_IO_buf_base : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:60 u_IO_buf_end : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:61 u_IO_save_base : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:64 u_IO_backup_base : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:65 u_IO_save_end : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_FILE.h:66 u_markers : access u_IO_marker; -- /usr/include/bits/types/struct_FILE.h:68 u_chain : access u_IO_FILE; -- /usr/include/bits/types/struct_FILE.h:70 u_fileno : aliased int; -- /usr/include/bits/types/struct_FILE.h:72 u_flags2 : aliased int; -- /usr/include/bits/types/struct_FILE.h:73 u_old_offset : aliased bits_types_h.uu_off_t; -- /usr/include/bits/types/struct_FILE.h:74 u_cur_column : aliased unsigned_short; -- /usr/include/bits/types/struct_FILE.h:77 u_vtable_offset : aliased signed_char; -- /usr/include/bits/types/struct_FILE.h:78 u_shortbuf : aliased u_IO_FILE_array1135; -- /usr/include/bits/types/struct_FILE.h:79 u_lock : System.Address; -- /usr/include/bits/types/struct_FILE.h:81 u_offset : aliased bits_types_h.uu_off64_t; -- /usr/include/bits/types/struct_FILE.h:89 u_codecvt : access u_IO_codecvt; -- /usr/include/bits/types/struct_FILE.h:91 u_wide_data : access u_IO_wide_data; -- /usr/include/bits/types/struct_FILE.h:92 u_freeres_list : access u_IO_FILE; -- /usr/include/bits/types/struct_FILE.h:93 u_freeres_buf : System.Address; -- /usr/include/bits/types/struct_FILE.h:94 uu_pad5 : aliased stddef_h.size_t; -- /usr/include/bits/types/struct_FILE.h:95 u_mode : aliased int; -- /usr/include/bits/types/struct_FILE.h:96 u_unused2 : aliased u_IO_FILE_array1140; -- /usr/include/bits/types/struct_FILE.h:98 end record with Convention => C_Pass_By_Copy; -- /usr/include/bits/types/struct_FILE.h:49 -- The following pointers correspond to the C++ streambuf protocol. -- Current read pointer -- End of get area. -- Start of putback+get area. -- Start of put area. -- Current put pointer. -- End of put area. -- Start of reserve area. -- End of reserve area. -- The following fields are used to support backing up and undo. -- Pointer to start of non-current get area. -- Pointer to first valid character of backup area -- Pointer to end of non-current get area. -- This used to be _offset but it's too small. -- 1+column number of pbase(); 0 is unknown. -- Wide character stream stuff. -- Make sure we don't get into trouble again. -- These macros are used by bits/stdio.h and internal headers. -- Many more flag bits are defined internally. end bits_types_struct_FILE_h;
PipeLine-CPU/msub_for_wjj.asm
MyLife97/MipsPipelineCPU
0
1582
init: addu $27,$0,$0 addu $28,$0,$0 addu $29,$0,$0 addu $30,$0,$0 addu $31,$0,$0 ori $28,$28,4 nop nop nop block_0: lui $31,0xdd7f ori $31,$31,0x94ee lui $12,0x0480 ori $12,$12,0x16da jal jump_block_0 nop jump_back_0: sw $31,0($29) addu $29,$29,$28 j block_1 ori $30,$0,18 jump_block_0: msub $31,$12 nop j jump_back_0 nop block_1: lui $31,0x798f ori $31,$31,0xfcc8 lui $12,0x30b9 ori $12,$12,0xb1dd jal jump_block_1 nop jump_back_1: sw $31,0($29) addu $29,$29,$28 j block_2 ori $30,$0,78 jump_block_1: ori $30,$0,28 msub $31,$12 ori $30,$0,47 j jump_back_1 nop block_2: lui $23,0x4402 ori $23,$23,0x49f8 lui $13,0xbc7f ori $13,$13,0xa3b9 jal jump_block_2 nop jump_back_2: sw $31,0($29) addu $29,$29,$28 j block_3 ori $30,$0,44 jump_block_2: msub $23,$13 nop j jump_back_2 nop block_3: lui $23,0xe1e1 ori $23,$23,0x534a lui $13,0xfa7f ori $13,$13,0xdf5b jal jump_block_3 nop jump_back_3: sw $31,0($29) addu $29,$29,$28 j block_4 nop jump_block_3: ori $30,$0,97 msub $23,$13 nop j jump_back_3 nop block_4: lui $31,0x8d8a ori $31,$31,0x168f lui $14,0xfad6 ori $14,$14,0x45cc jal jump_block_4 nop jump_back_4: sw $31,0($29) addu $29,$29,$28 j block_5 ori $30,$0,49 jump_block_4: msub $31,$14 nop j jump_back_4 nop block_5: lui $31,0x4f89 ori $31,$31,0x71cd lui $14,0xdfc4 ori $14,$14,0x6ad9 jal jump_block_5 nop jump_back_5: sw $31,0($29) addu $29,$29,$28 j block_6 nop jump_block_5: nop msub $31,$14 nop j jump_back_5 nop block_6: lui $5,0x8ac4 ori $5,$5,0x515c lui $2,0x16b3 ori $2,$2,0x9499 j jump_block_6 nop jr_back_6: addu $8,$0,$31 jalr $5,$8 nop jump_back_6: sw $5,0($29) addu $29,$29,$28 j block_7 ori $30,$0,11 jump_block_6: jal jr_back_6 nop msub $5,$2 nop j jump_back_6 nop block_7: lui $5,0xa455 ori $5,$5,0x1228 lui $2,0x1ba2 ori $2,$2,0x51ee j jump_block_7 nop jr_back_7: addu $8,$0,$31 jalr $5,$8 nop jump_back_7: sw $5,0($29) addu $29,$29,$28 j block_8 ori $30,$0,11 jump_block_7: jal jr_back_7 nop nop msub $5,$2 ori $30,$0,44 j jump_back_7 nop block_8: lui $0,0x2219 ori $0,$0,0xf94b lui $22,0xbdd5 ori $22,$22,0xbcff j jump_block_8 nop jr_back_8: addu $13,$0,$31 jalr $0,$13 nop jump_back_8: sw $0,0($29) addu $29,$29,$28 j block_9 ori $30,$0,93 jump_block_8: jal jr_back_8 nop msub $0,$22 nop j jump_back_8 nop block_9: lui $0,0xcb75 ori $0,$0,0x9328 lui $22,0x6051 ori $22,$22,0xb61f j jump_block_9 nop jr_back_9: addu $13,$0,$31 jalr $0,$13 nop jump_back_9: sw $0,0($29) addu $29,$29,$28 j block_10 ori $30,$0,50 jump_block_9: jal jr_back_9 nop ori $30,$0,57 msub $0,$22 ori $30,$0,67 j jump_back_9 nop block_10: lui $24,0x981d ori $24,$24,0x4fb9 lui $4,0xf558 ori $4,$4,0x2f48 j jump_block_10 nop jr_back_10: addu $14,$0,$31 jalr $21,$14 nop jump_back_10: sw $21,0($29) addu $29,$29,$28 j block_11 ori $30,$0,81 jump_block_10: jal jr_back_10 nop msub $24,$4 ori $30,$0,24 j jump_back_10 nop block_11:
oeis/127/A127337.asm
neoneye/loda-programs
11
720
; A127337: Numbers that are the sum of 10 consecutive primes. ; Submitted by <NAME>(s1) ; 129,158,192,228,264,300,340,382,424,468,510,552,594,636,682,732,780,824,870,912,954,1008,1060,1114,1164,1216,1266,1320,1376,1434,1494,1546,1596,1650,1704,1752,1800,1854,1914,1974,2030,2084,2142,2192,2250,2310,2374,2432,2480,2530,2582,2632,2686,2752,2812,2868,2922,2984,3050,3120,3188,3258,3324,3384,3446,3512,3578,3636,3696,3750,3810,3876,3938,4002,4062,4122,4182,4242,4302,4362,4416,4464,4522,4578,4636,4696,4756,4816,4880,4942,5020,5100,5178,5254,5332,5404,5478,5556,5628,5704 sub $0,1 mov $2,$0 mov $3,10 lpb $3 mov $0,$2 add $0,1 sub $3,1 add $0,$3 max $0,0 seq $0,86801 ; a(n) = prime(n) - 3. add $1,3 add $1,$0 lpe mov $0,$1
source/calendar/machine-apple-darwin/s-nareti.adb
ytomino/drake
33
27105
<filename>source/calendar/machine-apple-darwin/s-nareti.adb with System.Native_Time; package body System.Native_Real_Time is -- implementation function To_Native_Time (T : Duration) return Native_Time is begin return C.stdint.uint64_t'Integer_Value (T); end To_Native_Time; function To_Duration (T : Native_Time) return Duration is begin return Duration'Fixed_Value (T); end To_Duration; procedure Delay_Until (T : Native_Time) is Timeout_T : constant Duration := To_Duration (T); Current_T : constant Duration := To_Duration (Clock); D : Duration; begin if Timeout_T > Current_T then D := Timeout_T - Current_T; else D := 0.0; -- always calling Delay_For for abort checking end if; System.Native_Time.Delay_For (D); end Delay_Until; end System.Native_Real_Time;
macros_5/macros.asm
NrdyBhu1/learning-assembly-lang
1
175642
segment .text global _start %macro exit 1 mov rax, 60 mov rdi, %1 syscall %endmacro _start: exit 0 ret
programs/oeis/024/A024195.asm
neoneye/loda
22
166812
; A024195: Integer part of (4th elementary symmetric function of S(n))/(3rd elementary symmetric of S(n)), where S(n) = {3,4, ..., n+5}. ; 1,2,3,5,7,9,12,15,18,21,25,28,32,37,41,46,51,56,62,67,73,80,86,93,100,107,115,122,130,139,147,156,165,174,184,193,203,214,224,235,246,257,269,280,292,305,317,330,343,356,370,383,397,412,426,441,456,471,487,502,518,535,551,568,585,602,620,637,655,674,692,711,730,749,769,788,808,829,849,870,891,912,934,955,977,1000,1022,1045,1068,1091,1115,1138,1162,1187,1211,1236,1261,1286,1312,1337 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 mov $7,2 mov $10,$0 lpb $7 mov $0,$10 mov $6,0 sub $7,1 add $0,$7 sub $0,1 mov $8,$0 mul $8,$0 add $8,$0 lpb $0 mov $0,9 mov $6,2 lpe add $6,$8 div $6,8 mul $6,6 mov $3,$6 mov $5,$7 lpb $5 sub $5,1 mov $9,$3 lpe lpe lpb $10 sub $9,$3 mov $10,0 lpe mov $3,$9 div $3,6 add $3,1 add $1,$3 lpe mov $0,$1
Task/File-input-output/Ada/file-input-output-2.ada
LaudateCorpus1/RosettaCodeData
1
22719
with Ada.Command_Line, Ada.Text_IO; use Ada.Command_Line, Ada.Text_IO; procedure Read_And_Write_File_Line_By_Line is Read_From : constant String := "input.txt"; Write_To : constant String := "output.txt"; Input, Output : File_Type; begin begin Open (File => Input, Mode => In_File, Name => Read_From); exception when others => Put_Line (Standard_Error, "Can not open the file '" & Read_From & "'. Does it exist?"); Set_Exit_Status (Failure); return; end; begin Create (File => Output, Mode => Out_File, Name => Write_To); exception when others => Put_Line (Standard_Error, "Can not create a file named '" & Write_To & "'."); Set_Exit_Status (Failure); return; end; loop declare Line : String := Get_Line (Input); begin -- You can process the contents of Line here. Put_Line (Output, Line); end; end loop; Close (Input); Close (Output); exception when End_Error => if Is_Open(Input) then Close (Input); end if; if Is_Open(Output) then Close (Output); end if; end Read_And_Write_File_Line_By_Line;
test/interaction/Issue2728.agda
cruhland/agda
1,989
6203
<reponame>cruhland/agda record R : Set where infix 0 _+_
programs/oeis/003/A003057.asm
jmorken/loda
1
90712
<gh_stars>1-10 ; A003057: n appears n - 1 times. ; 2,3,3,4,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23 mul $0,2 mov $1,1 lpb $0 add $1,2 sub $0,$1 lpe div $1,2 add $1,2
src/dnscatcher/dnscatcher-datasets.ads
DNSCatcher/DNSCatcher
4
19636
-- Copyright 2019 <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. with Ada.Containers.Vectors; use Ada.Containers; with DNSCatcher.Types; use DNSCatcher.Types; -- @summary -- Datasets holds a collections and other protected types throughout the -- project in one top level module to help limit circular dependencies. -- -- @description -- Datasets include items as queues, pending requests, and other similar data -- structures which are reused in multiple places within the codebase. -- package DNSCatcher.Datasets is -- @summary -- Generic instance of vectors of Raw_Packet_Records, stored for processing package Stored_Packets_Vector is new Vectors (Natural, Raw_Packet_Record); use Stored_Packets_Vector; -- Raw_Packet_Record_Queue is a protected type intended to form queues for -- network workers as a consumer interface. A raw queue is used for sending -- outbound UDP packets for instance. -- -- Packets are stored FIFO. protected type Raw_Packet_Record_Queue is -- Stores a raw packet within the queue -- -- @param Packet -- Raw packet to store -- entry Put (Packet : in Raw_Packet_Record); -- Pops the top packet off the queue. -- -- @param Packet -- Output parameter for the packet -- entry Get (Packet : out Raw_Packet_Record); -- Gets count of number of packets in queue -- -- @param Count -- Returned count value -- entry Count (Count : out Integer); -- Deletes all stored packets -- entry Empty; private -- Internal storage vector for packets Stored_Packets : Vector; -- Current packet store count Packet_Count : Integer := 0; end Raw_Packet_Record_Queue; type DNS_Raw_Packet_Queue_Ptr is access Raw_Packet_Record_Queue; end DNSCatcher.Datasets;
programs/oeis/158/A158396.asm
neoneye/loda
22
100531
<reponame>neoneye/loda<filename>programs/oeis/158/A158396.asm ; A158396: 729n^2 + 2n. ; 731,2920,6567,11672,18235,26256,35735,46672,59067,72920,88231,105000,123227,142912,164055,186656,210715,236232,263207,291640,321531,352880,385687,419952,455675,492856,531495,571592,613147,656160,700631,746560,793947,842792,893095,944856,998075,1052752,1108887,1166480,1225531,1286040,1348007,1411432,1476315,1542656,1610455,1679712,1750427,1822600,1896231,1971320,2047867,2125872,2205335,2286256,2368635,2452472,2537767,2624520,2712731,2802400,2893527,2986112,3080155,3175656,3272615,3371032,3470907,3572240,3675031,3779280,3884987,3992152,4100775,4210856,4322395,4435392,4549847,4665760,4783131,4901960,5022247,5143992,5267195,5391856,5517975,5645552,5774587,5905080,6037031,6170440,6305307,6441632,6579415,6718656,6859355,7001512,7145127,7290200 seq $0,158397 ; 729n + 1. pow $0,2 add $1,$0 sub $1,532900 div $1,729 add $1,731 mov $0,$1
src/kernel/kernel.asm
asmCcoder/dzOS
1
175231
;****************************************************************************** ; kernel.asm ; ; Kernel ; for dastaZ80's dzOS ; by <NAME> (Jan 2018) ; ; Version 1.0.0 ; Created on 03 Jan 2018 ; Last Modification 03 Jan 2018 ;****************************************************************************** ; CHANGELOG ; - ;****************************************************************************** ; --------------------------- LICENSE NOTICE ---------------------------------- ; This file is part of dzOS ; Copyright (C) 2017-2018 <NAME> ; dzOS is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; dzOS is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; along with dzOS. If not, see <http://www.gnu.org/licenses/>. ; ----------------------------------------------------------------------------- ;============================================================================== ; Includes ;============================================================================== #include "src/includes/equates.inc" #include "exp/BIOS.exp" #include "exp/sysvars.exp" .ORG KRN_START ; ; Clean sysvars (not the ACIA, because they are in use already) ; ld hl, 0 ; ld a, 0 ; ld (secs_per_clus), a ; ld (secs_per_fat), hl ; ld (num_fats), a ; ld (reserv_secs), hl ; ld (clus2secnum), hl ; ld (root_dir_start), hl ; ld (root_dir_sectors), hl ; ld (cur_dir_start), hl ; ld (file_attributes), a krn_welcome: ; Kernel start up messages ld hl, msg_dzos ; dzOS welcome message call F_KRN_WRSTR ld hl, dzos_version ; dzOS version call F_KRN_WRSTR ; ; output 1 empty line ; ld b, 1 ; call F_KRN_EMPTYLINES ld hl, msg_bios_version ; BIOS version call F_KRN_WRSTR ld hl, msg_krn_version ; Kernel version call F_KRN_WRSTR ; output 2 empty lines ld b, 2 call F_KRN_EMPTYLINES ; Initialise CF card reader ld hl, krn_msg_cf_init call F_KRN_WRSTR call F_BIOS_CF_INIT ld hl, krn_msg_OK call F_KRN_WRSTR ld hl, krn_msg_cf_fat16ver call F_KRN_WRSTR call F_KRN_F16_READBOOTSEC ; read CF Boot Sector ; Copy BIOS Jumpblocks from ROM to RAM ld hl, krn_msg_cpybiosjblks call F_KRN_WRSTR ld hl, BIOS_JBLK_START ; pointer to address of start of BIOS Jumpblocks in ROM ld de, BIOS_JBLK_COPY_START ; pointer to address of start of BIOS Jumpblocks in RAM ld bc, 256 ; jumpblocks are 256 bytes max. ldir ; copy from ROM to RAM ld hl, krn_msg_OK call F_KRN_WRSTR ; Copy Kernel Jumpblocks from ROM to RAM ld hl, krn_msg_cpykrnjblks call F_KRN_WRSTR ld hl, KRN_JBLK_START ; pointer to address of start of Kernel Jumpblocks in ROM ld de, KRN_JBLK_COPY_START ; pointer to address of start of Kernel Jumpblocks in RAM ld bc, 256 ; jumpblocks are 256 bytes max. ldir ; copy from ROM to RAM ld hl, krn_msg_OK call F_KRN_WRSTR ; output 1 empty line ld b, 1 call F_KRN_EMPTYLINES jp CLI_START ; transfer control to CLI ;============================================================================== ; Kernel Modules ;============================================================================== #include "src/kernel/kernel.string.asm" #include "src/kernel/kernel.mem.asm" #include "src/kernel/kernel.conv.asm" #include "src/kernel/kernel.math.asm" #include "src/kernel/kernel.fat16.asm" ;============================================================================== ; Messages ;============================================================================== msg_krn_version: .BYTE CR, LF .BYTE "Kernel v1.0.0", 0 msg_dzos: .BYTE CR, LF .BYTE "##### ###### #### #### ", CR, LF .BYTE "## ## ## ## ## ## ", CR, LF .BYTE "## ## ## ## ## #### ", CR, LF .BYTE "## ## ## ## ## ## ", CR, LF .BYTE "##### ###### #### #### ", 0 krn_msg_cf_init: .BYTE "....Initialising CompactFlash reader ", 0 krn_msg_cf_fat16ver: .BYTE "FAT16 implementation v1.0 - No directories supported!", CR, LF, 0 krn_msg_cpybiosjblks: .BYTE CR, LF .BYTE "....Copying BIOS Jumblocks to RAM ", 0 krn_msg_cpykrnjblks: .BYTE "....Copying Kernel Jumblocks to RAM ", 0 krn_msg_OK: .BYTE "[ OK ]", CR, LF, 0 .ORG KRN_DZOS_VERSION dzos_version: .EXPORT dzos_version .BYTE "vYYYY.MM.DD. ", 0 ;============================================================================== ; END of CODE ;============================================================================== .ORG KRN_END .BYTE 0 .END
programs/oeis/104/A104765.asm
neoneye/loda
22
244782
; A104765: Triangle T(n,k) read by rows: row n contains the first n Lucas numbers A000204. ; 1,1,3,1,3,4,1,3,4,7,1,3,4,7,11,1,3,4,7,11,18,1,3,4,7,11,18,29,1,3,4,7,11,18,29,47,1,3,4,7,11,18,29,47,76,1,3,4,7,11,18,29,47,76,123,1,3,4,7,11,18,29,47,76,123,199,1,3,4,7,11,18,29,47,76,123,199,322,1,3,4,7,11,18,29,47,76,123,199,322,521,1,3,4,7,11,18,29,47,76 seq $0,25675 ; Exponent of 8 (value of j) in n-th number of form 7^i*8^j. seq $0,204 ; Lucas numbers (beginning with 1): L(n) = L(n-1) + L(n-2) with L(1) = 1, L(2) = 3.
alloy4fun_models/trashltl/models/15/FPXLXyapPzPAKbBnM.als
Kaixi26/org.alloytools.alloy
0
3783
<reponame>Kaixi26/org.alloytools.alloy open main pred idFPXLXyapPzPAKbBnM_prop16 { always all f:File | f in Protected } pred __repair { idFPXLXyapPzPAKbBnM_prop16 } check __repair { idFPXLXyapPzPAKbBnM_prop16 <=> prop16o }
programs/oeis/217/A217571.asm
karttu/loda
1
16935
; A217571: a(n) = (2*n*(n+5) + (2*n+1)*(-1)^n - 1)/8. ; 1,4,5,10,11,18,19,28,29,40,41,54,55,70,71,88,89,108,109,130,131,154,155,180,181,208,209,238,239,270,271,304,305,340,341,378,379,418,419,460,461,504,505,550,551,598,599,648,649,700,701,754,755,810,811,868,869,928,929,990,991,1054,1055,1120,1121,1188,1189,1258,1259,1330,1331,1404,1405,1480,1481,1558,1559,1638,1639,1720,1721,1804,1805,1890,1891,1978,1979,2068,2069,2160,2161,2254,2255,2350,2351,2448,2449,2548,2549,2650,2651,2754,2755,2860,2861,2968,2969,3078,3079,3190,3191,3304,3305,3420,3421,3538,3539,3658,3659,3780,3781,3904,3905,4030,4031,4158,4159,4288,4289,4420,4421,4554,4555,4690,4691,4828,4829,4968,4969,5110,5111,5254,5255,5400,5401,5548,5549,5698,5699,5850,5851,6004,6005,6160,6161,6318,6319,6478,6479,6640,6641,6804,6805,6970,6971,7138,7139,7308,7309,7480,7481,7654,7655,7830,7831,8008,8009,8188,8189,8370,8371,8554,8555,8740,8741,8928,8929,9118,9119,9310,9311,9504,9505,9700,9701,9898,9899,10098,10099,10300,10301,10504,10505,10710,10711,10918,10919,11128,11129,11340,11341,11554,11555,11770,11771,11988,11989,12208,12209,12430,12431,12654,12655,12880,12881,13108,13109,13338,13339,13570,13571,13804,13805,14040,14041,14278,14279,14518,14519,14760,14761,15004,15005,15250,15251,15498,15499,15748,15749,16000 mov $1,$0 mov $2,$0 div $2,2 sub $1,$2 add $0,$1 pow $1,2 add $1,$0 add $1,1
Cubical/Categories/Constructions/Quotient.agda
barrettj12/cubical
0
7022
-- Quotient category {-# OPTIONS --safe #-} module Cubical.Categories.Constructions.Quotient where open import Cubical.Categories.Category.Base open import Cubical.Categories.Functor.Base open import Cubical.Categories.Limits.Terminal open import Cubical.Foundations.HLevels open import Cubical.Foundations.Prelude open import Cubical.HITs.SetQuotients renaming ([_] to ⟦_⟧) private variable ℓ ℓ' ℓq : Level module _ (C : Category ℓ ℓ') where open Category C module _ (_~_ : {x y : ob} (f g : Hom[ x , y ] ) → Type ℓq) (~refl : {x y : ob} (f : Hom[ x , y ] ) → f ~ f) (~cong : {x y z : ob} (f f' : Hom[ x , y ]) → f ~ f' → (g g' : Hom[ y , z ]) → g ~ g' → (f ⋆ g) ~ (f' ⋆ g')) where private Hom[_,_]/~ = λ (x y : ob) → Hom[ x , y ] / _~_ module _ {x y z : ob} where _⋆/~_ : Hom[ x , y ]/~ → Hom[ y , z ]/~ → Hom[ x , z ]/~ _⋆/~_ = rec2 squash/ (λ f g → ⟦ f ⋆ g ⟧) (λ f f' g f~f' → eq/ _ _ (~cong _ _ f~f' _ _ (~refl _))) (λ f g g' g~g' → eq/ _ _ (~cong _ _ (~refl _) _ _ g~g')) module _ {x y : ob} where ⋆/~IdL : (f : Hom[ x , y ]/~) → (⟦ id ⟧ ⋆/~ f) ≡ f ⋆/~IdL = elimProp (λ _ → squash/ _ _) (λ _ → cong ⟦_⟧ (⋆IdL _)) ⋆/~IdR : (f : Hom[ x , y ]/~) → (f ⋆/~ ⟦ id ⟧) ≡ f ⋆/~IdR = elimProp (λ _ → squash/ _ _) (λ _ → cong ⟦_⟧ (⋆IdR _)) module _ {x y z w : ob} where ⋆/~Assoc : (f : Hom[ x , y ]/~) (g : Hom[ y , z ]/~) (h : Hom[ z , w ]/~) → ((f ⋆/~ g) ⋆/~ h) ≡ (f ⋆/~ (g ⋆/~ h)) ⋆/~Assoc = elimProp3 (λ _ _ _ → squash/ _ _) (λ _ _ _ → cong ⟦_⟧ (⋆Assoc _ _ _)) open Category QuotientCategory : Category ℓ (ℓ-max ℓ' ℓq) QuotientCategory .ob = ob C QuotientCategory .Hom[_,_] x y = (C [ x , y ]) / _~_ QuotientCategory .id = ⟦ id C ⟧ QuotientCategory ._⋆_ = _⋆/~_ QuotientCategory .⋆IdL = ⋆/~IdL QuotientCategory .⋆IdR = ⋆/~IdR QuotientCategory .⋆Assoc = ⋆/~Assoc QuotientCategory .isSetHom = squash/ private C/~ = QuotientCategory -- Quotient map open Functor QuoFunctor : Functor C C/~ QuoFunctor .F-ob x = x QuoFunctor .F-hom = ⟦_⟧ QuoFunctor .F-id = refl QuoFunctor .F-seq f g = refl -- Quotients preserve initial / terminal objects isInitial/~ : {z : ob C} → isInitial C z → isInitial C/~ z isInitial/~ zInit x = ⟦ zInit x .fst ⟧ , elimProp (λ _ → squash/ _ _) λ f → eq/ _ _ (subst (_~ f) (sym (zInit x .snd f)) (~refl _)) isFinal/~ : {z : ob C} → isFinal C z → isFinal C/~ z isFinal/~ zFinal x = ⟦ zFinal x .fst ⟧ , elimProp (λ _ → squash/ _ _) λ f → eq/ _ _ (subst (_~ f) (sym (zFinal x .snd f)) (~refl _))
examples/Introduction/Universes.agda
shlevy/agda
1,989
15503
<filename>examples/Introduction/Universes.agda module Introduction.Universes where data Nat : Set where zero : Nat suc : Nat -> Nat postulate IsEven : Nat -> Prop data Even : Set where even : (n : Nat) -> IsEven n -> Even
Data/MonoidalHeap/Monad.agda
oisdk/agda-playground
6
4070
<filename>Data/MonoidalHeap/Monad.agda {-# OPTIONS --cubical --safe #-} open import Algebra open import Relation.Binary open import Algebra.Monus module Data.MonoidalHeap.Monad {s} (monus : TMAPOM s) where open TMAPOM monus open import Prelude open import Data.List using (List; _∷_; []; foldr; _++_) import Data.Nat as ℕ import Data.Nat.Properties as ℕ 𝒮 : Type s 𝒮 = 𝑆 → 𝑆 ⟦_⇑⟧ : 𝑆 → 𝒮 ⟦_⇑⟧ = _∙_ ⟦_⇓⟧ : 𝒮 → 𝑆 ⟦ x ⇓⟧ = x ε infixl 10 _⊙_ _⊙_ : (𝑆 → A) → 𝑆 → 𝑆 → A f ⊙ x = λ y → f (x ∙ y) mutual data Node (V : 𝑆 → Type a) : Type (a ℓ⊔ s) where leaf : V ε → Node V _⋊_ : (w : 𝑆) → Heap (V ⊙ w) → Node V Heap : (𝑆 → Type a) → Type (a ℓ⊔ s) Heap V = List (Node V) private variable v : Level V : 𝑆 → Type v Root : (𝑆 → Type v) → Type _ Root V = ∃ w × Heap (V ⊙ w) partition : Heap V → List (V ε) × List (Root V) partition = foldr f ([] , []) where f : Node V → List (V ε) × List (∃ w × Heap (V ⊙ w)) → List (V ε) × List (∃ w × Heap (V ⊙ w)) f (leaf x) (ls , hs) = (x ∷ ls) , hs f (w ⋊ x) (ls , hs) = ls , ((w , x) ∷ hs) module _ {V : 𝑆 → Type v} where ⊙-assoc : ∀ x y k → x ≡ y ∙ k → V ⊙ x ≡ V ⊙ y ⊙ k ⊙-assoc x y k x≡y∙k i z = V ((cong (_∙ z) x≡y∙k ; assoc y k z) i) ⊙ε : V ⊙ ε ≡ V ⊙ε i x = V (ε∙ x i) ⊙-rassoc : ∀ x y → V ⊙ (x ∙ y) ≡ V ⊙ x ⊙ y ⊙-rassoc x y i z = V (assoc x y z i) merge : Root V → Root V → Root V merge (x , xs) (y , ys) with x ≤|≥ y ... | inl (k , y≡x∙k) = x , (k ⋊ subst Heap (⊙-assoc y x k y≡x∙k) ys) ∷ xs ... | inr (k , x≡y∙k) = y , (k ⋊ subst Heap (⊙-assoc x y k x≡y∙k) xs) ∷ ys merges⁺ : Root V → List (Root V) → Root V merges⁺ x [] = x merges⁺ x₁ (x₂ ∷ []) = merge x₁ x₂ merges⁺ x₁ (x₂ ∷ x₃ ∷ xs) = merge (merge x₁ x₂) (merges⁺ x₃ xs) merges : List (Root V) → Maybe (Root V) merges [] = nothing merges (x ∷ xs) = just (merges⁺ x xs) popMin : Heap V → List (V ε) × Maybe (Root V) popMin = map₂ merges ∘ partition return : V ε → Heap V return x = leaf x ∷ [] weight : ∃ x × V x → Heap V weight (w , x) = (w ⋊ (leaf (subst V (sym (∙ε w)) x) ∷ [])) ∷ [] _>>=_ : Heap V → (∀ {x} → V x → Heap (V ⊙ x)) → Heap V _>>=_ [] k = [] _>>=_ (leaf x ∷ xs) k = subst Heap ⊙ε (k x) ++ (xs >>= k) _>>=_ {V = V} ((w ⋊ x) ∷ xs) k = (w ⋊ (x >>= (subst Heap (⊙-rassoc {V = V} w _) ∘ k))) ∷ (xs >>= k)
oeis/091/A091527.asm
neoneye/loda-programs
11
19917
; A091527: a(n) = ((3*n)!/n!^2)*(Gamma(1+n/2)/Gamma(1+3n/2)). ; Submitted by <NAME> ; 1,4,30,256,2310,21504,204204,1966080,19122246,187432960,1848483780,18320719872,182327718300,1820797698048,18236779032600,183120225632256,1842826521244230,18581317012684800,187679234340049620,1898554215471513600,19232182592635611060,195062884538158940160,1980665038436368775400,20132340083242712432640,204826599735691440534300,2085710432623945008021504,21255328931341321610645544,216771272313736506816593920,2212241139727064219063537016,22591197226942904129122467840,230835920303934356099526310704 mov $1,1 mov $2,1 mov $3,$0 mul $3,2 lpb $3 mul $1,$0 sub $3,1 mul $2,$3 add $1,$2 mov $2,$1 mov $4,$5 cmp $4,0 add $5,$4 div $1,$5 div $2,$5 add $2,$1 mul $1,2 sub $3,1 add $5,1 lpe mov $0,$2
codec/encoder/core/asm/mb_copy.asm
TechSmith/openh264
1
173774
;*! ;* \copy ;* Copyright (c) 2009-2013, Cisco Systems ;* 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. ;* ;* 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. ;* ;* ;* mb_copy.asm ;* ;* Abstract ;* mb_copy ;* ;* ;*********************************************************************************************/ %include "asm_inc.asm" BITS 32 ;*********************************************************************** ; Macros and other preprocessor constants ;*********************************************************************** ;*********************************************************************** ; Code ;*********************************************************************** SECTION .text WELS_EXTERN WelsCopy16x16_sse2 WELS_EXTERN WelsCopy16x16NotAligned_sse2 WELS_EXTERN WelsCopy8x8_mmx WELS_EXTERN WelsCopy16x8NotAligned_sse2 ; WELS_EXTERN WelsCopy8x16_mmx ; WELS_EXTERN UpdateMbMv_sse2 ; ;*********************************************************************** ; void WelsCopy16x16_sse2( uint8_t* Dst, ; int32_t iStrideD, ; uint8_t* Src, ; int32_t iStrideS ) ;*********************************************************************** ALIGN 16 WelsCopy16x16_sse2: push esi push edi push ebx mov edi, [esp+16] ; Dst mov eax, [esp+20] ; iStrideD mov esi, [esp+24] ; Src mov ecx, [esp+28] ; iStrideS lea ebx, [eax+2*eax] ; x3 lea edx, [ecx+2*ecx] ; x3 movdqa xmm0, [esi] movdqa xmm1, [esi+ecx] movdqa xmm2, [esi+2*ecx] movdqa xmm3, [esi+edx] lea esi, [esi+4*ecx] movdqa xmm4, [esi] movdqa xmm5, [esi+ecx] movdqa xmm6, [esi+2*ecx] movdqa xmm7, [esi+edx] lea esi, [esi+4*ecx] movdqa [edi], xmm0 movdqa [edi+eax], xmm1 movdqa [edi+2*eax], xmm2 movdqa [edi+ebx], xmm3 lea edi, [edi+4*eax] movdqa [edi], xmm4 movdqa [edi+eax], xmm5 movdqa [edi+2*eax], xmm6 movdqa [edi+ebx], xmm7 lea edi, [edi+4*eax] movdqa xmm0, [esi] movdqa xmm1, [esi+ecx] movdqa xmm2, [esi+2*ecx] movdqa xmm3, [esi+edx] lea esi, [esi+4*ecx] movdqa xmm4, [esi] movdqa xmm5, [esi+ecx] movdqa xmm6, [esi+2*ecx] movdqa xmm7, [esi+edx] movdqa [edi], xmm0 movdqa [edi+eax], xmm1 movdqa [edi+2*eax], xmm2 movdqa [edi+ebx], xmm3 lea edi, [edi+4*eax] movdqa [edi], xmm4 movdqa [edi+eax], xmm5 movdqa [edi+2*eax], xmm6 movdqa [edi+ebx], xmm7 pop ebx pop edi pop esi ret ;*********************************************************************** ; void WelsCopy16x16NotAligned_sse2( uint8_t* Dst, ; int32_t iStrideD, ; uint8_t* Src, ; int32_t iStrideS ) ;*********************************************************************** ALIGN 16 ; dst can be align with 16 bytes, but not sure about pSrc, 12/29/2011 WelsCopy16x16NotAligned_sse2: push esi push edi push ebx mov edi, [esp+16] ; Dst mov eax, [esp+20] ; iStrideD mov esi, [esp+24] ; Src mov ecx, [esp+28] ; iStrideS lea ebx, [eax+2*eax] ; x3 lea edx, [ecx+2*ecx] ; x3 movdqu xmm0, [esi] movdqu xmm1, [esi+ecx] movdqu xmm2, [esi+2*ecx] movdqu xmm3, [esi+edx] lea esi, [esi+4*ecx] movdqu xmm4, [esi] movdqu xmm5, [esi+ecx] movdqu xmm6, [esi+2*ecx] movdqu xmm7, [esi+edx] lea esi, [esi+4*ecx] movdqa [edi], xmm0 movdqa [edi+eax], xmm1 movdqa [edi+2*eax], xmm2 movdqa [edi+ebx], xmm3 lea edi, [edi+4*eax] movdqa [edi], xmm4 movdqa [edi+eax], xmm5 movdqa [edi+2*eax], xmm6 movdqa [edi+ebx], xmm7 lea edi, [edi+4*eax] movdqu xmm0, [esi] movdqu xmm1, [esi+ecx] movdqu xmm2, [esi+2*ecx] movdqu xmm3, [esi+edx] lea esi, [esi+4*ecx] movdqu xmm4, [esi] movdqu xmm5, [esi+ecx] movdqu xmm6, [esi+2*ecx] movdqu xmm7, [esi+edx] movdqa [edi], xmm0 movdqa [edi+eax], xmm1 movdqa [edi+2*eax], xmm2 movdqa [edi+ebx], xmm3 lea edi, [edi+4*eax] movdqa [edi], xmm4 movdqa [edi+eax], xmm5 movdqa [edi+2*eax], xmm6 movdqa [edi+ebx], xmm7 pop ebx pop edi pop esi ret ; , 12/29/2011 ;*********************************************************************** ; void WelsCopy16x8NotAligned_sse2(uint8_t* Dst, ; int32_t iStrideD, ; uint8_t* Src, ; int32_t iStrideS ) ;*********************************************************************** ALIGN 16 WelsCopy16x8NotAligned_sse2: push esi push edi push ebx mov edi, [esp+16] ; Dst mov eax, [esp+20] ; iStrideD mov esi, [esp+24] ; Src mov ecx, [esp+28] ; iStrideS lea ebx, [eax+2*eax] ; x3 lea edx, [ecx+2*ecx] ; x3 movdqu xmm0, [esi] movdqu xmm1, [esi+ecx] movdqu xmm2, [esi+2*ecx] movdqu xmm3, [esi+edx] lea esi, [esi+4*ecx] movdqu xmm4, [esi] movdqu xmm5, [esi+ecx] movdqu xmm6, [esi+2*ecx] movdqu xmm7, [esi+edx] movdqa [edi], xmm0 movdqa [edi+eax], xmm1 movdqa [edi+2*eax], xmm2 movdqa [edi+ebx], xmm3 lea edi, [edi+4*eax] movdqa [edi], xmm4 movdqa [edi+eax], xmm5 movdqa [edi+2*eax], xmm6 movdqa [edi+ebx], xmm7 pop ebx pop edi pop esi ret ;*********************************************************************** ; void WelsCopy8x16_mmx(uint8_t* Dst, ; int32_t iStrideD, ; uint8_t* Src, ; int32_t iStrideS ) ;*********************************************************************** ALIGN 16 WelsCopy8x16_mmx: push ebx mov eax, [esp + 8 ] ;Dst mov ecx, [esp + 12] ;iStrideD mov ebx, [esp + 16] ;Src mov edx, [esp + 20] ;iStrideS movq mm0, [ebx] movq mm1, [ebx+edx] lea ebx, [ebx+2*edx] movq mm2, [ebx] movq mm3, [ebx+edx] lea ebx, [ebx+2*edx] movq mm4, [ebx] movq mm5, [ebx+edx] lea ebx, [ebx+2*edx] movq mm6, [ebx] movq mm7, [ebx+edx] lea ebx, [ebx+2*edx] movq [eax], mm0 movq [eax+ecx], mm1 lea eax, [eax+2*ecx] movq [eax], mm2 movq [eax+ecx], mm3 lea eax, [eax+2*ecx] movq [eax], mm4 movq [eax+ecx], mm5 lea eax, [eax+2*ecx] movq [eax], mm6 movq [eax+ecx], mm7 lea eax, [eax+2*ecx] movq mm0, [ebx] movq mm1, [ebx+edx] lea ebx, [ebx+2*edx] movq mm2, [ebx] movq mm3, [ebx+edx] lea ebx, [ebx+2*edx] movq mm4, [ebx] movq mm5, [ebx+edx] lea ebx, [ebx+2*edx] movq mm6, [ebx] movq mm7, [ebx+edx] movq [eax], mm0 movq [eax+ecx], mm1 lea eax, [eax+2*ecx] movq [eax], mm2 movq [eax+ecx], mm3 lea eax, [eax+2*ecx] movq [eax], mm4 movq [eax+ecx], mm5 lea eax, [eax+2*ecx] movq [eax], mm6 movq [eax+ecx], mm7 WELSEMMS pop ebx ret ;*********************************************************************** ; void WelsCopy8x8_mmx( uint8_t* Dst, ; int32_t iStrideD, ; uint8_t* Src, ; int32_t iStrideS ) ;*********************************************************************** ALIGN 16 WelsCopy8x8_mmx: push ebx push esi mov eax, [esp + 12] ;Dst mov ecx, [esp + 16] ;iStrideD mov esi, [esp + 20] ;Src mov ebx, [esp + 24] ;iStrideS lea edx, [ebx+2*ebx] ; to prefetch next loop prefetchnta [esi+2*ebx] prefetchnta [esi+edx] movq mm0, [esi] movq mm1, [esi+ebx] lea esi, [esi+2*ebx] ; to prefetch next loop prefetchnta [esi+2*ebx] prefetchnta [esi+edx] movq mm2, [esi] movq mm3, [esi+ebx] lea esi, [esi+2*ebx] ; to prefetch next loop prefetchnta [esi+2*ebx] prefetchnta [esi+edx] movq mm4, [esi] movq mm5, [esi+ebx] lea esi, [esi+2*ebx] movq mm6, [esi] movq mm7, [esi+ebx] movq [eax], mm0 movq [eax+ecx], mm1 lea eax, [eax+2*ecx] movq [eax], mm2 movq [eax+ecx], mm3 lea eax, [eax+2*ecx] movq [eax], mm4 movq [eax+ecx], mm5 lea eax, [eax+2*ecx] movq [eax], mm6 movq [eax+ecx], mm7 WELSEMMS pop esi pop ebx ret ; (<EMAIL>), 12/21/2011 ;*********************************************************************** ; void UpdateMbMv_sse2( SMVUnitXY *pMvBuffer, const SMVUnitXY sMv ) ;*********************************************************************** ALIGN 16 UpdateMbMv_sse2: mov eax, [esp+4] ; mv_buffer movd xmm0, [esp+8] ; _mv pshufd xmm1, xmm0, $0 movdqa [eax ], xmm1 movdqa [eax+0x10], xmm1 movdqa [eax+0x20], xmm1 movdqa [eax+0x30], xmm1 ret ;*********************************************************************** ; Macros and other preprocessor constants ;*********************************************************************** ;*********************************************************************** ; Local Data (Read Only) ;*********************************************************************** ;SECTION .rodata pData align=16 ;*********************************************************************** ; Various memory constants (trigonometric values or rounding values) ;*********************************************************************** ;read unaligned memory %macro SSE2_READ_UNA 2 movq %1, [%2] movhps %1, [%2+8] %endmacro ;write unaligned memory %macro SSE2_WRITE_UNA 2 movq [%1], %2 movhps [%1+8], %2 %endmacro ALIGN 16 ;*********************************************************************** ; Code ;*********************************************************************** SECTION .text WELS_EXTERN PixelAvgWidthEq8_mmx WELS_EXTERN PixelAvgWidthEq16_sse2 WELS_EXTERN McCopyWidthEq4_mmx WELS_EXTERN McCopyWidthEq8_mmx WELS_EXTERN McCopyWidthEq16_sse2 ALIGN 16 ;*********************************************************************** ; void PixelAvgWidthEq8_mmx( uint8_t *dst, int32_t iDstStride, ; uint8_t *pSrc1, int32_t iSrc1Stride, ; uint8_t *pSrc2, int32_t iSrc2Stride, ; int32_t iHeight ); ;*********************************************************************** PixelAvgWidthEq8_mmx: push ebp push ebx push esi push edi mov edi, [esp+20] mov esi, [esp+28] mov edx, [esp+36] mov ebp, [esp+24] mov eax, [esp+32] mov ebx, [esp+40] mov ecx, [esp+44] sar ecx, 2 .height_loop: movq mm0, [esi] pavgb mm0, [edx] movq [edi], mm0 movq mm1, [esi+eax] pavgb mm1, [edx+ebx] movq [edi+ebp], mm1 lea edi, [edi+2*ebp] lea esi, [esi+2*eax] lea edx, [edx+2*ebx] movq mm2, [esi] pavgb mm2, [edx] movq [edi], mm2 movq mm3, [esi+eax] pavgb mm3, [edx+ebx] movq [edi+ebp], mm3 lea edi, [edi+2*ebp] lea esi, [esi+2*eax] lea edx, [edx+2*ebx] dec ecx jne .height_loop WELSEMMS pop edi pop esi pop ebx pop ebp ret ALIGN 16 ;*********************************************************************** ; void PixelAvgWidthEq16_sse2( uint8_t *dst, int32_t iDstStride, ; uint8_t *pSrc1, int32_t iSrc1Stride, ; uint8_t *pSrc2, int32_t iSrc2Stride, ; int32_t iHeight ); ;*********************************************************************** PixelAvgWidthEq16_sse2: push ebp push ebx push esi push edi mov edi, [esp+20] mov esi, [esp+28] mov edx, [esp+36] mov ebp, [esp+24] mov eax, [esp+32] mov ebx, [esp+40] mov ecx, [esp+44] sar ecx, 2 .height_loop: movdqu xmm0, [esi] movdqu xmm1, [edx] movdqu xmm2, [esi+eax] movdqu xmm3, [edx+ebx] pavgb xmm0, xmm1 pavgb xmm2, xmm3 movdqu [edi], xmm0 movdqu [edi+ebp], xmm2 lea edi, [edi+2*ebp] lea esi, [esi+2*eax] lea edx, [edx+2*ebx] movdqu xmm4, [esi] movdqu xmm5, [edx] movdqu xmm6, [esi+eax] movdqu xmm7, [edx+ebx] pavgb xmm4, xmm5 pavgb xmm6, xmm7 movdqu [edi], xmm4 movdqu [edi+ebp], xmm6 lea edi, [edi+2*ebp] lea esi, [esi+2*eax] lea edx, [edx+2*ebx] dec ecx jne .height_loop pop edi pop esi pop ebx pop ebp ret ALIGN 64 avg_w16_align_0_ssse3: movdqa xmm1, [ebx] movdqu xmm2, [ecx] pavgb xmm1, xmm2 movdqa [edi], xmm1 add ebx, eax add ecx, ebp add edi, esi dec dword [esp+4] jg avg_w16_align_0_ssse3 ret ALIGN 64 avg_w16_align_1_ssse3: movdqa xmm1, [ebx+16] movdqu xmm2, [ecx] palignr xmm1, [ebx], 1 pavgb xmm1, xmm2 movdqa [edi], xmm1 add ebx, eax add ecx, ebp add edi, esi dec dword [esp+4] jg avg_w16_align_1_ssse3 ret ALIGN 16 ;*********************************************************************** ; void PixelAvgWidthEq16_ssse3(uint8_t *pDst, int32_t iDstStride, ; uint8_t *pSrc1, int32_t iSrc1Stride, ; uint8_t *pSrc2, int32_t iSrc2Stride, ; int32_t iHeight ); ;*********************************************************************** WELS_EXTERN PixelAvgWidthEq16_ssse3 PixelAvgWidthEq16_ssse3: push ebp push ebx push esi push edi mov edi, [esp+20] ; dst mov ebx, [esp+28] ; src1 mov ecx, [esp+36] ; src2 mov esi, [esp+24] ; i_dst_stride %define avg_w16_offset (avg_w16_align_1_ssse3-avg_w16_align_0_ssse3) mov edx, ebx and edx, 0x01 lea eax, [avg_w16_align_0_ssse3] lea ebp, [avg_w16_offset] imul ebp, edx lea edx, [ebp+eax] mov eax, [esp+32] mov ebp, [esp+44] push ebp mov ebp, [esp+44] and ebx, 0xfffffff0 call edx pop ebp pop edi pop esi pop ebx pop ebp ret ALIGN 16 ;******************************************************************************* ; void McCopyWidthEq4_mmx( uint8_t *pSrc, int32_t iSrcStride, ; uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) ;******************************************************************************* McCopyWidthEq4_mmx: push esi push edi push ebx mov esi, [esp+16] mov eax, [esp+20] mov edi, [esp+24] mov ecx, [esp+28] mov edx, [esp+32] ALIGN 4 .height_loop: mov ebx, [esi] mov [edi], ebx add esi, eax add edi, ecx dec edx jnz .height_loop WELSEMMS pop ebx pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void McCopyWidthEq8_mmx( uint8_t *pSrc, int32_t iSrcStride, ; uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) ;******************************************************************************* McCopyWidthEq8_mmx: push esi push edi mov esi, [esp+12] mov eax, [esp+16] mov edi, [esp+20] mov ecx, [esp+24] mov edx, [esp+28] ALIGN 4 .height_loop: movq mm0, [esi] movq [edi], mm0 add esi, eax add edi, ecx dec edx jnz .height_loop WELSEMMS pop edi pop esi ret ALIGN 16 ;*********************************************************************** ; void McCopyWidthEq16_sse2( uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, int32_t iHeight ) ;*********************************************************************** McCopyWidthEq16_sse2: push esi push edi mov esi, [esp+12] mov eax, [esp+16] mov edi, [esp+20] mov edx, [esp+24] mov ecx, [esp+28] ALIGN 4 .height_loop: SSE2_READ_UNA xmm0, esi SSE2_READ_UNA xmm1, esi+eax SSE2_WRITE_UNA edi, xmm0 SSE2_WRITE_UNA edi+edx, xmm1 sub ecx, 2 lea esi, [esi+eax*2] lea edi, [edi+edx*2] jnz .height_loop pop edi pop esi ret
bootloader/boot1.asm
rares985/wood-os
2
169566
<filename>bootloader/boot1.asm KERNEL_OFFSET equ 0xF000 [bits 16] boot1: pusha mov bp, 0x7000 ; 1. Set up the stack pointer. mov sp, bp ; Broken, for now. mov bx, 0 mov es, bx mov di, 0x5000 call do_e820 ; 2. Query BIOS for available memory. This can only be done in ; real mode, so perform it before switching to protected ; mode call load_kernel ; 3. Load the kernel from disk and map it into memory, ; using the exact same methods we used for the transition ; boot0 -> boot1. cli ; 4. Disable interrupts until the protected mode ; interrupt vector is set up or interrupts go wild lgdt [gdt_descriptor] ; 5. Load the GDT, which defines the protected mode ; segments (code and data) mov eax, cr0 ; 6. Switch to protected mode. For this, the first bit or eax, 0x1 ; of CR0, a control register, must be set. mov cr0, eax jmp CODE_SEG:initialise_pm ; 7. Make a far jump (actually not so far, just tricking ; the CPU ) to our 32-bit code. This forces the CPU ; to flush its cache of pre-fetched instructions. ; Function which loads the kernel into memory, starting at KERNEL_OFFSET. ; According to our memory map, we have around 576K of free memory (F000 - 0x9F000) ; For now, read only 32 sectors (16K) from the disk. load_kernel: pusha ; DL - drive from which to read (placed here by BIOS) mov dh, 64 ; DH - how many sectors to read mov ax, 17 ; AX - LBA address of sector from which to start (1 from boot0 + 16 from boot1 = 17 occupied) mov bx, 0 mov es, bx mov bx, KERNEL_OFFSET ; We want to load the kernel at KERNEL_OFFSET. call disk_load popa ret %include "disk.asm" %include "print.asm" %include "print_hex.asm" %include "gdt.asm" %include "e820.asm" ; 32-bit includes %include "print_no_bios.asm" ; Function which initialises the protected mode: ; - segment registers must point to the new data selector defined in GDT ; - stack must be set up again, since protected mode can address a lot more memory [bits 32] initialise_pm: mov ax, DATA_SEG ; Since we are in PM, old segments have no longer a meaning mov ds, ax ; we must point our segment registers to the data selector defined in GDT mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; Set up stack for protected mode mov esp, ebp mov ebx, HELLO_PROT call print_no_bios call KERNEL_OFFSET ; 8. Give control to the kernel jmp $ ; If control is ever returned, hang here HELLO_PROT db "protected mode!", 0 ; Recall that in boot0 we read 16 sectors from boot drive. ; 16 * 512 bytes = 8K of data. Therefore, we must read from ; boot disk, starting with sector 18 if we want to read the kernel. ; In order to do this, we must make the boot1 occupy exactly 8K due ; to how the OS is built, otherwise in the OS image the 8K will span ; both boot1 and some parts of the kernel. So we are padding from current ; address up until 8192 with zeros. times 8192 - ($ - $$) db 0
definitions/algos.yaml.adb
DragonDriver/ann-benchmarks
0
8634
float: euclidean: adb-async: docker-tag: ann-benchmarks-adb-async module: ann_benchmarks.algorithms.adb constructor: AnalyticDBAsync base-args: ["@dataset"] run-groups: base: args: [["gp-bp19e1yl22d85gqgxo-master.gpdbmaster.rds.aliyuncs.com"], [1, 2, 3]] query-args: [[1, 2, 3]]
src/test/kc/complex/new_30_years_low_resolution/mcbitmap.asm
jbrandwood/kickc
2
175227
<reponame>jbrandwood/kickc // KickAssembler functions for converting a Picture to a multi-color bitmap // Based on Code by Cruzer/CML, April 2011 (https://codebase64.org/doku.php?id=base:double_screen_horizontal_scroller&s[]=koala) // Based on a routine from Codebase64 by <NAME> //--------------------------------------------------------------------------------------------------------------------- // Picture - a result from LoadPicture() // - The upper line is used for defining the c64 palette, with multicolor sized pixels // - The pixel to the right of the palette defines the background color // Usage: // #import "mcbitmap.asm" // .var mcBmmData = getMcBitmapData(LoadPicture("bitmap.png")) // *=$0c00 "SCREEN"; // .for (var y=0; y<25; y++) // .for (var x=0; x<40; x++) // .byte getMcScreenData(x, y, mcBmmData) // *=$1c00 "COLORS" // colorRam: // .for (var y=0; y<25; y++) // .for (var x=0; x<40; x++) // .byte getMcColorData(x, y, mcBmmData) // *=$2000 "BITMAP"; // .for (var y=0; y<25; y++) // .for (var x=0; x<40; x++) // .fill 8, getMcPixelData(x, y, i, mcBmmData) #importonce .struct McBitmapPalette { // Hashtable mapping RGB to C64 color // rgb2c64.get(rgb) returns a C64 color (0-15) rgb2c64, // The (C64) background color of the image bgColor } // Bitmap data for a single (4x8 MC pixel) block .struct McBitmapBlock { // List() with 8 pixel bytes pixels, // C64 color for %01 pixels color1, // C64 color for %10 pixels color2, // C64 color for %11 pixels color3, // Byte for screen (color1*$10 + color2) screendata, // Byte for color (color3) colordata } // Bitmap data for an entire picture .struct McBitmapData { // The McBitmapPalette palette, // The number of X-blocks (40 for a normal full screen bitmap) width, // The number of Y-blocks (25 for a normal full screen bitmap) height, // List with width*height McBitmapBlock ordered row by row. // blocks.get(y*width+x) is the block at (x,y) blocks } // Get multicolor-bitmap data for a picture. The first row of the picture contains the palette and is discarded. (pixel #0-#15 as colors representing C64 color black, white, ... pixel #16 representing the background color) .function getMcBitmapData(pic) { .var palette = findMcPalette(pic) .var width = floor(pic.width/8) .var height = floor((pic.height-1)/8) // -1 to account for the first line containing the palette .var blocks = List() .for (var y=0; y<height; y++) .for (var x=0; x<width; x++) .eval blocks.add(createMcBlock(x, y, pic, palette)) .return McBitmapData(palette, width, height, blocks) } // Get the screen data for a specific bitmap block (1 char: 4x8 MC pixels). bmData is created by getMcBitmapData() .function getMcScreenData(x, y, bmData) { .return bmData.blocks.get(y*bmData.width + x).screendata } // Get the color data for a specific bitmap block (1 char: 4x8 MC pixels). bmData is created by getMcBitmapData() .function getMcColorData(x, y, bmData) { .return bmData.blocks.get(y*bmData.width + x).colordata } // Get pixel data for a specific bitmap block (1 char: 4x8 MC pixels). i is the pixel row (0-7). bmData is created by getMcBitmapData() .function getMcPixelData(x, y, i, bmData) { .return bmData.blocks.get(y*bmData.width + x).pixels.get(i) } // Find the C64 palette RGB values to use. // Looks at the first 16 pixels in the first line (0,0)..(0,15) of an image to find the palette. // Looks at pixel number 17 in the first line (0,16) to identify the background color to use. // Returns McBitmapPalette .function findMcPalette(pic) { .var rgb2c64 = Hashtable() .for (var i=0; i<16; i++) { .var rgb = pic.getPixel(i*2,0) .eval rgb2c64.put(rgb, i) } .var bgRgb = pic.getPixel(16*2,0) .var bgColor = rgb2c64.get(bgRgb) .return McBitmapPalette(rgb2c64, bgColor) } // Get the C64 color for a specific pixel (0-15) // Assumes multicolor with 2-pixel wide // Uses the passed palette to identify the C64 color .function getMcC64Color(xPos, yPos, pic, palette) { .var rgb = pic.getPixel(xPos*2, yPos+1) .var c64Color = palette.rgb2c64.get(rgb) .return c64Color } // Get the C64 colors to use for a bitmap block (1 char: 4x8 MC pixels). // Returns a list with 16 values (one per C64 color). // The values in the list is 0 for unused (or bgColor) and 1, 2, 3 for each used color. // cols.get(c64Color) will return %01, %10, %11 when passed the C64 color matching each multi-color. This is exactly the pixel value to use for the color. .function findMcBlockColors(chrX, chrY, pic, palette) { .var colorCounts = List() .for (var i=0; i<16; i++) .eval colorCounts.add(0) .for (var pixY=0; pixY<8; pixY++) { .for (var pixX=0; pixX<4; pixX++) { .var c64Color = getMcC64Color(chrX*4 + pixX, chrY*8 + pixY, pic, palette) .eval colorCounts.set(c64Color, colorCounts.get(c64Color) + 1) } } .eval colorCounts.set(palette.bgColor,0) .for (var i=0; i<16; i++) .eval colorCounts.set(i, [colorCounts.get(i) << 4] | i) .eval colorCounts.sort() .eval colorCounts.reverse() .var blockColors = List() .for (var i=0; i<16; i++) .eval blockColors.add(0) .for (var i=0; i<3; i++) { .var c64Color = colorCounts.get(i) & $0f .eval blockColors.set(c64Color, i+1) } .return blockColors } // Get the bitmap bytes for a a bitmap block (1 char: 4x8 MC pixels). // Returns BitmapBlock containing pixel data and color data for the bitmap block .function createMcBlock(chrX, chrY, pic, palette) { .var blockColors = findMcBlockColors(chrX, chrY, pic, palette) .var pixelData = List() .for (var pixY=0; pixY<8; pixY++) { .var bitmapByte = 0 .for (var pixX=0; pixX<4; pixX++) { .var c64Color = getMcC64Color(chrX*4 + pixX, chrY*8 + pixY, pic, palette) .var multiColor = blockColors.get(c64Color) .eval bitmapByte = bitmapByte | [multiColor << [6 - pixX*2]] } .eval pixelData.add(bitmapByte) } .var bitmapBlock = McBitmapBlock() .eval bitmapBlock.pixels = pixelData // Find the three C64 multi-colors .for (var i=1; i<16; i++) { .if (blockColors.get(i) == %01) .eval bitmapBlock.color1 = i .if (blockColors.get(i) == %10) .eval bitmapBlock.color2 = i .if (blockColors.get(i) == %11) .eval bitmapBlock.color3 = i } // Convert multi-colors to screen data and color data .eval bitmapBlock.screendata = (bitmapBlock.color1 << 4) | (bitmapBlock.color2 & $f) .eval bitmapBlock.colordata = bitmapBlock.color3 .return bitmapBlock }
src/main/antlr4/imports/Words.g4
Yucukof/edu-antlr4-toy-parser-to-nbc
0
1119
lexer grammar Words; import Actions , Directions , Items , KeyWords , Variables ;
src/dds-request_reply-requester2.adb
alexcamposruiz/dds-requestreply
0
20496
package body DDS.Request_Reply.requester is -- DDS_ReturnCode_t RTI_Connext_Requester_delete(RTI_Connext_Requester * self) -- { -- DDS_ReturnCode_t retCode = DDS_RETCODE_OK; -- -- if(self == NULL) { -- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s, -- "self"); -- return DDS_RETCODE_BAD_PARAMETER; -- } -- -- if(self->_impl != NULL) { -- retCode = RTI_Connext_EntityUntypedImpl_delete(self->_impl); -- } -- -- if(retCode != DDS_RETCODE_OK) { -- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s, -- "delete RequesterUntypedImpl"); -- } -- -- RTIOsapiHeap_free(self); -- return retCode; -- } -- -- DDS_ReturnCode_t RTI_Connext_Requester_wait_for_replies_for_related_request( -- RTI_Connext_Requester* self, -- DDS_Long min_reply_count, -- const struct DDS_Duration_t* max_wait, -- const struct DDS_SampleIdentity_t* related_request_info) -- { -- DDS_ReturnCode_t retCode = DDS_RETCODE_OK; -- -- -- if (related_request_info != NULL) { -- retCode = RTI_Connext_RequesterUntypedImpl_wait_for_replies( -- self->_impl, max_wait, min_reply_count, related_request_info); -- } else { -- retCode = RTI_Connext_EntityUntypedImpl_wait_for_any_sample( -- self->_impl, max_wait, min_reply_count); -- } -- -- if(retCode != DDS_RETCODE_OK && retCode != DDS_RETCODE_TIMEOUT) { -- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s, -- "wait for samples"); -- } -- return retCode; -- } -- -- DDS_ReturnCode_t RTI_Connext_Requester_wait_for_replies( -- RTI_Connext_Requester* self, -- DDS_Long min_reply_count, -- const struct DDS_Duration_t* max_wait) -- { -- return RTI_Connext_Requester_wait_for_replies_for_related_request( -- self, min_reply_count, max_wait, NULL); -- } -- -- /* ----------------------------------------------------------------- */ -- /* End of $Id$ */ end DDS.Request_Reply.requester;
iod/con2/ptr/sadd.asm
olifink/smsqe
0
17513
<filename>iod/con2/ptr/sadd.asm ; Set up pointer area addresses V2.04  1991 <NAME> ; 2005 <NAME> ; ; 2003-02-24 2.01 Now also returns sprite width in MSW of d5 (MK) ; 2003-04-30 2.02 Returns -1 in MSW of d5 instead of width if no alpha channel ; 2005-01-25 2.03 Changes for mouse pointer clipping (MK) ; 2005-11-08 2.04 Flags a0 with 0 for pt_sadd and pt_saddp (MK) ; section driver ; xdef pt_sadd xdef pt_saddp xdef pt_swind ; xref sp_ptr xref.s pt.spxsw ; shift pixel to sprite word xref.s pt.rpxsw ; round up pixel to sprite word (2^spxsw-1) ; include dev8_keys_con include dev8_keys_err include dev8_keys_sys include dev8_keys_qdos_pt ; ; set pointers within window for blob or sprite object ; ; d0 r column offset pointer sprite to object ; d1 r row offset pointer sprite to object ; d2 r column ; d4 p ; d3 r row ; d5 r sprite width or -1 / sprite word counter ; d6 r row counter ; d7 r right shift (low word) / 16-shift (high word) ; ; a0 p pointer to channel definition block ; a1 p ; a2 r address of pointer sprite on screen ; a3 cr linkage block address / new address of object ; a5 c u pointer to object definition / pointer to object pointer ; a6 r address increment of screen ; pt_swind moveq #-1,d5 default to "no alpha channel" btst #pto..alph,pto_ctrl(a5) is there an alpha channel? beq.s psw_noalpha move.w pto_xsiz(a5),d5 save width for alpha drawing swap d5 psw_noalpha addq.w #pto_xsiz,a5 ignore form etc move.w (a5)+,d2 set width moveq #pt.spxsw,d0 move.w #pt.rpxsw,d5 round up add.w d2,d5 ... number of sprite words lsr.w d0,d5 move.w (a5)+,d3 and height move.w d3,d6 ... number of rows-1 subq.w #1,d6 ; move.l d1,d0 set position swap d0 sub.w (a5)+,d0 offset by origin blt.s err_or sub.w (a5)+,d1 blt.s err_or ; add.w d0,d2 check rhs cmp.w sd_xsize(a0),d2 bgt.s err_or ; add.w d1,d3 check bottom cmp.w sd_ysize(a0),d3 bgt.s err_or ; add.w sd_xmin(a0),d0 and offset to window origin add.w sd_ymin(a0),d1 ; bsr.s set_ptr set the sprite pointers cmp.b d0,d0 return OK rts err_or moveq #err.orng,d0 rts page ; ; set pointers for pointer sprite ; ; d0 r column offset pointer sprite to object ; d1 r row offset pointer sprite to object ; d2 r column ; d3 r row ; d4 s ; d5 r sprite width or -1 / sprite word counter (-1) ; d6 r row counter ; d7 s ; ; a0 0 ; a1 r pointer to linkage block ; a2 r address of pointer sprite on screen ; a3 cr linkage block address / new address of object ; a4 r pointer to sprite pattern ; a5 cr pointer to sprite (pt_saddp), pointer to sprite mask ; a6 r address increment of screen ; pt_sadd move.l pt_psprt(a3),a5 ... definition pt_saddp suba.l a0,a0 signal "no CDB, put onto screen" move.l a3,a1 put it into a save place ; moveq #-1,d5 default to "no alpha channel" btst #pto..alph,pto_ctrl(a5) is there an alpha channel? beq.s psa_noalpha move.w pto_xsiz(a5),d5 save width for alpha drawing swap d5 psa_noalpha addq.w #pto_xsiz,a5 ignore form etc moveq #pt.spxsw,d0 move.w #pt.rpxsw,d5 round up add.w (a5)+,d5 ... number of long words lsr.w d0,d5 move.w (a5)+,d6 and height subq.w #1,d6 ; ; Simply limit sprite height if cursor is at lower edge of screen move.w pt_yscrs(a3),d0 y screen size sub.w pt_ypos(a3),d0 space between pos and y limit add.w 2(a5),d0 also take origin into account subq.w #1,d0 cmp.w d0,d6 blt.s psa_limitok move.w d0,d6 limit height of sprite psa_limitok ; movem.w pt_pos(a3),d0/d1 set position sub.w (a5)+,d0 offset position by origin sub.w (a5)+,d1 ; move.l a5,a4 set pointer to colour pattern add.l (a5)+,a4 move.l a5,d7 move.l (a5),a5 move.l a5,d4 beq.s psa_nomask add.l d7,a5 and sprite mask psa_nomask ; ; If sprite is above upper edge of screen, limit height and adjust data ptrs tst.w d1 sprite off top of screen? bpl.s set_ptr ... no neg.w d1 move.w d1,d7 lines to cut off sprite mulu d5,d1 long words to cut off lsl.l #2,d1 same in bytes add.l d1,a4 add to colour pattern swap d5 sprite width (-1 if no alpha) tst.w d5 alpha channel? bmi.s psa_noalpha2 ... no move.w d7,d1 width * y offset mulu d5,d1 bytes to skip in alpha channel psa_noalpha2 swap d5 add.l d1,a5 add to mask sub.w d7,d6 adjust height moveq #0,d1 at top of screen ; set_ptr cmp.b #ptm.ql8,pt_dmode(a3) is it 256 mode? bne.s set_ptr1 ... no bclr #0,d0 ... yes, alternate pixels only set_ptr1 move.l pt_addr(a3),a2 set address of pointer on screen bra.l sp_ptr end
2017/day02_x86/part2.nasm
nikklassen/advent-of-code
3
245151
<reponame>nikklassen/advent-of-code<filename>2017/day02_x86/part2.nasm global _start, buffer, buffer_len extern parse_int, print_char, print_int, print_str, read %define nums_len 16 section .data checksum_msg db 'Checksum: ', 0 buffer times 4000 db 0 buffer_len equ $ - buffer nums times 16 dd 0 section .text %macro PRINTC 1 mov rax, %1 call print_char %endmacro %macro PRINTI 1 mov rax, %1 push rax call print_int add rsp, 8 %endmacro %macro PRINTS 1 mov rax, %1 push rax call print_str add rsp, 8 %endmacro _start: call read mov rbx, rax %define checksum r8 mov checksum, DWORD 0 .read_line: mov rsi, nums cmp [rbx], BYTE 0 je .end push rbx push rsi call parse_line add rsp, 16 mov rbx, rax push rbx ; save the string pointer so we can use rbx in the loop .finished_line: mov rsi, nums mov rdi, nums_len dec rdi .scan_nums: test rdi, rdi ; for rdi = nums_len - 1; rdi >= 0; rdi-- jl .next_line mov rcx, rdi ; for rcx = rdi - 1; rcx >= 0; rcx-- dec rcx .find_divisible: test rcx, rcx jl .scan_nums_end mov rax, rdi imul rax, 4 add rax, rsi movzx eax, WORD [rax] mov rbx, rcx imul rbx, 4 add rbx, rsi movzx ebx, WORD [rbx] cdq div rbx test rdx, rdx jne .flip_args add checksum, rax jmp .done_find_divisible .flip_args: mov rax, rcx imul rax, 4 add rax, rsi movzx eax, WORD [rax] mov rbx, rdi imul rbx, 4 add rbx, rsi movzx ebx, WORD [rbx] cdq div rbx test rdx, rdx jne .done_find_divisible add checksum, rax .done_find_divisible: dec rcx jmp .find_divisible .scan_nums_end: dec rdi jmp .scan_nums .next_line: pop rbx inc rbx ; skip the newline jmp .read_line .end: PRINTS checksum_msg PRINTI checksum PRINTC 0xa mov rax, 60 ; exit mov rdi, 0 syscall parse_line: enter 64, 0 push rbx push rsi ; args ; - s: string to parse ; - a: output array ; output ; - rax: the start of the unparsed string mov rbx, [rbp+24] mov rsi, [rbp+16] .parse: push rbx call parse_int add rsp, 8 mov [rsi], eax add rsi, 4 mov rbx, rdx ; update position in the string .next_token: ; parse the next number cmp [rbx], BYTE 0xa je .finished_line cmp [rbx], BYTE 0x20 jne .parse inc rbx jmp .next_token .finished_line: ; set return value mov rax, rbx pop rsi pop rbx leave ret