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
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1312.asm
ljhsiun2/medusa
9
165367
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xd07e, %rcx nop add %rdi, %rdi movb (%rcx), %r8b nop nop dec %r12 lea addresses_UC_ht+0x15e7e, %rax cmp $32923, %r9 mov $0x6162636465666768, %rbx movq %rbx, %xmm5 movups %xmm5, (%rax) nop nop nop nop nop add $63495, %rbx lea addresses_WC_ht+0x1ae7e, %rsi lea addresses_WT_ht+0x1653e, %rdi nop nop nop nop dec %rax mov $48, %rcx rep movsq nop dec %r9 lea addresses_WT_ht+0x5bc0, %r9 nop add %rcx, %rcx mov $0x6162636465666768, %r12 movq %r12, %xmm6 vmovups %ymm6, (%r9) nop nop nop nop xor %r12, %r12 lea addresses_WC_ht+0x5421, %rsi lea addresses_WC_ht+0x927e, %rdi nop nop nop and %r9, %r9 mov $22, %rcx rep movsw xor $6379, %r12 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %r9 push %rdi push %rdx push %rsi // Faulty Load lea addresses_RW+0x1b87e, %r8 nop nop dec %rsi movb (%r8), %r9b lea oracles, %rsi and $0xff, %r9 shlq $12, %r9 mov (%rsi,%r9,1), %r9 pop %rsi pop %rdx pop %rdi pop %r9 pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_RW', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'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 */
Practical Exam/P17.a51
pronoym99/Microcontrollers-and-Applications
1
164126
org 0000h mov p1,#00h mov p2,#00h check:jnb p2.0,decrement clr p2.1 inc p1 acall delay sjmp check decrement:jnb p2.1,check clr p2.0 dec p1 acall delay sjmp check delay:mov r1,#0ffh h1:mov r2,#0ffh h2:mov r3,#0ffh h3:djnz r3,h3 djnz r2,h2 djnz r1,h1 ret end
Library/SpecUI/NewUI/Win/winClassSpec.asm
steakknife/pcgeos
504
28765
COMMENT @----------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: NewUI/Win (specific code for NewUI) FILE: winClassSpec.asm ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Split off from cwinClass.asm Eric 1/90 Contents of file moved to cwinClassCUAS.asm so can be shared by all CUA_STYLE UIs. DESCRIPTION: This file contains OLWinClass-related code which is specific to NewUI. See cwinClass.asm for class declaration and method table. $Id: winClassSpec.asm,v 1.1 98/03/09 18:42:25 joon Exp $ -------------------------------------------------------------------------------@ Build segment resource Build ends ;------------------------------ CommonFunctional segment resource CommonFunctional ends
u7bg/eop-castByKey.asm
JohnGlassmyer/UltimaHacks
68
21100
%include "include/u7bg-all-includes.asm" %assign ADD_RUNE_SOUND 15 %assign REMOVE_RUNE_SOUND 92 %assign NUMBER_OF_SPELLS 72 %macro gameSpecificSpellRunes 0 ; Linear db 'az', 0 db 'rh', 0 db 'af', 0 db 'bo', 0 db 'bl', 0 db 'kl', 0 db 'if', 0 db 'vk', 0 ; First Circle db 'imy', 0 db 'an', 0 db 'wj', 0 db 'vaf', 0 db 'vif', 0 db 'il', 0 db 'iw', 0 db 'vaz', 0 ; Second Circle db 'aj', 0 db 'oy', 0 db 'vf', 0 db 'vl', 0 db 'van', 0 db 'us', 0 db 'opy', 0 db 'pow', 0 ; Third Circle db 'ds', 0 db 'm', 0 db 'kbx', 0 db 'vus', 0 db 'ap', 0 db 'vw', 0 db 'in', 0 db 'iz', 0 ; Fourth Circle db 'kx', 0 db 'og', 0 db 'kpy', 0 db 'vds', 0 db 'kop', 0 db 'wq', 0 db 'kwc', 0 db 'ep', 0 ; Fifth Circle db 'axe', 0 db 'px', 0 db 'ag', 0 db 'vfh', 0 db 'vm', 0 db 'sl', 0 db 'ifg', 0 db 'vz', 0 ; Sixth Circle db 'qw', 0 db 'iqx', 0 db 'kfg', 0 db 'vifg', 0 db 'voh', 0 db 'ing', 0 db 'izg', 0 db 'vpy', 0 ; Seventh Circle db 'ry', 0 db 'cp', 0 db 'tvf', 0 db 'isg', 0 db 'ihgy', 0 db 'vaxe', 0 db 'ivp', 0 db 'vkm', 0 ; Eighth Circle db 'vkamicht', 0 db 'vch', 0 db 'vc', 0 db 'vsl', 0 db 'imc', 0 db 'kvx', 0 db 'ijpy', 0 db 'at', 0 %endmacro %include "../u7-common/patch-eop-castByKey.asm"
oeis/070/A070967.asm
neoneye/loda-programs
11
89098
; A070967: a(n) = Sum_{k=0..n} binomial(6*n,6*k). ; 1,2,926,37130,2973350,174174002,11582386286,729520967450,47006639297270,2999857885752002,192222214478506046,12295976362284182570,787111112023373201990,50370558298891875954002,3223838658635388303336206,206322355109994528871954490,13204720341191748556427279510,845099682254165242478546700002,54086444992983455477212566892766,3461530715675585391659793672635210,221538013427872070556035681478201830,14178431573518678167361443681007110002,907419655423554030113203073791595831726 mov $2,6 mul $2,$0 seq $2,306847 ; a(n) = Sum_{k=0..floor(n/6)} binomial(n,6*k). mov $0,$2
applet/aide/source/editors/aide-editor.adb
charlie5/aIDE
3
14783
with aIDE.Editor.of_comment, aIDE.Editor.of_exception, aIDE.Editor.of_pragma, aIDE.Editor.of_subtype, aIDE.Editor.of_derived_type, aIDE.Editor.of_enumeration_type, aIDE.Editor.of_signed_integer_type, aIDE.Editor.of_fixed_type, aIDE.Editor.of_decimal_type, aIDE.Editor.of_float_type, aIDE.Editor.of_array_type, aIDE.Editor.of_record_type, aIDE.Editor.of_private_type, aIDE.Editor.of_access_type, aIDE.Editor.of_subtype_indication, aIDE.Editor.of_object, aIDE.Editor.of_raw_source, AdaM.raw_Source, AdaM.Comment, AdaM.a_Pragma, AdaM.Declaration.of_exception, AdaM.Declaration.of_object, AdaM.a_Type.private_type, AdaM.a_Type.a_subtype, AdaM.a_Type.derived_type, AdaM.a_Type.enumeration_type, AdaM.a_Type.signed_integer_type, AdaM.a_Type.ordinary_fixed_point_type, AdaM.a_Type.decimal_fixed_point_type, AdaM.a_Type.floating_point_type, AdaM.a_Type.array_type, AdaM.a_Type.record_type, AdaM.a_Type.access_type, AdaM.subtype_Indication, Ada.Tags; with Ada.Text_IO; use Ada.Text_IO; package body aIDE.Editor is function to_Editor (Target : in AdaM.Entity.view) return Editor.view is use type AdaM.Entity.view; use AdaM.Comment; Self : Editor.view; begin if Target = null then raise Program_Error with "null Target"; end if; if Target.all in AdaM.raw_Source.item'Class then declare new_Editor : constant Editor.of_raw_source.view := Editor.of_raw_source.Forge.to_comment_Editor (AdaM.raw_Source.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Comment.item'Class then declare new_Editor : constant Editor.of_comment.view := Editor.of_comment.Forge.to_comment_Editor (AdaM.Comment.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Pragma.item'Class then declare new_Editor : constant Editor.of_pragma.view := Editor.of_pragma.Forge.new_Editor (AdaM.a_Pragma.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Declaration.of_exception.item'Class then declare new_Editor : constant Editor.of_exception.view := Editor.of_exception.Forge.new_Editor (AdaM.Declaration.of_exception.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Declaration.of_object.item'Class then declare new_Editor : constant Editor.of_object.view := Editor.of_object.Forge.new_Editor (AdaM.Declaration.of_object.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.private_type.item'Class then declare new_Editor : constant Editor.of_private_type.view := Editor.of_private_type.Forge.to_Editor (AdaM.a_Type.private_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.a_subtype.item'Class then declare new_Editor : constant Editor.of_subtype.view := Editor.of_subtype.Forge.to_Editor (AdaM.a_Type.a_subtype.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.derived_type.item'Class then declare new_Editor : constant Editor.of_derived_type.view := Editor.of_derived_type.Forge.to_Editor (AdaM.a_Type.derived_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.enumeration_type.item'Class then declare new_Editor : constant Editor.of_enumeration_type.view := Editor.of_enumeration_type.Forge.to_Editor (AdaM.a_Type.enumeration_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.signed_integer_type.item'Class then declare new_Editor : constant Editor.of_signed_integer_type.view := Editor.of_signed_integer_type.Forge.to_Editor (AdaM.a_Type.signed_integer_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.ordinary_fixed_point_type.item'Class then declare new_Editor : constant Editor.of_fixed_type.view := Editor.of_fixed_type.Forge.to_Editor (AdaM.a_Type.ordinary_fixed_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.decimal_fixed_point_type.item'Class then declare new_Editor : constant Editor.of_decimal_type.view := Editor.of_decimal_type.Forge.to_Editor (AdaM.a_Type.decimal_fixed_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.floating_point_type.item'Class then declare new_Editor : constant Editor.of_float_type.view := Editor.of_float_type.Forge.to_Editor (AdaM.a_Type.floating_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.array_type.item'Class then declare new_Editor : constant Editor.of_array_type.view := Editor.of_array_type.Forge.to_Editor (AdaM.a_Type.array_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.record_type.item'Class then declare new_Editor : constant Editor.of_record_type.view := Editor.of_record_type.Forge.to_Editor (AdaM.a_Type.record_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.access_type.item'Class then declare new_Editor : constant Editor.of_access_type.view := Editor.of_access_type.Forge.to_Editor (AdaM.a_Type.access_type.view (Target)); begin Self := Editor.view (new_Editor); end; -- elsif Target.all in AdaM.subtype_Indication.item'Class -- then -- declare -- new_Editor : constant Editor.of_subtype_indication.view -- := Editor.of_subtype_indication.Forge.to_Editor (AdaM.subtype_Indication.view (Target)); -- begin -- Self := Editor.view (new_Editor); -- end; else put_Line ("Warning: no editor is known for entity of type " & ada.Tags.Expanded_Name (Target.all'Tag)); return null; -- raise Program_Error with "no editor is known for entity of type " & ada.Tags.Expanded_Name (Target.all'Tag); end if; Self.top_Widget.show; return Self; end to_Editor; function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget is begin raise Program_Error with "top_Widget must be overridden in subclass of aIDE.Editor"; return null; end top_Widget; end aIDE.Editor;
Learn/5.3.x/ThirdPerson/Assets/Animations/Mannequin/ADB/FirstPerson.adb
longlongwaytogo/CryEngineV_Proj
0
29559
<reponame>longlongwaytogo/CryEngineV_Proj <AnimDB FragDef="Animations/Mannequin/ADB/PlayerFragmentIds.xml" TagDef="Animations/Mannequin/ADB/PlayerTags.xml"> <FragmentList> <Idle> <Fragment BlendOutDuration="0.2" Tags="Rotate"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="1DONE-BSpace_RotateRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Walk"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="2DONE-BSpace_MoveStrafeRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Walk+Rotate"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="2DONE-BSpace_MoveStrafeRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="rifleAim_idle_3p" flags="Loop"/> </AnimLayer> </Fragment> </Idle> </FragmentList> </AnimDB>
Numbers/BinaryNaturals/SubtractionGo.agda
Smaug123/agdaproofs
4
5728
<filename>Numbers/BinaryNaturals/SubtractionGo.agda {-# OPTIONS --warning=error --safe --without-K #-} open import LogicalFormulae open import Lists.Lists open import Numbers.BinaryNaturals.Definition open import Maybe module Numbers.BinaryNaturals.SubtractionGo where go : Bit → BinNat → BinNat → Maybe BinNat go zero [] [] = yes [] go one [] [] = no go zero [] (zero :: b) = go zero [] b go zero [] (one :: b) = no go one [] (x :: b) = no go zero (zero :: a) [] = yes (zero :: a) go one (zero :: a) [] = mapMaybe (one ::_) (go one a []) go zero (zero :: a) (zero :: b) = mapMaybe (zero ::_) (go zero a b) go one (zero :: a) (zero :: b) = mapMaybe (one ::_) (go one a b) go zero (zero :: a) (one :: b) = mapMaybe (one ::_) (go one a b) go one (zero :: a) (one :: b) = mapMaybe (zero ::_) (go one a b) go zero (one :: a) [] = yes (one :: a) go zero (one :: a) (zero :: b) = mapMaybe (one ::_) (go zero a b) go zero (one :: a) (one :: b) = mapMaybe (zero ::_) (go zero a b) go one (one :: a) [] = yes (zero :: a) go one (one :: a) (zero :: b) = mapMaybe (zero ::_) (go zero a b) go one (one :: a) (one :: b) = mapMaybe (one ::_) (go one a b) _-B_ : BinNat → BinNat → Maybe BinNat a -B b = go zero a b goEmpty : (a : BinNat) → go zero a [] ≡ yes a goEmpty [] = refl goEmpty (zero :: a) = refl goEmpty (one :: a) = refl goOneSelf : (a : BinNat) → go one a a ≡ no goOneSelf [] = refl goOneSelf (zero :: a) rewrite goOneSelf a = refl goOneSelf (one :: a) rewrite goOneSelf a = refl goOneEmpty : (b : BinNat) {t : BinNat} → go one [] b ≡ yes t → False goOneEmpty [] {t} () goOneEmpty (x :: b) {t} () goOneEmpty' : (b : BinNat) → go one [] b ≡ no goOneEmpty' b with inspect (go one [] b) goOneEmpty' b | no with≡ x = x goOneEmpty' b | yes x₁ with≡ x = exFalso (goOneEmpty b x) goZeroEmpty : (b : BinNat) {t : BinNat} → go zero [] b ≡ yes t → canonical b ≡ [] goZeroEmpty [] {t} = λ _ → refl goZeroEmpty (zero :: b) {t} pr with inspect (canonical b) goZeroEmpty (zero :: b) {t} pr | [] with≡ pr2 rewrite pr2 = refl goZeroEmpty (zero :: b) {t} pr | (x :: r) with≡ pr2 with goZeroEmpty b pr ... | u = exFalso (nonEmptyNotEmpty (transitivity (equalityCommutative pr2) u)) goZeroEmpty' : (b : BinNat) {t : BinNat} → go zero [] b ≡ yes t → canonical t ≡ [] goZeroEmpty' [] {[]} pr = refl goZeroEmpty' (x :: b) {[]} pr = refl goZeroEmpty' (zero :: b) {x₁ :: t} pr = goZeroEmpty' b pr goZeroIncr : (b : BinNat) → go zero [] (incr b) ≡ no goZeroIncr [] = refl goZeroIncr (zero :: b) = refl goZeroIncr (one :: b) = goZeroIncr b goPreservesCanonicalRightEmpty : (b : BinNat) → go zero [] (canonical b) ≡ go zero [] b goPreservesCanonicalRightEmpty [] = refl goPreservesCanonicalRightEmpty (zero :: b) with inspect (canonical b) goPreservesCanonicalRightEmpty (zero :: b) | [] with≡ x with goPreservesCanonicalRightEmpty b ... | pr2 rewrite x = pr2 goPreservesCanonicalRightEmpty (zero :: b) | (x₁ :: y) with≡ x with goPreservesCanonicalRightEmpty b ... | pr2 rewrite x = pr2 goPreservesCanonicalRightEmpty (one :: b) = refl goZero : (b : BinNat) {t : BinNat} → mapMaybe canonical (go zero [] b) ≡ yes t → t ≡ [] goZero b {[]} pr = refl goZero b {x :: t} pr with inspect (go zero [] b) goZero b {x :: t} pr | no with≡ pr2 rewrite pr2 = exFalso (noNotYes pr) goZero b {x :: t} pr | yes x₁ with≡ pr2 with goZeroEmpty b pr2 ... | u with applyEquality (mapMaybe canonical) (goPreservesCanonicalRightEmpty b) ... | bl rewrite u | pr = exFalso (nonEmptyNotEmpty (equalityCommutative (yesInjective bl)))
tools/scitools/conf/understand/ada/ada95/a-string.ads
brucegua/moocos
1
9968
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- A D A . S T R I N G S -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ package Ada.Strings is pragma Pure (Strings); Space : constant Character := ' '; Wide_Space : constant Wide_Character := ' '; Length_Error, Pattern_Error, Index_Error, Translation_Error : exception; type Alignment is (Left, Right, Center); type Truncation is (Left, Right, Error); type Membership is (Inside, Outside); type Direction is (Forward, Backward); type Trim_End is (Left, Right, Both); end Ada.Strings;
bb-runtimes/src/a-intnam__ppc-openpic.ads
JCGobbi/Nucleo-STM32G474RE
0
24245
<filename>bb-runtimes/src/a-intnam__ppc-openpic.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- A D A . I N T E R R U P T S . N A M E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the version for P2020 targets of this package pragma Restrictions (no_elaboration_code); with System; package Ada.Interrupts.Names is -- All identifiers in this unit are implementation defined pragma Implementation_Defined; -- Note: do not forget to update procedures Priority_Of_Interrupt and -- Initialize_Board of package System.BB.Board_Support (s-bbbosu) when -- you modify this package (in particular when you add an interrupt). -- The interrupt ID number is internal to the run-time. Use the range -- corresponding to your type of interrupt (Interprocessor, External, -- Iternal, etc.). For example, Internal interrupt 7 can be defined as: -- Internal_Interrupt_7 : constant Internal_Interrupt_ID := -- Internal_Interrupt_ID'First + 7; -- Do not use 0 Interrupt_ID, it is reserved by the runtime for the -- spurious interrupt. -- You can use any priority as long as it belongs to the range defined by -- Interrupt_Priority'First .. Interrupt_Priority'Last - 1. -- It is not recommended to use Interrupt_Priority'First as such priority -- are always disabled by the OpenPIC. -- Interrupt_Priority'Last is reserved for non-OpenPIC interrupts such -- as the decrementer. subtype IPI_Interrupt_ID is Interrupt_ID range 1 .. 4; subtype External_Interrupt_ID is Interrupt_ID range 5 .. 16; subtype Internal_Interrupt_ID is Interrupt_ID range 17 .. 80; subtype Messaging_Interrupt_ID is Interrupt_ID range 81 .. 88; subtype Shared_Message_Interrupt_ID is Interrupt_ID range 89 .. 96; Interprocessor_Interrupt_0 : constant Interrupt_ID := 1; Interprocessor_Interrupt_0_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First + 1; Interprocessor_Interrupt_1 : constant Interrupt_ID := 2; Interprocessor_Interrupt_1_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First + 4; Interprocessor_Interrupt_2 : constant Interrupt_ID := 3; Interprocessor_Interrupt_2_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First + 8; Interprocessor_Interrupt_3 : constant Interrupt_ID := 4; Interprocessor_Interrupt_3_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First + 12; end Ada.Interrupts.Names;
src/main.asm
tewtal/lttphack
0
174953
lorom !FEATURE_HUD ?= 1 !FEATURE_SD2SNES ?= 1 !VERSION ?= "ALEPH 1" incsrc defines.asm incsrc hexedits.asm org $A08000 incsrc gamemode.asm incsrc nmi.asm incsrc timers.asm incsrc hudextras.asm if !FEATURE_HUD incsrc hud.asm endif org $A28000 incsrc tiles.asm org $A38000 incsrc init.asm incsrc rng.asm incsrc misc.asm incsrc idle.asm incsrc glitchedwindow.asm org $A48000 incsrc custom_menu.asm print "Custom menu size: ", pc org $A58000 incsrc presets.asm org $A68000 incsrc poverty_states.asm org $A78000 incsrc music.asm org $A88000 incsrc movie.asm ; ---- data ---- org $B08000 incsrc preset_data_nmg.asm org $B18000 incsrc preset_data_hundo.asm org $B28000 incsrc preset_data_low.asm org $B38000 incsrc preset_data_ad.asm org !SPC_DATA_OVERWORLD incbin ../resources/spc_overworld.bin org !SPC_DATA_UNDERWORLD incbin ../resources/spc_underworld.bin org !SPC_DATA_CREDITS incbin ../resources/spc_credits.bin ;======================================================================== ; LEAVE THIS HERE ; it's needed for calculating when certain data comes from a possibly ; non-vanilla source, which requires knowing the last bank we write to ;======================================================================== EndOfPracticeROM: ; pad rom to 2mb org $3FFFFF db $FF
messages_out.asm
Namerlight/OS-Kernel-Skeleton
0
86472
print: pusha print_next: mov al, [bx] cmp al, 0 je end_print mov ah, 0x0e int 0x10 add bx, 1 jmp print_next end_print: popa ret print_newline: pusha mov ah, 0x0e mov al, 0x0a int 0x10 mov al, 0x0d int 0x10 popa ret
tajo-core/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
gyias/tajo
0
43
/* 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. */ lexer grammar SQLLexer; @header { } @members { } /* =============================================================================== Tokens for Case Insensitive Keywords =============================================================================== */ fragment A : 'A' | 'a'; fragment B : 'B' | 'b'; fragment C : 'C' | 'c'; fragment D : 'D' | 'd'; fragment E : 'E' | 'e'; fragment F : 'F' | 'f'; fragment G : 'G' | 'g'; fragment H : 'H' | 'h'; fragment I : 'I' | 'i'; fragment J : 'J' | 'j'; fragment K : 'K' | 'k'; fragment L : 'L' | 'l'; fragment M : 'M' | 'm'; fragment N : 'N' | 'n'; fragment O : 'O' | 'o'; fragment P : 'P' | 'p'; fragment Q : 'Q' | 'q'; fragment R : 'R' | 'r'; fragment S : 'S' | 's'; fragment T : 'T' | 't'; fragment U : 'U' | 'u'; fragment V : 'V' | 'v'; fragment W : 'W' | 'w'; fragment X : 'X' | 'x'; fragment Y : 'Y' | 'y'; fragment Z : 'Z' | 'z'; /* =============================================================================== Reserved Keywords =============================================================================== */ AS : A S; ALL : A L L; AND : A N D; ANY : A N Y; ASYMMETRIC : A S Y M M E T R I C; ASC : A S C; BOTH : B O T H; CASE : C A S E; CAST : C A S T; CREATE : C R E A T E; CROSS : C R O S S; CURRENT_DATE: C U R R E N T UNDERLINE D A T E; CURRENT_TIME: C U R R E N T UNDERLINE T I M E; CURRENT_TIMESTAMP: C U R R E N T UNDERLINE T I M E S T A M P; DESC : D E S C; DISTINCT : D I S T I N C T; END : E N D; ELSE : E L S E; EXCEPT : E X C E P T; FALSE : F A L S E; FULL : F U L L; FROM : F R O M; GROUP : G R O U P; HAVING : H A V I N G; ILIKE : I L I K E; IN : I N; INNER : I N N E R; INTERSECT : I N T E R S E C T; INTO : I N T O; IS : I S; JOIN : J O I N; LEADING : L E A D I N G; LEFT : L E F T; LIKE : L I K E; LIMIT : L I M I T; NATURAL : N A T U R A L; NOT : N O T; NULL : N U L L; ON : O N; OR : O R; ORDER : O R D E R; OUTER : O U T E R; OVER : O V E R; RIGHT : R I G H T; SELECT : S E L E C T; SOME : S O M E; SYMMETRIC : S Y M M E T R I C; TABLE : T A B L E; THEN : T H E N; TRAILING : T R A I L I N G; TRUE : T R U E; UNION : U N I O N; UNIQUE : U N I Q U E; USING : U S I N G; WHEN : W H E N; WHERE : W H E R E; WITH : W I T H; WINDOW : W I N D O W; /* =============================================================================== Non Reserved Keywords =============================================================================== */ AVG : A V G; ADD: A D D; ALTER : A L T E R; BETWEEN : B E T W E E N; BY : B Y; CATALOG : C A T A L O G; CENTURY : C E N T U R Y; CHARACTER : C H A R A C T E R; COLLECT : C O L L E C T; COALESCE : C O A L E S C E; COLUMN : C O L U M N; COUNT : C O U N T; CUBE : C U B E; CUME_DIST : C U M E UNDERLINE D I S T; CURRENT : C U R R E N T; DAY : D A Y; DEFAULT : D E F A U L T; DATABASE : D A T A B A S E; DEC : D E C; DECADE : D E C A D E; DENSE_RANK : D E N S E UNDERLINE R A N K; DOW : D O W; DOY : D O Y; DROP : D R O P; EPOCH : E P O C H; EVERY : E V E R Y; EXCLUDE : E X C L U D E; EXISTS : E X I S T S; EXPLAIN : E X P L A I N; EXTERNAL : E X T E R N A L; EXTRACT : E X T R A C T; FILTER : F I L T E R; FIRST : F I R S T; FIRST_VALUE : F I R S T UNDERLINE V A L U E; FOLLOWING : F O L L O W I N G; FORMAT : F O R M A T; FUSION : F U S I O N; GROUPING : G R O U P I N G; HASH : H A S H; HOUR : H O U R; IF : I F; INDEX : I N D E X; INSERT : I N S E R T; INTERSECTION : I N T E R S E C T I O N; ISODOW : I S O D O W; ISOYEAR : I S O Y E A R; LAST : L A S T; LAST_VALUE : L A S T UNDERLINE V A L U E; LESS : L E S S; LIST : L I S T; LOCATION : L O C A T I O N; MAX : M A X; MAXVALUE : M A X V A L U E; MICROSECONDS : M I C R O S E C O N D S; MILLENNIUM : M I L L E N N I U M; MILLISECONDS : M I L L I S E C O N D S; MIN : M I N; MINUTE : M I N U T E; MONTH : M O N T H; NATIONAL : N A T I O N A L; NULLIF : N U L L I F; NO : N O; OVERWRITE : O V E R W R I T E; OTHERS: O T H E R S; PARTITION : P A R T I T I O N; PARTITIONS : P A R T I T I O N S; PERCENT_RANK : P E R C E N T UNDERLINE R A N K; PRECEDING : P R E C E D I N G; PRECISION : P R E C I S I O N; PURGE : P U R G E; QUARTER : Q U A R T E R; RANGE : R A N G E; RANK : R A N K; REGEXP : R E G E X P; RENAME : R E N A M E; RESET : R E S E T; RLIKE : R L I K E; ROLLUP : R O L L U P; ROW : R O W; ROWS : R O W S; ROW_NUMBER : R O W UNDERLINE N U M B E R; SECOND : S E C O N D; SESSION : S E S S I O N; SET : S E T; SIMILAR : S I M I L A R; STDDEV_POP : S T D D E V UNDERLINE P O P; STDDEV_SAMP : S T D D E V UNDERLINE S A M P; SUBPARTITION : S U B P A R T I T I O N; SUM : S U M; TABLESPACE : T A B L E S P A C E; THAN : T H A N; TIES : T I E S; TIMEZONE: T I M E Z O N E; TIMEZONE_HOUR: T I M E Z O N E UNDERLINE H O U R; TIMEZONE_MINUTE: T I M E Z O N E UNDERLINE M I N U T E; TRIM : T R I M; TO : T O; TRUNCATE : T R U N C A T E; UNBOUNDED : U N B O U N D E D; UNKNOWN : U N K N O W N; VALUES : V A L U E S; VAR_SAMP : V A R UNDERLINE S A M P; VAR_POP : V A R UNDERLINE P O P; VARYING : V A R Y I N G; WEEK : W E E K; YEAR : Y E A R; ZONE : Z O N E; /* =============================================================================== Data Type Tokens =============================================================================== */ BOOLEAN : B O O L E A N; BOOL : B O O L; BIT : B I T; VARBIT : V A R B I T; INT1 : I N T '1'; INT2 : I N T '2'; INT4 : I N T '4'; INT8 : I N T '8'; TINYINT : T I N Y I N T; // alias for INT1 SMALLINT : S M A L L I N T; // alias for INT2 INT : I N T; // alias for INT4 INTEGER : I N T E G E R; // alias - INT4 BIGINT : B I G I N T; // alias for INT8 FLOAT4 : F L O A T '4'; FLOAT8 : F L O A T '8'; REAL : R E A L; // alias for FLOAT4 FLOAT : F L O A T; // alias for FLOAT8 DOUBLE : D O U B L E; // alias for FLOAT8 NUMERIC : N U M E R I C; DECIMAL : D E C I M A L; // alias for number CHAR : C H A R; VARCHAR : V A R C H A R; NCHAR : N C H A R; NVARCHAR : N V A R C H A R; DATE : D A T E; INTERVAL: I N T E R V A L; TIME : T I M E; TIMETZ : T I M E T Z; TIMESTAMP : T I M E S T A M P; TIMESTAMPTZ : T I M E S T A M P T Z; TEXT : T E X T; BINARY : B I N A R Y; VARBINARY : V A R B I N A R Y; BLOB : B L O B; BYTEA : B Y T E A; // alias for BLOB INET4 : I N E T '4'; // Operators Similar_To : '~'; Not_Similar_To : '!~'; Similar_To_Case_Insensitive : '~*'; Not_Similar_To_Case_Insensitive : '!~*'; // Cast Operator CAST_EXPRESSION : COLON COLON ; ASSIGN : ':='; EQUAL : '='; COLON : ':'; SEMI_COLON : ';'; COMMA : ','; CONCATENATION_OPERATOR : VERTICAL_BAR VERTICAL_BAR; NOT_EQUAL : '<>' | '!=' | '~='| '^=' ; LTH : '<' ; LEQ : '<='; GTH : '>'; GEQ : '>='; LEFT_PAREN : '('; RIGHT_PAREN : ')'; PLUS : '+'; MINUS : '-'; MULTIPLY: '*'; DIVIDE : '/'; MODULAR : '%'; DOT : '.'; UNDERLINE : '_'; VERTICAL_BAR : '|'; QUOTE : '\''; DOUBLE_QUOTE : '"'; NUMBER : Digit+; fragment Digit : '0'..'9'; REAL_NUMBER : ('0'..'9')+ '.' ('0'..'9')* EXPONENT? | '.' ('0'..'9')+ EXPONENT? | ('0'..'9')+ EXPONENT ; BlockComment : '/*' .*? '*/' -> skip ; LineComment : '--' ~[\r\n]* -> skip ; /* =============================================================================== Identifiers =============================================================================== */ Regular_Identifier : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|Digit|'_')* { setText(getText().toLowerCase()); } ; Quoted_Identifier : DOUBLE_QUOTE ( ESC_SEQ | ~('\\'|'"') )* DOUBLE_QUOTE { setText(getText().substring(1, getText().length()-1)); } ; /* =============================================================================== Literal =============================================================================== */ // Some Unicode Character Ranges fragment Control_Characters : '\u0001' .. '\u001F'; fragment Extended_Control_Characters : '\u0080' .. '\u009F'; Character_String_Literal : QUOTE ( ESC_SEQ | ~('\\'|'\'') )* QUOTE ; fragment EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; fragment ESC_SEQ : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | UNICODE_ESC | OCTAL_ESC ; fragment OCTAL_ESC : '\\' ('0'..'3') ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ; fragment UNICODE_ESC : '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; /* =============================================================================== Whitespace Tokens =============================================================================== */ Space : ' ' -> skip ; White_Space : ( Control_Characters | Extended_Control_Characters )+ -> skip ; BAD : . -> skip ;
src/firmware-tests/Platform/Lcd/States/EnableWaitForShiftRegister/ShiftRegisterNotClearedBeforeEnabledTest.asm
pete-restall/Cluck2Sesame-Prototype
1
178825
#include "Platform.inc" #include "FarCalls.inc" #include "Lcd.inc" #include "../../LcdStates.inc" #include "../../../ShiftRegister/IsShiftRegisterEnabledStub.inc" #include "../../../ShiftRegister/ShiftOutMock.inc" #include "TestFixture.inc" radix decimal ShiftRegisterNotClearedBeforeEnabledTest code global testArrange testArrange: clrw fcall initialiseIsShiftRegisterEnabledStub fcall initialiseShiftOutMock fcall initialiseLcd testAct: setLcdState LCD_STATE_ENABLE_WAITFORSHIFTREGISTER fcall pollLcd testAssert: banksel calledShiftOutCount .assert "calledShiftOutCount == 0, 'Expected shiftOut() was not called.'" return end
examples/pxScene2d/external/libnode-v6.9.0/deps/openssl/asm_obsolete/x86-win32-masm/bn/bn-586.asm
madanagopaltcomcast/pxCore
5,964
21934
<gh_stars>1000+ TITLE ../openssl/crypto/bn/asm/bn-586.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 ;EXTERN _OPENSSL_ia32cap_P:NEAR ALIGN 16 _bn_mul_add_words PROC PUBLIC $L_bn_mul_add_words_begin:: lea eax,DWORD PTR _OPENSSL_ia32cap_P bt DWORD PTR [eax],26 jnc $L000maw_non_sse2 mov eax,DWORD PTR 4[esp] mov edx,DWORD PTR 8[esp] mov ecx,DWORD PTR 12[esp] movd mm0,DWORD PTR 16[esp] pxor mm1,mm1 jmp $L001maw_sse2_entry ALIGN 16 $L002maw_sse2_unrolled: movd mm3,DWORD PTR [eax] paddq mm1,mm3 movd mm2,DWORD PTR [edx] pmuludq mm2,mm0 movd mm4,DWORD PTR 4[edx] pmuludq mm4,mm0 movd mm6,DWORD PTR 8[edx] pmuludq mm6,mm0 movd mm7,DWORD PTR 12[edx] pmuludq mm7,mm0 paddq mm1,mm2 movd mm3,DWORD PTR 4[eax] paddq mm3,mm4 movd mm5,DWORD PTR 8[eax] paddq mm5,mm6 movd mm4,DWORD PTR 12[eax] paddq mm7,mm4 movd DWORD PTR [eax],mm1 movd mm2,DWORD PTR 16[edx] pmuludq mm2,mm0 psrlq mm1,32 movd mm4,DWORD PTR 20[edx] pmuludq mm4,mm0 paddq mm1,mm3 movd mm6,DWORD PTR 24[edx] pmuludq mm6,mm0 movd DWORD PTR 4[eax],mm1 psrlq mm1,32 movd mm3,DWORD PTR 28[edx] add edx,32 pmuludq mm3,mm0 paddq mm1,mm5 movd mm5,DWORD PTR 16[eax] paddq mm2,mm5 movd DWORD PTR 8[eax],mm1 psrlq mm1,32 paddq mm1,mm7 movd mm5,DWORD PTR 20[eax] paddq mm4,mm5 movd DWORD PTR 12[eax],mm1 psrlq mm1,32 paddq mm1,mm2 movd mm5,DWORD PTR 24[eax] paddq mm6,mm5 movd DWORD PTR 16[eax],mm1 psrlq mm1,32 paddq mm1,mm4 movd mm5,DWORD PTR 28[eax] paddq mm3,mm5 movd DWORD PTR 20[eax],mm1 psrlq mm1,32 paddq mm1,mm6 movd DWORD PTR 24[eax],mm1 psrlq mm1,32 paddq mm1,mm3 movd DWORD PTR 28[eax],mm1 lea eax,DWORD PTR 32[eax] psrlq mm1,32 sub ecx,8 jz $L003maw_sse2_exit $L001maw_sse2_entry: test ecx,4294967288 jnz $L002maw_sse2_unrolled ALIGN 4 $L004maw_sse2_loop: movd mm2,DWORD PTR [edx] movd mm3,DWORD PTR [eax] pmuludq mm2,mm0 lea edx,DWORD PTR 4[edx] paddq mm1,mm3 paddq mm1,mm2 movd DWORD PTR [eax],mm1 sub ecx,1 psrlq mm1,32 lea eax,DWORD PTR 4[eax] jnz $L004maw_sse2_loop $L003maw_sse2_exit: movd eax,mm1 emms ret ALIGN 16 $L000maw_non_sse2: push ebp push ebx push esi push edi ; xor esi,esi mov edi,DWORD PTR 20[esp] mov ecx,DWORD PTR 28[esp] mov ebx,DWORD PTR 24[esp] and ecx,4294967288 mov ebp,DWORD PTR 32[esp] push ecx jz $L005maw_finish ALIGN 16 $L006maw_loop: ; Round 0 mov eax,DWORD PTR [ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR [edi] adc edx,0 mov DWORD PTR [edi],eax mov esi,edx ; Round 4 mov eax,DWORD PTR 4[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 4[edi] adc edx,0 mov DWORD PTR 4[edi],eax mov esi,edx ; Round 8 mov eax,DWORD PTR 8[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 8[edi] adc edx,0 mov DWORD PTR 8[edi],eax mov esi,edx ; Round 12 mov eax,DWORD PTR 12[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 12[edi] adc edx,0 mov DWORD PTR 12[edi],eax mov esi,edx ; Round 16 mov eax,DWORD PTR 16[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 16[edi] adc edx,0 mov DWORD PTR 16[edi],eax mov esi,edx ; Round 20 mov eax,DWORD PTR 20[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 20[edi] adc edx,0 mov DWORD PTR 20[edi],eax mov esi,edx ; Round 24 mov eax,DWORD PTR 24[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 24[edi] adc edx,0 mov DWORD PTR 24[edi],eax mov esi,edx ; Round 28 mov eax,DWORD PTR 28[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 28[edi] adc edx,0 mov DWORD PTR 28[edi],eax mov esi,edx ; sub ecx,8 lea ebx,DWORD PTR 32[ebx] lea edi,DWORD PTR 32[edi] jnz $L006maw_loop $L005maw_finish: mov ecx,DWORD PTR 32[esp] and ecx,7 jnz $L007maw_finish2 jmp $L008maw_end $L007maw_finish2: ; Tail Round 0 mov eax,DWORD PTR [ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR [edi] adc edx,0 dec ecx mov DWORD PTR [edi],eax mov esi,edx jz $L008maw_end ; Tail Round 1 mov eax,DWORD PTR 4[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 4[edi] adc edx,0 dec ecx mov DWORD PTR 4[edi],eax mov esi,edx jz $L008maw_end ; Tail Round 2 mov eax,DWORD PTR 8[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 8[edi] adc edx,0 dec ecx mov DWORD PTR 8[edi],eax mov esi,edx jz $L008maw_end ; Tail Round 3 mov eax,DWORD PTR 12[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 12[edi] adc edx,0 dec ecx mov DWORD PTR 12[edi],eax mov esi,edx jz $L008maw_end ; Tail Round 4 mov eax,DWORD PTR 16[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 16[edi] adc edx,0 dec ecx mov DWORD PTR 16[edi],eax mov esi,edx jz $L008maw_end ; Tail Round 5 mov eax,DWORD PTR 20[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 20[edi] adc edx,0 dec ecx mov DWORD PTR 20[edi],eax mov esi,edx jz $L008maw_end ; Tail Round 6 mov eax,DWORD PTR 24[ebx] mul ebp add eax,esi adc edx,0 add eax,DWORD PTR 24[edi] adc edx,0 mov DWORD PTR 24[edi],eax mov esi,edx $L008maw_end: mov eax,esi pop ecx pop edi pop esi pop ebx pop ebp ret _bn_mul_add_words ENDP ALIGN 16 _bn_mul_words PROC PUBLIC $L_bn_mul_words_begin:: lea eax,DWORD PTR _OPENSSL_ia32cap_P bt DWORD PTR [eax],26 jnc $L009mw_non_sse2 mov eax,DWORD PTR 4[esp] mov edx,DWORD PTR 8[esp] mov ecx,DWORD PTR 12[esp] movd mm0,DWORD PTR 16[esp] pxor mm1,mm1 ALIGN 16 $L010mw_sse2_loop: movd mm2,DWORD PTR [edx] pmuludq mm2,mm0 lea edx,DWORD PTR 4[edx] paddq mm1,mm2 movd DWORD PTR [eax],mm1 sub ecx,1 psrlq mm1,32 lea eax,DWORD PTR 4[eax] jnz $L010mw_sse2_loop movd eax,mm1 emms ret ALIGN 16 $L009mw_non_sse2: push ebp push ebx push esi push edi ; xor esi,esi mov edi,DWORD PTR 20[esp] mov ebx,DWORD PTR 24[esp] mov ebp,DWORD PTR 28[esp] mov ecx,DWORD PTR 32[esp] and ebp,4294967288 jz $L011mw_finish $L012mw_loop: ; Round 0 mov eax,DWORD PTR [ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR [edi],eax mov esi,edx ; Round 4 mov eax,DWORD PTR 4[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 4[edi],eax mov esi,edx ; Round 8 mov eax,DWORD PTR 8[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 8[edi],eax mov esi,edx ; Round 12 mov eax,DWORD PTR 12[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 12[edi],eax mov esi,edx ; Round 16 mov eax,DWORD PTR 16[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 16[edi],eax mov esi,edx ; Round 20 mov eax,DWORD PTR 20[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 20[edi],eax mov esi,edx ; Round 24 mov eax,DWORD PTR 24[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 24[edi],eax mov esi,edx ; Round 28 mov eax,DWORD PTR 28[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 28[edi],eax mov esi,edx ; add ebx,32 add edi,32 sub ebp,8 jz $L011mw_finish jmp $L012mw_loop $L011mw_finish: mov ebp,DWORD PTR 28[esp] and ebp,7 jnz $L013mw_finish2 jmp $L014mw_end $L013mw_finish2: ; Tail Round 0 mov eax,DWORD PTR [ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR [edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 1 mov eax,DWORD PTR 4[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 4[edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 2 mov eax,DWORD PTR 8[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 8[edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 3 mov eax,DWORD PTR 12[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 12[edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 4 mov eax,DWORD PTR 16[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 16[edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 5 mov eax,DWORD PTR 20[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 20[edi],eax mov esi,edx dec ebp jz $L014mw_end ; Tail Round 6 mov eax,DWORD PTR 24[ebx] mul ecx add eax,esi adc edx,0 mov DWORD PTR 24[edi],eax mov esi,edx $L014mw_end: mov eax,esi pop edi pop esi pop ebx pop ebp ret _bn_mul_words ENDP ALIGN 16 _bn_sqr_words PROC PUBLIC $L_bn_sqr_words_begin:: lea eax,DWORD PTR _OPENSSL_ia32cap_P bt DWORD PTR [eax],26 jnc $L015sqr_non_sse2 mov eax,DWORD PTR 4[esp] mov edx,DWORD PTR 8[esp] mov ecx,DWORD PTR 12[esp] ALIGN 16 $L016sqr_sse2_loop: movd mm0,DWORD PTR [edx] pmuludq mm0,mm0 lea edx,DWORD PTR 4[edx] movq QWORD PTR [eax],mm0 sub ecx,1 lea eax,DWORD PTR 8[eax] jnz $L016sqr_sse2_loop emms ret ALIGN 16 $L015sqr_non_sse2: push ebp push ebx push esi push edi ; mov esi,DWORD PTR 20[esp] mov edi,DWORD PTR 24[esp] mov ebx,DWORD PTR 28[esp] and ebx,4294967288 jz $L017sw_finish $L018sw_loop: ; Round 0 mov eax,DWORD PTR [edi] mul eax mov DWORD PTR [esi],eax mov DWORD PTR 4[esi],edx ; Round 4 mov eax,DWORD PTR 4[edi] mul eax mov DWORD PTR 8[esi],eax mov DWORD PTR 12[esi],edx ; Round 8 mov eax,DWORD PTR 8[edi] mul eax mov DWORD PTR 16[esi],eax mov DWORD PTR 20[esi],edx ; Round 12 mov eax,DWORD PTR 12[edi] mul eax mov DWORD PTR 24[esi],eax mov DWORD PTR 28[esi],edx ; Round 16 mov eax,DWORD PTR 16[edi] mul eax mov DWORD PTR 32[esi],eax mov DWORD PTR 36[esi],edx ; Round 20 mov eax,DWORD PTR 20[edi] mul eax mov DWORD PTR 40[esi],eax mov DWORD PTR 44[esi],edx ; Round 24 mov eax,DWORD PTR 24[edi] mul eax mov DWORD PTR 48[esi],eax mov DWORD PTR 52[esi],edx ; Round 28 mov eax,DWORD PTR 28[edi] mul eax mov DWORD PTR 56[esi],eax mov DWORD PTR 60[esi],edx ; add edi,32 add esi,64 sub ebx,8 jnz $L018sw_loop $L017sw_finish: mov ebx,DWORD PTR 28[esp] and ebx,7 jz $L019sw_end ; Tail Round 0 mov eax,DWORD PTR [edi] mul eax mov DWORD PTR [esi],eax dec ebx mov DWORD PTR 4[esi],edx jz $L019sw_end ; Tail Round 1 mov eax,DWORD PTR 4[edi] mul eax mov DWORD PTR 8[esi],eax dec ebx mov DWORD PTR 12[esi],edx jz $L019sw_end ; Tail Round 2 mov eax,DWORD PTR 8[edi] mul eax mov DWORD PTR 16[esi],eax dec ebx mov DWORD PTR 20[esi],edx jz $L019sw_end ; Tail Round 3 mov eax,DWORD PTR 12[edi] mul eax mov DWORD PTR 24[esi],eax dec ebx mov DWORD PTR 28[esi],edx jz $L019sw_end ; Tail Round 4 mov eax,DWORD PTR 16[edi] mul eax mov DWORD PTR 32[esi],eax dec ebx mov DWORD PTR 36[esi],edx jz $L019sw_end ; Tail Round 5 mov eax,DWORD PTR 20[edi] mul eax mov DWORD PTR 40[esi],eax dec ebx mov DWORD PTR 44[esi],edx jz $L019sw_end ; Tail Round 6 mov eax,DWORD PTR 24[edi] mul eax mov DWORD PTR 48[esi],eax mov DWORD PTR 52[esi],edx $L019sw_end: pop edi pop esi pop ebx pop ebp ret _bn_sqr_words ENDP ALIGN 16 _bn_div_words PROC PUBLIC $L_bn_div_words_begin:: mov edx,DWORD PTR 4[esp] mov eax,DWORD PTR 8[esp] mov ecx,DWORD PTR 12[esp] div ecx ret _bn_div_words ENDP ALIGN 16 _bn_add_words PROC PUBLIC $L_bn_add_words_begin:: push ebp push ebx push esi push edi ; mov ebx,DWORD PTR 20[esp] mov esi,DWORD PTR 24[esp] mov edi,DWORD PTR 28[esp] mov ebp,DWORD PTR 32[esp] xor eax,eax and ebp,4294967288 jz $L020aw_finish $L021aw_loop: ; Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx ; Round 1 mov ecx,DWORD PTR 4[esi] mov edx,DWORD PTR 4[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 4[ebx],ecx ; Round 2 mov ecx,DWORD PTR 8[esi] mov edx,DWORD PTR 8[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 8[ebx],ecx ; Round 3 mov ecx,DWORD PTR 12[esi] mov edx,DWORD PTR 12[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 12[ebx],ecx ; Round 4 mov ecx,DWORD PTR 16[esi] mov edx,DWORD PTR 16[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 16[ebx],ecx ; Round 5 mov ecx,DWORD PTR 20[esi] mov edx,DWORD PTR 20[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 20[ebx],ecx ; Round 6 mov ecx,DWORD PTR 24[esi] mov edx,DWORD PTR 24[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx ; Round 7 mov ecx,DWORD PTR 28[esi] mov edx,DWORD PTR 28[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 28[ebx],ecx ; add esi,32 add edi,32 add ebx,32 sub ebp,8 jnz $L021aw_loop $L020aw_finish: mov ebp,DWORD PTR 32[esp] and ebp,7 jz $L022aw_end ; Tail Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR [ebx],ecx jz $L022aw_end ; Tail Round 1 mov ecx,DWORD PTR 4[esi] mov edx,DWORD PTR 4[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR 4[ebx],ecx jz $L022aw_end ; Tail Round 2 mov ecx,DWORD PTR 8[esi] mov edx,DWORD PTR 8[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR 8[ebx],ecx jz $L022aw_end ; Tail Round 3 mov ecx,DWORD PTR 12[esi] mov edx,DWORD PTR 12[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR 12[ebx],ecx jz $L022aw_end ; Tail Round 4 mov ecx,DWORD PTR 16[esi] mov edx,DWORD PTR 16[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR 16[ebx],ecx jz $L022aw_end ; Tail Round 5 mov ecx,DWORD PTR 20[esi] mov edx,DWORD PTR 20[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 dec ebp mov DWORD PTR 20[ebx],ecx jz $L022aw_end ; Tail Round 6 mov ecx,DWORD PTR 24[esi] mov edx,DWORD PTR 24[edi] add ecx,eax mov eax,0 adc eax,eax add ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx $L022aw_end: pop edi pop esi pop ebx pop ebp ret _bn_add_words ENDP ALIGN 16 _bn_sub_words PROC PUBLIC $L_bn_sub_words_begin:: push ebp push ebx push esi push edi ; mov ebx,DWORD PTR 20[esp] mov esi,DWORD PTR 24[esp] mov edi,DWORD PTR 28[esp] mov ebp,DWORD PTR 32[esp] xor eax,eax and ebp,4294967288 jz $L023aw_finish $L024aw_loop: ; Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx ; Round 1 mov ecx,DWORD PTR 4[esi] mov edx,DWORD PTR 4[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 4[ebx],ecx ; Round 2 mov ecx,DWORD PTR 8[esi] mov edx,DWORD PTR 8[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 8[ebx],ecx ; Round 3 mov ecx,DWORD PTR 12[esi] mov edx,DWORD PTR 12[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 12[ebx],ecx ; Round 4 mov ecx,DWORD PTR 16[esi] mov edx,DWORD PTR 16[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 16[ebx],ecx ; Round 5 mov ecx,DWORD PTR 20[esi] mov edx,DWORD PTR 20[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 20[ebx],ecx ; Round 6 mov ecx,DWORD PTR 24[esi] mov edx,DWORD PTR 24[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx ; Round 7 mov ecx,DWORD PTR 28[esi] mov edx,DWORD PTR 28[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 28[ebx],ecx ; add esi,32 add edi,32 add ebx,32 sub ebp,8 jnz $L024aw_loop $L023aw_finish: mov ebp,DWORD PTR 32[esp] and ebp,7 jz $L025aw_end ; Tail Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR [ebx],ecx jz $L025aw_end ; Tail Round 1 mov ecx,DWORD PTR 4[esi] mov edx,DWORD PTR 4[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 4[ebx],ecx jz $L025aw_end ; Tail Round 2 mov ecx,DWORD PTR 8[esi] mov edx,DWORD PTR 8[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 8[ebx],ecx jz $L025aw_end ; Tail Round 3 mov ecx,DWORD PTR 12[esi] mov edx,DWORD PTR 12[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 12[ebx],ecx jz $L025aw_end ; Tail Round 4 mov ecx,DWORD PTR 16[esi] mov edx,DWORD PTR 16[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 16[ebx],ecx jz $L025aw_end ; Tail Round 5 mov ecx,DWORD PTR 20[esi] mov edx,DWORD PTR 20[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 20[ebx],ecx jz $L025aw_end ; Tail Round 6 mov ecx,DWORD PTR 24[esi] mov edx,DWORD PTR 24[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx $L025aw_end: pop edi pop esi pop ebx pop ebp ret _bn_sub_words ENDP ALIGN 16 _bn_sub_part_words PROC PUBLIC $L_bn_sub_part_words_begin:: push ebp push ebx push esi push edi ; mov ebx,DWORD PTR 20[esp] mov esi,DWORD PTR 24[esp] mov edi,DWORD PTR 28[esp] mov ebp,DWORD PTR 32[esp] xor eax,eax and ebp,4294967288 jz $L026aw_finish $L027aw_loop: ; Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx ; Round 1 mov ecx,DWORD PTR 4[esi] mov edx,DWORD PTR 4[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 4[ebx],ecx ; Round 2 mov ecx,DWORD PTR 8[esi] mov edx,DWORD PTR 8[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 8[ebx],ecx ; Round 3 mov ecx,DWORD PTR 12[esi] mov edx,DWORD PTR 12[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 12[ebx],ecx ; Round 4 mov ecx,DWORD PTR 16[esi] mov edx,DWORD PTR 16[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 16[ebx],ecx ; Round 5 mov ecx,DWORD PTR 20[esi] mov edx,DWORD PTR 20[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 20[ebx],ecx ; Round 6 mov ecx,DWORD PTR 24[esi] mov edx,DWORD PTR 24[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx ; Round 7 mov ecx,DWORD PTR 28[esi] mov edx,DWORD PTR 28[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 28[ebx],ecx ; add esi,32 add edi,32 add ebx,32 sub ebp,8 jnz $L027aw_loop $L026aw_finish: mov ebp,DWORD PTR 32[esp] and ebp,7 jz $L028aw_end ; Tail Round 0 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 1 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 2 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 3 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 4 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 5 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 dec ebp jz $L028aw_end ; Tail Round 6 mov ecx,DWORD PTR [esi] mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx add esi,4 add edi,4 add ebx,4 $L028aw_end: cmp DWORD PTR 36[esp],0 je $L029pw_end mov ebp,DWORD PTR 36[esp] cmp ebp,0 je $L029pw_end jge $L030pw_pos ; pw_neg mov edx,0 sub edx,ebp mov ebp,edx and ebp,4294967288 jz $L031pw_neg_finish $L032pw_neg_loop: ; dl<0 Round 0 mov ecx,0 mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR [ebx],ecx ; dl<0 Round 1 mov ecx,0 mov edx,DWORD PTR 4[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 4[ebx],ecx ; dl<0 Round 2 mov ecx,0 mov edx,DWORD PTR 8[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 8[ebx],ecx ; dl<0 Round 3 mov ecx,0 mov edx,DWORD PTR 12[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 12[ebx],ecx ; dl<0 Round 4 mov ecx,0 mov edx,DWORD PTR 16[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 16[ebx],ecx ; dl<0 Round 5 mov ecx,0 mov edx,DWORD PTR 20[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 20[ebx],ecx ; dl<0 Round 6 mov ecx,0 mov edx,DWORD PTR 24[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx ; dl<0 Round 7 mov ecx,0 mov edx,DWORD PTR 28[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 28[ebx],ecx ; add edi,32 add ebx,32 sub ebp,8 jnz $L032pw_neg_loop $L031pw_neg_finish: mov edx,DWORD PTR 36[esp] mov ebp,0 sub ebp,edx and ebp,7 jz $L029pw_end ; dl<0 Tail Round 0 mov ecx,0 mov edx,DWORD PTR [edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR [ebx],ecx jz $L029pw_end ; dl<0 Tail Round 1 mov ecx,0 mov edx,DWORD PTR 4[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 4[ebx],ecx jz $L029pw_end ; dl<0 Tail Round 2 mov ecx,0 mov edx,DWORD PTR 8[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 8[ebx],ecx jz $L029pw_end ; dl<0 Tail Round 3 mov ecx,0 mov edx,DWORD PTR 12[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 12[ebx],ecx jz $L029pw_end ; dl<0 Tail Round 4 mov ecx,0 mov edx,DWORD PTR 16[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 16[ebx],ecx jz $L029pw_end ; dl<0 Tail Round 5 mov ecx,0 mov edx,DWORD PTR 20[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 dec ebp mov DWORD PTR 20[ebx],ecx jz $L029pw_end ; dl<0 Tail Round 6 mov ecx,0 mov edx,DWORD PTR 24[edi] sub ecx,eax mov eax,0 adc eax,eax sub ecx,edx adc eax,0 mov DWORD PTR 24[ebx],ecx jmp $L029pw_end $L030pw_pos: and ebp,4294967288 jz $L033pw_pos_finish $L034pw_pos_loop: ; dl>0 Round 0 mov ecx,DWORD PTR [esi] sub ecx,eax mov DWORD PTR [ebx],ecx jnc $L035pw_nc0 ; dl>0 Round 1 mov ecx,DWORD PTR 4[esi] sub ecx,eax mov DWORD PTR 4[ebx],ecx jnc $L036pw_nc1 ; dl>0 Round 2 mov ecx,DWORD PTR 8[esi] sub ecx,eax mov DWORD PTR 8[ebx],ecx jnc $L037pw_nc2 ; dl>0 Round 3 mov ecx,DWORD PTR 12[esi] sub ecx,eax mov DWORD PTR 12[ebx],ecx jnc $L038pw_nc3 ; dl>0 Round 4 mov ecx,DWORD PTR 16[esi] sub ecx,eax mov DWORD PTR 16[ebx],ecx jnc $L039pw_nc4 ; dl>0 Round 5 mov ecx,DWORD PTR 20[esi] sub ecx,eax mov DWORD PTR 20[ebx],ecx jnc $L040pw_nc5 ; dl>0 Round 6 mov ecx,DWORD PTR 24[esi] sub ecx,eax mov DWORD PTR 24[ebx],ecx jnc $L041pw_nc6 ; dl>0 Round 7 mov ecx,DWORD PTR 28[esi] sub ecx,eax mov DWORD PTR 28[ebx],ecx jnc $L042pw_nc7 ; add esi,32 add ebx,32 sub ebp,8 jnz $L034pw_pos_loop $L033pw_pos_finish: mov ebp,DWORD PTR 36[esp] and ebp,7 jz $L029pw_end ; dl>0 Tail Round 0 mov ecx,DWORD PTR [esi] sub ecx,eax mov DWORD PTR [ebx],ecx jnc $L043pw_tail_nc0 dec ebp jz $L029pw_end ; dl>0 Tail Round 1 mov ecx,DWORD PTR 4[esi] sub ecx,eax mov DWORD PTR 4[ebx],ecx jnc $L044pw_tail_nc1 dec ebp jz $L029pw_end ; dl>0 Tail Round 2 mov ecx,DWORD PTR 8[esi] sub ecx,eax mov DWORD PTR 8[ebx],ecx jnc $L045pw_tail_nc2 dec ebp jz $L029pw_end ; dl>0 Tail Round 3 mov ecx,DWORD PTR 12[esi] sub ecx,eax mov DWORD PTR 12[ebx],ecx jnc $L046pw_tail_nc3 dec ebp jz $L029pw_end ; dl>0 Tail Round 4 mov ecx,DWORD PTR 16[esi] sub ecx,eax mov DWORD PTR 16[ebx],ecx jnc $L047pw_tail_nc4 dec ebp jz $L029pw_end ; dl>0 Tail Round 5 mov ecx,DWORD PTR 20[esi] sub ecx,eax mov DWORD PTR 20[ebx],ecx jnc $L048pw_tail_nc5 dec ebp jz $L029pw_end ; dl>0 Tail Round 6 mov ecx,DWORD PTR 24[esi] sub ecx,eax mov DWORD PTR 24[ebx],ecx jnc $L049pw_tail_nc6 mov eax,1 jmp $L029pw_end $L050pw_nc_loop: mov ecx,DWORD PTR [esi] mov DWORD PTR [ebx],ecx $L035pw_nc0: mov ecx,DWORD PTR 4[esi] mov DWORD PTR 4[ebx],ecx $L036pw_nc1: mov ecx,DWORD PTR 8[esi] mov DWORD PTR 8[ebx],ecx $L037pw_nc2: mov ecx,DWORD PTR 12[esi] mov DWORD PTR 12[ebx],ecx $L038pw_nc3: mov ecx,DWORD PTR 16[esi] mov DWORD PTR 16[ebx],ecx $L039pw_nc4: mov ecx,DWORD PTR 20[esi] mov DWORD PTR 20[ebx],ecx $L040pw_nc5: mov ecx,DWORD PTR 24[esi] mov DWORD PTR 24[ebx],ecx $L041pw_nc6: mov ecx,DWORD PTR 28[esi] mov DWORD PTR 28[ebx],ecx $L042pw_nc7: ; add esi,32 add ebx,32 sub ebp,8 jnz $L050pw_nc_loop mov ebp,DWORD PTR 36[esp] and ebp,7 jz $L051pw_nc_end mov ecx,DWORD PTR [esi] mov DWORD PTR [ebx],ecx $L043pw_tail_nc0: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 4[esi] mov DWORD PTR 4[ebx],ecx $L044pw_tail_nc1: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 8[esi] mov DWORD PTR 8[ebx],ecx $L045pw_tail_nc2: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 12[esi] mov DWORD PTR 12[ebx],ecx $L046pw_tail_nc3: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 16[esi] mov DWORD PTR 16[ebx],ecx $L047pw_tail_nc4: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 20[esi] mov DWORD PTR 20[ebx],ecx $L048pw_tail_nc5: dec ebp jz $L051pw_nc_end mov ecx,DWORD PTR 24[esi] mov DWORD PTR 24[ebx],ecx $L049pw_tail_nc6: $L051pw_nc_end: mov eax,0 $L029pw_end: pop edi pop esi pop ebx pop ebp ret _bn_sub_part_words ENDP .text$ ENDS .bss SEGMENT 'BSS' COMM _OPENSSL_ia32cap_P:DWORD:4 .bss ENDS END
HW5/hwk5.asm
CodyKelly-UCD/CSCI-2525
0
5211
TITLE inclassMENU.asm ; Author: <NAME> ; Date: 7 March 2018 ; Description: This program presents a menu allowing the user to pick a menu option ; which then performs a given task. ; 1. The user enters a string of less than 50 characters. ; 2. The entered string is converted to lower case. ; 3. The entered string has all non - letter elements removed. ; 4. Is the entered string a palindrome (not case-sensitive). ; 5. Is the string a palindrome (case-sensitive). ; 6. Print the string. ; 7. Exit ; ==================================================================================== Include Irvine32.inc ;//Macros ClearEAX textequ <mov eax, 0> ClearEBX textequ <mov ebx, 0> ClearECX textequ <mov ecx, 0> ClearEDX textequ <mov edx, 0> ClearESI textequ <mov esi, 0> ClearEDI textequ <mov edi, 0> maxLength = 51d .data UserOption byte 0h theString byte maxLength dup(0) theStringLen byte 0 errormessage byte 'You have entered an invalid option. Please try again.', 0Ah, 0Dh, 0h .code main PROC call ClearRegisters ;// clears registers startHere: call DisplayMainMenu call readhex mov useroption, al mov edx, offset theString mov ecx, lengthof theString mov ebx, offset thestringlen opt1: cmp useroption, 1 jne opt2 call clrscr call option1 jmp starthere opt2: cmp useroption, 2 jne opt3 call clrscr call option2 jmp starthere opt3: cmp useroption, 3 jne opt4 call clrscr call option3 jmp starthere opt4: cmp useroption, 4 jne opt5 call clrscr call option4 jmp starthere opt5: cmp useroption, 5 jne opt6 call clrscr call option5 jmp starthere opt6: cmp useroption, 6 jne opt7 call clrscr call option6 jmp starthere opt7: cmp useroption, 7 jne oops jmp quitit oops: push edx mov edx, offset errormessage call writestring call waitmsg pop edx jmp starthere quitit: exit main ENDP ;// Procedures ;// =============================================================== ClearRegisters Proc ;// Description: Clears the registers EAX, EBX, ECX, EDX, ESI, EDI ;// Requires: Nothing ;// Returns: Nothing, but all registers will be cleared. cleareax clearebx clearecx clearedx clearesi clearedi ret ClearRegisters ENDP DisplayMainMenu proc ;// Description: Displays the main menu ;// Requires: Nothing ;// Returns: Nothing .data Menuprompt1 byte 'MAIN MENU', 0Ah, 0Dh, '==========', 0Ah, 0Dh, '1. Enter a String', 0Ah, 0Dh, '2. Convert all elements to lower case',0Ah, 0Dh, '3. Remove all non-letter elements',0Ah, 0Dh, '4. Determine if the string is a palindrome (not case-sensitive)',0Ah, 0Dh, '5. ', 0 Menuprompt2 byte 'EXTRA CREDIT', 0 Menuprompt3 byte ': Determine if the string is a palindrome (case-sensitive)', 0Ah, 0Dh, '6. Display the string',0Ah, 0Dh, '7. Exit: ',0Ah, 0Dh, 0h .code ; Clear screen call clrscr ; Display first part of main menu mov edx, offset menuprompt1 call WriteString ; Display the words EXTRA CREDIT in gold mov eax, 14 mov edx, offset menuprompt2 call SetTextColor call WriteString ; Reset text color and display the rest of the menu mov eax, 7 mov edx, offset menuprompt3 call settextcolor call writestring ret DisplayMainMenu endp option1 proc uses edx ecx ; Description: Receives a string from the user ; ; Receives: ; EDX: The offset of the byte array to store the string in. ; Must have 50 elements. ; ; Returns: ; EDX: string from user ; EBX: length of string ; ; Requires: ; Array must have 50 elements .data option1prompt byte 'Please enter a string of characters (50 or less): ', 0Ah, 0Dh, '--->', 0h .code push edx ; saving the address of the string mov edx, offset option1prompt call writestring pop edx ; add procedure to clear string (loop through and place zeros) call readstring mov byte ptr [ebx], al ;//length of user entered string, now in thestringlen ret option1 endp option2 proc uses edx ebx ; Description: Converts all uppercase letters in string to lowercase ; ; Receives: ; EDX: Offset of string array ; ECX: Length of string array ; ; Returns: ; EDX: String array with converted letters, if any clearESI L2: mov al, byte ptr [edx+esi] cmp al, 41h jb keepgoing cmp al, 5ah ja keepgoing or al, 20h ;//could use add al, 20h mov byte ptr [edx+esi], al keepgoing: inc esi loop L2 ret option2 endp option3 proc ; Description: Removes all non-letter characters from string ; ; Receives: ; EDX: offset of string array ; ; Returns: ; EDX: offset of string array ; EBX: new length of string push eax push esi push edx push ebx clearESI clearEAX L1: ; Move current element into al mov al, byte ptr [edx + esi] ; Test if current element is NOT a capital letter cmp al, 41h jb notLetter cmp al, 5bh jb letter ; If the element isn't a capital letter, it may be a lowercase letter cmp al, 61h jb notLetter cmp al, 7bh jb letter cmp al, 75h ja notletter letter: ; If current element IS letter: ; Move element into element at ah movzx ebx, ah ; Make current element 0 mov byte ptr [edx + esi], 0 ; Move letter into new position mov byte ptr [edx + ebx], al ; Increment ah so we get a new valid position inc ah jmp keepgoing notLetter: ; If current element is NOT a letter: ; Make current element 0 mov byte ptr [edx + esi], 0 keepgoing: inc esi LOOP L1 complete: pop ebx mov byte ptr [ebx], ah ; Return length of string pop edx pop esi pop eax ret option3 endp option4 proc ; Description: Checks if a given string is a palindrome. ; To be a palindrome, the given string must read the same forwards as it ; does backwards. This means that a character at index n must be the same ; as the character at index (length of string - 1) - n, where n is less than or ; equal to (length of string) / 2. ; ; This is not a case-sensitive palindrome check ; ; Receives: ; EDX: Offset of string array ; EBX: Number of characters in string .data theStringUppercase byte maxLength dup(0) .code push esi push eax push ecx ; First we put the contents of the string received into ; theStringUppercase clearESI L1: mov al, [edx + esi] mov theStringUppercase[esi], al inc esi loop L1 ; Then we convert the new string to uppercase pop ecx mov edx, OFFSET theStringUppercase call option2 ; Then we check the string for palindromeness call option5 pop edx pop esi ret option4 endp option5 proc ; Description: Checks if a given string is a palindrome. ; To be a palindrome, the given string must read the same forwards as it ; does backwards. This means that a character at index n must be the same ; as the character at index (length of string - 1) - n, where n is less than or ; equal to (length of string) / 2. ; ; This is a case-sensitive palindrome check ; ; Receives: ; EDX: Offset of string array ; EBX: Number of characters in string ; ; Returns: ; ; Requires: .data palMsg byte "The string is a palindrome.",0 notPalMsg byte "The string is not a palindrome.",0 .code push ebx push esi push eax ; ESI will hold the first index to compare mov esi, 0 ; EBX will hold the second movzx ebx, byte ptr [ebx] dec ebx ; We're going to loop through as many elements as there ; are in the string, push ecx mov ecx, ebx ; Loop through the string, comparing elements at front and back L1: mov al, byte ptr [edx + esi] cmp al, byte ptr [edx + ebx] jne notPalindrome inc esi dec ebx cmp esi, ebx jae palindrome ; If esi (first index) is greater than or equal to ; ebx (second index), we're done. LOOP L1 palindrome: ; Write results to screen push edx mov edx, offset palMsg call WriteString call crlf call waitmsg jmp complete notPalindrome: push edx mov edx, offset notPalMsg call WriteString call crlf call waitmsg complete: pop edx pop ecx pop eax pop esi pop ebx ret option5 endp option6 proc uses edx .data option5prompt byte 'The String is: ', 0h .code push edx mov edx, offset option5prompt call writestring pop edx call writestring call crlf call waitmsg ret option6 endp END main
src/fot/FOTC/Program/SortList/CorrectnessProofI.agda
asr/fotc
11
5641
<filename>src/fot/FOTC/Program/SortList/CorrectnessProofI.agda ------------------------------------------------------------------------------ -- The program to sort a list is correct ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- This module prove the correctness of a program which sorts a list -- by converting it into an ordered tree and then back to a list -- (Burstall 1969, p. 45). module FOTC.Program.SortList.CorrectnessProofI where open import FOTC.Base open import FOTC.Data.Nat.List.Type open import FOTC.Program.SortList.PropertiesI open import FOTC.Program.SortList.Properties.Totality.TreeI open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ -- Main theorem: The sort program generates an ordered list. sortCorrect : ∀ {is} → ListN is → OrdList (sort is) sortCorrect {is} Lis = subst OrdList refl (flatten-OrdList (makeTree-Tree Lis) (makeTree-OrdTree Lis)) ------------------------------------------------------------------------------ -- References -- -- <NAME>. (1969). Proving properties of programs by -- structural induction. The Computer Journal 12.1, pp. 41–48.
software/hal/boards/pixracer_v1/hil/hil-uart.adb
TUM-EI-RCS/StratoX
12
10149
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: <NAME> (<EMAIL>) pragma SPARK_Mode (Off); with STM32.USARTs; with STM32.Device; with HIL.Devices; use HIL.Devices; -- @summary -- Target-specific mapping for HIL of UART package body HIL.UART with SPARK_Mode => Off is procedure configure is begin -- USART 1 (wifi) STM32.USARTs.Enable (STM32.Device.USART_1); STM32.USARTs.Set_Stop_Bits (STM32.Device.USART_1, STM32.USARTs.Stopbits_1); STM32.USARTs.Set_Word_Length (STM32.Device.USART_1, STM32.USARTs.Word_Length_8); STM32.USARTs.Set_Parity (STM32.Device.USART_1, STM32.USARTs.No_Parity); STM32.USARTs.Set_Baud_Rate (STM32.Device.USART_1, 115_200); STM32.USARTs.Set_Oversampling_Mode (STM32.Device.USART_1, STM32.USARTs.Oversampling_By_16); STM32.USARTs.Set_Mode (STM32.Device.USART_1, STM32.USARTs.Tx_Rx_Mode); STM32.USARTs.Set_Flow_Control (STM32.Device.USART_1, STM32.USARTs.No_Flow_Control); -- USART 2 (tele 1) STM32.USARTs.Enable (STM32.Device.USART_2); STM32.USARTs.Set_Stop_Bits (STM32.Device.USART_2, STM32.USARTs.Stopbits_1); STM32.USARTs.Set_Word_Length (STM32.Device.USART_2, STM32.USARTs.Word_Length_8); STM32.USARTs.Set_Parity (STM32.Device.USART_2, STM32.USARTs.No_Parity); STM32.USARTs.Set_Baud_Rate (STM32.Device.USART_2, 57_600); STM32.USARTs.Set_Oversampling_Mode (STM32.Device.USART_2, STM32.USARTs.Oversampling_By_16); STM32.USARTs.Set_Mode (STM32.Device.USART_2, STM32.USARTs.Tx_Rx_Mode); STM32.USARTs.Set_Flow_Control (STM32.Device.USART_2, STM32.USARTs.No_Flow_Control); -- USART 3 (tele 2) STM32.USARTs.Enable (STM32.Device.USART_3); STM32.USARTs.Set_Stop_Bits (STM32.Device.USART_3, STM32.USARTs.Stopbits_1); STM32.USARTs.Set_Word_Length (STM32.Device.USART_3, STM32.USARTs.Word_Length_8); STM32.USARTs.Set_Parity (STM32.Device.USART_3, STM32.USARTs.No_Parity); STM32.USARTs.Set_Baud_Rate (STM32.Device.USART_3, 115_200); STM32.USARTs.Set_Oversampling_Mode (STM32.Device.USART_3, STM32.USARTs.Oversampling_By_16); STM32.USARTs.Set_Mode (STM32.Device.USART_3, STM32.USARTs.Tx_Rx_Mode); STM32.USARTs.Set_Flow_Control (STM32.Device.USART_3, STM32.USARTs.No_Flow_Control); -- UART 4 (GPS) STM32.USARTs.Enable (STM32.Device.UART_4); STM32.USARTs.Set_Stop_Bits (STM32.Device.UART_4, STM32.USARTs.Stopbits_1); STM32.USARTs.Set_Word_Length (STM32.Device.UART_4, STM32.USARTs.Word_Length_8); STM32.USARTs.Set_Parity (STM32.Device.UART_4, STM32.USARTs.No_Parity); STM32.USARTs.Set_Baud_Rate (STM32.Device.UART_4, 38_400); STM32.USARTs.Set_Oversampling_Mode (STM32.Device.UART_4, STM32.USARTs.Oversampling_By_16); STM32.USARTs.Set_Mode (STM32.Device.UART_4, STM32.USARTs.Tx_Rx_Mode); STM32.USARTs.Set_Flow_Control (STM32.Device.UART_4, STM32.USARTs.No_Flow_Control); -- USART 7 (Console) STM32.USARTs.Enable (STM32.Device.USART_7); STM32.USARTs.Set_Stop_Bits (STM32.Device.USART_7, STM32.USARTs.Stopbits_1); STM32.USARTs.Set_Word_Length (STM32.Device.USART_7, STM32.USARTs.Word_Length_8); STM32.USARTs.Set_Parity (STM32.Device.USART_7, STM32.USARTs.No_Parity); STM32.USARTs.Set_Baud_Rate (STM32.Device.USART_7, 115_200); STM32.USARTs.Set_Oversampling_Mode (STM32.Device.USART_7, STM32.USARTs.Oversampling_By_16); STM32.USARTs.Set_Mode (STM32.Device.USART_7, STM32.USARTs.Tx_Rx_Mode); STM32.USARTs.Set_Flow_Control (STM32.Device.USART_7, STM32.USARTs.No_Flow_Control); end configure; -- writes devices by internally mapping to U(S)ART ports procedure write (Device : in Device_ID_Type; Data : in Data_Type) is procedure write_to_port (port : in out STM32.USARTs.USART; Data : in Data_Type) is flag : constant STM32.USARTS.USART_Status_Flag := STM32.USARTs.USART_Status_Flag'First; -- ret : Boolean := STM32.USARTS.Status (port, flag); begin for i in Data'Range loop STM32.USARTs.Transmit (port, HAL.UInt9 (Data (i))); end loop; end write_to_port; begin case (Device) is when CONSOLE => write_to_port (STM32.Device.USART_7, Data); when TELE1 => write_to_port (STM32.Device.USART_2, Data); when TELE2 => write_to_port (STM32.Device.USART_3, Data); when WIFI => write_to_port (STM32.Device.USART_1, Data); when GPS => write_to_port (STM32.Device.UART_4, Data); end case; end write; -- reads devices by internally mapping to U(S)ART ports procedure read (Device : in Device_ID_Type; Data : out Data_Type; n_read : out Natural) is procedure read_from_port (port : in out STM32.USARTs.USART; Data : out Data_Type; n_read : out Natural) is begin for i in Data'Range loop STM32.USARTs.Receive (port, HAL.UInt9 (Data (i))); end loop; n_read := Data'Length; end read_from_port; begin case (Device) is when CONSOLE => read_from_port (STM32.Device.USART_7, Data, n_read); when TELE1 => read_from_port (STM32.Device.USART_2, Data, n_read); when TELE2 => read_from_port (STM32.Device.USART_3, Data, n_read); when WIFI => read_from_port (STM32.Device.USART_1, Data, n_read); when GPS => read_from_port (STM32.Device.UART_4, Data, n_read); end case; end read; function toData_Type( Message : String ) return Data_Type is Bytes : Data_Type( Message'Range ) := (others => 0); begin for pos in Message'Range loop Bytes(pos) := Character'Pos( Message(pos) ); end loop; return Bytes; end toData_Type; end HIL.UART;
CS21/asm/1.asm
rizarae/rizarae.github.io
0
7398
<filename>CS21/asm/1.asm # LAB 1 # lab lab .text main: li $t1, 9 #load 9 to t1 li $t2, 38 #load 38 to t2 (displays 0x00000026) li $t3, -421 #load -421 to t3 (displays -421 in 2's complement) li $t4, 0x00001985 #loads 0x00001985 to t4 li $t5, 0xABCD0000 #loads 0xabcd0000 to t5 li $v0, 10 #syscall 10 (exit) syscall .data
ada homework2/src/coords.adb
jamalakhaligova/ADA
0
1077
<filename>ada homework2/src/coords.adb package body Coords is function Get_X(C: Coord) return Integer is begin return C.x; end; function Get_Y(C: Coord) return Integer is begin return C.y; end; procedure Set_X(C: out Coord;x_new : Integer) is begin C.x := x_new; end; procedure Set_Y(C: out Coord;y_new : Integer) is begin C.y := y_new; end; function Get_Distance(C_act, C_oth : Coord) return Integer is begin return ((C_oth.x - C_act.x)**2 + (C_oth.y - C_act.y)**2); end; procedure Change_To_Direction(CarDir : Cardinal_Direction ; C: in out Coord) is begin case CarDir is when N => C.y := C.y - 1; when S => C.y := C.y + 1; when E => C.x := C.x + 1; when W => C.x := C.x - 1; when NE => C.x := C.x + 1; C.y := C.y - 1; when SE => C.x := C.x + 1; C.y := C.y + 1; when SW => C.x := C.x - 1; C.y := C.y + 1; when NW => C.x := C.x - 1; C.y := C.y - 1; when others => -- error has already been signaled to user null; end case; end; function Coord_With_Array(Arr : Map;Coor : Coord) return Item is begin return Arr(Coor.x,Coor.y); end; end Coords;
programs/oeis/199/A199318.asm
karttu/loda
1
29271
; A199318: 3*6^n+1. ; 4,19,109,649,3889,23329,139969,839809,5038849,30233089,181398529,1088391169,6530347009,39182082049,235092492289,1410554953729,8463329722369,50779978334209,304679870005249,1828079220031489,10968475320188929 mov $1,6 pow $1,$0 mul $1,3 add $1,1
src/06-Horizontal-Position/horizontal.asm
HudsonSchumaker/Atari-2600
0
84262
<filename>src/06-Horizontal-Position/horizontal.asm<gh_stars>0 processor 6502 ; Include required files with register mapping and macros include "vcs.h" include "macro.h" ; Start an uninitialized segment at $80 for var declaration. ; We have memory from $80 to $FF to work with, minus a few at ; the end if we use the stack. seg.u Variables org $80 P0XPos byte ; sprite X coordinate ; Start our ROM code segment starting at $F000. seg Code org $F000 Reset: CLEAN_START ; macro to clean memory and TIA ldx #$88 ; light purple background color stx COLUBK ; Initialize variables lda #40 sta P0XPos ; initialize player X coordinate ;; Start a new frame by configuring VBLANK and VSYNC StartFrame: lda #2 sta VBLANK ; turn VBLANK on sta VSYNC ; turn VSYNC on ;; Display 3 vertical lines of VSYNC REPEAT 3 sta WSYNC ; first three VSYNC scanlines REPEND lda #0 sta VSYNC ; turn VSYNC off ; Set player horizontal position while in VBLANK ; Here we are using 2 WSYNCs (2 lines) of our 37 VBLANK lines lda P0XPos ; load register A with desired X position and #$7F ; same as AND 01111111, forces bit 7 to zero ; keeping the result positive sec ; set carry flag before subtraction sta WSYNC ; wait for next scanline sta HMCLR ; clear old horizontal position values DivideLoop: sbc #15 ; Subtract 15 from A bcs DivideLoop ; loop while carry flag is still set eor #7 ; adjust the remainder in A between -8 and 7 asl ; shift left by 4, as HMP0 uses only 4 bits asl asl asl sta HMP0 ; set player0 smooth position value sta RESP0 ; fix player0 rough position sta WSYNC ; wait for next scanline sta HMOVE ; apply fine position offset to all objects ;; Let the TIA output the remaining 35 lines of VBLANK (37 - 2) REPEAT 35 sta WSYNC REPEND lda #0 sta VBLANK ; turn VBLANK off ;; Draw the 192 visible scanlines REPEAT 60 sta WSYNC ; wait for 60 empty scanlines REPEND ldy 8 ; counter to draw 8 rows of bitmap DrawBitmap: lda P0Bitmap,Y ; load player bitmap slice of data sta GRP0 ; set graphics for player 0 slice lda P0Color,Y ; load player color from lookup table sta COLUP0 ; set color for player 0 slice sta WSYNC ; wait for next scanline dey bne DrawBitmap ; repeat next scanline until finished lda #0 sta GRP0 ; disable P0 bitmap graphics REPEAT 124 sta WSYNC ; wait for remaining 124 empty scanlines REPEND ; Output 30 more VBLANK overscan lines to complete our frame Overscan: lda #2 sta VBLANK ; turn VBLANK on again for overscan REPEAT 30 sta WSYNC REPEND ; Increment X coordinate if we are between 40 and 80 pixels lda P0XPos ; load A with the player current X position cmp #80 ; compare the value with 80 bpl ResetXPos ; if A is greater, then reset position jmp IncrmXPos ; else, continue to increment the position ResetXPos: lda #40 sta P0XPos ; reset the player X position to 40 IncrmXPos: inc P0XPos ; increment the player X position ; Loop to next frame jmp StartFrame ; Lookup table for the player graphics bitmap. P0Bitmap: byte #%00000000 byte #%00010000 byte #%00001000 byte #%00011100 byte #%00110110 byte #%00101110 byte #%00101110 byte #%00111110 byte #%00011100 ; Lookup table for the player colors. P0Color: byte #$00 byte #$02 byte #$02 byte #$52 byte #$52 byte #$52 byte #$52 byte #$52 byte #$52 ; Complete ROM size org $FFFC word Reset word Reset
oeis/142/A142385.asm
neoneye/loda-programs
11
241522
<reponame>neoneye/loda-programs ; A142385: Primes congruent to 34 mod 47. ; Submitted by <NAME> ; 269,457,739,1021,1303,1867,2243,2713,3089,3371,3559,4217,4969,6379,6473,6661,7507,7789,7883,8353,8447,9011,9199,9293,9857,10139,10891,11173,11549,11831,12113,12301,12583,12959,13147,13241,13523,13711,14087,14369,14557,15121,15497,16061,16249,17189,17377,17471,17659,18223,18787,19069,19163,19727,20479,21419,21701,22171,22453,23017,23581,23957,24239,24709,25367,25931,26119,26683,26777,27059,27529,28657,28751,29033,29221,29879,30161,30631,31477,32323,32887,33827,34297,34673,35801,36083,36929,37117 mov $1,50 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $1,10 sub $2,1 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,57 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,113
programs/oeis/290/A290604.asm
neoneye/loda
22
89356
<reponame>neoneye/loda ; A290604: a(0) = 2, a(1) = 2; for n > 1, a(n) = a(n-1) + 2*a(n-2) + 3. ; 2,2,9,16,37,72,149,296,597,1192,2389,4776,9557,19112,38229,76456,152917,305832,611669,1223336,2446677,4893352,9786709,19573416,39146837,78293672,156587349,313174696,626349397,1252698792,2505397589,5010795176,10021590357,20043180712,40086361429,80172722856,160345445717,320690891432,641381782869,1282763565736,2565527131477,5131054262952,10262108525909,20524217051816,41048434103637,82096868207272,164193736414549,328387472829096,656774945658197,1313549891316392,2627099782632789,5254199565265576,10508399130531157,21016798261062312,42033596522124629,84067193044249256,168134386088498517,336268772176997032,672537544353994069,1345075088707988136,2690150177415976277,5380300354831952552,10760600709663905109,21521201419327810216,43042402838655620437,86084805677311240872,172169611354622481749,344339222709244963496,688678445418489926997,1377356890836979853992,2754713781673959707989,5509427563347919415976,11018855126695838831957,22037710253391677663912,44075420506783355327829,88150841013566710655656,176301682027133421311317,352603364054266842622632,705206728108533685245269,1410413456217067370490536,2820826912434134740981077,5641653824868269481962152,11283307649736538963924309,22566615299473077927848616,45133230598946155855697237,90266461197892311711394472,180532922395784623422788949,361065844791569246845577896,722131689583138493691155797,1444263379166276987382311592,2888526758332553974764623189,5777053516665107949529246376,11554107033330215899058492757,23108214066660431798116985512,46216428133320863596233971029,92432856266641727192467942056,184865712533283454384935884117,369731425066566908769871768232,739462850133133817539743536469,1478925700266267635079487072936 mov $1,2 pow $1,$0 div $1,3 mul $1,7 add $1,2 mov $0,$1
src/PiCalculus/LinearTypeSystem/Algebras/Shared.agda
guilhermehas/typing-linear-pi
26
8373
{-# OPTIONS --safe --without-K #-} open import Relation.Binary.PropositionalEquality using (refl) open import Relation.Nullary using (yes) open import Data.Unit using (⊤; tt) open import Data.Product using (_,_) open import Data.Sum using (inj₁) open import PiCalculus.LinearTypeSystem.Algebras module PiCalculus.LinearTypeSystem.Algebras.Shared where pattern ω = tt Shared : Algebra ⊤ Algebra.0∙ Shared = ω Algebra.1∙ Shared = ω Algebra._≔_∙_ Shared _ _ _ = ⊤ Algebra.∙-computeʳ Shared _ _ = yes (ω , tt) Algebra.∙-unique Shared _ _ = refl Algebra.∙-uniqueˡ Shared _ _ = refl Algebra.0∙-minˡ Shared _ = refl Algebra.∙-idˡ Shared = tt Algebra.∙-comm Shared _ = tt Algebra.∙-assoc Shared _ _ = ω , tt , tt
Src/Ant8/Tests/aa8/basic/12_inc_r1.asm
geoffthorpe/ant-architecture
0
1248
<gh_stars>0 # $Id: 12_inc_r1.asm,v 1.3 2001/03/22 00:39:00 ellard Exp $ # # Copyright 1999-2001 by the President and Fellows of Harvard College. # See LICENSE.txt for license information. # #@ Testing inc for r1. # OK inc r1, 1 hlt
Categories/Diagram/Coend.agda
Taneb/agda-categories
0
1609
<reponame>Taneb/agda-categories {-# OPTIONS --without-K --safe #-} open import Categories.Category open import Categories.Functor.Bifunctor module Categories.Diagram.Coend {o ℓ e o′ ℓ′ e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′} (F : Bifunctor (Category.op C) C D) where private module C = Category C module D = Category D open D open HomReasoning variable A B : Obj f g : A ⇒ B open import Level open import Data.Product using (Σ; _,_) open import Categories.Functor open import Categories.Functor.Construction.Constant open import Categories.NaturalTransformation.Dinatural open import Categories.Morphism.Reasoning D open Functor F record Cowedge : Set (levelOfTerm F) where field E : Obj dinatural : DinaturalTransformation F (const E) module dinatural = DinaturalTransformation dinatural Cowedge-∘ : (W : Cowedge) → Cowedge.E W ⇒ A → Cowedge Cowedge-∘ {A = A} W f = record { E = A ; dinatural = extranaturalˡ (λ X → f ∘ dinatural.α X) (assoc ○ ∘-resp-≈ʳ (extranatural-commˡ dinatural) ○ ⟺ assoc) } where open Cowedge W record Coend : Set (levelOfTerm F) where field cowedge : Cowedge module cowedge = Cowedge cowedge open cowedge public open Cowedge field factor : (W : Cowedge) → cowedge.E ⇒ E W universal : ∀ {W : Cowedge} {A} → factor W ∘ cowedge.dinatural.α A ≈ dinatural.α W A unique : ∀ {W : Cowedge} {g : cowedge.E ⇒ E W} → (∀ {A} → g ∘ cowedge.dinatural.α A ≈ dinatural.α W A) → factor W ≈ g η-id : factor cowedge ≈ D.id η-id = unique identityˡ unique′ :(∀ {A} → f ∘ cowedge.dinatural.α A ≈ g ∘ cowedge.dinatural.α A) → f ≈ g unique′ {f = f} {g = g} eq = ⟺ (unique {W = Cowedge-∘ cowedge f} refl) ○ unique (⟺ eq)
programs/oeis/085/A085740.asm
karttu/loda
1
27344
<filename>programs/oeis/085/A085740.asm ; A085740: a(n) = T(n)^2 - n^2, where T(n) is a triangular number. ; 0,0,5,27,84,200,405,735,1232,1944,2925,4235,5940,8112,10829,14175,18240,23120,28917,35739,43700,52920,63525,75647,89424,105000,122525,142155,164052,188384,215325,245055,277760,313632,352869,395675,442260,492840,547637,606879,670800,739640,813645,893067,978164,1069200,1166445,1270175,1380672,1498224,1623125,1755675,1896180,2044952,2202309,2368575,2544080,2729160,2924157,3129419,3345300,3572160,3810365,4060287,4322304,4596800,4884165,5184795,5499092,5827464,6170325,6528095,6901200,7290072,7695149,8116875,8555700,9012080,9486477,9979359,10491200,11022480,11573685,12145307,12737844,13351800,13987685,14646015,15327312,16032104,16760925,17514315,18292820,19096992,19927389,20784575,21669120,22581600,23522597,24492699,25492500,26522600,27583605,28676127,29800784,30958200,32149005,33373835,34633332,35928144,37258925,38626335,40031040,41473712,42955029,44475675,46036340,47637720,49280517,50965439,52693200,54464520,56280125,58140747,60047124,62000000,64000125,66048255,68145152,70291584,72488325,74736155,77035860,79388232,81794069,84254175,86769360,89340440,91968237,94653579,97397300,100200240,103063245,105987167,108972864,112021200,115133045,118309275,121550772,124858424,128233125,131675775,135187280,138768552,142420509,146144075,149940180,153809760,157753757,161773119,165868800,170041760,174292965,178623387,183034004,187525800,192099765,196756895,201498192,206324664,211237325,216237195,221325300,226502672,231770349,237129375,242580800,248125680,253765077,259500059,265331700,271261080,277289285,283417407,289646544,295977800,302412285,308951115,315595412,322346304,329204925,336172415,343249920,350438592,357739589,365154075,372683220,380328200,388090197,395970399,403970000,412090200,420332205,428697227,437186484,445801200,454542605,463411935,472410432,481539344,490799925,500193435,509721140,519384312,529184229,539122175,549199440,559417320,569777117,580280139,590927700,601721120,612661725,623750847,634989824,646380000,657922725,669619355,681471252,693479784,705646325,717972255,730458960,743107832,755920269,768897675,782041460,795353040,808833837,822485279,836308800,850305840,864477845,878826267,893352564,908058200,922944645,938013375,953265872,968703624 mov $1,$0 bin $0,2 mul $1,2 add $1,$0 mul $1,$0
source/gmp-c.ads
ytomino/gmp-ada
4
1378
with MPC.Generic_C; generic package GMP.C renames MPC.Generic_C;
base/agda/Base/Extensionality.agda
FreeProving/free-compiler
36
4860
module Base.Extensionality where open import Level using (Level) open import Relation.Binary.PropositionalEquality using (_≡_) -- Postualting extensionality is consistent with agdas underlying theory. postulate ext : ∀ {ℓ ℓ′ : Level} {A : Set ℓ} {B : A → Set ℓ′} {f g : (x : A) → B x} → (∀ (x : A) → f x ≡ g x) ----------------------- → f ≡ g
SOAS/ContextMaps/CategoryOfRenamings.agda
k4rtik/agda-soas
0
10569
-- The category of contexts and renamings module SOAS.ContextMaps.CategoryOfRenamings {T : Set} where open import SOAS.Common open import SOAS.Context {T} open import SOAS.Variable open import SOAS.ContextMaps.Combinators (ℐ {T}) open import Categories.Functor.Bifunctor open import Categories.Object.Initial open import Categories.Object.Coproduct open import Categories.Category.Cocartesian import Categories.Morphism -- The category of contexts and renamings, defined as the Lawvere theory -- associated with the clone of variables. In elementary terms it has -- contexts Γ, Δ as objects, and renamings Γ ↝ Δ ≜ Γ ~[ ℐ → ℐ ]↝ Δ as arrows. 𝔽 : Category 0ℓ 0ℓ 0ℓ 𝔽 = categoryHelper (record { Obj = Ctx ; _⇒_ = _↝_ ; _≈_ = λ {Γ} ρ₁ ρ₂ → ∀{α : T}{v : ℐ α Γ} → ρ₁ v ≡ ρ₂ v ; id = λ x → x ; _∘_ = λ ϱ ρ v → ϱ (ρ v) ; assoc = refl ; identityˡ = refl ; identityʳ = refl ; equiv = record { refl = refl ; sym = λ p → sym p ; trans = λ p q → trans p q } ; ∘-resp-≈ = λ{ {f = ρ₁} p₁ p₂ → trans (cong ρ₁ p₂) p₁ } }) module 𝔽 = Category 𝔽 using (op) renaming ( _∘_ to _∘ᵣ_ ; _≈_ to _≈ᵣ_ ; id to idᵣ ; ∘-resp-≈ to ∘-resp-≈ᵣ ) open 𝔽 public id′ᵣ : (Γ : Ctx) → Γ ↝ Γ id′ᵣ Γ = idᵣ {Γ} -- Category of context is co-Cartesian, given by the empty initial context and -- context concatenation as the monoidal product. 𝔽:Cocartesian : Cocartesian 𝔽 𝔽:Cocartesian = record { initial = record { ⊥ = ∅ ; ⊥-is-initial = record { ! = λ{()} ; !-unique = λ{ f {_} {()}} } } ; coproducts = record { coproduct = λ {Γ}{Δ} → record { A+B = Γ ∔ Δ ; i₁ = expandʳ Δ ; i₂ = expandˡ Γ ; [_,_] = copair ; inject₁ = λ{ {Θ}{ρ}{ϱ} → i₁-commute ρ ϱ _ } ; inject₂ = λ{ {Θ}{ρ}{ϱ} → i₂-commute ρ ϱ _ } ; unique = λ{ p₁ p₂ → unique {Γ}{Δ} _ _ _ p₁ p₂ _ } } } } where in₁ : (Γ Δ : Ctx) → Γ ↝ Γ ∔ Δ in₁ (α ∙ Γ) Δ new = new in₁ (α ∙ Γ) Δ (old v) = old (in₁ Γ Δ v) in₂ : (Γ Δ : Ctx) → Δ ↝ Γ ∔ Δ in₂ ∅ Δ v = v in₂ (α ∙ Γ) Δ v = old (in₂ Γ Δ v) i₁-commute : {Γ Δ Θ : Ctx}{α : T}(ρ : Γ ↝ Θ)(ϱ : Δ ↝ Θ)(v : ℐ α Γ) → copair ρ ϱ (expandʳ Δ v) ≡ ρ v i₁-commute ρ ϱ new = refl i₁-commute ρ ϱ (old v) = i₁-commute (ρ ∘ old) ϱ v i₂-commute : {Γ Δ Θ : Ctx}{α : T}(ρ : Γ ↝ Θ)(ϱ : Δ ↝ Θ)(v : ℐ α Δ) → copair ρ ϱ (expandˡ Γ v) ≡ ϱ v i₂-commute {∅} ρ ϱ v = refl i₂-commute {α ∙ Γ} ρ ϱ v = i₂-commute (ρ ∘ old) ϱ v unique : {Γ Δ Θ : Ctx}{α : T}(ρ : Γ ↝ Θ)(ϱ : Δ ↝ Θ)(π : Γ ∔ Δ ↝ Θ) → (π ∘ᵣ expandʳ Δ ≈ᵣ ρ) → (π ∘ᵣ expandˡ Γ ≈ᵣ ϱ) → (v : ℐ α (Γ ∔ Δ)) → copair ρ ϱ v ≡ π v unique {∅} ρ ϱ π p₁ p₂ v = sym p₂ unique {α ∙ Γ} ρ ϱ π p₁ p₂ new = sym p₁ unique {α ∙ Γ} ρ ϱ π p₁ p₂ (old v) = unique (ρ ∘ old) ϱ (π ∘ old) p₁ p₂ v module 𝔽:Co = Cocartesian 𝔽:Cocartesian module ∔ = BinaryCoproducts (Cocartesian.coproducts 𝔽:Cocartesian) -- | Special operations coming from the coproduct structure -- Concatenation is a bifunctor ∔:Bifunctor : Bifunctor 𝔽 𝔽 𝔽 ∔:Bifunctor = 𝔽:Co.-+- -- Left context concatenation functor Γ ∔ (-) : 𝔽 ⟶ 𝔽, for any context Γ _∔F- : Ctx → Functor 𝔽 𝔽 Γ ∔F- = Γ ∔.+- -- Right context concatenation functor (-) ∔ Δ : 𝔽 ⟶ 𝔽, for any context Δ -∔F_ : Ctx → Functor 𝔽 𝔽 -∔F Δ = ∔.-+ Δ -- Functorial mapping and injections _∣∔∣_ : {Γ₁ Γ₂ Δ₁ Δ₂ : Ctx}(ρ : Γ₁ ↝ Γ₂)(ϱ : Δ₁ ↝ Δ₂) → (Γ₁ ∔ Δ₁) ↝ (Γ₂ ∔ Δ₂) _∣∔∣_ = ∔._+₁_ _∣∔_ : {Γ₁ Γ₂ : Ctx}(ρ : Γ₁ ↝ Γ₂)(Δ : Ctx) → (Γ₁ ∔ Δ) ↝ (Γ₂ ∔ Δ) ρ ∣∔ Δ = ρ ∣∔∣ id′ᵣ Δ _∔∣_ : {Δ₁ Δ₂ : Ctx}(Γ : Ctx)(ϱ : Δ₁ ↝ Δ₂) → (Γ ∔ Δ₁) ↝ (Γ ∔ Δ₂) Γ ∔∣ ϱ = id′ᵣ Γ ∣∔∣ ϱ inl : (Γ {Δ} : Ctx) → Γ ↝ Γ ∔ Δ inl Γ {Δ} v = ∔.i₁ {Γ}{Δ} v inr : (Γ {Δ} : Ctx) → Δ ↝ Γ ∔ Δ inr Γ {Δ} v = ∔.i₂ {Γ}{Δ} v -- Left context concatenation represents weakening a variable in Γ by an -- arbitrary new context Θ to get a variable in context (Θ ∔ Γ). module Concatˡ Γ = Functor (Γ ∔F-) using () renaming ( F₁ to _∔ᵣ_ ; identity to ∔identity ; homomorphism to ∔homomorphism ; F-resp-≈ to ∔F-resp-≈) open Concatˡ public -- Context extension represents weakening by a single type, and it's a special -- case of context concatenation with a singleton context. module Ext τ = Functor (⌊ τ ⌋ ∔F-) using () renaming ( F₁ to _∙ᵣ_ ; identity to ∙identity ; homomorphism to ∙homomorphism ; F-resp-≈ to ∙F-resp-≈) open Ext public -- The two coincide (since add is a special case of copair) -- but not definitionally: ∙ᵣ is the parallel sum of id : ⌊ τ ⌋ ↝ ⌊ τ ⌋ and ρ : Γ ↝ Δ -- (i.e. the copairing of expandʳ ⌊ τ ⌋ Δ : ⌊ τ ⌋ ↝ τ ∙ Δ and old ∘ ρ : Γ ↝ τ ∙ Δ) -- while liftᵣ is the copairing of new : ⌊ τ ⌋ ↝ τ ∙ Δ and old ∘ ρ : Γ ↝ τ ∙ Δ ∙ᵣ-as-add : {α τ : T}{Γ Δ : Ctx} → (ρ : Γ ↝ Δ)(v : ℐ α (τ ∙ Γ)) → add new (old ∘ ρ) v ≡ (τ ∙ᵣ ρ) v ∙ᵣ-as-add ρ new = refl ∙ᵣ-as-add ρ (old v) = refl -- Making this a definitional equality simplifies things significantly -- Right context concatenation is possible but rarely needed. module Concatʳ Δ = Functor (-∔F Δ )
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/nested_generic1_pkg.ads
best08618/asylo
7
24427
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/nested_generic1_pkg.ads generic package Nested_Generic1_Pkg is type Element_Renderer is access procedure; generic procedure Image_Generic (Renderer : in not null Element_Renderer); end Nested_Generic1_Pkg;
src/ship.adb
drm343/Space-War-3000
2
6747
package body ship is -------------------------------------- -- Build Ship -------------------------------------- function is_Colony return Ship_Data is result: Ship_Data := (Colony, 1, 2, 0, 0); begin return result; end is_Colony; -------------------------------------- function is_StarShip return Ship_Data is result: Ship_Data := (StarShip, 1, 0, 1, 1); begin return result; end is_StarShip; -------------------------------------- function is_Station return Ship_Data is result: Ship_Data := (Station, 2, 0, 2, 2); begin return result; end is_Station; -------------------------------------- -- ShipData Operator -------------------------------------- function show_me_ship_type (ship: in Ship_Data) return String is begin return Ship_Type'Image (ship.name); end show_me_ship_type; function show_me_ship_data (ship: in Ship_Data; modify: in Ship_Modify) return Integer is begin case modify is when colony => return ship.colony; when grid => return ship.grid; when max => return ship.max; when others => return ship.build; end case; end show_me_ship_data; procedure modify_ship_data (ship: in out Ship_Data; modify: in Ship_Modify; num: Integer) is begin case modify is when colony => ship.colony := ship.colony + num; when grid => ship.grid := ship.grid + num; when max => ship.max := ship.max + num; when others => ship.build := ship.build + num; end case; end modify_ship_data; end ship;
PropLogic.agda
onestruggler/Kalmar
0
12027
-- This file comes from the agda class taught by <NAME> at -- Dalhousie University. It contains a bonus question that -- propostional logic is complete. We will show this in -- Kalmar.agda. -- The course link: -- https://www.mathstat.dal.ca/~selinger/agda-lectures/ {-# OPTIONS --without-K --safe #-} module PropLogic where -- We replace the library (lib-3.0) used in class by the stdlib v2. -- open import Equality open import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; inspect ; [_] ; trans ; sym) -- open import Nat open import Data.Nat using (ℕ) -- open import Bool -- renaming and defining new connectives. open import Data.Bool renaming(_∧_ to _and_ ; _∨_ to _or_) using (Bool ; not ; true ; false) _implies_ : Bool → Bool → Bool _implies_ a b = not a or b -- ---------------------------------------------------------------------- -- * Introduction -- In this project, we will formalize boolean (i.e., classical) -- propositional logic, define a notion of derivation for the logic, -- give a semantics for the logic in terms of truth tables (also known -- as boolean assignments), and prove the soundness of the derivation -- rules. -- ---------------------------------------------------------------------- -- * The set of boolean formulas -- We start by defining the set of boolean formulas. Informally, the -- formulas are given by the following grammar: -- -- Formula A, B ::= P n | A ∧ B | A ⇒ B | ⊥ | ⊤ -- -- Here, n is a natural number, and P n is the nth propositional -- symbol. A ∧ B is conjunction, A ⇒ B is implication, ⊥ is "false" -- (also known as a contradiction), and ⊤ is "true". You can type -- these symbols in Emacs Agda mode using \and, \=>, \bot, and \top. -- Note that the symbol "⊤" is not the same as the capital letter "T". -- The set of propositional formulas as an Agda datatype: data Formula : Set where P : ℕ -> Formula _∧_ : Formula -> Formula -> Formula _⇒_ : Formula -> Formula -> Formula ⊥ : Formula ⊤ : Formula ¬_ : Formula -> Formula _∨_ : Formula -> Formula -> Formula infixl 9 _∧_ infixr 8 _⇒_ infix 20 ¬_ -- ---------------------------------------------------------------------- -- * Derivations -- The most important concept in logic is that of derivability. -- "Derivation" is another word for "proof". If A₁, ..., Aₙ, B are -- formulas, we write -- -- A₁, ..., Aₙ ⊢ -- -- for the statement "the conclusion B can be derived from hypotheses -- A₁, ..., Aₙ". The symbol "⊢" is pronounced "entails", and we also -- say "A₁, ..., Aₙ entails B". You can type this symbol as \|- or -- \entails or \vdash. -- -- Although entailment "⊢" is somewhat similar to implication "⇒", -- there is an important difference: an implication A ⇒ B is a -- formula, so it could be used, for example, as a hypothesis or as a -- conclusion in a proof. Entailment is a statement about formulas, -- i.e., entailment means: there exists a proof of B from hypotheses -- A₁, ..., Aₙ. Entailment is not itself a formula; it is a statement -- about provability. Thus, entailment is a relation between a list of -- formulas (the hypotheses) and a formula (the conclusion). -- ---------------------------------------------------------------------- -- ** Contexts -- Before we can formalize entailment, we must formalize lists of -- formulas. A list of formulas is also called a "context". We -- write Γ for an arbitrary context. -- -- Because a context can also be empty (a list of zero formulas), it -- is convenient to use the empty context as the base case. Then we -- can give the following recursive definition of contexts: a context -- is either the empty context, or it is obtained from another context -- by adding one more formula on the right. In other words, we have -- the following grammar for contexts: -- -- Context Γ ::= Empty | Γ, A -- -- We formalize this as the following Agda datatype: {- data Context : Set where Empty : Context _,_ : Context -> Formula -> Context -} -- Modification: We use List Formula as Context instead of defining a -- new data type. This will ease the proof using list with distinct -- elements. open import Data.List using (List ; _∷_ ; []) Context = List Formula infixl 7 _,_ -- _,_ : Context -> Formula -> Context -- _,_ Γ F = F ∷ Γ pattern _,_ Γ F = F ∷ Γ pattern Empty = [] -- We also need the membership relation for contexts. We define the -- relation A ∈ Γ to mean "the formula A is in the context Γ". The -- symbol ∈ is typed as \in. The membership relation can be -- recursively defined as follows: the empty context has no members, -- and the members of the context Γ, A are A and the members of -- Γ. More formally, we have the following inference rules for -- membership: -- -- ───────────── (∈-base) -- A ∈ Γ, A -- -- -- A ∈ Γ -- ───────────── (∈-step) -- A ∈ Γ, B -- -- An inference rule, written with a horizontal line, has the -- following meaning: if the (zero or more) statements above the line -- are true, then the statement below the line is true. The statements -- above the line are called the hypotheses of the inference rule, and -- the statement below the line is called the conclusion. The name of -- each inference rule (e.g., ∈-base, ∈-step) is written next to the -- rule. We use inference rules to define a relation, in this case the -- relation "∈". By definition, "∈" is the smallest relation -- satisfying (∈-base) and (∈-step). -- -- We can directly translate these inference rules into Agda as -- follows: data _∈_ : Formula -> Context -> Set where ∈-base : ∀ {A : Formula} {Γ : Context} -> A ∈ (Γ , A) ∈-step : ∀ {A B : Formula} {Γ : Context} -> A ∈ Γ -> A ∈ (Γ , B) infixl 6 _∈_ -- ---------------------------------------------------------------------- -- ** Entailment -- We now define the entailment relation. Recall that the entailment -- relation Γ ⊢ A is supposed to mean "the conclusion A can be derived -- from the hypotheses Γ". Defining entailment therefore requires us -- to formalize what we mean by "derived". In other words, we have to -- give a set of proof rules for propositional logic. Let me first -- write these proof rules in the style of inference rules. These -- rules define the relation "⊢": -- -- A ∈ Γ -- ───────────── (assump) -- Γ ⊢ A -- -- -- Γ ⊢ A Γ ⊢ B -- ───────────────── (∧-intro) -- Γ ⊢ A ∧ B -- -- -- Γ ⊢ A ∧ B -- ───────────────── (∧-elim1) -- Γ ⊢ A -- -- -- Γ ⊢ A ∧ B -- ───────────────── (∧-elim2) -- Γ ⊢ B -- -- -- Γ, A ⊢ B -- ───────────────── (⇒-intro) -- Γ ⊢ A ⇒ B -- -- -- Γ ⊢ A ⇒ B Γ ⊢ A -- ────────────────────────── (⇒-elim) -- Γ ⊢ B -- -- -- Γ ⊢ (A ⇒ ⊥) ⇒ ⊥ -- ────────────────────── (double-negation) -- Γ ⊢ A -- -- -- ───────────────── (⊤-intro) -- Γ ⊢ ⊤ -- -- -- The rule (assump) states that if A is one of the hypotheses, then A -- can be derived from the hypothesis. Basically A is true "by assumption". -- -- Several of the connectives, such as ∧ and ⇒, have an "introduction" -- rule, which shows how to prove such a formula, and an "elimination" -- rule, which shows how such a formula can be used to prove other -- things. The rule (∧-intro) states that to prove A ∧ B from the -- given hypotheses Γ, we must separately derive A and B. Conversely, -- the rules (∧-elim1) and (∧-elim2) state that if we have already -- derived A ∧ B, then we may separately conclude A and B. The rule -- (⇒-intro) states that to prove an implication A ⇒ B, we must assume -- A and prove B. In other words, to derive A ⇒ B from some hypotheses -- Γ, we must prove B from the hypotheses Γ, A. The rule (⇒-elim) is -- also known by its Latin name "modus ponens". It states that if we -- can prove A ⇒ B and we can also prove A, then we may conclude -- B. The rule (double-negation) is required to make the logic -- classical. Informally, it states that we can prove A by assuming -- "not A" and deriving a contradiction. Remember that "not A" is an -- abbreviation for (A ⇒ ⊥). The rule (⊤-intro) states that ⊤ can be -- derived from any set of hypotheses. -- We can directly translate the above rules into Agda: data _⊢_ : Context -> Formula -> Set where assump : ∀ {Γ A} -> A ∈ Γ -> Γ ⊢ A ∧-intro : ∀ {Γ A B} -> Γ ⊢ A -> Γ ⊢ B -> Γ ⊢ A ∧ B ∧-elim1 : ∀ {Γ A B} -> Γ ⊢ A ∧ B -> Γ ⊢ A ∧-elim2 : ∀ {Γ A B} -> Γ ⊢ A ∧ B -> Γ ⊢ B ⇒-intro : ∀ {Γ A B} -> Γ , A ⊢ B -> Γ ⊢ A ⇒ B ⇒-elim : ∀ {Γ A B} -> Γ ⊢ A ⇒ B -> Γ ⊢ A -> Γ ⊢ B double-negation : ∀ {Γ A} -> Γ ⊢ (A ⇒ ⊥) ⇒ ⊥ -> Γ ⊢ A ⊤-intro : ∀ {Γ} -> Γ ⊢ ⊤ ¬-intro : ∀ {Γ A} -> Γ , A ⊢ ⊥ -> Γ ⊢ ¬ A ¬-elim : ∀ {Γ A} -> Γ ⊢ ¬ A -> Γ ⊢ A -> Γ ⊢ ⊥ ∨-intro1 : ∀ {Γ A B} -> Γ ⊢ A -> Γ ⊢ A ∨ B ∨-intro2 : ∀ {Γ A B} -> Γ ⊢ B -> Γ ⊢ A ∨ B ∨-elim : ∀ {Γ A B C} -> Γ ⊢ A ∨ B -> Γ , A ⊢ C -> Γ , B ⊢ C -> Γ ⊢ C infixl 4 _⊢_ -- ---------------------------------------------------------------------- -- ** Weakening -- "Weakening" is the property that if we add additional hypotheses to -- an entailment (or change their order), the entailment remains valid. -- More formally, weakening states that Γ ⊢ A and Γ ⊆ Γ' implies Γ' ⊢ A. -- -- To state weakening, we must first define ⊆. The symbol ⊆ can be -- typed as \subseteq or \seq. _⊆_ : Context -> Context -> Set Γ ⊆ Γ' = ∀ {A} -> A ∈ Γ -> A ∈ Γ' infix 4 _⊆_ -- We need a lemma about ⊆: lemma-⊆ : ∀ {Γ Γ' A} -> Γ ⊆ Γ' -> Γ , A ⊆ Γ' , A lemma-⊆ hyp ∈-base = ∈-base lemma-⊆ hyp (∈-step hyp2) = ∈-step (hyp hyp2) lemma-⊆-ext : ∀ {Γ Γ' A} -> Γ ⊆ Γ' -> Γ ⊆ Γ' , A lemma-⊆-ext hyp = \ x -> ∈-step (hyp x) lemma-⊆-ext' : ∀ {Γ A} -> Γ ⊆ Γ , A lemma-⊆-ext' = lemma-⊆-ext \ x -> x lemma-⊆-empty : ∀ {Γ} -> Empty ⊆ Γ lemma-⊆-empty {Γ} {A} () -- Prove the weakening lemma: weakening : ∀ {Γ Γ' A} -> Γ ⊢ A -> Γ ⊆ Γ' -> Γ' ⊢ A weakening (assump x) w = assump (w x) weakening (∧-intro d d₁) w = ∧-intro (weakening d w) (weakening d₁ w) weakening (∧-elim1 d) w = ∧-elim1 (weakening d w ) weakening (∧-elim2 d) w = ∧-elim2 (weakening d w) weakening (⇒-intro d) w = ⇒-intro (weakening d (lemma-⊆ w) ) weakening (⇒-elim d d₁) w = ⇒-elim (weakening d w ) (weakening d₁ w ) weakening (double-negation d) w = double-negation (weakening d w ) weakening ⊤-intro w = ⊤-intro weakening (¬-intro d) w = ¬-intro (weakening d (lemma-⊆ w ) ) weakening (¬-elim d e) w = ( ¬-elim (weakening d w) (weakening e w)) weakening (∨-intro1 d) w = ∨-intro1 (weakening d w) weakening (∨-intro2 d) w = ∨-intro2 (weakening d w) weakening (∨-elim d e f) w = ∨-elim (weakening d w) (weakening e (lemma-⊆ w)) (weakening f (lemma-⊆ w) ) -- ---------------------------------------------------------------------- -- ** A derived rule -- Classical logic also has the following rule, called "ex falsum -- quodlibet" or "⊥-elim". -- -- Γ ⊢ ⊥ -- ───────────────── (⊥-elim) -- Γ ⊢ A -- -- The reason we did not include it in the proof rules in the above -- definition of entailment it that it follows from the other rules. -- Prove it: ⊥-elim : ∀ {Γ A} -> Γ ⊢ ⊥ -> Γ ⊢ A ⊥-elim {Γ} {A} a = double-negation a-⊥-⊥ where a-⊥ : Γ ⊢ A ⇒ ⊥ a-⊥ = ⇒-intro (weakening a (lemma-⊆-ext \ x -> x ) ) a-⊥-⊥ : Γ ⊢ (A ⇒ ⊥) ⇒ ⊥ a-⊥-⊥ = ⇒-intro (weakening a (lemma-⊆-ext \ x -> x ) ) -- ---------------------------------------------------------------------- -- * Truth table semantics -- ---------------------------------------------------------------------- -- ** Truth assignments and interpretation -- Remember that the atomic formulas of our logic are P 0, P 1, P 2, -- and so on. The fundamental concept of truth tables is that of a -- "truth assignment", namely a map from atomic formulas to {T, F}. -- We usually denote a truth assignment by the letter ρ = \rho. -- -- We formalize truth assignments as maps from ℕ to Bool. Assign : Set Assign = ℕ -> Bool -- Given a truth assignment ρ, we can compute the truth value (true or -- false) of any given formula. This is called the "interpretation" of -- formulas. interp : Assign -> Formula -> Bool interp ρ (P x) = ρ x interp ρ (A ∧ B) = (interp ρ A) and (interp ρ B) interp ρ (A ⇒ B) = (interp ρ A) implies (interp ρ B) interp ρ ⊥ = false interp ρ ⊤ = true interp ρ (¬ A) = not (interp ρ A) interp ρ (A ∨ B) = (interp ρ A) or (interp ρ B) -- Lift the interp function to a list of formulas. We interpret a list -- of formulas basically as the conjunction of the formulas, i.e., the -- interpretation of Γ is true if and only if the interpretation of -- all A ∈ Γ is true. interps : Assign -> Context -> Bool interps ρ Empty = true interps ρ (c , x) = interps ρ c and interp ρ x -- ---------------------------------------------------------------------- -- ** Semantic entailment -- We write Γ ⊧ A if under all assignments ρ, if Γ is true, then A is true. -- A special case is when the context Γ is empty. In that case, ⊧ A means -- that A is true under all assignments, i.e., A is a tautology. -- -- The symbol ⊧ is pronounced "models", and you can type it as -- \models. Please note that this is a different symbol from ⊨ = \|=. -- We use the symbol "⊧" here. -- -- The relation ⊧ is also called "semantic entailment" or "truth table -- entailment", to distinguish it from ⊢, which is "syntactic -- entailment" or "derivability". -- We define semantic entailment. -- _⊧_ : Context -> Formula -> Set -- Γ ⊧ A = ∀ ρ -> interps ρ Γ ≡ true -> interp ρ A ≡ true _⊧_ : Context -> Formula -> Set Γ ⊧ f = (ρ : Assign) -> interps ρ Γ ≡ true -> interp ρ f ≡ true infix 4 _⊧_ -- ---------------------------------------------------------------------- -- * Soundness -- ---------------------------------------------------------------------- -- ** Lemmas about the boolean connectives -- The boolean functions 'and' and 'implies' are defined in Bool.agda. -- We need to know certain ones of their properties. boolCases : {p : Set} -> (a : Bool) -> (a ≡ true -> p) -> (a ≡ false -> p) -> p boolCases true t f = t refl boolCases false t f = f refl lemma-and-1 : {a b : Bool} -> a ≡ true -> b ≡ true -> a and b ≡ true lemma-and-1 refl refl = refl lemma-and-2 : {a b : Bool} -> a and b ≡ true -> a ≡ true lemma-and-2 {true} {true} abt = refl lemma-and-3 : {a b : Bool} -> a and b ≡ true -> b ≡ true lemma-and-3 {true} {true} abt = refl lemma-imp-1 : {a b : Bool} -> a implies b ≡ true -> a ≡ true -> b ≡ true lemma-imp-1 {true} {true} aibt at = refl lemma-imp-2 : {a b : Bool} -> a ≡ false -> a implies b ≡ true lemma-imp-2 {false} {true} af = refl lemma-imp-2 {false} {false} af = refl lemma-imp-3 : {a b : Bool} -> b ≡ true -> a implies b ≡ true lemma-imp-3 {true} {true} bt = refl lemma-imp-3 {false} {b} bt = refl lemma-doubleNeg : {a : Bool} -> (a implies false) implies false ≡ true -> a ≡ true lemma-doubleNeg {true} a-f-ft = refl lemma-not-true : {a : Bool} -> a ≡ true -> not a ≡ false lemma-not-true {.true} refl = refl lemma-not-false : {a : Bool} -> a ≡ false -> not a ≡ true lemma-not-false {.false} refl = refl lemma-or-1 : {a b : Bool} -> a ≡ true -> a or b ≡ true lemma-or-1 refl = refl lemma-or-2 : {a b : Bool} -> b ≡ true -> a or b ≡ true lemma-or-2 {true} {.true} refl = refl lemma-or-2 {false} {.true} refl = refl -- like boolCases lemma-or-3 : {C : Set} -> {a b : Bool} -> a or b ≡ true -> (a ≡ true -> C) -> (b ≡ true -> C) -> C lemma-or-3 {a = true} {true} aob ca cb = ca aob lemma-or-3 {a = false} {true} aob ca cb = cb aob lemma-or-3 {a = true} {false} aob ca cb = ca refl -- ---------------------------------------------------------------------- -- ** Lemmas about the soundness of individual rules -- Each of the proof rules of logic has a semantic counterpart. lemma-assump : ∀ Γ A -> A ∈ Γ -> Γ ⊧ A lemma-assump (._ , A) A ∈-base = \ ρ ct -> lemma-and-3 ct lemma-assump (Γ' , B) A (∈-step hyp) = \ ρ ct -> (lemma-assump Γ' A hyp) ρ (lemma-and-2 ct ) lemma-∧-intro : ∀ Γ A B -> Γ ⊧ A -> Γ ⊧ B -> Γ ⊧ A ∧ B lemma-∧-intro Γ A B as bs = \ ρ ct -> lemma-and-1 (as ρ ct ) (bs ρ ct ) lemma-∧-elim1 : ∀ Γ A B -> Γ ⊧ A ∧ B -> Γ ⊧ A lemma-∧-elim1 Γ A B abs = \ ρ ct -> lemma-and-2 (abs ρ ct) lemma-∧-elim2 : ∀ Γ A B -> Γ ⊧ A ∧ B -> Γ ⊧ B lemma-∧-elim2 Γ A B abs = \ ρ ct -> lemma-and-3 (abs ρ ct) lemma-⇒-intro' : ∀ Γ A B -> Γ , A ⊧ B -> Γ ⊧ A ⇒ B lemma-⇒-intro' Γ A B a-bs ρ ct = boolCases (interp ρ A) (\ x -> lemma-imp-3 (a-bs ρ (lemma-and-1 ct x ) ) ) \ x -> lemma-imp-2 x lemma-⇒-intro : ∀ Γ A B -> Γ , A ⊧ B -> Γ ⊧ A ⇒ B lemma-⇒-intro Γ A B a-bs ρ ct with (interp ρ) A | inspect (interp ρ) A lemma-⇒-intro Γ A B a-bs ρ ct | true | [ eq ] = lemma-imp-3 (a-bs ρ (lemma-and-1 ct eq ) ) lemma-⇒-intro Γ A B a-bs ρ ct | false | [ eq ] = refl lemma-⇒-elim : ∀ Γ A B -> Γ ⊧ A ⇒ B -> Γ ⊧ A -> Γ ⊧ B lemma-⇒-elim Γ A B a-bs as = \ ρ ct -> lemma-imp-1 (a-bs ρ ct ) (as ρ ct ) lemma-double-negation : ∀ Γ A -> Γ ⊧ (A ⇒ ⊥) ⇒ ⊥ -> Γ ⊧ A lemma-double-negation Γ A anns = \ ρ ct -> lemma-doubleNeg (anns ρ ct ) lemma-⊤-intro : ∀ Γ -> Γ ⊧ ⊤ lemma-⊤-intro Γ = \ ρ ct -> refl lemma-¬-intro : ∀ Γ A -> Γ , A ⊧ ⊥ -> Γ ⊧ ¬ A lemma-¬-intro Γ A a ρ ct with (interp ρ) A | inspect (interp ρ) A lemma-¬-intro Γ A a ρ ct | true | [ eq ] = a ρ (lemma-and-1 ct eq) lemma-¬-intro Γ A a ρ ct | false | [ eq ] = refl lemma-¬-intro' : ∀ Γ A -> Γ , A ⊧ ⊥ -> Γ ⊧ ¬ A lemma-¬-intro' Γ A a ρ ct = boolCases (interp ρ A) (\x -> trans (lemma-not-true x ) (a ρ (lemma-and-1 ct x ) ) ) \ x -> lemma-not-false x lemma-¬-elim : ∀ Γ A -> Γ ⊧ ¬ A -> Γ ⊧ A -> Γ ⊧ ⊥ lemma-¬-elim Γ A a b ρ ct = boolCases (interp ρ A) (\ x -> trans (sym (lemma-not-true x)) (a ρ ct ) ) \ x -> trans (sym x ) (b ρ ct) lemma-∨-intro1 : ∀ Γ A B -> Γ ⊧ A -> Γ ⊧ A ∨ B lemma-∨-intro1 Γ A B a ρ ct = lemma-or-1 (a ρ ct ) lemma-∨-intro2 : ∀ Γ A B -> Γ ⊧ B -> Γ ⊧ A ∨ B lemma-∨-intro2 Γ A B a ρ ct = lemma-or-2 (a ρ ct ) lemma-∨-elim : ∀ Γ A B C -> Γ ⊧ A ∨ B -> Γ , A ⊧ C -> Γ , B ⊧ C -> Γ ⊧ C lemma-∨-elim Γ A B C aob ac bc ρ ct = lemma-or-3 (aob ρ ct) (\ x -> ac ρ (lemma-and-1 ct x ) ) \ x -> bc ρ (lemma-and-1 ct x ) -- ---------------------------------------------------------------------- -- * The soundness theorem of boolean logic. -- Soundness states that Γ ⊢ A implies Γ ⊧ A, or equivalently: -- everything that is provable is valid. -- 4. Prove the soundness of boolean logic. sound : ∀ Γ A -> Γ ⊢ A -> Γ ⊧ A sound Γ A (assump x) = lemma-assump Γ A x sound Γ (A ∧ B) (∧-intro hyp hyp₁) = lemma-∧-intro Γ A B (sound Γ A hyp) (sound Γ B hyp₁) sound Γ A (∧-elim1 {B = B} hyp) = lemma-∧-elim1 Γ A B (sound Γ (A ∧ B) hyp ) sound Γ A (∧-elim2 {A = A₁} hyp) = lemma-∧-elim2 Γ A₁ A ((sound Γ (A₁ ∧ A) hyp ) ) sound Γ (A ⇒ B) (⇒-intro hyp) = lemma-⇒-intro Γ A B (sound (Γ , A) B hyp ) sound Γ A (⇒-elim {A = A₁} hyp hyp₁) = lemma-⇒-elim Γ A₁ A (sound Γ (A₁ ⇒ A) hyp ) (sound Γ A₁ hyp₁) sound Γ A (double-negation hyp) = lemma-double-negation Γ A (sound Γ ((A ⇒ ⊥) ⇒ ⊥) hyp) sound Γ .⊤ ⊤-intro = λ ρ _ → refl sound Γ (¬ A) (¬-intro x) = lemma-¬-intro' Γ A ((sound (Γ , A) ⊥ x ) ) sound Γ .⊥ (¬-elim {A = A} x y) = lemma-¬-elim Γ A (sound Γ (¬ A) x) (sound Γ A y) sound Γ (A ∨ B) (∨-intro1 x) = lemma-∨-intro1 Γ A B (sound Γ A x ) sound Γ (A ∨ B) (∨-intro2 x) = lemma-∨-intro2 Γ A B (sound Γ B x ) sound Γ C (∨-elim {A = A} {B} x y z) = lemma-∨-elim Γ A B C (sound Γ (A ∨ B) x ) (sound (Γ , A) C y ) (sound (Γ , B) C z) -- ---------------------------------------------------------------------- -- * Bonus questions and beyond -- If you feel adventurous, add more connectives, such as ¬A or A ∨ B, -- to the boolean logic. -- -- The proof rules are: -- -- Γ, A ⊢ ⊥ -- ────────────── (¬-intro) -- Γ ⊢ ¬A -- -- -- Γ ⊢ ¬A Γ ⊢ A -- ───────────────────── (¬-elim) -- Γ ⊢ ⊥ -- -- -- Γ ⊢ A -- ───────────── (∨-intro1) -- Γ ⊢ A ∨ B -- -- -- Γ ⊢ B -- ───────────── (∨-intro2) -- Γ ⊢ A ∨ B -- -- -- Γ ⊢ A ∨ B Γ, A ⊢ C Γ, B ⊢ C -- ─────────────────────────────────────── (∨-elim) -- Γ ⊢ C -- If you feel extremely ambitious, try to prove completeness, the -- converse of soundness. Completeness is the statement that Γ ⊧ A -- implies Γ ⊢ A. -- -- Warning: this is extremely difficult and far more work than -- soundness. Neither Frank nor I have been able to finish a proof of -- completeness. -- Actually, Peter had finished the proof a couple of days later using -- conjunction normal form. completeness-property : Set completeness-property = ∀ Γ A -> Γ ⊧ A -> Γ ⊢ A -- Now, I (Bian) will prove this property in Kalmar.agda using -- Kalmar's lemma.
bits/src/search/bitoperations-search.ads
vasil-sd/ada-tlsf
3
17438
with BitOperations.Types; with BitOperations.Shift; with BitOperations.Mask; with Interfaces; generic with package Types is new BitOperations.Types (<>); package BitOperations.Search with SPARK_Mode, Pure, Preelaborate is use Types; package Shift is new BitOperations.Shift(Types); package Mask is new BitOperations.Mask(Types); use Shift; function Most_Significant_Bit(Value : Modular) return Bit_Position with Pure_Function, Global => null, Pre => Value /= 0; end BitOperations.Search;
gcc-gcc-7_3_0-release/gcc/ada/g-bubsor.ads
best08618/asylo
7
26463
<filename>gcc-gcc-7_3_0-release/gcc/ada/g-bubsor.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . B U B B L E _ S O R T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2010, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Sort Utility (Using Bubblesort Algorithm) -- This package provides a bubblesort routine that works with access to -- subprogram parameters, so that it can be used with different types with -- shared sorting code. -- See also GNAT.Bubble_Sort_G and GNAT.Bubble_Sort_A. These are older -- versions of this routine. In some cases GNAT.Bubble_Sort_G may be a -- little faster than GNAT.Bubble_Sort, at the expense of generic code -- duplication and a less convenient interface. The generic version also -- has the advantage of being Pure, while this unit can only be Preelaborate. package GNAT.Bubble_Sort is pragma Pure; -- The data to be sorted is assumed to be indexed by integer values from -- 1 to N, where N is the number of items to be sorted. type Xchg_Procedure is access procedure (Op1, Op2 : Natural); -- A pointer to a procedure that exchanges the two data items whose -- index values are Op1 and Op2. type Lt_Function is access function (Op1, Op2 : Natural) return Boolean; -- A pointer to a function that compares two items and returns True if -- the item with index value Op1 is less than the item with Index value -- Op2, and False if the Op1 item is greater than or equal to the Op2 -- item. procedure Sort (N : Natural; Xchg : Xchg_Procedure; Lt : Lt_Function); -- This procedures sorts items in the range from 1 to N into ascending -- order making calls to Lt to do required comparisons, and calls to -- Xchg to exchange items. The sort is stable, that is the order of -- equal items in the input is preserved. end GNAT.Bubble_Sort;
programs/oeis/277/A277723.asm
neoneye/loda
22
102849
; A277723: a(n) = floor(n*tau^3) where tau is the tribonacci constant (A058265). ; 0,6,12,18,24,31,37,43,49,56,62,68,74,80,87,93,99,105,112,118,124,130,136,143,149,155,161,168,174,180,186,192,199,205,211,217,224,230,236,242,248,255,261,267,273,280,286,292,298,304,311,317,323,329,336,342,348,354,360,367,373,379,385,392,398,404,410,416,423,429,435,441,448,454,460,466,472,479,485,491,497,504,510,516,522,528,535,541,547,553,560,566,572,578,584,591,597,603,609,616 mov $1,56 mul $1,$0 div $1,9 mov $0,$1
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/title_main_usa.asm
prismotizm/gigaleak
0
9493
Name: title_main_usa.asm Type: file Size: 88494 Last-Modified: '1993-07-20T07:13:29Z' SHA-1: 5A2095BBAFB92188199B2070EC406C3162E60F27 Description: null
demos/predef.ada
daveshields/AdaEd
3
25358
<reponame>daveshields/AdaEd -- -- -- ********************************** -- * * -- * T e x t * -- * * -- * Input / Output Package * -- * * -- * and other * -- * * -- * Predefined Units * -- * * -- * * -- * ADA Project * -- * Courant Institute * -- * New York University * -- * 251 Mercer Street, * -- * New York, NY 10012 * -- * * -- ********************************** -- -- -- by -- -- <NAME> -- <NAME> -- <NAME> -- <NAME> -- <NAME> -- -- -- -- -- -- -- This file contains several of the predefined Ada package spec- -- ifications. They do not actually implement the package's -- operations, which are coded in the implementation language SETL, -- provide an interface to them through the standard procedure/ -- function calling mechanism. The predefined packages are: -- -- . The SYSTEM package. -- -- . The IO_EXCEPTIONS package. -- -- . The generic SEQUENTIAL_IO package. -- -- . The generic DIRECT_IO package. -- -- . The TEXT_IO package. -- -- . The CALENDAR package and the predefined subprograms -- UNCHECKED_CONVERSION and UNCHECKED_DEALLOCATION. -- package SYSTEM is type NAME is (ADA_ED); type ADDRESS is new INTEGER; SYSTEM_NAME : constant NAME := ADA_ED; STORAGE_UNIT : constant := 32; MEMORY_SIZE : constant := 2**30 - 1; -- System Dependent Named Numbers: MIN_INT : constant := -(2**30 - 1); MAX_INT : constant := 2**30 - 1; MAX_DIGITS : constant := 6; MAX_MANTISSA : constant := 1000; FINE_DELTA : constant := 2.0 ** (-30); TICK : constant := 0.01; -- Other System Dependent Declarations subtype PRIORITY is INTEGER range 0 .. 9; SYSTEM_ERROR : exception; end SYSTEM; package IO_EXCEPTIONS is STATUS_ERROR : exception; MODE_ERROR : exception; NAME_ERROR : exception; USE_ERROR : exception; DEVICE_ERROR : exception; END_ERROR : exception; DATA_ERROR : exception; LAYOUT_ERROR : exception; end IO_EXCEPTIONS; with IO_EXCEPTIONS; generic type ELEMENT_TYPE is private; package SEQUENTIAL_IO is type FILE_TYPE is limited private; type FILE_MODE is (IN_FILE, OUT_FILE); -- File management procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := OUT_FILE; NAME : in STRING := ""; FORM : in STRING := ""); procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := ""); procedure CLOSE (FILE : in out FILE_TYPE); procedure DELETE (FILE : in out FILE_TYPE); procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE); procedure RESET (FILE : in out FILE_TYPE); function MODE (FILE : in FILE_TYPE) return FILE_MODE; function NAME (FILE : in FILE_TYPE) return STRING; function FORM (FILE : in FILE_TYPE) return STRING; function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN; -- Input and Output Operations: procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE); procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE); function END_OF_FILE(FILE : in FILE_TYPE) return BOOLEAN; -- Exceptions: STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR; MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR; NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR; USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR; DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR; END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR; DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR; private type FILE_TYPE is record FILE_NUM : INTEGER := 0; end record; end SEQUENTIAL_IO; package body SEQUENTIAL_IO is -- The body for each procedure and function consists of an -- interface pragma which generates an AIS instruction of -- the form: -- -- ['predef_', specifier, [formal, formal, ...]] -- -- where the specifier is the second argument to the pragma -- in upper case, and the formals are the fully qualified -- names of the formal parameters to the subprogram. The -- specifier is used by the SETL INPUT_OUTPUT routines in -- determining which routine was called, and the formals are -- used for accessing and setting the values of the arguments -- to the subprogram. -- File management procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := OUT_FILE; NAME : in STRING := ""; FORM : in STRING := "") is begin pragma io_interface (PREDEF, SIO_CREATE, ELEMENT_TYPE); null; end CREATE; procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := "") is begin pragma io_interface (PREDEF, SIO_OPEN, ELEMENT_TYPE); null; end OPEN; procedure CLOSE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, SIO_CLOSE); null; end CLOSE; procedure DELETE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, SIO_DELETE); null; end DELETE; procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE) is begin pragma io_interface (PREDEF, SIO_RESET_MODE); null; end RESET; procedure RESET (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, SIO_RESET); null; end RESET; function MODE (FILE : in FILE_TYPE) return FILE_MODE is begin pragma io_interface (PREDEF, SIO_MODE); null; end MODE; function NAME (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, SIO_NAME); null; end NAME; function FORM (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, SIO_FORM); null; end FORM; function IS_OPEN(FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, SIO_IS_OPEN); null; end IS_OPEN; -- Input and Output Operations: procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE) is begin pragma io_interface (PREDEF, SIO_READ, ELEMENT_TYPE); null; end READ; procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE) is begin pragma io_interface (PREDEF, SIO_WRITE); null; end WRITE; function END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, SIO_END_OF_FILE); null; end END_OF_FILE; end SEQUENTIAL_IO; with IO_EXCEPTIONS; generic type ELEMENT_TYPE is private; package DIRECT_IO is type FILE_TYPE is limited private; type FILE_MODE is (IN_FILE, INOUT_FILE, OUT_FILE); type COUNT is range 0 .. INTEGER'LAST; subtype POSITIVE_COUNT is COUNT range 1 .. COUNT'LAST; -- File management procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := INOUT_FILE; NAME : in STRING := ""; FORM : in STRING := ""); procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := ""); procedure CLOSE (FILE : in out FILE_TYPE); procedure DELETE (FILE : in out FILE_TYPE); procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE); procedure RESET (FILE : in out FILE_TYPE); function MODE (FILE : in FILE_TYPE) return FILE_MODE; function NAME (FILE : in FILE_TYPE) return STRING; function FORM (FILE : in FILE_TYPE) return STRING; function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN; -- Input and Output Operations: procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE); procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE; FROM : in POSITIVE_COUNT); procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE); procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE; TO : in POSITIVE_COUNT); procedure SET_INDEX(FILE : in FILE_TYPE; TO :in POSITIVE_COUNT); function INDEX (FILE : in FILE_TYPE) return POSITIVE_COUNT; function SIZE (FILE : in FILE_TYPE) return COUNT; function END_OF_FILE(FILE : in FILE_TYPE) return BOOLEAN; -- Exceptions: STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR; MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR; NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR; USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR; DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR; END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR; DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR; private type FILE_TYPE is record FILE_NUM : INTEGER := 0; end record; end DIRECT_IO; package body DIRECT_IO is -- The body for each procedure and function consists of an -- interface pragma which generates an AIS instruction of -- the form: -- -- ['predef_', specifier, [formal, formal, ...]] -- -- where the specifier is the second argument to the pragma -- in upper case, and the formals are the fully qualified -- names of the formal parameters to the subprogram. The -- specifier is used by the SETL INPUT_OUTPUT routines in -- determining which routine was called, and the formals are -- used for accessing and setting the values of the arguments -- to the subprogram. -- File management procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := INOUT_FILE; NAME : in STRING := ""; FORM : in STRING := "") is begin pragma io_interface (PREDEF, DIO_CREATE, ELEMENT_TYPE); null; end CREATE; procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := "") is begin pragma io_interface (PREDEF, DIO_OPEN, ELEMENT_TYPE); null; end OPEN; procedure CLOSE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, DIO_CLOSE); null; end CLOSE; procedure DELETE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, DIO_DELETE); null; end DELETE; procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE) is begin pragma io_interface (PREDEF, DIO_RESET_MODE); null; end RESET; procedure RESET (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, DIO_RESET); null; end RESET; function MODE (FILE : in FILE_TYPE) return FILE_MODE is begin pragma io_interface (PREDEF, DIO_MODE); null; end MODE; function NAME (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, DIO_NAME); null; end NAME; function FORM (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, DIO_FORM); null; end FORM; function IS_OPEN(FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, DIO_IS_OPEN); null; end IS_OPEN; -- Input and Output Operations: procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE) is begin pragma io_interface (PREDEF, DIO_READ, ELEMENT_TYPE); null; end READ; procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE; FROM : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, DIO_READ_FROM, ELEMENT_TYPE); null; end READ; procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE) is begin pragma io_interface (PREDEF, DIO_WRITE); null; end WRITE; procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE; TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, DIO_WRITE_TO); null; end WRITE; procedure SET_INDEX(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, DIO_SET_INDEX); null; end SET_INDEX; function INDEX (FILE : in FILE_TYPE) return POSITIVE_COUNT is begin pragma io_interface (PREDEF, DIO_INDEX); null; end INDEX; function SIZE (FILE : in FILE_TYPE) return COUNT is begin pragma io_interface (PREDEF, DIO_SIZE); null; end SIZE; function END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, DIO_END_OF_FILE); null; end END_OF_FILE; end DIRECT_IO; with IO_EXCEPTIONS; package TEXT_IO is type FILE_TYPE is limited private; type FILE_MODE is (IN_FILE, OUT_FILE); type COUNT is range 0 .. INTEGER'LAST; subtype POSITIVE_COUNT IS COUNT range 1 .. COUNT'LAST; UNBOUNDED : constant COUNT := 0; -- line and page length subtype FIELD is INTEGER range 0 .. 100 ; subtype NUMBER_BASE is INTEGER range 2 .. 16; type TYPE_SET is (LOWER_CASE, UPPER_CASE); -- File Management procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := OUT_FILE; NAME : in STRING := ""; FORM : in STRING := ""); procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := ""); procedure CLOSE (FILE : in out FILE_TYPE); procedure DELETE (FILE : in out FILE_TYPE); procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE); procedure RESET (FILE : in out FILE_TYPE); function MODE (FILE : in FILE_TYPE) return FILE_MODE; function NAME (FILE : in FILE_TYPE) return STRING; function FORM (FILE : in FILE_TYPE) return STRING; function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN; -- Control of default input and output files procedure SET_INPUT (FILE : in FILE_TYPE); procedure SET_OUTPUT (FILE : in FILE_TYPE); function STANDARD_INPUT return FILE_TYPE; function STANDARD_OUTPUT return FILE_TYPE; function CURRENT_INPUT return FILE_TYPE; function CURRENT_OUTPUT return FILE_TYPE; -- Specification of line and page lengths procedure SET_LINE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT); procedure SET_LINE_LENGTH (TO : in COUNT); -- default output file procedure SET_PAGE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT); procedure SET_PAGE_LENGTH (TO : in COUNT); -- default output file function LINE_LENGTH (FILE : in FILE_TYPE) return COUNT; function LINE_LENGTH return COUNT; -- default output file function PAGE_LENGTH (FILE : in FILE_TYPE) return COUNT; function PAGE_LENGTH return COUNT; -- default output file -- Column, Line and Page Control procedure NEW_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1); procedure NEW_LINE (SPACING : in POSITIVE_COUNT := 1); procedure SKIP_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1); procedure SKIP_LINE (SPACING : in POSITIVE_COUNT := 1); function END_OF_LINE (FILE : in FILE_TYPE) return BOOLEAN; function END_OF_LINE return BOOLEAN; -- default input file procedure NEW_PAGE (FILE : in FILE_TYPE); procedure NEW_PAGE; -- default output file procedure SKIP_PAGE (FILE : in FILE_TYPE); procedure SKIP_PAGE; -- default input file function END_OF_PAGE (FILE : in FILE_TYPE) return BOOLEAN; function END_OF_PAGE return BOOLEAN; function END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN; function END_OF_FILE return BOOLEAN; procedure SET_COL(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT); procedure SET_COL(TO : in POSITIVE_COUNT); -- default output file procedure SET_LINE(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT); procedure SET_LINE(TO : in POSITIVE_COUNT); -- default output file function COL(FILE : in FILE_TYPE) return POSITIVE_COUNT; function COL return POSITIVE_COUNT; -- default output file function LINE(FILE : in FILE_TYPE) return POSITIVE_COUNT; function LINE return POSITIVE_COUNT; -- default output file function PAGE(FILE : in FILE_TYPE) return POSITIVE_COUNT; function PAGE return POSITIVE_COUNT; -- default output file -- Character Input-Output procedure GET (FILE : in FILE_TYPE; ITEM : out CHARACTER); procedure GET (ITEM : out CHARACTER); procedure PUT (FILE : in FILE_TYPE; ITEM : in CHARACTER); procedure PUT (ITEM : in CHARACTER); -- String Input-Output procedure GET (FILE : in FILE_TYPE; ITEM : out STRING); procedure GET (ITEM : out STRING); procedure PUT (FILE : in FILE_TYPE; ITEM : in STRING); procedure PUT (ITEM : in STRING); procedure GET_LINE (FILE : in FILE_TYPE; ITEM : out STRING; LAST : out NATURAL); procedure GET_LINE (ITEM : out STRING; LAST : out NATURAL); procedure PUT_LINE (FILE : in FILE_TYPE; ITEM : in STRING); procedure PUT_LINE (ITEM : in STRING); -- Generic package for Input-Output of Integer Types generic type NUM is range <>; package INTEGER_IO is DEFAULT_WIDTH : FIELD := NUM'WIDTH; DEFAULT_BASE : NUMBER_BASE := 10; procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0); procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0); procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; WIDTH : in FIELD := DEFAULT_WIDTH; BASE : in NUMBER_BASE := DEFAULT_BASE); procedure PUT (ITEM : in NUM; WIDTH : in FIELD := DEFAULT_WIDTH; BASE : in NUMBER_BASE := DEFAULT_BASE); procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE); procedure PUT (TO : out STRING; ITEM : in NUM; BASE : in NUMBER_BASE := DEFAULT_BASE); end INTEGER_IO; -- Generic packages for Input-Output of Real Types generic type NUM is digits <>; package FLOAT_IO is DEFAULT_FORE : FIELD := 2; DEFAULT_AFT : FIELD := NUM'DIGITS-1; DEFAULT_EXP : FIELD := 3; procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0); procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0); procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); procedure PUT (ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE); procedure PUT (TO : out STRING; ITEM : in NUM; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); end FLOAT_IO; generic type NUM is delta <>; package FIXED_IO is DEFAULT_FORE : FIELD := NUM'FORE; DEFAULT_AFT : FIELD := NUM'AFT; DEFAULT_EXP : FIELD := 0; procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0); procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0); procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); procedure PUT (ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE); procedure PUT (TO : out STRING; ITEM : in NUM; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP); end FIXED_IO; -- Generic package for Input-Output of Enumeration Types generic type ENUM is (<>); package ENUMERATION_IO is DEFAULT_WIDTH : FIELD := 0; DEFAULT_SETTING : TYPE_SET := UPPER_CASE; procedure GET (FILE : in FILE_TYPE; ITEM : out ENUM); procedure GET (ITEM : out ENUM); procedure PUT (FILE : in FILE_TYPE; ITEM : in ENUM; WIDTH : in FIELD := DEFAULT_WIDTH; SET : in TYPE_SET := DEFAULT_SETTING); procedure PUT (ITEM : in ENUM; WIDTH : in FIELD := DEFAULT_WIDTH; SET : in TYPE_SET := DEFAULT_SETTING); procedure GET(FROM : in STRING; ITEM: out ENUM; LAST: out POSITIVE); procedure PUT (TO : out STRING; ITEM : in ENUM; SET : in TYPE_SET := DEFAULT_SETTING); end ENUMERATION_IO; -- Exceptions: -- -- These are the exceptions whose names are visible to the -- calling environment. STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR; MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR; NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR; USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR; DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR; END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR; DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR; LAYOUT_ERROR : exception renames IO_EXCEPTIONS.LAYOUT_ERROR; private type FILE_TYPE is record FILE_NUM : INTEGER := 0; end record; end TEXT_IO; package body TEXT_IO is -- The bodies for all the procedure and functions consist of an -- interface pragma which generates an AIS instruction of the form: -- -- [ 'predef_', specifier, [formal, formal, ...] ] -- -- where the specifier is the second argument to the pragma in -- upper case, and the formals are the fully qualified names of the -- formal parameters to the procedure. The specifier is used by the -- SETL TEXT_IO routines in determining which routine was called and -- the formal names are used for accessing and setting the values of -- the arguments to the procedure or function call. -- Global operations for file manipulation: procedure CREATE (FILE : in out FILE_TYPE; MODE : in FILE_MODE := OUT_FILE; NAME : in STRING := ""; FORM : in STRING := "") is begin pragma io_interface (PREDEF, TIO_CREATE); null; end CREATE; procedure OPEN (FILE : in out FILE_TYPE; MODE : in FILE_MODE; NAME : in STRING; FORM : in STRING := "") is begin pragma io_interface (PREDEF, TIO_OPEN); null; end OPEN; procedure CLOSE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, TIO_CLOSE); null; end CLOSE; procedure DELETE (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, TIO_DELETE); null; end DELETE; procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE) is begin pragma io_interface (PREDEF, TIO_RESET_MODE); null; end RESET; procedure RESET (FILE : in out FILE_TYPE) is begin pragma io_interface (PREDEF, TIO_RESET); null; end RESET; function MODE (FILE : in FILE_TYPE) return FILE_MODE is begin pragma io_interface (PREDEF, TIO_MODE); null; end MODE; function NAME (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, TIO_NAME); null; end NAME; function FORM (FILE : in FILE_TYPE) return STRING is begin pragma io_interface (PREDEF, TIO_FORM); null; end FORM; function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, TIO_IS_OPEN); null; end IS_OPEN; -- Control of default input and output files procedure SET_INPUT (FILE : in FILE_TYPE) is begin pragma io_interface (PREDEF, SET_INPUT); null; end SET_INPUT; procedure SET_OUTPUT (FILE : in FILE_TYPE) is begin pragma io_interface (PREDEF, SET_OUTPUT); null; end SET_OUTPUT; function STANDARD_INPUT return FILE_TYPE is begin pragma io_interface (PREDEF, STANDARD_INPUT); null; end STANDARD_INPUT; function STANDARD_OUTPUT return FILE_TYPE is begin pragma io_interface (PREDEF, STANDARD_OUTPUT); null; end STANDARD_OUTPUT; function CURRENT_INPUT return FILE_TYPE is begin pragma io_interface (PREDEF, CURRENT_INPUT); null; end CURRENT_INPUT; function CURRENT_OUTPUT return FILE_TYPE is begin pragma io_interface (PREDEF, CURRENT_OUTPUT); null; end CURRENT_OUTPUT; -- Specification of line and page lengths procedure SET_LINE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT) is begin pragma io_interface (PREDEF, SET_LINE_LENGTH_FILE); null; end SET_LINE_LENGTH; procedure SET_LINE_LENGTH (TO : in COUNT) is begin pragma io_interface (PREDEF, SET_LINE_LENGTH); null; end SET_LINE_LENGTH; procedure SET_PAGE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT) is begin pragma io_interface (PREDEF, SET_PAGE_LENGTH_FILE); null; end SET_PAGE_LENGTH; procedure SET_PAGE_LENGTH (TO : in COUNT) is begin pragma io_interface (PREDEF, SET_PAGE_LENGTH); null; end SET_PAGE_LENGTH; function LINE_LENGTH (FILE : in FILE_TYPE) return COUNT is begin pragma io_interface (PREDEF, LINE_LENGTH_FILE); null; end LINE_LENGTH; function LINE_LENGTH return COUNT is begin pragma io_interface (PREDEF, LINE_LENGTH); null; end LINE_LENGTH; function PAGE_LENGTH (FILE : in FILE_TYPE) return COUNT is begin pragma io_interface (PREDEF, PAGE_LENGTH_FILE); null; end PAGE_LENGTH; function PAGE_LENGTH return COUNT is begin pragma io_interface (PREDEF, PAGE_LENGTH); null; end PAGE_LENGTH; -- Column, Line and Page Control procedure NEW_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1) is begin pragma io_interface (PREDEF, NEW_LINE_FILE); null; end NEW_LINE; procedure NEW_LINE (SPACING : in POSITIVE_COUNT := 1) is begin pragma io_interface (PREDEF, NEW_LINE); null; end NEW_LINE; procedure SKIP_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1) is begin pragma io_interface (PREDEF, SKIP_LINE_FILE); null; end SKIP_LINE; procedure SKIP_LINE (SPACING : in POSITIVE_COUNT := 1) is begin pragma io_interface (PREDEF, SKIP_LINE); null; end SKIP_LINE; function END_OF_LINE (FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, END_OF_LINE_FILE); null; end END_OF_LINE; function END_OF_LINE return BOOLEAN is begin pragma io_interface (PREDEF, END_OF_LINE); null; end END_OF_LINE; procedure NEW_PAGE(FILE : in FILE_TYPE) is begin pragma io_interface (PREDEF, NEW_PAGE_FILE); null; end NEW_PAGE; procedure NEW_PAGE is begin pragma io_interface (PREDEF, NEW_PAGE); null; end NEW_PAGE; procedure SKIP_PAGE(FILE : in FILE_TYPE) is begin pragma io_interface (PREDEF, SKIP_PAGE_FILE); null; end SKIP_PAGE; procedure SKIP_PAGE is begin pragma io_interface (PREDEF, SKIP_PAGE); null; end SKIP_PAGE; function END_OF_PAGE(FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, END_OF_PAGE_FILE); null; end END_OF_PAGE; function END_OF_PAGE return BOOLEAN is begin pragma io_interface (PREDEF, END_OF_PAGE); null; end END_OF_PAGE; function END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN is begin pragma io_interface (PREDEF, TIO_END_OF_FILE_FILE); null; end END_OF_FILE; function END_OF_FILE return BOOLEAN is begin pragma io_interface (PREDEF, TIO_END_OF_FILE); null; end END_OF_FILE; procedure SET_COL(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, SET_COL_FILE); null; end SET_COL; procedure SET_COL(TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, SET_COL); null; end SET_COL; procedure SET_LINE(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, SET_LINE_FILE); null; end SET_LINE; procedure SET_LINE(TO : in POSITIVE_COUNT) is begin pragma io_interface (PREDEF, SET_LINE); null; end SET_LINE; function COL(FILE : in FILE_TYPE) return POSITIVE_COUNT is begin pragma io_interface (PREDEF, COL_FILE); null; end COL; function COL return POSITIVE_COUNT is begin pragma io_interface (PREDEF, COL); null; end COL; function LINE(FILE : in FILE_TYPE) return POSITIVE_COUNT is begin pragma io_interface (PREDEF, LINE_FILE); null; end LINE; function LINE return POSITIVE_COUNT is begin pragma io_interface (PREDEF, LINE); null; end LINE; function PAGE(FILE : in FILE_TYPE) return POSITIVE_COUNT is begin pragma io_interface (PREDEF, PAGE_FILE); null; end PAGE; function PAGE return POSITIVE_COUNT is begin pragma io_interface (PREDEF, PAGE); null; end PAGE; -- Character Input-Output procedure GET (FILE : in FILE_TYPE; ITEM : out CHARACTER) is begin pragma io_interface (PREDEF, GET_CHAR_FILE_ITEM); null; end GET; procedure GET (ITEM : out CHARACTER) is begin pragma io_interface (PREDEF, GET_CHAR_ITEM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in CHARACTER) is begin pragma io_interface (PREDEF, PUT_CHAR_FILE_ITEM); null; end PUT; procedure PUT (ITEM : in CHARACTER) is begin pragma io_interface (PREDEF, PUT_CHAR_ITEM); null; end PUT; -- String Input-Output procedure GET (FILE : in FILE_TYPE; ITEM : out STRING) is begin pragma io_interface (PREDEF, GET_STRING_FILE_ITEM); null; end GET; procedure GET (ITEM : out STRING) is begin pragma io_interface (PREDEF, GET_STRING_ITEM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in STRING) is begin pragma io_interface (PREDEF, PUT_STRING_FILE_ITEM); null; end PUT; procedure PUT (ITEM : in STRING) is begin pragma io_interface (PREDEF, PUT_STRING_ITEM); null; end PUT; procedure GET_LINE (FILE : in FILE_TYPE; ITEM : out STRING; LAST : out NATURAL) is begin pragma io_interface (PREDEF, GET_LINE_FILE); null; end GET_LINE; procedure GET_LINE (ITEM : out STRING; LAST : out NATURAL) is begin pragma io_interface (PREDEF, GET_LINE); null; end GET_LINE; procedure PUT_LINE (FILE : in FILE_TYPE; ITEM : in STRING) is begin pragma io_interface (PREDEF, PUT_LINE_FILE); null; end PUT_LINE; procedure PUT_LINE (ITEM : in STRING) is begin pragma io_interface (PREDEF, PUT_LINE); null; end PUT_LINE; -- Generic package for Input-Output of Integer Types package body INTEGER_IO is procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_INTEGER_FILE_ITEM, NUM); null; end GET; procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_INTEGER_ITEM, NUM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; WIDTH : in FIELD := DEFAULT_WIDTH; BASE : in NUMBER_BASE := DEFAULT_BASE) is begin pragma io_interface (PREDEF, PUT_INTEGER_FILE_ITEM); null; end PUT; procedure PUT (ITEM : in NUM; WIDTH : in FIELD := DEFAULT_WIDTH; BASE : in NUMBER_BASE := DEFAULT_BASE) is begin pragma io_interface (PREDEF, PUT_INTEGER_ITEM); null; end PUT; procedure GET (FROM : in STRING; ITEM : out NUM; LAST: out POSITIVE) is begin pragma io_interface (PREDEF, GET_INTEGER_STRING, NUM); null; end GET; procedure PUT (TO : out STRING; ITEM : in NUM; BASE : in NUMBER_BASE := DEFAULT_BASE) is begin pragma io_interface (PREDEF, PUT_INTEGER_STRING); null; end PUT; end INTEGER_IO; -- Generic packages for Input-Output of Real Types package body FLOAT_IO is procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_FLOAT_FILE_ITEM, NUM); null; end GET; procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_FLOAT_ITEM, NUM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FLOAT_FILE_ITEM); null; end PUT; procedure PUT (ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FLOAT_ITEM); null; end PUT; procedure GET (FROM : in STRING; ITEM : out NUM; LAST: out POSITIVE) is begin pragma io_interface (PREDEF, GET_FLOAT_STRING, NUM); null; end GET; procedure PUT (TO : out STRING; ITEM : in NUM; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FLOAT_STRING); null; end PUT; end FLOAT_IO; package body FIXED_IO is procedure GET (FILE : in FILE_TYPE; ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_FIXED_FILE_ITEM, NUM); null; end GET; procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0) is begin pragma io_interface (PREDEF, GET_FIXED_ITEM, NUM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FIXED_FILE_ITEM); null; end PUT; procedure PUT (ITEM : in NUM; FORE : in FIELD := DEFAULT_FORE; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FIXED_ITEM); null; end PUT; procedure GET (FROM : in STRING; ITEM : out NUM; LAST: out POSITIVE) is begin pragma io_interface (PREDEF, GET_FIXED_STRING, NUM); null; end GET; procedure PUT (TO : out STRING; ITEM : in NUM; AFT : in FIELD := DEFAULT_AFT; EXP : in FIELD := DEFAULT_EXP) is begin pragma io_interface (PREDEF, PUT_FIXED_STRING); null; end PUT; end FIXED_IO; -- Generic package for Input-Output of Enumeration Types package body ENUMERATION_IO is procedure GET (FILE : in FILE_TYPE; ITEM : out ENUM) is begin pragma io_interface (PREDEF, GET_ENUM_FILE_ITEM, ENUM); null; end GET; procedure GET (ITEM : out ENUM) is begin pragma io_interface (PREDEF, GET_ENUM_ITEM, ENUM); null; end GET; procedure PUT (FILE : in FILE_TYPE; ITEM : in ENUM; WIDTH : in FIELD := DEFAULT_WIDTH; SET : in TYPE_SET := DEFAULT_SETTING) is begin pragma io_interface (PREDEF, PUT_ENUM_FILE_ITEM, ENUM); null; end PUT; procedure PUT (ITEM : in ENUM; WIDTH : in FIELD := DEFAULT_WIDTH; SET : in TYPE_SET := DEFAULT_SETTING) is begin pragma io_interface (PREDEF, PUT_ENUM_ITEM, ENUM); null; end PUT; procedure GET (FROM : in STRING; ITEM: out ENUM; LAST: out POSITIVE) is begin pragma io_interface (PREDEF, GET_ENUM_STRING, ENUM); null; end GET; procedure PUT (TO : out STRING; ITEM : in ENUM; SET : in TYPE_SET := DEFAULT_SETTING) is begin pragma io_interface (PREDEF, PUT_ENUM_STRING, ENUM); null; end PUT; end ENUMERATION_IO; end TEXT_IO; -- Predefined library units: calendar & generic subprograms package CALENDAR is type TIME is private; subtype YEAR_NUMBER is INTEGER range 1901 .. 2099; subtype MONTH_NUMBER is INTEGER range 1 .. 12; subtype DAY_NUMBER is INTEGER range 1 .. 31; function CLOCK return TIME; function YEAR (DATE : TIME) return YEAR_NUMBER; function MONTH (DATE : TIME) return MONTH_NUMBER; function DAY (DATE : TIME) return DAY_NUMBER; function SECONDS(DATE : TIME) return DURATION; procedure SPLIT (DATE : in TIME; YEAR : out YEAR_NUMBER; MONTH : out MONTH_NUMBER; DAY : out DAY_NUMBER; SECONDS : out DURATION); function TIME_OF(YEAR : YEAR_NUMBER; MONTH : MONTH_NUMBER; DAY : DAY_NUMBER; SECONDS : DURATION := 0.0) return TIME; TIME_ERROR : exception; -- can be raised by TIME_OF function "+" (LEFT : TIME; RIGHT : DURATION) return TIME; function "+" (LEFT : DURATION; RIGHT : TIME) return TIME; function "-" (LEFT : TIME; RIGHT : DURATION) return TIME; function "-" (LEFT : TIME; RIGHT : TIME) return DURATION; function "<" (LEFT, RIGHT : TIME) return BOOLEAN; function "<=" (LEFT, RIGHT : TIME) return BOOLEAN; function ">" (LEFT, RIGHT : TIME) return BOOLEAN; function ">=" (LEFT, RIGHT : TIME) return BOOLEAN; private type TIME is record YEAR : YEAR_NUMBER; MONTH : MONTH_NUMBER; DAY : DAY_NUMBER; SECONDS : DURATION; end record; end CALENDAR; package body CALENDAR is function CLOCK return TIME is begin pragma io_interface(PREDEF, CLOCK); null; end CLOCK; function YEAR (DATE : TIME) return YEAR_NUMBER is begin pragma io_interface(PREDEF, YEAR); null; end YEAR; function MONTH (DATE : TIME) return MONTH_NUMBER is begin pragma io_interface(PREDEF, MONTH); null; end MONTH; function DAY (DATE : TIME) return DAY_NUMBER is begin pragma io_interface(PREDEF, DAY); null; end DAY; function SECONDS(DATE : TIME) return DURATION is begin pragma io_interface(PREDEF, SECONDS); null; end SECONDS; procedure SPLIT (DATE : in TIME; YEAR : out YEAR_NUMBER; MONTH : out MONTH_NUMBER; DAY : out DAY_NUMBER; SECONDS : out DURATION) is begin pragma io_interface(PREDEF, SPLIT); null; end SPLIT; function TIME_OF(YEAR : YEAR_NUMBER; MONTH : MONTH_NUMBER; DAY : DAY_NUMBER; SECONDS : DURATION := 0.0) return TIME is begin pragma io_interface(PREDEF, TIME_OF); null; end TIME_OF; function "+" (LEFT : TIME; RIGHT : DURATION) return TIME is begin pragma io_interface(PREDEF, ADD_TIME_DUR); null; end "+"; function "+" (LEFT : DURATION; RIGHT : TIME) return TIME is begin pragma io_interface(PREDEF, ADD_DUR_TIME); null; end "+"; function "-" (LEFT : TIME; RIGHT : DURATION) return TIME is begin pragma io_interface(PREDEF, SUB_TIME_DUR); null; end "-"; function "-" (LEFT : TIME; RIGHT : TIME) return DURATION is begin pragma io_interface(PREDEF, SUB_TIME_TIME); null; end "-"; function "<" (LEFT, RIGHT : TIME) return BOOLEAN is begin pragma io_interface(PREDEF, LT_TIME); null; end "<"; function "<=" (LEFT, RIGHT : TIME) return BOOLEAN is begin pragma io_interface(PREDEF, LE_TIME); null; end "<="; function ">" (LEFT, RIGHT : TIME) return BOOLEAN is begin pragma io_interface(PREDEF, GT_TIME); null; end ">"; function ">=" (LEFT, RIGHT : TIME) return BOOLEAN is begin pragma io_interface(PREDEF, GE_TIME); null; end ">="; end CALENDAR; generic type OBJECT is limited private; type NAME is access OBJECT; procedure UNCHECKED_DEALLOCATION(X : in out NAME); generic type SOURCE is limited private; type TARGET is limited private; function UNCHECKED_CONVERSION(S : SOURCE) return TARGET; procedure UNCHECKED_DEALLOCATION(X : in out NAME) is begin if x /= null then x := null; end if; end UNCHECKED_DEALLOCATION; function UNCHECKED_CONVERSION(S : SOURCE) return TARGET is begin raise PROGRAM_ERROR; end UNCHECKED_CONVERSION;
oeis/056/A056617.asm
neoneye/loda-programs
11
176031
<reponame>neoneye/loda-programs ; A056617: Denominator of binomial(2*n,n) / (2*n+1). ; 1,3,5,7,9,11,13,5,17,19,21,23,25,27,29,31,11,7,37,13,41,43,3,47,49,17,53,55,57,59,61,9,65,67,23,71,73,75,11,79,81,83,17,29,89,13,31,19,97,11,101,103,35,107,109,37,113,115,39,119,121,41,125,127,43,131,133,9,137,139,47,13,29,49,149,151,17,31,157,53,23,163,3,167,169,171,173,5,59,179,181,183,37,17,27,191,193,1,197,199 mov $1,$0 sub $2,$0 sub $1,$2 add $1,1 bin $2,$0 gcd $2,$1 div $1,$2 mov $0,$1
applet/aide/source/palettes/aide-palette-of_pragmas.adb
charlie5/aIDE
3
27811
<filename>applet/aide/source/palettes/aide-palette-of_pragmas.adb with AdaM.Comment, AdaM.raw_Source, AdaM.a_Type.enumeration_type, Glib, Glib.Error, Glib.Object, Gtk.Builder, Gtk.Handlers, Pango.Font, Ada.Characters.handling; with Ada.Text_IO; use Ada.Text_IO; package body aIDE.Palette.of_pragmas is use Glib, Glib.Error, Glib.Object, Gtk.Builder, Gtk.Button, Gtk.Window; -- Events -- procedure on_raw_source_Button_clicked (the_Button : access Gtk_Button_Record'Class; Self : in aIDE.Palette.of_pragmas.view) is pragma Unreferenced (the_Button); new_Source : constant AdaM.raw_Source.view := AdaM.raw_Source.new_Source; begin put_Line ("KKK KKK " & the_Button.get_Label); Self.Target.Name_is (the_Button.get_Label); Self.Top.Hide; Self.Invoked_by.freshen; end on_raw_source_Button_clicked; package Button_Callbacks is new Gtk.Handlers.User_Callback (Gtk_Button_Record, aIDE.Palette.of_pragmas.view); -- Forge -- function to_source_entities_Palette return View is Self : constant Palette.of_pragmas.view := new Palette.of_pragmas.item; the_Builder : Gtk_Builder; Error : aliased GError; Result : Guint; pragma Unreferenced (Result); begin gtk_New (the_Builder); Result := the_Builder.add_from_File ("glade/palette/pragmas_palette.glade", Error'Access); if Error /= null then Put_Line ("Error: 'adam.Palette.of_source_Entities' ~ " & Get_Message (Error)); Error_Free (Error); end if; Self.Top := gtk_Window (the_Builder.get_Object ("top_Window")); Self.new_type_Frame := gtk_Frame (the_Builder.get_Object ("new_type_Frame")); Self.raw_source_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); Self.comment_Button := gtk_Button (the_Builder.get_Object ("comment_Button")); Self.enumeration_type_Button := gtk_Button (the_Builder.get_Object ("new_enumeration_Button")); Self.close_Button := gtk_Button (the_Builder.get_Object ("close_Button")); for i in Self.kind_Buttons'Range loop declare use Ada.Characters.handling; button_Name : constant String := AdaM.a_Pragma.Kind'Image (i); begin Self.kind_Buttons (i) := gtk_Button (the_Builder.get_Object (to_Lower (button_Name) & "_Button")); Button_Callbacks.connect (Self.kind_Buttons (i), "clicked", on_raw_source_Button_clicked'Access, Self); end; end loop; -- Self.all_calls_remote_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.assert_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.assertion_policy_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.asynchronous_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.atomic_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.atomic_components_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.attach_handler_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.convention_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.cpu_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.default_storage_pool_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.detect_blocking_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.discard_names_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.dispatching_domain_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.elaborate_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.elaborate_all_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.elaborate_body_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.export_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.import_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.independent_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.independent_components_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.inline_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.inspection_point_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.interrupt_handler_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.interrupt_priority_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.linker_options_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.list_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.locking_policy_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.no_return_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.normalize_scalars_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.optimize_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.pack_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.page_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.partition_elaboration_policy_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.preelaborable_initialization_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.preelaborate_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.priority_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.priority_specific_dispatching_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.profile_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.pure_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.queuing_policy_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.relative_deadline_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.remote_call_interface_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.remote_types_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.restrictions_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.reviewable_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.shared_passive_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.storage_size_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.suppress_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.task_dispatching_policy_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.unchecked_union_Button := gtk_Button (the_Builder.get_Object ("raw_source_Button")); -- Self.unsuppress_Button : gtk_Button; -- Self.volatile_Button : gtk_Button; -- Self.volatile_components_Button : gtk_Button; -- Self.assertion_policy_2_Button : gtk_Button; -- Button_Callbacks.connect (Self.raw_source_Button, -- "clicked", -- on_raw_source_Button_clicked'Access, -- Self); -- Self.Top.modify_Font (Font_Desc => Pango.Font.From_String ("Courier 10")); -- Self.freshen; return Self; end to_source_entities_Palette; -- Attributes -- function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget is begin return gtk.Widget.Gtk_Widget (Self.Top); end top_Widget; procedure show (Self : in out Item; Invoked_by : in aIDE.Editor.view; -- Target : in AdaM.Source.Entities_view; -- Target : in AdaM.Entity.Entities_view; Target : in AdaM.a_Pragma.view; Allowed : in Filter) is begin Self.Invoked_by := Invoked_by; Self.Target := Target; -- case Allowed -- is -- when declare_Region => -- Self.new_type_Frame.show; -- -- when begin_Region => -- Self.new_type_Frame.hide; -- end case; Self.Top.show; end show; procedure freshen (Self : in out Item) is begin null; end freshen; end aIDE.Palette.of_pragmas;
awa/src/awa-users-filters.ads
fuzzysloth/ada-awa
0
17534
<gh_stars>0 ----------------------------------------------------------------------- -- awa-users-filters -- Specific filters for authentication and key verification -- Copyright (C) 2011, 2012, 2015 <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 Ada.Strings.Unbounded; with ASF.Requests; with ASF.Responses; with ASF.Sessions; with ASF.Principals; with ASF.Filters; with ASF.Servlets; with ASF.Security.Filters; with AWA.Users.Principals; package AWA.Users.Filters is -- Set the user principal on the session associated with the ASF request. procedure Set_Session_Principal (Request : in out ASF.Requests.Request'Class; Principal : in AWA.Users.Principals.Principal_Access); -- ------------------------------ -- Authentication verification filter -- ------------------------------ -- The <b>Auth_Filter</b> verifies that the user has the permission to access -- a given page. If the user is not logged, it tries to login automatically -- by using some persistent cookie. When this fails, it redirects the -- user to a login page (configured by AUTH_FILTER_REDIRECT_PARAM property). type Auth_Filter is new ASF.Security.Filters.Auth_Filter with private; -- The configuration parameter which controls the redirection page -- when the user is not logged (this should be the login page). AUTH_FILTER_REDIRECT_PARAM : constant String := "redirect"; -- A temporary cookie used to store the URL for redirection after the login is successful. REDIRECT_COOKIE : constant String := "RURL"; -- Initialize the filter and configure the redirection URIs. overriding procedure Initialize (Filter : in out Auth_Filter; Config : in ASF.Servlets.Filter_Config); -- Authenticate a user by using the auto-login cookie. This procedure is called if the -- current session does not have any principal. Based on the request and the optional -- auto-login cookie passed in <b>Auth_Id</b>, it should identify the user and return -- a principal object. The principal object will be freed when the session is closed. -- If the user cannot be authenticated, the returned principal should be null. -- -- The default implementation returns a null principal. overriding procedure Authenticate (F : in Auth_Filter; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class; Session : in ASF.Sessions.Session; Auth_Id : in String; Principal : out ASF.Principals.Principal_Access); -- Display or redirects the user to the login page. This procedure is called when -- the user is not authenticated. overriding procedure Do_Login (Filter : in Auth_Filter; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class); -- ------------------------------ -- Verify access key filter -- ------------------------------ -- The <b>Verify_Filter</b> filter verifies an access key associated to a user. -- The access key should have been sent to the user by some mechanism (email). -- The access key must be valid, that is an <b>Access_Key</b> database entry -- must exist and it must be associated with an email address and a user. type Verify_Filter is new ASF.Filters.Filter with private; -- The request parameter that <b>Verify_Filter</b> will check. PARAM_ACCESS_KEY : constant String := "key"; -- The configuration parameter which controls the redirection page -- when the access key is invalid. VERIFY_FILTER_REDIRECT_PARAM : constant String := "redirect"; -- Initialize the filter and configure the redirection URIs. procedure Initialize (Filter : in out Verify_Filter; Config : in ASF.Servlets.Filter_Config); -- Filter a request which contains an access key and verify that the -- key is valid and identifies a user. Once the user is known, create -- a session and setup the user principal. -- -- If the access key is missing or invalid, redirect to the -- <b>Invalid_Key_URI</b> associated with the filter. overriding procedure Do_Filter (Filter : in Verify_Filter; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class; Chain : in out ASF.Servlets.Filter_Chain); private use Ada.Strings.Unbounded; type Auth_Filter is new ASF.Security.Filters.Auth_Filter with record Login_URI : Unbounded_String; end record; type Verify_Filter is new ASF.Filters.Filter with record Invalid_Key_URI : Unbounded_String; end record; end AWA.Users.Filters;
Task/QR-decomposition/Ada/qr-decomposition.ada
mullikine/RosettaCodeData
1
2646
with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Real_Arrays; use Ada.Numerics.Real_Arrays; with Ada.Numerics.Generic_Elementary_Functions; procedure QR is procedure Show (mat : Real_Matrix) is package FIO is new Ada.Text_IO.Float_IO (Float); begin for row in mat'Range (1) loop for col in mat'Range (2) loop FIO.Put (mat (row, col), Exp => 0, Aft => 4, Fore => 5); end loop; New_Line; end loop; end Show; function GetCol (mat : Real_Matrix; n : Integer) return Real_Matrix is column : Real_Matrix (mat'Range (1), 1 .. 1); begin for row in mat'Range (1) loop column (row, 1) := mat (row, n); end loop; return column; end GetCol; function Mag (mat : Real_Matrix) return Float is sum : Real_Matrix := Transpose (mat) * mat; package Math is new Ada.Numerics.Generic_Elementary_Functions (Float); begin return Math.Sqrt (sum (1, 1)); end Mag; function eVect (col : Real_Matrix; n : Integer) return Real_Matrix is vect : Real_Matrix (col'Range (1), 1 .. 1); begin for row in col'Range (1) loop if row /= n then vect (row, 1) := 0.0; else vect (row, 1) := 1.0; end if; end loop; return vect; end eVect; function Identity (n : Integer) return Real_Matrix is mat : Real_Matrix (1 .. n, 1 .. n) := (1 .. n => (others => 0.0)); begin for i in Integer range 1 .. n loop mat (i, i) := 1.0; end loop; return mat; end Identity; function Chop (mat : Real_Matrix; n : Integer) return Real_Matrix is small : Real_Matrix (n .. mat'Length (1), n .. mat'Length (2)); begin for row in small'Range (1) loop for col in small'Range (2) loop small (row, col) := mat (row, col); end loop; end loop; return small; end Chop; function H_n (inmat : Real_Matrix; n : Integer) return Real_Matrix is mat : Real_Matrix := Chop (inmat, n); col : Real_Matrix := GetCol (mat, n); colT : Real_Matrix (1 .. 1, mat'Range (1)); H : Real_Matrix := Identity (mat'Length (1)); Hall : Real_Matrix := Identity (inmat'Length (1)); begin col := col - Mag (col) * eVect (col, n); col := col / Mag (col); colT := Transpose (col); H := H - 2.0 * (col * colT); for row in H'Range (1) loop for col in H'Range (2) loop Hall (n - 1 + row, n - 1 + col) := H (row, col); end loop; end loop; return Hall; end H_n; A : constant Real_Matrix (1 .. 3, 1 .. 3) := ( (12.0, -51.0, 4.0), (6.0, 167.0, -68.0), (-4.0, 24.0, -41.0)); Q1, Q2, Q3, Q, R: Real_Matrix (1 .. 3, 1 .. 3); begin Q1 := H_n (A, 1); Q2 := H_n (Q1 * A, 2); Q3 := H_n (Q2 * Q1* A, 3); Q := Transpose (Q1) * Transpose (Q2) * TransPose(Q3); R := Q3 * Q2 * Q1 * A; Put_Line ("Q:"); Show (Q); Put_Line ("R:"); Show (R); end QR;
Categories/Functor/Construction/Inclusion.agda
elpinal/exsub-ccc
3
12693
open import Theory module Categories.Functor.Construction.Inclusion {ℓ₁ ℓ₂ ℓ₃} (Th : Theory ℓ₁ ℓ₂ ℓ₃) where open import Syntax open Theory.Theory Th open Signature Sg open Term Sg open import Categories.Category.Construction.Renaming Sg as Renaming using (Ren; ren; _≐_) open import Categories.Category.Construction.Classifying Th using (Cl; CC) open import Categories.Functor open import Categories.Category open import Categories.Morphism Cl using (_≅_; Iso) open import Categories.Category.CartesianClosed Cl open import Categories.Category.Cartesian Cl open import Categories.Category.BinaryProducts Cl open import Data.List using (List; []; _∷_; _++_) import Relation.Binary.Reasoning.Setoid as Reasoning module TermReasoning {Γ A} = Reasoning (TermSetoid {Γ} {A}) inclusion : Functor Ren Cl inclusion = record { F₀ = F₀ ; F₁ = F₁ ; identity = C.Equiv.refl ; homomorphism = λ {Γ₁} {Γ₂} {Γ₃} {f} {g} -> homomorphism f g ; F-resp-≈ = F-resp-≈ } where module C = Category Cl open CartesianClosed CC open Cartesian cartesian open BinaryProducts products open import Categories.Morphism.Reasoning Cl id⁂id : forall {A B} -> C.id ⁂ C.id C.≈ C.id {A = A * B} id⁂id = trans (⟨⟩-cong₂ C.identityˡ C.identityˡ) η F₀ : Context -> Type F₀ [] = Unit F₀ (A ∷ Γ) = F₀ Γ * A F₀/*⇒++ : forall {Γ Δ} -> F₀ Γ * F₀ Δ C.⇒ F₀ (Δ ++ Γ) F₀/*⇒++ {Γ} {[]} = fst var F₀/*⇒++ {Γ} {A ∷ Δ} = (F₀/*⇒++ ⁂ C.id) C.∘ assocʳ F₀/++⇒* : forall {Γ Δ} -> F₀ (Δ ++ Γ) C.⇒ F₀ Γ * F₀ Δ F₀/++⇒* {Γ} {[]} = pair var unit F₀/++⇒* {Γ} {A ∷ Δ} = assocˡ C.∘ (F₀/++⇒* ⁂ C.id) F₀/*≅++ : forall {Γ Δ} -> F₀ Γ * F₀ Δ ≅ F₀ (Δ ++ Γ) F₀/*≅++ = record { from = F₀/*⇒++ ; to = F₀/++⇒* ; iso = record { isoˡ = isoˡ ; isoʳ = isoʳ } } where isoˡ : forall {Γ Δ} -> F₀/++⇒* C.∘ F₀/*⇒++ C.≈ C.id {A = F₀ Γ * F₀ Δ} isoˡ {Γ} {[]} = begin pair var unit [ ext ! (fst var) ] ≈⟨ trans comm/pair (cong/pair (var/ext _ _) (comm/unit _ _ _)) ⟩ pair (fst var) unit ≈⟨ cong/pair refl (eta/Unit _) ⟩ pair (fst var) (snd var) ≈⟨ eta/* _ ⟩ var ∎ where open TermReasoning isoˡ {Γ} {A ∷ Δ} = begin (assocˡ C.∘ (F₀/++⇒* ⁂ var)) C.∘ ((F₀/*⇒++ ⁂ var) C.∘ assocʳ) ≈⟨ C.assoc ⟩ assocˡ C.∘ (F₀/++⇒* ⁂ var) C.∘ (F₀/*⇒++ ⁂ var) C.∘ assocʳ ≈⟨ C.∘-resp-≈ʳ (pullˡ ⁂∘⁂) ⟩ assocˡ C.∘ (F₀/++⇒* C.∘ F₀/*⇒++ ⁂ var C.∘ var) C.∘ assocʳ ≈⟨ C.∘-resp-≈ʳ (C.∘-resp-≈ˡ (⁂-cong₂ isoˡ C.identity²)) ⟩ assocˡ C.∘ (var ⁂ var) C.∘ assocʳ ≈⟨ elim-center id⁂id ⟩ assocˡ C.∘ assocʳ ≈⟨ assocˡ∘assocʳ ⟩ var ∎ where open TermReasoning isoʳ : forall {Γ Δ} -> F₀/*⇒++ C.∘ F₀/++⇒* {Γ = Γ} C.≈ C.id {A = F₀ (Δ ++ Γ)} isoʳ {Γ} {[]} = trans comm/fst (trans (cong/fst (var/ext _ _)) (beta/*₁ _ _)) isoʳ {Γ} {A ∷ Δ} = begin ((F₀/*⇒++ ⁂ var) C.∘ assocʳ) C.∘ (assocˡ C.∘ (F₀/++⇒* ⁂ var)) ≈⟨ cancelInner assocʳ∘assocˡ ⟩ (F₀/*⇒++ ⁂ var) C.∘ (F₀/++⇒* ⁂ var) ≈⟨ ⁂∘⁂ ⟩ F₀/*⇒++ C.∘ F₀/++⇒* ⁂ var C.∘ var ≈⟨ ⁂-cong₂ isoʳ C.identity² ⟩ var ⁂ var ≈⟨ id⁂id ⟩ var ∎ where open TermReasoning F₁p : forall {Γ Δ} -> F₀ (Δ ++ Γ) ∷ [] ⊢ F₀ Γ F₁p = fst var C.∘ F₀/++⇒* F₁q : forall {Γ Δ} -> F₀ (Δ ++ Γ) ∷ [] ⊢ F₀ Δ F₁q = snd var C.∘ F₀/++⇒* F₁ : forall {Γ Δ : Context} -> ren Γ Δ -> F₀ Γ ∷ [] ⊢ F₀ Δ F₁ Renaming.id = C.id F₁ (r Renaming.∙ r₁) = F₁ r C.∘ F₁ r₁ F₁ Renaming.! = unit F₁ Renaming.⟪ r , r₁ ⟫ = F₀/*⇒++ C.∘ pair (F₁ r) (F₁ r₁) F₁ Renaming.p = F₁p F₁ Renaming.q = F₁q homomorphism : forall {Γ₁ Γ₂ Γ₃} (f : ren Γ₁ Γ₂) (g : ren Γ₂ Γ₃) -> F₀ Γ₁ ∷ [] ⊢ F₁ g [ ext ! (F₁ f) ] ≡ F₁ g [ ext ! (F₁ f) ] homomorphism f g = refl F-resp-≈ : forall {Γ Δ} {f g : ren Γ Δ} -> f ≐ g -> F₀ Γ ∷ [] ⊢ F₁ f ≡ F₁ g F-resp-≈ _≐_.refl = refl F-resp-≈ (_≐_.sym x) = sym (F-resp-≈ x) F-resp-≈ (_≐_.trans x x₁) = trans (F-resp-≈ x) (F-resp-≈ x₁) F-resp-≈ _≐_.identityˡ = var/ext _ _ F-resp-≈ _≐_.identityʳ = trans (cong/sub (trans (cong/ext !-unique refl) η-pair) refl) sub/id F-resp-≈ _≐_.assoc = C.assoc F-resp-≈ _≐_.!-unique = eta/Unit _ F-resp-≈ _≐_.β₁/⟪⟫ = trans (cancelInner (Iso.isoˡ (_≅_.iso F₀/*≅++))) project₁ F-resp-≈ _≐_.β₂/⟪⟫ = trans (cancelInner (Iso.isoˡ (_≅_.iso F₀/*≅++))) project₂ F-resp-≈ _≐_.η/⟪⟫ = trans (C.∘-resp-≈ʳ (trans (⟨⟩-cong₂ C.assoc C.assoc) g-η)) (cancelˡ (Iso.isoʳ (_≅_.iso F₀/*≅++))) F-resp-≈ (_≐_.cong/∙ x x₁) = cong/sub (cong/ext refl (F-resp-≈ x₁)) (F-resp-≈ x) F-resp-≈ (_≐_.cong/⟪⟫ x x₁) = cong/sub (cong/ext refl (cong/pair (F-resp-≈ x) (F-resp-≈ x₁))) refl
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1629.asm
ljhsiun2/medusa
9
3787
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xcbb7, %rsi nop nop nop nop nop and $46246, %r9 mov $0x6162636465666768, %r8 movq %r8, %xmm5 movups %xmm5, (%rsi) nop nop nop nop inc %r8 lea addresses_WC_ht+0x10fdf, %rsi lea addresses_normal_ht+0x1175f, %rdi add $41911, %r14 mov $84, %rcx rep movsq nop nop nop nop nop and $55643, %rdi lea addresses_UC_ht+0xa6df, %r14 nop nop nop nop nop add %rdx, %rdx movw $0x6162, (%r14) nop nop cmp %rsi, %rsi lea addresses_WT_ht+0xd7df, %r14 nop nop nop nop nop add %rdx, %rdx mov (%r14), %ecx nop nop nop sub %rdx, %rdx lea addresses_normal_ht+0xfcdf, %rdi nop nop nop nop nop xor %rcx, %rcx mov (%rdi), %r9 nop nop xor $35111, %rcx lea addresses_normal_ht+0x107df, %rsi lea addresses_D_ht+0x12605, %rdi sub $11298, %rdx mov $115, %rcx rep movsl xor %rdi, %rdi lea addresses_normal_ht+0x54a7, %rsi nop nop cmp %r8, %r8 movw $0x6162, (%rsi) nop sub $16867, %rdi lea addresses_A_ht+0x3517, %rsi lea addresses_WT_ht+0xdf0b, %rdi nop nop nop nop inc %rbp mov $54, %rcx rep movsq nop nop nop nop nop cmp %r8, %r8 lea addresses_WT_ht+0xe15f, %r14 nop nop nop nop nop add $9863, %r9 movups (%r14), %xmm1 vpextrq $0, %xmm1, %rsi nop nop nop cmp %rsi, %rsi lea addresses_WT_ht+0x1703f, %rsi nop nop and $18317, %rdx movb (%rsi), %r14b nop inc %rdx lea addresses_WT_ht+0x13df, %r14 nop nop nop xor %rcx, %rcx mov (%r14), %si nop sub %r9, %r9 lea addresses_A_ht+0x1347, %rbp cmp $52682, %r9 mov (%rbp), %edi nop nop xor $7194, %r14 lea addresses_WT_ht+0xb1df, %rsi lea addresses_WC_ht+0x18df, %rdi xor $27510, %r8 mov $51, %rcx rep movsq nop nop nop nop xor $30961, %rdx lea addresses_normal_ht+0xd7df, %rsi lea addresses_A_ht+0xf3df, %rdi nop nop nop nop dec %rdx mov $111, %rcx rep movsw nop and $18833, %rdi lea addresses_normal_ht+0x1b7df, %rsi nop nop nop and $27972, %r9 movw $0x6162, (%rsi) nop nop nop dec %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r14 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %rbp push %rbx push %rcx push %rdi push %rdx // Store lea addresses_normal+0x8fdf, %rdx and %rcx, %rcx mov $0x5152535455565758, %rdi movq %rdi, %xmm6 movups %xmm6, (%rdx) inc %r13 // Store lea addresses_D+0x105dd, %rbx nop nop cmp %r12, %r12 movw $0x5152, (%rbx) nop nop nop nop dec %r12 // Load lea addresses_UC+0x10bdf, %rdx nop nop nop nop nop sub $61122, %rbx movb (%rdx), %cl nop nop nop nop cmp %r12, %r12 // Faulty Load lea addresses_UC+0x10bdf, %rbp nop nop nop nop sub %rdi, %rdi mov (%rbp), %r12 lea oracles, %rdi and $0xff, %r12 shlq $12, %r12 mov (%rdi,%r12,1), %r12 pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 7}, 'dst': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'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 */
programs/oeis/027/A027689.asm
neoneye/loda
22
161298
<reponame>neoneye/loda ; A027689: a(n) = n^2 + n + 4. ; 4,6,10,16,24,34,46,60,76,94,114,136,160,186,214,244,276,310,346,384,424,466,510,556,604,654,706,760,816,874,934,996,1060,1126,1194,1264,1336,1410,1486,1564,1644,1726,1810,1896,1984,2074,2166,2260,2356,2454,2554,2656,2760,2866,2974,3084,3196,3310,3426,3544,3664,3786,3910,4036,4164,4294,4426,4560,4696,4834,4974,5116,5260,5406,5554,5704,5856,6010,6166,6324,6484,6646,6810,6976,7144,7314,7486,7660,7836,8014,8194,8376,8560,8746,8934,9124,9316,9510,9706,9904 mov $1,$0 pow $0,2 add $0,$1 add $0,4
thingsToDoToday.scpt
philtr/geektool-scripts
0
2922
<reponame>philtr/geektool-scripts set taskList to "" tell application "Things3" repeat with toDo in to dos of list "Today" set toDoName to name of toDo if status of toDo is completed set indicator to "☑︎ " else if status of toDo is canceled set indicator to "☒ " else set indicator to "☐ " end if set taskList to taskList & indicator & todoName & return end repeat end tell return taskList
utils/matrix4x4.ads
Lucretia/old_nehe_ada95
0
7114
--------------------------------------------------------------------------------- -- Copyright 2004-2005 © <NAME> -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- with Vector3; with Matrix3x3; use type Matrix3x3.Object; package Matrix4x4 is ORDER : constant Integer := 4; -- 4 - 1 => The width of the matrix = 4! -- OpenGL Matrices: -- Array Matrix Axes -- X Y Z P -- m0 m4 m8 m12 m11 m12 m13 m14 x x x x -- m1 m5 m9 m13 :-> m21 m22 m23 m24 :-> y y y y -- m2 m6 m10 m14 m31 m32 m33 m34 z z z z -- m3 m7 m11 m15 m41 m42 m43 m44 0 0 0 1 type Matrix_Elements is (XAxis_X, XAxis_Y, XAxis_Z, XAxis_W, YAxis_X, YAxis_Y, YAxis_Z, YAxis_W, ZAxis_X, ZAxis_Y, ZAxis_Z, ZAxis_W, Pos_X, Pos_Y, Pos_Z, Pos_W); type Object is array(Matrix_Elements'Range) of Float; type Reference is access all Object; type View is access constant Object; function Identity return Object; procedure Identity(Self : in out Object); function Compose(R : in Matrix3x3.Object; P : in Vector3.Object) return Object; procedure FromAngleAxis(Result : out Object; Angle : in Float; UnitAxis : in Vector3.Object); procedure Translate(Result : out Object; X, Y, Z : in Float); procedure Transpose(Self : in out Object); procedure Inverse(Self : in out Object); function "*"(Left, Right : in Object) return Object; end Matrix4x4;
src/semantica.adb
alvaromb/Compilemon
1
24810
package body Semantica is procedure Abuit (P : out Pnode) is begin P := null; end Abuit; procedure Creanode_Programa (P : out Atribut; A : in Atribut) is begin P := A; Arbre := P.A; end Creanode_Programa; procedure Creanode (P : out Atribut; Fe, Fd : in Atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.Fe1 := Fe.A; Paux.Fd1 := Fd.A; P := (Nodearbre, 0, 0, Paux); end Creanode; procedure Creanode (P : out Atribut; Fe, Fc, Fd : in Atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.Fe2 := Fe.A; Paux.Fd2 := Fd.A; Paux.Fc2 := Fc.A; P := (Nodearbre, 0, 0, Paux); end Creanode; procedure Creanode (P : out Atribut; Fe, Fd : in Atribut; Op : in Operacio; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.Fe3 := Fe.A; Paux.Fd3 := Fd.A; Paux.Op3 := Op; P := (Nodearbre, 0, 0, Paux); end Creanode; procedure Creanode (P : out Atribut; F : in Atribut; Op : in Operacio; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.F4 := F.A; Paux.Op4 := Op; P := (Nodearbre, 0, 0, Paux); end Creanode; procedure Creanode (P : out Atribut; Fe, Fce, Fc, Fd : in Atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.Fe5 := Fe.A; Paux.Fc5 := Fce.A; Paux.Fd5 := Fc.A; Paux.Fid5 := Fd.A; P := (Nodearbre, 0, 0, Paux); end Creanode; procedure Creanode (P : out atribut; F : in atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.F6 := F.A; P := (Nodearbre, 0, 0, Paux); end Creanode; -- Crea node per identificadors procedure Creanode_Id (P : out Atribut; Id : in Atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.Id12 := Id.Idn; Paux.L1 := Id.Lin; Paux.C1 := Id.Col; P := (Nodearbre, 0, 0, Paux); end Creanode_Id; procedure Creanode_Val (P : out Atribut; A : in Atribut; Tn : in Tipusnode; S : in Valor) is Paux : Pnode; begin Paux := new Node(Tn); if S = 0 then Paux.Val := A.Val*(-1); else Paux.Val := A.Val; end if; Paux.Tconst := A.T; Paux.L2 := A.Lin; Paux.C2 := A.Col; P := (Nodearbre, 0, 0, Paux); end Creanode_Val; procedure Creanode_Mode (P : out Atribut; M : in mmode; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(Tn); Paux.M12 := M; P := (NodeArbre, 0, 0, Paux); end Creanode_Mode; procedure Creanode (P : out Atribut; Tn : in Tipusnode) is Paux : Pnode; begin Paux := new Node(tn); P := (NodeArbre, 0, 0, Paux); end Creanode; procedure Remunta (P : out Atribut; A : in Atribut) is begin P := A; end Remunta; procedure Cons_Tnode (P : in Pnode; Tn : out Tipusnode) is begin Tn := P.Tipus; end Cons_Tnode; -- Procediments per a les Taules procedure Noves_taules (Tp : out T_Procs; Tv : out T_Vars) is begin Tp.Np := 0; Tv.Nv := 0; end Noves_taules; -- Procediments per Taula de Procediments procedure Posa (Tp : in out T_Procs; Ip : in Info_Proc; Idp : out num_Proc) is begin Tp.Np := Tp.Np+1; Tp.Tp(Tp.Np) := Ip; Idp := Tp.Np; end Posa; procedure Modif_Descripcio (Tp : in out T_Procs; Idp : in Num_Proc; Ip : in Info_Proc) is begin Tp.Tp(Idp) := Ip; end Modif_Descripcio; -- Procediments per a la Taula de Variables procedure Posa (Tv : in out T_Vars; Iv : in Info_Var; Idv : out Num_Var) is begin Tv.Nv := Tv.Nv+1; Tv.Tv(Tv.Nv) := Iv; Idv := Tv.Nv; end Posa; function Nova_Etiq return Num_Etiq is begin Ne := Ne+1; return Ne; end Nova_Etiq; end Semantica;
programs/oeis/164/A164577.asm
jmorken/loda
1
105550
; A164577: Integer averages of the first perfect cubes up to some n^3. ; 1,12,25,45,112,162,225,396,507,637,960,1156,1377,1900,2205,2541,3312,3750,4225,5292,5887,6525,7936,8712,9537,11340,12321,13357,15600,16810,18081,20812,22275,23805,27072,28812,30625,34476,36517,38637,43120,45486,47937,53100,55815,58621,64512,67600,70785,77452,80937,84525,92016,95922,99937,108300,112651,117117,126400,131220,136161,146412,151725,157165,168432,174262,180225,192556,198927,205437,218880,225816,232897,247500,255025,262701,278512,286650,294945,312012,320787,329725,348096,357532,367137,386860,396981,407277,428400,439230,450241,472812,484375,496125,520192,532512,545025,570636,583737,597037,624240,638146,652257,681100,695835,710781,741312,756900,772705,804972,821437,838125,872176,889542,907137,943020,961311,979837,1017600,1036840,1056321,1096012,1116225,1136685,1178352,1199562,1221025,1264716,1286947,1309437,1355200,1378476,1402017,1449900,1474245,1498861,1548912,1574350,1600065,1652332,1678887,1705725,1760256,1787952,1815937,1872780,1901641,1930797,1990000,2020050,2050401,2112012,2143275,2174845,2238912,2271412,2304225,2370796,2404557,2438637,2507760,2542806,2578177,2649900,2686255,2722941,2797312,2835000,2873025,2950092,2989137,3028525,3108336,3148762,3189537,3272140,3313971,3356157,3441600,3484860,3528481,3616812,3661525,3706605,3797872,3844062,3890625,3984876,4032567,4080637,4177920,4227136,4276737,4377100,4427865,4479021,4582512,4634850,4687585,4794252,4848187,4902525,5012416,5067972,5123937,5237100,5294301,5351917,5468400,5527270,5586561,5706412,5766975,5827965,5951232,6013512,6076225,6202956,6266977,6331437,6461680,6527466,6593697,6727500,6795075,6863101,7000512,7069900,7139745,7280812,7352037,7423725,7568496,7641582,7715137,7863660,7938631,8014077,8166400,8243280,8320641,8476812,8555625,8634925,8794992,8875762,8957025,9121036,9203787,9287037 add $0,2 mul $0,8 div $0,6 mov $1,1 sub $1,$0 mov $2,$1 mul $2,$0 lpb $0 sub $0,1 sub $2,1 lpe mul $1,$2 sub $1,4 div $1,4 add $1,1
programs/oeis/227/A227546.asm
karttu/loda
0
97111
<reponame>karttu/loda ; A227546: n! + n^2 + 1. ; 2,3,7,16,41,146,757,5090,40385,362962,3628901,39916922,479001745,6227020970,87178291397,1307674368226,20922789888257,355687428096290,6402373705728325 mov $1,$0 fac $1 pow $0,2 add $1,$0 add $1,1
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vect2.ads
best08618/asylo
7
10336
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vect2.ads with Vect2_Pkg; package Vect2 is -- Unconstrained array types are vectorizable, possibly with special -- help for the programmer type Varray is array (Positive range <>) of Long_Float; for Varray'Alignment use 16; function "+" (X, Y : Varray) return Varray; procedure Add (X, Y : Varray; R : out Varray); procedure Add (X, Y : not null access Varray; R : not null access Varray); -- Constrained array types are vectorizable type Sarray is array (Positive(1) .. Positive(4)) of Long_Float; for Sarray'Alignment use 16; function "+" (X, Y : Sarray) return Sarray; procedure Add (X, Y : Sarray; R : out Sarray); procedure Add (X, Y : not null access Sarray; R : not null access Sarray); type Darray1 is array (Positive(1) .. Vect2_Pkg.N) of Long_Float; for Darray1'Alignment use 16; function "+" (X, Y : Darray1) return Darray1; procedure Add (X, Y : Darray1; R : out Darray1); procedure Add (X, Y : not null access Darray1; R : not null access Darray1); type Darray2 is array (Vect2_Pkg.K .. Positive(4)) of Long_Float; for Darray2'Alignment use 16; function "+" (X, Y : Darray2) return Darray2; procedure Add (X, Y : Darray2; R : out Darray2); procedure Add (X, Y : not null access Darray2; R : not null access Darray2); type Darray3 is array (Vect2_Pkg.K .. Vect2_Pkg.N) of Long_Float; for Darray3'Alignment use 16; function "+" (X, Y : Darray3) return Darray3; procedure Add (X, Y : Darray3; R : out Darray3); procedure Add (X, Y : not null access Darray3; R : not null access Darray3); end Vect2;
data/pokemon/base_stats/ampharos.asm
AtmaBuster/pokeplat-gen2
6
2650
db 0 ; species ID placeholder db 90, 75, 75, 55, 115, 90 ; hp atk def spd sat sdf db ELECTRIC, ELECTRIC ; type db 45 ; catch rate db 194 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 20 ; step cycles to hatch INCBIN "gfx/pokemon/ampharos/front.dimensions" db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_MONSTER, EGG_GROUND ; egg groups db 70 ; happiness ; tm/hm learnset tmhm FOCUS_PUNCH, TOXIC, HIDDEN_POWER, HYPER_BEAM, LIGHT_SCREEN, PROTECT, RAIN_DANCE, FRUSTRATION, IRON_TAIL, THUNDERBOLT, THUNDER, RETURN, BRICK_BREAK, DOUBLE_TEAM, SHOCK_WAVE, FACADE, SECRET_POWER, REST, ATTRACT, FOCUS_BLAST, FLING, CHARGE_BEAM, ENDURE, GIGA_IMPACT, FLASH, THUNDER_WAVE, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, SWAGGER, SUBSTITUTE, STRENGTH, ROCK_SMASH, ROCK_CLIMB, FIRE_PUNCH, MAGNET_RISE, OUTRAGE, SIGNAL_BEAM, SNORE, SWIFT, THUNDERPUNCH ; end
Cubical/Data/Prod/Properties.agda
limemloh/cubical
0
12275
<reponame>limemloh/cubical {-# OPTIONS --cubical --safe #-} module Cubical.Data.Prod.Properties where open import Cubical.Core.Everything open import Cubical.Data.Prod.Base open import Cubical.Data.Sigma open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence private variable ℓ ℓ' : Level A B : Type ℓ -- Swapping is an equivalence swap : A × B → B × A swap (x , y) = (y , x) swap-invol : (xy : A × B) → swap (swap xy) ≡ xy swap-invol (_ , _) = refl isEquivSwap : (A : Type ℓ) (B : Type ℓ') → isEquiv (λ (xy : A × B) → swap xy) isEquivSwap A B = isoToIsEquiv (iso swap swap swap-invol swap-invol) swapEquiv : (A : Type ℓ) (B : Type ℓ') → A × B ≃ B × A swapEquiv A B = (swap , isEquivSwap A B) swapEq : (A : Type ℓ) (B : Type ℓ') → A × B ≡ B × A swapEq A B = ua (swapEquiv A B) private open import Cubical.Data.Nat -- As × is defined as a datatype this computes as expected -- (i.e. "C-c C-n test1" reduces to (2 , 1)). If × is implemented -- using Sigma this would be "transp (λ i → swapEq ℕ ℕ i) i0 (1 , 2)" test : ℕ × ℕ test = transp (λ i → swapEq ℕ ℕ i) i0 (1 , 2) testrefl : test ≡ (2 , 1) testrefl = refl -- equivalence between the sigma-based definition and the inductive one A×B≡A×ΣB : A × B ≡ A ×Σ B A×B≡A×ΣB = isoToPath (iso (λ { (a , b) → (a , b)}) (λ { (a , b) → (a , b)}) (λ _ → refl) (λ { (a , b) → refl })) -- truncation for products hLevelProd : (n : ℕ) → isOfHLevel n A → isOfHLevel n B → isOfHLevel n (A × B) hLevelProd {A = A} {B = B} n h1 h2 = let h : isOfHLevel n (A ×Σ B) h = isOfHLevelΣ n h1 (λ _ → h2) in transport (λ i → isOfHLevel n (A×B≡A×ΣB {A = A} {B = B} (~ i))) h
programs/oeis/043/A043291.asm
neoneye/loda
22
87110
; A043291: Every run length in base 2 is 2. ; 3,12,51,204,819,3276,13107,52428,209715,838860,3355443,13421772,53687091,214748364,858993459,3435973836,13743895347,54975581388,219902325555,879609302220,3518437208883,14073748835532,56294995342131,225179981368524,900719925474099,3602879701896396,14411518807585587,57646075230342348,230584300921369395,922337203685477580,3689348814741910323,14757395258967641292,59029581035870565171,236118324143482260684,944473296573929042739,3777893186295716170956,15111572745182864683827,60446290980731458735308,241785163922925834941235,967140655691703339764940,3868562622766813359059763,15474250491067253436239052,61897001964269013744956211,247588007857076054979824844,990352031428304219919299379,3961408125713216879677197516,15845632502852867518708790067,63382530011411470074835160268,253530120045645880299340641075,1014120480182583521197362564300,4056481920730334084789450257203,16225927682921336339157801028812,64903710731685345356631204115251,259614842926741381426524816461004,1038459371706965525706099265844019,4153837486827862102824397063376076,16615349947311448411297588253504307,66461399789245793645190353014017228,265845599156983174580761412056068915 mov $1,4 pow $1,$0 mul $1,32 div $1,10 mov $0,$1
src/L/Base/Coproduct.agda
borszag/smallib
0
5850
module L.Base.Coproduct where -- Reexport definitions open import L.Base.Coproduct.Core public
dependently-typed-programming-in-agda_norell-chapman/Logic.agda
neosimsim/merkdas
1
8429
module Logic where data Bool : Set where true : Bool false : Bool _∧_ : Bool → Bool → Bool false ∧ _ = false true ∧ b = b _∨_ : Bool → Bool → Bool true ∨ _ = true false ∨ b = b
stack.asm
Klaus073/Assembly-language
0
172503
<filename>stack.asm<gh_stars>0 [org 0x0100] jmp start sum: dw 0 sum1: dw 0 add2: mov bp,sp mov cx,[bp+2] add cx,ax add cx,bx pop word[bp+2] ret add1: push bp mov bp,sp mov ax,[bp+4] mov bx,[bp+6] add word[sum],bx add word[sum],ax push word[sum] call add2 pop bp ret 4 start: push 5 push 4 call add1 mov ax, 0x4c00 int 0x21
source/miscellany/list.asm
paulscottrobson/rpl-32
0
244014
<filename>source/miscellany/list.asm<gh_stars>0 ; ****************************************************************************** ; ****************************************************************************** ; ; Name : list.asm ; Purpose : List Program ; Author : <NAME> (<EMAIL>) ; Created : 5th October 2019 ; ; ****************************************************************************** ; ****************************************************************************** ; ****************************************************************************** ; ; List command ; ; ****************************************************************************** Cmd_List: ;; [list] jsr ResetCodePointer ; back to the beginning stz zTemp2 ; clear the lowest-number stz zTemp2+1 cpx #0 ; stack empty ? beq _CLINone lda stack0,x ; use tos as start line sta zTemp2 lda stack1,x sta zTemp2+1 dex ; and pop the tos _CLINone: lda #30 ; list this many lines sta zTemp1 ; ; Listing loop ; _CLILoop lda (codePtr) ; check end of program beq _CLIEnd ldy #1 ; compare line# vs the minimum sec lda (codePtr),y sbc zTemp2 iny lda (codePtr),y sbc zTemp2+1 bcc _CLISkip phx jsr ListCurrent ; list the line. plx dec zTemp1 ; done all lines beq _CLIEnd _CLISkip: clc lda (codePtr) ; go to next adc codePtr sta codePtr bcc _CLILoop inc codePtr+1 bra _CLILoop _CLIEnd: jmp WarmStart ; ****************************************************************************** ; ; List current line number ; ; ****************************************************************************** ListCurrent: ldy #3 lda (codePtr),y cmp #2 bne _LCList lda #13 jsr ExternPrint jsr _LCList lda #13 jsr ExternPrint rts _LCList: lda #CTH_LINENO jsr ExternColour ; set colour ldy #1 ; print line# lda (codePtr),y pha iny lda (codePtr),y tay pla jsr ErrorPrint16 ; tay _LCPadOut: ; pad out to align neatly lda #' ' jsr ExternPrint iny cpy #5 bne _LCPadOut ldy #3 ; start here ; ; List loop ; _LCLoop: lda #' ' ; space jsr ExternPrint _LCLoopNoSpace: lda (codePtr),y ; get first bmi _LCIdentConst ; identifier or constant bne _LCStringToken lda #13 jmp ExternPrint ; _LCStringToken: cmp #$10 ; if < 10 it's a string. bcc _LCString jsr ListPrintToken lda (codePtr),y ; no space if ^ iny ; advance pointer cmp #KWD_HAT beq _LCLoopNoSpace bra _LCLoop ; go round again. ; ; Print a string or comment ; _LCString: lsr a ; CS if 1 (string) CC if 2 (comment) lda #CTH_STRING ; decide on colour. ldx #'"' bcs _LCSSkip lda #CTH_COMMENT ldx #"'" cpy #3 beq _LCSSkip lda #CTH_LCOMMENT _LCSSkip: jsr ExternColour ; set colour txa pha ; save end quote on stack. jsr ExternPrint iny ; skip type size iny _LCSPrint: ; string printing loop. lda (codePtr),y iny cmp #0 ; 0 is end beq _LCSExit jsr ExternPrint bra _LCSPrint _LCSExit: ; restore ending quote and print pla jsr ExternPrint bra _LCLoop ; ; Identifier or constant ; _LCIdentConst: cmp #$C0 ; check if constant bcc _LCConstant ; ; Identifier ; lda #CTH_IDENT ; set colour jsr ExternColour _LCCIdLoop: lda (codePtr),y ; read and #$1F ; convert clc adc #'A' cmp #'A'+31 ; handle '.' bne _LCCNotDot lda #'.' _LCCNotDot: jsr ExternPrint lda (codePtr),y ; at end ? iny cmp #$E0 bcs _LCLoop bra _LCCIdLoop ; ; Constant ; _LCConstant: lda #CTH_NUMBER ; number colour jsr ExternColour ldx #254 ; use the topmost stack element jsr ExtractIntegerToTOS ; so there is a very rare case lda stack3+0,x ; save stack top byte pha jsr IntegerToString ; this could corrupt stack if full :) jsr ErrorPrintIntegerBuffer pla ; sign back bpl _LCLoop2 lda #"-" jsr ExternPrint _LCLoop2: jmp _LCLoop ; ; Print token in A ; ListPrintToken: phy pha ; token colour lda #CTH_TOKEN jsr ExternColour plx lda #KeywordText & $FF sta zTemp0 lda #KeywordText >> 8 sta zTemp0+1 _LPTLoop: cpx #$10 ; first token is $10 beq _LPTFound dex lda (zTemp0) sec ; add 1, it's length+name adc zTemp0 sta zTemp0 bcc _LPTLoop inc zTemp0+1 bra _LPTLoop _LPTFound: ldy #1 ; start here. _LPTShow: lda (zTemp0),y ; get character cmp #32 ; < 32, length, so exit bcc _LPTExit iny jsr ExternPrint bra _LPTShow _LPTExit: ply rts
libsrc/enterprise/exos_open_channel_callee.asm
meesokim/z88dk
0
245156
; ; Enterprise 64/128 specific routines ; by <NAME>, 2011 ; ; exos_open_channel(unsigned char ch_number, char *device); ; ; ; $Id: exos_open_channel_callee.asm,v 1.4 2015/01/19 01:32:42 pauloscustodio Exp $ ; PUBLIC exos_open_channel_callee PUBLIC ASMDISP_EXOS_OPEN_CHANNEL_CALLEE exos_open_channel_callee: pop hl pop de ex (sp),hl ; enter : de = char *device ; l = channel number .asmentry ld a,l ; channel rst 30h defb 1 ld h,0 ld l,a ret DEFC ASMDISP_EXOS_OPEN_CHANNEL_CALLEE = # asmentry - exos_open_channel_callee
dbi_clients_src/pin/pin-3.6-97554-g31f0a167d-gcc-linux/source/tools/IArg/iarg_explicit_memory_ea_app_asm_intel64.asm
DigitalAlchemist/fuzzwatch
326
80058
; BEGIN_LEGAL ; Intel Open Source License ; ; Copyright (c) 2002-2017 Intel Corporation. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are ; met: ; ; Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. Redistributions ; in binary form must reproduce the above copyright notice, this list of ; conditions and the following disclaimer in the documentation and/or ; other materials provided with the distribution. Neither the name of ; the Intel Corporation nor the names of its contributors may be used to ; endorse or promote products derived from this software without ; specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ; ITS 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. ; END_LEGAL PUBLIC DoExplicitMemoryOps .code extern globalVar:qword extern dynVar:qword extern lblPtr:qword extern autoVarPtr:qword DoExplicitMemoryOps PROC push rbp mov rbp, rsp sub rsp, 16 lbl1: lea rax, globalVar lbl2: lea rax, [rsp + 8] ; <-- this will be autoVar mov rbx, [dynVar] lbl3: lea rax, [rbx] mov rax, 0cafebabeH lbl4: lea rax, [rax] lbl5: lea rax, [0deadbeeH] lbl6: mov rax, globalVar lbl7: mov [rsp + 8], rax lea rax, [rsp + 8] mov [autoVarPtr], rax lbl8: lea rax, fs:[-8] mov rax, 0deadbeefH lbl9: lea rax, fs:[rax] mov rbx, [lblPtr] mov rax, offset lbl1 mov [rbx], rax mov rax, offset lbl2 mov [rbx+8], rax mov rax, offset lbl3 mov [rbx+16], rax mov rax, offset lbl4 mov [rbx+24], rax mov rax, offset lbl5 mov [rbx+32], rax mov rax, offset lbl6 mov [rbx+40], rax mov rax, offset lbl7 mov [rbx+48], rax mov rax, offset lbl8 mov [rbx+56], rax mov rax, offset lbl9 mov [rbx+64], rax mov rsp, rbp pop rbp ret DoExplicitMemoryOps ENDP end
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/ascii.asm
prismotizm/gigaleak
0
177861
<reponame>prismotizm/gigaleak Name: ascii.asm Type: file Size: 12622 Last-Modified: '1992-02-13T07:47:48Z' SHA-1: C3E7C99A9AA8E3A6AD662A1567522A4BCD8180B3 Description: null
20_E_FATTORE.asm
aleattene/lc2-exams
0
175212
<reponame>aleattene/lc2-exams ; ************ DESCRIZIONE SOTTOPROGRAMMA ************ Il seguente sottoprogramma denominato E_FATTORE riceve nei registri R0 e R1 i due numeri N e F, entrambi positivi codificati in complemento a due (quindi compresi fra 1 e 32767). Il sottoprogramma inoltre restituisce nel registro R0 il numero intero I tale che I x F = N Se il numero F NON è un fattore di N (ovvero se N/F dà resto non nullo) il sottoprogramma restituisce il valore 0 (zero) Nonostante l'utilizzo di altri registri della CPU, il sottoprogramma restituisce il controllo al programma chiamante senza che tali registri risultino alterati. ; ************ ESEMPI FUNZIONAMENTO SOTTOPROGRAMMA ************ INPUT 1 OUTPUT 1 R0 100 R0 20 R1 5 INPUT 2 OUTPUT 2 R0 100 R0 0 R1 6 INPUT 3 OUTPUT 3 R0 100 R0 100 R1 1 INPUT 4 OUTPUT 4 R0 100 R0 0 R1 110 ; ********** PROGRAMMA TEST ************* .orig x3000 LD R0, int_pos_N ; acquisisco in R0 un num intero positivo N LD R1, int_pos_F ; acquisisco in R1 un num intero positivo F ; ********* SOTTORPROGRAMMA ************* ; E_FATTORE ST R2, store2 ; contenuto R2 -> in cella indirizzo store2 ST R3, store3 ; contenuto R3 -> in cella indirizzo store3 ST R4, store4 ; contenuto R4 -> in cella indirizzo store4 AND R2,R2,#0 ; azzero il registro contatore NOT R0,R0 ADD R0,R0,#1 ; Ca2 valore R0 per confronto ADD R4,R1,#0 ; contenuto R1 -> contenuto R4 ciclo ADD R3,R4,R0 ; confronto tra numero F e N BRZ output_ok ; se risultato zero "divisione perfetta" BRP output_zero ; se risultato positivo "non divisibilità" ; se negativo bisogna proseguire sin quando ; non si ottiene uno zero o un positivo ADD R4,R4,R1 ; incremento di F il valore di R4 ADD R2,R2,#1 ; incremento di 1 il contatore R2 BRNZP ciclo ; ripeto il ciclo sino ad ottenere ; un risultato nullo o negativo nel confronto output_ok ADD R0,R2,#1 ; contenuto R2 + 1 -> in R0 (come da specifica) BRNZP fine ; vado a fine sottoprogramma output_zero AND R0,R0,#0 ; output R0 = 0 (come da sapecifica) BRNZP fine ; vado a fine sottoprogramma fine LD R2, store2 ; contenuto cella indirizzo store2 -> in R2 LD R3, store3 ; contenuto cella indirizzo store3 -> in R3 LD R4, store4 ; contenuto cella indirizzo store4 -> in R4 ; RET ; ritorno da sottoprogramma ; ********** VARIABILI SOTTOPROGRAMMA e PROGRAMMA *********** store2 .blkw 1 ; riservo una cella memoria per contenuto R2 store3 .blkw 1 ; riservo una cella memoria per contenuto R2 store4 .blkw 1 ; riservo una cella memoria per contenuto R2 int_pos_N .fill #100 ;int_pos_F .fill #5 ;int_pos_F .fill #6 ;int_pos_F .fill #1 int_pos_F .fill #110 .end ; fine programma
components/hap/wolfssl/wolfcrypt/src/aes_asm.asm
StefVos/HapSnap
22
85652
; /* aes_asm.asm ; * ; * Copyright (C) 2006-2016 wolfSSL Inc. ; * ; * This file is part of wolfssl. (formerly known as CyaSSL) ; * ; * wolfSSL is free software; you can redistribute it and/or modify ; * it under the term 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. ; * ; * wolfSSL 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 program; if not, write to the Free Software ; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA ; */ ; ; ; /* See Intel Advanced Encryption Standard (AES) Instructions Set White Paper ; * by Israel, Intel Mobility Group Development Center, <NAME> ; */ ; ; /* This file is in intel asm syntax, see .s for at&t syntax */ ; ; /* ; AES_CBC_encrypt[const ,unsigned char*in ; unsigned ,char*out ; unsigned ,char ivec+16 ; unsigned ,long length ; const ,unsigned char*KS ; int nr] ; */ _text SEGMENT AES_CBC_encrypt PROC ;# parameter 1: rdi ;# parameter 2: rsi ;# parameter 3: rdx ;# parameter 4: rcx ;# parameter 5: r8 ;# parameter 6: r9d ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,[rsp+40] mov r9d,[rsp+48] mov r10,rcx shr rcx,4 shl r10,60 je NO_PARTS add rcx,1 NO_PARTS: sub rsi,16 movdqa xmm1,[rdx] LOOP_1: pxor xmm1,[rdi] pxor xmm1,[r8] add rsi,16 add rdi,16 cmp r9d,12 aesenc xmm1,16[r8] aesenc xmm1,32[r8] aesenc xmm1,48[r8] aesenc xmm1,64[r8] aesenc xmm1,80[r8] aesenc xmm1,96[r8] aesenc xmm1,112[r8] aesenc xmm1,128[r8] aesenc xmm1,144[r8] movdqa xmm2,160[r8] jb LAST cmp r9d,14 aesenc xmm1,160[r8] aesenc xmm1,176[r8] movdqa xmm2,192[r8] jb LAST aesenc xmm1,192[r8] aesenc xmm1,208[r8] movdqa xmm2,224[r8] LAST: dec rcx aesenclast xmm1,xmm2 movdqu [rsi],xmm1 jne LOOP_1 ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ret AES_CBC_encrypt ENDP ; void AES_CBC_decrypt_by4(const unsigned char* in, ; unsigned char* out, ; unsigned char ivec[16], ; unsigned long length, ; const unsigned char* KS, ; int nr) AES_CBC_decrypt_by4 PROC ; parameter 1: rdi ; parameter 2: rsi ; parameter 3: rdx ; parameter 4: rcx ; parameter 5: r8 ; parameter 6: r9d ; save rdi and rsi to rax and r11, restore before ret mov rax, rdi mov r11, rsi ; convert to what we had for att&t convention mov rdi, rcx mov rsi, rdx mov rdx, r8 mov rcx,r9 mov r8, [rsp+40] mov r9d, [rsp+48] ; on microsoft xmm6-xmm15 are non volatile, ; let's save on stack and restore at end sub rsp, 8+8*16 ; 8 = align stack , 8 xmm6-12,15 16 bytes each movdqa [rsp+0], xmm6 movdqa [rsp+16], xmm7 movdqa [rsp+32], xmm8 movdqa [rsp+48], xmm9 movdqa [rsp+64], xmm10 movdqa [rsp+80], xmm11 movdqa [rsp+96], xmm12 movdqa [rsp+112], xmm15 ; back to our original code, more or less mov r10, rcx shr rcx, 4 shl r10, 60 je DNO_PARTS_4 add rcx, 1 DNO_PARTS_4: mov r10, rcx shl r10, 62 shr r10, 62 shr rcx, 2 movdqu xmm5, [rdx] je DREMAINDER_4 sub rsi, 64 DLOOP_4: movdqu xmm1, [rdi] movdqu xmm2, 16[rdi] movdqu xmm3, 32[rdi] movdqu xmm4, 48[rdi] movdqa xmm6, xmm1 movdqa xmm7, xmm2 movdqa xmm8, xmm3 movdqa xmm15, xmm4 movdqa xmm9, [r8] movdqa xmm10, 16[r8] movdqa xmm11, 32[r8] movdqa xmm12, 48[r8] pxor xmm1, xmm9 pxor xmm2, xmm9 pxor xmm3, xmm9 pxor xmm4, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm1, xmm12 aesdec xmm2, xmm12 aesdec xmm3, xmm12 aesdec xmm4, xmm12 movdqa xmm9, 64[r8] movdqa xmm10, 80[r8] movdqa xmm11, 96[r8] movdqa xmm12, 112[r8] aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm1, xmm12 aesdec xmm2, xmm12 aesdec xmm3, xmm12 aesdec xmm4, xmm12 movdqa xmm9, 128[r8] movdqa xmm10, 144[r8] movdqa xmm11, 160[r8] cmp r9d, 12 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 jb DLAST_4 movdqa xmm9, 160[r8] movdqa xmm10, 176[r8] movdqa xmm11, 192[r8] cmp r9d, 14 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 jb DLAST_4 movdqa xmm9, 192[r8] movdqa xmm10, 208[r8] movdqa xmm11, 224[r8] aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 DLAST_4: add rdi, 64 add rsi, 64 dec rcx aesdeclast xmm1, xmm11 aesdeclast xmm2, xmm11 aesdeclast xmm3, xmm11 aesdeclast xmm4, xmm11 pxor xmm1, xmm5 pxor xmm2, xmm6 pxor xmm3, xmm7 pxor xmm4, xmm8 movdqu [rsi], xmm1 movdqu 16[rsi], xmm2 movdqu 32[rsi], xmm3 movdqu 48[rsi], xmm4 movdqa xmm5, xmm15 jne DLOOP_4 add rsi, 64 DREMAINDER_4: cmp r10, 0 je DEND_4 DLOOP_4_2: movdqu xmm1, [rdi] movdqa xmm15, xmm1 add rdi, 16 pxor xmm1, [r8] movdqu xmm2, 160[r8] cmp r9d, 12 aesdec xmm1, 16[r8] aesdec xmm1, 32[r8] aesdec xmm1, 48[r8] aesdec xmm1, 64[r8] aesdec xmm1, 80[r8] aesdec xmm1, 96[r8] aesdec xmm1, 112[r8] aesdec xmm1, 128[r8] aesdec xmm1, 144[r8] jb DLAST_4_2 movdqu xmm2, 192[r8] cmp r9d, 14 aesdec xmm1, 160[r8] aesdec xmm1, 176[r8] jb DLAST_4_2 movdqu xmm2, 224[r8] aesdec xmm1, 192[r8] aesdec xmm1, 208[r8] DLAST_4_2: aesdeclast xmm1, xmm2 pxor xmm1, xmm5 movdqa xmm5, xmm15 movdqu [rsi], xmm1 add rsi, 16 dec r10 jne DLOOP_4_2 DEND_4: ; restore non volatile rdi,rsi mov rdi, rax mov rsi, r11 ; restore non volatile xmms from stack movdqa xmm6, [rsp+0] movdqa xmm7, [rsp+16] movdqa xmm8, [rsp+32] movdqa xmm9, [rsp+48] movdqa xmm10, [rsp+64] movdqa xmm11, [rsp+80] movdqa xmm12, [rsp+96] movdqa xmm15, [rsp+112] add rsp, 8+8*16 ; 8 = align stack , 8 xmm6-12,15 16 bytes each ret AES_CBC_decrypt_by4 ENDP ; void AES_CBC_decrypt_by6(const unsigned char *in, ; unsigned char *out, ; unsigned char ivec[16], ; unsigned long length, ; const unsigned char *KS, ; int nr) AES_CBC_decrypt_by6 PROC ; parameter 1: rdi - in ; parameter 2: rsi - out ; parameter 3: rdx - ivec ; parameter 4: rcx - length ; parameter 5: r8 - KS ; parameter 6: r9d - nr ; save rdi and rsi to rax and r11, restore before ret mov rax, rdi mov r11, rsi ; convert to what we had for att&t convention mov rdi, rcx mov rsi, rdx mov rdx, r8 mov rcx, r9 mov r8, [rsp+40] mov r9d, [rsp+48] ; on microsoft xmm6-xmm15 are non volatile, ; let's save on stack and restore at end sub rsp, 8+9*16 ; 8 = align stack , 9 xmm6-14 16 bytes each movdqa [rsp+0], xmm6 movdqa [rsp+16], xmm7 movdqa [rsp+32], xmm8 movdqa [rsp+48], xmm9 movdqa [rsp+64], xmm10 movdqa [rsp+80], xmm11 movdqa [rsp+96], xmm12 movdqa [rsp+112], xmm13 movdqa [rsp+128], xmm14 ; back to our original code, more or less mov r10, rcx shr rcx, 4 shl r10, 60 je DNO_PARTS_6 add rcx, 1 DNO_PARTS_6: mov r12, rax mov r13, rdx mov r14, rbx mov rdx, 0 mov rax, rcx mov rbx, 6 div rbx mov rcx, rax mov r10, rdx mov rax, r12 mov rdx, r13 mov rbx, r14 cmp rcx, 0 movdqu xmm7, [rdx] je DREMAINDER_6 sub rsi, 96 DLOOP_6: movdqu xmm1, [rdi] movdqu xmm2, 16[rdi] movdqu xmm3, 32[rdi] movdqu xmm4, 48[rdi] movdqu xmm5, 64[rdi] movdqu xmm6, 80[rdi] movdqa xmm8, [r8] movdqa xmm9, 16[r8] movdqa xmm10, 32[r8] movdqa xmm11, 48[r8] pxor xmm1, xmm8 pxor xmm2, xmm8 pxor xmm3, xmm8 pxor xmm4, xmm8 pxor xmm5, xmm8 pxor xmm6, xmm8 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm5, xmm9 aesdec xmm6, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 movdqa xmm8, 64[r8] movdqa xmm9, 80[r8] movdqa xmm10, 96[r8] movdqa xmm11, 112[r8] aesdec xmm1, xmm8 aesdec xmm2, xmm8 aesdec xmm3, xmm8 aesdec xmm4, xmm8 aesdec xmm5, xmm8 aesdec xmm6, xmm8 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm5, xmm9 aesdec xmm6, xmm9 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 movdqa xmm8, 128[r8] movdqa xmm9, 144[r8] movdqa xmm10, 160[r8] cmp r9d, 12 aesdec xmm1, xmm8 aesdec xmm2, xmm8 aesdec xmm3, xmm8 aesdec xmm4, xmm8 aesdec xmm5, xmm8 aesdec xmm6, xmm8 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm5, xmm9 aesdec xmm6, xmm9 jb DLAST_6 movdqa xmm8, 160[r8] movdqa xmm9, 176[r8] movdqa xmm10, 192[r8] cmp r9d, 14 aesdec xmm1, xmm8 aesdec xmm2, xmm8 aesdec xmm3, xmm8 aesdec xmm4, xmm8 aesdec xmm5, xmm8 aesdec xmm6, xmm8 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm5, xmm9 aesdec xmm6, xmm9 jb DLAST_6 movdqa xmm8, 192[r8] movdqa xmm9, 208[r8] movdqa xmm10, 224[r8] aesdec xmm1, xmm8 aesdec xmm2, xmm8 aesdec xmm3, xmm8 aesdec xmm4, xmm8 aesdec xmm5, xmm8 aesdec xmm6, xmm8 aesdec xmm1, xmm9 aesdec xmm2, xmm9 aesdec xmm3, xmm9 aesdec xmm4, xmm9 aesdec xmm5, xmm9 aesdec xmm6, xmm9 DLAST_6: add rsi, 96 aesdeclast xmm1, xmm10 aesdeclast xmm2, xmm10 aesdeclast xmm3, xmm10 aesdeclast xmm4, xmm10 aesdeclast xmm5, xmm10 aesdeclast xmm6, xmm10 movdqu xmm8, [rdi] movdqu xmm9, 16[rdi] movdqu xmm10, 32[rdi] movdqu xmm11, 48[rdi] movdqu xmm12, 64[rdi] movdqu xmm13, 80[rdi] pxor xmm1, xmm7 pxor xmm2, xmm8 pxor xmm3, xmm9 pxor xmm4, xmm10 pxor xmm5, xmm11 pxor xmm6, xmm12 movdqu xmm7, xmm13 movdqu [rsi], xmm1 movdqu 16[rsi], xmm2 movdqu 32[rsi], xmm3 movdqu 48[rsi], xmm4 movdqu 64[rsi], xmm5 movdqu 80[rsi], xmm6 add rdi, 96 dec rcx jne DLOOP_6 add rsi, 96 DREMAINDER_6: cmp r10, 0 je DEND_6 DLOOP_6_2: movdqu xmm1, [rdi] movdqa xmm10, xmm1 add rdi, 16 pxor xmm1, [r8] movdqu xmm2, 160[r8] cmp r9d, 12 aesdec xmm1, 16[r8] aesdec xmm1, 32[r8] aesdec xmm1, 48[r8] aesdec xmm1, 64[r8] aesdec xmm1, 80[r8] aesdec xmm1, 96[r8] aesdec xmm1, 112[r8] aesdec xmm1, 128[r8] aesdec xmm1, 144[r8] jb DLAST_6_2 movdqu xmm2, 192[r8] cmp r9d, 14 aesdec xmm1, 160[r8] aesdec xmm1, 176[r8] jb DLAST_6_2 movdqu xmm2, 224[r8] aesdec xmm1, 192[r8] aesdec xmm1, 208[r8] DLAST_6_2: aesdeclast xmm1, xmm2 pxor xmm1, xmm7 movdqa xmm7, xmm10 movdqu [rsi], xmm1 add rsi, 16 dec r10 jne DLOOP_6_2 DEND_6: ; restore non volatile rdi,rsi mov rdi, rax mov rsi, r11 ; restore non volatile xmms from stack movdqa xmm6, [rsp+0] movdqa xmm7, [rsp+16] movdqa xmm8, [rsp+32] movdqa xmm9, [rsp+48] movdqa xmm10, [rsp+64] movdqa xmm11, [rsp+80] movdqa xmm12, [rsp+96] movdqa xmm13, [rsp+112] movdqa xmm14, [rsp+128] add rsp, 8+9*16 ; 8 = align stack , 9 xmm6-14 16 bytes each ret AES_CBC_decrypt_by6 ENDP ; void AES_CBC_decrypt_by8(const unsigned char *in, ; unsigned char *out, ; unsigned char ivec[16], ; unsigned long length, ; const unsigned char *KS, ; int nr) AES_CBC_decrypt_by8 PROC ; parameter 1: rdi - in ; parameter 2: rsi - out ; parameter 3: rdx - ivec ; parameter 4: rcx - length ; parameter 5: r8 - KS ; parameter 6: r9d - nr ; save rdi and rsi to rax and r11, restore before ret mov rax, rdi mov r11, rsi ; convert to what we had for att&t convention mov rdi, rcx mov rsi, rdx mov rdx, r8 mov rcx,r9 mov r8, [rsp+40] mov r9d, [rsp+48] ; on microsoft xmm6-xmm15 are non volatile, ; let's save on stack and restore at end sub rsp, 8+8*16 ; 8 = align stack , 8 xmm6-13 16 bytes each movdqa [rsp+0], xmm6 movdqa [rsp+16], xmm7 movdqa [rsp+32], xmm8 movdqa [rsp+48], xmm9 movdqa [rsp+64], xmm10 movdqa [rsp+80], xmm11 movdqa [rsp+96], xmm12 movdqa [rsp+112], xmm13 ; back to our original code, more or less mov r10, rcx shr rcx, 4 shl r10, 60 je DNO_PARTS_8 add rcx, 1 DNO_PARTS_8: mov r10, rcx shl r10, 61 shr r10, 61 shr rcx, 3 movdqu xmm9, [rdx] je DREMAINDER_8 sub rsi, 128 DLOOP_8: movdqu xmm1, [rdi] movdqu xmm2, 16[rdi] movdqu xmm3, 32[rdi] movdqu xmm4, 48[rdi] movdqu xmm5, 64[rdi] movdqu xmm6, 80[rdi] movdqu xmm7, 96[rdi] movdqu xmm8, 112[rdi] movdqa xmm10, [r8] movdqa xmm11, 16[r8] movdqa xmm12, 32[r8] movdqa xmm13, 48[r8] pxor xmm1, xmm10 pxor xmm2, xmm10 pxor xmm3, xmm10 pxor xmm4, xmm10 pxor xmm5, xmm10 pxor xmm6, xmm10 pxor xmm7, xmm10 pxor xmm8, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 aesdec xmm7, xmm11 aesdec xmm8, xmm11 aesdec xmm1, xmm12 aesdec xmm2, xmm12 aesdec xmm3, xmm12 aesdec xmm4, xmm12 aesdec xmm5, xmm12 aesdec xmm6, xmm12 aesdec xmm7, xmm12 aesdec xmm8, xmm12 aesdec xmm1, xmm13 aesdec xmm2, xmm13 aesdec xmm3, xmm13 aesdec xmm4, xmm13 aesdec xmm5, xmm13 aesdec xmm6, xmm13 aesdec xmm7, xmm13 aesdec xmm8, xmm13 movdqa xmm10, 64[r8] movdqa xmm11, 80[r8] movdqa xmm12, 96[r8] movdqa xmm13, 112[r8] aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm7, xmm10 aesdec xmm8, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 aesdec xmm7, xmm11 aesdec xmm8, xmm11 aesdec xmm1, xmm12 aesdec xmm2, xmm12 aesdec xmm3, xmm12 aesdec xmm4, xmm12 aesdec xmm5, xmm12 aesdec xmm6, xmm12 aesdec xmm7, xmm12 aesdec xmm8, xmm12 aesdec xmm1, xmm13 aesdec xmm2, xmm13 aesdec xmm3, xmm13 aesdec xmm4, xmm13 aesdec xmm5, xmm13 aesdec xmm6, xmm13 aesdec xmm7, xmm13 aesdec xmm8, xmm13 movdqa xmm10, 128[r8] movdqa xmm11, 144[r8] movdqa xmm12, 160[r8] cmp r9d, 12 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm7, xmm10 aesdec xmm8, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 aesdec xmm7, xmm11 aesdec xmm8, xmm11 jb DLAST_8 movdqa xmm10, 160[r8] movdqa xmm11, 176[r8] movdqa xmm12, 192[r8] cmp r9d, 14 aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm7, xmm10 aesdec xmm8, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 aesdec xmm7, xmm11 aesdec xmm8, xmm11 jb DLAST_8 movdqa xmm10, 192[r8] movdqa xmm11, 208[r8] movdqa xmm12, 224[r8] aesdec xmm1, xmm10 aesdec xmm2, xmm10 aesdec xmm3, xmm10 aesdec xmm4, xmm10 aesdec xmm5, xmm10 aesdec xmm6, xmm10 aesdec xmm7, xmm10 aesdec xmm8, xmm10 aesdec xmm1, xmm11 aesdec xmm2, xmm11 aesdec xmm3, xmm11 aesdec xmm4, xmm11 aesdec xmm5, xmm11 aesdec xmm6, xmm11 aesdec xmm7, xmm11 aesdec xmm8, xmm11 DLAST_8: add rsi, 128 aesdeclast xmm1, xmm12 aesdeclast xmm2, xmm12 aesdeclast xmm3, xmm12 aesdeclast xmm4, xmm12 aesdeclast xmm5, xmm12 aesdeclast xmm6, xmm12 aesdeclast xmm7, xmm12 aesdeclast xmm8, xmm12 movdqu xmm10, [rdi] movdqu xmm11, 16[rdi] movdqu xmm12, 32[rdi] movdqu xmm13, 48[rdi] pxor xmm1, xmm9 pxor xmm2, xmm10 pxor xmm3, xmm11 pxor xmm4, xmm12 pxor xmm5, xmm13 movdqu xmm10, 64[rdi] movdqu xmm11, 80[rdi] movdqu xmm12, 96[rdi] movdqu xmm9, 112[rdi] pxor xmm6, xmm10 pxor xmm7, xmm11 pxor xmm8, xmm12 movdqu [rsi], xmm1 movdqu 16[rsi], xmm2 movdqu 32[rsi], xmm3 movdqu 48[rsi], xmm4 movdqu 64[rsi], xmm5 movdqu 80[rsi], xmm6 movdqu 96[rsi], xmm7 movdqu 112[rsi], xmm8 add rdi, 128 dec rcx jne DLOOP_8 add rsi, 128 DREMAINDER_8: cmp r10, 0 je DEND_8 DLOOP_8_2: movdqu xmm1, [rdi] movdqa xmm10, xmm1 add rdi, 16 pxor xmm1, [r8] movdqu xmm2, 160[r8] cmp r9d, 12 aesdec xmm1, 16[r8] aesdec xmm1, 32[r8] aesdec xmm1, 48[r8] aesdec xmm1, 64[r8] aesdec xmm1, 80[r8] aesdec xmm1, 96[r8] aesdec xmm1, 112[r8] aesdec xmm1, 128[r8] aesdec xmm1, 144[r8] jb DLAST_8_2 movdqu xmm2, 192[r8] cmp r9d, 14 aesdec xmm1, 160[r8] aesdec xmm1, 176[r8] jb DLAST_8_2 movdqu xmm2, 224[r8] aesdec xmm1, 192[r8] aesdec xmm1, 208[r8] DLAST_8_2: aesdeclast xmm1, xmm2 pxor xmm1, xmm9 movdqa xmm9, xmm10 movdqu [rsi], xmm1 add rsi, 16 dec r10 jne DLOOP_8_2 DEND_8: ; restore non volatile rdi,rsi mov rdi, rax mov rsi, r11 ; restore non volatile xmms from stack movdqa xmm6, [rsp+0] movdqa xmm7, [rsp+16] movdqa xmm8, [rsp+32] movdqa xmm9, [rsp+48] movdqa xmm10, [rsp+64] movdqa xmm11, [rsp+80] movdqa xmm12, [rsp+96] movdqa xmm13, [rsp+112] add rsp, 8+8*16 ; 8 = align stack , 8 xmm6-13 16 bytes each ret AES_CBC_decrypt_by8 ENDP ; /* ; AES_ECB_encrypt[const ,unsigned char*in ; unsigned ,char*out ; unsigned ,long length ; const ,unsigned char*KS ; int nr] ; */ ; . globl AES_ECB_encrypt AES_ECB_encrypt PROC ;# parameter 1: rdi ;# parameter 2: rsi ;# parameter 3: rdx ;# parameter 4: rcx ;# parameter 5: r8d ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8d,[rsp+40] ; on microsoft xmm6-xmm15 are non volaitle, let's save on stack and restore at end sub rsp,8+4*16 ; 8 = align stack , 4 xmm9-12, 16 bytes each movdqa [rsp+0], xmm9 movdqa [rsp+16], xmm10 movdqa [rsp+32], xmm11 movdqa [rsp+48], xmm12 mov r10,rdx shr rdx,4 shl r10,60 je EECB_NO_PARTS_4 add rdx,1 EECB_NO_PARTS_4: mov r10,rdx shl r10,62 shr r10,62 shr rdx,2 je EECB_REMAINDER_4 sub rsi,64 EECB_LOOP_4: movdqu xmm1,[rdi] movdqu xmm2,16[rdi] movdqu xmm3,32[rdi] movdqu xmm4,48[rdi] movdqa xmm9,[rcx] movdqa xmm10,16[rcx] movdqa xmm11,32[rcx] movdqa xmm12,48[rcx] pxor xmm1,xmm9 pxor xmm2,xmm9 pxor xmm3,xmm9 pxor xmm4,xmm9 aesenc xmm1,xmm10 aesenc xmm2,xmm10 aesenc xmm3,xmm10 aesenc xmm4,xmm10 aesenc xmm1,xmm11 aesenc xmm2,xmm11 aesenc xmm3,xmm11 aesenc xmm4,xmm11 aesenc xmm1,xmm12 aesenc xmm2,xmm12 aesenc xmm3,xmm12 aesenc xmm4,xmm12 movdqa xmm9,64[rcx] movdqa xmm10,80[rcx] movdqa xmm11,96[rcx] movdqa xmm12,112[rcx] aesenc xmm1,xmm9 aesenc xmm2,xmm9 aesenc xmm3,xmm9 aesenc xmm4,xmm9 aesenc xmm1,xmm10 aesenc xmm2,xmm10 aesenc xmm3,xmm10 aesenc xmm4,xmm10 aesenc xmm1,xmm11 aesenc xmm2,xmm11 aesenc xmm3,xmm11 aesenc xmm4,xmm11 aesenc xmm1,xmm12 aesenc xmm2,xmm12 aesenc xmm3,xmm12 aesenc xmm4,xmm12 movdqa xmm9,128[rcx] movdqa xmm10,144[rcx] movdqa xmm11,160[rcx] cmp r8d,12 aesenc xmm1,xmm9 aesenc xmm2,xmm9 aesenc xmm3,xmm9 aesenc xmm4,xmm9 aesenc xmm1,xmm10 aesenc xmm2,xmm10 aesenc xmm3,xmm10 aesenc xmm4,xmm10 jb EECB_LAST_4 movdqa xmm9,160[rcx] movdqa xmm10,176[rcx] movdqa xmm11,192[rcx] cmp r8d,14 aesenc xmm1,xmm9 aesenc xmm2,xmm9 aesenc xmm3,xmm9 aesenc xmm4,xmm9 aesenc xmm1,xmm10 aesenc xmm2,xmm10 aesenc xmm3,xmm10 aesenc xmm4,xmm10 jb EECB_LAST_4 movdqa xmm9,192[rcx] movdqa xmm10,208[rcx] movdqa xmm11,224[rcx] aesenc xmm1,xmm9 aesenc xmm2,xmm9 aesenc xmm3,xmm9 aesenc xmm4,xmm9 aesenc xmm1,xmm10 aesenc xmm2,xmm10 aesenc xmm3,xmm10 aesenc xmm4,xmm10 EECB_LAST_4: add rdi,64 add rsi,64 dec rdx aesenclast xmm1,xmm11 aesenclast xmm2,xmm11 aesenclast xmm3,xmm11 aesenclast xmm4,xmm11 movdqu [rsi],xmm1 movdqu 16[rsi],xmm2 movdqu 32[rsi],xmm3 movdqu 48[rsi],xmm4 jne EECB_LOOP_4 add rsi,64 EECB_REMAINDER_4: cmp r10,0 je EECB_END_4 EECB_LOOP_4_2: movdqu xmm1,[rdi] add rdi,16 pxor xmm1,[rcx] movdqu xmm2,160[rcx] aesenc xmm1,16[rcx] aesenc xmm1,32[rcx] aesenc xmm1,48[rcx] aesenc xmm1,64[rcx] aesenc xmm1,80[rcx] aesenc xmm1,96[rcx] aesenc xmm1,112[rcx] aesenc xmm1,128[rcx] aesenc xmm1,144[rcx] cmp r8d,12 jb EECB_LAST_4_2 movdqu xmm2,192[rcx] aesenc xmm1,160[rcx] aesenc xmm1,176[rcx] cmp r8d,14 jb EECB_LAST_4_2 movdqu xmm2,224[rcx] aesenc xmm1,192[rcx] aesenc xmm1,208[rcx] EECB_LAST_4_2: aesenclast xmm1,xmm2 movdqu [rsi],xmm1 add rsi,16 dec r10 jne EECB_LOOP_4_2 EECB_END_4: ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ; restore non volatile xmms from stack movdqa xmm9, [rsp+0] movdqa xmm10, [rsp+16] movdqa xmm11, [rsp+32] movdqa xmm12, [rsp+48] add rsp,8+4*16 ; 8 = align stack , 4 xmm9-12 16 bytes each ret AES_ECB_encrypt ENDP ; /* ; AES_ECB_decrypt[const ,unsigned char*in ; unsigned ,char*out ; unsigned ,long length ; const ,unsigned char*KS ; int nr] ; */ ; . globl AES_ECB_decrypt AES_ECB_decrypt PROC ;# parameter 1: rdi ;# parameter 2: rsi ;# parameter 3: rdx ;# parameter 4: rcx ;# parameter 5: r8d ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8d,[rsp+40] ; on microsoft xmm6-xmm15 are non volaitle, let's save on stack and restore at end sub rsp,8+4*16 ; 8 = align stack , 4 xmm9-12, 16 bytes each movdqa [rsp+0], xmm9 movdqa [rsp+16], xmm10 movdqa [rsp+32], xmm11 movdqa [rsp+48], xmm12 mov r10,rdx shr rdx,4 shl r10,60 je DECB_NO_PARTS_4 add rdx,1 DECB_NO_PARTS_4: mov r10,rdx shl r10,62 shr r10,62 shr rdx,2 je DECB_REMAINDER_4 sub rsi,64 DECB_LOOP_4: movdqu xmm1,[rdi] movdqu xmm2,16[rdi] movdqu xmm3,32[rdi] movdqu xmm4,48[rdi] movdqa xmm9,[rcx] movdqa xmm10,16[rcx] movdqa xmm11,32[rcx] movdqa xmm12,48[rcx] pxor xmm1,xmm9 pxor xmm2,xmm9 pxor xmm3,xmm9 pxor xmm4,xmm9 aesdec xmm1,xmm10 aesdec xmm2,xmm10 aesdec xmm3,xmm10 aesdec xmm4,xmm10 aesdec xmm1,xmm11 aesdec xmm2,xmm11 aesdec xmm3,xmm11 aesdec xmm4,xmm11 aesdec xmm1,xmm12 aesdec xmm2,xmm12 aesdec xmm3,xmm12 aesdec xmm4,xmm12 movdqa xmm9,64[rcx] movdqa xmm10,80[rcx] movdqa xmm11,96[rcx] movdqa xmm12,112[rcx] aesdec xmm1,xmm9 aesdec xmm2,xmm9 aesdec xmm3,xmm9 aesdec xmm4,xmm9 aesdec xmm1,xmm10 aesdec xmm2,xmm10 aesdec xmm3,xmm10 aesdec xmm4,xmm10 aesdec xmm1,xmm11 aesdec xmm2,xmm11 aesdec xmm3,xmm11 aesdec xmm4,xmm11 aesdec xmm1,xmm12 aesdec xmm2,xmm12 aesdec xmm3,xmm12 aesdec xmm4,xmm12 movdqa xmm9,128[rcx] movdqa xmm10,144[rcx] movdqa xmm11,160[rcx] cmp r8d,12 aesdec xmm1,xmm9 aesdec xmm2,xmm9 aesdec xmm3,xmm9 aesdec xmm4,xmm9 aesdec xmm1,xmm10 aesdec xmm2,xmm10 aesdec xmm3,xmm10 aesdec xmm4,xmm10 jb DECB_LAST_4 movdqa xmm9,160[rcx] movdqa xmm10,176[rcx] movdqa xmm11,192[rcx] cmp r8d,14 aesdec xmm1,xmm9 aesdec xmm2,xmm9 aesdec xmm3,xmm9 aesdec xmm4,xmm9 aesdec xmm1,xmm10 aesdec xmm2,xmm10 aesdec xmm3,xmm10 aesdec xmm4,xmm10 jb DECB_LAST_4 movdqa xmm9,192[rcx] movdqa xmm10,208[rcx] movdqa xmm11,224[rcx] aesdec xmm1,xmm9 aesdec xmm2,xmm9 aesdec xmm3,xmm9 aesdec xmm4,xmm9 aesdec xmm1,xmm10 aesdec xmm2,xmm10 aesdec xmm3,xmm10 aesdec xmm4,xmm10 DECB_LAST_4: add rdi,64 add rsi,64 dec rdx aesdeclast xmm1,xmm11 aesdeclast xmm2,xmm11 aesdeclast xmm3,xmm11 aesdeclast xmm4,xmm11 movdqu [rsi],xmm1 movdqu 16[rsi],xmm2 movdqu 32[rsi],xmm3 movdqu 48[rsi],xmm4 jne DECB_LOOP_4 add rsi,64 DECB_REMAINDER_4: cmp r10,0 je DECB_END_4 DECB_LOOP_4_2: movdqu xmm1,[rdi] add rdi,16 pxor xmm1,[rcx] movdqu xmm2,160[rcx] cmp r8d,12 aesdec xmm1,16[rcx] aesdec xmm1,32[rcx] aesdec xmm1,48[rcx] aesdec xmm1,64[rcx] aesdec xmm1,80[rcx] aesdec xmm1,96[rcx] aesdec xmm1,112[rcx] aesdec xmm1,128[rcx] aesdec xmm1,144[rcx] jb DECB_LAST_4_2 cmp r8d,14 movdqu xmm2,192[rcx] aesdec xmm1,160[rcx] aesdec xmm1,176[rcx] jb DECB_LAST_4_2 movdqu xmm2,224[rcx] aesdec xmm1,192[rcx] aesdec xmm1,208[rcx] DECB_LAST_4_2: aesdeclast xmm1,xmm2 movdqu [rsi],xmm1 add rsi,16 dec r10 jne DECB_LOOP_4_2 DECB_END_4: ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ; restore non volatile xmms from stack movdqa xmm9, [rsp+0] movdqa xmm10, [rsp+16] movdqa xmm11, [rsp+32] movdqa xmm12, [rsp+48] add rsp,8+4*16 ; 8 = align stack , 4 xmm9-12 16 bytes each ret AES_ECB_decrypt ENDP ; /* ; void ,AES_128_Key_Expansion[const unsigned char*userkey ; unsigned char*key_schedule]/ ; */ ; . align 16,0x90 ; . globl AES_128_Key_Expansion AES_128_Key_Expansion PROC ;# parameter 1: rdi ;# parameter 2: rsi ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx mov dword ptr 240[rsi],10 movdqu xmm1,[rdi] movdqa [rsi],xmm1 ASSISTS: aeskeygenassist xmm2,xmm1,1 call PREPARE_ROUNDKEY_128 movdqa 16[rsi],xmm1 aeskeygenassist xmm2,xmm1,2 call PREPARE_ROUNDKEY_128 movdqa 32[rsi],xmm1 aeskeygenassist xmm2,xmm1,4 call PREPARE_ROUNDKEY_128 movdqa 48[rsi],xmm1 aeskeygenassist xmm2,xmm1,8 call PREPARE_ROUNDKEY_128 movdqa 64[rsi],xmm1 aeskeygenassist xmm2,xmm1,16 call PREPARE_ROUNDKEY_128 movdqa 80[rsi],xmm1 aeskeygenassist xmm2,xmm1,32 call PREPARE_ROUNDKEY_128 movdqa 96[rsi],xmm1 aeskeygenassist xmm2,xmm1,64 call PREPARE_ROUNDKEY_128 movdqa 112[rsi],xmm1 aeskeygenassist xmm2,xmm1,80h call PREPARE_ROUNDKEY_128 movdqa 128[rsi],xmm1 aeskeygenassist xmm2,xmm1,1bh call PREPARE_ROUNDKEY_128 movdqa 144[rsi],xmm1 aeskeygenassist xmm2,xmm1,36h call PREPARE_ROUNDKEY_128 movdqa 160[rsi],xmm1 ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ret PREPARE_ROUNDKEY_128: pshufd xmm2,xmm2,255 movdqa xmm3,xmm1 pslldq xmm3,4 pxor xmm1,xmm3 pslldq xmm3,4 pxor xmm1,xmm3 pslldq xmm3,4 pxor xmm1,xmm3 pxor xmm1,xmm2 ret AES_128_Key_Expansion ENDP ; /* ; void ,AES_192_Key_Expansion[const unsigned char*userkey ; unsigned char*key] ; */ ; . globl AES_192_Key_Expansion AES_192_Key_Expansion PROC ;# parameter 1: rdi ;# parameter 2: rsi ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx ; on microsoft xmm6-xmm15 are non volaitle, let's save on stack and restore at end sub rsp,8+1*16 ; 8 = align stack , 1 xmm6, 16 bytes each movdqa [rsp+0], xmm6 movdqu xmm1,[rdi] movq xmm3,qword ptr 16[rdi] movdqa [rsi],xmm1 movdqa xmm5,xmm3 aeskeygenassist xmm2,xmm3,1h call PREPARE_ROUNDKEY_192 shufpd xmm5,xmm1,0 movdqa 16[rsi],xmm5 movdqa xmm6,xmm1 shufpd xmm6,xmm3,1 movdqa 32[rsi],xmm6 aeskeygenassist xmm2,xmm3,2h call PREPARE_ROUNDKEY_192 movdqa 48[rsi],xmm1 movdqa xmm5,xmm3 aeskeygenassist xmm2,xmm3,4h call PREPARE_ROUNDKEY_192 shufpd xmm5,xmm1,0 movdqa 64[rsi],xmm5 movdqa xmm6,xmm1 shufpd xmm6,xmm3,1 movdqa 80[rsi],xmm6 aeskeygenassist xmm2,xmm3,8h call PREPARE_ROUNDKEY_192 movdqa 96[rsi],xmm1 movdqa xmm5,xmm3 aeskeygenassist xmm2,xmm3,10h call PREPARE_ROUNDKEY_192 shufpd xmm5,xmm1,0 movdqa 112[rsi],xmm5 movdqa xmm6,xmm1 shufpd xmm6,xmm3,1 movdqa 128[rsi],xmm6 aeskeygenassist xmm2,xmm3,20h call PREPARE_ROUNDKEY_192 movdqa 144[rsi],xmm1 movdqa xmm5,xmm3 aeskeygenassist xmm2,xmm3,40h call PREPARE_ROUNDKEY_192 shufpd xmm5,xmm1,0 movdqa 160[rsi],xmm5 movdqa xmm6,xmm1 shufpd xmm6,xmm3,1 movdqa 176[rsi],xmm6 aeskeygenassist xmm2,xmm3,80h call PREPARE_ROUNDKEY_192 movdqa 192[rsi],xmm1 movdqa 208[rsi],xmm3 ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ; restore non volatile xmms from stack movdqa xmm6, [rsp+0] add rsp,8+1*16 ; 8 = align stack , 1 xmm6 16 bytes each ret PREPARE_ROUNDKEY_192: pshufd xmm2,xmm2,55h movdqu xmm4,xmm1 pslldq xmm4,4 pxor xmm1,xmm4 pslldq xmm4,4 pxor xmm1,xmm4 pslldq xmm4,4 pxor xmm1,xmm4 pxor xmm1,xmm2 pshufd xmm2,xmm1,0ffh movdqu xmm4,xmm3 pslldq xmm4,4 pxor xmm3,xmm4 pxor xmm3,xmm2 ret AES_192_Key_Expansion ENDP ; /* ; void ,AES_256_Key_Expansion[const unsigned char*userkey ; unsigned char*key] ; */ ; . globl AES_256_Key_Expansion AES_256_Key_Expansion PROC ;# parameter 1: rdi ;# parameter 2: rsi ; save rdi and rsi to rax and r11, restore before ret mov rax,rdi mov r11,rsi ; convert to what we had for att&t convention mov rdi,rcx mov rsi,rdx movdqu xmm1,[rdi] movdqu xmm3,16[rdi] movdqa [rsi],xmm1 movdqa 16[rsi],xmm3 aeskeygenassist xmm2,xmm3,1h call MAKE_RK256_a movdqa 32[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 48[rsi],xmm3 aeskeygenassist xmm2,xmm3,2h call MAKE_RK256_a movdqa 64[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 80[rsi],xmm3 aeskeygenassist xmm2,xmm3,4h call MAKE_RK256_a movdqa 96[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 112[rsi],xmm3 aeskeygenassist xmm2,xmm3,8h call MAKE_RK256_a movdqa 128[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 144[rsi],xmm3 aeskeygenassist xmm2,xmm3,10h call MAKE_RK256_a movdqa 160[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 176[rsi],xmm3 aeskeygenassist xmm2,xmm3,20h call MAKE_RK256_a movdqa 192[rsi],xmm1 aeskeygenassist xmm2,xmm1,0h call MAKE_RK256_b movdqa 208[rsi],xmm3 aeskeygenassist xmm2,xmm3,40h call MAKE_RK256_a movdqa 224[rsi],xmm1 ; restore non volatile rdi,rsi mov rdi,rax mov rsi,r11 ret AES_256_Key_Expansion ENDP MAKE_RK256_a: pshufd xmm2,xmm2,0ffh movdqa xmm4,xmm1 pslldq xmm4,4 pxor xmm1,xmm4 pslldq xmm4,4 pxor xmm1,xmm4 pslldq xmm4,4 pxor xmm1,xmm4 pxor xmm1,xmm2 ret MAKE_RK256_b: pshufd xmm2,xmm2,0aah movdqa xmm4,xmm3 pslldq xmm4,4 pxor xmm3,xmm4 pslldq xmm4,4 pxor xmm3,xmm4 pslldq xmm4,4 pxor xmm3,xmm4 pxor xmm3,xmm2 ret ; See Intel® Carry-Less Multiplication Instruction ; and its Usage for Computing the GCM Mode White Paper ; by <NAME>, Intel Mobility Group, Israel Development Center; ; and <NAME>, Intel Labs, Circuits and Systems Research ; void gfmul(__m128i a, __m128i b, __m128i* out); ; .globl gfmul gfmul PROC ; xmm0 holds operand a (128 bits) ; xmm1 holds operand b (128 bits) ; r8 holds the pointer to output (128 bits) ; convert to what we had for att&t convention movdqa xmm0, [rcx] movdqa xmm1, [rdx] ; on microsoft xmm6-xmm15 are non volaitle, let's save on stack and restore at end sub rsp,8+4*16 ; 8 = align stack , 4 xmm6-9 16 bytes each movdqa [rsp+0], xmm6 movdqa [rsp+16], xmm7 movdqa [rsp+32], xmm8 movdqa [rsp+48], xmm9 movdqa xmm3, xmm0 pclmulqdq xmm3, xmm1, 0 ; xmm3 holds a0*b0 movdqa xmm4, xmm0 pclmulqdq xmm4, xmm1, 16 ; xmm4 holds a0*b1 movdqa xmm5, xmm0 pclmulqdq xmm5, xmm1, 1 ; xmm5 holds a1*b0 movdqa xmm6, xmm0 pclmulqdq xmm6, xmm1, 17 ; xmm6 holds a1*b1 pxor xmm4, xmm5 ; xmm4 holds a0*b1 + a1*b0 movdqa xmm5, xmm4 psrldq xmm4, 8 pslldq xmm5, 8 pxor xmm3, xmm5 pxor xmm6, xmm4 ; <xmm6:xmm3> holds the result of ; the carry-less multiplication of ; xmm0 by xmm1 ; shift the result by one bit position to the left cope for the fact ; that bits are reversed movdqa xmm7, xmm3 movdqa xmm8, xmm6 pslld xmm3, 1 pslld xmm6, 1 psrld xmm7, 31 psrld xmm8, 31 movdqa xmm9, xmm7 pslldq xmm8, 4 pslldq xmm7, 4 psrldq xmm9, 12 por xmm3, xmm7 por xmm6, xmm8 por xmm6, xmm9 ; first phase of the reduction movdqa xmm7, xmm3 movdqa xmm8, xmm3 movdqa xmm9, xmm3 pslld xmm7, 31 ; packed right shifting << 31 pslld xmm8, 30 ; packed right shifting shift << 30 pslld xmm9, 25 ; packed right shifting shift << 25 pxor xmm7, xmm8 ; xor the shifted versions pxor xmm7, xmm9 movdqa xmm8, xmm7 pslldq xmm7, 12 psrldq xmm8, 4 pxor xmm3, xmm7 ; first phase of the reduction complete movdqa xmm2, xmm3 ; second phase of the reduction movdqa xmm4, xmm3 movdqa xmm5, xmm3 psrld xmm2, 1 ; packed left shifting >> 1 psrld xmm4, 2 ; packed left shifting >> 2 psrld xmm5, 7 ; packed left shifting >> 7 pxor xmm2, xmm4 ; xor the shifted versions pxor xmm2, xmm5 pxor xmm2, xmm8 pxor xmm3, xmm2 pxor xmm6, xmm3 ; the result is in xmm6 movdqu [r8],xmm6 ; store the result ; restore non volatile xmms from stack movdqa xmm6, [rsp+0] movdqa xmm7, [rsp+16] movdqa xmm8, [rsp+32] movdqa xmm9, [rsp+48] add rsp,8+4*16 ; 8 = align stack , 4 xmm6-9 16 bytes each ret gfmul ENDP END
libsrc/_DEVELOPMENT/math/integer/z80_zxn/l_z80_zxn_mulu_16_16x8.asm
Toysoft/z88dk
0
88517
INCLUDE "config_private.inc" SECTION code_clib SECTION code_math PUBLIC l_z80_zxn_mulu_16_16x8 ex de,hl l_z80_zxn_mulu_16_16x8: ; multiplication of a 16-bit number by an 8-bit number into 16-bit product ; ; enter : l = 8-bit multiplicand ; de = 16-bit multiplicand ; ; exit : hl = 16-bit product ; carry reset ; ; uses : af, de, hl ld h,e ; h = yl ld e,l ; e = x mul de ; x * yh ex de,hl mul de ; x * yl ld a,l ; cross product lsb add a,d ; add to msb final ld h,a ld l,e ; hl = final ; 44 cycles, 11 bytes xor a ret
src/Implicits/Resolution/Termination/Lemmas/SizeMeasures.agda
metaborg/ts.agda
4
2944
<gh_stars>1-10 open import Prelude module Implicits.Resolution.Termination.Lemmas.SizeMeasures where open import Induction.WellFounded open import Induction.Nat open import Data.Vec open import Data.Fin.Substitution open import Extensions.Vec open import Implicits.Syntax open import Implicits.Syntax.Type.Unification open import Implicits.Substitutions open import Implicits.Substitutions.Lemmas open import Data.Nat hiding (_<_) open import Data.Nat.Properties open import Relation.Binary using (module DecTotalOrder) open DecTotalOrder decTotalOrder using () renaming (refl to ≤-refl) open import Extensions.Nat open import Implicits.Resolution.Termination.SizeMeasures -- we can show that our size measure a ρ< b is well founded -- by relating it to the well-foundedness proof of _<'_ open import Induction.WellFounded ρ<-well-founded : Well-founded _ρ<_ ρ<-well-founded = sub.well-founded (image.well-founded <-well-founded) where open import Induction.Nat open import Data.Nat open import Data.Nat.Properties module sub = Inverse-image (λ{ (_ , a ) → || a ||}) module image = Subrelation {A = ℕ} {_<_} {_<′_} ≤⇒≤′ open import Induction.WellFounded hρ<-well-founded : Well-founded _hρ<_ hρ<-well-founded = sub.well-founded (image.well-founded <-well-founded) where open import Induction.Nat open import Data.Nat open import Data.Nat.Properties module sub = Inverse-image (λ{ (_ , a ) → h|| a ||}) module image = Subrelation {A = ℕ} {_<_} {_<′_} ≤⇒≤′ m<-well-founded : Well-founded _m<_ m<-well-founded = sub.well-founded (image.well-founded <-well-founded) where module sub = Inverse-image (λ{ (_ , _ , a) → m|| a ||}) module image = Subrelation {A = ℕ} {_<_} {_<′_} ≤⇒≤′ module TypeSubstSizeLemmas where open MetaTypeTypeSubst mutual ||a/Var|| : ∀ {m ν μ} (a : MetaType m ν) (s : Sub Fin ν μ) → m|| a /Var s || ≡ m|| a || ||a/Var|| (a ⇒ b) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| (∀' a) s = cong (λ u → 1 + u) (||a/Var|| a (s VarSubst.↑)) ||a/Var|| (simpl (tvar x)) s = refl ||a/Var|| (simpl (mvar x)) s = refl ||a/Var|| (simpl (a →' b)) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| (simpl (tc c)) s = refl ||weaken-a|| : ∀ {m ν} (a : MetaType m ν) → m|| weaken a || ≡ m|| a || ||weaken-a|| {m} {ν} a = begin m|| weaken a || ≡⟨ refl ⟩ m|| a /Var VarSubst.wk || ≡⟨ ||a/Var|| a VarSubst.wk ⟩ m|| a || ∎ ||s↑|| : ∀ {m ν μ} (s : Sub (MetaType m) ν μ) → (∀ (x : Fin ν) → m|| lookup x s || ≡ 1) → ∀ y → m|| lookup y (s ↑) || ≡ 1 ||s↑|| s p zero = refl ||s↑|| s p (suc y) = begin m|| lookup y (map weaken s) || ≡⟨ cong m||_|| (sym $ lookup⋆map s weaken y) ⟩ m|| weaken (lookup y s) || ≡⟨ ||weaken-a|| (lookup y s) ⟩ m|| (lookup y s) || ≡⟨ p y ⟩ 1 ∎ ||a/s|| : ∀ {m ν μ} (a : MetaType m ν) (s : Sub (MetaType m) ν μ) → (∀ x → m|| lookup x s || ≡ 1) → m|| a / s || ≡ m|| a || ||a/s|| (a ⇒ b) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (∀' a) s p = cong (λ u → 1 + u) (||a/s|| a (s ↑) (||s↑|| s p)) ||a/s|| {m} {ν} (simpl (tvar x)) s p = begin m|| (simpl (tvar x)) / s || ≡⟨ cong m||_|| (MetaTypeTypeLemmas.var-/ {x = x}) ⟩ m|| lookup x s || ≡⟨ p x ⟩ 1 ∎ ||a/s|| (simpl (mvar x)) s p = refl ||a/s|| (simpl (a →' b)) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (simpl (tc c)) s p = refl module MetaSubstSizeLemmas where open MetaTypeMetaSubst hiding (open-meta) mutual ||a/Var|| : ∀ {ν m n} (a : MetaType m ν) (s : Sub Fin m n) → m|| a /Var s || ≡ m|| a || ||a/Var|| (a ⇒ b) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| {ν = ν} (∀' a) s = cong (λ u → 1 + u) (||a/Var|| a ((varLift MetaLift.↑tp) {ν = ν} s)) ||a/Var|| (simpl (tvar x)) s = refl ||a/Var|| (simpl (mvar x)) s = refl ||a/Var|| (simpl (a →' b)) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| (simpl (tc c)) s = refl ||weaken-a|| : ∀ {m ν} (a : MetaType m ν) → m|| weaken a || ≡ m|| a || ||weaken-a|| {m} {ν} a = begin m|| weaken a || ≡⟨ refl ⟩ m|| a /Var VarSubst.wk || ≡⟨ ||a/Var|| a VarSubst.wk ⟩ m|| a || ∎ ||s↑|| : ∀ {m ν μ} (s : Sub (MetaType m) ν μ) → (∀ (x : Fin ν) → m|| lookup x s || ≡ 1) → ∀ y → m|| lookup y (s ↑) || ≡ 1 ||s↑|| s p zero = refl ||s↑|| s p (suc y) = begin m|| lookup y (map weaken s) || ≡⟨ cong m||_|| (sym $ lookup⋆map s weaken y) ⟩ m|| weaken (lookup y s) || ≡⟨ ||weaken-a|| (lookup y s) ⟩ m|| (lookup y s) || ≡⟨ p y ⟩ 1 ∎ ||a/s|| : ∀ {m ν n} (a : MetaType m ν) (s : Sub (flip MetaType ν) m n) → (∀ x → m|| lookup x s || ≡ 1) → m|| a / s || ≡ m|| a || ||a/s|| (a ⇒ b) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (∀' a) s p = cong (λ u → 1 + u) (||a/s|| a (map MetaTypeTypeSubst.weaken s) lem) where lem : ∀ x → m|| lookup x (map MetaTypeTypeSubst.weaken s) || ≡ 1 lem x = begin m|| lookup x (map MetaTypeTypeSubst.weaken s) || ≡⟨ cong m||_|| (sym $ lookup⋆map s _ x) ⟩ m|| MetaTypeTypeSubst.weaken (lookup x s) || ≡⟨ TypeSubstSizeLemmas.||weaken-a|| (lookup x s) ⟩ m|| lookup x s || ≡⟨ p x ⟩ 1 ∎ ||a/s|| {m} {ν} (simpl (mvar x)) s p = begin m|| (simpl (mvar x)) / s || ≡⟨ cong m||_|| (MetaTypeTypeLemmas.var-/ {x = x}) ⟩ m|| lookup x s || ≡⟨ p x ⟩ 1 ∎ ||a/s|| (simpl (tvar x)) s p = refl ||a/s|| (simpl (a →' b)) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (simpl (tc c)) s p = refl ||open-meta-a||≡a : ∀ {m ν} (a : MetaType m (suc ν)) → m|| open-meta a || ≡ m|| a || ||open-meta-a||≡a {m} {ν} a = begin m|| open-meta a || ≡⟨ TypeSubstSizeLemmas.||a/s|| (MMS.weaken a) (MTS.sub (simpl (mvar zero))) lem ⟩ m|| (MMS.weaken a) || ≡⟨ ||weaken-a|| a ⟩ m|| a || ∎ where module MMS = MetaTypeMetaSubst module MTS = MetaTypeTypeSubst lem : ∀ (x : Fin (suc ν)) → m|| lookup x (MetaTypeTypeSubst.sub (simpl (mvar zero))) || ≡ 1 lem zero = refl lem (suc x) = cong m||_|| (MetaTypeTypeLemmas.lookup-sub-↑⋆ {t = (simpl (mvar zero))} zero x) module SubstSizeLemmas where open TypeLemmas mutual ||a|| : ∀ {ν} (a : Type ν) → || a || ≥ 1 ||a|| (simpl (tc x)) = s≤s z≤n ||a|| (simpl (tvar n)) = s≤s z≤n ||a|| (simpl (a →' b)) = s≤s z≤n ||a|| (a ⇒ b) = s≤s z≤n ||a|| (∀' a) = s≤s z≤n ||a/Var|| : ∀ {ν μ} (a : Type ν) (s : Sub Fin ν μ) → || a /Var s || ≡ || a || ||a/Var|| (a ⇒ b) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| (∀' a) s = cong (λ u → 1 + u) (||a/Var|| a (s VarSubst.↑)) ||a/Var|| (simpl (tvar x)) s = refl ||a/Var|| (simpl (a →' b)) s = cong₂ (λ u v → 1 + u + v) (||a/Var|| a s) (||a/Var|| b s) ||a/Var|| (simpl (tc c)) s = refl ||weaken-a|| : ∀ {ν} (a : Type ν) → || weaken a || ≡ || a || ||weaken-a|| {ν} a = begin || weaken a || ≡⟨ refl ⟩ || a /Var VarSubst.wk || ≡⟨ ||a/Var|| a VarSubst.wk ⟩ || a || ∎ ||s↑|| : ∀ {ν μ} (s : Sub Type ν μ) → (∀ (x : Fin ν) → || lookup x s || ≡ 1) → ∀ y → || lookup y (s ↑) || ≡ 1 ||s↑|| s p zero = refl ||s↑|| s p (suc y) = begin || lookup y (map weaken s) || ≡⟨ cong ||_|| (sym $ lookup⋆map s weaken y) ⟩ || weaken (lookup y s) || ≡⟨ ||weaken-a|| (lookup y s) ⟩ || (lookup y s) || ≡⟨ p y ⟩ 1 ∎ ||a/s|| : ∀ {ν μ} (a : Type ν) (s : Sub Type ν μ) → (∀ x → || lookup x s || ≡ 1) → || a / s || ≡ || a || ||a/s|| (a ⇒ b) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (∀' a) s p = cong (λ u → 1 + u) (||a/s|| a (s ↑) (||s↑|| s p)) ||a/s|| {m} {ν} (simpl (tvar x)) s p = begin || (simpl (tvar x)) / s || ≡⟨ cong ||_|| (var-/ {x = x}) ⟩ || lookup x s || ≡⟨ p x ⟩ 1 ∎ ||a/s|| (simpl (a →' b)) s p = cong₂ (λ u v → 1 + u + v) (||a/s|| a s p) (||a/s|| b s p) ||a/s|| (simpl (tc c)) s p = refl ||a/wk↑k|| : ∀ {ν} k (a : Type (k + ν)) → || a / wk ↑⋆ k || ≡ || a || ||a/wk↑k|| k a = ||a/s|| a (wk ↑⋆ k) (λ x → cong ||_|| (lookup-wk-↑⋆ k x)) ||a/s||' : ∀ {ν μ} (a : Type ν) (s : Sub Type ν μ) → || a || ≤ || a / s || ||a/s||' (simpl (tc x)) s = s≤s z≤n ||a/s||' (simpl (tvar n)) s = ||a|| (lookup n s) ||a/s||' (simpl (a →' b)) s = s≤s (<-+ (||a/s||' a s) (||a/s||' b s)) ||a/s||' (a ⇒ b) s = s≤s (<-+ (||a/s||' a s) (||a/s||' b s)) ||a/s||' (∀' b) s = s≤s (||a/s||' b (s TypeSubst.↑)) h||a/s|| : ∀ {ν μ} (a : Type ν) (s : Sub Type ν μ) → (, a) hρ≤ (, a / s) h||a/s|| (simpl (tc x)) s = s≤s z≤n h||a/s|| (simpl (tvar n)) s = ||a|| (proj₂ (lookup n s ◁)) h||a/s|| (simpl (a →' b)) s = s≤s (<-+ (||a/s||' a s) (||a/s||' b s)) h||a/s|| (a ⇒ b) s = h||a/s|| b s h||a/s|| (∀' b) s = h||a/s|| b (s TypeSubst.↑) a-ρ<-∀a : ∀ {n} a → (suc n , a) ρ< (, ∀' a) a-ρ<-∀a _ = ≤-refl b-ρ<-a⇒b : ∀ {ν} (a b : Type ν) → (_ , b) ρ< (_ , a ⇒ b) b-ρ<-a⇒b a b = s≤s (≤-steps || a || ≤-refl) b-hρ≤-a⇒b : ∀ {ν} (a b : Type ν) → (_ , b) hρ≤ (_ , a ⇒ b) b-hρ≤-a⇒b a b = subst (λ u → u ≤ h|| a ⇒ b ||) refl ≤-refl a-m<-∀a : ∀ {m ν} a → (m , suc ν , a) m< (m , ν , ∀' a) a-m<-∀a a = ≤-refl b-m<-a⇒b : ∀ {m ν} a b → (m , ν , b) m< (m , ν , a ⇒ b) b-m<-a⇒b a b = s≤s (≤-steps m|| a || ≤-refl) open-meta-a-m<-∀'a : ∀ {m ν} a → (suc m , ν , open-meta a) m< (m , ν , ∀' a) open-meta-a-m<-∀'a a = subst (λ x → x < m|| ∀' a ||) (sym $ MetaSubstSizeLemmas.||open-meta-a||≡a a) (a-m<-∀a a)
coverage/PENDING_SUBMIT/amdvlk/0612-COVERAGE-instruction-simplify-2340/work/variant/1_spirv_asm/shader.frag.asm
asuonpaa/ShaderTests
0
164358
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 133 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %59 %114 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %11 "arr" OpName %14 "buf1" OpMemberName %14 0 "_GLF_uniform_float_values" OpName %16 "" OpName %43 "buf2" OpMemberName %43 0 "injectionSwitch" OpName %45 "" OpName %59 "gl_FragCoord" OpName %78 "buf0" OpMemberName %78 0 "_GLF_uniform_int_values" OpName %80 "" OpName %114 "_GLF_color" OpDecorate %13 ArrayStride 16 OpMemberDecorate %14 0 Offset 0 OpDecorate %14 Block OpDecorate %16 DescriptorSet 0 OpDecorate %16 Binding 1 OpMemberDecorate %43 0 Offset 0 OpDecorate %43 Block OpDecorate %45 DescriptorSet 0 OpDecorate %45 Binding 2 OpDecorate %59 BuiltIn FragCoord OpDecorate %77 ArrayStride 16 OpMemberDecorate %78 0 Offset 0 OpDecorate %78 Block OpDecorate %80 DescriptorSet 0 OpDecorate %80 Binding 0 OpDecorate %114 Location 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeFloat 32 %7 = OpTypeInt 32 0 %8 = OpConstant %7 10 %9 = OpTypeArray %6 %8 %10 = OpTypePointer Function %9 %12 = OpConstant %7 2 %13 = OpTypeArray %6 %12 %14 = OpTypeStruct %13 %15 = OpTypePointer Uniform %14 %16 = OpVariable %15 Uniform %17 = OpTypeInt 32 1 %18 = OpConstant %17 0 %19 = OpConstant %17 1 %20 = OpTypePointer Uniform %6 %42 = OpTypeVector %6 2 %43 = OpTypeStruct %42 %44 = OpTypePointer Uniform %43 %45 = OpVariable %44 Uniform %46 = OpConstant %7 0 %49 = OpConstant %7 1 %52 = OpTypeBool %57 = OpTypeVector %6 4 %58 = OpTypePointer Input %57 %59 = OpVariable %58 Input %60 = OpTypePointer Input %6 %63 = OpConstant %6 0 %76 = OpConstant %7 4 %77 = OpTypeArray %17 %76 %78 = OpTypeStruct %77 %79 = OpTypePointer Uniform %78 %80 = OpVariable %79 Uniform %81 = OpConstant %17 3 %82 = OpTypePointer Uniform %17 %91 = OpTypePointer Function %6 %102 = OpConstant %17 2 %113 = OpTypePointer Output %57 %114 = OpVariable %113 Output %4 = OpFunction %2 None %3 %5 = OpLabel %11 = OpVariable %10 Function %21 = OpAccessChain %20 %16 %18 %19 %22 = OpLoad %6 %21 %23 = OpAccessChain %20 %16 %18 %19 %24 = OpLoad %6 %23 %25 = OpAccessChain %20 %16 %18 %19 %26 = OpLoad %6 %25 %27 = OpAccessChain %20 %16 %18 %19 %28 = OpLoad %6 %27 %29 = OpAccessChain %20 %16 %18 %19 %30 = OpLoad %6 %29 %31 = OpAccessChain %20 %16 %18 %19 %32 = OpLoad %6 %31 %33 = OpAccessChain %20 %16 %18 %19 %34 = OpLoad %6 %33 %35 = OpAccessChain %20 %16 %18 %19 %36 = OpLoad %6 %35 %37 = OpAccessChain %20 %16 %18 %19 %38 = OpLoad %6 %37 %39 = OpAccessChain %20 %16 %18 %19 %40 = OpLoad %6 %39 %41 = OpCompositeConstruct %9 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 OpStore %11 %41 %47 = OpAccessChain %20 %45 %18 %46 %48 = OpLoad %6 %47 %50 = OpAccessChain %20 %45 %18 %49 %51 = OpLoad %6 %50 %53 = OpFOrdGreaterThan %52 %48 %51 OpSelectionMerge %55 None OpBranchConditional %53 %54 %56 %54 = OpLabel OpBranch %55 %56 = OpLabel %61 = OpAccessChain %60 %59 %46 %62 = OpLoad %6 %61 %64 = OpFOrdLessThan %52 %62 %63 OpSelectionMerge %66 None OpBranchConditional %64 %65 %67 %65 = OpLabel OpBranch %66 %67 = OpLabel %68 = OpAccessChain %20 %45 %18 %46 %69 = OpLoad %6 %68 %70 = OpAccessChain %20 %45 %18 %49 %71 = OpLoad %6 %70 %72 = OpFOrdGreaterThan %52 %69 %71 OpSelectionMerge %74 None OpBranchConditional %72 %73 %75 %73 = OpLabel OpBranch %74 %75 = OpLabel %83 = OpAccessChain %82 %80 %18 %81 %84 = OpLoad %17 %83 %85 = OpAccessChain %82 %80 %18 %19 %86 = OpLoad %17 %85 %87 = OpExtInst %17 %1 FindILsb %86 %88 = OpSDiv %17 %84 %87 %89 = OpAccessChain %20 %16 %18 %18 %90 = OpLoad %6 %89 %92 = OpAccessChain %91 %11 %88 OpStore %92 %90 OpBranch %74 %74 = OpLabel OpBranch %66 %66 = OpLabel OpBranch %55 %55 = OpLabel %93 = OpAccessChain %82 %80 %18 %18 %94 = OpLoad %17 %93 %95 = OpAccessChain %91 %11 %94 %96 = OpLoad %6 %95 %97 = OpAccessChain %20 %16 %18 %19 %98 = OpLoad %6 %97 %99 = OpFOrdEqual %52 %96 %98 OpSelectionMerge %101 None OpBranchConditional %99 %100 %101 %100 = OpLabel %103 = OpAccessChain %82 %80 %18 %102 %104 = OpLoad %17 %103 %105 = OpAccessChain %91 %11 %104 %106 = OpLoad %6 %105 %107 = OpAccessChain %20 %16 %18 %18 %108 = OpLoad %6 %107 %109 = OpFOrdEqual %52 %106 %108 OpBranch %101 %101 = OpLabel %110 = OpPhi %52 %99 %55 %109 %100 OpSelectionMerge %112 None OpBranchConditional %110 %111 %128 %111 = OpLabel %115 = OpAccessChain %82 %80 %18 %102 %116 = OpLoad %17 %115 %117 = OpConvertSToF %6 %116 %118 = OpAccessChain %82 %80 %18 %18 %119 = OpLoad %17 %118 %120 = OpConvertSToF %6 %119 %121 = OpAccessChain %82 %80 %18 %18 %122 = OpLoad %17 %121 %123 = OpConvertSToF %6 %122 %124 = OpAccessChain %82 %80 %18 %102 %125 = OpLoad %17 %124 %126 = OpConvertSToF %6 %125 %127 = OpCompositeConstruct %57 %117 %120 %123 %126 OpStore %114 %127 OpBranch %112 %128 = OpLabel %129 = OpAccessChain %82 %80 %18 %18 %130 = OpLoad %17 %129 %131 = OpConvertSToF %6 %130 %132 = OpCompositeConstruct %57 %131 %131 %131 %131 OpStore %114 %132 OpBranch %112 %112 = OpLabel OpReturn OpFunctionEnd
programs/oeis/033/A033414.asm
neoneye/loda
22
163185
; A033414: a(n) = floor(94/n). ; 94,47,31,23,18,15,13,11,10,9,8,7,7,6,6,5,5,5,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 add $0,1 mov $1,94 div $1,$0 mov $0,$1
tests/thread/main.adb
Fabien-Chouteau/ASFML
0
11317
<filename>tests/thread/main.adb with Ada.Text_IO; use Ada.Text_IO; with Sf.System.Thread; use Sf, Sf.System, Sf.System.Thread; with Sf.System.Sleep; use Sf.System.Sleep; with Thread_Func; procedure Main is Thread : sfThread_Ptr; TFunc : sfThreadFunc_Ptr := Thread_Func'Access; UData : String := "Hello"; begin Thread := Create (TFunc, UData'Address); Launch (Thread); for I in 1 .. 10 loop Put_Line ("I'm main thread"); sfDelay (0.001); end loop; Destroy (Thread); end Main;
ado/src/sqlbench.ads
fjudith/sql-benchmark
24
10288
<reponame>fjudith/sql-benchmark ----------------------------------------------------------------------- -- sqlbench -- SQL Benchmark -- Copyright (C) 2018 <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 ADO.Sessions; with ADO.Sessions.Factory; private with Util.Measures; private with Util.Properties; private with Ada.Containers.Indefinite_Vectors; package Sqlbench is Benchmark_Error : exception; type Context_Type is tagged limited private; type Repeat_Type is new Positive range 1 .. 1_000_000; subtype Repeat_Factor_Type is Repeat_Type range 1 .. 100; type Benchmark_Handler is access not null procedure (Context : in out Context_Type); -- Register a benchmark handler under the given name. procedure Register (Context : in out Context_Type; Handler : in Benchmark_Handler; Title : in String; Factor : in Repeat_Factor_Type := 100) with Pre => Title'Length > 0; -- Get the database session to make SQL requests on the database. function Get_Session (Context : in Context_Type) return ADO.Sessions.Master_Session; -- Get a benchmark configuration parameter. function Get_Parameter (Context : in Context_Type; Name : in String) return String with Pre => Name'Length > 0; -- Get a SQL configuration file path that depends on the database driver. -- The file is of the form: <config-directory>/<database-driver>-<name> function Get_Config_Path (Context : in Context_Type; Name : in String) return String with Pre => Name'Length > 0; -- Get the database driver name. function Get_Driver_Name (Context : in Context_Type) return String with Post => Get_Driver_Name'Result'Length > 0; private type Benchmark_Test (Len : Natural) is record Handler : Benchmark_Handler; Title : String (1 .. Len); Factor : Repeat_Factor_Type := 1; end record; package Benchmark_Test_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => Benchmark_Test, "=" => "="); subtype Benchmark_Vector is Benchmark_Test_Vectors.Vector; subtype Benchmark_Cursor is Benchmark_Test_Vectors.Cursor; type Context_Type is tagged limited record Perf : Util.Measures.Measure_Set; Repeat : Repeat_Type := 1; Session : ADO.Sessions.Master_Session; Factory : ADO.Sessions.Factory.Session_Factory; Tests : Benchmark_Vector; Config : Util.Properties.Manager; end record; end Sqlbench;
user/alloctest.asm
Grapefruitcc/xv6-riscv-fall19
1
12377
<reponame>Grapefruitcc/xv6-riscv-fall19 user/_alloctest: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <test0>: #include "kernel/fcntl.h" #include "kernel/memlayout.h" #include "user/user.h" void test0() { 0: 715d addi sp,sp,-80 2: e486 sd ra,72(sp) 4: e0a2 sd s0,64(sp) 6: fc26 sd s1,56(sp) 8: f84a sd s2,48(sp) a: f44e sd s3,40(sp) c: f052 sd s4,32(sp) e: ec56 sd s5,24(sp) 10: 0880 addi s0,sp,80 enum { NCHILD = 50, NFD = 10}; int i, j; int fd; printf("filetest: start\n"); 12: 00001517 auipc a0,0x1 16: 9de50513 addi a0,a0,-1570 # 9f0 <malloc+0xec> 1a: 00001097 auipc ra,0x1 1e: 82c080e7 jalr -2004(ra) # 846 <printf> 22: 03200493 li s1,50 printf("test setup is wrong\n"); exit(1); } for (i = 0; i < NCHILD; i++) { int pid = fork(); 26: 00000097 auipc ra,0x0 2a: 498080e7 jalr 1176(ra) # 4be <fork> if(pid < 0){ 2e: 00054f63 bltz a0,4c <test0+0x4c> printf("fork failed"); exit(1); } if(pid == 0){ 32: c915 beqz a0,66 <test0+0x66> for (i = 0; i < NCHILD; i++) { 34: 34fd addiw s1,s1,-1 36: f8e5 bnez s1,26 <test0+0x26> 38: 03200493 li s1,50 sleep(10); exit(0); // no errors; exit with 0. } } int all_ok = 1; 3c: 4905 li s2,1 for(int i = 0; i < NCHILD; i++){ int xstatus; wait(&xstatus); if(xstatus != 0) { if(all_ok == 1) 3e: 4985 li s3,1 printf("filetest: FAILED\n"); 40: 00001a97 auipc s5,0x1 44: 9e0a8a93 addi s5,s5,-1568 # a20 <malloc+0x11c> all_ok = 0; 48: 4a01 li s4,0 4a: a8b1 j a6 <test0+0xa6> printf("fork failed"); 4c: 00001517 auipc a0,0x1 50: 9bc50513 addi a0,a0,-1604 # a08 <malloc+0x104> 54: 00000097 auipc ra,0x0 58: 7f2080e7 jalr 2034(ra) # 846 <printf> exit(1); 5c: 4505 li a0,1 5e: 00000097 auipc ra,0x0 62: 468080e7 jalr 1128(ra) # 4c6 <exit> 66: 44a9 li s1,10 if ((fd = open("README", O_RDONLY)) < 0) { 68: 00001917 auipc s2,0x1 6c: 9b090913 addi s2,s2,-1616 # a18 <malloc+0x114> 70: 4581 li a1,0 72: 854a mv a0,s2 74: 00000097 auipc ra,0x0 78: 492080e7 jalr 1170(ra) # 506 <open> 7c: 00054e63 bltz a0,98 <test0+0x98> for(j = 0; j < NFD; j++) { 80: 34fd addiw s1,s1,-1 82: f4fd bnez s1,70 <test0+0x70> sleep(10); 84: 4529 li a0,10 86: 00000097 auipc ra,0x0 8a: 4d0080e7 jalr 1232(ra) # 556 <sleep> exit(0); // no errors; exit with 0. 8e: 4501 li a0,0 90: 00000097 auipc ra,0x0 94: 436080e7 jalr 1078(ra) # 4c6 <exit> exit(1); 98: 4505 li a0,1 9a: 00000097 auipc ra,0x0 9e: 42c080e7 jalr 1068(ra) # 4c6 <exit> for(int i = 0; i < NCHILD; i++){ a2: 34fd addiw s1,s1,-1 a4: c09d beqz s1,ca <test0+0xca> wait(&xstatus); a6: fbc40513 addi a0,s0,-68 aa: 00000097 auipc ra,0x0 ae: 424080e7 jalr 1060(ra) # 4ce <wait> if(xstatus != 0) { b2: fbc42783 lw a5,-68(s0) b6: d7f5 beqz a5,a2 <test0+0xa2> if(all_ok == 1) b8: ff3915e3 bne s2,s3,a2 <test0+0xa2> printf("filetest: FAILED\n"); bc: 8556 mv a0,s5 be: 00000097 auipc ra,0x0 c2: 788080e7 jalr 1928(ra) # 846 <printf> all_ok = 0; c6: 8952 mv s2,s4 c8: bfe9 j a2 <test0+0xa2> } } if(all_ok) ca: 00091b63 bnez s2,e0 <test0+0xe0> printf("filetest: OK\n"); } ce: 60a6 ld ra,72(sp) d0: 6406 ld s0,64(sp) d2: 74e2 ld s1,56(sp) d4: 7942 ld s2,48(sp) d6: 79a2 ld s3,40(sp) d8: 7a02 ld s4,32(sp) da: 6ae2 ld s5,24(sp) dc: 6161 addi sp,sp,80 de: 8082 ret printf("filetest: OK\n"); e0: 00001517 auipc a0,0x1 e4: 95850513 addi a0,a0,-1704 # a38 <malloc+0x134> e8: 00000097 auipc ra,0x0 ec: 75e080e7 jalr 1886(ra) # 846 <printf> } f0: bff9 j ce <test0+0xce> 00000000000000f2 <test1>: // Allocate all free memory and count how it is void test1() { f2: 7139 addi sp,sp,-64 f4: fc06 sd ra,56(sp) f6: f822 sd s0,48(sp) f8: f426 sd s1,40(sp) fa: f04a sd s2,32(sp) fc: ec4e sd s3,24(sp) fe: 0080 addi s0,sp,64 void *a; int tot = 0; char buf[1]; int fds[2]; printf("memtest: start\n"); 100: 00001517 auipc a0,0x1 104: 94850513 addi a0,a0,-1720 # a48 <malloc+0x144> 108: 00000097 auipc ra,0x0 10c: 73e080e7 jalr 1854(ra) # 846 <printf> if(pipe(fds) != 0){ 110: fc040513 addi a0,s0,-64 114: 00000097 auipc ra,0x0 118: 3c2080e7 jalr 962(ra) # 4d6 <pipe> 11c: e525 bnez a0,184 <test1+0x92> 11e: 84aa mv s1,a0 printf("pipe() failed\n"); exit(1); } int pid = fork(); 120: 00000097 auipc ra,0x0 124: 39e080e7 jalr 926(ra) # 4be <fork> if(pid < 0){ 128: 06054b63 bltz a0,19e <test1+0xac> printf("fork failed"); exit(1); } if(pid == 0){ 12c: e959 bnez a0,1c2 <test1+0xd0> close(fds[0]); 12e: fc042503 lw a0,-64(s0) 132: 00000097 auipc ra,0x0 136: 3bc080e7 jalr 956(ra) # 4ee <close> while(1) { a = sbrk(PGSIZE); if (a == (char*)0xffffffffffffffffL) 13a: 597d li s2,-1 exit(0); *(int *)(a+4) = 1; 13c: 4485 li s1,1 if (write(fds[1], "x", 1) != 1) { 13e: 00001997 auipc s3,0x1 142: 92a98993 addi s3,s3,-1750 # a68 <malloc+0x164> a = sbrk(PGSIZE); 146: 6505 lui a0,0x1 148: 00000097 auipc ra,0x0 14c: 406080e7 jalr 1030(ra) # 54e <sbrk> if (a == (char*)0xffffffffffffffffL) 150: 07250463 beq a0,s2,1b8 <test1+0xc6> *(int *)(a+4) = 1; 154: c144 sw s1,4(a0) if (write(fds[1], "x", 1) != 1) { 156: 8626 mv a2,s1 158: 85ce mv a1,s3 15a: fc442503 lw a0,-60(s0) 15e: 00000097 auipc ra,0x0 162: 388080e7 jalr 904(ra) # 4e6 <write> 166: fe9500e3 beq a0,s1,146 <test1+0x54> printf("write failed"); 16a: 00001517 auipc a0,0x1 16e: 90650513 addi a0,a0,-1786 # a70 <malloc+0x16c> 172: 00000097 auipc ra,0x0 176: 6d4080e7 jalr 1748(ra) # 846 <printf> exit(1); 17a: 4505 li a0,1 17c: 00000097 auipc ra,0x0 180: 34a080e7 jalr 842(ra) # 4c6 <exit> printf("pipe() failed\n"); 184: 00001517 auipc a0,0x1 188: 8d450513 addi a0,a0,-1836 # a58 <malloc+0x154> 18c: 00000097 auipc ra,0x0 190: 6ba080e7 jalr 1722(ra) # 846 <printf> exit(1); 194: 4505 li a0,1 196: 00000097 auipc ra,0x0 19a: 330080e7 jalr 816(ra) # 4c6 <exit> printf("fork failed"); 19e: 00001517 auipc a0,0x1 1a2: 86a50513 addi a0,a0,-1942 # a08 <malloc+0x104> 1a6: 00000097 auipc ra,0x0 1aa: 6a0080e7 jalr 1696(ra) # 846 <printf> exit(1); 1ae: 4505 li a0,1 1b0: 00000097 auipc ra,0x0 1b4: 316080e7 jalr 790(ra) # 4c6 <exit> exit(0); 1b8: 4501 li a0,0 1ba: 00000097 auipc ra,0x0 1be: 30c080e7 jalr 780(ra) # 4c6 <exit> } } exit(0); } close(fds[1]); 1c2: fc442503 lw a0,-60(s0) 1c6: 00000097 auipc ra,0x0 1ca: 328080e7 jalr 808(ra) # 4ee <close> while(1) { if (read(fds[0], buf, 1) != 1) { 1ce: 4605 li a2,1 1d0: fc840593 addi a1,s0,-56 1d4: fc042503 lw a0,-64(s0) 1d8: 00000097 auipc ra,0x0 1dc: 306080e7 jalr 774(ra) # 4de <read> 1e0: 4785 li a5,1 1e2: 00f51463 bne a0,a5,1ea <test1+0xf8> break; } else { tot += 1; 1e6: 2485 addiw s1,s1,1 if (read(fds[0], buf, 1) != 1) { 1e8: b7dd j 1ce <test1+0xdc> } } //int n = (PHYSTOP-KERNBASE)/PGSIZE; //printf("allocated %d out of %d pages\n", tot, n); if(tot < 31950) { 1ea: 67a1 lui a5,0x8 1ec: ccd78793 addi a5,a5,-819 # 7ccd <__global_pointer$+0x69d4> 1f0: 0297ca63 blt a5,s1,224 <test1+0x132> printf("expected to allocate at least 31950, only got %d\n", tot); 1f4: 85a6 mv a1,s1 1f6: 00001517 auipc a0,0x1 1fa: 88a50513 addi a0,a0,-1910 # a80 <malloc+0x17c> 1fe: 00000097 auipc ra,0x0 202: 648080e7 jalr 1608(ra) # 846 <printf> printf("memtest: FAILED\n"); 206: 00001517 auipc a0,0x1 20a: 8b250513 addi a0,a0,-1870 # ab8 <malloc+0x1b4> 20e: 00000097 auipc ra,0x0 212: 638080e7 jalr 1592(ra) # 846 <printf> } else { printf("memtest: OK\n"); } } 216: 70e2 ld ra,56(sp) 218: 7442 ld s0,48(sp) 21a: 74a2 ld s1,40(sp) 21c: 7902 ld s2,32(sp) 21e: 69e2 ld s3,24(sp) 220: 6121 addi sp,sp,64 222: 8082 ret printf("memtest: OK\n"); 224: 00001517 auipc a0,0x1 228: 8ac50513 addi a0,a0,-1876 # ad0 <malloc+0x1cc> 22c: 00000097 auipc ra,0x0 230: 61a080e7 jalr 1562(ra) # 846 <printf> } 234: b7cd j 216 <test1+0x124> 0000000000000236 <main>: int main(int argc, char *argv[]) { 236: 1141 addi sp,sp,-16 238: e406 sd ra,8(sp) 23a: e022 sd s0,0(sp) 23c: 0800 addi s0,sp,16 test0(); 23e: 00000097 auipc ra,0x0 242: dc2080e7 jalr -574(ra) # 0 <test0> test1(); 246: 00000097 auipc ra,0x0 24a: eac080e7 jalr -340(ra) # f2 <test1> exit(0); 24e: 4501 li a0,0 250: 00000097 auipc ra,0x0 254: 276080e7 jalr 630(ra) # 4c6 <exit> 0000000000000258 <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { 258: 1141 addi sp,sp,-16 25a: e422 sd s0,8(sp) 25c: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) 25e: 87aa mv a5,a0 260: 0585 addi a1,a1,1 262: 0785 addi a5,a5,1 264: fff5c703 lbu a4,-1(a1) 268: fee78fa3 sb a4,-1(a5) 26c: fb75 bnez a4,260 <strcpy+0x8> ; return os; } 26e: 6422 ld s0,8(sp) 270: 0141 addi sp,sp,16 272: 8082 ret 0000000000000274 <strcmp>: int strcmp(const char *p, const char *q) { 274: 1141 addi sp,sp,-16 276: e422 sd s0,8(sp) 278: 0800 addi s0,sp,16 while(*p && *p == *q) 27a: 00054783 lbu a5,0(a0) 27e: cb91 beqz a5,292 <strcmp+0x1e> 280: 0005c703 lbu a4,0(a1) 284: 00f71763 bne a4,a5,292 <strcmp+0x1e> p++, q++; 288: 0505 addi a0,a0,1 28a: 0585 addi a1,a1,1 while(*p && *p == *q) 28c: 00054783 lbu a5,0(a0) 290: fbe5 bnez a5,280 <strcmp+0xc> return (uchar)*p - (uchar)*q; 292: 0005c503 lbu a0,0(a1) } 296: 40a7853b subw a0,a5,a0 29a: 6422 ld s0,8(sp) 29c: 0141 addi sp,sp,16 29e: 8082 ret 00000000000002a0 <strlen>: uint strlen(const char *s) { 2a0: 1141 addi sp,sp,-16 2a2: e422 sd s0,8(sp) 2a4: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) 2a6: 00054783 lbu a5,0(a0) 2aa: cf91 beqz a5,2c6 <strlen+0x26> 2ac: 0505 addi a0,a0,1 2ae: 87aa mv a5,a0 2b0: 4685 li a3,1 2b2: 9e89 subw a3,a3,a0 2b4: 00f6853b addw a0,a3,a5 2b8: 0785 addi a5,a5,1 2ba: fff7c703 lbu a4,-1(a5) 2be: fb7d bnez a4,2b4 <strlen+0x14> ; return n; } 2c0: 6422 ld s0,8(sp) 2c2: 0141 addi sp,sp,16 2c4: 8082 ret for(n = 0; s[n]; n++) 2c6: 4501 li a0,0 2c8: bfe5 j 2c0 <strlen+0x20> 00000000000002ca <memset>: void* memset(void *dst, int c, uint n) { 2ca: 1141 addi sp,sp,-16 2cc: e422 sd s0,8(sp) 2ce: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ 2d0: ca19 beqz a2,2e6 <memset+0x1c> 2d2: 87aa mv a5,a0 2d4: 1602 slli a2,a2,0x20 2d6: 9201 srli a2,a2,0x20 2d8: 00a60733 add a4,a2,a0 cdst[i] = c; 2dc: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ 2e0: 0785 addi a5,a5,1 2e2: fee79de3 bne a5,a4,2dc <memset+0x12> } return dst; } 2e6: 6422 ld s0,8(sp) 2e8: 0141 addi sp,sp,16 2ea: 8082 ret 00000000000002ec <strchr>: char* strchr(const char *s, char c) { 2ec: 1141 addi sp,sp,-16 2ee: e422 sd s0,8(sp) 2f0: 0800 addi s0,sp,16 for(; *s; s++) 2f2: 00054783 lbu a5,0(a0) 2f6: cb99 beqz a5,30c <strchr+0x20> if(*s == c) 2f8: 00f58763 beq a1,a5,306 <strchr+0x1a> for(; *s; s++) 2fc: 0505 addi a0,a0,1 2fe: 00054783 lbu a5,0(a0) 302: fbfd bnez a5,2f8 <strchr+0xc> return (char*)s; return 0; 304: 4501 li a0,0 } 306: 6422 ld s0,8(sp) 308: 0141 addi sp,sp,16 30a: 8082 ret return 0; 30c: 4501 li a0,0 30e: bfe5 j 306 <strchr+0x1a> 0000000000000310 <gets>: char* gets(char *buf, int max) { 310: 711d addi sp,sp,-96 312: ec86 sd ra,88(sp) 314: e8a2 sd s0,80(sp) 316: e4a6 sd s1,72(sp) 318: e0ca sd s2,64(sp) 31a: fc4e sd s3,56(sp) 31c: f852 sd s4,48(sp) 31e: f456 sd s5,40(sp) 320: f05a sd s6,32(sp) 322: ec5e sd s7,24(sp) 324: 1080 addi s0,sp,96 326: 8baa mv s7,a0 328: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ 32a: 892a mv s2,a0 32c: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') 32e: 4aa9 li s5,10 330: 4b35 li s6,13 for(i=0; i+1 < max; ){ 332: 89a6 mv s3,s1 334: 2485 addiw s1,s1,1 336: 0344d863 bge s1,s4,366 <gets+0x56> cc = read(0, &c, 1); 33a: 4605 li a2,1 33c: faf40593 addi a1,s0,-81 340: 4501 li a0,0 342: 00000097 auipc ra,0x0 346: 19c080e7 jalr 412(ra) # 4de <read> if(cc < 1) 34a: 00a05e63 blez a0,366 <gets+0x56> buf[i++] = c; 34e: faf44783 lbu a5,-81(s0) 352: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') 356: 01578763 beq a5,s5,364 <gets+0x54> 35a: 0905 addi s2,s2,1 35c: fd679be3 bne a5,s6,332 <gets+0x22> for(i=0; i+1 < max; ){ 360: 89a6 mv s3,s1 362: a011 j 366 <gets+0x56> 364: 89a6 mv s3,s1 break; } buf[i] = '\0'; 366: 99de add s3,s3,s7 368: 00098023 sb zero,0(s3) return buf; } 36c: 855e mv a0,s7 36e: 60e6 ld ra,88(sp) 370: 6446 ld s0,80(sp) 372: 64a6 ld s1,72(sp) 374: 6906 ld s2,64(sp) 376: 79e2 ld s3,56(sp) 378: 7a42 ld s4,48(sp) 37a: 7aa2 ld s5,40(sp) 37c: 7b02 ld s6,32(sp) 37e: 6be2 ld s7,24(sp) 380: 6125 addi sp,sp,96 382: 8082 ret 0000000000000384 <stat>: int stat(const char *n, struct stat *st) { 384: 1101 addi sp,sp,-32 386: ec06 sd ra,24(sp) 388: e822 sd s0,16(sp) 38a: e426 sd s1,8(sp) 38c: e04a sd s2,0(sp) 38e: 1000 addi s0,sp,32 390: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); 392: 4581 li a1,0 394: 00000097 auipc ra,0x0 398: 172080e7 jalr 370(ra) # 506 <open> if(fd < 0) 39c: 02054563 bltz a0,3c6 <stat+0x42> 3a0: 84aa mv s1,a0 return -1; r = fstat(fd, st); 3a2: 85ca mv a1,s2 3a4: 00000097 auipc ra,0x0 3a8: 17a080e7 jalr 378(ra) # 51e <fstat> 3ac: 892a mv s2,a0 close(fd); 3ae: 8526 mv a0,s1 3b0: 00000097 auipc ra,0x0 3b4: 13e080e7 jalr 318(ra) # 4ee <close> return r; } 3b8: 854a mv a0,s2 3ba: 60e2 ld ra,24(sp) 3bc: 6442 ld s0,16(sp) 3be: 64a2 ld s1,8(sp) 3c0: 6902 ld s2,0(sp) 3c2: 6105 addi sp,sp,32 3c4: 8082 ret return -1; 3c6: 597d li s2,-1 3c8: bfc5 j 3b8 <stat+0x34> 00000000000003ca <atoi>: int atoi(const char *s) { 3ca: 1141 addi sp,sp,-16 3cc: e422 sd s0,8(sp) 3ce: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') 3d0: 00054603 lbu a2,0(a0) 3d4: fd06079b addiw a5,a2,-48 3d8: 0ff7f793 andi a5,a5,255 3dc: 4725 li a4,9 3de: 02f76963 bltu a4,a5,410 <atoi+0x46> 3e2: 86aa mv a3,a0 n = 0; 3e4: 4501 li a0,0 while('0' <= *s && *s <= '9') 3e6: 45a5 li a1,9 n = n*10 + *s++ - '0'; 3e8: 0685 addi a3,a3,1 3ea: 0025179b slliw a5,a0,0x2 3ee: 9fa9 addw a5,a5,a0 3f0: 0017979b slliw a5,a5,0x1 3f4: 9fb1 addw a5,a5,a2 3f6: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') 3fa: 0006c603 lbu a2,0(a3) 3fe: fd06071b addiw a4,a2,-48 402: 0ff77713 andi a4,a4,255 406: fee5f1e3 bgeu a1,a4,3e8 <atoi+0x1e> return n; } 40a: 6422 ld s0,8(sp) 40c: 0141 addi sp,sp,16 40e: 8082 ret n = 0; 410: 4501 li a0,0 412: bfe5 j 40a <atoi+0x40> 0000000000000414 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 414: 1141 addi sp,sp,-16 416: e422 sd s0,8(sp) 418: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { 41a: 02b57463 bgeu a0,a1,442 <memmove+0x2e> while(n-- > 0) 41e: 00c05f63 blez a2,43c <memmove+0x28> 422: 1602 slli a2,a2,0x20 424: 9201 srli a2,a2,0x20 426: 00c507b3 add a5,a0,a2 dst = vdst; 42a: 872a mv a4,a0 *dst++ = *src++; 42c: 0585 addi a1,a1,1 42e: 0705 addi a4,a4,1 430: fff5c683 lbu a3,-1(a1) 434: fed70fa3 sb a3,-1(a4) while(n-- > 0) 438: fee79ae3 bne a5,a4,42c <memmove+0x18> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } 43c: 6422 ld s0,8(sp) 43e: 0141 addi sp,sp,16 440: 8082 ret dst += n; 442: 00c50733 add a4,a0,a2 src += n; 446: 95b2 add a1,a1,a2 while(n-- > 0) 448: fec05ae3 blez a2,43c <memmove+0x28> 44c: fff6079b addiw a5,a2,-1 450: 1782 slli a5,a5,0x20 452: 9381 srli a5,a5,0x20 454: fff7c793 not a5,a5 458: 97ba add a5,a5,a4 *--dst = *--src; 45a: 15fd addi a1,a1,-1 45c: 177d addi a4,a4,-1 45e: 0005c683 lbu a3,0(a1) 462: 00d70023 sb a3,0(a4) while(n-- > 0) 466: fee79ae3 bne a5,a4,45a <memmove+0x46> 46a: bfc9 j 43c <memmove+0x28> 000000000000046c <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { 46c: 1141 addi sp,sp,-16 46e: e422 sd s0,8(sp) 470: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { 472: ca05 beqz a2,4a2 <memcmp+0x36> 474: fff6069b addiw a3,a2,-1 478: 1682 slli a3,a3,0x20 47a: 9281 srli a3,a3,0x20 47c: 0685 addi a3,a3,1 47e: 96aa add a3,a3,a0 if (*p1 != *p2) { 480: 00054783 lbu a5,0(a0) 484: 0005c703 lbu a4,0(a1) 488: 00e79863 bne a5,a4,498 <memcmp+0x2c> return *p1 - *p2; } p1++; 48c: 0505 addi a0,a0,1 p2++; 48e: 0585 addi a1,a1,1 while (n-- > 0) { 490: fed518e3 bne a0,a3,480 <memcmp+0x14> } return 0; 494: 4501 li a0,0 496: a019 j 49c <memcmp+0x30> return *p1 - *p2; 498: 40e7853b subw a0,a5,a4 } 49c: 6422 ld s0,8(sp) 49e: 0141 addi sp,sp,16 4a0: 8082 ret return 0; 4a2: 4501 li a0,0 4a4: bfe5 j 49c <memcmp+0x30> 00000000000004a6 <memcpy>: void * memcpy(void *dst, const void *src, uint n) { 4a6: 1141 addi sp,sp,-16 4a8: e406 sd ra,8(sp) 4aa: e022 sd s0,0(sp) 4ac: 0800 addi s0,sp,16 return memmove(dst, src, n); 4ae: 00000097 auipc ra,0x0 4b2: f66080e7 jalr -154(ra) # 414 <memmove> } 4b6: 60a2 ld ra,8(sp) 4b8: 6402 ld s0,0(sp) 4ba: 0141 addi sp,sp,16 4bc: 8082 ret 00000000000004be <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork 4be: 4885 li a7,1 ecall 4c0: 00000073 ecall ret 4c4: 8082 ret 00000000000004c6 <exit>: .global exit exit: li a7, SYS_exit 4c6: 4889 li a7,2 ecall 4c8: 00000073 ecall ret 4cc: 8082 ret 00000000000004ce <wait>: .global wait wait: li a7, SYS_wait 4ce: 488d li a7,3 ecall 4d0: 00000073 ecall ret 4d4: 8082 ret 00000000000004d6 <pipe>: .global pipe pipe: li a7, SYS_pipe 4d6: 4891 li a7,4 ecall 4d8: 00000073 ecall ret 4dc: 8082 ret 00000000000004de <read>: .global read read: li a7, SYS_read 4de: 4895 li a7,5 ecall 4e0: 00000073 ecall ret 4e4: 8082 ret 00000000000004e6 <write>: .global write write: li a7, SYS_write 4e6: 48c1 li a7,16 ecall 4e8: 00000073 ecall ret 4ec: 8082 ret 00000000000004ee <close>: .global close close: li a7, SYS_close 4ee: 48d5 li a7,21 ecall 4f0: 00000073 ecall ret 4f4: 8082 ret 00000000000004f6 <kill>: .global kill kill: li a7, SYS_kill 4f6: 4899 li a7,6 ecall 4f8: 00000073 ecall ret 4fc: 8082 ret 00000000000004fe <exec>: .global exec exec: li a7, SYS_exec 4fe: 489d li a7,7 ecall 500: 00000073 ecall ret 504: 8082 ret 0000000000000506 <open>: .global open open: li a7, SYS_open 506: 48bd li a7,15 ecall 508: 00000073 ecall ret 50c: 8082 ret 000000000000050e <mknod>: .global mknod mknod: li a7, SYS_mknod 50e: 48c5 li a7,17 ecall 510: 00000073 ecall ret 514: 8082 ret 0000000000000516 <unlink>: .global unlink unlink: li a7, SYS_unlink 516: 48c9 li a7,18 ecall 518: 00000073 ecall ret 51c: 8082 ret 000000000000051e <fstat>: .global fstat fstat: li a7, SYS_fstat 51e: 48a1 li a7,8 ecall 520: 00000073 ecall ret 524: 8082 ret 0000000000000526 <link>: .global link link: li a7, SYS_link 526: 48cd li a7,19 ecall 528: 00000073 ecall ret 52c: 8082 ret 000000000000052e <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir 52e: 48d1 li a7,20 ecall 530: 00000073 ecall ret 534: 8082 ret 0000000000000536 <chdir>: .global chdir chdir: li a7, SYS_chdir 536: 48a5 li a7,9 ecall 538: 00000073 ecall ret 53c: 8082 ret 000000000000053e <dup>: .global dup dup: li a7, SYS_dup 53e: 48a9 li a7,10 ecall 540: 00000073 ecall ret 544: 8082 ret 0000000000000546 <getpid>: .global getpid getpid: li a7, SYS_getpid 546: 48ad li a7,11 ecall 548: 00000073 ecall ret 54c: 8082 ret 000000000000054e <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk 54e: 48b1 li a7,12 ecall 550: 00000073 ecall ret 554: 8082 ret 0000000000000556 <sleep>: .global sleep sleep: li a7, SYS_sleep 556: 48b5 li a7,13 ecall 558: 00000073 ecall ret 55c: 8082 ret 000000000000055e <uptime>: .global uptime uptime: li a7, SYS_uptime 55e: 48b9 li a7,14 ecall 560: 00000073 ecall ret 564: 8082 ret 0000000000000566 <ntas>: .global ntas ntas: li a7, SYS_ntas 566: 48d9 li a7,22 ecall 568: 00000073 ecall ret 56c: 8082 ret 000000000000056e <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { 56e: 1101 addi sp,sp,-32 570: ec06 sd ra,24(sp) 572: e822 sd s0,16(sp) 574: 1000 addi s0,sp,32 576: feb407a3 sb a1,-17(s0) write(fd, &c, 1); 57a: 4605 li a2,1 57c: fef40593 addi a1,s0,-17 580: 00000097 auipc ra,0x0 584: f66080e7 jalr -154(ra) # 4e6 <write> } 588: 60e2 ld ra,24(sp) 58a: 6442 ld s0,16(sp) 58c: 6105 addi sp,sp,32 58e: 8082 ret 0000000000000590 <printint>: static void printint(int fd, int xx, int base, int sgn) { 590: 7139 addi sp,sp,-64 592: fc06 sd ra,56(sp) 594: f822 sd s0,48(sp) 596: f426 sd s1,40(sp) 598: f04a sd s2,32(sp) 59a: ec4e sd s3,24(sp) 59c: 0080 addi s0,sp,64 59e: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 5a0: c299 beqz a3,5a6 <printint+0x16> 5a2: 0805c863 bltz a1,632 <printint+0xa2> neg = 1; x = -xx; } else { x = xx; 5a6: 2581 sext.w a1,a1 neg = 0; 5a8: 4881 li a7,0 5aa: fc040693 addi a3,s0,-64 } i = 0; 5ae: 4701 li a4,0 do{ buf[i++] = digits[x % base]; 5b0: 2601 sext.w a2,a2 5b2: 00000517 auipc a0,0x0 5b6: 53650513 addi a0,a0,1334 # ae8 <digits> 5ba: 883a mv a6,a4 5bc: 2705 addiw a4,a4,1 5be: 02c5f7bb remuw a5,a1,a2 5c2: 1782 slli a5,a5,0x20 5c4: 9381 srli a5,a5,0x20 5c6: 97aa add a5,a5,a0 5c8: 0007c783 lbu a5,0(a5) 5cc: 00f68023 sb a5,0(a3) }while((x /= base) != 0); 5d0: 0005879b sext.w a5,a1 5d4: 02c5d5bb divuw a1,a1,a2 5d8: 0685 addi a3,a3,1 5da: fec7f0e3 bgeu a5,a2,5ba <printint+0x2a> if(neg) 5de: 00088b63 beqz a7,5f4 <printint+0x64> buf[i++] = '-'; 5e2: fd040793 addi a5,s0,-48 5e6: 973e add a4,a4,a5 5e8: 02d00793 li a5,45 5ec: fef70823 sb a5,-16(a4) 5f0: 0028071b addiw a4,a6,2 while(--i >= 0) 5f4: 02e05863 blez a4,624 <printint+0x94> 5f8: fc040793 addi a5,s0,-64 5fc: 00e78933 add s2,a5,a4 600: fff78993 addi s3,a5,-1 604: 99ba add s3,s3,a4 606: 377d addiw a4,a4,-1 608: 1702 slli a4,a4,0x20 60a: 9301 srli a4,a4,0x20 60c: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); 610: fff94583 lbu a1,-1(s2) 614: 8526 mv a0,s1 616: 00000097 auipc ra,0x0 61a: f58080e7 jalr -168(ra) # 56e <putc> while(--i >= 0) 61e: 197d addi s2,s2,-1 620: ff3918e3 bne s2,s3,610 <printint+0x80> } 624: 70e2 ld ra,56(sp) 626: 7442 ld s0,48(sp) 628: 74a2 ld s1,40(sp) 62a: 7902 ld s2,32(sp) 62c: 69e2 ld s3,24(sp) 62e: 6121 addi sp,sp,64 630: 8082 ret x = -xx; 632: 40b005bb negw a1,a1 neg = 1; 636: 4885 li a7,1 x = -xx; 638: bf8d j 5aa <printint+0x1a> 000000000000063a <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { 63a: 7119 addi sp,sp,-128 63c: fc86 sd ra,120(sp) 63e: f8a2 sd s0,112(sp) 640: f4a6 sd s1,104(sp) 642: f0ca sd s2,96(sp) 644: ecce sd s3,88(sp) 646: e8d2 sd s4,80(sp) 648: e4d6 sd s5,72(sp) 64a: e0da sd s6,64(sp) 64c: fc5e sd s7,56(sp) 64e: f862 sd s8,48(sp) 650: f466 sd s9,40(sp) 652: f06a sd s10,32(sp) 654: ec6e sd s11,24(sp) 656: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ 658: 0005c903 lbu s2,0(a1) 65c: 18090f63 beqz s2,7fa <vprintf+0x1c0> 660: 8aaa mv s5,a0 662: 8b32 mv s6,a2 664: 00158493 addi s1,a1,1 state = 0; 668: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 66a: 02500a13 li s4,37 if(c == 'd'){ 66e: 06400c13 li s8,100 printint(fd, va_arg(ap, int), 10, 1); } else if(c == 'l') { 672: 06c00c93 li s9,108 printint(fd, va_arg(ap, uint64), 10, 0); } else if(c == 'x') { 676: 07800d13 li s10,120 printint(fd, va_arg(ap, int), 16, 0); } else if(c == 'p') { 67a: 07000d93 li s11,112 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 67e: 00000b97 auipc s7,0x0 682: 46ab8b93 addi s7,s7,1130 # ae8 <digits> 686: a839 j 6a4 <vprintf+0x6a> putc(fd, c); 688: 85ca mv a1,s2 68a: 8556 mv a0,s5 68c: 00000097 auipc ra,0x0 690: ee2080e7 jalr -286(ra) # 56e <putc> 694: a019 j 69a <vprintf+0x60> } else if(state == '%'){ 696: 01498f63 beq s3,s4,6b4 <vprintf+0x7a> for(i = 0; fmt[i]; i++){ 69a: 0485 addi s1,s1,1 69c: fff4c903 lbu s2,-1(s1) 6a0: 14090d63 beqz s2,7fa <vprintf+0x1c0> c = fmt[i] & 0xff; 6a4: 0009079b sext.w a5,s2 if(state == 0){ 6a8: fe0997e3 bnez s3,696 <vprintf+0x5c> if(c == '%'){ 6ac: fd479ee3 bne a5,s4,688 <vprintf+0x4e> state = '%'; 6b0: 89be mv s3,a5 6b2: b7e5 j 69a <vprintf+0x60> if(c == 'd'){ 6b4: 05878063 beq a5,s8,6f4 <vprintf+0xba> } else if(c == 'l') { 6b8: 05978c63 beq a5,s9,710 <vprintf+0xd6> } else if(c == 'x') { 6bc: 07a78863 beq a5,s10,72c <vprintf+0xf2> } else if(c == 'p') { 6c0: 09b78463 beq a5,s11,748 <vprintf+0x10e> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ 6c4: 07300713 li a4,115 6c8: 0ce78663 beq a5,a4,794 <vprintf+0x15a> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 6cc: 06300713 li a4,99 6d0: 0ee78e63 beq a5,a4,7cc <vprintf+0x192> putc(fd, va_arg(ap, uint)); } else if(c == '%'){ 6d4: 11478863 beq a5,s4,7e4 <vprintf+0x1aa> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 6d8: 85d2 mv a1,s4 6da: 8556 mv a0,s5 6dc: 00000097 auipc ra,0x0 6e0: e92080e7 jalr -366(ra) # 56e <putc> putc(fd, c); 6e4: 85ca mv a1,s2 6e6: 8556 mv a0,s5 6e8: 00000097 auipc ra,0x0 6ec: e86080e7 jalr -378(ra) # 56e <putc> } state = 0; 6f0: 4981 li s3,0 6f2: b765 j 69a <vprintf+0x60> printint(fd, va_arg(ap, int), 10, 1); 6f4: 008b0913 addi s2,s6,8 6f8: 4685 li a3,1 6fa: 4629 li a2,10 6fc: 000b2583 lw a1,0(s6) 700: 8556 mv a0,s5 702: 00000097 auipc ra,0x0 706: e8e080e7 jalr -370(ra) # 590 <printint> 70a: 8b4a mv s6,s2 state = 0; 70c: 4981 li s3,0 70e: b771 j 69a <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 710: 008b0913 addi s2,s6,8 714: 4681 li a3,0 716: 4629 li a2,10 718: 000b2583 lw a1,0(s6) 71c: 8556 mv a0,s5 71e: 00000097 auipc ra,0x0 722: e72080e7 jalr -398(ra) # 590 <printint> 726: 8b4a mv s6,s2 state = 0; 728: 4981 li s3,0 72a: bf85 j 69a <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 72c: 008b0913 addi s2,s6,8 730: 4681 li a3,0 732: 4641 li a2,16 734: 000b2583 lw a1,0(s6) 738: 8556 mv a0,s5 73a: 00000097 auipc ra,0x0 73e: e56080e7 jalr -426(ra) # 590 <printint> 742: 8b4a mv s6,s2 state = 0; 744: 4981 li s3,0 746: bf91 j 69a <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 748: 008b0793 addi a5,s6,8 74c: f8f43423 sd a5,-120(s0) 750: 000b3983 ld s3,0(s6) putc(fd, '0'); 754: 03000593 li a1,48 758: 8556 mv a0,s5 75a: 00000097 auipc ra,0x0 75e: e14080e7 jalr -492(ra) # 56e <putc> putc(fd, 'x'); 762: 85ea mv a1,s10 764: 8556 mv a0,s5 766: 00000097 auipc ra,0x0 76a: e08080e7 jalr -504(ra) # 56e <putc> 76e: 4941 li s2,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 770: 03c9d793 srli a5,s3,0x3c 774: 97de add a5,a5,s7 776: 0007c583 lbu a1,0(a5) 77a: 8556 mv a0,s5 77c: 00000097 auipc ra,0x0 780: df2080e7 jalr -526(ra) # 56e <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 784: 0992 slli s3,s3,0x4 786: 397d addiw s2,s2,-1 788: fe0914e3 bnez s2,770 <vprintf+0x136> printptr(fd, va_arg(ap, uint64)); 78c: f8843b03 ld s6,-120(s0) state = 0; 790: 4981 li s3,0 792: b721 j 69a <vprintf+0x60> s = va_arg(ap, char*); 794: 008b0993 addi s3,s6,8 798: 000b3903 ld s2,0(s6) if(s == 0) 79c: 02090163 beqz s2,7be <vprintf+0x184> while(*s != 0){ 7a0: 00094583 lbu a1,0(s2) 7a4: c9a1 beqz a1,7f4 <vprintf+0x1ba> putc(fd, *s); 7a6: 8556 mv a0,s5 7a8: 00000097 auipc ra,0x0 7ac: dc6080e7 jalr -570(ra) # 56e <putc> s++; 7b0: 0905 addi s2,s2,1 while(*s != 0){ 7b2: 00094583 lbu a1,0(s2) 7b6: f9e5 bnez a1,7a6 <vprintf+0x16c> s = va_arg(ap, char*); 7b8: 8b4e mv s6,s3 state = 0; 7ba: 4981 li s3,0 7bc: bdf9 j 69a <vprintf+0x60> s = "(null)"; 7be: 00000917 auipc s2,0x0 7c2: 32290913 addi s2,s2,802 # ae0 <malloc+0x1dc> while(*s != 0){ 7c6: 02800593 li a1,40 7ca: bff1 j 7a6 <vprintf+0x16c> putc(fd, va_arg(ap, uint)); 7cc: 008b0913 addi s2,s6,8 7d0: 000b4583 lbu a1,0(s6) 7d4: 8556 mv a0,s5 7d6: 00000097 auipc ra,0x0 7da: d98080e7 jalr -616(ra) # 56e <putc> 7de: 8b4a mv s6,s2 state = 0; 7e0: 4981 li s3,0 7e2: bd65 j 69a <vprintf+0x60> putc(fd, c); 7e4: 85d2 mv a1,s4 7e6: 8556 mv a0,s5 7e8: 00000097 auipc ra,0x0 7ec: d86080e7 jalr -634(ra) # 56e <putc> state = 0; 7f0: 4981 li s3,0 7f2: b565 j 69a <vprintf+0x60> s = va_arg(ap, char*); 7f4: 8b4e mv s6,s3 state = 0; 7f6: 4981 li s3,0 7f8: b54d j 69a <vprintf+0x60> } } } 7fa: 70e6 ld ra,120(sp) 7fc: 7446 ld s0,112(sp) 7fe: 74a6 ld s1,104(sp) 800: 7906 ld s2,96(sp) 802: 69e6 ld s3,88(sp) 804: 6a46 ld s4,80(sp) 806: 6aa6 ld s5,72(sp) 808: 6b06 ld s6,64(sp) 80a: 7be2 ld s7,56(sp) 80c: 7c42 ld s8,48(sp) 80e: 7ca2 ld s9,40(sp) 810: 7d02 ld s10,32(sp) 812: 6de2 ld s11,24(sp) 814: 6109 addi sp,sp,128 816: 8082 ret 0000000000000818 <fprintf>: void fprintf(int fd, const char *fmt, ...) { 818: 715d addi sp,sp,-80 81a: ec06 sd ra,24(sp) 81c: e822 sd s0,16(sp) 81e: 1000 addi s0,sp,32 820: e010 sd a2,0(s0) 822: e414 sd a3,8(s0) 824: e818 sd a4,16(s0) 826: ec1c sd a5,24(s0) 828: 03043023 sd a6,32(s0) 82c: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 830: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 834: 8622 mv a2,s0 836: 00000097 auipc ra,0x0 83a: e04080e7 jalr -508(ra) # 63a <vprintf> } 83e: 60e2 ld ra,24(sp) 840: 6442 ld s0,16(sp) 842: 6161 addi sp,sp,80 844: 8082 ret 0000000000000846 <printf>: void printf(const char *fmt, ...) { 846: 711d addi sp,sp,-96 848: ec06 sd ra,24(sp) 84a: e822 sd s0,16(sp) 84c: 1000 addi s0,sp,32 84e: e40c sd a1,8(s0) 850: e810 sd a2,16(s0) 852: ec14 sd a3,24(s0) 854: f018 sd a4,32(s0) 856: f41c sd a5,40(s0) 858: 03043823 sd a6,48(s0) 85c: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 860: 00840613 addi a2,s0,8 864: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 868: 85aa mv a1,a0 86a: 4505 li a0,1 86c: 00000097 auipc ra,0x0 870: dce080e7 jalr -562(ra) # 63a <vprintf> } 874: 60e2 ld ra,24(sp) 876: 6442 ld s0,16(sp) 878: 6125 addi sp,sp,96 87a: 8082 ret 000000000000087c <free>: static Header base; static Header *freep; void free(void *ap) { 87c: 1141 addi sp,sp,-16 87e: e422 sd s0,8(sp) 880: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 882: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 886: 00000797 auipc a5,0x0 88a: 27a7b783 ld a5,634(a5) # b00 <freep> 88e: a805 j 8be <free+0x42> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 890: 4618 lw a4,8(a2) 892: 9db9 addw a1,a1,a4 894: feb52c23 sw a1,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 898: 6398 ld a4,0(a5) 89a: 6318 ld a4,0(a4) 89c: fee53823 sd a4,-16(a0) 8a0: a091 j 8e4 <free+0x68> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 8a2: ff852703 lw a4,-8(a0) 8a6: 9e39 addw a2,a2,a4 8a8: c790 sw a2,8(a5) p->s.ptr = bp->s.ptr; 8aa: ff053703 ld a4,-16(a0) 8ae: e398 sd a4,0(a5) 8b0: a099 j 8f6 <free+0x7a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8b2: 6398 ld a4,0(a5) 8b4: 00e7e463 bltu a5,a4,8bc <free+0x40> 8b8: 00e6ea63 bltu a3,a4,8cc <free+0x50> { 8bc: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8be: fed7fae3 bgeu a5,a3,8b2 <free+0x36> 8c2: 6398 ld a4,0(a5) 8c4: 00e6e463 bltu a3,a4,8cc <free+0x50> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8c8: fee7eae3 bltu a5,a4,8bc <free+0x40> if(bp + bp->s.size == p->s.ptr){ 8cc: ff852583 lw a1,-8(a0) 8d0: 6390 ld a2,0(a5) 8d2: 02059813 slli a6,a1,0x20 8d6: 01c85713 srli a4,a6,0x1c 8da: 9736 add a4,a4,a3 8dc: fae60ae3 beq a2,a4,890 <free+0x14> bp->s.ptr = p->s.ptr; 8e0: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 8e4: 4790 lw a2,8(a5) 8e6: 02061593 slli a1,a2,0x20 8ea: 01c5d713 srli a4,a1,0x1c 8ee: 973e add a4,a4,a5 8f0: fae689e3 beq a3,a4,8a2 <free+0x26> } else p->s.ptr = bp; 8f4: e394 sd a3,0(a5) freep = p; 8f6: 00000717 auipc a4,0x0 8fa: 20f73523 sd a5,522(a4) # b00 <freep> } 8fe: 6422 ld s0,8(sp) 900: 0141 addi sp,sp,16 902: 8082 ret 0000000000000904 <malloc>: return freep; } void* malloc(uint nbytes) { 904: 7139 addi sp,sp,-64 906: fc06 sd ra,56(sp) 908: f822 sd s0,48(sp) 90a: f426 sd s1,40(sp) 90c: f04a sd s2,32(sp) 90e: ec4e sd s3,24(sp) 910: e852 sd s4,16(sp) 912: e456 sd s5,8(sp) 914: e05a sd s6,0(sp) 916: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 918: 02051493 slli s1,a0,0x20 91c: 9081 srli s1,s1,0x20 91e: 04bd addi s1,s1,15 920: 8091 srli s1,s1,0x4 922: 0014899b addiw s3,s1,1 926: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 928: 00000517 auipc a0,0x0 92c: 1d853503 ld a0,472(a0) # b00 <freep> 930: c515 beqz a0,95c <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 932: 611c ld a5,0(a0) if(p->s.size >= nunits){ 934: 4798 lw a4,8(a5) 936: 02977f63 bgeu a4,s1,974 <malloc+0x70> 93a: 8a4e mv s4,s3 93c: 0009871b sext.w a4,s3 940: 6685 lui a3,0x1 942: 00d77363 bgeu a4,a3,948 <malloc+0x44> 946: 6a05 lui s4,0x1 948: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 94c: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 950: 00000917 auipc s2,0x0 954: 1b090913 addi s2,s2,432 # b00 <freep> if(p == (char*)-1) 958: 5afd li s5,-1 95a: a895 j 9ce <malloc+0xca> base.s.ptr = freep = prevp = &base; 95c: 00000797 auipc a5,0x0 960: 1ac78793 addi a5,a5,428 # b08 <base> 964: 00000717 auipc a4,0x0 968: 18f73e23 sd a5,412(a4) # b00 <freep> 96c: e39c sd a5,0(a5) base.s.size = 0; 96e: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 972: b7e1 j 93a <malloc+0x36> if(p->s.size == nunits) 974: 02e48c63 beq s1,a4,9ac <malloc+0xa8> p->s.size -= nunits; 978: 4137073b subw a4,a4,s3 97c: c798 sw a4,8(a5) p += p->s.size; 97e: 02071693 slli a3,a4,0x20 982: 01c6d713 srli a4,a3,0x1c 986: 97ba add a5,a5,a4 p->s.size = nunits; 988: 0137a423 sw s3,8(a5) freep = prevp; 98c: 00000717 auipc a4,0x0 990: 16a73a23 sd a0,372(a4) # b00 <freep> return (void*)(p + 1); 994: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 998: 70e2 ld ra,56(sp) 99a: 7442 ld s0,48(sp) 99c: 74a2 ld s1,40(sp) 99e: 7902 ld s2,32(sp) 9a0: 69e2 ld s3,24(sp) 9a2: 6a42 ld s4,16(sp) 9a4: 6aa2 ld s5,8(sp) 9a6: 6b02 ld s6,0(sp) 9a8: 6121 addi sp,sp,64 9aa: 8082 ret prevp->s.ptr = p->s.ptr; 9ac: 6398 ld a4,0(a5) 9ae: e118 sd a4,0(a0) 9b0: bff1 j 98c <malloc+0x88> hp->s.size = nu; 9b2: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 9b6: 0541 addi a0,a0,16 9b8: 00000097 auipc ra,0x0 9bc: ec4080e7 jalr -316(ra) # 87c <free> return freep; 9c0: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 9c4: d971 beqz a0,998 <malloc+0x94> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 9c6: 611c ld a5,0(a0) if(p->s.size >= nunits){ 9c8: 4798 lw a4,8(a5) 9ca: fa9775e3 bgeu a4,s1,974 <malloc+0x70> if(p == freep) 9ce: 00093703 ld a4,0(s2) 9d2: 853e mv a0,a5 9d4: fef719e3 bne a4,a5,9c6 <malloc+0xc2> p = sbrk(nu * sizeof(Header)); 9d8: 8552 mv a0,s4 9da: 00000097 auipc ra,0x0 9de: b74080e7 jalr -1164(ra) # 54e <sbrk> if(p == (char*)-1) 9e2: fd5518e3 bne a0,s5,9b2 <malloc+0xae> return 0; 9e6: 4501 li a0,0 9e8: bf45 j 998 <malloc+0x94>
support/support-regex.adb
leo-brewin/adm-bssn-numerical
1
21620
<filename>support/support-regex.adb with Support.Strings; use Support.Strings; with GNAT.Regpat; use GNAT.Regpat; package body Support.RegEx is Matches : Match_Array (0 .. 10); -- Matches (0) = first & last for the whole regex -- Matches (1) = first & last for the first (...) match -- Matches (2) = first & last for the second (...) match function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : String := "<no match>") return String is the_beg : Integer := the_line'first; the_end : Integer := the_line'last; Regexp : constant Pattern_Matcher := Compile (the_regex); begin -- look for a particular match for num in 1..the_match loop -- loop through successive matches Match (Regexp, the_line (the_beg..the_end), Matches); -- find the first match in this window (if it exists) if Matches(0).First > 0 then the_beg := Matches(0).Last + 1; -- skip over this match, shrink the search window else return fail; -- no match, so bail out end if; end loop; if Matches(0).First > 0 then return the_line (Matches(the_group).first..Matches(the_group).last); else return fail; end if; exception -- get here when user asked for a group that doesn't exist when others => return "<no such group>"; end grep; function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : Integer := -333) return Integer is result : Integer; the_beg : Integer := the_line'first; the_end : Integer := the_line'last; Regexp : constant Pattern_Matcher := Compile (the_regex); begin -- look for a particular match for num in 1..the_match loop -- loop through successive matches Match (Regexp, the_line (the_beg..the_end), Matches); -- find the first match in this window (if it exists) if Matches(0).First > 0 then the_beg := Matches(0).Last + 1; -- skip over this match, shrink the search window else return fail; -- no match, so bail out end if; end loop; if Matches(0).First > 0 then readstr (the_line (Matches(the_group).first..Matches(the_group).last),result); else result := fail; end if; return result; exception -- get here when user asked for a group that doesn't exist when others => return -666; end grep; function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : Real := -333.3e33) return Real is result : Real; the_beg : Integer := the_line'first; the_end : Integer := the_line'last; Regexp : constant Pattern_Matcher := Compile (the_regex); begin -- look for a particular match for num in 1..the_match loop -- loop through successive matches Match (Regexp, the_line (the_beg..the_end), Matches); -- find the first match in this window (if it exists) if Matches(0).First > 0 then the_beg := Matches(0).Last + 1; -- skip over this match, shrink the search window else return fail; -- no match, so bail out end if; end loop; if Matches(0).First > 0 then readstr (the_line (Matches(the_group).first..Matches(the_group).last),result); else result := fail; end if; return result; exception -- get here when user asked for a group that doesn't exist when others => return -666.6e66; end grep; function grep (the_line : String; the_regex : String; the_group : Integer := 1; the_match : Integer := 1) return Boolean is the_beg : Integer := the_line'first; the_end : Integer := the_line'last; Regexp : constant Pattern_Matcher := Compile (the_regex); begin -- look for a particular match for num in 1..the_match loop -- loop through successive matches Match (Regexp, the_line (the_beg..the_end), Matches); -- find the first match in this window (if it exists) if Matches(0).First > 0 then the_beg := Matches(0).Last + 1; -- skip over this match, shrink the search window else return False; -- no match, so bail out end if; end loop; if Matches(0).First > 0 then return True; else return False; end if; exception -- get here when user asked for a group that doesn't exist when others => return False; end grep; function regex_match (the_line : String; the_regex : String) return Boolean is Regexp : constant Pattern_Matcher := Compile (the_regex); begin Match (Regexp, the_line, Matches); if Matches (0) = No_Match then return false; else return true; end if; end regex_match; procedure grep (the_match : out String; found : out Boolean; the_line : String; the_regex : String; the_group : Integer) is Regexp : constant Pattern_Matcher := Compile (the_regex); begin Match (Regexp, the_line, Matches); if Matches(0).First > 0 then found := True; writestr (the_match,the_line (Matches(the_group).first..Matches(the_group).last)); else found := False; null_string (the_match); end if; end grep; procedure grep (the_beg : out Integer; the_end : out Integer; found : out Boolean; the_line : String; the_regex : String; the_group : Integer := 0) is Regexp : constant Pattern_Matcher := Compile (the_regex); begin Match (Regexp, the_line, Matches); if Matches (0) = No_Match then found := false; the_beg := -1; the_end := -1; else found := true; the_beg := Matches(the_group).first; the_end := Matches(the_group).last; end if; end grep; end Support.RegEx;
oeis/204/A204696.asm
neoneye/loda-programs
11
245427
<filename>oeis/204/A204696.asm ; A204696: G.f.: (32*x^7/(1-2*x) + 16*x^5 + 24*x^6)/(1-2*x^2). ; 0,0,0,0,0,16,24,64,112,256,480,1024,1984,4096,8064,16384,32512,65536,130560,262144,523264,1048576,2095104,4194304,8384512,16777216,33546240,67108864,134201344,268435456,536838144,1073741824,2147418112,4294967296,8589803520,17179869184,34359476224,68719476736,137438429184,274877906944 trn $0,2 seq $0,14236 ; Expansion of g.f.: 2*x*(1-x)/((1-2*x)*(1-2*x^2)). div $0,4 mul $0,8
src/grammar/Cosmos.g4
jonathanMelly/mtel
1
5983
//langage de type 'pseudo-code' pour apprendre à programmer parser grammar Cosmos ; options { tokenVocab = CosmosLexer; } //Removes clscompliant warning on build @header {#pragma warning disable 3021} programme : entete mainStart (instruction|noop)+ mainEnd .*? EOF ; entete : auteur date entreprise description ; auteur : LABEL_AUTEUR TEXTE_LIBRE_MONOLIGNE ; date : LABEL_DATE CONTENU_DATE RETOUR_DE_CHARIOT ; entreprise : ENTREPRISE_ENTETE TEXTE_LIBRE_MONOLIGNE ; //Active le mode island dans le lexer description : DESCRIPTION_ENTETE TEXTE_LIBRE_MULTILIGNE; mainStart: DEBUT nomDuProgramme=MOT (BIBLIOTHEQUE bibliotheque=MOT)? DEUX_POINT ; mainEnd: FIN DE_LA_TRANSMISSION? POINT; instruction : TABULATION+ (instruction_simple | instruction_complexe) ; noop:TABULATION* RETOUR_DE_CHARIOT ; instruction_simple : ( afficher | allouer | affecter | recuperer | generer_aleatoire | placer_curseur | dormir | colorier | decouper | afficher_curseur | masquer_curseur | lire_touche | effacer_ecran ) POINT RETOUR_DE_CHARIOT ; //terminaison identique pour chaque instruction_complexe : selection|boucle ; //terminaison spécifique pour chaque afficher : AFFICHER expression; allouer : ALLOUER_TERME une_zone_memoire (INITIALISATION_TERME? expression)? ; affecter : ( INSERER expression DANS la_zone_memoire) | (variable OPERATEUR_MATH_EGAL expression ) ; recuperer: RECUPERER la_zone_memoire; placer_curseur: PLACER_LE_CURSEUR (ligne=LIGNE|colonne=COLONNE) expression_numerique; generer_aleatoire: PLACER_ALEATOIRE min=expression_numerique ET max=expression_numerique DANS la_zone_memoire; dormir: ATTENDRE expression_numerique MS; colorier: CHOISIR_COULEUR (red=ROUGE|green=VERT|blue=BLEU|white=BLANC|black=NOIR|gray=GRIS) dark=FONCE? POUR_LE (text=TEXTE|background=FOND); decouper: DECOUPER source=expression SUR separateur=expression; afficher_curseur: AFFICHER LE_CURSEUR; masquer_curseur: MASQUER LE_CURSEUR; lire_touche: RECUPERER_TOUCHE la_zone_memoire; effacer_ecran: EFFACER_ECRAN; variable : (LA VALEUR DE)? la_zone_memoire; la_zone_memoire : (LA ZONE_MEMOIRE ZONE_NOM?)? VARIABLE; une_zone_memoire : (UNE ZONE_MEMOIRE ZONE_NOM?)? VARIABLE; boucle : REPETER (expression_numerique FOIS | TANT_QUE expression_booleenne | boucle_avec_variable) RETOUR_DE_CHARIOT (instruction|noop)+ TABULATION+ SUIVANT RETOUR_DE_CHARIOT ; boucle_avec_variable : AUTANT_DE_FOIS VARIABLE | LE_NOMBRE_DE_FOIS variable; selection : SI base_si sinon_si* sinon? TABULATION+ POINT_INTERROGATION TABULATION* RETOUR_DE_CHARIOT ; base_si : condition=expression_booleenne ALORS RETOUR_DE_CHARIOT (instruction|noop)+ ; sinon_si : TABULATION+ SINON_SI base_si ; sinon : TABULATION+ (ET_SINON|SINON) RETOUR_DE_CHARIOT (instruction|noop)+ ; //Variable doublé pour éviter que la première règle de sous-expression prenne le dessus expression : variable | expression_comparable | expression_booleenne ; //Variable doublé pour éviter que la première règle de sous-expression prenne le dessus expression_comparable : variable | expression_textuelle | expression_numerique ; //Exprimée dans l'ordre de priorité des opérateurs expression_booleenne : gauche=expression_booleenne operateur=OPERATEUR_LOGIQUE_OU droite=expression_booleenne | gauche=expression_booleenne operateur=(ET | OPERATEUR_LOGIQUE_ET | OPERATEUR_LOGIQUE_OU_EXCLUSIF) droite=expression_booleenne //priorité différente ? | gaucheNb=expression_comparable operateurNb=( OPERATEUR_COMPARAISON_EQUIVALENT | OPERATEUR_COMPARAISON_DIFFERENT | OPERATEUR_COMPARAISON_PLUS_GRAND | OPERATEUR_COMPARAISON_PLUS_GRAND_OU_EGAL | OPERATEUR_COMPARAISON_PLUS_PETIT | OPERATEUR_COMPARAISON_PLUS_PETIT_OU_EGAL) droiteNb=expression_comparable | gauche=expression_booleenne operateur=(OPERATEUR_COMPARAISON_EQUIVALENT | OPERATEUR_COMPARAISON_DIFFERENT) droite=expression_booleenne | gauche=expression_booleenne operateur=OPERATEUR_LOGIQUE_EST (VRAI|FAUX) //construction sympa ;-) | OPERATEUR_LOGIQUE_NON sousExpression=expression_booleenne | (VRAI | FAUX | variable) | LE_RESULTAT_DE? PARENTHESE_GAUCHE sousExpression=expression_booleenne PARENTHESE_DROITE ; //Exprimée dans l'ordre de priorité des opérateurs expression_numerique : gauche=expression_numerique operateur=OPERATEUR_MATH_PUISSANCE droite=expression_numerique | gauche=expression_numerique operateur=(OPERATEUR_MATH_FOIS | OPERATEUR_MATH_DIVISE) droite=expression_numerique | gauche=expression_numerique operateur=(OPERATEUR_MATH_PLUS | OPERATEUR_MATH_MOINS) droite=expression_numerique | operateur=(OPERATEUR_MATH_RACINE_CARREE|OPERATEUR_MATH_SINUS|OPERATEUR_MATH_COSINUS) gauche=expression_numerique | gauche=expression_numerique operateur=OPERATEUR_MATH_MODULO2 droite=expression_numerique | operateur=OPERATEUR_MATH_MODULO1 gauche=expression_numerique OPERATEUR_MATH_MODULO1_PAR droite=expression_numerique | (atome_numerique | variable) | operateur=(OPERATEUR_MATH_PLUS | OPERATEUR_MATH_MOINS) sousExpression=expression_numerique | LE_RESULTAT_DE? PARENTHESE_GAUCHE sousExpression=expression_numerique PARENTHESE_DROITE ; expression_textuelle : atome_textuel ; atome_textuel : chaine_de_caractere ; atome_numerique : nombre | pi ; pi: PI; chaine_de_caractere : LE_TEXTE? VALEUR_TEXTE ; nombre : (LE_NOMBRE|LA VALEUR)? VALEUR_NOMBRE ;
libsrc/_DEVELOPMENT/target/yaz180/device/asci/asci0_interrupt.asm
Toysoft/z88dk
0
23227
INCLUDE "config_private.inc" SECTION code_driver SECTION code_driver_character_input PUBLIC _asci0_interrupt EXTERN asci0RxBuffer, asci0RxCount, asci0RxIn EXTERN asci0TxBuffer, asci0TxCount, asci0TxOut _asci0_interrupt: push af push hl ; start doing the Rx stuff in0 a,(STAT0) ; load the ASCI0 status register tst STAT0_RDRF ; test whether we have received on ASCI0 jr Z,ASCI0_TX_CHECK ; if not, go check for bytes to transmit ASCI0_RX_GET: in0 l,(RDR0) ; move Rx byte from the ASCI0 RDR to l and STAT0_OVRN|STAT0_PE|STAT0_FE ; test whether we have error on ASCI0 jr NZ,ASCI0_RX_ERROR ; drop this byte, clear error, and get the next byte ld a,(asci0RxCount) ; get the number of bytes in the Rx buffer cp __ASCI0_RX_SIZE-1 ; check whether there is space in the buffer jr NC,ASCI0_RX_CHECK ; buffer full, check whether we need to drain H/W FIFO ld a,l ; get Rx byte from l ld hl,(asci0RxIn) ; get the pointer to where we poke ld (hl),a ; write the Rx byte to the asci0RxIn target inc l ; move the Rx pointer low byte along IF __ASCI0_RX_SIZE != 0x100 ld a,__ASCI0_RX_SIZE-1 ; load the buffer size, (n^2)-1 and l ; range check or asci0RxBuffer&0xFF ; locate base ld l,a ; return the low byte to l ENDIF ld (asci0RxIn),hl ; write where the next byte should be poked ld hl, asci0RxCount inc (hl) ; atomically increment Rx buffer count jr ASCI0_RX_CHECK ; check for additional bytes ASCI0_RX_ERROR: in0 a,(CNTLA0) ; get the CNTRLA0 register and ~ CNTLA0_EFR ; to clear the error flag, EFR, to 0 out0 (CNTLA0),a ; and write it back ASCI0_RX_CHECK: ; Z8S180 has 4 byte Rx H/W FIFO in0 a,(STAT0) ; load the ASCI0 status register tst STAT0_RDRF ; test whether we have received on ASCI0 jr NZ,ASCI0_RX_GET ; if still more bytes in H/W FIFO, get them ASCI0_TX_CHECK: ; now start doing the Tx stuff and STAT0_TDRE ; test whether we can transmit on ASCI0 jr Z,ASCI0_TX_END ; if not, then end ld a,(asci0TxCount) ; get the number of bytes in the Tx buffer or a ; check whether it is zero jr Z,ASCI0_TX_TIE0_CLEAR ; if the count is zero, then disable the Tx Interrupt ld hl,(asci0TxOut) ; get the pointer to place where we pop the Tx byte ld a,(hl) ; get the Tx byte out0 (TDR0),a ; output the Tx byte to the ASCI0 inc l ; move the Tx pointer low byte along IF __ASCI0_TX_SIZE != 0x100 ld a,__ASCI0_TX_SIZE-1 ; load the buffer size, (n^2)-1 and l ; range check or asci0TxBuffer&0xFF ; locate base ld l,a ; return the low byte to l ENDIF ld (asci0TxOut),hl ; write where the next byte should be popped ld hl,asci0TxCount dec (hl) ; atomically decrement current Tx count jr NZ,ASCI0_TX_END ; if we've more Tx bytes to send, we're done for now ASCI0_TX_TIE0_CLEAR: in0 a,(STAT0) ; get the ASCI0 status register and ~STAT0_TIE ; mask out (disable) the Tx Interrupt out0 (STAT0),a ; set the ASCI0 status register ASCI0_TX_END: pop hl pop af ei ret EXTERN _asci0_need defc NEED = _asci0_need
antlr/JSONFormula.g4
vdua/json-formula
0
1146
/* Copyright 2021 Adobe. All rights reserved. This file is licensed 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 REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ grammar JSONFormula; formula : expression EOF ; expression : expression '.' chainedExpression # chainExpression | expression chainedBracketSpecifier # bracketedExpression | bracketSpecifier # bracketExpression | expression ('^') expression # powerExpression | expression ('*' | '/' | '&') expression # multDivExpression | expression ('+' | '-') expression # addSubtractExpression | expression COMPARATOR expression # comparisonExpression | expression '&&' expression # andExpression | expression '||' expression # orExpression | identifier # identifierExpression | '!' expression # notExpression | '(' expression ')' # parenExpression | wildcard # wildcardExpression | multiSelectList # multiSelectListExpression | multiSelectHash # multiSelectHashExpression | literal # literalExpression | functionExpression # functionCallExpression | expression '|' expression # pipeExpression | RAW_STRING # rawStringExpression | (REAL_OR_EXPONENT_NUMBER | SIGNED_INT) # numberLiteral | currentNode # currentNodeExpression | form # formExpression | currentField # currentFieldExpression ; chainedExpression : identifier | multiSelectList | multiSelectHash | functionExpression | wildcard ; wildcard : '*' ; multiSelectList : '[' expression (',' expression)* ']' ; multiSelectHash : '{' '}' #emptyHash | '{' keyvalExpr (',' keyvalExpr)* '}' #nonEmptyHash ; keyvalExpr : identifier ':' expression ; bracketSpecifier : '[' SIGNED_INT ']' # bracketIndex | '[' '*' ']' # bracketStar | '[' slice ']' # bracketSlice | '[' ']' # bracketFlatten | '[?' expression ']' # select ; chainedBracketSpecifier : bracketSpecifier # chainedBracket | '[' expression ']' # chainedBracketIndex ; slice : start=expression? ':' stop=expression? (':' step=expression?)? ; COMPARATOR : '<' | '<=' | '==' | '>=' | '>' | '!=' ; functionExpression : NAME '(' functionArg (',' functionArg)* ')' | NAME '(' ')' | JSON_CONSTANT '(' ')' ; functionArg : expression | expressionType ; currentNode : '@' ; form : '$form' ; currentField : '$field' ; expressionType : '&' expression ; RAW_STRING : '\'' (RAW_ESC | ~['\\])* '\'' ; fragment RAW_ESC : '\\' . ; literal : '`' jsonValue '`' ; identifier : NAME | STRING | JSON_CONSTANT ; JSON_CONSTANT : 'true' | 'false' | 'null' ; NAME : [@a-zA-Z_] [a-zA-Z0-9_]* ; jsonObject : '{' jsonObjectPair (',' jsonObjectPair)* '}' | '{' '}' ; jsonObjectPair : STRING ':' jsonValue ; jsonArray : '[' jsonValue (',' jsonValue)* ']' | '[' ']' ; jsonValue : STRING # jsonStringValue | (REAL_OR_EXPONENT_NUMBER | SIGNED_INT) # jsonNumberValue | jsonObject # jsonObjectValue | jsonArray # jsonArrayValue | JSON_CONSTANT # jsonConstantValue ; STRING : '"' (ESC | ~ ["\\])* '"' ; fragment ESC : '\\' (["\\/bfnrt`] | UNICODE) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [0-9a-fA-F] ; REAL_OR_EXPONENT_NUMBER : '-'? INT '.' [0-9] + EXP? | '-'? INT EXP ; SIGNED_INT : '-'? INT ; fragment INT : '0' | [1-9] [0-9]* ; fragment EXP : [Ee] [+\-]? INT ; WS : [ \t\n\r] + -> skip ;
test/fat.asm
AndreLaranjeira/AssemblyTranslator
0
168650
SECTION TEXT INPUT N LOAD N FAT: SUB ONE JMPZ FIM STORE AUX MULT N STORE N LOAD AUX JMP FAT FIM: OUTPUT N STOP SECTION DATA AUX: SPACE N: SPACE ONE: CONST 1
test/Fail/IrrelevantTelescopeRecord.agda
shlevy/agda
1,989
12955
<reponame>shlevy/agda -- Andreas, 2011-04-07 module IrrelevantTelescopeRecord where record Wrap .(A : Set) : Set where field out : A -- cannot use A, because it is declared irrelevant
programs/oeis/049/A049647.asm
jmorken/loda
1
15022
<gh_stars>1-10 ; A049647: T(n,n+2), array T given by A049639. ; 1,1,4,4,7,7,11,11,17,17,23,23,31,31,41,41,51,51,61,61,75,75,89,89,105,105,123,123,137,137,153,153,177,177,199,199,223,223,249,249 div $0,2 cal $0,49648 ; T(n,n+1), array T as in A049687 and T(2n,2n+2), array T given by A049639. mov $1,$0
alloy4fun_models/trashltl/models/7/mxZLihr3ZFJygYKiv.als
Kaixi26/org.alloytools.alloy
0
1394
open main pred idmxZLihr3ZFJygYKiv_prop8 { always (all f:File| some f.link implies eventually f.link in Trash) } pred __repair { idmxZLihr3ZFJygYKiv_prop8 } check __repair { idmxZLihr3ZFJygYKiv_prop8 <=> prop8o }
oeis/083/A083022.asm
neoneye/loda-programs
11
2049
; A083022: Numbers n such that 4*n^2 - 3 is prime. ; Submitted by <NAME> ; 2,4,5,7,10,13,16,17,20,22,23,29,32,34,40,43,44,46,49,55,56,59,62,64,68,70,71,73,82,86,95,97,101,103,104,109,110,125,127,133,134,148,149,152,155,160,161,163,164,166,170,175,178,181,185,208,209,218,220,226,230,235,244,247,251,253,254,263,265,274,277,280,287,290,293,295,304,313,317,320,326,328,329,331,332,334,343,346,347,352,356,361,364,368,373,385,386,395,397,398 mov $2,$0 pow $2,2 add $2,1 mov $6,1 lpb $2 add $1,6 mov $3,$1 add $5,$1 add $3,$5 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,$6 add $1,1 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 sub $5,2 lpe mov $0,$1 div $0,8 add $0,2
oeis/028/A028028.asm
neoneye/loda-programs
11
3450
<reponame>neoneye/loda-programs<filename>oeis/028/A028028.asm ; A028028: Expansion of 1/((1-3*x)*(1-4*x)*(1-5*x)*(1-9*x)). ; Submitted by <NAME> ; 1,21,286,3234,33187,322455,3035152,28040628,256229413,2326373049,21042916258,189930286182,1712158289479,15423616827003,138884571944404,1250325501927096,11254768340210185,101302177508279517,911766183522100390,8206129677461670570,73856341613555028331,664712964664800205791,5982446202971827605016,53842163712882124383804,484580213971670117380717,4361225633024743807601025,39251049251628030936279082,353259536108713679011333998,3179336289486891859800464143,28614028929077086095171220419 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,18911 ; Expansion of 1/((1-4x)(1-5x)(1-9x)). sub $0,$1 mul $1,4 add $1,$0 lpe mov $0,$1
react/react.g4
caos21/test-ode
1
3608
/* * Grammar for reactions * * copyright = "Copyright 2017, <NAME>" * license = "Apache v2.0" * */ grammar react; // A collection of entry entries : entry+ ; // Each entry can be: // - comment, starts with # ( # comment ) // - diffusion ( D[Ar+] = 3.5; ) // - constant ( Ar+ = 1.5e-21; ) or // - reaction ( Ar* + Ar* -> Ar + Ar+ + 2e; ) entry : COMMENT | ((constant | (diffusion | reaction)) SEMICOLON) ; // A reaction is one of more reactants which produce // products, and a rate name with constants aconstant eactivation and beta // Ar* + Ar* -> Ar + Ar+ + 2e 2.0e25 1.0 15.60 reaction : reactants PRODUCE products (rate)? (aconstant)? (eactivation)? (beta scientific*)? ; // diffusion coefficient diffusion : LDIFFBRACKET symbol RBRACKET (EQUAL dvalue)? ; // diffusion value dvalue : scientific ; // beta exponent Arrhenius: A eps^\beta exp(-eactivation/eps) beta : scientific ; // Activation energy Arrhenius: A eps^\beta exp(-eactivation/eps) eactivation : scientific ; // A constant Arrhenius: A eps^\beta exp(-eactivation/eps) aconstant : scientific ; // rate, name for a rate constant // ki rate : symbol ; // products, a combination of several product // Ar + Ar+ + 2e products : product (combineOperator product)* ; // product follows the same logic as reactants // 2e product : (scientific)?symbol ; // reactants, reactant (+ reactant ...) // Ar* + Ar* reactants : reactant (combineOperator reactant)* ; // reactant a factor times a symbol // Ar* reactant : (scientific)?symbol ; // constant value cvalue : scientific ; // A constant may be followed by a value // ng = 5.0e21; (or) // Ar constant : symbol (EQUAL cvalue)? ; symbol : SYMBOL ; // Operator for combination of reactants combineOperator : PLUS ; // scientific notation for numbers scientific : (PLUS | MINUS)?SCIENTIFIC_NUMBER ; // comment // : COMMENT // ; // comment line COMMENT : '#' ~( '\r' | '\n' )* ; // end of entry SEMICOLON : ';' ; // // a string // STRING // : '"' (~ '"')* '"' // ; // chemical symbol: starts with a letter and followed by a letter or numbers SYMBOL : [a-zA-Z][a-zA-Z0-9_*@./#&+-]* ; SCIENTIFIC_NUMBER : NUMBER (E SIGN? INTEGER)? ; // number 10.10 or .10 fragment NUMBER : INTEGER (POINT (INTEGER)?)? | POINT INTEGER ; fragment INTEGER : DIGIT+ ; fragment E : 'E' | 'e' ; fragment SIGN : (PLUS | MINUS) ; // fragment only see by lexer fragment DIGIT : ('0' .. '9') ; PLUS : '+' ; MINUS : '-' ; LDIFFBRACKET : 'D[' ; RBRACKET : ']' ; // STAR // : '*' // ; // reaction produces PRODUCE : '->' ; // assigns constant EQUAL : '=' ; // floats POINT : '.' ; // ignore any whitespace WHITESPACE : [ \t\r\n] -> skip ;
oeis/129/A129003.asm
neoneye/loda-programs
11
27548
; A129003: (n^3+n^2)*3^n. ; Submitted by <NAME>(s3) ; 6,108,972,6480,36450,183708,857304,3779136,15943230,64953900,257217444,994857552,3772168218,14061928860,51656065200,187339329792,671787127926,2384960530284,8391527791740,29288988968400,101486346775506,349333955567388,1195241798387592,4066985325326400,13768439903448750,46394135098660908,155653695863554644,520126753255993296,1731544420915998090,5744362585440707100,18994692282523938144,62617258221681411072,205829776537284794598,674758771568509381740,2206391138865887078700,7197337951761701850192 add $0,1 mov $1,3 pow $1,$0 sub $2,$0 mul $1,$2 sub $2,1 mul $0,$2 mul $1,$0 mov $0,$1
library/fmGUI_ManageDatabase/fmGUI_ManageDB_TO_ListAdd.applescript
NYHTC/applescript-fm-helper
1
1588
<filename>library/fmGUI_ManageDatabase/fmGUI_ManageDB_TO_ListAdd.applescript -- fmGUI_ManageDB_TO_ListAdd({TOList:null}) -- <NAME>, NYHTC -- given a list of table occurences, add them to the current DB. (* HISTORY: 1.2 - 2016-08-02 ( eshagdar ): the TOList might be a comma-delim string, so convert it to a list 1.1 - 2015-11-19 ( eshagdar ): renamed from 'addTOCsToBackupSystem'. Removed prompting for TOs, and instead receive it from main script. Save Manage DB at the end. Put the function in a try block. 1.0 - created REQUIRES: fmGUI_ManageDb_TO_Add fmGUI_ManageDB_Save parseChars replaceSimple *) on run fmGUI_ManageDb_TO_Add({TOList:null}) end run -------------------- -- START OF CODE -------------------- on fmGUI_ManageDB_TO_ListAdd(prefs) -- version 1.1 set defaultPrefs to {TOList:""} set prefs to prefs & defaultPrefs try set TOList to TOList of prefs set TOList to replaceSimple({TOList, CR, LF}) set TOList to replaceSimple({TOList, ", ", LF}) -- might have passed in a comma-delim string instead of a list set TOList to parseChars({sourceTEXT:TOList, parseString:LF}) if (count of TOList) is greater than 0 then -- loop over and get list of DBs that need to exist as data sources. repeat with oneTO in TOList set TORec to parseChars({sourceTEXT:oneTO, parseString:"||"}) set oneDBName to item 1 of TORec set oneTableName to item 2 of TORec set TOParam to {dbName:oneDBName, baseTableName:oneTableName, TOName:oneDBName & "__" & oneTableName} fmGUI_ManageDb_TO_Add(TOParam) end repeat fmGUI_ManageDB_Save({}) end if return true on error errMsg number errNum error "Couldn't fmGUI_ManageDB_TO_ListAdd - " & errMsg number errNum end try end fmGUI_ManageDB_TO_ListAdd -------------------- -- END OF CODE -------------------- on fmGUI_ManageDb_TO_Add(prefs) tell application "htcLib" to fmGUI_ManageDb_TO_Add(prefs) end fmGUI_ManageDb_TO_Add on fmGUI_ManageDB_Save(prefs) tell application "htcLib" to fmGUI_ManageDB_Save(prefs) end fmGUI_ManageDB_Save on parseChars(prefs) tell application "htcLib" to parseChars(prefs) end parseChars on replaceSimple(prefs) tell application "htcLib" to replaceSimple(prefs) end replaceSimple
src/main/antlr/PlanningProblem.g4
giancosta86/LambdaPrism
4
5949
/*§ =========================================================================== LambdaPrism =========================================================================== Copyright (C) 2016 <NAME> =========================================================================== 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. =========================================================================== */ grammar PlanningProblem; @header { package info.gianlucacosta.lambdaprism.planning.problem.parser; } problem: startDeclaration goalDeclaration mainAction*; startDeclaration: 'START:' literals; goalDeclaration: 'GOAL:' literals; mainAction: 'ACTION:' signature ('PRE:' preconditions)? ('POST:' effects)?; signature: FUNCTOR_NAME parameters?; parameters: '(' variable (',' variable)* ')'; preconditions: literals; effects: literals; literals: literal (',' literal)*; literal: NOT? functor; functor: FUNCTOR_NAME arguments?; arguments: '(' argument (',' argument)* ')'; argument: variable | constant; variable: VARIABLE_NAME; constant: FUNCTOR_NAME; NOT: '~'; FUNCTOR_NAME: [a-z0-9][A-Za-z0-9_]*; VARIABLE_NAME: [A-Z][A-Za-z0-9_]*; WHITESPACE: [ \t\r\n]+ -> skip ; SINGLE_LINE_COMMENT: ('//'|'#') ~('\r' | '\n')* -> skip; MULTI_LINE_COMMENT: '/*' .*? '*/' -> skip;
src/glfw/v3/glfw.adb
Roldak/OpenGLAda
79
23096
<reponame>Roldak/OpenGLAda -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with Glfw.API; with Interfaces.C.Strings; package body Glfw is use type Interfaces.C.int; procedure Init is begin if API.Init = 0 then raise Initialization_Exception; end if; end Init; procedure Shutdown is begin API.Glfw_Terminate; end Shutdown; procedure Version (Major, Minor, Rev : out Natural) is Raw_Major, Raw_Minor, Raw_Rev : C.int; begin API.Get_Version (Raw_Major, Raw_Minor, Raw_Rev); Major := Natural (Raw_Major); Minor := Natural (Raw_Minor); Rev := Natural (Raw_Rev); end Version; function Version_String return String is begin return Interfaces.C.Strings.Value (API.Get_Version_String); end Version_String; function Time return Seconds is begin return API.Get_Time; end Time; procedure Set_Time (Value : Seconds) is begin API.Set_Time (Value); end Set_Time; function Extension_Supported (Name : String) return Boolean is begin return Boolean (API.Extension_Supported (Interfaces.C.To_C (Name))); end Extension_Supported; end Glfw;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_833.asm
ljhsiun2/medusa
9
163017
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %r8 push %rax push %rbp lea addresses_UC_ht+0x11bfa, %r15 and $11314, %rbp mov (%r15), %r10 and $34602, %r13 lea addresses_WT_ht+0x2e1e, %r12 clflush (%r12) nop nop nop and $42148, %rax mov (%r12), %bp dec %rbp lea addresses_WT_ht+0x1812, %r10 nop nop sub $12128, %r8 and $0xffffffffffffffc0, %r10 movntdqa (%r10), %xmm6 vpextrq $0, %xmm6, %r13 nop nop nop and %rax, %rax lea addresses_WC_ht+0xc8a, %r8 add $51609, %r10 mov (%r8), %r12d nop nop add %r10, %r10 lea addresses_UC_ht+0x76f4, %rbp clflush (%rbp) nop nop add $30494, %r12 movl $0x61626364, (%rbp) add $1156, %r13 lea addresses_D_ht+0xca72, %r12 nop nop inc %r10 mov $0x6162636465666768, %r15 movq %r15, (%r12) nop nop nop nop nop mfence lea addresses_WT_ht+0x2acd, %r13 nop nop nop nop inc %rax movb $0x61, (%r13) nop nop nop sub %rbp, %rbp pop %rbp pop %rax pop %r8 pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rax push %rdx // Load mov $0x112, %r8 and $39045, %r12 mov (%r8), %ax nop nop and $61898, %r13 // Faulty Load lea addresses_D+0x1aa12, %rdx cmp $26920, %r10 mov (%rdx), %r13 lea oracles, %r12 and $0xff, %r13 shlq $12, %r13 mov (%r12,%r13,1), %r13 pop %rdx pop %rax pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
libsrc/stdio/c7420/fputc_cons.asm
jpoikela/z88dk
640
20437
<gh_stars>100-1000 ; ; ROM Console routine for the Philips Videopac C7420 ; By <NAME> - 2015 ; Apr, 2107: fixes and improvements ; ; $Id:fputc_cons.asm, 2017, Stefano $ ; SECTION code_clib PUBLIC fputc_cons_native .fputc_cons_native ; ODDLY THIS DOESN'T WORK ! (O2EM emulator problem ?) ; ld hl,2 ; add hl,sp ; ld a,(hl) pop bc pop hl ld a,l push hl push bc IF STANDARDESCAPECHARS cp 13 ret z cp 10 ELSE cp 10 ret z cp 13 ENDIF jr nz,nocr ld a,131 ; ENTER .nocr cp 8 jr nz,nobs ld a,130 ; RUBOUT .nobs cp 12 jr nz,nocls ;ld a,159 ; VIDINI (slower) ld a,157 ; CLEARA call outchar ld a,140 ; HOME .nocls cp '$' jr nz,nodollar ld a,4 .nodollar cp '#' jr nz,nohash ld a,6 .nohash cp '^' jr nz,nopow ld a,13 .nopow .outchar push af pop af rst $30 ret
org.alloytools.alloy.extra/extra/models/book/appendixA/undirected.als
Kaixi26/org.alloytools.alloy
527
3352
module appendixA/undirected sig Node { adjs: set Node } pred acyclic { adjs = ~adjs // You have to fill in additional formula here } run acyclic for 4
test/multiboot2_trampoline.asm
Itay2805/limine
67
85265
<filename>test/multiboot2_trampoline.asm extern multiboot2_main global _start section .multiboot_header header_start: dd 0xe85250d6 ; Magic number (multiboot 2) dd 0 ; Architecture 0 (protected mode i386) dd header_end - header_start ; Header length dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start)) ; Checksum align 8 framebuffer_tag_start: dw 5 ; type dw 1 ; flags dd framebuffer_tag_end - framebuffer_tag_start ; size dd 800 ; width dd 600 ; height dd 32 ; depth framebuffer_tag_end: align 8 ; Required end tag: dw 0 ; type dw 0 ; flags dw 8 ; size header_end: section .text bits 32 _start: cli mov esp, stack_top push ebx push eax call multiboot2_main ; Jump to our multiboot test kernel section .bss stack_bottom: resb 4096 * 16 stack_top:
source/nodes/program-storage_pools-instance.ads
reznikmm/gela
0
26025
<filename>source/nodes/program-storage_pools-instance.ads<gh_stars>0 -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Storage_Pools.Instance is Pool : aliased Storage_Pool; Pool_Access : constant Storage_Pool_Access := Pool'Access with Export, External_Name => "pool_access"; end Program.Storage_Pools.Instance;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/t9.adb
best08618/asylo
7
15121
-- { dg-do run } with Init9; use Init9; with Ada.Numerics; use Ada.Numerics; with Text_IO; use Text_IO; with Dump; procedure T9 is Local_R1 : R1; Local_R2 : R2; begin Local_R1.F := My_R1.F + 1.0; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40.*\n" } Local_R2.F := My_R2.F + 1.0; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c.*\n" } Local_R1.F := Pi; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40.*\n" } Local_R2.F := Pi; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18.*\n" } Local_R1.F := Local_R1.F + 1.0; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40.*\n" } Local_R2.F := Local_R2.F + 1.0; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c.*\n" } end;
test/Succeed/Issue1380a.agda
shlevy/agda
1,989
493
{-# OPTIONS --exact-split #-} -- {-# OPTIONS -v tc.cover:10 #-} postulate A : Set record I : Set where constructor i field f : A data Wrap : (j : I) → Set where con : (j : I) → Wrap j postulate C : Set anything : C test : (X : I) -> Wrap X -> C test (i ._) (con x) = anything
C5515_Support_Files/C5515_Lib/dsplib_2.40.00/55x_src/mtrans.asm
HeroSizy/Sizy
0
26074
<filename>C5515_Support_Files/C5515_Lib/dsplib_2.40.00/55x_src/mtrans.asm ;*********************************************************** ; Version 2.40.00 ;*********************************************************** ; Note: a symbol "SI_BUGS" is used to make a work around for silicon ; 5510 version1.0. If you are going to use the code on 5510 version1.0 ; silicon, you have to put switch -d"SI_BUGS" when you compile the code. ;**************************************************************** ; Function: mtrans ; Description: matrix multiply implementation ; Usage: short mtrans( DATA *x1, AR0 ; short row1, T0 ; short col1, T1 ; DATA *r); AR1 ; ; Copyright Texas instruments Inc, 2000 ;**************************************************************** .mmregs .text .def _mtrans _mtrans: PSH mmap(ST1_55) PSH mmap(ST2_55) ;XAR0 = x1 ;T0 = row1 ;T1 = col1 ;XAR1 = r MOV T0,HI(AC0) .if $isdefed("SI_BUGS") MPY T1,AC0,AC1 ;AC1 = row1*col1 MOV XAR1,XAR2 ;XAR2 = r to ensure MDP .else MPY T1,AC0,AC1 ;AC1 = row1*col1 || MOV XAR1,XAR2 ;XAR2 = r to ensure MDP .endif MOV AR0,mmap(@BSA01) ;BSA01 = x1 MOV AR1,mmap(@BSA23) ;BSA23 = r MOV AC1,mmap(@BK03) ;init block size MOV #0,AR0 ;AR0 = 0 MOV #0,AR2 ;AR2 = 0 BSET AR0LC BSET AR2LC SUB #1,T1,T2 MOV T2,CSR ;inner loop CSR = col-1 SUB #1,T0,T2 MOV T2,BRC0 ;outer loop BRC0 = row-1 MOV #0,T2 RPTBLOCAL loop ;for every row of x1 RPT CSR ; for every col of x1 MOV *AR0+,*(AR2+T0) loop: AMAR *AR2+ ; next col of r MOV #0,T0 ;return value TRUE POP mmap(ST2_55) POP mmap(ST1_55) return
Light/Implementation/Data/Boolean.agda
zamfofex/lightlib
1
7496
{-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-} module Light.Implementation.Data.Boolean where open import Light.Library.Data.Boolean using (Library ; Dependencies) open import Light.Variable.Sets open import Light.Library.Data.Unit as Unit using (Unit ; unit) open import Light.Level using (lift) open import Light.Library.Relation.Decidable using (Decidable ; yes ; no) open import Light.Library.Relation.Binary.Equality using (_≈_ ; wrap) open import Light.Library.Relation.Binary using (reflexivity) import Light.Implementation.Relation.Binary.Equality.Propositional import Light.Implementation.Relation.Decidable import Light.Package import Light.Implementation.Relation.Binary.Equality.Propositional.Decidable as DecidablePropositional import Light.Implementation.Data.Empty import Light.Implementation.Data.Unit instance dependencies : Dependencies dependencies = record {} instance library : Library dependencies library = record { Implementation } where module Implementation where data Boolean : Set where true false : Boolean {-# COMPILE JS Boolean = (a, cons) => a ? cons.true() : cons.false() #-} {-# COMPILE JS true = !0 #-} {-# COMPILE JS false = !1 #-} -- TODO: Optimize operations using JS operators. if_then_else_ : Boolean → 𝕒 → 𝕒 → 𝕒 if true then a else _ = a if false then _ else a = a postulate ¬_ : Boolean → Boolean postulate _∧_ _∨_ _⇢_ : Boolean → Boolean → Boolean true‐is‐true = lift unit false‐is‐false = lift unit private _≈?_ : ∀ (a b : Boolean) → Decidable (a ≈ b) false ≈? false = yes reflexivity false ≈? true = no λ () true ≈? false = no λ () true ≈? true = yes reflexivity equals = record { equals = wrap (record { are = λ a b → a ≈? b }) } module EqualityProperties = DecidablePropositional.Main _≈?_
libsrc/graphics/w_xorborder_callee.asm
rjcorrig/z88dk
0
177798
; ; Z88 Graphics Functions ; Written around the Interlogic Standard Library ; ; Wide resolution (int type parameters) and CALLEE conversion by <NAME>, 2018 ; ; ----- void __CALLEE__ xorborder(int x, int y, int x2, int y2) ; ; ; $Id: w_xorborder_callee.asm $ ; SECTION code_graphics PUBLIC xorborder_callee PUBLIC _xorborder_callee PUBLIC ASMDISP_XORBORDER_CALLEE EXTERN w_xorpixel EXTERN swapgfxbk EXTERN __graphics_end .xorborder_callee ._xorborder_callee pop af pop de pop hl exx ; w_plotpixel and swapgfxbk must not use the alternate registers, no problem with w_line_r pop de pop hl push af ; ret addr exx .asmentry push ix call swapgfxbk push hl push de exx push hl push de exx ;exx push de ; y delta exx pop bc ; y delta exx push hl ;inc hl .xloop1 exx call plot_sub ; (hl,de) ex de,hl add hl,bc ; y += delta ex de,hl inc hl call plot_sub ; (hl,de) ex de,hl and a sbc hl,bc ; y -= delta ex de,hl inc hl exx dec hl ld a,h or l jr z,endxloop dec hl ld a,h or l jr nz,xloop1 .endxloop pop hl ; restore x exx pop de ; y pop hl exx pop de ; y delta pop hl push hl ; x delta exx pop bc ; x delta ;inc de exx dec de .yloop1 exx call plot_sub ; (hl,de) add hl,bc ; x += delta inc de call plot_sub ; (hl,de) and a sbc hl,bc ; x -= delta inc de exx dec de ld a,d or e jr z,endyloop dec de ld a,d or e jr nz,yloop1 .endyloop jp __graphics_end .plot_sub push bc push hl push de call w_xorpixel pop de pop hl pop bc ret DEFC ASMDISP_XORBORDER_CALLEE = # asmentry - xorborder_callee
Cubical/HITs/Ints/QuoInt/Properties.agda
limemloh/cubical
1
16505
<reponame>limemloh/cubical {-# OPTIONS --cubical --safe #-} module Cubical.HITs.Ints.QuoInt.Properties where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.GroupoidLaws open import Cubical.HITs.Ints.QuoInt.Base renaming (_+ℤ_ to _+_) open import Cubical.Data.Nat hiding (+-comm; +-zero; _+_) +-pos-0 : ∀ a → pos 0 + a ≡ a +-pos-0 (pos zero) = refl +-pos-0 (pos (suc n)) = cong sucℤ (+-pos-0 (pos n)) +-pos-0 (neg zero) = posneg +-pos-0 (neg (suc n)) = cong predℤ (+-pos-0 (neg n)) +-pos-0 (posneg i) j = posneg (i ∧ j) +-neg-0 : ∀ a → neg 0 + a ≡ a +-neg-0 (neg zero) = refl +-neg-0 (neg (suc n)) = cong predℤ (+-neg-0 (neg n)) +-neg-0 (pos zero) = sym posneg +-neg-0 (pos (suc n)) = cong sucℤ (+-neg-0 (pos n)) +-neg-0 (posneg i) j = posneg (i ∨ ~ j) +-pos-suc : ∀ a b → sucℤ (pos b + a) ≡ (pos (suc b) + a) +-pos-suc (pos zero) b = refl +-pos-suc (pos (suc n)) b = cong sucℤ (+-pos-suc (pos n) b) +-pos-suc (neg zero) b = refl +-pos-suc (posneg i) b = refl +-pos-suc (neg (suc n)) b = sucPredℤ (pos b + neg n) ∙∙ sym (predSucℤ (pos b + neg n)) ∙∙ cong predℤ (+-pos-suc (neg n) b) -- the following hcomp does not termination-check: -- hcomp (λ j → λ -- { (i = i0) → sucPredℤ (pos b + neg n) (~ j) -- ; (i = i1) → {!predℤ ((+-pos-suc (neg n) b) j)!} -- }) (predSucℤ (pos b + neg n) (~ i)) +-neg-pred : ∀ a b → predℤ (neg b + a) ≡ (neg (suc b) + a) +-neg-pred (pos zero) b = refl +-neg-pred (neg zero) b = refl +-neg-pred (neg (suc n)) b = cong predℤ (+-neg-pred (neg n) b) +-neg-pred (posneg i) b = refl +-neg-pred (pos (suc n)) b = predSucℤ (neg b + pos n) ∙∙ sym (sucPredℤ (neg b + pos n)) ∙∙ cong sucℤ (+-neg-pred (pos n) b) +-comm : ∀ a b → a + b ≡ b + a +-comm a (pos zero) = sym (+-pos-0 a) +-comm a (neg zero) = sym (+-neg-0 a) +-comm a (pos (suc b)) = cong sucℤ (+-comm a (pos b)) ∙ +-pos-suc a b +-comm a (neg (suc b)) = cong predℤ (+-comm a (neg b)) ∙ +-neg-pred a b +-comm a (posneg i) = lemma a i where -- get some help from: -- https://www.codewars.com/kata/reviews/5c878e3ef1abb10001e32eb1/groups/5cca3f9e840f4b0001d8ac98 lemma : ∀ a → (λ i → (a + posneg i) ≡ (posneg i + a)) [ sym (+-pos-0 a) ≡ sym (+-neg-0 a) ] lemma (pos zero) i j = posneg (i ∧ j) lemma (pos (suc n)) i = cong sucℤ (lemma (pos n) i) lemma (neg zero) i j = posneg (i ∨ ~ j) lemma (neg (suc n)) i = cong predℤ (lemma (neg n) i) lemma (posneg i) j k = posneg ((i ∧ ~ k) ∨ (i ∧ j) ∨ (j ∧ k))
libsrc/target/coleco/games/joystick.asm
Frodevan/z88dk
640
88261
<filename>libsrc/target/coleco/games/joystick.asm SECTION code_clib PUBLIC joystick PUBLIC _joystick EXTERN coleco_joypad defc joystick = coleco_joypad defc _joystick = coleco_joypad
oeis/205/A205248.asm
neoneye/loda-programs
11
18921
<reponame>neoneye/loda-programs ; A205248: Number of (n+1) X 2 0..1 arrays with the number of clockwise edge increases in every 2 X 2 subblock the same. ; 16,40,112,328,976,2920,8752,26248,78736,236200,708592,2125768,6377296,19131880,57395632,172186888,516560656,1549681960,4649045872,13947137608,41841412816,125524238440,376572715312,1129718145928,3389154437776,10167463313320,30502389939952,91507169819848,274521509459536,823564528378600,2470693585135792,7412080755407368,22236242266222096,66708726798666280,200126180395998832,600378541187996488,1801135623563989456,5403406870691968360,16210220612075905072,48630661836227715208,145891985508683145616 mov $1,3 pow $1,$0 div $1,2 mul $1,24 add $1,16 mov $0,$1