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
bootdict/x86/string.asm
ikysil/ikforth
8
172585
;****************************************************************************** ; ; string.asm ; IKForth ; ; Unlicense since 1999 by <NAME> ; ;****************************************************************************** ; String words ;****************************************************************************** ; 17.6.1.0910 CMOVE ; D: c-addr1 c-addr2 u -- ; If u is greater than zero, copy u consecutive characters from the data space ; starting at c-addr1 to that starting at c-addr2, proceeding character-by-character ; from lower addresses to higher addresses. $CODE 'CMOVE',$C_MOVE PUSHRS EDI PUSHRS ESI POPDS ECX POPDS EDI POPDS ESI OR ECX,ECX JZ SHORT CMOVE_EXIT CLD REP MOVSB CMOVE_EXIT: POPRS ESI POPRS EDI $NEXT ; 17.6.1.0920 CMOVE> ; D: c-addr1 c-addr2 u -- ; If u is greater than zero, copy u consecutive characters from the data space ; starting at c-addr1 to that starting at c-addr2, proceeding character-by-character ; from higher addresses to lower addresses. $CODE 'CMOVE>',$C_MOVE_UP PUSHRS EDI PUSHRS ESI POPDS ECX POPDS EDI ADD EDI,ECX DEC EDI POPDS ESI ADD ESI,ECX DEC ESI OR ECX,ECX JBE SHORT CMOVEGR_EXIT STD REP MOVSB CLD CMOVEGR_EXIT: POPRS ESI POPRS EDI $NEXT ; 6.1.0980 COUNT $CODE 'COUNT',$COUNT POPDS EBX MOVZX EAX,byte [EBX] INC EBX PUSHDS EBX PUSHDS EAX $NEXT
alloy4fun_models/trashltl/models/14/P6vJmxESuSZGz3vqg.als
Kaixi26/org.alloytools.alloy
0
1444
<gh_stars>0 open main pred idP6vJmxESuSZGz3vqg_prop15 { eventually all f:File | f not in Trash implies f in Trash } pred __repair { idP6vJmxESuSZGz3vqg_prop15 } check __repair { idP6vJmxESuSZGz3vqg_prop15 <=> prop15o }
test/asset/agda-stdlib-1.0/Data/Fin/Substitution/Example.agda
omega12345/agda-mode
0
4408
<gh_stars>0 ------------------------------------------------------------------------ -- The Agda standard library -- -- An example of how Data.Fin.Substitution can be used: a definition -- of substitution for the untyped λ-calculus, along with some lemmas ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Fin.Substitution.Example where open import Data.Fin.Substitution open import Data.Fin.Substitution.Lemmas open import Data.Nat open import Data.Fin using (Fin) open import Data.Vec open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; refl; sym; cong; cong₂) open PropEq.≡-Reasoning open import Relation.Binary.Construct.Closure.ReflexiveTransitive using (Star; ε; _◅_) -- A representation of the untyped λ-calculus. Uses de Bruijn indices. infixl 9 _·_ data Tm (n : ℕ) : Set where var : (x : Fin n) → Tm n ƛ : (t : Tm (suc n)) → Tm n _·_ : (t₁ t₂ : Tm n) → Tm n -- Code for applying substitutions. module TmApp {ℓ} {T : ℕ → Set ℓ} (l : Lift T Tm) where open Lift l hiding (var) -- Applies a substitution to a term. infix 8 _/_ _/_ : ∀ {m n} → Tm m → Sub T m n → Tm n var x / ρ = lift (lookup ρ x) ƛ t / ρ = ƛ (t / ρ ↑) t₁ · t₂ / ρ = (t₁ / ρ) · (t₂ / ρ) open Application (record { _/_ = _/_ }) using (_/✶_) -- Some lemmas about _/_. ƛ-/✶-↑✶ : ∀ k {m n t} (ρs : Subs T m n) → ƛ t /✶ ρs ↑✶ k ≡ ƛ (t /✶ ρs ↑✶ suc k) ƛ-/✶-↑✶ k ε = refl ƛ-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (ƛ-/✶-↑✶ k ρs) refl ·-/✶-↑✶ : ∀ k {m n t₁ t₂} (ρs : Subs T m n) → t₁ · t₂ /✶ ρs ↑✶ k ≡ (t₁ /✶ ρs ↑✶ k) · (t₂ /✶ ρs ↑✶ k) ·-/✶-↑✶ k ε = refl ·-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (·-/✶-↑✶ k ρs) refl tmSubst : TermSubst Tm tmSubst = record { var = var; app = TmApp._/_ } open TermSubst tmSubst hiding (var) -- Substitution lemmas. tmLemmas : TermLemmas Tm tmLemmas = record { termSubst = tmSubst ; app-var = refl ; /✶-↑✶ = Lemma./✶-↑✶ } where module Lemma {T₁ T₂} {lift₁ : Lift T₁ Tm} {lift₂ : Lift T₂ Tm} where open Lifted lift₁ using () renaming (_↑✶_ to _↑✶₁_; _/✶_ to _/✶₁_) open Lifted lift₂ using () renaming (_↑✶_ to _↑✶₂_; _/✶_ to _/✶₂_) /✶-↑✶ : ∀ {m n} (ρs₁ : Subs T₁ m n) (ρs₂ : Subs T₂ m n) → (∀ k x → var x /✶₁ ρs₁ ↑✶₁ k ≡ var x /✶₂ ρs₂ ↑✶₂ k) → ∀ k t → t /✶₁ ρs₁ ↑✶₁ k ≡ t /✶₂ ρs₂ ↑✶₂ k /✶-↑✶ ρs₁ ρs₂ hyp k (var x) = hyp k x /✶-↑✶ ρs₁ ρs₂ hyp k (ƛ t) = begin ƛ t /✶₁ ρs₁ ↑✶₁ k ≡⟨ TmApp.ƛ-/✶-↑✶ _ k ρs₁ ⟩ ƛ (t /✶₁ ρs₁ ↑✶₁ suc k) ≡⟨ cong ƛ (/✶-↑✶ ρs₁ ρs₂ hyp (suc k) t) ⟩ ƛ (t /✶₂ ρs₂ ↑✶₂ suc k) ≡⟨ sym (TmApp.ƛ-/✶-↑✶ _ k ρs₂) ⟩ ƛ t /✶₂ ρs₂ ↑✶₂ k ∎ /✶-↑✶ ρs₁ ρs₂ hyp k (t₁ · t₂) = begin t₁ · t₂ /✶₁ ρs₁ ↑✶₁ k ≡⟨ TmApp.·-/✶-↑✶ _ k ρs₁ ⟩ (t₁ /✶₁ ρs₁ ↑✶₁ k) · (t₂ /✶₁ ρs₁ ↑✶₁ k) ≡⟨ cong₂ _·_ (/✶-↑✶ ρs₁ ρs₂ hyp k t₁) (/✶-↑✶ ρs₁ ρs₂ hyp k t₂) ⟩ (t₁ /✶₂ ρs₂ ↑✶₂ k) · (t₂ /✶₂ ρs₂ ↑✶₂ k) ≡⟨ sym (TmApp.·-/✶-↑✶ _ k ρs₂) ⟩ t₁ · t₂ /✶₂ ρs₂ ↑✶₂ k ∎ open TermLemmas tmLemmas public hiding (var)
programs/oeis/241/A241575.asm
neoneye/loda
22
3124
<reponame>neoneye/loda ; A241575: Sturmian expansion of 1/2 in base sqrt(2)-1. ; 0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0 add $0,36 seq $0,285073 ; 0-limiting word of the morphism 0->10, 1-> 010.
alloc/allopool.asm
DigitalMars/optlink
28
172512
TITLE ALLOPOOL - Copyright (c) SLR Systems 1994 INCLUDE MACROS PUBLIC SSYM_POOL_GET,TEXT_POOL_GET,P1ONLY_POOL_GET,TILLP2_POOL_GET,TILLMIDDLE_POOL_GET,SECTION_POOL_GET PUBLIC SEGMENT_POOL_GET,SEGMOD_POOL_GET,CLASS_POOL_GET,GROUP_POOL_GET,MODULE_POOL_GET,ALLOC_LOCAL,RELOC_POOL_GET PUBLIC XREF_POOL_GET,UNMANGLE_POOL_GET if fg_segm PUBLIC ENTRYNAME_POOL_GET,IMPNAME_POOL_GET,ENTRY_POOL_GET,RESTYPE_POOL_GET,RESOURCE_POOL_GET,RESNAME_POOL_GET PUBLIC PENT_POOL_GET,IMPMOD_POOL_GET,RES_TYPENAME_POOL_GET,RTNL_POOL_GET endif if fg_td PUBLIC TD_NAME_POOL_GET,TD_GLOCAL_POOL_GET,TD_GTYPE_POOL_GET,TD_GSMEM_POOL_GET,TD_GCLASS_POOL_GET endif if fg_pe PUBLIC PAGE_RELOC_POOL_GET endif if fg_cvpack PUBLIC CV_GSYM_POOL_GET,CV_LTYPE_POOL_GET,CV_GTYPE_POOL_GET,CV_SSYM_POOL_GET,CV_HASHES_POOL_GET endif .DATA EXTERNDEF SSYM_STUFF:ALLOCS_STRUCT,TEXT_STUFF:ALLOCS_STRUCT,P1ONLY_STUFF:ALLOCS_STRUCT EXTERNDEF TILLMIDDLE_STUFF:ALLOCS_STRUCT,SEGMENT_STUFF:ALLOCS_STRUCT,LNAME_STUFF:ALLOCS_STRUCT EXTERNDEF TD_NAME_STUFF:ALLOCS_STRUCT,TD_GLOCAL_STUFF:ALLOCS_STRUCT,ENTRYNAME_STUFF:ALLOCS_STRUCT EXTERNDEF IMPNAME_STUFF:ALLOCS_STRUCT,ENTRY_STUFF:ALLOCS_STRUCT,RESOURCE_TYPE_STUFF:ALLOCS_STRUCT EXTERNDEF RESOURCE_STUFF:ALLOCS_STRUCT,RESOURCE_NAME_STUFF:ALLOCS_STRUCT,PENT_STUFF:ALLOCS_STRUCT EXTERNDEF RELOC_STUFF:ALLOCS_STRUCT,TD_GTYPE_STUFF:ALLOCS_STRUCT,TD_GSMEM_STUFF:ALLOCS_STRUCT EXTERNDEF TD_GCLASS_STUFF:ALLOCS_STRUCT,PAGE_RELOC_STUFF:ALLOCS_STRUCT,CV_GSYM_STUFF:ALLOCS_STRUCT EXTERNDEF CV_LTYPE_STUFF:ALLOCS_STRUCT,CV_GTYPE_STUFF:ALLOCS_STRUCT,CV_SSYM_STUFF:ALLOCS_STRUCT EXTERNDEF CV_HASHES_STUFF:ALLOCS_STRUCT,XREF_STUFF:ALLOCS_STRUCT,UNMANGLE_STUFF:ALLOCS_STRUCT if fg_cvpack EXTERNDEF CV_LTYPE_OVERSIZE_CNT:DWORD EXTERNDEF CV_LTYPE_SPECIAL_BLOCK:DWORD EXTERNDEF CV_GTYPE_OVERSIZE_CNT:DWORD EXTERNDEF CV_GTYPE_SPECIAL_BLOCK:DWORD endif .CODE ROOT_TEXT externdef _allo_pool_get1:proc externdef _ap_fix:proc externdef _get_new_phys_blk:proc externdef _cv_ltype_pool_get:proc externdef _cv_gtype_pool_get:proc if fg_cvpack EXTERNDEF _get_large_segment:proc endif UNMANGLE_POOL_GET PROC push ECX push EDX push OFF UNMANGLE_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret UNMANGLE_POOL_GET ENDP if fg_cvpack CV_GSYM_POOL_GET PROC push ECX push EDX push OFF CV_GSYM_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret CV_GSYM_POOL_GET ENDP CV_SSYM_POOL_GET PROC push ECX push EDX push OFF CV_SSYM_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret CV_SSYM_POOL_GET ENDP CV_LTYPE_POOL_GET PROC push ECX push EDX push EAX call _cv_ltype_pool_get add ESP,4 pop EDX pop ECX ret CV_LTYPE_POOL_GET ENDP CV_GTYPE_POOL_GET PROC push ECX push EDX push EAX call _cv_gtype_pool_get add ESP,4 pop EDX pop ECX ret CV_GTYPE_POOL_GET ENDP CV_HASHES_POOL_GET PROC push ECX push EDX push OFF CV_HASHES_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret CV_HASHES_POOL_GET ENDP endif if fg_pe PAGE_RELOC_POOL_GET PROC push ECX push EDX push OFF PAGE_RELOC_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret PAGE_RELOC_POOL_GET ENDP endif if fg_td TD_GCLASS_POOL_GET PROC push ECX push EDX push OFF TD_GCLASS_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret TD_GCLASS_POOL_GET ENDP TD_GSMEM_POOL_GET PROC push ECX push EDX push OFF TD_GSMEM_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret TD_GSMEM_POOL_GET ENDP TD_GLOCAL_POOL_GET PROC push ECX push EDX push OFF TD_GLOCAL_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret TD_GLOCAL_POOL_GET ENDP TD_GTYPE_POOL_GET PROC push ECX push EDX push OFF TD_GTYPE_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret TD_GTYPE_POOL_GET ENDP TD_NAME_POOL_GET PROC push ECX push EDX push OFF TD_NAME_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret TD_NAME_POOL_GET ENDP endif if fg_segm PENT_POOL_GET PROC push ECX push EDX push OFF PENT_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret PENT_POOL_GET ENDP RESOURCE_POOL_GET PROC push ECX push EDX push OFF RESOURCE_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret RESOURCE_POOL_GET ENDP RESTYPE_POOL_GET EQU RESOURCE_POOL_GET RESNAME_POOL_GET EQU RESOURCE_POOL_GET RES_TYPENAME_POOL_GET EQU RESOURCE_POOL_GET RTNL_POOL_GET EQU RESOURCE_POOL_GET ENTRY_POOL_GET PROC push ECX push EDX push OFF ENTRY_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ENTRY_POOL_GET ENDP ENTRYNAME_POOL_GET PROC push ECX push EDX push OFF ENTRYNAME_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ENTRYNAME_POOL_GET ENDP IMPNAME_POOL_GET PROC push ECX push EDX push OFF IMPNAME_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret IMPNAME_POOL_GET ENDP endif RELOC_POOL_GET PROC ; ;USED BY: INSTRELO ; INSTNMSP ; push ECX push EDX push OFF RELOC_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret RELOC_POOL_GET ENDP XREF_POOL_GET PROC push ECX push EDX push OFF XREF_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret XREF_POOL_GET ENDP SSYM_POOL_GET PROC push ECX push EDX push OFF SSYM_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ; ;USED BY: RESOURCE ;PTRS DESCRIBING .RES FILE BLOCKS ; COMDEF ;HUGE PTR ALLOCATION ; FARINST ;NORMAL GLOBAL SYMBOLS ; SSYM_POOL_GET ENDP P1ONLY_POOL_GET PROC push ECX push EDX push OFF P1ONLY_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ; ;USED BY: COMDAT-ORDERING ; COMDAT-SOFT-REFERENCE STUFF ; SOME LIBRARY STUFF ; P1ONLY_POOL_GET ENDP public _tillmiddle_pool_get _tillmiddle_pool_get proc mov EAX,4[ESP] _tillmiddle_pool_get endp TILLMIDDLE_POOL_GET PROC push ECX push EDX push OFF TILLMIDDLE_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ; ;USED BY: LOCAL SYMBOLS ; MODULE_STRUCT IF NOT HASHING ; TILLMIDDLE_POOL_GET ENDP TILLP2_POOL_GET EQU TILLMIDDLE_POOL_GET ; ;USED BY: MODULE NAME, DESCRIPTION ; START-ADDRESS FIXUPP ; CSEG_STRUCTS ; OUTFILE_STRUCTS ; SRC_STRUCTS ; ; LEA DI,TILLP2_STUFF ; JMP ALLO_POOL_GET ;TILLP2_POOL_GET ENDP ALLOC_LOCAL PROC push ECX push EDX push OFF LNAME_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret ALLOC_LOCAL ENDP SEGMENT_POOL_GET PROC push ECX push EDX push OFF SEGMENT_STUFF push EAX call _allo_pool_get1 add ESP,8 pop EDX pop ECX ret SEGMENT_POOL_GET ENDP SEGMOD_POOL_GET EQU SEGMENT_POOL_GET CLASS_POOL_GET EQU SEGMENT_POOL_GET GROUP_POOL_GET EQU SEGMENT_POOL_GET MODULE_POOL_GET EQU SEGMENT_POOL_GET ;FOR SEARCHING FOR SPECIFIC MODULE NAMES SECTION_POOL_GET EQU SEGMENT_POOL_GET if fg_segm IMPMOD_POOL_GET EQU SEGMOD_POOL_GET endif TEXT_POOL_GET EQU SEGMENT_POOL_GET ; ;USED BY: FILE_LIST KINDS OF STUFF ; LIBRARY_STRUCTS ; END
test/Succeed/Issue1221.agda
cruhland/agda
1,989
12248
<reponame>cruhland/agda<gh_stars>1000+ open import Common.Level open import Common.Reflection open import Common.Equality open import Common.Prelude postulate f : ∀ a → Set a pattern expectedType = pi (vArg (def (quote Level) [])) (abs "a" (sort (set (var 0 [])))) ok : ⊤ ok = _ notOk : String notOk = "not ok" macro isExpected : QName → Tactic isExpected x hole = bindTC (getType x) λ { expectedType → give (quoteTerm ok) hole ; t → give (quoteTerm notOk) hole } thm : ⊤ thm = isExpected f
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_498.asm
ljhsiun2/medusa
9
179010
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_498.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1a9ae, %r14 nop nop nop nop sub %r9, %r9 mov $0x6162636465666768, %rbp movq %rbp, %xmm4 movups %xmm4, (%r14) sub $46328, %rdx lea addresses_WT_ht+0x11fae, %r11 nop nop nop nop nop sub %rdx, %rdx movb $0x61, (%r11) nop nop nop nop cmp $6561, %rbp lea addresses_A_ht+0x12b7e, %rsi lea addresses_WT_ht+0x9179, %rdi clflush (%rsi) nop nop nop dec %r9 mov $23, %rcx rep movsb sub $32530, %r9 lea addresses_WC_ht+0x36ee, %rsi add %r12, %r12 mov (%rsi), %r14 nop and %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r14 push %r9 push %rax push %rdx // Load lea addresses_PSE+0xb1be, %r11 nop nop nop cmp %r9, %r9 mov (%r11), %r13d nop nop nop nop xor %rdx, %rdx // Store lea addresses_PSE+0x1b890, %rax nop and $45743, %rdx movl $0x51525354, (%rax) nop nop nop inc %r9 // Faulty Load lea addresses_D+0x52ae, %r14 and $32100, %r12 mov (%r14), %eax lea oracles, %r14 and $0xff, %rax shlq $12, %rax mov (%r14,%rax,1), %rax pop %rdx pop %rax pop %r9 pop %r14 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 1}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_A_ht', 'congruent': 3}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'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 */
oeis/070/A070953.asm
neoneye/loda-programs
11
86774
<reponame>neoneye/loda-programs<filename>oeis/070/A070953.asm ; A070953: Order of the group GU(n,2), the general unitary n X n matrices over the finite field GF(4). ; Submitted by <NAME> ; 3,18,648,77760,41057280,82771476480,683361309818880,22304913152488243200,2929259634489976002969600,1534275894314621670931405209600,3219180858829475639028172057057689600 mov $1,1 mov $4,3 lpb $0 sub $0,1 mov $2,$4 mul $3,8 add $3,$4 add $4,$3 mul $1,$4 mov $3,$2 lpe mov $0,$1 mul $0,3
HelloWorld.adb
abhilashkr1996/HelloWorld
7
19635
with Ada.Text_IO; procedure Hello is begin Ada.Text_IO.Put_Line("Hello, world!"); end Hello;
ada/prime/prime_ada.ads
rn7s2/src
1
29204
package Prime_Ada is cnt : Integer; procedure Get_Prime (n : Integer); end Prime_Ada;
oeis/090/A090301.asm
neoneye/loda-programs
11
97037
<reponame>neoneye/loda-programs ; A090301: a(n) = 15*a(n-1) + a(n-2), starting with a(0) = 2 and a(1) = 15. ; Submitted by <NAME>(l1) ; 2,15,227,3420,51527,776325,11696402,176222355,2655031727,40001698260,602680505627,9080209282665,136805819745602,2061167505466695,31054318401746027,467875943531657100,7049193471376602527,106205778014180695005,1600135863684087027602,24108243733275486109035,363223791862816378663127,5472465121675521166055940,82450200616995633869502227,1242225474376610029208589345,18715832316266146071998342402,281979710218368801109183725375,4248411485591798162709754223027,64008151994095341241755497070780 mov $2,1 lpb $0 sub $0,1 mul $2,-1 add $3,1 mov $1,$3 mul $1,15 add $2,$1 add $3,$2 lpe mov $0,$2 add $0,1
programs/oeis/288/A288918.asm
jmorken/loda
1
22055
<reponame>jmorken/loda<filename>programs/oeis/288/A288918.asm ; A288918: Number of 4-cycles in the n X n king graph. ; 0,3,29,79,153,251,373,519,689,883,1101,1343,1609,1899,2213,2551,2913,3299,3709,4143,4601,5083,5589,6119,6673,7251,7853,8479,9129,9803,10501,11223,11969,12739,13533,14351,15193,16059,16949,17863,18801,19763,20749,21759,22793,23851,24933,26039,27169,28323,29501,30703,31929,33179,34453,35751,37073,38419,39789,41183,42601,44043,45509,46999,48513,50051,51613,53199,54809,56443,58101,59783,61489,63219,64973,66751,68553,70379,72229,74103,76001,77923,79869,81839,83833,85851,87893,89959,92049,94163,96301,98463,100649,102859,105093,107351,109633,111939,114269,116623,119001,121403,123829,126279,128753,131251,133773,136319,138889,141483,144101,146743,149409,152099,154813,157551,160313,163099,165909,168743,171601,174483,177389,180319,183273,186251,189253,192279,195329,198403,201501,204623,207769,210939,214133,217351,220593,223859,227149,230463,233801,237163,240549,243959,247393,250851,254333,257839,261369,264923,268501,272103,275729,279379,283053,286751,290473,294219,297989,301783,305601,309443,313309,317199,321113,325051,329013,332999,337009,341043,345101,349183,353289,357419,361573,365751,369953,374179,378429,382703,387001,391323,395669,400039,404433,408851,413293,417759,422249,426763,431301,435863,440449,445059,449693,454351,459033,463739,468469,473223,478001,482803,487629,492479,497353,502251,507173,512119,517089,522083,527101,532143,537209,542299,547413,552551,557713,562899,568109,573343,578601,583883,589189,594519,599873,605251,610653,616079,621529,627003,632501,638023,643569,649139,654733,660351,665993,671659,677349,683063,688801,694563,700349,706159,711993,717851,723733,729639,735569,741523 mov $2,$0 mul $2,2 lpb $2 add $3,1 add $1,$3 trn $1,3 sub $2,1 add $3,5 lpe trn $1,1
Library/Ruler/uiGuideCreateControl.asm
steakknife/pcgeos
504
89009
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: uiGuideCreateControl.asm AUTHOR: <NAME> METHODS: Name Description ---- ----------- FUNCTIONS: Scope Name Description ----- ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- jon 11 feb 1992 Initial version. DESCRIPTION: Code for the Guide Create controller $Id: uiGuideCreateControl.asm,v 1.1 97/04/07 10:43:16 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RulerUICode segment resource COMMENT @---------------------------------------------------------------------- MESSAGE: GuideCreateControlGetInfo -- MSG_GEN_CONTROL_GET_INFO for GuideCreateControlClass DESCRIPTION: Return group PASS: *ds:si - instance data es - segment of GuideCreateControlClass ax - The message cx:dx - GenControlBuildInfo structure to fill in RETURN: none DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/31/91 Initial version ------------------------------------------------------------------------------@ GuideCreateControlGetInfo method dynamic GuideCreateControlClass, MSG_GEN_CONTROL_GET_INFO mov si, offset GCC_dupInfo call CopyDupInfoCommon ret GuideCreateControlGetInfo endm GCC_dupInfo GenControlBuildInfo < 0, ; GCBI_flags GCC_IniFileKey, ; GCBI_initFileKey GCC_gcnList, ; GCBI_gcnList length GCC_gcnList, ; GCBI_gcnCount GCC_notifyList, ; GCBI_notificationList length GCC_notifyList, ; GCBI_notificationCount GCCName, ; GCBI_controllerName handle GuideCreateControlUI, ; GCBI_dupBlock GCC_childList, ; GCBI_childList length GCC_childList, ; GCBI_childCount GCC_featuresList, ; GCBI_featuresList length GCC_featuresList, ; GCBI_featuresCount GCC_DEFAULT_FEATURES, ; GCBI_features 0, ; GCBI_toolBlock 0, ; GCBI_toolList 0, ; GCBI_toolCount 0, ; GCBI_toolFeaturesList 0, ; GCBI_toolFeaturesCount 0, ; GCBI_toolFeatures GCC_helpContext> ; GCBI_helpContext if FULL_EXECUTE_IN_PLACE RulerControlInfoXIP segment resource endif GCC_helpContext char "dbGuideCreat", 0 GCC_IniFileKey char "GuideCreate", 0 GCC_gcnList GCNListType \ <MANUFACTURER_ID_GEOWORKS, GAGCNLT_APP_TARGET_NOTIFY_RULER_TYPE_CHANGE> GCC_notifyList NotificationType \ <MANUFACTURER_ID_GEOWORKS, GWNT_RULER_TYPE_CHANGE> ;--- GCC_childList GenControlChildInfo \ <offset GuideCreateInteraction, mask GCCF_HORIZONTAL_GUIDES or \ mask GCCF_VERTICAL_GUIDES, 0> GCC_featuresList GenControlFeaturesInfo \ <offset CreateHorizontalGuidelineTrigger, VGuideCreateName, 0>, <offset CreateVerticalGuidelineTrigger, HGuideCreateName, 0> if FULL_EXECUTE_IN_PLACE RulerControlInfoXIP ends endif COMMENT @---------------------------------------------------------------------- MESSAGE: GuideCreateControlCreateGuide -- MSG_GCC_CREATE_VERTICAL_GUIDELINE for GuideCreateControlClass DESCRIPTION: Cretae a guideline PASS: *ds:si - instance data es - segment of GuideCreateControlClass ax - The message RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: Only update on a USER change KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/31/91 Initial version ------------------------------------------------------------------------------@ GuideCreateControlCreateVerticalGuideline method dynamic GuideCreateControlClass, MSG_GCC_CREATE_VERTICAL_GUIDELINE .enter ; ; Sorry about the nomenclature, but a vertical *guideline* is ; actually a horizontal *guide*, since the guideline itself ; runs from the top of the screen to the bottom (it's vertical), ; but it guides your horizontal motion. ; mov ax, MSG_VIS_RULER_ADD_HORIZONTAL_GUIDE call GuideCreateControlCreateGuidelineCommon .leave ret GuideCreateControlCreateVerticalGuideline endm GuideCreateControlCreateHorizontalGuideline method dynamic GuideCreateControlClass, MSG_GCC_CREATE_HORIZONTAL_GUIDELINE .enter ; ; Sorry about the nomenclature, but a horizontal *guideline* is ; actually a vertical *guide*, since the guideline itself ; runs from the top of the screen to the bottom (it's horizontal) ; but it guides your vertical motion. ; mov ax, MSG_VIS_RULER_ADD_VERTICAL_GUIDE call GuideCreateControlCreateGuidelineCommon .leave ret GuideCreateControlCreateHorizontalGuideline endm GuideCreateControlCreateGuidelineCommon proc near .enter push ax,si ;save message, controller chunk call GetChildBlock mov si, offset GuideCreateValue mov ax, MSG_GEN_VALUE_GET_VALUE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop bx,si ;bx <- message, si <- chunk mov_tr ax, dx cwd sub sp, size DWFixed mov bp, sp movdwf ss:[bp], dxaxcx mov dx, size DWFixed mov_tr ax, bx ;ax <- message mov bx, segment VisRulerClass mov di, offset VisRulerClass call GenControlOutputActionStack add sp, size DWFixed .leave ret GuideCreateControlCreateGuidelineCommon endp COMMENT @---------------------------------------------------------------------- MESSAGE: GuideCreateControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI for GuideCreateControlClass DESCRIPTION: Handle notification of type change PASS: *ds:si - instance data es - segment of GuideCreateControlClass ax - MSG_GEN_CONTROL_UPDATE_UI ss:bp - GenControlUpdateUIParams RETURN: nothing DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 11 feb 1992 Initial version ------------------------------------------------------------------------------@ GuideCreateControlUpdateUI method GuideCreateControlClass, MSG_GEN_CONTROL_UPDATE_UI .enter mov bx, ss:[bp].GCUUIP_dataBlock call MemLock mov ds, ax mov cl, ds:[RTNB_type] call MemUnlock call ConvertVisRulerTypeToDisplayFormat mov bx, ss:[bp].GCUUIP_childBlock mov si, offset GuideCreateUnitsList mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr di, dx call ObjMessage mov ax, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE mov cx, ax ;mark modified clr di call ObjMessage mov ax, MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG clr di call ObjMessage .leave ret GuideCreateControlUpdateUI endm RulerUICode ends
src/asf-components-html-selects.adb
jquorning/ada-asf
12
1879
----------------------------------------------------------------------- -- html-selects -- ASF HTML UISelectOne and UISelectMany components -- Copyright (C) 2011, 2013, 2014, 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 Util.Strings; with ASF.Utils; package body ASF.Components.Html.Selects is -- ------------------------------ -- UISelectItem Component -- ------------------------------ ITEM_LABEL_NAME : constant String := "itemLabel"; ITEM_VALUE_NAME : constant String := "itemValue"; ITEM_DESCRIPTION_NAME : constant String := "itemDescription"; ITEM_DISABLED_NAME : constant String := "itemDisabled"; SELECT_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; -- ------------------------------ -- UISelectBoolean Component -- ------------------------------ -- Render the checkbox element. overriding procedure Render_Input (UI : in UISelectBoolean; Context : in out Faces_Context'Class; Write_Id : in Boolean := True) is use ASF.Components.Html.Forms; Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Value : constant EL.Objects.Object := UIInput'Class (UI).Get_Value; begin Writer.Start_Element ("input"); Writer.Write_Attribute (Name => "type", Value => "checkbox"); UI.Render_Attributes (Context, SELECT_ATTRIBUTE_NAMES, Writer, Write_Id); Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id); if not EL.Objects.Is_Null (Value) and then EL.Objects.To_Boolean (Value) then Writer.Write_Attribute (Name => "checked", Value => "true"); end if; Writer.End_Element ("input"); end Render_Input; -- ------------------------------ -- Convert the string into a value. If a converter is specified on the component, -- use it to convert the value. Make sure the result is a boolean. -- ------------------------------ overriding function Convert_Value (UI : in UISelectBoolean; Value : in String; Context : in Faces_Context'Class) return EL.Objects.Object is use type EL.Objects.Data_Type; Result : constant EL.Objects.Object := Forms.UIInput (UI).Convert_Value (Value, Context); begin case EL.Objects.Get_Type (Result) is when EL.Objects.TYPE_BOOLEAN => return Result; when EL.Objects.TYPE_INTEGER => return EL.Objects.To_Object (EL.Objects.To_Boolean (Result)); when others => if Value = "on" then return EL.Objects.To_Object (True); else return EL.Objects.To_Object (False); end if; end case; end Convert_Value; -- ------------------------------ -- Iterator over the Select_Item elements -- ------------------------------ -- ------------------------------ -- Get an iterator to scan the component children. -- ------------------------------ procedure First (UI : in UISelectOne'Class; Context : in Faces_Context'Class; Iterator : out Cursor) is begin Iterator.Component := UI.First; Iterator.Pos := 0; Iterator.Last := 0; while ASF.Components.Base.Has_Element (Iterator.Component) loop Iterator.Current := ASF.Components.Base.Element (Iterator.Component); if Iterator.Current.all in UISelectItem'Class then return; end if; if Iterator.Current.all in UISelectItems'Class then Iterator.List := UISelectItems'Class (Iterator.Current.all) .Get_Select_Item_List (Context); Iterator.Last := Iterator.List.Length; Iterator.Pos := 1; if Iterator.Last > 0 then return; end if; end if; ASF.Components.Base.Next (Iterator.Component); end loop; Iterator.Pos := 0; Iterator.Current := null; end First; -- ------------------------------ -- Returns True if the iterator points to a valid child. -- ------------------------------ function Has_Element (Pos : in Cursor) return Boolean is use type ASF.Components.Base.UIComponent_Access; begin if Pos.Pos > 0 and Pos.Pos <= Pos.Last then return True; else return Pos.Current /= null; end if; end Has_Element; -- ------------------------------ -- Get the child component pointed to by the iterator. -- ------------------------------ function Element (Pos : in Cursor; Context : in Faces_Context'Class) return ASF.Models.Selects.Select_Item is begin if Pos.Pos > 0 and Pos.Pos <= Pos.Last then return Pos.List.Get_Select_Item (Pos.Pos); else return UISelectItem'Class (Pos.Current.all).Get_Select_Item (Context); end if; end Element; -- ------------------------------ -- Move to the next child. -- ------------------------------ procedure Next (Pos : in out Cursor; Context : in Faces_Context'Class) is begin if Pos.Pos > 0 and Pos.Pos < Pos.Last then Pos.Pos := Pos.Pos + 1; else Pos.Pos := 0; loop Pos.Current := null; ASF.Components.Base.Next (Pos.Component); exit when not ASF.Components.Base.Has_Element (Pos.Component); Pos.Current := ASF.Components.Base.Element (Pos.Component); exit when Pos.Current.all in UISelectItem'Class; if Pos.Current.all in UISelectItems'Class then Pos.List := UISelectItems'Class (Pos.Current.all).Get_Select_Item_List (Context); Pos.Last := Pos.List.Length; Pos.Pos := 1; exit when Pos.Last > 0; Pos.Pos := 0; end if; end loop; end if; end Next; -- ------------------------------ -- Get the <b>Select_Item</b> represented by the component. -- ------------------------------ function Get_Select_Item (From : in UISelectItem; Context : in Faces_Context'Class) return ASF.Models.Selects.Select_Item is use Util.Beans.Objects; Val : constant Object := From.Get_Attribute (Name => VALUE_NAME, Context => Context); begin if not Is_Null (Val) then return ASF.Models.Selects.To_Select_Item (Val); end if; declare Label : constant Object := From.Get_Attribute (Name => ITEM_LABEL_NAME, Context => Context); Value : constant Object := From.Get_Attribute (Name => ITEM_VALUE_NAME, Context => Context); Description : constant Object := From.Get_Attribute (Name => ITEM_DESCRIPTION_NAME, Context => Context); Disabled : constant Boolean := From.Get_Attribute (Name => ITEM_DISABLED_NAME, Context => Context); begin if Is_Null (Label) then return ASF.Models.Selects.Create_Select_Item (Value, Value, Description, Disabled); else return ASF.Models.Selects.Create_Select_Item (Label, Value, Description, Disabled); end if; end; end Get_Select_Item; -- ------------------------------ -- UISelectItems Component -- ------------------------------ -- ------------------------------ -- Get the <b>Select_Item</b> represented by the component. -- ------------------------------ function Get_Select_Item_List (From : in UISelectItems; Context : in Faces_Context'Class) return ASF.Models.Selects.Select_Item_List is use Util.Beans.Objects; Value : constant Object := From.Get_Attribute (Name => VALUE_NAME, Context => Context); begin return ASF.Models.Selects.To_Select_Item_List (Value); end Get_Select_Item_List; -- ------------------------------ -- SelectOne Component -- ------------------------------ -- ------------------------------ -- Render the <b>select</b> element. -- ------------------------------ overriding procedure Encode_Begin (UI : in UISelectOne; Context : in out Faces_Context'Class) is begin if UI.Is_Rendered (Context) then UISelectOne'Class (UI).Render_Select (Context); end if; end Encode_Begin; -- ------------------------------ -- Renders the <b>select</b> element. This is called by <b>Encode_Begin</b> if -- the component is rendered. -- ------------------------------ procedure Render_Select (UI : in UISelectOne; Context : in out Faces_Context'Class) is Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Value : constant EL.Objects.Object := UISelectOne'Class (UI).Get_Value; begin Writer.Start_Element ("select"); Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id); UI.Render_Attributes (Context, SELECT_ATTRIBUTE_NAMES, Writer); UISelectOne'Class (UI).Render_Options (Value, Context); Writer.End_Element ("select"); end Render_Select; -- ------------------------------ -- Renders the <b>option</b> element. This is called by <b>Render_Select</b> to -- generate the component options. -- ------------------------------ procedure Render_Options (UI : in UISelectOne; Value : in Util.Beans.Objects.Object; Context : in out Faces_Context'Class) is Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Selected : constant Wide_Wide_String := Util.Beans.Objects.To_Wide_Wide_String (Value); Iter : Cursor; begin UI.First (Context, Iter); while Has_Element (Iter) loop declare Item : constant ASF.Models.Selects.Select_Item := Element (Iter, Context); Item_Value : constant Wide_Wide_String := Item.Get_Value; begin Writer.Start_Element ("option"); Writer.Write_Wide_Attribute ("value", Item_Value); if Item_Value = Selected then Writer.Write_Attribute ("selected", "selected"); end if; if Item.Is_Escaped then Writer.Write_Wide_Text (Item.Get_Label); else Writer.Write_Wide_Text (Item.Get_Label); end if; Writer.End_Element ("option"); Next (Iter, Context); end; end loop; end Render_Options; -- ------------------------------ -- Returns True if the radio options must be rendered vertically. -- ------------------------------ function Is_Vertical (UI : in UISelectOneRadio; Context : in Faces_Context'Class) return Boolean is Dir : constant String := UI.Get_Attribute (Context => Context, Name => "layout", Default => ""); begin return Dir = "pageDirection"; end Is_Vertical; -- ------------------------------ -- Renders the <b>select</b> element. This is called by <b>Encode_Begin</b> if -- the component is rendered. -- ------------------------------ overriding procedure Render_Select (UI : in UISelectOneRadio; Context : in out Faces_Context'Class) is Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Value : constant EL.Objects.Object := UISelectOne'Class (UI).Get_Value; Vertical : constant Boolean := UI.Is_Vertical (Context); Selected : constant Wide_Wide_String := Util.Beans.Objects.To_Wide_Wide_String (Value); Iter : Cursor; Id : constant String := To_String (UI.Get_Client_Id); N : Natural := 0; Disabled_Class : constant EL.Objects.Object := UI.Get_Attribute (Context => Context, Name => "disabledClass"); Enabled_Class : constant EL.Objects.Object := UI.Get_Attribute (Context => Context, Name => "enabledClass"); begin Writer.Start_Element ("table"); UI.Render_Attributes (Context, Writer); if not Vertical then Writer.Start_Element ("tr"); end if; UI.First (Context, Iter); while Has_Element (Iter) loop declare Item : constant ASF.Models.Selects.Select_Item := Element (Iter, Context); Item_Value : constant Wide_Wide_String := Item.Get_Value; begin if Vertical then Writer.Start_Element ("tr"); end if; Writer.Start_Element ("td"); -- Render the input radio checkbox. Writer.Start_Element ("input"); Writer.Write_Attribute ("type", "radio"); Writer.Write_Attribute ("name", Id); if Item.Is_Disabled then Writer.Write_Attribute ("disabled", "disabled"); end if; Writer.Write_Attribute ("id", Id & "_" & Util.Strings.Image (N)); Writer.Write_Wide_Attribute ("value", Item_Value); if Item_Value = Selected then Writer.Write_Attribute ("checked", "checked"); end if; Writer.End_Element ("input"); -- Render the label associated with the checkbox. Writer.Start_Element ("label"); if Item.Is_Disabled then if not Util.Beans.Objects.Is_Null (Disabled_Class) then Writer.Write_Attribute ("class", Disabled_Class); end if; else if not Util.Beans.Objects.Is_Null (Enabled_Class) then Writer.Write_Attribute ("class", Enabled_Class); end if; end if; Writer.Write_Attribute ("for", Id & "_" & Util.Strings.Image (N)); if Item.Is_Escaped then Writer.Write_Wide_Text (Item.Get_Label); else Writer.Write_Wide_Text (Item.Get_Label); end if; Writer.End_Element ("label"); Writer.End_Element ("td"); if Vertical then Writer.End_Element ("tr"); end if; Next (Iter, Context); N := N + 1; end; end loop; if not Vertical then Writer.End_Element ("tr"); end if; Writer.End_Element ("table"); end Render_Select; begin ASF.Utils.Set_Text_Attributes (SELECT_ATTRIBUTE_NAMES); ASF.Utils.Set_Interactive_Attributes (SELECT_ATTRIBUTE_NAMES); end ASF.Components.Html.Selects;
programs/oeis/173/A173740.asm
neoneye/loda
22
13512
; A173740: Triangle T(n,k) = binomial(n,k) + 2 for 1 <= k <= n - 1, n >= 2, and T(n,0) = T(n,n) = 1 for n >= 0, read by rows. ; 1,1,1,1,4,1,1,5,5,1,1,6,8,6,1,1,7,12,12,7,1,1,8,17,22,17,8,1,1,9,23,37,37,23,9,1,1,10,30,58,72,58,30,10,1,1,11,38,86,128,128,86,38,11,1,1,12,47,122,212,254,212,122,47,12,1,1,13,57,167,332,464,464,332,167,57,13,1,1,14,68,222,497,794,926,794,497,222,68,14,1,1,15,80,288,717,1289,1718,1718,1289 seq $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n. add $1,$0 add $1,1 lpb $1 div $1,3 mul $1,34 lpe add $1,1 mov $0,$1
vendor/stdlib/src/Relation/Binary/FunctionSetoid.agda
isabella232/Lemmachine
56
17079
------------------------------------------------------------------------ -- Function setoids and related constructions ------------------------------------------------------------------------ module Relation.Binary.FunctionSetoid where open import Data.Function open import Relation.Binary infixr 0 _↝_ _⟶_ _⇨_ _≡⇨_ -- A logical relation (i.e. a relation which relates functions which -- map related things to related things). _↝_ : ∀ {A B} → (∼₁ : Rel A) (∼₂ : Rel B) → Rel (A → B) _∼₁_ ↝ _∼₂_ = λ f g → ∀ {x y} → x ∼₁ y → f x ∼₂ g y -- Functions which preserve equality. record _⟶_ (From To : Setoid) : Set where open Setoid infixl 5 _⟨$⟩_ field _⟨$⟩_ : carrier From → carrier To pres : _⟨$⟩_ Preserves _≈_ From ⟶ _≈_ To open _⟶_ public ↝-isEquivalence : ∀ {A B C} {∼₁ : Rel A} {∼₂ : Rel B} (fun : C → (A → B)) → (∀ f → fun f Preserves ∼₁ ⟶ ∼₂) → IsEquivalence ∼₁ → IsEquivalence ∼₂ → IsEquivalence ((∼₁ ↝ ∼₂) on₁ fun) ↝-isEquivalence _ pres eq₁ eq₂ = record { refl = λ {f} x∼₁y → pres f x∼₁y ; sym = λ f∼g x∼y → sym eq₂ (f∼g (sym eq₁ x∼y)) ; trans = λ f∼g g∼h x∼y → trans eq₂ (f∼g (refl eq₁)) (g∼h x∼y) } where open IsEquivalence -- Function setoids. _⇨_ : Setoid → Setoid → Setoid S₁ ⇨ S₂ = record { carrier = S₁ ⟶ S₂ ; _≈_ = (_≈_ S₁ ↝ _≈_ S₂) on₁ _⟨$⟩_ ; isEquivalence = ↝-isEquivalence _⟨$⟩_ pres (isEquivalence S₁) (isEquivalence S₂) } where open Setoid; open _⟶_ -- A generalised variant of (_↝_ _≡_). ≡↝ : ∀ {A} {B : A → Set} → (∀ x → Rel (B x)) → Rel ((x : A) → B x) ≡↝ R = λ f g → ∀ x → R x (f x) (g x) ≡↝-isEquivalence : {A : Set} {B : A → Set} {R : ∀ x → Rel (B x)} → (∀ x → IsEquivalence (R x)) → IsEquivalence (≡↝ R) ≡↝-isEquivalence eq = record { refl = λ _ → refl ; sym = λ f∼g x → sym (f∼g x) ; trans = λ f∼g g∼h x → trans (f∼g x) (g∼h x) } where open module Eq {x} = IsEquivalence (eq x) _≡⇨_ : (A : Set) → (A → Setoid) → Setoid A ≡⇨ S = record { carrier = (x : A) → carrier (S x) ; _≈_ = ≡↝ (λ x → _≈_ (S x)) ; isEquivalence = ≡↝-isEquivalence (λ x → isEquivalence (S x)) } where open Setoid
programs/oeis/061/A061171.asm
jmorken/loda
1
25060
; A061171: One half of second column of Lucas bisection triangle (odd part). ; 3,19,79,283,940,2982,9171,27581,81557,237995,687158,1966764,5588259,15780103,44323195,123920827,345062176,957403026,2647935987,7302634865,20087869313,55128445259,150971982314,412643577048,1125852459075,3066738855547,8340945563431,22654017146971,61448282358292,166474440058110,450498691725843,1217808986718629,3288766669317869,8873218872299243 add $0,1 mov $2,$0 mov $3,$0 mul $0,2 lpb $3 add $0,$2 add $1,$0 add $2,$0 sub $2,1 sub $3,1 lpe
P6/data_P6_2/MDTest93.asm
alxzzhou/BUAA_CO_2020
1
13741
ori $ra,$ra,0xf multu $1,$0 mult $4,$2 sb $4,16($0) mfhi $5 multu $4,$4 lui $4,6925 divu $5,$ra sll $5,$0,31 ori $1,$5,58644 mthi $3 lui $2,357 divu $1,$ra lui $1,62996 sll $5,$5,8 mthi $2 mult $5,$6 srav $6,$4,$5 mtlo $1 div $5,$ra mtlo $1 addu $6,$1,$1 lui $4,8132 sb $5,7($0) mflo $1 lui $2,4675 ori $5,$4,48462 lui $4,43527 sb $1,10($0) div $4,$ra mflo $1 ori $3,$3,29233 lui $2,33437 sb $5,13($0) lui $6,43458 sb $3,15($0) multu $4,$2 multu $3,$4 div $1,$ra ori $5,$4,26608 mthi $0 mflo $5 multu $4,$2 divu $2,$ra srav $6,$0,$2 lui $4,45764 multu $1,$2 mthi $5 sb $1,7($0) sb $4,0($0) sll $3,$6,12 srav $5,$5,$2 mflo $1 lb $0,16($0) mflo $5 divu $5,$ra ori $5,$4,16307 sll $4,$4,29 addu $4,$4,$1 mthi $0 addiu $4,$2,10129 lb $0,0($0) mfhi $4 divu $3,$ra mult $4,$2 addu $1,$6,$6 div $4,$ra srav $4,$4,$3 srav $6,$4,$6 addu $4,$4,$5 ori $6,$2,14636 mult $0,$1 srav $1,$1,$1 multu $4,$2 addiu $4,$5,1646 sll $4,$2,26 ori $2,$1,16018 sll $5,$4,8 sb $5,2($0) lui $3,51269 sll $3,$2,12 addiu $5,$5,28076 multu $6,$2 sll $1,$1,3 lb $1,12($0) mflo $1 divu $5,$ra divu $4,$ra mfhi $0 mult $4,$0 addiu $5,$6,-25048 addu $5,$5,$1 lui $4,43210 mthi $6 addu $2,$2,$6 mthi $4 addu $5,$6,$3 mult $5,$0 srav $0,$4,$4 srav $1,$5,$3 div $1,$ra mfhi $5 mfhi $2 divu $5,$ra ori $2,$2,3779 multu $1,$2 sb $3,12($0) mflo $1 mult $2,$5 mthi $1 ori $4,$0,38107 sb $4,11($0) mflo $5 lui $3,40914 mflo $4 multu $3,$3 lb $4,14($0) mfhi $4 sll $2,$5,31 divu $0,$ra mflo $1 lb $0,12($0) lb $4,8($0) sb $1,7($0) sll $1,$1,26 mtlo $1 addiu $4,$1,27180 sll $1,$0,10 lui $1,15944 srav $5,$5,$5 mfhi $1 mthi $5 mult $4,$4 srav $5,$5,$5 mflo $1 mult $0,$2 addu $6,$1,$6 sb $4,6($0) srav $4,$1,$3 lb $4,12($0) addiu $5,$1,17728 divu $6,$ra multu $5,$2 sll $4,$2,23 multu $1,$1 lui $1,45524 mtlo $4 ori $4,$2,25718 mult $4,$2 addu $2,$2,$3 div $1,$ra srav $4,$2,$5 addiu $4,$4,-10301 ori $4,$2,30710 divu $1,$ra mult $1,$1 addu $2,$2,$2 sb $1,12($0) mthi $4 sll $4,$6,22 div $5,$ra mthi $4 addiu $6,$2,19153 divu $4,$ra multu $4,$2 sb $2,16($0) addu $6,$5,$2 mult $0,$1 lb $5,2($0) mflo $1 mult $6,$4 sb $2,5($0) div $5,$ra lb $5,15($0) mflo $4 addiu $6,$2,-23624 addu $1,$2,$2 mfhi $3 div $6,$ra sb $3,11($0) lui $1,29397 mtlo $4 mfhi $3 multu $5,$4 addu $4,$4,$3 ori $5,$5,13324 div $5,$ra lui $3,13808 addiu $4,$5,3722 multu $4,$6 ori $4,$1,26279 mfhi $4 divu $5,$ra mflo $5 mfhi $0 mfhi $6 div $6,$ra mtlo $1 sb $6,16($0) sll $1,$2,19 lui $4,44417 ori $1,$3,46429 mult $0,$0 mflo $4 mtlo $2 lui $5,43252 ori $6,$6,39566 ori $1,$1,16715 mthi $1 ori $1,$5,32397 mtlo $0 mfhi $3 lb $0,15($0) ori $3,$4,40894 srav $4,$5,$5 addiu $2,$2,10594 sb $5,7($0) mthi $5 mflo $5 divu $5,$ra div $1,$ra mtlo $0 mtlo $4 multu $5,$1 div $6,$ra mtlo $4 mult $5,$0 div $4,$ra mult $0,$5 addiu $4,$4,27759 divu $6,$ra mfhi $5 mflo $4 sb $5,3($0) divu $4,$ra mult $4,$5 mthi $2 srav $0,$0,$5 lui $2,24701 divu $6,$ra mult $5,$1 lui $4,63009 mthi $2 lb $4,7($0) ori $5,$5,3029 addu $6,$3,$3 div $1,$ra srav $4,$5,$3 ori $6,$5,65279 mfhi $4 sll $3,$2,0 srav $6,$5,$2 mult $6,$6 ori $1,$4,27037 ori $0,$4,8306 sll $5,$6,1 mflo $3 sb $4,2($0) sb $4,15($0) mult $4,$2 mtlo $4 addu $1,$1,$3 lui $1,39433 sll $1,$2,15 addu $4,$2,$4 multu $6,$6 lb $3,5($0) sb $4,6($0) srav $4,$1,$4 srav $4,$5,$2 ori $0,$0,35840 addu $4,$4,$4 lui $5,7891 lui $4,556 divu $4,$ra multu $0,$4 sb $3,16($0) mfhi $1 addu $4,$4,$0 srav $3,$5,$3 srav $1,$2,$2 sll $5,$5,20 divu $5,$ra ori $4,$0,1311 addiu $5,$3,-16177 lb $6,9($0) addu $4,$4,$4 srav $5,$1,$1 srav $4,$4,$4 ori $2,$2,15829 mthi $4 multu $0,$1 sll $4,$4,28 lui $1,1589 sb $2,1($0) mult $3,$3 mflo $4 mflo $1 div $5,$ra ori $5,$1,32403 mthi $2 div $6,$ra addu $5,$6,$1 ori $5,$5,58766 addu $5,$4,$5 mtlo $5 srav $4,$2,$4 divu $4,$ra mfhi $5 multu $1,$2 ori $4,$6,25343 lb $4,13($0) ori $4,$4,51016 addu $5,$5,$5 addiu $2,$2,27473 div $3,$ra mfhi $0 srav $4,$2,$2 addiu $1,$1,-1218 divu $5,$ra mthi $4 ori $1,$1,35736 divu $0,$ra divu $1,$ra mthi $2 div $4,$ra mthi $0 multu $4,$6 multu $4,$6 divu $0,$ra sb $4,13($0) mtlo $4 sll $1,$1,10 div $4,$ra div $4,$ra addu $4,$4,$4 srav $0,$1,$4 divu $1,$ra sll $1,$2,24 sll $5,$1,0 sb $6,2($0) multu $4,$4 mflo $1 ori $4,$2,3826 sb $0,15($0) mult $5,$1 multu $1,$6 div $4,$ra mult $4,$4 mflo $6 lb $4,15($0) divu $6,$ra srav $3,$0,$3 srav $3,$3,$3 divu $5,$ra mtlo $5 addiu $5,$0,-28343 sll $4,$2,5 mult $3,$3 mult $1,$1 divu $2,$ra addu $1,$1,$1 srav $4,$5,$5 mthi $4 mtlo $0 divu $1,$ra mfhi $0 div $6,$ra sb $3,16($0) divu $0,$ra mult $4,$5 lb $6,14($0) divu $5,$ra lui $0,33921 divu $4,$ra srav $5,$5,$5 sll $4,$4,2 mthi $1 srav $5,$5,$5 sll $0,$6,14 mfhi $4 mthi $5 lui $4,9290 ori $4,$4,27828 sll $4,$4,28 sb $1,1($0) mflo $1 sll $5,$2,21 ori $1,$2,10914 addu $4,$1,$1 mtlo $0 divu $2,$ra mtlo $5 addu $4,$2,$4 lb $4,8($0) mthi $4 sb $1,6($0) mfhi $2 lb $1,8($0) divu $5,$ra mtlo $4 lb $5,10($0) ori $1,$4,508 divu $4,$ra lb $4,10($0) sll $5,$1,30 mfhi $4 mtlo $5 mult $4,$3 srav $4,$2,$3 sll $6,$6,11 srav $4,$1,$3 mflo $2 sll $4,$4,7 addu $0,$4,$0 mthi $5 lb $5,3($0) mthi $1 addiu $6,$4,-19744 mthi $4 lb $6,8($0) mthi $5 sll $5,$5,4 mult $6,$6 divu $2,$ra srav $4,$4,$4 div $5,$ra addiu $1,$2,25347 mfhi $6 ori $5,$4,33486 srav $0,$4,$4 multu $6,$2 lui $0,16335 multu $4,$5 lui $1,61747 lb $1,3($0) mult $3,$3 lb $5,12($0) addiu $3,$2,-2267 lb $0,1($0) addiu $4,$2,10209 divu $6,$ra mtlo $4 mflo $2 addiu $1,$6,-30791 divu $2,$ra mfhi $4 ori $4,$6,63869 mfhi $1 ori $5,$5,3778 ori $5,$1,5193 div $1,$ra mult $6,$6 divu $5,$ra ori $2,$2,16254 mflo $1 divu $4,$ra addiu $4,$4,-19028 mfhi $0 multu $1,$1 sll $4,$4,3 lb $4,0($0) multu $1,$6 lb $1,10($0) div $5,$ra mtlo $4 sb $2,13($0) lb $1,10($0) mflo $4 mflo $6 addiu $6,$4,3761 sb $5,8($0) sb $5,13($0) sll $2,$0,29 sb $1,7($0) mfhi $6 addiu $4,$2,-30457 div $4,$ra addu $4,$1,$1 sb $4,6($0) mult $4,$5 addu $4,$4,$5 div $4,$ra mtlo $5 mtlo $4 mflo $3 multu $4,$4 srav $3,$2,$3 multu $1,$1 mthi $4 ori $6,$4,53769 mtlo $4 sb $6,14($0) div $5,$ra divu $4,$ra sll $4,$4,3 sb $4,11($0) mfhi $4 addu $5,$5,$5 ori $6,$2,17614 sb $4,16($0) mtlo $5 mfhi $4 mult $1,$1 mult $2,$2 ori $2,$1,50740 mflo $5 multu $4,$5 mthi $5 divu $3,$ra mthi $1 addiu $4,$5,-22613 mtlo $4 sll $5,$2,3 multu $1,$1 mthi $2 mfhi $4 multu $0,$4 ori $1,$2,52165 mfhi $1 lb $3,9($0) div $1,$ra div $5,$ra addu $1,$3,$3 sb $1,4($0) mflo $4 ori $1,$1,52129 mfhi $3 mfhi $4 sll $4,$1,21 multu $4,$2 addiu $5,$5,18704 sll $6,$0,17 lui $4,29498 mtlo $1 mfhi $4 lb $1,1($0) addu $2,$5,$2 addu $2,$2,$4 mult $4,$4 mfhi $4 mthi $3 srav $5,$2,$3 addu $5,$5,$5 divu $4,$ra mthi $6 div $5,$ra ori $1,$1,29856 mult $5,$5 addu $5,$1,$2 mflo $5 mflo $5 mfhi $4 srav $1,$4,$4 sll $6,$6,15 addu $2,$2,$5 srav $0,$2,$2 mthi $0 srav $4,$6,$6 div $1,$ra mtlo $6 multu $5,$1 mthi $5 srav $4,$0,$0 div $1,$ra multu $4,$2 div $4,$ra mflo $1 multu $2,$4 mult $1,$4 mtlo $5 sb $5,15($0) addu $1,$4,$4 divu $4,$ra addiu $5,$5,-27337 mfhi $4 lui $3,20360 srav $6,$2,$4 lb $1,5($0) sll $5,$5,14 addu $1,$1,$4 multu $4,$4 mtlo $4 lui $4,46923 mfhi $6 mflo $0 mult $0,$0 addu $5,$6,$3 mflo $5 ori $2,$2,19727 mtlo $0 mtlo $4 mflo $3 addu $6,$1,$1 divu $5,$ra addiu $3,$2,-12314 sll $5,$2,12 mtlo $1 divu $2,$ra ori $4,$2,61392 sll $5,$1,18 addiu $2,$4,3156 addiu $3,$3,11738 multu $5,$5 divu $6,$ra srav $4,$6,$0 lb $1,13($0) div $0,$ra lb $5,9($0) mtlo $0 addu $3,$3,$3 multu $2,$5 mthi $1 mflo $5 sll $4,$4,14 mult $4,$2 mult $1,$0 multu $5,$4 divu $2,$ra lb $3,15($0) ori $2,$5,56862 sll $4,$4,30 sb $0,12($0) multu $4,$4 sll $5,$1,11 mflo $4 lb $4,12($0) srav $1,$2,$2 sll $5,$4,20 addiu $5,$5,19553 mfhi $4 addiu $5,$1,-2684 addu $2,$2,$2 addu $4,$2,$5 mult $4,$3 addu $4,$0,$3 div $2,$ra lb $5,2($0) div $4,$ra mfhi $3 divu $1,$ra div $5,$ra lb $5,14($0) lui $4,36731 addiu $5,$1,-27345 divu $4,$ra lb $1,11($0) div $3,$ra lui $2,7723 mthi $4 srav $1,$5,$2 sll $5,$2,16 mult $2,$2 lui $5,22130 ori $2,$2,18246 lui $5,39149 sb $4,2($0) sb $5,7($0) lb $4,6($0) lui $3,34440 addu $3,$3,$3 mflo $1 addiu $0,$0,31768 addiu $5,$5,-2966 lb $5,12($0) sll $5,$0,16 addiu $1,$2,17857 mthi $6 lui $5,20805 lb $4,2($0) lui $6,26118 sb $1,10($0) addu $0,$0,$2 divu $6,$ra addiu $4,$1,-30906 srav $4,$0,$4 sll $4,$1,21 ori $6,$1,13367 mtlo $4 mthi $0 multu $1,$1 srav $1,$1,$3 addiu $6,$1,20599 mult $4,$1 sb $0,15($0) mflo $4 mult $4,$6 divu $5,$ra addiu $4,$2,-8029 sb $3,8($0) lui $4,40479 multu $5,$2 lb $3,11($0) mult $2,$2 mult $1,$4 mtlo $4 addu $5,$5,$5 addiu $5,$4,27160 ori $5,$5,57475 multu $0,$0 divu $0,$ra mthi $1 mflo $1 divu $0,$ra ori $3,$3,38586 srav $0,$0,$1 ori $5,$4,31157 srav $4,$4,$3 multu $2,$2 ori $2,$2,8777 lui $4,11853 addu $5,$4,$4 mtlo $3 mult $0,$0 mult $5,$2 mult $4,$4 sll $1,$6,2 mflo $4 ori $1,$6,9823 mtlo $3 sb $0,2($0) divu $0,$ra ori $2,$6,21483 addiu $0,$5,8477 lui $4,64024 addu $0,$4,$0 lb $4,16($0) div $6,$ra divu $0,$ra mfhi $1 mult $4,$1 multu $1,$4 multu $0,$4 mthi $5 lb $1,8($0) mtlo $4 mfhi $4 mult $1,$1 sb $0,12($0) mtlo $4 lui $3,59912 srav $3,$4,$3 sll $4,$2,9 mfhi $4 ori $3,$0,58574 mtlo $1 mfhi $3 mflo $1 div $5,$ra lui $5,7111 sb $1,15($0) mfhi $5 mtlo $3 mflo $5 sll $1,$2,28 sb $5,7($0) addu $1,$2,$2 mult $5,$5 ori $3,$4,2159 addu $1,$1,$1 sll $5,$3,25 mthi $1 mflo $6 lui $2,17490 mthi $4 addu $6,$0,$0 mtlo $4 div $5,$ra mfhi $1 div $6,$ra ori $5,$1,42067 sb $4,14($0) lb $4,7($0) addiu $4,$4,-3744 addu $2,$2,$2 multu $6,$6 mtlo $5 lui $1,32862 div $4,$ra mfhi $5 lb $4,4($0) lb $6,9($0) addiu $4,$6,9342 mthi $6 lb $1,13($0) lui $3,33479 mult $4,$4 divu $2,$ra mflo $6 divu $1,$ra ori $5,$0,36867 sll $0,$2,10 mflo $5 sb $5,9($0) lb $3,13($0) addu $4,$2,$4 mult $5,$5 mthi $1 addiu $4,$4,-10783 mflo $5 divu $5,$ra ori $1,$1,14463 lb $5,1($0) ori $6,$5,22578 lui $5,31772 lui $1,22003 ori $2,$2,50838 sb $6,16($0) sb $4,16($0) srav $1,$4,$1 mflo $2 multu $6,$1 addiu $2,$2,-8513 lb $4,6($0) sll $1,$4,29 mflo $6 div $2,$ra mtlo $4 div $4,$ra ori $2,$2,39884 sb $1,14($0) addu $4,$4,$4 mult $3,$2 addu $4,$4,$2 mult $4,$2 mflo $4 addu $1,$2,$2 sb $1,12($0) multu $5,$2 divu $5,$ra srav $0,$4,$4 ori $1,$1,49093 lb $2,15($0) addu $1,$5,$5 srav $5,$5,$1 lui $2,11567 sll $5,$2,29 srav $5,$1,$1 addiu $1,$4,1499 sb $5,9($0) ori $2,$2,49483 lui $5,13444 ori $5,$3,38512 mthi $0 mfhi $6 sll $2,$2,29 lb $1,1($0) mfhi $4 mthi $5 mtlo $5 mtlo $4 mfhi $4 div $5,$ra div $2,$ra srav $4,$2,$4 mtlo $4 sb $3,6($0) addu $4,$1,$4 addiu $5,$5,5452 mflo $3 sll $6,$6,6 mflo $2 mtlo $3 mflo $6 divu $1,$ra multu $4,$6 sll $6,$4,25 lui $6,46899 addu $4,$4,$3 multu $4,$4 sb $1,14($0) mtlo $5 addu $1,$4,$4 divu $0,$ra mfhi $3 lui $1,1006 srav $3,$3,$3 mfhi $4 lui $3,33826 srav $3,$2,$3 divu $2,$ra lui $2,20923 lui $1,6415 ori $4,$4,32746 mthi $0 lb $2,7($0) addiu $2,$2,-16804 ori $4,$5,29032 mult $1,$1
Numeral/Natural/Function.agda
Lolirofle/stuff-in-agda
6
15851
module Numeral.Natural.Function where open import Numeral.Natural open import Numeral.Natural.Oper -- Maximum function -- Returns the greatest number max : ℕ → ℕ → ℕ max 𝟎 𝟎 = 𝟎 max (𝐒(a)) 𝟎 = 𝐒(a) max 𝟎 (𝐒(b)) = 𝐒(b) max (𝐒(a)) (𝐒(b)) = 𝐒(max a b) -- Minimum function -- Returns the smallest number min : ℕ → ℕ → ℕ min 𝟎 𝟎 = 𝟎 min (𝐒(_)) 𝟎 = 𝟎 min 𝟎 (𝐒(_)) = 𝟎 min (𝐒(a)) (𝐒(b)) = 𝐒(min a b) -- min a b = (a + b) −₀ max(a)(b) -- min and max as binary operators infixl 100 _[max]_ _[min]_ _[max]_ = max _[min]_ = min -- Fibonacci numbers fib : ℕ → ℕ fib(𝟎) = 𝟎 fib(𝐒(𝟎)) = 𝐒(𝟎) fib(𝐒(𝐒(n))) = fib(n) + fib(𝐒(n)) arithmetic-sequence : ℕ → ℕ → (ℕ → ℕ) arithmetic-sequence init diff 𝟎 = init arithmetic-sequence init diff (𝐒(n)) = diff + arithmetic-sequence init diff n geometric-sequence : ℕ → ℕ → (ℕ → ℕ) geometric-sequence init diff 𝟎 = init geometric-sequence init diff (𝐒(n)) = diff ⋅ arithmetic-sequence init diff n
oeis/171/A171631.asm
neoneye/loda-programs
11
1315
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A171631: Triangle read by rows: T(n,k) = n*(binomial(n-2, k-1) + n*binomial(n-2, k)), n > 0 and 0 <= k <= n - 1. ; Submitted by <NAME> ; 1,4,2,9,12,3,16,36,24,4,25,80,90,40,5,36,150,240,180,60,6,49,252,525,560,315,84,7,64,392,1008,1400,1120,504,112,8,81,576,1764,3024,3150,2016,756,144,9,100,810,2880,5880,7560,6300,3360,1080,180,10,121,1100 mov $2,1 lpb $0 add $1,1 sub $0,$1 add $2,1 lpe add $1,1 bin $1,$0 sub $2,$0 pow $2,2 mul $1,$2 mov $0,$1
programs/oeis/054/A054868.asm
karttu/loda
0
90396
; A054868: Sum of bits of sum of bits of n: a(n) = wt(wt(n)). ; 0,1,1,1,1,1,1,2,1,1,1,2,1,2,2,1,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,2,1,1,2,1,2,2,2,1,2,2,2,2,2,2,3,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,2,1,1,2,1,2,2,2,1,2,2,2,2,2,2,3,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,2,1,1,2,1,2,2,2,1,2,2,2,2,2,2,3,2,1,1,2,1,2,2,2,1,2,2,2,2,2,2,3,1,2,2,2,2,2,2,3,2,2 mov $1,1 mov $2,4 lpb $2,1 add $1,108 mov $2,$0 lpb $1,1 sub $1,8 div $2,2 sub $0,$2 lpe mov $2,$1 lpe mov $1,$0
oeis/127/A127918.asm
neoneye/loda-programs
11
2915
; A127918: Half of product of three numbers: n-th prime, previous and following number. ; Submitted by <NAME> ; 3,12,60,168,660,1092,2448,3420,6072,12180,14880,25308,34440,39732,51888,74412,102660,113460,150348,178920,194472,246480,285852,352440,456288,515100,546312,612468,647460,721392,1024128,1123980,1285608,1342740,1653900,1721400,1934868,2165292,2328648,2588772,2867580,2964780,3483840,3594432,3822588,3940200,4696860,5544672,5848428,6004380,6324552,6825840,6998640,7906500,8487168,9095592,9732420,9951120,10626828,11093880,11332452,12576732,14467068,15039960,15331992,15927348,18132180,19136208,20890788 seq $0,40 ; The prime numbers. mov $1,$0 pow $1,3 sub $1,$0 mov $0,$1 div $0,2
test/Succeed/Issue2668.agda
cruhland/agda
1,989
15785
-- 2017-11-01, issue #2668 reported by brprice -- -- This seems to have been fixed in 2.5.3 (specifically, commit -- 8518b8e seems to have solved this, along with #2727 and #2726) -- {-# OPTIONS -v tc.mod.apply:20 #-} -- {-# OPTIONS -v tc.proj.like:40 #-} -- {-# OPTIONS -v tc.signature:60 #-} -- {-# OPTIONS -v tc.with:60 #-} open import Agda.Builtin.Equality open import Agda.Builtin.Nat module _ (Q : Set) where -- parameter needed to trigger issue -- has to pattern match: `badRefl _ = refl` typechecks badRefl : (n : Nat) → n ≡ n badRefl zero = refl badRefl (suc n) = refl -- has to wrap: `Wrap = Nat` (and changing uses of wrap) typechecks data Wrap : Set where wrap : (n : Nat) → Wrap record Rec (A : Set) : Set where field recW : (m : Nat) → Wrap foo : A → Wrap → Wrap foo _ (wrap i) = recW i Thin : Rec Nat Thin = record { recW = wrap } module Th = Rec Thin test : ∀ (th : Nat)(t : Wrap) → Th.foo th t ≡ Th.foo th t -- If we don't go via Th, it typechecks -- → Rec.foo Thin th t ≡ Rec.foo Thin th t -- test = {!Rec.foo!} test th t with badRefl th ... | p = refl -- ERROR WAS: -- Expected a hidden argument, but found a visible argument -- when checking that the type -- (Q : Set) (th : Nat) → th ≡ th → (t : Wrap) → -- Rec.foo (record { recW = wrap }) th t ≡ -- Rec.foo (record { recW = wrap }) th t -- of the generated with function is well-formed -- Should succeed
entropy-cyclelog.applescript
rinchen/fesc
0
4445
on clicked theObject -- Read in the preferences set theLocation to POSIX path of (call method "defaultObjectForKey:" with parameter "entropy") try do shell script "cd " & theLocation & ";mv -f entropy.log entropy.old.log" display dialog "entropy.log successfully copied over to entropy.old.log" on error display dialog "Error: entropy.log not found." end try end clicked
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_1376.asm
ljhsiun2/medusa
9
11860
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %r8 push %rax push %rbp lea addresses_D_ht+0x1d411, %r11 nop add $31152, %r15 mov (%r11), %rbp nop nop nop nop nop add %r12, %r12 lea addresses_WC_ht+0x1b711, %r10 clflush (%r10) nop nop nop nop cmp $64213, %rax mov (%r10), %r8 nop nop nop sub $25006, %rax lea addresses_normal_ht+0x16f11, %r12 clflush (%r12) nop nop nop cmp $28395, %r8 mov $0x6162636465666768, %r15 movq %r15, (%r12) sub %r8, %r8 pop %rbp pop %rax pop %r8 pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %rbx push %rcx push %rdx // Store lea addresses_US+0x17971, %r8 nop nop nop nop add %r15, %r15 mov $0x5152535455565758, %rcx movq %rcx, %xmm4 movups %xmm4, (%r8) nop nop nop nop add %r8, %r8 // Store lea addresses_normal+0xbf15, %r12 nop nop xor $6619, %rdx mov $0x5152535455565758, %rbx movq %rbx, %xmm5 movups %xmm5, (%r12) nop nop nop nop sub %rcx, %rcx // Faulty Load mov $0x4b18d0000000711, %r15 nop nop nop nop sub %rcx, %rcx mov (%r15), %rbx lea oracles, %r12 and $0xff, %rbx shlq $12, %rbx mov (%r12,%rbx,1), %rbx pop %rdx pop %rcx pop %rbx pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
master-project/report/alloy/employee-supervisor-reviewer.als
abhabongse/relationalcalculus-alloy
1
2107
<reponame>abhabongse/relationalcalculus-alloy /* Scalar values */ sig Superparticle {} { Superparticle = Universe.Element } /* Domains */ abstract sig Universe { Element: some Superparticle } one sig UniverseAlpha, UniverseBeta extends Universe {} /* Common domain */ some sig Particle in Superparticle {} { Particle = UniverseAlpha.Element & UniverseBeta.Element } /* Database Instance */ one sig Table { Employee: Particle -> Particle, Supervisor: Particle -> Particle, Reviewer: Particle -> Particle -> Particle } /* Query functions */ fun query1[u: Universe]: Superparticle -> Superparticle { { x, y: u.Element | some b: u.Element | (x -> b in Table.Supervisor) and (y -> b in Table.Supervisor) and (some l: u.Element | (b -> l in Table.Employee) and ((x -> l in Table.Employee) or (y -> l in Table.Employee))) } } fun query2[u: Universe]: Superparticle -> Superparticle { { x, y: u.Element | some b, l: u.Element | (b -> l in Table.Employee) and ((x -> l in Table.Employee) and (x -> b in Table.Supervisor) or (y -> l in Table.Employee) and (y -> b in Table.Supervisor)) } } fun query3[u: Universe]: set Superparticle { { x: u.Element | not some b: u.Element | x -> b in Table.Supervisor } } fun query4[u: Universe]: Superparticle -> Superparticle { { x, y: u.Element | some t: u.Element | (x -> t -> y in Table.Reviewer) or (y -> t -> x in Table.Reviewer) } } fun query5[u: Universe]: set Superparticle { { b: u.Element | (all x: u.Element | some t: u.Element | x -> t -> b in Table.Reviewer) and (some y: u.Element | (y -> b in Table.Supervisor) and not (y = b)) } } /* Safety assertion */ assert queryIsSafe { all u, u': Universe | query5[u] = query5[u'] } /* Results placeholder */ abstract sig Result { OneColOutput: set Superparticle, TwoColOutput: Superparticle -> Superparticle } one sig ResultAlpha, ResultBeta extends Result {} { ResultAlpha.@OneColOutput = query5[UniverseAlpha] ResultBeta.@OneColOutput = query5[UniverseBeta] } /* Invoke the verification on the assertion */ check queryIsSafe for 10
src/g4-units/interface-error-recovery/Interface.g4
ZenUml/vue-sequence
1
2259
grammar Interface; participant : LT LT ID GT GT ID EOF; LT : '<' ; GT : '>' ; ID : [a-zA-Z_] [a-zA-Z_0-9]* ; SPACE : [ \t] -> channel(HIDDEN) ;
oeis/040/A040475.asm
neoneye/loda-programs
11
96561
; A040475: Continued fraction for sqrt(498). ; 22,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6,22,6,3,44,3,6 seq $0,10144 ; Continued fraction for sqrt(59). add $0,45 mul $0,16 div $0,5 sub $0,144
writer.asm
JacobLaney/x86-Assembly-Practice
0
18085
<reponame>JacobLaney/x86-Assembly-Practice ; <NAME> ; January 2016 ; ; NASM x86 for Mac OSX ; build: nasm -f macho64 writer.asm && ld writer.o -o writer ; run: ./writer ; ; Obective is to produce an assortment of procedures for printing data ; to stdout global start section .data ; SYSTEM CALL CODES %define exit 0x2000001 %define read 0x2000003 %define write 0x2000004 msg: db "Hello World!", 10, 0 .len: equ $ - msg section .text ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; start: default rel ; use relative addressing mov rsi, msg call WriteStr mov rax, exit mov rdi, 0 syscall ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WriteStr(char * message) ; input: ; rsi - address of 0 terminated string max 100 chars ; output: ; prints string to stdout WriteStr: push rax push rdx push rdi push rsi push rcx mov ecx, 100 ; max 100 rep mov rdx, 0 ; count length of string StrLenCountLoop: ; check for termination of string cmp byte [rsi], 0 pushf inc rsi ; move to next address in string inc rdx ; increment size of string popf loopne StrLenCountLoop pop rcx pop rsi mov rax, write mov rdi, 1 ; stdout syscall ; write the string Return: pop rdi pop rdx pop rax ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Numeral/Natural/Oper/DivMod/Proofs.agda
Lolirofle/stuff-in-agda
6
11729
<gh_stars>1-10 module Numeral.Natural.Oper.DivMod.Proofs where import Lvl open import Data open import Data.Boolean.Stmt open import Logic.Predicate open import Numeral.Finite open import Numeral.Natural open import Numeral.Natural.Oper open import Numeral.Natural.Oper.Comparisons open import Numeral.Natural.Oper.FlooredDivision open import Numeral.Natural.Oper.FlooredDivision.Proofs.DivisibilityWithRemainder open import Numeral.Natural.Oper.Modulo open import Numeral.Natural.Oper.Modulo.Proofs.DivisibilityWithRemainder open import Numeral.Natural.Oper.Proofs open import Numeral.Natural.Relation.DivisibilityWithRemainder open import Numeral.Natural.Relation.DivisibilityWithRemainder.Proofs open import Relator.Equals open import Relator.Equals.Proofs open import Structure.Operator open import Structure.Operator.Proofs.Util open import Structure.Operator.Properties open import Syntax.Transitivity -- The division theorem. [⌊/⌋][mod]-is-division-with-remainder : ∀{x y} → (((x ⌊/⌋ 𝐒(y)) ⋅ 𝐒(y)) + (x mod 𝐒(y)) ≡ x) [⌊/⌋][mod]-is-division-with-remainder {x}{y} with [∃]-intro r ⦃ p ⦄ ← [∣ᵣₑₘ]-existence-alt {x}{y} = ((x ⌊/⌋ 𝐒(y)) ⋅ 𝐒(y)) + (x mod 𝐒(y)) 🝖[ _≡_ ]-[ congruence₂(_+_) (congruence₂ₗ(_⋅_)(𝐒(y)) ([⌊/⌋][∣ᵣₑₘ]-quotient-equality {x}{y}{r}{p})) ([mod][∣ᵣₑₘ]-remainder-equality {x}{y}{r}{p}) ] (([∣ᵣₑₘ]-quotient p) ⋅ 𝐒(y)) + (𝕟-to-ℕ ([∣ᵣₑₘ]-remainder p)) 🝖[ _≡_ ]-[ [∣ᵣₑₘ]-is-division-with-remainder {x}{𝐒(y)}{r} p ] x 🝖-end [⌊/⌋][mod]-is-division-with-remainder-pred-commuted : ∀{x y} ⦃ _ : IsTrue(positive?(y)) ⦄ → ((y ⋅ (x ⌊/⌋ y)) + (x mod y) ≡ x) [⌊/⌋][mod]-is-division-with-remainder-pred-commuted {x} {𝐒 y} = [≡]-with(_+ (x mod 𝐒(y))) (commutativity(_⋅_) {𝐒(y)}{x ⌊/⌋ 𝐒(y)}) 🝖 [⌊/⌋][mod]-is-division-with-remainder {x}{y} -- Floored division and multiplication is not inverse operators for all numbers. -- This shows why it is not exactly. [⌊/⌋][⋅]-semiInverseOperatorᵣ : ∀{a b} → ((a ⌊/⌋ 𝐒(b)) ⋅ 𝐒(b) ≡ a −₀ (a mod 𝐒(b))) [⌊/⌋][⋅]-semiInverseOperatorᵣ {a}{b} = (a ⌊/⌋ 𝐒(b)) ⋅ 𝐒(b) 🝖[ _≡_ ]-[ OneTypeTwoOp.moveᵣ-to-invOp {b = a mod 𝐒(b)}{c = a} (([⌊/⌋][mod]-is-division-with-remainder {y = b})) ] a −₀ (a mod 𝐒(b)) 🝖-end -- Floored division and multiplication is not inverse operators for all numbers. -- This theorem shows that modulo is the error term (difference between the actual value for it to be inverse and value of the operation). [⌊/⌋][⋅]-inverseOperatorᵣ-error : ∀{a b} → (a mod 𝐒(b) ≡ a −₀ (a ⌊/⌋ 𝐒(b) ⋅ 𝐒(b))) [⌊/⌋][⋅]-inverseOperatorᵣ-error {a}{b} = (a mod 𝐒(b)) 🝖[ _≡_ ]-[ OneTypeTwoOp.moveᵣ-to-invOp {a = a mod 𝐒(b)}{b = (a ⌊/⌋ 𝐒(b)) ⋅ 𝐒(b)}{c = a} (commutativity(_+_) {a mod 𝐒(b)}{(a ⌊/⌋ 𝐒(b)) ⋅ 𝐒(b)} 🝖 [⌊/⌋][mod]-is-division-with-remainder {y = b}) ] a −₀ (a ⌊/⌋ 𝐒(b) ⋅ 𝐒(b)) 🝖-end
Transynther/x86/_processed/P/_zr_/i7-7700_9_0xca_notsx.log_1_495.asm
ljhsiun2/medusa
9
91563
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xb051, %r12 and $4351, %rdi movb $0x61, (%r12) nop nop nop and $60263, %rbx lea addresses_WC_ht+0x93a6, %rsi lea addresses_A_ht+0x6c02, %rdi clflush (%rsi) cmp %r9, %r9 mov $54, %rcx rep movsw nop nop nop nop nop add %rbx, %rbx lea addresses_WT_ht+0xbfa6, %rsi lea addresses_WC_ht+0xe671, %rdi nop nop cmp %rbx, %rbx mov $108, %rcx rep movsl nop cmp $53387, %r10 lea addresses_D_ht+0x86de, %rcx nop cmp $5511, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm2 movups %xmm2, (%rcx) nop nop add $32465, %rdi lea addresses_WC_ht+0x139a6, %rcx nop nop nop nop nop sub $59166, %rsi movb (%rcx), %r10b nop nop nop nop nop add %rdi, %rdi lea addresses_UC_ht+0x125a6, %rdi sub %rbx, %rbx mov $0x6162636465666768, %rcx movq %rcx, (%rdi) cmp $64858, %rsi lea addresses_normal_ht+0x131a6, %rdi nop nop nop nop add %rbx, %rbx vmovups (%rdi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %r10 nop nop nop nop add %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r9 push %rax push %rbx push %rdi push %rdx // Store lea addresses_WC+0xac26, %r10 nop nop nop nop dec %rax movb $0x51, (%r10) nop cmp %r9, %r9 // Load lea addresses_D+0x100a6, %rbx clflush (%rbx) nop nop nop nop nop sub $3811, %r9 movb (%rbx), %dl nop nop nop nop nop cmp %r10, %r10 // Load lea addresses_WT+0x47a6, %rdi nop nop nop nop nop and %r11, %r11 mov (%rdi), %ax nop add %rdx, %rdx // Faulty Load mov $0xba6, %rbx nop nop nop nop nop xor $49192, %r10 movb (%rbx), %al lea oracles, %rbx and $0xff, %rax shlq $12, %rax mov (%rbx,%rax,1), %rax pop %rdx pop %rdi pop %rbx pop %rax pop %r9 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_P'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_P'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'00': 1} 00 */
programs/oeis/081/A081909.asm
jmorken/loda
1
88599
; A081909: a(n) = 3^n(n^2 - n + 18)/18. ; 1,3,10,36,135,513,1944,7290,26973,98415,354294,1259712,4428675,15411789,53144100,181752822,617003001,2080591515,6973568802,23245229340,77096677311,254535261273,836828256240,2740612539186,8943601988565,29090242257543,94331465184654,305023899399480,983702075563323,3164622956269605 mov $1,$0 bin $1,2 mov $2,$0 lpb $2 add $1,6 mul $1,3 sub $2,1 lpe div $1,9 add $1,1
binutils-2.21.1/gcc-4.5.1/gcc/config/h8300/crti.asm
cberner12/xv6
51
13104
/* Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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. 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/>. */ /* The code in sections .init and .fini is supposed to be a single regular function. The function in .init is called directly from start in crt0.asm. The function in .fini is atexit()ed in crt0.asm too. crti.asm contributes the prologue of a function to these sections, and crtn.asm comes up the epilogue. STARTFILE_SPEC should list crti.o before any other object files that might add code to .init or .fini sections, and ENDFILE_SPEC should list crtn.o after any such object files. */ #ifdef __H8300H__ #ifdef __NORMAL_MODE__ .h8300hn #else .h8300h #endif #endif #ifdef __H8300S__ #ifdef __NORMAL_MODE__ .h8300sn #else .h8300s #endif #endif #ifdef __H8300SX__ #ifdef __NORMAL_MODE__ .h8300sxn #else .h8300sx #endif #endif .section .init .global __init __init: .section .fini .global __fini __fini:
src/hyperion-rest-servers.ads
stcarrez/hyperion
0
25990
-- Hyperion API -- Hyperion Monitoring API The monitoring agent is first registered so that the server knows it as well as its security key. Each host are then registered by a monitoring agent. -- ------------ EDIT NOTE ------------ -- This file was generated with swagger-codegen. You can modify it to implement -- the server. After you modify this file, you should add the following line -- to the .swagger-codegen-ignore file: -- -- src/hyperion-rest-servers.ads -- -- Then, you can drop this edit note comment. -- ------------ EDIT NOTE ------------ with Swagger.Servers; with Hyperion.Rest.Models; with Hyperion.Rest.Skeletons; package Hyperion.Rest.Servers is use Hyperion.Rest.Models; type Server_Type is limited new Hyperion.Rest.Skeletons.Server_Type with null record; -- Register a monitoring agent -- Register a new monitoring agent in the system overriding procedure Register_Agent (Server : in out Server_Type; Name : in Swagger.UString; Ip : in Swagger.UString; Agent_Key : in Swagger.UString; Result : out Hyperion.Rest.Models.Agent_Type; Context : in out Swagger.Servers.Context_Type); -- Create a host -- Register a new host in the monitoring system overriding procedure Create_Host (Server : in out Server_Type; Name : in Swagger.UString; Ip : in Swagger.UString; Host_Key : in Swagger.UString; Agent_Key : in Swagger.UString; Agent_Id : in Integer; Result : out Hyperion.Rest.Models.Host_Type; Context : in out Swagger.Servers.Context_Type); -- Get information about the host -- Provide information about the host procedure Get_Host (Server : in out Server_Type; Host_Id : in Swagger.Long; Result : out Hyperion.Rest.Models.Host_Type; Context : in out Swagger.Servers.Context_Type); -- Get information about the host datasets -- The datasets describes and gives access to the monitored data. overriding procedure Get_Datasets (Server : in out Server_Type; Host_Id : in Swagger.Long; Result : out Hyperion.Rest.Models.Dataset_Type_Vectors.Vector; Context : in out Swagger.Servers.Context_Type); procedure Register (Server : in out Swagger.Servers.Application_Type'Class); end Hyperion.Rest.Servers;
programs/oeis/205/A205219.asm
jmorken/loda
1
84421
; A205219: Number of (n+1)X2 0..1 arrays with the number of equal 2X2 subblock diagonal pairs and equal antidiagonal pairs differing from each horizontal or vertical neighbor, and new values 0..1 introduced in row major order ; 8,20,52,132,340,868,2228,5700,14612,37412,95860,245508,628948,1610980,4126772,10570692,27077780,69360548,177671668,455113860,1165800532,2986255972,7649458100,19594481988,50192314388,128570242340,329339499892,843620469252,2160978468820,5535460345828,14179374221108,36321215604420,93038712488852,238323574906532,610478424861940,1563772724488068,4005686423935828 mov $1,4 mov $2,1 lpb $0 sub $0,1 add $2,6 mov $3,$1 mov $1,$2 add $1,3 mul $3,4 add $3,$2 mov $2,2 sub $3,8 add $2,$3 lpe sub $1,4 div $1,2 mul $1,4 add $1,8
gamess/source/ztime.asm
andremirt/v_cond
0
3855
* 8 MAY 1983 - MWS - REASSEMBLED * THIS ROUTINE TAKEN FROM THE PROGRAM SYSTEM ALIS * ORIGINALLY WRITTEN AT IOWA STATE UNIVERSITY COMPUTER CENTER * THIS ROUTINE LETS THE IBM VERSION OF GAMESS PERFORM * CPU AND REAL TIMING CHECKS. * ZTIME CSECT ENTRY TIME,ZTIME1,ZTIME2 EJECT * SUBROUTINE TIME(S) * THE ARGUMENT IS A REAL NUMBER WHICH WILL BE SET * TO THE NUMBER OF SECONDS ELAPSED SINCE MIDNIGHT. * TIME BC ALWAYS,12(15) LINKAGE CONVENTION DC X'08' DC CL7'TIME' STM 14,WORK,12(13) BAL WORK,A(15) USING *,13 SAVEMAC DC 18F'0' S ST 13,4(WORK) ST WORK,8(13) LR 13,WORK SPACE 3 * GET TIME IN BINARY (1/100 SEC UNITS) FORMAT L OUTADDR,0(1) GET ADDR OF ARG TIME BIN GET TIME ST 0,CONV+4 CONVERT BINARY TO FLT PT NO LD WORK,UNORMZRO AD WORK,CONV DD WORK,TIMRUNIT STE WORK,0(OUTADDR) BC ALWAYS,RETURN GO HOME EJECT * * SUBROUTINE ZTIME1(T,X,Y) * ONE, TWO, OR THREE ARGUMENTS MAY BE USED. * T IS FOR REAL (WALL CLOCK) TIME IN SECONDS. * X IS FOR TASK (CPU) TIME IN SECONDS. * Y IS FOR DEFINING USER TASK TIME INTERVALS. * Y IS SET TO ZERO WHEN THE USER INTERVAL EXPIRES. * NOTE: CALLING ZTIME1 TWICE WITH NO INTERVENING CALL TO ZTIME2 * RESULTS IN THE TASK TIMING INTERVAL BEING RESET. ZTIME1 BC ALWAYS,12(15) LINKAGE CONVENTIONS DC X'08' DC CL7'ZTIME1' STM 14,WORK,12(13) LA WORK,B LCR WORK,WORK AR WORK,15 ST 13,4(WORK) ST WORK,8(13) LR 13,WORK SPACE 3 * SUBTRACT TIMER VALUE FROM ARG AND RETURN L OUTADDR,0(1) GET ADDRESS OF USER'S SUBTOT- LTR OUTADDR,OUTADDR DO WE WANT TASK TIMING TOO BM CONT1 NO L WORK,4(1) LTR WORK,WORK IS THERE ANOTHER ARGUMENT BM XXX NO SDR WORK,WORK YES L GT,8(1) GET ADDRESS OF SET INTERVAL LE WORK,0(GT) GET SET INTERVAL LE GT,0(WORK) GET SUBTOTAL AER GT,WORK ADD SUBTOTAL STE GT,0(WORK) SAVE IT DD WORK,FIX CONVERT TO RIGHT UNITS AW WORK,UNORMZRO FIX IT STD WORK,SUBTOT ST GT,X STORE IT'S ADDRESS STIMER TASK,EXIT,TUINTVL=SET B CONT1 XXX STIMER TASK,TUINTVL=H24RS YES?. THEN SET TIMER LE WORK,0(WORK) GET USER'S SUBTOT MVC CONV+4(4),H24RS FLOAT SET INTERVAL LD GT,CONV MD GT,FIX CONVERT TO SECONDS AER WORK,GT ADD THEM TOGETHER AND STE WORK,0(WORK) SAVE CONT1 MVC SUBTOT+0(4),0(OUTADDR) MOVE IN USER'S SUBTOT TIME BIN GET TIME (INTEGER,UNITS=1/100 SEC) ST 0,CONV+4 CONVERT BINARY TIME TO FLOATING NUMBER LD WORK,UNORMZRO SD WORK,CONV SUBTRACT CURRENT TIMER VALUE DD WORK,TIMRUNIT CHANGE TIMER UNITS TO SECONDS AD WORK,SUBTOT ADD USER'S TIME STE WORK,0(OUTADDR) SUBTOTAL & RETURN VALUE IN USER'S BC ALWAYS,RETURN SUBTOTAL EJECT * * SUBROUTINE ZTIME2(T,X,Y) * ONE, TWO, OR THREE ARGUMENTS MAY BE USED. * T IS FOR REAL (WALL CLOCK) TIME IN SECONDS. * X IS FOR TASK (CPU) TIME IN SECONDS. * Y IS FOR DEFINING USER TASK TIME INTERVALS. * Y IS SET TO ZERO WHEN THE USER INTERVAL EXPIRES. * NOTE: ZTIME2 SHOULD NEVER BE CALLED TWICE IN SUCCESSION UNLESS * THE ORIGINAL VALUES FROM ZTIME1 ARE RESTORED. ZTIME2 BC ALWAYS,12(15) LINKAGE CONVENTIONS DC X'08' DC CL7'ZTIME2' STM 14,WORK,12(13) LA WORK,C LCR WORK,WORK AR WORK,15 ST 13,4(WORK) ST WORK,8(13) LR 13,WORK SPACE 3 * ADD TIMER VALUE TO ARG TO GET TIME SUBTOTAL L OUTADDR,0(1) GET ADDR OF USER'S TIME SUBTOTAL LTR OUTADDR,OUTADDR DO WE WANT TASK TIME BM CONT2 NO L WORK,4(1) YES, THEN GET ADDRESS * PUT TIME LEFT IN REGISTER 0 TTIMER ST 0,CONV+4 FLOAT IT AND NORMALIZE IT LD WORK,UNORMZRO AD WORK,CONV MD WORK,FIX CONVERT TO SECONDS LCDR WORK,WORK SUBTRACT TIME LEFT FROM USER'S SUBTOT AE WORK,0(WORK) STE WORK,0(WORK) STORE SHORT LTR WORK,WORK IF HAVE 3RD AGRUMENT, CANCEL LAST STIMER BM CONT2 TTIMER CANCEL CONT2 TIME BIN GET TIME OF DAY ST 0,CONV+4 LD WORK,UNORMZRO CONVERT BINARY TIME TO FLOATING NUMBER AD WORK,CONV ADD CURRENT TIMER VALUE DD WORK,TIMRUNIT CHANGE TIMER UNITS TO SECONDS MVC SUBTOT+0(4),0(OUTADDR) AD WORK,SUBTOT ADD USER'S SUBTOTAL MODUP BNL ANSWER ANSWER CONSIDERED GOOD IF IT IS POSITIVE. AD WORK,HRS24 ELSE, ADD 24 HOURS AND TEST IT AGAIN BC ALWAYS,MODUP ANSWER STE WORK,0(OUTADDR) PUT ANSWER IN USER'S SUBTOTAL BC ALWAYS,RETURN EJECT RETURN EQU * CONVENTIONAL RETURN L 13,4(13) LM 14,WORK,12(13) MVI 12(13),X'FF' BCR ALWAYS,14 SPACE 3 * EXIT ROUTINE DROP 13 DS 0D USING *,15 EXIT ST 2,X+4 L 2,X MVC 0(4,2),UNORMZRO+4 L 2,X+4 BR 14 X DS 2F DROP 15 SPACE 3 * CONSTANT DEFINITION DS 0D HRS24 DC D'86400.0' TIMRUNIT DC D'100.0' UNORMZRO DC X'4E00000000000000' CONV DC X'4E00000000000000' SUBTOT DC X'0000000000000000' FIX DC D'26.04E-6' H24RS DC X'7F',3X'FF' SPACE 3 * EQUIVALENCES ALWAYS EQU 15 GT EQU 2 OUTADDR EQU 3 WORK EQU 4 A EQU S-TIME B EQU ZTIME1-SAVEMAC C EQU ZTIME2-SAVEMAC SET EQU SUBTOT+4 END
base/ntos/ke/amd64/procstat.asm
szdyg/Wrk-Learning
0
242030
<reponame>szdyg/Wrk-Learning title "Processor State Save Restore" ;++ ; ; Copyright (c) Microsoft Corporation. All rights reserved. ; ; You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). ; If you do not agree to the terms, do not use the code. ; ; ; Module Name: ; ; procstat.asm ; ; Abstract: ; ; This module implements routines to save and restore processor control ; state. ; ;-- include ksamd64.inc altentry KiBugCheckReturn extern KeBugCheck2:proc extern KxContextToKframes:proc extern KiHardwareTrigger:dword extern RtlCaptureContext:proc subttl "BugCheck" ;++ ; ; VOID ; KeBugCheck ( ; __in ULONG BugCheckCode ; ) ; ; Routine Description: ; ; This routine calls extended bugcheck to crash the system in a controlled ; manner. ; ; Arguments: ; ; BugCheckCode (rcx) - BugCheck code. ; ; Return Value: ; ; None - function does not return. ; ;-- BcFrame struct P1Home dq ? ; parameter home addresses P2Home dq ? ; P3Home dq ? ; P4Home dq ? ; P5Home dq ? ; BcFrame ends NESTED_ENTRY KeBugCheck, _TEXT$00 alloc_stack (sizeof BcFrame) ; allocate stack frame END_PROLOGUE ALTERNATE_ENTRY KiBugCheckReturn call KeBugCheckEx ; bugcheck system - not return nop ; fill - do not remove NESTED_END KeBugCheck, _TEXT$00 subttl "BugCheck 3" ;++ ; ; VOID ; KeBugCheck3 ( ; __in ULONG BugCheckCode, ; __in ULONG_PTR P1, ; __in ULONG_PTR P2, ; __in ULONG_PTR P3 ; ) ; ; Routine Description: ; ; This routine calls extended bugcheck to crash the system in a controlled ; manner. ; ; This routine differs from KeBugCheckEx in that the fourth bugcheck ; parameter is not used and presumed zero. ; ; Arguments: ; ; BugCheckCode (rcx) - BugCheck code. ; ; P1, P2 and P3 - Bugcheck parameters ; ; Return Value: ; ; None - function does not return. ; ;-- BcFrame struct P1Home dq ? ; parameter home addresses P2Home dq ? ; P3Home dq ? ; P4Home dq ? ; P5Home dq ? ; BcFrame ends NESTED_ENTRY KiBugCheck3, _TEXT$00 alloc_stack (sizeof BcFrame) ; allocate stack frame END_PROLOGUE mov BcFrame.P5Home[rsp], 0 call KeBugCheckEx ; bugcheck system - not return nop ; fill - do not remove NESTED_END KiBugCheck3, _TEXT$00 subttl "BugCheck Extended" ;++ ; ; VOID ; KeBugCheckEx ( ; __in ULONG BugCheckCode, ; __in ULONG_PTR P1, ; __in ULONG_PTR P2, ; __in ULONG_PTR P3, ; __in ULONG_PTR P4 ; ) ; ; Routine Description: ; ; This routine restores the context and control state of the current ; processor and passes control to KeBugCheck2. ; ; Arguments: ; ; BugCheckCode (rcx) - BugCheck code. ; ; P1, P2, P3 and P4 - BugCheck parameters. ; ; Return Value: ; ; None - function does not return. ; ;-- BeFrame struct P1Home dq ? ; parameter home addresses P2Home dq ? ; P3Home dq ? ; P4Home dq ? ; P5Home dq ? ; P6Home dq ? ; Flags dq ? ; BeFrame ends NESTED_ENTRY KeBugCheckEx, _TEXT$00 mov P1Home[rsp], rcx ; save argument registers mov P2Home[rsp], rdx ; mov P3Home[rsp], r8 ; mov P4Home[rsp], r9 ; push_eflags ; save processor flags alloc_stack (sizeof BeFrame - 8) ; allocate stack frame END_PROLOGUE ; ; Capture Processor context and control state ; cli ; disable interrupts mov rcx, gs:[PcCurrentPrcb] ; get current PRCB address add rcx, PbProcessorState + PsContextFrame ; set context address call RtlCaptureContext ; capture processor context mov rcx, gs:[PcCurrentPrcb] ; get current PRCB address add rcx, PbProcessorState ; set address of processor state call KiSaveProcessorControlState; save processor control state ; ; Update register values in captured context to their state at the entry ; of BugCheck function. ; mov r10, gs:[PcCurrentPrcb] ; get current PRCB address add r10, PbProcessorState + PsContextFrame ; point to context frame mov rax, P1Home + (sizeof BeFrame)[rsp] ; get saved rcx mov CxRcx[r10], rax ; update rcx in context frame mov rax, BeFrame.Flags[rsp] ; get saved flags mov CxEFlags[r10], rax ; update rflag in context frame lea rax, KiBugCheckReturn + 5 ; get return address of KeBugCheck cmp rax, (sizeof BeFrame)[rsp] ; identify caller by return address jnz short KeBC10 ; if nz, caller is not KeBugCheck lea r8, (sizeof BeFrame) + (sizeof BcFrame) + 8[rsp] ; calculate rsp at entry of KeBugCheck lea r9, KeBugCheck ; get the entry point of KeBugCheck jmp short KeBC20 ; KeBC10: lea r8, (sizeof BeFrame)[rsp] ; calculate rsp at entry of KeBugCheckEx lea r9, KeBugCheckEx ; get the entry point of KeBugCheckEx KeBC20: mov CxRsp[r10], r8 ; update rsp in context frame mov CxRip[r10], r9 ; update rip in context frame ; ; Raise IRQL and enable interrupt as appropriate. ; CurrentIrql ; get current IRQL mov gs:[PcDebuggerSavedIRQL], al ; save current IRQL cmp al, DISPATCH_LEVEL ; check if IRQL is less than dispatch jge short KeBC30 ; if ge, don't bother to raise mov ecx, DISPATCH_LEVEL ; raise to DISPATCH_LEVEL SetIrql ; set IRQL KeBC30: mov rax, BeFrame.Flags[rsp] ; get saved flags and rax, EFLAGS_IF_MASK ; check previous interrupt state jz short KeBC40 ; if z, interrupt was disabled sti ; enable interrupt KeBC40: lock inc KiHardwareTrigger ; assert lock to avoid speculative read ; ; Pass control to KeBugCheck2 ; mov rcx, P1Home + (sizeof BeFrame)[rsp] ; get saved bugcheck code mov qword ptr BeFrame.P6Home[rsp], 0 ; set parameter 6 to NULL lea rax, KiBugCheckReturn + 5; get return address of KeBugCheck cmp rax, (sizeof BeFrame)[rsp] ; identify caller by return address jz short KeBC50 ; if z, caller is KeBugCheck mov rax, (5 * 8) + (sizeof BeFrame)[rsp] ; get parameter 5 mov BeFrame.P5Home[rsp], rax; set parameter 5 mov r9, P4Home + (sizeof BeFrame)[rsp] ; restore parameter 4 mov r8, P3Home + (sizeof BeFrame)[rsp] ; restore parameter 3 mov rdx, P2Home + (sizeof BeFrame)[rsp] ; restore parameter 2 call KeBugCheck2 ; bugcheck system - not return nop ; fill - do not remove ; KeBC50: mov qword ptr Beframe.P5Home[rsp], 0 ; set parameter 5 to 0 xor r9d, r9d ; set parameter 4 to 0 xor r8d, r8d ; set parameter 3 to 0 xor edx, edx ; set parameter 2 to 0 call KeBugCheck2 ; bugcheck system - not return nop ; fill - do not remove NESTED_END KeBugCheckEx, _TEXT$00 subttl "Context To Kernel Frame" ;++ ; ; VOID ; KeContextToKframes ( ; IN OUT PKTRAP_FRAME TrapFrame, ; IN OUT PKEXCEPTION_FRAME ExceptionFrame, ; IN PCONTEXT ContextRecord, ; IN ULONG ContextFlags, ; IN KPROCESSOR_MODE PreviousMode ; ) ; ; Routine Description: ; ; This function saves the current non-volatile XMM state, performs a ; context to kernel frames operation, then restores the non-volatile ; XMM state. ; ; Arguments: ; ; TrapFrame (rcx) - Supplies a pointer to a trap frame that receives the ; volatile context from the context record. ; ; ExceptionFrame (rdx) - Supplies a pointer to an exception frame that ; receives the nonvolatile context from the context record. ; ; ContextRecord (r8) - Supplies a pointer to a context frame that contains ; the context that is to be copied into the trap and exception frames. ; ; ContextFlags (r9) - Supplies the set of flags that specify which parts ; of the context frame are to be copied into the trap and exception ; frames. ; ; PreviousMode (32[rsp]) - Supplies the processor mode for which the ; exception and trap frames are being built. ; ; Return Value: ; ; None. ; ;-- KfFrame struct P1Home dq ? ; parameter home addresses P2Home dq ? ; P3Home dq ? ; P4Home dq ? ; P5Home dq ? ; OldIrql dd ? ; previous IRQL Fill1 dd ? ; fill SavedXmm6 db 16 dup (?) ; saved nonvolatile floating registers SavedXmm7 db 16 dup (?) ; SavedXmm8 db 16 dup (?) ; SavedXmm9 db 16 dup (?) ; SavedXmm10 db 16 dup (?) ; SavedXmm11 db 16 dup (?) ; SavedXmm12 db 16 dup (?) ; SavedXmm13 db 16 dup (?) ; SavedXmm14 db 16 dup (?) ; SavedXmm15 db 16 dup (?) ; Fill2 dq ? ; fill KfFrame ends NESTED_ENTRY KeContextToKframes, _TEXT$00 alloc_stack (sizeof KfFrame) ; allocate stack frame save_xmm128 xmm6, KfFrame.SavedXmm6 ; save nonvolatile floating registers save_xmm128 xmm7, KfFrame.SavedXmm7 ; save_xmm128 xmm8, KfFrame.SavedXmm8 ; save_xmm128 xmm9, KfFrame.SavedXmm9 ; save_xmm128 xmm10, KfFrame.SavedXmm10 ; save_xmm128 xmm11, KfFrame.SavedXmm11 ; save_xmm128 xmm12, KfFrame.SavedXmm12 ; save_xmm128 xmm13, KfFrame.SavedXmm13 ; save_xmm128 xmm14, KfFrame.SavedXmm14 ; save_xmm128 xmm15, KfFrame.SavedXmm15 ; END_PROLOGUE mov rax, cr8 ; get current IRQL mov KfFrame.OldIrql[rsp], eax ; save current IRQL cmp eax, APC_LEVEL ; check if above or equal to APC level jae short KfCS10 ; if ae, above or equal APC level mov eax, APC_LEVEL ; raise IRQL to APC level mov cr8, rax ; KfCS10: mov r10, (5 * 8) + (sizeof KfFrame)[rsp] ; get parameter 5 mov KfFrame.P5Home[rsp], r10 ; set parameter 5 mov rax, dr7 ; access debug register call KxContextToKframes ; perform a context to kernel frames test rax, rax ; test if legacy floating switched jz short KfCS20 ; if z, legacy floating not switched ; ; N.B. The following legacy restore also restores the nonvolatile floating ; registers xmm6-xmm15 with potentially incorrect values. Fortunately, ; these registers are restored to their proper value shortly thereafter. ; fxrstor [rax] ; restore legacy floating state KfCS20: cmp KfFrame.OldIrql[rsp], APC_LEVEL ; check if lower IRQL required jae short KfCS30 ; if ae, lower IRQL not necessary mov eax, KfFrame.OldIrql[rsp] ; lower IRQL to previous level mov cr8, rax ; KfCS30: movdqa xmm6, KfFrame.SavedXmm6[rsp] ; restore nonvolatile floating registers movdqa xmm7, KfFrame.SavedXmm7[rsp] ; movdqa xmm8, KfFrame.SavedXmm8[rsp] ; movdqa xmm9, KfFrame.SavedXmm9[rsp] ; movdqa xmm10, KfFrame.SavedXmm10[rsp] ; movdqa xmm11, KfFrame.SavedXmm11[rsp] ; movdqa xmm12, KfFrame.SavedXmm12[rsp] ; movdqa xmm13, KfFrame.SavedXmm13[rsp] ; movdqa xmm14, KfFrame.SavedXmm14[rsp] ; movdqa xmm15, KfFrame.SavedXmm15[rsp] ; add rsp, (sizeof KfFrame) ; deallocate stack frame ret ; return NESTED_END KeContextToKframes, _TEXT$00 subttl "Save Initial Processor Control State" ;++ ; ; KiSaveInitialProcessorControlState ( ; PKPROCESSOR_STATE ProcessorState ; ); ; ; Routine Description: ; ; This routine saves the initial control state of the current processor. ; ; N.B. The debug register state is not saved. ; ; Arguments: ; ; ProcessorState (rcx) - Supplies a pointer to a processor state structure. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KiSaveInitialProcessorControlState, _TEXT$00 mov rax, cr0 ; save processor control state mov PsCr0[rcx], rax ; mov rax, cr2 ; mov PsCr2[rcx], rax ; mov rax, cr3 ; mov PsCr3[rcx], rax ; mov rax, cr4 ; mov PsCr4[rcx], rax ; mov rax, cr8 ; mov PsCr8[rcx], rax ; sgdt fword ptr PsGdtr[rcx] ; save GDTR sidt fword ptr PsIdtr[rcx] ; save IDTR str word ptr PsTr[rcx] ; save TR sldt word ptr PsLdtr[rcx] ; save LDTR stmxcsr dword ptr PsMxCsr[rcx] ; save XMM control/status ret ; return LEAF_END KiSaveInitialProcessorControlState, _TEXT$00 subttl "Restore Processor Control State" ;++ ; ; KiRestoreProcessorControlState ( ; VOID ; ); ; ; Routine Description: ; ; This routine restores the control state of the current processor. ; ; Arguments: ; ; ProcessorState (rcx) - Supplies a pointer to a processor state structure. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KiRestoreProcessorControlState, _TEXT$00 mov rax, PsCr0[rcx] ; restore processor control registers mov cr0, rax ; mov rax, PsCr3[rcx] ; mov cr3, rax ; mov rax, PsCr4[rcx] ; mov cr4, rax ; mov rax, PsCr8[rcx] ; mov cr8, rax ; lgdt fword ptr PsGdtr[rcx] ; restore GDTR lidt fword ptr PsIdtr[rcx] ; restore IDTR ; ; Force the TSS descriptor into a non-busy state so no fault will occur when ; TR is loaded. ; movzx eax, word ptr PsTr[rcx] ; get TSS selector add rax, PsGdtr + 2[rcx] ; compute TSS GDT entry address and byte ptr 5[rax], NOT 2 ; clear busy bit ltr word ptr PsTr[rcx] ; restore TR xor eax, eax ; load a NULL selector into the ldt lldt ax ; ldmxcsr dword ptr PsMxCsr[rcx] ; restore XMM control/status ; ; Restore debug control state. ; xor edx, edx ; restore debug registers mov dr7, rdx ; mov rax, PsKernelDr0[rcx] ; mov rdx, PsKernelDr1[rcx] ; mov dr0, rax ; mov dr1, rdx ; mov rax, PsKernelDr2[rcx] ; mov rdx, PsKernelDr3[rcx] ; mov dr2, rax ; mov dr3, rdx ; mov rdx, PsKernelDr7[rcx] ; xor eax, eax ; mov dr6, rax ; mov dr7, rdx ; cmp byte ptr gs:[PcCpuVendor], CPU_AMD ; check if AMD processor jne short KiRC30 ; if ne, not authentic AMD processor ; ; The host processor is an authentic AMD processor. ; ; Check if branch tracing or last branch capture is enabled. ; test dx, DR7_TRACE_BRANCH ; test for trace branch enable jz short KiRC10 ; if z, trace branch not enabled or eax, MSR_DEBUG_CRL_BTF ; set trace branch enable KiRC10: test dx, DR7_LAST_BRANCH ; test for last branch enable jz short KiRC20 ; if z, last branch not enabled or eax, MSR_DEBUG_CTL_LBR ; set last branch enable KiRC20: test eax, eax ; test for extended debug enables jz short KiRC30 ; if z, no extended debug enables mov r8d, eax ; save extended debug enables mov ecx, MSR_DEGUG_CTL ; set debug control MSR number rdmsr ; set extended debug control and eax, not (MSR_DEBUG_CTL_LBR or MSR_DEBUG_CRL_BTF) ; or eax, r8d ; wrmsr ; KiRC30: ret ; return LEAF_END KiRestoreProcessorControlState, _TEXT$00 subttl "Save Processor Control State" ;++ ; ; KiSaveProcessorControlState ( ; PKPROCESSOR_STATE ProcessorState ; ); ; ; Routine Description: ; ; This routine saves the control state of the current processor. ; ; Arguments: ; ; ProcessorState (rcx) - Supplies a pointer to a processor state structure. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KiSaveProcessorControlState, _TEXT$00 mov rax, cr0 ; save processor control state mov PsCr0[rcx], rax ; mov rax, cr2 ; mov PsCr2[rcx], rax ; mov rax, cr3 ; mov PsCr3[rcx], rax ; mov rax, cr4 ; mov PsCr4[rcx], rax ; mov rax, cr8 ; mov PsCr8[rcx], rax ; sgdt fword ptr PsGdtr[rcx] ; save GDTR sidt fword ptr PsIdtr[rcx] ; save IDTR str word ptr PsTr[rcx] ; save TR sldt word ptr PsLdtr[rcx] ; save LDTR stmxcsr dword ptr PsMxCsr[rcx] ; save XMM control/status ; ; Save debug control state. ; mov rax, dr0 ; save debug registers mov rdx, dr1 ; mov PsKernelDr0[rcx], rax ; mov PsKernelDr1[rcx], rdx ; mov rax, dr2 ; mov rdx, dr3 ; mov PsKernelDr2[rcx], rax ; mov PsKernelDr3[rcx], rdx ; mov rax, dr6 ; mov rdx, dr7 ; mov PsKernelDr6[rcx], rax ; mov PsKernelDr7[rcx], rdx ; xor eax, eax ; mov dr7, rax ; cmp byte ptr gs:[PcCpuVendor], CPU_AMD ; check if AMD processor jne short KiSC10 ; if ne, not authentic AMD processor ; ; The host processor is an authentic AMD processor. ; ; Check if branch tracing or last branch capture is enabled. ; test dx, DR7_TRACE_BRANCH or DR7_LAST_BRANCH ; test for extended enables jz short KiSC10 ; if z, extended debugging not enabled mov r8, rcx ; save processor state address mov ecx, MSR_LAST_BRANCH_FROM ; save last branch information rdmsr ; mov PsLastBranchFromRip[r8], eax ; mov PsLastBranchFromRip + 4[r8], edx ; mov ecx, MSR_LAST_BRANCH_TO ; rdmsr ; mov PsLastBranchToRip[r8], eax ; mov PsLastBranchToRip + 4[r8], edx ; mov ecx, MSR_LAST_EXCEPTION_FROM ; rdmsr ; mov PsLastExceptionFromRip[r8], eax ; mov PsLastExceptionFromRip + 4[r8], edx ; mov ecx, MSR_LAST_EXCEPTION_TO ; rdmsr ; mov PsLastExceptionToRip[r8], eax ; mov PsLastExceptionToRip + 4[r8], edx ; mov ecx, MSR_DEGUG_CTL ; clear extended debug control rdmsr ; and eax, not (MSR_DEBUG_CTL_LBR or MSR_DEBUG_CRL_BTF) ; wrmsr ; KiSC10: ret ; return LEAF_END KiSaveProcessorControlState, _TEXT$00 subttl "Restore Debug Register State" ;++ ; ; VOID ; KiRestoreDebugRegisterState ( ; VOID ; ); ; ; Routine Description: ; ; This routine is executed on a transition from kernel mode to user mode ; and restores the debug register state. ; ; N.B. This routine is used for both trap/interrupt and system service ; exit. ; ; Arguments: ; ; None. ; ; Implicit Arguments: ; ; rbp - Supplies a pointer to a trap frame. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KiRestoreDebugRegisterState, _TEXT$00 xor edx, edx ; clear register mov dr7, rdx ; clear control before loading mov rax, TrDr0[rbp] ; restore user debug registers mov rdx, TrDr1[rbp] ; mov dr0, rax ; mov dr1, rdx ; mov rax, TrDr2[rbp] ; mov rdx, TrDr3[rbp] ; mov dr2, rax ; mov dr3, rdx ; mov rdx, TrDr7[rbp] ; xor eax, eax ; mov dr6, rax ; mov dr7, rdx ; cmp byte ptr gs:[PcCpuVendor], CPU_AMD ; check if AMD processor jne short KiRD30 ; if ne, not authentic AMD processor ; ; The host processor is an authentic AMD processor. ; ; Check if branch tracing or last branch capture is enabled. ; test dx, DR7_TRACE_BRANCH ; test for trace branch enable jz short KiRD10 ; if z, trace branch not enabled or eax, MSR_DEBUG_CRL_BTF ; set trace branch enable KiRD10: test dx, DR7_LAST_BRANCH ; test for last branch enable jz short KiRD20 ; if z, last branch not enabled or eax, MSR_DEBUG_CTL_LBR ; set last branch enable KiRD20: test eax, eax ; test for extended debug enables jz short KiRD30 ; if z, no extended debug enables mov r8d, eax ; save extended debug enables mov ecx, MSR_DEGUG_CTL ; set extended debug control rdmsr ; and eax, not (MSR_DEBUG_CTL_LBR or MSR_DEBUG_CRL_BTF) ; or eax, r8d ; wrmsr ; KiRD30: ret ; return LEAF_END KiRestoreDebugRegisterState, _TEXT$00 subttl "Save Debug Register State" ;++ ; ; VOID ; KiSaveDebugRegisterState ( ; VOID ; ); ; ; Routine Description: ; ; This routine is called on a transition from user mode to kernel mode ; when user debug registers are active. It saves the user debug registers ; and loads the kernel debug register state. ; ; Arguments: ; ; None. ; ; Implicit Arguments: ; ; rbp - Supplies a pointer to a trap frame. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KiSaveDebugRegisterState, _TEXT$00 mov r9, gs:[PcSelf] ; get PCR address mov rax, dr0 ; save user debug registers mov rdx, dr1 ; mov TrDr0[rbp], rax ; mov TrDr1[rbp], rdx ; mov rax, dr2 ; mov rdx, dr3 ; mov TrDr2[rbp], rax ; mov TrDr3[rbp], rdx ; mov rax, dr6 ; mov rdx, dr7 ; mov TrDr6[rbp], rax ; mov TrDr7[rbp], rdx ; xor eax, eax ; mov dr7, rax ; cmp byte ptr gs:[PcCpuVendor], CPU_AMD ; check if AMD processor jne short KiSD10 ; if ne, not authentic AMD processor ; ; The host processor is an authentic AMD processor. ; ; Check if branch tracing or last branch capture is enabled. ; test dx, DR7_TRACE_BRANCH or DR7_LAST_BRANCH ; test for extended enables jz short KiSD10 ; if z, not extended debug enables mov ecx, MSR_LAST_BRANCH_FROM ; save last branch information rdmsr ; mov TrLastBranchFromRip[rbp], eax ; mov TrLastBranchFromRip + 4[rbp], edx ; mov ecx, MSR_LAST_BRANCH_TO ; rdmsr ; mov TrLastBranchToRip[rbp], eax ; mov TrLastBranchToRip + 4[rbp], edx ; mov ecx, MSR_LAST_EXCEPTION_FROM ; rdmsr ; mov TrLastExceptionFromRip[rbp], eax ; mov TrLastExceptionFromRip + 4[rbp], edx ; mov ecx, MSR_LAST_EXCEPTION_TO ; rdmsr ; mov TrLastExceptionToRip[rbp], eax ; mov TrLastExceptionToRip + 4[rbp], edx ; mov ecx, MSR_DEGUG_CTL ; Clear extended debug control rdmsr ; and eax, not (MSR_DEBUG_CTL_LBR or MSR_DEBUG_CRL_BTF) ; wrmsr ; KiSD10: test word ptr PcKernelDr7[r9], DR7_ACTIVE ; test if debug enabled jz short KiSD40 ; if z, debug not enabled mov rax, PcKernelDr0[r9] ; set debug registers mov rdx, PcKernelDr1[r9] ; mov dr0, rax ; mov dr1, rdx ; mov rax, PcKernelDr2[r9] ; mov rdx, PcKernelDr3[r9] ; mov dr2, rax ; mov dr3, rdx ; mov rdx, PcKernelDr7[r9] ; xor eax, eax ; mov dr6, rax ; mov dr7, rdx ; cmp byte ptr gs:[PcCpuVendor], CPU_AMD ; check if AMD processor jne short KiSD40 ; if ne, not authentic AMD processor ; ; The host processor is an authentic AMD processor. ; ; Check if branch tracing or last branch capture is enabled. ; test dx, DR7_TRACE_BRANCH ; test for trace branch enable jz short KiSD20 ; if z, trace branch not enabled or eax, MSR_DEBUG_CRL_BTF ; set trace branch enable KiSD20: test dx, DR7_LAST_BRANCH ; test for last branch enable jz short KiSD30 ; if z, last branch not enabled or eax, MSR_DEBUG_CTL_LBR ; set last branch enable KiSD30: test eax, eax ; test for extended debug enables jz short KiSD40 ; if z, no extended debug enables mov r8d, eax ; save extended debug enables mov ecx, MSR_DEGUG_CTL ; set extended debug control rdmsr ; and eax, not (MSR_DEBUG_CTL_LBR or MSR_DEBUG_CRL_BTF) ; or eax, r8d ; wrmsr ; KiSD40: ret ; return LEAF_END KiSaveDebugRegisterState, _TEXT$00 subttl "Get Current Stack Pointer" ;++ ; ; ULONG64 ; KeGetCurrentStackPointer ( ; VOID ; ); ; ; Routine Description: ; ; This function returns the caller's stack pointer. ; ; Arguments: ; ; None. ; ; Return Value: ; ; The callers stack pointer is returned as the function value. ; ;-- LEAF_ENTRY KeGetCurrentStackPointer, _TEXT$00 lea rax, 8[rsp] ; get callers stack pointer ret ; LEAF_END KeGetCurrentStackPointer, _TEXT$00 subttl "Save Legacy Floating Point State" ;++ ; ; VOID ; KeSaveLegacyFloatingPointState ( ; PXMM_SAVE_AREA32 NpxFrame ; ); ; ; Routine Description: ; ; This routine saves the legacy floating state for the current thread. ; ; Arguments: ; ; NpxFrame (rcx) - Supplies the address of the legacy floating save area. ; ; Return Value: ; ; None. ; ;-- LEAF_ENTRY KeSaveLegacyFloatingPointState, _TEXT$00 fxsave [rcx] ; save legacy floating state ret ; LEAF_END KeSaveLegacyFloatingPointState, _TEXT$00 end
src/Util/Vec.agda
JLimperg/msc-thesis-code
5
10526
{-# OPTIONS --without-K --safe #-} module Util.Vec where open import Data.Vec public open import Data.Vec.Relation.Unary.All as All public using (All ; [] ; _∷_) open import Data.Vec.Relation.Unary.Any as Any public using (Any ; here ; there) open import Data.Vec.Membership.Propositional public using (_∈_) open import Data.Nat as ℕ using (_≤_) open import Level using (_⊔_) open import Relation.Binary using (Rel) open import Util.Prelude import Data.Nat.Properties as ℕ max : ∀ {n} → Vec ℕ n → ℕ max = foldr _ ℕ._⊔_ 0 max-weaken : ∀ {n} x (xs : Vec ℕ n) → max xs ≤ max (x ∷ xs) max-weaken _ _ = ℕ.n≤m⊔n _ _ max-maximal : ∀ {n} (xs : Vec ℕ n) → All (_≤ max xs) xs max-maximal [] = [] max-maximal (x ∷ xs) = ℕ.m≤m⊔n _ _ ∷ All.map (λ x≤max → ℕ.≤-trans x≤max (max-weaken x xs)) (max-maximal xs) All→∈→P : ∀ {α β} {A : Set α} {P : A → Set β} {n} {xs : Vec A n} → All P xs → ∀ {x} → x ∈ xs → P x All→∈→P (px ∷ allP) (here refl) = px All→∈→P (px ∷ allP) (there x∈xs) = All→∈→P allP x∈xs max-maximal-∈ : ∀ {n x} {xs : Vec ℕ n} → x ∈ xs → x ≤ max xs max-maximal-∈ = All→∈→P (max-maximal _) data All₂ {α} {A : Set α} {ρ} (R : Rel A ρ) : ∀ {n} → Vec A n → Vec A n → Set (α ⊔ ρ) where [] : All₂ R [] [] _∷_ : ∀ {n x y} {xs ys : Vec A n} → R x y → All₂ R xs ys → All₂ R (x ∷ xs) (y ∷ ys) All₂-tabulate⁺ : ∀ {α} {A : Set α} {ρ} {R : Rel A ρ} {n} {f g : Fin n → A} → (∀ x → R (f x) (g x)) → All₂ R (tabulate f) (tabulate g) All₂-tabulate⁺ {n = zero} p = [] All₂-tabulate⁺ {n = suc n} p = p zero ∷ All₂-tabulate⁺ (λ x → p (suc x)) All₂-tabulate⁻ : ∀ {α} {A : Set α} {ρ} {R : Rel A ρ} {n} {f g : Fin n → A} → All₂ R (tabulate f) (tabulate g) → ∀ x → R (f x) (g x) All₂-tabulate⁻ [] () All₂-tabulate⁻ (fzRgz ∷ all) zero = fzRgz All₂-tabulate⁻ (fzRgz ∷ all) (suc x) = All₂-tabulate⁻ all x
theorems/cw/cohomology/ReconstructedCohomologyGroups.agda
mikeshulman/HoTT-Agda
0
12116
<filename>theorems/cw/cohomology/ReconstructedCohomologyGroups.agda {-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.ChainComplex open import cohomology.Theory open import groups.KernelImage open import cw.CW module cw.cohomology.ReconstructedCohomologyGroups {i : ULevel} (OT : OrdinaryTheory i) where open OrdinaryTheory OT open import cw.cohomology.Descending OT open import cw.cohomology.ReconstructedCochainComplex OT open import cw.cohomology.ReconstructedZerothCohomologyGroup OT open import cw.cohomology.ReconstructedFirstCohomologyGroup OT open import cw.cohomology.ReconstructedHigherCohomologyGroups OT abstract reconstructed-cohomology-group : ∀ m {n} (⊙skel : ⊙Skeleton {i} n) → ⊙has-cells-with-choice 0 ⊙skel i → C m ⊙⟦ ⊙skel ⟧ ≃ᴳ cohomology-group (cochain-complex ⊙skel) m reconstructed-cohomology-group (pos 0) ⊙skel ac = zeroth-cohomology-group ⊙skel ac reconstructed-cohomology-group (pos 1) ⊙skel ac = first-cohomology-group ⊙skel ac reconstructed-cohomology-group (pos (S (S m))) ⊙skel ac = higher-cohomology-group m ⊙skel ac reconstructed-cohomology-group (negsucc m) ⊙skel ac = lift-iso {j = i} ∘eᴳ trivial-iso-0ᴳ (C-cw-at-negsucc ⊙skel m ac)
src/compiler/LiteParser.g4
lian1925/lite-typescript
0
4358
<reponame>lian1925/lite-typescript<filename>src/compiler/LiteParser.g4<gh_stars>0 parser grammar LiteParser; options { tokenVocab = LiteLexer; } program: statement+; statement: (New_Line)* (annotationSupport)? exportStatement ( New_Line )* namespaceSupportStatement*; // 导出命名空间 exportStatement: TextLiteral left_brace (importStatement | New_Line)* right_brace end; // 导入命名空间 importStatement: (annotationSupport)? TextLiteral (id call?)? end; namespaceSupportStatement: namespaceVariableStatement | namespaceControlStatement | namespaceFunctionStatement | namespaceConstantStatement | packageStatement | protocolStatement | implementStatement | overrideStatement | packageNewStatement | enumStatement | typeAliasStatement | typeRedefineStatement | New_Line; // 类型别名 typeAliasStatement: id Equal_Arrow typeType end; // 类型重定义 typeRedefineStatement: id Right_Arrow typeType end; // 枚举 enumStatement: (annotationSupport)? id Right_Arrow New_Line* typeType left_brack enumSupportStatement* right_brack end; enumSupportStatement: id (Equal (add)? integerExpr)? end; // 命名空间变量 namespaceVariableStatement: (annotationSupport)? id ( Colon_Equal expression | Colon typeType (Equal expression)? ) end; // 命名空间控制 namespaceControlStatement: (annotationSupport)? id Colon typeType ( Equal expression )? Right_Arrow (packageControlSubStatement)+ end; // 命名空间常量 namespaceConstantStatement: (annotationSupport)? id ( Colon typeType Colon | Colon_Colon ) expression end; // 命名空间函数 namespaceFunctionStatement: (annotationSupport)? id ( templateDefine )? parameterClauseIn t = (Right_Arrow | Right_Flow) New_Line* parameterClauseOut left_brace ( functionSupportStatement )* right_brace end; // 定义包 packageStatement: (annotationSupport)? id (templateDefine)? Right_Arrow left_brace ( packageSupportStatement )* right_brace end; // 包支持的语句 packageSupportStatement: includeStatement | packageVariableStatement | packageEventStatement | New_Line; // 包含 includeStatement: Colon typeType end; // 包构造方法 packageNewStatement: (annotationSupport)? parameterClauseSelf Less Greater parameterClauseIn ( left_paren expressionList? right_paren )? left_brace (functionSupportStatement)* right_brace; // 定义变量 packageVariableStatement: (annotationSupport)? id ( Colon_Equal expression | Colon typeType (Equal expression)? ) end; // 定义子方法 packageControlSubStatement: id (left_paren id right_paren)? left_brace ( functionSupportStatement )+ right_brace; // 定义包事件 packageEventStatement: id Colon left_brack Question right_brack nameSpaceItem end; // 实现 implementStatement: parameterClauseSelf Right_Arrow (typeType)? New_Line* left_brace ( implementSupportStatement )* right_brace end; // 实现支持的语句 implementSupportStatement: implementFunctionStatement | implementControlStatement | New_Line; // 函数 implementFunctionStatement: (annotationSupport)? (n = '_')? id ( templateDefine )? parameterClauseIn t = (Right_Arrow | Right_Flow) New_Line* parameterClauseOut left_brace ( functionSupportStatement )* right_brace end; // 定义控制 implementControlStatement: (annotationSupport)? (n = '_')? id Colon typeType Right_Arrow ( packageControlSubStatement )+ end; // 重载 overrideStatement: parameterClauseSelf left_paren id right_paren Right_Arrow New_Line* left_brace ( overrideSupportStatement )* right_brace end; // 实现支持的语句 overrideSupportStatement: overrideFunctionStatement | overrideControlStatement | New_Line; // 函数 overrideFunctionStatement: (annotationSupport)? (n = '_')? id ( templateDefine )? parameterClauseIn t = (Right_Arrow | Right_Flow) New_Line* parameterClauseOut left_brace ( functionSupportStatement )* right_brace end; // 定义控制 overrideControlStatement: (annotationSupport)? (n = '_')? id Colon typeType Right_Arrow ( packageControlSubStatement )+ end; // 协议 protocolStatement: (annotationSupport)? id (templateDefine)? Left_Arrow left_brace ( protocolSupportStatement )* right_brace end; // 协议支持的语句 protocolSupportStatement: includeStatement | protocolFunctionStatement | protocolControlStatement | New_Line; // 定义控制 protocolControlStatement: (annotationSupport)? id Colon typeType Right_Arrow protocolControlSubStatement ( Comma protocolControlSubStatement )* end; // 定义子方法 protocolControlSubStatement: id; // 函数 protocolFunctionStatement: (annotationSupport)? id ( templateDefine )? parameterClauseIn t = (Right_Arrow | Right_Flow) New_Line* parameterClauseOut end; // 函数 functionStatement: id (templateDefine)? parameterClauseIn t = ( Right_Arrow | Right_Flow ) New_Line* parameterClauseOut left_brace ( functionSupportStatement )* right_brace end; // 返回 returnStatement: Left_Arrow tuple end; // 入参 parameterClauseIn: left_paren parameter? (more parameter)* right_paren; // 出参 parameterClauseOut: left_paren parameter? (more parameter)* right_paren; // 接收器 parameterClauseSelf: left_paren id Colon typeType right_paren; // 参数结构 parameter: (annotationSupport)? id Colon typeType ( Equal expression )?; // 函数支持的语句 functionSupportStatement: returnStatement | judgeCaseStatement | judgeStatement | loopStatement | loopEachStatement | loopCaseStatement | loopInfiniteStatement | loopJumpStatement | loopContinueStatement | usingStatement | checkStatement | reportStatement | functionStatement | variableStatement | variableDeclaredStatement | channelAssignStatement | assignStatement | expressionStatement | New_Line; // 条件判断 judgeCaseStatement: expression Question (caseStatement)+ end; // 缺省条件声明 caseDefaultStatement: Discard left_brace (functionSupportStatement)* right_brace; // 条件声明 caseExprStatement: (expression | (id)? Colon typeType) left_brace ( functionSupportStatement )* right_brace; // 判断条件声明 caseStatement: caseDefaultStatement | caseExprStatement; // 判断 judgeStatement: judgeIfStatement (judgeElseIfStatement)* judgeElseStatement end | judgeIfStatement (judgeElseIfStatement)* end; // else 判断 judgeElseStatement: Discard left_brace (functionSupportStatement)* right_brace; // if 判断 judgeIfStatement: Question expression left_brace (functionSupportStatement)* right_brace; // else if 判断 judgeElseIfStatement: expression left_brace (functionSupportStatement)* right_brace; // 循环 loopStatement: iteratorStatement At id left_brace (functionSupportStatement)* right_brace end; // 集合循环 loopEachStatement: expression At (Left_Brack id Right_Brack)? id left_brace ( functionSupportStatement )* right_brace end; // 条件循环 loopCaseStatement: At expression left_brace (functionSupportStatement)* right_brace end; // 无限循环 loopInfiniteStatement: At left_brace (functionSupportStatement)* right_brace end; // 跳出循环 loopJumpStatement: Left_Arrow At end; // 跳出当前循环 loopContinueStatement: Right_Arrow At end; // 检查 checkStatement: Bang left_brace (functionSupportStatement)* right_brace ( checkErrorStatement )* checkFinallyStatment end | Bang left_brace (functionSupportStatement)* right_brace ( checkErrorStatement )+ end; // 定义检查变量 usingStatement: expression Bang expression (Colon typeType)? end; // 错误处理 checkErrorStatement: (id | id Colon typeType) left_brace ( functionSupportStatement )* right_brace; // 最终执行 checkFinallyStatment: Discard left_brace (functionSupportStatement)* right_brace; // 报告错误 reportStatement: Bang left_paren (expression)? right_paren end; // 迭代器 iteratorStatement: Left_Brack expression op = ( Less | Less_Equal | Greater | Greater_Equal ) expression more expression Right_Brack | Left_Brack expression op = ( Less | Less_Equal | Greater | Greater_Equal ) expression Right_Brack; // 定义变量 variableStatement: expression (Colon_Equal | Colon typeType Equal) expression end; // 声明变量 variableDeclaredStatement: expression Colon typeType end; // 通道赋值 channelAssignStatement: expression Left_Brack Left_Arrow Right_Brack assign expression end; // 赋值 assignStatement: expression assign expression end; expressionStatement: expression end; // 基础表达式 primaryExpression: id (templateCall)? | t = Discard | left_paren expression right_paren | dataStatement; // 表达式 expression: linq // 联合查询 | callFunc // 函数调用 | primaryExpression | callChannel //调用通道 | callElement //调用元素 | callNew // 构造类对象 | callPkg // 新建包 | getType // 获取类型 | callAwait // 异步等待调用 | list // 列表 | set // 集合 | dictionary // 字典 | lambda // lambda表达式 | functionExpression // 函数 | pkgAnonymous // 匿名包 | tupleExpression //元组表达式 | plusMinus // 正负处理 | negate // 取反 | expression op = Bang // 引用判断 | expression op = Question // 可空判断 | expression op = Left_Flow // 异步执行 | expression typeConversion // 类型转换 | expression call callExpression // 链式调用 | expression judgeType typeType // 类型判断表达式 | expression judge expression // 判断型表达式 | expression add expression // 和型表达式 | expression mul expression // 积型表达式 | expression pow expression // 幂型表达式 | stringExpression ; // 字符串插值 callExpression: callElement // 访问元素 | callFunc // 函数调用 | callPkg // | id // id | callExpression call New_Line? callExpression ; // 链式调用 tuple: left_paren (expression (more expression)*)? right_paren; // 元组 expressionList: expression (more expression)*; // 表达式列 annotationSupport: annotation (New_Line)?; annotation: Left_Brack (id Right_Arrow)? annotationList Right_Brack; // 注解 annotationList: annotationItem (more annotationItem)*; annotationItem: id ( left_paren annotationAssign (more annotationAssign)* right_paren )?; annotationAssign: (id Equal)? expression; callFunc: id (templateCall)? (tuple | lambda); // 函数调用 callChannel: id op = Question? Left_Brack Left_Arrow Right_Brack; callElement: id op = Question? Left_Brack (slice | expression) Right_Brack; callPkg: typeType left_brace ( pkgAssign | listAssign | setAssign | dictionaryAssign )? right_brace; // 新建包 callNew: Less typeType Greater left_paren New_Line? expressionList? New_Line? right_paren; // 构造类对象 getType: Question left_paren (expression | Colon typeType) right_paren; typeConversion: Colon left_paren typeType right_paren; // 类型转化 pkgAssign: pkgAssignElement (more pkgAssignElement)*; // 简化赋值 pkgAssignElement: name Equal expression; // 简化赋值元素 listAssign: expression (more expression)*; setAssign: Left_Brack expression Right_Brack ( more Left_Brack expression Right_Brack )*; dictionaryAssign: dictionaryElement (more dictionaryElement)*; callAwait: Left_Flow expression; // 异步调用 list: left_brace expression (more expression)* right_brace; // 列表 set: left_brace Left_Brack expression Right_Brack ( more Left_Brack expression Right_Brack )* right_brace; // 无序集合 dictionary: left_brace dictionaryElement (more dictionaryElement)* right_brace; // 字典 dictionaryElement: Left_Brack expression Right_Brack expression; // 字典元素 slice: sliceFull | sliceStart | sliceEnd; sliceFull: expression op = (Less | Less_Equal | Greater | Greater_Equal) expression; sliceStart: expression op = (Less | Less_Equal | Greater | Greater_Equal); sliceEnd: op = (Less | Less_Equal | Greater | Greater_Equal) expression; nameSpaceItem: (id call New_Line?)* id; name: id (call New_Line? id)*; templateDefine: Less templateDefineItem (more templateDefineItem)* Greater; templateDefineItem: id (Colon id)?; templateCall: Less typeType (more typeType)* Greater; lambda: left_brace (lambdaIn)? t = (Right_Arrow | Right_Flow) New_Line* expressionList right_brace | left_brace (lambdaIn)? t = (Right_Arrow | Right_Flow) New_Line* ( functionSupportStatement )* right_brace; lambdaIn: id (more id)*; pkgAnonymous: pkgAnonymousAssign; // 匿名包 pkgAnonymousAssign: left_brace pkgAnonymousAssignElement ( more pkgAnonymousAssignElement )* right_brace; // 简化赋值 pkgAnonymousAssignElement: name Equal expression; // 简化赋值元素 functionExpression: parameterClauseIn t = (Right_Arrow | Right_Flow) New_Line* parameterClauseOut left_brace ( functionSupportStatement )* right_brace; tupleExpression: left_paren expression (more expression)* right_paren; // 元组 plusMinus: add expression; negate: wave expression; linq: linqHeadKeyword New_Line? expression Right_Arrow New_Line? ( linqItem )+ k = (LinqSelect | LinqBy) New_Line? expression; linqItem: linqKeyword (expression)? Right_Arrow New_Line?; linqKeyword: linqHeadKeyword | linqBodyKeyword; linqHeadKeyword: k = LinqFrom; linqBodyKeyword: k = ( LinqSelect | LinqBy | LinqWhere | LinqGroup | LinqInto | LinqOrderby | LinqJoin | LinqLet | LinqIn | LinqOn | LinqEquals | LinqAscending | LinqDescending ); stringExpression: TextLiteral (stringExpressionElement)+; stringExpressionElement: expression TextLiteral; // 基础数据 dataStatement: floatExpr | integerExpr | t = TextLiteral | t = CharLiteral | t = TrueLiteral | t = FalseLiteral | nilExpr | t = UndefinedLiteral; floatExpr: integerExpr call integerExpr; integerExpr: NumberLiteral; // 类型 typeNotNull: typeAny | typeTuple | typeArray | typeList | typeSet | typeDictionary | typeChannel | typeBasic | typePackage | typeFunction; typeReference: Bang (typeNotNull | typeNullable); typeNullable: Question typeNotNull; typeType: typeNotNull | typeNullable | typeReference; typeTuple: left_paren typeType (more typeType)+ right_paren; typeArray: Left_Brack Colon Right_Brack typeType; typeList: Left_Brack Right_Brack typeType; typeSet: Left_Brack typeType Right_Brack; typeDictionary: Left_Brack typeType Right_Brack typeType; typeChannel: Left_Brack Right_Arrow Right_Brack typeType; typePackage: nameSpaceItem (templateCall)?; typeFunction: typeFunctionParameterClause t = (Right_Arrow | Right_Flow) New_Line* typeFunctionParameterClause ; typeAny: TypeAny; // 函数类型参数 typeFunctionParameterClause: left_paren typeType? (more typeType)* right_paren; // 基础类型名 typeBasic: t = TypeI8 | t = TypeU8 | t = TypeI16 | t = TypeU16 | t = TypeI32 | t = TypeU32 | t = TypeI64 | t = TypeU64 | t = TypeF32 | t = TypeF64 | t = TypeChr | t = TypeStr | t = TypeBool | t = TypeInt | t = TypeNum | t = TypeByte; // nil值 nilExpr: NilLiteral; // bool值 boolExpr: t = TrueLiteral | t = FalseLiteral; judgeType: op = (Equal_Equal | Not_Equal) Colon; judge: op = ( Or | And | Equal_Equal | Not_Equal | Less_Equal | Greater_Equal | Less | Greater ) (New_Line)?; assign: op = ( Equal | Add_Equal | Sub_Equal | Mul_Equal | Div_Equal | Mod_Equal ) (New_Line)?; add: op = (Add | Sub) (New_Line)?; mul: op = (Mul | Div | Mod) (New_Line)?; pow: op = (Pow | Root | Log) (New_Line)?; call: op = Dot (New_Line)?; wave: op = Wave; id: (idItem); idItem: op = (IDPublic | IDPrivate) | typeBasic | typeAny | linqKeyword; end: Semi | New_Line; more: Comma New_Line*; left_brace: Left_Brace New_Line*; right_brace: New_Line* Right_Brace; left_paren: Left_Paren; right_paren: Right_Paren; left_brack: Left_Brack New_Line*; right_brack: New_Line* Right_Brack;
src/plugins/plugin-url.adb
Okasu/Byron
1
10665
with Scape; use Scape; with Ada.Characters.Conversions; use Ada.Characters.Conversions; with Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded; with AWS.Client; use AWS.Client; with GNAT.Regpat; use Gnat.Regpat; with AWS.Response; use AWS.Response; with ZLib; use ZLib; use AWS; package body Plugin.URL is function Unescape (Str : String) return String is (To_String (To_Wide_Wide_String (Decode (Str)))); -- FIXME: Fix this crap function Get_Body (URL : Unbounded_String) return String is Limit : constant Content_Range := (1, 3000); begin return Message_Body (Get (URL => To_String (URL), Data_Range => Limit)); exception when Zlib_Error => return Message_Body (Get (To_String (URL))); end Get_Body; -- Strip newlines from title, just a corner case. function Normalize_Title (Raw : String) return Unbounded_String is (GSub (To_Unbounded_String (Bold ("Title: ") & Unescape (Raw)), ASCII.CR & ASCII.LF, "")); function Get_Title (URL : Unbounded_String) return Unbounded_String is Header : constant Data := Head (To_String (URL)); Regex : constant Pattern_Matcher := Compile ("<title>(.*)<\/title>", Case_Insensitive or Single_Line); Result : Match_Array (0 .. 1); begin if Response.Header (Header, "Content-Type") (1 .. 4) = "text" then declare Content : constant String := Get_Body (URL); begin Match(Regex, Content, Result); if not (Result(1) = No_Match) then return Normalize_Title (Content (Result(1).First .. Result(1).Last)); else return To_Unbounded_String ("Title not found"); end if; end; else return To_Unbounded_String (Bold ("Content-Type: ") & Response.Header (Header, "Content-Type") & ", " & Bold ("Size: ") & Response.Header (Header, "Content-Length")); end if; end Get_Title; procedure URL_Title (Message : IRC.Message) is Answer : IRC.Message := Message; begin for C in Iterate (Words (Message.Content)) loop if Link (Element (C)) then Answer.Content := Get_Title (Element (C)); IRC.Put_Message (Answer); exit; end if; end loop; exception -- Silently ignore exceptions like malformed url or connection problems when others => null; end URL_Title; end Plugin.URL;
alloy/tp7/properties.als
motapinto/feup-mfes
0
2651
/* * Exercise A.1.1 on page 240 of * Software Abstractions, by <NAME> * * This following Alloy model constrains a binary relation to have a collection * of standard properties. * * A finite binary relation cannot have all of these properties at once. Which * individual properties, if eliminated would allow the remaining properties to * be satisfied? For each such property eliminated, give an example of a * relation that satisfies the rest. * * You can use the Alloy Analyzer to help you. The run command instructs the * analyzer to search for an instance satisfying the constraints in a universe * of 4 atoms. To eliminate a property, just comment it out. To get you * started, we have commented out the non-empty property to permit the empty * relation as a solution. */ pred show { some r: univ -> univ { some r // non empty r.r in r // transitive //no iden & r // irreflexive ~r in r // symmetric ~r.r in iden // functional r.~r in iden // injective univ in r.univ // total univ in univ.r // onto } } run show for 4
basic/csapp/exercise/ex3-55.asm
zing-dev/learn-c
1
166602
<reponame>zing-dev/learn-c ;; 3.55 ;; 在完成这道练习的过程中,因为没有考虑到 x * y 会发生隐式类型转换。 ;; 也就是,y 从 int 类型转换为 long long 类型。这种转换是隐式进行的。 ;; 因此,我就不能理解为什么要用 x_low * (y>>31) 了。 ;; 然后,通过在网络上搜索(感谢网络)。我发现了在豆瓣和 stackoverflow 的参考链接 ;; http://book.douban.com/subject/1230413/annotation?sort=rank&start=20 ;; http://stackoverflow.com/questions/11680720/implement-64-bit-arithmetic-on-a-32-bit-machine ;; dest at %ebp+8, x at %ebp+12, y at %ebp+20 movl 12(%ebp), %esi ; x_low -> esi movl 20(%ebp), %eax ; y -> eax movl %eax, %edx ; y -> edx sarl $31, %edx ; y>>31 -> edx movl %edx, %ecx ; y>>31 -> ecx imull %esi, %ecx ; x_low * (y>>31) -> ecx movl 16(%ebp), %ebx ; x_high -> ebx imull %eax, %ebx ; y * x_high -> ebx addl %ebx, %ecx ; y * x_high + (y>>31) * x_low -> ecx mull %esi ; x_low * y -> edx:eax leal (%ecx, %edx), %edx ; y * x_high + (y>>31)* x_low + edx -> edx movl 8(%ebp), %ecx ; dest -> ecx movl %eax, (%ecx) ; (x*y)_low -> *dest movl %edx, 4(%ecx) ; (x*y)_high -> *(dest+4) ;; 现在描述实现以上运算的算法: ;; 由于两个 64 位数字相乘,它的结果的 64 位表示,对于有符号和无符号都是相同的 ;; 1. a = x_low * y_low ;; 2. b = x_low * y_high ;; 3. c = x_high * y_low ;; 4. result = a + b + c
programs/oeis/222/A222261.asm
karttu/loda
0
23890
; A222261: Lexicographically earliest injective sequence of positive integers such that the sum of 10 consecutive terms is always divisible by 10. ; 1,2,3,4,5,6,7,8,9,15,11,12,13,14,25,16,17,18,19,35,21,22,23,24,45,26,27,28,29,55,31,32,33,34,65,36,37,38,39,75,41,42,43,44,85,46,47,48,49,95,51,52,53,54,105,56,57,58,59,115,61,62,63,64,125,66,67,68,69,135,71,72,73,74,145,76,77,78,79,155,81 mov $2,$0 sub $0,3 lpb $0,1 sub $0,1 mov $1,$0 mod $0,5 lpe add $1,1 add $1,$2
ada/euler1_3.adb
gregorymorrison/euler1
1
261
<gh_stars>1-10 -- Euler1 in Ada with Ada.Integer_Text_IO; procedure Euler1_3 is function Euler(n : in Integer; acc : in Integer := 0) return Integer is begin if n = 0 then return acc; elsif n mod 3 = 0 or n mod 5 = 0 then return Euler(n-1, acc+n); else return Euler(n-1, acc); end if; end Euler; begin Ada.Integer_Text_IO.Put (Integer( Euler(n => 999) )); end Euler1_3;
oeis/239/A239798.asm
neoneye/loda-programs
11
4898
; A239798: Decimal expansion of the midsphere radius in a regular dodecahedron with unit edges. ; Submitted by <NAME> ; 1,3,0,9,0,1,6,9,9,4,3,7,4,9,4,7,4,2,4,1,0,2,2,9,3,4,1,7,1,8,2,8,1,9,0,5,8,8,6,0,1,5,4,5,8,9,9,0,2,8,8,1,4,3,1,0,6,7,7,2,4,3,1,1,3,5,2,6,3,0,2,3,1,4,0,9,4,5,1,2,2,4,8,5,3,6,0,3,6,0,2,0,9,4,6,9,5,5,6,8 mov $1,1 mov $3,$0 mul $3,4 sub $3,1 lpb $3 mul $1,$3 mul $2,$3 add $1,$2 mov $5,$0 cmp $5,0 add $0,$5 div $1,$0 div $2,$0 add $2,$1 sub $3,1 lpe mul $2,2 mov $4,10 pow $4,$0 div $2,$4 mov $5,$4 cmp $5,0 cmp $5,0 add $2,$5 div $1,$2 mod $1,10 mov $0,$1
src/notcurses-visual.ads
JeremyGrosser/notcursesada
5
21247
<gh_stars>1-10 package Notcurses.Visual is type Notcurses_Visual is private; type Scale_Mode is (None, Scale, Stretch, None_Hires, None_Scale_Hires); type Blitter is (Blit_Default, Blit_1x1, Blit_2x1, Blit_2x2, Blit_3x2, Blit_Braille, Blit_Pixel, Blit_4x1, Blit_8x1); type Visual_Flags is record No_Degrade : Boolean := False; -- fail rather than degrade Blend : Boolean := False; -- use NCALPHA_BLEND with visual Horizontal_Aligned : Boolean := False; -- Position.X is an alignment, not absolute Vertical_Aligned : Boolean := False; -- Position.Y is an alignment, not absolute Add_Alpha : Boolean := False; -- transcolor is in effect Child_Plane : Boolean := False; -- interpret n as parent No_Interpolate : Boolean := False; -- non-interpolative scaling end record with Size => 64; for Visual_Flags use record No_Degrade at 0 range 0 .. 0; Blend at 0 range 1 .. 1; Horizontal_Aligned at 0 range 2 .. 2; Vertical_Aligned at 0 range 3 .. 3; Add_Alpha at 0 range 4 .. 4; Child_Plane at 0 range 5 .. 5; No_Interpolate at 0 range 6 .. 6; end record; type Visual_Options is record Plane : Notcurses_Plane; Scaling : Scale_Mode := None; -- ignored if Plane is provided Position : Coordinate := (0, 0); -- Offset the visual from the origin of Plane (or Standard_Plane if Plane is null) Origin : Coordinate := (0, 0); -- Mask the visual starting at Origin Size : Coordinate := (0, 0); -- Size of the Mask, or (0, 0) if no mask should be applied Blit : Blitter := Blit_Default; -- Glyph set to use. Default selects the best available for your terminal Flags : Visual_Flags := (others => False); Transparent_Color : Interfaces.Unsigned_32; -- if Flags.Add_Alpha, treat this color as transparent end record; type Decode_Status is (Ok, End_Of_File, Error); type RGBA is record R, G, B, A : Interfaces.Unsigned_8; end record with Size => 32; type RGBA_Bitmap is array (Integer range <>, Integer range <>) of RGBA with Component_Size => 32, Alignment => 4; function From_Bitmap (Bitmap : RGBA_Bitmap) return Notcurses_Visual; function From_File (Filename : Wide_Wide_String) return Notcurses_Visual; function Dimensions (Context : Notcurses_Context; Visual : Notcurses_Visual; Options : Visual_Options) return Coordinate; function Scale (Context : Notcurses_Context; Visual : Notcurses_Visual; Options : Visual_Options) return Coordinate; function From_Plane (Plane : Notcurses_Plane; Blit : Blitter; Position : Coordinate := (0, 0); Size : Coordinate := (-1, -1)) return Notcurses_Visual; function Media_Default_Blitter (Context : Notcurses_Context; Scale : Scale_Mode) return Blitter; procedure Set (Visual : Notcurses_Visual; Position : Coordinate; Color : RGBA); function Get (Visual : Notcurses_Visual; Position : Coordinate) return RGBA; procedure Render (Context : Notcurses_Context; Visual : Notcurses_Visual; Options : Visual_Options; Plane : out Notcurses_Plane); function Decode (Visual : Notcurses_Visual) return Decode_Status; procedure Destroy (This : Notcurses_Visual); private type Notcurses_Visual is access all Thin.ncvisual; function To_UInt64 is new Ada.Unchecked_Conversion (Source => Visual_Flags, Target => Interfaces.Unsigned_64); function To_C (O : Visual_Options) return Thin.ncvisual_options; function To_C is new Ada.Unchecked_Conversion (Source => RGBA, Target => Interfaces.Unsigned_32); function To_Ada is new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_32, Target => RGBA); end Notcurses.Visual;
test/src/yaml-transformation_tests.ads
robdaemon/AdaYaml
32
18641
<filename>test/src/yaml-transformation_tests.ads -- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" package Yaml.Transformation_Tests is end Yaml.Transformation_Tests;
demos/spath.ada
daveshields/AdaEd
3
30453
<reponame>daveshields/AdaEd -- A parallel single-source, all-destinations shortest-path finder. -- Each task is assigned a node, and tries to extend the path by -- cloning new tasks that explore all successors of that node. -- The graph is represented by adjacency lists. This representation -- is fixed, and global to all tasks. -- The minimum distances at each step of the computation are kept in -- arrays RESULT and COMING_FROM. These objects are monitored by an -- array of tasks, one for each node, to yield greater concurrency. with TEXT_IO; use TEXT_IO; procedure shortest_path is package i_io is new integer_io(integer); use i_io; n: integer := 4; -- cardinality of graph subtype graph_size is integer range 1..n; subtype graph_node is graph_size ; inf: integer := 9999; -- Infinite distance type config is array(graph_size) of integer; adjacency: array(graph_size) of config; -- To describe the graph result: config := (graph_size => inf); -- Shortest distances coming_from: config; -- To reconstruct paths begin declare task type monitor_node is entry init(node: graph_node) ; entry go_on(pred: graph_node; pathlength: integer; shorter: out boolean); end monitor_node; monitor: array(graph_size) of monitor_node ; task type path is entry init(node, pred: graph_node; pathlength, size: integer); end path; type path_name is access path; start: path_name; subtype s_path is path; task body monitor_node is here: graph_node ; -- node monitored by this task begin accept init(node: graph_node) do here := node ; end init ; loop select accept go_on(pred: graph_node; pathlength: integer; shorter: out boolean) do if pathlength < result(here) then -- new path is shorter than previous attempts. result(here) := pathlength; coming_from(here) := pred; shorter := true; else shorter := false; end if; end go_on; or terminate; end select; end loop; end monitor_node; task body path is source, from: graph_node; cost,edge: integer; options: config; x: path_name; response: boolean; begin accept init(node, pred: graph_node; pathlength,size: integer) do source := node; from := pred; cost := pathlength; edge := size; end init; cost:=cost+edge; monitor(source).go_on(from, cost, response); if response then -- found shorter path than previous attempts. -- Clone successors to explore edges out of this node. options := adjacency(source) ; for j in graph_size loop if options(j) /= inf then -- edge exists; x := new s_path ; -- new task for it x.init(j, source, cost, options(j)); end if; end loop; end if; end path; begin adjacency :=((inf, 9, 2, inf), (inf, 1, 1, 2), (inf, 2, inf, 5), (inf, 1, inf, 2) ); for j in graph_size loop -- Attach a monitor_node to each graph node. monitor(j).init(j) ; end loop ; start := new path; start.init(1, 1, 0, 0); -- start from node 1, distance 0. end; -- and wait for tasks to terminate. put_line("Final distances from source") ; new_line; for j in graph_size'succ(graph_size'first).. graph_size'last loop put(result(j)); put(" to ") ; put(j) ; put(" reached via ") ; put(coming_from(j)) ; new_line; end loop; end shortest_path;
src/Categories/Object/Cokernel.agda
Trebor-Huang/agda-categories
279
13328
<reponame>Trebor-Huang/agda-categories {-# OPTIONS --without-K --safe #-} open import Categories.Category open import Categories.Object.Zero -- Cokernels of morphisms. -- https://ncatlab.org/nlab/show/cokernel module Categories.Object.Cokernel {o ℓ e} {𝒞 : Category o ℓ e} (𝟎 : Zero 𝒞) where open import Level open import Categories.Morphism 𝒞 open import Categories.Morphism.Reasoning 𝒞 hiding (glue) open Category 𝒞 open Zero 𝟎 open HomReasoning private variable A B X : Obj f h i j k : A ⇒ B record IsCokernel {A B K} (f : A ⇒ B) (k : B ⇒ K) : Set (o ⊔ ℓ ⊔ e) where field commute : k ∘ f ≈ zero⇒ universal : ∀ {X} {h : B ⇒ X} → h ∘ f ≈ zero⇒ → K ⇒ X factors : ∀ {eq : h ∘ f ≈ zero⇒} → h ≈ universal eq ∘ k unique : ∀ {eq : h ∘ f ≈ zero⇒} → h ≈ i ∘ k → i ≈ universal eq universal-resp-≈ : ∀ {eq : h ∘ f ≈ zero⇒} {eq′ : i ∘ f ≈ zero⇒} → h ≈ i → universal eq ≈ universal eq′ universal-resp-≈ h≈i = unique (⟺ h≈i ○ factors) universal-∘ : h ∘ k ∘ f ≈ zero⇒ universal-∘ {h = h} = begin h ∘ k ∘ f ≈⟨ refl⟩∘⟨ commute ⟩ h ∘ zero⇒ ≈⟨ zero-∘ˡ h ⟩ zero⇒ ∎ record Cokernel {A B} (f : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where field {cokernel} : Obj cokernel⇒ : B ⇒ cokernel isCokernel : IsCokernel f cokernel⇒ open IsCokernel isCokernel public IsCokernel⇒Cokernel : IsCokernel f k → Cokernel f IsCokernel⇒Cokernel {k = k} isCokernel = record { cokernel⇒ = k ; isCokernel = isCokernel }
BSidesCanberra/2021/pwn/secure_service_monitor/src/checks.asm
mystickev/ctf-archives
1
174052
_TEXT SEGMENT extrn socket : proc extrn connect : proc extrn puts : proc PUBLIC DoTCPCheck signature db "BEARS" DoSpecialCheck PROC pop rdi lea rcx, blocked_msg jmp puts DoSpecialCheck ENDP blocked_msg db "Checking of port 28928 is disabled", 10, 0 ; ALIGN 16 ; note: removed function alignment, just a waste of space DoTCPCheck PROC EXPORT ; run special case for port 28928 ; TODO: why do we have this special case? ; TODO: why did we even implement any of this in assembly? ; TODO: why is this function in the executable's export table too? push rdi movzx rdi, word ptr [rcx+2] cmp rdi, 71h jz DoSpecialCheck ; create socket sub rsp, 20h mov rdi, rdx mov ecx, 2 ; AF_INET mov edx, 1 ; SOCK_STREAM xor r8d, r8d call socket cmp rax, -1 jz failed ; connect to socket mov rcx, rax mov rdx, rdi mov r8, 16 ; sizeof(sockaddr_in) call connect test eax, eax jnz failed ; if we connected, we succeeded mov eax, 1 jmp done failed: xor eax, eax done: add rsp, 20h pop rdi ret DoTCPCheck ENDP ; TODO: Previous developer left this code here, we should probably delete it? add rcx, 20h push rdi call qword ptr [rcx+30h] pop rdi ret _TEXT ENDS END
programs/oeis/274/A274139.asm
jmorken/loda
1
95898
; A274139: a(n) = 2^A000265(n) = 2^numerator(n/2^n), a sequence related to Oresme numbers. ; 2,2,8,2,32,8,128,2,512,32,2048,8,8192,128,32768,2,131072,512,524288,32,2097152,2048,8388608,8,33554432,8192,134217728,128,536870912,32768,2147483648,2,8589934592,131072,34359738368,512,137438953472,524288,549755813888,32 add $0,2 lpb $0 mov $1,1 sub $1,2 mul $1,2 mov $2,4 mov $6,$0 add $6,$2 sub $6,2 pow $1,$6 clr $5,$1 mov $0,$6 div $0,2 mul $1,4 lpe div $1,192 mul $1,6 add $1,2
oeis/203/A203998.asm
neoneye/loda-programs
11
83733
; A203998: Symmetric matrix based on f(i,j)=max{i(j+1)-1,j(i+1)-1}, by antidiagonals. ; Submitted by <NAME> ; 1,3,3,5,5,5,7,8,8,7,9,11,11,11,9,11,14,15,15,14,11,13,17,19,19,19,17,13,15,20,23,24,24,23,20,15,17,23,27,29,29,29,27,23,17,19,26,31,34,35,35,34,31,26,19,21,29,35,39,41,41,41,39,35,29,21,23,32,39,44 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe min $0,$2 add $0,1 add $1,2 sub $1,$0 mov $2,$1 mul $2,$0 add $2,$1 mov $0,$2 sub $0,1
src/sets/nat/ordering/leq/core.agda
pcapriotti/agda-base
20
9139
{-# OPTIONS --without-K #-} module sets.nat.ordering.leq.core where open import decidable open import equality.core open import function.core open import sets.nat.core open import sets.empty data _≤_ : ℕ → ℕ → Set where z≤n : ∀ {n} → zero ≤ n s≤s : ∀ {m n} (p : m ≤ n) → suc m ≤ suc n ap-pred-≤ : ∀ {n m} → suc n ≤ suc m → n ≤ m ap-pred-≤ (s≤s p) = p refl≤ : {n : ℕ} → n ≤ n refl≤ {0} = z≤n refl≤ {suc n} = s≤s refl≤ ≡⇒≤ : {n m : ℕ} → n ≡ m → n ≤ m ≡⇒≤ refl = refl≤ suc≤ : ∀ {n} → n ≤ suc n suc≤ {0} = z≤n suc≤ {suc n} = s≤s suc≤ suc≰ : ∀ {n} → ¬ (suc n ≤ n) suc≰ {zero} () suc≰ {suc n} p = suc≰ (ap-pred-≤ p) trans≤ : ∀ {n m p} → n ≤ m → m ≤ p → n ≤ p trans≤ z≤n q = z≤n trans≤ (s≤s p) (s≤s q) = s≤s (trans≤ p q) antisym≤ : ∀ {n m} → n ≤ m → m ≤ n → n ≡ m antisym≤ z≤n z≤n = refl antisym≤ (s≤s p) (s≤s q) = ap suc (antisym≤ p q)
oeis/346/A346773.asm
neoneye/loda-programs
11
4170
<gh_stars>10-100 ; A346773: a(n) = Sum_{d|n} möbius(d)^n. ; Submitted by <NAME> ; 1,2,0,2,0,4,0,2,0,4,0,4,0,4,0,2,0,4,0,4,0,4,0,4,0,4,0,4,0,8,0,2,0,4,0,4,0,4,0,4,0,8,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,8,0,4,0,2,0,8,0,4,0,8,0,4,0,4,0,4,0,8,0,4,0,4,0,8,0,4,0,4,0,8,0,4,0,4,0,4,0,4,0,4 add $0,1 mov $1,1 mov $2,2 lpb $0 mov $3,$0 lpb $3 mul $1,$4 mov $4,$0 mod $4,$2 add $2,1 cmp $4,0 cmp $4,0 sub $3,$4 lpe mov $5,1 lpb $0 dif $0,$2 mov $4,1 lpe add $5,1 mul $1,$5 lpe mov $0,$1
programs/oeis/152/A152113.asm
neoneye/loda
22
82336
; A152113: A001333 with terms repeated. ; 1,1,3,3,7,7,17,17,41,41,99,99,239,239,577,577,1393,1393,3363,3363,8119,8119,19601,19601,47321,47321,114243,114243,275807,275807,665857,665857,1607521,1607521,3880899,3880899,9369319,9369319,22619537,22619537,54608393 div $0,2 seq $0,78057 ; Expansion of (1+x)/(1-2*x-x^2).
Applications/System-Events/process/first process whose frontmost is true.applescript
looking-for-a-job/applescript-examples
1
3877
<gh_stars>1-10 #!/usr/bin/osascript tell application "System Events" name of (first process whose frontmost is true) end tell
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_130.asm
ljhsiun2/medusa
9
92741
.global s_prepare_buffers s_prepare_buffers: push %r9 push %rcx push %rdi push %rsi lea addresses_A_ht+0xcbee, %rsi lea addresses_D_ht+0x8d6e, %rdi clflush (%rdi) nop nop dec %r9 mov $2, %rcx rep movsb cmp %r9, %r9 pop %rsi pop %rdi pop %rcx pop %r9 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %rax push %rbp push %rdi push %rdx // Store lea addresses_WT+0x13339, %rax nop nop nop nop sub %rdx, %rdx movl $0x51525354, (%rax) nop nop nop nop add $4237, %r11 // Store lea addresses_D+0x1ed0e, %r8 nop and $63187, %rdx movw $0x5152, (%r8) nop add %r11, %r11 // Store lea addresses_WT+0xcb0e, %r11 cmp %r8, %r8 mov $0x5152535455565758, %rax movq %rax, (%r11) nop nop nop nop sub $7493, %rax // Store lea addresses_WT+0x1b82a, %rdx nop xor %rdi, %rdi mov $0x5152535455565758, %rbp movq %rbp, %xmm2 vmovups %ymm2, (%rdx) nop nop nop and %rbp, %rbp // Store mov $0x21e, %rbp nop nop nop add $12253, %rax movb $0x51, (%rbp) nop nop inc %rbp // Store lea addresses_UC+0x350e, %rdx nop inc %r8 movw $0x5152, (%rdx) xor %rdi, %rdi // Store lea addresses_WC+0x150e, %rax nop nop nop xor %r11, %r11 mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%rax) nop nop nop nop nop dec %r8 // Store lea addresses_D+0x1ed0e, %r8 nop nop nop nop sub $10287, %rax mov $0x5152535455565758, %rdi movq %rdi, %xmm1 movups %xmm1, (%r8) // Exception!!! nop nop nop mov (0), %rbp nop nop cmp $8594, %r13 // Load lea addresses_RW+0x5c6, %r8 nop dec %rdi mov (%r8), %dx nop nop nop nop nop dec %r8 // Faulty Load lea addresses_D+0x1ed0e, %r8 nop add $26780, %rdi mov (%r8), %dx lea oracles, %rbp and $0xff, %rdx shlq $12, %rdx mov (%rbp,%rdx,1), %rdx pop %rdx pop %rdi pop %rbp pop %rax pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
Assembler/TEST.asm
techno-sorcery/CPU-16
0
17326
<reponame>techno-sorcery/CPU-16<gh_stars>0 LNK D6,#-4
HoTT/Identity/Coproduct.agda
michaelforney/hott
0
5337
<reponame>michaelforney/hott<filename>HoTT/Identity/Coproduct.agda {-# OPTIONS --without-K #-} module HoTT.Identity.Coproduct where open import HoTT.Base open import HoTT.Equivalence open variables private variable x y : A + B _=+_ : {A : 𝒰 i} {B : 𝒰 j} (x y : A + B) → 𝒰 (i ⊔ j) _=+_ {j = j} (inl a₁) (inl a₂) = Lift {j} (a₁ == a₂) _=+_ (inl _) (inr _) = 𝟎 _=+_ (inr _) (inl _) = 𝟎 _=+_ {i} (inr b₁) (inr b₂) = Lift {i} (b₁ == b₂) =+-equiv : (x == y) ≃ x =+ y =+-equiv = f , qinv→isequiv (g , η , ε) where f : x == y → x =+ y f {x = inl a} refl = lift refl f {x = inr a} refl = lift refl g : x =+ y → x == y g {x = inl _} {inl _} (lift refl) = refl g {x = inl _} {inr _} () g {x = inr _} {inl _} () g {x = inr _} {inr _} (lift refl) = refl η : {x y : A + B} → g {x = x} {y} ∘ f ~ id η {y = inl _} refl = refl η {y = inr _} refl = refl ε : f {x = x} {y} ∘ g ~ id ε {x = inl _} {inl _} (lift refl) = refl ε {x = inl _} {inr _} () ε {x = inr _} {inl _} () ε {x = inr _} {inr _} (lift refl) = refl =+-elim : x == y → x =+ y =+-elim = pr₁ =+-equiv =+-intro : x =+ y → x == y =+-intro = Iso.g (eqv→iso =+-equiv)
tools/scitools/conf/understand/ada/ada05/s-traces.ads
brucegua/moocos
1
21671
<filename>tools/scitools/conf/understand/ada/ada05/s-traces.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T R A C E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-2005 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package implements functions for traces when tasking is not involved -- Warning : NO dependencies to tasking should be created here -- This package, and all its children are used to implement debug -- informations -- A new primitive, Send_Trace_Info (Id : Trace_T; 'data') is introduced. -- Trace_T is an event identifier, 'data' are the informations to pass -- with the event. Thid procedure is used from within the Runtime to send -- debug informations. -- This primitive is overloaded in System.Traces.Tasking and this package. -- Send_Trace_Info calls Send_Trace, in System.Traces.Send, which is trarget -- dependent, to send the debug informations to a debugger, stream .. -- To add a new event, just add them to the Trace_T type, and write the -- corresponding Send_Trace_Info procedure. It may be required for some -- target to modify Send_Trace (eg. VxWorks). -- To add a new target, just adapt System.Traces.Send to your own purpose. package System.Traces is pragma Preelaborate; type Trace_T is ( -- Events handled. -- Messages -- M_Accept_Complete, M_Select_Else, M_RDV_Complete, M_Call_Complete, M_Delay, -- Errors -- E_Missed, E_Timeout, E_Kill, -- Waiting events -- W_Call, W_Accept, W_Select, W_Completion, W_Delay, WU_Delay, WT_Call, WT_Select, WT_Completion, -- Protected objects events -- PO_Call, POT_Call, PO_Run, PO_Lock, PO_Unlock, PO_Done, -- Task handling events -- T_Create, T_Activate, T_Abort, T_Terminate); -- Send_Trace_Info procedures -- They are overloaded, depending on the parameters passed with -- the event, e.g. Time information, Task name, Accept name ... procedure Send_Trace_Info (Id : Trace_T); procedure Send_Trace_Info (Id : Trace_T; Timeout : Duration); end System.Traces;
programs/oeis/214/A214647.asm
neoneye/loda
22
165541
<reponame>neoneye/loda<gh_stars>10-100 ; A214647: (n^n + n^2)/2. ; 1,4,18,136,1575,23346,411796,8388640,193710285,5000000050,142655835366,4458050224200,151437553296211,5556003412779106,218946945190429800,9223372036854775936,413620130943168382233,19673204037648268787874,989209827830156794562170 mov $1,$0 add $0,1 add $1,1 mov $2,$1 mul $1,$0 pow $2,$0 add $1,$2 mov $0,$1 div $0,2
source/pools/required/s-poosiz.ads
ytomino/drake
33
18778
pragma License (Unrestricted); -- implementation unit required by compiler with System.Storage_Elements; with System.Storage_Pools; package System.Pool_Size is pragma Preelaborate; use type Storage_Elements.Storage_Offset; type Aligned_Storage_Array is new Storage_Elements.Storage_Array; for Aligned_Storage_Array'Alignment use Standard'Maximum_Alignment; -- mixed type Bounded_Allocator ( Size : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) is limited record First_Free : Storage_Elements.Storage_Offset := -1; -- offset First_Empty : Storage_Elements.Storage_Count := 0; -- offset Storage : aliased Aligned_Storage_Array (1 .. Size); end record; for Bounded_Allocator'Alignment use Standard'Maximum_Alignment; procedure Allocate ( Allocator : aliased in out Bounded_Allocator; Storage_Address : out Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); procedure Deallocate ( Allocator : aliased in out Bounded_Allocator; Storage_Address : Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); function Storage_Size (Allocator : Bounded_Allocator) return Storage_Elements.Storage_Count; pragma Inline (Storage_Size); pragma Simple_Storage_Pool_Type (Bounded_Allocator); -- fixed type Bounded_Fixed_Allocator ( Size : Storage_Elements.Storage_Count; Component_Size : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) is limited record First_Free : Storage_Elements.Storage_Offset := -1; -- offset First_Empty : Storage_Elements.Storage_Count := 0; -- offset Storage : aliased Aligned_Storage_Array (1 .. Size); end record; for Bounded_Fixed_Allocator'Alignment use Standard'Maximum_Alignment; procedure Allocate ( Allocator : aliased in out Bounded_Fixed_Allocator; Storage_Address : out Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); procedure Deallocate ( Allocator : aliased in out Bounded_Fixed_Allocator; Storage_Address : Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); function Storage_Size (Allocator : Bounded_Fixed_Allocator) return Storage_Elements.Storage_Count; pragma Inline (Storage_Size); pragma Simple_Storage_Pool_Type (Bounded_Fixed_Allocator); -- required for access types having explicit 'Storage_Size > 0 by compiler -- (s-poosiz.ads) type Stack_Bounded_Pool ( Pool_Size : Storage_Elements.Storage_Count; Elmt_Size : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) is limited new Storage_Pools.Root_Storage_Pool with record case Elmt_Size is when 0 => Mixed : aliased Bounded_Allocator (Pool_Size, Alignment); when others => Fixed : aliased Bounded_Fixed_Allocator (Pool_Size, Elmt_Size, Alignment); end case; end record with Disable_Controlled => True; pragma Finalize_Storage_Only (Stack_Bounded_Pool); overriding procedure Allocate ( Pool : in out Stack_Bounded_Pool; Storage_Address : out Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); pragma Inline (Allocate); overriding procedure Deallocate ( Pool : in out Stack_Bounded_Pool; Storage_Address : Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); pragma Inline (Deallocate); overriding function Storage_Size (Pool : Stack_Bounded_Pool) return Storage_Elements.Storage_Count; pragma Inline (Storage_Size); end System.Pool_Size;
libsrc/_DEVELOPMENT/adt/ba_priority_queue/c/sccz80/ba_priority_queue_top.asm
jpoikela/z88dk
640
170475
; int ba_priority_queue_top(ba_priority_queue_t *q) SECTION code_clib SECTION code_adt_ba_priority_queue PUBLIC ba_priority_queue_top EXTERN asm_ba_priority_queue_top defc ba_priority_queue_top = asm_ba_priority_queue_top ; SDCC bridge for Classic IF __CLASSIC PUBLIC _ba_priority_queue_top defc _ba_priority_queue_top = ba_priority_queue_top ENDIF
target/target.exe.asm
katahiromz/DecodersTatami
3
26711
<filename>target/target.exe.asm CodeReverse2 2.4.3 by katahiromz ## CommandLine ## "C:\Program Files (x86)\CodeReverse2\bin\cr2.exe" --addr --hex --add-func 0x401550 --read 0x404000 0x100 C:/dev/DecodersTatami/target/target.exe C:/dev/DecodersTatami/target/target.exe.asm ## OS Info ## Windows 6.2 (x86) ## Read Memory ## +ADDRESS +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 0123456789ABCDEF 00404000 74 00 61 00 72 00 67 00 65 00 74 00 00 00 00 00 t a r g e t 00404010 20 53 40 00 40 50 40 00 70 1A 40 00 00 80 40 00 S@ @P@ p.@ .@ 00404020 04 80 40 00 90 53 40 00 20 70 40 00 00 00 00 00 ..@ .S@ p@ 00404030 00 00 00 00 55 6E 6B 6E 6F 77 6E 20 65 72 72 6F Unknown erro 00404040 72 00 00 00 5F 6D 61 74 68 65 72 72 28 29 3A 20 r _matherr(): 00404050 25 73 20 69 6E 20 25 73 28 25 67 2C 20 25 67 29 %s in %s(%g, %g) 00404060 20 20 28 72 65 74 76 61 6C 3D 25 67 29 0A 00 00 (retval=%g). 00404070 41 72 67 75 6D 65 6E 74 20 64 6F 6D 61 69 6E 20 Argument domain 00404080 65 72 72 6F 72 20 28 44 4F 4D 41 49 4E 29 00 41 error (DOMAIN) A 00404090 72 67 75 6D 65 6E 74 20 73 69 6E 67 75 6C 61 72 rgument singular 004040A0 69 74 79 20 28 53 49 47 4E 29 00 00 4F 76 65 72 ity (SIGN) Over 004040B0 66 6C 6F 77 20 72 61 6E 67 65 20 65 72 72 6F 72 flow range error 004040C0 20 28 4F 56 45 52 46 4C 4F 57 29 00 54 68 65 20 (OVERFLOW) The 004040D0 72 65 73 75 6C 74 20 69 73 20 74 6F 6F 20 73 6D result is too sm 004040E0 61 6C 6C 20 74 6F 20 62 65 20 72 65 70 72 65 73 all to be repres 004040F0 65 6E 74 65 64 20 28 55 4E 44 45 52 46 4C 4F 57 ented (UNDERFLOW 256 (0x100) bytes read. ## IMAGE_DOS_HEADER ## e_magic: 0x5A4D e_cblp: 0x0090 e_cp: 0x0003 e_crlc: 0x0000 e_cparhdr: 0x0004 e_minalloc: 0x0000 e_maxalloc: 0xFFFF e_ss: 0x0000 e_sp: 0x00B8 e_csum: 0x0000 e_ip: 0x0000 e_cs: 0x0000 e_lfarlc: 0x0040 e_ovno: 0x0000 e_res[0]: 0x0000 e_res[1]: 0x0000 e_res[2]: 0x0000 e_res[3]: 0x0000 e_oemid: 0x0000 e_oeminfo: 0x0000 e_res2[0]: 0x0000 e_res2[1]: 0x0000 e_res2[2]: 0x0000 e_res2[3]: 0x0000 e_res2[4]: 0x0000 e_res2[5]: 0x0000 e_res2[6]: 0x0000 e_res2[7]: 0x0000 e_res2[8]: 0x0000 e_res2[9]: 0x0000 e_lfanew: 0x00000080 ## IMAGE_FILE_HEADER ## Machine: 0x014C (IMAGE_FILE_MACHINE_I386) NumberOfSections: 0x0008 (8) TimeDateStamp: 0x60D81FDA (Sun Jun 27 06:51:06 2021) PointerToSymbolTable: 0x00009600 NumberOfSymbols: 0x00000405 (1029) SizeOfOptionalHeader: 0x00E0 (224) Characteristics: 0x0307 (IMAGE_FILE_RELOCS_STRIPPED IMAGE_FILE_EXECUTABLE_IMAGE IMAGE_FILE_LINE_NUMS_STRIPPED IMAGE_FILE_32BIT_MACHINE IMAGE_FILE_DEBUG_STRIPPED ) ## IMAGE_OPTIONAL_HEADER32 ## Magic: 0x010B LinkerVersion: 2.34 SizeOfCode: 0x00001A00 (6656) SizeOfInitializedData: 0x00009200 (37376) SizeOfUninitializedData: 0x00000400 (1024) AddressOfEntryPoint: 0x000014C0 BaseOfCode: 0x00001000 BaseOfData: 0x00003000 ImageBase: 0x00400000 SectionAlignment: 0x00001000 FileAlignment: 0x00000200 OperatingSystemVersion: 4.0 ImageVersion: 0.0 SubsystemVersion: 4.0 Win32VersionValue: 0x00000000 SizeOfImage: 0x00010000 (65536) SizeOfHeaders: 0x00000400 (1024) CheckSum: 0x0001DB53 Subsystem: 0x0002 (IMAGE_SUBSYSTEM_WINDOWS_GUI) DllCharacteristics: 0x0000 () SizeOfStackReserve: 0x00200000 (2097152) SizeOfStackCommit: 0x00001000 (4096) SizeOfHeapReserve: 0x00100000 (1048576) SizeOfHeapCommit: 0x00001000 (4096) LoaderFlags: 0x00000000 NumberOfRvaAndSizes: 0x00000010 (16) ## Data Directories ## IMAGE_DIRECTORY_ENTRY_EXPORT ( 0): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_IMPORT ( 1): AVA 0x00406000, RVA 0x00006000, size 0x00000624 (1572) IMAGE_DIRECTORY_ENTRY_RESOURCE ( 2): AVA 0x00409000, RVA 0x00009000, size 0x00006238 (25144) IMAGE_DIRECTORY_ENTRY_EXCEPTION ( 3): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_SECURITY ( 4): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_BASERELOC ( 5): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_DEBUG ( 6): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_ARCHITECTURE ( 7): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_GLOBALPTR ( 8): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_TLS ( 9): AVA 0x0040401C, RVA 0x0000401C, size 0x00000018 (24) IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG (10): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT (11): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_IAT (12): AVA 0x0040614C, RVA 0x0000614C, size 0x000000D4 (212) IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT (13): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR (14): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) (Reserved Directory Entry) (15): AVA 0x00000000, RVA 0x00000000, size 0x00000000 (0) ## Section Header #1 ## Name: .text VirtualSize: 0x000019C4 (6596) VirtualAddress: 0x00001000 (RVA) VirtualAddress: 0x00401000 (AVA) SizeOfRawData: 0x00001A00 (6656) PointerToRawData: 0x00000400 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0x60500060 (IMAGE_SCN_CNT_CODE IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_16BYTES IMAGE_SCN_MEM_EXECUTE IMAGE_SCN_MEM_READ ) ## Section Header #2 ## Name: .data VirtualSize: 0x00000030 (48) VirtualAddress: 0x00003000 (RVA) VirtualAddress: 0x00403000 (AVA) SizeOfRawData: 0x00000200 (512) PointerToRawData: 0x00001E00 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Section Header #3 ## Name: .rdata VirtualSize: 0x00000570 (1392) VirtualAddress: 0x00004000 (RVA) VirtualAddress: 0x00404000 (AVA) SizeOfRawData: 0x00000600 (1536) PointerToRawData: 0x00002000 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0x40300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ ) ## Section Header #4 ## Name: .bss VirtualSize: 0x000003E8 (1000) VirtualAddress: 0x00005000 (RVA) VirtualAddress: 0x00405000 (AVA) SizeOfRawData: 0x00000000 (0) PointerToRawData: 0x00000000 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0600080 (IMAGE_SCN_CNT_UNINITIALIZED_DATA IMAGE_SCN_ALIGN_32BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Section Header #5 ## Name: .idata VirtualSize: 0x00000624 (1572) VirtualAddress: 0x00006000 (RVA) VirtualAddress: 0x00406000 (AVA) SizeOfRawData: 0x00000800 (2048) PointerToRawData: 0x00002600 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Section Header #6 ## Name: .CRT VirtualSize: 0x00000034 (52) VirtualAddress: 0x00007000 (RVA) VirtualAddress: 0x00407000 (AVA) SizeOfRawData: 0x00000200 (512) PointerToRawData: 0x00002E00 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Section Header #7 ## Name: .tls VirtualSize: 0x00000008 (8) VirtualAddress: 0x00008000 (RVA) VirtualAddress: 0x00408000 (AVA) SizeOfRawData: 0x00000200 (512) PointerToRawData: 0x00003000 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Section Header #8 ## Name: .rsrc VirtualSize: 0x00006238 (25144) VirtualAddress: 0x00009000 (RVA) VirtualAddress: 0x00409000 (AVA) SizeOfRawData: 0x00006400 (25600) PointerToRawData: 0x00003200 PointerToRelocations: 0x00000000 PointerToLinenumbers: 0x00000000 NumberOfRelocations: 0x00000000 (0) NumberOfLinenumbers: 0x00000000 (0) Characteristics: 0xC0300040 (IMAGE_SCN_CNT_INITIALIZED_DATA IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_MEM_READ IMAGE_SCN_MEM_WRITE ) ## Imports ## Characteristics: 0x00006078 (24696) TimeDateStamp: 0x00000000 ((null)) Name: 0x00006524 (25892) FirstThunk: 0x0000614C (24908) Hint RVA VA Function 5F 00006220 00406220 comctl32.dll!InitCommonControls D7 00006236 00406236 kernel32.dll!DeleteCriticalSection F3 0000624E 0040624E kernel32.dll!EnterCriticalSection 1C8 00006266 00406266 kernel32.dll!GetCurrentProcess 1C9 0000627A 0040627A kernel32.dll!GetCurrentProcessId 1CD 00006290 00406290 kernel32.dll!GetCurrentThreadId 207 000062A6 004062A6 kernel32.dll!GetLastError 268 000062B6 004062B6 kernel32.dll!GetStartupInfoA 27F 000062C8 004062C8 kernel32.dll!GetSystemTimeAsFileTime 29B 000062E2 004062E2 kernel32.dll!GetTickCount 2EF 000062F2 004062F2 kernel32.dll!InitializeCriticalSection 345 0000630E 0040630E kernel32.dll!LeaveCriticalSection 3B6 00006326 00406326 kernel32.dll!QueryPerformanceCounter 48C 00006340 00406340 kernel32.dll!SetUnhandledExceptionFilter 499 0000635E 0040635E kernel32.dll!Sleep 4A7 00006366 00406366 kernel32.dll!TerminateProcess 4AE 0000637A 0040637A kernel32.dll!TlsGetValue 4BB 00006388 00406388 kernel32.dll!UnhandledExceptionFilter 4DB 000063A4 004063A4 kernel32.dll!VirtualProtect 4DE 000063B6 004063B6 kernel32.dll!VirtualQuery 3B 000063C6 004063C6 msvcrt.dll!__getmainargs 3C 000063D6 004063D6 msvcrt.dll!__initenv 45 000063E2 004063E2 msvcrt.dll!__lconv_init 4D 000063F2 004063F2 msvcrt.dll!__p__acmdln 54 00006400 00406400 msvcrt.dll!__p__fmode 69 0000640E 0040640E msvcrt.dll!__set_app_type 6C 00006420 00406420 msvcrt.dll!__setusermatherr 91 00006434 00406434 msvcrt.dll!_amsg_exit A2 00006442 00406442 msvcrt.dll!_cexit 160 0000644C 0040644C msvcrt.dll!_initterm 164 00006458 00406458 msvcrt.dll!_iob 274 00006460 00406460 msvcrt.dll!_onexit 421 0000646A 0040646A msvcrt.dll!abort 42E 00006472 00406472 msvcrt.dll!calloc 439 0000647C 0040647C msvcrt.dll!exit 449 00006484 00406484 msvcrt.dll!fprintf 450 0000648E 0040648E msvcrt.dll!free 45C 00006496 00406496 msvcrt.dll!fwrite 48B 000064A0 004064A0 msvcrt.dll!malloc 4AF 000064AA 004064AA msvcrt.dll!signal 4C3 000064B4 004064B4 msvcrt.dll!strlen 4C6 000064BE 004064BE msvcrt.dll!strncmp 4E5 000064C8 004064C8 msvcrt.dll!vfprintf 1B 000064D4 004064D4 shell32.dll!DragAcceptFiles B6 000064E6 004064E6 user32.dll!DialogBoxParamW EB 000064F8 004064F8 user32.dll!EndDialog 237 00006504 00406504 user32.dll!LoadStringW 254 00006512 00406512 user32.dll!MessageBoxW ## Exports ## No exports. ## Delay ## No delays. ## DisAsm ## proc target.exe!WinMainCRTStartup Label_004014C0 attrs [[cdecl]][[entry]] # call_to : 00401880 004018C0 00401BF0 00401DD0 0040288C 0040289C 004028BC 004028DC 004028E4 004028EC 0040290C 00402940 00402950 # jump_to : 00401160 0040117B 004011AA 004011C0 004011D4 004011F0 00401207 00401213 0040121B 0040123F 00401290 0040129E 0040129F 004012A7 004012B2 004012C0 004012C5 004012CD 004012D2 004012EB 004012F0 00401330 0040133E 00401390 00401398 00401400 00401411 00401429 00401451 00401460 00401480 004014A4 004014AC Label_00401160: 00401160: 8D 4C 24 04 : lea ecx, [esp+0x4] # jump_from : 004014D5 00401164: 83 E4 F0 : and esp, 0xfffffff0 00401167: FF 71 FC : push dword [ecx-0x4] 0040116A: 31 D2 : xor edx, edx 0040116C: 31 C0 : xor eax, eax 0040116E: 55 : push ebp 0040116F: 89 E5 : mov ebp, esp 00401171: 57 : push edi 00401172: 56 : push esi 00401173: 53 : push ebx 00401174: 51 : push ecx 00401175: 81 EC 88 00 00 00 : sub esp, 0x88 Label_0040117B: 0040117B: 89 54 05 A4 : mov [ebp+eax-0x5c], edx # jump_from : 00401189 0040117F: 89 54 05 A8 : mov [ebp+eax-0x58], edx 00401183: 83 C0 08 : add eax, 0x8 00401186: 83 F8 40 : cmp eax, 0x40 00401189: 72 F0 : jb Label_0040117B 0040118B: 8B 0D 98 53 40 00 : mov ecx, [0x405398] 00401191: 31 D2 : xor edx, edx 00401193: 89 54 05 A4 : mov [ebp+eax-0x5c], edx 00401197: 85 C9 : test ecx, ecx 00401199: 74 0F : jz Label_004011AA 0040119B: 8D 45 A4 : lea eax, [ebp-0x5c] 0040119E: 89 04 24 : mov [esp], eax 004011A1: FF 15 6C 61 40 00 : call kernel32.dll!GetStartupInfoA 004011A7: 83 EC 04 : sub esp, 0x4 Label_004011AA: 004011AA: 64 A1 18 00 00 00 : mov eax, [fs:0x18] # jump_from : 00401199 004011B0: 31 DB : xor ebx, ebx 004011B2: 8B 78 04 : mov edi, [eax+0x4] 004011B5: 8B 35 88 61 40 00 : mov esi, [0x406188] 004011BB: EB 17 : jmp Label_004011D4 Label_004011C0: 004011C0: 39 C7 : cmp edi, eax # jump_from : 004011E0 004011C2: 0F 84 38 02 00 00 : jz Label_00401400 004011C8: C7 04 24 E8 03 00 00 : mov dword [esp], 0x3e8 004011CF: FF D6 : call esi 004011D1: 83 EC 04 : sub esp, 0x4 Label_004011D4: 004011D4: 89 D8 : mov eax, ebx # jump_from : 004011BB 004011D6: F0 0F B1 3D E0 53 40 00 : lock cmpxchg [0x4053e0], edi 004011DE: 85 C0 : test eax, eax 004011E0: 75 DE : jnz Label_004011C0 004011E2: A1 E4 53 40 00 : mov eax, [0x4053e4] 004011E7: 31 DB : xor ebx, ebx 004011E9: 48 : dec eax 004011EA: 0F 84 21 02 00 00 : jz Label_00401411 Label_004011F0: 004011F0: A1 E4 53 40 00 : mov eax, [0x4053e4] # jump_from : 0040140B 004011F5: 85 C0 : test eax, eax 004011F7: 0F 84 83 02 00 00 : jz Label_00401480 004011FD: B8 01 00 00 00 : mov eax, 0x1 00401202: A3 08 50 40 00 : mov [0x405008], eax Label_00401207: 00401207: A1 E4 53 40 00 : mov eax, [0x4053e4] # jump_from : 0040149F 0040120C: 48 : dec eax 0040120D: 0F 84 16 02 00 00 : jz Label_00401429 Label_00401213: 00401213: 85 DB : test ebx, ebx # jump_from : 00401423 00401215: 0F 84 36 02 00 00 : jz Label_00401451 Label_0040121B: 0040121B: A1 18 40 40 00 : mov eax, [0x404018] # jump_from : 0040144B 00401457 00401220: 85 C0 : test eax, eax 00401222: 74 1B : jz Label_0040123F 00401224: C7 04 24 00 00 00 00 : mov dword [esp], 0x0 0040122B: 31 D2 : xor edx, edx 0040122D: B9 02 00 00 00 : mov ecx, 0x2 00401232: 89 54 24 08 : mov [esp+0x8], edx 00401236: 89 4C 24 04 : mov [esp+0x4], ecx 0040123A: FF D0 : call eax 0040123C: 83 EC 0C : sub esp, 0xc Label_0040123F: 0040123F: E8 8C 0B 00 00 : call Func00401DD0@4 # jump_from : 00401222 00401244: BF 00 00 40 00 : mov edi, 0x400000 00401249: C7 04 24 60 20 40 00 : mov dword [esp], 0x402060 00401250: FF 15 84 61 40 00 : call kernel32.dll!SetUnhandledExceptionFilter 00401256: A3 AC 53 40 00 : mov [0x4053ac], eax 0040125B: 83 EC 04 : sub esp, 0x4 0040125E: C7 04 24 00 10 40 00 : mov dword [esp], 0x401000 00401265: E8 D6 16 00 00 : call Func00402940 0040126A: E8 81 09 00 00 : call Func00401BF0 0040126F: 89 3D DC 53 40 00 : mov [0x4053dc], edi 00401275: E8 92 16 00 00 : call msvcrt.dll!__p__acmdln 0040127A: 31 C9 : xor ecx, ecx 0040127C: 8B 00 : mov eax, [eax] 0040127E: 85 C0 : test eax, eax 00401280: 74 50 : jz Label_004012D2 00401282: 0F B6 10 : movzx edx, byte [eax] 00401285: 80 FA 20 : cmp dl, 0x20 00401288: 7F 1D : jg Label_004012A7 0040128A: 8D B6 00 00 00 00 : lea esi, [esi] Label_00401290: 00401290: 84 D2 : test dl, dl # jump_from : 004012A5 00401292: 74 1E : jz Label_004012B2 00401294: F6 C1 01 : test cl, 0x1 00401297: 74 19 : jz Label_004012B2 00401299: B9 01 00 00 00 : mov ecx, 0x1 Label_0040129E: 0040129E: 40 : inc eax # jump_from : 004012AA Label_0040129F: 0040129F: 0F B6 10 : movzx edx, byte [eax] # jump_from : 004012B0 004012A2: 80 FA 20 : cmp dl, 0x20 004012A5: 7E E9 : jle Label_00401290 Label_004012A7: 004012A7: 80 FA 22 : cmp dl, 0x22 # jump_from : 00401288 004012AA: 75 F2 : jnz Label_0040129E 004012AC: 83 F1 01 : xor ecx, 0x1 004012AF: 40 : inc eax 004012B0: EB ED : jmp Label_0040129F Label_004012B2: 004012B2: 84 D2 : test dl, dl # jump_from : 00401292 00401297 004012B4: 75 0F : jnz Label_004012C5 004012B6: EB 15 : jmp Label_004012CD Label_004012C0: 004012C0: 80 FA 20 : cmp dl, 0x20 # jump_from : 004012CB 004012C3: 7F 08 : jg Label_004012CD Label_004012C5: 004012C5: 40 : inc eax # jump_from : 004012B4 004012C6: 0F B6 10 : movzx edx, byte [eax] 004012C9: 84 D2 : test dl, dl 004012CB: 75 F3 : jnz Label_004012C0 Label_004012CD: 004012CD: A3 D8 53 40 00 : mov [0x4053d8], eax # jump_from : 004012B6 004012C3 Label_004012D2: 004012D2: 8B 35 98 53 40 00 : mov esi, [0x405398] # jump_from : 00401280 004012D8: 85 F6 : test esi, esi 004012DA: 74 14 : jz Label_004012F0 004012DC: F6 45 D0 01 : test byte [ebp-0x30], 0x1 004012E0: B8 0A 00 00 00 : mov eax, 0xa 004012E5: 74 04 : jz Label_004012EB 004012E7: 0F B7 45 D4 : movzx eax, word [ebp-0x2c] Label_004012EB: 004012EB: A3 00 30 40 00 : mov [0x403000], eax # jump_from : 004012E5 Label_004012F0: 004012F0: 8B 1D 1C 50 40 00 : mov ebx, [0x40501c] # jump_from : 004012DA 004012F6: 8D 34 9D 04 00 00 00 : lea esi, [ebx*4+0x4] 004012FD: 89 34 24 : mov [esp], esi 00401300: E8 97 15 00 00 : call msvcrt.dll!malloc 00401305: 85 DB : test ebx, ebx 00401307: 89 45 88 : mov [ebp-0x78], eax 0040130A: 89 C1 : mov ecx, eax 0040130C: A1 18 50 40 00 : mov eax, [0x405018] 00401311: 0F 8E 8D 01 00 00 : jle Label_004014A4 00401317: 89 4D 94 : mov [ebp-0x6c], ecx 0040131A: 89 C3 : mov ebx, eax 0040131C: 8D 46 FC : lea eax, [esi-0x4] 0040131F: 89 45 84 : mov [ebp-0x7c], eax 00401322: 01 D8 : add eax, ebx 00401324: 89 45 90 : mov [ebp-0x70], eax 00401327: EB 15 : jmp Label_0040133E Label_00401330: 00401330: F3 A4 : rep movsb # jump_from : 00401366 0040136A 00401332: 83 C3 04 : add ebx, 0x4 00401335: 83 45 94 04 : add dword [ebp-0x6c], 0x4 00401339: 39 5D 90 : cmp [ebp-0x70], ebx 0040133C: 74 52 : jz Label_00401390 Label_0040133E: 0040133E: 8B 03 : mov eax, [ebx] # jump_from : 00401327 00401388 00401340: 89 04 24 : mov [esp], eax 00401343: E8 44 15 00 00 : call msvcrt.dll!strlen 00401348: 89 45 8C : mov [ebp-0x74], eax 0040134B: 8D 70 01 : lea esi, [eax+0x1] 0040134E: 89 34 24 : mov [esp], esi 00401351: E8 46 15 00 00 : call msvcrt.dll!malloc 00401356: 8B 7D 94 : mov edi, [ebp-0x6c] 00401359: 89 F1 : mov ecx, esi 0040135B: 83 F9 08 : cmp ecx, 0x8 0040135E: 89 07 : mov [edi], eax 00401360: 89 C7 : mov edi, eax 00401362: 8B 13 : mov edx, [ebx] 00401364: 89 D6 : mov esi, edx 00401366: 72 C8 : jb Label_00401330 00401368: A8 04 : test al, 0x4 0040136A: 74 C4 : jz Label_00401330 0040136C: 8B 12 : mov edx, [edx] 0040136E: 83 C7 04 : add edi, 0x4 00401371: 83 C6 04 : add esi, 0x4 00401374: 83 C3 04 : add ebx, 0x4 00401377: 89 10 : mov [eax], edx 00401379: 8B 4D 8C : mov ecx, [ebp-0x74] 0040137C: 83 E9 03 : sub ecx, 0x3 0040137F: F3 A4 : rep movsb 00401381: 83 45 94 04 : add dword [ebp-0x6c], 0x4 00401385: 39 5D 90 : cmp [ebp-0x70], ebx 00401388: 75 B4 : jnz Label_0040133E 0040138A: 8D B6 00 00 00 00 : lea esi, [esi] Label_00401390: 00401390: 8B 45 84 : mov eax, [ebp-0x7c] # jump_from : 0040133C 00401393: 8B 5D 88 : mov ebx, [ebp-0x78] 00401396: 01 D8 : add eax, ebx Label_00401398: 00401398: C7 00 00 00 00 00 : mov dword [eax], 0x0 # jump_from : 004014A7 0040139E: 8B 45 88 : mov eax, [ebp-0x78] 004013A1: A3 18 50 40 00 : mov [0x405018], eax 004013A6: E8 D5 04 00 00 : call Func00401880 004013AB: A1 14 50 40 00 : mov eax, [0x405014] 004013B0: 8B 15 A8 61 40 00 : mov edx, [0x4061a8] 004013B6: 89 02 : mov [edx], eax 004013B8: 89 44 24 08 : mov [esp+0x8], eax 004013BC: A1 18 50 40 00 : mov eax, [0x405018] 004013C1: 89 44 24 04 : mov [esp+0x4], eax 004013C5: A1 1C 50 40 00 : mov eax, [0x40501c] 004013CA: 89 04 24 : mov [esp], eax 004013CD: E8 7E 15 00 00 : call Func00402950 004013D2: 8B 0D 0C 50 40 00 : mov ecx, [0x40500c] 004013D8: 85 C9 : test ecx, ecx 004013DA: A3 10 50 40 00 : mov [0x405010], eax 004013DF: 0F 84 C7 00 00 00 : jz Label_004014AC 004013E5: 8B 15 08 50 40 00 : mov edx, [0x405008] 004013EB: 85 D2 : test edx, edx 004013ED: 74 71 : jz Label_00401460 004013EF: 8D 65 F0 : lea esp, [ebp-0x10] 004013F2: 59 : pop ecx 004013F3: 5B : pop ebx 004013F4: 5E : pop esi 004013F5: 5F : pop edi 004013F6: 5D : pop ebp 004013F7: 8D 61 FC : lea esp, [ecx-0x4] 004013FA: C3 : ret Label_00401400: 00401400: A1 E4 53 40 00 : mov eax, [0x4053e4] # jump_from : 004011C2 00401405: BB 01 00 00 00 : mov ebx, 0x1 0040140A: 48 : dec eax 0040140B: 0F 85 DF FD FF FF : jnz Label_004011F0 Label_00401411: 00401411: C7 04 24 1F 00 00 00 : mov dword [esp], 0x1f # jump_from : 004011EA 00401418: E8 CF 14 00 00 : call msvcrt.dll!_amsg_exit 0040141D: A1 E4 53 40 00 : mov eax, [0x4053e4] 00401422: 48 : dec eax 00401423: 0F 85 EA FD FF FF : jnz Label_00401213 Label_00401429: 00401429: C7 04 24 00 70 40 00 : mov dword [esp], 0x407000 # jump_from : 0040120D 00401430: BE 08 70 40 00 : mov esi, 0x407008 00401435: BF 02 00 00 00 : mov edi, 0x2 0040143A: 89 74 24 04 : mov [esp+0x4], esi 0040143E: E8 99 14 00 00 : call msvcrt.dll!_initterm 00401443: 85 DB : test ebx, ebx 00401445: 89 3D E4 53 40 00 : mov [0x4053e4], edi 0040144B: 0F 85 CA FD FF FF : jnz Label_0040121B Label_00401451: 00401451: 87 1D E0 53 40 00 : xchg [0x4053e0], ebx # jump_from : 00401215 00401457: E9 BF FD FF FF : jmp Label_0040121B Label_00401460: 00401460: E8 7F 14 00 00 : call msvcrt.dll!_cexit # jump_from : 004013ED 00401465: A1 10 50 40 00 : mov eax, [0x405010] 0040146A: 8D 65 F0 : lea esp, [ebp-0x10] 0040146D: 59 : pop ecx 0040146E: 5B : pop ebx 0040146F: 5E : pop esi 00401470: 5F : pop edi 00401471: 5D : pop ebp 00401472: 8D 61 FC : lea esp, [ecx-0x4] 00401475: C3 : ret Label_00401480: 00401480: C7 04 24 0C 70 40 00 : mov dword [esp], 0x40700c # jump_from : 004011F7 00401487: B8 01 00 00 00 : mov eax, 0x1 0040148C: A3 E4 53 40 00 : mov [0x4053e4], eax 00401491: B8 18 70 40 00 : mov eax, 0x407018 00401496: 89 44 24 04 : mov [esp+0x4], eax 0040149A: E8 3D 14 00 00 : call msvcrt.dll!_initterm 0040149F: E9 63 FD FF FF : jmp Label_00401207 Label_004014A4: 004014A4: 8B 45 88 : mov eax, [ebp-0x78] # jump_from : 00401311 004014A7: E9 EC FE FF FF : jmp Label_00401398 Label_004014AC: 004014AC: 89 04 24 : mov [esp], eax # jump_from : 004013DF 004014AF: 90 : nop 004014B0: E8 07 14 00 00 : call msvcrt.dll!exit 004014B5: 8D B4 26 00 00 00 00 : lea esi, [esi] 004014BC: 8D 74 26 00 : lea esi, [esi] Label_004014C0: 004014C0: 83 EC 0C : sub esp, 0xc 004014C3: B8 01 00 00 00 : mov eax, 0x1 004014C8: A3 98 53 40 00 : mov [0x405398], eax 004014CD: E8 EE 03 00 00 : call Func004018C0 004014D2: 83 C4 0C : add esp, 0xc 004014D5: E9 86 FC FF FF : jmp Label_00401160 end proc proc Func00401500 Label_00401500 attrs [[cdecl]] # call_from : 00401880 # call_to : 004028D4 Label_00401500: 00401500: 83 EC 1C : sub esp, 0x1c 00401503: 8B 44 24 20 : mov eax, [esp+0x20] 00401507: 89 04 24 : mov [esp], eax 0040150A: E8 C5 13 00 00 : call msvcrt.dll!_onexit 0040150F: 85 C0 : test eax, eax 00401511: 0F 94 C0 : setz al 00401514: 83 C4 1C : add esp, 0x1c 00401517: 0F B6 C0 : movzx eax, al 0040151A: F7 D8 : neg eax 0040151C: C3 : ret end proc proc Func00401550@16 Label_00401550 attrs [[stdcall]] # jump_to : 00401582 00401590 004015C0 004015F0 00401640 Label_00401550: 00401550: 53 : push ebx 00401551: 81 EC 18 01 00 00 : sub esp, 0x118 00401557: 8B 84 24 24 01 00 00 : mov eax, [esp+0x124] 0040155E: 3D 10 01 00 00 : cmp eax, 0x110 00401563: 74 2B : jz Label_00401590 00401565: 3D 11 01 00 00 : cmp eax, 0x111 0040156A: 75 16 : jnz Label_00401582 0040156C: 0F B7 84 24 28 01 00 00 : movzx eax, word [esp+0x128] 00401574: 83 F8 01 : cmp eax, 0x1 00401577: 0F 84 C3 00 00 00 : jz Label_00401640 0040157D: 83 F8 02 : cmp eax, 0x2 00401580: 74 3E : jz Label_004015C0 Label_00401582: 00401582: 81 C4 18 01 00 00 : add esp, 0x118 # jump_from : 0040156A 00401612 00401633 00401588: 31 C0 : xor eax, eax 0040158A: 5B : pop ebx 0040158B: C2 10 00 : ret 0x10 Label_00401590: 00401590: 8B 84 24 20 01 00 00 : mov eax, [esp+0x120] # jump_from : 00401563 00401597: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 0040159F: 89 04 24 : mov [esp], eax 004015A2: FF 15 04 62 40 00 : call shell32.dll!DragAcceptFiles 004015A8: B8 01 00 00 00 : mov eax, 0x1 004015AD: 83 EC 08 : sub esp, 0x8 004015B0: 81 C4 18 01 00 00 : add esp, 0x118 004015B6: 5B : pop ebx 004015B7: C2 10 00 : ret 0x10 Label_004015C0: 004015C0: 8D 5C 24 10 : lea ebx, [esp+0x10] # jump_from : 00401580 004015C4: C7 44 24 0C 80 00 00 00 : mov dword [esp+0xc], 0x80 004015CC: 89 5C 24 08 : mov [esp+0x8], ebx 004015D0: C7 44 24 04 65 00 00 00 : mov dword [esp+0x4], 0x65 004015D8: C7 04 24 00 00 00 00 : mov dword [esp], 0x0 004015DF: FF 15 14 62 40 00 : call user32.dll!LoadStringW 004015E5: 83 EC 10 : sub esp, 0x10 004015E8: C7 44 24 0C 43 00 00 00 : mov dword [esp+0xc], 0x43 Label_004015F0: 004015F0: 8B 84 24 20 01 00 00 : mov eax, [esp+0x120] # jump_from : 00401670 004015F7: C7 44 24 08 00 40 40 00 : mov dword [esp+0x8], 0x404000 004015FF: 89 5C 24 04 : mov [esp+0x4], ebx 00401603: 89 04 24 : mov [esp], eax 00401606: FF 15 18 62 40 00 : call user32.dll!MessageBoxW 0040160C: 83 EC 10 : sub esp, 0x10 0040160F: 83 F8 06 : cmp eax, 0x6 00401612: 0F 85 6A FF FF FF : jnz Label_00401582 00401618: 8B 84 24 20 01 00 00 : mov eax, [esp+0x120] 0040161F: C7 44 24 04 02 00 00 00 : mov dword [esp+0x4], 0x2 00401627: 89 04 24 : mov [esp], eax 0040162A: FF 15 10 62 40 00 : call user32.dll!EndDialog 00401630: 83 EC 08 : sub esp, 0x8 00401633: E9 4A FF FF FF : jmp Label_00401582 Label_00401640: 00401640: 8D 5C 24 10 : lea ebx, [esp+0x10] # jump_from : 00401577 00401644: C7 44 24 0C 80 00 00 00 : mov dword [esp+0xc], 0x80 0040164C: 89 5C 24 08 : mov [esp+0x8], ebx 00401650: C7 44 24 04 64 00 00 00 : mov dword [esp+0x4], 0x64 00401658: C7 04 24 00 00 00 00 : mov dword [esp], 0x0 0040165F: FF 15 14 62 40 00 : call user32.dll!LoadStringW 00401665: 83 EC 10 : sub esp, 0x10 00401668: C7 44 24 0C 44 00 00 00 : mov dword [esp+0xc], 0x44 00401670: E9 7B FF FF FF : jmp Label_004015F0 end proc proc Func00401790@16 Label_00401790 attrs [[stdcall]] # call_from : 00402950 Label_00401790: 00401790: 83 EC 2C : sub esp, 0x2c 00401793: FF 15 4C 61 40 00 : call comctl32.dll!InitCommonControls 00401799: 8B 44 24 30 : mov eax, [esp+0x30] 0040179D: C7 44 24 10 00 00 00 00 : mov dword [esp+0x10], 0x0 004017A5: C7 44 24 0C 50 15 40 00 : mov dword [esp+0xc], 0x401550 004017AD: C7 44 24 08 00 00 00 00 : mov dword [esp+0x8], 0x0 004017B5: C7 44 24 04 64 00 00 00 : mov dword [esp+0x4], 0x64 004017BD: 89 04 24 : mov [esp], eax 004017C0: FF 15 0C 62 40 00 : call user32.dll!DialogBoxParamW 004017C6: 31 C0 : xor eax, eax 004017C8: 83 EC 14 : sub esp, 0x14 004017CB: 83 C4 2C : add esp, 0x2c 004017CE: C2 10 00 : ret 0x10 end proc proc Func00401880 Label_00401880 attrs [[cdecl]] # call_from : 004014C0 00402950 # call_to : 00401500 # jump_to : 00401820 0040182F 00401840 0040184A 00401860 00401864 00401866 00401890 Label_00401820: 00401820: 53 : push ebx # jump_from : 0040189A 00401821: 83 EC 18 : sub esp, 0x18 00401824: 8B 1D B0 29 40 00 : mov ebx, [0x4029b0] 0040182A: 83 FB FF : cmp ebx, 0xffffffff 0040182D: 74 31 : jz Label_00401860 Label_0040182F: 0040182F: 85 DB : test ebx, ebx # jump_from : 00401874 00401831: 74 17 : jz Label_0040184A 00401833: 8D B4 26 00 00 00 00 : lea esi, [esi] 0040183A: 8D B6 00 00 00 00 : lea esi, [esi] Label_00401840: 00401840: FF 14 9D B0 29 40 00 : call dword [ebx*4+0x4029b0] # jump_from : 00401848 00401847: 4B : dec ebx 00401848: 75 F6 : jnz Label_00401840 Label_0040184A: 0040184A: C7 04 24 E0 17 40 00 : mov dword [esp], 0x4017e0 # jump_from : 00401831 00401851: E8 AA FC FF FF : call Func00401500 00401856: 83 C4 18 : add esp, 0x18 00401859: 5B : pop ebx 0040185A: C3 : ret Label_00401860: 00401860: 31 DB : xor ebx, ebx # jump_from : 0040182D 00401862: EB 02 : jmp Label_00401866 Label_00401864: 00401864: 89 C3 : mov ebx, eax # jump_from : 00401872 Label_00401866: 00401866: 8D 43 01 : lea eax, [ebx+0x1] # jump_from : 00401862 00401869: 8B 14 85 B0 29 40 00 : mov edx, [eax*4+0x4029b0] 00401870: 85 D2 : test edx, edx 00401872: 75 F0 : jnz Label_00401864 00401874: EB B9 : jmp Label_0040182F Label_00401880: 00401880: 8B 15 20 50 40 00 : mov edx, [0x405020] 00401886: 85 D2 : test edx, edx 00401888: 74 06 : jz Label_00401890 0040188A: C3 : ret Label_00401890: 00401890: B8 01 00 00 00 : mov eax, 0x1 # jump_from : 00401888 00401895: A3 20 50 40 00 : mov [0x405020], eax 0040189A: EB 84 : jmp Label_00401820 end proc proc Func004018C0 Label_004018C0 attrs [[cdecl]] # call_from : 004014C0 # jump_to : 004018F2 00401910 0040196F 00401980 Label_004018C0: 004018C0: 83 EC 3C : sub esp, 0x3c 004018C3: 31 C9 : xor ecx, ecx 004018C5: 89 5C 24 2C : mov [esp+0x2c], ebx 004018C9: A1 28 30 40 00 : mov eax, [0x403028] 004018CE: 31 DB : xor ebx, ebx 004018D0: 89 74 24 30 : mov [esp+0x30], esi 004018D4: 89 7C 24 34 : mov [esp+0x34], edi 004018D8: 89 6C 24 38 : mov [esp+0x38], ebp 004018DC: 89 4C 24 10 : mov [esp+0x10], ecx 004018E0: 3D 4E E6 40 BB : cmp eax, 0xbb40e64e 004018E5: 89 5C 24 14 : mov [esp+0x14], ebx 004018E9: 74 25 : jz Label_00401910 004018EB: F7 D0 : not eax 004018ED: A3 2C 30 40 00 : mov [0x40302c], eax Label_004018F2: 004018F2: 8B 5C 24 2C : mov ebx, [esp+0x2c] # jump_from : 0040197A 004018F6: 8B 74 24 30 : mov esi, [esp+0x30] 004018FA: 8B 7C 24 34 : mov edi, [esp+0x34] 004018FE: 8B 6C 24 38 : mov ebp, [esp+0x38] 00401902: 83 C4 3C : add esp, 0x3c 00401905: C3 : ret Label_00401910: 00401910: 8D 44 24 10 : lea eax, [esp+0x10] # jump_from : 004018E9 00401914: 89 04 24 : mov [esp], eax 00401917: FF 15 70 61 40 00 : call kernel32.dll!GetSystemTimeAsFileTime 0040191D: 83 EC 04 : sub esp, 0x4 00401920: 8B 5C 24 10 : mov ebx, [esp+0x10] 00401924: 8B 44 24 14 : mov eax, [esp+0x14] 00401928: 31 C3 : xor ebx, eax 0040192A: FF 15 60 61 40 00 : call kernel32.dll!GetCurrentProcessId 00401930: 89 C5 : mov ebp, eax 00401932: FF 15 64 61 40 00 : call kernel32.dll!GetCurrentThreadId 00401938: 89 C7 : mov edi, eax 0040193A: FF 15 74 61 40 00 : call kernel32.dll!GetTickCount 00401940: 89 C6 : mov esi, eax 00401942: 8D 44 24 18 : lea eax, [esp+0x18] 00401946: 89 04 24 : mov [esp], eax 00401949: FF 15 80 61 40 00 : call kernel32.dll!QueryPerformanceCounter 0040194F: 83 EC 04 : sub esp, 0x4 00401952: 8B 44 24 18 : mov eax, [esp+0x18] 00401956: 8B 54 24 1C : mov edx, [esp+0x1c] 0040195A: 31 D8 : xor eax, ebx 0040195C: 31 D0 : xor eax, edx 0040195E: 31 E8 : xor eax, ebp 00401960: 31 F8 : xor eax, edi 00401962: 31 F0 : xor eax, esi 00401964: 3D 4E E6 40 BB : cmp eax, 0xbb40e64e 00401969: 74 15 : jz Label_00401980 0040196B: 89 C2 : mov edx, eax 0040196D: F7 D2 : not edx Label_0040196F: 0040196F: A3 28 30 40 00 : mov [0x403028], eax # jump_from : 0040198A 00401974: 89 15 2C 30 40 00 : mov [0x40302c], edx 0040197A: E9 73 FF FF FF : jmp Label_004018F2 Label_00401980: 00401980: BA B0 19 BF 44 : mov edx, 0x44bf19b0 # jump_from : 00401969 00401985: B8 4F E6 40 BB : mov eax, 0xbb40e64f 0040198A: EB E3 : jmp Label_0040196F end proc proc Func00401BF0 Label_00401BF0 attrs [[cdecl]] # call_from : 004014C0 00401C20 00401C80 00401DD0 Label_00401BF0: 00401BF0: DB E3 : fninit 00401BF2: C3 : ret end proc proc Func00401C20@4 Label_00401C20 attrs [[cdecl]][[stdcall]] # call_from : 00401C20 00401C80 00401DD0 # call_to : 00401BF0 00401C20 00401C80 004025E0 00402660 004026F0 00402850 0040287C 00402894 004028A4 004028CC 00402920 # jump_to : 00401CA0 00401CB4 00401CBC 00401D2F 00401D35 00401D3C 00401D90 00401D97 00401DB7 00401DE3 00401DF0 00401E4D 00401E58 00401E80 00401E98 00401EA7 00401EF0 00401F20 00401F31 00401F60 00401F80 00401FAC 00401FC0 00401FCC 00401FF0 00401FF5 00402010 00402045 0040204F 00402090 004020B0 004020F1 004020F8 00402130 00402132 00402140 00402157 00402170 004021B0 004021CF 004021EB Label_00401C20: 00401C20: 53 : push ebx 00401C21: 83 EC 18 : sub esp, 0x18 00401C24: C7 04 24 02 00 00 00 : mov dword [esp], 0x2 00401C2B: 8D 5C 24 24 : lea ebx, [esp+0x24] 00401C2F: E8 EC 0C 00 00 : call Func00402920@4 00401C34: BA 01 00 00 00 : mov edx, 0x1 00401C39: 89 54 24 04 : mov [esp+0x4], edx 00401C3D: C7 04 24 68 41 40 00 : mov dword [esp], 0x404168 00401C44: 89 44 24 0C : mov [esp+0xc], eax 00401C48: B8 1B 00 00 00 : mov eax, 0x1b 00401C4D: 89 44 24 08 : mov [esp+0x8], eax 00401C51: E8 4E 0C 00 00 : call msvcrt.dll!fwrite@4 00401C56: C7 04 24 02 00 00 00 : mov dword [esp], 0x2 00401C5D: E8 BE 0C 00 00 : call Func00402920@4 00401C62: 8B 54 24 20 : mov edx, [esp+0x20] 00401C66: 89 5C 24 08 : mov [esp+0x8], ebx 00401C6A: 89 54 24 04 : mov [esp+0x4], edx 00401C6E: 89 04 24 : mov [esp], eax 00401C71: E8 06 0C 00 00 : call msvcrt.dll!vfprintf@4 00401C76: E8 51 0C 00 00 : call msvcrt.dll!abort@4 00401C7B: 8D 74 26 00 : lea esi, [esi] 00401C7F: 90 : nop 00401C80: 57 : push edi 00401C81: 56 : push esi 00401C82: 53 : push ebx 00401C83: 83 EC 30 : sub esp, 0x30 00401C86: 8B 35 A0 53 40 00 : mov esi, [0x4053a0] 00401C8C: 85 F6 : test esi, esi 00401C8E: 0F 8E FC 00 00 00 : jle Label_00401D90 00401C94: 8B 3D A4 53 40 00 : mov edi, [0x4053a4] 00401C9A: 31 DB : xor ebx, ebx 00401C9C: 8D 57 0C : lea edx, [edi+0xc] 00401C9F: 90 : nop Label_00401CA0: 00401CA0: 8B 0A : mov ecx, [edx] # jump_from : 00401CBA 00401CA2: 39 C1 : cmp ecx, eax 00401CA4: 77 0E : ja Label_00401CB4 00401CA6: 8B 7A 04 : mov edi, [edx+0x4] 00401CA9: 03 4F 08 : add ecx, [edi+0x8] 00401CAC: 39 C8 : cmp eax, ecx 00401CAE: 0F 82 81 00 00 00 : jb Label_00401D35 Label_00401CB4: 00401CB4: 43 : inc ebx # jump_from : 00401CA4 00401CB5: 83 C2 14 : add edx, 0x14 00401CB8: 39 F3 : cmp ebx, esi 00401CBA: 75 E4 : jnz Label_00401CA0 Label_00401CBC: 00401CBC: 89 04 24 : mov [esp], eax # jump_from : 00401D92 00401CBF: 89 C3 : mov ebx, eax 00401CC1: E8 1A 09 00 00 : call Func004025E0@4 00401CC6: 85 C0 : test eax, eax 00401CC8: 89 C7 : mov edi, eax 00401CCA: 0F 84 E7 00 00 00 : jz Label_00401DB7 00401CD0: A1 A4 53 40 00 : mov eax, [0x4053a4] 00401CD5: 8D 1C B6 : lea ebx, [esi+esi*4] 00401CD8: C1 E3 02 : shl ebx, 0x2 00401CDB: 01 D8 : add eax, ebx 00401CDD: 89 78 10 : mov [eax+0x10], edi 00401CE0: C7 00 00 00 00 00 : mov dword [eax], 0x0 00401CE6: E8 05 0A 00 00 : call Func004026F0@4 00401CEB: 8B 77 0C : mov esi, [edi+0xc] 00401CEE: 8B 15 A4 53 40 00 : mov edx, [0x4053a4] 00401CF4: 01 F0 : add eax, esi 00401CF6: 89 44 1A 0C : mov [edx+ebx+0xc], eax 00401CFA: BA 1C 00 00 00 : mov edx, 0x1c 00401CFF: 89 54 24 08 : mov [esp+0x8], edx 00401D03: 8D 54 24 14 : lea edx, [esp+0x14] 00401D07: 89 54 24 04 : mov [esp+0x4], edx 00401D0B: 89 04 24 : mov [esp], eax 00401D0E: FF 15 9C 61 40 00 : call kernel32.dll!VirtualQuery 00401D14: 83 EC 0C : sub esp, 0xc 00401D17: 85 C0 : test eax, eax 00401D19: 74 7C : jz Label_00401D97 00401D1B: 8B 44 24 28 : mov eax, [esp+0x28] 00401D1F: 8D 50 C0 : lea edx, [eax-0x40] 00401D22: 83 E2 BF : and edx, 0xffffffbf 00401D25: 74 08 : jz Label_00401D2F 00401D27: 83 E8 04 : sub eax, 0x4 00401D2A: 83 E0 FB : and eax, 0xfffffffb 00401D2D: 75 0D : jnz Label_00401D3C Label_00401D2F: 00401D2F: FF 05 A0 53 40 00 : inc dword [0x4053a0] # jump_from : 00401D25 00401D70 Label_00401D35: 00401D35: 83 C4 30 : add esp, 0x30 # jump_from : 00401CAE 00401D38: 5B : pop ebx 00401D39: 5E : pop esi 00401D3A: 5F : pop edi 00401D3B: C3 : ret Label_00401D3C: 00401D3C: A1 A4 53 40 00 : mov eax, [0x4053a4] # jump_from : 00401D2D 00401D41: B9 40 00 00 00 : mov ecx, 0x40 00401D46: 8B 54 24 20 : mov edx, [esp+0x20] 00401D4A: 01 C3 : add ebx, eax 00401D4C: 8B 44 24 14 : mov eax, [esp+0x14] 00401D50: 89 53 08 : mov [ebx+0x8], edx 00401D53: 89 43 04 : mov [ebx+0x4], eax 00401D56: 89 5C 24 0C : mov [esp+0xc], ebx 00401D5A: 89 4C 24 08 : mov [esp+0x8], ecx 00401D5E: 89 54 24 04 : mov [esp+0x4], edx 00401D62: 89 04 24 : mov [esp], eax 00401D65: FF 15 98 61 40 00 : call kernel32.dll!VirtualProtect 00401D6B: 83 EC 10 : sub esp, 0x10 00401D6E: 85 C0 : test eax, eax 00401D70: 75 BD : jnz Label_00401D2F 00401D72: FF 15 68 61 40 00 : call kernel32.dll!GetLastError 00401D78: C7 04 24 D8 41 40 00 : mov dword [esp], 0x4041d8 00401D7F: 89 44 24 04 : mov [esp+0x4], eax 00401D83: E8 98 FE FF FF : call Func00401C20@4 00401D88: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401D8F: 90 : nop Label_00401D90: 00401D90: 31 F6 : xor esi, esi # jump_from : 00401C8E 00401D92: E9 25 FF FF FF : jmp Label_00401CBC Label_00401D97: 00401D97: A1 A4 53 40 00 : mov eax, [0x4053a4] # jump_from : 00401D19 00401D9C: 8B 44 18 0C : mov eax, [eax+ebx+0xc] 00401DA0: 89 44 24 08 : mov [esp+0x8], eax 00401DA4: 8B 47 08 : mov eax, [edi+0x8] 00401DA7: C7 04 24 A4 41 40 00 : mov dword [esp], 0x4041a4 00401DAE: 89 44 24 04 : mov [esp+0x4], eax 00401DB2: E8 69 FE FF FF : call Func00401C20@4 Label_00401DB7: 00401DB7: 89 5C 24 04 : mov [esp+0x4], ebx # jump_from : 00401CCA 00401DBB: C7 04 24 84 41 40 00 : mov dword [esp], 0x404184 00401DC2: E8 59 FE FF FF : call Func00401C20@4 00401DC7: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401DCE: 66 90 : nop 00401DD0: 55 : push ebp 00401DD1: 89 E5 : mov ebp, esp 00401DD3: 57 : push edi 00401DD4: 56 : push esi 00401DD5: 53 : push ebx 00401DD6: 83 EC 3C : sub esp, 0x3c 00401DD9: 8B 35 9C 53 40 00 : mov esi, [0x40539c] 00401DDF: 85 F6 : test esi, esi 00401DE1: 74 0D : jz Label_00401DF0 Label_00401DE3: 00401DE3: 8D 65 F4 : lea esp, [ebp-0xc] # jump_from : 00401E37 00401E77 00401F68 00401FFB 00401DE6: 5B : pop ebx 00401DE7: 5E : pop esi 00401DE8: 5F : pop edi 00401DE9: 5D : pop ebp 00401DEA: C3 : ret Label_00401DF0: 00401DF0: BF 01 00 00 00 : mov edi, 0x1 # jump_from : 00401DE1 00401DF5: 89 3D 9C 53 40 00 : mov [0x40539c], edi 00401DFB: E8 60 08 00 00 : call Func00402660@4 00401E00: 8D 04 80 : lea eax, [eax+eax*4] 00401E03: 8D 04 85 1B 00 00 00 : lea eax, [eax*4+0x1b] 00401E0A: C1 E8 04 : shr eax, 0x4 00401E0D: C1 E0 04 : shl eax, 0x4 00401E10: E8 3B 0A 00 00 : call Func00402850@4 00401E15: 29 C4 : sub esp, eax 00401E17: 8D 44 24 1F : lea eax, [esp+0x1f] 00401E1B: 83 E0 F0 : and eax, 0xfffffff0 00401E1E: A3 A4 53 40 00 : mov [0x4053a4], eax 00401E23: 31 C0 : xor eax, eax 00401E25: A3 A0 53 40 00 : mov [0x4053a0], eax 00401E2A: B8 70 45 40 00 : mov eax, 0x404570 00401E2F: 2D 70 45 40 00 : sub eax, 0x404570 00401E34: 83 F8 07 : cmp eax, 0x7 00401E37: 7E AA : jle Label_00401DE3 00401E39: 83 F8 0B : cmp eax, 0xb 00401E3C: 8B 15 70 45 40 00 : mov edx, [0x404570] 00401E42: 0F 8F A8 00 00 00 : jg Label_00401EF0 00401E48: BB 70 45 40 00 : mov ebx, 0x404570 Label_00401E4D: 00401E4D: 85 D2 : test edx, edx # jump_from : 00401F16 00401E4F: 0F 85 A0 01 00 00 : jnz Label_00401FF5 00401E55: 8B 43 04 : mov eax, [ebx+0x4] Label_00401E58: 00401E58: 85 C0 : test eax, eax # jump_from : 0040204A 00401E5A: 0F 85 95 01 00 00 : jnz Label_00401FF5 00401E60: 8B 43 08 : mov eax, [ebx+0x8] 00401E63: 83 F8 01 : cmp eax, 0x1 00401E66: 0F 85 E3 01 00 00 : jnz Label_0040204F 00401E6C: 83 C3 0C : add ebx, 0xc 00401E6F: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401E75: 72 30 : jb Label_00401EA7 00401E77: E9 67 FF FF FF : jmp Label_00401DE3 Label_00401E80: 00401E80: 8B 45 D4 : mov eax, [ebp-0x2c] # jump_from : 00401ECD 00401E83: 29 C2 : sub edx, eax 00401E85: 8B 07 : mov eax, [edi] 00401E87: 01 C2 : add edx, eax 00401E89: 89 F8 : mov eax, edi 00401E8B: 89 55 D4 : mov [ebp-0x2c], edx 00401E8E: E8 ED FD FF FF : call Func00401C80@4 00401E93: 8B 55 D4 : mov edx, [ebp-0x2c] 00401E96: 89 17 : mov [edi], edx Label_00401E98: 00401E98: 83 C3 0C : add ebx, 0xc # jump_from : 00401FE3 00401E9B: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401EA1: 0F 83 B9 00 00 00 : jae Label_00401F60 Label_00401EA7: 00401EA7: 8B 03 : mov eax, [ebx] # jump_from : 00401E75 00401F51 00401EA9: 8B 4B 04 : mov ecx, [ebx+0x4] 00401EAC: 8D 90 00 00 40 00 : lea edx, [eax+0x400000] 00401EB2: 89 55 D4 : mov [ebp-0x2c], edx 00401EB5: 8B 90 00 00 40 00 : mov edx, [eax+0x400000] 00401EBB: 8D B9 00 00 40 00 : lea edi, [ecx+0x400000] 00401EC1: 0F B6 43 08 : movzx eax, byte [ebx+0x8] 00401EC5: 83 F8 10 : cmp eax, 0x10 00401EC8: 74 56 : jz Label_00401F20 00401ECA: 83 F8 20 : cmp eax, 0x20 00401ECD: 74 B1 : jz Label_00401E80 00401ECF: 83 F8 08 : cmp eax, 0x8 00401ED2: 0F 84 E8 00 00 00 : jz Label_00401FC0 00401ED8: 89 44 24 04 : mov [esp+0x4], eax 00401EDC: C7 04 24 34 42 40 00 : mov dword [esp], 0x404234 00401EE3: E8 38 FD FF FF : call Func00401C20@4 00401EE8: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401EEF: 90 : nop Label_00401EF0: 00401EF0: 85 D2 : test edx, edx # jump_from : 00401E42 00401EF2: 0F 85 F8 00 00 00 : jnz Label_00401FF0 00401EF8: A1 74 45 40 00 : mov eax, [0x404574] 00401EFD: 89 C1 : mov ecx, eax 00401EFF: 0B 0D 78 45 40 00 : or ecx, [0x404578] 00401F05: 0F 85 3A 01 00 00 : jnz Label_00402045 00401F0B: 8B 15 7C 45 40 00 : mov edx, [0x40457c] 00401F11: BB 7C 45 40 00 : mov ebx, 0x40457c 00401F16: E9 32 FF FF FF : jmp Label_00401E4D Label_00401F20: 00401F20: 0F B7 81 00 00 40 00 : movzx eax, word [ecx+0x400000] # jump_from : 00401EC8 00401F27: F6 C4 80 : test ah, 0x80 00401F2A: 74 05 : jz Label_00401F31 00401F2C: 0D 00 00 FF FF : or eax, 0xffff0000 Label_00401F31: 00401F31: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401F2A 00401F34: 83 C3 0C : add ebx, 0xc 00401F37: 29 C8 : sub eax, ecx 00401F39: 01 D0 : add eax, edx 00401F3B: 89 45 D4 : mov [ebp-0x2c], eax 00401F3E: 89 F8 : mov eax, edi 00401F40: E8 3B FD FF FF : call Func00401C80@4 00401F45: 8B 45 D4 : mov eax, [ebp-0x2c] 00401F48: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401F4E: 66 89 07 : mov [edi], ax 00401F51: 0F 82 50 FF FF FF : jb Label_00401EA7 00401F57: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F5E: 66 90 : nop Label_00401F60: 00401F60: 8B 1D A0 53 40 00 : mov ebx, [0x4053a0] # jump_from : 00401EA1 00402040 00401F66: 85 DB : test ebx, ebx 00401F68: 0F 8E 75 FE FF FF : jle Label_00401DE3 00401F6E: 8B 1D 98 61 40 00 : mov ebx, [0x406198] 00401F74: 8D 7D E4 : lea edi, [ebp-0x1c] 00401F77: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F7E: 66 90 : nop Label_00401F80: 00401F80: 8B 15 A4 53 40 00 : mov edx, [0x4053a4] # jump_from : 00401FB3 00401F86: 8D 04 B6 : lea eax, [esi+esi*4] 00401F89: 8D 04 82 : lea eax, [edx+eax*4] 00401F8C: 8B 10 : mov edx, [eax] 00401F8E: 85 D2 : test edx, edx 00401F90: 74 1A : jz Label_00401FAC 00401F92: 89 7C 24 0C : mov [esp+0xc], edi 00401F96: 89 54 24 08 : mov [esp+0x8], edx 00401F9A: 8B 50 08 : mov edx, [eax+0x8] 00401F9D: 89 54 24 04 : mov [esp+0x4], edx 00401FA1: 8B 40 04 : mov eax, [eax+0x4] 00401FA4: 89 04 24 : mov [esp], eax 00401FA7: FF D3 : call ebx 00401FA9: 83 EC 10 : sub esp, 0x10 Label_00401FAC: 00401FAC: 46 : inc esi # jump_from : 00401F90 00401FAD: 3B 35 A0 53 40 00 : cmp esi, [0x4053a0] 00401FB3: 7C CB : jl Label_00401F80 00401FB5: 8D 65 F4 : lea esp, [ebp-0xc] 00401FB8: 5B : pop ebx 00401FB9: 5E : pop esi 00401FBA: 5F : pop edi 00401FBB: 5D : pop ebp 00401FBC: C3 : ret Label_00401FC0: 00401FC0: 0F B6 07 : movzx eax, byte [edi] # jump_from : 00401ED2 00401FC3: 84 C0 : test al, al 00401FC5: 79 05 : jns Label_00401FCC 00401FC7: 0D 00 FF FF FF : or eax, 0xffffff00 Label_00401FCC: 00401FCC: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401FC5 00401FCF: 29 C8 : sub eax, ecx 00401FD1: 01 D0 : add eax, edx 00401FD3: 89 45 D4 : mov [ebp-0x2c], eax 00401FD6: 89 F8 : mov eax, edi 00401FD8: E8 A3 FC FF FF : call Func00401C80@4 00401FDD: 0F B6 45 D4 : movzx eax, byte [ebp-0x2c] 00401FE1: 88 07 : mov [edi], al 00401FE3: E9 B0 FE FF FF : jmp Label_00401E98 Label_00401FF0: 00401FF0: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401EF2 Label_00401FF5: 00401FF5: 81 FB 70 45 40 00 : cmp ebx, 0x404570 # jump_from : 00401E4F 00401E5A 00401FFB: 0F 83 E2 FD FF FF : jae Label_00401DE3 00402001: 8D B4 26 00 00 00 00 : lea esi, [esi] 00402008: 8D B4 26 00 00 00 00 : lea esi, [esi] 0040200F: 90 : nop Label_00402010: 00402010: 8B 7B 04 : mov edi, [ebx+0x4] # jump_from : 0040203E 00402013: 83 C3 08 : add ebx, 0x8 00402016: 8B 53 F8 : mov edx, [ebx-0x8] 00402019: 8B 8F 00 00 40 00 : mov ecx, [edi+0x400000] 0040201F: 8D 87 00 00 40 00 : lea eax, [edi+0x400000] 00402025: 01 CA : add edx, ecx 00402027: 89 55 D4 : mov [ebp-0x2c], edx 0040202A: E8 51 FC FF FF : call Func00401C80@4 0040202F: 8B 55 D4 : mov edx, [ebp-0x2c] 00402032: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00402038: 89 97 00 00 40 00 : mov [edi+0x400000], edx 0040203E: 72 D0 : jb Label_00402010 00402040: E9 1B FF FF FF : jmp Label_00401F60 Label_00402045: 00402045: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401F05 0040204A: E9 09 FE FF FF : jmp Label_00401E58 Label_0040204F: 0040204F: 89 44 24 04 : mov [esp+0x4], eax # jump_from : 00401E66 00402053: C7 04 24 00 42 40 00 : mov dword [esp], 0x404200 0040205A: E8 C1 FB FF FF : call Func00401C20@4 0040205F: 90 : nop 00402060: 53 : push ebx 00402061: 83 EC 18 : sub esp, 0x18 00402064: 8B 5C 24 20 : mov ebx, [esp+0x20] 00402068: 8B 03 : mov eax, [ebx] 0040206A: 8B 00 : mov eax, [eax] 0040206C: 3D 91 00 00 C0 : cmp eax, 0xc0000091 00402071: 76 3D : jbe Label_004020B0 00402073: 3D 94 00 00 C0 : cmp eax, 0xc0000094 00402078: 0F 84 C2 00 00 00 : jz Label_00402140 0040207E: 3D 96 00 00 C0 : cmp eax, 0xc0000096 00402083: 74 73 : jz Label_004020F8 00402085: 3D 93 00 00 C0 : cmp eax, 0xc0000093 0040208A: 0F 84 E0 00 00 00 : jz Label_00402170 Label_00402090: 00402090: A1 AC 53 40 00 : mov eax, [0x4053ac] # jump_from : 004020DF 004020F6 00402115 00402159 00402095: 85 C0 : test eax, eax 00402097: 0F 84 93 00 00 00 : jz Label_00402130 0040209D: 89 5C 24 20 : mov [esp+0x20], ebx 004020A1: 83 C4 18 : add esp, 0x18 004020A4: 5B : pop ebx 004020A5: FF E0 : jmp eax Label_004020B0: 004020B0: 3D 8D 00 00 C0 : cmp eax, 0xc000008d # jump_from : 00402071 004020B5: 0F 83 B5 00 00 00 : jae Label_00402170 004020BB: 3D 05 00 00 C0 : cmp eax, 0xc0000005 004020C0: 75 2F : jnz Label_004020F1 004020C2: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020C9: 31 C0 : xor eax, eax 004020CB: 89 44 24 04 : mov [esp+0x4], eax 004020CF: E8 C0 07 00 00 : call msvcrt.dll!signal@4 004020D4: 83 F8 01 : cmp eax, 0x1 004020D7: 0F 84 0E 01 00 00 : jz Label_004021EB 004020DD: 85 C0 : test eax, eax 004020DF: 74 AF : jz Label_00402090 004020E1: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020E8: FF D0 : call eax 004020EA: B8 FF FF FF FF : mov eax, 0xffffffff 004020EF: EB 41 : jmp Label_00402132 Label_004020F1: 004020F1: 3D 1D 00 00 C0 : cmp eax, 0xc000001d # jump_from : 004020C0 004020F6: 75 98 : jnz Label_00402090 Label_004020F8: 004020F8: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 # jump_from : 00402083 004020FF: 31 C0 : xor eax, eax 00402101: 89 44 24 04 : mov [esp+0x4], eax 00402105: E8 8A 07 00 00 : call msvcrt.dll!signal@4 0040210A: 83 F8 01 : cmp eax, 0x1 0040210D: 0F 84 BC 00 00 00 : jz Label_004021CF 00402113: 85 C0 : test eax, eax 00402115: 0F 84 75 FF FF FF : jz Label_00402090 0040211B: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 00402122: FF D0 : call eax 00402124: B8 FF FF FF FF : mov eax, 0xffffffff 00402129: EB 07 : jmp Label_00402132 Label_00402130: 00402130: 31 C0 : xor eax, eax # jump_from : 00402097 Label_00402132: 00402132: 83 C4 18 : add esp, 0x18 # jump_from : 004020EF 00402129 0040216D 004021A6 004021CA 004021E6 00402202 00402135: 5B : pop ebx 00402136: C2 04 00 : ret 0x4 Label_00402140: 00402140: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402078 00402147: 31 C0 : xor eax, eax 00402149: 89 44 24 04 : mov [esp+0x4], eax 0040214D: E8 42 07 00 00 : call msvcrt.dll!signal@4 00402152: 83 F8 01 : cmp eax, 0x1 00402155: 74 59 : jz Label_004021B0 Label_00402157: 00402157: 85 C0 : test eax, eax # jump_from : 00402185 00402159: 0F 84 31 FF FF FF : jz Label_00402090 0040215F: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 00402166: FF D0 : call eax 00402168: B8 FF FF FF FF : mov eax, 0xffffffff 0040216D: EB C3 : jmp Label_00402132 Label_00402170: 00402170: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 0040208A 004020B5 00402177: 31 C0 : xor eax, eax 00402179: 89 44 24 04 : mov [esp+0x4], eax 0040217D: E8 12 07 00 00 : call msvcrt.dll!signal@4 00402182: 83 F8 01 : cmp eax, 0x1 00402185: 75 D0 : jnz Label_00402157 00402187: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 0040218E: BA 01 00 00 00 : mov edx, 0x1 00402193: 89 54 24 04 : mov [esp+0x4], edx 00402197: E8 F8 06 00 00 : call msvcrt.dll!signal@4 0040219C: E8 4F FA FF FF : call Func00401BF0@4 004021A1: B8 FF FF FF FF : mov eax, 0xffffffff 004021A6: EB 8A : jmp Label_00402132 Label_004021B0: 004021B0: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402155 004021B7: B9 01 00 00 00 : mov ecx, 0x1 004021BC: 89 4C 24 04 : mov [esp+0x4], ecx 004021C0: E8 CF 06 00 00 : call msvcrt.dll!signal@4 004021C5: B8 FF FF FF FF : mov eax, 0xffffffff 004021CA: E9 63 FF FF FF : jmp Label_00402132 Label_004021CF: 004021CF: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 0040210D 004021D7: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 004021DE: E8 B1 06 00 00 : call msvcrt.dll!signal@4 004021E3: 83 C8 FF : or eax, 0xffffffff 004021E6: E9 47 FF FF FF : jmp Label_00402132 Label_004021EB: 004021EB: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 004020D7 004021F3: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004021FA: E8 95 06 00 00 : call msvcrt.dll!signal@4 004021FF: 83 C8 FF : or eax, 0xffffffff 00402202: E9 2B FF FF FF : jmp Label_00402132 end proc proc Func00401C80@4 Label_00401C80 attrs [[cdecl]][[stdcall]] # call_from : 00401C20 00401C80 00401DD0 # call_to : 00401BF0 00401C20 00401C80 004025E0 00402660 004026F0 00402850 00402894 # jump_to : 00401CA0 00401CB4 00401CBC 00401D2F 00401D35 00401D3C 00401D90 00401D97 00401DB7 00401DE3 00401DF0 00401E4D 00401E58 00401E80 00401E98 00401EA7 00401EF0 00401F20 00401F31 00401F60 00401F80 00401FAC 00401FC0 00401FCC 00401FF0 00401FF5 00402010 00402045 0040204F 00402090 004020B0 004020F1 004020F8 00402130 00402132 00402140 00402157 00402170 004021B0 004021CF 004021EB Label_00401C80: 00401C80: 57 : push edi 00401C81: 56 : push esi 00401C82: 53 : push ebx 00401C83: 83 EC 30 : sub esp, 0x30 00401C86: 8B 35 A0 53 40 00 : mov esi, [0x4053a0] 00401C8C: 85 F6 : test esi, esi 00401C8E: 0F 8E FC 00 00 00 : jle Label_00401D90 00401C94: 8B 3D A4 53 40 00 : mov edi, [0x4053a4] 00401C9A: 31 DB : xor ebx, ebx 00401C9C: 8D 57 0C : lea edx, [edi+0xc] 00401C9F: 90 : nop Label_00401CA0: 00401CA0: 8B 0A : mov ecx, [edx] # jump_from : 00401CBA 00401CA2: 39 C1 : cmp ecx, eax 00401CA4: 77 0E : ja Label_00401CB4 00401CA6: 8B 7A 04 : mov edi, [edx+0x4] 00401CA9: 03 4F 08 : add ecx, [edi+0x8] 00401CAC: 39 C8 : cmp eax, ecx 00401CAE: 0F 82 81 00 00 00 : jb Label_00401D35 Label_00401CB4: 00401CB4: 43 : inc ebx # jump_from : 00401CA4 00401CB5: 83 C2 14 : add edx, 0x14 00401CB8: 39 F3 : cmp ebx, esi 00401CBA: 75 E4 : jnz Label_00401CA0 Label_00401CBC: 00401CBC: 89 04 24 : mov [esp], eax # jump_from : 00401D92 00401CBF: 89 C3 : mov ebx, eax 00401CC1: E8 1A 09 00 00 : call Func004025E0@4 00401CC6: 85 C0 : test eax, eax 00401CC8: 89 C7 : mov edi, eax 00401CCA: 0F 84 E7 00 00 00 : jz Label_00401DB7 00401CD0: A1 A4 53 40 00 : mov eax, [0x4053a4] 00401CD5: 8D 1C B6 : lea ebx, [esi+esi*4] 00401CD8: C1 E3 02 : shl ebx, 0x2 00401CDB: 01 D8 : add eax, ebx 00401CDD: 89 78 10 : mov [eax+0x10], edi 00401CE0: C7 00 00 00 00 00 : mov dword [eax], 0x0 00401CE6: E8 05 0A 00 00 : call Func004026F0@4 00401CEB: 8B 77 0C : mov esi, [edi+0xc] 00401CEE: 8B 15 A4 53 40 00 : mov edx, [0x4053a4] 00401CF4: 01 F0 : add eax, esi 00401CF6: 89 44 1A 0C : mov [edx+ebx+0xc], eax 00401CFA: BA 1C 00 00 00 : mov edx, 0x1c 00401CFF: 89 54 24 08 : mov [esp+0x8], edx 00401D03: 8D 54 24 14 : lea edx, [esp+0x14] 00401D07: 89 54 24 04 : mov [esp+0x4], edx 00401D0B: 89 04 24 : mov [esp], eax 00401D0E: FF 15 9C 61 40 00 : call kernel32.dll!VirtualQuery 00401D14: 83 EC 0C : sub esp, 0xc 00401D17: 85 C0 : test eax, eax 00401D19: 74 7C : jz Label_00401D97 00401D1B: 8B 44 24 28 : mov eax, [esp+0x28] 00401D1F: 8D 50 C0 : lea edx, [eax-0x40] 00401D22: 83 E2 BF : and edx, 0xffffffbf 00401D25: 74 08 : jz Label_00401D2F 00401D27: 83 E8 04 : sub eax, 0x4 00401D2A: 83 E0 FB : and eax, 0xfffffffb 00401D2D: 75 0D : jnz Label_00401D3C Label_00401D2F: 00401D2F: FF 05 A0 53 40 00 : inc dword [0x4053a0] # jump_from : 00401D25 00401D70 Label_00401D35: 00401D35: 83 C4 30 : add esp, 0x30 # jump_from : 00401CAE 00401D38: 5B : pop ebx 00401D39: 5E : pop esi 00401D3A: 5F : pop edi 00401D3B: C3 : ret Label_00401D3C: 00401D3C: A1 A4 53 40 00 : mov eax, [0x4053a4] # jump_from : 00401D2D 00401D41: B9 40 00 00 00 : mov ecx, 0x40 00401D46: 8B 54 24 20 : mov edx, [esp+0x20] 00401D4A: 01 C3 : add ebx, eax 00401D4C: 8B 44 24 14 : mov eax, [esp+0x14] 00401D50: 89 53 08 : mov [ebx+0x8], edx 00401D53: 89 43 04 : mov [ebx+0x4], eax 00401D56: 89 5C 24 0C : mov [esp+0xc], ebx 00401D5A: 89 4C 24 08 : mov [esp+0x8], ecx 00401D5E: 89 54 24 04 : mov [esp+0x4], edx 00401D62: 89 04 24 : mov [esp], eax 00401D65: FF 15 98 61 40 00 : call kernel32.dll!VirtualProtect 00401D6B: 83 EC 10 : sub esp, 0x10 00401D6E: 85 C0 : test eax, eax 00401D70: 75 BD : jnz Label_00401D2F 00401D72: FF 15 68 61 40 00 : call kernel32.dll!GetLastError 00401D78: C7 04 24 D8 41 40 00 : mov dword [esp], 0x4041d8 00401D7F: 89 44 24 04 : mov [esp+0x4], eax 00401D83: E8 98 FE FF FF : call Func00401C20@4 00401D88: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401D8F: 90 : nop Label_00401D90: 00401D90: 31 F6 : xor esi, esi # jump_from : 00401C8E 00401D92: E9 25 FF FF FF : jmp Label_00401CBC Label_00401D97: 00401D97: A1 A4 53 40 00 : mov eax, [0x4053a4] # jump_from : 00401D19 00401D9C: 8B 44 18 0C : mov eax, [eax+ebx+0xc] 00401DA0: 89 44 24 08 : mov [esp+0x8], eax 00401DA4: 8B 47 08 : mov eax, [edi+0x8] 00401DA7: C7 04 24 A4 41 40 00 : mov dword [esp], 0x4041a4 00401DAE: 89 44 24 04 : mov [esp+0x4], eax 00401DB2: E8 69 FE FF FF : call Func00401C20@4 Label_00401DB7: 00401DB7: 89 5C 24 04 : mov [esp+0x4], ebx # jump_from : 00401CCA 00401DBB: C7 04 24 84 41 40 00 : mov dword [esp], 0x404184 00401DC2: E8 59 FE FF FF : call Func00401C20@4 00401DC7: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401DCE: 66 90 : nop 00401DD0: 55 : push ebp 00401DD1: 89 E5 : mov ebp, esp 00401DD3: 57 : push edi 00401DD4: 56 : push esi 00401DD5: 53 : push ebx 00401DD6: 83 EC 3C : sub esp, 0x3c 00401DD9: 8B 35 9C 53 40 00 : mov esi, [0x40539c] 00401DDF: 85 F6 : test esi, esi 00401DE1: 74 0D : jz Label_00401DF0 Label_00401DE3: 00401DE3: 8D 65 F4 : lea esp, [ebp-0xc] # jump_from : 00401E37 00401E77 00401F68 00401FFB 00401DE6: 5B : pop ebx 00401DE7: 5E : pop esi 00401DE8: 5F : pop edi 00401DE9: 5D : pop ebp 00401DEA: C3 : ret Label_00401DF0: 00401DF0: BF 01 00 00 00 : mov edi, 0x1 # jump_from : 00401DE1 00401DF5: 89 3D 9C 53 40 00 : mov [0x40539c], edi 00401DFB: E8 60 08 00 00 : call Func00402660@4 00401E00: 8D 04 80 : lea eax, [eax+eax*4] 00401E03: 8D 04 85 1B 00 00 00 : lea eax, [eax*4+0x1b] 00401E0A: C1 E8 04 : shr eax, 0x4 00401E0D: C1 E0 04 : shl eax, 0x4 00401E10: E8 3B 0A 00 00 : call Func00402850@4 00401E15: 29 C4 : sub esp, eax 00401E17: 8D 44 24 1F : lea eax, [esp+0x1f] 00401E1B: 83 E0 F0 : and eax, 0xfffffff0 00401E1E: A3 A4 53 40 00 : mov [0x4053a4], eax 00401E23: 31 C0 : xor eax, eax 00401E25: A3 A0 53 40 00 : mov [0x4053a0], eax 00401E2A: B8 70 45 40 00 : mov eax, 0x404570 00401E2F: 2D 70 45 40 00 : sub eax, 0x404570 00401E34: 83 F8 07 : cmp eax, 0x7 00401E37: 7E AA : jle Label_00401DE3 00401E39: 83 F8 0B : cmp eax, 0xb 00401E3C: 8B 15 70 45 40 00 : mov edx, [0x404570] 00401E42: 0F 8F A8 00 00 00 : jg Label_00401EF0 00401E48: BB 70 45 40 00 : mov ebx, 0x404570 Label_00401E4D: 00401E4D: 85 D2 : test edx, edx # jump_from : 00401F16 00401E4F: 0F 85 A0 01 00 00 : jnz Label_00401FF5 00401E55: 8B 43 04 : mov eax, [ebx+0x4] Label_00401E58: 00401E58: 85 C0 : test eax, eax # jump_from : 0040204A 00401E5A: 0F 85 95 01 00 00 : jnz Label_00401FF5 00401E60: 8B 43 08 : mov eax, [ebx+0x8] 00401E63: 83 F8 01 : cmp eax, 0x1 00401E66: 0F 85 E3 01 00 00 : jnz Label_0040204F 00401E6C: 83 C3 0C : add ebx, 0xc 00401E6F: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401E75: 72 30 : jb Label_00401EA7 00401E77: E9 67 FF FF FF : jmp Label_00401DE3 Label_00401E80: 00401E80: 8B 45 D4 : mov eax, [ebp-0x2c] # jump_from : 00401ECD 00401E83: 29 C2 : sub edx, eax 00401E85: 8B 07 : mov eax, [edi] 00401E87: 01 C2 : add edx, eax 00401E89: 89 F8 : mov eax, edi 00401E8B: 89 55 D4 : mov [ebp-0x2c], edx 00401E8E: E8 ED FD FF FF : call Func00401C80@4 00401E93: 8B 55 D4 : mov edx, [ebp-0x2c] 00401E96: 89 17 : mov [edi], edx Label_00401E98: 00401E98: 83 C3 0C : add ebx, 0xc # jump_from : 00401FE3 00401E9B: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401EA1: 0F 83 B9 00 00 00 : jae Label_00401F60 Label_00401EA7: 00401EA7: 8B 03 : mov eax, [ebx] # jump_from : 00401E75 00401F51 00401EA9: 8B 4B 04 : mov ecx, [ebx+0x4] 00401EAC: 8D 90 00 00 40 00 : lea edx, [eax+0x400000] 00401EB2: 89 55 D4 : mov [ebp-0x2c], edx 00401EB5: 8B 90 00 00 40 00 : mov edx, [eax+0x400000] 00401EBB: 8D B9 00 00 40 00 : lea edi, [ecx+0x400000] 00401EC1: 0F B6 43 08 : movzx eax, byte [ebx+0x8] 00401EC5: 83 F8 10 : cmp eax, 0x10 00401EC8: 74 56 : jz Label_00401F20 00401ECA: 83 F8 20 : cmp eax, 0x20 00401ECD: 74 B1 : jz Label_00401E80 00401ECF: 83 F8 08 : cmp eax, 0x8 00401ED2: 0F 84 E8 00 00 00 : jz Label_00401FC0 00401ED8: 89 44 24 04 : mov [esp+0x4], eax 00401EDC: C7 04 24 34 42 40 00 : mov dword [esp], 0x404234 00401EE3: E8 38 FD FF FF : call Func00401C20@4 00401EE8: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401EEF: 90 : nop Label_00401EF0: 00401EF0: 85 D2 : test edx, edx # jump_from : 00401E42 00401EF2: 0F 85 F8 00 00 00 : jnz Label_00401FF0 00401EF8: A1 74 45 40 00 : mov eax, [0x404574] 00401EFD: 89 C1 : mov ecx, eax 00401EFF: 0B 0D 78 45 40 00 : or ecx, [0x404578] 00401F05: 0F 85 3A 01 00 00 : jnz Label_00402045 00401F0B: 8B 15 7C 45 40 00 : mov edx, [0x40457c] 00401F11: BB 7C 45 40 00 : mov ebx, 0x40457c 00401F16: E9 32 FF FF FF : jmp Label_00401E4D Label_00401F20: 00401F20: 0F B7 81 00 00 40 00 : movzx eax, word [ecx+0x400000] # jump_from : 00401EC8 00401F27: F6 C4 80 : test ah, 0x80 00401F2A: 74 05 : jz Label_00401F31 00401F2C: 0D 00 00 FF FF : or eax, 0xffff0000 Label_00401F31: 00401F31: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401F2A 00401F34: 83 C3 0C : add ebx, 0xc 00401F37: 29 C8 : sub eax, ecx 00401F39: 01 D0 : add eax, edx 00401F3B: 89 45 D4 : mov [ebp-0x2c], eax 00401F3E: 89 F8 : mov eax, edi 00401F40: E8 3B FD FF FF : call Func00401C80@4 00401F45: 8B 45 D4 : mov eax, [ebp-0x2c] 00401F48: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401F4E: 66 89 07 : mov [edi], ax 00401F51: 0F 82 50 FF FF FF : jb Label_00401EA7 00401F57: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F5E: 66 90 : nop Label_00401F60: 00401F60: 8B 1D A0 53 40 00 : mov ebx, [0x4053a0] # jump_from : 00401EA1 00402040 00401F66: 85 DB : test ebx, ebx 00401F68: 0F 8E 75 FE FF FF : jle Label_00401DE3 00401F6E: 8B 1D 98 61 40 00 : mov ebx, [0x406198] 00401F74: 8D 7D E4 : lea edi, [ebp-0x1c] 00401F77: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F7E: 66 90 : nop Label_00401F80: 00401F80: 8B 15 A4 53 40 00 : mov edx, [0x4053a4] # jump_from : 00401FB3 00401F86: 8D 04 B6 : lea eax, [esi+esi*4] 00401F89: 8D 04 82 : lea eax, [edx+eax*4] 00401F8C: 8B 10 : mov edx, [eax] 00401F8E: 85 D2 : test edx, edx 00401F90: 74 1A : jz Label_00401FAC 00401F92: 89 7C 24 0C : mov [esp+0xc], edi 00401F96: 89 54 24 08 : mov [esp+0x8], edx 00401F9A: 8B 50 08 : mov edx, [eax+0x8] 00401F9D: 89 54 24 04 : mov [esp+0x4], edx 00401FA1: 8B 40 04 : mov eax, [eax+0x4] 00401FA4: 89 04 24 : mov [esp], eax 00401FA7: FF D3 : call ebx 00401FA9: 83 EC 10 : sub esp, 0x10 Label_00401FAC: 00401FAC: 46 : inc esi # jump_from : 00401F90 00401FAD: 3B 35 A0 53 40 00 : cmp esi, [0x4053a0] 00401FB3: 7C CB : jl Label_00401F80 00401FB5: 8D 65 F4 : lea esp, [ebp-0xc] 00401FB8: 5B : pop ebx 00401FB9: 5E : pop esi 00401FBA: 5F : pop edi 00401FBB: 5D : pop ebp 00401FBC: C3 : ret Label_00401FC0: 00401FC0: 0F B6 07 : movzx eax, byte [edi] # jump_from : 00401ED2 00401FC3: 84 C0 : test al, al 00401FC5: 79 05 : jns Label_00401FCC 00401FC7: 0D 00 FF FF FF : or eax, 0xffffff00 Label_00401FCC: 00401FCC: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401FC5 00401FCF: 29 C8 : sub eax, ecx 00401FD1: 01 D0 : add eax, edx 00401FD3: 89 45 D4 : mov [ebp-0x2c], eax 00401FD6: 89 F8 : mov eax, edi 00401FD8: E8 A3 FC FF FF : call Func00401C80@4 00401FDD: 0F B6 45 D4 : movzx eax, byte [ebp-0x2c] 00401FE1: 88 07 : mov [edi], al 00401FE3: E9 B0 FE FF FF : jmp Label_00401E98 Label_00401FF0: 00401FF0: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401EF2 Label_00401FF5: 00401FF5: 81 FB 70 45 40 00 : cmp ebx, 0x404570 # jump_from : 00401E4F 00401E5A 00401FFB: 0F 83 E2 FD FF FF : jae Label_00401DE3 00402001: 8D B4 26 00 00 00 00 : lea esi, [esi] 00402008: 8D B4 26 00 00 00 00 : lea esi, [esi] 0040200F: 90 : nop Label_00402010: 00402010: 8B 7B 04 : mov edi, [ebx+0x4] # jump_from : 0040203E 00402013: 83 C3 08 : add ebx, 0x8 00402016: 8B 53 F8 : mov edx, [ebx-0x8] 00402019: 8B 8F 00 00 40 00 : mov ecx, [edi+0x400000] 0040201F: 8D 87 00 00 40 00 : lea eax, [edi+0x400000] 00402025: 01 CA : add edx, ecx 00402027: 89 55 D4 : mov [ebp-0x2c], edx 0040202A: E8 51 FC FF FF : call Func00401C80@4 0040202F: 8B 55 D4 : mov edx, [ebp-0x2c] 00402032: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00402038: 89 97 00 00 40 00 : mov [edi+0x400000], edx 0040203E: 72 D0 : jb Label_00402010 00402040: E9 1B FF FF FF : jmp Label_00401F60 Label_00402045: 00402045: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401F05 0040204A: E9 09 FE FF FF : jmp Label_00401E58 Label_0040204F: 0040204F: 89 44 24 04 : mov [esp+0x4], eax # jump_from : 00401E66 00402053: C7 04 24 00 42 40 00 : mov dword [esp], 0x404200 0040205A: E8 C1 FB FF FF : call Func00401C20@4 0040205F: 90 : nop 00402060: 53 : push ebx 00402061: 83 EC 18 : sub esp, 0x18 00402064: 8B 5C 24 20 : mov ebx, [esp+0x20] 00402068: 8B 03 : mov eax, [ebx] 0040206A: 8B 00 : mov eax, [eax] 0040206C: 3D 91 00 00 C0 : cmp eax, 0xc0000091 00402071: 76 3D : jbe Label_004020B0 00402073: 3D 94 00 00 C0 : cmp eax, 0xc0000094 00402078: 0F 84 C2 00 00 00 : jz Label_00402140 0040207E: 3D 96 00 00 C0 : cmp eax, 0xc0000096 00402083: 74 73 : jz Label_004020F8 00402085: 3D 93 00 00 C0 : cmp eax, 0xc0000093 0040208A: 0F 84 E0 00 00 00 : jz Label_00402170 Label_00402090: 00402090: A1 AC 53 40 00 : mov eax, [0x4053ac] # jump_from : 004020DF 004020F6 00402115 00402159 00402095: 85 C0 : test eax, eax 00402097: 0F 84 93 00 00 00 : jz Label_00402130 0040209D: 89 5C 24 20 : mov [esp+0x20], ebx 004020A1: 83 C4 18 : add esp, 0x18 004020A4: 5B : pop ebx 004020A5: FF E0 : jmp eax Label_004020B0: 004020B0: 3D 8D 00 00 C0 : cmp eax, 0xc000008d # jump_from : 00402071 004020B5: 0F 83 B5 00 00 00 : jae Label_00402170 004020BB: 3D 05 00 00 C0 : cmp eax, 0xc0000005 004020C0: 75 2F : jnz Label_004020F1 004020C2: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020C9: 31 C0 : xor eax, eax 004020CB: 89 44 24 04 : mov [esp+0x4], eax 004020CF: E8 C0 07 00 00 : call msvcrt.dll!signal@4 004020D4: 83 F8 01 : cmp eax, 0x1 004020D7: 0F 84 0E 01 00 00 : jz Label_004021EB 004020DD: 85 C0 : test eax, eax 004020DF: 74 AF : jz Label_00402090 004020E1: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020E8: FF D0 : call eax 004020EA: B8 FF FF FF FF : mov eax, 0xffffffff 004020EF: EB 41 : jmp Label_00402132 Label_004020F1: 004020F1: 3D 1D 00 00 C0 : cmp eax, 0xc000001d # jump_from : 004020C0 004020F6: 75 98 : jnz Label_00402090 Label_004020F8: 004020F8: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 # jump_from : 00402083 004020FF: 31 C0 : xor eax, eax 00402101: 89 44 24 04 : mov [esp+0x4], eax 00402105: E8 8A 07 00 00 : call msvcrt.dll!signal@4 0040210A: 83 F8 01 : cmp eax, 0x1 0040210D: 0F 84 BC 00 00 00 : jz Label_004021CF 00402113: 85 C0 : test eax, eax 00402115: 0F 84 75 FF FF FF : jz Label_00402090 0040211B: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 00402122: FF D0 : call eax 00402124: B8 FF FF FF FF : mov eax, 0xffffffff 00402129: EB 07 : jmp Label_00402132 Label_00402130: 00402130: 31 C0 : xor eax, eax # jump_from : 00402097 Label_00402132: 00402132: 83 C4 18 : add esp, 0x18 # jump_from : 004020EF 00402129 0040216D 004021A6 004021CA 004021E6 00402202 00402135: 5B : pop ebx 00402136: C2 04 00 : ret 0x4 Label_00402140: 00402140: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402078 00402147: 31 C0 : xor eax, eax 00402149: 89 44 24 04 : mov [esp+0x4], eax 0040214D: E8 42 07 00 00 : call msvcrt.dll!signal@4 00402152: 83 F8 01 : cmp eax, 0x1 00402155: 74 59 : jz Label_004021B0 Label_00402157: 00402157: 85 C0 : test eax, eax # jump_from : 00402185 00402159: 0F 84 31 FF FF FF : jz Label_00402090 0040215F: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 00402166: FF D0 : call eax 00402168: B8 FF FF FF FF : mov eax, 0xffffffff 0040216D: EB C3 : jmp Label_00402132 Label_00402170: 00402170: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 0040208A 004020B5 00402177: 31 C0 : xor eax, eax 00402179: 89 44 24 04 : mov [esp+0x4], eax 0040217D: E8 12 07 00 00 : call msvcrt.dll!signal@4 00402182: 83 F8 01 : cmp eax, 0x1 00402185: 75 D0 : jnz Label_00402157 00402187: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 0040218E: BA 01 00 00 00 : mov edx, 0x1 00402193: 89 54 24 04 : mov [esp+0x4], edx 00402197: E8 F8 06 00 00 : call msvcrt.dll!signal@4 0040219C: E8 4F FA FF FF : call Func00401BF0@4 004021A1: B8 FF FF FF FF : mov eax, 0xffffffff 004021A6: EB 8A : jmp Label_00402132 Label_004021B0: 004021B0: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402155 004021B7: B9 01 00 00 00 : mov ecx, 0x1 004021BC: 89 4C 24 04 : mov [esp+0x4], ecx 004021C0: E8 CF 06 00 00 : call msvcrt.dll!signal@4 004021C5: B8 FF FF FF FF : mov eax, 0xffffffff 004021CA: E9 63 FF FF FF : jmp Label_00402132 Label_004021CF: 004021CF: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 0040210D 004021D7: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 004021DE: E8 B1 06 00 00 : call msvcrt.dll!signal@4 004021E3: 83 C8 FF : or eax, 0xffffffff 004021E6: E9 47 FF FF FF : jmp Label_00402132 Label_004021EB: 004021EB: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 004020D7 004021F3: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004021FA: E8 95 06 00 00 : call msvcrt.dll!signal@4 004021FF: 83 C8 FF : or eax, 0xffffffff 00402202: E9 2B FF FF FF : jmp Label_00402132 end proc proc Func00401DD0@4 Label_00401DD0 attrs [[cdecl]][[stdcall]] # call_from : 004014C0 # call_to : 00401BF0 00401C20 00401C80 00402660 00402850 00402894 # jump_to : 00401DE3 00401DF0 00401E4D 00401E58 00401E80 00401E98 00401EA7 00401EF0 00401F20 00401F31 00401F60 00401F80 00401FAC 00401FC0 00401FCC 00401FF0 00401FF5 00402010 00402045 0040204F 00402090 004020B0 004020F1 004020F8 00402130 00402132 00402140 00402157 00402170 004021B0 004021CF 004021EB Label_00401DD0: 00401DD0: 55 : push ebp 00401DD1: 89 E5 : mov ebp, esp 00401DD3: 57 : push edi 00401DD4: 56 : push esi 00401DD5: 53 : push ebx 00401DD6: 83 EC 3C : sub esp, 0x3c 00401DD9: 8B 35 9C 53 40 00 : mov esi, [0x40539c] 00401DDF: 85 F6 : test esi, esi 00401DE1: 74 0D : jz Label_00401DF0 Label_00401DE3: 00401DE3: 8D 65 F4 : lea esp, [ebp-0xc] # jump_from : 00401E37 00401E77 00401F68 00401FFB 00401DE6: 5B : pop ebx 00401DE7: 5E : pop esi 00401DE8: 5F : pop edi 00401DE9: 5D : pop ebp 00401DEA: C3 : ret Label_00401DF0: 00401DF0: BF 01 00 00 00 : mov edi, 0x1 # jump_from : 00401DE1 00401DF5: 89 3D 9C 53 40 00 : mov [0x40539c], edi 00401DFB: E8 60 08 00 00 : call Func00402660@4 00401E00: 8D 04 80 : lea eax, [eax+eax*4] 00401E03: 8D 04 85 1B 00 00 00 : lea eax, [eax*4+0x1b] 00401E0A: C1 E8 04 : shr eax, 0x4 00401E0D: C1 E0 04 : shl eax, 0x4 00401E10: E8 3B 0A 00 00 : call Func00402850@4 00401E15: 29 C4 : sub esp, eax 00401E17: 8D 44 24 1F : lea eax, [esp+0x1f] 00401E1B: 83 E0 F0 : and eax, 0xfffffff0 00401E1E: A3 A4 53 40 00 : mov [0x4053a4], eax 00401E23: 31 C0 : xor eax, eax 00401E25: A3 A0 53 40 00 : mov [0x4053a0], eax 00401E2A: B8 70 45 40 00 : mov eax, 0x404570 00401E2F: 2D 70 45 40 00 : sub eax, 0x404570 00401E34: 83 F8 07 : cmp eax, 0x7 00401E37: 7E AA : jle Label_00401DE3 00401E39: 83 F8 0B : cmp eax, 0xb 00401E3C: 8B 15 70 45 40 00 : mov edx, [0x404570] 00401E42: 0F 8F A8 00 00 00 : jg Label_00401EF0 00401E48: BB 70 45 40 00 : mov ebx, 0x404570 Label_00401E4D: 00401E4D: 85 D2 : test edx, edx # jump_from : 00401F16 00401E4F: 0F 85 A0 01 00 00 : jnz Label_00401FF5 00401E55: 8B 43 04 : mov eax, [ebx+0x4] Label_00401E58: 00401E58: 85 C0 : test eax, eax # jump_from : 0040204A 00401E5A: 0F 85 95 01 00 00 : jnz Label_00401FF5 00401E60: 8B 43 08 : mov eax, [ebx+0x8] 00401E63: 83 F8 01 : cmp eax, 0x1 00401E66: 0F 85 E3 01 00 00 : jnz Label_0040204F 00401E6C: 83 C3 0C : add ebx, 0xc 00401E6F: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401E75: 72 30 : jb Label_00401EA7 00401E77: E9 67 FF FF FF : jmp Label_00401DE3 Label_00401E80: 00401E80: 8B 45 D4 : mov eax, [ebp-0x2c] # jump_from : 00401ECD 00401E83: 29 C2 : sub edx, eax 00401E85: 8B 07 : mov eax, [edi] 00401E87: 01 C2 : add edx, eax 00401E89: 89 F8 : mov eax, edi 00401E8B: 89 55 D4 : mov [ebp-0x2c], edx 00401E8E: E8 ED FD FF FF : call Func00401C80@4 00401E93: 8B 55 D4 : mov edx, [ebp-0x2c] 00401E96: 89 17 : mov [edi], edx Label_00401E98: 00401E98: 83 C3 0C : add ebx, 0xc # jump_from : 00401FE3 00401E9B: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401EA1: 0F 83 B9 00 00 00 : jae Label_00401F60 Label_00401EA7: 00401EA7: 8B 03 : mov eax, [ebx] # jump_from : 00401E75 00401F51 00401EA9: 8B 4B 04 : mov ecx, [ebx+0x4] 00401EAC: 8D 90 00 00 40 00 : lea edx, [eax+0x400000] 00401EB2: 89 55 D4 : mov [ebp-0x2c], edx 00401EB5: 8B 90 00 00 40 00 : mov edx, [eax+0x400000] 00401EBB: 8D B9 00 00 40 00 : lea edi, [ecx+0x400000] 00401EC1: 0F B6 43 08 : movzx eax, byte [ebx+0x8] 00401EC5: 83 F8 10 : cmp eax, 0x10 00401EC8: 74 56 : jz Label_00401F20 00401ECA: 83 F8 20 : cmp eax, 0x20 00401ECD: 74 B1 : jz Label_00401E80 00401ECF: 83 F8 08 : cmp eax, 0x8 00401ED2: 0F 84 E8 00 00 00 : jz Label_00401FC0 00401ED8: 89 44 24 04 : mov [esp+0x4], eax 00401EDC: C7 04 24 34 42 40 00 : mov dword [esp], 0x404234 00401EE3: E8 38 FD FF FF : call Func00401C20@4 00401EE8: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401EEF: 90 : nop Label_00401EF0: 00401EF0: 85 D2 : test edx, edx # jump_from : 00401E42 00401EF2: 0F 85 F8 00 00 00 : jnz Label_00401FF0 00401EF8: A1 74 45 40 00 : mov eax, [0x404574] 00401EFD: 89 C1 : mov ecx, eax 00401EFF: 0B 0D 78 45 40 00 : or ecx, [0x404578] 00401F05: 0F 85 3A 01 00 00 : jnz Label_00402045 00401F0B: 8B 15 7C 45 40 00 : mov edx, [0x40457c] 00401F11: BB 7C 45 40 00 : mov ebx, 0x40457c 00401F16: E9 32 FF FF FF : jmp Label_00401E4D Label_00401F20: 00401F20: 0F B7 81 00 00 40 00 : movzx eax, word [ecx+0x400000] # jump_from : 00401EC8 00401F27: F6 C4 80 : test ah, 0x80 00401F2A: 74 05 : jz Label_00401F31 00401F2C: 0D 00 00 FF FF : or eax, 0xffff0000 Label_00401F31: 00401F31: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401F2A 00401F34: 83 C3 0C : add ebx, 0xc 00401F37: 29 C8 : sub eax, ecx 00401F39: 01 D0 : add eax, edx 00401F3B: 89 45 D4 : mov [ebp-0x2c], eax 00401F3E: 89 F8 : mov eax, edi 00401F40: E8 3B FD FF FF : call Func00401C80@4 00401F45: 8B 45 D4 : mov eax, [ebp-0x2c] 00401F48: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00401F4E: 66 89 07 : mov [edi], ax 00401F51: 0F 82 50 FF FF FF : jb Label_00401EA7 00401F57: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F5E: 66 90 : nop Label_00401F60: 00401F60: 8B 1D A0 53 40 00 : mov ebx, [0x4053a0] # jump_from : 00401EA1 00402040 00401F66: 85 DB : test ebx, ebx 00401F68: 0F 8E 75 FE FF FF : jle Label_00401DE3 00401F6E: 8B 1D 98 61 40 00 : mov ebx, [0x406198] 00401F74: 8D 7D E4 : lea edi, [ebp-0x1c] 00401F77: 8D B4 26 00 00 00 00 : lea esi, [esi] 00401F7E: 66 90 : nop Label_00401F80: 00401F80: 8B 15 A4 53 40 00 : mov edx, [0x4053a4] # jump_from : 00401FB3 00401F86: 8D 04 B6 : lea eax, [esi+esi*4] 00401F89: 8D 04 82 : lea eax, [edx+eax*4] 00401F8C: 8B 10 : mov edx, [eax] 00401F8E: 85 D2 : test edx, edx 00401F90: 74 1A : jz Label_00401FAC 00401F92: 89 7C 24 0C : mov [esp+0xc], edi 00401F96: 89 54 24 08 : mov [esp+0x8], edx 00401F9A: 8B 50 08 : mov edx, [eax+0x8] 00401F9D: 89 54 24 04 : mov [esp+0x4], edx 00401FA1: 8B 40 04 : mov eax, [eax+0x4] 00401FA4: 89 04 24 : mov [esp], eax 00401FA7: FF D3 : call ebx 00401FA9: 83 EC 10 : sub esp, 0x10 Label_00401FAC: 00401FAC: 46 : inc esi # jump_from : 00401F90 00401FAD: 3B 35 A0 53 40 00 : cmp esi, [0x4053a0] 00401FB3: 7C CB : jl Label_00401F80 00401FB5: 8D 65 F4 : lea esp, [ebp-0xc] 00401FB8: 5B : pop ebx 00401FB9: 5E : pop esi 00401FBA: 5F : pop edi 00401FBB: 5D : pop ebp 00401FBC: C3 : ret Label_00401FC0: 00401FC0: 0F B6 07 : movzx eax, byte [edi] # jump_from : 00401ED2 00401FC3: 84 C0 : test al, al 00401FC5: 79 05 : jns Label_00401FCC 00401FC7: 0D 00 FF FF FF : or eax, 0xffffff00 Label_00401FCC: 00401FCC: 8B 4D D4 : mov ecx, [ebp-0x2c] # jump_from : 00401FC5 00401FCF: 29 C8 : sub eax, ecx 00401FD1: 01 D0 : add eax, edx 00401FD3: 89 45 D4 : mov [ebp-0x2c], eax 00401FD6: 89 F8 : mov eax, edi 00401FD8: E8 A3 FC FF FF : call Func00401C80@4 00401FDD: 0F B6 45 D4 : movzx eax, byte [ebp-0x2c] 00401FE1: 88 07 : mov [edi], al 00401FE3: E9 B0 FE FF FF : jmp Label_00401E98 Label_00401FF0: 00401FF0: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401EF2 Label_00401FF5: 00401FF5: 81 FB 70 45 40 00 : cmp ebx, 0x404570 # jump_from : 00401E4F 00401E5A 00401FFB: 0F 83 E2 FD FF FF : jae Label_00401DE3 00402001: 8D B4 26 00 00 00 00 : lea esi, [esi] 00402008: 8D B4 26 00 00 00 00 : lea esi, [esi] 0040200F: 90 : nop Label_00402010: 00402010: 8B 7B 04 : mov edi, [ebx+0x4] # jump_from : 0040203E 00402013: 83 C3 08 : add ebx, 0x8 00402016: 8B 53 F8 : mov edx, [ebx-0x8] 00402019: 8B 8F 00 00 40 00 : mov ecx, [edi+0x400000] 0040201F: 8D 87 00 00 40 00 : lea eax, [edi+0x400000] 00402025: 01 CA : add edx, ecx 00402027: 89 55 D4 : mov [ebp-0x2c], edx 0040202A: E8 51 FC FF FF : call Func00401C80@4 0040202F: 8B 55 D4 : mov edx, [ebp-0x2c] 00402032: 81 FB 70 45 40 00 : cmp ebx, 0x404570 00402038: 89 97 00 00 40 00 : mov [edi+0x400000], edx 0040203E: 72 D0 : jb Label_00402010 00402040: E9 1B FF FF FF : jmp Label_00401F60 Label_00402045: 00402045: BB 70 45 40 00 : mov ebx, 0x404570 # jump_from : 00401F05 0040204A: E9 09 FE FF FF : jmp Label_00401E58 Label_0040204F: 0040204F: 89 44 24 04 : mov [esp+0x4], eax # jump_from : 00401E66 00402053: C7 04 24 00 42 40 00 : mov dword [esp], 0x404200 0040205A: E8 C1 FB FF FF : call Func00401C20@4 0040205F: 90 : nop 00402060: 53 : push ebx 00402061: 83 EC 18 : sub esp, 0x18 00402064: 8B 5C 24 20 : mov ebx, [esp+0x20] 00402068: 8B 03 : mov eax, [ebx] 0040206A: 8B 00 : mov eax, [eax] 0040206C: 3D 91 00 00 C0 : cmp eax, 0xc0000091 00402071: 76 3D : jbe Label_004020B0 00402073: 3D 94 00 00 C0 : cmp eax, 0xc0000094 00402078: 0F 84 C2 00 00 00 : jz Label_00402140 0040207E: 3D 96 00 00 C0 : cmp eax, 0xc0000096 00402083: 74 73 : jz Label_004020F8 00402085: 3D 93 00 00 C0 : cmp eax, 0xc0000093 0040208A: 0F 84 E0 00 00 00 : jz Label_00402170 Label_00402090: 00402090: A1 AC 53 40 00 : mov eax, [0x4053ac] # jump_from : 004020DF 004020F6 00402115 00402159 00402095: 85 C0 : test eax, eax 00402097: 0F 84 93 00 00 00 : jz Label_00402130 0040209D: 89 5C 24 20 : mov [esp+0x20], ebx 004020A1: 83 C4 18 : add esp, 0x18 004020A4: 5B : pop ebx 004020A5: FF E0 : jmp eax Label_004020B0: 004020B0: 3D 8D 00 00 C0 : cmp eax, 0xc000008d # jump_from : 00402071 004020B5: 0F 83 B5 00 00 00 : jae Label_00402170 004020BB: 3D 05 00 00 C0 : cmp eax, 0xc0000005 004020C0: 75 2F : jnz Label_004020F1 004020C2: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020C9: 31 C0 : xor eax, eax 004020CB: 89 44 24 04 : mov [esp+0x4], eax 004020CF: E8 C0 07 00 00 : call msvcrt.dll!signal@4 004020D4: 83 F8 01 : cmp eax, 0x1 004020D7: 0F 84 0E 01 00 00 : jz Label_004021EB 004020DD: 85 C0 : test eax, eax 004020DF: 74 AF : jz Label_00402090 004020E1: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004020E8: FF D0 : call eax 004020EA: B8 FF FF FF FF : mov eax, 0xffffffff 004020EF: EB 41 : jmp Label_00402132 Label_004020F1: 004020F1: 3D 1D 00 00 C0 : cmp eax, 0xc000001d # jump_from : 004020C0 004020F6: 75 98 : jnz Label_00402090 Label_004020F8: 004020F8: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 # jump_from : 00402083 004020FF: 31 C0 : xor eax, eax 00402101: 89 44 24 04 : mov [esp+0x4], eax 00402105: E8 8A 07 00 00 : call msvcrt.dll!signal@4 0040210A: 83 F8 01 : cmp eax, 0x1 0040210D: 0F 84 BC 00 00 00 : jz Label_004021CF 00402113: 85 C0 : test eax, eax 00402115: 0F 84 75 FF FF FF : jz Label_00402090 0040211B: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 00402122: FF D0 : call eax 00402124: B8 FF FF FF FF : mov eax, 0xffffffff 00402129: EB 07 : jmp Label_00402132 Label_00402130: 00402130: 31 C0 : xor eax, eax # jump_from : 00402097 Label_00402132: 00402132: 83 C4 18 : add esp, 0x18 # jump_from : 004020EF 00402129 0040216D 004021A6 004021CA 004021E6 00402202 00402135: 5B : pop ebx 00402136: C2 04 00 : ret 0x4 Label_00402140: 00402140: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402078 00402147: 31 C0 : xor eax, eax 00402149: 89 44 24 04 : mov [esp+0x4], eax 0040214D: E8 42 07 00 00 : call msvcrt.dll!signal@4 00402152: 83 F8 01 : cmp eax, 0x1 00402155: 74 59 : jz Label_004021B0 Label_00402157: 00402157: 85 C0 : test eax, eax # jump_from : 00402185 00402159: 0F 84 31 FF FF FF : jz Label_00402090 0040215F: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 00402166: FF D0 : call eax 00402168: B8 FF FF FF FF : mov eax, 0xffffffff 0040216D: EB C3 : jmp Label_00402132 Label_00402170: 00402170: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 0040208A 004020B5 00402177: 31 C0 : xor eax, eax 00402179: 89 44 24 04 : mov [esp+0x4], eax 0040217D: E8 12 07 00 00 : call msvcrt.dll!signal@4 00402182: 83 F8 01 : cmp eax, 0x1 00402185: 75 D0 : jnz Label_00402157 00402187: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 0040218E: BA 01 00 00 00 : mov edx, 0x1 00402193: 89 54 24 04 : mov [esp+0x4], edx 00402197: E8 F8 06 00 00 : call msvcrt.dll!signal@4 0040219C: E8 4F FA FF FF : call Func00401BF0@4 004021A1: B8 FF FF FF FF : mov eax, 0xffffffff 004021A6: EB 8A : jmp Label_00402132 Label_004021B0: 004021B0: C7 04 24 08 00 00 00 : mov dword [esp], 0x8 # jump_from : 00402155 004021B7: B9 01 00 00 00 : mov ecx, 0x1 004021BC: 89 4C 24 04 : mov [esp+0x4], ecx 004021C0: E8 CF 06 00 00 : call msvcrt.dll!signal@4 004021C5: B8 FF FF FF FF : mov eax, 0xffffffff 004021CA: E9 63 FF FF FF : jmp Label_00402132 Label_004021CF: 004021CF: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 0040210D 004021D7: C7 04 24 04 00 00 00 : mov dword [esp], 0x4 004021DE: E8 B1 06 00 00 : call msvcrt.dll!signal@4 004021E3: 83 C8 FF : or eax, 0xffffffff 004021E6: E9 47 FF FF FF : jmp Label_00402132 Label_004021EB: 004021EB: C7 44 24 04 01 00 00 00 : mov dword [esp+0x4], 0x1 # jump_from : 004020D7 004021F3: C7 04 24 0B 00 00 00 : mov dword [esp], 0xb 004021FA: E8 95 06 00 00 : call msvcrt.dll!signal@4 004021FF: 83 C8 FF : or eax, 0xffffffff 00402202: E9 2B FF FF FF : jmp Label_00402132 end proc proc Func00402490 Label_00402490 attrs [[cdecl]] # call_from : 004025E0 00402660 004026F0 # jump_to : 004024B0 Label_00402490: 00402490: 8B 50 3C : mov edx, [eax+0x3c] 00402493: 01 D0 : add eax, edx 00402495: 81 38 50 45 00 00 : cmp dword [eax], 0x4550 0040249B: 75 13 : jnz Label_004024B0 0040249D: 66 81 78 18 0B 01 : cmp word [eax+0x18], 0x10b 004024A3: 0F 94 C0 : setz al 004024A6: 0F B6 C0 : movzx eax, al 004024A9: C3 : ret Label_004024B0: 004024B0: 31 C0 : xor eax, eax # jump_from : 0040249B 004024B2: C3 : ret end proc proc Func004025E0 Label_004025E0 attrs [[cdecl]] # call_from : 00401C20 00401C80 # call_to : 00402490 # jump_to : 00402630 0040263E 00402646 00402648 00402650 Label_004025E0: 004025E0: 31 C9 : xor ecx, ecx 004025E2: 66 81 3D 00 00 40 00 4D 5A : cmp word [0x400000], 0x5a4d 004025EB: 75 63 : jnz Label_00402650 004025ED: 56 : push esi 004025EE: B8 00 00 40 00 : mov eax, 0x400000 004025F3: 53 : push ebx 004025F4: E8 97 FE FF FF : call Func00402490 004025F9: 85 C0 : test eax, eax 004025FB: 74 4B : jz Label_00402648 004025FD: A1 3C 00 40 00 : mov eax, [0x40003c] 00402602: 8B 5C 24 0C : mov ebx, [esp+0xc] 00402606: 0F B7 90 14 00 40 00 : movzx edx, word [eax+0x400014] 0040260D: 05 00 00 40 00 : add eax, 0x400000 00402612: 0F B7 70 06 : movzx esi, word [eax+0x6] 00402616: 81 EB 00 00 40 00 : sub ebx, 0x400000 0040261C: 8D 4C 10 18 : lea ecx, [eax+edx+0x18] 00402620: 85 F6 : test esi, esi 00402622: 74 22 : jz Label_00402646 00402624: 31 D2 : xor edx, edx 00402626: 8D B4 26 00 00 00 00 : lea esi, [esi] 0040262D: 8D 76 00 : lea esi, [esi] Label_00402630: 00402630: 8B 41 0C : mov eax, [ecx+0xc] # jump_from : 00402644 00402633: 39 C3 : cmp ebx, eax 00402635: 72 07 : jb Label_0040263E 00402637: 03 41 08 : add eax, [ecx+0x8] 0040263A: 39 C3 : cmp ebx, eax 0040263C: 72 0A : jb Label_00402648 Label_0040263E: 0040263E: 42 : inc edx # jump_from : 00402635 0040263F: 83 C1 28 : add ecx, 0x28 00402642: 39 F2 : cmp edx, esi 00402644: 75 EA : jnz Label_00402630 Label_00402646: 00402646: 31 C9 : xor ecx, ecx # jump_from : 00402622 Label_00402648: 00402648: 5B : pop ebx # jump_from : 004025FB 0040263C 00402649: 89 C8 : mov eax, ecx 0040264B: 5E : pop esi 0040264C: C3 : ret Label_00402650: 00402650: 89 C8 : mov eax, ecx # jump_from : 004025EB 00402652: C3 : ret end proc proc Func00402660 Label_00402660 attrs [[cdecl]] # call_from : 00401C20 00401C80 00401DD0 # call_to : 00402490 # jump_to : 00402687 Label_00402660: 00402660: 31 C0 : xor eax, eax 00402662: 66 81 3D 00 00 40 00 4D 5A : cmp word [0x400000], 0x5a4d 0040266B: 75 1A : jnz Label_00402687 0040266D: B8 00 00 40 00 : mov eax, 0x400000 00402672: E8 19 FE FF FF : call Func00402490 00402677: 85 C0 : test eax, eax 00402679: 74 0C : jz Label_00402687 0040267B: A1 3C 00 40 00 : mov eax, [0x40003c] 00402680: 0F B7 80 06 00 40 00 : movzx eax, word [eax+0x400006] Label_00402687: 00402687: C3 : ret # jump_from : 0040266B 00402679 end proc proc Func004026F0 Label_004026F0 attrs [[cdecl]] # call_from : 00401C20 00401C80 # call_to : 00402490 # jump_to : 00402710 Label_004026F0: 004026F0: 31 C9 : xor ecx, ecx 004026F2: 66 81 3D 00 00 40 00 4D 5A : cmp word [0x400000], 0x5a4d 004026FB: 75 13 : jnz Label_00402710 004026FD: B8 00 00 40 00 : mov eax, 0x400000 00402702: E8 89 FD FF FF : call Func00402490 00402707: 85 C0 : test eax, eax 00402709: 74 05 : jz Label_00402710 0040270B: B9 00 00 40 00 : mov ecx, 0x400000 Label_00402710: 00402710: 89 C8 : mov eax, ecx # jump_from : 004026FB 00402709 00402712: C3 : ret end proc proc Func00402850 Label_00402850 attrs [[cdecl]] # call_from : 00401C20 00401C80 00401DD0 # jump_to : 0040285D 00402872 Label_00402850: 00402850: 51 : push ecx 00402851: 50 : push eax 00402852: 3D 00 10 00 00 : cmp eax, 0x1000 00402857: 8D 4C 24 0C : lea ecx, [esp+0xc] 0040285B: 72 15 : jb Label_00402872 Label_0040285D: 0040285D: 81 E9 00 10 00 00 : sub ecx, 0x1000 # jump_from : 00402870 00402863: 83 09 00 : or dword [ecx], 0x0 00402866: 2D 00 10 00 00 : sub eax, 0x1000 0040286B: 3D 00 10 00 00 : cmp eax, 0x1000 00402870: 77 EB : ja Label_0040285D Label_00402872: 00402872: 29 C1 : sub ecx, eax # jump_from : 0040285B 00402874: 83 09 00 : or dword [ecx], 0x0 00402877: 58 : pop eax 00402878: 59 : pop ecx 00402879: C3 : ret end proc proc imp.msvcrt.dll!vfprintf Label_0040287C attrs [[jumponly]] # call_from : 00401C20 Label_0040287C: 0040287C: FF 25 FC 61 40 00 : jmp dword [0x4061fc] end proc proc imp.msvcrt.dll!strlen Label_0040288C attrs [[jumponly]] # call_from : 004014C0 Label_0040288C: 0040288C: FF 25 F4 61 40 00 : jmp dword [0x4061f4] end proc proc imp.msvcrt.dll!signal Label_00402894 attrs [[jumponly]] # call_from : 00401C20 00401C80 00401DD0 Label_00402894: 00402894: FF 25 F0 61 40 00 : jmp dword [0x4061f0] end proc proc imp.msvcrt.dll!malloc Label_0040289C attrs [[jumponly]] # call_from : 004014C0 Label_0040289C: 0040289C: FF 25 EC 61 40 00 : jmp dword [0x4061ec] end proc proc imp.msvcrt.dll!fwrite Label_004028A4 attrs [[jumponly]] # call_from : 00401C20 Label_004028A4: 004028A4: FF 25 E8 61 40 00 : jmp dword [0x4061e8] end proc proc imp.msvcrt.dll!exit Label_004028BC attrs [[jumponly]] # call_from : 004014C0 Label_004028BC: 004028BC: FF 25 DC 61 40 00 : jmp dword [0x4061dc] end proc proc imp.msvcrt.dll!abort Label_004028CC attrs [[jumponly]] # call_from : 00401C20 Label_004028CC: 004028CC: FF 25 D4 61 40 00 : jmp dword [0x4061d4] end proc proc imp.msvcrt.dll!_onexit Label_004028D4 attrs [[jumponly]] # call_from : 00401500 Label_004028D4: 004028D4: FF 25 D0 61 40 00 : jmp dword [0x4061d0] end proc proc imp.msvcrt.dll!_initterm Label_004028DC attrs [[jumponly]] # call_from : 004014C0 Label_004028DC: 004028DC: FF 25 C8 61 40 00 : jmp dword [0x4061c8] end proc proc imp.msvcrt.dll!_cexit Label_004028E4 attrs [[jumponly]] # call_from : 004014C0 Label_004028E4: 004028E4: FF 25 C4 61 40 00 : jmp dword [0x4061c4] end proc proc imp.msvcrt.dll!_amsg_exit Label_004028EC attrs [[jumponly]] # call_from : 004014C0 Label_004028EC: 004028EC: FF 25 C0 61 40 00 : jmp dword [0x4061c0] end proc proc imp.msvcrt.dll!__p__acmdln Label_0040290C attrs [[jumponly]] # call_from : 004014C0 Label_0040290C: 0040290C: FF 25 B0 61 40 00 : jmp dword [0x4061b0] end proc proc Func00402920 Label_00402920 attrs [[cdecl]] # call_from : 00401C20 Label_00402920: 00402920: 8B 44 24 04 : mov eax, [esp+0x4] 00402924: 8B 15 CC 61 40 00 : mov edx, [0x4061cc] 0040292A: C1 E0 05 : shl eax, 0x5 0040292D: 01 D0 : add eax, edx 0040292F: C3 : ret end proc proc Func00402940 Label_00402940 attrs [[cdecl]] # call_from : 004014C0 Label_00402940: 00402940: 8B 44 24 04 : mov eax, [esp+0x4] 00402944: 87 05 D4 53 40 00 : xchg [0x4053d4], eax 0040294A: C3 : ret end proc proc Func00402950 Label_00402950 attrs [[cdecl]] # call_from : 004014C0 # call_to : 00401790 00401880 Label_00402950: 00402950: 8D 4C 24 04 : lea ecx, [esp+0x4] 00402954: 83 E4 F0 : and esp, 0xfffffff0 00402957: FF 71 FC : push dword [ecx-0x4] 0040295A: 55 : push ebp 0040295B: 89 E5 : mov ebp, esp 0040295D: 51 : push ecx 0040295E: 83 EC 14 : sub esp, 0x14 00402961: E8 1A EF FF FF : call Func00401880 00402966: A1 00 30 40 00 : mov eax, [0x403000] 0040296B: 89 44 24 0C : mov [esp+0xc], eax 0040296F: A1 D8 53 40 00 : mov eax, [0x4053d8] 00402974: 89 44 24 08 : mov [esp+0x8], eax 00402978: 31 C0 : xor eax, eax 0040297A: 89 44 24 04 : mov [esp+0x4], eax 0040297E: A1 DC 53 40 00 : mov eax, [0x4053dc] 00402983: 89 04 24 : mov [esp], eax 00402986: E8 05 EE FF FF : call Func00401790@16 0040298B: 8B 4D FC : mov ecx, [ebp-0x4] 0040298E: 83 EC 10 : sub esp, 0x10 00402991: C9 : leave 00402992: 8D 61 FC : lea esp, [ecx-0x4] 00402995: C3 : ret end proc
src/spat-preconditions.ads
yannickmoy/spat
20
20390
------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); ------------------------------------------------------------------------------ -- -- SPARK Proof Analysis Tool -- -- S.P.A.T. - Collection of checks that should succeed before creating -- objects from the JSON data. -- ------------------------------------------------------------------------------ package SPAT.Preconditions is type Accepted_Value_Types is array (JSON_Value_Type) of Boolean with Pack => True; Number_Kind : constant Accepted_Value_Types; --------------------------------------------------------------------------- -- Ensure_Field -- -- Check that the given JSON object contains an object named Field with -- type of Kind. -- If the field is not found or the type is different from the expected -- one, a warning is issued, unless Is_Optional is True. -- Returns True if so, False otherwise. --------------------------------------------------------------------------- function Ensure_Field (Object : in JSON_Value; Field : in UTF8_String; Kind : in JSON_Value_Type; Is_Optional : in Boolean := False) return Boolean; --------------------------------------------------------------------------- -- Ensure_Field -- -- Check that the given JSON object contains an object named Field with -- on of the types in Kind. -- Returns True if so, False otherwise. --------------------------------------------------------------------------- function Ensure_Field (Object : in JSON_Value; Field : in UTF8_String; Kinds_Allowed : in Accepted_Value_Types) return Boolean; --------------------------------------------------------------------------- -- Ensure_Rule_Severity -- -- Checks that the given JSON object contains a rule and a severity object. -- Returns True if so, False otherwise. --------------------------------------------------------------------------- function Ensure_Rule_Severity (Object : in JSON_Value) return Boolean; private -- Make JSON type enumeration literals directly visible. use all type JSON_Value_Type; Number_Kind : constant Accepted_Value_Types := Accepted_Value_Types'(JSON_Int_Type | JSON_Float_Type => True, others => False); end SPAT.Preconditions;
coverage/PENDING_SUBMIT/amdvlk/0625-COVERAGE-inst-combiner-h-307/work/variant/1_spirv_asm/shader.frag.asm
asuonpaa/ShaderTests
0
103486
<filename>coverage/PENDING_SUBMIT/amdvlk/0625-COVERAGE-inst-combiner-h-307/work/variant/1_spirv_asm/shader.frag.asm ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 69 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %49 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %9 "p" OpName %11 "buf1" OpMemberName %11 0 "resolution" OpName %13 "" OpName %37 "buf0" OpMemberName %37 0 "_GLF_uniform_int_values" OpName %39 "" OpName %49 "_GLF_color" OpMemberDecorate %11 0 Offset 0 OpDecorate %11 Block OpDecorate %13 DescriptorSet 0 OpDecorate %13 Binding 1 OpDecorate %36 ArrayStride 16 OpMemberDecorate %37 0 Offset 0 OpDecorate %37 Block OpDecorate %39 DescriptorSet 0 OpDecorate %39 Binding 0 OpDecorate %49 Location 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypeVector %6 2 %8 = OpTypePointer Function %7 %10 = OpTypeFloat 32 %11 = OpTypeStruct %10 %12 = OpTypePointer Uniform %11 %13 = OpVariable %12 Uniform %14 = OpConstant %6 0 %15 = OpTypePointer Uniform %10 %20 = OpConstant %6 1 %21 = OpConstantComposite %7 %20 %20 %23 = OpTypeInt 32 0 %24 = OpConstant %23 1 %25 = OpTypePointer Function %6 %28 = OpConstant %23 0 %35 = OpConstant %23 3 %36 = OpTypeArray %6 %35 %37 = OpTypeStruct %36 %38 = OpTypePointer Uniform %37 %39 = OpVariable %38 Uniform %40 = OpTypePointer Uniform %6 %43 = OpTypeBool %47 = OpTypeVector %10 4 %48 = OpTypePointer Output %47 %49 = OpVariable %48 Output %53 = OpConstant %6 2 %4 = OpFunction %2 None %3 %5 = OpLabel %9 = OpVariable %8 Function %16 = OpAccessChain %15 %13 %14 %17 = OpLoad %10 %16 %18 = OpConvertFToS %6 %17 %19 = OpCompositeConstruct %7 %18 %18 %22 = OpShiftRightArithmetic %7 %19 %21 OpStore %9 %22 %26 = OpAccessChain %25 %9 %24 %27 = OpLoad %6 %26 %29 = OpAccessChain %25 %9 %28 %30 = OpLoad %6 %29 %31 = OpIAdd %6 %30 %27 %32 = OpAccessChain %25 %9 %28 OpStore %32 %31 %33 = OpAccessChain %25 %9 %28 %34 = OpLoad %6 %33 %41 = OpAccessChain %40 %39 %14 %14 %42 = OpLoad %6 %41 %44 = OpIEqual %43 %34 %42 OpSelectionMerge %46 None OpBranchConditional %44 %45 %64 %45 = OpLabel %50 = OpAccessChain %40 %39 %14 %20 %51 = OpLoad %6 %50 %52 = OpConvertSToF %10 %51 %54 = OpAccessChain %40 %39 %14 %53 %55 = OpLoad %6 %54 %56 = OpConvertSToF %10 %55 %57 = OpAccessChain %40 %39 %14 %53 %58 = OpLoad %6 %57 %59 = OpConvertSToF %10 %58 %60 = OpAccessChain %40 %39 %14 %20 %61 = OpLoad %6 %60 %62 = OpConvertSToF %10 %61 %63 = OpCompositeConstruct %47 %52 %56 %59 %62 OpStore %49 %63 OpBranch %46 %64 = OpLabel %65 = OpAccessChain %40 %39 %14 %53 %66 = OpLoad %6 %65 %67 = OpConvertSToF %10 %66 %68 = OpCompositeConstruct %47 %67 %67 %67 %67 OpStore %49 %68 OpBranch %46 %46 = OpLabel OpReturn OpFunctionEnd
projects/batfish/src/batfish/grammar/cisco/Cisco_ospf.g4
luispedrosa/batfish
0
5187
parser grammar Cisco_ospf; import Cisco_common; options { tokenVocab = CiscoLexer; } area_ipv6_ro_stanza : AREA ~NEWLINE* NEWLINE ; area_nssa_ro_stanza : AREA ( area_int = DEC | area_ip = IP_ADDRESS ) NSSA ( NO_SUMMARY | DEFAULT_INFORMATION_ORIGINATE )* NEWLINE ; default_information_ipv6_ro_stanza : DEFAULT_INFORMATION ~NEWLINE* NEWLINE ; default_information_ro_stanza : DEFAULT_INFORMATION ORIGINATE ( ( METRIC metric = DEC ) | ( METRIC_TYPE metric_type = DEC ) | ALWAYS | ( ROUTE_MAP map = VARIABLE ) )* NEWLINE ; ipv6_ro_stanza : null_ipv6_ro_stanza | passive_interface_ipv6_ro_stanza | redistribute_ipv6_ro_stanza ; ipv6_router_ospf_stanza : IPV6 ROUTER OSPF procnum = DEC NEWLINE ( rosl += ipv6_ro_stanza )+ ; log_adjacency_changes_ipv6_ro_stanza : LOG_ADJACENCY_CHANGES NEWLINE ; maximum_paths_ro_stanza : MAXIMUM_PATHS ~NEWLINE* NEWLINE ; network_ro_stanza : NETWORK ip = IP_ADDRESS wildcard = IP_ADDRESS AREA ( area_int = DEC | area_ip = IP_ADDRESS ) NEWLINE ; null_ipv6_ro_stanza : area_ipv6_ro_stanza | default_information_ipv6_ro_stanza | log_adjacency_changes_ipv6_ro_stanza | router_id_ipv6_ro_stanza ; null_ro_stanza : null_standalone_ro_stanza ; null_standalone_ro_stanza : NO? ( ( AREA ( DEC | IP_ADDRESS ) AUTHENTICATION ) | AUTO_COST | BFD | DISTRIBUTE_LIST | LOG_ADJACENCY_CHANGES | NSF ) ~NEWLINE* NEWLINE ; passive_interface_ipv6_ro_stanza : NO? PASSIVE_INTERFACE ~NEWLINE* NEWLINE ; passive_interface_default_ro_stanza : PASSIVE_INTERFACE DEFAULT NEWLINE ; passive_interface_ro_stanza : NO? PASSIVE_INTERFACE i = VARIABLE NEWLINE ; redistribute_bgp_ro_stanza : REDISTRIBUTE BGP as = DEC ( ( METRIC metric = DEC ) | ( METRIC_TYPE type = DEC ) | ( ROUTE_MAP map = VARIABLE ) | subnets = SUBNETS | ( TAG tag = DEC ) )* NEWLINE ; redistribute_ipv6_ro_stanza : REDISTRIBUTE ~NEWLINE* NEWLINE ; redistribute_connected_ro_stanza : REDISTRIBUTE CONNECTED ( ( METRIC metric = DEC ) | ( METRIC_TYPE type = DEC ) | ( ROUTE_MAP map = VARIABLE ) | subnets = SUBNETS | ( TAG tag = DEC ) )* NEWLINE ; redistribute_rip_ro_stanza : REDISTRIBUTE RIP ~NEWLINE* NEWLINE ; redistribute_static_ro_stanza : REDISTRIBUTE STATIC ( ( METRIC metric = DEC ) | ( METRIC_TYPE type = DEC ) | ( ROUTE_MAP map = VARIABLE ) | subnets = SUBNETS | ( TAG tag = DEC ) )* NEWLINE ; ro_stanza : area_nssa_ro_stanza | default_information_ro_stanza | maximum_paths_ro_stanza | network_ro_stanza | null_ro_stanza | passive_interface_default_ro_stanza | passive_interface_ro_stanza | redistribute_bgp_ro_stanza | redistribute_connected_ro_stanza | redistribute_rip_ro_stanza | redistribute_static_ro_stanza | router_id_ro_stanza ; router_id_ipv6_ro_stanza : ROUTER_ID ~NEWLINE* NEWLINE ; router_id_ro_stanza : ROUTER_ID ip = IP_ADDRESS NEWLINE ; router_ospf_stanza : ROUTER OSPF procnum = DEC NEWLINE router_ospf_stanza_tail ; router_ospf_stanza_tail : ( rosl += ro_stanza )+ ;
Universe/ApplyMyRollAndPitch.asm
ped7g/EliteNext
9
240317
; Full version ; 1. K2 = y - alpha * x ; 2. z = z + beta * K2 ; 3. y = K2 - beta * z ; 4. x = x + alpha * y ApplyMyRollToNosev: ApplyMyRollToVector ALPHA, UBnkrotmatNosevX, UBnkrotmatNosevY ret ApplyMyRollToSidev: ApplyMyRollToVector ALPHA, UBnkrotmatSidevX, UBnkrotmatSidevY ret ApplyMyRollToRoofv: ApplyMyRollToVector ALPHA, UBnkrotmatRoofvX, UBnkrotmatRoofvY ret ApplyMyPitchToNosev: ApplyMyRollToVector BETA, UBnkrotmatNosevZ, UBnkrotmatNosevY ret ApplyMyPitchToSidev: ApplyMyRollToVector BETA, UBnkrotmatSidevZ, UBnkrotmatSidevY ret ApplyMyPitchToRoofv: ApplyMyRollToVector BETA, UBnkrotmatRoofvZ, UBnkrotmatRoofvY ret APPequPosPlusAPP: MACRO Position, PositionSign push bc ld c,a ; save original value of a into c ld a,(PositionSign) ld b,a ld a,c xor b ; a = a xor x postition sign jp m,.MV50 ; if the sign is negative then A and X are both opposite signs ; Signs are the same to we just add and take which ever sign ld de,(varPp1) ; Note we take p+2,p+1 we we did a previous 24 bit mulitple ld hl,(Position) add hl,de ld (varPp1),hl ; now we have P1 and p2 with lo hi and ld a,c ; and a = original sign as they were both the same pop bc ret ; Signs are opposite so we subtract .MV50: ld de,(varPp1) ld hl,(Position) or a sbc hl,de jr c,.MV51 ; if the result was negative then negate result ld a,c ; get back the original sign ld (varPp1),hl ; and save result to P[2][1] xor SignOnly8Bit ; flip sign and exit A = flip of a pop bc ret .MV51: NegHL ld (varPp1),hl ld a,c ; the original sign will still be good pop bc ret ENDM APPequXPosPlusAPP: APPequPosPlusAPP UBnKxlo, UBnKxsgn APPequYPosPlusAPP: APPequPosPlusAPP UBnKylo, UBnKysgn APPequZPosPlusAPP: APPequPosPlusAPP UBnKzlo, UBnKzsgn ; rollWork holds Alpha intermidate results rollWork DS 3 rollWorkp1 equ rollWork rollWorkp2 equ rollWork+1 rollWorkp3 equ rollWork+2 ;---------------------------------------------------------------------------------------------------------------------------------- ; based on MVEIT part 4 of 9 ApplyMyRollAndPitch: ld a,(ALP1) ; get roll magnitude ld hl,BET1 ; and pitch or (hl) jp z,.NoRotation ; if both zero then don't compute ;break ; P[210] = x * alph (we use P[2]P[1] later as result/256 ld e,a ; e = roll magnitude ld hl,(UBnKxlo) ; hl = ship x pos call AHLequHLmulE ; MULTU2-2 AHL = UbnkXlo * Alp1 both unsigned ld (varPhi2),a ; set P[2] to high byte to help with ./256 ld (varP),hl ; P (2 1 0) = UbnkXlo * Alph1 ; A = Flip sign ld a,(ALP2FLIP) ; flip the current roll angle alpha and xor with x sign ld hl,UBnKxsgn ; and xor with x pos sign xor (hl) ; so now (A P+2 P+1) = - (x_sign x_hi x_lo) * alpha / 256 ; AP[2]P[1] =Y + AP[2]P[1] (i.e. Previous APP/256) call APPequYPosPlusAPP ; MVT6 calculate APP = y - (x * alpha / 256) ; K2 = AP[2][1] K2(3 2 1) = (A P+2 P+1) = y - x * alpha / 256 ld (rollWorkp3),a ; k2+3 = sign of result ld (rollWorkp1),hl ; k2+1,2 = result ; P[210] = K2[2 1] * Beta = (A ~P) * X ld a,(BET1) ; a = magnitude of pitch ld e,a call AHLequHLmulE ; MLTU2-2 AHL = (P+2 P+1) * BET1 or by now ((UbnkXlo * Alph1)/256 * Bet1) ld (varPp2),a ; save highest byte in P2 ld (varP),hl ; Fetch sign of previosu cal and xor with BETA inverted ld a,(rollWorkp3) ld e,a ld a,(BET2) xor e ; so we get the sign of K3 and xor with pitch sign ; Z = P[210] =Z + APP call APPequZPosPlusAPP ; MVT6 ld (UBnKzsgn),a ; save result back into z ld (UBnKzlo),hl ; A[P1]P[0] = z * Beta ld a,(BET1) ; get pitch back again for mulitply in original it was kept in Q so no fetch needed ld e,a call AHLequHLmulE ; MULTU2 P2 P1 was already in hl (A P+1 P) = (z_hi z_lo) * beta ld (varPp2),a ; P2 = high byte of result ld (varP),hl ; P (2 1 0) = UbnkXlo & Alph1 ; A xor BET2,Zsign ld a,(rollWorkp3) ; get K3 (sign of y) and store it in y pos ld (UBnKysgn),a ; save result back into y ld e,a ; a = y sign Xor pitch rate sign ld a,(BET2) ; xor e ; ld e,a ; now xor it with z sign too ld a,(UBnKzsgn) ; xor e ; so now a = sign of y * beta * sign y * sign z jp p,.MV43 ; if result is pve beta * z and y have differetn signs ld hl,(varPp1) ld de,(rollWorkp1) or a add hl,de jp .MV44 .MV43: ld hl,(rollWorkp1) ld de,(varPp1) or a sbc hl,de ; (y_hi y_lo) = K2(2 1) - P(2 1) jr nc,.MV44 ; if there was no over flow carry on NegHL ld a,(UBnKysgn) ; flip sign bit TODO, we may have to remove xor as planets and suns are sign + 23 bit xpos xor SignOnly8Bit ld (UBnKysgn),a ; by here we have (y_sign y_hi y_lo) = K2(2 1) - P(2 1) = K2 - beta * z .MV44: ld (UBnKylo),hl ; we do save here to avoid two writes if MV43 ended up with a 2s'c conversion ld a,(ALP1) ; get roll magnitude ld e,a ld hl,(UBnKylo) call AHLequHLmulE ; MLTU2-2 AHL = (y_hi y_lo) * alpha ld (varPp2),a ; store high byte P(2 1 0) = (y_hi y_lo) * alpha ld (varP),hl ld a,(ALP2) ld e,a ld a,(UBnKysgn) xor e ; a = sign of roll xor y so now we have (A P+2 P+1) = (y_sign y_hi y_lo) * alpha / 256 call APPequXPosPlusAPP ; MVT6 Set (A P+2 P+1) = (x_sign x_hi x_lo) + (A P+2 P+1) = x + y * alpha / 256 ld (UBnKxsgn),a ; save resutl stright into X pos ld (UBnKxlo),hl ;break ; if its not a sun then apply to local orientation call ApplyMyRollToNosev call ApplyMyRollToSidev call ApplyMyRollToRoofv call ApplyMyPitchToNosev call ApplyMyPitchToSidev call ApplyMyPitchToRoofv .NoRotation: ld a,(DELTA) ; get speed ld d,0 ld e,a ; de = speed in low byte ld hl,(UBnKzlo) ; hl = z position ld a,(UBnKzsgn) ; b = z sign ld b,a ; ld c,$80 ; c = -ve as we are always moving forwards call ADDHLDESignBC ; update speed ld (UBnKzlo),hl ; write back to zpos ld (UBnKzsgn),a ; ret
Src/Ant32/Tests/ant32/constants/lch-null-super-constant-1.autotest.asm
geoffthorpe/ant-architecture
0
22991
<reponame>geoffthorpe/ant-architecture<gh_stars>0 lcl r5, 0xffff lch r5, 0x1234 halt #@expected values #r5 = 0x1234ffff #pc = 0x8000000c #e0 = 0 #e3 = 0
src/convtest/measure_units.adb
shintakezou/adaplayground
0
11663
package body Measure_Units is function To_Mps (V : Kn) return Mps is (Mps (Float (V) * Mps_per_Knot)); function To_Meters (V : NM) return Meter is (Meter (Float (V) * Meters_per_Nautical_Mile)); function To_Meters (V : Ft) return Meter is (Meter (Float (V) * Meters_per_Foot)); function "*" (Speed : Kn; T : Duration) return NM is (NM (Float (Speed) * Float (T) / 3600.0)); function "*" (CR : Climb_Rate; T : Duration) return Ft is (Ft (Float (CR) * Float (T) / 60.0)); function "/" (D : Ft; T : Duration) return Climb_Rate is (Climb_Rate (60.0 * Float (D) / Float (T))); end Measure_Units;
tools/smaz.adb
faelys/natools
0
19984
------------------------------------------------------------------------------ -- Copyright (c) 2016-2017, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Command Line Interface for primitives in Natools.Smaz.Tools. -- ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; with Ada.Command_Line; with Ada.Containers.Indefinite_Doubly_Linked_Lists; with Ada.Containers.Indefinite_Holders; with Ada.Streams; with Ada.Strings.Fixed; with Ada.Strings.Unbounded; with Ada.Text_IO.Text_Streams; with Natools.Getopt_Long; with Natools.Parallelism; with Natools.S_Expressions.Parsers; with Natools.S_Expressions.Printers; with Natools.Smaz; with Natools.Smaz.Tools; with Natools.Smaz_256; with Natools.Smaz_4096; with Natools.Smaz_64; with Natools.Smaz_Generic.Tools; with Natools.Smaz_Implementations.Base_4096; with Natools.Smaz_Implementations.Base_64_Tools; with Natools.Smaz_Tools; with Natools.Smaz_Tools.GNAT; with Natools.String_Escapes; procedure Smaz is function To_SEA (S : String) return Ada.Streams.Stream_Element_Array renames Natools.S_Expressions.To_Atom; package Tools_256 is new Natools.Smaz_256.Tools; package Tools_4096 is new Natools.Smaz_4096.Tools; package Tools_64 is new Natools.Smaz_64.Tools; package Methods renames Natools.Smaz_Tools.Methods; package Actions is type Enum is (Nothing, Adjust_Dictionary, Decode, Encode, Evaluate); end Actions; package Algorithms is type Enum is (Base_256, Base_4096, Base_64, Base_256_Retired); end Algorithms; package Dict_Sources is type Enum is (S_Expression, Text_List, Unoptimized_Text_List); end Dict_Sources; package Options is type Id is (Base_256, Base_4096, Base_64, Output_Ada_Dict, Check_Roundtrip, Dictionary_Input, Decode, Encode, Evaluate, Filter_Threshold, Output_Hash, Job_Count, Help, Sx_Dict_Output, Min_Sub_Size, Max_Sub_Size, Dict_Size, Max_Pending, Base_256_Retired, Stat_Output, No_Stat_Output, Text_List_Input, Fast_Text_Input, Max_Word_Size, Sx_Output, No_Sx_Output, Force_Word, Max_Dict_Size, Min_Dict_Size, No_Vlen_Verbatim, Score_Method, Vlen_Verbatim); end Options; package Getopt is new Natools.Getopt_Long (Options.Id); type Callback is new Getopt.Handlers.Callback with record Algorithm : Algorithms.Enum := Algorithms.Base_256; Display_Help : Boolean := False; Need_Dictionary : Boolean := False; Stat_Output : Boolean := False; Sx_Output : Boolean := False; Sx_Dict_Output : Boolean := False; Min_Sub_Size : Positive := 1; Max_Sub_Size : Positive := 3; Max_Word_Size : Positive := 10; Max_Dict_Size : Positive := 254; Min_Dict_Size : Positive := 254; Vlen_Verbatim : Boolean := True; Max_Pending : Ada.Containers.Count_Type := Ada.Containers.Count_Type'Last; Job_Count : Natural := 0; Filter_Threshold : Natools.Smaz_Tools.String_Count := 0; Score_Method : Methods.Enum := Methods.Encoded; Action : Actions.Enum := Actions.Nothing; Ada_Dictionary : Ada.Strings.Unbounded.Unbounded_String; Hash_Package : Ada.Strings.Unbounded.Unbounded_String; Dict_Source : Dict_Sources.Enum := Dict_Sources.S_Expression; Check_Roundtrip : Boolean := False; Forced_Words : Natools.Smaz_Tools.String_Lists.List; end record; overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String); overriding procedure Argument (Handler : in out Callback; Argument : in String) is null; function Activate_Dictionary (Dict : in Natools.Smaz_256.Dictionary) return Natools.Smaz_256.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_4096.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_64.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz.Dictionary) return Natools.Smaz.Dictionary; -- Update Dictionary.Hash so that it can be actually used procedure Build_Perfect_Hash (Word_List : in Natools.Smaz.Tools.String_Lists.List; Package_Name : in String); -- Adapter between Smaz_256 generator and retired Smaz types procedure Convert (Input : in Natools.Smaz_Tools.String_Lists.List; Output : out Natools.Smaz.Tools.String_Lists.List); -- Convert between old and new string lists function Getopt_Config return Getopt.Configuration; -- Build the configuration object function Last_Code (Dict : in Natools.Smaz_256.Dictionary) return Ada.Streams.Stream_Element is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_Implementations.Base_4096.Base_4096_Digit is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz.Dictionary) return Ada.Streams.Stream_Element is (Dict.Dict_Last); -- Return the last valid entry function Length (Dict : in Natools.Smaz_256.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz_4096.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz_64.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz.Dictionary) return Positive is (Dict.Offsets'Length); -- Return the number of entries in Dict procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_4096.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_64.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz.Dictionary; Hash_Package_Name : in String := ""); -- print the given dictionary in the given file procedure Print_Help (Opt : in Getopt.Configuration; Output : in Ada.Text_IO.File_Type); -- Print the help text to the given file generic type Dictionary (<>) is private; type Dictionary_Entry is (<>); type Methods is (<>); type Score_Value is range <>; type String_Count is range <>; type Word_Counter is private; type Dictionary_Counts is array (Dictionary_Entry) of String_Count; with package String_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists (String); with function Activate_Dictionary (Dict : in Dictionary) return Dictionary is <>; with procedure Add_Substrings (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); with procedure Add_Words (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); with function Append_String (Dict : in Dictionary; Element : in String) return Dictionary; with procedure Build_Perfect_Hash (Word_List : in String_Lists.List; Package_Name : in String); with function Compress (Dict : in Dictionary; Input : in String) return Ada.Streams.Stream_Element_Array; with function Decompress (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) return String; with function Dict_Entry (Dict : in Dictionary; Element : in Dictionary_Entry) return String; with procedure Evaluate_Dictionary (Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); with procedure Evaluate_Dictionary_Partial (Dict : in Dictionary; Corpus_Entry : in String; Compressed_Size : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts); with procedure Filter_By_Count (Counter : in out Word_Counter; Threshold_Count : in String_Count); with function Last_Code (Dict : in Dictionary) return Dictionary_Entry; with function Length (Dict : in Dictionary) return Positive is <>; with procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dict : in Dictionary; Hash_Package_Name : in String := "") is <>; with function Remove_Element (Dict : in Dictionary; Element : in Dictionary_Entry) return Dictionary; with function Replace_Element (Dict : in Dictionary; Element : in Dictionary_Entry; Value : in String) return Dictionary; Score_Encoded, Score_Frequency, Score_Gain : in access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; with function Simple_Dictionary (Counter : in Word_Counter; Word_Count : in Natural; Method : in Methods) return String_Lists.List; with procedure Simple_Dictionary_And_Pending (Counter : in Word_Counter; Word_Count : in Natural; Selected : out String_Lists.List; Pending : out String_Lists.List; Method : in Methods; Max_Pending_Count : in Ada.Containers.Count_Type); with function To_Dictionary (List : in String_Lists.List; Variable_Length_Verbatim : in Boolean) return Dictionary; with function Worst_Element (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods; First, Last : in Dictionary_Entry) return Dictionary_Entry; package Dictionary_Subprograms is package Holders is new Ada.Containers.Indefinite_Holders (Dictionary); function Adjust_Dictionary (Handler : in Callback'Class; Dict : in Dictionary; Corpus : in String_Lists.List; Method : in Methods) return Dictionary; -- Adjust the given dictionary according to info in Handle procedure Evaluate_Dictionary (Job_Count : in Natural; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); -- Dispatch to parallel or non-parallel version of -- Evaluate_Dictionary depending on Job_Count. function Image (Dict : in Dictionary; Code : in Dictionary_Entry) return Natools.S_Expressions.Atom; -- S-expression image of Code function Is_In_Dict (Dict : Dictionary; Word : String) return Boolean; -- Return whether Word is in Dict (inefficient) function Make_Word_Counter (Handler : in Callback'Class; Input : in String_Lists.List) return Word_Counter; -- Make a word counter from an input word list procedure Optimization_Round (Dict : in out Holders.Holder; Score : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts; First : in Dictionary_Entry; Pending_Words : in out String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive; Updated : out Boolean); -- Try to improve on Dict by replacing a single entry from it with -- one of the substring in Pending_Words. function Optimize_Dictionary (Base : in Dictionary; First : in Dictionary_Entry; Pending_Words : in String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive) return Dictionary; -- Optimize the dictionary on Input_Texts, starting with Base and -- adding substrings from Pending_Words. Operates only on words -- at First and beyond. procedure Parallel_Evaluate_Dictionary (Job_Count : in Positive; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); -- Return the same results as Natools.Smaz.Tools.Evaluate_Dictionary, -- but hopefully more quickly, using Job_Count tasks. procedure Print_Dictionary (Filename : in String; Dict : in Dictionary; Hash_Package_Name : in String := ""); -- print the given dictionary in the given file procedure Process (Handler : in Callback'Class; Word_List : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods); -- Perform the requested operations function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) return Dictionary; -- Convert the input into a dictionary given the option in Handler end Dictionary_Subprograms; package body Dictionary_Subprograms is function Adjust_Dictionary (Handler : in Callback'Class; Dict : in Dictionary; Corpus : in String_Lists.List; Method : in Methods) return Dictionary is begin if Handler.Forced_Words.Is_Empty or else Corpus.Is_Empty then return Dict; end if; Add_Forced_Words : declare Actual_Dict : constant Dictionary := Activate_Dictionary (Dict); Counts : Dictionary_Counts; Discarded_Size : Ada.Streams.Stream_Element_Count; Replacement_Count : String_Count; Current : Holders.Holder := Holders.To_Holder (Actual_Dict); begin Evaluate_Dictionary (Handler.Job_Count, Actual_Dict, Corpus, Discarded_Size, Counts); Replacement_Count := Counts (Counts'First); for I in Counts'Range loop if Replacement_Count < Counts (I) then Replacement_Count := Counts (I); end if; end loop; for Word of Handler.Forced_Words loop if not Is_In_Dict (Actual_Dict, Word) then declare Worst_Index : constant Dictionary_Entry := Worst_Element (Actual_Dict, Counts, Method, Dictionary_Entry'First, Last_Code (Actual_Dict)); New_Dict : constant Dictionary := Replace_Element (Current.Element, Worst_Index, Word); begin Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "Removing" & Counts (Worst_Index)'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Dict_Entry (Actual_Dict, Worst_Index), True) & " at" & Worst_Index'Img & ", replaced by " & Natools.String_Escapes.C_Escape_Hex (Word, True)); Current := Holders.To_Holder (New_Dict); Counts (Worst_Index) := Replacement_Count; end; end if; end loop; return Current.Element; end Add_Forced_Words; end Adjust_Dictionary; procedure Evaluate_Dictionary (Job_Count : in Natural; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts) is Actual_Dict : constant Dictionary := Activate_Dictionary (Dict); begin if Job_Count > 0 then Parallel_Evaluate_Dictionary (Job_Count, Actual_Dict, Corpus, Compressed_Size, Counts); else Evaluate_Dictionary (Actual_Dict, Corpus, Compressed_Size, Counts); end if; end Evaluate_Dictionary; function Image (Dict : in Dictionary; Code : in Dictionary_Entry) return Natools.S_Expressions.Atom is begin return Compress (Dict, Dict_Entry (Dict, Code)); end Image; function Is_In_Dict (Dict : Dictionary; Word : String) return Boolean is begin for Code in Dictionary_Entry'First .. Last_Code (Dict) loop if Dict_Entry (Dict, Code) = Word then return True; end if; end loop; return False; end Is_In_Dict; function Make_Word_Counter (Handler : in Callback'Class; Input : in String_Lists.List) return Word_Counter is use type Natools.Smaz_Tools.String_Count; Counter : Word_Counter; begin for S of Input loop Add_Substrings (Counter, S, Handler.Min_Sub_Size, Handler.Max_Sub_Size); if Handler.Max_Word_Size > Handler.Max_Sub_Size then Add_Words (Counter, S, Handler.Max_Sub_Size + 1, Handler.Max_Word_Size); end if; end loop; if Handler.Filter_Threshold > 0 then Filter_By_Count (Counter, String_Count (Handler.Filter_Threshold)); end if; return Counter; end Make_Word_Counter; procedure Optimization_Round (Dict : in out Holders.Holder; Score : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts; First : in Dictionary_Entry; Pending_Words : in out String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive; Updated : out Boolean) is use type Ada.Streams.Stream_Element_Offset; No_Longer_Pending : String_Lists.Cursor; Log_Message : Ada.Strings.Unbounded.Unbounded_String; Original : constant Dictionary := Dict.Element; Worst_Index : constant Dictionary_Entry := Worst_Element (Original, Counts, Method, First, Last_Code (Original)); Worst_Value : constant String := Dict_Entry (Original, Worst_Index); Worst_Count : constant String_Count := Counts (Worst_Index); Worst_Removed : Boolean := False; Base : constant Dictionary := Remove_Element (Original, Worst_Index); Old_Score : constant Ada.Streams.Stream_Element_Count := Score; begin Updated := False; for Position in Pending_Words.Iterate loop declare Word : constant String := String_Lists.Element (Position); New_Dict : constant Dictionary := Append_String (Base, Word); New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, New_Dict, Input_Texts, New_Score, New_Counts); if New_Score < Score then Dict := Holders.To_Holder (New_Dict); Score := New_Score; Counts := New_Counts; No_Longer_Pending := Position; Worst_Removed := True; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Removing" & Worst_Count'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Worst_Value, True) & ", adding" & Counts (Last_Code (New_Dict))'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Word, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end loop; if Length (Original) < Max_Dict_Size then for Position in Pending_Words.Iterate loop declare Word : constant String := String_Lists.Element (Position); New_Dict : constant Dictionary := Append_String (Original, Word); New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, New_Dict, Input_Texts, New_Score, New_Counts); if New_Score < Score then Dict := Holders.To_Holder (New_Dict); Score := New_Score; Counts := New_Counts; No_Longer_Pending := Position; Worst_Removed := False; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Adding" & Counts (Last_Code (New_Dict))'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Word, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end loop; end if; if Length (Base) >= Min_Dict_Size then declare New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, Base, Input_Texts, New_Score, New_Counts); if New_Score <= Score then Dict := Holders.To_Holder (Base); Score := New_Score; Counts := New_Counts; No_Longer_Pending := String_Lists.No_Element; Worst_Removed := True; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Removing" & Worst_Count'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Worst_Value, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end if; if Updated then if String_Lists.Has_Element (No_Longer_Pending) then Pending_Words.Delete (No_Longer_Pending); end if; if Worst_Removed then Pending_Words.Append (Worst_Value); end if; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, Ada.Strings.Unbounded.To_String (Log_Message)); end if; end Optimization_Round; function Optimize_Dictionary (Base : in Dictionary; First : in Dictionary_Entry; Pending_Words : in String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive) return Dictionary is Holder : Holders.Holder := Holders.To_Holder (Base); Pending : String_Lists.List := Pending_Words; Score : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; Running : Boolean := True; begin Evaluate_Dictionary (Job_Count, Base, Input_Texts, Score, Counts); while Running loop Optimization_Round (Holder, Score, Counts, First, Pending, Input_Texts, Job_Count, Method, Min_Dict_Size, Max_Dict_Size, Running); end loop; return Holder.Element; end Optimize_Dictionary; procedure Parallel_Evaluate_Dictionary (Job_Count : in Positive; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts) is type Result_Values is record Compressed_Size : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; end record; procedure Initialize (Result : in out Result_Values); procedure Get_Next_Job (Global : in out String_Lists.Cursor; Job : out String_Lists.Cursor; Terminated : out Boolean); procedure Do_Job (Result : in out Result_Values; Job : in String_Lists.Cursor); procedure Gather_Result (Global : in out String_Lists.Cursor; Partial : in Result_Values); procedure Initialize (Result : in out Result_Values) is begin Result := (Compressed_Size => 0, Counts => (others => 0)); end Initialize; procedure Get_Next_Job (Global : in out String_Lists.Cursor; Job : out String_Lists.Cursor; Terminated : out Boolean) is begin Job := Global; Terminated := not String_Lists.Has_Element (Global); if not Terminated then String_Lists.Next (Global); end if; end Get_Next_Job; procedure Do_Job (Result : in out Result_Values; Job : in String_Lists.Cursor) is begin Evaluate_Dictionary_Partial (Dict, String_Lists.Element (Job), Result.Compressed_Size, Result.Counts); end Do_Job; procedure Gather_Result (Global : in out String_Lists.Cursor; Partial : in Result_Values) is pragma Unreferenced (Global); use type Ada.Streams.Stream_Element_Count; use type Natools.Smaz_Tools.String_Count; begin Compressed_Size := Compressed_Size + Partial.Compressed_Size; for I in Counts'Range loop Counts (I) := Counts (I) + Partial.Counts (I); end loop; end Gather_Result; procedure Parallel_Run is new Natools.Parallelism.Per_Task_Accumulator_Run (String_Lists.Cursor, Result_Values, String_Lists.Cursor); Cursor : String_Lists.Cursor := String_Lists.First (Corpus); begin Compressed_Size := 0; Counts := (others => 0); Parallel_Run (Cursor, Job_Count); end Parallel_Evaluate_Dictionary; procedure Print_Dictionary (Filename : in String; Dict : in Dictionary; Hash_Package_Name : in String := "") is begin if Filename = "-" then Print_Dictionary (Ada.Text_IO.Current_Output, Dict, Hash_Package_Name); elsif Filename'Length > 0 then declare File : Ada.Text_IO.File_Type; begin Ada.Text_IO.Create (File, Name => Filename); Print_Dictionary (File, Dict, Hash_Package_Name); Ada.Text_IO.Close (File); end; end if; end Print_Dictionary; procedure Process (Handler : in Callback'Class; Word_List : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) is Dict : constant Dictionary := Activate_Dictionary (To_Dictionary (Handler, Word_List, Data_List, Method)); Sx_Output : Natools.S_Expressions.Printers.Canonical (Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Current_Output)); Ada_Dictionary : constant String := Ada.Strings.Unbounded.To_String (Handler.Ada_Dictionary); Hash_Package : constant String := Ada.Strings.Unbounded.To_String (Handler.Hash_Package); begin if Ada_Dictionary'Length > 0 then Print_Dictionary (Ada_Dictionary, Dict, Hash_Package); end if; if Hash_Package'Length > 0 then Build_Perfect_Hash (Word_List, Hash_Package); end if; if Handler.Sx_Dict_Output then Sx_Output.Open_List; for I in Dictionary_Entry'First .. Last_Code (Dict) loop Sx_Output.Append_String (Dict_Entry (Dict, I)); end loop; Sx_Output.Close_List; end if; case Handler.Action is when Actions.Nothing | Actions.Adjust_Dictionary => null; when Actions.Decode => if Handler.Sx_Output then Sx_Output.Open_List; for S of Data_List loop Sx_Output.Append_String (Decompress (Dict, To_SEA (S))); end loop; Sx_Output.Close_List; end if; if Handler.Check_Roundtrip then for S of Data_List loop declare use type Ada.Streams.Stream_Element_Array; Input : constant Ada.Streams.Stream_Element_Array := To_SEA (S); Processed : constant String := Decompress (Dict, Input); Roundtrip : constant Ada.Streams.Stream_Element_Array := Compress (Dict, Processed); begin if Input /= Roundtrip then Sx_Output.Open_List; Sx_Output.Append_String ("decompress-roundtrip-failed"); Sx_Output.Append_Atom (Input); Sx_Output.Append_String (Processed); Sx_Output.Append_Atom (Roundtrip); Sx_Output.Close_List; end if; end; end loop; end if; if Handler.Stat_Output then declare procedure Print_Line (Original, Output : Natural); procedure Print_Line (Original, Output : Natural) is begin Ada.Text_IO.Put_Line (Natural'Image (Original) & Ada.Characters.Latin_1.HT & Natural'Image (Output) & Ada.Characters.Latin_1.HT & Float'Image (Float (Original) / Float (Output))); end Print_Line; Original_Total : Natural := 0; Output_Total : Natural := 0; begin for S of Data_List loop declare Original_Size : constant Natural := S'Length; Output_Size : constant Natural := Decompress (Dict, To_SEA (S))'Length; begin Print_Line (Original_Size, Output_Size); Original_Total := Original_Total + Original_Size; Output_Total := Output_Total + Output_Size; end; end loop; Print_Line (Original_Total, Output_Total); end; end if; when Actions.Encode => if Handler.Sx_Output then Sx_Output.Open_List; for S of Data_List loop Sx_Output.Append_Atom (Compress (Dict, S)); end loop; Sx_Output.Close_List; end if; if Handler.Check_Roundtrip then for S of Data_List loop declare Processed : constant Ada.Streams.Stream_Element_Array := Compress (Dict, S); Roundtrip : constant String := Decompress (Dict, Processed); begin if S /= Roundtrip then Sx_Output.Open_List; Sx_Output.Append_String ("compress-roundtrip-failed"); Sx_Output.Append_String (S); Sx_Output.Append_Atom (Processed); Sx_Output.Append_String (Roundtrip); Sx_Output.Close_List; end if; end; end loop; end if; if Handler.Stat_Output then declare procedure Print_Line (Original, Output, Base64 : Natural); procedure Print_Line (Original, Output, Base64 : in Natural) is begin Ada.Text_IO.Put_Line (Natural'Image (Original) & Ada.Characters.Latin_1.HT & Natural'Image (Output) & Ada.Characters.Latin_1.HT & Natural'Image (Base64) & Ada.Characters.Latin_1.HT & Float'Image (Float (Output) / Float (Original)) & Ada.Characters.Latin_1.HT & Float'Image (Float (Base64) / Float (Original))); end Print_Line; Original_Total : Natural := 0; Output_Total : Natural := 0; Base64_Total : Natural := 0; begin for S of Data_List loop declare Original_Size : constant Natural := S'Length; Output_Size : constant Natural := Compress (Dict, S)'Length; Base64_Size : constant Natural := ((Output_Size + 2) / 3) * 4; begin Print_Line (Original_Size, Output_Size, Base64_Size); Original_Total := Original_Total + Original_Size; Output_Total := Output_Total + Output_Size; Base64_Total := Base64_Total + Base64_Size; end; end loop; Print_Line (Original_Total, Output_Total, Base64_Total); end; end if; when Actions.Evaluate => declare Total_Size : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; begin Evaluate_Dictionary (Handler.Job_Count, Dict, Data_List, Total_Size, Counts); if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_String (Ada.Strings.Fixed.Trim (Ada.Streams.Stream_Element_Count'Image (Total_Size), Ada.Strings.Both)); for E in Dictionary_Entry'First .. Last_Code (Dict) loop Sx_Output.Open_List; Sx_Output.Append_Atom (Image (Dict, E)); Sx_Output.Append_String (Dict_Entry (Dict, E)); Sx_Output.Append_String (Ada.Strings.Fixed.Trim (String_Count'Image (Counts (E)), Ada.Strings.Both)); Sx_Output.Close_List; end loop; Sx_Output.Close_List; end if; if Handler.Stat_Output then declare procedure Print (Label : in String; E : in Dictionary_Entry; Score : in Score_Value); procedure Print_Min_Max (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value); procedure Print_Value (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; Ref : in Score_Value); procedure Print (Label : in String; E : in Dictionary_Entry; Score : in Score_Value) is begin if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_Atom (Image (Dict, E)); Sx_Output.Append_String (Dict_Entry (Dict, E)); Sx_Output.Append_String (Ada.Strings.Fixed.Trim (Score'Img, Ada.Strings.Both)); Sx_Output.Close_List; else Ada.Text_IO.Put_Line (Label & Ada.Characters.Latin_1.HT & Dictionary_Entry'Image (E) & Ada.Characters.Latin_1.HT & Natools.String_Escapes.C_Escape_Hex (Dict_Entry (Dict, E), True) & Ada.Characters.Latin_1.HT & Score'Img); end if; end Print; procedure Print_Min_Max (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value) is Min_Score, Max_Score : Score_Value := Score (Dict, Counts, Dictionary_Entry'First); S : Score_Value; begin for E in Dictionary_Entry'Succ (Dictionary_Entry'First) .. Last_Code (Dict) loop S := Score (Dict, Counts, E); if S < Min_Score then Min_Score := S; end if; if S > Max_Score then Max_Score := S; end if; end loop; Print_Value ("best-" & Label, Score, Max_Score); Print_Value ("worst-" & Label, Score, Min_Score); end Print_Min_Max; procedure Print_Value (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; Ref : in Score_Value) is begin if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_String (Label); end if; for E in Dictionary_Entry'First .. Last_Code (Dict) loop if Score (Dict, Counts, E) = Ref then Print (Label, E, Ref); end if; end loop; if Handler.Sx_Output then Sx_Output.Close_List; end if; end Print_Value; begin Print_Min_Max ("encoded", Score_Encoded); Print_Min_Max ("frequency", Score_Frequency); Print_Min_Max ("gain", Score_Gain); end; end if; end; end case; end Process; function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) return Dictionary is begin case Handler.Dict_Source is when Dict_Sources.S_Expression => return Adjust_Dictionary (Handler, To_Dictionary (Input, Handler.Vlen_Verbatim), Data_List, Method); when Dict_Sources.Text_List => declare Needed : constant Integer := Handler.Max_Dict_Size - Natural (Handler.Forced_Words.Length); Selected, Pending : String_Lists.List; First : Dictionary_Entry := Dictionary_Entry'First; begin if Needed <= 0 then for Word of reverse Handler.Forced_Words loop Selected.Prepend (Word); exit when Positive (Selected.Length) = Handler.Max_Dict_Size; end loop; return To_Dictionary (Selected, Handler.Vlen_Verbatim); end if; Simple_Dictionary_And_Pending (Make_Word_Counter (Handler, Input), Needed, Selected, Pending, Method, Handler.Max_Pending); for Word of reverse Handler.Forced_Words loop Selected.Prepend (Word); First := Dictionary_Entry'Succ (First); end loop; return Optimize_Dictionary (To_Dictionary (Selected, Handler.Vlen_Verbatim), First, Pending, Input, Handler.Job_Count, Method, Handler.Min_Dict_Size, Handler.Max_Dict_Size); end; when Dict_Sources.Unoptimized_Text_List => declare Needed : constant Integer := Handler.Max_Dict_Size - Natural (Handler.Forced_Words.Length); All_Words : String_Lists.List; begin if Needed > 0 then All_Words := Simple_Dictionary (Make_Word_Counter (Handler, Input), Needed, Method); for Word of reverse Handler.Forced_Words loop All_Words.Prepend (Word); end loop; else for Word of reverse Handler.Forced_Words loop All_Words.Prepend (Word); exit when Positive (All_Words.Length) >= Handler.Max_Dict_Size; end loop; end if; return To_Dictionary (All_Words, Handler.Vlen_Verbatim); end; end case; end To_Dictionary; end Dictionary_Subprograms; package Dict_256 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_256.Dictionary, Dictionary_Entry => Ada.Streams.Stream_Element, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_256.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_256.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_256.Compress, Decompress => Natools.Smaz_256.Decompress, Dict_Entry => Natools.Smaz_256.Dict_Entry, Evaluate_Dictionary => Tools_256.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_256.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_256.Remove_Element, Replace_Element => Tools_256.Replace_Element, Score_Encoded => Tools_256.Score_Encoded'Access, Score_Frequency => Tools_256.Score_Frequency'Access, Score_Gain => Tools_256.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_256.To_Dictionary, Worst_Element => Tools_256.Worst_Index); package Dict_4096 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_4096.Dictionary, Dictionary_Entry => Natools.Smaz_Implementations.Base_4096.Base_4096_Digit, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_4096.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_4096.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_4096.Compress, Decompress => Natools.Smaz_4096.Decompress, Dict_Entry => Natools.Smaz_4096.Dict_Entry, Evaluate_Dictionary => Tools_4096.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_4096.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_4096.Remove_Element, Replace_Element => Tools_4096.Replace_Element, Score_Encoded => Tools_4096.Score_Encoded'Access, Score_Frequency => Tools_4096.Score_Frequency'Access, Score_Gain => Tools_4096.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_4096.To_Dictionary, Worst_Element => Tools_4096.Worst_Index); package Dict_64 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_64.Dictionary, Dictionary_Entry => Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_64.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_64.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_64.Compress, Decompress => Natools.Smaz_64.Decompress, Dict_Entry => Natools.Smaz_64.Dict_Entry, Evaluate_Dictionary => Tools_64.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_64.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_64.Remove_Element, Replace_Element => Tools_64.Replace_Element, Score_Encoded => Tools_64.Score_Encoded'Access, Score_Frequency => Tools_64.Score_Frequency'Access, Score_Gain => Tools_64.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_64.To_Dictionary, Worst_Element => Tools_64.Worst_Index); package Dict_Retired is new Dictionary_Subprograms (Dictionary => Natools.Smaz.Dictionary, Dictionary_Entry => Ada.Streams.Stream_Element, Methods => Natools.Smaz.Tools.Methods.Enum, Score_Value => Natools.Smaz.Tools.Score_Value, String_Count => Natools.Smaz.Tools.String_Count, Word_Counter => Natools.Smaz.Tools.Word_Counter, Dictionary_Counts => Natools.Smaz.Tools.Dictionary_Counts, String_Lists => Natools.Smaz.Tools.String_Lists, Add_Substrings => Natools.Smaz.Tools.Add_Substrings, Add_Words => Natools.Smaz.Tools.Add_Words, Append_String => Natools.Smaz.Tools.Append_String, Build_Perfect_Hash => Build_Perfect_Hash, Compress => Natools.Smaz.Compress, Decompress => Natools.Smaz.Decompress, Dict_Entry => Natools.Smaz.Dict_Entry, Evaluate_Dictionary => Natools.Smaz.Tools.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Natools.Smaz.Tools.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz.Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Natools.Smaz.Tools.Remove_Element, Replace_Element => Natools.Smaz.Tools.Replace_Element, Score_Encoded => Natools.Smaz.Tools.Score_Encoded'Access, Score_Frequency => Natools.Smaz.Tools.Score_Frequency'Access, Score_Gain => Natools.Smaz.Tools.Score_Gain'Access, Simple_Dictionary => Natools.Smaz.Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz.Tools.Simple_Dictionary_And_Pending, To_Dictionary => Natools.Smaz.Tools.To_Dictionary, Worst_Element => Natools.Smaz.Tools.Worst_Index); overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String) is begin case Id is when Options.Help => Handler.Display_Help := True; when Options.Decode => Handler.Need_Dictionary := True; Handler.Action := Actions.Decode; when Options.Encode => Handler.Need_Dictionary := True; Handler.Action := Actions.Encode; when Options.Evaluate => Handler.Need_Dictionary := True; Handler.Action := Actions.Evaluate; when Options.No_Stat_Output => Handler.Stat_Output := False; when Options.No_Sx_Output => Handler.Sx_Output := False; when Options.Output_Ada_Dict => Handler.Need_Dictionary := True; if Argument'Length > 0 then Handler.Ada_Dictionary := Ada.Strings.Unbounded.To_Unbounded_String (Argument); else Handler.Ada_Dictionary := Ada.Strings.Unbounded.To_Unbounded_String ("-"); end if; when Options.Output_Hash => Handler.Need_Dictionary := True; Handler.Hash_Package := Ada.Strings.Unbounded.To_Unbounded_String (Argument); when Options.Stat_Output => Handler.Stat_Output := True; when Options.Sx_Output => Handler.Sx_Output := True; when Options.Dictionary_Input => Handler.Dict_Source := Dict_Sources.S_Expression; when Options.Text_List_Input => Handler.Dict_Source := Dict_Sources.Text_List; when Options.Fast_Text_Input => Handler.Dict_Source := Dict_Sources.Unoptimized_Text_List; when Options.Sx_Dict_Output => Handler.Need_Dictionary := True; Handler.Sx_Dict_Output := True; when Options.Min_Sub_Size => Handler.Min_Sub_Size := Positive'Value (Argument); when Options.Max_Sub_Size => Handler.Max_Sub_Size := Positive'Value (Argument); when Options.Max_Word_Size => Handler.Max_Word_Size := Positive'Value (Argument); when Options.Job_Count => Handler.Job_Count := Natural'Value (Argument); when Options.Filter_Threshold => Handler.Filter_Threshold := Natools.Smaz_Tools.String_Count'Value (Argument); when Options.Score_Method => Handler.Score_Method := Methods.Enum'Value (Argument); when Options.Max_Pending => Handler.Max_Pending := Ada.Containers.Count_Type'Value (Argument); when Options.Dict_Size => Handler.Min_Dict_Size := Positive'Value (Argument); Handler.Max_Dict_Size := Positive'Value (Argument); when Options.Vlen_Verbatim => Handler.Vlen_Verbatim := True; when Options.No_Vlen_Verbatim => Handler.Vlen_Verbatim := False; when Options.Base_256 => Handler.Algorithm := Algorithms.Base_256; when Options.Base_256_Retired => Handler.Algorithm := Algorithms.Base_256_Retired; when Options.Base_64 => Handler.Algorithm := Algorithms.Base_64; when Options.Base_4096 => Handler.Algorithm := Algorithms.Base_4096; when Options.Check_Roundtrip => Handler.Check_Roundtrip := True; when Options.Force_Word => if Argument'Length > 0 then Handler.Need_Dictionary := True; Handler.Forced_Words.Append (Argument); if Handler.Action in Actions.Nothing then Handler.Action := Actions.Adjust_Dictionary; end if; end if; when Options.Max_Dict_Size => Handler.Max_Dict_Size := Positive'Value (Argument); when Options.Min_Dict_Size => Handler.Min_Dict_Size := Positive'Value (Argument); end case; end Option; function Activate_Dictionary (Dict : in Natools.Smaz_256.Dictionary) return Natools.Smaz_256.Dictionary is Result : Natools.Smaz_256.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_256.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_256.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_4096.Dictionary is Result : Natools.Smaz_4096.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_4096.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_4096.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_64.Dictionary is Result : Natools.Smaz_64.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_64.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_64.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz.Dictionary) return Natools.Smaz.Dictionary is Result : Natools.Smaz.Dictionary := Dict; begin Natools.Smaz.Tools.Set_Dictionary_For_Trie_Search (Result); Result.Hash := Natools.Smaz.Tools.Trie_Search'Access; for I in Result.Offsets'Range loop if Natools.Smaz.Tools.Trie_Search (Natools.Smaz.Dict_Entry (Result, I)) /= Natural (I) then Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "Fail at" & Ada.Streams.Stream_Element'Image (I) & " -> " & Natools.String_Escapes.C_Escape_Hex (Natools.Smaz.Dict_Entry (Result, I), True) & " ->" & Natural'Image (Natools.Smaz.Tools.Trie_Search (Natools.Smaz.Dict_Entry (Result, I)))); end if; end loop; return Result; end Activate_Dictionary; procedure Build_Perfect_Hash (Word_List : in Natools.Smaz.Tools.String_Lists.List; Package_Name : in String) is Other_Word_List : Natools.Smaz_Tools.String_Lists.List; begin for S of Word_List loop Natools.Smaz_Tools.String_Lists.Append (Other_Word_List, S); end loop; Natools.Smaz_Tools.GNAT.Build_Perfect_Hash (Other_Word_List, Package_Name); end Build_Perfect_Hash; procedure Convert (Input : in Natools.Smaz_Tools.String_Lists.List; Output : out Natools.Smaz.Tools.String_Lists.List) is begin Natools.Smaz.Tools.String_Lists.Clear (Output); for S of Input loop Natools.Smaz.Tools.String_Lists.Append (Output, S); end loop; end Convert; function Getopt_Config return Getopt.Configuration is use Getopt; use Options; R : Getopt.Configuration; begin R.Add_Option ("base-256", '2', No_Argument, Base_256); R.Add_Option ("base-4096", '4', No_Argument, Base_4096); R.Add_Option ("base-64", '6', No_Argument, Base_64); R.Add_Option ("ada-dict", 'A', Optional_Argument, Output_Ada_Dict); R.Add_Option ("check", 'C', No_Argument, Check_Roundtrip); R.Add_Option ("decode", 'd', No_Argument, Decode); R.Add_Option ("dict", 'D', No_Argument, Dictionary_Input); R.Add_Option ("encode", 'e', No_Argument, Encode); R.Add_Option ("evaluate", 'E', No_Argument, Evaluate); R.Add_Option ("filter", 'F', Required_Argument, Filter_Threshold); R.Add_Option ("help", 'h', No_Argument, Help); R.Add_Option ("hash-pkg", 'H', Required_Argument, Output_Hash); R.Add_Option ("jobs", 'j', Required_Argument, Job_Count); R.Add_Option ("sx-dict", 'L', No_Argument, Sx_Dict_Output); R.Add_Option ("min-substring", 'm', Required_Argument, Min_Sub_Size); R.Add_Option ("max-substring", 'M', Required_Argument, Max_Sub_Size); R.Add_Option ("dict-size", 'n', Required_Argument, Dict_Size); R.Add_Option ("max-pending", 'N', Required_Argument, Max_Pending); R.Add_Option ("retired", 'R', No_Argument, Base_256_Retired); R.Add_Option ("stats", 's', No_Argument, Stat_Output); R.Add_Option ("no-stats", 'S', No_Argument, No_Stat_Output); R.Add_Option ("text-list", 't', No_Argument, Text_List_Input); R.Add_Option ("fast-text-list", 'T', No_Argument, Fast_Text_Input); R.Add_Option ("max-word-len", 'W', Required_Argument, Max_Word_Size); R.Add_Option ("s-expr", 'x', No_Argument, Sx_Output); R.Add_Option ("no-s-expr", 'X', No_Argument, No_Sx_Output); R.Add_Option ("force-word", Required_Argument, Force_Word); R.Add_Option ("max-dict-size", Required_Argument, Max_Dict_Size); R.Add_Option ("min-dict-size", Required_Argument, Min_Dict_Size); R.Add_Option ("no-vlen-verbatim", No_Argument, No_Vlen_Verbatim); R.Add_Option ("score-method", Required_Argument, Score_Method); R.Add_Option ("vlen-verbatim", No_Argument, Vlen_Verbatim); return R; end Getopt_Config; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_256.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_4096.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_4096.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_64.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_64.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Natools.Smaz.Tools.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Help (Opt : in Getopt.Configuration; Output : in Ada.Text_IO.File_Type) is use Ada.Text_IO; Indent : constant String := " "; begin Put_Line (Output, "Usage:"); for Id in Options.Id loop Put (Output, Indent & Opt.Format_Names (Id)); case Id is when Options.Help => New_Line (Output); Put_Line (Output, Indent & Indent & "Display this help text"); when Options.Decode => New_Line (Output); Put_Line (Output, Indent & Indent & "Read a list of strings and decode them"); when Options.Encode => New_Line (Output); Put_Line (Output, Indent & Indent & "Read a list of strings and encode them"); when Options.No_Stat_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Do not output filter statistics"); when Options.No_Sx_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Do not output filtered results in a S-expression"); when Options.Output_Ada_Dict => Put_Line (Output, " [filename]"); Put_Line (Output, Indent & Indent & "Output the current dictionary as Ada code in the given"); Put_Line (Output, Indent & Indent & "file, or standard output if filename is empty or ""-"""); when Options.Output_Hash => Put_Line (Output, " <Hash_Package_Name>"); Put_Line (Output, Indent & Indent & "Build a package with a perfect hash function for the"); Put_Line (Output, Indent & Indent & "current dictionary."); when Options.Stat_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output filter statistics"); when Options.Sx_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output filtered results in a S-expression"); when Options.Dictionary_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Read dictionary directly in input S-expression (default)"); when Options.Text_List_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Compute dictionary from sample texts" & " in input S-expression"); when Options.Fast_Text_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Compute dictionary from sample texts" & " in input S-expression, without optimization"); when Options.Sx_Dict_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output the dictionary as a S-expression"); when Options.Min_Sub_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Minimum substring size when building a dictionary"); when Options.Max_Sub_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Maximum substring size when building a dictionary"); when Options.Max_Word_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Maximum word size when building a dictionary"); when Options.Evaluate => New_Line (Output); Put_Line (Output, Indent & Indent & "Evaluate the dictionary on the input given corpus"); when Options.Job_Count => Put_Line (Output, " <number>"); Put_Line (Output, Indent & Indent & "Number of parallel jobs in long calculations"); when Options.Filter_Threshold => Put_Line (Output, " <threshold>"); Put_Line (Output, Indent & Indent & "Before building a dictionary from substrings, remove"); Put_Line (Output, Indent & Indent & "substrings whose count is below the threshold."); when Options.Score_Method => Put_Line (Output, " <method>"); Put_Line (Output, Indent & Indent & "Select heuristic method to replace dictionary items" & " during optimization"); when Options.Max_Pending => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Maximum size of candidate list" & " when building a dictionary"); when Options.Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Number of words in the dictionary to build"); when Options.Vlen_Verbatim => New_Line (Output); Put_Line (Output, Indent & Indent & "Enable variable-length verbatim in built dictionary"); when Options.No_Vlen_Verbatim => New_Line (Output); Put_Line (Output, Indent & Indent & "Disable variable-length verbatim in built dictionary"); when Options.Base_256 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-256 implementation (default)"); when Options.Base_256_Retired => New_Line (Output); Put_Line (Output, Indent & Indent & "Use retired base-256 implementation"); when Options.Base_64 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-64 implementation"); when Options.Base_4096 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-4096 implementation"); when Options.Check_Roundtrip => New_Line (Output); Put_Line (Output, Indent & Indent & "Check roundtrip of compression or decompression"); when Options.Force_Word => Put_Line (Output, " <word>"); Put_Line (Output, Indent & Indent & "Force <word> into the dictionary," & " replacing the worst entry"); Put_Line (Output, Indent & Indent & "Can be specified multiple times to force many words."); when Options.Max_Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Maximum number of words in the dictionary to build"); when Options.Min_Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Minimum number of words in the dictionary to build"); end case; end loop; end Print_Help; Opt_Config : constant Getopt.Configuration := Getopt_Config; Handler : Callback; Input_List, Input_Data : Natools.Smaz_Tools.String_Lists.List; begin Process_Command_Line : begin Opt_Config.Process (Handler); exception when Getopt.Option_Error => Print_Help (Opt_Config, Ada.Text_IO.Current_Error); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end Process_Command_Line; if Handler.Display_Help then Print_Help (Opt_Config, Ada.Text_IO.Current_Output); end if; if not Handler.Need_Dictionary then return; end if; if not (Handler.Stat_Output or Handler.Sx_Output or Handler.Check_Roundtrip) then Handler.Sx_Output := True; end if; Read_Input_List : declare use type Actions.Enum; Input : constant access Ada.Streams.Root_Stream_Type'Class := Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Current_Input); Parser : Natools.S_Expressions.Parsers.Stream_Parser (Input); begin Parser.Next; Natools.Smaz_Tools.Read_List (Input_List, Parser); if Handler.Action /= Actions.Nothing then Parser.Next; Natools.Smaz_Tools.Read_List (Input_Data, Parser); end if; end Read_Input_List; case Handler.Algorithm is when Algorithms.Base_256 => Dict_256.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_64 => Dict_64.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_4096 => Dict_4096.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_256_Retired => declare Converted_Input_List : Natools.Smaz.Tools.String_Lists.List; Converted_Input_Data : Natools.Smaz.Tools.String_Lists.List; begin Convert (Input_List, Converted_Input_List); Convert (Input_Data, Converted_Input_Data); Dict_Retired.Process (Handler, Converted_Input_List, Converted_Input_Data, Natools.Smaz.Tools.Methods.Enum'Val (Natools.Smaz_Tools.Methods.Enum'Pos (Handler.Score_Method))); end; end case; end Smaz;
Exams/Test2_2015_2016/11.als
pemesteves/MFES_2021
0
4973
sig Name {} sig Pessoa { n: one Name, descendentes : set Pessoa } fun getAscendents[p: Pessoa]: set Pessoa { {p1: Pessoa | p != p1 and p in p1} } -- a) fact onlyTwoAscendents{ all p: Pessoa | #getAscendents[p] <= 2 } -- b) fun getFirstPerson: Pessoa { {p: Pessoa | all p1: Pessoa | p != p1 and p1 in p.^descendentes} }
src/main/antlr4/a2lParser.g4
ThaisMatos/A2LParser
12
2666
/* TODO: check for guessed definitions and compare them to the real 1.7 definition (1.7 spec needed) */ parser grammar a2lParser; options { tokenVocab=a2lLexer; } @header { package net.alenzen.a2l.antlr; } string_exp : string=STRING; conversion_type : RAT_FUNC | TAB_INTP | TAB_NOINTP | TAB_VERB | FORM | IDENTICAL | LINEAR; prg_type_memory_layout : PRG_CODE | PRG_DATA | PRG_RESERVED; prg_type_memory_segment : CALIBRATION_VARIABLES | CODE | DATA | EXCLUDE_FROM_FLASH | OFFLINE_DATA | RESERVED | SERAM | VARIABLES; memory_type : EEPROM | EPROM | FLASH | RAM | ROM | REGISTER | NOT_IN_ECU; byte_order_enum : LITTLE_ENDIAN | BIG_ENDIAN | MSB_FIRST | MSB_LAST; deposit_mode : ABSOLUTE | DIFFERENCE; datatype_enum : UBYTE | SBYTE | UWORD | SWORD | ULONG | SLONG | A_UINT64 | A_INT64 | FLOAT32_IEEE | FLOAT64_IEEE; datasize_enum : BYTE | WORD | LONG; index_mode_enum : COLUMN_DIR | ROW_DIR | ALTERNATE_WITH_X | ALTERNATE_WITH_Y | ALTERNATE_CURVES; addresstype_enum : PBYTE | PWORD | PLONG | DIRECT; index_order_enum : INDEX_INCR | INDEX_DECR; calibration_access_enum : CALIBRATION | NO_CALIBRATION | NOT_IN_MCD_SYSTEM | OFFLINE_CALIBRATION; type_enum : VALUE | CURVE | MAP | CUBOID | VAL_BLK | ASCII | CUBE_4 | CUBE_5; unit_type_enum : DERIVED | EXTENDED_SI; attribute_memory_segment : INTERN | EXTERN; attribute_axis_descr_enum : STD_AXIS | FIX_AXIS | COM_AXIS | RES_AXIS | CURVE_AXIS; monotony_enum : MON_INCREASE | MON_DECREASE | STRICT_INCREASE | STRICT_DECREASE | MONOTONOUS | STRICT_MON | NOT_MON; int_value : INT | HEX_VALUE; value : INT | DECIMAL | HEX_VALUE; value_pair : InVal=value OutVal=value; /* ROOT rule to interpret content */ a2l_file : (a2ml_version_exp | asap2_version_exp)* project_block; /* ROOT rule to interpret includes */ a2l_file_includes : (Includes+=include_exp | .)*?; include_exp : INCLUDE Filename=FILEPATH; /* A2ML_VERSION */ a2ml_version_exp : A2ML_VERSION VersionNo=int_value UpgradeNo=int_value; /* ASAP2_VERSION */ asap2_version_exp : ASAP2_VERSION VersionNo=int_value UpgradeNo=int_value; /* PROJECT */ project_exp : PROJECT Name=IDENTIFIER LongIdentifier=string_exp; project_block : BEGIN project_exp project_sub_nodes END PROJECT; project_sub_nodes : ( header_block | module_block | include_exp )*; /* HEADER */ header_exp : HEADER Comment=string_exp; header_block : BEGIN header_exp header_sub_nodes END HEADER; header_sub_nodes : (version_exp | project_no_exp)*; version_exp : VERSION VersionIdentifier=string_exp; project_no_exp : PROJECT_NO ProjectNumber=IDENTIFIER; /* MODULE */ module_exp : MODULE Name=IDENTIFIER LongIdentifier=string_exp; module_block : BEGIN module_exp module_sub_nodes END MODULE; module_sub_nodes : ( a2ml_block | if_data_block | mod_common_block | mod_par_block | compu_method_block | compu_tab_block | compu_vtab_block | compu_vtab_range_block | measurement_block | record_layout_block | characteristic_block | axis_pts_block | function_block | group_block | frame_block | unit_block | user_rights_block | typedef_characteristic_block | instance_block | typedef_axis_block | typedef_structure_block | transformer_block | blob_block | variant_coding_block | include_exp // TODO: TYPEDEF_BLOB TYPEDEF_MEASURMENT )* ; /* UNIT */ unit_exp : UNIT Name=IDENTIFIER LongIdentifier=string_exp Display=string_exp Type=unit_type_enum; unit_block : BEGIN unit_exp unit_sub_nodes END UNIT; unit_sub_nodes : ( ref_unit_exp | si_exponents_exp | unit_conversion_exp )*; si_exponents_exp : SI_EXPONENTS Length=int_value Mass=int_value Time=int_value ElectricCurrent=int_value Temperature=int_value AmountOfSubstance=int_value LuminousIntensity=int_value; unit_conversion_exp : UNIT_CONVERSION Gradient=value Offset=value; /* USER_RIGHTS */ user_rights_exp : USER_RIGHTS UserLevelId=IDENTIFIER; user_rights_block : BEGIN user_rights_exp user_rights_sub_nodes END USER_RIGHTS; user_rights_sub_nodes : ( read_only_exp | ref_group_block )*; ref_group_block : BEGIN REF_GROUP Identifier+=IDENTIFIER* END REF_GROUP; /* FRAME */ frame_exp : FRAME Name=IDENTIFIER LongIdentifier=string_exp ScalingUnit=int_value Rate=int_value; frame_block : BEGIN frame_exp frame_sub_nodes END FRAME; frame_sub_nodes : ( frame_measurement_exp | if_data_block )*; frame_measurement_exp : FRAME_MEASUREMENT Identifier+=IDENTIFIER*; /* A2ML */ a2ml_block : A2ML_BLOCK; /* IF_DATA */ if_data_block : IF_DATA_BLOCK; /* BLOB */ blob_block : BLOB_A2ML_BLOCK; /* MOD_COMMON */ mod_common_exp : MOD_COMMON Comment=string_exp; mod_common_block : BEGIN mod_common_exp mod_common_sub_nodes END MOD_COMMON; mod_common_sub_nodes : ( alignment_byte_exp | alignment_word_exp | alignment_long_exp | alignment_int64_exp | alignment_float32_exp | alignment_float64_exp | deposit_exp | byte_order_exp | data_size_exp | s_rec_layout_exp )*; alignment_byte_exp : ALIGNMENT_BYTE AlignmentBorder=int_value; alignment_word_exp : ALIGNMENT_WORD AlignmentBorder=int_value; alignment_long_exp : ALIGNMENT_LONG AlignmentBorder=int_value; alignment_int64_exp : ALIGNMENT_INT64 AlignmentBorder=int_value; alignment_float32_exp : ALIGNMENT_FLOAT32_IEEE AlignmentBorder=int_value; alignment_float64_exp : ALIGNMENT_FLOAT64_IEEE AlignmentBorder=int_value; deposit_exp : DEPOSIT Mode=deposit_mode; byte_order_exp : BYTE_ORDER ByteOrder=byte_order_enum; data_size_exp : DATA_SIZE Size=int_value; // S_REC_LAYOUT is not part of 1.7.1 but in 1.5.1 s_rec_layout_exp : S_REC_LAYOUT Name=IDENTIFIER; /* MOD_PAR */ mod_par_exp : MOD_PAR Comment=string_exp; mod_par_block : BEGIN mod_par_exp mod_par_sub_nodes END MOD_PAR; mod_par_sub_nodes : ( no_of_interfaces_exp | memory_segment_block | system_constant_exp | version_exp | addr_epk_exp | epk_exp | supplier_exp | customer_exp | customer_no_exp | user_exp | phone_no_exp | ecu_exp | cpu_type_exp | ecu_calibration_offset_exp | calibration_method_block | memory_layout_block )*; no_of_interfaces_exp : NO_OF_INTERFACES Num=int_value; memory_segment_exp : MEMORY_SEGMENT Name=IDENTIFIER LongIdentifier=string_exp PrgType=prg_type_memory_segment MemoryType=memory_type Attribute=attribute_memory_segment Address=int_value Size=int_value (Offset+=int_value Offset+=int_value Offset+=int_value Offset+=int_value Offset+=int_value); memory_segment_block : BEGIN memory_segment_exp memory_segment_sub_nodes END MEMORY_SEGMENT; memory_segment_sub_nodes : (if_data_block)*; system_constant_exp : SYSTEM_CONSTANT Name=string_exp Value=string_exp; memory_layout_exp : MEMORY_LAYOUT PrgType=prg_type_memory_layout Address=int_value Size=int_value (Offset+=int_value Offset+=int_value Offset+=int_value Offset+=int_value Offset+=int_value); memory_layout_block : BEGIN memory_layout_exp memory_layout_sub_nodes END MEMORY_LAYOUT; memory_layout_sub_nodes : ( if_data_block )*; calibration_method_exp : CALIBRATION_METHOD Method=string_exp Version=int_value; calibration_method_block : BEGIN calibration_method_exp calibration_method_sub_nodes END CALIBRATION_METHOD; calibration_method_sub_nodes: ( calibration_handle_block )*; calibration_handle_block : BEGIN CALIBRATION_HANDLE Handle+=int_value* calibration_handle_text_exp? END CALIBRATION_HANDLE; calibration_handle_text_exp : CALIBRATION_HANDLE_TEXT text=string_exp; ecu_calibration_offset_exp : ECU_CALIBRATION_OFFSET Offset=int_value; cpu_type_exp : CPU_TYPE CPU=string_exp; ecu_exp : ECU ControlUnit=string_exp; phone_no_exp : PHONE_NO PhoneNo=string_exp; user_exp : USER UserName=string_exp; customer_exp : CUSTOMER Customer=string_exp; customer_no_exp : CUSTOMER_NO Number=string_exp; supplier_exp : SUPPLIER Manufacturer=string_exp; epk_exp : EPK Identifier=string_exp; addr_epk_exp : ADDR_EPK Address=int_value; /* COMPU_METHOD */ compu_method_exp : COMPU_METHOD Name=IDENTIFIER LongIdentifier=string_exp ConversionType=conversion_type Format=string_exp Unit=string_exp; compu_method_block : BEGIN compu_method_exp compu_method_sub_nodes END COMPU_METHOD; compu_method_sub_nodes : ( formula_block | coeffs_exp | compu_tab_ref_exp | ref_unit_exp | coeffs_linear_exp | status_string_ref_exp )*; formula_exp : FORMULA f_x=string_exp; formula_block : BEGIN formula_exp formula_inv_exp? END FORMULA; formula_inv_exp : FORMULA_INV g_x=string_exp; coeffs_exp : COEFFS a=value b=value c=value d=value e=value f=value; coeffs_linear_exp : COEFFS_LINEAR a=value b=value; compu_tab_ref_exp : COMPU_TAB_REF ConversionTable=IDENTIFIER; ref_unit_exp : REF_UNIT Unit=IDENTIFIER; status_string_ref_exp : STATUS_STRING_REF ConversionTable=IDENTIFIER; /* COMPU_TAB */ compu_tab_exp : COMPU_TAB Name=IDENTIFIER LongIdentifier=string_exp ConversionType=conversion_type NumberValuePairs=int_value ValuePairs+=value_pair*; compu_tab_block : BEGIN compu_tab_exp compu_tab_sub_nodes END COMPU_TAB; compu_tab_sub_nodes : (default_value_numeric_exp | default_value_exp)*; default_value_numeric_exp : DEFAULT_VALUE_NUMERIC display_value=value; default_value_exp : DEFAULT_VALUE display_string=string_exp; /* COMPU_VTAB */ value_description_pair : InVal=value OutVal=string_exp; compu_vtab_exp : COMPU_VTAB Name=IDENTIFIER LongIdentifier=string_exp ConversionType=TAB_VERB NumberValuePairs=int_value ValuePairs+=value_description_pair*; compu_vtab_block : BEGIN compu_vtab_exp compu_vtab_default_value? END COMPU_VTAB; compu_vtab_default_value : DEFAULT_VALUE Value=string_exp; /* COMPU_VTAB_RANGE */ value_description_triple : InValMin=value InValMax=value OutVal=string_exp; compu_vtab_range_exp : COMPU_VTAB_RANGE Name=IDENTIFIER LongIdentifier=string_exp NumberValueTriples=int_value ValueTriples+=value_description_triple*; compu_vtab_range_block : BEGIN compu_vtab_range_exp compu_vtab_range_default_value? END COMPU_VTAB_RANGE; compu_vtab_range_default_value : DEFAULT_VALUE Value=string_exp; /* MEASUREMENT */ measurement_exp : MEASUREMENT Name=IDENTIFIER LongIdentifier=string_exp Datatype=datatype_enum Conversion=IDENTIFIER Resolution=int_value Accuracy=value LowerLimit=value UpperLimit=value; measurement_block : BEGIN measurement_exp measurement_sub_nodes END MEASUREMENT; measurement_sub_nodes : ( display_identifier_exp | read_write_exp | format_exp | array_size_exp | bit_mask_exp | bit_operation_block | byte_order_exp | max_refresh_exp | virtual_block | error_mask_exp | function_list_block | if_data_block | ecu_address_exp | ref_memory_segment_exp | annotation_block | matrix_dim_exp | ecu_address_extension_exp | discrete_exp | layout_exp | phys_unit_exp | symbol_link_exp )*; symbol_link_exp : SYMBOL_LINK SymbolName=string_exp Offset=int_value; indexmode_enum : ROW_DIR | COLUMN_DIR; layout_exp : LAYOUT IndexMode=indexmode_enum; display_identifier_exp : DISPLAY_IDENTIFIER display_name=IDENTIFIER; read_write_exp : READ_WRITE; format_exp : FORMAT Format=string_exp; array_size_exp : ARRAY_SIZE Number=int_value; bit_mask_exp : BIT_MASK Mask=int_value; bit_operation_block : BEGIN BIT_OPERATION bit_operation_sub_nodes END BIT_OPERATION; bit_operation_sub_nodes : ( left_shift_exp | right_shift_exp | sign_extend_exp )*; left_shift_exp : LEFT_SHIFT Bitcount=int_value; right_shift_exp : RIGHT_SHIFT Bitcount=int_value; sign_extend_exp : SIGN_EXTEND; max_refresh_exp : MAX_REFRESH ScalingUnit=int_value Rate=int_value; virtual_block : BEGIN VIRTUAL MeasuringChannels+=IDENTIFIER* END VIRTUAL; error_mask_exp : ERROR_MASK Mask=int_value; function_list_block : BEGIN FUNCTION_LIST Names+=IDENTIFIER* END FUNCTION_LIST; ecu_address_exp : ECU_ADDRESS Address=int_value; ref_memory_segment_exp: REF_MEMORY_SEGMENT Name=IDENTIFIER; annotation_exp : ANNOTATION; annotation_block : BEGIN annotation_exp annotation_sub_nodes END ANNOTATION; annotation_sub_nodes : ( annotation_label_exp | annotation_origin_exp | annotation_text_block )*; annotation_label_exp : ANNOTATION_LABEL label=string_exp; annotation_origin_exp : ANNOTATION_ORIGIN origin=string_exp; annotation_text_block : BEGIN ANNOTATION_TEXT annotation_text+=string_exp* END ANNOTATION_TEXT; matrix_dim_exp : MATRIX_DIM xDim=int_value yDim=int_value? zDim=int_value?; ecu_address_extension_exp : ECU_ADDRESS_EXTENSION Extension=int_value; discrete_exp : DISCRETE; phys_unit_exp : PHYS_UNIT Unit=string_exp; /* RECORD_LAYOUT */ record_layout_exp : RECORD_LAYOUT Name=IDENTIFIER; record_layout_block : BEGIN record_layout_exp record_layout_sub_nodes END RECORD_LAYOUT; record_layout_sub_nodes : ( fnc_values_exp | alignment_byte_exp | alignment_word_exp | alignment_long_exp | alignment_int64_exp | alignment_float32_exp | alignment_float64_exp | axis_pts_x_exp | axis_pts_y_exp | axis_pts_z_exp | axis_pts_4_exp | axis_pts_5_exp | axis_rescale_x_exp | axis_rescale_y_exp | axis_rescale_z_exp | axis_rescale_4_exp | axis_rescale_5_exp | dist_op_x_exp | dist_op_y_exp | dist_op_z_exp | dist_op_4_exp | dist_op_5_exp | fix_no_axis_pts_x_exp | fix_no_axis_pts_y_exp | fix_no_axis_pts_z_exp | fix_no_axis_pts_4_exp | fix_no_axis_pts_5_exp | identification_exp | no_axis_pts_x_exp | no_axis_pts_y_exp | no_axis_pts_z_exp | no_axis_pts_4_exp | no_axis_pts_5_exp | no_rescale_x_exp | no_rescale_y_exp | no_rescale_z_exp | no_rescale_4_exp | no_rescale_5_exp | offset_x_exp | offset_y_exp | offset_z_exp | offset_4_exp | offset_5_exp | reserved_exp | rip_addr_w_exp | rip_addr_x_exp | rip_addr_y_exp | rip_addr_z_exp | rip_addr_4_exp | rip_addr_5_exp | shift_op_x_exp | shift_op_y_exp | shift_op_z_exp | shift_op_4_exp | shift_op_5_exp | src_addr_x_exp | src_addr_y_exp | src_addr_z_exp | src_addr_4_exp | src_addr_5_exp | static_record_layout_exp )*; static_record_layout_exp : STATIC_RECORD_LAYOUT; fnc_values_exp : FNC_VALUES Position=int_value Datatype=datatype_enum IndexMode=index_mode_enum Addresstype=addresstype_enum; axis_pts_x_exp : AXIS_PTS_X Parameters=axis_pts_xyz45_parameters; axis_pts_y_exp : AXIS_PTS_Y Parameters=axis_pts_xyz45_parameters; axis_pts_z_exp : AXIS_PTS_Z Parameters=axis_pts_xyz45_parameters; axis_pts_4_exp : AXIS_PTS_4 Parameters=axis_pts_xyz45_parameters; axis_pts_5_exp : AXIS_PTS_5 Parameters=axis_pts_xyz45_parameters; axis_pts_xyz45_parameters : Position=int_value Datatype=datatype_enum IndexIncr=index_order_enum Adresing=addresstype_enum; guard_rails_exp : GUARD_RAILS; extended_limits_exp : EXTENDED_LIMITS LowerLimit=value UpperLimit=value; calibration_access_exp : CALIBRATION_ACCESS Type=calibration_access_enum; // in general for axis: 1.6 contains 4 and 5 but 1.5.1 does not axis_rescale_x_exp : AXIS_RESCALE_X Parameters=axis_rescale_xyz45_parameters; axis_rescale_y_exp : AXIS_RESCALE_Y Parameters=axis_rescale_xyz45_parameters; axis_rescale_z_exp : AXIS_RESCALE_Z Parameters=axis_rescale_xyz45_parameters; axis_rescale_4_exp : AXIS_RESCALE_4 Parameters=axis_rescale_xyz45_parameters; axis_rescale_5_exp : AXIS_RESCALE_5 Parameters=axis_rescale_xyz45_parameters; axis_rescale_xyz45_parameters : Position=int_value Datatype=datatype_enum MaxNumberOfrescalePairs=int_value IndexIncr=index_order_enum Adressing=addresstype_enum; no_rescale_x_exp : NO_RESCALE_X Parameters=position_datatype_parameters; no_rescale_y_exp : NO_RESCALE_Y Parameters=position_datatype_parameters; no_rescale_z_exp : NO_RESCALE_Z Parameters=position_datatype_parameters; no_rescale_4_exp : NO_RESCALE_4 Parameters=position_datatype_parameters; no_rescale_5_exp : NO_RESCALE_5 Parameters=position_datatype_parameters; position_datatype_parameters : Position=int_value Datatype=datatype_enum; dist_op_x_exp : DIST_OP_X Parameters=position_datatype_parameters; dist_op_y_exp : DIST_OP_Y Parameters=position_datatype_parameters; dist_op_z_exp : DIST_OP_Z Parameters=position_datatype_parameters; dist_op_4_exp : DIST_OP_4 Parameters=position_datatype_parameters; dist_op_5_exp : DIST_OP_5 Parameters=position_datatype_parameters; fix_no_axis_pts_x_exp : FIX_NO_AXIS_PTS_X NumberOfAxisPoints=int_value; fix_no_axis_pts_y_exp : FIX_NO_AXIS_PTS_Y NumberOfAxisPoints=int_value; fix_no_axis_pts_z_exp : FIX_NO_AXIS_PTS_Z NumberOfAxisPoints=int_value; fix_no_axis_pts_4_exp : FIX_NO_AXIS_PTS_4 NumberOfAxisPoints=int_value; fix_no_axis_pts_5_exp : FIX_NO_AXIS_PTS_5 NumberOfAxisPoints=int_value; identification_exp : IDENTIFICATION Position=int_value Datatype=datatype_enum; no_axis_pts_x_exp : NO_AXIS_PTS_X Parameters=position_datatype_parameters; no_axis_pts_y_exp : NO_AXIS_PTS_Y Parameters=position_datatype_parameters; no_axis_pts_z_exp : NO_AXIS_PTS_Z Parameters=position_datatype_parameters; no_axis_pts_4_exp : NO_AXIS_PTS_4 Parameters=position_datatype_parameters; no_axis_pts_5_exp : NO_AXIS_PTS_5 Parameters=position_datatype_parameters; offset_x_exp : OFFSET_X Parameters=position_datatype_parameters; offset_y_exp : OFFSET_Y Parameters=position_datatype_parameters; offset_z_exp : OFFSET_Z Parameters=position_datatype_parameters; offset_4_exp : OFFSET_4 Parameters=position_datatype_parameters; offset_5_exp : OFFSET_5 Parameters=position_datatype_parameters; reserved_exp : RESERVED Position=int_value DataSize=datasize_enum; rip_addr_w_exp : RIP_ADDR_W Parameters=position_datatype_parameters; rip_addr_x_exp : RIP_ADDR_X Parameters=position_datatype_parameters; rip_addr_y_exp : RIP_ADDR_Y Parameters=position_datatype_parameters; rip_addr_z_exp : RIP_ADDR_Z Parameters=position_datatype_parameters; rip_addr_4_exp : RIP_ADDR_4 Parameters=position_datatype_parameters; rip_addr_5_exp : RIP_ADDR_5 Parameters=position_datatype_parameters; shift_op_x_exp : SHIFT_OP_X Parameters=position_datatype_parameters; shift_op_y_exp : SHIFT_OP_Y Parameters=position_datatype_parameters; shift_op_z_exp : SHIFT_OP_Z Parameters=position_datatype_parameters; shift_op_4_exp : SHIFT_OP_4 Parameters=position_datatype_parameters; shift_op_5_exp : SHIFT_OP_5 Parameters=position_datatype_parameters; src_addr_x_exp : SRC_ADDR_X Parameters=position_datatype_parameters; src_addr_y_exp : SRC_ADDR_Y Parameters=position_datatype_parameters; src_addr_z_exp : SRC_ADDR_Z Parameters=position_datatype_parameters; src_addr_4_exp : SRC_ADDR_4 Parameters=position_datatype_parameters; src_addr_5_exp : SRC_ADDR_5 Parameters=position_datatype_parameters; /* CHARACTERISTIC */ characteristic_exp : CHARACTERISTIC Name=IDENTIFIER LongIdentifier=string_exp Type=type_enum Address=int_value Deposit=IDENTIFIER MaxDiff=value Conversion=IDENTIFIER LowerLimit=value UpperLimit=value; characteristic_block : BEGIN characteristic_exp characteristic_sub_nodes END CHARACTERISTIC; characteristic_sub_nodes : ( display_identifier_exp | format_exp | byte_order_exp | bit_mask_exp | function_list_block | number_exp | extended_limits_exp | read_only_exp | guard_rails_exp | map_list_block | max_refresh_exp | dependent_characteristic_block | virtual_characteristic_block | ref_memory_segment_exp | annotation_block | comparison_quantity_exp | if_data_block | axis_descr_block | calibration_access_exp | matrix_dim_exp | ecu_address_extension_exp | discrete_exp | phys_unit_exp | step_size_exp | symbol_link_exp | var_address_block | model_link_exp )*; // <guessed definition from demo file for 1.7.1> model_link_exp : MODEL_LINK model=string_exp; var_address_block : BEGIN VAR_ADDRESS Addresses+=int_value* END VAR_ADDRESS; step_size_exp : STEP_SIZE StepSize=value; number_exp : NUMBER Number=int_value; read_only_exp : READ_ONLY; map_list_block : BEGIN MAP_LIST Names+=IDENTIFIER* END MAP_LIST; dependent_characteristic_exp : DEPENDENT_CHARACTERISTIC Formula=string_exp; dependent_characteristic_block : BEGIN dependent_characteristic_exp Characteristic+=IDENTIFIER* END DEPENDENT_CHARACTERISTIC; virtual_characteristic_exp : VIRTUAL_CHARACTERISTIC Formula=string_exp; virtual_characteristic_block : BEGIN virtual_characteristic_exp Characteristics+=IDENTIFIER* END VIRTUAL_CHARACTERISTIC; comparison_quantity_exp : COMPARISON_QUANTITY Name=IDENTIFIER; axis_descr_exp : AXIS_DESCR Attribute=attribute_axis_descr_enum InputQuantity=IDENTIFIER Conversion=IDENTIFIER MaxAxisPoints=int_value LowerLimit=value UpperLimit=value; axis_descr_block : BEGIN axis_descr_exp axis_descr_sub_nodes END AXIS_DESCR; axis_descr_sub_nodes : ( read_only_exp | format_exp | annotation_block | axis_pts_ref_exp | max_grad_exp | monotony_exp | byte_order_exp | extended_limits_exp | fix_axis_par_exp | fix_axis_par_dist_exp | fix_axis_par_list_block | deposit_exp | curve_axis_ref_exp | phys_unit_exp | step_size_exp )*; axis_pts_ref_exp : AXIS_PTS_REF AxisPoints=IDENTIFIER; max_grad_exp : MAX_GRAD MaxGradient=value; monotony_exp : MONOTONY Monotony=monotony_enum; fix_axis_par_exp : FIX_AXIS_PAR Offset=int_value Shift=int_value Numberapo=int_value; fix_axis_par_dist_exp : FIX_AXIS_PAR_DIST Offset=int_value Distance=int_value Numberapo=int_value; fix_axis_par_list_block : BEGIN FIX_AXIS_PAR_LIST AxisPts_Values+=value* END FIX_AXIS_PAR_LIST; curve_axis_ref_exp : CURVE_AXIS_REF CurveAxis=IDENTIFIER; /* AXIS_PTS */ axis_pts_exp : AXIS_PTS Name=IDENTIFIER LongIdentifier=string_exp Address=int_value InputQuantity=IDENTIFIER Deposit=IDENTIFIER MaxDiff=value Conversion=IDENTIFIER MaxAxisPoints=int_value LowerLimit=value UpperLimit=value; axis_pts_block : BEGIN axis_pts_exp axis_pts_sub_nodes END AXIS_PTS; axis_pts_sub_nodes : ( display_identifier_exp | format_exp | deposit_exp | byte_order_exp | function_list_block | ref_memory_segment_exp | guard_rails_exp | extended_limits_exp | annotation_block | if_data_block | calibration_access_exp | ecu_address_extension_exp | monotony_exp | phys_unit_exp | read_only_exp | step_size_exp | symbol_link_exp )*; /* FUNCTION */ function_exp : FUNCTION Name=IDENTIFIER LongIdentifier=string_exp; function_block : BEGIN function_exp function_sub_nodes END FUNCTION; function_sub_nodes : ( annotation_block | def_characteristic_block | function_version_exp | if_data_block | in_measurement_block | loc_measurement_block | out_measurement_block | ref_characteristic_block | sub_function_block )*; function_version_exp : FUNCTION_VERSION VersionIdentifier=string_exp; def_characteristic_block : BEGIN DEF_CHARACTERISTIC Identifier+=IDENTIFIER* END DEF_CHARACTERISTIC; ref_characteristic_block : BEGIN REF_CHARACTERISTIC Identifier+=IDENTIFIER* END REF_CHARACTERISTIC; in_measurement_block : BEGIN IN_MEASUREMENT Identifier+=IDENTIFIER* END IN_MEASUREMENT; loc_measurement_block : BEGIN LOC_MEASUREMENT Identifier+=IDENTIFIER* END LOC_MEASUREMENT; out_measurement_block : BEGIN OUT_MEASUREMENT Identifier+=IDENTIFIER* END OUT_MEASUREMENT; sub_function_block : BEGIN SUB_FUNCTION Identifier+=IDENTIFIER* END SUB_FUNCTION; /* GROUP */ group_exp : GROUP GroupName=IDENTIFIER GroupLongIdentifier=string_exp; group_block : BEGIN group_exp group_sub_nodes END GROUP; group_sub_nodes : ( annotation_block | root_exp | ref_characteristic_block | ref_measurement_block | function_list_block | sub_group_block | if_data_block )*; root_exp : ROOT; ref_measurement_block : BEGIN REF_MEASUREMENT Identifier+=IDENTIFIER* END REF_MEASUREMENT; sub_group_block : BEGIN SUB_GROUP Identifier+=IDENTIFIER* END SUB_GROUP; /* VARIANT_CODING */ variant_coding_exp : VARIANT_CODING; variant_coding_block : BEGIN variant_coding_exp variant_coding_sub_nodes END VARIANT_CODING; variant_coding_sub_nodes : ( var_characteristic_block | var_criterion_block | var_forbidden_comb_block | var_naming_exp | var_separator_exp )*; var_characteristic_exp : VAR_CHARACTERISTIC Name=IDENTIFIER CriterionNames+=IDENTIFIER*; var_characteristic_block : BEGIN var_characteristic_exp var_characteristic_sub_nodes END VAR_CHARACTERISTIC; var_characteristic_sub_nodes : ( var_address_block )*; var_criterion_exp : VAR_CRITERION Name=IDENTIFIER LongIdentifier=string_exp Values+=IDENTIFIER*; var_criterion_block : BEGIN var_criterion_exp var_criterion_sub_nodes END VAR_CRITERION; var_criterion_sub_nodes : ( var_measurement_exp | var_selection_characteristic_exp )*; var_measurement_exp : VAR_MEASUREMENT Name=IDENTIFIER; var_selection_characteristic_exp : VAR_SELECTION_CHARACTERISTIC Name=IDENTIFIER; var_forbidden_comb_block : BEGIN VAR_FORBIDDEN_COMB tuples+=criterion_tuple* END VAR_FORBIDDEN_COMB; criterion_tuple : CriterionName=IDENTIFIER CriterionValue=IDENTIFIER; var_naming_exp : VAR_NAMING Tag=(NUMERIC | ALPHA); var_separator_exp : VAR_SEPARATOR Separator=string_exp; /* I cannot find any definition for the following elements which are part of 1.7.1 */ /* TYPEDEF_CHARACTERISTIC <guessed definition from demo file for 1.7.1> */ typedef_characteristic_exp : TYPEDEF_CHARACTERISTIC IDENTIFIER string_exp type_enum IDENTIFIER value IDENTIFIER value value; typedef_characteristic_block : BEGIN typedef_characteristic_exp typedef_characteristic_sub_nodes END TYPEDEF_CHARACTERISTIC; typedef_characteristic_sub_nodes : ( extended_limits_exp | format_exp | phys_unit_exp | axis_descr_block | number_exp )*; /* INSTANCE <guessed definition from demo file for 1.7.1> */ instance_exp : INSTANCE IDENTIFIER string_exp IDENTIFIER int_value; instance_block : BEGIN instance_exp instance_sub_nodes END INSTANCE; instance_sub_nodes : ( matrix_dim_exp | display_identifier_exp )*; /* TYPEDEF_AXIS <guessed definition from demo file for 1.7.1> */ typedef_axis_exp : TYPEDEF_AXIS IDENTIFIER string_exp IDENTIFIER IDENTIFIER value IDENTIFIER int_value value value; typedef_axis_block : BEGIN typedef_axis_exp END TYPEDEF_AXIS; // there is no example within the demo file for optional parameters typedef_axis_sub_nodes : ; /* TYPEDEF_STRUCTURE <guessed definition from demo file for 1.7.1> */ typedef_structure_exp : TYPEDEF_STRUCTURE IDENTIFIER string_exp int_value; typedef_structure_block : BEGIN typedef_structure_exp typedef_structure_sub_nodes END TYPEDEF_STRUCTURE; typedef_structure_sub_nodes : ( structure_component_block )*; structure_component_exp : STRUCTURE_COMPONENT IDENTIFIER IDENTIFIER int_value; structure_component_block : BEGIN structure_component_exp structure_component_sub_nodes END STRUCTURE_COMPONENT; // there is no example within the demo file for optional parameters structure_component_sub_nodes : ( matrix_dim_exp )*; /* TRANSFORMER <guessed definition from demo file for 1.7.1> */ transformer_exp : TRANSFORMER IDENTIFIER string_exp string_exp string_exp int_value trigger_conditions_enum IDENTIFIER; transformer_block : BEGIN transformer_exp transformer_sub_nodes END TRANSFORMER; transformer_sub_nodes : ( transformer_in_objects_block | transformer_out_objects_block )*; trigger_conditions_enum : ON_CHANGE | ON_USER_REQUEST; transformer_in_objects_block : BEGIN TRANSFORMER_IN_OBJECTS Identifier+=IDENTIFIER* END TRANSFORMER_IN_OBJECTS; transformer_out_objects_block : BEGIN TRANSFORMER_OUT_OBJECTS Identifier+=IDENTIFIER* END TRANSFORMER_OUT_OBJECTS;
libsrc/_DEVELOPMENT/arch/sms/SMSlib/z80/asm_SMSlib_updateSpritePosition.asm
jpoikela/z88dk
640
175830
; ************************************************** ; SMSlib - C programming library for the SMS/GG ; ( part of devkitSMS - github.com/sverx/devkitSMS ) ; ************************************************** INCLUDE "SMSlib_private.inc" SECTION code_clib SECTION code_SMSlib PUBLIC asm_SMSlib_updateSpritePosition EXTERN __SMSlib_SpriteTableY, __SMSlib_SpriteTableXN asm_SMSlib_updateSpritePosition: ; void SMS_updateSpritePosition (signed char sprite, unsigned char x, unsigned char y) ; ; enter : e = signed char sprite ; a = unsigned char y ; c = unsigned char x ; ; uses : af, d, hl ld d,0 ld hl,__SMSlib_SpriteTableY add hl,de cp 0xd1 jr z, bad_sprite_coord dec a ld (hl),a ld hl,__SMSlib_SpriteTableXN add hl,de add hl,de ld (hl),c ret bad_sprite_coord: ld (hl),0xe0 ret
tools-src/gnu/gcc/gcc/ada/s-wchstw.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
19335
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- S Y S T E M . W C H _ S T W -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2000 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 2, 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with System.WCh_Con; use System.WCh_Con; with System.WCh_JIS; use System.WCh_JIS; package body System.WCh_StW is --------------------------- -- String_To_Wide_String -- --------------------------- function String_To_Wide_String (S : String; EM : WC_Encoding_Method) return Wide_String is R : Wide_String (1 .. S'Length); RP : Natural; SP : Natural; U1 : Unsigned_16; U2 : Unsigned_16; U3 : Unsigned_16; U : Unsigned_16; Last : constant Natural := S'Last; function Get_Hex (C : Character) return Unsigned_16; -- Converts character from hex digit to value in range 0-15. The -- input must be in 0-9, A-F, or a-f, and no check is needed. procedure Get_Hex_4; -- Translates four hex characters starting at S (SP) to a single -- wide character. Used in WCEM_Hex and WCEM_Brackets mode. SP -- is not modified by the call. The resulting wide character value -- is stored in R (RP). RP is not modified by the call. function Get_Hex (C : Character) return Unsigned_16 is begin if C in '0' .. '9' then return Character'Pos (C) - Character'Pos ('0'); elsif C in 'A' .. 'F' then return Character'Pos (C) - Character'Pos ('A') + 10; else return Character'Pos (C) - Character'Pos ('a') + 10; end if; end Get_Hex; procedure Get_Hex_4 is begin R (RP) := Wide_Character'Val ( Get_Hex (S (SP + 3)) + 16 * (Get_Hex (S (SP + 2)) + 16 * (Get_Hex (S (SP + 1)) + 16 * (Get_Hex (S (SP + 0)))))); end Get_Hex_4; -- Start of processing for String_To_Wide_String begin SP := S'First; RP := 0; case EM is -- ESC-Hex representation when WCEM_Hex => while SP <= Last - 4 loop RP := RP + 1; if S (SP) = ASCII.ESC then SP := SP + 1; Get_Hex_4; SP := SP + 4; else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; -- Upper bit shift, internal code = external code when WCEM_Upper => while SP < Last loop RP := RP + 1; if S (SP) >= Character'Val (16#80#) then U1 := Character'Pos (S (SP)); U2 := Character'Pos (S (SP + 1)); R (RP) := Wide_Character'Val (256 * U1 + U2); SP := SP + 2; else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; -- Upper bit shift, shift-JIS when WCEM_Shift_JIS => while SP < Last loop RP := RP + 1; if S (SP) >= Character'Val (16#80#) then R (RP) := Shift_JIS_To_JIS (S (SP), S (SP + 1)); SP := SP + 2; else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; -- Upper bit shift, EUC when WCEM_EUC => while SP < Last loop RP := RP + 1; if S (SP) >= Character'Val (16#80#) then R (RP) := EUC_To_JIS (S (SP), S (SP + 1)); SP := SP + 2; else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; -- Upper bit shift, UTF-8 when WCEM_UTF8 => while SP < Last loop RP := RP + 1; if S (SP) >= Character'Val (16#80#) then U1 := Character'Pos (S (SP)); U2 := Character'Pos (S (SP + 1)); U := Shift_Left (U1 and 2#00011111#, 6) + (U2 and 2#00111111#); SP := SP + 2; if U1 >= 2#11100000# then U3 := Character'Pos (S (SP)); U := Shift_Left (U, 6) + (U3 and 2#00111111#); SP := SP + 1; end if; R (RP) := Wide_Character'Val (U); else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; -- Brackets representation when WCEM_Brackets => while SP <= Last - 7 loop RP := RP + 1; if S (SP) = '[' and then S (SP + 1) = '"' and then S (SP + 2) /= '"' then SP := SP + 2; Get_Hex_4; SP := SP + 6; else R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end if; end loop; end case; while SP <= Last loop RP := RP + 1; R (RP) := Wide_Character'Val (Character'Pos (S (SP))); SP := SP + 1; end loop; return R (1 .. RP); end String_To_Wide_String; end System.WCh_StW;
source/RASCAL-ToolboxProgInfo.ads
bracke/Meaning
0
4885
-------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public -- -- License along with this library; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- -------------------------------------------------------------------------------- -- @brief Toolbox ProgInfo related types and methods. -- $Author$ -- $Date$ -- $Revision$ with RASCAL.Toolbox; use RASCAL.Toolbox; with RASCAL.OS; use RASCAL.OS; with System.Unsigned_Types; use System.Unsigned_Types; with Interfaces.C; use Interfaces.C; package RASCAL.ToolboxProgInfo is type License_Type is (Public_Domain,Single_user,Single_Machine,Site,Network,Authority); -- -- Event is raised just before the Prog Info window is displayed. --Type lacks union. -- type Toolbox_ProgInfo_AboutToBeShown is record Header : Toolbox_Event_Header; Show_Type : Integer; end record; pragma Convention (C, Toolbox_ProgInfo_AboutToBeShown); type Toolbox_ProgInfo_AboutToBeShown_Pointer is access Toolbox_ProgInfo_AboutToBeShown; type ATEL_Toolbox_ProgInfo_AboutToBeShown is abstract new Toolbox_EventListener(Toolbox_Event_ProgInfo_AboutToBeShown,-1,-1) with record Event : Toolbox_ProgInfo_AboutToBeShown_Pointer; end record; -- -- Event is raised after the Prog Info window has been hidden. -- type Toolbox_ProgInfo_DialogueCompleted is record Header : Toolbox_Event_Header; end record; pragma Convention (C, Toolbox_ProgInfo_DialogueCompleted); type Toolbox_ProgInfo_DialogueCompleted_Pointer is access Toolbox_ProgInfo_DialogueCompleted; type ATEL_Toolbox_ProgInfo_DialogueCompleted is abstract new Toolbox_EventListener(Toolbox_Event_ProgInfo_DialogueCompleted,-1,-1) with record Event : Toolbox_ProgInfo_DialogueCompleted_Pointer; end record; -- -- Event is raised after the Prog Info Launch Web Page action button is clicked. -- type Toolbox_ProgInfo_LaunchWebPage is record Header : Toolbox_Event_Header; end record; pragma Convention (C, Toolbox_ProgInfo_LaunchWebPage); type Toolbox_ProgInfo_LaunchWebPage_Pointer is access Toolbox_ProgInfo_LaunchWebPage; type ATEL_Toolbox_ProgInfo_LaunchWebPage is abstract new Toolbox_EventListener(Toolbox_Event_ProgInfo_LaunchWebPage,-1,-1) with record Event : Toolbox_ProgInfo_LaunchWebPage_Pointer; end record; -- -- Returns the ID of the underlying Window object used for the Prog Info object. -- function Get_Window_ID (ProgInfo : Object_ID; Flags : in System.Unsigned_Types.Unsigned := 0) return Object_ID; -- -- Returns the URI launched by the web page button. -- function Get_URI (ProgInfo : Object_ID; Flags: in System.Unsigned_Types.Unsigned := 0) return string; -- -- Returns the window title being used in the Prog Info object. -- function Get_Title (ProgInfo : Object_ID; Flags : in System.Unsigned_Types.Unsigned := 0) return string; -- -- Sets the URI to be launched by the web page button. -- procedure Set_URI (ProgInfo : in Object_ID; URI : in string; Flags : in System.Unsigned_Types.Unsigned := 0); -- -- Sets the window title to be used in the Prog Info object. -- procedure Set_Title (ProgInfo : in Object_ID; Title : in string; Flags : in System.Unsigned_Types.Unsigned := 0); -- -- Returns the license type used in the Prog Info object. -- function Get_License_Type (ProgInfo : Object_ID; Flags : in System.Unsigned_Types.Unsigned := 0) return License_Type; -- -- Sets the license type to be used in the Prog Info object. -- procedure Set_License_Type (ProgInfo : in Object_ID; License : in License_Type; Flags : in System.Unsigned_Types.Unsigned := 0); -- -- Returns the version string used in the Prog Info object. -- function Get_Version (ProgInfo : Object_ID; Flags : in System.Unsigned_Types.Unsigned := 0) return string; -- -- Sets the version string used in the Prog Info object. -- procedure Set_Version (ProgInfo : in Object_ID; Version : in string; Flags : in System.Unsigned_Types.Unsigned := 0); -- -- Returns the event generated by a click on the web page button. -- function Get_Web_Event (ProgInfo : Object_ID; Flags : in System.Unsigned_Types.Unsigned := 0) return Toolbox_Event_Code_Type; -- -- Sets the event generated by a click on the web page button. -- procedure Set_Web_Event (ProgInfo : in Object_ID; Event : in Toolbox_Event_Code_Type; Flags : in System.Unsigned_Types.Unsigned := 0); -- -- -- procedure Handle(The : in ATEL_Toolbox_ProgInfo_AboutToBeShown) is abstract; -- -- -- procedure Handle(The : in ATEL_Toolbox_ProgInfo_DialogueCompleted) is abstract; -- -- -- procedure Handle(The : in ATEL_Toolbox_ProgInfo_LaunchWebPage) is abstract; end RASCAL.ToolboxProgInfo;
notes/FOT/FOTC/InductiveApproach/Recursion.agda
asr/fotc
11
14704
<filename>notes/FOT/FOTC/InductiveApproach/Recursion.agda ------------------------------------------------------------------------------ -- Discussion about the inductive approach ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- Andrés: From our discussion about the inductive approach, can I -- conclude that it is possible to rewrite the proofs using pattern -- matching on _≡_, by proofs using only subst, because the types -- associated with these proofs haven't proof terms? -- Peter: Yes, provided the RHS of the definition does not refer to the -- function defined, i e, there is no recursion. module FOT.FOTC.InductiveApproach.Recursion where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Base.PropertiesI open import FOTC.Data.Nat open import FOTC.Data.Nat.PropertiesI ------------------------------------------------------------------------------ -- foo is recursive and we pattern matching on _≡_. foo : ∀ {m n} → N m → m ≡ n → N (m + n) foo nzero refl = subst N (sym (+-leftIdentity zero)) nzero foo (nsucc {m} Nm) refl = subst N helper (nsucc (nsucc (foo Nm refl))) where helper : succ₁ (succ₁ (m + m)) ≡ succ₁ m + succ₁ m helper = succ₁ (succ₁ (m + m)) ≡⟨ succCong (sym (+-Sx m m)) ⟩ succ₁ (succ₁ m + m) ≡⟨ succCong (+-comm (nsucc Nm) Nm) ⟩ succ₁ (m + succ₁ m) ≡⟨ sym (+-Sx m (succ₁ m)) ⟩ succ₁ m + succ₁ m ∎ -- foo' is recursive and we only use subst. foo' : ∀ {m n} → N m → m ≡ n → N (m + n) foo' {n = n} nzero h = subst N (sym (+-leftIdentity n)) (subst N h nzero) foo' {n = n} (nsucc {m} Nm) h = subst N helper (nsucc (nsucc (foo' Nm refl))) where helper : succ₁ (succ₁ (m + m)) ≡ succ₁ m + n helper = succ₁ (succ₁ (m + m)) ≡⟨ succCong (sym (+-Sx m m)) ⟩ succ₁ (succ₁ m + m) ≡⟨ succCong (+-comm (nsucc Nm) Nm) ⟩ succ₁ (m + succ₁ m) ≡⟨ sym (+-Sx m (succ₁ m)) ⟩ succ₁ m + succ₁ m ≡⟨ +-rightCong h ⟩ succ₁ m + n ∎
programs/oeis/022/A022383.asm
neoneye/loda
22
6806
<filename>programs/oeis/022/A022383.asm ; A022383: Fibonacci sequence beginning 4, 14. ; 4,14,18,32,50,82,132,214,346,560,906,1466,2372,3838,6210,10048,16258,26306,42564,68870,111434,180304,291738,472042,763780,1235822,1999602,3235424,5235026,8470450,13705476,22175926,35881402,58057328,93938730,151996058,245934788,397930846,643865634,1041796480,1685662114,2727458594,4413120708,7140579302,11553700010,18694279312,30247979322,48942258634,79190237956,128132496590,207322734546,335455231136,542777965682,878233196818,1421011162500,2299244359318,3720255521818,6019499881136,9739755402954,15759255284090,25499010687044,41258265971134,66757276658178,108015542629312,174772819287490,282788361916802,457561181204292,740349543121094,1197910724325386,1938260267446480,3136170991771866,5074431259218346,8210602250990212,13285033510208558,21495635761198770,34780669271407328,56276305032606098,91056974304013426,147333279336619524,238390253640632950,385723532977252474,624113786617885424,1009837319595137898,1633951106213023322,2643788425808161220,4277739532021184542,6921527957829345762,11199267489850530304,18120795447679876066,29320062937530406370,47440858385210282436,76760921322740688806,124201779707950971242,200962701030691660048,325164480738642631290,526127181769334291338,851291662507976922628,1377418844277311213966,2228710506785288136594,3606129351062599350560 seq $0,22320 ; a(n) = a(n-1) + a(n-2) + 1, with a(0) = 1 and a(1) = 6. add $0,1 mul $0,2
sleep/Segments.asm
OS2World/DRV-VRAID
0
173435
;* ;* $Source: R:/source/driver/sleep/RCS/Segments.asm,v $ ;* $Revision: 1.6 $ ;* $Date: 1998/06/28 23:58:07 $ ;* $Locker: $ ;* ;* Assembler Helper to order segments ;* ;* $Log: Segments.asm,v $ ;* Revision 1.6 1998/06/28 23:58:07 vitus ;* - implemented _CallADD() ;* ;* Revision 1.5 1997/12/05 01:50:02 vitus ;* - moved segment declarations to include file segments.inc ;* ;* Revision 1.4 1997/05/07 23:45:53 vitus ;* - moved CONST segment to front (behind DDHeader) ;* ;* Revision 1.3 1997/03/03 01:27:22 vitus ;* Added SwapData ;* ;* Revision 1.2 1997/02/05 01:52:44 vitus ;* Added more device header flags (not required) ;* ;* Revision 1.1 1996/09/27 03:26:56 vitus ;* Initial revision ;* ---------------------------------------- ;* This code is Copyright <NAME> 1996 ;* .286c ; at least! INCLUDE devhdr.inc ; device header format INCLUDE segments.inc ; segment layout and order PUBLIC _AsmTimer ; so C-code can install it PUBLIC _CallADD ; passes IORB to ADD ;; The very first segment has to contain the ;; device driver header. Use own segment for ;; this purpose (but in DGROUP). DDHeader SEGMENT DiskDDHeader DD -1 DW DEV_CHAR_DEV OR DEV_30 OR DEVLEV_3 DW OFFSET AsmStrategy DW 0 DB "DSLEEPS$" DW 0 DW 0 DW 0 DW 0 DD DEV_INITCOMPLETE OR DEV_ADAPTER_DD OR DEV_16MB OR DEV_IOCTL2 DW 0 DDHeader ENDS ;; Start of code segments ;; There is really code contained: small stubs ;; to call C routines and save/restore registers. _TEXT SEGMENT ASSUME CS:StaticGroup EXTRN _Strategy : NEAR ; C routines EXTRN _Timer : NEAR AsmStrategy PROC FAR push es push bx call _Strategy add sp, 4 retf AsmStrategy ENDP _AsmTimer PROC FAR pushf pusha ; timer has to save ALL! push ds push es sti ; run with interrupts enabled mov ax, DGROUP mov ds, ax call _Timer pop es pop ds popa popf ret _AsmTimer ENDP _CallADD PROC NEAR enter 0,0 pusha push ds les bx,[bp+8] push es push bx call DWORD PTR [bp+4] add sp,4 pop ds popa leave ret _CallADD ENDP _TEXT ENDS END
programs/oeis/158/A158133.asm
karttu/loda
1
92666
<reponame>karttu/loda ; A158133: 144n + 1. ; 145,289,433,577,721,865,1009,1153,1297,1441,1585,1729,1873,2017,2161,2305,2449,2593,2737,2881,3025,3169,3313,3457,3601,3745,3889,4033,4177,4321,4465,4609,4753,4897,5041,5185,5329,5473,5617,5761,5905,6049,6193,6337,6481,6625,6769,6913,7057,7201,7345,7489,7633,7777,7921,8065,8209,8353,8497,8641,8785,8929,9073,9217,9361,9505,9649,9793,9937,10081,10225,10369,10513,10657,10801,10945,11089,11233,11377,11521,11665,11809,11953,12097,12241,12385,12529,12673,12817,12961,13105,13249,13393,13537,13681,13825,13969,14113,14257,14401,14545,14689,14833,14977,15121,15265,15409,15553,15697,15841,15985,16129,16273,16417,16561,16705,16849,16993,17137,17281,17425,17569,17713,17857,18001,18145,18289,18433,18577,18721,18865,19009,19153,19297,19441,19585,19729,19873,20017,20161,20305,20449,20593,20737,20881,21025,21169,21313,21457,21601,21745,21889,22033,22177,22321,22465,22609,22753,22897,23041,23185,23329,23473,23617,23761,23905,24049,24193,24337,24481,24625,24769,24913,25057,25201,25345,25489,25633,25777,25921,26065,26209,26353,26497,26641,26785,26929,27073,27217,27361,27505,27649,27793,27937,28081,28225,28369,28513,28657,28801,28945,29089,29233,29377,29521,29665,29809,29953,30097,30241,30385,30529,30673,30817,30961,31105,31249,31393,31537,31681,31825,31969,32113,32257,32401,32545,32689,32833,32977,33121,33265,33409,33553,33697,33841,33985,34129,34273,34417,34561,34705,34849,34993,35137,35281,35425,35569,35713,35857,36001 mov $1,$0 mul $1,144 add $1,145
source/oasis/program-elements-generic_procedure_renaming_declarations.ads
reznikmm/gela
0
20934
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Lexical_Elements; with Program.Elements.Defining_Names; with Program.Elements.Expressions; with Program.Elements.Aspect_Specifications; package Program.Elements.Generic_Procedure_Renaming_Declarations is pragma Pure (Program.Elements.Generic_Procedure_Renaming_Declarations); type Generic_Procedure_Renaming_Declaration is limited interface and Program.Elements.Declarations.Declaration; type Generic_Procedure_Renaming_Declaration_Access is access all Generic_Procedure_Renaming_Declaration'Class with Storage_Size => 0; not overriding function Name (Self : Generic_Procedure_Renaming_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is abstract; not overriding function Renamed_Procedure (Self : Generic_Procedure_Renaming_Declaration) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Aspects (Self : Generic_Procedure_Renaming_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is abstract; type Generic_Procedure_Renaming_Declaration_Text is limited interface; type Generic_Procedure_Renaming_Declaration_Text_Access is access all Generic_Procedure_Renaming_Declaration_Text'Class with Storage_Size => 0; not overriding function To_Generic_Procedure_Renaming_Declaration_Text (Self : in out Generic_Procedure_Renaming_Declaration) return Generic_Procedure_Renaming_Declaration_Text_Access is abstract; not overriding function Generic_Token (Self : Generic_Procedure_Renaming_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Procedure_Token (Self : Generic_Procedure_Renaming_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Renames_Token (Self : Generic_Procedure_Renaming_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function With_Token (Self : Generic_Procedure_Renaming_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Generic_Procedure_Renaming_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Generic_Procedure_Renaming_Declarations;
base/mvdm/dos/v86/cmd/command/comsw.asm
npocmaka/Windows-Server-2003
17
166151
;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ; SCCSID = @(#)comsw.asm 1.1 85/05/14 ; SCCSID = @(#)comsw.asm 1.1 85/05/14 include version.inc 
alloy4fun_models/trashltl/models/11/MfrBjNyLsPfLHmdjB.als
Kaixi26/org.alloytools.alloy
0
2672
open main pred idMfrBjNyLsPfLHmdjB_prop12 { all f:File | eventually always f in Trash } pred __repair { idMfrBjNyLsPfLHmdjB_prop12 } check __repair { idMfrBjNyLsPfLHmdjB_prop12 <=> prop12o }
problems/NatEquality/NatEquality.agda
danr/agder
1
10270
<filename>problems/NatEquality/NatEquality.agda module NatEquality where open import Definitions _≟_ : (m n : ℕ) → Equal? m n _≟_ = {!!} equality-disjoint : (m n : ℕ) → m ≡ n → m ≢ n → ⊥ equality-disjoint = {!!}
Cubical/Structures/Product.agda
RobertHarper/cubical
0
16372
<reponame>RobertHarper/cubical {- Product of structures S and T: X ↦ S X × T X -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Structures.Product where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Foundations.Transport open import Cubical.Foundations.Univalence open import Cubical.Foundations.Path open import Cubical.Foundations.SIP open import Cubical.Data.Sigma private variable ℓ ℓ₁ ℓ₁' ℓ₂ ℓ₂' : Level ProductStructure : (S₁ : Type ℓ → Type ℓ₁) (S₂ : Type ℓ → Type ℓ₂) → Type ℓ → Type (ℓ-max ℓ₁ ℓ₂) ProductStructure S₁ S₂ X = S₁ X × S₂ X ProductEquivStr : {S₁ : Type ℓ → Type ℓ₁} (ι₁ : StrEquiv S₁ ℓ₁') {S₂ : Type ℓ → Type ℓ₂} (ι₂ : StrEquiv S₂ ℓ₂') → StrEquiv (ProductStructure S₁ S₂) (ℓ-max ℓ₁' ℓ₂') ProductEquivStr ι₁ ι₂ (X , s₁ , s₂) (Y , t₁ , t₂) f = (ι₁ (X , s₁) (Y , t₁) f) × (ι₂ (X , s₂) (Y , t₂) f) ProductUnivalentStr : {S₁ : Type ℓ → Type ℓ₁} (ι₁ : StrEquiv S₁ ℓ₁') (θ₁ : UnivalentStr S₁ ι₁) {S₂ : Type ℓ → Type ℓ₂} (ι₂ : StrEquiv S₂ ℓ₂') (θ₂ : UnivalentStr S₂ ι₂) → UnivalentStr (ProductStructure S₁ S₂) (ProductEquivStr ι₁ ι₂) ProductUnivalentStr {S₁ = S₁} ι₁ θ₁ {S₂} ι₂ θ₂ {X , s₁ , s₂} {Y , t₁ , t₂} e = isoToEquiv (iso φ ψ η ε) where φ : ProductEquivStr ι₁ ι₂ (X , s₁ , s₂) (Y , t₁ , t₂) e → PathP (λ i → ProductStructure S₁ S₂ (ua e i)) (s₁ , s₂) (t₁ , t₂) φ (p , q) i = (θ₁ e .fst p i) , (θ₂ e .fst q i) ψ : PathP (λ i → ProductStructure S₁ S₂ (ua e i)) (s₁ , s₂) (t₁ , t₂) → ProductEquivStr ι₁ ι₂ (X , s₁ , s₂) (Y , t₁ , t₂) e ψ p = invEq (θ₁ e) (λ i → p i .fst) , invEq (θ₂ e) (λ i → p i .snd) η : section φ ψ η p i j = retEq (θ₁ e) (λ k → p k .fst) i j , retEq (θ₂ e) (λ k → p k .snd) i j ε : retract φ ψ ε (p , q) i = secEq (θ₁ e) p i , secEq (θ₂ e) q i
Assembly/Common/PGX.asm
detlefgrohs/C256-Foenix-FMX
0
11530
.text "PGX" .byte $01 .dword START
data/tilesets/ruins_of_alph_collision.asm
Dev727/ancientplatinum
28
9934
<filename>data/tilesets/ruins_of_alph_collision.asm<gh_stars>10-100 tilecoll WALL, WALL, WALL, WALL ; 00 tilecoll WALL, WALL, WALL, FLOOR ; 01 tilecoll WALL, WALL, FLOOR, WALL ; 02 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 03 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 04 tilecoll WALL, WALL, WALL, FLOOR ; 05 tilecoll WALL, WALL, FLOOR, FLOOR ; 06 tilecoll WALL, WALL, FLOOR, FLOOR ; 07 tilecoll WALL, WALL, FLOOR, WALL ; 08 tilecoll WALL, FLOOR, WALL, WALL ; 09 tilecoll FLOOR, FLOOR, WALL, WALL ; 0a tilecoll FLOOR, FLOOR, WALL, WALL ; 0b tilecoll FLOOR, WALL, WALL, WALL ; 0c tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0d tilecoll WALL, FLOOR, WALL, FLOOR ; 0e tilecoll FLOOR, WALL, FLOOR, WALL ; 0f tilecoll WALL, FLOOR, FLOOR, FLOOR ; 10 tilecoll FLOOR, WALL, FLOOR, FLOOR ; 11 tilecoll FLOOR, FLOOR, WALL, FLOOR ; 12 tilecoll FLOOR, FLOOR, FLOOR, WALL ; 13 tilecoll WALL, FLOOR, WALL, WALL ; 14 tilecoll FLOOR, FLOOR, WALL, FLOOR ; 15 tilecoll FLOOR, FLOOR, FLOOR, WALL ; 16 tilecoll FLOOR, WALL, WALL, WALL ; 17 tilecoll WALL, WALL, WALL, PIT ; 18 tilecoll WALL, WALL, PIT, WALL ; 19 tilecoll FLOOR, FLOOR, LADDER, FLOOR ; 1a tilecoll WALL, FLOOR, WALL, FLOOR ; 1b tilecoll FLOOR, WALL, FLOOR, WALL ; 1c tilecoll FLOOR, FLOOR, WALL, FLOOR ; 1d tilecoll FLOOR, FLOOR, FLOOR, WALL ; 1e tilecoll WALL, FLOOR, FLOOR, FLOOR ; 1f tilecoll FLOOR, WALL, FLOOR, FLOOR ; 20 tilecoll WALL, FLOOR, WALL, FLOOR ; 21 tilecoll WALL, FLOOR, FLOOR, FLOOR ; 22 tilecoll FLOOR, WALL, FLOOR, FLOOR ; 23 tilecoll WALL, WALL, WALL, WALL ; 24 tilecoll WALL, WALL, WALL, WALL ; 25 tilecoll WALL, WALL, WALL, WALL ; 26 tilecoll WALL, WALL, WALL, WALL ; 27 tilecoll WALL, WALL, WALL, WALL ; 28 tilecoll WALL, WALL, WALL, WALL ; 29 tilecoll WALL, WALL, WALL, WALL ; 2a tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WALL ; 2b tilecoll FLOOR, FLOOR, WALL, WARP_CARPET_DOWN ; 2c tilecoll WALL, WALL, FLOOR, FLOOR ; 2d tilecoll WALL, WALL, FLOOR, FLOOR ; 2e tilecoll FLOOR, FLOOR, FLOOR, PIT ; 2f tilecoll CAVE, WALL, FLOOR, FLOOR ; 30 tilecoll WALL, FLOOR, FLOOR, FLOOR ; 31 tilecoll FLOOR, WALL, FLOOR, FLOOR ; 32 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 33 tilecoll WALL, WALL, WALL, PIT ; 34 tilecoll WALL, WALL, PIT, WALL ; 35 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 36 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 37 tilecoll FLOOR, FLOOR, GRASS_4A, FLOOR ; 38 tilecoll FLOOR, FLOOR, GRASS_4B, FLOOR ; 39 tilecoll FLOOR, FLOOR, CUT_28, FLOOR ; 3a tilecoll FLOOR, FLOOR, WATER, FLOOR ; 3b tilecoll 64, FLOOR, WATERFALL_UP, FLOOR ; 3c tilecoll 65, FLOOR, WATERFALL, FLOOR ; 3d tilecoll WATERFALL_UP, FLOOR, WARP_CARPET_DOWN, FLOOR ; 3e tilecoll WATERFALL, FLOOR, DOOR, FLOOR ; 3f
Definition/Typed/Consequences/SucCong.agda
loic-p/logrel-mltt
0
12279
{-# OPTIONS --without-K --safe #-} module Definition.Typed.Consequences.SucCong where open import Definition.Untyped open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Properties open import Definition.Typed.Consequences.Syntactic open import Definition.Typed.Consequences.Substitution open import Tools.Product -- Congurence of the type of the successor case in natrec. sucCong : ∀ {F G Γ} → Γ ∙ ℕ ⊢ F ≡ G → Γ ⊢ Π ℕ ▹ (F ▹▹ F [ suc (var 0) ]↑) ≡ Π ℕ ▹ (G ▹▹ G [ suc (var 0) ]↑) sucCong F≡G with wfEq F≡G sucCong F≡G | ⊢Γ ∙ ⊢ℕ = let ⊢F , _ = syntacticEq F≡G in Π-cong ⊢ℕ (refl ⊢ℕ) (Π-cong ⊢F F≡G (wkEq (step id) (⊢Γ ∙ ⊢ℕ ∙ ⊢F) (subst↑TypeEq F≡G (refl (sucⱼ (var (⊢Γ ∙ ⊢ℕ) here))))))
oeis/249/A249311.asm
neoneye/loda-programs
11
91570
; A249311: Expansion of x*(1+9*x-8*x^3)/(1-10*x^2+8*x^4). ; Submitted by <NAME> ; 1,9,10,82,92,748,840,6824,7664,62256,69920,567968,637888,5181632,5819520,47272576,53092096,431272704,484364800,3934546432,4418911232,35895282688,40314193920,327476455424,367790649344,2987602292736,3355392942080,27256211283968,30611604226048,248661294497792,279272898723840,2268563254706176,2547836153430016,20696342191079424,23244178344509440,188814915873144832,212059094217654272,1722578421202812928,1934637515420467200,15715264885042970624,17649902400463437824,143372021480807202816 mov $1,8 mov $2,1 lpb $0 sub $0,2 add $1,$2 add $2,$1 mul $1,8 lpe lpb $0 bin $0,3 add $2,$1 lpe mov $0,$2
3-mid/impact/source/2d/collision/impact-d2-dynamic_tree.adb
charlie5/lace
20
16391
with ada.Containers.Vectors, ada.Unchecked_Deallocation, interfaces.c.Pointers; -- for debug package body impact.d2.dynamic_Tree is use type int32; ------- -- Node -- procedure free is new ada.Unchecked_Deallocation (b2DynamicTreeNodes, b2DynamicTreeNodes_view); function isLeaf (Self : in b2DynamicTreeNode) return Boolean is begin return Self.child1 = b2_nullNode; end isLeaf; ------- -- Tree -- function to_b2DynamicTree return b2DynamicTree is Self : b2DynamicTree; begin Self.m_root := b2_nullNode; Self.m_nodeCapacity := 16; Self.m_nodeCount := 0; Self.m_nodes := new b2DynamicTreeNodes (0 .. Self.m_nodeCapacity - 1); -- Build a linked list for the free list. for i in 0 .. Self.m_nodeCapacity - 2 loop Self.m_nodes (i).next := i + 1; Self.m_nodes (i).height := -1; end loop; Self.m_nodes (Self.m_nodeCapacity - 1).next := b2_nullNode; Self.m_nodes (Self.m_nodeCapacity - 1).height := -1; Self.m_freeList := 0; Self.m_path := 0; Self.m_insertionCount := 0; return Self; end to_b2DynamicTree; procedure destruct (Self : in out b2DynamicTree) is begin free (Self.m_nodes); -- This frees the entire tree in one shot. end destruct; -- Create a proxy in the tree as a leaf node. We return the index -- of the node instead of a pointer so that we can grow -- the node pool. -- function createProxy (Self : access b2DynamicTree; aabb : in collision.b2AABB; userData : access Any'Class ) return int32 is proxyId : constant int32 := Self.AllocateNode; r : constant b2Vec2 := (b2_aabbExtension, b2_aabbExtension); begin -- Fatten the aabb. Self.m_nodes (proxyId).aabb.lowerBound := aabb.lowerBound - r; Self.m_nodes (proxyId).aabb.upperBound := aabb.upperBound + r; Self.m_nodes (proxyId).userData := userData; Self.m_nodes (proxyId).height := 0; Self.InsertLeaf (proxyId); return proxyId; end createProxy; -- int32 b2DynamicTree::CreateProxy(const b2AABB& aabb, void* userData) -- { -- int32 proxyId = AllocateNode(); -- -- // Fatten the aabb. -- b2Vec2 r(b2_aabbExtension, b2_aabbExtension); -- m_nodes[proxyId].aabb.lowerBound = aabb.lowerBound - r; -- m_nodes[proxyId].aabb.upperBound = aabb.upperBound + r; -- m_nodes[proxyId].userData = userData; -- m_nodes[proxyId].height = 0; -- -- InsertLeaf(proxyId); -- -- return proxyId; -- } procedure destroyProxy (Self : in out b2DynamicTree; proxyId : int32) is begin pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity); pragma Assert (isLeaf (Self.m_nodes (proxyId))); Self.removeLeaf (proxyId); Self.freeNode (proxyId); end destroyProxy; -- void b2DynamicTree::DestroyProxy(int32 proxyId) -- { -- b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); -- b2Assert(m_nodes[proxyId].IsLeaf()); -- -- RemoveLeaf(proxyId); -- FreeNode(proxyId); -- } function MoveProxy (Self : access b2DynamicTree; proxyId : in int32; aabb : in collision.b2AABB; displacement : in b2Vec2) return Boolean is use impact.d2.Collision; b : collision.b2AABB; d, r : b2Vec2; begin pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity); pragma Assert (isLeaf (Self.m_nodes (proxyId))); if Contains (Self.m_nodes (proxyId).aabb, aabb) then return False; end if; Self.RemoveLeaf (proxyId); -- Extend AABB. b := aabb; r := (b2_aabbExtension, b2_aabbExtension); b.lowerBound := b.lowerBound - r; b.upperBound := b.upperBound + r; -- Predict AABB displacement. d := b2_aabbMultiplier * displacement; if d.x < 0.0 then b.lowerBound.x := b.lowerBound.x + d.x; else b.upperBound.x := b.upperBound.x + d.x; end if; if d.y < 0.0 then b.lowerBound.y := b.lowerBound.y + d.y; else b.upperBound.y := b.upperBound.y + d.y; end if; Self.m_nodes (proxyId).aabb := b; Self.insertLeaf (proxyId); return True; end MoveProxy; -- bool b2DynamicTree::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement) -- { -- b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); -- -- b2Assert(m_nodes[proxyId].IsLeaf()); -- -- if (m_nodes[proxyId].aabb.Contains(aabb)) -- { -- return false; -- } -- -- RemoveLeaf(proxyId); -- -- // Extend AABB. -- b2AABB b = aabb; -- b2Vec2 r(b2_aabbExtension, b2_aabbExtension); -- b.lowerBound = b.lowerBound - r; -- b.upperBound = b.upperBound + r; -- -- // Predict AABB displacement. -- b2Vec2 d = b2_aabbMultiplier * displacement; -- -- if (d.x < 0.0f) -- { -- b.lowerBound.x += d.x; -- } -- else -- { -- b.upperBound.x += d.x; -- } -- -- if (d.y < 0.0f) -- { -- b.lowerBound.y += d.y; -- } -- else -- { -- b.upperBound.y += d.y; -- } -- -- m_nodes[proxyId].aabb = b; -- -- InsertLeaf(proxyId); -- return true; -- } -- Perform a left or right rotation if node A is imbalanced. -- Returns the new root index. function Balance (Self : in out b2DynamicTree; iA : in int32) return int32 is pragma assert (iA /= b2_nullNode); A : b2DynamicTreeNode renames Self.m_nodes (iA); iB, iC : int32; begin if IsLeaf (A) or A.height < 2 then return iA; end if; iB := A.child1; pragma assert (0 <= iB and iB < Self.m_nodeCapacity); iC := A.child2; pragma assert (0 <= iC and iC < Self.m_nodeCapacity); declare B : b2DynamicTreeNode renames Self.m_nodes (iB); C : b2DynamicTreeNode renames Self.m_nodes (iC); balance : constant int32 := C.height - B.height; begin -- Rotate C up if balance > 1 then declare i_F : constant int32 := C.child1; pragma assert (0 <= i_F and i_F < Self.m_nodeCapacity); iG : constant int32 := C.child2; pragma assert (0 <= iG and iG < Self.m_nodeCapacity); F : b2DynamicTreeNode renames Self.m_nodes (i_F); G : b2DynamicTreeNode renames Self.m_nodes (iG); begin -- Swap A and C C.child1 := iA; C.parent := A.parent; A.parent := iC; -- A's old parent should point to C if C.parent /= b2_nullNode then if Self.m_nodes (C.parent).child1 = iA then Self.m_nodes (C.parent).child1 := iC; else pragma assert (Self.m_nodes (C.parent).child2 = iA); Self.m_nodes (C.parent).child2 := iC; end if; else Self.m_root := iC; end if; -- Rotate if F.height > G.height then C.child2 := i_F; A.child2 := iG; G.parent := iA; A.aabb.Combine (B.aabb, G.aabb); C.aabb.Combine (A.aabb, F.aabb); A.height := 1 + int32'Max (B.height, G.height); C.height := 1 + int32'Max (A.height, F.height); else C.child2 := iG; A.child2 := i_F; F.parent := iA; A.aabb.Combine(B.aabb, F.aabb); C.aabb.Combine(A.aabb, G.aabb); A.height := 1 + int32'Max (B.height, F.height); C.height := 1 + int32'Max (A.height, G.height); end if; return iC; end; end if; -- Rotate B up if balance < -1 then declare iD : constant int32 := B.child1; iE : constant int32 := B.child2; D : b2DynamicTreeNode renames Self.m_nodes (iD); E : b2DynamicTreeNode renames Self.m_nodes (iE); pragma assert (0 <= iD and iD < Self.m_nodeCapacity); pragma assert (0 <= iE and iE < Self.m_nodeCapacity); begin -- Swap A and B B.child1 := iA; B.parent := A.parent; A.parent := iB; -- A's old parent should point to B if B.parent /= b2_nullNode then if Self.m_nodes (B.parent).child1 = iA then Self.m_nodes (B.parent).child1 := iB; else pragma assert (Self.m_nodes (B.parent).child2 = iA); Self.m_nodes (B.parent).child2 := iB; end if; else Self.m_root := iB; end if; -- Rotate if D.height > E.height then B.child2 := iD; A.child1 := iE; E.parent := iA; A.aabb.Combine (C.aabb, E.aabb); B.aabb.Combine (A.aabb, D.aabb); A.height := 1 + int32'Max (C.height, E.height); B.height := 1 + int32'Max (A.height, D.height); else B.child2 := iE; A.child1 := iD; D.parent := iA; A.aabb.Combine (C.aabb, D.aabb); B.aabb.Combine (A.aabb, E.aabb); A.height := 1 + int32'Max (C.height, D.height); B.height := 1 + int32'Max (A.height, E.height); end if; return iB; end; end if; end; return iA; end Balance; -- // Perform a left or right rotation if node A is imbalanced. -- // Returns the new root index. -- int32 b2DynamicTree::Balance(int32 iA) -- { -- b2Assert(iA != b2_nullNode); -- -- b2TreeNode* A = m_nodes + iA; -- if (A->IsLeaf() || A->height < 2) -- { -- return iA; -- } -- -- int32 iB = A->child1; -- int32 iC = A->child2; -- b2Assert(0 <= iB && iB < m_nodeCapacity); -- b2Assert(0 <= iC && iC < m_nodeCapacity); -- -- b2TreeNode* B = m_nodes + iB; -- b2TreeNode* C = m_nodes + iC; -- -- int32 balance = C->height - B->height; -- -- // Rotate C up -- if (balance > 1) -- { -- int32 iF = C->child1; -- int32 iG = C->child2; -- b2TreeNode* F = m_nodes + iF; -- b2TreeNode* G = m_nodes + iG; -- b2Assert(0 <= iF && iF < m_nodeCapacity); -- b2Assert(0 <= iG && iG < m_nodeCapacity); -- -- // Swap A and C -- C->child1 = iA; -- C->parent = A->parent; -- A->parent = iC; -- -- // A's old parent should point to C -- if (C->parent != b2_nullNode) -- { -- if (m_nodes[C->parent].child1 == iA) -- { -- m_nodes[C->parent].child1 = iC; -- } -- else -- { -- b2Assert(m_nodes[C->parent].child2 == iA); -- m_nodes[C->parent].child2 = iC; -- } -- } -- else -- { -- m_root = iC; -- } -- -- // Rotate -- if (F->height > G->height) -- { -- C->child2 = iF; -- A->child2 = iG; -- G->parent = iA; -- A->aabb.Combine(B->aabb, G->aabb); -- C->aabb.Combine(A->aabb, F->aabb); -- -- A->height = 1 + b2Max(B->height, G->height); -- C->height = 1 + b2Max(A->height, F->height); -- } -- else -- { -- C->child2 = iG; -- A->child2 = iF; -- F->parent = iA; -- A->aabb.Combine(B->aabb, F->aabb); -- C->aabb.Combine(A->aabb, G->aabb); -- -- A->height = 1 + b2Max(B->height, F->height); -- C->height = 1 + b2Max(A->height, G->height); -- } -- -- return iC; -- } -- -- // Rotate B up -- if (balance < -1) -- { -- int32 iD = B->child1; -- int32 iE = B->child2; -- b2TreeNode* D = m_nodes + iD; -- b2TreeNode* E = m_nodes + iE; -- b2Assert(0 <= iD && iD < m_nodeCapacity); -- b2Assert(0 <= iE && iE < m_nodeCapacity); -- -- // Swap A and B -- B->child1 = iA; -- B->parent = A->parent; -- A->parent = iB; -- -- // A's old parent should point to B -- if (B->parent != b2_nullNode) -- { -- if (m_nodes[B->parent].child1 == iA) -- { -- m_nodes[B->parent].child1 = iB; -- } -- else -- { -- b2Assert(m_nodes[B->parent].child2 == iA); -- m_nodes[B->parent].child2 = iB; -- } -- } -- else -- { -- m_root = iB; -- } -- -- // Rotate -- if (D->height > E->height) -- { -- B->child2 = iD; -- A->child1 = iE; -- E->parent = iA; -- A->aabb.Combine(C->aabb, E->aabb); -- B->aabb.Combine(A->aabb, D->aabb); -- -- A->height = 1 + b2Max(C->height, E->height); -- B->height = 1 + b2Max(A->height, D->height); -- } -- else -- { -- B->child2 = iE; -- A->child1 = iD; -- D->parent = iA; -- A->aabb.Combine(C->aabb, D->aabb); -- B->aabb.Combine(A->aabb, E->aabb); -- -- A->height = 1 + b2Max(C->height, D->height); -- B->height = 1 + b2Max(A->height, E->height); -- } -- -- return iB; -- } -- -- return iA; -- } function getUserData (Self : in b2DynamicTree; proxyId : in int32) return access Any'Class is pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity); begin return Self.m_nodes (proxyId).userData; end getUserData; function GetFatAABB (Self : in b2DynamicTree; proxyId : int32) return collision.b2AABB is pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity); begin return Self.m_nodes (proxyId).aabb; end GetFatAABB; package int32_Vectors is new ada.Containers.Vectors (Positive, int32); subtype int32_Stack is int32_Vectors.Vector; procedure Query (Self : in b2DynamicTree; the_Callback : access callback_t; aabb : in collision.b2AABB) is use ada.Containers, int32_Vectors; Stack : int32_Stack; nodeId : int32; begin Stack.reserve_Capacity (256); Stack.append (Self.m_root); while Stack.Length > 0 loop nodeId := Stack.Last_Element; Stack.delete_Last; if nodeId /= b2_nullNode then declare node : b2DynamicTreeNode renames Self.m_nodes (nodeId); proceed : Boolean; begin if collision.b2TestOverlap (node.aabb, aabb) then if isLeaf (node) then proceed := QueryCallback (the_Callback, nodeId); if not proceed then return; end if; else Stack.append (node.child1); Stack.append (node.child2); end if; end if; end; end if; end loop; end Query; procedure Raycast (Self : in b2DynamicTree; the_Callback : access callback_t; input : in collision.b2RayCastInput) is use ada.Containers, int32_Vectors; p1 : constant b2Vec2 := input.p1; p2 : constant b2Vec2 := input.p2; r_pad : constant b2Vec2 := p2 - p1; pragma Assert (LengthSquared (r_pad) > 0.0); r : constant b2Vec2 := Normalize (r_pad); -- v is perpendicular to the segment. -- v : constant b2Vec2 := b2Cross (1.0, r); abs_v : constant b2Vec2 := b2Abs (v); -- Separating axis for segment (Gino, p80). -- |dot(v, p1 - c)| > dot(|v|, h) -- maxFraction : float32 := input.maxFraction; segmentAABB : collision.b2AABB; t : b2Vec2; Stack : int32_Stack; count : int32 := 0; nodeId : int32; begin -- Build a bounding box for the segment. -- t := p1 + maxFraction * (p2 - p1); segmentAABB.lowerBound := b2Min (p1, t); segmentAABB.upperBound := b2Max (p1, t); Stack.reserve_Capacity (256); Stack.append (Self.m_root); while Stack.Length > 0 loop nodeId := Stack.last_Element; Stack.delete_Last; if nodeId /= b2_nullNode then declare use impact.d2.Collision; node : b2DynamicTreeNode renames Self.m_nodes (nodeId); c, h : b2Vec2; separation : float32; subInput : collision.b2RayCastInput; value : float32; begin if collision.b2TestOverlap (node.aabb, segmentAABB) then -- Separating axis for segment (Gino, p80). -- |dot(v, p1 - c)| > dot(|v|, h) -- c := GetCenter (node.aabb); h := GetExtents (node.aabb); separation := abs (b2Dot (v, p1 - c)) - b2Dot (abs_v, h); if separation <= 0.0 then if isLeaf (node) then subInput.p1 := input.p1; subInput.p2 := input.p2; subInput.maxFraction := maxFraction; value := RayCastCallback (the_Callback, subInput, nodeId); if value = 0.0 then return; -- The client has terminated the ray cast. end if; if value > 0.0 then -- Update segment bounding box. -- maxFraction := value; t := p1 + maxFraction * (p2 - p1); segmentAABB.lowerBound := b2Min (p1, t); segmentAABB.upperBound := b2Max (p1, t); end if; else Stack.append (node.child1); Stack.append (node.child2); end if; end if; end if; end; end if; end loop; end Raycast; -- Allocate a node from the pool. Grow the pool if necessary. -- function AllocateNode (Self : access b2DynamicTree) return int32 is oldNodes : b2DynamicTreeNodes_view; nodeId : int32; begin -- Expand the node pool as needed. if Self.m_freeList = b2_nullNode then pragma Assert (Self.m_nodeCount = Self.m_nodeCapacity); -- The free list is empty. Rebuild a bigger pool. oldNodes := Self.m_nodes; Self.m_nodeCapacity := Self.m_nodeCapacity * 2; Self.m_nodes := new b2DynamicTreeNodes (0 .. Self.m_nodeCapacity - 1); Self.m_nodes (oldNodes'Range) := oldNodes.all; free (oldNodes); -- Build a linked list for the free list. The parent pointer becomes the "next" pointer. for i in Self.m_nodeCount .. Self.m_nodeCapacity - 2 loop Self.m_nodes (i).next := i + 1; Self.m_nodes (i).height := -1; end loop; Self.m_nodes (Self.m_nodeCapacity - 1).next := b2_nullNode; Self.m_nodes (Self.m_nodeCapacity - 1).height := -1; Self.m_freeList := Self.m_nodeCount; end if; -- Peel a node off the free list. nodeId := Self.m_freeList; Self.m_freeList := Self.m_nodes (nodeId).next; Self.m_nodes (nodeId).parent := b2_nullNode; Self.m_nodes (nodeId).child1 := b2_nullNode; Self.m_nodes (nodeId).child2 := b2_nullNode; Self.m_nodes (nodeId).height := 0; Self.m_nodes (nodeId).userData := null; Self.m_nodeCount := Self.m_nodeCount + 1; return nodeId; end AllocateNode; -- // Allocate a node from the pool. Grow the pool if necessary. -- int32 b2DynamicTree::AllocateNode() -- { -- // Expand the node pool as needed. -- if (m_freeList == b2_nullNode) -- { -- b2Assert(m_nodeCount == m_nodeCapacity); -- -- // The free list is empty. Rebuild a bigger pool. -- b2TreeNode* oldNodes = m_nodes; -- m_nodeCapacity *= 2; -- m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); -- memcpy(m_nodes, oldNodes, m_nodeCount * sizeof(b2TreeNode)); -- b2Free(oldNodes); -- -- // Build a linked list for the free list. The parent -- // pointer becomes the "next" pointer. -- for (int32 i = m_nodeCount; i < m_nodeCapacity - 1; ++i) -- { -- m_nodes[i].next = i + 1; -- m_nodes[i].height = -1; -- } -- m_nodes[m_nodeCapacity-1].next = b2_nullNode; -- m_nodes[m_nodeCapacity-1].height = -1; -- m_freeList = m_nodeCount; -- } -- -- // Peel a node off the free list. -- int32 nodeId = m_freeList; -- m_freeList = m_nodes[nodeId].next; -- m_nodes[nodeId].parent = b2_nullNode; -- m_nodes[nodeId].child1 = b2_nullNode; -- m_nodes[nodeId].child2 = b2_nullNode; -- m_nodes[nodeId].height = 0; -- m_nodes[nodeId].userData = NULL; -- ++m_nodeCount; -- return nodeId; -- } -- Return a node to the pool. -- procedure FreeNode (Self : in out b2DynamicTree; nodeId : in int32) is begin pragma Assert (0 <= nodeId and then nodeId < Self.m_nodeCapacity); pragma Assert (0 < Self.m_nodeCount); Self.m_nodes (nodeId).next := Self.m_freeList; Self.m_nodes (nodeId).height := -1; Self.m_freeList := nodeId; Self.m_nodeCount := Self.m_nodeCount - 1; end FreeNode; -- void b2DynamicTree::FreeNode(int32 nodeId) -- { -- b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); -- b2Assert(0 < m_nodeCount); -- m_nodes[nodeId].next = m_freeList; -- m_nodes[nodeId].height = -1; -- m_freeList = nodeId; -- --m_nodeCount; -- } procedure InsertLeaf (Self : in out b2DynamicTree; leafId : in int32) is use impact.d2.Collision; center : b2Vec2; sibling : int32; node1, node2 : int32; leafAABB : b2AABB; index : int32; begin Self.m_insertionCount := Self.m_insertionCount + 1; if Self.m_root = b2_nullNode then Self.m_root := leafId; Self.m_nodes (Self.m_root).parent := b2_nullNode; return; end if; -- Find the best sibling for this node. leafAABB := Self.m_nodes (leafId).aabb; index := Self.m_root; while not IsLeaf (Self.m_nodes (index)) loop declare child1 : constant int32 := Self.m_nodes (index).child1; child2 : constant int32 := Self.m_nodes (index).child2; area : constant float32 := GetPerimeter (Self.m_nodes (index).aabb); combinedAABB : b2AABB; combinedArea : float32; cost, cost1, cost2, inheritanceCost : float32; begin Combine (combinedAABB, Self.m_nodes (index).aabb, leafAABB); combinedArea := GetPerimeter (combinedAABB); -- Cost of creating a new parent for this node and the new leaf cost := 2.0 * combinedArea; -- Minimum cost of pushing the leaf further down the tree inheritanceCost := 2.0 * (combinedArea - area); -- Cost of descending into child1 if IsLeaf (Self.m_nodes (child1)) then declare aabb : b2AABB; begin Combine (aabb, leafAABB, Self.m_nodes (child1).aabb); cost1 := GetPerimeter (aabb) + inheritanceCost; end; else declare aabb : b2AABB; oldArea, newArea : float32; begin aabb.Combine (leafAABB, Self.m_nodes (child1).aabb); oldArea := Self.m_nodes (child1).aabb.GetPerimeter; newArea := aabb.GetPerimeter; cost1 := (newArea - oldArea) + inheritanceCost; end; end if; -- Cost of descending into child2 if IsLeaf (Self.m_nodes (child2)) then declare aabb : b2AABB; begin aabb.Combine (leafAABB, Self.m_nodes (child2).aabb); cost2 := aabb.GetPerimeter + inheritanceCost; end; else declare aabb : b2AABB; oldArea, newArea : float32; begin aabb.Combine (leafAABB, Self.m_nodes (child2).aabb); oldArea := Self.m_nodes (child2).aabb.GetPerimeter; newArea := aabb.GetPerimeter; cost2 := newArea - oldArea + inheritanceCost; end; end if; -- Descend according to the minimum cost. if cost < cost1 and then cost < cost2 then exit; end if; -- Descend if cost1 < cost2 then index := child1; else index := child2; end if; end; end loop; sibling := index; -- Create a new parent. -- declare oldParent : constant int32 := Self.m_nodes (sibling).parent; newParent : constant int32 := Self.AllocateNode; begin Self.m_nodes (newParent).parent := oldParent; Self.m_nodes (newParent).userData := null; Self.m_nodes (newParent).aabb.Combine(leafAABB, Self.m_nodes (sibling).aabb); Self.m_nodes (newParent).height := Self.m_nodes (sibling).height + 1; if oldParent /= b2_nullNode then -- The sibling was not the root. if Self.m_nodes (oldParent).child1 = sibling then Self.m_nodes (oldParent).child1 := newParent; else Self.m_nodes (oldParent).child2 := newParent; end if; Self.m_nodes (newParent).child1 := sibling; Self.m_nodes (newParent).child2 := leafId; Self.m_nodes (sibling) .parent := newParent; Self.m_nodes (leafId) .parent := newParent; else -- The sibling was the root. Self.m_nodes (newParent).child1 := sibling; Self.m_nodes (newParent).child2 := leafId; Self.m_nodes (sibling) .parent := newParent; Self.m_nodes (leafId) .parent := newParent; Self.m_root := newParent; end if; end; -- Walk back up the tree fixing heights and AABBs index := Self.m_nodes (leafId).parent; while index /= b2_nullNode loop declare child1, child2 : int32; begin index := Self.Balance (index); child1 := Self.m_nodes (index).child1; child2 := Self.m_nodes (index).child2; pragma assert (child1 /= b2_nullNode); pragma assert (child2 /= b2_nullNode); Self.m_nodes (index).height := 1 + int32'Max (Self.m_nodes (child1).height, Self.m_nodes (child2).height); Self.m_nodes (index).aabb.Combine (Self.m_nodes (child1).aabb, Self.m_nodes (child2).aabb); index := Self.m_nodes (index).parent; end; end loop; end InsertLeaf; -- void b2DynamicTree::InsertLeaf(int32 leaf) -- { -- ++m_insertionCount; -- -- if (m_root == b2_nullNode) -- { -- m_root = leaf; -- m_nodes[m_root].parent = b2_nullNode; -- return; -- } -- -- // Find the best sibling for this node -- b2AABB leafAABB = m_nodes[leaf].aabb; -- int32 index = m_root; -- while (m_nodes[index].IsLeaf() == false) -- { -- int32 child1 = m_nodes[index].child1; -- int32 child2 = m_nodes[index].child2; -- -- float32 area = m_nodes[index].aabb.GetPerimeter(); -- -- b2AABB combinedAABB; -- combinedAABB.Combine(m_nodes[index].aabb, leafAABB); -- float32 combinedArea = combinedAABB.GetPerimeter(); -- -- // Cost of creating a new parent for this node and the new leaf -- float32 cost = 2.0f * combinedArea; -- -- // Minimum cost of pushing the leaf further down the tree -- float32 inheritanceCost = 2.0f * (combinedArea - area); -- -- // Cost of descending into child1 -- float32 cost1; -- if (m_nodes[child1].IsLeaf()) -- { -- b2AABB aabb; -- aabb.Combine(leafAABB, m_nodes[child1].aabb); -- cost1 = aabb.GetPerimeter() + inheritanceCost; -- } -- else -- { -- b2AABB aabb; -- aabb.Combine(leafAABB, m_nodes[child1].aabb); -- float32 oldArea = m_nodes[child1].aabb.GetPerimeter(); -- float32 newArea = aabb.GetPerimeter(); -- cost1 = (newArea - oldArea) + inheritanceCost; -- } -- -- // Cost of descending into child2 -- float32 cost2; -- if (m_nodes[child2].IsLeaf()) -- { -- b2AABB aabb; -- aabb.Combine(leafAABB, m_nodes[child2].aabb); -- cost2 = aabb.GetPerimeter() + inheritanceCost; -- } -- else -- { -- b2AABB aabb; -- aabb.Combine(leafAABB, m_nodes[child2].aabb); -- float32 oldArea = m_nodes[child2].aabb.GetPerimeter(); -- float32 newArea = aabb.GetPerimeter(); -- cost2 = newArea - oldArea + inheritanceCost; -- } -- -- // Descend according to the minimum cost. -- if (cost < cost1 && cost < cost2) -- { -- break; -- } -- -- // Descend -- if (cost1 < cost2) -- { -- index = child1; -- } -- else -- { -- index = child2; -- } -- } -- -- int32 sibling = index; -- -- // Create a new parent. -- int32 oldParent = m_nodes[sibling].parent; -- int32 newParent = AllocateNode(); -- m_nodes[newParent].parent = oldParent; -- m_nodes[newParent].userData = NULL; -- m_nodes[newParent].aabb.Combine(leafAABB, m_nodes[sibling].aabb); -- m_nodes[newParent].height = m_nodes[sibling].height + 1; -- -- if (oldParent != b2_nullNode) -- { -- // The sibling was not the root. -- if (m_nodes[oldParent].child1 == sibling) -- { -- m_nodes[oldParent].child1 = newParent; -- } -- else -- { -- m_nodes[oldParent].child2 = newParent; -- } -- -- m_nodes[newParent].child1 = sibling; -- m_nodes[newParent].child2 = leaf; -- m_nodes[sibling].parent = newParent; -- m_nodes[leaf].parent = newParent; -- } -- else -- { -- // The sibling was the root. -- m_nodes[newParent].child1 = sibling; -- m_nodes[newParent].child2 = leaf; -- m_nodes[sibling].parent = newParent; -- m_nodes[leaf].parent = newParent; -- m_root = newParent; -- } -- -- // Walk back up the tree fixing heights and AABBs -- index = m_nodes[leaf].parent; -- while (index != b2_nullNode) -- { -- index = Balance(index); -- -- int32 child1 = m_nodes[index].child1; -- int32 child2 = m_nodes[index].child2; -- -- b2Assert(child1 != b2_nullNode); -- b2Assert(child2 != b2_nullNode); -- -- m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); -- m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); -- -- index = m_nodes[index].parent; -- } -- -- //Validate(); -- } procedure RemoveLeaf (Self : in out b2DynamicTree; leafId : in int32) is use impact.d2.Collision; parent : int32; grandParent : int32; sibling : int32; oldAABB : b2AABB; begin if leafId = Self.m_root then Self.m_root := b2_nullNode; return; end if; parent := Self.m_nodes (leafId).parent; grandParent := Self.m_nodes (parent).parent; if Self.m_nodes (parent).child1 = leafId then sibling := Self.m_nodes (parent).child2; else sibling := Self.m_nodes (parent).child1; end if; if grandParent /= b2_nullNode then -- Destroy node2 and connect node1 to sibling. if Self.m_nodes (grandParent).child1 = parent then Self.m_nodes (grandParent).child1 := sibling; else Self.m_nodes (grandParent).child2 := sibling; end if; Self.m_nodes (sibling).parent := grandParent; Self.FreeNode (parent); -- Adjust ancestor bounds. declare index : int32 := grandParent; child1, child2 : int32; begin while index /= b2_nullNode loop index := Self.Balance (index); child1 := Self.m_nodes (index).child1; child2 := Self.m_nodes (index).child2; Self.m_nodes (index).aabb.combine (Self.m_nodes (child1).aabb, Self.m_nodes (child2).aabb); Self.m_nodes (index).height := 1 + int32'Max (Self.m_nodes (child1).height, Self.m_nodes (child2).height); index := Self.m_nodes (index).parent; end loop; end; else Self.m_root := sibling; Self.m_nodes (sibling).parent := b2_nullNode; Self.FreeNode (parent); end if; end RemoveLeaf; -- void b2DynamicTree::RemoveLeaf(int32 leaf) -- { -- if (leaf == m_root) -- { -- m_root = b2_nullNode; -- return; -- } -- -- int32 parent = m_nodes[leaf].parent; -- int32 grandParent = m_nodes[parent].parent; -- int32 sibling; -- if (m_nodes[parent].child1 == leaf) -- { -- sibling = m_nodes[parent].child2; -- } -- else -- { -- sibling = m_nodes[parent].child1; -- } -- -- if (grandParent != b2_nullNode) -- { -- // Destroy parent and connect sibling to grandParent. -- if (m_nodes[grandParent].child1 == parent) -- { -- m_nodes[grandParent].child1 = sibling; -- } -- else -- { -- m_nodes[grandParent].child2 = sibling; -- } -- m_nodes[sibling].parent = grandParent; -- FreeNode(parent); -- -- // Adjust ancestor bounds. -- int32 index = grandParent; -- while (index != b2_nullNode) -- { -- index = Balance(index); -- -- int32 child1 = m_nodes[index].child1; -- int32 child2 = m_nodes[index].child2; -- -- m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); -- m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); -- -- index = m_nodes[index].parent; -- } -- } -- else -- { -- m_root = sibling; -- m_nodes[sibling].parent = b2_nullNode; -- FreeNode(parent); -- } -- -- //Validate(); -- } function getHeight (Self : in b2DynamicTree) return int32 is begin if Self.m_root = b2_nullNode then return 0; end if; return Self.m_nodes (Self.m_root).height; end getHeight; function GetMaxBalance (Self : in b2DynamicTree) return int32 is maxBalance : int32 := 0; begin for i in 0 .. Self.m_nodeCapacity - 1 loop declare node : b2DynamicTreeNode renames Self.m_nodes (i); child1, child2, balance : int32; begin if node.height > 1 then pragma assert (not IsLeaf (node)); child1 := node.child1; child2 := node.child2; balance := abs ( Self.m_nodes (child2).height - Self.m_nodes (child1).height); maxBalance := int32'Max (maxBalance, balance); end if; end; end loop; return maxBalance; end GetMaxBalance; function GetAreaRatio (Self : in b2DynamicTree) return float32 is begin if Self.m_root = b2_nullNode then return 0.0; end if; declare root : b2DynamicTreeNode renames Self.m_nodes (Self.m_root); rootArea : float32 := root.aabb.GetPerimeter; totalArea : float32 := 0.0; begin for i in 0 .. Self.m_nodeCapacity - 1 loop declare node : b2DynamicTreeNode renames Self.m_nodes (i); begin if node.height < 0 then -- Free node in pool null; else totalArea := totalArea + node.aabb.GetPerimeter; end if; end; end loop; return totalArea / rootArea; end; end GetAreaRatio; function ComputeHeight (Self : in b2DynamicTree) return int32 is begin return Self.ComputeHeight (Self.m_root); end ComputeHeight; -- Compute the height of a sub-tree. -- function ComputeHeight (Self : in b2DynamicTree; nodeId : in int32) return int32 is pragma assert ( 0 <= nodeId and then nodeId < Self.m_nodeCapacity); node : b2DynamicTreeNode renames Self.m_nodes (nodeId); begin if isLeaf (node) then return 0; end if; declare height1 : constant int32 := Self.computeHeight (node.child1); height2 : constant int32 := Self.computeHeight (node.child2); begin return 1 + int32'Max (height1, height2); end; end ComputeHeight; -- int32 b2DynamicTree::ComputeHeight(int32 nodeId) const -- { -- b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); -- b2TreeNode* node = m_nodes + nodeId; -- -- if (node->IsLeaf()) -- { -- return 0; -- } -- -- int32 height1 = ComputeHeight(node->child1); -- int32 height2 = ComputeHeight(node->child2); -- return 1 + b2Max(height1, height2); -- } end impact.d2.dynamic_Tree;
oeis/105/A105129.asm
neoneye/loda-programs
11
92756
; A105129: Primes of the form 128n+65. ; Submitted by <NAME> ; 193,449,577,1217,1601,2113,2753,3137,4289,4673,4801,5441,5569,5953,6337,6977,7489,7873,8513,8641,9281,10177,10433,11329,11969,12097,13121,13249,13633,14401,14657,15809,15937,16193,17729,19009,19777,20161,20929,21313,21569,22721,23873,24001,25153,25409,25537,25793,26177,26561,27073,27329,27457,28097,29633,29761,30529,32321,32833,33601,33857,34369,35393,35521,36161,36929,37057,37313,37441,38593,38977,39233,40129,40897,41281,42433,42689,43201,43457,43969,45121,45377,46273,47041,47297,47681,47809 mov $1,3 mov $2,$0 add $2,6 pow $2,2 lpb $2 add $1,24 sub $2,1 mov $3,$1 add $1,4 add $3,5 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,36 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,69
programs/oeis/319/A319610.asm
jmorken/loda
1
88549
; A319610: a(n) is the minimal number of successive OFF cells that appears in n-th generation of rule-30 1D cellular automaton started from a single ON cell. ; 0,0,2,1,2,1,2,1,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,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,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 mov $2,$0 mov $4,$0 lpb $4 lpb $0 add $2,4 mov $0,$2 lpe mov $3,4 lpb $2 trn $2,$3 lpe sub $0,2 mov $1,4 sub $1,$4 add $2,3 mov $4,$0 lpe
source/oasis/program-elements-anonymous_access_definitions.ads
reznikmm/gela
0
30222
<reponame>reznikmm/gela -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Definitions; package Program.Elements.Anonymous_Access_Definitions is pragma Pure (Program.Elements.Anonymous_Access_Definitions); type Anonymous_Access_Definition is limited interface and Program.Elements.Definitions.Definition; type Anonymous_Access_Definition_Access is access all Anonymous_Access_Definition'Class with Storage_Size => 0; end Program.Elements.Anonymous_Access_Definitions;
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_190_1978.asm
ljhsiun2/medusa
9
17329
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0xcc1a, %r8 clflush (%r8) nop nop xor $63243, %rdi and $0xffffffffffffffc0, %r8 vmovaps (%r8), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %r15 nop nop nop nop nop xor $36898, %r13 lea addresses_UC_ht+0x10d6e, %r13 nop nop nop xor $64420, %r15 movb $0x61, (%r13) nop nop nop nop nop dec %r15 lea addresses_WT_ht+0x187ee, %r14 nop nop nop nop add %r13, %r13 vmovups (%r14), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %r8 add $13528, %r14 lea addresses_D_ht+0x16a2e, %rsi lea addresses_normal_ht+0x8e4e, %rdi nop nop nop nop nop and %r15, %r15 mov $4, %rcx rep movsw xor $29206, %rdi lea addresses_D_ht+0x623e, %rcx clflush (%rcx) nop nop nop nop nop sub %rdi, %rdi movw $0x6162, (%rcx) xor $6145, %rdi lea addresses_UC_ht+0x956e, %rsi lea addresses_WC_ht+0x10d88, %rdi nop nop nop nop cmp %rbx, %rbx mov $47, %rcx rep movsw nop nop nop nop xor %rcx, %rcx lea addresses_WC_ht+0xc76e, %rcx nop nop nop add %rbx, %rbx mov (%rcx), %r13w cmp $1198, %r15 lea addresses_normal_ht+0x10f52, %rcx xor %r14, %r14 vmovups (%rcx), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rsi nop xor $11439, %rsi lea addresses_WC_ht+0x8e6e, %rcx nop nop nop nop sub %r15, %r15 vmovups (%rcx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rdi nop nop nop inc %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r8 push %rdi push %rdx // Store lea addresses_UC+0x1eaee, %r11 nop nop nop and $20893, %r13 mov $0x5152535455565758, %rdx movq %rdx, %xmm6 vmovups %ymm6, (%r11) inc %rdx // Load lea addresses_RW+0x183ee, %r14 nop nop nop nop nop lfence mov (%r14), %r11d nop add %r11, %r11 // Store lea addresses_D+0xd708, %r13 nop nop nop inc %rdi movl $0x51525354, (%r13) nop nop nop nop and %r13, %r13 // Store mov $0x35ddee0000000ace, %r14 nop nop nop nop xor %rdi, %rdi mov $0x5152535455565758, %r13 movq %r13, %xmm4 vmovups %ymm4, (%r14) nop nop nop nop nop xor $60698, %r13 // Faulty Load lea addresses_US+0x556e, %rdx nop nop cmp %r10, %r10 mov (%rdx), %r8w lea oracles, %rdi and $0xff, %r8 shlq $12, %r8 mov (%rdi,%r8,1), %r8 pop %rdx pop %rdi pop %r8 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'00': 190} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oeis/162/A162845.asm
neoneye/loda-programs
11
16879
<filename>oeis/162/A162845.asm ; A162845: Sum of digits of binomial(3n,n). ; 1,3,6,12,18,6,24,18,27,39,18,36,36,36,42,60,63,63,78,72,72,63,72,90,72,99,90,75,117,108,90,99,117,117,99,162,126,144,153,153,153,159,150,126,153,114,144,171,171,171,162,162,198,180,186,207,180,189,180,234,207 mov $3,$0 seq $3,5809 ; a(n) = binomial(3n,n). mov $2,$3 seq $2,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n). mov $0,$2
drivers/stm32gd-drivers.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
24666
<filename>drivers/stm32gd-drivers.ads package STM32GD.Drivers is pragma Pure; end STM32GD.Drivers;
agda-stdlib-0.9/src/Relation/Binary/Properties/StrictTotalOrder.agda
qwe2/try-agda
1
10348
------------------------------------------------------------------------ -- The Agda standard library -- -- Properties satisfied by strict partial orders ------------------------------------------------------------------------ open import Relation.Binary module Relation.Binary.Properties.StrictTotalOrder {s₁ s₂ s₃} (STO : StrictTotalOrder s₁ s₂ s₃) where open Relation.Binary.StrictTotalOrder STO import Relation.Binary.StrictToNonStrict as Conv open Conv _≈_ _<_ import Relation.Binary.Properties.StrictPartialOrder as SPO open import Relation.Binary.Consequences ------------------------------------------------------------------------ -- Strict total orders can be converted to decidable total orders decTotalOrder : DecTotalOrder _ _ _ decTotalOrder = record { isDecTotalOrder = record { isTotalOrder = record { isPartialOrder = SPO.isPartialOrder strictPartialOrder ; total = total compare } ; _≟_ = _≟_ ; _≤?_ = decidable' compare } } open DecTotalOrder decTotalOrder public
source/asis/asis-gela-normalizer-utils.ads
faelys/gela-asis
4
26839
<reponame>faelys/gela-asis<gh_stars>1-10 ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ -- Purpose: -- Helper subprograms with Asis.Declarations; private package Asis.Gela.Normalizer.Utils is procedure Set_Default_Kind (Element : Asis.Element); procedure Set_Names (Element : Asis.Element; Name : Asis.Defining_Name := Asis.Nil_Element); procedure Check_Empty_Profile (Element : in out Asis.Element); procedure Check_Empty_Result (Profile : in out Asis.Element); procedure Check_Empty_Generic (Element : Asis.Element); procedure Normalize_Access_Type (Element : Asis.Element); procedure Normalize_Formal_Access_Type (Element : Asis.Element); procedure Normalize_Attribute_Reference (Element : Asis.Element); procedure Normalize_Qualified_Expression (Element : Asis.Element); procedure Normalize_Procedure_Call (Element : Asis.Element); procedure Normalize_Pragma_Argument (Element : in out Asis.Expression); procedure Normalize_Function_Call (Element : in out Asis.Element; Control : in out Traverse_Control; State : in out State_Information); procedure Normalize_Record_Aggregate (Element : in out Asis.Element; Control : in out Traverse_Control; State : in out State_Information); procedure To_Deferred_Constant (Element : in out Asis.Element); procedure Normalize_Enumeration_Rep_Clause (Element : in out Asis.Element); procedure Set_Start_Position (Element, Source : Asis.Element); procedure Set_Enum_Positions (List : Asis.Declaration_List); procedure Create_Incomplete_Definition (Element : Asis.Declaration); ---------------------------------- -- Split_Function_Specification -- ---------------------------------- generic type Node_Type is new Element_Node with private; with function Specification (Element : Node_Type) return Asis.Element is <>; with procedure Set_Parameter_Profile (Element : in out Node_Type; Value : in Asis.Element) is <>; with procedure Set_Result_Subtype (Element : in out Node_Type; Value : in Asis.Expression) is <>; procedure Split_Function_Specification (Element : Asis.Element); ----------------------------------- -- Split_Procedure_Specification -- ----------------------------------- generic type Node_Type is new Element_Node with private; with function Specification (Element : Node_Type) return Asis.Element is <>; with procedure Set_Parameter_Profile (Element : in out Node_Type; Value : in Asis.Element) is <>; procedure Split_Procedure_Specification (Element : Asis.Element); ------------------- -- Split_Profile -- ------------------- generic type Node_Type is new Element_Node with private; with function Result_Subtype (Element : Node_Type) return Asis.Element is <>; with procedure Set_Parameter_Profile (Element : in out Node_Type; Value : in Asis.Element) is <>; with procedure Set_Result_Subtype (Element : in out Node_Type; Value : in Asis.Definition) is <>; procedure Split_Profile (Element : Asis.Element); ---------------------------------- -- Normalize_Handled_Statements -- ---------------------------------- generic type Node_Type is new Element_Node with private; with function Handled_Statements (Element : Node_Type) return Asis.Element is <>; with procedure Set_Statements (Element : in out Node_Type; Value : in Asis.Element) is <>; with procedure Set_Exception_Handlers (Element : in out Node_Type; Value : in Asis.Element) is <>; procedure Normalize_Handled_Statements (Element : Asis.Element); --------------------------- -- Check_Back_Identifier -- --------------------------- generic type Node_Type is new Element_Node with private; with function Compound_Name (Element : Node_Type) return Asis.Element is <>; with procedure Set_Is_Name_Repeated (Element : in out Node_Type; Value : in Boolean) is <>; with function Names (Element : Asis.Element) return Asis.Element_List is Asis.Declarations.Names; procedure Check_Back_Identifier (Element : Asis.Element); --------------------------------- -- Split_Package_Specification -- --------------------------------- generic type Node_Type is new Element_Node with private; with function Specification (Element : Node_Type) return Asis.Element is <>; with procedure Set_Is_Name_Repeated (Element : in out Node_Type; Value : in Boolean) is <>; with procedure Set_Is_Private_Present (Element : in out Node_Type; Value : in Boolean) is <>; with procedure Set_Visible_Part_Declarative_Items (Element : in out Node_Type; Value : in Asis.Element) is <>; with procedure Set_Private_Part_Declarative_Items (Element : in out Node_Type; Value : in Asis.Element) is <>; procedure Split_Package_Specification (Element : Asis.Element); --------------------------- -- Set_Generic_Unit_Name -- --------------------------- generic type Node_Type is new Element_Node with private; with procedure Set_Generic_Unit_Name (Element : in out Node_Type; Value : in Asis.Expression) is <>; procedure Set_Generic_Unit_Names (Element : Asis.Element); generic type Node_Type is new Element_Node with private; with procedure Set_Trait_Kind (Element : in out Node_Type; Value : in Asis.Trait_Kinds) is <>; procedure Set_Trait_Kind (Element : Asis.Element); ------------------------------ -- Normalize_Component_List -- ------------------------------ generic type Node_Type is new Element_Node with private; with function Record_Components_List (Element : Node_Type) return Asis.Element is <>; procedure Normalize_Component_List (Element : Asis.Element); --------------------- -- Set_Has_Private -- --------------------- generic type Node_Type is new Element_Node with private; with function Private_Part_Items_List (Element : Node_Type) return Asis.Element is <>; with procedure Set_Is_Private_Present (Element : in out Node_Type; Value : in Boolean) is <>; procedure Set_Has_Private (Element : Asis.Element); ---------------------- -- Set_Formal_Array -- ---------------------- generic type Node_Type is new Element_Node with private; type Array_Type is new Element_Node with private; with procedure Set_Index_Subtype_Definitions (Element : in out Node_Type; Value : in Asis.Element) is <>; with function Index_Subtype_Definitions_List (Element : Array_Type) return Asis.Element is <>; with procedure Set_Array_Component_Definition (Element : in out Node_Type; Value : in Asis.Component_Definition) is <>; with function Array_Definition (Element : Node_Type) return Asis.Element is <>; -- with function Array_Component_Definition -- (Element : Array_Type) return Asis.Element is <>; procedure Set_Formal_Array (Element : Asis.Element); ------------------------------- -- Drop_Range_Attr_Reference -- ------------------------------- generic type Node_Type is new Element_Node with private; with procedure Set_Range_Attribute (Element : in out Node_Type; Value : in Asis.Expression) is <>; procedure Drop_Range_Attr_Reference (Element : Asis.Element); generic type Node_Type is new Element_Node with private; with procedure Set_Subtype_Mark (Element : in out Node_Type; Value : in Asis.Expression) is <>; with procedure Set_Subtype_Constraint (Element : in out Node_Type; Value : in Asis.Constraint) is <>; procedure Drop_Range_Subtype_Indication (Element : Asis.Element); end Asis.Gela.Normalizer.Utils; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1763.asm
ljhsiun2/medusa
9
90020
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1763.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %rax push %rdx push %rsi lea addresses_D_ht+0x7539, %rdx nop nop cmp $57765, %rsi movw $0x6162, (%rdx) nop xor $6303, %r11 lea addresses_normal_ht+0x5d79, %r15 clflush (%r15) nop nop nop nop dec %rsi movb (%r15), %al nop nop nop nop cmp %r15, %r15 pop %rsi pop %rdx pop %rax pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %r8 push %r9 push %rax // Store lea addresses_D+0x1e539, %r8 clflush (%r8) nop xor $4653, %r9 movb $0x51, (%r8) nop nop nop nop nop dec %r8 // Faulty Load lea addresses_normal+0x1d939, %r8 nop nop nop nop add $7233, %r10 movups (%r8), %xmm5 vpextrq $0, %xmm5, %rax lea oracles, %r9 and $0xff, %rax shlq $12, %rax mov (%r9,%rax,1), %rax pop %rax pop %r9 pop %r8 pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */