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
examples/mtask.asm
Benderx2/FVM
2
97311
<filename>examples/mtask.asm ;; Simple test. Compile with FASM. ;; macros for fasm include 'a32.inc' _start: ;; Register Interrupt Handler LOAD_R0 0x01 ;; Register ISR 1 LOAD_R1 int1a ;; Load ISR Handler Address LOAD_INTERRUPT ;; Load Interrupt! ;; Task 0 Infinite Loop! SUBLEQ _data.d2, _data.d1, troll VM_DEBUG dead_end: troll: JMPF dead_end task1: LOAD_R1 'A' VM_CALL 0 JMPF task1 task2: LOAD_R1 'B' VM_CALL 0 JMPF task2 int1a: LOAD_SP 1000 ;; Load kernel stack ;; Push R0 and R1 PUSH R0 PUSH R1 ;; Load the variable which_task LOAD_R0 which_task ;; Grab the byte LOAD_BYTE ;; Is R0 = 0 (Switch to task 1) CMPR R1, 0 JMPF_E .task_1 ;; Or 1 (switch to task 1) CMPR R1, 1 JMPF_E .task_2 .task_1: ;; Set the which_task to 1 (will make the routine switch to the next task) LOAD_R0 which_task ;; Load 1 LOAD_R1 1 ;; Copy it STORE_BYTE ;; Pop off CPU Registers POP R1 POP R0 ;; Push the address / 4 (since it needs to be aligned) PUSH task1 / 4 ;; Return from interrupt IRETF .task_2: LOAD_R0 which_task LOAD_R1 0 STORE_BYTE POP R1 POP R0 PUSH task2 / 4 IRETF _end_start: _data: .d1: db 0 .d2: db 1 which_task: db 0 _end_data: _bss: _end_bss:
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1441.asm
ljhsiun2/medusa
9
177656
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1ad10, %rdi nop nop nop nop cmp $6570, %r11 vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r13 nop nop nop nop inc %r14 lea addresses_normal_ht+0xee20, %rsi lea addresses_D_ht+0xe8a0, %rdi nop cmp $60555, %r11 mov $99, %rcx rep movsq nop inc %rdi lea addresses_A_ht+0x5620, %rdi clflush (%rdi) nop sub $23424, %rax mov (%rdi), %r13w dec %rax lea addresses_D_ht+0xc298, %rsi lea addresses_normal_ht+0x93a0, %rdi nop nop nop inc %rbp mov $39, %rcx rep movsl nop nop nop nop cmp %rbp, %rbp lea addresses_WC_ht+0x151e8, %rsi nop nop nop nop sub $56882, %rbp vmovups (%rsi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %r11 nop nop nop dec %rax lea addresses_WC_ht+0x16544, %rsi lea addresses_A_ht+0x9d20, %rdi nop inc %r11 mov $43, %rcx rep movsb nop nop nop nop xor $62970, %r14 lea addresses_WT_ht+0x13abe, %r11 nop nop add $36541, %r14 movl $0x61626364, (%r11) nop nop nop nop sub %rax, %rax lea addresses_D_ht+0x1abd0, %rdi nop sub $44473, %rsi mov $0x6162636465666768, %rax movq %rax, %xmm5 vmovups %ymm5, (%rdi) nop nop nop nop nop xor $21805, %rcx lea addresses_WC_ht+0x1fa0, %rcx nop nop nop nop xor %rdi, %rdi movw $0x6162, (%rcx) nop nop nop nop sub $54258, %rbp lea addresses_WT_ht+0x11780, %rsi nop nop nop nop sub %r11, %r11 movb (%rsi), %r14b nop nop nop cmp $40288, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r8 push %rax push %rcx push %rdi push %rsi // Load lea addresses_WC+0x183ac, %r12 sub $62312, %r13 vmovups (%r12), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rax sub $16267, %r12 // REPMOV lea addresses_D+0xa9a0, %rsi lea addresses_A+0x171e8, %rdi nop nop nop nop nop xor $49932, %rax mov $98, %rcx rep movsw cmp $18447, %rcx // Faulty Load lea addresses_normal+0x12520, %rsi clflush (%rsi) sub %rdi, %rdi vmovups (%rsi), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %r13 lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_D'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 8, 'same': True, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_WT_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 */
libsrc/fcntl/newbrain/readbyte.asm
andydansby/z88dk-mk2
1
22087
; ; Grundy Newbrain Specific libraries ; ; <NAME> - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; fcntl input function ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int __LIB__ __FASTCALL__ readbyte(int handle); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: readbyte.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB readbyte LIB nb_getc .readbyte jp nb_getc
tests/issue88/1.asm
NullMember/customasm
414
245364
#subruledef reg { ax => 0x0 bx => 0x1 cx => 0x2 } #subruledef memaccess { {o: s8}(%{r: reg}) => 0x00 @ r @ o } #subruledef arg { {m: memaccess} => 0x00 @ m %{r: reg} => 0x01 @ r } #ruledef { mov {a: arg}, {a2: arg} => 0x10 @ a @ a2 } mov (%ax), %bx ; error: no match
alloy4fun_models/trainstlt/models/3/zwgmKQQYks3wNLPLn.als
Kaixi26/org.alloytools.alloy
0
2668
open main pred idzwgmKQQYks3wNLPLn_prop4 { always (all disj t1,t2:Train | t1.pos != t2.pos) } pred __repair { idzwgmKQQYks3wNLPLn_prop4 } check __repair { idzwgmKQQYks3wNLPLn_prop4 <=> prop4o }
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1616.asm
ljhsiun2/medusa
9
162707
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1616.asm .global s_prepare_buffers s_prepare_buffers: push %r13 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x13c11, %rsi lea addresses_UC_ht+0x1e9ff, %rdi nop nop nop nop nop add $15848, %r13 mov $98, %rcx rep movsb xor %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %rax push %rbp push %rbx push %rdx // Store lea addresses_WT+0x18b9f, %r12 nop nop nop nop nop add %rbp, %rbp movl $0x51525354, (%r12) cmp %rdx, %rdx // Faulty Load lea addresses_RW+0x98df, %rbp nop nop nop nop nop xor %r11, %r11 vmovups (%rbp), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 lea oracles, %rbx and $0xff, %r12 shlq $12, %r12 mov (%rbx,%r12,1), %r12 pop %rdx pop %rbx pop %rbp pop %rax pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_RW', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
tests/resources/INILexer.g4
akosthekiss/picireny
41
1063
/* * Copyright (c) 2017-2021 <NAME>, <NAME>. * * Licensed under the BSD 3-Clause License * <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. * This file may not be copied, modified, or distributed except * according to those terms. */ lexer grammar INILexer; HEADER_OPEN : '[' -> pushMode(HEADER_MODE) ; KEY : KEY_START_CHAR ( KEY_CHAR_WS* KEY_CHAR )? ; fragment KEY_START_CHAR : ~[[:=\r\n;# \t] ; fragment KEY_CHAR : KEY_START_CHAR | '[' ; fragment KEY_CHAR_WS : KEY_CHAR | WS ; EQUALS : [:=] -> pushMode(VALUE_MODE) ; WS : [ \t]+ ; EOL : '\r\n' | '\r' | '\n' ; COMMENT : COMMENT_START_CHAR ~[\r\n]* ; fragment COMMENT_START_CHAR : [;#] ; mode HEADER_MODE; HEADER : HEADER_CHAR ( HEADER_CHAR_WS* HEADER_CHAR )? ; fragment HEADER_CHAR : ~[[\]\r\n;# \t] ; fragment HEADER_CHAR_WS : HEADER_CHAR | HEADER_WS ; HEADER_CLOSE : ']' -> popMode ; HEADER_WS : [ \t]+ ; mode VALUE_MODE; VALUE : VALUE_CHAR ( VALUE_CHAR_WS* VALUE_CHAR )? -> popMode ; fragment VALUE_CHAR : ~[\r\n\t;# ] ; fragment VALUE_CHAR_WS : VALUE_CHAR | VALUE_WS ; VALUE_WS : [ \t]+ ;
oeis/298/A298802.asm
neoneye/loda-programs
11
93992
; A298802: Growth series for group with presentation < S, T : S^4 = T^4 = (S*T)^4 = 1 >. ; Submitted by <NAME> ; 1,4,10,24,56,128,294,676,1552,3564,8186,18800,43176,99160,227734,523020,1201184,2758676,6335658,14550664,33417496,76747632,176260934,404806196,929690160,2135154556,4903660570,11261895264,25864409480,59400985544,136422101046,313311125788,719559813184,1652562842916,3795325836362,8716460173304,20018486219256,45975061268320,105587717046886,242495946358980,556923529035344,1279047430896140,2937499037463354,6746349186638416,15493869706033768,35583690056098104,81722579448009686,187686549121448492 mov $1,1 lpb $0 sub $0,1 add $2,$1 add $1,$3 add $2,2 add $4,$2 add $2,$1 add $3,$4 sub $4,$3 add $3,$4 sub $3,1 lpe trn $2,1 mov $0,$2 add $0,1
arch/ARM/STM32/svd/stm32f46_79x/stm32_svd-usart.ads
rocher/Ada_Drivers_Library
192
22738
<reponame>rocher/Ada_Drivers_Library -- This spec has been automatically generated from STM32F46_79x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.USART is pragma Preelaborate; --------------- -- Registers -- --------------- -- Status register type SR_Register is record -- Read-only. Parity error PE : Boolean := False; -- Read-only. Framing error FE : Boolean := False; -- Read-only. Noise detected flag NF : Boolean := False; -- Read-only. Overrun error ORE : Boolean := False; -- Read-only. IDLE line detected IDLE : Boolean := False; -- Read data register not empty RXNE : Boolean := False; -- Transmission complete TC : Boolean := False; -- Read-only. Transmit data register empty TXE : Boolean := False; -- LIN break detection flag LBD : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#6000#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record PE at 0 range 0 .. 0; FE at 0 range 1 .. 1; NF at 0 range 2 .. 2; ORE at 0 range 3 .. 3; IDLE at 0 range 4 .. 4; RXNE at 0 range 5 .. 5; TC at 0 range 6 .. 6; TXE at 0 range 7 .. 7; LBD at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype DR_DR_Field is HAL.UInt9; -- Data register type DR_Register is record -- Data value DR : DR_DR_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DR_Register use record DR at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype BRR_DIV_Fraction_Field is HAL.UInt4; subtype BRR_DIV_Mantissa_Field is HAL.UInt12; -- Baud rate register type BRR_Register is record -- fraction of USARTDIV DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#; -- mantissa of USARTDIV DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BRR_Register use record DIV_Fraction at 0 range 0 .. 3; DIV_Mantissa at 0 range 4 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Control register 1 type CR1_Register is record -- Send break SBK : Boolean := False; -- Receiver wakeup RWU : Boolean := False; -- Receiver enable RE : Boolean := False; -- Transmitter enable TE : Boolean := False; -- IDLE interrupt enable IDLEIE : Boolean := False; -- RXNE interrupt enable RXNEIE : Boolean := False; -- Transmission complete interrupt enable TCIE : Boolean := False; -- TXE interrupt enable TXEIE : Boolean := False; -- PE interrupt enable PEIE : Boolean := False; -- Parity selection PS : Boolean := False; -- Parity control enable PCE : Boolean := False; -- Wakeup method WAKE : Boolean := False; -- Word length M : Boolean := False; -- USART enable UE : Boolean := False; -- unspecified Reserved_14_14 : HAL.Bit := 16#0#; -- Oversampling mode OVER8 : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record SBK at 0 range 0 .. 0; RWU at 0 range 1 .. 1; RE at 0 range 2 .. 2; TE at 0 range 3 .. 3; IDLEIE at 0 range 4 .. 4; RXNEIE at 0 range 5 .. 5; TCIE at 0 range 6 .. 6; TXEIE at 0 range 7 .. 7; PEIE at 0 range 8 .. 8; PS at 0 range 9 .. 9; PCE at 0 range 10 .. 10; WAKE at 0 range 11 .. 11; M at 0 range 12 .. 12; UE at 0 range 13 .. 13; Reserved_14_14 at 0 range 14 .. 14; OVER8 at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CR2_ADD_Field is HAL.UInt4; subtype CR2_STOP_Field is HAL.UInt2; -- Control register 2 type CR2_Register is record -- Address of the USART node ADD : CR2_ADD_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- lin break detection length LBDL : Boolean := False; -- LIN break detection interrupt enable LBDIE : Boolean := False; -- unspecified Reserved_7_11 : HAL.UInt5 := 16#0#; -- STOP bits STOP : CR2_STOP_Field := 16#0#; -- LIN mode enable LINEN : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record ADD at 0 range 0 .. 3; Reserved_4_4 at 0 range 4 .. 4; LBDL at 0 range 5 .. 5; LBDIE at 0 range 6 .. 6; Reserved_7_11 at 0 range 7 .. 11; STOP at 0 range 12 .. 13; LINEN at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- Control register 3 type CR3_Register is record -- Error interrupt enable EIE : Boolean := False; -- IrDA mode enable IREN : Boolean := False; -- IrDA low-power IRLP : Boolean := False; -- Half-duplex selection HDSEL : Boolean := False; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- DMA enable receiver DMAR : Boolean := False; -- DMA enable transmitter DMAT : Boolean := False; -- unspecified Reserved_8_10 : HAL.UInt3 := 16#0#; -- One sample bit method enable ONEBIT : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR3_Register use record EIE at 0 range 0 .. 0; IREN at 0 range 1 .. 1; IRLP at 0 range 2 .. 2; HDSEL at 0 range 3 .. 3; Reserved_4_5 at 0 range 4 .. 5; DMAR at 0 range 6 .. 6; DMAT at 0 range 7 .. 7; Reserved_8_10 at 0 range 8 .. 10; ONEBIT at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- Status register type SR_Register_1 is record -- Read-only. Parity error PE : Boolean := False; -- Read-only. Framing error FE : Boolean := False; -- Read-only. Noise detected flag NF : Boolean := False; -- Read-only. Overrun error ORE : Boolean := False; -- Read-only. IDLE line detected IDLE : Boolean := False; -- Read data register not empty RXNE : Boolean := False; -- Transmission complete TC : Boolean := False; -- Read-only. Transmit data register empty TXE : Boolean := False; -- LIN break detection flag LBD : Boolean := False; -- CTS flag CTS : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#3000#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register_1 use record PE at 0 range 0 .. 0; FE at 0 range 1 .. 1; NF at 0 range 2 .. 2; ORE at 0 range 3 .. 3; IDLE at 0 range 4 .. 4; RXNE at 0 range 5 .. 5; TC at 0 range 6 .. 6; TXE at 0 range 7 .. 7; LBD at 0 range 8 .. 8; CTS at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; -- Control register 2 type CR2_Register_1 is record -- Address of the USART node ADD : CR2_ADD_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- lin break detection length LBDL : Boolean := False; -- LIN break detection interrupt enable LBDIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Last bit clock pulse LBCL : Boolean := False; -- Clock phase CPHA : Boolean := False; -- Clock polarity CPOL : Boolean := False; -- Clock enable CLKEN : Boolean := False; -- STOP bits STOP : CR2_STOP_Field := 16#0#; -- LIN mode enable LINEN : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register_1 use record ADD at 0 range 0 .. 3; Reserved_4_4 at 0 range 4 .. 4; LBDL at 0 range 5 .. 5; LBDIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; LBCL at 0 range 8 .. 8; CPHA at 0 range 9 .. 9; CPOL at 0 range 10 .. 10; CLKEN at 0 range 11 .. 11; STOP at 0 range 12 .. 13; LINEN at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- Control register 3 type CR3_Register_1 is record -- Error interrupt enable EIE : Boolean := False; -- IrDA mode enable IREN : Boolean := False; -- IrDA low-power IRLP : Boolean := False; -- Half-duplex selection HDSEL : Boolean := False; -- Smartcard NACK enable NACK : Boolean := False; -- Smartcard mode enable SCEN : Boolean := False; -- DMA enable receiver DMAR : Boolean := False; -- DMA enable transmitter DMAT : Boolean := False; -- RTS enable RTSE : Boolean := False; -- CTS enable CTSE : Boolean := False; -- CTS interrupt enable CTSIE : Boolean := False; -- One sample bit method enable ONEBIT : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR3_Register_1 use record EIE at 0 range 0 .. 0; IREN at 0 range 1 .. 1; IRLP at 0 range 2 .. 2; HDSEL at 0 range 3 .. 3; NACK at 0 range 4 .. 4; SCEN at 0 range 5 .. 5; DMAR at 0 range 6 .. 6; DMAT at 0 range 7 .. 7; RTSE at 0 range 8 .. 8; CTSE at 0 range 9 .. 9; CTSIE at 0 range 10 .. 10; ONEBIT at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype GTPR_PSC_Field is HAL.UInt8; subtype GTPR_GT_Field is HAL.UInt8; -- Guard time and prescaler register type GTPR_Register is record -- Prescaler value PSC : GTPR_PSC_Field := 16#0#; -- Guard time value GT : GTPR_GT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for GTPR_Register use record PSC at 0 range 0 .. 7; GT at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Universal synchronous asynchronous receiver transmitter type UART4_Peripheral is record -- Status register SR : aliased SR_Register; -- Data register DR : aliased DR_Register; -- Baud rate register BRR : aliased BRR_Register; -- Control register 1 CR1 : aliased CR1_Register; -- Control register 2 CR2 : aliased CR2_Register; -- Control register 3 CR3 : aliased CR3_Register; end record with Volatile; for UART4_Peripheral use record SR at 16#0# range 0 .. 31; DR at 16#4# range 0 .. 31; BRR at 16#8# range 0 .. 31; CR1 at 16#C# range 0 .. 31; CR2 at 16#10# range 0 .. 31; CR3 at 16#14# range 0 .. 31; end record; -- Universal synchronous asynchronous receiver transmitter UART4_Periph : aliased UART4_Peripheral with Import, Address => System'To_Address (16#40004C00#); -- Universal synchronous asynchronous receiver transmitter UART5_Periph : aliased UART4_Peripheral with Import, Address => System'To_Address (16#40005000#); -- Universal synchronous asynchronous receiver transmitter UART7_Periph : aliased UART4_Peripheral with Import, Address => System'To_Address (16#40007800#); -- Universal synchronous asynchronous receiver transmitter UART8_Periph : aliased UART4_Peripheral with Import, Address => System'To_Address (16#40007C00#); -- Universal synchronous asynchronous receiver transmitter type USART1_Peripheral is record -- Status register SR : aliased SR_Register_1; -- Data register DR : aliased DR_Register; -- Baud rate register BRR : aliased BRR_Register; -- Control register 1 CR1 : aliased CR1_Register; -- Control register 2 CR2 : aliased CR2_Register_1; -- Control register 3 CR3 : aliased CR3_Register_1; -- Guard time and prescaler register GTPR : aliased GTPR_Register; end record with Volatile; for USART1_Peripheral use record SR at 16#0# range 0 .. 31; DR at 16#4# range 0 .. 31; BRR at 16#8# range 0 .. 31; CR1 at 16#C# range 0 .. 31; CR2 at 16#10# range 0 .. 31; CR3 at 16#14# range 0 .. 31; GTPR at 16#18# range 0 .. 31; end record; -- Universal synchronous asynchronous receiver transmitter USART1_Periph : aliased USART1_Peripheral with Import, Address => System'To_Address (16#40011000#); -- Universal synchronous asynchronous receiver transmitter USART2_Periph : aliased USART1_Peripheral with Import, Address => System'To_Address (16#40004400#); -- Universal synchronous asynchronous receiver transmitter USART3_Periph : aliased USART1_Peripheral with Import, Address => System'To_Address (16#40004800#); -- Universal synchronous asynchronous receiver transmitter USART6_Periph : aliased USART1_Peripheral with Import, Address => System'To_Address (16#40011400#); end STM32_SVD.USART;
macros/optimizations.asm
dougmasten/coco_libraries
2
162856
<reponame>dougmasten/coco_libraries ; optimizations.asm *pragmapush list ; Save state of list pragma pragma nolist ; Turn off assembly listing and exclude from symbol list ifndef MACROS_OPTIMIZE_DEFS ; Load macros only once ; space savings macros skip1 macro fcb $c5 ; actually a BITB #$xx instruction (2 clocks) endm skip2 macro fcb $8c ; actually a CMPX #$xxxx instruction (3 clocks) endm ; increment memory word by +1 inc_word macro inc \1+1 ; increment LSB bne a@ inc \1 ; increment MSB a@ equ * endm ; faster long branch instructions if branch is not taken (same cycles otherwise but with one extra byte) jcc macro bcs a@ jmp \1 a@ equ * endm jcs macro bcc a@ jmp \1 a@ equ * endm jeq macro bne a@ jmp \1 a@ equ * endm jmi macro bpl a@ jmp \1 a@ equ * endm jne macro beq a@ jmp \1 a@ equ * endm jpl macro bmi a@ jmp \1 a@ equ * endm jvc macro bvs a@ jmp \1 a@ equ * endm jvs macro bvc a@ jmp \1 a@ equ * endm ; faster push and pop of a single register using SMC (Self modifying code) ; example: ; firq ; store_a firq_reg_a ; ; misc code ; load_a firq_reg_a ; rti store_a macro sta \1 endm load_a macro lda #$ff \1 equ *-1 endm store_b macro stb \1 endm load_b macro ldb #$ff \1 equ *-1 endm store_d macro std \1 endm load_d macro ldd #$ffff \1 equ *-2 endm store_e macro ste \1 endm load_e macro lde #$ff \1 equ *-1 endm store_f macro stf \1 endm load_f macro ldf #$ff \1 equ *-1 endm store_q macro stq \1 endm load_q macro ldq #$ffffffff \1 equ *-4 endm store_u macro stu \1 endm load_u macro ldu #$ffff \1 equ *-2 endm store_w macro stw \1 endm load_w macro ldw #$ffff \1 equ *-2 endm store_x macro stx \1 endm load_x macro ldx #$ffff \1 equ *-2 endm store_y macro sty \1 endm load_y macro ldy #$ffff \1 equ *-2 endm MACROS_OPTIMIZE_DEFS equ 1 ; Set flag for macros being loaded endc *pragmapop list ; restore assembly listing to previous state
examples/outdated-and-incorrect/Warshall.agda
asr/agda-kanso
1
14425
<filename>examples/outdated-and-incorrect/Warshall.agda module Warshall (X : Set) ((≤) : X -> X -> Prop) -- and axioms... where id : {A:Set} -> A -> A id x = x (∘) : {A B C:Set} -> (B -> C) -> (A -> B) -> A -> C f ∘ g = \x -> f (g x) -- Natural numbers -------------------------------------------------------- data Nat : Set where zero : Nat suc : Nat -> Nat (+) : Nat -> Nat -> Nat zero + m = m suc n + m = suc (n + m) -- Finite sets ------------------------------------------------------------ data Zero : Set where data Suc (A:Set) : Set where fzero_ : Suc A fsuc_ : A -> Suc A mutual data Fin (n:Nat) : Set where finI : Fin_ n -> Fin n Fin_ : Nat -> Set Fin_ zero = Zero Fin_ (suc n) = Suc (Fin n) fzero : {n:Nat} -> Fin (suc n) fzero = finI fzero_ fsuc : {n:Nat} -> Fin n -> Fin (suc n) fsuc i = finI (fsuc_ i) finE : {n:Nat} -> Fin n -> Fin_ n finE (finI i) = i infixr 15 :: -- Vectors ---------------------------------------------------------------- data Nil : Set where nil_ : Nil data Cons (Xs:Set) : Set where cons_ : X -> Xs -> Cons Xs mutual data Vec (n:Nat) : Set where vecI : Vec_ n -> Vec n Vec_ : Nat -> Set Vec_ zero = Nil Vec_ (suc n) = Cons (Vec n) nil : Vec zero nil = vecI nil_ (::) : {n:Nat} -> X -> Vec n -> Vec (suc n) x :: xs = vecI (cons_ x xs) vecE : {n:Nat} -> Vec n -> Vec_ n vecE (vecI xs) = xs vec : (n:Nat) -> X -> Vec n vec zero _ = nil vec (suc n) x = x :: vec n x map : {n:Nat} -> (X -> X) -> Vec n -> Vec n map {zero} f (vecI nil_) = nil map {suc n} f (vecI (cons_ x xs)) = f x :: map f xs (!) : {n:Nat} -> Vec n -> Fin n -> X (!) {suc n} (vecI (cons_ x _ )) (finI fzero_) = x (!) {suc n} (vecI (cons_ _ xs)) (finI (fsuc_ i)) = xs ! i upd : {n:Nat} -> Fin n -> X -> Vec n -> Vec n upd {suc n} (finI fzero_) x (vecI (cons_ _ xs)) = x :: xs upd {suc n} (finI (fsuc_ i)) x (vecI (cons_ y xs)) = y :: upd i x xs tabulate : {n:Nat} -> (Fin n -> X) -> Vec n tabulate {zero} f = nil tabulate {suc n} f = f fzero :: tabulate (\x -> f (fsuc x)) postulate (===) : {n:Nat} -> Vec n -> Vec n -> Prop module Proof (F : {n:Nat} -> Vec n -> Vec n) -- and axioms... where stepF : {n:Nat} -> Fin n -> Vec n -> Vec n stepF i xs = upd i (F xs ! i) xs unsafeF' : {n:Nat} -> Nat -> Vec (suc n) -> Vec (suc n) unsafeF' zero = id unsafeF' (suc m) = unsafeF' m ∘ stepF fzero unsafeF : {n:Nat} -> Vec n -> Vec n unsafeF {zero} = id unsafeF {suc n} = unsafeF' (suc n) thm : {n:Nat} -> (xs:Vec n) -> F xs === unsafeF xs thm = ?
writeonly/main.asm
TrevCan/unOctet-computer
0
9895
; data address for PORT B IO (8 pins) PORTA = $6001 ; data address for PORT B IO (8 pins) PORTB = $6000 ; register addresses to set to either Input ; or Output DDRA = $6003 DDRB = $6002 ; literal 11111111 binary ; all outputs in IO W65C22 IOSETOUTS = $ff .org $8000 reset: nop ; set PORTB output pins ; to literal 0x50 ( 01010000 binary ) lda #%11100011 sta $5999 blink: sta PORTB jmp blink .org $fffc .word reset .word $0000
src/fot/FOTC/Data/Nat/Inequalities/EliminationPropertiesI.agda
asr/fotc
11
14017
<gh_stars>10-100 ------------------------------------------------------------------------------ -- Elimination properties for the inequalities ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Data.Nat.Inequalities.EliminationPropertiesI where open import FOTC.Base open import FOTC.Data.Nat open import FOTC.Data.Nat.Inequalities ------------------------------------------------------------------------------ 0<0→⊥ : ¬ (zero < zero) 0<0→⊥ 0<0 = t≢f (trans (sym 0<0) lt-00) S<0→⊥ : ∀ {n} → ¬ (succ₁ n < zero) S<0→⊥ {n} h = t≢f (trans (sym h) (lt-S0 n)) x<0→⊥ : ∀ {n} → N n → ¬ (n < zero) x<0→⊥ nzero 0<0 = 0<0→⊥ 0<0 x<0→⊥ (nsucc _) Sn<0 = S<0→⊥ Sn<0 x<x→⊥ : ∀ {n} → N n → ¬ (n < n) x<x→⊥ nzero 0<0 = 0<0→⊥ 0<0 x<x→⊥ (nsucc {n} Nn) Sn<Sn = ⊥-elim (x<x→⊥ Nn (trans (sym (lt-SS n n)) Sn<Sn)) 0>0→⊥ : ¬ (zero > zero) 0>0→⊥ 0>0 = t≢f (trans (sym 0>0) lt-00) 0>S→⊥ : ∀ {n} → ¬ (zero > succ₁ n) 0>S→⊥ {n} h = t≢f (trans (sym h) (lt-S0 n)) 0>x→⊥ : ∀ {n} → N n → ¬ (zero > n) 0>x→⊥ nzero 0>0 = 0>0→⊥ 0>0 0>x→⊥ (nsucc _) 0>Sn = 0>S→⊥ 0>Sn x>x→⊥ : ∀ {n} → N n → ¬ (n > n) x>x→⊥ Nn = x<x→⊥ Nn S≤0→⊥ : ∀ {n} → N n → ¬ (succ₁ n ≤ zero) S≤0→⊥ nzero S0≤0 = t≢f (trans (sym S0≤0) (trans (lt-SS zero zero) lt-00)) S≤0→⊥ (nsucc {n} _) SSn≤0 = t≢f (trans (sym SSn≤0) (trans (lt-SS (succ₁ n) zero) (lt-S0 n))) 0≥S→⊥ : ∀ {n} → N n → ¬ (zero ≥ succ₁ n) 0≥S→⊥ Nn 0≥Sn = S≤0→⊥ Nn 0≥Sn x<y→y<x→⊥ : ∀ {m n} → N m → N n → m < n → ¬ (n < m) x<y→y<x→⊥ nzero Nn 0<n n<0 = ⊥-elim (0>x→⊥ Nn n<0) x<y→y<x→⊥ (nsucc Nm) nzero Sm<0 0<Sm = ⊥-elim (0>x→⊥ (nsucc Nm) Sm<0) x<y→y<x→⊥ (nsucc {m} Nm) (nsucc {n} Nn) Sm<Sn Sn<Sm = x<y→y<x→⊥ Nm Nn (trans (sym (lt-SS m n)) Sm<Sn) (trans (sym (lt-SS n m)) Sn<Sm) S≯0→⊥ : ∀ {n} → ¬ (succ₁ n ≯ zero) S≯0→⊥ {n} h = ⊥-elim (t≢f (trans (sym (lt-0S n)) h))
LearnAssembly/chap5/test.asm
wisemountain/wise.learn
3
10972
segment .data a dq 175 b dq 4097 segment .text global _start _start: mov rax, [a] ; mov a into rax add rax, [b] ; add b to rax xor rax, rax mov rax, 60 mov rdi, 0 syscall
awa/plugins/awa-comments/src/awa-comments-beans.adb
fuzzysloth/ada-awa
81
15817
----------------------------------------------------------------------- -- awa-comments-beans -- Beans for the comments module -- Copyright (C) 2014, 2015, 2016, 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Sessions.Entities; with ADO.Queries; with ADO.Utils; with ADO.Parameters; with AWA.Helpers.Requests; package body AWA.Comments.Beans is use Ada.Strings.Unbounded; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Comment_Bean; Name : in String) return Util.Beans.Objects.Object is begin if From.Is_Null then return Util.Beans.Objects.Null_Object; else return AWA.Comments.Models.Comment_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Comment_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "entity_type" then From.Entity_Type := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "entity_id" then declare use type ADO.Identifier; Id : constant ADO.Identifier := ADO.Utils.To_Identifier (Value); begin if Id /= ADO.NO_IDENTIFIER then From.Set_Entity_Id (ADO.Utils.To_Identifier (Value)); end if; end; elsif Name = "permission" then From.Permission := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "id" and not Util.Beans.Objects.Is_Empty (Value) then declare Id : constant ADO.Identifier := ADO.Utils.To_Identifier (Value); begin From.Module.Load_Comment (From, Id); end; else AWA.Comments.Models.Comment_Bean (From).Set_Value (Name, Value); end if; end Set_Value; -- ------------------------------ -- Create the comment. -- ------------------------------ overriding procedure Create (Bean : in out Comment_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Module.Create_Comment (Permission => To_String (Bean.Permission), Entity_Type => To_String (Bean.Entity_Type), Comment => Bean); end Create; -- ------------------------------ -- Save the comment. -- ------------------------------ overriding procedure Save (Bean : in out Comment_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Module.Update_Comment (Permission => To_String (Bean.Permission), Comment => Bean); end Save; -- ------------------------------ -- Publish or not the comment. -- ------------------------------ overriding procedure Publish (Bean : in out Comment_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); Id : constant ADO.Identifier := Helpers.Requests.Get_Parameter ("id"); Value : constant Util.Beans.Objects.Object := Helpers.Requests.Get_Parameter ("status"); begin Bean.Module.Publish_Comment (Permission => To_String (Bean.Permission), Id => Id, Status => Models.Status_Type_Objects.To_Value (Value), Comment => Bean); end Publish; -- ------------------------------ -- Delete the comment. -- ------------------------------ overriding procedure Delete (Bean : in out Comment_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Module.Delete_Comment (Ada.Strings.Unbounded.To_String (Bean.Permission), Bean); end Delete; -- ------------------------------ -- Create a new comment bean instance. -- ------------------------------ function Create_Comment_Bean (Module : in AWA.Comments.Modules.Comment_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Result : constant Comment_Bean_Access := new Comment_Bean; begin Result.Module := Module; return Result.all'Access; end Create_Comment_Bean; -- ------------------------------ -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. -- ------------------------------ overriding procedure Set_Value (From : in out Comment_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "entity_type" then From.Entity_Type := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "permission" then From.Permission := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "entity_id" then From.Load_Comments (ADO.Utils.To_Identifier (Value)); elsif Name = "sort" then if Util.Beans.Objects.To_String (Value) = "oldest" then From.Oldest_First := True; else From.Oldest_First := False; end if; elsif Name = "status" then if Util.Beans.Objects.To_String (Value) = "published" then From.Publish_Only := True; else From.Publish_Only := False; end if; end if; end Set_Value; -- ------------------------------ -- Set the entity type (database table) with which the comments are associated. -- ------------------------------ procedure Set_Entity_Type (Into : in out Comment_List_Bean; Table : in ADO.Schemas.Class_Mapping_Access) is begin Into.Entity_Type := Ada.Strings.Unbounded.To_Unbounded_String (Table.Table.all); end Set_Entity_Type; -- ------------------------------ -- Set the permission to check before removing or adding a comment on the entity. -- ------------------------------ procedure Set_Permission (Into : in out Comment_List_Bean; Permission : in String) is begin Into.Permission := Ada.Strings.Unbounded.To_Unbounded_String (Permission); end Set_Permission; -- ------------------------------ -- Load the comments associated with the given database identifier. -- ------------------------------ procedure Load_Comments (Into : in out Comment_List_Bean; For_Entity_Id : in ADO.Identifier) is Session : ADO.Sessions.Session := Into.Module.Get_Session; begin Into.Load_Comments (Session, For_Entity_Id); end Load_Comments; -- ------------------------------ -- Load the comments associated with the given database identifier. -- ------------------------------ procedure Load_Comments (Into : in out Comment_List_Bean; Session : in out ADO.Sessions.Session; For_Entity_Id : in ADO.Identifier) is use ADO.Sessions.Entities; Entity_Type : constant String := Ada.Strings.Unbounded.To_String (Into.Entity_Type); Kind : constant ADO.Entity_Type := Find_Entity_Type (Session, Entity_Type); Query : ADO.Queries.Context; begin Into.Entity_Id := For_Entity_Id; if Into.Publish_Only then Query.Set_Query (AWA.Comments.Models.Query_Comment_List); Query.Bind_Param ("status", Integer (Models.Status_Type'Pos (Models.COMMENT_PUBLISHED))); else Query.Set_Query (AWA.Comments.Models.Query_All_Comment_List); end if; Query.Bind_Param ("entity_type", Kind); Query.Bind_Param ("entity_id", For_Entity_Id); if Into.Oldest_First then Query.Bind_Param ("sort", ADO.Parameters.Token '("ASC")); else Query.Bind_Param ("sort", ADO.Parameters.Token '("DESC")); end if; AWA.Comments.Models.List (Into, Session, Query); end Load_Comments; -- ------------------------------ -- Create the comment list bean instance. -- ------------------------------ function Create_Comment_List_Bean (Module : in AWA.Comments.Modules.Comment_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Result : constant Comment_List_Bean_Access := new Comment_List_Bean; begin Result.Module := Module; return Result.all'Access; end Create_Comment_List_Bean; end AWA.Comments.Beans;
alloy4fun_models/trashltl/models/7/whJKWtjtw2wNQNLiD.als
Kaixi26/org.alloytools.alloy
0
1134
open main pred idwhJKWtjtw2wNQNLiD_prop8 { always (all f : File | some f.link implies (eventually f.link in Trash)) } pred __repair { idwhJKWtjtw2wNQNLiD_prop8 } check __repair { idwhJKWtjtw2wNQNLiD_prop8 <=> prop8o }
src/world.asm
AmFobes/MineAssemble
479
161584
; ; This file contains all functions related to the state of the world ; [bits 32] %include "constants.asm" global init_world, set_block, get_block global world, worldSX, worldSY, worldSZ global sunDir extern init_player, set_pos, set_view extern zero, playerHeight section .data ; World block dimensions worldSX dd WORLD_SX worldSY dd WORLD_SY worldSZ dd WORLD_SZ halfWorldSX dd WORLD_SX / 2 halfWorldSY dd WORLD_SY / 2 halfWorldSZ dd WORLD_SZ / 2 ; Sun shadows sunDir dd SUN_DIR_X, SUN_DIR_Y, SUN_DIR_Z section .bss ; World block array (1 byte per block) world resb WORLD_SX * WORLD_SY * WORLD_SZ world_end: section .text ; void init_world() ; Initialize default world blocks (flat grass) init_world: push edi push ebx ; First initialize everything to 0 mov eax, world .empty_world: mov byte [eax], BLOCK_AIR inc eax cmp eax, world_end jne .empty_world ; Now fill bottom half with dirt ; Loop over x, y, z and set to BLOCK_DIRT ; Stop when y is at WORLD_SY / 2 mov eax, 0 mov ebx, 0 mov ecx, 0 .fill_x: .fill_y: .fill_z: ; Caller saved (only eax is used in set_block) push eax ; Set block value push dword BLOCK_DIRT push ecx push ebx push eax call set_block add esp, 16 pop eax inc ecx cmp ecx, WORLD_SZ jne .fill_z mov ecx, 0 ; Reset inner z iterator inc ebx cmp ebx, WORLD_SY / 2 jne .fill_y mov ebx, 0 ; Reset inner y iterator inc eax cmp eax, WORLD_SX jne .fill_x ; Set initial player position sub esp, 12 fild dword [halfWorldSX] fstp dword [esp + 0] ; x (worldSX / 2) fild dword [halfWorldSY] fld dword [playerHeight] fadd fstp dword [esp + 4] ; y (worldSY / 2 + 1.8) fild dword [halfWorldSZ] fstp dword [esp + 8] ; z (worldSZ / 2) call set_pos add esp, 12 ; And initial view sub esp, 8 fldz fst dword [esp + 0] ; pitch (0) fstp dword [esp + 4] ; yaw (0) call set_view add esp, 8 pop ebx pop edi ret ; byte get_block(int x, int y, int z) ; Get block value given x, y and z coordinates get_block: ; Compute index (x * worldSY * worldSZ + y * worldSZ + z) ; worldSZ can be factorized out to produce: ; (x * worldSY + y) * worldSZ + z mov eax, [esp + 4] ; x mul dword [worldSY] add eax, [esp + 8] ; y mul dword [worldSZ] add eax, [esp + 12] ; z ; Retrieve from world array; ; The other 3 bytes of eax are also zero'd movzx eax, byte [eax + world] ret ; void set_block(int x, int y, int z, byte type) ; Set block value given x, y, z and type parameters set_block: ; Compute index (x * worldSY * worldSZ + y * worldSZ + z) ; worldSZ can be factorized out to produce: ; (x * worldSY + y) * worldSZ + z mov eax, [esp + 4] ; x mul dword [worldSY] add eax, [esp + 8] ; y mul dword [worldSZ] add eax, [esp + 12] ; z ; Assign to world array mov edx, [esp + 16] ; type (can't mov from memory -> memory) mov byte [eax + world], dl ret
test/epic/tests/Forcing2.agda
larrytheliquid/agda
0
1770
<reponame>larrytheliquid/agda module tests.Forcing2 where open import Prelude.Nat open import Prelude.IO open import Prelude.Unit data _**_ (A B : Set) : Set where _,_ : A -> B -> A ** B data P {A B : Set} : A ** B -> Set where _,_ : (x : A)(y : B) -> P (x , y) data Q {A : Set} : A ** A -> Set where [_] : (x : A) -> Q (x , x) test1 : (p : Nat ** Nat) -> P p -> Nat test1 .(x , y) (x , y) = x + y test2 : (q : Nat ** Nat) -> Q q -> Nat test2 .(x , x) [ x ] = ((S (S Z)) * x) + 1 test3 : (q : (Nat ** Nat) ** (Nat ** Nat)) -> Q q -> Nat test3 .((Z , Z) , (Z , Z)) [ Z , Z ] = Z test3 .((S n , m) , (S n , m)) [ S n , m ] = S n + m test3 .((Z , m) , (Z , m)) [ Z , m ] = m main : IO Unit main = printNat (test1 (5 , 8) (5 , 8)) ,, printNat (test2 (1 , 1) [ 1 ]) ,, printNat (test3 ( (3 , 4) , (3 , 4) ) [ 3 , 4 ]) ,, return unit
programs/oeis/264/A264447.asm
neoneye/loda
22
242637
; A264447: a(n) = n*(n + 7)*(n + 14)*(n + 21)/24. ; 0,110,276,510,825,1235,1755,2401,3190,4140,5270,6600,8151,9945,12005,14355,17020,20026,23400,27170,31365,36015,41151,46805,53010,59800,67210,75276,84035,93525,103785,114855,126776,139590,153340,168070,183825,200651,218595,237705,258030 mov $2,$0 mov $5,$0 mov $8,$0 mov $9,$0 bin $0,4 add $0,$8 add $0,$8 mov $7,8 add $7,$0 add $7,2 add $8,$5 add $8,$5 mov $6,$8 lpb $0 mov $0,0 add $2,7 pow $6,2 sub $7,$2 mov $3,$7 lpe add $3,$6 add $3,1 mov $1,$3 trn $1,4 mov $4,$9 mul $4,85 add $1,$4 mov $10,$9 mul $10,$9 mov $4,$10 mul $4,13 add $1,$4 mul $10,$9 mov $4,$10 mul $4,2 add $1,$4 mov $0,$1
alloy4fun_models/trashltl/models/5/2u3JjLAqANNhYCr6j.als
Kaixi26/org.alloytools.alloy
0
252
<reponame>Kaixi26/org.alloytools.alloy open main pred id2u3JjLAqANNhYCr6j_prop6 { all f:File | f in Trash implies (always f in Trash) } pred __repair { id2u3JjLAqANNhYCr6j_prop6 } check __repair { id2u3JjLAqANNhYCr6j_prop6 <=> prop6o }
win32/VC10/Win32/libxml2_Release/error.asm
txwizard/libxml2_x64_and_ARM
0
7267
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27027.1 TITLE C:\Users\DAG\Documents\_Clients\CodeProject Authors Group\Windows on ARM\libxml2\libxml2-2.9.9\error.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRT INCLUDELIB OLDNAMES _DATA SEGMENT COMM _xmlMalloc:DWORD COMM _xmlMallocAtomic:DWORD COMM _xmlRealloc:DWORD COMM _xmlFree:DWORD COMM _xmlMemStrdup:DWORD COMM _forbiddenExp:DWORD COMM _emptyExp:DWORD _DATA ENDS msvcjmc SEGMENT __188180DA_corecrt_math@h DB 01H __2CC6E67D_corecrt_stdio_config@h DB 01H __05476D76_corecrt_wstdio@h DB 01H __A452D4A0_stdio@h DB 01H __4384A2D9_corecrt_memcpy_s@h DB 01H __4E51A221_corecrt_wstring@h DB 01H __2140C079_string@h DB 01H __67926DEE_error@c DB 01H msvcjmc ENDS PUBLIC ___local_stdio_printf_options PUBLIC _fprintf PUBLIC _xmlSetGenericErrorFunc PUBLIC _initGenericErrorDefaultFunc PUBLIC _xmlSetStructuredErrorFunc PUBLIC _xmlParserError PUBLIC _xmlParserWarning PUBLIC _xmlParserValidityError PUBLIC _xmlParserValidityWarning PUBLIC _xmlParserPrintFileInfo PUBLIC _xmlParserPrintFileContext PUBLIC _xmlGetLastError PUBLIC _xmlResetLastError PUBLIC _xmlCtxtGetLastError PUBLIC _xmlCtxtResetLastError PUBLIC _xmlResetError PUBLIC _xmlCopyError PUBLIC ___xmlRaiseError PUBLIC ___xmlSimpleError PUBLIC _xmlGenericErrorDefaultFunc PUBLIC __JustMyCode_Default PUBLIC ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ ; `string' PUBLIC ??_C@_0BC@FMCMLLAH@Entity?3?5line?5?$CFd?3?5@ ; `string' PUBLIC ??_C@_03OFAPEBGM@?$CFs?6@ ; `string' PUBLIC ??_C@_0N@MLFICIIN@element?5?$CFs?3?5@ ; `string' PUBLIC ??_C@_07CNNNFPCP@parser?5@ ; `string' PUBLIC ??_C@_0L@BNCDLIEB@namespace?5@ ; `string' PUBLIC ??_C@_09BIOOFDLF@validity?5@ ; `string' PUBLIC ??_C@_0N@IENDNEBE@HTML?5parser?5@ ; `string' PUBLIC ??_C@_07KICHBFMM@memory?5@ ; `string' PUBLIC ??_C@_07NOLKHGJF@output?5@ ; `string' PUBLIC ??_C@_04HKCNGDON@I?1O?5@ ; `string' PUBLIC ??_C@_09JKGAONDL@XInclude?5@ ; `string' PUBLIC ??_C@_06ONGIFIKK@XPath?5@ ; `string' PUBLIC ??_C@_07IGPLNGGH@regexp?5@ ; `string' PUBLIC ??_C@_07KEPCOONB@module?5@ ; `string' PUBLIC ??_C@_0BC@MEEJMAME@Schemas?5validity?5@ ; `string' PUBLIC ??_C@_0BA@COGPIGL@Schemas?5parser?5@ ; `string' PUBLIC ??_C@_0BB@FGPKBGBA@Relax?9NG?5parser?5@ ; `string' PUBLIC ??_C@_0BD@EPDAPLJK@Relax?9NG?5validity?5@ ; `string' PUBLIC ??_C@_08NOLMNIGP@Catalog?5@ ; `string' PUBLIC ??_C@_05MLHJFMDG@C14N?5@ ; `string' PUBLIC ??_C@_05POKACEJG@XSLT?5@ ; `string' PUBLIC ??_C@_09JICCLIJI@encoding?5@ ; `string' PUBLIC ??_C@_0M@LAKDBFM@schematron?5@ ; `string' PUBLIC ??_C@_0BB@FACNAIAH@internal?5buffer?5@ ; `string' PUBLIC ??_C@_04ECOFBNJN@URI?5@ ; `string' PUBLIC ??_C@_02LMMGGCAJ@?3?5@ ; `string' PUBLIC ??_C@_0L@HNPIBIGM@warning?5?3?5@ ; `string' PUBLIC ??_C@_08PMHKJNKP@error?5?3?5@ ; `string' PUBLIC ??_C@_02DKCKIIND@?$CFs@ ; `string' PUBLIC ??_C@_0BE@LHHHBFLE@out?5of?5memory?5error@ ; `string' PUBLIC ??_C@_08JJLLLDHF@?$CFs?3?$CFd?3?5?6@ ; `string' PUBLIC ??_C@_0BD@GENHFBJC@Entity?3?5line?5?$CFd?3?5?6@ ; `string' PUBLIC ??_C@_0BK@ONMNHCCC@No?5error?5message?5provided@ ; `string' PUBLIC ??_C@_04CMBCJJJD@href@ ; `string' PUBLIC ??_C@_0BP@DJFHNAOK@Memory?5allocation?5failed?5?3?5?$CFs?6@ ; `string' PUBLIC ??_C@_0BK@GDFDKGPJ@Memory?5allocation?5failed?6@ ; `string' PUBLIC ??_C@_07FJOHCPOO@error?3?5@ ; `string' PUBLIC ??_C@_01EEMJAFIK@?6@ ; `string' PUBLIC ??_C@_09GFHECBDK@warning?3?5@ ; `string' PUBLIC ??_C@_0BB@DJCEBDOI@validity?5error?3?5@ ; `string' PUBLIC ??_C@_0BD@BMEBJKPI@validity?5warning?3?5@ ; `string' EXTRN _xmlStrdup:PROC EXTRN _xmlStrlen:PROC EXTRN __imp____acrt_iob_func:PROC EXTRN __imp____stdio_common_vfprintf:PROC EXTRN __imp____stdio_common_vsprintf:PROC EXTRN _xmlGetLineNo:PROC EXTRN _xmlGetProp:PROC EXTRN ___xmlLastError:PROC EXTRN ___xmlGenericError:PROC EXTRN ___xmlStructuredError:PROC EXTRN ___xmlGenericErrorContext:PROC EXTRN ___xmlStructuredErrorContext:PROC EXTRN ___xmlGetWarningsDefaultValue:PROC EXTRN @__CheckForDebuggerJustMyCode@4:PROC EXTRN _memset:PROC _DATA SEGMENT COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage _DATA ENDS _BSS SEGMENT ?had_info@?1??xmlParserValidityError@@9@9 DD 01H DUP (?) ; `xmlParserValidityError'::`2'::had_info _BSS ENDS ; COMDAT ??_C@_0BD@BMEBJKPI@validity?5warning?3?5@ CONST SEGMENT ??_C@_0BD@BMEBJKPI@validity?5warning?3?5@ DB 'validity warning: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BB@DJCEBDOI@validity?5error?3?5@ CONST SEGMENT ??_C@_0BB@DJCEBDOI@validity?5error?3?5@ DB 'validity error: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_09GFHECBDK@warning?3?5@ CONST SEGMENT ??_C@_09GFHECBDK@warning?3?5@ DB 'warning: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_01EEMJAFIK@?6@ CONST SEGMENT ??_C@_01EEMJAFIK@?6@ DB 0aH, 00H ; `string' CONST ENDS ; COMDAT ??_C@_07FJOHCPOO@error?3?5@ CONST SEGMENT ??_C@_07FJOHCPOO@error?3?5@ DB 'error: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BK@GDFDKGPJ@Memory?5allocation?5failed?6@ CONST SEGMENT ??_C@_0BK@GDFDKGPJ@Memory?5allocation?5failed?6@ DB 'Memory allocation fa' DB 'iled', 0aH, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BP@DJFHNAOK@Memory?5allocation?5failed?5?3?5?$CFs?6@ CONST SEGMENT ??_C@_0BP@DJFHNAOK@Memory?5allocation?5failed?5?3?5?$CFs?6@ DB 'Memory al' DB 'location failed : %s', 0aH, 00H ; `string' CONST ENDS ; COMDAT ??_C@_04CMBCJJJD@href@ CONST SEGMENT ??_C@_04CMBCJJJD@href@ DB 'href', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BK@ONMNHCCC@No?5error?5message?5provided@ CONST SEGMENT ??_C@_0BK@ONMNHCCC@No?5error?5message?5provided@ DB 'No error message pro' DB 'vided', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BD@GENHFBJC@Entity?3?5line?5?$CFd?3?5?6@ CONST SEGMENT ??_C@_0BD@GENHFBJC@Entity?3?5line?5?$CFd?3?5?6@ DB 'Entity: line %d: ', 0aH DB 00H ; `string' CONST ENDS ; COMDAT ??_C@_08JJLLLDHF@?$CFs?3?$CFd?3?5?6@ CONST SEGMENT ??_C@_08JJLLLDHF@?$CFs?3?$CFd?3?5?6@ DB '%s:%d: ', 0aH, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BE@LHHHBFLE@out?5of?5memory?5error@ CONST SEGMENT ??_C@_0BE@LHHHBFLE@out?5of?5memory?5error@ DB 'out of memory error', 00H ; `string' CONST ENDS ; COMDAT ??_C@_02DKCKIIND@?$CFs@ CONST SEGMENT ??_C@_02DKCKIIND@?$CFs@ DB '%s', 00H ; `string' CONST ENDS ; COMDAT ??_C@_08PMHKJNKP@error?5?3?5@ CONST SEGMENT ??_C@_08PMHKJNKP@error?5?3?5@ DB 'error : ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0L@HNPIBIGM@warning?5?3?5@ CONST SEGMENT ??_C@_0L@HNPIBIGM@warning?5?3?5@ DB 'warning : ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_02LMMGGCAJ@?3?5@ CONST SEGMENT ??_C@_02LMMGGCAJ@?3?5@ DB ': ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_04ECOFBNJN@URI?5@ CONST SEGMENT ??_C@_04ECOFBNJN@URI?5@ DB 'URI ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BB@FACNAIAH@internal?5buffer?5@ CONST SEGMENT ??_C@_0BB@FACNAIAH@internal?5buffer?5@ DB 'internal buffer ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0M@LAKDBFM@schematron?5@ CONST SEGMENT ??_C@_0M@LAKDBFM@schematron?5@ DB 'schematron ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_09JICCLIJI@encoding?5@ CONST SEGMENT ??_C@_09JICCLIJI@encoding?5@ DB 'encoding ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_05POKACEJG@XSLT?5@ CONST SEGMENT ??_C@_05POKACEJG@XSLT?5@ DB 'XSLT ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_05MLHJFMDG@C14N?5@ CONST SEGMENT ??_C@_05MLHJFMDG@C14N?5@ DB 'C14N ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_08NOLMNIGP@Catalog?5@ CONST SEGMENT ??_C@_08NOLMNIGP@Catalog?5@ DB 'Catalog ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BD@EPDAPLJK@Relax?9NG?5validity?5@ CONST SEGMENT ??_C@_0BD@EPDAPLJK@Relax?9NG?5validity?5@ DB 'Relax-NG validity ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BB@FGPKBGBA@Relax?9NG?5parser?5@ CONST SEGMENT ??_C@_0BB@FGPKBGBA@Relax?9NG?5parser?5@ DB 'Relax-NG parser ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BA@COGPIGL@Schemas?5parser?5@ CONST SEGMENT ??_C@_0BA@COGPIGL@Schemas?5parser?5@ DB 'Schemas parser ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BC@MEEJMAME@Schemas?5validity?5@ CONST SEGMENT ??_C@_0BC@MEEJMAME@Schemas?5validity?5@ DB 'Schemas validity ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07KEPCOONB@module?5@ CONST SEGMENT ??_C@_07KEPCOONB@module?5@ DB 'module ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07IGPLNGGH@regexp?5@ CONST SEGMENT ??_C@_07IGPLNGGH@regexp?5@ DB 'regexp ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_06ONGIFIKK@XPath?5@ CONST SEGMENT ??_C@_06ONGIFIKK@XPath?5@ DB 'XPath ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_09JKGAONDL@XInclude?5@ CONST SEGMENT ??_C@_09JKGAONDL@XInclude?5@ DB 'XInclude ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_04HKCNGDON@I?1O?5@ CONST SEGMENT ??_C@_04HKCNGDON@I?1O?5@ DB 'I/O ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07NOLKHGJF@output?5@ CONST SEGMENT ??_C@_07NOLKHGJF@output?5@ DB 'output ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07KICHBFMM@memory?5@ CONST SEGMENT ??_C@_07KICHBFMM@memory?5@ DB 'memory ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0N@IENDNEBE@HTML?5parser?5@ CONST SEGMENT ??_C@_0N@IENDNEBE@HTML?5parser?5@ DB 'HTML parser ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_09BIOOFDLF@validity?5@ CONST SEGMENT ??_C@_09BIOOFDLF@validity?5@ DB 'validity ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0L@BNCDLIEB@namespace?5@ CONST SEGMENT ??_C@_0L@BNCDLIEB@namespace?5@ DB 'namespace ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07CNNNFPCP@parser?5@ CONST SEGMENT ??_C@_07CNNNFPCP@parser?5@ DB 'parser ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0N@MLFICIIN@element?5?$CFs?3?5@ CONST SEGMENT ??_C@_0N@MLFICIIN@element?5?$CFs?3?5@ DB 'element %s: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_03OFAPEBGM@?$CFs?6@ CONST SEGMENT ??_C@_03OFAPEBGM@?$CFs?6@ DB '%s', 0aH, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BC@FMCMLLAH@Entity?3?5line?5?$CFd?3?5@ CONST SEGMENT ??_C@_0BC@FMCMLLAH@Entity?3?5line?5?$CFd?3?5@ DB 'Entity: line %d: ', 00H ; `string' CONST ENDS ; COMDAT ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ CONST SEGMENT ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ DB '%s:%d: ', 00H ; `string' CONST ENDS ; Function compile flags: /Odt ; COMDAT __JustMyCode_Default _TEXT SEGMENT __JustMyCode_Default PROC ; COMDAT push ebp mov ebp, esp pop ebp ret 0 __JustMyCode_Default ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlReportError _TEXT SEGMENT _buf$1 = -172 ; size = 150 _level$1$ = -20 ; size = 4 _cur$1$ = -16 ; size = 4 _input$1$ = -12 ; size = 4 _domain$1$ = -8 ; size = 4 _line$1$ = -4 ; size = 4 _err$ = 8 ; size = 4 _ctxt$ = 12 ; size = 4 _str$ = 16 ; size = 4 _channel$ = 20 ; size = 4 _data$ = 24 ; size = 4 _xmlReportError PROC ; COMDAT ; 247 : { push ebp mov ebp, esp sub esp, 172 ; 000000acH push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov edi, DWORD PTR _err$[ebp] xor edx, edx mov DWORD PTR _input$1$[ebp], 0 mov DWORD PTR _cur$1$[ebp], edx test edi, edi je $LN62@xmlReportE ; 248 : char *file = NULL; ; 249 : int line = 0; ; 250 : int code = -1; ; 251 : int domain; ; 252 : const xmlChar *name = NULL; ; 253 : xmlNodePtr node; ; 254 : xmlErrorLevel level; ; 255 : xmlParserInputPtr input = NULL; ; 256 : xmlParserInputPtr cur = NULL; ; 257 : ; 258 : if (err == NULL) ; 259 : return; ; 260 : ; 261 : if (channel == NULL) { push ebx push esi mov esi, DWORD PTR _channel$[ebp] test esi, esi jne SHORT $LN68@xmlReportE ; 262 : channel = xmlGenericError; call ___xmlGenericError mov esi, DWORD PTR [eax] ; 263 : data = xmlGenericErrorContext; call ___xmlGenericErrorContext mov ebx, DWORD PTR [eax] jmp SHORT $LN10@xmlReportE $LN68@xmlReportE: ; 248 : char *file = NULL; ; 249 : int line = 0; ; 250 : int code = -1; ; 251 : int domain; ; 252 : const xmlChar *name = NULL; ; 253 : xmlNodePtr node; ; 254 : xmlErrorLevel level; ; 255 : xmlParserInputPtr input = NULL; ; 256 : xmlParserInputPtr cur = NULL; ; 257 : ; 258 : if (err == NULL) ; 259 : return; ; 260 : ; 261 : if (channel == NULL) { mov ebx, DWORD PTR _data$[ebp] $LN10@xmlReportE: ; 264 : } ; 265 : file = err->file; ; 266 : line = err->line; ; 267 : code = err->code; ; 268 : domain = err->domain; ; 269 : level = err->level; ; 270 : node = err->node; ; 271 : ; 272 : if (code == XML_ERR_OK) cmp DWORD PTR [edi+4], 0 mov eax, DWORD PTR [edi+20] mov ecx, DWORD PTR [edi+12] mov edx, DWORD PTR [edi+16] mov DWORD PTR _line$1$[ebp], eax mov eax, DWORD PTR [edi] mov DWORD PTR _domain$1$[ebp], eax mov DWORD PTR _level$1$[ebp], ecx je $LN71@xmlReportE ; 273 : return; ; 274 : ; 275 : if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) mov ecx, DWORD PTR [edi+48] test ecx, ecx je SHORT $LN70@xmlReportE cmp DWORD PTR [ecx+4], 1 jne SHORT $LN70@xmlReportE ; 276 : name = node->name; mov edi, DWORD PTR [ecx+8] jmp SHORT $LN12@xmlReportE $LN70@xmlReportE: ; 277 : ; 278 : /* ; 279 : * Maintain the compatibility with the legacy error handling ; 280 : */ ; 281 : if (ctxt != NULL) { xor edi, edi $LN12@xmlReportE: mov ecx, DWORD PTR _ctxt$[ebp] test ecx, ecx je SHORT $LN13@xmlReportE ; 282 : input = ctxt->input; mov edx, DWORD PTR [ecx+36] mov DWORD PTR _input$1$[ebp], edx ; 283 : if ((input != NULL) && (input->filename == NULL) && test edx, edx je $LN22@xmlReportE cmp DWORD PTR [edx+4], 0 jne SHORT $LN15@xmlReportE mov ecx, DWORD PTR [ecx+40] cmp ecx, 1 jle SHORT $LN15@xmlReportE ; 284 : (ctxt->inputNr > 1)) { ; 285 : cur = input; ; 286 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR _ctxt$[ebp] mov DWORD PTR _cur$1$[ebp], edx mov eax, DWORD PTR [eax+48] mov edx, DWORD PTR [eax+ecx*4-8] mov eax, DWORD PTR _domain$1$[ebp] mov DWORD PTR _input$1$[ebp], edx $LN15@xmlReportE: ; 287 : } ; 288 : if (input != NULL) { test edx, edx je SHORT $LN22@xmlReportE ; 289 : if (input->filename) mov ecx, DWORD PTR [edx+4] test ecx, ecx je SHORT $LN17@xmlReportE ; 290 : channel(data, "%s:%d: ", input->filename, input->line); push DWORD PTR [edx+28] push ecx push OFFSET ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ push ebx call esi add esp, 16 ; 00000010H jmp SHORT $LN22@xmlReportE $LN17@xmlReportE: ; 291 : else if ((line != 0) && (domain == XML_FROM_PARSER)) cmp DWORD PTR _line$1$[ebp], 0 je SHORT $LN22@xmlReportE cmp eax, 1 jne SHORT $LN22@xmlReportE ; 292 : channel(data, "Entity: line %d: ", input->line); push DWORD PTR [edx+28] ; 293 : } ; 294 : } else { jmp SHORT $LN73@xmlReportE $LN13@xmlReportE: ; 295 : if (file != NULL) test edx, edx je SHORT $LN20@xmlReportE ; 296 : channel(data, "%s:%d: ", file, line); push DWORD PTR _line$1$[ebp] push edx push OFFSET ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ push ebx call esi add esp, 16 ; 00000010H jmp SHORT $LN22@xmlReportE $LN20@xmlReportE: ; 297 : else if ((line != 0) && mov ecx, DWORD PTR _line$1$[ebp] test ecx, ecx je SHORT $LN22@xmlReportE cmp eax, 1 je SHORT $LN23@xmlReportE cmp eax, 17 ; 00000011H je SHORT $LN23@xmlReportE cmp eax, 16 ; 00000010H je SHORT $LN23@xmlReportE cmp eax, 4 je SHORT $LN23@xmlReportE cmp eax, 18 ; 00000012H je SHORT $LN23@xmlReportE cmp eax, 19 ; 00000013H jne SHORT $LN22@xmlReportE $LN23@xmlReportE: ; 298 : ((domain == XML_FROM_PARSER) || (domain == XML_FROM_SCHEMASV)|| ; 299 : (domain == XML_FROM_SCHEMASP)||(domain == XML_FROM_DTD) || ; 300 : (domain == XML_FROM_RELAXNGP)||(domain == XML_FROM_RELAXNGV))) ; 301 : channel(data, "Entity: line %d: ", line); push ecx $LN73@xmlReportE: ; 302 : } ; 303 : if (name != NULL) { push OFFSET ??_C@_0BC@FMCMLLAH@Entity?3?5line?5?$CFd?3?5@ push ebx call esi add esp, 12 ; 0000000cH $LN22@xmlReportE: test edi, edi je SHORT $LN24@xmlReportE ; 304 : channel(data, "element %s: ", name); push edi push OFFSET ??_C@_0N@MLFICIIN@element?5?$CFs?3?5@ push ebx call esi add esp, 12 ; 0000000cH $LN24@xmlReportE: ; 305 : } ; 306 : switch (domain) { mov eax, DWORD PTR _domain$1$[ebp] dec eax cmp eax, 29 ; 0000001dH ja $LN48@xmlReportE jmp DWORD PTR $LN79@xmlReportE[eax*4] $LN26@xmlReportE: ; 307 : case XML_FROM_PARSER: ; 308 : channel(data, "parser "); ; 309 : break; ; 310 : case XML_FROM_NAMESPACE: ; 311 : channel(data, "namespace "); push OFFSET ??_C@_0L@BNCDLIEB@namespace?5@ ; 312 : break; jmp $LN74@xmlReportE $LN27@xmlReportE: ; 313 : case XML_FROM_DTD: ; 314 : case XML_FROM_VALID: ; 315 : channel(data, "validity "); push OFFSET ??_C@_09BIOOFDLF@validity?5@ ; 316 : break; jmp $LN74@xmlReportE $LN28@xmlReportE: ; 317 : case XML_FROM_HTML: ; 318 : channel(data, "HTML parser "); push OFFSET ??_C@_0N@IENDNEBE@HTML?5parser?5@ ; 319 : break; jmp $LN74@xmlReportE $LN29@xmlReportE: ; 320 : case XML_FROM_MEMORY: ; 321 : channel(data, "memory "); push OFFSET ??_C@_07KICHBFMM@memory?5@ ; 322 : break; jmp SHORT $LN74@xmlReportE $LN30@xmlReportE: ; 323 : case XML_FROM_OUTPUT: ; 324 : channel(data, "output "); push OFFSET ??_C@_07NOLKHGJF@output?5@ ; 325 : break; jmp SHORT $LN74@xmlReportE $LN31@xmlReportE: ; 326 : case XML_FROM_IO: ; 327 : channel(data, "I/O "); push OFFSET ??_C@_04HKCNGDON@I?1O?5@ ; 328 : break; jmp SHORT $LN74@xmlReportE $LN32@xmlReportE: ; 329 : case XML_FROM_XINCLUDE: ; 330 : channel(data, "XInclude "); push OFFSET ??_C@_09JKGAONDL@XInclude?5@ ; 331 : break; jmp SHORT $LN74@xmlReportE $LN33@xmlReportE: ; 332 : case XML_FROM_XPATH: ; 333 : channel(data, "XPath "); push OFFSET ??_C@_06ONGIFIKK@XPath?5@ ; 334 : break; jmp SHORT $LN74@xmlReportE $LN34@xmlReportE: ; 335 : case XML_FROM_XPOINTER: ; 336 : channel(data, "parser "); push OFFSET ??_C@_07CNNNFPCP@parser?5@ ; 337 : break; jmp SHORT $LN74@xmlReportE $LN35@xmlReportE: ; 338 : case XML_FROM_REGEXP: ; 339 : channel(data, "regexp "); push OFFSET ??_C@_07IGPLNGGH@regexp?5@ ; 340 : break; jmp SHORT $LN74@xmlReportE $LN36@xmlReportE: ; 341 : case XML_FROM_MODULE: ; 342 : channel(data, "module "); push OFFSET ??_C@_07KEPCOONB@module?5@ ; 343 : break; jmp SHORT $LN74@xmlReportE $LN37@xmlReportE: ; 344 : case XML_FROM_SCHEMASV: ; 345 : channel(data, "Schemas validity "); push OFFSET ??_C@_0BC@MEEJMAME@Schemas?5validity?5@ ; 346 : break; jmp SHORT $LN74@xmlReportE $LN38@xmlReportE: ; 347 : case XML_FROM_SCHEMASP: ; 348 : channel(data, "Schemas parser "); push OFFSET ??_C@_0BA@COGPIGL@Schemas?5parser?5@ ; 349 : break; jmp SHORT $LN74@xmlReportE $LN39@xmlReportE: ; 350 : case XML_FROM_RELAXNGP: ; 351 : channel(data, "Relax-NG parser "); push OFFSET ??_C@_0BB@FGPKBGBA@Relax?9NG?5parser?5@ ; 352 : break; jmp SHORT $LN74@xmlReportE $LN40@xmlReportE: ; 353 : case XML_FROM_RELAXNGV: ; 354 : channel(data, "Relax-NG validity "); push OFFSET ??_C@_0BD@EPDAPLJK@Relax?9NG?5validity?5@ ; 355 : break; jmp SHORT $LN74@xmlReportE $LN41@xmlReportE: ; 356 : case XML_FROM_CATALOG: ; 357 : channel(data, "Catalog "); push OFFSET ??_C@_08NOLMNIGP@Catalog?5@ ; 358 : break; jmp SHORT $LN74@xmlReportE $LN42@xmlReportE: ; 359 : case XML_FROM_C14N: ; 360 : channel(data, "C14N "); push OFFSET ??_C@_05MLHJFMDG@C14N?5@ ; 361 : break; jmp SHORT $LN74@xmlReportE $LN43@xmlReportE: ; 362 : case XML_FROM_XSLT: ; 363 : channel(data, "XSLT "); push OFFSET ??_C@_05POKACEJG@XSLT?5@ ; 364 : break; jmp SHORT $LN74@xmlReportE $LN44@xmlReportE: ; 365 : case XML_FROM_I18N: ; 366 : channel(data, "encoding "); push OFFSET ??_C@_09JICCLIJI@encoding?5@ ; 367 : break; jmp SHORT $LN74@xmlReportE $LN45@xmlReportE: ; 368 : case XML_FROM_SCHEMATRONV: ; 369 : channel(data, "schematron "); push OFFSET ??_C@_0M@LAKDBFM@schematron?5@ ; 370 : break; jmp SHORT $LN74@xmlReportE $LN46@xmlReportE: ; 371 : case XML_FROM_BUFFER: ; 372 : channel(data, "internal buffer "); push OFFSET ??_C@_0BB@FACNAIAH@internal?5buffer?5@ ; 373 : break; jmp SHORT $LN74@xmlReportE $LN47@xmlReportE: ; 374 : case XML_FROM_URI: ; 375 : channel(data, "URI "); push OFFSET ??_C@_04ECOFBNJN@URI?5@ $LN74@xmlReportE: ; 376 : break; ; 377 : default: ; 378 : break; ; 379 : } ; 380 : switch (level) { push ebx call esi add esp, 8 $LN48@xmlReportE: mov eax, DWORD PTR _level$1$[ebp] cmp eax, 3 ja SHORT $LN4@xmlReportE jmp DWORD PTR $LN80@xmlReportE[eax*4] $LN49@xmlReportE: ; 381 : case XML_ERR_NONE: ; 382 : channel(data, ": "); push OFFSET ??_C@_02LMMGGCAJ@?3?5@ ; 383 : break; jmp SHORT $LN75@xmlReportE $LN50@xmlReportE: ; 384 : case XML_ERR_WARNING: ; 385 : channel(data, "warning : "); push OFFSET ??_C@_0L@HNPIBIGM@warning?5?3?5@ ; 386 : break; jmp SHORT $LN75@xmlReportE $LN52@xmlReportE: ; 387 : case XML_ERR_ERROR: ; 388 : channel(data, "error : "); ; 389 : break; ; 390 : case XML_ERR_FATAL: ; 391 : channel(data, "error : "); push OFFSET ??_C@_08PMHKJNKP@error?5?3?5@ $LN75@xmlReportE: ; 392 : break; ; 393 : } ; 394 : if (str != NULL) { push ebx call esi add esp, 8 $LN4@xmlReportE: mov edi, DWORD PTR _str$[ebp] test edi, edi je SHORT $LN53@xmlReportE ; 395 : int len; ; 396 : len = xmlStrlen((const xmlChar *)str); push edi call _xmlStrlen add esp, 4 ; 397 : if ((len > 0) && (str[len - 1] != '\n')) test eax, eax jle SHORT $LN55@xmlReportE cmp BYTE PTR [eax+edi-1], 10 ; 0000000aH je SHORT $LN55@xmlReportE ; 398 : channel(data, "%s\n", str); push edi jmp SHORT $LN76@xmlReportE $LN55@xmlReportE: ; 399 : else ; 400 : channel(data, "%s", str); push edi push OFFSET ??_C@_02DKCKIIND@?$CFs@ ; 401 : } else { jmp SHORT $LN77@xmlReportE $LN53@xmlReportE: ; 402 : channel(data, "%s\n", "out of memory error"); push OFFSET ??_C@_0BE@LHHHBFLE@out?5of?5memory?5error@ $LN76@xmlReportE: ; 403 : } ; 404 : ; 405 : if (ctxt != NULL) { push OFFSET ??_C@_03OFAPEBGM@?$CFs?6@ $LN77@xmlReportE: push ebx call esi add esp, 12 ; 0000000cH cmp DWORD PTR _ctxt$[ebp], 0 je SHORT $LN58@xmlReportE ; 406 : xmlParserPrintFileContextInternal(input, channel, data); push ebx push esi push DWORD PTR _input$1$[ebp] call _xmlParserPrintFileContextInternal ; 407 : if (cur != NULL) { mov edi, DWORD PTR _cur$1$[ebp] add esp, 12 ; 0000000cH test edi, edi je SHORT $LN58@xmlReportE ; 408 : if (cur->filename) mov eax, DWORD PTR [edi+4] test eax, eax je SHORT $LN59@xmlReportE ; 409 : channel(data, "%s:%d: \n", cur->filename, cur->line); push DWORD PTR [edi+28] push eax push OFFSET ??_C@_08JJLLLDHF@?$CFs?3?$CFd?3?5?6@ push ebx call esi add esp, 16 ; 00000010H jmp SHORT $LN61@xmlReportE $LN59@xmlReportE: ; 410 : else if ((line != 0) && (domain == XML_FROM_PARSER)) cmp DWORD PTR _line$1$[ebp], 0 je SHORT $LN61@xmlReportE cmp DWORD PTR _domain$1$[ebp], 1 jne SHORT $LN61@xmlReportE ; 411 : channel(data, "Entity: line %d: \n", cur->line); push DWORD PTR [edi+28] push OFFSET ??_C@_0BD@GENHFBJC@Entity?3?5line?5?$CFd?3?5?6@ push ebx call esi add esp, 12 ; 0000000cH $LN61@xmlReportE: ; 412 : xmlParserPrintFileContextInternal(cur, channel, data); push ebx push esi push edi call _xmlParserPrintFileContextInternal add esp, 12 ; 0000000cH $LN58@xmlReportE: ; 413 : } ; 414 : } ; 415 : if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && ; 416 : (err->int1 < 100) && cmp DWORD PTR _domain$1$[ebp], 12 ; 0000000cH jne SHORT $LN71@xmlReportE mov edi, DWORD PTR _err$[ebp] mov eax, DWORD PTR [edi+24] test eax, eax je SHORT $LN71@xmlReportE cmp DWORD PTR [edi+36], 100 ; 00000064H jge SHORT $LN71@xmlReportE push eax call _xmlStrlen add esp, 4 cmp DWORD PTR [edi+36], eax jge SHORT $LN71@xmlReportE ; 417 : (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { ; 418 : xmlChar buf[150]; ; 419 : int i; ; 420 : ; 421 : channel(data, "%s\n", err->str1); push DWORD PTR [edi+24] push OFFSET ??_C@_03OFAPEBGM@?$CFs?6@ push ebx call esi ; 422 : for (i=0;i < err->int1;i++) mov ecx, DWORD PTR [edi+36] add esp, 12 ; 0000000cH xor eax, eax test ecx, ecx jle SHORT $LN7@xmlReportE ; 417 : (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { ; 418 : xmlChar buf[150]; ; 419 : int i; ; 420 : ; 421 : channel(data, "%s\n", err->str1); mov edx, ecx lea edi, DWORD PTR _buf$1[ebp] shr ecx, 2 mov eax, 538976288 ; 20202020H rep stosd mov ecx, edx and ecx, 3 rep stosb mov eax, edx $LN7@xmlReportE: ; 423 : buf[i] = ' '; ; 424 : buf[i++] = '^'; mov WORD PTR _buf$1[ebp+eax], 94 ; 0000005eH ; 425 : buf[i] = 0; ; 426 : channel(data, "%s\n", buf); lea eax, DWORD PTR _buf$1[ebp] push eax push OFFSET ??_C@_03OFAPEBGM@?$CFs?6@ push ebx call esi add esp, 12 ; 0000000cH $LN71@xmlReportE: pop esi pop ebx $LN62@xmlReportE: pop edi ; 427 : } ; 428 : } mov esp, ebp pop ebp ret 0 npad 2 $LN79@xmlReportE: DD $LN34@xmlReportE DD $LN48@xmlReportE DD $LN26@xmlReportE DD $LN27@xmlReportE DD $LN28@xmlReportE DD $LN29@xmlReportE DD $LN30@xmlReportE DD $LN31@xmlReportE DD $LN48@xmlReportE DD $LN48@xmlReportE DD $LN32@xmlReportE DD $LN33@xmlReportE DD $LN34@xmlReportE DD $LN35@xmlReportE DD $LN48@xmlReportE DD $LN38@xmlReportE DD $LN37@xmlReportE DD $LN39@xmlReportE DD $LN40@xmlReportE DD $LN41@xmlReportE DD $LN42@xmlReportE DD $LN43@xmlReportE DD $LN27@xmlReportE DD $LN48@xmlReportE DD $LN48@xmlReportE DD $LN36@xmlReportE DD $LN44@xmlReportE DD $LN45@xmlReportE DD $LN46@xmlReportE DD $LN47@xmlReportE $LN80@xmlReportE: DD $LN49@xmlReportE DD $LN50@xmlReportE DD $LN52@xmlReportE DD $LN52@xmlReportE _xmlReportError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserPrintFileContextInternal _TEXT SEGMENT _content$ = -84 ; size = 81 _input$ = 8 ; size = 4 _channel$ = 12 ; size = 4 _data$ = 16 ; size = 4 _xmlParserPrintFileContextInternal PROC ; COMDAT ; 174 : xmlGenericErrorFunc channel, void *data ) { push ebp mov ebp, esp sub esp, 84 ; 00000054H mov ecx, OFFSET __67926DEE_error@c push esi call @__CheckForDebuggerJustMyCode@4 mov esi, DWORD PTR _input$[ebp] test esi, esi je $LN11@xmlParserP ; 175 : const xmlChar *cur, *base; ; 176 : unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ ; 177 : xmlChar content[81]; /* space for 80 chars + line terminator */ ; 178 : xmlChar *ctnt; ; 179 : ; 180 : if ((input == NULL) || (input->cur == NULL)) push edi mov edi, DWORD PTR [esi+16] test edi, edi je $LN39@xmlParserP ; 181 : return; ; 182 : ; 183 : cur = input->cur; ; 184 : base = input->base; mov esi, DWORD PTR [esi+12] mov eax, edi ; 185 : /* skip backwards over any end-of-lines */ ; 186 : while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { cmp eax, esi jbe SHORT $LN36@xmlParserP $LL2@xmlParserP: mov cl, BYTE PTR [eax] cmp cl, 10 ; 0000000aH je SHORT $LN30@xmlParserP cmp cl, 13 ; 0000000dH jne SHORT $LN36@xmlParserP $LN30@xmlParserP: ; 187 : cur--; dec eax cmp eax, esi ja SHORT $LL2@xmlParserP $LN36@xmlParserP: ; 188 : } ; 189 : n = 0; xor ecx, ecx $LL4@xmlParserP: ; 190 : /* search backwards for beginning-of-line (to max buff size) */ ; 191 : while ((n++ < (sizeof(content)-1)) && (cur > base) && ; 192 : (*(cur) != '\n') && (*(cur) != '\r')) inc ecx cmp eax, esi jbe SHORT $LN22@xmlParserP mov dl, BYTE PTR [eax] cmp dl, 10 ; 0000000aH je SHORT $LN14@xmlParserP cmp dl, 13 ; 0000000dH je SHORT $LN22@xmlParserP ; 193 : cur--; dec eax cmp ecx, 80 ; 00000050H jb SHORT $LL4@xmlParserP $LN22@xmlParserP: ; 194 : if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; mov cl, BYTE PTR [eax] cmp cl, 10 ; 0000000aH je SHORT $LN14@xmlParserP cmp cl, 13 ; 0000000dH jne SHORT $LN13@xmlParserP $LN14@xmlParserP: mov cl, BYTE PTR [eax+1] inc eax $LN13@xmlParserP: ; 195 : /* calculate the error position in terms of the current position */ ; 196 : col = input->cur - cur; sub edi, eax ; 197 : /* search forward for end-of-line (to max buff size) */ ; 198 : n = 0; ; 199 : ctnt = content; lea edx, DWORD PTR _content$[ebp] xor esi, esi push ebx ; 200 : /* copy selected text to our buffer */ ; 201 : while ((*cur != 0) && (*(cur) != '\n') && ; 202 : (*(cur) != '\r') && (n < sizeof(content)-1)) { test cl, cl je SHORT $LN37@xmlParserP ; 185 : /* skip backwards over any end-of-lines */ ; 186 : while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { mov ebx, edx sub eax, ebx npad 5 $LL6@xmlParserP: ; 200 : /* copy selected text to our buffer */ ; 201 : while ((*cur != 0) && (*(cur) != '\n') && ; 202 : (*(cur) != '\r') && (n < sizeof(content)-1)) { cmp cl, 10 ; 0000000aH je SHORT $LN37@xmlParserP cmp cl, 13 ; 0000000dH je SHORT $LN37@xmlParserP cmp esi, 80 ; 00000050H jae SHORT $LN37@xmlParserP ; 203 : *ctnt++ = *cur++; movzx ecx, BYTE PTR [eax+edx] ; 204 : n++; inc esi mov BYTE PTR [edx], cl inc edx mov cl, BYTE PTR [eax+edx] test cl, cl jne SHORT $LL6@xmlParserP $LN37@xmlParserP: ; 205 : } ; 206 : *ctnt = 0; ; 207 : /* print out the selected text */ ; 208 : channel(data ,"%s\n", content); mov esi, DWORD PTR _data$[ebp] lea eax, DWORD PTR _content$[ebp] mov ebx, DWORD PTR _channel$[ebp] push eax push OFFSET ??_C@_03OFAPEBGM@?$CFs?6@ push esi mov BYTE PTR [edx], 0 call ebx add esp, 12 ; 0000000cH ; 209 : /* create blank line with problem pointer */ ; 210 : n = 0; ; 211 : ctnt = content; lea ecx, DWORD PTR _content$[ebp] xor edx, edx ; 212 : /* (leave buffer space for pointer + line terminator) */ ; 213 : while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) { test edi, edi je SHORT $LN38@xmlParserP npad 1 $LL8@xmlParserP: mov eax, edx inc edx cmp eax, 79 ; 0000004fH jae SHORT $LN38@xmlParserP mov al, BYTE PTR [ecx] test al, al je SHORT $LN38@xmlParserP ; 214 : if (*(ctnt) != '\t') cmp al, 9 je SHORT $LN35@xmlParserP ; 215 : *(ctnt) = ' '; mov BYTE PTR [ecx], 32 ; 00000020H $LN35@xmlParserP: ; 216 : ctnt++; inc ecx cmp edx, edi jb SHORT $LL8@xmlParserP $LN38@xmlParserP: ; 217 : } ; 218 : *ctnt++ = '^'; ; 219 : *ctnt = 0; ; 220 : channel(data ,"%s\n", content); lea eax, DWORD PTR _content$[ebp] mov WORD PTR [ecx], 94 ; 0000005eH push eax push OFFSET ??_C@_03OFAPEBGM@?$CFs?6@ push esi call ebx add esp, 12 ; 0000000cH pop ebx $LN39@xmlParserP: pop edi $LN11@xmlParserP: pop esi ; 221 : } mov esp, ebp pop ebp ret 0 _xmlParserPrintFileContextInternal ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlGenericErrorDefaultFunc _TEXT SEGMENT _ctx$ = 8 ; size = 4 _msg$ = 12 ; size = 4 _xmlGenericErrorDefaultFunc PROC ; COMDAT ; 71 : xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { push ebp mov ebp, esp push esi push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlGenericErrorContext cmp DWORD PTR [eax], 0 jne SHORT $LN2@xmlGeneric ; 72 : va_list args; ; 73 : ; 74 : if (xmlGenericErrorContext == NULL) ; 75 : xmlGenericErrorContext = (void *) stderr; call ___xmlGenericErrorContext push 2 mov esi, eax call DWORD PTR __imp____acrt_iob_func add esp, 4 mov DWORD PTR [esi], eax $LN2@xmlGeneric: ; 76 : ; 77 : va_start(args, msg); ; 78 : vfprintf((FILE *)xmlGenericErrorContext, msg, args); mov edi, DWORD PTR _msg$[ebp] call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 push edi push esi push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H pop edi pop esi ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 80 : } pop ebp ret 0 _xmlGenericErrorDefaultFunc ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT ___xmlSimpleError _TEXT SEGMENT _domain$ = 8 ; size = 4 _code$ = 12 ; size = 4 _node$ = 16 ; size = 4 _msg$ = 20 ; size = 4 _extra$ = 24 ; size = 4 ___xmlSimpleError PROC ; COMDAT ; 653 : { push ebp mov ebp, esp mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov ecx, DWORD PTR _code$[ebp] mov eax, DWORD PTR _extra$[ebp] cmp ecx, 2 jne SHORT $LN2@xmlSimpleE ; 654 : ; 655 : if (code == XML_ERR_NO_MEMORY) { ; 656 : if (extra) test eax, eax je SHORT $LN4@xmlSimpleE ; 657 : __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, push eax push OFFSET ??_C@_0BP@DJFHNAOK@Memory?5allocation?5failed?5?3?5?$CFs?6@ push 0 push 0 push 0 push 0 push eax push 0 push 0 push 3 push ecx jmp SHORT $LN7@xmlSimpleE $LN4@xmlSimpleE: ; 658 : XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra, ; 659 : NULL, NULL, 0, 0, ; 660 : "Memory allocation failed : %s\n", extra); ; 661 : else ; 662 : __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, push OFFSET ??_C@_0BK@GDFDKGPJ@Memory?5allocation?5failed?6@ push 0 push 0 push 0 push 0 push 0 push 0 push 0 push 3 push 2 push DWORD PTR _domain$[ebp] push DWORD PTR _node$[ebp] push 0 push 0 push 0 push 0 call ___xmlRaiseError add esp, 64 ; 00000040H ; 667 : code, XML_ERR_ERROR, NULL, 0, extra, ; 668 : NULL, NULL, 0, 0, msg, extra); ; 669 : } ; 670 : } pop ebp ret 0 $LN2@xmlSimpleE: ; 663 : XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL, ; 664 : NULL, NULL, 0, 0, "Memory allocation failed\n"); ; 665 : } else { ; 666 : __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, push eax push DWORD PTR _msg$[ebp] push 0 push 0 push 0 push 0 push eax push 0 push 0 push 2 push ecx $LN7@xmlSimpleE: ; 667 : code, XML_ERR_ERROR, NULL, 0, extra, ; 668 : NULL, NULL, 0, 0, msg, extra); ; 669 : } ; 670 : } push DWORD PTR _domain$[ebp] push DWORD PTR _node$[ebp] push 0 push 0 push 0 push 0 call ___xmlRaiseError add esp, 68 ; 00000044H pop ebp ret 0 ___xmlSimpleError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT ___xmlRaiseError _TEXT SEGMENT _to$1$ = -24 ; size = 4 _baseptr$1$ = -20 ; size = 4 _ctxt$1$ = -16 ; size = 4 _schannel$1$ = -12 ; size = 4 _str$1$ = -8 ; size = 4 _data$1$ = -4 ; size = 4 _schannel$ = 8 ; size = 4 _channel$ = 12 ; size = 4 _data$ = 16 ; size = 4 _ctx$ = 20 ; size = 4 _line$1$ = 24 ; size = 4 _nod$ = 24 ; size = 4 _domain$ = 28 ; size = 4 _code$ = 32 ; size = 4 _level$ = 36 ; size = 4 _file$ = 40 ; size = 4 _line$ = 44 ; size = 4 _str1$ = 48 ; size = 4 _str2$ = 52 ; size = 4 _str3$ = 56 ; size = 4 _int1$ = 60 ; size = 4 _col$ = 64 ; size = 4 _msg$ = 68 ; size = 4 ___xmlRaiseError PROC ; COMDAT ; 461 : { push ebp mov ebp, esp sub esp, 24 ; 00000018H push ebx push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov ebx, DWORD PTR _nod$[ebp] xor eax, eax mov DWORD PTR _ctxt$1$[ebp], eax call ___xmlLastError cmp DWORD PTR _code$[ebp], 0 mov edi, eax mov DWORD PTR _to$1$[ebp], edi mov DWORD PTR _baseptr$1$[ebp], 0 je $LN67@xmlRaiseEr ; 462 : xmlParserCtxtPtr ctxt = NULL; ; 463 : xmlNodePtr node = (xmlNodePtr) nod; ; 464 : char *str = NULL; ; 465 : xmlParserInputPtr input = NULL; ; 466 : xmlErrorPtr to = &xmlLastError; ; 467 : xmlNodePtr baseptr = NULL; ; 468 : ; 469 : if (code == XML_ERR_OK) ; 470 : return; ; 471 : if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING)) call ___xmlGetWarningsDefaultValue cmp DWORD PTR [eax], 0 jne SHORT $LN10@xmlRaiseEr cmp DWORD PTR _level$[ebp], 1 je $LN67@xmlRaiseEr $LN10@xmlRaiseEr: ; 472 : return; ; 473 : if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || ; 474 : (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || ; 475 : (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { mov eax, DWORD PTR _domain$[ebp] push esi cmp eax, 1 je SHORT $LN12@xmlRaiseEr cmp eax, 5 je SHORT $LN12@xmlRaiseEr cmp eax, 4 je SHORT $LN12@xmlRaiseEr cmp eax, 3 je SHORT $LN12@xmlRaiseEr cmp eax, 8 je SHORT $LN12@xmlRaiseEr cmp eax, 23 ; 00000017H je SHORT $LN12@xmlRaiseEr mov ecx, DWORD PTR _schannel$[ebp] mov esi, DWORD PTR _data$[ebp] mov DWORD PTR _schannel$1$[ebp], ecx jmp SHORT $LN102@xmlRaiseEr $LN12@xmlRaiseEr: ; 476 : ctxt = (xmlParserCtxtPtr) ctx; ; 477 : if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && ; 478 : (ctxt->sax->initialized == XML_SAX2_MAGIC) && mov ecx, DWORD PTR _schannel$[ebp] mov edx, DWORD PTR _ctx$[ebp] mov DWORD PTR _ctxt$1$[ebp], edx mov DWORD PTR _schannel$1$[ebp], ecx test ecx, ecx jne SHORT $LN91@xmlRaiseEr test edx, edx je SHORT $LN90@xmlRaiseEr mov eax, DWORD PTR [edx] test eax, eax je SHORT $LN90@xmlRaiseEr cmp DWORD PTR [eax+108], -554844497 ; deedbeafH jne SHORT $LN90@xmlRaiseEr mov ecx, DWORD PTR [eax+124] mov DWORD PTR _schannel$1$[ebp], ecx test ecx, ecx je SHORT $LN90@xmlRaiseEr ; 479 : (ctxt->sax->serror != NULL)) { ; 480 : schannel = ctxt->sax->serror; ; 481 : data = ctxt->userData; mov esi, DWORD PTR [edx+4] $LN102@xmlRaiseEr: ; 482 : } ; 483 : } ; 484 : /* ; 485 : * Check if structured error handler set ; 486 : */ ; 487 : if (schannel == NULL) { mov DWORD PTR _data$1$[ebp], esi test ecx, ecx jne SHORT $LN15@xmlRaiseEr ; 476 : ctxt = (xmlParserCtxtPtr) ctx; ; 477 : if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && ; 478 : (ctxt->sax->initialized == XML_SAX2_MAGIC) && jmp SHORT $LN87@xmlRaiseEr $LN90@xmlRaiseEr: mov eax, DWORD PTR _data$[ebp] mov DWORD PTR _data$1$[ebp], eax $LN87@xmlRaiseEr: ; 488 : schannel = xmlStructuredError; call ___xmlStructuredError mov eax, DWORD PTR [eax] mov DWORD PTR _schannel$1$[ebp], eax ; 489 : /* ; 490 : * if user has defined handler, change data ptr to user's choice ; 491 : */ ; 492 : if (schannel != NULL) test eax, eax je SHORT $LN15@xmlRaiseEr ; 493 : data = xmlStructuredErrorContext; call ___xmlStructuredErrorContext mov eax, DWORD PTR [eax] jmp SHORT $LN103@xmlRaiseEr $LN91@xmlRaiseEr: ; 476 : ctxt = (xmlParserCtxtPtr) ctx; ; 477 : if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && ; 478 : (ctxt->sax->initialized == XML_SAX2_MAGIC) && mov eax, DWORD PTR _data$[ebp] $LN103@xmlRaiseEr: ; 494 : } ; 495 : /* ; 496 : * Formatting the message ; 497 : */ ; 498 : if (msg == NULL) { mov DWORD PTR _data$1$[ebp], eax $LN15@xmlRaiseEr: cmp DWORD PTR _msg$[ebp], 0 jne SHORT $LN16@xmlRaiseEr ; 499 : str = (char *) xmlStrdup(BAD_CAST "No error message provided"); push OFFSET ??_C@_0BK@ONMNHCCC@No?5error?5message?5provided@ call _xmlStrdup add esp, 4 mov DWORD PTR _str$1$[ebp], eax ; 500 : } else { jmp $LN75@xmlRaiseEr $LN16@xmlRaiseEr: ; 501 : XML_GET_VAR_STR(msg, str); push 150 ; 00000096H call DWORD PTR _xmlMalloc mov esi, eax add esp, 4 mov DWORD PTR _str$1$[ebp], esi test esi, esi je SHORT $LN75@xmlRaiseEr mov edi, 150 ; 00000096H or ebx, -1 npad 4 $LL2@xmlRaiseEr: mov esi, DWORD PTR _msg$[ebp] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 1440 : int const _Result = __stdio_common_vsprintf( call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 mov ecx, DWORD PTR [eax] push esi mov esi, DWORD PTR _str$1$[ebp] or ecx, 2 push edi push esi push DWORD PTR [eax+4] push ecx call DWORD PTR __imp____stdio_common_vsprintf add esp, 28 ; 0000001cH ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; mov ecx, -1 test eax, eax cmovs eax, ecx ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 501 : XML_GET_VAR_STR(msg, str); cmp eax, ecx jle SHORT $LN22@xmlRaiseEr cmp eax, edi jge SHORT $LN21@xmlRaiseEr cmp ebx, eax je SHORT $LN97@xmlRaiseEr mov ebx, eax $LN21@xmlRaiseEr: inc edi add edi, eax jmp SHORT $LN23@xmlRaiseEr $LN22@xmlRaiseEr: add edi, 100 ; 00000064H $LN23@xmlRaiseEr: push edi push esi call DWORD PTR _xmlRealloc add esp, 8 test eax, eax je SHORT $LN97@xmlRaiseEr mov DWORD PTR _str$1$[ebp], eax cmp edi, 64000 ; 0000fa00H jl SHORT $LL2@xmlRaiseEr $LN97@xmlRaiseEr: mov ebx, DWORD PTR _nod$[ebp] mov edi, DWORD PTR _to$1$[ebp] $LN75@xmlRaiseEr: ; 502 : } ; 503 : ; 504 : /* ; 505 : * specific processing if a parser context is provided ; 506 : */ ; 507 : if (ctxt != NULL) { mov edx, DWORD PTR _ctxt$1$[ebp] test edx, edx je SHORT $LN25@xmlRaiseEr ; 508 : if (file == NULL) { cmp DWORD PTR _file$[ebp], 0 jne SHORT $LN92@xmlRaiseEr ; 509 : input = ctxt->input; mov eax, DWORD PTR [edx+36] ; 510 : if ((input != NULL) && (input->filename == NULL) && test eax, eax je SHORT $LN92@xmlRaiseEr cmp DWORD PTR [eax+4], 0 jne SHORT $LN28@xmlRaiseEr mov ecx, DWORD PTR [edx+40] cmp ecx, 1 jle SHORT $LN28@xmlRaiseEr ; 511 : (ctxt->inputNr > 1)) { ; 512 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR [edx+48] mov eax, DWORD PTR [eax+ecx*4-8] $LN28@xmlRaiseEr: ; 513 : } ; 514 : if (input != NULL) { test eax, eax je SHORT $LN92@xmlRaiseEr ; 515 : file = input->filename; ; 516 : line = input->line; mov ecx, DWORD PTR [eax+28] ; 517 : col = input->col; ; 518 : } ; 519 : } ; 520 : to = &ctxt->lastError; lea edi, DWORD PTR [edx+384] mov esi, DWORD PTR [eax+4] mov eax, DWORD PTR [eax+32] mov DWORD PTR _line$1$[ebp], ecx mov DWORD PTR _col$[ebp], eax jmp $LN34@xmlRaiseEr $LN92@xmlRaiseEr: ; 513 : } ; 514 : if (input != NULL) { mov eax, DWORD PTR _line$[ebp] ; 517 : col = input->col; ; 518 : } ; 519 : } ; 520 : to = &ctxt->lastError; lea edi, DWORD PTR [edx+384] mov esi, DWORD PTR _file$[ebp] mov DWORD PTR _line$1$[ebp], eax jmp $LN34@xmlRaiseEr $LN25@xmlRaiseEr: ; 521 : } else if ((node != NULL) && (file == NULL)) { test ebx, ebx je SHORT $LN95@xmlRaiseEr cmp DWORD PTR _file$[ebp], 0 jne SHORT $LN96@xmlRaiseEr ; 522 : int i; ; 523 : ; 524 : if ((node->doc != NULL) && (node->doc->URL != NULL)) { mov eax, DWORD PTR [ebx+32] xor ecx, ecx test eax, eax je SHORT $LN31@xmlRaiseEr cmp DWORD PTR [eax+72], ecx cmovne ecx, ebx mov DWORD PTR _baseptr$1$[ebp], ecx $LN31@xmlRaiseEr: ; 525 : baseptr = node; ; 526 : /* file = (const char *) node->doc->URL; */ ; 527 : } ; 528 : for (i = 0; xor eax, eax npad 1 $LL6@xmlRaiseEr: ; 529 : ((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE)); test ebx, ebx je SHORT $LN5@xmlRaiseEr cmp DWORD PTR [ebx+4], 1 je SHORT $LN5@xmlRaiseEr ; 530 : i++) ; 531 : node = node->parent; mov ebx, DWORD PTR [ebx+20] inc eax cmp eax, 10 ; 0000000aH jl SHORT $LL6@xmlRaiseEr $LN5@xmlRaiseEr: ; 532 : if ((baseptr == NULL) && (node != NULL) && ; 533 : (node->doc != NULL) && (node->doc->URL != NULL)) test ecx, ecx jne SHORT $LN32@xmlRaiseEr test ebx, ebx je SHORT $LN93@xmlRaiseEr mov eax, DWORD PTR [ebx+32] test eax, eax je SHORT $LN32@xmlRaiseEr cmp DWORD PTR [eax+72], ecx cmovne ecx, ebx mov DWORD PTR _baseptr$1$[ebp], ecx $LN32@xmlRaiseEr: ; 534 : baseptr = node; ; 535 : ; 536 : if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) test ebx, ebx je SHORT $LN93@xmlRaiseEr cmp DWORD PTR [ebx+4], 1 jne SHORT $LN93@xmlRaiseEr ; 537 : line = node->line; movzx esi, WORD PTR [ebx+56] jmp SHORT $LN104@xmlRaiseEr $LN93@xmlRaiseEr: ; 534 : baseptr = node; ; 535 : ; 536 : if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) mov esi, DWORD PTR _line$[ebp] $LN104@xmlRaiseEr: ; 538 : if ((line == 0) || (line == 65535)) mov DWORD PTR _line$1$[ebp], esi test esi, esi je SHORT $LN35@xmlRaiseEr cmp esi, 65535 ; 0000ffffH jne SHORT $LN98@xmlRaiseEr $LN35@xmlRaiseEr: ; 539 : line = xmlGetLineNo(node); push ebx call _xmlGetLineNo add esp, 4 jmp SHORT $LN109@xmlRaiseEr $LN96@xmlRaiseEr: ; 521 : } else if ((node != NULL) && (file == NULL)) { mov esi, DWORD PTR _line$[ebp] mov DWORD PTR _line$1$[ebp], esi jmp SHORT $LN98@xmlRaiseEr $LN95@xmlRaiseEr: mov eax, DWORD PTR _line$[ebp] $LN109@xmlRaiseEr: ; 540 : } ; 541 : ; 542 : /* ; 543 : * Save the information about the error ; 544 : */ ; 545 : xmlResetError(to); mov DWORD PTR _line$1$[ebp], eax $LN98@xmlRaiseEr: mov esi, DWORD PTR _file$[ebp] $LN34@xmlRaiseEr: push edi call _xmlResetError ; 546 : to->domain = domain; mov eax, DWORD PTR _domain$[ebp] add esp, 4 mov DWORD PTR [edi], eax ; 547 : to->code = code; mov eax, DWORD PTR _code$[ebp] mov DWORD PTR [edi+4], eax ; 548 : to->message = str; mov eax, DWORD PTR _str$1$[ebp] mov DWORD PTR [edi+8], eax ; 549 : to->level = level; mov eax, DWORD PTR _level$[ebp] mov DWORD PTR [edi+12], eax ; 550 : if (file != NULL) test esi, esi je SHORT $LN36@xmlRaiseEr ; 551 : to->file = (char *) xmlStrdup((const xmlChar *) file); push esi jmp $LN105@xmlRaiseEr $LN36@xmlRaiseEr: ; 552 : else if (baseptr != NULL) { mov edx, DWORD PTR _baseptr$1$[ebp] test edx, edx je $LN49@xmlRaiseEr ; 553 : #ifdef LIBXML_XINCLUDE_ENABLED ; 554 : /* ; 555 : * We check if the error is within an XInclude section and, ; 556 : * if so, attempt to print out the href of the XInclude instead ; 557 : * of the usual "base" (doc->URL) for the node (bug 152623). ; 558 : */ ; 559 : xmlNodePtr prev = baseptr; mov esi, edx ; 560 : int inclcount = 0; xor eax, eax $LL7@xmlRaiseEr: ; 562 : if (prev->prev == NULL) mov ecx, DWORD PTR [esi+28] test ecx, ecx jne SHORT $LN39@xmlRaiseEr ; 563 : prev = prev->parent; mov esi, DWORD PTR [esi+20] jmp SHORT $LN44@xmlRaiseEr $LN39@xmlRaiseEr: ; 564 : else { ; 565 : prev = prev->prev; mov esi, ecx ; 566 : if (prev->type == XML_XINCLUDE_START) { mov ecx, DWORD PTR [esi+4] cmp ecx, 19 ; 00000013H jne SHORT $LN41@xmlRaiseEr ; 567 : if (--inclcount < 0) sub eax, 1 js SHORT $LN77@xmlRaiseEr ; 568 : break; ; 569 : } else if (prev->type == XML_XINCLUDE_END) jmp SHORT $LN44@xmlRaiseEr $LN41@xmlRaiseEr: cmp ecx, 20 ; 00000014H jne SHORT $LN44@xmlRaiseEr ; 570 : inclcount++; inc eax $LN44@xmlRaiseEr: ; 561 : while (prev != NULL) { test esi, esi jne SHORT $LL7@xmlRaiseEr $LN77@xmlRaiseEr: ; 571 : } ; 572 : } ; 573 : if (prev != NULL) { test esi, esi je SHORT $LN45@xmlRaiseEr ; 574 : if (prev->type == XML_XINCLUDE_START) { cmp DWORD PTR [esi+4], 19 ; 00000013H push OFFSET ??_C@_04CMBCJJJD@href@ push esi jne SHORT $LN47@xmlRaiseEr ; 575 : prev->type = XML_ELEMENT_NODE; mov DWORD PTR [esi+4], 1 ; 576 : to->file = (char *) xmlGetProp(prev, BAD_CAST "href"); call _xmlGetProp mov DWORD PTR [edi+16], eax add esp, 8 ; 577 : prev->type = XML_XINCLUDE_START; mov DWORD PTR [esi+4], 19 ; 00000013H ; 578 : } else { jmp SHORT $LN46@xmlRaiseEr $LN47@xmlRaiseEr: ; 579 : to->file = (char *) xmlGetProp(prev, BAD_CAST "href"); call _xmlGetProp add esp, 8 ; 580 : } ; 581 : } else jmp SHORT $LN106@xmlRaiseEr $LN45@xmlRaiseEr: ; 582 : #endif ; 583 : to->file = (char *) xmlStrdup(baseptr->doc->URL); mov eax, DWORD PTR [edx+32] push DWORD PTR [eax+72] call _xmlStrdup add esp, 4 $LN106@xmlRaiseEr: ; 584 : if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) { mov DWORD PTR [edi+16], eax $LN46@xmlRaiseEr: cmp DWORD PTR [edi+16], 0 jne SHORT $LN49@xmlRaiseEr test ebx, ebx je SHORT $LN49@xmlRaiseEr mov eax, DWORD PTR [ebx+32] test eax, eax je SHORT $LN49@xmlRaiseEr ; 585 : to->file = (char *) xmlStrdup(node->doc->URL); push DWORD PTR [eax+72] $LN105@xmlRaiseEr: ; 586 : } ; 587 : } ; 588 : to->line = line; call _xmlStrdup mov DWORD PTR [edi+16], eax add esp, 4 $LN49@xmlRaiseEr: mov eax, DWORD PTR _line$1$[ebp] mov DWORD PTR [edi+20], eax ; 589 : if (str1 != NULL) mov eax, DWORD PTR _str1$[ebp] test eax, eax je SHORT $LN50@xmlRaiseEr ; 590 : to->str1 = (char *) xmlStrdup((const xmlChar *) str1); push eax call _xmlStrdup add esp, 4 mov DWORD PTR [edi+24], eax $LN50@xmlRaiseEr: ; 591 : if (str2 != NULL) mov eax, DWORD PTR _str2$[ebp] test eax, eax je SHORT $LN51@xmlRaiseEr ; 592 : to->str2 = (char *) xmlStrdup((const xmlChar *) str2); push eax call _xmlStrdup add esp, 4 mov DWORD PTR [edi+28], eax $LN51@xmlRaiseEr: ; 593 : if (str3 != NULL) mov eax, DWORD PTR _str3$[ebp] test eax, eax je SHORT $LN52@xmlRaiseEr ; 594 : to->str3 = (char *) xmlStrdup((const xmlChar *) str3); push eax call _xmlStrdup add esp, 4 mov DWORD PTR [edi+32], eax $LN52@xmlRaiseEr: ; 595 : to->int1 = int1; mov eax, DWORD PTR _int1$[ebp] mov DWORD PTR [edi+36], eax ; 596 : to->int2 = col; mov eax, DWORD PTR _col$[ebp] mov DWORD PTR [edi+40], eax ; 597 : to->node = node; ; 598 : to->ctxt = ctx; mov eax, DWORD PTR _ctx$[ebp] mov DWORD PTR [edi+48], ebx mov DWORD PTR [edi+44], eax ; 599 : ; 600 : if (to != &xmlLastError) call ___xmlLastError cmp edi, eax je SHORT $LN53@xmlRaiseEr ; 601 : xmlCopyError(to,&xmlLastError); call ___xmlLastError push eax push edi call _xmlCopyError add esp, 8 $LN53@xmlRaiseEr: ; 602 : ; 603 : if (schannel != NULL) { mov eax, DWORD PTR _schannel$1$[ebp] test eax, eax je SHORT $LN54@xmlRaiseEr ; 604 : schannel(data, to); push edi push DWORD PTR _data$1$[ebp] call eax add esp, 8 pop esi pop edi ; 639 : } pop ebx mov esp, ebp pop ebp ret 0 $LN54@xmlRaiseEr: ; 605 : return; ; 606 : } ; 607 : ; 608 : /* ; 609 : * Find the callback channel if channel param is NULL ; 610 : */ ; 611 : if ((ctxt != NULL) && (channel == NULL) && ; 612 : (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { mov ebx, DWORD PTR _channel$[ebp] mov esi, DWORD PTR _ctxt$1$[ebp] test ebx, ebx jne SHORT $LN86@xmlRaiseEr test esi, esi je SHORT $LN55@xmlRaiseEr call ___xmlStructuredError cmp DWORD PTR [eax], ebx jne SHORT $LN55@xmlRaiseEr mov eax, DWORD PTR [esi] test eax, eax je SHORT $LN55@xmlRaiseEr ; 613 : if (level == XML_ERR_WARNING) cmp DWORD PTR _level$[ebp], 1 jne SHORT $LN57@xmlRaiseEr ; 614 : channel = ctxt->sax->warning; mov ebx, DWORD PTR [eax+84] ; 617 : data = ctxt->userData; mov eax, DWORD PTR [esi+4] jmp SHORT $LN107@xmlRaiseEr $LN57@xmlRaiseEr: ; 615 : else ; 616 : channel = ctxt->sax->error; mov ebx, DWORD PTR [eax+88] ; 617 : data = ctxt->userData; mov eax, DWORD PTR [esi+4] jmp SHORT $LN107@xmlRaiseEr $LN55@xmlRaiseEr: ; 618 : } else if (channel == NULL) { ; 619 : channel = xmlGenericError; call ___xmlGenericError mov ebx, DWORD PTR [eax] ; 620 : if (ctxt != NULL) { test esi, esi je SHORT $LN60@xmlRaiseEr ; 621 : data = ctxt; mov DWORD PTR _data$1$[ebp], esi ; 622 : } else { jmp SHORT $LN61@xmlRaiseEr $LN60@xmlRaiseEr: ; 623 : data = xmlGenericErrorContext; call ___xmlGenericErrorContext mov eax, DWORD PTR [eax] $LN107@xmlRaiseEr: ; 624 : } ; 625 : } ; 626 : if (channel == NULL) mov DWORD PTR _data$1$[ebp], eax $LN61@xmlRaiseEr: test ebx, ebx je SHORT $LN101@xmlRaiseEr $LN86@xmlRaiseEr: ; 627 : return; ; 628 : ; 629 : if ((channel == xmlParserError) || ; 630 : (channel == xmlParserWarning) || ; 631 : (channel == xmlParserValidityError) || cmp ebx, OFFSET _xmlParserError je SHORT $LN65@xmlRaiseEr cmp ebx, OFFSET _xmlParserWarning je SHORT $LN65@xmlRaiseEr cmp ebx, OFFSET _xmlParserValidityError je SHORT $LN65@xmlRaiseEr cmp ebx, OFFSET _xmlParserValidityWarning je SHORT $LN65@xmlRaiseEr ; 634 : else if ((channel == (xmlGenericErrorFunc) fprintf) || cmp ebx, OFFSET _fprintf je SHORT $LN68@xmlRaiseEr cmp ebx, OFFSET _xmlGenericErrorDefaultFunc je SHORT $LN68@xmlRaiseEr ; 637 : else ; 638 : channel(data, "%s", str); push DWORD PTR _str$1$[ebp] push OFFSET ??_C@_02DKCKIIND@?$CFs@ push DWORD PTR _data$1$[ebp] call ebx add esp, 12 ; 0000000cH pop esi pop edi ; 639 : } pop ebx mov esp, ebp pop ebp ret 0 $LN68@xmlRaiseEr: ; 635 : (channel == xmlGenericErrorDefaultFunc)) ; 636 : xmlReportError(to, ctxt, str, channel, data); push DWORD PTR _data$1$[ebp] push ebx push DWORD PTR _str$1$[ebp] push esi push edi call _xmlReportError add esp, 20 ; 00000014H pop esi pop edi ; 639 : } pop ebx mov esp, ebp pop ebp ret 0 $LN65@xmlRaiseEr: ; 632 : (channel == xmlParserValidityWarning)) ; 633 : xmlReportError(to, ctxt, str, NULL, NULL); push 0 push 0 push DWORD PTR _str$1$[ebp] push esi push edi call _xmlReportError add esp, 20 ; 00000014H $LN101@xmlRaiseEr: pop esi $LN67@xmlRaiseEr: pop edi ; 639 : } pop ebx mov esp, ebp pop ebp ret 0 ___xmlRaiseError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlCopyError _TEXT SEGMENT _str3$1$ = -12 ; size = 4 _str2$1$ = -8 ; size = 4 _str1$1$ = -4 ; size = 4 _file$1$ = 8 ; size = 4 _from$ = 8 ; size = 4 _to$ = 12 ; size = 4 _xmlCopyError PROC ; COMDAT ; 957 : xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) { push ebp mov ebp, esp sub esp, 12 ; 0000000cH mov ecx, OFFSET __67926DEE_error@c push esi push edi call @__CheckForDebuggerJustMyCode@4 mov edi, DWORD PTR _from$[ebp] test edi, edi je $LN3@xmlCopyErr ; 958 : char *message, *file, *str1, *str2, *str3; ; 959 : ; 960 : if ((from == NULL) || (to == NULL)) mov esi, DWORD PTR _to$[ebp] test esi, esi je $LN3@xmlCopyErr ; 962 : ; 963 : message = (char *) xmlStrdup((xmlChar *) from->message); push ebx push DWORD PTR [edi+8] call _xmlStrdup ; 964 : file = (char *) xmlStrdup ((xmlChar *) from->file); push DWORD PTR [edi+16] mov ebx, eax call _xmlStrdup ; 965 : str1 = (char *) xmlStrdup ((xmlChar *) from->str1); push DWORD PTR [edi+24] mov DWORD PTR _file$1$[ebp], eax call _xmlStrdup ; 966 : str2 = (char *) xmlStrdup ((xmlChar *) from->str2); push DWORD PTR [edi+28] mov DWORD PTR _str1$1$[ebp], eax call _xmlStrdup ; 967 : str3 = (char *) xmlStrdup ((xmlChar *) from->str3); push DWORD PTR [edi+32] mov DWORD PTR _str2$1$[ebp], eax call _xmlStrdup ; 968 : ; 969 : if (to->message != NULL) mov ecx, DWORD PTR [esi+8] add esp, 20 ; 00000014H mov DWORD PTR _str3$1$[ebp], eax test ecx, ecx je SHORT $LN4@xmlCopyErr ; 970 : xmlFree(to->message); push ecx call DWORD PTR _xmlFree add esp, 4 $LN4@xmlCopyErr: ; 971 : if (to->file != NULL) mov eax, DWORD PTR [esi+16] test eax, eax je SHORT $LN5@xmlCopyErr ; 972 : xmlFree(to->file); push eax call DWORD PTR _xmlFree add esp, 4 $LN5@xmlCopyErr: ; 973 : if (to->str1 != NULL) mov eax, DWORD PTR [esi+24] test eax, eax je SHORT $LN6@xmlCopyErr ; 974 : xmlFree(to->str1); push eax call DWORD PTR _xmlFree add esp, 4 $LN6@xmlCopyErr: ; 975 : if (to->str2 != NULL) mov eax, DWORD PTR [esi+28] test eax, eax je SHORT $LN7@xmlCopyErr ; 976 : xmlFree(to->str2); push eax call DWORD PTR _xmlFree add esp, 4 $LN7@xmlCopyErr: ; 977 : if (to->str3 != NULL) mov eax, DWORD PTR [esi+32] test eax, eax je SHORT $LN8@xmlCopyErr ; 978 : xmlFree(to->str3); push eax call DWORD PTR _xmlFree add esp, 4 $LN8@xmlCopyErr: ; 979 : to->domain = from->domain; mov eax, DWORD PTR [edi] mov DWORD PTR [esi], eax ; 980 : to->code = from->code; mov eax, DWORD PTR [edi+4] mov DWORD PTR [esi+4], eax ; 981 : to->level = from->level; mov eax, DWORD PTR [edi+12] mov DWORD PTR [esi+12], eax ; 982 : to->line = from->line; mov eax, DWORD PTR [edi+20] mov DWORD PTR [esi+20], eax ; 983 : to->node = from->node; mov eax, DWORD PTR [edi+48] mov DWORD PTR [esi+48], eax ; 984 : to->int1 = from->int1; mov eax, DWORD PTR [edi+36] mov DWORD PTR [esi+36], eax ; 985 : to->int2 = from->int2; mov eax, DWORD PTR [edi+40] mov DWORD PTR [esi+40], eax ; 986 : to->node = from->node; mov eax, DWORD PTR [edi+48] mov DWORD PTR [esi+48], eax ; 987 : to->ctxt = from->ctxt; mov eax, DWORD PTR [edi+44] mov DWORD PTR [esi+44], eax ; 988 : to->message = message; ; 989 : to->file = file; mov eax, DWORD PTR _file$1$[ebp] mov DWORD PTR [esi+16], eax ; 990 : to->str1 = str1; mov eax, DWORD PTR _str1$1$[ebp] mov DWORD PTR [esi+24], eax ; 991 : to->str2 = str2; mov eax, DWORD PTR _str2$1$[ebp] mov DWORD PTR [esi+8], ebx mov DWORD PTR [esi+28], eax ; 992 : to->str3 = str3; mov eax, DWORD PTR _str3$1$[ebp] ; 993 : ; 994 : return 0; pop ebx mov DWORD PTR [esi+32], eax xor eax, eax pop edi ; 995 : } pop esi mov esp, ebp pop ebp ret 0 $LN3@xmlCopyErr: pop edi ; 961 : return(-1); or eax, -1 ; 995 : } pop esi mov esp, ebp pop ebp ret 0 _xmlCopyError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlResetError _TEXT SEGMENT _err$ = 8 ; size = 4 _xmlResetError PROC ; COMDAT ; 874 : { push ebp mov ebp, esp push esi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov esi, DWORD PTR _err$[ebp] test esi, esi je SHORT $LN1@xmlResetEr ; 875 : if (err == NULL) ; 876 : return; ; 877 : if (err->code == XML_ERR_OK) cmp DWORD PTR [esi+4], 0 je SHORT $LN1@xmlResetEr ; 878 : return; ; 879 : if (err->message != NULL) mov eax, DWORD PTR [esi+8] test eax, eax je SHORT $LN4@xmlResetEr ; 880 : xmlFree(err->message); push eax call DWORD PTR _xmlFree add esp, 4 $LN4@xmlResetEr: ; 881 : if (err->file != NULL) mov eax, DWORD PTR [esi+16] test eax, eax je SHORT $LN5@xmlResetEr ; 882 : xmlFree(err->file); push eax call DWORD PTR _xmlFree add esp, 4 $LN5@xmlResetEr: ; 883 : if (err->str1 != NULL) mov eax, DWORD PTR [esi+24] test eax, eax je SHORT $LN6@xmlResetEr ; 884 : xmlFree(err->str1); push eax call DWORD PTR _xmlFree add esp, 4 $LN6@xmlResetEr: ; 885 : if (err->str2 != NULL) mov eax, DWORD PTR [esi+28] test eax, eax je SHORT $LN7@xmlResetEr ; 886 : xmlFree(err->str2); push eax call DWORD PTR _xmlFree add esp, 4 $LN7@xmlResetEr: ; 887 : if (err->str3 != NULL) mov eax, DWORD PTR [esi+32] test eax, eax je SHORT $LN8@xmlResetEr ; 888 : xmlFree(err->str3); push eax call DWORD PTR _xmlFree add esp, 4 $LN8@xmlResetEr: ; 889 : memset(err, 0, sizeof(xmlError)); push 52 ; 00000034H push 0 push esi call _memset add esp, 12 ; 0000000cH $LN1@xmlResetEr: pop esi ; 890 : err->code = XML_ERR_OK; ; 891 : } pop ebp ret 0 _xmlResetError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlCtxtResetLastError _TEXT SEGMENT _ctx$ = 8 ; size = 4 _xmlCtxtResetLastError PROC ; COMDAT ; 936 : { push ebp mov ebp, esp mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov eax, DWORD PTR _ctx$[ebp] test eax, eax je SHORT $LN1@xmlCtxtRes ; 937 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 938 : ; 939 : if (ctxt == NULL) ; 940 : return; ; 941 : ctxt->errNo = XML_ERR_OK; cmp DWORD PTR [eax+388], 0 mov DWORD PTR [eax+84], 0 ; 942 : if (ctxt->lastError.code == XML_ERR_OK) je SHORT $LN1@xmlCtxtRes ; 943 : return; ; 944 : xmlResetError(&ctxt->lastError); add eax, 384 ; 00000180H mov DWORD PTR _ctx$[ebp], eax ; 945 : } pop ebp ; 943 : return; ; 944 : xmlResetError(&ctxt->lastError); jmp _xmlResetError $LN1@xmlCtxtRes: ; 945 : } pop ebp ret 0 _xmlCtxtResetLastError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlCtxtGetLastError _TEXT SEGMENT _ctx$ = 8 ; size = 4 _xmlCtxtGetLastError PROC ; COMDAT ; 917 : { push ebp mov ebp, esp mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov eax, DWORD PTR _ctx$[ebp] test eax, eax je SHORT $LN5@xmlCtxtGet ; 918 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 919 : ; 920 : if (ctxt == NULL) ; 921 : return (NULL); ; 922 : if (ctxt->lastError.code == XML_ERR_OK) cmp DWORD PTR [eax+388], 0 je SHORT $LN5@xmlCtxtGet ; 924 : return (&ctxt->lastError); add eax, 384 ; 00000180H ; 925 : } pop ebp ret 0 $LN5@xmlCtxtGet: ; 923 : return (NULL); xor eax, eax ; 925 : } pop ebp ret 0 _xmlCtxtGetLastError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlResetLastError _TEXT SEGMENT _xmlResetLastError PROC ; COMDAT mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlLastError cmp DWORD PTR [eax+4], 0 je SHORT $LN1@xmlResetLa ; 902 : if (xmlLastError.code == XML_ERR_OK) ; 903 : return; ; 904 : xmlResetError(&xmlLastError); call ___xmlLastError push eax call _xmlResetError pop ecx $LN1@xmlResetLa: ; 905 : } ret 0 _xmlResetLastError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlGetLastError _TEXT SEGMENT _xmlGetLastError PROC ; COMDAT mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlLastError cmp DWORD PTR [eax+4], 0 jne SHORT $LN2@xmlGetLast ; 861 : if (xmlLastError.code == XML_ERR_OK) ; 862 : return (NULL); xor eax, eax ; 864 : } ret 0 $LN2@xmlGetLast: ; 863 : return (&xmlLastError); jmp ___xmlLastError _xmlGetLastError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserPrintFileContext _TEXT SEGMENT _input$ = 8 ; size = 4 _xmlParserPrintFileContext PROC ; COMDAT ; 230 : xmlParserPrintFileContext(xmlParserInputPtr input) { push ebp mov ebp, esp push esi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push DWORD PTR _input$[ebp] call _xmlParserPrintFileContextInternal add esp, 12 ; 0000000cH pop esi ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, ; 232 : xmlGenericErrorContext); ; 233 : } pop ebp ret 0 _xmlParserPrintFileContext ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserPrintFileInfo _TEXT SEGMENT tv184 = 8 ; size = 4 _input$ = 8 ; size = 4 _xmlParserPrintFileInfo PROC ; COMDAT ; 153 : xmlParserPrintFileInfo(xmlParserInputPtr input) { push ebp mov ebp, esp push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov edi, DWORD PTR _input$[ebp] test edi, edi je SHORT $LN4@xmlParserP ; 154 : if (input != NULL) { ; 155 : if (input->filename) push ebx push esi mov esi, DWORD PTR [edi+4] call ___xmlGenericError mov ebx, eax mov eax, DWORD PTR [edi+28] mov DWORD PTR tv184[ebp], eax test esi, esi je SHORT $LN3@xmlParserP ; 156 : xmlGenericError(xmlGenericErrorContext, mov esi, DWORD PTR [edi+4] call ___xmlGenericErrorContext push DWORD PTR tv184[ebp] push esi push OFFSET ??_C@_07FCDHCGBN@?$CFs?3?$CFd?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [ebx] call eax add esp, 16 ; 00000010H pop esi pop ebx pop edi ; 161 : "Entity: line %d: ", input->line); ; 162 : } ; 163 : } pop ebp ret 0 $LN3@xmlParserP: ; 157 : "%s:%d: ", input->filename, ; 158 : input->line); ; 159 : else ; 160 : xmlGenericError(xmlGenericErrorContext, call ___xmlGenericErrorContext push DWORD PTR tv184[ebp] push OFFSET ??_C@_0BC@FMCMLLAH@Entity?3?5line?5?$CFd?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [ebx] call eax add esp, 12 ; 0000000cH pop esi pop ebx $LN4@xmlParserP: pop edi ; 161 : "Entity: line %d: ", input->line); ; 162 : } ; 163 : } pop ebp ret 0 _xmlParserPrintFileInfo ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserValidityWarning _TEXT SEGMENT _prev_size$1$ = -8 ; size = 4 _input$1$ = -4 ; size = 4 _ctx$ = 8 ; size = 4 _msg$ = 12 ; size = 4 _xmlParserValidityWarning PROC ; COMDAT ; 818 : { push ebp mov ebp, esp sub esp, 8 push ebx push esi push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 push DWORD PTR _msg$[ebp] mov DWORD PTR _input$1$[ebp], 0 call _xmlStrlen mov edi, DWORD PTR _ctx$[ebp] add esp, 4 test edi, edi je SHORT $LN4@xmlParserV ; 819 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 820 : xmlParserInputPtr input = NULL; ; 821 : char * str; ; 822 : int len = xmlStrlen((const xmlChar *) msg); ; 823 : ; 824 : if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) { test eax, eax je SHORT $LN4@xmlParserV mov ecx, DWORD PTR _msg$[ebp] cmp BYTE PTR [eax+ecx-1], 58 ; 0000003aH je SHORT $LN4@xmlParserV ; 825 : input = ctxt->input; mov eax, DWORD PTR [edi+36] mov DWORD PTR _input$1$[ebp], eax ; 826 : if ((input->filename == NULL) && (ctxt->inputNr > 1)) cmp DWORD PTR [eax+4], 0 jne SHORT $LN5@xmlParserV mov ecx, DWORD PTR [edi+40] cmp ecx, 1 jle SHORT $LN5@xmlParserV ; 827 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR [edi+48] mov eax, DWORD PTR [eax+ecx*4-8] mov DWORD PTR _input$1$[ebp], eax $LN5@xmlParserV: ; 828 : ; 829 : xmlParserPrintFileInfo(input); push eax call _xmlParserPrintFileInfo add esp, 4 $LN4@xmlParserV: ; 830 : } ; 831 : ; 832 : xmlGenericError(xmlGenericErrorContext, "validity warning: "); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_0BD@BMEBJKPI@validity?5warning?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax ; 833 : XML_GET_VAR_STR(msg, str); push 150 ; 00000096H mov DWORD PTR _prev_size$1$[ebp], -1 call DWORD PTR _xmlMalloc mov ebx, eax add esp, 12 ; 0000000cH test ebx, ebx je SHORT $LN21@xmlParserV mov esi, 150 ; 00000096H $LL2@xmlParserV: mov edi, DWORD PTR _msg$[ebp] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 1440 : int const _Result = __stdio_common_vsprintf( call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 mov ecx, DWORD PTR [eax] push edi push esi push ebx push DWORD PTR [eax+4] or ecx, 2 push ecx call DWORD PTR __imp____stdio_common_vsprintf add esp, 28 ; 0000001cH ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; mov ecx, -1 test eax, eax cmovs eax, ecx ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 833 : XML_GET_VAR_STR(msg, str); cmp eax, ecx jle SHORT $LN10@xmlParserV cmp eax, esi jge SHORT $LN9@xmlParserV cmp DWORD PTR _prev_size$1$[ebp], eax je SHORT $LN26@xmlParserV mov DWORD PTR _prev_size$1$[ebp], eax $LN9@xmlParserV: inc esi add esi, eax jmp SHORT $LN11@xmlParserV $LN10@xmlParserV: add esi, 100 ; 00000064H $LN11@xmlParserV: push esi push ebx call DWORD PTR _xmlRealloc add esp, 8 test eax, eax je SHORT $LN26@xmlParserV mov ebx, eax cmp esi, 64000 ; 0000fa00H jl SHORT $LL2@xmlParserV $LN26@xmlParserV: mov edi, DWORD PTR _ctx$[ebp] $LN21@xmlParserV: ; 834 : xmlGenericError(xmlGenericErrorContext, "%s", str); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push ebx push OFFSET ??_C@_02DKCKIIND@?$CFs@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax add esp, 12 ; 0000000cH ; 835 : if (str != NULL) test ebx, ebx je SHORT $LN13@xmlParserV ; 836 : xmlFree(str); push ebx call DWORD PTR _xmlFree add esp, 4 $LN13@xmlParserV: ; 837 : ; 838 : if (ctxt != NULL) { test edi, edi je SHORT $LN18@xmlParserV ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push DWORD PTR _input$1$[ebp] call _xmlParserPrintFileContextInternal add esp, 12 ; 0000000cH $LN18@xmlParserV: pop edi ; 839 : xmlParserPrintFileContext(input); ; 840 : } ; 841 : } pop esi pop ebx mov esp, ebp pop ebp ret 0 _xmlParserValidityWarning ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserValidityError _TEXT SEGMENT _prev_size$1$ = -8 ; size = 4 _input$1$ = -4 ; size = 4 _ctx$ = 8 ; size = 4 _msg$ = 12 ; size = 4 _xmlParserValidityError PROC ; COMDAT ; 774 : { push ebp mov ebp, esp sub esp, 8 push ebx push esi push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 push DWORD PTR _msg$[ebp] mov DWORD PTR _input$1$[ebp], 0 call _xmlStrlen add esp, 4 cmp eax, 1 jle SHORT $LN4@xmlParserV ; 775 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 776 : xmlParserInputPtr input = NULL; ; 777 : char * str; ; 778 : int len = xmlStrlen((const xmlChar *) msg); ; 779 : static int had_info = 0; ; 780 : ; 781 : if ((len > 1) && (msg[len - 2] != ':')) { mov ecx, DWORD PTR _msg$[ebp] cmp BYTE PTR [eax+ecx-2], 58 ; 0000003aH je SHORT $LN4@xmlParserV ; 782 : if (ctxt != NULL) { mov eax, DWORD PTR _ctx$[ebp] test eax, eax je SHORT $LN8@xmlParserV ; 783 : input = ctxt->input; mov ebx, DWORD PTR [eax+36] mov DWORD PTR _input$1$[ebp], ebx ; 784 : if ((input->filename == NULL) && (ctxt->inputNr > 1)) cmp DWORD PTR [ebx+4], 0 jne SHORT $LN7@xmlParserV mov ecx, DWORD PTR [eax+40] cmp ecx, 1 jle SHORT $LN7@xmlParserV ; 785 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR [eax+48] mov ebx, DWORD PTR [eax+ecx*4-8] mov DWORD PTR _input$1$[ebp], ebx $LN7@xmlParserV: ; 786 : ; 787 : if (had_info == 0) { cmp DWORD PTR ?had_info@?1??xmlParserValidityError@@9@9, 0 jne SHORT $LN8@xmlParserV ; 788 : xmlParserPrintFileInfo(input); push ebx call _xmlParserPrintFileInfo add esp, 4 $LN8@xmlParserV: ; 789 : } ; 790 : } ; 791 : xmlGenericError(xmlGenericErrorContext, "validity error: "); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_0BB@DJCEBDOI@validity?5error?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax add esp, 8 ; 792 : had_info = 0; xor eax, eax ; 793 : } else { jmp SHORT $LN5@xmlParserV $LN4@xmlParserV: ; 794 : had_info = 1; mov eax, 1 $LN5@xmlParserV: ; 797 : XML_GET_VAR_STR(msg, str); push 150 ; 00000096H mov DWORD PTR ?had_info@?1??xmlParserValidityError@@9@9, eax mov DWORD PTR _prev_size$1$[ebp], -1 call DWORD PTR _xmlMalloc mov ebx, eax add esp, 4 test ebx, ebx je SHORT $LN29@xmlParserV mov esi, 150 ; 00000096H $LL2@xmlParserV: mov edi, DWORD PTR _msg$[ebp] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 1440 : int const _Result = __stdio_common_vsprintf( call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 mov ecx, DWORD PTR [eax] push edi push esi push ebx push DWORD PTR [eax+4] or ecx, 2 push ecx call DWORD PTR __imp____stdio_common_vsprintf add esp, 28 ; 0000001cH ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; mov ecx, -1 test eax, eax cmovs eax, ecx ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 797 : XML_GET_VAR_STR(msg, str); cmp eax, ecx jle SHORT $LN13@xmlParserV cmp eax, esi jge SHORT $LN12@xmlParserV cmp DWORD PTR _prev_size$1$[ebp], eax je SHORT $LN29@xmlParserV mov DWORD PTR _prev_size$1$[ebp], eax $LN12@xmlParserV: inc esi add esi, eax jmp SHORT $LN14@xmlParserV $LN13@xmlParserV: add esi, 100 ; 00000064H $LN14@xmlParserV: push esi push ebx call DWORD PTR _xmlRealloc add esp, 8 test eax, eax je SHORT $LN29@xmlParserV mov ebx, eax cmp esi, 64000 ; 0000fa00H jl SHORT $LL2@xmlParserV $LN29@xmlParserV: ; 798 : xmlGenericError(xmlGenericErrorContext, "%s", str); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push ebx push OFFSET ??_C@_02DKCKIIND@?$CFs@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax add esp, 12 ; 0000000cH ; 799 : if (str != NULL) test ebx, ebx je SHORT $LN16@xmlParserV ; 800 : xmlFree(str); push ebx call DWORD PTR _xmlFree add esp, 4 $LN16@xmlParserV: ; 801 : ; 802 : if ((ctxt != NULL) && (input != NULL)) { cmp DWORD PTR _ctx$[ebp], 0 je SHORT $LN21@xmlParserV mov edi, DWORD PTR _input$1$[ebp] test edi, edi je SHORT $LN21@xmlParserV ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push edi call _xmlParserPrintFileContextInternal add esp, 12 ; 0000000cH $LN21@xmlParserV: pop edi ; 803 : xmlParserPrintFileContext(input); ; 804 : } ; 805 : } pop esi pop ebx mov esp, ebp pop ebp ret 0 _xmlParserValidityError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserWarning _TEXT SEGMENT _cur$1$ = -12 ; size = 4 _prev_size$1$ = -8 ; size = 4 _input$1$ = -4 ; size = 4 _ctx$ = 8 ; size = 4 _msg$ = 12 ; size = 4 _xmlParserWarning PROC ; COMDAT ; 725 : { push ebp mov ebp, esp sub esp, 12 ; 0000000cH push ebx push esi push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov eax, DWORD PTR _ctx$[ebp] xor edi, edi mov DWORD PTR _input$1$[ebp], 0 mov DWORD PTR _cur$1$[ebp], edi test eax, eax je SHORT $LN4@xmlParserW ; 726 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 727 : xmlParserInputPtr input = NULL; ; 728 : xmlParserInputPtr cur = NULL; ; 729 : char * str; ; 730 : ; 731 : if (ctxt != NULL) { ; 732 : input = ctxt->input; mov edi, DWORD PTR [eax+36] mov DWORD PTR _input$1$[ebp], edi ; 733 : if ((input != NULL) && (input->filename == NULL) && test edi, edi je SHORT $LN5@xmlParserW cmp DWORD PTR [edi+4], 0 jne SHORT $LN5@xmlParserW mov ecx, DWORD PTR [eax+40] cmp ecx, 1 jle SHORT $LN5@xmlParserW ; 734 : (ctxt->inputNr > 1)) { ; 735 : cur = input; ; 736 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR [eax+48] mov DWORD PTR _cur$1$[ebp], edi mov edi, DWORD PTR [eax+ecx*4-8] mov DWORD PTR _input$1$[ebp], edi $LN5@xmlParserW: ; 737 : } ; 738 : xmlParserPrintFileInfo(input); push edi call _xmlParserPrintFileInfo add esp, 4 $LN4@xmlParserW: ; 739 : } ; 740 : ; 741 : xmlGenericError(xmlGenericErrorContext, "warning: "); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_09GFHECBDK@warning?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax ; 742 : XML_GET_VAR_STR(msg, str); push 150 ; 00000096H mov DWORD PTR _prev_size$1$[ebp], -1 call DWORD PTR _xmlMalloc mov ebx, eax add esp, 12 ; 0000000cH test ebx, ebx je SHORT $LN29@xmlParserW mov esi, 150 ; 00000096H npad 5 $LL2@xmlParserW: mov edi, DWORD PTR _msg$[ebp] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 1440 : int const _Result = __stdio_common_vsprintf( call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 mov ecx, DWORD PTR [eax] push edi push esi push ebx push DWORD PTR [eax+4] or ecx, 2 push ecx call DWORD PTR __imp____stdio_common_vsprintf add esp, 28 ; 0000001cH ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; mov ecx, -1 test eax, eax cmovs eax, ecx ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 742 : XML_GET_VAR_STR(msg, str); cmp eax, ecx jle SHORT $LN10@xmlParserW cmp eax, esi jge SHORT $LN9@xmlParserW cmp DWORD PTR _prev_size$1$[ebp], eax je SHORT $LN29@xmlParserW mov DWORD PTR _prev_size$1$[ebp], eax $LN9@xmlParserW: inc esi add esi, eax jmp SHORT $LN11@xmlParserW $LN10@xmlParserW: add esi, 100 ; 00000064H $LN11@xmlParserW: push esi push ebx call DWORD PTR _xmlRealloc add esp, 8 test eax, eax je SHORT $LN29@xmlParserW mov ebx, eax cmp esi, 64000 ; 0000fa00H jl SHORT $LL2@xmlParserW $LN29@xmlParserW: ; 743 : xmlGenericError(xmlGenericErrorContext, "%s", str); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push ebx push OFFSET ??_C@_02DKCKIIND@?$CFs@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax add esp, 12 ; 0000000cH ; 744 : if (str != NULL) test ebx, ebx je SHORT $LN13@xmlParserW ; 745 : xmlFree(str); push ebx call DWORD PTR _xmlFree add esp, 4 $LN13@xmlParserW: ; 746 : ; 747 : if (ctxt != NULL) { cmp DWORD PTR _ctx$[ebp], 0 je SHORT $LN21@xmlParserW ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push DWORD PTR _input$1$[ebp] call _xmlParserPrintFileContextInternal ; 748 : xmlParserPrintFileContext(input); ; 749 : if (cur != NULL) { mov ebx, DWORD PTR _cur$1$[ebp] ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, add esp, 12 ; 0000000cH ; 748 : xmlParserPrintFileContext(input); ; 749 : if (cur != NULL) { test ebx, ebx je SHORT $LN21@xmlParserW ; 750 : xmlParserPrintFileInfo(cur); push ebx call _xmlParserPrintFileInfo ; 751 : xmlGenericError(xmlGenericErrorContext, "\n"); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_01EEMJAFIK@?6@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push ebx call _xmlParserPrintFileContextInternal add esp, 24 ; 00000018H $LN21@xmlParserW: pop edi ; 752 : xmlParserPrintFileContext(cur); ; 753 : } ; 754 : } ; 755 : } pop esi pop ebx mov esp, ebp pop ebp ret 0 _xmlParserWarning ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlParserError _TEXT SEGMENT _cur$1$ = -12 ; size = 4 _prev_size$1$ = -8 ; size = 4 _input$1$ = -4 ; size = 4 _ctx$ = 8 ; size = 4 _msg$ = 12 ; size = 4 _xmlParserError PROC ; COMDAT ; 682 : { push ebp mov ebp, esp sub esp, 12 ; 0000000cH push ebx push esi push edi mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 mov eax, DWORD PTR _ctx$[ebp] xor edi, edi mov DWORD PTR _input$1$[ebp], 0 mov DWORD PTR _cur$1$[ebp], edi test eax, eax je SHORT $LN4@xmlParserE ; 683 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; ; 684 : xmlParserInputPtr input = NULL; ; 685 : xmlParserInputPtr cur = NULL; ; 686 : char * str; ; 687 : ; 688 : if (ctxt != NULL) { ; 689 : input = ctxt->input; mov edi, DWORD PTR [eax+36] mov DWORD PTR _input$1$[ebp], edi ; 690 : if ((input != NULL) && (input->filename == NULL) && test edi, edi je SHORT $LN5@xmlParserE cmp DWORD PTR [edi+4], 0 jne SHORT $LN5@xmlParserE mov ecx, DWORD PTR [eax+40] cmp ecx, 1 jle SHORT $LN5@xmlParserE ; 691 : (ctxt->inputNr > 1)) { ; 692 : cur = input; ; 693 : input = ctxt->inputTab[ctxt->inputNr - 2]; mov eax, DWORD PTR [eax+48] mov DWORD PTR _cur$1$[ebp], edi mov edi, DWORD PTR [eax+ecx*4-8] mov DWORD PTR _input$1$[ebp], edi $LN5@xmlParserE: ; 694 : } ; 695 : xmlParserPrintFileInfo(input); push edi call _xmlParserPrintFileInfo add esp, 4 $LN4@xmlParserE: ; 696 : } ; 697 : ; 698 : xmlGenericError(xmlGenericErrorContext, "error: "); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_07FJOHCPOO@error?3?5@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax ; 699 : XML_GET_VAR_STR(msg, str); push 150 ; 00000096H mov DWORD PTR _prev_size$1$[ebp], -1 call DWORD PTR _xmlMalloc mov ebx, eax add esp, 12 ; 0000000cH test ebx, ebx je SHORT $LN29@xmlParserE mov esi, 150 ; 00000096H npad 5 $LL2@xmlParserE: mov edi, DWORD PTR _msg$[ebp] ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; 1440 : int const _Result = __stdio_common_vsprintf( call ___local_stdio_printf_options lea ecx, DWORD PTR _msg$[ebp+4] push ecx push 0 mov ecx, DWORD PTR [eax] push edi push esi push ebx push DWORD PTR [eax+4] or ecx, 2 push ecx call DWORD PTR __imp____stdio_common_vsprintf add esp, 28 ; 0000001cH ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; mov ecx, -1 test eax, eax cmovs eax, ecx ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; 699 : XML_GET_VAR_STR(msg, str); cmp eax, ecx jle SHORT $LN10@xmlParserE cmp eax, esi jge SHORT $LN9@xmlParserE cmp DWORD PTR _prev_size$1$[ebp], eax je SHORT $LN29@xmlParserE mov DWORD PTR _prev_size$1$[ebp], eax $LN9@xmlParserE: inc esi add esi, eax jmp SHORT $LN11@xmlParserE $LN10@xmlParserE: add esi, 100 ; 00000064H $LN11@xmlParserE: push esi push ebx call DWORD PTR _xmlRealloc add esp, 8 test eax, eax je SHORT $LN29@xmlParserE mov ebx, eax cmp esi, 64000 ; 0000fa00H jl SHORT $LL2@xmlParserE $LN29@xmlParserE: ; 700 : xmlGenericError(xmlGenericErrorContext, "%s", str); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push ebx push OFFSET ??_C@_02DKCKIIND@?$CFs@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax add esp, 12 ; 0000000cH ; 701 : if (str != NULL) test ebx, ebx je SHORT $LN13@xmlParserE ; 702 : xmlFree(str); push ebx call DWORD PTR _xmlFree add esp, 4 $LN13@xmlParserE: ; 703 : ; 704 : if (ctxt != NULL) { cmp DWORD PTR _ctx$[ebp], 0 je SHORT $LN21@xmlParserE ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push DWORD PTR _input$1$[ebp] call _xmlParserPrintFileContextInternal ; 705 : xmlParserPrintFileContext(input); ; 706 : if (cur != NULL) { mov ebx, DWORD PTR _cur$1$[ebp] ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, add esp, 12 ; 0000000cH ; 705 : xmlParserPrintFileContext(input); ; 706 : if (cur != NULL) { test ebx, ebx je SHORT $LN21@xmlParserE ; 707 : xmlParserPrintFileInfo(cur); push ebx call _xmlParserPrintFileInfo ; 708 : xmlGenericError(xmlGenericErrorContext, "\n"); call ___xmlGenericError mov esi, eax call ___xmlGenericErrorContext push OFFSET ??_C@_01EEMJAFIK@?6@ push DWORD PTR [eax] mov eax, DWORD PTR [esi] call eax ; 231 : xmlParserPrintFileContextInternal(input, xmlGenericError, call ___xmlGenericErrorContext mov esi, DWORD PTR [eax] call ___xmlGenericError push esi push DWORD PTR [eax] push ebx call _xmlParserPrintFileContextInternal add esp, 24 ; 00000018H $LN21@xmlParserE: pop edi ; 709 : xmlParserPrintFileContext(cur); ; 710 : } ; 711 : } ; 712 : } pop esi pop ebx mov esp, ebp pop ebp ret 0 _xmlParserError ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlSetStructuredErrorFunc _TEXT SEGMENT _ctx$ = 8 ; size = 4 _handler$ = 12 ; size = 4 _xmlSetStructuredErrorFunc PROC ; COMDAT ; 134 : xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { push ebp mov ebp, esp mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlStructuredErrorContext mov ecx, DWORD PTR _ctx$[ebp] mov DWORD PTR [eax], ecx call ___xmlStructuredError mov ecx, DWORD PTR _handler$[ebp] mov DWORD PTR [eax], ecx ; 135 : xmlStructuredErrorContext = ctx; ; 136 : xmlStructuredError = handler; ; 137 : } pop ebp ret 0 _xmlSetStructuredErrorFunc ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _initGenericErrorDefaultFunc _TEXT SEGMENT _handler$ = 8 ; size = 4 _initGenericErrorDefaultFunc PROC ; COMDAT ; 91 : { push ebp mov ebp, esp mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlGenericError mov ecx, eax mov eax, DWORD PTR _handler$[ebp] test eax, eax jne SHORT $LN2@initGeneri ; 96 : } mov DWORD PTR [ecx], OFFSET _xmlGenericErrorDefaultFunc pop ebp ret 0 $LN2@initGeneri: ; 92 : if (handler == NULL) ; 93 : xmlGenericError = xmlGenericErrorDefaultFunc; ; 94 : else ; 95 : xmlGenericError = (*handler); mov eax, DWORD PTR [eax] ; 96 : } mov DWORD PTR [ecx], eax pop ebp ret 0 _initGenericErrorDefaultFunc ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\error.c ; COMDAT _xmlSetGenericErrorFunc _TEXT SEGMENT _ctx$ = 8 ; size = 4 _handler$ = 12 ; size = 4 _xmlSetGenericErrorFunc PROC ; COMDAT ; 113 : xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { push ebp mov ebp, esp push esi mov esi, DWORD PTR _handler$[ebp] mov ecx, OFFSET __67926DEE_error@c call @__CheckForDebuggerJustMyCode@4 call ___xmlGenericErrorContext mov ecx, DWORD PTR _ctx$[ebp] mov DWORD PTR [eax], ecx call ___xmlGenericError test esi, esi mov ecx, OFFSET _xmlGenericErrorDefaultFunc cmove esi, ecx mov DWORD PTR [eax], esi pop esi ; 114 : xmlGenericErrorContext = ctx; ; 115 : if (handler != NULL) ; 116 : xmlGenericError = handler; ; 117 : else ; 118 : xmlGenericError = xmlGenericErrorDefaultFunc; ; 119 : } pop ebp ret 0 _xmlSetGenericErrorFunc ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; COMDAT _vsnprintf _TEXT SEGMENT __Buffer$ = 8 ; size = 4 __BufferCount$ = 12 ; size = 4 __Format$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 _vsnprintf PROC ; COMDAT ; 1439 : { push ebp mov ebp, esp mov ecx, OFFSET __A452D4A0_stdio@h call @__CheckForDebuggerJustMyCode@4 call ___local_stdio_printf_options push DWORD PTR __ArgList$[ebp] mov ecx, eax push 0 push DWORD PTR __Format$[ebp] push DWORD PTR __BufferCount$[ebp] mov eax, DWORD PTR [ecx] push DWORD PTR __Buffer$[ebp] or eax, 2 push DWORD PTR [ecx+4] push eax call DWORD PTR __imp____stdio_common_vsprintf or ecx, -1 add esp, 28 ; 0000001cH test eax, eax cmovs eax, ecx ; 1440 : int const _Result = __stdio_common_vsprintf( ; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, ; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList); ; 1443 : ; 1444 : return _Result < 0 ? -1 : _Result; ; 1445 : } pop ebp ret 0 _vsnprintf ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; COMDAT _fprintf _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 _fprintf PROC ; COMDAT ; 835 : { push ebp mov ebp, esp push esi mov ecx, OFFSET __A452D4A0_stdio@h call @__CheckForDebuggerJustMyCode@4 mov esi, DWORD PTR __Format$[ebp] ; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); call ___local_stdio_printf_options lea ecx, DWORD PTR __Format$[ebp+4] push ecx push 0 push esi push DWORD PTR __Stream$[ebp] push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H ; 836 : int _Result; ; 837 : va_list _ArgList; ; 838 : __crt_va_start(_ArgList, _Format); ; 839 : _Result = _vfprintf_l(_Stream, _Format, NULL, _ArgList); ; 840 : __crt_va_end(_ArgList); ; 841 : return _Result; pop esi ; 842 : } pop ebp ret 0 _fprintf ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; COMDAT _vfprintf _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __ArgList$ = 16 ; size = 4 _vfprintf PROC ; COMDAT ; 656 : { push ebp mov ebp, esp mov ecx, OFFSET __A452D4A0_stdio@h call @__CheckForDebuggerJustMyCode@4 ; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); call ___local_stdio_printf_options push DWORD PTR __ArgList$[ebp] push 0 push DWORD PTR __Format$[ebp] push DWORD PTR __Stream$[ebp] push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H ; 657 : return _vfprintf_l(_Stream, _Format, NULL, _ArgList); ; 658 : } pop ebp ret 0 _vfprintf ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h ; COMDAT __vfprintf_l _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __Locale$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 __vfprintf_l PROC ; COMDAT ; 642 : { push ebp mov ebp, esp mov ecx, OFFSET __A452D4A0_stdio@h call @__CheckForDebuggerJustMyCode@4 call ___local_stdio_printf_options push DWORD PTR __ArgList$[ebp] push DWORD PTR __Locale$[ebp] push DWORD PTR __Format$[ebp] push DWORD PTR __Stream$[ebp] push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H ; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); ; 644 : } pop ebp ret 0 __vfprintf_l ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h ; COMDAT ___local_stdio_printf_options _TEXT SEGMENT ___local_stdio_printf_options PROC ; COMDAT mov ecx, OFFSET __2CC6E67D_corecrt_stdio_config@h call @__CheckForDebuggerJustMyCode@4 mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage ret 0 ___local_stdio_printf_options ENDP _TEXT ENDS END
oeis/222/A222963.asm
neoneye/loda-programs
11
11880
<reponame>neoneye/loda-programs ; A222963: a(n) = (p-3)*(p+3)/4 where p is the n-th prime. ; Submitted by <NAME> ; 0,4,10,28,40,70,88,130,208,238,340,418,460,550,700,868,928,1120,1258,1330,1558,1720,1978,2350,2548,2650,2860,2968,3190,4030,4288,4690,4828,5548,5698,6160,6640,6970,7480,8008,8188,9118,9310,9700,9898,11128,12430,12880,13108,13570,14278,14518,15748,16510,17290,18088,18358,19180,19738,20020,21460,23560,24178,24490,25120,27388,28390,30100,30448,31150,32218,33670,34780,35908,36670,37828,39400,40198,41818,43888,44308,46438,46870,48178,49060,50398,52210,53128,53590,54520,57358,59290,60268,62248,63250 seq $0,65091 ; Odd primes. pow $0,2 sub $0,9 div $0,4
demos/dns/dns.adb
stcarrez/ada-enet
16
18250
<reponame>stcarrez/ada-enet<gh_stars>10-100 ----------------------------------------------------------------------- -- dns -- DNS Example -- Copyright (C) 2016, 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Real_Time; with Interfaces; with STM32.Board; with HAL.Bitmap; with Net.Buffers; with Net.Utils; with Net.Protos.Arp; with Net.DNS; with Net.DHCP; with Receiver; with Dns_List; with Demos; pragma Unreferenced (Receiver); -- == DNS Application == -- The <b>DNS</b> application resolves several domain names by using the DNS client and it -- displays the IPv4 address that was resolved. It periodically resolve the names and -- also displays the TTL associated with the response. -- -- The application has two tasks. The main task loops to manage the refresh of the STM32 -- display and send the DNS resolution requests regularly. The second task is responsible for -- waiting of Ethernet packets, analyzing them to handle ARP and DNS response packets. procedure Dns is use type Interfaces.Unsigned_32; use type Net.Ip_Addr; use type Ada.Real_Time.Time; use type Ada.Real_Time.Time_Span; procedure Refresh; procedure Header; function Get_Status (Query : in Net.DNS.Query) return String; function Get_Status (Query : in Net.DNS.Query) return String is use type Net.DNS.Status_Type; S : constant Net.DNS.Status_Type := Query.Get_Status; begin if S = Net.DNS.PENDING then return "..."; elsif S = Net.DNS.NOERROR then return "OK"; elsif S = Net.DNS.NOQUERY then return ""; else return "FAIL"; end if; end Get_Status; procedure Refresh is use type Net.DHCP.State_Type; Y : Natural := 90; Status : Net.Error_Code; pragma Unreferenced (Status); begin for I in Dns_List.Queries'Range loop if Dns_List.Queries (I).Get_Name'Length > 0 then Demos.Put (0, Y, Dns_List.Queries (I).Get_Name); Demos.Put (180, Y, Net.Utils.To_String (Dns_List.Queries (I).Get_Ip)); Demos.Put (330, Y, Get_Status (Dns_List.Queries (I))); Demos.Put (400, Y, Net.Uint32'Image (Dns_List.Queries (I).Get_Ttl)); -- Put (250, Y, Net.Uint64 (Hosts (I).Seq)); -- Demos.Put (400, Y, Net.Uint64 (Dns_List.Queries (I).)); Y := Y + 16; end if; end loop; Demos.Refresh_Ifnet_Stats; STM32.Board.Display.Update_Layer (1); if Demos.Dhcp.Get_State = Net.DHCP.STATE_BOUND then Dns_List.Queries (1).Resolve (Demos.Ifnet'Access, "www.google.com", Status); Dns_List.Queries (2).Resolve (Demos.Ifnet'Access, "www.facebook.com", Status); Dns_List.Queries (3).Resolve (Demos.Ifnet'Access, "www.apple.com", Status); Dns_List.Queries (4).Resolve (Demos.Ifnet'Access, "www.adacore.com", Status); Dns_List.Queries (5).Resolve (Demos.Ifnet'Access, "github.com", Status); Dns_List.Queries (6).Resolve (Demos.Ifnet'Access, "www.twitter.com", Status); Dns_List.Queries (7).Resolve (Demos.Ifnet'Access, "www.kalabosse.com", Status); end if; end Refresh; procedure Header is null; procedure Initialize is new Demos.Initialize (Header); -- The display refresh period. REFRESH_PERIOD : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds (1000); -- Refresh display deadline. Display_Deadline : Ada.Real_Time.Time; Dhcp_Deadline : Ada.Real_Time.Time; begin Initialize ("STM32 DNS"); Display_Deadline := Ada.Real_Time.Clock; loop Net.Protos.Arp.Timeout (Demos.Ifnet); Demos.Dhcp.Process (Dhcp_Deadline); if Display_Deadline < Ada.Real_Time.Clock then Refresh; Display_Deadline := Display_Deadline + REFRESH_PERIOD; end if; if Dhcp_Deadline < Display_Deadline then delay until Dhcp_Deadline; else delay until Display_Deadline; end if; end loop; end Dns;
oeis/060/A060896.asm
neoneye/loda-programs
11
165778
<reponame>neoneye/loda-programs ; A060896: n^12 - n^6 + 1. ; 1,1,4033,530713,16773121,244125001,2176735681,13841169553,68719214593,282429005041,999999000001,3138426605161,8916097462273,23298080295673,56693904845761,129746326500001,281474959933441,582622213092193,1156831347413953,2213314872020281,4095999936000001,7355827425620521,12855002517669313,21914624283984433,36520347244953601,59604644531250001,95428956352766401,150094634909578633,232218264607322113,353814782610645721,531440999271000001,787662782901046081,1152921503533105153,1667889513661516993 pow $0,6 bin $0,2 mul $0,2 add $0,1
src/Examples/Sorting/Sequential/InsertionSort.agda
jonsterling/agda-calf
29
6816
<filename>src/Examples/Sorting/Sequential/InsertionSort.agda {-# OPTIONS --prop --rewriting #-} open import Examples.Sorting.Sequential.Comparable module Examples.Sorting.Sequential.InsertionSort (M : Comparable) where open Comparable M open import Examples.Sorting.Sequential.Core M open import Calf costMonoid open import Calf.Types.Bool open import Calf.Types.List open import Calf.Types.Eq open import Calf.Types.Bounded costMonoid open import Calf.Types.BigO costMonoid open import Relation.Nullary open import Relation.Nullary.Negation open import Relation.Binary.PropositionalEquality as Eq using (_≡_; refl; module ≡-Reasoning) open import Data.Product using (_×_; _,_; ∃) open import Data.Sum using (inj₁; inj₂) open import Function open import Data.Nat as Nat using (ℕ; zero; suc; z≤n; s≤s; _+_; _*_) import Data.Nat.Properties as N open import Data.Nat.Square insert : cmp (Π A λ _ → Π (list A) λ _ → F (list A)) insert x [] = ret [ x ] insert x (y ∷ ys) = bind (F (list A)) (x ≤ᵇ y) λ { false → bind (F (list A)) (insert x ys) (ret ∘ (y ∷_)) ; true → ret (x ∷ (y ∷ ys)) } insert/correct : ∀ x l → Sorted l → ◯ (∃ λ l' → insert x l ≡ ret l' × SortedOf (x ∷ l) l') insert/correct x [] [] u = [ x ] , refl , refl , [] ∷ [] insert/correct x (y ∷ ys) (h ∷ hs) u with h-cost x y insert/correct x (y ∷ ys) (h ∷ hs) u | ⇓ b withCost q [ _ , h-eq ] rewrite eq/ref h-eq with ≤ᵇ-reflects-≤ u (Eq.trans (eq/ref h-eq) (step/ext (F bool) (ret b) q u)) | ≤-total x y insert/correct x (y ∷ ys) (h ∷ hs) u | ⇓ false withCost q [ _ , _ ] | ofⁿ ¬x≤y | inj₁ x≤y = contradiction x≤y ¬x≤y insert/correct x (y ∷ ys) (h ∷ hs) u | ⇓ false withCost q [ _ , _ ] | ofⁿ ¬x≤y | inj₂ x≤y = let (ys' , h-ys' , x∷ys↭ys' , sorted-ys') = insert/correct x ys hs u in y ∷ ys' , ( let open ≡-Reasoning in begin step (F (list A)) q (bind (F (list A)) (insert x ys) (ret ∘ (y ∷_))) ≡⟨ step/ext (F (list A)) (bind (F (list A)) (insert x ys) (ret ∘ (y ∷_))) q u ⟩ bind (F (list A)) (insert x ys) (ret ∘ (y ∷_)) ≡⟨ Eq.cong (λ e → bind (F (list A)) e (ret ∘ (y ∷_))) h-ys' ⟩ ret (y ∷ ys') ∎ ) , ( let open PermutationReasoning in begin x ∷ y ∷ ys <<⟨ refl ⟩ y ∷ (x ∷ ys) <⟨ x∷ys↭ys' ⟩ y ∷ ys' ∎ ) , All-resp-↭ x∷ys↭ys' (x≤y ∷ h) ∷ sorted-ys' insert/correct x (y ∷ ys) (h ∷ hs) u | ⇓ true withCost q [ _ , _ ] | ofʸ x≤y | _ = x ∷ (y ∷ ys) , step/ext (F (list A)) (ret _) q u , refl , (x≤y ∷ ≤-≤* x≤y h) ∷ (h ∷ hs) insert/cost : cmp (Π A λ _ → Π (list A) λ _ → cost) insert/cost x [] = zero insert/cost x (y ∷ ys) with h-cost x y ... | ⇓ false withCost q [ q≤1 , h-eq ] = q + (insert/cost x ys + zero) ... | ⇓ true withCost q [ q≤1 , h-eq ] = q + 0 insert/cost/closed : cmp (Π A λ _ → Π (list A) λ _ → cost) insert/cost/closed x l = length l insert/cost≤insert/cost/closed : ∀ x l → ◯ (insert/cost x l Nat.≤ insert/cost/closed x l) insert/cost≤insert/cost/closed x [] u = N.≤-refl insert/cost≤insert/cost/closed x (y ∷ ys) u with h-cost x y ... | ⇓ false withCost q [ q≤1 , h-eq ] = Eq.subst (λ n → (q + n) Nat.≤ (suc (length ys))) (Eq.sym (+-identityʳ (insert/cost x ys))) ( N.≤-trans (+-monoˡ-≤ _ (q≤1 u)) (s≤s (insert/cost≤insert/cost/closed x ys u)) ) ... | ⇓ true withCost q [ q≤1 , h-eq ] = Eq.subst (Nat._≤ (suc (length ys))) (Eq.sym (+-identityʳ q)) ( N.≤-trans (q≤1 u) (s≤s z≤n) ) insert≤insert/cost : ∀ x l → IsBounded (list A) (insert x l) (insert/cost x l) insert≤insert/cost x [] = bound/ret insert≤insert/cost x (y ∷ ys) with h-cost x y ... | ⇓ false withCost q [ q≤1 , h-eq ] rewrite eq/ref h-eq = bound/step q (insert/cost x ys + 0) (bound/bind/const (insert/cost x ys) 0 (insert≤insert/cost x ys) λ _ → bound/ret) ... | ⇓ true withCost q [ q≤1 , h-eq ] rewrite eq/ref h-eq = bound/step q 0 bound/ret insert≤insert/cost/closed : ∀ x l → IsBounded (list A) (insert x l) (insert/cost/closed x l) insert≤insert/cost/closed x l = bound/relax (insert/cost≤insert/cost/closed x l) (insert≤insert/cost x l) sort : cmp (Π (list A) λ _ → F (list A)) sort [] = ret [] sort (x ∷ xs) = bind (F (list A)) (sort xs) (insert x) sort/correct : IsSort sort sort/correct [] u = [] , refl , refl , [] sort/correct (x ∷ xs) u = let (xs' , h-xs' , xs↭xs' , sorted-xs' ) = sort/correct xs u in let (x∷xs' , h-x∷xs' , x∷xs↭x∷xs' , sorted-x∷xs') = insert/correct x xs' sorted-xs' u in x∷xs' , ( let open ≡-Reasoning in begin sort (x ∷ xs) ≡⟨⟩ bind (F (list A)) (sort xs) (insert x) ≡⟨ Eq.cong (λ e → bind (F (list A)) e (insert x)) h-xs' ⟩ bind (F (list A)) (ret {list A} xs') (insert x) ≡⟨⟩ insert x xs' ≡⟨ h-x∷xs' ⟩ ret x∷xs' ∎ ) , ( let open PermutationReasoning in begin x ∷ xs <⟨ xs↭xs' ⟩ x ∷ xs' ↭⟨ x∷xs↭x∷xs' ⟩ x∷xs' ∎ ) , sorted-x∷xs' sort/cost : cmp (Π (list A) λ _ → cost) sort/cost [] = 0 sort/cost (x ∷ xs) = bind cost (sort xs) (λ xs' → sort/cost xs + insert/cost/closed x xs') sort/cost/closed : cmp (Π (list A) λ _ → cost) sort/cost/closed l = length l ² sort/cost≤sort/cost/closed : ∀ l → ◯ (sort/cost l Nat.≤ sort/cost/closed l) sort/cost≤sort/cost/closed [] u = N.≤-refl sort/cost≤sort/cost/closed (x ∷ xs) u = let (xs' , ≡ , ↭ , sorted) = sort/correct xs u in begin sort/cost (x ∷ xs) ≡⟨⟩ bind cost (sort xs) (λ xs' → sort/cost xs + length xs') ≡⟨ Eq.cong (λ e → bind cost e λ xs' → sort/cost xs + length xs') (≡) ⟩ sort/cost xs + length xs' ≡˘⟨ Eq.cong (sort/cost xs +_) (↭-length ↭) ⟩ sort/cost xs + length xs ≤⟨ +-monoˡ-≤ (insert/cost/closed x xs) (sort/cost≤sort/cost/closed xs u) ⟩ sort/cost/closed xs + insert/cost/closed x xs ≡⟨⟩ length xs ² + length xs ≤⟨ lemma/arithmetic (length xs) ⟩ length (x ∷ xs) ² ≡⟨⟩ sort/cost/closed (x ∷ xs) ∎ where open ≤-Reasoning lemma/arithmetic : ∀ n → n ² + n Nat.≤ suc n ² lemma/arithmetic n = begin n ² + n ≡⟨ N.+-comm (n ²) n ⟩ n + n ² ≡⟨⟩ n + n * n ≤⟨ N.m≤n+m (n + n * n) (suc n) ⟩ suc n + (n + n * n) ≡⟨⟩ suc (n + (n + n * n)) ≡˘⟨ Eq.cong (λ m → suc (n + m)) (N.*-suc n n) ⟩ suc (n + n * suc n) ≡⟨⟩ suc n ² ∎ sort≤sort/cost : ∀ l → IsBounded (list A) (sort l) (sort/cost l) sort≤sort/cost [] = bound/ret sort≤sort/cost (x ∷ xs) = bound/bind (sort/cost xs) (insert/cost/closed x) (sort≤sort/cost xs) (insert≤insert/cost/closed x) sort≤sort/cost/closed : ∀ l → IsBounded (list A) (sort l) (sort/cost/closed l) sort≤sort/cost/closed l = bound/relax (sort/cost≤sort/cost/closed l) (sort≤sort/cost l) sort/asymptotic : given (list A) measured-via length , sort ∈𝓞(λ n → n ²) sort/asymptotic = 0 ≤n⇒f[n]≤g[n]via λ l _ → sort≤sort/cost/closed l
ffight/lcs/enemy/44.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
90222
<filename>ffight/lcs/enemy/44.asm<gh_stars>1-10 copyright zengfr site:http://github.com/zengfr/romhack 0039FE movem.l D0-D3, -(A6) 003A02 movem.l D0-D3, -(A6) 007520 move.w A1, ($44,A3) [boss+40, enemy+40] 007524 rts [boss+44, enemy+44] 009ACA dbra D5, $9ac8 copyright zengfr site:http://github.com/zengfr/romhack
Cubical/Categories/Limits/Pullback.agda
thomas-lamiaux/cubical
1
8356
<filename>Cubical/Categories/Limits/Pullback.agda {-# OPTIONS --safe #-} module Cubical.Categories.Limits.Pullback where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.HITs.PropositionalTruncation.Base open import Cubical.Data.Sigma open import Cubical.Data.Unit open import Cubical.Categories.Category open import Cubical.Categories.Functor open import Cubical.Categories.Instances.Cospan open import Cubical.Categories.Limits.Limits private variable ℓ ℓ' : Level module _ (C : Category ℓ ℓ') where open Category C open Functor record Cospan : Type (ℓ-max ℓ ℓ') where constructor cospan field l m r : ob s₁ : C [ l , m ] s₂ : C [ r , m ] open Cospan isPullback : (cspn : Cospan) → {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) → Type (ℓ-max ℓ ℓ') isPullback cspn {c} p₁ p₂ H = ∀ {d} (h : C [ d , cspn .l ]) (k : C [ d , cspn .r ]) (H' : h ⋆ cspn .s₁ ≡ k ⋆ cspn .s₂) → ∃![ hk ∈ C [ d , c ] ] (h ≡ hk ⋆ p₁) × (k ≡ hk ⋆ p₂) isPropIsPullback : (cspn : Cospan) → {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) → isProp (isPullback cspn p₁ p₂ H) isPropIsPullback cspn p₁ p₂ H = isPropImplicitΠ (λ x → isPropΠ3 λ h k H' → isPropIsContr) record Pullback (cspn : Cospan) : Type (ℓ-max ℓ ℓ') where field pbOb : ob pbPr₁ : C [ pbOb , cspn .l ] pbPr₂ : C [ pbOb , cspn .r ] pbCommutes : pbPr₁ ⋆ cspn .s₁ ≡ pbPr₂ ⋆ cspn .s₂ univProp : isPullback cspn pbPr₁ pbPr₂ pbCommutes open Pullback pullbackArrow : {cspn : Cospan} (pb : Pullback cspn) {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) → C [ c , pb . pbOb ] pullbackArrow pb p₁ p₂ H = pb .univProp p₁ p₂ H .fst .fst pullbackArrowPr₁ : {cspn : Cospan} (pb : Pullback cspn) {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) → p₁ ≡ pullbackArrow pb p₁ p₂ H ⋆ pbPr₁ pb pullbackArrowPr₁ pb p₁ p₂ H = pb .univProp p₁ p₂ H .fst .snd .fst pullbackArrowPr₂ : {cspn : Cospan} (pb : Pullback cspn) {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) → p₂ ≡ pullbackArrow pb p₁ p₂ H ⋆ pbPr₂ pb pullbackArrowPr₂ pb p₁ p₂ H = pb .univProp p₁ p₂ H .fst .snd .snd pullbackArrowUnique : {cspn : Cospan} (pb : Pullback cspn) {c : ob} (p₁ : C [ c , cspn .l ]) (p₂ : C [ c , cspn .r ]) (H : p₁ ⋆ cspn .s₁ ≡ p₂ ⋆ cspn .s₂) (pbArrow' : C [ c , pb .pbOb ]) (H₁ : p₁ ≡ pbArrow' ⋆ pbPr₁ pb) (H₂ : p₂ ≡ pbArrow' ⋆ pbPr₂ pb) → pullbackArrow pb p₁ p₂ H ≡ pbArrow' pullbackArrowUnique pb p₁ p₂ H pbArrow' H₁ H₂ = cong fst (pb .univProp p₁ p₂ H .snd (pbArrow' , (H₁ , H₂))) Pullbacks : Type (ℓ-max ℓ ℓ') Pullbacks = (cspn : Cospan) → Pullback cspn hasPullbacks : Type (ℓ-max ℓ ℓ') hasPullbacks = ∥ Pullbacks ∥₁ -- Pullbacks from limits module _ {C : Category ℓ ℓ'} where open Category C open Functor open Pullback open LimCone open Cone open Cospan Cospan→Func : Cospan C → Functor CospanCat C Cospan→Func (cospan l m r f g) .F-ob ⓪ = l Cospan→Func (cospan l m r f g) .F-ob ① = m Cospan→Func (cospan l m r f g) .F-ob ② = r Cospan→Func (cospan l m r f g) .F-hom {⓪} {①} k = f Cospan→Func (cospan l m r f g) .F-hom {②} {①} k = g Cospan→Func (cospan l m r f g) .F-hom {⓪} {⓪} k = id Cospan→Func (cospan l m r f g) .F-hom {①} {①} k = id Cospan→Func (cospan l m r f g) .F-hom {②} {②} k = id Cospan→Func (cospan l m r f g) .F-id {⓪} = refl Cospan→Func (cospan l m r f g) .F-id {①} = refl Cospan→Func (cospan l m r f g) .F-id {②} = refl Cospan→Func (cospan l m r f g) .F-seq {⓪} {⓪} {⓪} φ ψ = sym (⋆IdL _) Cospan→Func (cospan l m r f g) .F-seq {⓪} {⓪} {①} φ ψ = sym (⋆IdL _) Cospan→Func (cospan l m r f g) .F-seq {⓪} {①} {①} φ ψ = sym (⋆IdR _) Cospan→Func (cospan l m r f g) .F-seq {①} {①} {①} φ ψ = sym (⋆IdL _) Cospan→Func (cospan l m r f g) .F-seq {②} {②} {②} φ ψ = sym (⋆IdL _) Cospan→Func (cospan l m r f g) .F-seq {②} {②} {①} φ ψ = sym (⋆IdL _) Cospan→Func (cospan l m r f g) .F-seq {②} {①} {①} φ ψ = sym (⋆IdR _) LimitsOfShapeCospanCat→Pullbacks : LimitsOfShape CospanCat C → Pullbacks C pbOb (LimitsOfShapeCospanCat→Pullbacks H cspn) = lim (H (Cospan→Func cspn)) pbPr₁ (LimitsOfShapeCospanCat→Pullbacks H cspn) = limOut (H (Cospan→Func cspn)) ⓪ pbPr₂ (LimitsOfShapeCospanCat→Pullbacks H cspn) = limOut (H (Cospan→Func cspn)) ② pbCommutes (LimitsOfShapeCospanCat→Pullbacks H cspn) = limOutCommutes (H (Cospan→Func cspn)) {v = ①} tt ∙ sym (limOutCommutes (H (Cospan→Func cspn)) tt) univProp (LimitsOfShapeCospanCat→Pullbacks H cspn) {d = d} h k H' = uniqueExists (limArrow (H (Cospan→Func cspn)) d cc) ( sym (limArrowCommutes (H (Cospan→Func cspn)) d cc ⓪) , sym (limArrowCommutes (H (Cospan→Func cspn)) d cc ②)) (λ _ → isProp× (isSetHom _ _) (isSetHom _ _)) λ a' ha' → limArrowUnique (H (Cospan→Func cspn)) d cc a' (λ { ⓪ → sym (ha' .fst) ; ① → cong (a' ⋆_) (sym (limOutCommutes (H (Cospan→Func cspn)) {⓪} {①} tt)) ∙∙ sym (⋆Assoc _ _ _) ∙∙ cong (_⋆ cspn .s₁) (sym (ha' .fst)) ; ② → sym (ha' .snd) }) where cc : Cone (Cospan→Func cspn) d coneOut cc ⓪ = h coneOut cc ① = h ⋆ cspn .s₁ coneOut cc ② = k coneOutCommutes cc {⓪} {⓪} e = ⋆IdR h coneOutCommutes cc {⓪} {①} e = refl coneOutCommutes cc {①} {①} e = ⋆IdR _ coneOutCommutes cc {②} {①} e = sym H' coneOutCommutes cc {②} {②} e = ⋆IdR k Limits→Pullbacks : Limits C → Pullbacks C Limits→Pullbacks H = LimitsOfShapeCospanCat→Pullbacks (H CospanCat)
alloy4fun_models/trashltl/models/13/QyyqNz9mvoxHq23Xi.als
Kaixi26/org.alloytools.alloy
0
4985
open main pred idQyyqNz9mvoxHq23Xi_prop14 { all f : File | (f in (Trash & Protected)) implies f not in Protected' } pred __repair { idQyyqNz9mvoxHq23Xi_prop14 } check __repair { idQyyqNz9mvoxHq23Xi_prop14 <=> prop14o }
src/fot/FOTC/Program/ABP/Lemma2I.agda
asr/fotc
11
7857
<reponame>asr/fotc<filename>src/fot/FOTC/Program/ABP/Lemma2I.agda ------------------------------------------------------------------------------ -- ABP Lemma 2 ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- From Dybjer and Sander's paper: The second lemma states that given -- a state of the latter kind (see Lemma 1) we will arrive at a new -- start state, which is identical to the old start state except that -- the bit has alternated and the first item in the input stream has -- been removed. module FOTC.Program.ABP.Lemma2I where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Base.List open import FOTC.Base.List.PropertiesI open import FOTC.Base.Loop open import FOTC.Base.PropertiesI open import FOTC.Data.Bool open import FOTC.Data.Bool.PropertiesI open import FOTC.Data.List open import FOTC.Data.List.PropertiesI open import FOTC.Program.ABP.ABP open import FOTC.Program.ABP.Fair.Type open import FOTC.Program.ABP.Fair.PropertiesI open import FOTC.Program.ABP.PropertiesI open import FOTC.Program.ABP.Terms ------------------------------------------------------------------------------ -- Helper function for Lemma 2. helper₂ : ∀ {b i' is' os₁' os₂' as' bs' cs' ds' js'} → Bit b → Fair os₁' → S' b i' is' os₁' os₂' as' bs' cs' ds' js' → ∀ ft₂ os₂'' → F*T ft₂ → Fair os₂'' → os₂' ≡ ft₂ ++ os₂'' → ∃[ os₁'' ] ∃[ os₂'' ] ∃[ as'' ] ∃[ bs'' ] ∃[ cs'' ] ∃[ ds'' ] Fair os₁'' ∧ Fair os₂'' ∧ S (not b) is' os₁'' os₂'' as'' bs'' cs'' ds'' js' helper₂ {b} {i'} {is'} {os₁'} {os₂'} {as'} {bs'} {cs'} {ds'} {js'} Bb Fos₁' (as'S' , bs'S' , cs'S' , ds'S' , js'S') .(T ∷ []) os₂'' f*tnil Fos₂'' os₂'-eq = os₁' , os₂'' , as'' , bs'' , cs'' , ds'' , Fos₁' , Fos₂'' , as''-eq , bs''-eq , cs''-eq , refl , js'-eq where os₂'-eq-helper : os₂' ≡ T ∷ os₂'' os₂'-eq-helper = os₂' ≡⟨ os₂'-eq ⟩ (T ∷ []) ++ os₂'' ≡⟨ ++-∷ T [] os₂'' ⟩ T ∷ [] ++ os₂'' ≡⟨ ∷-rightCong (++-leftIdentity os₂'') ⟩ T ∷ os₂'' ∎ ds'' : D ds'' = corrupt os₂'' · cs' ds'-eq : ds' ≡ ok b ∷ ds'' ds'-eq = ds' ≡⟨ ds'S' ⟩ corrupt os₂' · (b ∷ cs') ≡⟨ ·-leftCong (corruptCong os₂'-eq-helper) ⟩ corrupt (T ∷ os₂'') · (b ∷ cs') ≡⟨ corrupt-T os₂'' b cs' ⟩ ok b ∷ corrupt os₂'' · cs' ≡⟨ refl ⟩ ok b ∷ ds'' ∎ as'' : D as'' = as' as''-eq : as'' ≡ send (not b) · is' · ds'' as''-eq = as'' ≡⟨ as'S' ⟩ await b i' is' ds' ≡⟨ awaitCong₄ ds'-eq ⟩ await b i' is' (ok b ∷ ds'') ≡⟨ await-ok≡ b b i' is' ds'' refl ⟩ send (not b) · is' · ds'' ∎ bs'' : D bs'' = bs' bs''-eq : bs'' ≡ corrupt os₁' · as' bs''-eq = bs'S' cs'' : D cs'' = cs' cs''-eq : cs'' ≡ ack (not b) · bs' cs''-eq = cs'S' js'-eq : js' ≡ out (not b) · bs'' js'-eq = js'S' helper₂ {b} {i'} {is'} {os₁'} {os₂'} {as'} {bs'} {cs'} {ds'} {js'} Bb Fos₁' (as'S' , bs'S' , cs'S' , ds'S' , js'S') .(F ∷ ft₂) os₂'' (f*tcons {ft₂} FTft₂) Fos₂'' os₂'-eq = helper₂ Bb (tail-Fair Fos₁') ihS' ft₂ os₂'' FTft₂ Fos₂'' refl where os₁^ : D os₁^ = tail₁ os₁' os₂^ : D os₂^ = ft₂ ++ os₂'' os₂'-eq-helper : os₂' ≡ F ∷ os₂^ os₂'-eq-helper = os₂' ≡⟨ os₂'-eq ⟩ (F ∷ ft₂) ++ os₂'' ≡⟨ ++-∷ _ _ _ ⟩ F ∷ ft₂ ++ os₂'' ≡⟨ refl ⟩ F ∷ os₂^ ∎ ds^ : D ds^ = corrupt os₂^ · cs' ds'-eq : ds' ≡ error ∷ ds^ ds'-eq = ds' ≡⟨ ds'S' ⟩ corrupt os₂' · (b ∷ cs') ≡⟨ ·-leftCong (corruptCong os₂'-eq-helper) ⟩ corrupt (F ∷ os₂^) · (b ∷ cs') ≡⟨ corrupt-F _ _ _ ⟩ error ∷ corrupt os₂^ · cs' ≡⟨ refl ⟩ error ∷ ds^ ∎ as^ : D as^ = await b i' is' ds^ as'-eq : as' ≡ < i' , b > ∷ as^ as'-eq = as' ≡⟨ as'S' ⟩ await b i' is' ds' ≡⟨ awaitCong₄ ds'-eq ⟩ await b i' is' (error ∷ ds^) ≡⟨ await-error _ _ _ _ ⟩ < i' , b > ∷ await b i' is' ds^ ≡⟨ refl ⟩ < i' , b > ∷ as^ ∎ bs^ : D bs^ = corrupt os₁^ · as^ bs'-eq-helper₁ : os₁' ≡ T ∷ tail₁ os₁' → bs' ≡ ok < i' , b > ∷ bs^ bs'-eq-helper₁ h = bs' ≡⟨ bs'S' ⟩ corrupt os₁' · as' ≡⟨ subst₂ (λ t t' → corrupt os₁' · as' ≡ corrupt t · t') h as'-eq refl ⟩ corrupt (T ∷ tail₁ os₁') · (< i' , b > ∷ as^) ≡⟨ corrupt-T _ _ _ ⟩ ok < i' , b > ∷ corrupt (tail₁ os₁') · as^ ≡⟨ refl ⟩ ok < i' , b > ∷ bs^ ∎ bs'-eq-helper₂ : os₁' ≡ F ∷ tail₁ os₁' → bs' ≡ error ∷ bs^ bs'-eq-helper₂ h = bs' ≡⟨ bs'S' ⟩ corrupt os₁' · as' ≡⟨ subst₂ (λ t t' → corrupt os₁' · as' ≡ corrupt t · t') h as'-eq refl ⟩ corrupt (F ∷ tail₁ os₁') · (< i' , b > ∷ as^) ≡⟨ corrupt-F _ _ _ ⟩ error ∷ corrupt (tail₁ os₁') · as^ ≡⟨ refl ⟩ error ∷ bs^ ∎ bs'-eq : bs' ≡ ok < i' , b > ∷ bs^ ∨ bs' ≡ error ∷ bs^ bs'-eq = case (λ h → inj₁ (bs'-eq-helper₁ h)) (λ h → inj₂ (bs'-eq-helper₂ h)) (head-tail-Fair Fos₁') cs^ : D cs^ = ack (not b) · bs^ cs'-eq-helper₁ : bs' ≡ ok < i' , b > ∷ bs^ → cs' ≡ b ∷ cs^ cs'-eq-helper₁ h = cs' ≡⟨ cs'S' ⟩ ack (not b) · bs' ≡⟨ ·-rightCong h ⟩ ack (not b) · (ok < i' , b > ∷ bs^) ≡⟨ ack-ok≢ _ _ _ _ (not-x≢x Bb) ⟩ not (not b) ∷ ack (not b) · bs^ ≡⟨ ∷-leftCong (not-involutive Bb) ⟩ b ∷ ack (not b) · bs^ ≡⟨ refl ⟩ b ∷ cs^ ∎ cs'-eq-helper₂ : bs' ≡ error ∷ bs^ → cs' ≡ b ∷ cs^ cs'-eq-helper₂ h = cs' ≡⟨ cs'S' ⟩ ack (not b) · bs' ≡⟨ ·-rightCong h ⟩ ack (not b) · (error ∷ bs^) ≡⟨ ack-error _ _ ⟩ not (not b) ∷ ack (not b) · bs^ ≡⟨ ∷-leftCong (not-involutive Bb) ⟩ b ∷ ack (not b) · bs^ ≡⟨ refl ⟩ b ∷ cs^ ∎ cs'-eq : cs' ≡ b ∷ cs^ cs'-eq = case cs'-eq-helper₁ cs'-eq-helper₂ bs'-eq js'-eq-helper₁ : bs' ≡ ok < i' , b > ∷ bs^ → js' ≡ out (not b) · bs^ js'-eq-helper₁ h = js' ≡⟨ js'S' ⟩ out (not b) · bs' ≡⟨ ·-rightCong h ⟩ out (not b) · (ok < i' , b > ∷ bs^) ≡⟨ out-ok≢ (not b) b i' bs^ (not-x≢x Bb) ⟩ out (not b) · bs^ ∎ js'-eq-helper₂ : bs' ≡ error ∷ bs^ → js' ≡ out (not b) · bs^ js'-eq-helper₂ h = js' ≡⟨ js'S' ⟩ out (not b) · bs' ≡⟨ ·-rightCong h ⟩ out (not b) · (error ∷ bs^) ≡⟨ out-error (not b) bs^ ⟩ out (not b) · bs^ ∎ js'-eq : js' ≡ out (not b) · bs^ js'-eq = case js'-eq-helper₁ js'-eq-helper₂ bs'-eq ds^-eq : ds^ ≡ corrupt os₂^ · (b ∷ cs^) ds^-eq = ·-rightCong cs'-eq ihS' : S' b i' is' os₁^ os₂^ as^ bs^ cs^ ds^ js' ihS' = refl , refl , refl , ds^-eq , js'-eq -- From Dybjer and Sander's paper: From the assumption that -- os₂' ∈ Fair and hence by unfolding Fair, we conclude that there are -- ft₂ : F*T and os₂'' : Fair, such that os₂' = ft₂ ++ os₂''. -- -- We proceed by induction on ft₂ : F*T using helper. lemma₂ : ∀ {b i' is' os₁' os₂' as' bs' cs' ds' js'} → Bit b → Fair os₁' → Fair os₂' → S' b i' is' os₁' os₂' as' bs' cs' ds' js' → ∃[ os₁'' ] ∃[ os₂'' ] ∃[ as'' ] ∃[ bs'' ] ∃[ cs'' ] ∃[ ds'' ] Fair os₁'' ∧ Fair os₂'' ∧ S (not b) is' os₁'' os₂'' as'' bs'' cs'' ds'' js' lemma₂ {b} {is' = is'} {os₂' = os₂'} {js' = js'} Bb Fos₁' Fos₂' s' = helper₁ (Fair-out Fos₂') where helper₁ : (∃[ ft₂ ] ∃[ os₂'' ] F*T ft₂ ∧ os₂' ≡ ft₂ ++ os₂'' ∧ Fair os₂'') → ∃[ os₁'' ] ∃[ os₂'' ] ∃[ as'' ] ∃[ bs'' ] ∃[ cs'' ] ∃[ ds'' ] Fair os₁'' ∧ Fair os₂'' ∧ S (not b) is' os₁'' os₂'' as'' bs'' cs'' ds'' js' helper₁ (ft₂ , os₂'' , FTft₂ , os₂'-eq , Fos₂'') = helper₂ Bb Fos₁' s' ft₂ os₂'' FTft₂ Fos₂'' os₂'-eq
src/Categories/Functor/Construction/ObjectRestriction.agda
Trebor-Huang/agda-categories
279
762
<reponame>Trebor-Huang/agda-categories<filename>src/Categories/Functor/Construction/ObjectRestriction.agda {-# OPTIONS --without-K --safe #-} -- The category build from ObjectRestriction can be done so Functorially module Categories.Functor.Construction.ObjectRestriction where open import Level open import Data.Product using (proj₁) open import Relation.Unary using (Pred) open import Function using () renaming (id to id→) open import Categories.Category.Core open import Categories.Category.Construction.ObjectRestriction open import Categories.Functor.Core open import Categories.Functor.Properties using (Faithful; Full) private variable o ℓ e ℓ′ : Level C : Category o ℓ e RestrictionFunctor : {ℓ′ : Level} → (C : Category o ℓ e) → (E : Pred (Category.Obj C) ℓ′) → Functor (ObjectRestriction C E) C RestrictionFunctor C E = record { F₀ = proj₁ ; F₁ = id→ ; identity = Equiv.refl ; homomorphism = Equiv.refl ; F-resp-≈ = id→ } where open Category C RF-Faithful : {E : Pred (Category.Obj C) ℓ′} → Faithful (RestrictionFunctor C E) RF-Faithful _ _ = id→ RF-Full : {E : Pred (Category.Obj C) ℓ′} → Full (RestrictionFunctor C E) RF-Full {C = C} = record { from = record { _⟨$⟩_ = id→ ; cong = id→ } ; right-inverse-of = λ _ → Category.Equiv.refl C }
EjerciciosClase/BNp01a.asm
adeandak/OPC
0
176948
<reponame>adeandak/OPC TITLE Ejercicio Suma de arreglo ; Descripcion: ; Ejemplo de uso de direccionamiento indirecto con operandos indirectos, ; en la suma de elementos de un arreglo. ; Todas las impresiones enteras se haran en Hexadecimal. ; Irvine Library procedures and functions INCLUDE \masm32\Irvine\Irvine32.inc INCLUDELIB \masm32\Irvine\Irvine32.lib INCLUDELIB \masm32\Irvine\User32.lib INCLUDELIB \masm32\Irvine\Kernel32.lib ; End Irvine .DATA ; Variables arraySD SDWORD 1001h, 2002h, 3003h, 4004h, 5005h ; en Hexadecimal ; Textos para la Consola mcr = 0dh mlf = 0ah mnul = 0h prtit BYTE mcr, mlf, "Ejercicio arreglo suma con operandos indirectos", mcr, mlf, mnul adios BYTE mcr, mlf, "ADIOS.", mcr, mlf, mnul prtot BYTE mcr, mlf, "Total: ", mnul .CODE ; Procedimiento principal main PROC mov edx,OFFSET prtit call WriteString call CrLf mov ESI, offset arraySD mov ECX, 0 ; acumulador mov EBX, 0 ; variable de control ; ***** COMPLETAR ; ***** COMPLETAR ; Total mov EDX, OFFSET prtot call WriteString mov EAX, ECX call WriteHex call Crlf ; ADIOS mov edx,OFFSET adios call WriteString call Crlf exit main ENDP ; Termina el procedimiento principal ; Termina el area de Ensamble END main
oeis/024/A024816.asm
neoneye/loda-programs
11
26767
; A024816: Antisigma(n): Sum of the numbers less than n that do not divide n. ; Submitted by <NAME> ; 0,0,2,3,9,9,20,21,32,37,54,50,77,81,96,105,135,132,170,168,199,217,252,240,294,309,338,350,405,393,464,465,513,541,582,575,665,681,724,730,819,807,902,906,957,1009,1080,1052,1168,1182,1254,1280,1377,1365,1468,1476,1573,1621,1710,1662,1829,1857,1912,1953,2061,2067,2210,2220,2319,2341,2484,2433,2627,2661,2726,2786,2907,2913,3080,3054,3200,3277,3402,3346,3547,3609,3708,3736,3915,3861,4074,4110,4243,4321,4440,4404,4655,4680,4794,4833 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 mul $3,29 mul $3,$0 sub $0,1 add $1,$3 lpe mul $1,43 mov $0,$1 sub $0,1247 div $0,1247
libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_aaddr2cx.asm
meesokim/z88dk
0
102265
; uint zx_aaddr2cx(void *attraddr) SECTION code_arch PUBLIC zx_aaddr2cx zx_aaddr2cx: INCLUDE "arch/zx/display/z80/asm_zx_aaddr2cx.asm"
alloy4fun_models/trashltl/models/15/7iKEdQRHo4MFEtZQD.als
Kaixi26/org.alloytools.alloy
0
4148
open main pred id7iKEdQRHo4MFEtZQD_prop16 { all f:Protected | always some (f & Protected) } pred __repair { id7iKEdQRHo4MFEtZQD_prop16 } check __repair { id7iKEdQRHo4MFEtZQD_prop16 <=> prop16o }
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/trampoline3.adb
best08618/asylo
7
30666
-- { dg-do compile { target *-*-linux* } } -- { dg-options "-gnatws" } procedure Trampoline3 is A : Integer; type FuncPtr is access function (I : Integer) return Integer; function F (I : Integer) return Integer is begin return A + I; end F; P : FuncPtr := F'Access; I : Integer; begin I := P(0); end; -- { dg-final { scan-assembler-not "GNU-stack.*x" } }
unittests/ASM/Primary/Primary_A6_REP_down_Equal.asm
cobalt2727/FEX
628
20356
<gh_stars>100-1000 %ifdef CONFIG { "RegData": { "RAX": "0x4600", "RCX": "0x0", "RDX": "0x1", "RDI": "0xDFFFFFFF", "RSI": "0xE000000F" }, "MemoryRegions": { "0x100000000": "4096" } } %endif %macro copy 3 ; Dest, Src, Size mov rdi, %1 mov rsi, %2 mov rcx, %3 cld rep movsb %endmacro mov rdx, 0xe0000000 lea r15, [rdx + 8 * 0] lea r14, [rel .StringOne] copy r15, r14, 11 lea r15, [rdx + 8 * 2] lea r14, [rel .StringTwo] copy r15, r14, 11 lea rdi, [rdx + 8 * 0 + 10] lea rsi, [rdx + 8 * 2 + 10] std mov rcx, 11 ; Lower String length repe cmpsb ; rdi cmp rsi mov rax, 0 lahf mov rdx, 0 sete dl hlt .StringOne: db "\0TestString" .StringTwo: db "\0TestString"
msp430x2/msp430g2553/svd/msp430_svd-usci_b0_i2c_mode.ads
ekoeppen/MSP430_Generic_Ada_Drivers
0
29889
<filename>msp430x2/msp430g2553/svd/msp430_svd-usci_b0_i2c_mode.ads<gh_stars>0 -- This spec has been automatically generated from msp430g2553.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- USCI_B0 I2C Mode package MSP430_SVD.USCI_B0_I2C_MODE is pragma Preelaborate; --------------- -- Registers -- --------------- -- Sync. Mode: USCI Mode 1 type UCB0CTL0_UCMODE_Field is (-- Sync. Mode: USCI Mode: 0 Ucmode_0, -- Sync. Mode: USCI Mode: 1 Ucmode_1, -- Sync. Mode: USCI Mode: 2 Ucmode_2, -- Sync. Mode: USCI Mode: 3 Ucmode_3) with Size => 2; for UCB0CTL0_UCMODE_Field use (Ucmode_0 => 0, Ucmode_1 => 1, Ucmode_2 => 2, Ucmode_3 => 3); -- USCI B0 Control Register 0 type UCB0CTL0_Register is record -- Sync-Mode 0:UART-Mode / 1:SPI-Mode UCSYNC : MSP430_SVD.Bit := 16#0#; -- Sync. Mode: USCI Mode 1 UCMODE : UCB0CTL0_UCMODE_Field := MSP430_SVD.USCI_B0_I2C_MODE.Ucmode_0; -- Sync. Mode: Master Select UCMST : MSP430_SVD.Bit := 16#0#; -- unspecified Reserved_4_4 : MSP430_SVD.Bit := 16#0#; -- Multi-Master Environment UCMM : MSP430_SVD.Bit := 16#0#; -- 10-bit Slave Address Mode UCSLA10 : MSP430_SVD.Bit := 16#0#; -- 10-bit Address Mode UCA10 : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for UCB0CTL0_Register use record UCSYNC at 0 range 0 .. 0; UCMODE at 0 range 1 .. 2; UCMST at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; UCMM at 0 range 5 .. 5; UCSLA10 at 0 range 6 .. 6; UCA10 at 0 range 7 .. 7; end record; -- USCI 1 Clock Source Select 1 type UCB0CTL1_UCSSEL_Field is (-- USCI 0 Clock Source: 0 Ucssel_0, -- USCI 0 Clock Source: 1 Ucssel_1, -- USCI 0 Clock Source: 2 Ucssel_2, -- USCI 0 Clock Source: 3 Ucssel_3) with Size => 2; for UCB0CTL1_UCSSEL_Field use (Ucssel_0 => 0, Ucssel_1 => 1, Ucssel_2 => 2, Ucssel_3 => 3); -- USCI B0 Control Register 1 type UCB0CTL1_Register is record -- USCI Software Reset UCSWRST : MSP430_SVD.Bit := 16#0#; -- Transmit START UCTXSTT : MSP430_SVD.Bit := 16#0#; -- Transmit STOP UCTXSTP : MSP430_SVD.Bit := 16#0#; -- Transmit NACK UCTXNACK : MSP430_SVD.Bit := 16#0#; -- Transmit/Receive Select/Flag UCTR : MSP430_SVD.Bit := 16#0#; -- unspecified Reserved_5_5 : MSP430_SVD.Bit := 16#0#; -- USCI 1 Clock Source Select 1 UCSSEL : UCB0CTL1_UCSSEL_Field := MSP430_SVD.USCI_B0_I2C_MODE.Ucssel_0; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for UCB0CTL1_Register use record UCSWRST at 0 range 0 .. 0; UCTXSTT at 0 range 1 .. 1; UCTXSTP at 0 range 2 .. 2; UCTXNACK at 0 range 3 .. 3; UCTR at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; UCSSEL at 0 range 6 .. 7; end record; -- USCI B0 I2C Interrupt Enable Register type UCB0I2CIE_Register is record -- Arbitration Lost interrupt enable UCALIE : MSP430_SVD.Bit := 16#0#; -- START Condition interrupt enable UCSTTIE : MSP430_SVD.Bit := 16#0#; -- STOP Condition interrupt enable UCSTPIE : MSP430_SVD.Bit := 16#0#; -- NACK Condition interrupt enable UCNACKIE : MSP430_SVD.Bit := 16#0#; -- unspecified Reserved_4_7 : MSP430_SVD.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for UCB0I2CIE_Register use record UCALIE at 0 range 0 .. 0; UCSTTIE at 0 range 1 .. 1; UCSTPIE at 0 range 2 .. 2; UCNACKIE at 0 range 3 .. 3; Reserved_4_7 at 0 range 4 .. 7; end record; -- USCI B0 Status Register type UCB0STAT_Register is record -- Arbitration Lost interrupt Flag UCALIFG : MSP430_SVD.Bit := 16#0#; -- START Condition interrupt Flag UCSTTIFG : MSP430_SVD.Bit := 16#0#; -- STOP Condition interrupt Flag UCSTPIFG : MSP430_SVD.Bit := 16#0#; -- NAK Condition interrupt Flag UCNACKIFG : MSP430_SVD.Bit := 16#0#; -- Bus Busy Flag UCBBUSY : MSP430_SVD.Bit := 16#0#; -- General Call address received Flag UCGC : MSP430_SVD.Bit := 16#0#; -- SCL low UCSCLLOW : MSP430_SVD.Bit := 16#0#; -- USCI Listen mode UCLISTEN : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for UCB0STAT_Register use record UCALIFG at 0 range 0 .. 0; UCSTTIFG at 0 range 1 .. 1; UCSTPIFG at 0 range 2 .. 2; UCNACKIFG at 0 range 3 .. 3; UCBBUSY at 0 range 4 .. 4; UCGC at 0 range 5 .. 5; UCSCLLOW at 0 range 6 .. 6; UCLISTEN at 0 range 7 .. 7; end record; -- UCB0I2COA_UCOA array type UCB0I2COA_UCOA_Field_Array is array (0 .. 9) of MSP430_SVD.Bit with Component_Size => 1, Size => 10; -- Type definition for UCB0I2COA_UCOA type UCB0I2COA_UCOA_Field (As_Array : Boolean := False) is record case As_Array is when False => -- UCOA as a value Val : MSP430_SVD.UInt10; when True => -- UCOA as an array Arr : UCB0I2COA_UCOA_Field_Array; end case; end record with Unchecked_Union, Size => 10; for UCB0I2COA_UCOA_Field use record Val at 0 range 0 .. 9; Arr at 0 range 0 .. 9; end record; -- USCI B0 I2C Own Address type UCB0I2COA_Register is record -- I2C Own Address 0 UCOA : UCB0I2COA_UCOA_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_10_14 : MSP430_SVD.UInt5 := 16#0#; -- I2C General Call enable UCGCEN : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for UCB0I2COA_Register use record UCOA at 0 range 0 .. 9; Reserved_10_14 at 0 range 10 .. 14; UCGCEN at 0 range 15 .. 15; end record; -- UCB0I2CSA_UCSA array type UCB0I2CSA_UCSA_Field_Array is array (0 .. 9) of MSP430_SVD.Bit with Component_Size => 1, Size => 10; -- Type definition for UCB0I2CSA_UCSA type UCB0I2CSA_UCSA_Field (As_Array : Boolean := False) is record case As_Array is when False => -- UCSA as a value Val : MSP430_SVD.UInt10; when True => -- UCSA as an array Arr : UCB0I2CSA_UCSA_Field_Array; end case; end record with Unchecked_Union, Size => 10; for UCB0I2CSA_UCSA_Field use record Val at 0 range 0 .. 9; Arr at 0 range 0 .. 9; end record; -- USCI B0 I2C Slave Address type UCB0I2CSA_Register is record -- I2C Slave Address 0 UCSA : UCB0I2CSA_UCSA_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_10_15 : MSP430_SVD.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for UCB0I2CSA_Register use record UCSA at 0 range 0 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; ----------------- -- Peripherals -- ----------------- -- USCI_B0 I2C Mode type USCI_B0_I2C_MODE_Peripheral is record -- USCI B0 Control Register 0 UCB0CTL0 : aliased UCB0CTL0_Register; -- USCI B0 Control Register 1 UCB0CTL1 : aliased UCB0CTL1_Register; -- USCI B0 Baud Rate 0 UCB0BR0 : aliased MSP430_SVD.Byte; -- USCI B0 Baud Rate 1 UCB0BR1 : aliased MSP430_SVD.Byte; -- USCI B0 I2C Interrupt Enable Register UCB0I2CIE : aliased UCB0I2CIE_Register; -- USCI B0 Status Register UCB0STAT : aliased UCB0STAT_Register; -- USCI B0 Receive Buffer UCB0RXBUF : aliased MSP430_SVD.Byte; -- USCI B0 Transmit Buffer UCB0TXBUF : aliased MSP430_SVD.Byte; -- USCI B0 I2C Own Address UCB0I2COA : aliased UCB0I2COA_Register; -- USCI B0 I2C Slave Address UCB0I2CSA : aliased UCB0I2CSA_Register; end record with Volatile; for USCI_B0_I2C_MODE_Peripheral use record UCB0CTL0 at 16#0# range 0 .. 7; UCB0CTL1 at 16#1# range 0 .. 7; UCB0BR0 at 16#2# range 0 .. 7; UCB0BR1 at 16#3# range 0 .. 7; UCB0I2CIE at 16#4# range 0 .. 7; UCB0STAT at 16#5# range 0 .. 7; UCB0RXBUF at 16#6# range 0 .. 7; UCB0TXBUF at 16#7# range 0 .. 7; UCB0I2COA at 16#B0# range 0 .. 15; UCB0I2CSA at 16#B2# range 0 .. 15; end record; -- USCI_B0 I2C Mode USCI_B0_I2C_MODE_Periph : aliased USCI_B0_I2C_MODE_Peripheral with Import, Address => USCI_B0_I2C_MODE_Base; end MSP430_SVD.USCI_B0_I2C_MODE;
sources/ippcp/asm_ia32/pcprij128encryptofbg9as.asm
ntyukaev/ipp-crypto
30
91386
<gh_stars>10-100 ;=============================================================================== ; Copyright 2014-2020 Intel Corporation ; ; 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. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Rijndael Inverse Cipher function ; ; Content: ; Encrypt_RIJ128_AES_NI() ; ; %include "asmdefs.inc" %include "ia_emm.inc" %macro COPY_8U 4.nolist %xdefine %%dst %1 %xdefine %%src %2 %xdefine %%limit %3 %xdefine %%tmp %4 xor ecx, ecx %%next_byte: mov %%tmp, byte [%%src+ecx] mov byte [%%dst+ecx], %%tmp add ecx, 1 cmp ecx, %%limit jl %%next_byte %endmacro ;*************************************************************** ;* Purpose: RIJ128 OFB encryption ;* ;* void EncryptOFB_RIJ128_AES_NI(const Ipp32u* inpBlk, ;* Ipp32u* outBlk, ;* int nr, ;* const Ipp32u* pRKey, ;* int length, ;* int ofbBlks, ;* const Ipp8u* pIV) ;*************************************************************** %if (_IPP >= _IPP_P8) ;; ;; Lib = P8 ;; ;; Caller = ippsRijndael128DecryptOFB ;; segment .text align=IPP_ALIGN_FACTOR align IPP_ALIGN_FACTOR IPPASM EncryptOFB_RIJ128_AES_NI,PUBLIC USES_GPR esi,edi,ebx,ebp mov ebp, esp ; save original esp to use it to reach parameters %xdefine pInpBlk [ebp + ARG_1 + 0*sizeof(dword)] ; input block address %xdefine pOutBlk [ebp + ARG_1 + 1*sizeof(dword)] ; output block address %xdefine nr [ebp + ARG_1 + 2*sizeof(dword)] ; number of rounds %xdefine pKey [ebp + ARG_1 + 3*sizeof(dword)] ; key material address %xdefine len [ebp + ARG_1 + 4*sizeof(dword)] ; length of stream in bytes %xdefine ofbSize [ebp + ARG_1 + 5*sizeof(dword)] ; ofb blk size %xdefine pIV [ebp + ARG_1 + 6*sizeof(dword)] ; IV %xdefine SC (4) %assign BLKS_PER_LOOP (4) %xdefine tmpInp esp %xdefine tmpOut tmpInp+sizeof(oword) %xdefine locDst tmpOut+sizeof(oword) %xdefine locSrc locDst+sizeof(oword)*4 %xdefine locLen locSrc+sizeof(oword)*4 %xdefine stackLen sizeof(oword)+sizeof(oword)+sizeof(oword)*4+sizeof(oword)*4+sizeof(dword) sub esp,stackLen ; allocate stack mov eax, pIV ; get IV movdqu xmm0, oword [eax] ; movdqu oword [tmpInp], xmm0 ; and save into the stack mov eax, nr ; number of rounds mov ecx, pKey ; key material address lea eax, [eax*4] ; nr*16 offset (bytes) to end of key material lea eax, [eax*4] lea ecx, [ecx+eax] neg eax ; save -nr*16 mov nr, eax mov pKey, ecx ; save key material address mov esi, pInpBlk ; input stream mov edi, pOutBlk ; output stream mov ebx, ofbSize ; cfb blk size align IPP_ALIGN_FACTOR ;; ;; processing ;; .blks_loop: lea ebx, [ebx*BLKS_PER_LOOP] ; 4 cfb block cmp len, ebx cmovl ebx, len COPY_8U {locSrc}, esi, ebx, dl ; move 1-4 input blocks to stack mov ecx, pKey mov eax, nr mov dword [locLen], ebx xor edx, edx ; index align IPP_ALIGN_FACTOR .single_blk: movdqa xmm3, oword [ecx+eax] ; preload key material add eax, 16 movdqa xmm4, oword [ecx+eax] ; preload next key material pxor xmm0, xmm3 ; whitening align IPP_ALIGN_FACTOR .cipher_loop: add eax, 16 aesenc xmm0, xmm4 ; regular round movdqa xmm4, oword [ecx+eax] jnz .cipher_loop aesenclast xmm0, xmm4 ; irregular round movdqu oword [tmpOut], xmm0 ; save chipher output mov eax, ofbSize ; cfb blk size movdqu xmm1, oword [locSrc+edx] ; get src blocks from the stack pxor xmm1, xmm0 ; xor src movdqu oword [locDst+edx],xmm1 ;and store into the stack movdqu xmm0, oword [tmpInp+eax] ; update chiper input (IV) movdqu oword [tmpInp], xmm0 add edx, eax ; advance index mov eax, nr cmp edx, ebx jl .single_blk COPY_8U edi, {locDst}, edx, bl ; move 1-4 blocks to output mov ebx, ofbSize ; restore cfb blk size add esi, edx ; advance pointers add edi, edx sub len, edx ; decrease stream counter jg .blks_loop mov eax, pIV ; IV address movdqu xmm0, oword [tmpInp] ; update IV before return movdqu oword [eax], xmm0 add esp,stackLen ; remove local variables REST_GPR ret ENDFUNC EncryptOFB_RIJ128_AES_NI align IPP_ALIGN_FACTOR IPPASM EncryptOFB128_RIJ128_AES_NI,PUBLIC USES_GPR esi,edi %xdefine pInpBlk [esp + ARG_1 + 0*sizeof(dword)] ; input block address %xdefine pOutBlk [esp + ARG_1 + 1*sizeof(dword)] ; output block address %xdefine nr [esp + ARG_1 + 2*sizeof(dword)] ; number of rounds %xdefine pKey [esp + ARG_1 + 3*sizeof(dword)] ; key material address %xdefine len [esp + ARG_1 + 4*sizeof(dword)] ; length of stream in bytes %xdefine pIV [esp + ARG_1 + 5*sizeof(dword)] ; IV %xdefine SC (4) %assign BLKS_PER_LOOP (4) mov eax, pIV ; get IV movdqu xmm0, oword [eax] ; mov eax, nr ; number of rounds mov ecx, pKey ; key material address lea eax, [eax*4] ; nr*16 offset (bytes) to end of key material lea eax, [eax*4] lea ecx, [ecx+eax] neg eax ; save -nr*16 mov nr, eax mov esi, pInpBlk ; input stream mov edi, pOutBlk ; output stream mov edx, len ; length of stream align IPP_ALIGN_FACTOR ;; ;; processing ;; .blks_loop: movdqa xmm3, oword [ecx+eax] ; preload key material add eax, 16 align IPP_ALIGN_FACTOR .single_blk: movdqa xmm4, oword [ecx+eax] ; preload next key material pxor xmm0, xmm3 ; whitening movdqu xmm1, oword [esi] ; input block align IPP_ALIGN_FACTOR .cipher_loop: add eax, 16 aesenc xmm0, xmm4 ; regular round movdqa xmm4, oword [ecx+eax] jnz .cipher_loop aesenclast xmm0, xmm4 ; irregular round pxor xmm1, xmm0 ; xor src movdqu oword [edi],xmm1 ; and store into the dst mov eax, nr ; restore key material counter add esi, 16 ; advance pointers add edi, 16 sub edx, 16 ; decrease stream counter jg .blks_loop mov eax, pIV ; get IV address movdqu oword [eax], xmm0 ; update IV before return REST_GPR ret ENDFUNC EncryptOFB128_RIJ128_AES_NI %endif
tests/expr_asm_tokens.asm
jonfoster/customasm
0
177625
<filename>tests/expr_asm_tokens.asm ; ::: include #ruledef reg { a => 0xaa b => 0xbb } #ruledef { emit {r: reg} => r`8 test {r: reg} => asm { emit {r} } } ; ::: emit a ; = 0xaa emit b ; = 0xbb test a ; = 0xaa test b ; = 0xbb ; ::: test c ; error: no match ; ::: test 0x12 ; error: no match ; ::: include ; ::: #ruledef reg { a => 0xaa b => 0xbb } #ruledef { emit {r: reg} => r`8 test {r: reg} => asm { emit {r} emit b emit {r} } } test a ; = 0xaabbaa ; ::: include ; ::: #ruledef reg { a => 0xaa b => 0xbb } #ruledef { emit {r: reg} => r`8 test {r: reg} => asm { emit {unknown} } } test a ; error: failed / error: :10: unknown ; ::: include ; ::: #ruledef reg { a => 0xaa b => 0xbb } #ruledef { emit {r: reg} => r`8 test {r: reg} => asm { emit r } } test a ; error: failed / error: :10: no match ; ::: include ; ::: #ruledef reg { a => 0xaa b => 0xbb } #ruledef reg2 { a => 0xaa b => 0xbb c => 0xcc } #ruledef { emit {r: reg} => r`8 test {r: reg2} => asm { emit {r} } } test c ; error: failed / error: :17: no match
user/sh.asm
Hasnain62/xv6-Procject
0
17115
user/_sh: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <getcmd>: exit(0); } int getcmd(char *buf, int nbuf) { 0: 1101 addi sp,sp,-32 2: ec06 sd ra,24(sp) 4: e822 sd s0,16(sp) 6: e426 sd s1,8(sp) 8: e04a sd s2,0(sp) a: 1000 addi s0,sp,32 c: 84aa mv s1,a0 e: 892e mv s2,a1 fprintf(2, "$ "); 10: 00001597 auipc a1,0x1 14: 2f858593 addi a1,a1,760 # 1308 <malloc+0xe6> 18: 4509 li a0,2 1a: 00001097 auipc ra,0x1 1e: 122080e7 jalr 290(ra) # 113c <fprintf> memset(buf, 0, nbuf); 22: 864a mv a2,s2 24: 4581 li a1,0 26: 8526 mv a0,s1 28: 00001097 auipc ra,0x1 2c: ba6080e7 jalr -1114(ra) # bce <memset> gets(buf, nbuf); 30: 85ca mv a1,s2 32: 8526 mv a0,s1 34: 00001097 auipc ra,0x1 38: be0080e7 jalr -1056(ra) # c14 <gets> if(buf[0] == 0) // EOF 3c: 0004c503 lbu a0,0(s1) 40: 00153513 seqz a0,a0 return -1; return 0; } 44: 40a00533 neg a0,a0 48: 60e2 ld ra,24(sp) 4a: 6442 ld s0,16(sp) 4c: 64a2 ld s1,8(sp) 4e: 6902 ld s2,0(sp) 50: 6105 addi sp,sp,32 52: 8082 ret 0000000000000054 <panic>: exit(0); } void panic(char *s) { 54: 1141 addi sp,sp,-16 56: e406 sd ra,8(sp) 58: e022 sd s0,0(sp) 5a: 0800 addi s0,sp,16 5c: 862a mv a2,a0 fprintf(2, "%s\n", s); 5e: 00001597 auipc a1,0x1 62: 2b258593 addi a1,a1,690 # 1310 <malloc+0xee> 66: 4509 li a0,2 68: 00001097 auipc ra,0x1 6c: 0d4080e7 jalr 212(ra) # 113c <fprintf> exit(1); 70: 4505 li a0,1 72: 00001097 auipc ra,0x1 76: d56080e7 jalr -682(ra) # dc8 <exit> 000000000000007a <fork1>: } int fork1(void) { 7a: 1141 addi sp,sp,-16 7c: e406 sd ra,8(sp) 7e: e022 sd s0,0(sp) 80: 0800 addi s0,sp,16 int pid; pid = fork(); 82: 00001097 auipc ra,0x1 86: d3e080e7 jalr -706(ra) # dc0 <fork> if(pid == -1) 8a: 57fd li a5,-1 8c: 00f50663 beq a0,a5,98 <fork1+0x1e> panic("fork"); return pid; } 90: 60a2 ld ra,8(sp) 92: 6402 ld s0,0(sp) 94: 0141 addi sp,sp,16 96: 8082 ret panic("fork"); 98: 00001517 auipc a0,0x1 9c: 28050513 addi a0,a0,640 # 1318 <malloc+0xf6> a0: 00000097 auipc ra,0x0 a4: fb4080e7 jalr -76(ra) # 54 <panic> 00000000000000a8 <runcmd>: { a8: 7179 addi sp,sp,-48 aa: f406 sd ra,40(sp) ac: f022 sd s0,32(sp) ae: ec26 sd s1,24(sp) b0: 1800 addi s0,sp,48 if(cmd == 0) b2: c10d beqz a0,d4 <runcmd+0x2c> b4: 84aa mv s1,a0 switch(cmd->type){ b6: 4118 lw a4,0(a0) b8: 4795 li a5,5 ba: 02e7e263 bltu a5,a4,de <runcmd+0x36> be: 00056783 lwu a5,0(a0) c2: 078a slli a5,a5,0x2 c4: 00001717 auipc a4,0x1 c8: 35470713 addi a4,a4,852 # 1418 <malloc+0x1f6> cc: 97ba add a5,a5,a4 ce: 439c lw a5,0(a5) d0: 97ba add a5,a5,a4 d2: 8782 jr a5 exit(1); d4: 4505 li a0,1 d6: 00001097 auipc ra,0x1 da: cf2080e7 jalr -782(ra) # dc8 <exit> panic("runcmd"); de: 00001517 auipc a0,0x1 e2: 24250513 addi a0,a0,578 # 1320 <malloc+0xfe> e6: 00000097 auipc ra,0x0 ea: f6e080e7 jalr -146(ra) # 54 <panic> if(ecmd->argv[0] == 0) ee: 6508 ld a0,8(a0) f0: c515 beqz a0,11c <runcmd+0x74> exec(ecmd->argv[0], ecmd->argv); f2: 00848593 addi a1,s1,8 f6: 00001097 auipc ra,0x1 fa: d0a080e7 jalr -758(ra) # e00 <exec> fprintf(2, "exec %s failed\n", ecmd->argv[0]); fe: 6490 ld a2,8(s1) 100: 00001597 auipc a1,0x1 104: 22858593 addi a1,a1,552 # 1328 <malloc+0x106> 108: 4509 li a0,2 10a: 00001097 auipc ra,0x1 10e: 032080e7 jalr 50(ra) # 113c <fprintf> exit(0); 112: 4501 li a0,0 114: 00001097 auipc ra,0x1 118: cb4080e7 jalr -844(ra) # dc8 <exit> exit(1); 11c: 4505 li a0,1 11e: 00001097 auipc ra,0x1 122: caa080e7 jalr -854(ra) # dc8 <exit> close(rcmd->fd); 126: 5148 lw a0,36(a0) 128: 00001097 auipc ra,0x1 12c: cc8080e7 jalr -824(ra) # df0 <close> if(open(rcmd->file, rcmd->mode) < 0){ 130: 508c lw a1,32(s1) 132: 6888 ld a0,16(s1) 134: 00001097 auipc ra,0x1 138: cd4080e7 jalr -812(ra) # e08 <open> 13c: 00054763 bltz a0,14a <runcmd+0xa2> runcmd(rcmd->cmd); 140: 6488 ld a0,8(s1) 142: 00000097 auipc ra,0x0 146: f66080e7 jalr -154(ra) # a8 <runcmd> fprintf(2, "open %s failed\n", rcmd->file); 14a: 6890 ld a2,16(s1) 14c: 00001597 auipc a1,0x1 150: 1ec58593 addi a1,a1,492 # 1338 <malloc+0x116> 154: 4509 li a0,2 156: 00001097 auipc ra,0x1 15a: fe6080e7 jalr -26(ra) # 113c <fprintf> exit(1); 15e: 4505 li a0,1 160: 00001097 auipc ra,0x1 164: c68080e7 jalr -920(ra) # dc8 <exit> if(fork1() == 0) 168: 00000097 auipc ra,0x0 16c: f12080e7 jalr -238(ra) # 7a <fork1> 170: c919 beqz a0,186 <runcmd+0xde> wait(0); 172: 4501 li a0,0 174: 00001097 auipc ra,0x1 178: c5c080e7 jalr -932(ra) # dd0 <wait> runcmd(lcmd->right); 17c: 6888 ld a0,16(s1) 17e: 00000097 auipc ra,0x0 182: f2a080e7 jalr -214(ra) # a8 <runcmd> runcmd(lcmd->left); 186: 6488 ld a0,8(s1) 188: 00000097 auipc ra,0x0 18c: f20080e7 jalr -224(ra) # a8 <runcmd> if(pipe(p) < 0) 190: fd840513 addi a0,s0,-40 194: 00001097 auipc ra,0x1 198: c44080e7 jalr -956(ra) # dd8 <pipe> 19c: 04054363 bltz a0,1e2 <runcmd+0x13a> if(fork1() == 0){ 1a0: 00000097 auipc ra,0x0 1a4: eda080e7 jalr -294(ra) # 7a <fork1> 1a8: c529 beqz a0,1f2 <runcmd+0x14a> if(fork1() == 0){ 1aa: 00000097 auipc ra,0x0 1ae: ed0080e7 jalr -304(ra) # 7a <fork1> 1b2: cd25 beqz a0,22a <runcmd+0x182> close(p[0]); 1b4: fd842503 lw a0,-40(s0) 1b8: 00001097 auipc ra,0x1 1bc: c38080e7 jalr -968(ra) # df0 <close> close(p[1]); 1c0: fdc42503 lw a0,-36(s0) 1c4: 00001097 auipc ra,0x1 1c8: c2c080e7 jalr -980(ra) # df0 <close> wait(0); 1cc: 4501 li a0,0 1ce: 00001097 auipc ra,0x1 1d2: c02080e7 jalr -1022(ra) # dd0 <wait> wait(0); 1d6: 4501 li a0,0 1d8: 00001097 auipc ra,0x1 1dc: bf8080e7 jalr -1032(ra) # dd0 <wait> break; 1e0: bf0d j 112 <runcmd+0x6a> panic("pipe"); 1e2: 00001517 auipc a0,0x1 1e6: 16650513 addi a0,a0,358 # 1348 <malloc+0x126> 1ea: 00000097 auipc ra,0x0 1ee: e6a080e7 jalr -406(ra) # 54 <panic> close(1); 1f2: 4505 li a0,1 1f4: 00001097 auipc ra,0x1 1f8: bfc080e7 jalr -1028(ra) # df0 <close> dup(p[1]); 1fc: fdc42503 lw a0,-36(s0) 200: 00001097 auipc ra,0x1 204: c40080e7 jalr -960(ra) # e40 <dup> close(p[0]); 208: fd842503 lw a0,-40(s0) 20c: 00001097 auipc ra,0x1 210: be4080e7 jalr -1052(ra) # df0 <close> close(p[1]); 214: fdc42503 lw a0,-36(s0) 218: 00001097 auipc ra,0x1 21c: bd8080e7 jalr -1064(ra) # df0 <close> runcmd(pcmd->left); 220: 6488 ld a0,8(s1) 222: 00000097 auipc ra,0x0 226: e86080e7 jalr -378(ra) # a8 <runcmd> close(0); 22a: 00001097 auipc ra,0x1 22e: bc6080e7 jalr -1082(ra) # df0 <close> dup(p[0]); 232: fd842503 lw a0,-40(s0) 236: 00001097 auipc ra,0x1 23a: c0a080e7 jalr -1014(ra) # e40 <dup> close(p[0]); 23e: fd842503 lw a0,-40(s0) 242: 00001097 auipc ra,0x1 246: bae080e7 jalr -1106(ra) # df0 <close> close(p[1]); 24a: fdc42503 lw a0,-36(s0) 24e: 00001097 auipc ra,0x1 252: ba2080e7 jalr -1118(ra) # df0 <close> runcmd(pcmd->right); 256: 6888 ld a0,16(s1) 258: 00000097 auipc ra,0x0 25c: e50080e7 jalr -432(ra) # a8 <runcmd> if(fork1() == 0) 260: 00000097 auipc ra,0x0 264: e1a080e7 jalr -486(ra) # 7a <fork1> 268: ea0515e3 bnez a0,112 <runcmd+0x6a> runcmd(bcmd->cmd); 26c: 6488 ld a0,8(s1) 26e: 00000097 auipc ra,0x0 272: e3a080e7 jalr -454(ra) # a8 <runcmd> 0000000000000276 <execcmd>: //PAGEBREAK! // Constructors struct cmd* execcmd(void) { 276: 1101 addi sp,sp,-32 278: ec06 sd ra,24(sp) 27a: e822 sd s0,16(sp) 27c: e426 sd s1,8(sp) 27e: 1000 addi s0,sp,32 struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 280: 0a800513 li a0,168 284: 00001097 auipc ra,0x1 288: f9e080e7 jalr -98(ra) # 1222 <malloc> 28c: 84aa mv s1,a0 memset(cmd, 0, sizeof(*cmd)); 28e: 0a800613 li a2,168 292: 4581 li a1,0 294: 00001097 auipc ra,0x1 298: 93a080e7 jalr -1734(ra) # bce <memset> cmd->type = EXEC; 29c: 4785 li a5,1 29e: c09c sw a5,0(s1) return (struct cmd*)cmd; } 2a0: 8526 mv a0,s1 2a2: 60e2 ld ra,24(sp) 2a4: 6442 ld s0,16(sp) 2a6: 64a2 ld s1,8(sp) 2a8: 6105 addi sp,sp,32 2aa: 8082 ret 00000000000002ac <redircmd>: struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { 2ac: 7139 addi sp,sp,-64 2ae: fc06 sd ra,56(sp) 2b0: f822 sd s0,48(sp) 2b2: f426 sd s1,40(sp) 2b4: f04a sd s2,32(sp) 2b6: ec4e sd s3,24(sp) 2b8: e852 sd s4,16(sp) 2ba: e456 sd s5,8(sp) 2bc: e05a sd s6,0(sp) 2be: 0080 addi s0,sp,64 2c0: 8b2a mv s6,a0 2c2: 8aae mv s5,a1 2c4: 8a32 mv s4,a2 2c6: 89b6 mv s3,a3 2c8: 893a mv s2,a4 struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 2ca: 02800513 li a0,40 2ce: 00001097 auipc ra,0x1 2d2: f54080e7 jalr -172(ra) # 1222 <malloc> 2d6: 84aa mv s1,a0 memset(cmd, 0, sizeof(*cmd)); 2d8: 02800613 li a2,40 2dc: 4581 li a1,0 2de: 00001097 auipc ra,0x1 2e2: 8f0080e7 jalr -1808(ra) # bce <memset> cmd->type = REDIR; 2e6: 4789 li a5,2 2e8: c09c sw a5,0(s1) cmd->cmd = subcmd; 2ea: 0164b423 sd s6,8(s1) cmd->file = file; 2ee: 0154b823 sd s5,16(s1) cmd->efile = efile; 2f2: 0144bc23 sd s4,24(s1) cmd->mode = mode; 2f6: 0334a023 sw s3,32(s1) cmd->fd = fd; 2fa: 0324a223 sw s2,36(s1) return (struct cmd*)cmd; } 2fe: 8526 mv a0,s1 300: 70e2 ld ra,56(sp) 302: 7442 ld s0,48(sp) 304: 74a2 ld s1,40(sp) 306: 7902 ld s2,32(sp) 308: 69e2 ld s3,24(sp) 30a: 6a42 ld s4,16(sp) 30c: 6aa2 ld s5,8(sp) 30e: 6b02 ld s6,0(sp) 310: 6121 addi sp,sp,64 312: 8082 ret 0000000000000314 <pipecmd>: struct cmd* pipecmd(struct cmd *left, struct cmd *right) { 314: 7179 addi sp,sp,-48 316: f406 sd ra,40(sp) 318: f022 sd s0,32(sp) 31a: ec26 sd s1,24(sp) 31c: e84a sd s2,16(sp) 31e: e44e sd s3,8(sp) 320: 1800 addi s0,sp,48 322: 89aa mv s3,a0 324: 892e mv s2,a1 struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 326: 4561 li a0,24 328: 00001097 auipc ra,0x1 32c: efa080e7 jalr -262(ra) # 1222 <malloc> 330: 84aa mv s1,a0 memset(cmd, 0, sizeof(*cmd)); 332: 4661 li a2,24 334: 4581 li a1,0 336: 00001097 auipc ra,0x1 33a: 898080e7 jalr -1896(ra) # bce <memset> cmd->type = PIPE; 33e: 478d li a5,3 340: c09c sw a5,0(s1) cmd->left = left; 342: 0134b423 sd s3,8(s1) cmd->right = right; 346: 0124b823 sd s2,16(s1) return (struct cmd*)cmd; } 34a: 8526 mv a0,s1 34c: 70a2 ld ra,40(sp) 34e: 7402 ld s0,32(sp) 350: 64e2 ld s1,24(sp) 352: 6942 ld s2,16(sp) 354: 69a2 ld s3,8(sp) 356: 6145 addi sp,sp,48 358: 8082 ret 000000000000035a <listcmd>: struct cmd* listcmd(struct cmd *left, struct cmd *right) { 35a: 7179 addi sp,sp,-48 35c: f406 sd ra,40(sp) 35e: f022 sd s0,32(sp) 360: ec26 sd s1,24(sp) 362: e84a sd s2,16(sp) 364: e44e sd s3,8(sp) 366: 1800 addi s0,sp,48 368: 89aa mv s3,a0 36a: 892e mv s2,a1 struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 36c: 4561 li a0,24 36e: 00001097 auipc ra,0x1 372: eb4080e7 jalr -332(ra) # 1222 <malloc> 376: 84aa mv s1,a0 memset(cmd, 0, sizeof(*cmd)); 378: 4661 li a2,24 37a: 4581 li a1,0 37c: 00001097 auipc ra,0x1 380: 852080e7 jalr -1966(ra) # bce <memset> cmd->type = LIST; 384: 4791 li a5,4 386: c09c sw a5,0(s1) cmd->left = left; 388: 0134b423 sd s3,8(s1) cmd->right = right; 38c: 0124b823 sd s2,16(s1) return (struct cmd*)cmd; } 390: 8526 mv a0,s1 392: 70a2 ld ra,40(sp) 394: 7402 ld s0,32(sp) 396: 64e2 ld s1,24(sp) 398: 6942 ld s2,16(sp) 39a: 69a2 ld s3,8(sp) 39c: 6145 addi sp,sp,48 39e: 8082 ret 00000000000003a0 <backcmd>: struct cmd* backcmd(struct cmd *subcmd) { 3a0: 1101 addi sp,sp,-32 3a2: ec06 sd ra,24(sp) 3a4: e822 sd s0,16(sp) 3a6: e426 sd s1,8(sp) 3a8: e04a sd s2,0(sp) 3aa: 1000 addi s0,sp,32 3ac: 892a mv s2,a0 struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 3ae: 4541 li a0,16 3b0: 00001097 auipc ra,0x1 3b4: e72080e7 jalr -398(ra) # 1222 <malloc> 3b8: 84aa mv s1,a0 memset(cmd, 0, sizeof(*cmd)); 3ba: 4641 li a2,16 3bc: 4581 li a1,0 3be: 00001097 auipc ra,0x1 3c2: 810080e7 jalr -2032(ra) # bce <memset> cmd->type = BACK; 3c6: 4795 li a5,5 3c8: c09c sw a5,0(s1) cmd->cmd = subcmd; 3ca: 0124b423 sd s2,8(s1) return (struct cmd*)cmd; } 3ce: 8526 mv a0,s1 3d0: 60e2 ld ra,24(sp) 3d2: 6442 ld s0,16(sp) 3d4: 64a2 ld s1,8(sp) 3d6: 6902 ld s2,0(sp) 3d8: 6105 addi sp,sp,32 3da: 8082 ret 00000000000003dc <gettoken>: char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 3dc: 7139 addi sp,sp,-64 3de: fc06 sd ra,56(sp) 3e0: f822 sd s0,48(sp) 3e2: f426 sd s1,40(sp) 3e4: f04a sd s2,32(sp) 3e6: ec4e sd s3,24(sp) 3e8: e852 sd s4,16(sp) 3ea: e456 sd s5,8(sp) 3ec: e05a sd s6,0(sp) 3ee: 0080 addi s0,sp,64 3f0: 8a2a mv s4,a0 3f2: 892e mv s2,a1 3f4: 8ab2 mv s5,a2 3f6: 8b36 mv s6,a3 char *s; int ret; s = *ps; 3f8: 6104 ld s1,0(a0) while(s < es && strchr(whitespace, *s)) 3fa: 00001997 auipc s3,0x1 3fe: 0ce98993 addi s3,s3,206 # 14c8 <whitespace> 402: 00b4fe63 bgeu s1,a1,41e <gettoken+0x42> 406: 0004c583 lbu a1,0(s1) 40a: 854e mv a0,s3 40c: 00000097 auipc ra,0x0 410: 7e4080e7 jalr 2020(ra) # bf0 <strchr> 414: c509 beqz a0,41e <gettoken+0x42> s++; 416: 0485 addi s1,s1,1 while(s < es && strchr(whitespace, *s)) 418: fe9917e3 bne s2,s1,406 <gettoken+0x2a> s++; 41c: 84ca mv s1,s2 if(q) 41e: 000a8463 beqz s5,426 <gettoken+0x4a> *q = s; 422: 009ab023 sd s1,0(s5) ret = *s; 426: 0004c783 lbu a5,0(s1) 42a: 00078a9b sext.w s5,a5 switch(*s){ 42e: 03c00713 li a4,60 432: 06f76663 bltu a4,a5,49e <gettoken+0xc2> 436: 03a00713 li a4,58 43a: 00f76e63 bltu a4,a5,456 <gettoken+0x7a> 43e: cf89 beqz a5,458 <gettoken+0x7c> 440: 02600713 li a4,38 444: 00e78963 beq a5,a4,456 <gettoken+0x7a> 448: fd87879b addiw a5,a5,-40 44c: 0ff7f793 zext.b a5,a5 450: 4705 li a4,1 452: 06f76d63 bltu a4,a5,4cc <gettoken+0xf0> case '(': case ')': case ';': case '&': case '<': s++; 456: 0485 addi s1,s1,1 ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if(eq) 458: 000b0463 beqz s6,460 <gettoken+0x84> *eq = s; 45c: 009b3023 sd s1,0(s6) while(s < es && strchr(whitespace, *s)) 460: 00001997 auipc s3,0x1 464: 06898993 addi s3,s3,104 # 14c8 <whitespace> 468: 0124fe63 bgeu s1,s2,484 <gettoken+0xa8> 46c: 0004c583 lbu a1,0(s1) 470: 854e mv a0,s3 472: 00000097 auipc ra,0x0 476: 77e080e7 jalr 1918(ra) # bf0 <strchr> 47a: c509 beqz a0,484 <gettoken+0xa8> s++; 47c: 0485 addi s1,s1,1 while(s < es && strchr(whitespace, *s)) 47e: fe9917e3 bne s2,s1,46c <gettoken+0x90> s++; 482: 84ca mv s1,s2 *ps = s; 484: 009a3023 sd s1,0(s4) return ret; } 488: 8556 mv a0,s5 48a: 70e2 ld ra,56(sp) 48c: 7442 ld s0,48(sp) 48e: 74a2 ld s1,40(sp) 490: 7902 ld s2,32(sp) 492: 69e2 ld s3,24(sp) 494: 6a42 ld s4,16(sp) 496: 6aa2 ld s5,8(sp) 498: 6b02 ld s6,0(sp) 49a: 6121 addi sp,sp,64 49c: 8082 ret switch(*s){ 49e: 03e00713 li a4,62 4a2: 02e79163 bne a5,a4,4c4 <gettoken+0xe8> s++; 4a6: 00148693 addi a3,s1,1 if(*s == '>'){ 4aa: 0014c703 lbu a4,1(s1) 4ae: 03e00793 li a5,62 s++; 4b2: 0489 addi s1,s1,2 ret = '+'; 4b4: 02b00a93 li s5,43 if(*s == '>'){ 4b8: faf700e3 beq a4,a5,458 <gettoken+0x7c> s++; 4bc: 84b6 mv s1,a3 ret = *s; 4be: 03e00a93 li s5,62 4c2: bf59 j 458 <gettoken+0x7c> switch(*s){ 4c4: 07c00713 li a4,124 4c8: f8e787e3 beq a5,a4,456 <gettoken+0x7a> while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 4cc: 00001997 auipc s3,0x1 4d0: ffc98993 addi s3,s3,-4 # 14c8 <whitespace> 4d4: 00001a97 auipc s5,0x1 4d8: feca8a93 addi s5,s5,-20 # 14c0 <symbols> 4dc: 0324f663 bgeu s1,s2,508 <gettoken+0x12c> 4e0: 0004c583 lbu a1,0(s1) 4e4: 854e mv a0,s3 4e6: 00000097 auipc ra,0x0 4ea: 70a080e7 jalr 1802(ra) # bf0 <strchr> 4ee: e50d bnez a0,518 <gettoken+0x13c> 4f0: 0004c583 lbu a1,0(s1) 4f4: 8556 mv a0,s5 4f6: 00000097 auipc ra,0x0 4fa: 6fa080e7 jalr 1786(ra) # bf0 <strchr> 4fe: e911 bnez a0,512 <gettoken+0x136> s++; 500: 0485 addi s1,s1,1 while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 502: fc991fe3 bne s2,s1,4e0 <gettoken+0x104> s++; 506: 84ca mv s1,s2 if(eq) 508: 06100a93 li s5,97 50c: f40b18e3 bnez s6,45c <gettoken+0x80> 510: bf95 j 484 <gettoken+0xa8> ret = 'a'; 512: 06100a93 li s5,97 516: b789 j 458 <gettoken+0x7c> 518: 06100a93 li s5,97 51c: bf35 j 458 <gettoken+0x7c> 000000000000051e <peek>: int peek(char **ps, char *es, char *toks) { 51e: 7139 addi sp,sp,-64 520: fc06 sd ra,56(sp) 522: f822 sd s0,48(sp) 524: f426 sd s1,40(sp) 526: f04a sd s2,32(sp) 528: ec4e sd s3,24(sp) 52a: e852 sd s4,16(sp) 52c: e456 sd s5,8(sp) 52e: 0080 addi s0,sp,64 530: 8a2a mv s4,a0 532: 892e mv s2,a1 534: 8ab2 mv s5,a2 char *s; s = *ps; 536: 6104 ld s1,0(a0) while(s < es && strchr(whitespace, *s)) 538: 00001997 auipc s3,0x1 53c: f9098993 addi s3,s3,-112 # 14c8 <whitespace> 540: 00b4fe63 bgeu s1,a1,55c <peek+0x3e> 544: 0004c583 lbu a1,0(s1) 548: 854e mv a0,s3 54a: 00000097 auipc ra,0x0 54e: 6a6080e7 jalr 1702(ra) # bf0 <strchr> 552: c509 beqz a0,55c <peek+0x3e> s++; 554: 0485 addi s1,s1,1 while(s < es && strchr(whitespace, *s)) 556: fe9917e3 bne s2,s1,544 <peek+0x26> s++; 55a: 84ca mv s1,s2 *ps = s; 55c: 009a3023 sd s1,0(s4) return *s && strchr(toks, *s); 560: 0004c583 lbu a1,0(s1) 564: 4501 li a0,0 566: e991 bnez a1,57a <peek+0x5c> } 568: 70e2 ld ra,56(sp) 56a: 7442 ld s0,48(sp) 56c: 74a2 ld s1,40(sp) 56e: 7902 ld s2,32(sp) 570: 69e2 ld s3,24(sp) 572: 6a42 ld s4,16(sp) 574: 6aa2 ld s5,8(sp) 576: 6121 addi sp,sp,64 578: 8082 ret return *s && strchr(toks, *s); 57a: 8556 mv a0,s5 57c: 00000097 auipc ra,0x0 580: 674080e7 jalr 1652(ra) # bf0 <strchr> 584: 00a03533 snez a0,a0 588: b7c5 j 568 <peek+0x4a> 000000000000058a <parseredirs>: return cmd; } struct cmd* parseredirs(struct cmd *cmd, char **ps, char *es) { 58a: 7159 addi sp,sp,-112 58c: f486 sd ra,104(sp) 58e: f0a2 sd s0,96(sp) 590: eca6 sd s1,88(sp) 592: e8ca sd s2,80(sp) 594: e4ce sd s3,72(sp) 596: e0d2 sd s4,64(sp) 598: fc56 sd s5,56(sp) 59a: f85a sd s6,48(sp) 59c: f45e sd s7,40(sp) 59e: f062 sd s8,32(sp) 5a0: ec66 sd s9,24(sp) 5a2: 1880 addi s0,sp,112 5a4: 8a2a mv s4,a0 5a6: 89ae mv s3,a1 5a8: 8932 mv s2,a2 int tok; char *q, *eq; while(peek(ps, es, "<>")){ 5aa: 00001b97 auipc s7,0x1 5ae: dc6b8b93 addi s7,s7,-570 # 1370 <malloc+0x14e> tok = gettoken(ps, es, 0, 0); if(gettoken(ps, es, &q, &eq) != 'a') 5b2: 06100c13 li s8,97 panic("missing file for redirection"); switch(tok){ 5b6: 03c00c93 li s9,60 while(peek(ps, es, "<>")){ 5ba: a02d j 5e4 <parseredirs+0x5a> panic("missing file for redirection"); 5bc: 00001517 auipc a0,0x1 5c0: d9450513 addi a0,a0,-620 # 1350 <malloc+0x12e> 5c4: 00000097 auipc ra,0x0 5c8: a90080e7 jalr -1392(ra) # 54 <panic> case '<': cmd = redircmd(cmd, q, eq, O_RDONLY, 0); 5cc: 4701 li a4,0 5ce: 4681 li a3,0 5d0: f9043603 ld a2,-112(s0) 5d4: f9843583 ld a1,-104(s0) 5d8: 8552 mv a0,s4 5da: 00000097 auipc ra,0x0 5de: cd2080e7 jalr -814(ra) # 2ac <redircmd> 5e2: 8a2a mv s4,a0 switch(tok){ 5e4: 03e00b13 li s6,62 5e8: 02b00a93 li s5,43 while(peek(ps, es, "<>")){ 5ec: 865e mv a2,s7 5ee: 85ca mv a1,s2 5f0: 854e mv a0,s3 5f2: 00000097 auipc ra,0x0 5f6: f2c080e7 jalr -212(ra) # 51e <peek> 5fa: c925 beqz a0,66a <parseredirs+0xe0> tok = gettoken(ps, es, 0, 0); 5fc: 4681 li a3,0 5fe: 4601 li a2,0 600: 85ca mv a1,s2 602: 854e mv a0,s3 604: 00000097 auipc ra,0x0 608: dd8080e7 jalr -552(ra) # 3dc <gettoken> 60c: 84aa mv s1,a0 if(gettoken(ps, es, &q, &eq) != 'a') 60e: f9040693 addi a3,s0,-112 612: f9840613 addi a2,s0,-104 616: 85ca mv a1,s2 618: 854e mv a0,s3 61a: 00000097 auipc ra,0x0 61e: dc2080e7 jalr -574(ra) # 3dc <gettoken> 622: f9851de3 bne a0,s8,5bc <parseredirs+0x32> switch(tok){ 626: fb9483e3 beq s1,s9,5cc <parseredirs+0x42> 62a: 03648263 beq s1,s6,64e <parseredirs+0xc4> 62e: fb549fe3 bne s1,s5,5ec <parseredirs+0x62> break; case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE|O_TRUNC, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); 632: 4705 li a4,1 634: 20100693 li a3,513 638: f9043603 ld a2,-112(s0) 63c: f9843583 ld a1,-104(s0) 640: 8552 mv a0,s4 642: 00000097 auipc ra,0x0 646: c6a080e7 jalr -918(ra) # 2ac <redircmd> 64a: 8a2a mv s4,a0 break; 64c: bf61 j 5e4 <parseredirs+0x5a> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE|O_TRUNC, 1); 64e: 4705 li a4,1 650: 60100693 li a3,1537 654: f9043603 ld a2,-112(s0) 658: f9843583 ld a1,-104(s0) 65c: 8552 mv a0,s4 65e: 00000097 auipc ra,0x0 662: c4e080e7 jalr -946(ra) # 2ac <redircmd> 666: 8a2a mv s4,a0 break; 668: bfb5 j 5e4 <parseredirs+0x5a> } } return cmd; } 66a: 8552 mv a0,s4 66c: 70a6 ld ra,104(sp) 66e: 7406 ld s0,96(sp) 670: 64e6 ld s1,88(sp) 672: 6946 ld s2,80(sp) 674: 69a6 ld s3,72(sp) 676: 6a06 ld s4,64(sp) 678: 7ae2 ld s5,56(sp) 67a: 7b42 ld s6,48(sp) 67c: 7ba2 ld s7,40(sp) 67e: 7c02 ld s8,32(sp) 680: 6ce2 ld s9,24(sp) 682: 6165 addi sp,sp,112 684: 8082 ret 0000000000000686 <parseexec>: return cmd; } struct cmd* parseexec(char **ps, char *es) { 686: 7159 addi sp,sp,-112 688: f486 sd ra,104(sp) 68a: f0a2 sd s0,96(sp) 68c: eca6 sd s1,88(sp) 68e: e8ca sd s2,80(sp) 690: e4ce sd s3,72(sp) 692: e0d2 sd s4,64(sp) 694: fc56 sd s5,56(sp) 696: f85a sd s6,48(sp) 698: f45e sd s7,40(sp) 69a: f062 sd s8,32(sp) 69c: ec66 sd s9,24(sp) 69e: 1880 addi s0,sp,112 6a0: 8a2a mv s4,a0 6a2: 8aae mv s5,a1 char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) 6a4: 00001617 auipc a2,0x1 6a8: cd460613 addi a2,a2,-812 # 1378 <malloc+0x156> 6ac: 00000097 auipc ra,0x0 6b0: e72080e7 jalr -398(ra) # 51e <peek> 6b4: e905 bnez a0,6e4 <parseexec+0x5e> 6b6: 89aa mv s3,a0 return parseblock(ps, es); ret = execcmd(); 6b8: 00000097 auipc ra,0x0 6bc: bbe080e7 jalr -1090(ra) # 276 <execcmd> 6c0: 8c2a mv s8,a0 cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); 6c2: 8656 mv a2,s5 6c4: 85d2 mv a1,s4 6c6: 00000097 auipc ra,0x0 6ca: ec4080e7 jalr -316(ra) # 58a <parseredirs> 6ce: 84aa mv s1,a0 while(!peek(ps, es, "|)&;")){ 6d0: 008c0913 addi s2,s8,8 6d4: 00001b17 auipc s6,0x1 6d8: cc4b0b13 addi s6,s6,-828 # 1398 <malloc+0x176> if((tok=gettoken(ps, es, &q, &eq)) == 0) break; if(tok != 'a') 6dc: 06100c93 li s9,97 panic("syntax"); cmd->argv[argc] = q; cmd->eargv[argc] = eq; argc++; if(argc >= MAXARGS) 6e0: 4ba9 li s7,10 while(!peek(ps, es, "|)&;")){ 6e2: a0b1 j 72e <parseexec+0xa8> return parseblock(ps, es); 6e4: 85d6 mv a1,s5 6e6: 8552 mv a0,s4 6e8: 00000097 auipc ra,0x0 6ec: 1bc080e7 jalr 444(ra) # 8a4 <parseblock> 6f0: 84aa mv s1,a0 ret = parseredirs(ret, ps, es); } cmd->argv[argc] = 0; cmd->eargv[argc] = 0; return ret; } 6f2: 8526 mv a0,s1 6f4: 70a6 ld ra,104(sp) 6f6: 7406 ld s0,96(sp) 6f8: 64e6 ld s1,88(sp) 6fa: 6946 ld s2,80(sp) 6fc: 69a6 ld s3,72(sp) 6fe: 6a06 ld s4,64(sp) 700: 7ae2 ld s5,56(sp) 702: 7b42 ld s6,48(sp) 704: 7ba2 ld s7,40(sp) 706: 7c02 ld s8,32(sp) 708: 6ce2 ld s9,24(sp) 70a: 6165 addi sp,sp,112 70c: 8082 ret panic("syntax"); 70e: 00001517 auipc a0,0x1 712: c7250513 addi a0,a0,-910 # 1380 <malloc+0x15e> 716: 00000097 auipc ra,0x0 71a: 93e080e7 jalr -1730(ra) # 54 <panic> ret = parseredirs(ret, ps, es); 71e: 8656 mv a2,s5 720: 85d2 mv a1,s4 722: 8526 mv a0,s1 724: 00000097 auipc ra,0x0 728: e66080e7 jalr -410(ra) # 58a <parseredirs> 72c: 84aa mv s1,a0 while(!peek(ps, es, "|)&;")){ 72e: 865a mv a2,s6 730: 85d6 mv a1,s5 732: 8552 mv a0,s4 734: 00000097 auipc ra,0x0 738: dea080e7 jalr -534(ra) # 51e <peek> 73c: e131 bnez a0,780 <parseexec+0xfa> if((tok=gettoken(ps, es, &q, &eq)) == 0) 73e: f9040693 addi a3,s0,-112 742: f9840613 addi a2,s0,-104 746: 85d6 mv a1,s5 748: 8552 mv a0,s4 74a: 00000097 auipc ra,0x0 74e: c92080e7 jalr -878(ra) # 3dc <gettoken> 752: c51d beqz a0,780 <parseexec+0xfa> if(tok != 'a') 754: fb951de3 bne a0,s9,70e <parseexec+0x88> cmd->argv[argc] = q; 758: f9843783 ld a5,-104(s0) 75c: 00f93023 sd a5,0(s2) cmd->eargv[argc] = eq; 760: f9043783 ld a5,-112(s0) 764: 04f93823 sd a5,80(s2) argc++; 768: 2985 addiw s3,s3,1 if(argc >= MAXARGS) 76a: 0921 addi s2,s2,8 76c: fb7999e3 bne s3,s7,71e <parseexec+0x98> panic("too many args"); 770: 00001517 auipc a0,0x1 774: c1850513 addi a0,a0,-1000 # 1388 <malloc+0x166> 778: 00000097 auipc ra,0x0 77c: 8dc080e7 jalr -1828(ra) # 54 <panic> cmd->argv[argc] = 0; 780: 098e slli s3,s3,0x3 782: 9c4e add s8,s8,s3 784: 000c3423 sd zero,8(s8) cmd->eargv[argc] = 0; 788: 040c3c23 sd zero,88(s8) return ret; 78c: b79d j 6f2 <parseexec+0x6c> 000000000000078e <parsepipe>: { 78e: 7179 addi sp,sp,-48 790: f406 sd ra,40(sp) 792: f022 sd s0,32(sp) 794: ec26 sd s1,24(sp) 796: e84a sd s2,16(sp) 798: e44e sd s3,8(sp) 79a: 1800 addi s0,sp,48 79c: 892a mv s2,a0 79e: 89ae mv s3,a1 cmd = parseexec(ps, es); 7a0: 00000097 auipc ra,0x0 7a4: ee6080e7 jalr -282(ra) # 686 <parseexec> 7a8: 84aa mv s1,a0 if(peek(ps, es, "|")){ 7aa: 00001617 auipc a2,0x1 7ae: bf660613 addi a2,a2,-1034 # 13a0 <malloc+0x17e> 7b2: 85ce mv a1,s3 7b4: 854a mv a0,s2 7b6: 00000097 auipc ra,0x0 7ba: d68080e7 jalr -664(ra) # 51e <peek> 7be: e909 bnez a0,7d0 <parsepipe+0x42> } 7c0: 8526 mv a0,s1 7c2: 70a2 ld ra,40(sp) 7c4: 7402 ld s0,32(sp) 7c6: 64e2 ld s1,24(sp) 7c8: 6942 ld s2,16(sp) 7ca: 69a2 ld s3,8(sp) 7cc: 6145 addi sp,sp,48 7ce: 8082 ret gettoken(ps, es, 0, 0); 7d0: 4681 li a3,0 7d2: 4601 li a2,0 7d4: 85ce mv a1,s3 7d6: 854a mv a0,s2 7d8: 00000097 auipc ra,0x0 7dc: c04080e7 jalr -1020(ra) # 3dc <gettoken> cmd = pipecmd(cmd, parsepipe(ps, es)); 7e0: 85ce mv a1,s3 7e2: 854a mv a0,s2 7e4: 00000097 auipc ra,0x0 7e8: faa080e7 jalr -86(ra) # 78e <parsepipe> 7ec: 85aa mv a1,a0 7ee: 8526 mv a0,s1 7f0: 00000097 auipc ra,0x0 7f4: b24080e7 jalr -1244(ra) # 314 <pipecmd> 7f8: 84aa mv s1,a0 return cmd; 7fa: b7d9 j 7c0 <parsepipe+0x32> 00000000000007fc <parseline>: { 7fc: 7179 addi sp,sp,-48 7fe: f406 sd ra,40(sp) 800: f022 sd s0,32(sp) 802: ec26 sd s1,24(sp) 804: e84a sd s2,16(sp) 806: e44e sd s3,8(sp) 808: e052 sd s4,0(sp) 80a: 1800 addi s0,sp,48 80c: 892a mv s2,a0 80e: 89ae mv s3,a1 cmd = parsepipe(ps, es); 810: 00000097 auipc ra,0x0 814: f7e080e7 jalr -130(ra) # 78e <parsepipe> 818: 84aa mv s1,a0 while(peek(ps, es, "&")){ 81a: 00001a17 auipc s4,0x1 81e: b8ea0a13 addi s4,s4,-1138 # 13a8 <malloc+0x186> 822: a839 j 840 <parseline+0x44> gettoken(ps, es, 0, 0); 824: 4681 li a3,0 826: 4601 li a2,0 828: 85ce mv a1,s3 82a: 854a mv a0,s2 82c: 00000097 auipc ra,0x0 830: bb0080e7 jalr -1104(ra) # 3dc <gettoken> cmd = backcmd(cmd); 834: 8526 mv a0,s1 836: 00000097 auipc ra,0x0 83a: b6a080e7 jalr -1174(ra) # 3a0 <backcmd> 83e: 84aa mv s1,a0 while(peek(ps, es, "&")){ 840: 8652 mv a2,s4 842: 85ce mv a1,s3 844: 854a mv a0,s2 846: 00000097 auipc ra,0x0 84a: cd8080e7 jalr -808(ra) # 51e <peek> 84e: f979 bnez a0,824 <parseline+0x28> if(peek(ps, es, ";")){ 850: 00001617 auipc a2,0x1 854: b6060613 addi a2,a2,-1184 # 13b0 <malloc+0x18e> 858: 85ce mv a1,s3 85a: 854a mv a0,s2 85c: 00000097 auipc ra,0x0 860: cc2080e7 jalr -830(ra) # 51e <peek> 864: e911 bnez a0,878 <parseline+0x7c> } 866: 8526 mv a0,s1 868: 70a2 ld ra,40(sp) 86a: 7402 ld s0,32(sp) 86c: 64e2 ld s1,24(sp) 86e: 6942 ld s2,16(sp) 870: 69a2 ld s3,8(sp) 872: 6a02 ld s4,0(sp) 874: 6145 addi sp,sp,48 876: 8082 ret gettoken(ps, es, 0, 0); 878: 4681 li a3,0 87a: 4601 li a2,0 87c: 85ce mv a1,s3 87e: 854a mv a0,s2 880: 00000097 auipc ra,0x0 884: b5c080e7 jalr -1188(ra) # 3dc <gettoken> cmd = listcmd(cmd, parseline(ps, es)); 888: 85ce mv a1,s3 88a: 854a mv a0,s2 88c: 00000097 auipc ra,0x0 890: f70080e7 jalr -144(ra) # 7fc <parseline> 894: 85aa mv a1,a0 896: 8526 mv a0,s1 898: 00000097 auipc ra,0x0 89c: ac2080e7 jalr -1342(ra) # 35a <listcmd> 8a0: 84aa mv s1,a0 return cmd; 8a2: b7d1 j 866 <parseline+0x6a> 00000000000008a4 <parseblock>: { 8a4: 7179 addi sp,sp,-48 8a6: f406 sd ra,40(sp) 8a8: f022 sd s0,32(sp) 8aa: ec26 sd s1,24(sp) 8ac: e84a sd s2,16(sp) 8ae: e44e sd s3,8(sp) 8b0: 1800 addi s0,sp,48 8b2: 84aa mv s1,a0 8b4: 892e mv s2,a1 if(!peek(ps, es, "(")) 8b6: 00001617 auipc a2,0x1 8ba: ac260613 addi a2,a2,-1342 # 1378 <malloc+0x156> 8be: 00000097 auipc ra,0x0 8c2: c60080e7 jalr -928(ra) # 51e <peek> 8c6: c12d beqz a0,928 <parseblock+0x84> gettoken(ps, es, 0, 0); 8c8: 4681 li a3,0 8ca: 4601 li a2,0 8cc: 85ca mv a1,s2 8ce: 8526 mv a0,s1 8d0: 00000097 auipc ra,0x0 8d4: b0c080e7 jalr -1268(ra) # 3dc <gettoken> cmd = parseline(ps, es); 8d8: 85ca mv a1,s2 8da: 8526 mv a0,s1 8dc: 00000097 auipc ra,0x0 8e0: f20080e7 jalr -224(ra) # 7fc <parseline> 8e4: 89aa mv s3,a0 if(!peek(ps, es, ")")) 8e6: 00001617 auipc a2,0x1 8ea: ae260613 addi a2,a2,-1310 # 13c8 <malloc+0x1a6> 8ee: 85ca mv a1,s2 8f0: 8526 mv a0,s1 8f2: 00000097 auipc ra,0x0 8f6: c2c080e7 jalr -980(ra) # 51e <peek> 8fa: cd1d beqz a0,938 <parseblock+0x94> gettoken(ps, es, 0, 0); 8fc: 4681 li a3,0 8fe: 4601 li a2,0 900: 85ca mv a1,s2 902: 8526 mv a0,s1 904: 00000097 auipc ra,0x0 908: ad8080e7 jalr -1320(ra) # 3dc <gettoken> cmd = parseredirs(cmd, ps, es); 90c: 864a mv a2,s2 90e: 85a6 mv a1,s1 910: 854e mv a0,s3 912: 00000097 auipc ra,0x0 916: c78080e7 jalr -904(ra) # 58a <parseredirs> } 91a: 70a2 ld ra,40(sp) 91c: 7402 ld s0,32(sp) 91e: 64e2 ld s1,24(sp) 920: 6942 ld s2,16(sp) 922: 69a2 ld s3,8(sp) 924: 6145 addi sp,sp,48 926: 8082 ret panic("parseblock"); 928: 00001517 auipc a0,0x1 92c: a9050513 addi a0,a0,-1392 # 13b8 <malloc+0x196> 930: fffff097 auipc ra,0xfffff 934: 724080e7 jalr 1828(ra) # 54 <panic> panic("syntax - missing )"); 938: 00001517 auipc a0,0x1 93c: a9850513 addi a0,a0,-1384 # 13d0 <malloc+0x1ae> 940: fffff097 auipc ra,0xfffff 944: 714080e7 jalr 1812(ra) # 54 <panic> 0000000000000948 <nulterminate>: // NUL-terminate all the counted strings. struct cmd* nulterminate(struct cmd *cmd) { 948: 1101 addi sp,sp,-32 94a: ec06 sd ra,24(sp) 94c: e822 sd s0,16(sp) 94e: e426 sd s1,8(sp) 950: 1000 addi s0,sp,32 952: 84aa mv s1,a0 struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) 954: c521 beqz a0,99c <nulterminate+0x54> return 0; switch(cmd->type){ 956: 4118 lw a4,0(a0) 958: 4795 li a5,5 95a: 04e7e163 bltu a5,a4,99c <nulterminate+0x54> 95e: 00056783 lwu a5,0(a0) 962: 078a slli a5,a5,0x2 964: 00001717 auipc a4,0x1 968: acc70713 addi a4,a4,-1332 # 1430 <malloc+0x20e> 96c: 97ba add a5,a5,a4 96e: 439c lw a5,0(a5) 970: 97ba add a5,a5,a4 972: 8782 jr a5 case EXEC: ecmd = (struct execcmd*)cmd; for(i=0; ecmd->argv[i]; i++) 974: 651c ld a5,8(a0) 976: c39d beqz a5,99c <nulterminate+0x54> 978: 01050793 addi a5,a0,16 *ecmd->eargv[i] = 0; 97c: 67b8 ld a4,72(a5) 97e: 00070023 sb zero,0(a4) for(i=0; ecmd->argv[i]; i++) 982: 07a1 addi a5,a5,8 984: ff87b703 ld a4,-8(a5) 988: fb75 bnez a4,97c <nulterminate+0x34> 98a: a809 j 99c <nulterminate+0x54> break; case REDIR: rcmd = (struct redircmd*)cmd; nulterminate(rcmd->cmd); 98c: 6508 ld a0,8(a0) 98e: 00000097 auipc ra,0x0 992: fba080e7 jalr -70(ra) # 948 <nulterminate> *rcmd->efile = 0; 996: 6c9c ld a5,24(s1) 998: 00078023 sb zero,0(a5) bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } 99c: 8526 mv a0,s1 99e: 60e2 ld ra,24(sp) 9a0: 6442 ld s0,16(sp) 9a2: 64a2 ld s1,8(sp) 9a4: 6105 addi sp,sp,32 9a6: 8082 ret nulterminate(pcmd->left); 9a8: 6508 ld a0,8(a0) 9aa: 00000097 auipc ra,0x0 9ae: f9e080e7 jalr -98(ra) # 948 <nulterminate> nulterminate(pcmd->right); 9b2: 6888 ld a0,16(s1) 9b4: 00000097 auipc ra,0x0 9b8: f94080e7 jalr -108(ra) # 948 <nulterminate> break; 9bc: b7c5 j 99c <nulterminate+0x54> nulterminate(lcmd->left); 9be: 6508 ld a0,8(a0) 9c0: 00000097 auipc ra,0x0 9c4: f88080e7 jalr -120(ra) # 948 <nulterminate> nulterminate(lcmd->right); 9c8: 6888 ld a0,16(s1) 9ca: 00000097 auipc ra,0x0 9ce: f7e080e7 jalr -130(ra) # 948 <nulterminate> break; 9d2: b7e9 j 99c <nulterminate+0x54> nulterminate(bcmd->cmd); 9d4: 6508 ld a0,8(a0) 9d6: 00000097 auipc ra,0x0 9da: f72080e7 jalr -142(ra) # 948 <nulterminate> break; 9de: bf7d j 99c <nulterminate+0x54> 00000000000009e0 <parsecmd>: { 9e0: 7179 addi sp,sp,-48 9e2: f406 sd ra,40(sp) 9e4: f022 sd s0,32(sp) 9e6: ec26 sd s1,24(sp) 9e8: e84a sd s2,16(sp) 9ea: 1800 addi s0,sp,48 9ec: fca43c23 sd a0,-40(s0) es = s + strlen(s); 9f0: 84aa mv s1,a0 9f2: 00000097 auipc ra,0x0 9f6: 1b2080e7 jalr 434(ra) # ba4 <strlen> 9fa: 1502 slli a0,a0,0x20 9fc: 9101 srli a0,a0,0x20 9fe: 94aa add s1,s1,a0 cmd = parseline(&s, es); a00: 85a6 mv a1,s1 a02: fd840513 addi a0,s0,-40 a06: 00000097 auipc ra,0x0 a0a: df6080e7 jalr -522(ra) # 7fc <parseline> a0e: 892a mv s2,a0 peek(&s, es, ""); a10: 00001617 auipc a2,0x1 a14: 9d860613 addi a2,a2,-1576 # 13e8 <malloc+0x1c6> a18: 85a6 mv a1,s1 a1a: fd840513 addi a0,s0,-40 a1e: 00000097 auipc ra,0x0 a22: b00080e7 jalr -1280(ra) # 51e <peek> if(s != es){ a26: fd843603 ld a2,-40(s0) a2a: 00961e63 bne a2,s1,a46 <parsecmd+0x66> nulterminate(cmd); a2e: 854a mv a0,s2 a30: 00000097 auipc ra,0x0 a34: f18080e7 jalr -232(ra) # 948 <nulterminate> } a38: 854a mv a0,s2 a3a: 70a2 ld ra,40(sp) a3c: 7402 ld s0,32(sp) a3e: 64e2 ld s1,24(sp) a40: 6942 ld s2,16(sp) a42: 6145 addi sp,sp,48 a44: 8082 ret fprintf(2, "leftovers: %s\n", s); a46: 00001597 auipc a1,0x1 a4a: 9aa58593 addi a1,a1,-1622 # 13f0 <malloc+0x1ce> a4e: 4509 li a0,2 a50: 00000097 auipc ra,0x0 a54: 6ec080e7 jalr 1772(ra) # 113c <fprintf> panic("syntax"); a58: 00001517 auipc a0,0x1 a5c: 92850513 addi a0,a0,-1752 # 1380 <malloc+0x15e> a60: fffff097 auipc ra,0xfffff a64: 5f4080e7 jalr 1524(ra) # 54 <panic> 0000000000000a68 <main>: { a68: 7139 addi sp,sp,-64 a6a: fc06 sd ra,56(sp) a6c: f822 sd s0,48(sp) a6e: f426 sd s1,40(sp) a70: f04a sd s2,32(sp) a72: ec4e sd s3,24(sp) a74: e852 sd s4,16(sp) a76: e456 sd s5,8(sp) a78: 0080 addi s0,sp,64 while((fd = open("console", O_RDWR)) >= 0){ a7a: 00001497 auipc s1,0x1 a7e: 98648493 addi s1,s1,-1658 # 1400 <malloc+0x1de> a82: 4589 li a1,2 a84: 8526 mv a0,s1 a86: 00000097 auipc ra,0x0 a8a: 382080e7 jalr 898(ra) # e08 <open> a8e: 00054963 bltz a0,aa0 <main+0x38> if(fd >= 3){ a92: 4789 li a5,2 a94: fea7d7e3 bge a5,a0,a82 <main+0x1a> close(fd); a98: 00000097 auipc ra,0x0 a9c: 358080e7 jalr 856(ra) # df0 <close> while(getcmd(buf, sizeof(buf)) >= 0){ aa0: 00001497 auipc s1,0x1 aa4: a3848493 addi s1,s1,-1480 # 14d8 <buf.0> if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ aa8: 06300913 li s2,99 aac: 02000993 li s3,32 if(chdir(buf+3) < 0) ab0: 00001a17 auipc s4,0x1 ab4: a2ba0a13 addi s4,s4,-1493 # 14db <buf.0+0x3> fprintf(2, "cannot cd %s\n", buf+3); ab8: 00001a97 auipc s5,0x1 abc: 950a8a93 addi s5,s5,-1712 # 1408 <malloc+0x1e6> ac0: a819 j ad6 <main+0x6e> if(fork1() == 0) ac2: fffff097 auipc ra,0xfffff ac6: 5b8080e7 jalr 1464(ra) # 7a <fork1> aca: c925 beqz a0,b3a <main+0xd2> wait(0); acc: 4501 li a0,0 ace: 00000097 auipc ra,0x0 ad2: 302080e7 jalr 770(ra) # dd0 <wait> while(getcmd(buf, sizeof(buf)) >= 0){ ad6: 06400593 li a1,100 ada: 8526 mv a0,s1 adc: fffff097 auipc ra,0xfffff ae0: 524080e7 jalr 1316(ra) # 0 <getcmd> ae4: 06054763 bltz a0,b52 <main+0xea> if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ ae8: 0004c783 lbu a5,0(s1) aec: fd279be3 bne a5,s2,ac2 <main+0x5a> af0: 0014c703 lbu a4,1(s1) af4: 06400793 li a5,100 af8: fcf715e3 bne a4,a5,ac2 <main+0x5a> afc: 0024c783 lbu a5,2(s1) b00: fd3791e3 bne a5,s3,ac2 <main+0x5a> buf[strlen(buf)-1] = 0; // chop \n b04: 8526 mv a0,s1 b06: 00000097 auipc ra,0x0 b0a: 09e080e7 jalr 158(ra) # ba4 <strlen> b0e: fff5079b addiw a5,a0,-1 b12: 1782 slli a5,a5,0x20 b14: 9381 srli a5,a5,0x20 b16: 97a6 add a5,a5,s1 b18: 00078023 sb zero,0(a5) if(chdir(buf+3) < 0) b1c: 8552 mv a0,s4 b1e: 00000097 auipc ra,0x0 b22: 31a080e7 jalr 794(ra) # e38 <chdir> b26: fa0558e3 bgez a0,ad6 <main+0x6e> fprintf(2, "cannot cd %s\n", buf+3); b2a: 8652 mv a2,s4 b2c: 85d6 mv a1,s5 b2e: 4509 li a0,2 b30: 00000097 auipc ra,0x0 b34: 60c080e7 jalr 1548(ra) # 113c <fprintf> b38: bf79 j ad6 <main+0x6e> runcmd(parsecmd(buf)); b3a: 00001517 auipc a0,0x1 b3e: 99e50513 addi a0,a0,-1634 # 14d8 <buf.0> b42: 00000097 auipc ra,0x0 b46: e9e080e7 jalr -354(ra) # 9e0 <parsecmd> b4a: fffff097 auipc ra,0xfffff b4e: 55e080e7 jalr 1374(ra) # a8 <runcmd> exit(0); b52: 4501 li a0,0 b54: 00000097 auipc ra,0x0 b58: 274080e7 jalr 628(ra) # dc8 <exit> 0000000000000b5c <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { b5c: 1141 addi sp,sp,-16 b5e: e422 sd s0,8(sp) b60: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) b62: 87aa mv a5,a0 b64: 0585 addi a1,a1,1 b66: 0785 addi a5,a5,1 b68: fff5c703 lbu a4,-1(a1) b6c: fee78fa3 sb a4,-1(a5) b70: fb75 bnez a4,b64 <strcpy+0x8> ; return os; } b72: 6422 ld s0,8(sp) b74: 0141 addi sp,sp,16 b76: 8082 ret 0000000000000b78 <strcmp>: int strcmp(const char *p, const char *q) { b78: 1141 addi sp,sp,-16 b7a: e422 sd s0,8(sp) b7c: 0800 addi s0,sp,16 while(*p && *p == *q) b7e: 00054783 lbu a5,0(a0) b82: cb91 beqz a5,b96 <strcmp+0x1e> b84: 0005c703 lbu a4,0(a1) b88: 00f71763 bne a4,a5,b96 <strcmp+0x1e> p++, q++; b8c: 0505 addi a0,a0,1 b8e: 0585 addi a1,a1,1 while(*p && *p == *q) b90: 00054783 lbu a5,0(a0) b94: fbe5 bnez a5,b84 <strcmp+0xc> return (uchar)*p - (uchar)*q; b96: 0005c503 lbu a0,0(a1) } b9a: 40a7853b subw a0,a5,a0 b9e: 6422 ld s0,8(sp) ba0: 0141 addi sp,sp,16 ba2: 8082 ret 0000000000000ba4 <strlen>: uint strlen(const char *s) { ba4: 1141 addi sp,sp,-16 ba6: e422 sd s0,8(sp) ba8: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) baa: 00054783 lbu a5,0(a0) bae: cf91 beqz a5,bca <strlen+0x26> bb0: 0505 addi a0,a0,1 bb2: 87aa mv a5,a0 bb4: 4685 li a3,1 bb6: 9e89 subw a3,a3,a0 bb8: 00f6853b addw a0,a3,a5 bbc: 0785 addi a5,a5,1 bbe: fff7c703 lbu a4,-1(a5) bc2: fb7d bnez a4,bb8 <strlen+0x14> ; return n; } bc4: 6422 ld s0,8(sp) bc6: 0141 addi sp,sp,16 bc8: 8082 ret for(n = 0; s[n]; n++) bca: 4501 li a0,0 bcc: bfe5 j bc4 <strlen+0x20> 0000000000000bce <memset>: void* memset(void *dst, int c, uint n) { bce: 1141 addi sp,sp,-16 bd0: e422 sd s0,8(sp) bd2: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ bd4: ca19 beqz a2,bea <memset+0x1c> bd6: 87aa mv a5,a0 bd8: 1602 slli a2,a2,0x20 bda: 9201 srli a2,a2,0x20 bdc: 00a60733 add a4,a2,a0 cdst[i] = c; be0: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ be4: 0785 addi a5,a5,1 be6: fee79de3 bne a5,a4,be0 <memset+0x12> } return dst; } bea: 6422 ld s0,8(sp) bec: 0141 addi sp,sp,16 bee: 8082 ret 0000000000000bf0 <strchr>: char* strchr(const char *s, char c) { bf0: 1141 addi sp,sp,-16 bf2: e422 sd s0,8(sp) bf4: 0800 addi s0,sp,16 for(; *s; s++) bf6: 00054783 lbu a5,0(a0) bfa: cb99 beqz a5,c10 <strchr+0x20> if(*s == c) bfc: 00f58763 beq a1,a5,c0a <strchr+0x1a> for(; *s; s++) c00: 0505 addi a0,a0,1 c02: 00054783 lbu a5,0(a0) c06: fbfd bnez a5,bfc <strchr+0xc> return (char*)s; return 0; c08: 4501 li a0,0 } c0a: 6422 ld s0,8(sp) c0c: 0141 addi sp,sp,16 c0e: 8082 ret return 0; c10: 4501 li a0,0 c12: bfe5 j c0a <strchr+0x1a> 0000000000000c14 <gets>: char* gets(char *buf, int max) { c14: 711d addi sp,sp,-96 c16: ec86 sd ra,88(sp) c18: e8a2 sd s0,80(sp) c1a: e4a6 sd s1,72(sp) c1c: e0ca sd s2,64(sp) c1e: fc4e sd s3,56(sp) c20: f852 sd s4,48(sp) c22: f456 sd s5,40(sp) c24: f05a sd s6,32(sp) c26: ec5e sd s7,24(sp) c28: 1080 addi s0,sp,96 c2a: 8baa mv s7,a0 c2c: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ c2e: 892a mv s2,a0 c30: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') c32: 4aa9 li s5,10 c34: 4b35 li s6,13 for(i=0; i+1 < max; ){ c36: 89a6 mv s3,s1 c38: 2485 addiw s1,s1,1 c3a: 0344d863 bge s1,s4,c6a <gets+0x56> cc = read(0, &c, 1); c3e: 4605 li a2,1 c40: faf40593 addi a1,s0,-81 c44: 4501 li a0,0 c46: 00000097 auipc ra,0x0 c4a: 19a080e7 jalr 410(ra) # de0 <read> if(cc < 1) c4e: 00a05e63 blez a0,c6a <gets+0x56> buf[i++] = c; c52: faf44783 lbu a5,-81(s0) c56: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') c5a: 01578763 beq a5,s5,c68 <gets+0x54> c5e: 0905 addi s2,s2,1 c60: fd679be3 bne a5,s6,c36 <gets+0x22> for(i=0; i+1 < max; ){ c64: 89a6 mv s3,s1 c66: a011 j c6a <gets+0x56> c68: 89a6 mv s3,s1 break; } buf[i] = '\0'; c6a: 99de add s3,s3,s7 c6c: 00098023 sb zero,0(s3) return buf; } c70: 855e mv a0,s7 c72: 60e6 ld ra,88(sp) c74: 6446 ld s0,80(sp) c76: 64a6 ld s1,72(sp) c78: 6906 ld s2,64(sp) c7a: 79e2 ld s3,56(sp) c7c: 7a42 ld s4,48(sp) c7e: 7aa2 ld s5,40(sp) c80: 7b02 ld s6,32(sp) c82: 6be2 ld s7,24(sp) c84: 6125 addi sp,sp,96 c86: 8082 ret 0000000000000c88 <stat>: int stat(const char *n, struct stat *st) { c88: 1101 addi sp,sp,-32 c8a: ec06 sd ra,24(sp) c8c: e822 sd s0,16(sp) c8e: e426 sd s1,8(sp) c90: e04a sd s2,0(sp) c92: 1000 addi s0,sp,32 c94: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); c96: 4581 li a1,0 c98: 00000097 auipc ra,0x0 c9c: 170080e7 jalr 368(ra) # e08 <open> if(fd < 0) ca0: 02054563 bltz a0,cca <stat+0x42> ca4: 84aa mv s1,a0 return -1; r = fstat(fd, st); ca6: 85ca mv a1,s2 ca8: 00000097 auipc ra,0x0 cac: 178080e7 jalr 376(ra) # e20 <fstat> cb0: 892a mv s2,a0 close(fd); cb2: 8526 mv a0,s1 cb4: 00000097 auipc ra,0x0 cb8: 13c080e7 jalr 316(ra) # df0 <close> return r; } cbc: 854a mv a0,s2 cbe: 60e2 ld ra,24(sp) cc0: 6442 ld s0,16(sp) cc2: 64a2 ld s1,8(sp) cc4: 6902 ld s2,0(sp) cc6: 6105 addi sp,sp,32 cc8: 8082 ret return -1; cca: 597d li s2,-1 ccc: bfc5 j cbc <stat+0x34> 0000000000000cce <atoi>: int atoi(const char *s) { cce: 1141 addi sp,sp,-16 cd0: e422 sd s0,8(sp) cd2: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') cd4: 00054683 lbu a3,0(a0) cd8: fd06879b addiw a5,a3,-48 cdc: 0ff7f793 zext.b a5,a5 ce0: 4625 li a2,9 ce2: 02f66863 bltu a2,a5,d12 <atoi+0x44> ce6: 872a mv a4,a0 n = 0; ce8: 4501 li a0,0 n = n*10 + *s++ - '0'; cea: 0705 addi a4,a4,1 cec: 0025179b slliw a5,a0,0x2 cf0: 9fa9 addw a5,a5,a0 cf2: 0017979b slliw a5,a5,0x1 cf6: 9fb5 addw a5,a5,a3 cf8: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') cfc: 00074683 lbu a3,0(a4) d00: fd06879b addiw a5,a3,-48 d04: 0ff7f793 zext.b a5,a5 d08: fef671e3 bgeu a2,a5,cea <atoi+0x1c> return n; } d0c: 6422 ld s0,8(sp) d0e: 0141 addi sp,sp,16 d10: 8082 ret n = 0; d12: 4501 li a0,0 d14: bfe5 j d0c <atoi+0x3e> 0000000000000d16 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { d16: 1141 addi sp,sp,-16 d18: e422 sd s0,8(sp) d1a: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { d1c: 02b57463 bgeu a0,a1,d44 <memmove+0x2e> while(n-- > 0) d20: 00c05f63 blez a2,d3e <memmove+0x28> d24: 1602 slli a2,a2,0x20 d26: 9201 srli a2,a2,0x20 d28: 00c507b3 add a5,a0,a2 dst = vdst; d2c: 872a mv a4,a0 *dst++ = *src++; d2e: 0585 addi a1,a1,1 d30: 0705 addi a4,a4,1 d32: fff5c683 lbu a3,-1(a1) d36: fed70fa3 sb a3,-1(a4) while(n-- > 0) d3a: fee79ae3 bne a5,a4,d2e <memmove+0x18> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } d3e: 6422 ld s0,8(sp) d40: 0141 addi sp,sp,16 d42: 8082 ret dst += n; d44: 00c50733 add a4,a0,a2 src += n; d48: 95b2 add a1,a1,a2 while(n-- > 0) d4a: fec05ae3 blez a2,d3e <memmove+0x28> d4e: fff6079b addiw a5,a2,-1 d52: 1782 slli a5,a5,0x20 d54: 9381 srli a5,a5,0x20 d56: fff7c793 not a5,a5 d5a: 97ba add a5,a5,a4 *--dst = *--src; d5c: 15fd addi a1,a1,-1 d5e: 177d addi a4,a4,-1 d60: 0005c683 lbu a3,0(a1) d64: 00d70023 sb a3,0(a4) while(n-- > 0) d68: fee79ae3 bne a5,a4,d5c <memmove+0x46> d6c: bfc9 j d3e <memmove+0x28> 0000000000000d6e <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { d6e: 1141 addi sp,sp,-16 d70: e422 sd s0,8(sp) d72: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { d74: ca05 beqz a2,da4 <memcmp+0x36> d76: fff6069b addiw a3,a2,-1 d7a: 1682 slli a3,a3,0x20 d7c: 9281 srli a3,a3,0x20 d7e: 0685 addi a3,a3,1 d80: 96aa add a3,a3,a0 if (*p1 != *p2) { d82: 00054783 lbu a5,0(a0) d86: 0005c703 lbu a4,0(a1) d8a: 00e79863 bne a5,a4,d9a <memcmp+0x2c> return *p1 - *p2; } p1++; d8e: 0505 addi a0,a0,1 p2++; d90: 0585 addi a1,a1,1 while (n-- > 0) { d92: fed518e3 bne a0,a3,d82 <memcmp+0x14> } return 0; d96: 4501 li a0,0 d98: a019 j d9e <memcmp+0x30> return *p1 - *p2; d9a: 40e7853b subw a0,a5,a4 } d9e: 6422 ld s0,8(sp) da0: 0141 addi sp,sp,16 da2: 8082 ret return 0; da4: 4501 li a0,0 da6: bfe5 j d9e <memcmp+0x30> 0000000000000da8 <memcpy>: void * memcpy(void *dst, const void *src, uint n) { da8: 1141 addi sp,sp,-16 daa: e406 sd ra,8(sp) dac: e022 sd s0,0(sp) dae: 0800 addi s0,sp,16 return memmove(dst, src, n); db0: 00000097 auipc ra,0x0 db4: f66080e7 jalr -154(ra) # d16 <memmove> } db8: 60a2 ld ra,8(sp) dba: 6402 ld s0,0(sp) dbc: 0141 addi sp,sp,16 dbe: 8082 ret 0000000000000dc0 <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork dc0: 4885 li a7,1 ecall dc2: 00000073 ecall ret dc6: 8082 ret 0000000000000dc8 <exit>: .global exit exit: li a7, SYS_exit dc8: 4889 li a7,2 ecall dca: 00000073 ecall ret dce: 8082 ret 0000000000000dd0 <wait>: .global wait wait: li a7, SYS_wait dd0: 488d li a7,3 ecall dd2: 00000073 ecall ret dd6: 8082 ret 0000000000000dd8 <pipe>: .global pipe pipe: li a7, SYS_pipe dd8: 4891 li a7,4 ecall dda: 00000073 ecall ret dde: 8082 ret 0000000000000de0 <read>: .global read read: li a7, SYS_read de0: 4895 li a7,5 ecall de2: 00000073 ecall ret de6: 8082 ret 0000000000000de8 <write>: .global write write: li a7, SYS_write de8: 48c1 li a7,16 ecall dea: 00000073 ecall ret dee: 8082 ret 0000000000000df0 <close>: .global close close: li a7, SYS_close df0: 48d5 li a7,21 ecall df2: 00000073 ecall ret df6: 8082 ret 0000000000000df8 <kill>: .global kill kill: li a7, SYS_kill df8: 4899 li a7,6 ecall dfa: 00000073 ecall ret dfe: 8082 ret 0000000000000e00 <exec>: .global exec exec: li a7, SYS_exec e00: 489d li a7,7 ecall e02: 00000073 ecall ret e06: 8082 ret 0000000000000e08 <open>: .global open open: li a7, SYS_open e08: 48bd li a7,15 ecall e0a: 00000073 ecall ret e0e: 8082 ret 0000000000000e10 <mknod>: .global mknod mknod: li a7, SYS_mknod e10: 48c5 li a7,17 ecall e12: 00000073 ecall ret e16: 8082 ret 0000000000000e18 <unlink>: .global unlink unlink: li a7, SYS_unlink e18: 48c9 li a7,18 ecall e1a: 00000073 ecall ret e1e: 8082 ret 0000000000000e20 <fstat>: .global fstat fstat: li a7, SYS_fstat e20: 48a1 li a7,8 ecall e22: 00000073 ecall ret e26: 8082 ret 0000000000000e28 <link>: .global link link: li a7, SYS_link e28: 48cd li a7,19 ecall e2a: 00000073 ecall ret e2e: 8082 ret 0000000000000e30 <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir e30: 48d1 li a7,20 ecall e32: 00000073 ecall ret e36: 8082 ret 0000000000000e38 <chdir>: .global chdir chdir: li a7, SYS_chdir e38: 48a5 li a7,9 ecall e3a: 00000073 ecall ret e3e: 8082 ret 0000000000000e40 <dup>: .global dup dup: li a7, SYS_dup e40: 48a9 li a7,10 ecall e42: 00000073 ecall ret e46: 8082 ret 0000000000000e48 <getpid>: .global getpid getpid: li a7, SYS_getpid e48: 48ad li a7,11 ecall e4a: 00000073 ecall ret e4e: 8082 ret 0000000000000e50 <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk e50: 48b1 li a7,12 ecall e52: 00000073 ecall ret e56: 8082 ret 0000000000000e58 <sleep>: .global sleep sleep: li a7, SYS_sleep e58: 48b5 li a7,13 ecall e5a: 00000073 ecall ret e5e: 8082 ret 0000000000000e60 <uptime>: .global uptime uptime: li a7, SYS_uptime e60: 48b9 li a7,14 ecall e62: 00000073 ecall ret e66: 8082 ret 0000000000000e68 <waitstat>: .global waitstat waitstat: li a7, SYS_waitstat e68: 48d9 li a7,22 ecall e6a: 00000073 ecall ret e6e: 8082 ret 0000000000000e70 <btput>: .global btput btput: li a7, SYS_btput e70: 48dd li a7,23 ecall e72: 00000073 ecall ret e76: 8082 ret 0000000000000e78 <tput>: .global tput tput: li a7, SYS_tput e78: 48e1 li a7,24 ecall e7a: 00000073 ecall ret e7e: 8082 ret 0000000000000e80 <btget>: .global btget btget: li a7, SYS_btget e80: 48e5 li a7,25 ecall e82: 00000073 ecall ret e86: 8082 ret 0000000000000e88 <tget>: .global tget tget: li a7, SYS_tget e88: 48e9 li a7,26 ecall e8a: 00000073 ecall ret e8e: 8082 ret 0000000000000e90 <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { e90: 1101 addi sp,sp,-32 e92: ec06 sd ra,24(sp) e94: e822 sd s0,16(sp) e96: 1000 addi s0,sp,32 e98: feb407a3 sb a1,-17(s0) write(fd, &c, 1); e9c: 4605 li a2,1 e9e: fef40593 addi a1,s0,-17 ea2: 00000097 auipc ra,0x0 ea6: f46080e7 jalr -186(ra) # de8 <write> } eaa: 60e2 ld ra,24(sp) eac: 6442 ld s0,16(sp) eae: 6105 addi sp,sp,32 eb0: 8082 ret 0000000000000eb2 <printint>: static void printint(int fd, int xx, int base, int sgn) { eb2: 7139 addi sp,sp,-64 eb4: fc06 sd ra,56(sp) eb6: f822 sd s0,48(sp) eb8: f426 sd s1,40(sp) eba: f04a sd s2,32(sp) ebc: ec4e sd s3,24(sp) ebe: 0080 addi s0,sp,64 ec0: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ ec2: c299 beqz a3,ec8 <printint+0x16> ec4: 0805c963 bltz a1,f56 <printint+0xa4> neg = 1; x = -xx; } else { x = xx; ec8: 2581 sext.w a1,a1 neg = 0; eca: 4881 li a7,0 ecc: fc040693 addi a3,s0,-64 } i = 0; ed0: 4701 li a4,0 do{ buf[i++] = digits[x % base]; ed2: 2601 sext.w a2,a2 ed4: 00000517 auipc a0,0x0 ed8: 5d450513 addi a0,a0,1492 # 14a8 <digits> edc: 883a mv a6,a4 ede: 2705 addiw a4,a4,1 ee0: 02c5f7bb remuw a5,a1,a2 ee4: 1782 slli a5,a5,0x20 ee6: 9381 srli a5,a5,0x20 ee8: 97aa add a5,a5,a0 eea: 0007c783 lbu a5,0(a5) eee: 00f68023 sb a5,0(a3) }while((x /= base) != 0); ef2: 0005879b sext.w a5,a1 ef6: 02c5d5bb divuw a1,a1,a2 efa: 0685 addi a3,a3,1 efc: fec7f0e3 bgeu a5,a2,edc <printint+0x2a> if(neg) f00: 00088c63 beqz a7,f18 <printint+0x66> buf[i++] = '-'; f04: fd070793 addi a5,a4,-48 f08: 00878733 add a4,a5,s0 f0c: 02d00793 li a5,45 f10: fef70823 sb a5,-16(a4) f14: 0028071b addiw a4,a6,2 while(--i >= 0) f18: 02e05863 blez a4,f48 <printint+0x96> f1c: fc040793 addi a5,s0,-64 f20: 00e78933 add s2,a5,a4 f24: fff78993 addi s3,a5,-1 f28: 99ba add s3,s3,a4 f2a: 377d addiw a4,a4,-1 f2c: 1702 slli a4,a4,0x20 f2e: 9301 srli a4,a4,0x20 f30: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); f34: fff94583 lbu a1,-1(s2) f38: 8526 mv a0,s1 f3a: 00000097 auipc ra,0x0 f3e: f56080e7 jalr -170(ra) # e90 <putc> while(--i >= 0) f42: 197d addi s2,s2,-1 f44: ff3918e3 bne s2,s3,f34 <printint+0x82> } f48: 70e2 ld ra,56(sp) f4a: 7442 ld s0,48(sp) f4c: 74a2 ld s1,40(sp) f4e: 7902 ld s2,32(sp) f50: 69e2 ld s3,24(sp) f52: 6121 addi sp,sp,64 f54: 8082 ret x = -xx; f56: 40b005bb negw a1,a1 neg = 1; f5a: 4885 li a7,1 x = -xx; f5c: bf85 j ecc <printint+0x1a> 0000000000000f5e <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { f5e: 7119 addi sp,sp,-128 f60: fc86 sd ra,120(sp) f62: f8a2 sd s0,112(sp) f64: f4a6 sd s1,104(sp) f66: f0ca sd s2,96(sp) f68: ecce sd s3,88(sp) f6a: e8d2 sd s4,80(sp) f6c: e4d6 sd s5,72(sp) f6e: e0da sd s6,64(sp) f70: fc5e sd s7,56(sp) f72: f862 sd s8,48(sp) f74: f466 sd s9,40(sp) f76: f06a sd s10,32(sp) f78: ec6e sd s11,24(sp) f7a: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ f7c: 0005c903 lbu s2,0(a1) f80: 18090f63 beqz s2,111e <vprintf+0x1c0> f84: 8aaa mv s5,a0 f86: 8b32 mv s6,a2 f88: 00158493 addi s1,a1,1 state = 0; f8c: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ f8e: 02500a13 li s4,37 f92: 4c55 li s8,21 f94: 00000c97 auipc s9,0x0 f98: 4bcc8c93 addi s9,s9,1212 # 1450 <malloc+0x22e> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ s = va_arg(ap, char*); if(s == 0) s = "(null)"; while(*s != 0){ f9c: 02800d93 li s11,40 putc(fd, 'x'); fa0: 4d41 li s10,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); fa2: 00000b97 auipc s7,0x0 fa6: 506b8b93 addi s7,s7,1286 # 14a8 <digits> faa: a839 j fc8 <vprintf+0x6a> putc(fd, c); fac: 85ca mv a1,s2 fae: 8556 mv a0,s5 fb0: 00000097 auipc ra,0x0 fb4: ee0080e7 jalr -288(ra) # e90 <putc> fb8: a019 j fbe <vprintf+0x60> } else if(state == '%'){ fba: 01498d63 beq s3,s4,fd4 <vprintf+0x76> for(i = 0; fmt[i]; i++){ fbe: 0485 addi s1,s1,1 fc0: fff4c903 lbu s2,-1(s1) fc4: 14090d63 beqz s2,111e <vprintf+0x1c0> if(state == 0){ fc8: fe0999e3 bnez s3,fba <vprintf+0x5c> if(c == '%'){ fcc: ff4910e3 bne s2,s4,fac <vprintf+0x4e> state = '%'; fd0: 89d2 mv s3,s4 fd2: b7f5 j fbe <vprintf+0x60> if(c == 'd'){ fd4: 11490c63 beq s2,s4,10ec <vprintf+0x18e> fd8: f9d9079b addiw a5,s2,-99 fdc: 0ff7f793 zext.b a5,a5 fe0: 10fc6e63 bltu s8,a5,10fc <vprintf+0x19e> fe4: f9d9079b addiw a5,s2,-99 fe8: 0ff7f713 zext.b a4,a5 fec: 10ec6863 bltu s8,a4,10fc <vprintf+0x19e> ff0: 00271793 slli a5,a4,0x2 ff4: 97e6 add a5,a5,s9 ff6: 439c lw a5,0(a5) ff8: 97e6 add a5,a5,s9 ffa: 8782 jr a5 printint(fd, va_arg(ap, int), 10, 1); ffc: 008b0913 addi s2,s6,8 1000: 4685 li a3,1 1002: 4629 li a2,10 1004: 000b2583 lw a1,0(s6) 1008: 8556 mv a0,s5 100a: 00000097 auipc ra,0x0 100e: ea8080e7 jalr -344(ra) # eb2 <printint> 1012: 8b4a mv s6,s2 } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 1014: 4981 li s3,0 1016: b765 j fbe <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 1018: 008b0913 addi s2,s6,8 101c: 4681 li a3,0 101e: 4629 li a2,10 1020: 000b2583 lw a1,0(s6) 1024: 8556 mv a0,s5 1026: 00000097 auipc ra,0x0 102a: e8c080e7 jalr -372(ra) # eb2 <printint> 102e: 8b4a mv s6,s2 state = 0; 1030: 4981 li s3,0 1032: b771 j fbe <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 1034: 008b0913 addi s2,s6,8 1038: 4681 li a3,0 103a: 866a mv a2,s10 103c: 000b2583 lw a1,0(s6) 1040: 8556 mv a0,s5 1042: 00000097 auipc ra,0x0 1046: e70080e7 jalr -400(ra) # eb2 <printint> 104a: 8b4a mv s6,s2 state = 0; 104c: 4981 li s3,0 104e: bf85 j fbe <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 1050: 008b0793 addi a5,s6,8 1054: f8f43423 sd a5,-120(s0) 1058: 000b3983 ld s3,0(s6) putc(fd, '0'); 105c: 03000593 li a1,48 1060: 8556 mv a0,s5 1062: 00000097 auipc ra,0x0 1066: e2e080e7 jalr -466(ra) # e90 <putc> putc(fd, 'x'); 106a: 07800593 li a1,120 106e: 8556 mv a0,s5 1070: 00000097 auipc ra,0x0 1074: e20080e7 jalr -480(ra) # e90 <putc> 1078: 896a mv s2,s10 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 107a: 03c9d793 srli a5,s3,0x3c 107e: 97de add a5,a5,s7 1080: 0007c583 lbu a1,0(a5) 1084: 8556 mv a0,s5 1086: 00000097 auipc ra,0x0 108a: e0a080e7 jalr -502(ra) # e90 <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 108e: 0992 slli s3,s3,0x4 1090: 397d addiw s2,s2,-1 1092: fe0914e3 bnez s2,107a <vprintf+0x11c> printptr(fd, va_arg(ap, uint64)); 1096: f8843b03 ld s6,-120(s0) state = 0; 109a: 4981 li s3,0 109c: b70d j fbe <vprintf+0x60> s = va_arg(ap, char*); 109e: 008b0913 addi s2,s6,8 10a2: 000b3983 ld s3,0(s6) if(s == 0) 10a6: 02098163 beqz s3,10c8 <vprintf+0x16a> while(*s != 0){ 10aa: 0009c583 lbu a1,0(s3) 10ae: c5ad beqz a1,1118 <vprintf+0x1ba> putc(fd, *s); 10b0: 8556 mv a0,s5 10b2: 00000097 auipc ra,0x0 10b6: dde080e7 jalr -546(ra) # e90 <putc> s++; 10ba: 0985 addi s3,s3,1 while(*s != 0){ 10bc: 0009c583 lbu a1,0(s3) 10c0: f9e5 bnez a1,10b0 <vprintf+0x152> s = va_arg(ap, char*); 10c2: 8b4a mv s6,s2 state = 0; 10c4: 4981 li s3,0 10c6: bde5 j fbe <vprintf+0x60> s = "(null)"; 10c8: 00000997 auipc s3,0x0 10cc: 38098993 addi s3,s3,896 # 1448 <malloc+0x226> while(*s != 0){ 10d0: 85ee mv a1,s11 10d2: bff9 j 10b0 <vprintf+0x152> putc(fd, va_arg(ap, uint)); 10d4: 008b0913 addi s2,s6,8 10d8: 000b4583 lbu a1,0(s6) 10dc: 8556 mv a0,s5 10de: 00000097 auipc ra,0x0 10e2: db2080e7 jalr -590(ra) # e90 <putc> 10e6: 8b4a mv s6,s2 state = 0; 10e8: 4981 li s3,0 10ea: bdd1 j fbe <vprintf+0x60> putc(fd, c); 10ec: 85d2 mv a1,s4 10ee: 8556 mv a0,s5 10f0: 00000097 auipc ra,0x0 10f4: da0080e7 jalr -608(ra) # e90 <putc> state = 0; 10f8: 4981 li s3,0 10fa: b5d1 j fbe <vprintf+0x60> putc(fd, '%'); 10fc: 85d2 mv a1,s4 10fe: 8556 mv a0,s5 1100: 00000097 auipc ra,0x0 1104: d90080e7 jalr -624(ra) # e90 <putc> putc(fd, c); 1108: 85ca mv a1,s2 110a: 8556 mv a0,s5 110c: 00000097 auipc ra,0x0 1110: d84080e7 jalr -636(ra) # e90 <putc> state = 0; 1114: 4981 li s3,0 1116: b565 j fbe <vprintf+0x60> s = va_arg(ap, char*); 1118: 8b4a mv s6,s2 state = 0; 111a: 4981 li s3,0 111c: b54d j fbe <vprintf+0x60> } } } 111e: 70e6 ld ra,120(sp) 1120: 7446 ld s0,112(sp) 1122: 74a6 ld s1,104(sp) 1124: 7906 ld s2,96(sp) 1126: 69e6 ld s3,88(sp) 1128: 6a46 ld s4,80(sp) 112a: 6aa6 ld s5,72(sp) 112c: 6b06 ld s6,64(sp) 112e: 7be2 ld s7,56(sp) 1130: 7c42 ld s8,48(sp) 1132: 7ca2 ld s9,40(sp) 1134: 7d02 ld s10,32(sp) 1136: 6de2 ld s11,24(sp) 1138: 6109 addi sp,sp,128 113a: 8082 ret 000000000000113c <fprintf>: void fprintf(int fd, const char *fmt, ...) { 113c: 715d addi sp,sp,-80 113e: ec06 sd ra,24(sp) 1140: e822 sd s0,16(sp) 1142: 1000 addi s0,sp,32 1144: e010 sd a2,0(s0) 1146: e414 sd a3,8(s0) 1148: e818 sd a4,16(s0) 114a: ec1c sd a5,24(s0) 114c: 03043023 sd a6,32(s0) 1150: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 1154: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 1158: 8622 mv a2,s0 115a: 00000097 auipc ra,0x0 115e: e04080e7 jalr -508(ra) # f5e <vprintf> } 1162: 60e2 ld ra,24(sp) 1164: 6442 ld s0,16(sp) 1166: 6161 addi sp,sp,80 1168: 8082 ret 000000000000116a <printf>: void printf(const char *fmt, ...) { 116a: 711d addi sp,sp,-96 116c: ec06 sd ra,24(sp) 116e: e822 sd s0,16(sp) 1170: 1000 addi s0,sp,32 1172: e40c sd a1,8(s0) 1174: e810 sd a2,16(s0) 1176: ec14 sd a3,24(s0) 1178: f018 sd a4,32(s0) 117a: f41c sd a5,40(s0) 117c: 03043823 sd a6,48(s0) 1180: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 1184: 00840613 addi a2,s0,8 1188: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 118c: 85aa mv a1,a0 118e: 4505 li a0,1 1190: 00000097 auipc ra,0x0 1194: dce080e7 jalr -562(ra) # f5e <vprintf> } 1198: 60e2 ld ra,24(sp) 119a: 6442 ld s0,16(sp) 119c: 6125 addi sp,sp,96 119e: 8082 ret 00000000000011a0 <free>: static Header base; static Header *freep; void free(void *ap) { 11a0: 1141 addi sp,sp,-16 11a2: e422 sd s0,8(sp) 11a4: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 11a6: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 11aa: 00000797 auipc a5,0x0 11ae: 3267b783 ld a5,806(a5) # 14d0 <freep> 11b2: a02d j 11dc <free+0x3c> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 11b4: 4618 lw a4,8(a2) 11b6: 9f2d addw a4,a4,a1 11b8: fee52c23 sw a4,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 11bc: 6398 ld a4,0(a5) 11be: 6310 ld a2,0(a4) 11c0: a83d j 11fe <free+0x5e> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 11c2: ff852703 lw a4,-8(a0) 11c6: 9f31 addw a4,a4,a2 11c8: c798 sw a4,8(a5) p->s.ptr = bp->s.ptr; 11ca: ff053683 ld a3,-16(a0) 11ce: a091 j 1212 <free+0x72> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 11d0: 6398 ld a4,0(a5) 11d2: 00e7e463 bltu a5,a4,11da <free+0x3a> 11d6: 00e6ea63 bltu a3,a4,11ea <free+0x4a> { 11da: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 11dc: fed7fae3 bgeu a5,a3,11d0 <free+0x30> 11e0: 6398 ld a4,0(a5) 11e2: 00e6e463 bltu a3,a4,11ea <free+0x4a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 11e6: fee7eae3 bltu a5,a4,11da <free+0x3a> if(bp + bp->s.size == p->s.ptr){ 11ea: ff852583 lw a1,-8(a0) 11ee: 6390 ld a2,0(a5) 11f0: 02059813 slli a6,a1,0x20 11f4: 01c85713 srli a4,a6,0x1c 11f8: 9736 add a4,a4,a3 11fa: fae60de3 beq a2,a4,11b4 <free+0x14> bp->s.ptr = p->s.ptr->s.ptr; 11fe: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 1202: 4790 lw a2,8(a5) 1204: 02061593 slli a1,a2,0x20 1208: 01c5d713 srli a4,a1,0x1c 120c: 973e add a4,a4,a5 120e: fae68ae3 beq a3,a4,11c2 <free+0x22> p->s.ptr = bp->s.ptr; 1212: e394 sd a3,0(a5) } else p->s.ptr = bp; freep = p; 1214: 00000717 auipc a4,0x0 1218: 2af73e23 sd a5,700(a4) # 14d0 <freep> } 121c: 6422 ld s0,8(sp) 121e: 0141 addi sp,sp,16 1220: 8082 ret 0000000000001222 <malloc>: return freep; } void* malloc(uint nbytes) { 1222: 7139 addi sp,sp,-64 1224: fc06 sd ra,56(sp) 1226: f822 sd s0,48(sp) 1228: f426 sd s1,40(sp) 122a: f04a sd s2,32(sp) 122c: ec4e sd s3,24(sp) 122e: e852 sd s4,16(sp) 1230: e456 sd s5,8(sp) 1232: e05a sd s6,0(sp) 1234: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1236: 02051493 slli s1,a0,0x20 123a: 9081 srli s1,s1,0x20 123c: 04bd addi s1,s1,15 123e: 8091 srli s1,s1,0x4 1240: 0014899b addiw s3,s1,1 1244: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 1246: 00000517 auipc a0,0x0 124a: 28a53503 ld a0,650(a0) # 14d0 <freep> 124e: c515 beqz a0,127a <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1250: 611c ld a5,0(a0) if(p->s.size >= nunits){ 1252: 4798 lw a4,8(a5) 1254: 02977f63 bgeu a4,s1,1292 <malloc+0x70> 1258: 8a4e mv s4,s3 125a: 0009871b sext.w a4,s3 125e: 6685 lui a3,0x1 1260: 00d77363 bgeu a4,a3,1266 <malloc+0x44> 1264: 6a05 lui s4,0x1 1266: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 126a: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 126e: 00000917 auipc s2,0x0 1272: 26290913 addi s2,s2,610 # 14d0 <freep> if(p == (char*)-1) 1276: 5afd li s5,-1 1278: a895 j 12ec <malloc+0xca> base.s.ptr = freep = prevp = &base; 127a: 00000797 auipc a5,0x0 127e: 2c678793 addi a5,a5,710 # 1540 <base> 1282: 00000717 auipc a4,0x0 1286: 24f73723 sd a5,590(a4) # 14d0 <freep> 128a: e39c sd a5,0(a5) base.s.size = 0; 128c: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 1290: b7e1 j 1258 <malloc+0x36> if(p->s.size == nunits) 1292: 02e48c63 beq s1,a4,12ca <malloc+0xa8> p->s.size -= nunits; 1296: 4137073b subw a4,a4,s3 129a: c798 sw a4,8(a5) p += p->s.size; 129c: 02071693 slli a3,a4,0x20 12a0: 01c6d713 srli a4,a3,0x1c 12a4: 97ba add a5,a5,a4 p->s.size = nunits; 12a6: 0137a423 sw s3,8(a5) freep = prevp; 12aa: 00000717 auipc a4,0x0 12ae: 22a73323 sd a0,550(a4) # 14d0 <freep> return (void*)(p + 1); 12b2: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 12b6: 70e2 ld ra,56(sp) 12b8: 7442 ld s0,48(sp) 12ba: 74a2 ld s1,40(sp) 12bc: 7902 ld s2,32(sp) 12be: 69e2 ld s3,24(sp) 12c0: 6a42 ld s4,16(sp) 12c2: 6aa2 ld s5,8(sp) 12c4: 6b02 ld s6,0(sp) 12c6: 6121 addi sp,sp,64 12c8: 8082 ret prevp->s.ptr = p->s.ptr; 12ca: 6398 ld a4,0(a5) 12cc: e118 sd a4,0(a0) 12ce: bff1 j 12aa <malloc+0x88> hp->s.size = nu; 12d0: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 12d4: 0541 addi a0,a0,16 12d6: 00000097 auipc ra,0x0 12da: eca080e7 jalr -310(ra) # 11a0 <free> return freep; 12de: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 12e2: d971 beqz a0,12b6 <malloc+0x94> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 12e4: 611c ld a5,0(a0) if(p->s.size >= nunits){ 12e6: 4798 lw a4,8(a5) 12e8: fa9775e3 bgeu a4,s1,1292 <malloc+0x70> if(p == freep) 12ec: 00093703 ld a4,0(s2) 12f0: 853e mv a0,a5 12f2: fef719e3 bne a4,a5,12e4 <malloc+0xc2> p = sbrk(nu * sizeof(Header)); 12f6: 8552 mv a0,s4 12f8: 00000097 auipc ra,0x0 12fc: b58080e7 jalr -1192(ra) # e50 <sbrk> if(p == (char*)-1) 1300: fd5518e3 bne a0,s5,12d0 <malloc+0xae> return 0; 1304: 4501 li a0,0 1306: bf45 j 12b6 <malloc+0x94>
Cubical/HITs/Ints/DiffInt/Properties.agda
Edlyr/cubical
0
4899
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.HITs.Ints.DiffInt.Properties where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Univalence open import Cubical.HITs.Ints.DiffInt.Base open import Cubical.Data.Nat open import Cubical.Data.Sigma open import Cubical.Data.Bool open import Cubical.Relation.Binary.Base open import Cubical.Relation.Nullary open import Cubical.HITs.SetQuotients open BinaryRelation relIsEquiv : isEquivRel rel relIsEquiv = equivRel {A = ℕ × ℕ} relIsRefl relIsSym relIsTrans where relIsRefl : isRefl rel relIsRefl (a0 , a1) = refl relIsSym : isSym rel relIsSym (a0 , a1) (b0 , b1) p = sym p relIsTrans : isTrans rel relIsTrans (a0 , a1) (b0 , b1) (c0 , c1) p0 p1 = inj-m+ {m = (b0 + b1)} ((b0 + b1) + (a0 + c1) ≡⟨ +-assoc (b0 + b1) a0 c1 ⟩ ((b0 + b1) + a0) + c1 ≡[ i ]⟨ +-comm b0 b1 i + a0 + c1 ⟩ ((b1 + b0) + a0) + c1 ≡[ i ]⟨ +-comm (b1 + b0) a0 i + c1 ⟩ (a0 + (b1 + b0)) + c1 ≡[ i ]⟨ +-assoc a0 b1 b0 i + c1 ⟩ (a0 + b1) + b0 + c1 ≡⟨ sym (+-assoc (a0 + b1) b0 c1) ⟩ (a0 + b1) + (b0 + c1) ≡⟨ cong (λ p → p . fst + p .snd) (transport ΣPath≡PathΣ (p0 , p1))⟩ (b0 + a1) + (c0 + b1) ≡⟨ sym (+-assoc b0 a1 (c0 + b1))⟩ b0 + (a1 + (c0 + b1)) ≡[ i ]⟨ b0 + (a1 + +-comm c0 b1 i) ⟩ b0 + (a1 + (b1 + c0)) ≡[ i ]⟨ b0 + +-comm a1 (b1 + c0) i ⟩ b0 + ((b1 + c0) + a1) ≡[ i ]⟨ b0 + +-assoc b1 c0 a1 (~ i) ⟩ b0 + (b1 + (c0 + a1)) ≡⟨ +-assoc b0 b1 (c0 + a1)⟩ (b0 + b1) + (c0 + a1) ∎ ) relIsProp : BinaryRelation.isPropValued rel relIsProp a b x y = isSetℕ _ _ _ _ discreteℤ : Discrete ℤ discreteℤ = discreteSetQuotients (discreteΣ discreteℕ λ _ → discreteℕ) relIsProp relIsEquiv (λ _ _ → discreteℕ _ _) private _ : Dec→Bool (discreteℤ [ (3 , 5) ] [ (4 , 6) ]) ≡ true _ = refl _ : Dec→Bool (discreteℤ [ (3 , 5) ] [ (4 , 7) ]) ≡ false _ = refl
oeis/100/A100689.asm
neoneye/loda-programs
11
241401
; A100689: a(n) = prime(n) * 4^prime(n) - 1. ; Submitted by <NAME>(l1) ; 31,191,5119,114687,46137343,872415231,292057776127,5222680231935,1618481116086271,8358680908399640575,142962266571249025023,698910239464707491627007,198263834416799184651812863,3326963855579459488791396351,930930909542605966724141416447 seq $0,6005 ; The odd prime numbers together with 1. max $0,2 mov $1,$0 mov $2,4 pow $2,$0 mul $1,$2 mov $0,$1 sub $0,1
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_6040_597.asm
ljhsiun2/medusa
9
81858
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r13 push %r8 push %rax push %rdx lea addresses_UC_ht+0x1d89f, %rax cmp $31623, %r8 mov $0x6162636465666768, %r11 movq %r11, %xmm2 vmovups %ymm2, (%rax) sub %rdx, %rdx lea addresses_WT_ht+0xfedf, %r10 nop nop nop xor $12083, %r8 movb $0x61, (%r10) nop nop nop nop nop sub %r10, %r10 lea addresses_A_ht+0x187b5, %r13 nop xor $27681, %r12 movb $0x61, (%r13) dec %r11 pop %rdx pop %rax pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r8 push %rbp push %rcx push %rdx // Faulty Load lea addresses_A+0x1efdf, %r15 nop nop nop nop sub $9085, %r11 movb (%r15), %dl lea oracles, %r8 and $0xff, %rdx shlq $12, %rdx mov (%r8,%rdx,1), %rdx pop %rdx pop %rcx pop %rbp pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'00': 6040} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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/053/A053091.asm
neoneye/loda-programs
11
26536
<reponame>neoneye/loda-programs ; A053091: F^3-convex polyominoes on the honeycomb lattice by number of cells. ; Submitted by <NAME> ; 1,3,5,6,9,11,10,15,18,14,21,23,18,30,29,21,33,35,31,39,41,30,42,54,35,51,53,38,66,54,42,63,65,60,69,70,43,75,90,54,81,83,63,93,89,62,90,95,84,99,90,77,105,126,74,111,113,60,138,119,91,126,125,108 mul $0,2 add $0,1 seq $0,228443 ; G.f.: Sum_{k>=0} (2*k + 1) * x^k / (1 + x^(2*k + 1)). div $0,2
stm32l0/stm32l0x1/svd/stm32_svd-firewall.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
30475
-- This spec has been automatically generated from STM32L0x1.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.Firewall is pragma Preelaborate; --------------- -- Registers -- --------------- -- Code segment start address type FIREWALL_CSSA_Register is record -- unspecified Reserved_0_7 : STM32_SVD.Byte; -- code segment start address ADD : STM32_SVD.UInt16; -- unspecified Reserved_24_31 : STM32_SVD.Byte; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_CSSA_Register use record Reserved_0_7 at 0 range 0 .. 7; ADD at 0 range 8 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- Code segment length type FIREWALL_CSL_Register is record -- unspecified Reserved_0_7 : STM32_SVD.Byte; -- code segment length LENG : STM32_SVD.UInt14; -- unspecified Reserved_22_31 : STM32_SVD.UInt10; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_CSL_Register use record Reserved_0_7 at 0 range 0 .. 7; LENG at 0 range 8 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- Non-volatile data segment start address type FIREWALL_NVDSSA_Register is record -- unspecified Reserved_0_7 : STM32_SVD.Byte; -- Non-volatile data segment start address ADD : STM32_SVD.UInt16; -- unspecified Reserved_24_31 : STM32_SVD.Byte; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_NVDSSA_Register use record Reserved_0_7 at 0 range 0 .. 7; ADD at 0 range 8 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- Non-volatile data segment length type FIREWALL_NVDSL_Register is record -- unspecified Reserved_0_7 : STM32_SVD.Byte; -- Non-volatile data segment length LENG : STM32_SVD.UInt14; -- unspecified Reserved_22_31 : STM32_SVD.UInt10; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_NVDSL_Register use record Reserved_0_7 at 0 range 0 .. 7; LENG at 0 range 8 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- Volatile data segment start address type FIREWALL_VDSSA_Register is record -- unspecified Reserved_0_5 : STM32_SVD.UInt6; -- Volatile data segment start address ADD : STM32_SVD.UInt10; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_VDSSA_Register use record Reserved_0_5 at 0 range 0 .. 5; ADD at 0 range 6 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Volatile data segment length type FIREWALL_VDSL_Register is record -- unspecified Reserved_0_5 : STM32_SVD.UInt6; -- Non-volatile data segment length LENG : STM32_SVD.UInt10; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_VDSL_Register use record Reserved_0_5 at 0 range 0 .. 5; LENG at 0 range 6 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Configuration register type FIREWALL_CR_Register is record -- Firewall pre alarm FPA : STM32_SVD.Bit; -- Volatile data shared VDS : STM32_SVD.Bit; -- Volatile data execution VDE : STM32_SVD.Bit; -- unspecified Reserved_3_31 : STM32_SVD.UInt29; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for FIREWALL_CR_Register use record FPA at 0 range 0 .. 0; VDS at 0 range 1 .. 1; VDE at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Firewall type Firewall_Peripheral is record -- Code segment start address FIREWALL_CSSA : aliased FIREWALL_CSSA_Register; -- Code segment length FIREWALL_CSL : aliased FIREWALL_CSL_Register; -- Non-volatile data segment start address FIREWALL_NVDSSA : aliased FIREWALL_NVDSSA_Register; -- Non-volatile data segment length FIREWALL_NVDSL : aliased FIREWALL_NVDSL_Register; -- Volatile data segment start address FIREWALL_VDSSA : aliased FIREWALL_VDSSA_Register; -- Volatile data segment length FIREWALL_VDSL : aliased FIREWALL_VDSL_Register; -- Configuration register FIREWALL_CR : aliased FIREWALL_CR_Register; end record with Volatile; for Firewall_Peripheral use record FIREWALL_CSSA at 16#0# range 0 .. 31; FIREWALL_CSL at 16#4# range 0 .. 31; FIREWALL_NVDSSA at 16#8# range 0 .. 31; FIREWALL_NVDSL at 16#C# range 0 .. 31; FIREWALL_VDSSA at 16#10# range 0 .. 31; FIREWALL_VDSL at 16#14# range 0 .. 31; FIREWALL_CR at 16#20# range 0 .. 31; end record; -- Firewall Firewall_Periph : aliased Firewall_Peripheral with Import, Address => Firewall_Base; end STM32_SVD.Firewall;
resources/patches/vars.asm
Yoshimaster96/Superstar-Editor-YI
2
81117
<reponame>Yoshimaster96/Superstar-Editor-YI LevelID = $FE SRAMCopySrcLo = $DC SRAMCopySrcHi = $D8 SRAMCopyDstLo = $DE SRAMCopyDstHi = $DA SRAMCopySize = $FC SRAMCopyRt = $DC ExObjTemps = $D8 ExGFXBG1Base = $E0 ExGFXBG2Base = $E6 ExGFXBG3Base = $EA ExGFXOBJBase = $EE ExTMBG2 = $D0 ExTMBG3 = $D2 ExPAL = $D4 ExANIM = $D5 ExMAP16 = $D6
programs/oeis/158/A158551.asm
karttu/loda
1
168842
<reponame>karttu/loda<gh_stars>1-10 ; A158551: a(n) = 26*n^2 - 1. ; 25,103,233,415,649,935,1273,1663,2105,2599,3145,3743,4393,5095,5849,6655,7513,8423,9385,10399,11465,12583,13753,14975,16249,17575,18953,20383,21865,23399,24985,26623,28313,30055,31849,33695,35593,37543,39545,41599,43705,45863,48073,50335,52649,55015,57433,59903,62425,64999,67625,70303,73033,75815,78649,81535,84473,87463,90505,93599,96745,99943,103193,106495,109849,113255,116713,120223,123785,127399,131065,134783,138553,142375,146249,150175,154153,158183,162265,166399,170585,174823,179113,183455,187849,192295,196793,201343,205945,210599,215305,220063,224873,229735,234649,239615,244633,249703,254825,259999,265225,270503,275833,281215,286649,292135,297673,303263,308905,314599,320345,326143,331993,337895,343849,349855,355913,362023,368185,374399,380665,386983,393353,399775,406249,412775,419353,425983,432665,439399,446185,453023,459913,466855,473849,480895,487993,495143,502345,509599,516905,524263,531673,539135,546649,554215,561833,569503,577225,584999,592825,600703,608633,616615,624649,632735,640873,649063,657305,665599,673945,682343,690793,699295,707849,716455,725113,733823,742585,751399,760265,769183,778153,787175,796249,805375,814553,823783,833065,842399,851785,861223,870713,880255,889849,899495,909193,918943,928745,938599,948505,958463,968473,978535,988649,998815,1009033,1019303,1029625,1039999,1050425,1060903,1071433,1082015,1092649,1103335,1114073,1124863,1135705,1146599,1157545,1168543,1179593,1190695,1201849,1213055,1224313,1235623,1246985,1258399,1269865,1281383,1292953,1304575,1316249,1327975,1339753,1351583,1363465,1375399,1387385,1399423,1411513,1423655,1435849,1448095,1460393,1472743,1485145,1497599,1510105,1522663,1535273,1547935,1560649,1573415,1586233,1599103,1612025,1624999 mov $1,2 add $1,$0 mul $1,$0 mul $1,26 add $1,25
oeis/161/A161202.asm
neoneye/loda-programs
11
165646
<filename>oeis/161/A161202.asm ; A161202: Numerators in expansion of (1-x)^(5/2) ; Submitted by <NAME> ; 1,-5,15,-5,-5,-3,-5,-5,-45,-55,-143,-195,-1105,-1615,-4845,-7429,-185725,-294975,-950475,-1550775,-10235115,-17058525,-57378675,-97294275,-1329688425,-2287064091,-7916760315,-13781027215 mov $1,1 mov $3,1 lpb $0 mov $2,$0 mul $2,2 mul $3,$0 sub $0,1 sub $2,7 mul $1,$2 lpe gcd $3,$1 div $1,$3 mov $0,$1
test/Succeed/Issue4528.agda
shlevy/agda
1,989
397
{-# OPTIONS --allow-unsolved-metas #-} open import Agda.Builtin.Equality open import Agda.Builtin.List postulate A : Set nilA : A consA : A → List A → A w/e : {x y : A} → x ≡ y data D : List A → Set where nil : D [] cons : (x : A) (xs : List A) → D (x ∷ xs) foo : ∀ {xs} (d : D xs) (let f : D xs → A f = λ where nil → nilA (cons y ys) → consA y ys) → f d ≡ nilA foo nil = {!!} foo (cons _ _) = w/e
src/main/antlr/Galileo.g4
ftsrg/StoATT
0
7596
<gh_stars>0 /* * * Copyright 2021 Budapest University of Technology and Economics * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ grammar Galileo; faulttree: top';' ((gate|basicevent)';')* EOF; top: TOPLEVEL name=NAME; gate: name=NAME operation (inputs+=NAME)*; basicevent: name=NAME property*; /*TODO: forbid setting the same property more than once*/ property : (lambda|phase|probability|dormancy|repair|numFailureStates); lambda : LAMBDA EQ val=(DOUBLE|INT); phase: PH EQ val=rateMatrix; rateMatrix: '[' ( matrixRow ';')* matrixRow ']'; matrixRow: ((vals+=(DOUBLE|INT))',')* vals+=(DOUBLE|INT); numFailureStates : FAILURE_STATES EQ val=INT; probability : PROBABILITY EQ val=(DOUBLE|INT); dormancy : DORMANCY EQ val=(DOUBLE|INT); repair: REPAIR EQ val=(DOUBLE|INT); operation : (or|and|of|wsp); or : OR; and: AND; of: (k=INT)(OF)(n=INT); wsp: WSP; INT: DIGIT+; EQ : '='; OR : 'or'; EXP: 'e' | 'E'; AND : 'and'; OF: 'of'; WSP: 'wsp'; TOPLEVEL : 'toplevel'; LAMBDA : 'lambda'; PH: 'ph'; PROBABILITY : 'prob'; DORMANCY : 'dorm'; REPAIR : 'repair'; FAILURE_STATES : 'failurestates'; fragment DIGIT : [0-9]; DOUBLE : DIGIT*'.'DIGIT+ | DIGIT+ EXP '-'? DIGIT+ | DIGIT*'.'DIGIT+ EXP '-'? DIGIT+; NAME: '"'IDENTIFIER*'"'; /*TODO: some better solution for the greediness*/ IDENTIFIER : [a-zA-Z_][a-zA-Z_0-9]*?; COMMENT : '/*' .*? '*/' -> skip; WS : [ \t\n\r] -> skip;
vendor/stdlib/src/Data/AVL/Sets.agda
isabella232/Lemmachine
56
16162
<filename>vendor/stdlib/src/Data/AVL/Sets.agda ------------------------------------------------------------------------ -- Finite sets, based on AVL trees ------------------------------------------------------------------------ open import Relation.Binary module Data.AVL.Sets (OrderedKeySet : StrictTotalOrder) where import Data.AVL as AVL open StrictTotalOrder OrderedKeySet renaming (carrier to Key) open import Data.Unit open import Data.Function open import Data.Product as Prod using (_×_; _,_; proj₁) open import Data.Maybe as Maybe open import Data.Bool open import Data.List open import Category.Functor open RawFunctor Maybe.functor -- The set type. (Note that Set is a reserved word.) private open module S = AVL OrderedKeySet (const₁ ⊤) public using () renaming (Tree to ⟨Set⟩) -- Repackaged functions. empty : ⟨Set⟩ empty = S.empty singleton : Key → ⟨Set⟩ singleton k = S.singleton k _ insert : Key → ⟨Set⟩ → ⟨Set⟩ insert k = S.insert k _ delete : Key → ⟨Set⟩ → ⟨Set⟩ delete = S.delete lookup : Key → ⟨Set⟩ → Maybe Key lookup k s = proj₁ <$> S.lookup k s _∈?_ : Key → ⟨Set⟩ → Bool _∈?_ = S._∈?_ headTail : ⟨Set⟩ → Maybe (Key × ⟨Set⟩) headTail s = Prod.map proj₁ id <$> S.headTail s initLast : ⟨Set⟩ → Maybe (⟨Set⟩ × Key) initLast s = Prod.map id proj₁ <$> S.initLast s fromList : List Key → ⟨Set⟩ fromList = S.fromList ∘ map (λ k → (k , _)) toList : ⟨Set⟩ → List Key toList = map proj₁ ∘ S.toList
lib/Univalence.agda
sattlerc/HoTT-Agda
0
13355
<reponame>sattlerc/HoTT-Agda {-# OPTIONS --without-K #-} open import lib.Base open import lib.PathGroupoid open import lib.PathFunctor open import lib.Equivalences module lib.Univalence where {- The map [coe-equiv] is the map which is supposed to be an equivalence according to the univalence axiom. We do not define it directly by path induction because it may be helpful to know definitionally what are the components. -} coe-equiv : ∀ {i} {A B : Type i} → A == B → A ≃ B coe-equiv p = equiv (coe p) (coe! p) (coe!-inv-r p) (coe!-inv-l p) {- We postulate the univalence axiom as three separate axioms because it’s more natural this way. But it doesn’t change anything in practice. -} postulate -- Univalence axiom ua : ∀ {i} {A B : Type i} → (A ≃ B) → A == B coe-equiv-β : ∀ {i} {A B : Type i} (e : A ≃ B) → coe-equiv (ua e) == e ua-η : ∀ {i} {A B : Type i} (p : A == B) → ua (coe-equiv p) == p ua-equiv : ∀ {i} {A B : Type i} → (A ≃ B) ≃ (A == B) ua-equiv = equiv ua coe-equiv ua-η coe-equiv-β {- Reductions for coercions along a path constructed with the univalence axiom -} coe-β : ∀ {i} {A B : Type i} (e : A ≃ B) (a : A) → coe (ua e) a == –> e a coe-β e a = ap (λ e → –> e a) (coe-equiv-β e) coe!-β : ∀ {i} {A B : Type i} (e : A ≃ B) (b : B) → coe! (ua e) b == <– e b coe!-β e a = ap (λ e → <– e a) (coe-equiv-β e) {- Paths over a path in a universe in the identity fibration reduces -} ↓-idf-ua-out : ∀ {i} {A B : Type i} (e : A ≃ B) {u : A} {v : B} → u == v [ (λ x → x) ↓ (ua e) ] → –> e u == v ↓-idf-ua-out e p = ! (coe-β e _) ∙ aux (ua e) p where aux : ∀ {i} {A B : Type i} (p : A == B) {u : A} {v : B} → u == v [ (λ x → x) ↓ p ] → coe p u == v aux idp = idf _ ↓-idf-ua-in : ∀ {i} {A B : Type i} (e : A ≃ B) {u : A} {v : B} → –> e u == v → u == v [ (λ x → x) ↓ (ua e) ] ↓-idf-ua-in e p = aux (ua e) (coe-β e _ ∙ p) where aux : ∀ {i} {A B : Type i} (p : A == B) {u : A} {v : B} → coe p u == v → u == v [ (λ x → x) ↓ p ] aux idp = idf _ {- Induction along equivalences If [P] is a predicate over all equivalences in a universe [Type i] and [d] is a proof of [P] over all [ide A], then we get a section of [P] -} equiv-induction : ∀ {i j} (P : {A B : Type i} (f : A ≃ B) → Type j) (d : (A : Type i) → P (ide A)) {A B : Type i} (f : A ≃ B) → P f equiv-induction {i} {j} P d f = transport P (coe-equiv-β f) (aux P d (ua f)) where aux : ∀ {j} (P : {A : Type i} {B : Type i} (f : A ≃ B) → Type j) (d : (A : Type i) → P (ide A)) {A B : Type i} (p : A == B) → P (coe-equiv p) aux P d idp = d _
user/strace.asm
Vidhi1109/Modified-XV6
0
85176
<reponame>Vidhi1109/Modified-XV6 user/_strace: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <main>: #include "kernel/stat.h" #include "user/user.h" int main(int argc, char *argv[]) { 0: 712d addi sp,sp,-288 2: ee06 sd ra,280(sp) 4: ea22 sd s0,272(sp) 6: e626 sd s1,264(sp) 8: e24a sd s2,256(sp) a: 1200 addi s0,sp,288 c: 892e mv s2,a1 int i; char *nargv[32]; if(argc < 3 ) e: 4789 li a5,2 10: 02a7dc63 bge a5,a0,48 <main+0x48> 14: 84aa mv s1,a0 { fprintf(2, "Incorrect number of arguments\n", argv[0]); exit(1); } if (argv[1][0] < '0' || argv[1][0] > '9') 16: 6588 ld a0,8(a1) 18: 00054783 lbu a5,0(a0) 1c: fd07879b addiw a5,a5,-48 20: 0ff7f793 zext.b a5,a5 24: 4725 li a4,9 26: 04f77063 bgeu a4,a5,66 <main+0x66> { fprintf(2, "Incorrectarguments\n", argv[0]); 2a: 6190 ld a2,0(a1) 2c: 00001597 auipc a1,0x1 30: 87458593 addi a1,a1,-1932 # 8a0 <malloc+0x10c> 34: 4509 li a0,2 36: 00000097 auipc ra,0x0 3a: 678080e7 jalr 1656(ra) # 6ae <fprintf> exit(1); 3e: 4505 li a0,1 40: 00000097 auipc ra,0x0 44: 30a080e7 jalr 778(ra) # 34a <exit> fprintf(2, "Incorrect number of arguments\n", argv[0]); 48: 6190 ld a2,0(a1) 4a: 00001597 auipc a1,0x1 4e: 83658593 addi a1,a1,-1994 # 880 <malloc+0xec> 52: 4509 li a0,2 54: 00000097 auipc ra,0x0 58: 65a080e7 jalr 1626(ra) # 6ae <fprintf> exit(1); 5c: 4505 li a0,1 5e: 00000097 auipc ra,0x0 62: 2ec080e7 jalr 748(ra) # 34a <exit> } if (trace(atoi(argv[1])) < 0) 66: 00000097 auipc ra,0x0 6a: 1ea080e7 jalr 490(ra) # 250 <atoi> 6e: 00000097 auipc ra,0x0 72: 384080e7 jalr 900(ra) # 3f2 <trace> 76: 04054463 bltz a0,be <main+0xbe> 7a: 01090793 addi a5,s2,16 7e: ee040713 addi a4,s0,-288 82: ffd4851b addiw a0,s1,-3 86: 02051693 slli a3,a0,0x20 8a: 01d6d513 srli a0,a3,0x1d 8e: 953e add a0,a0,a5 90: 10090593 addi a1,s2,256 exit(1); } for(i = 2; i < argc && i < 32; i++) { nargv[i-2] = argv[i]; 94: 6394 ld a3,0(a5) 96: e314 sd a3,0(a4) for(i = 2; i < argc && i < 32; i++) 98: 00a78663 beq a5,a0,a4 <main+0xa4> 9c: 07a1 addi a5,a5,8 9e: 0721 addi a4,a4,8 a0: feb79ae3 bne a5,a1,94 <main+0x94> } exec(nargv[0], nargv); a4: ee040593 addi a1,s0,-288 a8: ee043503 ld a0,-288(s0) ac: 00000097 auipc ra,0x0 b0: 2d6080e7 jalr 726(ra) # 382 <exec> exit(0); b4: 4501 li a0,0 b6: 00000097 auipc ra,0x0 ba: 294080e7 jalr 660(ra) # 34a <exit> fprintf(2, "%s: trace failed\n", argv[0]); be: 00093603 ld a2,0(s2) c2: 00000597 auipc a1,0x0 c6: 7f658593 addi a1,a1,2038 # 8b8 <malloc+0x124> ca: 4509 li a0,2 cc: 00000097 auipc ra,0x0 d0: 5e2080e7 jalr 1506(ra) # 6ae <fprintf> exit(1); d4: 4505 li a0,1 d6: 00000097 auipc ra,0x0 da: 274080e7 jalr 628(ra) # 34a <exit> 00000000000000de <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { de: 1141 addi sp,sp,-16 e0: e422 sd s0,8(sp) e2: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) e4: 87aa mv a5,a0 e6: 0585 addi a1,a1,1 e8: 0785 addi a5,a5,1 ea: fff5c703 lbu a4,-1(a1) ee: fee78fa3 sb a4,-1(a5) f2: fb75 bnez a4,e6 <strcpy+0x8> ; return os; } f4: 6422 ld s0,8(sp) f6: 0141 addi sp,sp,16 f8: 8082 ret 00000000000000fa <strcmp>: int strcmp(const char *p, const char *q) { fa: 1141 addi sp,sp,-16 fc: e422 sd s0,8(sp) fe: 0800 addi s0,sp,16 while(*p && *p == *q) 100: 00054783 lbu a5,0(a0) 104: cb91 beqz a5,118 <strcmp+0x1e> 106: 0005c703 lbu a4,0(a1) 10a: 00f71763 bne a4,a5,118 <strcmp+0x1e> p++, q++; 10e: 0505 addi a0,a0,1 110: 0585 addi a1,a1,1 while(*p && *p == *q) 112: 00054783 lbu a5,0(a0) 116: fbe5 bnez a5,106 <strcmp+0xc> return (uchar)*p - (uchar)*q; 118: 0005c503 lbu a0,0(a1) } 11c: 40a7853b subw a0,a5,a0 120: 6422 ld s0,8(sp) 122: 0141 addi sp,sp,16 124: 8082 ret 0000000000000126 <strlen>: uint strlen(const char *s) { 126: 1141 addi sp,sp,-16 128: e422 sd s0,8(sp) 12a: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) 12c: 00054783 lbu a5,0(a0) 130: cf91 beqz a5,14c <strlen+0x26> 132: 0505 addi a0,a0,1 134: 87aa mv a5,a0 136: 4685 li a3,1 138: 9e89 subw a3,a3,a0 13a: 00f6853b addw a0,a3,a5 13e: 0785 addi a5,a5,1 140: fff7c703 lbu a4,-1(a5) 144: fb7d bnez a4,13a <strlen+0x14> ; return n; } 146: 6422 ld s0,8(sp) 148: 0141 addi sp,sp,16 14a: 8082 ret for(n = 0; s[n]; n++) 14c: 4501 li a0,0 14e: bfe5 j 146 <strlen+0x20> 0000000000000150 <memset>: void* memset(void *dst, int c, uint n) { 150: 1141 addi sp,sp,-16 152: e422 sd s0,8(sp) 154: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ 156: ca19 beqz a2,16c <memset+0x1c> 158: 87aa mv a5,a0 15a: 1602 slli a2,a2,0x20 15c: 9201 srli a2,a2,0x20 15e: 00a60733 add a4,a2,a0 cdst[i] = c; 162: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ 166: 0785 addi a5,a5,1 168: fee79de3 bne a5,a4,162 <memset+0x12> } return dst; } 16c: 6422 ld s0,8(sp) 16e: 0141 addi sp,sp,16 170: 8082 ret 0000000000000172 <strchr>: char* strchr(const char *s, char c) { 172: 1141 addi sp,sp,-16 174: e422 sd s0,8(sp) 176: 0800 addi s0,sp,16 for(; *s; s++) 178: 00054783 lbu a5,0(a0) 17c: cb99 beqz a5,192 <strchr+0x20> if(*s == c) 17e: 00f58763 beq a1,a5,18c <strchr+0x1a> for(; *s; s++) 182: 0505 addi a0,a0,1 184: 00054783 lbu a5,0(a0) 188: fbfd bnez a5,17e <strchr+0xc> return (char*)s; return 0; 18a: 4501 li a0,0 } 18c: 6422 ld s0,8(sp) 18e: 0141 addi sp,sp,16 190: 8082 ret return 0; 192: 4501 li a0,0 194: bfe5 j 18c <strchr+0x1a> 0000000000000196 <gets>: char* gets(char *buf, int max) { 196: 711d addi sp,sp,-96 198: ec86 sd ra,88(sp) 19a: e8a2 sd s0,80(sp) 19c: e4a6 sd s1,72(sp) 19e: e0ca sd s2,64(sp) 1a0: fc4e sd s3,56(sp) 1a2: f852 sd s4,48(sp) 1a4: f456 sd s5,40(sp) 1a6: f05a sd s6,32(sp) 1a8: ec5e sd s7,24(sp) 1aa: 1080 addi s0,sp,96 1ac: 8baa mv s7,a0 1ae: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ 1b0: 892a mv s2,a0 1b2: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') 1b4: 4aa9 li s5,10 1b6: 4b35 li s6,13 for(i=0; i+1 < max; ){ 1b8: 89a6 mv s3,s1 1ba: 2485 addiw s1,s1,1 1bc: 0344d863 bge s1,s4,1ec <gets+0x56> cc = read(0, &c, 1); 1c0: 4605 li a2,1 1c2: faf40593 addi a1,s0,-81 1c6: 4501 li a0,0 1c8: 00000097 auipc ra,0x0 1cc: 19a080e7 jalr 410(ra) # 362 <read> if(cc < 1) 1d0: 00a05e63 blez a0,1ec <gets+0x56> buf[i++] = c; 1d4: faf44783 lbu a5,-81(s0) 1d8: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') 1dc: 01578763 beq a5,s5,1ea <gets+0x54> 1e0: 0905 addi s2,s2,1 1e2: fd679be3 bne a5,s6,1b8 <gets+0x22> for(i=0; i+1 < max; ){ 1e6: 89a6 mv s3,s1 1e8: a011 j 1ec <gets+0x56> 1ea: 89a6 mv s3,s1 break; } buf[i] = '\0'; 1ec: 99de add s3,s3,s7 1ee: 00098023 sb zero,0(s3) return buf; } 1f2: 855e mv a0,s7 1f4: 60e6 ld ra,88(sp) 1f6: 6446 ld s0,80(sp) 1f8: 64a6 ld s1,72(sp) 1fa: 6906 ld s2,64(sp) 1fc: 79e2 ld s3,56(sp) 1fe: 7a42 ld s4,48(sp) 200: 7aa2 ld s5,40(sp) 202: 7b02 ld s6,32(sp) 204: 6be2 ld s7,24(sp) 206: 6125 addi sp,sp,96 208: 8082 ret 000000000000020a <stat>: int stat(const char *n, struct stat *st) { 20a: 1101 addi sp,sp,-32 20c: ec06 sd ra,24(sp) 20e: e822 sd s0,16(sp) 210: e426 sd s1,8(sp) 212: e04a sd s2,0(sp) 214: 1000 addi s0,sp,32 216: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); 218: 4581 li a1,0 21a: 00000097 auipc ra,0x0 21e: 170080e7 jalr 368(ra) # 38a <open> if(fd < 0) 222: 02054563 bltz a0,24c <stat+0x42> 226: 84aa mv s1,a0 return -1; r = fstat(fd, st); 228: 85ca mv a1,s2 22a: 00000097 auipc ra,0x0 22e: 178080e7 jalr 376(ra) # 3a2 <fstat> 232: 892a mv s2,a0 close(fd); 234: 8526 mv a0,s1 236: 00000097 auipc ra,0x0 23a: 13c080e7 jalr 316(ra) # 372 <close> return r; } 23e: 854a mv a0,s2 240: 60e2 ld ra,24(sp) 242: 6442 ld s0,16(sp) 244: 64a2 ld s1,8(sp) 246: 6902 ld s2,0(sp) 248: 6105 addi sp,sp,32 24a: 8082 ret return -1; 24c: 597d li s2,-1 24e: bfc5 j 23e <stat+0x34> 0000000000000250 <atoi>: int atoi(const char *s) { 250: 1141 addi sp,sp,-16 252: e422 sd s0,8(sp) 254: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') 256: 00054683 lbu a3,0(a0) 25a: fd06879b addiw a5,a3,-48 25e: 0ff7f793 zext.b a5,a5 262: 4625 li a2,9 264: 02f66863 bltu a2,a5,294 <atoi+0x44> 268: 872a mv a4,a0 n = 0; 26a: 4501 li a0,0 n = n*10 + *s++ - '0'; 26c: 0705 addi a4,a4,1 26e: 0025179b slliw a5,a0,0x2 272: 9fa9 addw a5,a5,a0 274: 0017979b slliw a5,a5,0x1 278: 9fb5 addw a5,a5,a3 27a: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') 27e: 00074683 lbu a3,0(a4) 282: fd06879b addiw a5,a3,-48 286: 0ff7f793 zext.b a5,a5 28a: fef671e3 bgeu a2,a5,26c <atoi+0x1c> return n; } 28e: 6422 ld s0,8(sp) 290: 0141 addi sp,sp,16 292: 8082 ret n = 0; 294: 4501 li a0,0 296: bfe5 j 28e <atoi+0x3e> 0000000000000298 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 298: 1141 addi sp,sp,-16 29a: e422 sd s0,8(sp) 29c: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { 29e: 02b57463 bgeu a0,a1,2c6 <memmove+0x2e> while(n-- > 0) 2a2: 00c05f63 blez a2,2c0 <memmove+0x28> 2a6: 1602 slli a2,a2,0x20 2a8: 9201 srli a2,a2,0x20 2aa: 00c507b3 add a5,a0,a2 dst = vdst; 2ae: 872a mv a4,a0 *dst++ = *src++; 2b0: 0585 addi a1,a1,1 2b2: 0705 addi a4,a4,1 2b4: fff5c683 lbu a3,-1(a1) 2b8: fed70fa3 sb a3,-1(a4) while(n-- > 0) 2bc: fee79ae3 bne a5,a4,2b0 <memmove+0x18> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } 2c0: 6422 ld s0,8(sp) 2c2: 0141 addi sp,sp,16 2c4: 8082 ret dst += n; 2c6: 00c50733 add a4,a0,a2 src += n; 2ca: 95b2 add a1,a1,a2 while(n-- > 0) 2cc: fec05ae3 blez a2,2c0 <memmove+0x28> 2d0: fff6079b addiw a5,a2,-1 2d4: 1782 slli a5,a5,0x20 2d6: 9381 srli a5,a5,0x20 2d8: fff7c793 not a5,a5 2dc: 97ba add a5,a5,a4 *--dst = *--src; 2de: 15fd addi a1,a1,-1 2e0: 177d addi a4,a4,-1 2e2: 0005c683 lbu a3,0(a1) 2e6: 00d70023 sb a3,0(a4) while(n-- > 0) 2ea: fee79ae3 bne a5,a4,2de <memmove+0x46> 2ee: bfc9 j 2c0 <memmove+0x28> 00000000000002f0 <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { 2f0: 1141 addi sp,sp,-16 2f2: e422 sd s0,8(sp) 2f4: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { 2f6: ca05 beqz a2,326 <memcmp+0x36> 2f8: fff6069b addiw a3,a2,-1 2fc: 1682 slli a3,a3,0x20 2fe: 9281 srli a3,a3,0x20 300: 0685 addi a3,a3,1 302: 96aa add a3,a3,a0 if (*p1 != *p2) { 304: 00054783 lbu a5,0(a0) 308: 0005c703 lbu a4,0(a1) 30c: 00e79863 bne a5,a4,31c <memcmp+0x2c> return *p1 - *p2; } p1++; 310: 0505 addi a0,a0,1 p2++; 312: 0585 addi a1,a1,1 while (n-- > 0) { 314: fed518e3 bne a0,a3,304 <memcmp+0x14> } return 0; 318: 4501 li a0,0 31a: a019 j 320 <memcmp+0x30> return *p1 - *p2; 31c: 40e7853b subw a0,a5,a4 } 320: 6422 ld s0,8(sp) 322: 0141 addi sp,sp,16 324: 8082 ret return 0; 326: 4501 li a0,0 328: bfe5 j 320 <memcmp+0x30> 000000000000032a <memcpy>: void * memcpy(void *dst, const void *src, uint n) { 32a: 1141 addi sp,sp,-16 32c: e406 sd ra,8(sp) 32e: e022 sd s0,0(sp) 330: 0800 addi s0,sp,16 return memmove(dst, src, n); 332: 00000097 auipc ra,0x0 336: f66080e7 jalr -154(ra) # 298 <memmove> } 33a: 60a2 ld ra,8(sp) 33c: 6402 ld s0,0(sp) 33e: 0141 addi sp,sp,16 340: 8082 ret 0000000000000342 <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork 342: 4885 li a7,1 ecall 344: 00000073 ecall ret 348: 8082 ret 000000000000034a <exit>: .global exit exit: li a7, SYS_exit 34a: 4889 li a7,2 ecall 34c: 00000073 ecall ret 350: 8082 ret 0000000000000352 <wait>: .global wait wait: li a7, SYS_wait 352: 488d li a7,3 ecall 354: 00000073 ecall ret 358: 8082 ret 000000000000035a <pipe>: .global pipe pipe: li a7, SYS_pipe 35a: 4891 li a7,4 ecall 35c: 00000073 ecall ret 360: 8082 ret 0000000000000362 <read>: .global read read: li a7, SYS_read 362: 4895 li a7,5 ecall 364: 00000073 ecall ret 368: 8082 ret 000000000000036a <write>: .global write write: li a7, SYS_write 36a: 48c1 li a7,16 ecall 36c: 00000073 ecall ret 370: 8082 ret 0000000000000372 <close>: .global close close: li a7, SYS_close 372: 48d5 li a7,21 ecall 374: 00000073 ecall ret 378: 8082 ret 000000000000037a <kill>: .global kill kill: li a7, SYS_kill 37a: 4899 li a7,6 ecall 37c: 00000073 ecall ret 380: 8082 ret 0000000000000382 <exec>: .global exec exec: li a7, SYS_exec 382: 489d li a7,7 ecall 384: 00000073 ecall ret 388: 8082 ret 000000000000038a <open>: .global open open: li a7, SYS_open 38a: 48bd li a7,15 ecall 38c: 00000073 ecall ret 390: 8082 ret 0000000000000392 <mknod>: .global mknod mknod: li a7, SYS_mknod 392: 48c5 li a7,17 ecall 394: 00000073 ecall ret 398: 8082 ret 000000000000039a <unlink>: .global unlink unlink: li a7, SYS_unlink 39a: 48c9 li a7,18 ecall 39c: 00000073 ecall ret 3a0: 8082 ret 00000000000003a2 <fstat>: .global fstat fstat: li a7, SYS_fstat 3a2: 48a1 li a7,8 ecall 3a4: 00000073 ecall ret 3a8: 8082 ret 00000000000003aa <link>: .global link link: li a7, SYS_link 3aa: 48cd li a7,19 ecall 3ac: 00000073 ecall ret 3b0: 8082 ret 00000000000003b2 <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir 3b2: 48d1 li a7,20 ecall 3b4: 00000073 ecall ret 3b8: 8082 ret 00000000000003ba <chdir>: .global chdir chdir: li a7, SYS_chdir 3ba: 48a5 li a7,9 ecall 3bc: 00000073 ecall ret 3c0: 8082 ret 00000000000003c2 <dup>: .global dup dup: li a7, SYS_dup 3c2: 48a9 li a7,10 ecall 3c4: 00000073 ecall ret 3c8: 8082 ret 00000000000003ca <getpid>: .global getpid getpid: li a7, SYS_getpid 3ca: 48ad li a7,11 ecall 3cc: 00000073 ecall ret 3d0: 8082 ret 00000000000003d2 <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk 3d2: 48b1 li a7,12 ecall 3d4: 00000073 ecall ret 3d8: 8082 ret 00000000000003da <sleep>: .global sleep sleep: li a7, SYS_sleep 3da: 48b5 li a7,13 ecall 3dc: 00000073 ecall ret 3e0: 8082 ret 00000000000003e2 <uptime>: .global uptime uptime: li a7, SYS_uptime 3e2: 48b9 li a7,14 ecall 3e4: 00000073 ecall ret 3e8: 8082 ret 00000000000003ea <waitx>: .global waitx waitx: li a7, SYS_waitx 3ea: 48d9 li a7,22 ecall 3ec: 00000073 ecall ret 3f0: 8082 ret 00000000000003f2 <trace>: .global trace trace: li a7, SYS_trace 3f2: 48e1 li a7,24 ecall 3f4: 00000073 ecall ret 3f8: 8082 ret 00000000000003fa <set_priority>: .global set_priority set_priority: li a7, SYS_set_priority 3fa: 48dd li a7,23 ecall 3fc: 00000073 ecall ret 400: 8082 ret 0000000000000402 <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { 402: 1101 addi sp,sp,-32 404: ec06 sd ra,24(sp) 406: e822 sd s0,16(sp) 408: 1000 addi s0,sp,32 40a: feb407a3 sb a1,-17(s0) write(fd, &c, 1); 40e: 4605 li a2,1 410: fef40593 addi a1,s0,-17 414: 00000097 auipc ra,0x0 418: f56080e7 jalr -170(ra) # 36a <write> } 41c: 60e2 ld ra,24(sp) 41e: 6442 ld s0,16(sp) 420: 6105 addi sp,sp,32 422: 8082 ret 0000000000000424 <printint>: static void printint(int fd, int xx, int base, int sgn) { 424: 7139 addi sp,sp,-64 426: fc06 sd ra,56(sp) 428: f822 sd s0,48(sp) 42a: f426 sd s1,40(sp) 42c: f04a sd s2,32(sp) 42e: ec4e sd s3,24(sp) 430: 0080 addi s0,sp,64 432: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 434: c299 beqz a3,43a <printint+0x16> 436: 0805c963 bltz a1,4c8 <printint+0xa4> neg = 1; x = -xx; } else { x = xx; 43a: 2581 sext.w a1,a1 neg = 0; 43c: 4881 li a7,0 43e: fc040693 addi a3,s0,-64 } i = 0; 442: 4701 li a4,0 do{ buf[i++] = digits[x % base]; 444: 2601 sext.w a2,a2 446: 00000517 auipc a0,0x0 44a: 4ea50513 addi a0,a0,1258 # 930 <digits> 44e: 883a mv a6,a4 450: 2705 addiw a4,a4,1 452: 02c5f7bb remuw a5,a1,a2 456: 1782 slli a5,a5,0x20 458: 9381 srli a5,a5,0x20 45a: 97aa add a5,a5,a0 45c: 0007c783 lbu a5,0(a5) 460: 00f68023 sb a5,0(a3) }while((x /= base) != 0); 464: 0005879b sext.w a5,a1 468: 02c5d5bb divuw a1,a1,a2 46c: 0685 addi a3,a3,1 46e: fec7f0e3 bgeu a5,a2,44e <printint+0x2a> if(neg) 472: 00088c63 beqz a7,48a <printint+0x66> buf[i++] = '-'; 476: fd070793 addi a5,a4,-48 47a: 00878733 add a4,a5,s0 47e: 02d00793 li a5,45 482: fef70823 sb a5,-16(a4) 486: 0028071b addiw a4,a6,2 while(--i >= 0) 48a: 02e05863 blez a4,4ba <printint+0x96> 48e: fc040793 addi a5,s0,-64 492: 00e78933 add s2,a5,a4 496: fff78993 addi s3,a5,-1 49a: 99ba add s3,s3,a4 49c: 377d addiw a4,a4,-1 49e: 1702 slli a4,a4,0x20 4a0: 9301 srli a4,a4,0x20 4a2: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); 4a6: fff94583 lbu a1,-1(s2) 4aa: 8526 mv a0,s1 4ac: 00000097 auipc ra,0x0 4b0: f56080e7 jalr -170(ra) # 402 <putc> while(--i >= 0) 4b4: 197d addi s2,s2,-1 4b6: ff3918e3 bne s2,s3,4a6 <printint+0x82> } 4ba: 70e2 ld ra,56(sp) 4bc: 7442 ld s0,48(sp) 4be: 74a2 ld s1,40(sp) 4c0: 7902 ld s2,32(sp) 4c2: 69e2 ld s3,24(sp) 4c4: 6121 addi sp,sp,64 4c6: 8082 ret x = -xx; 4c8: 40b005bb negw a1,a1 neg = 1; 4cc: 4885 li a7,1 x = -xx; 4ce: bf85 j 43e <printint+0x1a> 00000000000004d0 <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { 4d0: 7119 addi sp,sp,-128 4d2: fc86 sd ra,120(sp) 4d4: f8a2 sd s0,112(sp) 4d6: f4a6 sd s1,104(sp) 4d8: f0ca sd s2,96(sp) 4da: ecce sd s3,88(sp) 4dc: e8d2 sd s4,80(sp) 4de: e4d6 sd s5,72(sp) 4e0: e0da sd s6,64(sp) 4e2: fc5e sd s7,56(sp) 4e4: f862 sd s8,48(sp) 4e6: f466 sd s9,40(sp) 4e8: f06a sd s10,32(sp) 4ea: ec6e sd s11,24(sp) 4ec: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ 4ee: 0005c903 lbu s2,0(a1) 4f2: 18090f63 beqz s2,690 <vprintf+0x1c0> 4f6: 8aaa mv s5,a0 4f8: 8b32 mv s6,a2 4fa: 00158493 addi s1,a1,1 state = 0; 4fe: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 500: 02500a13 li s4,37 504: 4c55 li s8,21 506: 00000c97 auipc s9,0x0 50a: 3d2c8c93 addi s9,s9,978 # 8d8 <malloc+0x144> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ s = va_arg(ap, char*); if(s == 0) s = "(null)"; while(*s != 0){ 50e: 02800d93 li s11,40 putc(fd, 'x'); 512: 4d41 li s10,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 514: 00000b97 auipc s7,0x0 518: 41cb8b93 addi s7,s7,1052 # 930 <digits> 51c: a839 j 53a <vprintf+0x6a> putc(fd, c); 51e: 85ca mv a1,s2 520: 8556 mv a0,s5 522: 00000097 auipc ra,0x0 526: ee0080e7 jalr -288(ra) # 402 <putc> 52a: a019 j 530 <vprintf+0x60> } else if(state == '%'){ 52c: 01498d63 beq s3,s4,546 <vprintf+0x76> for(i = 0; fmt[i]; i++){ 530: 0485 addi s1,s1,1 532: fff4c903 lbu s2,-1(s1) 536: 14090d63 beqz s2,690 <vprintf+0x1c0> if(state == 0){ 53a: fe0999e3 bnez s3,52c <vprintf+0x5c> if(c == '%'){ 53e: ff4910e3 bne s2,s4,51e <vprintf+0x4e> state = '%'; 542: 89d2 mv s3,s4 544: b7f5 j 530 <vprintf+0x60> if(c == 'd'){ 546: 11490c63 beq s2,s4,65e <vprintf+0x18e> 54a: f9d9079b addiw a5,s2,-99 54e: 0ff7f793 zext.b a5,a5 552: 10fc6e63 bltu s8,a5,66e <vprintf+0x19e> 556: f9d9079b addiw a5,s2,-99 55a: 0ff7f713 zext.b a4,a5 55e: 10ec6863 bltu s8,a4,66e <vprintf+0x19e> 562: 00271793 slli a5,a4,0x2 566: 97e6 add a5,a5,s9 568: 439c lw a5,0(a5) 56a: 97e6 add a5,a5,s9 56c: 8782 jr a5 printint(fd, va_arg(ap, int), 10, 1); 56e: 008b0913 addi s2,s6,8 572: 4685 li a3,1 574: 4629 li a2,10 576: 000b2583 lw a1,0(s6) 57a: 8556 mv a0,s5 57c: 00000097 auipc ra,0x0 580: ea8080e7 jalr -344(ra) # 424 <printint> 584: 8b4a mv s6,s2 } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 586: 4981 li s3,0 588: b765 j 530 <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 58a: 008b0913 addi s2,s6,8 58e: 4681 li a3,0 590: 4629 li a2,10 592: 000b2583 lw a1,0(s6) 596: 8556 mv a0,s5 598: 00000097 auipc ra,0x0 59c: e8c080e7 jalr -372(ra) # 424 <printint> 5a0: 8b4a mv s6,s2 state = 0; 5a2: 4981 li s3,0 5a4: b771 j 530 <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 5a6: 008b0913 addi s2,s6,8 5aa: 4681 li a3,0 5ac: 866a mv a2,s10 5ae: 000b2583 lw a1,0(s6) 5b2: 8556 mv a0,s5 5b4: 00000097 auipc ra,0x0 5b8: e70080e7 jalr -400(ra) # 424 <printint> 5bc: 8b4a mv s6,s2 state = 0; 5be: 4981 li s3,0 5c0: bf85 j 530 <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 5c2: 008b0793 addi a5,s6,8 5c6: f8f43423 sd a5,-120(s0) 5ca: 000b3983 ld s3,0(s6) putc(fd, '0'); 5ce: 03000593 li a1,48 5d2: 8556 mv a0,s5 5d4: 00000097 auipc ra,0x0 5d8: e2e080e7 jalr -466(ra) # 402 <putc> putc(fd, 'x'); 5dc: 07800593 li a1,120 5e0: 8556 mv a0,s5 5e2: 00000097 auipc ra,0x0 5e6: e20080e7 jalr -480(ra) # 402 <putc> 5ea: 896a mv s2,s10 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 5ec: 03c9d793 srli a5,s3,0x3c 5f0: 97de add a5,a5,s7 5f2: 0007c583 lbu a1,0(a5) 5f6: 8556 mv a0,s5 5f8: 00000097 auipc ra,0x0 5fc: e0a080e7 jalr -502(ra) # 402 <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 600: 0992 slli s3,s3,0x4 602: 397d addiw s2,s2,-1 604: fe0914e3 bnez s2,5ec <vprintf+0x11c> printptr(fd, va_arg(ap, uint64)); 608: f8843b03 ld s6,-120(s0) state = 0; 60c: 4981 li s3,0 60e: b70d j 530 <vprintf+0x60> s = va_arg(ap, char*); 610: 008b0913 addi s2,s6,8 614: 000b3983 ld s3,0(s6) if(s == 0) 618: 02098163 beqz s3,63a <vprintf+0x16a> while(*s != 0){ 61c: 0009c583 lbu a1,0(s3) 620: c5ad beqz a1,68a <vprintf+0x1ba> putc(fd, *s); 622: 8556 mv a0,s5 624: 00000097 auipc ra,0x0 628: dde080e7 jalr -546(ra) # 402 <putc> s++; 62c: 0985 addi s3,s3,1 while(*s != 0){ 62e: 0009c583 lbu a1,0(s3) 632: f9e5 bnez a1,622 <vprintf+0x152> s = va_arg(ap, char*); 634: 8b4a mv s6,s2 state = 0; 636: 4981 li s3,0 638: bde5 j 530 <vprintf+0x60> s = "(null)"; 63a: 00000997 auipc s3,0x0 63e: 29698993 addi s3,s3,662 # 8d0 <malloc+0x13c> while(*s != 0){ 642: 85ee mv a1,s11 644: bff9 j 622 <vprintf+0x152> putc(fd, va_arg(ap, uint)); 646: 008b0913 addi s2,s6,8 64a: 000b4583 lbu a1,0(s6) 64e: 8556 mv a0,s5 650: 00000097 auipc ra,0x0 654: db2080e7 jalr -590(ra) # 402 <putc> 658: 8b4a mv s6,s2 state = 0; 65a: 4981 li s3,0 65c: bdd1 j 530 <vprintf+0x60> putc(fd, c); 65e: 85d2 mv a1,s4 660: 8556 mv a0,s5 662: 00000097 auipc ra,0x0 666: da0080e7 jalr -608(ra) # 402 <putc> state = 0; 66a: 4981 li s3,0 66c: b5d1 j 530 <vprintf+0x60> putc(fd, '%'); 66e: 85d2 mv a1,s4 670: 8556 mv a0,s5 672: 00000097 auipc ra,0x0 676: d90080e7 jalr -624(ra) # 402 <putc> putc(fd, c); 67a: 85ca mv a1,s2 67c: 8556 mv a0,s5 67e: 00000097 auipc ra,0x0 682: d84080e7 jalr -636(ra) # 402 <putc> state = 0; 686: 4981 li s3,0 688: b565 j 530 <vprintf+0x60> s = va_arg(ap, char*); 68a: 8b4a mv s6,s2 state = 0; 68c: 4981 li s3,0 68e: b54d j 530 <vprintf+0x60> } } } 690: 70e6 ld ra,120(sp) 692: 7446 ld s0,112(sp) 694: 74a6 ld s1,104(sp) 696: 7906 ld s2,96(sp) 698: 69e6 ld s3,88(sp) 69a: 6a46 ld s4,80(sp) 69c: 6aa6 ld s5,72(sp) 69e: 6b06 ld s6,64(sp) 6a0: 7be2 ld s7,56(sp) 6a2: 7c42 ld s8,48(sp) 6a4: 7ca2 ld s9,40(sp) 6a6: 7d02 ld s10,32(sp) 6a8: 6de2 ld s11,24(sp) 6aa: 6109 addi sp,sp,128 6ac: 8082 ret 00000000000006ae <fprintf>: void fprintf(int fd, const char *fmt, ...) { 6ae: 715d addi sp,sp,-80 6b0: ec06 sd ra,24(sp) 6b2: e822 sd s0,16(sp) 6b4: 1000 addi s0,sp,32 6b6: e010 sd a2,0(s0) 6b8: e414 sd a3,8(s0) 6ba: e818 sd a4,16(s0) 6bc: ec1c sd a5,24(s0) 6be: 03043023 sd a6,32(s0) 6c2: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 6c6: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 6ca: 8622 mv a2,s0 6cc: 00000097 auipc ra,0x0 6d0: e04080e7 jalr -508(ra) # 4d0 <vprintf> } 6d4: 60e2 ld ra,24(sp) 6d6: 6442 ld s0,16(sp) 6d8: 6161 addi sp,sp,80 6da: 8082 ret 00000000000006dc <printf>: void printf(const char *fmt, ...) { 6dc: 711d addi sp,sp,-96 6de: ec06 sd ra,24(sp) 6e0: e822 sd s0,16(sp) 6e2: 1000 addi s0,sp,32 6e4: e40c sd a1,8(s0) 6e6: e810 sd a2,16(s0) 6e8: ec14 sd a3,24(s0) 6ea: f018 sd a4,32(s0) 6ec: f41c sd a5,40(s0) 6ee: 03043823 sd a6,48(s0) 6f2: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 6f6: 00840613 addi a2,s0,8 6fa: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 6fe: 85aa mv a1,a0 700: 4505 li a0,1 702: 00000097 auipc ra,0x0 706: dce080e7 jalr -562(ra) # 4d0 <vprintf> } 70a: 60e2 ld ra,24(sp) 70c: 6442 ld s0,16(sp) 70e: 6125 addi sp,sp,96 710: 8082 ret 0000000000000712 <free>: static Header base; static Header *freep; void free(void *ap) { 712: 1141 addi sp,sp,-16 714: e422 sd s0,8(sp) 716: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 718: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 71c: 00000797 auipc a5,0x0 720: 22c7b783 ld a5,556(a5) # 948 <freep> 724: a02d j 74e <free+0x3c> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 726: 4618 lw a4,8(a2) 728: 9f2d addw a4,a4,a1 72a: fee52c23 sw a4,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 72e: 6398 ld a4,0(a5) 730: 6310 ld a2,0(a4) 732: a83d j 770 <free+0x5e> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 734: ff852703 lw a4,-8(a0) 738: 9f31 addw a4,a4,a2 73a: c798 sw a4,8(a5) p->s.ptr = bp->s.ptr; 73c: ff053683 ld a3,-16(a0) 740: a091 j 784 <free+0x72> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 742: 6398 ld a4,0(a5) 744: 00e7e463 bltu a5,a4,74c <free+0x3a> 748: 00e6ea63 bltu a3,a4,75c <free+0x4a> { 74c: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 74e: fed7fae3 bgeu a5,a3,742 <free+0x30> 752: 6398 ld a4,0(a5) 754: 00e6e463 bltu a3,a4,75c <free+0x4a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 758: fee7eae3 bltu a5,a4,74c <free+0x3a> if(bp + bp->s.size == p->s.ptr){ 75c: ff852583 lw a1,-8(a0) 760: 6390 ld a2,0(a5) 762: 02059813 slli a6,a1,0x20 766: 01c85713 srli a4,a6,0x1c 76a: 9736 add a4,a4,a3 76c: fae60de3 beq a2,a4,726 <free+0x14> bp->s.ptr = p->s.ptr->s.ptr; 770: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 774: 4790 lw a2,8(a5) 776: 02061593 slli a1,a2,0x20 77a: 01c5d713 srli a4,a1,0x1c 77e: 973e add a4,a4,a5 780: fae68ae3 beq a3,a4,734 <free+0x22> p->s.ptr = bp->s.ptr; 784: e394 sd a3,0(a5) } else p->s.ptr = bp; freep = p; 786: 00000717 auipc a4,0x0 78a: 1cf73123 sd a5,450(a4) # 948 <freep> } 78e: 6422 ld s0,8(sp) 790: 0141 addi sp,sp,16 792: 8082 ret 0000000000000794 <malloc>: return freep; } void* malloc(uint nbytes) { 794: 7139 addi sp,sp,-64 796: fc06 sd ra,56(sp) 798: f822 sd s0,48(sp) 79a: f426 sd s1,40(sp) 79c: f04a sd s2,32(sp) 79e: ec4e sd s3,24(sp) 7a0: e852 sd s4,16(sp) 7a2: e456 sd s5,8(sp) 7a4: e05a sd s6,0(sp) 7a6: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7a8: 02051493 slli s1,a0,0x20 7ac: 9081 srli s1,s1,0x20 7ae: 04bd addi s1,s1,15 7b0: 8091 srli s1,s1,0x4 7b2: 0014899b addiw s3,s1,1 7b6: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 7b8: 00000517 auipc a0,0x0 7bc: 19053503 ld a0,400(a0) # 948 <freep> 7c0: c515 beqz a0,7ec <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7c2: 611c ld a5,0(a0) if(p->s.size >= nunits){ 7c4: 4798 lw a4,8(a5) 7c6: 02977f63 bgeu a4,s1,804 <malloc+0x70> 7ca: 8a4e mv s4,s3 7cc: 0009871b sext.w a4,s3 7d0: 6685 lui a3,0x1 7d2: 00d77363 bgeu a4,a3,7d8 <malloc+0x44> 7d6: 6a05 lui s4,0x1 7d8: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 7dc: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 7e0: 00000917 auipc s2,0x0 7e4: 16890913 addi s2,s2,360 # 948 <freep> if(p == (char*)-1) 7e8: 5afd li s5,-1 7ea: a895 j 85e <malloc+0xca> base.s.ptr = freep = prevp = &base; 7ec: 00000797 auipc a5,0x0 7f0: 16478793 addi a5,a5,356 # 950 <base> 7f4: 00000717 auipc a4,0x0 7f8: 14f73a23 sd a5,340(a4) # 948 <freep> 7fc: e39c sd a5,0(a5) base.s.size = 0; 7fe: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 802: b7e1 j 7ca <malloc+0x36> if(p->s.size == nunits) 804: 02e48c63 beq s1,a4,83c <malloc+0xa8> p->s.size -= nunits; 808: 4137073b subw a4,a4,s3 80c: c798 sw a4,8(a5) p += p->s.size; 80e: 02071693 slli a3,a4,0x20 812: 01c6d713 srli a4,a3,0x1c 816: 97ba add a5,a5,a4 p->s.size = nunits; 818: 0137a423 sw s3,8(a5) freep = prevp; 81c: 00000717 auipc a4,0x0 820: 12a73623 sd a0,300(a4) # 948 <freep> return (void*)(p + 1); 824: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 828: 70e2 ld ra,56(sp) 82a: 7442 ld s0,48(sp) 82c: 74a2 ld s1,40(sp) 82e: 7902 ld s2,32(sp) 830: 69e2 ld s3,24(sp) 832: 6a42 ld s4,16(sp) 834: 6aa2 ld s5,8(sp) 836: 6b02 ld s6,0(sp) 838: 6121 addi sp,sp,64 83a: 8082 ret prevp->s.ptr = p->s.ptr; 83c: 6398 ld a4,0(a5) 83e: e118 sd a4,0(a0) 840: bff1 j 81c <malloc+0x88> hp->s.size = nu; 842: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 846: 0541 addi a0,a0,16 848: 00000097 auipc ra,0x0 84c: eca080e7 jalr -310(ra) # 712 <free> return freep; 850: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 854: d971 beqz a0,828 <malloc+0x94> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 856: 611c ld a5,0(a0) if(p->s.size >= nunits){ 858: 4798 lw a4,8(a5) 85a: fa9775e3 bgeu a4,s1,804 <malloc+0x70> if(p == freep) 85e: 00093703 ld a4,0(s2) 862: 853e mv a0,a5 864: fef719e3 bne a4,a5,856 <malloc+0xc2> p = sbrk(nu * sizeof(Header)); 868: 8552 mv a0,s4 86a: 00000097 auipc ra,0x0 86e: b68080e7 jalr -1176(ra) # 3d2 <sbrk> if(p == (char*)-1) 872: fd5518e3 bne a0,s5,842 <malloc+0xae> return 0; 876: 4501 li a0,0 878: bf45 j 828 <malloc+0x94>
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37008b.ada
best08618/asylo
7
16000
-- C37008B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT NO CONSTRAINT ERROR IS RAISED FOR AN UNUSED TYPE -- DECLARATION WITH AN INVALID DEFAULT VALUE -- JBG 9/11/81 -- SPS 10/25/82 WITH REPORT; USE REPORT; PROCEDURE C37008B IS BEGIN TEST ("C37008B", "CHECK THAT INVALID DEFAULT RECORD" & " COMPONENT INITIALIZATIONS DO NOT RAISE" & " CONSTRAINT_ERROR"); BEGIN DECLARE TYPE R1 IS RECORD C1 : INTEGER RANGE 1 .. 5 := 0; END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 1"); END; BEGIN DECLARE TYPE R IS RECORD C : CHARACTER RANGE 'A' .. 'Y' := 'Z'; END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 1A"); END; BEGIN DECLARE TYPE R2 IS RECORD C2 : BOOLEAN RANGE FALSE .. FALSE := TRUE; END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 2"); END; BEGIN DECLARE TYPE E IS (E1, E2, E3); TYPE R IS RECORD C : E RANGE E2 .. E3 := E1; END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 2A"); END; BEGIN DECLARE TYPE R3 IS RECORD C3 : INTEGER RANGE 1 .. 5; END RECORD; TYPE R3A IS RECORD C3A : R3 := (OTHERS => 6); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 3"); END; BEGIN DECLARE TYPE ARR IS ARRAY (1..3) OF INTEGER RANGE 8..9; TYPE R4 IS RECORD C4 : ARR := (1 => 8, 2 => 9, 3 => 10); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 4"); END; BEGIN DECLARE TYPE A IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 1 .. 5; TYPE AA IS ACCESS A; TYPE R5 IS RECORD C5 : AA := NEW A'(4, 5, 6); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 5"); END; BEGIN DECLARE TYPE A IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 1 .. 5; TYPE AA IS ACCESS A (1 .. 3); TYPE R6 IS RECORD C6 : AA := NEW A'(4, 4, 4, 4); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 6"); END; BEGIN DECLARE TYPE AI IS ACCESS INTEGER RANGE 6 .. 8; TYPE R7 IS RECORD C7 : AI := NEW INTEGER'(5); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 7"); END; BEGIN DECLARE TYPE UA IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 3 .. 5; SUBTYPE CA IS UA (7 .. 8); TYPE R8 IS RECORD C8 : CA := (6 .. 8 => 4); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 8"); END; BEGIN DECLARE TYPE UA IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 3 .. IDENT_INT(5); TYPE R9 IS RECORD C9 : UA (11 .. 11) := (11 => 6); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 9"); END; BEGIN DECLARE TYPE A IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 1 .. IDENT_INT (5); TYPE AA IS ACCESS A; TYPE R10 IS RECORD C10 : AA := NEW A'(4, 5, 6); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 10"); END; BEGIN DECLARE TYPE A IS ARRAY (NATURAL RANGE <> ) OF INTEGER RANGE 1 .. 5; TYPE AA IS ACCESS A (IDENT_INT (1) .. IDENT_INT (3)); TYPE R11 IS RECORD C11 : AA := NEW A'(4, 4, 4, 4); END RECORD; BEGIN NULL; END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED 11"); END; RESULT; END C37008B;
PointersAndTypeDef/PointersAndTypeDef/Main.asm
pratik088/AssemblyCodes
0
244286
<reponame>pratik088/AssemblyCodes<gh_stars>0 .386 .model flat PBYTE TYPEDEF PTR BYTE PWORD TYPEDEF PTR WORD PDWORD TYPEDEF PTR DWORD .data arrayB BYTE 10h,20h,30h arrayW WORD 1,2,3 arrayD DWORD 4,5,6 pt_1 PBYTE arrayB pt_2 PWORD arrayW pt_3 PDWORD arrayD .code start proc mov esi,pt_1 mov al,[esi] mov esi,pt_2 mov ax,[esi] mov esi,pt_3 mov eax,[esi] ret start endp end start
install/lib/disk/dsk_rset.asm
minblock/msdos
0
93398
<reponame>minblock/msdos ;======================================================== COMMENT # DSK_RSET.ASM Copyright (c) 1991 - Microsoft Corp. All rights reserved. Microsoft Confidential ================================================= Instructs DOS to do a reset of all it's disk buffers. int _dos_dskreset( void ) RETURNS: void ================================================ johnhe - 06/06/89 END COMMENT # ; ======================================================= INCLUDE disk_io.inc INCLUDE model.inc ; ======================================================= .DATA PUBLIC DiskChange DiskChange db 0 .CODE ; ======================================================= _dos_dskreset PROC mov DiskChange,1 mov AH,0dh int 21h ret _dos_dskreset ENDP ; ======================================================= END ; =======================================================
src/Tactic/Reflection/Reright.agda
lclem/agda-prelude
0
8730
<filename>src/Tactic/Reflection/Reright.agda<gh_stars>0 module Tactic.Reflection.Reright where open import Prelude hiding (abs) open import Container.Traversable open import Tactic.Reflection open import Tactic.Reflection.Match open import Tactic.Reflection.Replace open import Tactic.Reflection.Quote private {-# TERMINATING #-} reorderVars : List Nat → Term → Term reorderVars xs (var x args) = var (maybe x id (index xs x)) (fmap (reorderVars xs) <$> args) reorderVars xs (con c args) = con c ((fmap ∘ fmap) (reorderVars xs) args) reorderVars xs (def f args) = def f (fmap (reorderVars xs) <$> args) reorderVars xs (lam v t) = lam v (reorderVars (0 ∷ weaken 1 xs) <$> t) reorderVars xs (pat-lam cs args) = pat-lam (fmap (reorderVarsInClause xs) cs) ((fmap ∘ fmap) (reorderVars xs) args) where reorderVarsInClause : List Nat → Clause → Clause -- TODO reorder patterns? reorderVarsInClause xs (clause ps t) = (clause ps (reorderVars xs t)) reorderVarsInClause xs (absurd-clause ps) = (absurd-clause ps) reorderVars xs (pi a b) = pi (reorderVars xs <$> a) (reorderVars (0 ∷ weaken 1 xs) <$> b) reorderVars xs (agda-sort (set t)) = agda-sort (set (reorderVars xs t)) reorderVars xs (agda-sort (lit n)) = agda-sort (lit n) reorderVars xs (agda-sort unknown) = agda-sort unknown reorderVars xs (lit l) = lit l reorderVars xs (meta x args) = meta x $ (fmap ∘ fmap) (reorderVars xs) args reorderVars xs unknown = unknown {-# TERMINATING #-} freeDependencies : List (Arg Type) → Type → Maybe VarSet freeDependencies Γ x = foldr _∪_ (freeVars x) <$> mapM go (freeVars x) where _∪_ : VarSet → VarSet → VarSet -- REFACTOR this was stolen from Tactic.Reflection.Free [] ∪ ys = ys xs ∪ [] = xs (x ∷ xs) ∪ (y ∷ ys) with compare x y ... | (less _) = x ∷ (xs ∪ (y ∷ ys)) ... | (equal _) = x ∷ (xs ∪ ys) ... | (greater _) = y ∷ ((x ∷ xs) ∪ ys) go : Nat → Maybe VarSet go v = weaken (suc v) $ join $ freeDependencies (drop (suc v) Γ) <$> (unArg <$> index Γ v) .test-freeDependencies₁ : freeDependencies [] unknown ≡ just [] test-freeDependencies₁ = refl .test-freeDependencies₂ : freeDependencies (vArg (var₀ 0) ∷ vArg unknown ∷ []) (var₀ 0) ≡ just (0 ∷ 1 ∷ []) test-freeDependencies₂ = refl .test-freeDependencies₃ : freeDependencies (vArg (var₀ 0) ∷ vArg (var₀ 1) ∷ vArg unknown ∷ vArg unknown ∷ []) (var₀ 0) ≡ just (0 ∷ 1 ∷ 3 ∷ []) test-freeDependencies₃ = refl .test-freeDependencies₄ : freeDependencies (vArg (var₀ 0) ∷ vArg (var₀ 1) ∷ vArg unknown ∷ vArg unknown ∷ []) (var₀ 1) ≡ just (1 ∷ 3 ∷ []) test-freeDependencies₄ = refl .test-freeDependencies₅ : freeDependencies (vArg (var₀ 1) ∷ vArg unknown ∷ vArg unknown ∷ []) (var₀ 0) ≡ just (0 ∷ 2 ∷ []) test-freeDependencies₅ = refl .test-freeDependencies₆ : freeDependencies (vArg (var₀ 0) ∷ vArg (var₀ 1) ∷ vArg unknown ∷ vArg unknown ∷ []) (var₁ 0 (var₀ 1)) ≡ just (0 ∷ 1 ∷ 3 ∷ []) test-freeDependencies₆ = refl record Request : Set where field l≡r : Term A : Type L R : Type Γᶜ : List (Arg Type) 𝐺 : Type [iᶜ∣iᶜ∈FVᴬ] : VarSet [iᶜ∣iᶜ∈FVᴬ] = maybe [] id $ freeDependencies Γᶜ A -- TODO this is a hack; I don't expect freeDependencies will return 'nothing', but if it does, I hope(!) the rest of the computation will fail [iᶜ∣iᶜ∉FVᴬ] : VarSet [iᶜ∣iᶜ∉FVᴬ] = filter (not ∘ flip elem [iᶜ∣iᶜ∈FVᴬ]) (from 0 for (length Γᶜ)) record γᶜ' : Set where field iᶜ : Nat γᶜᵢ : Arg Type iᶜ∈FVᴬ : Bool iʷ : Nat γᶜᵢ∈Γʳ : Bool gᶜᵢ : Type gᶜᵢ = unArg γᶜᵢ Γᶜ' : List γᶜ' Γᶜ' = go 0 (length Γᶜ) Γᶜ where go : Nat → Nat → List (Arg Type) → List γᶜ' go iᶜ 0 _ = [] go iᶜ _ [] = [] go iᶜ (suc n) (γᶜᵢ ∷ Γᶜ) = γᶜᵢ' ∷ go (suc iᶜ) n (weaken 1 Γᶜ) where γᶜᵢ' = record { iᶜ = iᶜ ; γᶜᵢ = γᶜᵢ ; iᶜ∈FVᴬ = elem iᶜ [iᶜ∣iᶜ∈FVᴬ] ; iʷ = if elem iᶜ [iᶜ∣iᶜ∉FVᴬ] then (length (filter (_<? iᶜ) [iᶜ∣iᶜ∉FVᴬ])) else (length [iᶜ∣iᶜ∉FVᴬ] + (length (filter (_≤? iᶜ) [iᶜ∣iᶜ∈FVᴬ]))) ; γᶜᵢ∈Γʳ = let gᶜᵢ = unArg γᶜᵢ in (isNo $ weaken 1 gᶜᵢ == weaken 1 gᶜᵢ r[ unknown / L ]) && (isNo $ l≡r == var₀ iᶜ) } [iʷ∣γᶜᵢ∈Γʳ] : VarSet [iʷ∣γᶜᵢ∈Γʳ] = iʷ <$> filter γᶜᵢ∈Γʳ Γᶜ' where open γᶜ' [iʷ] : List Nat [iʷ] = iʷ <$> Γᶜ' where open γᶜ' subsetList : {A : Set} → List A → List Nat → Maybe (List A) subsetList xs is = traverse (index xs) is module _ where private Γʷ/ᶜ : Maybe (List (Arg Type)) Γʷ/ᶜ = go [iʷ] Γᶜ where go : List Nat → List (Arg Type) → Maybe (List (Arg Type)) go _ [] = just [] go [] _ = nothing go (iʷ ∷ [iʷ]) (γᶜᵢ ∷ Γᶜ) = _∷_ <$> (strengthen (suc iʷ) $ reorderVars [iʷ] <$> γᶜᵢ) <*> (go [iʷ] Γᶜ) Γʷ/ᴬ = join $ subsetList <$> Γʷ/ᶜ <*> pure [iᶜ∣iᶜ∈FVᴬ] Γʷ/⁻ᴬ = join $ subsetList <$> Γʷ/ᶜ <*> pure [iᶜ∣iᶜ∉FVᴬ] module _ where private Lʷ = reorderVars [iʷ] L Γʷ = caseF Γʷ' of _R[ var₀ (length [iᶜ∣iᶜ∉FVᴬ]) / Lʷ ] where Γʷ' : Maybe (List (Arg Type)) Γʷ' = _++_ <$> Γʷ/⁻ᴬ <*> (_∷_ <$> (strengthen (length [iᶜ∣iᶜ∉FVᴬ] + 1) $ hArg (reorderVars [iʷ] A)) <*> Γʷ/ᴬ) where 𝐺ʷ = reorderVars [iʷ] 𝐺 r[ var₀ (length [iᶜ∣iᶜ∉FVᴬ]) / Lʷ ] module _ where private Rʷ = reorderVars [iʷ] R gʳ : Maybe Type gʳ = join $ go <$> gʳ' <*> pure [iʷ∣γᶜᵢ∈Γʳ] <*> pure 𝐺ʷʳ where go : List (Arg Type) → List Nat → Type → Maybe Type go [] [] 𝐺 = just 𝐺 go (γʷ ∷ Γʷ) (iʷ ∷ iʷs) 𝐺 = go Γʷ iʷs $ pi (weaken (1 + iʷ) γʷ) $ abs "_" $ weaken 1 𝐺 r[ var₀ 0 / var₀ $ weaken 1 iʷ ] go _ _ _ = nothing gʳ' : Maybe (List (Arg Type)) gʳ' = join $ subsetList <$> (caseF Γʷ of _R[ Rʷ / var₀ (length [iᶜ∣iᶜ∉FVᴬ]) ]) <*> pure [iʷ∣γᶜᵢ∈Γʳ] 𝐺ʷʳ = 𝐺ʷ r[ Rʷ / var₀ (length [iᶜ∣iᶜ∉FVᴬ]) ] helper-type : Maybe Type helper-type = telPi <$> (_++_ <$> (reverse <$> Γʷ) <*> (_∷_ <$> (pure $ vArg (def₂ (quote _≡_) (var₀ (length [iᶜ∣iᶜ∉FVᴬ])) Rʷ)) <*> ([_] ∘ vArg <$> (weaken 1 <$> gʳ)))) <*> pure (weaken 2 𝐺ʷ) make-vars-from-args : List Nat → List (Arg Type) → Maybe (List (Arg Type)) make-vars-from-args [] [] = pure [] make-vars-from-args (i ∷ is) (x ∷ xs) = _∷_ <$> pure (var₀ i <$ x) <*> make-vars-from-args is xs make-vars-from-args _ _ = nothing defineHelper : Name → TC ⊤ defineHelper n = maybe (typeError ( strErr "error constructing helper function type, patterns, or term" ∷ strErr "\nhelper-type:" ∷ termErr (maybe unknown id helper-type) ∷ strErr "\n`helper-type:" ∷ termErr (` helper-type) ∷ strErr "\nhelper-patterns:" ∷ termErr (` helper-patterns) ∷ strErr "\nhelper-term:" ∷ termErr (maybe unknown id helper-term) ∷ strErr "\ngʳ:" ∷ termErr (` gʳ) ∷ strErr "\nΓʷ:" ∷ termErr (` Γʷ) ∷ strErr "\n𝐺ʷ:" ∷ termErr (` 𝐺ʷ) ∷ strErr "\nl≡r:" ∷ termErr (` l≡r) ∷ strErr "\nA:" ∷ termErr (` A) ∷ strErr "\nL:" ∷ termErr (` L) ∷ strErr "\nR:" ∷ termErr (` R) ∷ strErr "\nΓᶜ:" ∷ termErr (` Γᶜ) ∷ strErr "\n𝐺:" ∷ termErr (` 𝐺) ∷ strErr "\nΓʷ/ᴬ" ∷ termErr (` Γʷ/ᴬ) ∷ strErr "\nΓʷ/⁻ᴬ" ∷ termErr (` Γʷ/⁻ᴬ) ∷ strErr "\n[iᶜ∣iᶜ∈FVᴬ]" ∷ termErr (` [iᶜ∣iᶜ∈FVᴬ]) ∷ strErr "\n[iᶜ∣iᶜ∉FVᴬ]" ∷ termErr (` [iᶜ∣iᶜ∉FVᴬ]) ∷ strErr "\n[iʷ]" ∷ termErr (` [iʷ]) ∷ [] )) (λ {(helper-type , helper-patterns , helper-term) → catchTC (define (vArg n) helper-type [ clause helper-patterns helper-term ]) (typeError ( strErr "error defining helper function" ∷ strErr "\nhelper-type:" ∷ termErr helper-type ∷ strErr "\n`helper-type:" ∷ termErr (` helper-type) ∷ strErr "\nhelper-patterns:" ∷ termErr (` helper-patterns) ∷ strErr "\nhelper-term:" ∷ termErr helper-term ∷ strErr "\n`helper-term:" ∷ termErr (` helper-term) ∷ strErr "\ngʳ:" ∷ termErr (` gʳ) ∷ strErr "\nΓʷ:" ∷ termErr (` Γʷ) ∷ strErr "\n𝐺ʷ:" ∷ termErr (` 𝐺ʷ) ∷ strErr "\nl≡r:" ∷ termErr (` l≡r) ∷ strErr "\nA:" ∷ termErr (` A) ∷ strErr "\nL:" ∷ termErr (` L) ∷ strErr "\nR:" ∷ termErr (` R) ∷ strErr "\nΓᶜ:" ∷ termErr (` Γᶜ) ∷ strErr "\n𝐺:" ∷ termErr (` 𝐺) ∷ strErr "\nΓʷ/ᴬ" ∷ termErr (` Γʷ/ᴬ) ∷ strErr "\nΓʷ/⁻ᴬ" ∷ termErr (` Γʷ/⁻ᴬ) ∷ strErr "\n[iᶜ∣iᶜ∈FVᴬ]" ∷ termErr (` [iᶜ∣iᶜ∈FVᴬ]) ∷ strErr "\n[iᶜ∣iᶜ∉FVᴬ]" ∷ termErr (` [iᶜ∣iᶜ∉FVᴬ]) ∷ strErr "\n[iʷ]" ∷ termErr (` [iʷ]) ∷ [] )) }) (_,_ <$> helper-type <*> (_,_ <$> helper-patterns <*> helper-term)) where helper-patterns : Maybe (List (Arg Pattern)) helper-patterns = (λ pa w p-a pr → pa ++ w ∷ (p-a ++ pr)) <$> (telePat ∘ reverse <$> Γʷ/ᴬ) <*> just (hArg dot) <*> (telePat ∘ reverse <$> Γʷ/⁻ᴬ) <*> pure (vArg (con₀ (quote refl)) ∷ [ vArg (var "_") ]) helper-term : Maybe Term helper-term = do γʷs ← join $ subsetList <$> Γʷ <*> pure [iʷ∣γᶜᵢ∈Γʳ] iʷs ← make-vars-from-args [iʷ∣γᶜᵢ∈Γʳ] γʷs pure (var 0 (reverse (weaken 1 iʷs))) callHelper : Name → Tactic callHelper n hole = maybe (typeError [ strErr "error constructing helper call" ]) (unify hole) $ helper-call n where helper-call : Name → Maybe Term helper-call n = def n <$> (reverse <$> (_∷_ <$> pure (vArg l≡r) <*> Γʰ)) where Γʰ : Maybe $ List $ Arg Term Γʰ = (λ xs → take (length [iᶜ∣iᶜ∉FVᴬ]) xs ++ hArg unknown ∷ drop (length [iᶜ∣iᶜ∉FVᴬ]) xs) <$> (join $ make-vars-from-args <$> pure ([iᶜ∣iᶜ∉FVᴬ] ++ [iᶜ∣iᶜ∈FVᴬ]) <*> Γʰ') where Γʰ' : Maybe (List (Arg Type)) Γʰ' = _++_ <$> subsetList Γᶜ [iᶜ∣iᶜ∉FVᴬ] <*> subsetList Γᶜ [iᶜ∣iᶜ∈FVᴬ] inferGoal : Term → TC Type inferGoal hole = unPi =<< forceFun =<< inferType hole where unPi : Type → TC Type unPi (pi _ (abs _ (meta x _))) = blockOnMeta! x unPi (pi _ (abs _ b)) = maybe (typeError (strErr "error strengthening" ∷ termErr b ∷ [])) pure $ strengthen 1 b unPi x = typeError (strErr "goal is not a pi type" ∷ termErr x ∷ []) getRequest : Term → Term → TC Request getRequest l≡r hole = do L≡R ← inferType l≡r L≡R-matched ← maybe (typeError (strErr "not an equality" ∷ termErr l≡r ∷ termErr L≡R ∷ [])) pure $ match 3 (def (quote _≡_) (hArg unknown ∷ (hArg (var₀ 0)) ∷ (vArg (var₀ 1)) ∷ (vArg (var₀ 2)) ∷ [])) L≡R 𝐺 ← inferGoal hole Γᶜ ← getContext case L≡R-matched of λ { (A ∷ L ∷ R ∷ []) → pure $ record { l≡r = l≡r ; A = A ; L = L ; R = R ; Γᶜ = Γᶜ ; 𝐺 = 𝐺 } } macro reright : Term → Tactic reright l≡r hole = do q ← getRequest l≡r hole n ← freshName "reright" let open Request q defineHelper n callHelper n hole
models/tests/test73.als
transclosure/Amalgam
4
216
module tests/test one sig A { } fun B : univ { sig$ } run { } for 7 expect 1
agda-stdlib/src/Data/Unit/Polymorphic/Base.agda
DreamLinuxer/popl21-artifact
5
8688
------------------------------------------------------------------------ -- The Agda standard library -- -- The universe polymorphic unit type and ordering relation ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Unit.Polymorphic.Base where open import Level ------------------------------------------------------------------------ -- A unit type defined as a record type record ⊤ {ℓ : Level} : Set ℓ where constructor tt
programs/oeis/062/A062875.asm
neoneye/loda
22
91813
; A062875: Records in A046112 (or A006339). ; 1,5,25,125,3125,15625,390625,1953125,48828125,6103515625,30517578125,3814697265625,95367431640625,476837158203125,11920928955078125,1490116119384765625,186264514923095703125,931322574615478515625,116415321826934814453125,2910383045673370361328125,14551915228366851806640625,1818989403545856475830078125,45474735088646411895751953125,5684341886080801486968994140625,3552713678800500929355621337890625,88817841970012523233890533447265625,444089209850062616169452667236328125 seq $0,6005 ; The odd prime numbers together with 1. mov $1,5 lpb $0 sub $0,2 mul $1,5 lpe div $1,5 mov $0,$1
llvm-2.9/test/FrontendAda/field_order.ads
DependableSystemsLab/Trident
5
7399
-- RUN: %llvmgcc -S %s package Field_Order is type Tagged_Type is abstract tagged null record; type With_Discriminant (L : Positive) is new Tagged_Type with record S : String (1 .. L); end record; end;
programs/oeis/114/A114964.asm
karttu/loda
1
9762
<gh_stars>1-10 ; A114964: a(n) = n^2 + 30. ; 30,31,34,39,46,55,66,79,94,111,130,151,174,199,226,255,286,319,354,391,430,471,514,559,606,655,706,759,814,871,930,991,1054,1119,1186,1255,1326,1399,1474,1551,1630,1711,1794,1879,1966,2055,2146,2239,2334,2431,2530,2631,2734,2839,2946,3055,3166,3279,3394,3511,3630,3751,3874,3999,4126,4255,4386,4519,4654,4791,4930,5071,5214,5359,5506,5655,5806,5959,6114,6271,6430,6591,6754,6919,7086,7255,7426,7599,7774,7951,8130,8311,8494,8679,8866,9055,9246,9439,9634,9831,10030,10231,10434,10639,10846,11055,11266,11479,11694,11911,12130,12351,12574,12799,13026,13255,13486,13719,13954,14191,14430,14671,14914,15159,15406,15655,15906,16159,16414,16671,16930,17191,17454,17719,17986,18255,18526,18799,19074,19351,19630,19911,20194,20479,20766,21055,21346,21639,21934,22231,22530,22831,23134,23439,23746,24055,24366,24679,24994,25311,25630,25951,26274,26599,26926,27255,27586,27919,28254,28591,28930,29271,29614,29959,30306,30655,31006,31359,31714,32071,32430,32791,33154,33519,33886,34255,34626,34999,35374,35751,36130,36511,36894,37279,37666,38055,38446,38839,39234,39631,40030,40431,40834,41239,41646,42055,42466,42879,43294,43711,44130,44551,44974,45399,45826,46255,46686,47119,47554,47991,48430,48871,49314,49759,50206,50655,51106,51559,52014,52471,52930,53391,53854,54319,54786,55255,55726,56199,56674,57151,57630,58111,58594,59079,59566,60055,60546,61039,61534,62031 mov $1,$0 pow $1,2 add $1,30
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_21829_1542.asm
ljhsiun2/medusa
9
9377
.global s_prepare_buffers s_prepare_buffers: push %r8 push %rcx push %rdi push %rsi lea addresses_UC_ht+0x305b, %rsi lea addresses_WT_ht+0xf1af, %rdi nop inc %r8 mov $55, %rcx rep movsb nop nop nop nop nop add %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %r8 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %rax push %rbx push %rcx push %rsi // Store lea addresses_normal+0x149b, %rax xor %rsi, %rsi mov $0x5152535455565758, %r13 movq %r13, %xmm6 vmovups %ymm6, (%rax) nop nop nop nop nop sub %r14, %r14 // Load lea addresses_normal+0x1db93, %rax nop nop nop nop nop inc %r11 mov (%rax), %r14w nop nop nop nop nop inc %rsi // Store lea addresses_normal+0xec9b, %rcx nop nop dec %rax mov $0x5152535455565758, %r11 movq %r11, (%rcx) cmp %r11, %r11 // Store lea addresses_WC+0x289, %rcx nop nop add %r11, %r11 movl $0x51525354, (%rcx) nop nop nop nop nop xor %r14, %r14 // Store lea addresses_UC+0x3f9b, %r11 nop nop nop cmp %rsi, %rsi movl $0x51525354, (%r11) nop sub $22810, %rax // Faulty Load lea addresses_normal+0x149b, %r13 nop nop nop sub $40140, %rbx mov (%r13), %r11 lea oracles, %r13 and $0xff, %r11 shlq $12, %r11 mov (%r13,%r11,1), %r11 pop %rsi pop %rcx pop %rbx pop %rax pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 2}} {'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 */
src/coreclr/nativeaot/Runtime/arm64/StubDispatch.asm
pyracanda/runtime
9,402
246428
;; Licensed to the .NET Foundation under one or more agreements. ;; The .NET Foundation licenses this file to you under the MIT license. #include "AsmMacros.h" TEXTAREA #ifdef FEATURE_CACHED_INTERFACE_DISPATCH EXTERN RhpCidResolve EXTERN RhpUniversalTransition_DebugStepTailCall ;; Macro that generates code to check a single cache entry. MACRO CHECK_CACHE_ENTRY $entry ;; Check a single entry in the cache. ;; x9 : Cache data structure. Also used for target address jump. ;; x10 : Instance MethodTable* ;; x11 : Indirection cell address, preserved ;; x12 : Trashed ldr x12, [x9, #(OFFSETOF__InterfaceDispatchCache__m_rgEntries + ($entry * 16))] cmp x10, x12 bne %ft0 ldr x9, [x9, #(OFFSETOF__InterfaceDispatchCache__m_rgEntries + ($entry * 16) + 8)] br x9 0 MEND ;; ;; Macro that generates a stub consuming a cache with the given number of entries. ;; MACRO DEFINE_INTERFACE_DISPATCH_STUB $entries NESTED_ENTRY RhpInterfaceDispatch$entries ;; x11 holds the indirection cell address. Load the cache pointer. ldr x9, [x11, #OFFSETOF__InterfaceDispatchCell__m_pCache] ;; Load the MethodTable from the object instance in x0. ALTERNATE_ENTRY RhpInterfaceDispatchAVLocation$entries ldr x10, [x0] GBLA CurrentEntry CurrentEntry SETA 0 WHILE CurrentEntry < $entries CHECK_CACHE_ENTRY CurrentEntry CurrentEntry SETA CurrentEntry + 1 WEND ;; x11 still contains the indirection cell address. b RhpInterfaceDispatchSlow NESTED_END RhpInterfaceDispatch$entries MEND ;; ;; Define all the stub routines we currently need. ;; ;; If you change or add any new dispatch stubs, exception handling might need to be aware because it refers to the ;; *AVLocation symbols defined by the dispatch stubs to be able to unwind and blame user code if a NullRef happens ;; during the interface dispatch. ;; DEFINE_INTERFACE_DISPATCH_STUB 1 DEFINE_INTERFACE_DISPATCH_STUB 2 DEFINE_INTERFACE_DISPATCH_STUB 4 DEFINE_INTERFACE_DISPATCH_STUB 8 DEFINE_INTERFACE_DISPATCH_STUB 16 DEFINE_INTERFACE_DISPATCH_STUB 32 DEFINE_INTERFACE_DISPATCH_STUB 64 ;; ;; Initial dispatch on an interface when we don't have a cache yet. ;; LEAF_ENTRY RhpInitialInterfaceDispatch ALTERNATE_ENTRY RhpInitialDynamicInterfaceDispatch ;; Trigger an AV if we're dispatching on a null this. ;; The exception handling infrastructure is aware of the fact that this is the first ;; instruction of RhpInitialInterfaceDispatch and uses it to translate an AV here ;; to a NullReferenceException at the callsite. ldr xzr, [x0] ;; Just tail call to the cache miss helper. b RhpInterfaceDispatchSlow LEAF_END RhpInitialInterfaceDispatch ;; ;; Stub dispatch routine for dispatch to a vtable slot ;; LEAF_ENTRY RhpVTableOffsetDispatch ;; x11 contains the interface dispatch cell address. ;; load x12 to point to the vtable offset (which is stored in the m_pCache field). ldr x12, [x11, #OFFSETOF__InterfaceDispatchCell__m_pCache] ;; Load the MethodTable from the object instance in x0, and add it to the vtable offset ;; to get the address in the vtable of what we want to dereference ldr x13, [x0] add x12, x12, x13 ;; Load the target address of the vtable into x12 ldr x12, [x12] br x12 LEAF_END RhpVTableOffsetDispatch ;; ;; Cache miss case, call the runtime to resolve the target and update the cache. ;; Use universal transition helper to allow an exception to flow out of resolution. ;; LEAF_ENTRY RhpInterfaceDispatchSlow ;; x11 contains the interface dispatch cell address. ;; Calling convention of the universal thunk is: ;; xip0: target address for the thunk to call ;; xip1: parameter of the thunk's target ldr xip0, =RhpCidResolve mov xip1, x11 b RhpUniversalTransition_DebugStepTailCall LEAF_END RhpInterfaceDispatchSlow #endif // FEATURE_CACHED_INTERFACE_DISPATCH END
libsrc/_DEVELOPMENT/threads/mutex/c/sdcc_iy/mtx_unlock_fastcall.asm
jpoikela/z88dk
640
167171
<filename>libsrc/_DEVELOPMENT/threads/mutex/c/sdcc_iy/mtx_unlock_fastcall.asm ; int mtx_unlock_fastcall(mtx_t *m) SECTION code_clib SECTION code_threads_mutex PUBLIC _mtx_unlock_fastcall EXTERN asm_mtx_unlock defc _mtx_unlock_fastcall = asm_mtx_unlock
oeis/176/A176338.asm
neoneye/loda-programs
11
99774
<reponame>neoneye/loda-programs<filename>oeis/176/A176338.asm ; A176338: a(n) = 1 + (1-3^n)*a(n-1) for n >=1, a(0) = 0. ; 0,1,-7,183,-14639,3542639,-2579041191,5637784043527,-36983863325537119,727916397973221576159,-42982007467522787629036631,7614090694841791737333323035127,-4046432358866721800888421193787892879,6451316131253109635036029454522300950633039,-30856438613667423284869007728037620733247405279751,442756137162284171976796614202885384365018093103050802407,-19059199464706441311517010348539630332853311648740959036989455039,2461308106462503113412799182166084324604790588554894546072182216028176319 lpb $0 sub $0,1 sub $3,2 mul $2,$3 add $2,1 mul $3,3 lpe mov $0,$2
programs/oeis/239/A239462.asm
karttu/loda
0
160975
; A239462: A239459(n) / n. ; 11,41,91,161,251,361,491,641,811,10001,12101,14401,16901,19601,22501,25601,28901,32401,36101,40001,44101,48401,52901,57601,62501,67601,72901,78401,84101,90001,96101,102401,108901,115601,122501,129601,136901,144401,152101,160001,168101,176401,184901,193601,202501,211601,220901,230401,240101,250001,260101,270401,280901,291601,302501,313601,324901,336401,348101,360001,372101,384401,396901,409601,422501,435601,448901,462401,476101,490001,504101,518401,532901,547601,562501,577601,592901,608401,624101,640001,656101,672401,688901,705601,722501,739601,756901,774401,792101,810001,828101,846401,864901,883601,902501,921601,940901,960401,980101,10000001,10201001,10404001,10609001,10816001,11025001,11236001,11449001,11664001,11881001,12100001,12321001,12544001,12769001,12996001,13225001,13456001,13689001,13924001,14161001,14400001,14641001,14884001,15129001,15376001,15625001,15876001,16129001,16384001,16641001,16900001,17161001,17424001,17689001,17956001,18225001,18496001,18769001,19044001,19321001,19600001,19881001,20164001,20449001,20736001,21025001,21316001,21609001,21904001,22201001,22500001,22801001,23104001,23409001,23716001,24025001,24336001,24649001,24964001,25281001,25600001,25921001,26244001,26569001,26896001,27225001,27556001,27889001,28224001,28561001,28900001,29241001,29584001,29929001,30276001,30625001,30976001,31329001,31684001,32041001,32400001,32761001,33124001,33489001,33856001,34225001,34596001,34969001,35344001,35721001,36100001,36481001,36864001,37249001,37636001,38025001,38416001,38809001,39204001,39601001,40000001,40401001,40804001,41209001,41616001,42025001,42436001,42849001,43264001,43681001,44100001,44521001,44944001,45369001,45796001,46225001,46656001,47089001,47524001,47961001,48400001,48841001,49284001,49729001,50176001,50625001,51076001,51529001,51984001,52441001,52900001,53361001,53824001,54289001,54756001,55225001,55696001,56169001,56644001,57121001,57600001,58081001,58564001,59049001,59536001,60025001,60516001,61009001,61504001,62001001,62500001 add $0,1 mov $1,$0 mov $2,$0 lpb $0,1 div $0,10 mul $1,$2 mov $2,1 mov $3,3 sub $3,$0 add $2,$3 add $2,$0 add $2,1 mul $2,2 lpe sub $1,1 mul $1,10 add $1,11
processing/src/asm/intra_pred.asm
TechSmith/openh264
1
84089
;*! ;* \copy ;* Copyright (c) 2009-2013, Cisco Systems ;* All rights reserved. ;* ;* Redistribution and use in source and binary forms, with or without ;* modification, are permitted provided that the following conditions ;* are met: ;* ;* * Redistributions of source code must retain the above copyright ;* notice, this list of conditions and the following disclaimer. ;* ;* * Redistributions in binary form must reproduce the above copyright ;* notice, this list of conditions and the following disclaimer in ;* the documentation and/or other materials provided with the ;* distribution. ;* ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ;* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ;* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ;* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ;* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ;* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ;* POSSIBILITY OF SUCH DAMAGE. ;* ;* ;* intra_pred.asm ;* ;* Abstract ;* sse2 function for intra predict operations ;* ;* History ;* 18/09/2009 Created ;* ;* ;*************************************************************************/ %include "../../src/asm/asm_inc.asm" BITS 32 ;*********************************************************************** ; Local Data (Read Only) ;*********************************************************************** %ifdef FORMAT_COFF SECTION .rodata data %else SECTION .rodata align=16 %endif align 16 mmx_01bytes: times 16 db 1 ;*********************************************************************** ; macros ;*********************************************************************** %macro COPY_16_TIMES 2 movdqa %2, [%1-16] psrldq %2, 15 pmuludq %2, [mmx_01bytes] pshufd %2, %2, 0 %endmacro %macro COPY_16_TIMESS 3 movdqa %2, [%1+%3-16] psrldq %2, 15 pmuludq %2, [mmx_01bytes] pshufd %2, %2, 0 %endmacro ;*********************************************************************** ; Code ;*********************************************************************** SECTION .text ;*********************************************************************** ; void WelsI16x16LumaPredH_sse2(uint8_t *pred, uint8_t *pRef, int32_t stride); ;*********************************************************************** %macro SSE2_PRED_H_16X16_TWO_LINE 1 lea eax, [eax+ecx*2] COPY_16_TIMES eax, xmm0 movdqa [edx+%1], xmm0 COPY_16_TIMESS eax, xmm0, ecx movdqa [edx+%1+0x10], xmm0 %endmacro WELS_EXTERN WelsI16x16LumaPredH_sse2 WelsI16x16LumaPredH_sse2: mov edx, [esp+4] ; pred mov eax, [esp+8] ; pRef mov ecx, [esp+12] ; stride COPY_16_TIMES eax, xmm0 movdqa [edx], xmm0 COPY_16_TIMESS eax, xmm0, ecx movdqa [edx+0x10], xmm0 SSE2_PRED_H_16X16_TWO_LINE 0x20 SSE2_PRED_H_16X16_TWO_LINE 0x40 SSE2_PRED_H_16X16_TWO_LINE 0x60 SSE2_PRED_H_16X16_TWO_LINE 0x80 SSE2_PRED_H_16X16_TWO_LINE 0xa0 SSE2_PRED_H_16X16_TWO_LINE 0xc0 SSE2_PRED_H_16X16_TWO_LINE 0xe0 ret ;*********************************************************************** ; void WelsI16x16LumaPredV_sse2(uint8_t *pred, uint8_t *pRef, int32_t stride); ;*********************************************************************** WELS_EXTERN WelsI16x16LumaPredV_sse2 WelsI16x16LumaPredV_sse2: mov edx, [esp+4] ; pred mov eax, [esp+8] ; pRef mov ecx, [esp+12] ; stride sub eax, ecx movdqa xmm0, [eax] movdqa [edx], xmm0 movdqa [edx+10h], xmm0 movdqa [edx+20h], xmm0 movdqa [edx+30h], xmm0 movdqa [edx+40h], xmm0 movdqa [edx+50h], xmm0 movdqa [edx+60h], xmm0 movdqa [edx+70h], xmm0 movdqa [edx+80h], xmm0 movdqa [edx+90h], xmm0 movdqa [edx+160], xmm0 movdqa [edx+176], xmm0 movdqa [edx+192], xmm0 movdqa [edx+208], xmm0 movdqa [edx+224], xmm0 movdqa [edx+240], xmm0 ret
utils/mesh.ads
Lucretia/old_nehe_ada95
0
2764
--------------------------------------------------------------------------------- -- Copyright 2004-2005 © <NAME> -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- with GL; with Torus; with Cylinder; with AABB; with OBB; with Sphere; with Matrix3x3; with Vector3; package Mesh is subtype ColourRange is Integer range 1 .. 4; subtype VectorRange is Integer range 1 .. 3; subtype TCRange is Integer range 1 .. 2; type ColourArray is array(ColourRange) of aliased GL.GLfloat; type VectorArray is array(VectorRange) of aliased GL.GLfloat; type TCArray is array(TCRange) of aliased GL.GLfloat; type VectorArrayPtr is access all VectorArray; type ColourArrayPtr is access all ColourArray; type IntegerPtr is access all Integer; type TCArrayPtr is access all TCArray; type VertexArray is array(Integer range <>) of aliased VectorArray; type NormalArray is array(Integer range <>) of aliased VectorArray; type IndexArray is array(Integer range <>) of aliased Integer; type VertexColourArray is array(Integer range <>) of aliased ColourArray; type TexCoordArray is array(Integer range <>) of aliased TCArray; type VertexArrayPtr is access all VertexArray; type NormalArrayPtr is access all NormalArray; type IndexArrayPtr is access all IndexArray; type VertexColourArrayPtr is access all VertexColourArray; type TexCoordArrayPtr is access all TexCoordArray; type Object is record Primitive : GL.PrimitiveType := GL.GL_TRIANGLES; Vertices : VertexArrayPtr := null; Normals : NormalArrayPtr := null; Indices : IndexArrayPtr := null; TexCoords : TexCoordArrayPtr := null; AABB_Bounds : AABB.Object; OBB_Bounds : OBB.Object; Sphere_Bounds : Sphere.Object; Transform : Matrix3x3.Object := Matrix3x3.Identity; Translation : Vector3.Object := Vector3.ZERO; end record; function GetVertices(MeshData : in Object) return GL.GLpointer; function GetNormals(MeshData : in Object) return GL.GLpointer; function GetIndices(MeshData : in Object) return GL.GLpointer; function GetTextureCoords(MeshData : in Object) return GL.GLpointer; function Create(Data : in Torus.Object) return Object; function Create(Data : in Cylinder.Object) return Object; procedure Update_AABB(Self : in out Object); procedure Update_OBB(Self : in out Object); procedure Update_Sphere(Self : in out Object); end Mesh;
Assembly/HW4/symTab.asm
DulceWRLD/College
2
2324
<reponame>DulceWRLD/College .data inArr: .word 0:40 symTab: .word 0:40 prompt: .asciiz "Enter new set of tokens and types" LOC: .word 0 .text main: li $t0,0x0400 sw $t0, LOC inLoop: jal getTokens li $t9, 0 # DEFN li $t0, 0 # index to inArr lb $s0, inArr+12($t0) bne $s0, ':', operator jal getLabel operator: lb $s0, ',' lw $s1, inArr+20($t0) chkVar: bne $s1, 0x32, noVar # found a variable # save the var and LOC into symTab jal getVar noVar: addi $t0, $t0, 12 lb $s0, inArr($t0) bne $s0, ',', noVar lw $s1, inArr+20($t0) b chkVar # more checks for '#' for the end of inArr should be included jal dumpSymTab jal clearInArr b inLoop # # Save from keyboard to inArr table # getTokens: # # getLabel: Label is found, save it in symTab # getLabel: # # getVar: # getVar: # # dumpSymTab # dumpSymTab: # # clearInArr # clearInArr:
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10Parser.g4
jeffkala/batfish
0
1616
parser grammar A10Parser; import A10_access_list, A10_common, A10_floating_ip, A10_ha, A10_health_monitor, A10_interface, A10_ip_access_list, A10_ip_nat, A10_ip_route, A10_lacp_trunk, A10_rba, A10_router_bgp, A10_slb_server, A10_slb_service_group, A10_slb_template, A10_slb_virtual_server, A10_trunk, A10_vlan, A10_vrrp_a; options { superClass = 'org.batfish.grammar.BatfishParser'; tokenVocab = A10Lexer; } a10_configuration: NEWLINE? statement+ EOF; statement : s_access_list | s_floating_ip | s_health_monitor | s_hostname | s_interface | s_ha | s_ip | s_lacp_trunk | s_no | s_rba | s_router | s_slb | s_trunk | s_vlan | s_vrrp_a ; s_ip: IP si; si: si_access_list | si_nat | si_route; s_no: NO (sn_ha | sn_ip | sn_slb); sn_ip: IP sni; sni: sni_route; sn_slb: SLB sns_server; s_hostname: HOSTNAME hostname NEWLINE; s_router: ROUTER sr_bgp; s_slb: SLB ss; ss: ss_server | ss_service_group | ss_template | ss_virtual_server ;
oeis/037/A037140.asm
neoneye/loda-programs
11
23491
<filename>oeis/037/A037140.asm ; A037140: Convolution of natural numbers n >= 1 with Fibonacci numbers F(k), for k >= 5. ; 5,18,44,91,172,308,533,902,1504,2483,4072,6648,10821,17578,28516,46219,74868,121228,196245,317630,514040,831843,1346064,2178096,3524357,5702658,9227228,14930107,24157564,39087908,63245717,102333878,165579856,267914003,433494136,701408424,1134902853,1836311578,2971214740,4807526635,7778741700,12586268668,20365010709,32951279726,53316290792,86267570883,139583862048,225851433312,365435295749,591286729458,956722025612,1548008755483,2504730781516,4052739537428,6557470319381,10610209857254 lpb $0 sub $0,1 add $4,4 add $1,$4 add $2,4 mov $3,1 add $3,$1 mov $1,$2 add $2,$3 lpe add $1,$2 add $1,5 mov $0,$1
libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/sinh.asm
ahjelm/z88dk
640
27493
<reponame>ahjelm/z88dk<filename>libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/sinh.asm SECTION code_fp_am9511 PUBLIC _sinh EXTERN cam32_sdcc_sinh defc _sinh = cam32_sdcc_sinh
programs/oeis/215/A215004.asm
karttu/loda
1
19384
<filename>programs/oeis/215/A215004.asm ; A215004: a(0) = a(1) = 1; for n>1, a(n) = a(n-1) + a(n-2) + floor(n/2). ; 1,1,3,5,10,17,30,50,84,138,227,370,603,979,1589,2575,4172,6755,10936,17700,28646,46356,75013,121380,196405,317797,514215,832025,1346254,2178293,3524562,5702870,9227448,14930334,24157799,39088150,63245967,102334135,165580121,267914275,433494416,701408711,1134903148,1836311880,2971215050,4807526952,7778742025,12586269000,20365011049,32951280073,53316291147,86267571245,139583862418,225851433689,365435296134,591286729850,956722026012,1548008755890,2504730781931,4052739537850,6557470319811,10610209857691,17167680177533,27777890035255,44945570212820,72723460248107,117669030460960,190392490709100,308061521170094,498454011879228,806515533049357,1304969544928620,2111485077978013,3416454622906669,5527939700884719,8944394323791425 cal $0,192760 ; Coefficient of x in the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments. div $0,2 mov $1,$0 add $1,1
learn-lex-yacc-antlr4/src/main/antlr4/io/github/learnlexyacc/antlr4/recursive/LeftRecursiveCalc.g4
mpuening/learn-lex-yacc
2
1239
<filename>learn-lex-yacc-antlr4/src/main/antlr4/io/github/learnlexyacc/antlr4/recursive/LeftRecursiveCalc.g4 grammar LeftRecursiveCalc; statement : (variable '=' expression ';')+ ; variable : VARIABLE ; expression : lhs=expression op=('*'|'/') rhs=expression #operation | lhs=expression op=('+'|'-') rhs=expression #operation | '(' expression ')' #nestedExpression | term=variable #variableTerm | term=NUMBER #numberTerm ; NUMBER : ('0' .. '9') + ('.' ('0' .. '9') +)? ; VARIABLE : ('a' .. 'z')+ ; WS : [ \r\n\t] + -> skip ;
utils/vector3.ads
Lucretia/old_nehe_ada95
0
15059
--------------------------------------------------------------------------------- -- Copyright 2004-2005 © <NAME> -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- package Vector3 is type Object is record X, Y, Z : Float; end record; -- The additive identity. ZERO : constant Object := Object'(0.0, 0.0, 0.0); function Length(Self : in Object) return Float; procedure Normalise(Self : in out Object); function Dot(Self, Operand : in Object) return Float; function Cross(Self, Operand : in Object) return Object; function "+"(Left, Right : in Object) return Object; function "-"(Left, Right : in Object) return Object; function "-"(Left : in Object) return Object; function "*"(Left : in Object; Right : in Float) return Object; function "/"(Left : in Object; Right : in Float) return Object; function Output(Self : in Object) return String; end Vector3;
ADL/Assemble/Delete/2/B~HR_delete_middle.asm
MaxMorning/LinkedListVisualization
3
242978
aLine 0 sInit sTemp, {0:D} sBge sTemp, 1, 20 aLine 1 gNew delPtr gMove delPtr, Root aLine 2 gBne Root, null, 3 aLine 3 Exception NOT_FOUND aLine 5 gMoveNext Root, Root aLine 6 pDeletePrev Root aLine 7 pDeleteNext delPtr pDeletePrev delPtr nDelete delPtr gDelete delPtr aLine 8 aStd Halt aLine 10 gNew delPtr gMove delPtr, Root aLine 11 sInit i, 0 sBge i, {0:D}, 10 aLine 12 gBne delPtr, null, 3 aLine 13 Exception NOT_FOUND aLine 15 gMoveNext delPtr, delPtr aLine 11 sInc i, 1 Jmp -9 aLine 17 gBne delPtr, null, 3 aLine 18 Exception NOT_FOUND aLine 20 gNewVPtr delNext gMoveNext delNext, delPtr gNewVPtr delPrev gMovePrev delPrev, delPtr nMoveRel delPtr, delPtr, 0, -164.545 gBne delPtr, Rear, 4 aLine 21 gMove Rear, delPrev Jmp 3 aLine 24 pSetPrev delNext, delPrev aLine 26 pSetNext delPrev, delNext aLine 27 pDeleteNext delPtr pDeletePrev delPtr nDelete delPtr gDelete delPtr gDelete delPrev gDelete delNext aLine 28 aStd Halt
07_basic_calculator.asm
v3ree/learning_asm
0
86025
<gh_stars>0 ; nasm -f elf -F dwarf -g 07_basic_calculator.asm && ld -m elf_i386 07_basic_calculator.o -o 07_basic_calculator && ./07_basic_calculator 2 pow 32 %include "str_lib0.asm" %include "math_lib0.asm" SECTION .data usage_msg db "Usage (as program argument): (-)<integer> <operation (+ - x / pow sqrt fact)> (-)<integer>", 0x00 error_op db "Error - invalid operation!", 0x00 error_int db "Error - invalid integer!", 0x00 error_div db "Error - cannot divide by 0!", 0x00 error_pow db "Error - cannot raise to negative power!", 0x00 error_sqrt db "Error - cannot take square root of negative integer!", 0x00 remainder db " R ", 0x00 SECTION .bss number resb 255 SECTION .text global _start ;------------------------------------------------------------------------------- _start: pop esi ; number of arguments in esi cmp esi, 4 jg usage cmp esi, 3 jl usage pop ebx ; program name (discarded) pop eax ; the first integer call validate_int mov ebx, eax ; save value for calculation pop eax ; the operation call validate_op ; checks if [eax] is one of + - x / pow sqrt mov ecx, eax cmp BYTE [eax], 115 ; if op = sqrt skip second int (if any) je .skip_second_int cmp BYTE [eax], 102 ; if op = factorial skip second int (if any) je .skip_second_int pop eax ; the second integer call validate_int mov edx, eax ; save value for calculation .skip_second_int: call calculate ; int <ebx> op <ecx> int <edx> jmp exit ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- calculate: cmp BYTE [ecx], 43 ; check if + je .add cmp BYTE [ecx], 45 ; check if - je .sub cmp BYTE [ecx], 120 ; check if x je .mul cmp BYTE [ecx], 47 ; check if / je .div cmp BYTE [ecx], 112 ; check if p (pow operation already validated) je .pow cmp BYTE [ecx], 115 ; check if s (sqrt operation already validated) je .sqrt cmp BYTE [ecx], 102 ; check if f (factorial operation already validated) je .fact .add: mov eax, ebx add eax, edx jmp .done .sub: mov eax, ebx sub eax, edx jmp .done .mul: mov eax, ebx mul edx jmp .done .div: cmp edx, 0 jz .invalid_div push edx mov eax, ebx xor edx, edx pop ebx cdq ; extends the sign bit of eax into edx idiv ebx ; edx:eax / ebx -> Q(eax) R(edx) call print_sig_int ; print quotient mov eax, remainder call print_str ; print 'R' mov eax, edx ; print remainder jmp .done .pow: mov eax, ebx ; prepare to call power function mov ecx, edx call raise_to_power cmp ecx, -1 ; check for error je .invalid_pow jmp .done ; no error, result in eax .sqrt: ; square root of first integer (ebx) mov eax, ebx call square_root cmp eax, -1 ; check if negative integer was used je .invalid_sqrt jmp .done .fact: mov eax, ebx call factorial jmp .done .done: call print_sig_int call print_newline_char ret .invalid_div: mov eax, error_div call print_str call print_newline_char jmp usage .invalid_sqrt: mov eax, error_sqrt call print_str call print_newline_char jmp usage .invalid_pow: mov eax, error_pow call print_str call print_newline_char jmp usage ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- usage: ; print the usage string and exit mov eax, usage_msg call print_str call print_newline_char call exit ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- validate_int: push ebx call check_minus ; ebx is 1 if [eax] is negative int .start: push eax call valid_int_string cmp eax, 0 ; if string is invalid jz .invalid pop eax call str_to_int cmp ebx, 1 ; if ebx = 1 int is negative jne .done neg eax .done: pop ebx ret .invalid: mov eax, error_int call print_str call print_newline_char jmp usage check_minus: cmp BYTE [eax], 45 jne .done mov ebx, 1 ; number is negative inc eax ; remove '-' character ret .done: mov ebx, 0 ; number is positive ret ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- validate_op: push eax push eax ; check if operation is more than 4 chars call get_str_len cmp eax, 4 jg .invalid pop eax cmp BYTE [eax], 43 ; check if + je .valid cmp BYTE [eax], 45 ; check if - je .valid cmp BYTE [eax], 120 ; check if x je .valid cmp BYTE [eax], 47 ; check if / je .valid cmp BYTE [eax], 112 ; check if p(ow) je .pow cmp BYTE [eax], 115 ; check if s(qrt) je .sqrt cmp BYTE [eax], 102 ; check if f(act) je .fact .pow: cmp BYTE [eax+1], 111 ; check if o jne .invalid cmp BYTE [eax+2], 119 ; check if w jne .invalid jmp .valid .sqrt: cmp BYTE [eax+1], 113 ; check if q jne .invalid cmp BYTE [eax+2], 114 ; check if r jne .invalid cmp BYTE [eax+3], 116 ; check if t jne .invalid jmp .valid .fact: cmp BYTE [eax+1], 97 ; check if a jne .invalid cmp BYTE [eax+2], 99 ; check if c jne .invalid cmp BYTE [eax+3], 116 ; check if t jne .invalid jmp .valid .valid: pop eax ret .invalid: mov eax, error_op call print_str call print_newline_char jmp usage
archive/agda-2/Oscar/Class/Associativity.agda
m0davis/oscar
0
12269
module Oscar.Class.Associativity where open import Oscar.Class.Preservativity open import Oscar.Function open import Oscar.Level open import Oscar.Relation record Associativity {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) {ℓ} (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where field associativity : ∀ {k l} (f : k ► l) {m} (g : l ► m) {n} (h : m ► n) → (h ◅ (g ◅ f)) ≤ ((h ◅ g) ◅ f) instance `preservativity : ∀ {l} {m} {n} {w : m ► n} → Preservativity (λ ⋆ → _◅_ ⋆) (λ ⋆ → _◅_ ⋆) _≤_ (m ⟨ l ►_ ⟩→ n ∋ w ◅_) id (m ⟨ l ►_ ⟩→ n ∋ w ◅_) Preservativity.preservativity `preservativity g f = associativity f g _ -- ⦃ `preservativity ⦄ : ∀ {l} {m} {n} {w : m ► n} → Preservativity (λ ⋆ → _◅_ ⋆) (λ ⋆ → _◅_ ⋆) _≤_ (m ⟨ l ►_ ⟩→ n ∋ w ◅_) id (m ⟨ l ►_ ⟩→ n ∋ w ◅_) open Associativity ⦃ … ⦄ public module _ where private postulate A : Set _⇒_ : A → A → Set _∙_ : ∀ {m n} → m ⇒ n → ∀ {l} → m ⟨ l ⇒_ ⟩→ n _≋_ : ∀ {m n} → m ⇒ n → m ⇒ n → Set instance _ : Associativity _∙_ _≋_ test-associativity₁ : ∀ {k l} (f : k ⇒ l) {m} (g : l ⇒ m) {n} (h : m ⇒ n) → (h ∙ (g ∙ f)) ≋ ((h ∙ g) ∙ f) test-associativity₁ = associativity {_◅_ = _∙_} test-associativity₂ : ∀ {k l} (f : k ⇒ l) {m} (g : l ⇒ m) {n} (h : m ⇒ n) → (h ∙ (g ∙ f)) ≋ ((h ∙ g) ∙ f) test-associativity₂ = associativity {_≤_ = _≋_} -- Associativity : ∀ -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- {ℓ} -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- → Set (𝔞 ⊔ 𝔰 ⊔ ℓ) -- Associativity {_►_ = _►_} _◅_ _≤_ = -- ∀ {l} {m} {n} {w : m ► n} → Preservativity (λ ⋆ → _◅_ ⋆) (λ ⋆ → _◅_ ⋆) _≤_ (m ⟨ l ►_ ⟩→ n ∋ w ◅_) id (m ⟨ l ►_ ⟩→ n ∋ w ◅_) -- -- record Associativity -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- {𝔱} {▸ : 𝔄 → Set 𝔱} -- -- (_◃_ : ∀ {m n} → m ► n → m ⟨ ▸ ⟩→ n) -- -- {ℓ} -- -- (_≤_ : ∀ {n} → ▸ n → ▸ n → Set ℓ) -- -- : Set (𝔞 ⊔ 𝔰 ⊔ 𝔱 ⊔ ℓ) where -- -- field -- -- associativity : ∀ {l} (f : ▸ l) {m} (g : l ► m) {n} (h : m ► n) → (h ◃ (g ◃ f)) ≤ ((h ◅ g) ◃ f) -- -- open Associativity ⦃ … ⦄ public -- -- -- record Associativity -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- (_▻_ : ∀ {l m n} → l ► m → m ⟨ _► n ⟩→ l) -- -- -- {ℓ} -- -- -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where -- -- -- field -- -- -- ⦃ `preservativity ⦄ : ∀ l m n w → Preservativity (_▻_ {l = l} {m = m} {n = n}) (_▻_ {l = l}) _≤_ (w ▻_) id (w ▻_) -- -- -- -- ⦃ `preservativity ⦄ : ∀ n l w → Preservativity (λ ⋆ → _◅_ {n = n} ⋆) (λ ⋆ → _◅_ {l = l} ⋆) _≤_ (_◅ w) id (w ◅_) -- -- -- -- record Associativity -- -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- -- (_◅_ : ∀ {l m n} → m ► n → m ⟨ l ►_ ⟩→ n) -- -- -- -- {ℓ} -- -- -- -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where -- -- -- -- field -- -- -- -- ⦃ `preservativity ⦄ : ∀ l n w → Preservativity (flip (_◅_ {l = l} {n = n})) (flip _◅_) _≤_ (w ◅_) id (_◅ w) -- -- -- -- -- ⦃ `preservativity ⦄ : ∀ n l w → Preservativity (λ ⋆ → _◅_ {n = n} ⋆) (λ ⋆ → _◅_ {l = l} ⋆) _≤_ (_◅ w) id (w ◅_) -- -- -- -- -- record Associativity -- -- -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- -- -- -- {ℓ} -- -- -- -- -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- -- -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where -- -- -- -- -- field -- -- -- -- -- ⦃ `preservativity ⦄ : ∀ n l w → Preservativity (λ ⋆ → _◅_ {n = n} ⋆) (λ ⋆ → _◅_ ⋆ {l = l}) _≤_ (_◅ w) id (w ◅_) -- -- -- -- -- -- associativity : ∀ {k l} (f : k ► l) {m} (g : l ► m) {n} (h : m ► n) → (h ◅ (g ◅ f)) ≤ ((h ◅ g) ◅ f) -- -- -- -- -- -- record Associativity -- -- -- -- -- -- {a} {A : Set a} {b} {B : A → Set b} {c} {C : (x : A) → B x → Set c} -- -- -- -- -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- -- -- -- -- {ℓ} -- -- -- -- -- -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- -- -- -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where -- -- -- -- -- -- field -- -- -- -- -- -- ⦃ `preservativity ⦄ : Preservativity -- -- -- -- -- -- associativity : ∀ {k l} (f : k ► l) {m} (g : l ► m) {n} (h : m ► n) → (h ◅ (g ◅ f)) ≤ ((h ◅ g) ◅ f) -- -- -- -- -- -- open Associativity ⦃ … ⦄ public -- -- -- -- -- -- -- record Associativity -- -- -- -- -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- -- -- -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- -- -- -- -- -- {ℓ} -- -- -- -- -- -- -- (_≤_ : ∀ {m n} → m ► n → m ► n → Set ℓ) -- -- -- -- -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ ℓ) where -- -- -- -- -- -- -- field -- -- -- -- -- -- -- associativity : ∀ {k l} (f : k ► l) {m} (g : l ► m) {n} (h : m ► n) → (h ◅ (g ◅ f)) ≤ ((h ◅ g) ◅ f) -- -- -- -- -- -- -- open Associativity ⦃ … ⦄ public -- -- -- -- -- -- -- -- record Associativity -- -- -- -- -- -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- -- -- -- -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- -- -- -- -- -- -- {𝔱} {▸ : 𝔄 → Set 𝔱} -- -- -- -- -- -- -- -- (_◃_ : ∀ {m n} → m ► n → m ⟨ ▸ ⟩→ n) -- -- -- -- -- -- -- -- {ℓ} -- -- -- -- -- -- -- -- (_≤_ : ∀ {n} → ▸ n → ▸ n → Set ℓ) -- -- -- -- -- -- -- -- : Set (𝔞 ⊔ 𝔰 ⊔ 𝔱 ⊔ ℓ) where -- -- -- -- -- -- -- -- field -- -- -- -- -- -- -- -- associativity : ∀ {l} (f : ▸ l) {m} (g : l ► m) {n} (h : m ► n) → (h ◃ (g ◃ f)) ≤ ((h ◅ g) ◃ f) -- -- -- -- -- -- -- -- open Associativity ⦃ … ⦄ public -- -- -- -- -- -- -- -- association : ∀ -- -- -- -- -- -- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰} -- -- -- -- -- -- -- -- (_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n) -- -- -- -- -- -- -- -- {𝔱} {▸ : 𝔄 → Set 𝔱} -- -- -- -- -- -- -- -- {_◃_ : ∀ {m n} → m ► n → m ⟨ ▸ ⟩→ n} -- -- -- -- -- -- -- -- {ℓ} -- -- -- -- -- -- -- -- (_≤_ : ∀ {n} → ▸ n → ▸ n → Set ℓ) -- -- -- -- -- -- -- -- ⦃ _ : Associativity _◅_ _◃_ _≤_ ⦄ -- -- -- -- -- -- -- -- → ∀ {l} (f : ▸ l) {m} (g : l ► m) {n} (h : m ► n) → (h ◃ (g ◃ f)) ≤ ((h ◅ g) ◃ f) -- -- -- -- -- -- -- -- association _◅_ _≤_ = associativity {_◅_ = _◅_} {_≤_ = _≤_}
drivers/landscape.adb
sciencylab/lagrangian-solver
0
3082
with Numerics, Ada.Text_IO; use Numerics, Ada.Text_IO; procedure Landscape is use Real_IO, Int_IO, Real_Functions; α : Real := 1.0e3; function Phi (R : in Real) return Real is begin return 0.5 * (1.0 + Tanh (50.0 * (R - 0.5))); end Phi; function PE (Q : in Real_Vector) return Real is PE_G, PE_M : Real; T : Real renames Q (1); S : Real renames Q (2); R : constant Real := 2.0 * abs (Cos (0.5 * (T + S))); Cs : constant Real := Cos (S); Ct : constant Real := Cos (T); C2tps : constant Real := Cos (2.0 * T + S); Ctp2s : constant Real := Cos (T + 2.0 * S); Vo, Vi, Tmp, Ro : Real; begin Ro := 0.9; if R < Ro then return -250.0; end if; Tmp := 1.0 / R; PE_G := Ct + 2.0 * C2tps; Vi := 0.01 * Exp (-12.0 * (R - Ro)) / (R - Ro) ** 2; Vo := (Tmp ** 3) * Cos (2.0 * (T + S)) - 3.0 * (Tmp ** 5) * ((Ct + C2tps) * (Cs + Ctp2s)); PE_M := Cos (2.0 * T) - 3.0 * Ct ** 2 + Cos (2.0 * S) - 3.0 * Cs ** 2 + Vo * Phi (R) + Vi * (1.0 - Phi (R)); return ((α / 6.0) * PE_M + PE_G); end PE; R : constant Real := π * 0.7028; function PE2 (Q : in Real_Vector) return Real is PE_G, PE_M : Real; T : Real renames Q (1); S : Real renames Q (2); R : constant Real := 2.0 * abs (Cos (0.5 * (T + S))); Cs : constant Real := Cos (S); Ct : constant Real := Cos (T); C2tps : constant Real := Cos (2.0 * T + S); Ctp2s : constant Real := Cos (T + 2.0 * S); Vo : Real; begin PE_G := Ct + 2.0 * C2tps; Vo := (Cos (2.0 * (T + S)) * R ** 2 - 3.0 * ((Ct + C2tps) * (Cs + Ctp2s))) / R ** 5; PE_M := Cos (2.0 * T) - 3.0 * Ct ** 2 + Cos (2.0 * S) - 3.0 * Cs ** 2 + Vo; return ((α / 6.0) * PE_M + PE_G); end PE2; function PE3 (Q : in Real_Vector) return Real is PE_G, PE_M : Real := 0.0; T : Real renames Q (1); S : Real renames Q (2); Cs : constant Real := Cos (S); Ct : constant Real := Cos (T); C2tps : constant Real := Cos (2.0 * T + S); Ctp2s : constant Real := Cos (T + 2.0 * S); X, N : array (1 .. 3) of Real_Vector (1 .. 2); DX : Real_Vector (1 .. 2); Vo, R, Tmp : Real; begin N (1) := (0.0, 1.0); N (2) := (-Sin (2.0 * T), Cos (2.0 * T)); N (3) := (-Sin (2.0 * (T + S)), Cos (2.0 * (T + S))); X (1) := (0.0, 0.0); X (2) := (-Sin (T), Cos (T)); X (3) := (-Sin (T) - Sin (2.0 * T + S), Cos (T) + Cos (2.0 * T + S)); R := 2.0 * abs (Cos (0.5 * (T + S))); Vo := Cos (2.0 * (T + S)) / R ** 3 - 3.0 * ((Ct + C2tps) * (Cs + Ctp2s)) / R ** 5; pragma Assert (abs (Norm (X (1) - X (2)) - 1.0) < 1.0e-15); pragma Assert (abs (Norm (X (3) - X (2)) - 1.0) < 1.0e-15); pragma Assert (abs (Norm (X (3) - X (1)) - R) < 1.0e-15); for I in 1 .. 3 loop for J in I + 1 .. 3 loop DX := X (I) - X (J); R := Sqrt (Dot (DX, DX)); Tmp := Dot (N (I), N (J)) * R ** 2 - 3.0 * Dot (N (I), DX) * Dot (N (J), DX); if I = 1 and J = 2 then pragma Assert (abs (Tmp - (Cos (2.0 * T) - 3.0 * Ct ** 2)) < 1.0e-15); end if; if I = 2 and J = 3 then pragma Assert (abs (Tmp - (Cos (2.0 * S) - 3.0 * Cs ** 2)) < 1.0e-15); end if; if I = 1 and J = 3 then pragma Assert (abs (Tmp / R ** 5 - Vo) < 1.0e-15); end if; PE_M := PE_M + Tmp / R ** 5; end loop; end loop; PE_G := Ct + 2.0 * C2tps; return ((α / 6.0) * PE_M + PE_G); end PE3; function Coordinate_Transform (X : in Real_Vector) return Real_Vector is Y : Real_Vector (1 .. 2); begin Y (1) := 0.5 * (3.0 * X (1) + X (2)); Y (2) := 0.5 * (-3.0 * X (1) + X (2)); return Y; end Coordinate_Transform; N : constant Nat := 500; Dx : constant Real := 2.0 / Real (N); X, Y : Real_Vector (1 .. 2); Num : Pos; S : constant Real := 180.0 / π; Tmp : Real; File : File_Type; begin Create (File, Name => "landscape.vtk"); -- headers Put_Line (File, "# vtk DataFile Version 2.0"); Put_Line (File, "landscape"); Put_Line (File, "ASCII"); New_Line (File); -- grid points (the corners) Num := (N + 1) * (N + 1); Put_Line (File, "DATASET UNSTRUCTURED_GRID"); Put (File, "POINTS "); Put (File, Num, 0); Put_Line (File, " float"); for I in 1 .. N + 1 loop X (1) := -1.0 + Real (I - 1) * Dx; for J in 1 .. N + 1 loop X (2) := -1.0 + Real (J - 1) * Dx; Y := R * Coordinate_Transform (X); Put (File, S * Y (1)); Put (File, " "); Put (File, S * Y (2)); Y := R * Coordinate_Transform (X); Tmp := PE (Y); Put (File, " "); Put (File, Tmp); New_Line (File); -- Put_Line (File, " 0.0"); end loop; end loop; New_Line (File); -- identify cells Num := N * N; -- number of cells Put (File, "CELLS "); Put (File, Num, Width => 0); Put (File, " "); Num := 5 * Num; -- number of points total used to identify cells Put (File, Num, Width => 0); Put (File, " "); New_Line (File); for I in 1 .. N loop for J in 1 .. N loop Put (File, "4 "); Num := (I - 1) * (N + 1) + J - 1; -- bottom-left corner Put (File, Num, Width => 0); Put (File, " "); Num := Num + 1; -- bottom-right corner Put (File, Num, Width => 0); Put (File, " "); Num := I * (N + 1) + J; -- top-right corner Put (File, Num, Width => 0); Put (File, " "); Num := Num - 1; -- top-left corner Put (File, Num, Width => 0); New_Line (File); end loop; end loop; New_Line (File); --- identify cell types Num := N * N; -- number of cells Put (File, "CELL_TYPES "); Put (File, Num, Width => 0); New_Line (File); for I in 1 .. Num loop Put_Line (File, "9"); end loop; -- 9 <--> quad New_Line (File); Num := N * N; Put (File, "CELL_DATA "); Put (File, Num, Width => 0); New_Line (File); Put_Line (File, "SCALARS PE float 1"); Put_Line (File, "LOOKUP_TABLE default"); for I in 1 .. N loop X (1) := -1.0 + (Real (I) - 0.5) * Dx; for J in 1 .. N loop X (2) := -1.0 + (Real (J) - 0.5) * Dx; Y := R * Coordinate_Transform (X); -- Tmp := abs ((PE (Y) - PE2 (Y))); -- / PE2 (Y)); -- if 2.0 * abs (Cos (0.5 * (Y (1) + Y (2)))) < 1.0 then -- Put (File, -1.0e-6); New_Line (File); -- else -- Put (File, Tmp); New_Line (File); -- end if; Put (File, PE (Y)); New_Line (File); end loop; end loop; New_Line (File); -- Num := N * N; -- Put (File, "CELL_DATA "); Put (File, Num, Width => 0); New_Line (File); -- Put_Line (File, "SCALARS distance float 1"); -- Put_Line (File, "LOOKUP_TABLE default"); -- for I in 1 .. N loop -- X (1) := -1.0 + (Real (I) - 0.5) * Dx; -- for J in 1 .. N loop -- X (2) := -1.0 + (Real (J) - 0.5) * Dx; -- Y := R * Coordinate_Transform (X); -- Tmp := 2.0 * abs (Cos (0.5 * (Y (1) + Y (2)))); -- Put (File, Tmp); New_Line (File); -- end loop; -- end loop; Close (File); end Landscape;
oeis/203/A203148.asm
neoneye/loda-programs
11
98935
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A203148: (n-1)-st elementary symmetric function of {3,9,...,3^n}. ; Submitted by <NAME>(s2) ; 1,12,351,29160,7144929,5223002148,11433166050879,75035879252272080,1477081305957768349761,87223128348206814118735932,15451489966710801620870785316511,8211586182553137756809552940033725880,13091937140529934508508023103481190655434529,62618355676994024589361388429426765418215053860948,898505087338846836267213193824775253342753180462861630079,38677699608766272136958618215273852727954853262723082989467027360,4994844509296513627212038468923681274653619372503887018044092713181020801 mov $1,1 mov $2,1 lpb $0 sub $0,1 mov $3,$2 add $2,1 add $2,$3 mul $1,$2 add $2,$3 lpe mul $2,$1 mov $0,$2
oeis/128/A128715.asm
neoneye/loda-programs
11
6372
; A128715: A131830 + A103451 - A000012 as infinite lower triangular matrices. ; Submitted by <NAME> ; 1,2,2,3,1,3,4,2,2,4,5,3,5,3,5,6,4,9,9,4,6,7,5,14,19,14,5,7,8,6,20,34,34,20,6,8,9,7,27,55,69,55,27,7,9,10,8,35,83,125,125,83,35,8,10 mov $2,1 lpb $0 add $1,1 sub $0,$1 add $2,1 lpe bin $1,$0 div $2,$1 div $2,$1 add $2,$1 mov $0,$2 sub $0,1
programs/oeis/194/A194584.asm
karttu/loda
0
93524
; A194584: Differences of A035336. ; 5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3,5,3,5,5,3,5,5,3,5,3,5,5,3 mov $5,$0 mov $7,2 lpb $7,1 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $6,$0 mov $0,4 mov $2,32 mov $3,32 mov $4,1 mul $6,4 lpb $0,1 sub $0,1 mul $4,2 add $6,2 lpe sub $2,$3 add $3,8 mul $6,$3 add $2,$6 pow $4,2 add $4,3 div $2,$4 mov $6,$2 mov $8,$7 lpb $8,1 mov $1,$6 sub $8,1 lpe lpe lpb $5,1 sub $1,$6 mov $5,0 lpe mul $1,2 add $1,3
src/Web/Semantic/DL/Category/Properties/Composition/LeftUnit.agda
agda/agda-web-semantic
9
15264
<filename>src/Web/Semantic/DL/Category/Properties/Composition/LeftUnit.agda<gh_stars>1-10 open import Relation.Binary.PropositionalEquality using ( refl ) open import Web.Semantic.DL.ABox.Interp using ( _*_ ; ⌊_⌋ ; ind ) open import Web.Semantic.DL.ABox.Interp.Morphism using ( _,_ ) open import Web.Semantic.DL.ABox.Model using ( _⊨a_ ; on-bnode ; bnodes ; ⊨a-resp-≲ ; ⊨a-resp-≡³ ; _,_ ) open import Web.Semantic.DL.Category.Object using ( Object ; IN ; iface ) open import Web.Semantic.DL.Category.Morphism using ( _⇒_ ; BN ; impl ; _≣_ ; _⊑_ ; _,_ ) open import Web.Semantic.DL.Category.Composition using ( _∙_ ) open import Web.Semantic.DL.Category.Wiring using ( identity ) open import Web.Semantic.DL.Category.Properties.Composition.Lemmas using ( compose-left ; compose-right ; compose-resp-⊨a ; identity-intro ; identity-elim ) open import Web.Semantic.DL.Signature using ( Signature ) open import Web.Semantic.DL.TBox using ( TBox ) open import Web.Semantic.DL.TBox.Interp using ( Δ ; _⊨_≈_ ; ≈-refl ; ≈-sym ) open import Web.Semantic.DL.TBox.Interp.Morphism using ( ≲-refl ) open import Web.Semantic.Util using ( _∘_ ; _⊕_⊕_ ; False ; inode ; bnode ; enode ; left ; right ) module Web.Semantic.DL.Category.Properties.Composition.LeftUnit {Σ : Signature} {S T : TBox Σ} where compose-unit₁ : ∀ {A B : Object S T} (F : A ⇒ B) → (identity A ∙ F ≣ F) compose-unit₁ {A} {B} F = ( idF⊑F , F⊑idF ) where idF⊑F : identity A ∙ F ⊑ F idF⊑F I I⊨STA I⊨idF = (f , I⊨F) where Iˡ⊨id : left * I ⊨a impl (identity A) Iˡ⊨id = compose-left (identity A) F I I⊨idF Iʳ⊨F : right * I ⊨a impl F Iʳ⊨F = compose-right (identity A) F I I⊨idF f : BN F → Δ ⌊ I ⌋ f w = ind I (bnode (enode w)) f✓ : ∀ x → ⌊ I ⌋ ⊨ ind I (right x) ≈ on-bnode f (ind I) x f✓ (inode x) = ≈-sym ⌊ I ⌋ (identity-elim A (left * I) Iˡ⊨id x) f✓ (bnode v) = ≈-refl ⌊ I ⌋ f✓ (enode y) = ≈-refl ⌊ I ⌋ I⊨F : bnodes I f ⊨a impl F I⊨F = ⊨a-resp-≲ (≲-refl ⌊ I ⌋ , f✓) (impl F) Iʳ⊨F F⊑idF : F ⊑ identity A ∙ F F⊑idF I I⊨STA I⊨F = (f , I⊨idF) where f : (False ⊕ IN A ⊕ BN F) → Δ ⌊ I ⌋ f (inode ()) f (bnode x) = ind I (inode x) f (enode v) = ind I (bnode v) Iˡ⊨id : left * bnodes I f ⊨a impl (identity A) Iˡ⊨id = identity-intro A (left * bnodes I f) (λ x → ≈-refl ⌊ I ⌋) Iʳ⊨F : right * bnodes I f ⊨a impl F Iʳ⊨F = ⊨a-resp-≡³ I (on-bnode f (ind I) ∘ right) refl (impl F) I⊨F I⊨idF : bnodes I f ⊨a impl (identity A ∙ F) I⊨idF = compose-resp-⊨a (identity A) F (bnodes I f) Iˡ⊨id Iʳ⊨F
oeis/268/A268088.asm
neoneye/loda-programs
11
16713
<filename>oeis/268/A268088.asm ; A268088: Number of nX3 0..2 arrays with every repeated value in every row not one larger and in every column one larger mod 3 than the previous repeated value, and upper left element zero. ; Submitted by <NAME> ; 9,243,4608,83349,1339893,20699712,303284403,4320438183,59802048000,811951057125,10831783903677,142591596848064,1855468989421875,23920516469271231,305928653301448704,3886833181740400197,49103880497968317093,617397813039833352000,7731129167889151055859,96474481199867338572375,1200296024065951743527424,14895537250192664038389477,184446802450889854831549197,2279642151796093242558182592,28129112844645711127201992819,346606315602303261776203675503,4265708406771339689267575369728 seq $0,267946 ; Number of n X 1 0..2 arrays with every repeated value in every row and column one larger mod 3 than the previous repeated value, and upper left element zero. pow $0,3 mul $0,9
Univalence/TypeEquivCat.agda
JacquesCarette/pi-dual
14
10610
<reponame>JacquesCarette/pi-dual {-# OPTIONS --without-K #-} module TypeEquivCat where -- We will define a rig category whose objects are types and whose -- morphisms are type equivalences; and where the equivalence of -- morphisms ≋ is extensional open import Level renaming (zero to lzero; suc to lsuc) open import Data.Empty using (⊥) open import Data.Unit using (⊤) open import Data.Sum using (_⊎_) open import Data.Product using (_,_; _×_; uncurry) open import Data.Fin using (Fin; zero; suc) -- needed for distributivity import Relation.Binary.PropositionalEquality as P using (sym) open import Categories.Category using (Category) open import Categories.Groupoid using (Groupoid) open import Categories.Monoidal using (Monoidal) open import Categories.Monoidal.Helpers using (module MonoidalHelperFunctors) open import Categories.Bifunctor using (Bifunctor) open import Categories.NaturalIsomorphism using (NaturalIsomorphism) open import Categories.Monoidal.Braided using (Braided) open import Categories.Monoidal.Symmetric using (Symmetric) open import Categories.RigCategory using (RigCategory; module BimonoidalHelperFunctors) open import Equiv using (_≃_; id≃; sym≃; _●_; _⊎≃_; _×≃_) open import EquivEquiv using (_≋_; eq; id≋; sym≋; trans≋; ●-assoc; _◎_; linv≋; rinv≋; lid≋; rid≋; flip-sym≋) -- list all explicitly, but these are all equivalences open import TypeEquiv using (unite₊equiv; uniti₊equiv; unite₊′equiv; uniti₊′equiv; assocr₊equiv; assocl₊equiv; unite⋆equiv; uniti⋆equiv; unite⋆′equiv; uniti⋆′equiv; assocr⋆equiv; assocl⋆equiv; swap₊equiv; swap⋆equiv; distequiv; factorequiv; distlequiv; factorlequiv; distzequiv; factorzequiv; distzrequiv; factorzrequiv) open import TypeEquivEquiv -- need them all! -- convenience one two : Fin 3 one = suc zero two = suc (suc zero) ------------------------------------------------------------------------------ -- We show that types with type equivalences are a commutative rig -- groupoid -- First it is a category TypeEquivCat : Category (lsuc lzero) lzero lzero TypeEquivCat = record { Obj = Set ; _⇒_ = _≃_ ; _≡_ = _≋_ ; id = id≃ ; _∘_ = _●_ ; assoc = λ { {f = f} {g} {h} → ●-assoc {f = f} {g} {h} } ; identityˡ = lid≋ ; identityʳ = rid≋ ; equiv = record { refl = id≋ ; sym = sym≋ ; trans = trans≋ } ; ∘-resp-≡ = _◎_ } -- The category has inverses and hence a groupoid TypeEquivGroupoid : Groupoid TypeEquivCat TypeEquivGroupoid = record { _⁻¹ = sym≃ ; iso = λ { {f = A≃B} → record { isoˡ = linv≋ A≃B ; isoʳ = rinv≋ A≃B } } } -- The additive structure is monoidal ⊎-bifunctor : Bifunctor TypeEquivCat TypeEquivCat TypeEquivCat ⊎-bifunctor = record { F₀ = uncurry _⊎_ ; F₁ = uncurry _⊎≃_ ; identity = [id,id]≋id ; homomorphism = ⊎●≋●⊎ ; F-resp-≡ = uncurry _⊎≋_ } module ⊎h = MonoidalHelperFunctors TypeEquivCat ⊎-bifunctor ⊥ 0⊎x≡x : NaturalIsomorphism ⊎h.id⊗x ⊎h.x 0⊎x≡x = record { F⇒G = record { η = λ X → unite₊equiv {X zero} ; commute = λ f → unite₊-nat {f = f zero} } ; F⇐G = record { η = λ X → uniti₊equiv {X zero} ; commute = λ f → uniti₊-nat {f = f zero} } ; iso = λ _ → record { isoˡ = linv≋ unite₊equiv ; isoʳ = rinv≋ unite₊equiv } } x⊎0≡x : NaturalIsomorphism ⊎h.x⊗id ⊎h.x x⊎0≡x = record { F⇒G = record { η = λ X → unite₊′equiv {X zero} ; commute = λ f → unite₊′-nat {f = f zero} } ; F⇐G = record { η = λ X → uniti₊′equiv {X zero} ; commute = λ f → uniti₊′-nat {f = f zero} } ; iso = λ X → record { isoˡ = linv≋ unite₊′equiv ; isoʳ = rinv≋ unite₊′equiv } } [x⊎y]⊎z≡x⊎[y⊎z] : NaturalIsomorphism ⊎h.[x⊗y]⊗z ⊎h.x⊗[y⊗z] [x⊎y]⊎z≡x⊎[y⊎z] = record { F⇒G = record { η = λ X → assocr₊equiv {X zero} {X one} {X two} ; commute = λ f → assocr₊-nat {f₀ = f zero} {f one} {f two} } ; F⇐G = record { η = λ X → assocl₊equiv {X zero} {X one} {X two} ; commute = λ f → assocl₊-nat {f₀ = f zero} {f one} {f two} } ; iso = λ X → record { isoˡ = linv≋ assocr₊equiv ; isoʳ = rinv≋ assocr₊equiv } } CPM⊎ : Monoidal TypeEquivCat CPM⊎ = record { ⊗ = ⊎-bifunctor ; id = ⊥ ; identityˡ = 0⊎x≡x ; identityʳ = x⊎0≡x ; assoc = [x⊎y]⊎z≡x⊎[y⊎z] ; triangle = unite-assocr₊-coh ; pentagon = assocr₊-coh } -- The multiplicative structure is also monoidal ×-bifunctor : Bifunctor TypeEquivCat TypeEquivCat TypeEquivCat ×-bifunctor = record { F₀ = uncurry _×_ ; F₁ = uncurry _×≃_ ; identity = id×id≋id -- the following would have unresolved metas without the extra precision ; homomorphism = λ { {f = (f , g)} {h , i} → ×●≋●× {f = f} {g} {h} {i}} ; F-resp-≡ = uncurry _×≋_ } module ×h = MonoidalHelperFunctors TypeEquivCat ×-bifunctor ⊤ 1×y≡y : NaturalIsomorphism ×h.id⊗x ×h.x 1×y≡y = record { F⇒G = record { η = λ X → unite⋆equiv {X zero} ; commute = λ f → unite⋆-nat {f = f zero} } ; F⇐G = record { η = λ X → uniti⋆equiv {X zero} ; commute = λ f → uniti⋆-nat {f = f zero} } ; iso = λ X → record { isoˡ = linv≋ unite⋆equiv ; isoʳ = rinv≋ unite⋆equiv } } y×1≡y : NaturalIsomorphism ×h.x⊗id ×h.x y×1≡y = record { F⇒G = record { η = λ X → unite⋆′equiv {X zero} ; commute = λ f → unite⋆′-nat {f = f zero} } ; F⇐G = record { η = λ X → uniti⋆′equiv {X zero} ; commute = λ f → uniti⋆′-nat {f = f zero} } ; iso = λ X → record { isoˡ = linv≋ unite⋆′equiv ; isoʳ = rinv≋ unite⋆′equiv } } [x×y]×z≡x×[y×z] : NaturalIsomorphism ×h.[x⊗y]⊗z ×h.x⊗[y⊗z] [x×y]×z≡x×[y×z] = record { F⇒G = record { η = λ X → assocr⋆equiv {X zero} {X one} {X two} ; commute = λ f → assocr⋆-nat {f₀ = f zero} {f one} {f two}} ; F⇐G = record { η = λ X → assocl⋆equiv {X zero} {X one} {X two} ; commute = λ f → assocl⋆-nat {f₀ = f zero} {f one} {f two}} ; iso = λ X → record { isoˡ = linv≋ assocr⋆equiv ; isoʳ = rinv≋ assocr⋆equiv } } CPM× : Monoidal TypeEquivCat CPM× = record { ⊗ = ×-bifunctor ; id = ⊤ ; identityˡ = 1×y≡y ; identityʳ = y×1≡y ; assoc = [x×y]×z≡x×[y×z] ; triangle = unite-assocr⋆-coh ; pentagon = assocr⋆-coh } -- The monoidal structures are symmetric x⊎y≈y⊎x : NaturalIsomorphism ⊎h.x⊗y ⊎h.y⊗x x⊎y≈y⊎x = record { F⇒G = record { η = λ X → swap₊equiv {X zero} {X (suc zero)} ; commute = λ f → swap₊-nat {f = f zero} {f (suc zero)} } ; F⇐G = record { η = λ X → sym≃ (swap₊equiv {X zero} {X (suc zero)}) ; commute = λ f → swap₊-nat {f = f (suc zero)} {f zero} } ; iso = λ X → record { isoˡ = linv≋ swap₊equiv ; isoʳ = rinv≋ swap₊equiv } } BM⊎ : Braided CPM⊎ BM⊎ = record { braid = x⊎y≈y⊎x ; unit-coh = unite₊l-coh ; hexagon₁ = assocr₊-swap₊-coh ; hexagon₂ = assocl₊-swap₊-coh } x×y≈y×x : NaturalIsomorphism ×h.x⊗y ×h.y⊗x x×y≈y×x = record { F⇒G = record { η = λ X → swap⋆equiv ; commute = λ _ → swap⋆-nat } ; F⇐G = record { η = λ X → sym≃ swap⋆equiv ; commute = λ f → swap⋆-nat } ; iso = λ X → record { isoˡ = linv≋ swap⋆equiv ; isoʳ = rinv≋ swap⋆equiv } } BM× : Braided CPM× BM× = record { braid = x×y≈y×x ; unit-coh = unite⋆l-coh ; hexagon₁ = assocr⋆-swap⋆-coh ; hexagon₂ = assocl⋆-swap⋆-coh } SBM⊎ : Symmetric BM⊎ SBM⊎ = record { symmetry = linv≋ swap₊equiv } SBM× : Symmetric BM× SBM× = record { symmetry = linv≋ swap⋆equiv } -- And finally the multiplicative structure distributes over the -- additive one module r = BimonoidalHelperFunctors BM⊎ BM× x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] : NaturalIsomorphism r.x⊗[y⊕z] r.[x⊗y]⊕[x⊗z] x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] = record { F⇒G = record { η = λ X → distlequiv {X zero} {X one} {X two} ; commute = λ f → distl-nat {f = f zero} {f one} {f two} } ; F⇐G = record { η = λ X → factorlequiv {X zero} {X one} {X two} ; commute = λ f → factorl-nat {f = f zero} {f one} {f two} } ; iso = λ X → record { isoˡ = linv≋ distlequiv ; isoʳ = rinv≋ distlequiv } } [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] : NaturalIsomorphism r.[x⊕y]⊗z r.[x⊗z]⊕[y⊗z] [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] = record { F⇒G = record { η = λ X → distequiv ; commute = λ f → dist-nat } ; F⇐G = record { η = λ X → factorequiv ; commute = λ f → factor-nat } ; iso = λ X → record { isoˡ = linv≋ distequiv ; isoʳ = rinv≋ distequiv } } x⊗0≡0 : NaturalIsomorphism r.x⊗0 r.0↑ x⊗0≡0 = record { F⇒G = record { η = λ X → distzrequiv {X zero} ; commute = λ f → distzr-nat {f = f zero} } ; F⇐G = record { η = λ X → factorzrequiv {X zero} ; commute = λ f → factorzr-nat {f = f zero} } ; iso = λ X → record { isoˡ = linv≋ distzrequiv ; isoʳ = rinv≋ distzrequiv } } 0⊗x≡0 : NaturalIsomorphism r.0⊗x r.0↑ 0⊗x≡0 = record { F⇒G = record { η = λ X → distzequiv {X zero} ; commute = λ f → distz-nat {f = f zero} } ; F⇐G = record { η = λ X → factorzequiv {X zero} ; commute = λ f → factorz-nat {f = f zero} } ; iso = λ X → record { isoˡ = linv≋ (distzequiv {X zero}) ; isoʳ = rinv≋ distzequiv } } TERig : RigCategory SBM⊎ SBM× TERig = record -- new combinators { distribₗ = x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] ; distribᵣ = [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] ; annₗ = 0⊗x≡0 ; annᵣ = x⊗0≡0 -- derived identities which are ``coherent'' in that the -- two natural programs, using the new combinators and -- the underlying ones of the symmetric bimonoidal groupoid -- are in fact to be identified. ; laplazaI = λ {X} → A×[B⊎C]≃[A×C]⊎[A×B] {X zero} {X one} {X two} ; laplazaII = λ {X} → [A⊎B]×C≃[C×A]⊎[C×B] {X zero} {X one} {X two} ; laplazaIV = λ {X} → [A⊎B⊎C]×D≃[A×D⊎B×D]⊎C×D {X zero} {X (suc zero)} {X (suc (suc zero))} {X (suc (suc (suc zero)))} ; laplazaVI = λ {X} → A×B×[C⊎D]≃[A×B]×C⊎[A×B]×D {X zero} {X (suc zero)} {X (suc (suc zero))} {X (suc (suc (suc zero)))} ; laplazaIX = λ {X} → [A⊎B]×[C⊎D]≃[[A×C⊎B×C]⊎A×D]⊎B×D {X zero} {X (suc zero)} {X (suc (suc zero))} {X (suc (suc (suc zero)))} ; laplazaX = 0×0≃0 ; laplazaXI = λ {X} → 0×[A⊎B]≃0 {X zero} {X (suc zero)} ; laplazaXIII = 0×1≃0 ; laplazaXV = λ {X} → A×0≃0 {X zero} ; laplazaXVI = λ {X} → 0×A×B≃0 {X zero} {X (suc zero)} ; laplazaXVII = λ {X} → A×0×B≃0 {X zero} {X (suc zero)} ; laplazaXIX = λ {X} → A×[0+B]≃A×B {X zero} {X (suc zero)} ; laplazaXXIII = λ {X} → 1×[A⊎B]≃A⊎B {X zero} {X (suc zero)} } -- Notes from Laplaza, 72 -- All of 2, 9, 10, 15 -- one of each of {1,3}, {4,5}, {6,7}, {9, 12},{13,,14}, -- {19,20,21,22}, {23,24} -- two-of-three of {16,17,18} -- -- for natural isos -- α : A × (B × C) → (A × B) × C -- γ : A × B → B × A -- λ : U × A → A (so that U is 1) -- ρ : A × U → A -- λ* : N × A → N (so that N is 0) -- ρ* : A × n → N -- and ' versions for ⊕ -- as well as natural monomorphisms -- δ : A × (B ⊎ C) → (A × B) ⊎ (A × C) -- δ# : (A ⊎ B) × C → (A × C) ⊎ (B × C) ------------------------------------------------------------------------------
src/usb-device-hid-keyboard.adb
Fabien-Chouteau/usb_embedded
14
24358
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018-2021, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. 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. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body USB.Device.HID.Keyboard is ------------------ -- Set_Modifier -- ------------------ procedure Set_Modifier (This : in out Instance; M : Modifiers; Value : Boolean := True) is Mods : UInt8 renames This.Report (This.Report'First); begin if Value then Mods := Mods or M'Enum_Rep; else Mods := Mods and (not M'Enum_Rep); end if; end Set_Modifier; -------------------- -- Key_Codes_Full -- -------------------- function Key_Codes_Full (This : Instance) return Boolean is (This.Key_Code_Index = Max_Key_Codes); ------------------- -- Push_Key_Code -- ------------------- procedure Push_Key_Code (This : in out Instance; Code : UInt8) is begin if This.Key_Codes_Full then return; end if; This.Report (This.Report'First + 2 + This.Key_Code_Index) := Code; This.Key_Code_Index := This.Key_Code_Index + 1; end Push_Key_Code; ----------- -- Is_On -- ----------- function Is_On (This : Instance; L : LEDs) return Boolean is ((This.LEDs and L'Enum_Rep) /= 0); ----------------- -- Send_Report -- ----------------- overriding procedure Send_Report (This : in out Instance; UDC : in out USB_Device_Controller'Class) is begin Parent (This).Send_Report (UDC); This.Key_Code_Index := 0; end Send_Report; ---------------- -- Set_Report -- ---------------- overriding function Set_Report (This : in out Instance; Typ : UInt8; ID : UInt8; Data : UInt8_Array) return Setup_Request_Answer is begin if Data'Length /= 1 or else Typ /= 2 or else ID /= 0 then return Not_Supported; end if; This.LEDs := Data (Data'First); return Handled; end Set_Report; end USB.Device.HID.Keyboard;
src/bootloader/stage2.asm
FranchuFranchu/fran-os
1
5144
<reponame>FranchuFranchu/fran-os<filename>src/bootloader/stage2.asm BITS 16 [org 0x7e00] abs_start: jmp start db "Stage 2: Loaded", 0 %include "modules/a20.asm" %include "modules/unrealmode.asm" %include "modules/ext2.asm" %include "modules/misc.asm" %include "modules/protectedmode.asm" BITS 32 %include "stage3.asm" BITS 16 drive_number db 0 KERNEL_SIZE dd 0 ; In blocks start: mov [drive_number], dl mov si, bootloader_success call print_string call enable_a20 jmp unreal_start ; It will jump back to us in_unreal: mov si, unreal_success call print_string call kernel_ext2_setup mov eax, 0 push eax jmp .postadd .read_sectors: pop eax inc eax push eax .postadd: mov si, filename mov bx, disk_buffer call kernel_ext2_load_file_inode mov edi, 1 call kernel_ext2_load_inode_block jc .done ; Copy to kernel_buffer mov ecx, 0 mov cx, [BLOCK_SIZE] mov esi, disk_buffer mov edi, kernel_buffer pop eax push eax push eax mul ecx add edi, eax pop eax .copy: mov al, [esi] mov [edi], al dec ecx inc esi inc edi cmp ecx, 0 jne .copy .done_copy: jmp .read_sectors .done: pop eax mov [KERNEL_SIZE], eax mov si, kernel_success call print_string load_kernel: mov si, kernel_success call print_string jmp pm_start filename db "kernel.bin", 0 print_string: ; Routine: output string in SI to screen mov ah, 0Eh ; int 10h 'print char' function .repeat: lodsb ; Get character from string cmp al, 0 je .done ; If char is zero, end of string int 10h ; Otherwise, print it jmp .repeat .done: ret retry_count db 0 halt: cli .halt: hlt jmp .halt ;times (($-abs_start) % 512 - 4) db 21 where_to_load equ disk_buffer bootloader_success db "Bootloader: Loaded correctly", 0xa, 0xd, 0 unreal_success db "Unreal Mode: Switched correctly", 0xa, 0xd, 0 kernel_success db "Kernel: Loaded correctly", 0xa, 0xd, 0 superblock_buffer: times 1024 db 0 disk_buffer: times 512*8 db 0 kernel_size dd 0 ; in bytes kernel_buffer: ; Stores the kernel until stage3.asm copies it times 200*1024 db 0
hetro_stack_elems.ads
tyudosen/HeterogeneousStack
0
15511
<filename>hetro_stack_elems.ads with hetro_stack; with Ada.Text_IO; use Ada.Text_IO; package hetro_stack_elems is type CarString is new String(1..5); -- Holds Car Type. type PlaneString is new String(1..8); -- Holds Plane Type. type Vehicles is (Car, Plane); package VehiclesIO is new Ada.Text_IO.Enumeration_IO(Vehicles); -- Description: Parent Record. Cars and Plane records are derived from this, with relevant -- .. fields added on. type Vehicle is tagged record VehicleType: Vehicles; NumOfDoors: Integer; end record; ----- Procedure(s) For type Vehicle. procedure AssignVehicleType(aVehicle: in out Vehicle; CarOrPlane: in Vehicles); procedure AssignNumDoors(aVehicle: in out Vehicle; Num: in Integer); procedure PrintNumOfDoors(aVehicle: in out Vehicle); procedure Print(aVehicle: in Vehicle); function Compare(aVehicle: in Vehicle; Other: in Vehicle'Class) return Boolean; -- Child. Inherits componenents from Vehicle record. type CarRec is new Vehicle with record Manf : CarString; end record; type CarRecPtr is access CarRec; --- Procedure(s) for type CarRec. procedure AssignManf(aCar: in out CarRec; Manf: in CarString); procedure PrintCarString(PrtStr: CarString); procedure Print(aCar: in CarRec); function Compare(aCar: in CarRec; Other: in Vehicle'Class) return Boolean; -- Child. Inheriets from Vehicle record. type PlaneRec is new Vehicle with record Manf : PlaneString; NumOfEngines: Integer; end record; type PlaneRecPtr is access PlaneRec; -- Procedure(s) for PlaneRec. procedure AssignNumEngines(aPlane: in out PlaneRec; Num: in Integer); procedure AssignManf(aPlane: in out PlaneRec; Manf: in PlaneString); procedure PrintPlaneString(PrtStr: PlaneString); procedure Print(aPlane: in PlaneRec); function Compare(aPlane: in PlaneRec; Other: in Vehicle'Class) return Boolean; end hetro_stack_elems;
bdshemu_test/basic/test_64_basic05.asm
andreaswimmer/bddisasm
1
10884
bits 64 _xxx: lea rbp, [rel _xxx] sub rbp, 1 jmp rbp
exit.asm
qbbd/Algorithm_List
0
100583
section .text ; 섹션 시작 global _start ; _start:; ; 링커로 하여금 오류나 추측 방지 xor eax, eax ; eax 레지스터 0으로 채우기(safe) xor ebx, ebx ; ebx 레지스터 0으로 채우기(노트 참고) mov al, 0x01 ; 한 바이트에만 영향을 줌. 다른 24비트의 패딩은 중지 int 0x80 ; syscall을 실행하고자 커널호출
test/Compiler/simple/Issue728.agda
cruhland/agda
1,989
7884
<reponame>cruhland/agda<gh_stars>1000+ {-# OPTIONS --guardedness #-} module Issue728 where open import Common.MAlonzo using () renaming (main to mainDefault) main = mainDefault
alloy4fun_models/trainstlt/models/4/CCtwQfbBSvDHgtTtM.als
Kaixi26/org.alloytools.alloy
0
4436
open main pred idCCtwQfbBSvDHgtTtM_prop5 { all t:Train { t.pos in Exit => no t.pos' t.pos in (Track - Exit) => { one tk:((t.pos).prox) | t.pos' = tk } } } pred __repair { idCCtwQfbBSvDHgtTtM_prop5 } check __repair { idCCtwQfbBSvDHgtTtM_prop5 <=> prop5o }
oeis/195/A195622.asm
neoneye/loda-programs
11
90417
<filename>oeis/195/A195622.asm ; A195622: Denominators a(n) of Pythagorean approximations b(n)/a(n) to 5. ; Submitted by <NAME>(s4) ; 20,2020,206040,21014040,2143226060,218588044060,22293837268080,2273752813300080,231900493119340100,23651576545359390100,2412228907133538450120,246023696951075562522120,25092004860102573838806140,2559138472033511455995704140,261007032142558065937723016160,26620158140068889214191751944160,2714995123254884141781620975288180,276902882413858113572511147727450180,28241379011090272700254355447224630200,2880343756248793957312371744469184830200,293766821758365893373161663580409628050220 add $0,1 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $3,10 add $3,$1 mov $1,$2 lpe mul $1,$3 mul $1,2 mov $0,$1
Program.asm
winggar/BrainFudge
0
21260
<reponame>winggar/BrainFudge segment .data enter_code_str db "Enter BrainFudge code: (press enter twice to run)",10,0 nl db 10,0 d_fmt db "%d ",0 c_fmt db "%c",0 start_curly db "{ ",0 end_curly db "}",10,0 segment .bss buffer resb 1024 current resq 1 ; the stack wasn't working ok left_anchor resq 1 ; ^ segment .text global main extern fgets extern scanf extern printf extern stdin extern malloc main: push rbp mov rbp, rsp ; print_start prompt mov rdi, enter_code_str call printf ; fgets(buffer, 1024, stdin) mov rdx, QWORD stdin[0] lea rax, buffer mov esi, 1024 mov rdi, rax call fgets ; current = malloc(24); all values init to 0 mov edi, 24 call malloc mov QWORD [current], rax ; current mov QWORD [left_anchor], rax ; left_anchor mov DWORD [rax], 0 ; val mov DWORD [rax + 8], 0 ; left mov DWORD [rax + 16], 0 ; right ; execute BF code in buffer mov r15, 0 ; i = 0 code_start: mov cl, BYTE [buffer + r15] ; cl = buffer[i] cmp cl, 0 mov r10, QWORD [current] ; r10 = current je code_end cmp cl, '+' ; switch (cl) je plus cmp cl, '-' je minus cmp cl, '<' je left cmp cl, '>' je right cmp cl, '[' je l_brace cmp cl, ']' je r_brace cmp cl, ',' je input cmp cl, '.' je output jmp code_inc ; default: continue plus: add QWORD [r10], 1 ; current++ jmp code_inc minus: sub QWORD [r10], 1 ; current-- jmp code_inc left: cmp QWORD [r10 + 8], 0 je make_left mov r10, QWORD [r10 + 8] ; current = current->left mov QWORD [current], r10 jmp code_inc make_left: mov edi, 24 call malloc mov r10, QWORD [current] ; restore r10 mov QWORD [r10 + 8], rax ; left = new mov QWORD [current], rax ; current mov QWORD [left_anchor], rax ; left_anchor = current mov QWORD [rax], 0 ; val mov QWORD [rax + 8], 0 ; left mov QWORD [rax + 16], r10 ; right jmp code_inc right: cmp QWORD [r10 + 16], 0 je make_right mov r10, QWORD [r10 + 16] ; current = current->right mov QWORD [current], r10 jmp code_inc make_right: mov edi, 24 call malloc mov r10, QWORD [current] ; restore r10 mov QWORD [r10 + 16], rax ; right = new mov QWORD [current], rax ; current mov QWORD [rax], 0 ; val mov QWORD [rax + 8], r10 ; left mov QWORD [rax + 16], 0 ; right jmp code_inc l_brace: cmp QWORD [r10], 0 ; if current == 0 jne code_inc mov r14, 1 ; open = 1 l_brace_start: cmp r14, 0 ; if open == 0 jle code_inc inc r15 ; i++ mov cl, BYTE [buffer + r15] ; cl = buffer[i] cmp cl, '[' ; switch cl je l_brace_l cmp cl, ']' je l_brace_r jmp l_brace_start l_brace_l: ; [ -> open++ inc r14 jmp l_brace_start l_brace_r: ; ] -> open-- dec r14 jmp l_brace_start r_brace: cmp QWORD [r10], 0 ; if current != 0 je code_inc mov r14, 1 ; open = 1 r_brace_start: cmp r14, 0 ; if open == 0 jle code_inc dec r15 ; i-- mov cl, BYTE [buffer + r15] ; cl = buffer[i] cmp cl, '[' ; switch cl je r_brace_l cmp cl, ']' je r_brace_r jmp r_brace_start r_brace_l: ; [ -> open-- dec r14 jmp r_brace_start r_brace_r: ; ] -> open++ inc r14 jmp r_brace_start input: mov rdi, c_fmt ; scanf("%c", current) mov rsi, QWORD [current] call scanf jmp code_inc output: mov rdi, c_fmt ; printf("%c", current) mov rsi, QWORD [current] mov rsi, QWORD [rsi] call printf jmp code_inc code_inc: inc r15 ; i++ jmp code_start code_end: mov rax, QWORD [left_anchor] ; current = left_anchor mov QWORD [current], rax mov rdi, start_curly ; printf("{ ") call printf print_start: mov rdi, d_fmt ; printf("%d", current->val) mov rsi, QWORD [current] mov rsi, QWORD [rsi] call printf mov r10, QWORD [current] ; fix r10 cmp QWORD [r10 + 16], 0 ; stop if current->right == NULL je print_end mov r10, QWORD [r10 + 16] ; current = current->right mov QWORD [current], r10 jmp print_start print_end: mov rdi, end_curly ; printf("}\n") call printf mov rax, 0 mov rsp, rbp pop rbp ret
aunit/aunit-reporter-text.adb
btmalone/alog
0
1657
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . T E X T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with GNAT.IO; use GNAT.IO; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Very simple reporter to console package body AUnit.Reporter.Text is procedure Indent (N : Natural); -- Print N indentations to output procedure Dump_Result_List (L : Result_Lists.List; Prefix : String); -- Dump a result list procedure Put_Measure is new Gen_Put_Measure; -- Output elapsed time procedure Report_Test (Test : Test_Result; Prefix : String); -- Report a single assertion failure or unexpected exception generic with procedure Get (R : in out Result; L : in out Result_Lists.List); Label : String; Color : String; procedure Report_Tests (Engine : Text_Reporter; R : in out Result'Class); -- Report a series of tests ANSI_Def : constant String := ASCII.ESC & "[0m"; ANSI_Green : constant String := ASCII.ESC & "[32m"; ANSI_Purple : constant String := ASCII.ESC & "[35m"; ANSI_Red : constant String := ASCII.ESC & "[31m"; ------------------------- -- Set_Use_ANSI_Colors -- ------------------------- procedure Set_Use_ANSI_Colors (Engine : in out Text_Reporter; Value : Boolean) is begin Engine.Use_ANSI := Value; end Set_Use_ANSI_Colors; ------------ -- Indent -- ------------ procedure Indent (N : Natural) is begin for J in 1 .. N loop Put (" "); end loop; end Indent; ---------------------- -- Dump_Result_List -- ---------------------- procedure Dump_Result_List (L : Result_Lists.List; Prefix : String) is use Result_Lists; C : Cursor := First (L); begin if Has_Element (C) then New_Line; end if; -- Note: can't use Iterate because it violates restriction -- No_Implicit_Dynamic_Code while Has_Element (C) loop Report_Test (Element (C), Prefix); Next (C); end loop; end Dump_Result_List; --------- -- Get -- --------- procedure Report_Tests (Engine : Text_Reporter; R : in out Result'Class) is S : Result_Lists.List; begin Get (Result (R), S); if Engine.Use_ANSI then Put (Color); end if; Dump_Result_List (S, Label); if Engine.Use_ANSI then Put (ANSI_Def); end if; end Report_Tests; --------------------- -- Report_OK_Tests -- --------------------- procedure Report_OK_Tests (Engine : Text_Reporter; R : in out Result'Class) is procedure Internal is new Report_Tests (Successes, "OK", ANSI_Green); begin Internal (Engine, R); end Report_OK_Tests; procedure Report_Fail_Tests (Engine : Text_Reporter; R : in out Result'Class) is procedure Internal is new Report_Tests (Failures, "FAIL", ANSI_Purple); begin Internal (Engine, R); end Report_Fail_Tests; procedure Report_Error_Tests (Engine : Text_Reporter; R : in out Result'Class) is procedure Internal is new Report_Tests (Errors, "ERROR", ANSI_Red); begin Internal (Engine, R); end Report_Error_Tests; ------------ -- Report -- ------------ procedure Report (Engine : Text_Reporter; R : in out Result'Class; Options : AUnit_Options := Default_Options) is S_Count : constant Integer := Integer (Success_Count (R)); F_Count : constant Integer := Integer (Failure_Count (R)); E_Count : constant Integer := Integer (Error_Count (R)); T : AUnit_Duration; begin if Options.Report_Successes then Report_OK_Tests (Text_Reporter'Class (Engine), R); end if; Report_Fail_Tests (Text_Reporter'Class (Engine), R); Report_Error_Tests (Text_Reporter'Class (Engine), R); New_Line; Put ("Total Tests Run: "); Put (Integer (Test_Count (R))); New_Line; Put ("Successful Tests: "); Put (S_Count); New_Line; Put ("Failed Assertions: "); Put (F_Count); New_Line; Put ("Unexpected Errors: "); Put (E_Count); New_Line; if Elapsed (R) /= Time_Measure.Null_Time then T := Get_Measure (Elapsed (R)); Put ("Cumulative Time: "); Put_Measure (T); Put_Line (" seconds"); end if; end Report; ----------------- -- Report_Test -- ----------------- procedure Report_Test (Test : Test_Result; Prefix : String) is T : AUnit_Duration; begin Put (Prefix); Put (" "); Put (Test.Test_Name.all); if Test.Routine_Name /= null then Put (" : "); Put (Test.Routine_Name.all); end if; if Test.Elapsed /= Time_Measure.Null_Time then Put (" (in "); T := Get_Measure (Test.Elapsed); Put_Measure (T); Put (")"); end if; New_Line; if Test.Failure /= null then Indent (1); Put_Line (Test.Failure.Message.all); Indent (1); Put ("at "); Put (Test.Failure.Source_Name.all); Put (":"); Put (Test.Failure.Line); New_Line; elsif Test.Error /= null then Indent (1); Put_Line (Test.Error.Exception_Name.all); if Test.Error.Exception_Message /= null then Indent (1); Put ("Exception Message: "); Put_Line (Test.Error.Exception_Message.all); end if; if Test.Error.Traceback /= null then Indent (1); Put_Line ("Traceback:"); declare From, To : Natural := Test.Error.Traceback'First; begin while From <= Test.Error.Traceback'Last loop To := From; while To <= Test.Error.Traceback'Last and then Test.Error.Traceback (To) /= ASCII.LF loop To := To + 1; end loop; Indent (2); Put_Line (Test.Error.Traceback (From .. To - 1)); From := To + 1; end loop; end; end if; New_Line; end if; end Report_Test; end AUnit.Reporter.Text;
core/kernel_linux/simple_tests/eflags_asm.asm
DynamoRIO/drk
40
21616
<reponame>DynamoRIO/drk #include "asm_defines.asm" START_FILE DECL_EXTERN(test_flag) #define FUNCNAME test_eflags_pos DECLARE_FUNC(FUNCNAME) GLOBAL_LABEL(FUNCNAME:) /* We don't bother w/ SEH64 directives, though we're an illegal leaf routine! */ mov REG_XCX, ARG1 push REG_XCX /* save */ CALLC1(set_flag, REG_XCX) mov REG_XCX, PTRSZ [REG_XSP] PUSHF pop REG_XAX /* having DF set messes up printing for x64 */ push 0 POPF CALLC3(test_flag, REG_XAX, REG_XCX, 1) mov REG_XCX, PTRSZ [REG_XSP] CALLC1(clear_flag, REG_XCX) mov REG_XCX, PTRSZ [REG_XSP] PUSHF pop REG_XAX /* having DF set messes up printing for x64 */ push 0 POPF CALLC3(test_flag, REG_XAX, REG_XCX, 0) pop REG_XCX /* clean up */ ret END_FUNC(FUNCNAME) /* void set_flag(uint pos) */ #undef FUNCNAME #define FUNCNAME set_flag DECLARE_FUNC(FUNCNAME) GLOBAL_LABEL(FUNCNAME:) /* We don't bother w/ SEH64 directives, though we're an illegal leaf routine! */ PUSHF pop REG_XAX mov REG_XCX, ARG1 mov REG_XDX, 1 shl REG_XDX, cl or REG_XAX, REG_XDX push REG_XAX POPF ret END_FUNC(FUNCNAME) /* void clear_flag(uint pos) */ #undef FUNCNAME #define FUNCNAME clear_flag DECLARE_FUNC(FUNCNAME) GLOBAL_LABEL(FUNCNAME:) /* We don't bother w/ SEH64 directives, though we're an illegal leaf routine! */ PUSHF pop REG_XAX mov REG_XCX, ARG1 mov REG_XDX, 1 shl REG_XDX, cl not REG_XDX and REG_XAX, REG_XDX push REG_XAX POPF ret END_FUNC(FUNCNAME) END_FILE
src/util-concurrent-fifos.ads
Letractively/ada-util
0
12639
<reponame>Letractively/ada-util<gh_stars>0 ----------------------------------------------------------------------- -- Util.Concurrent.Fifos -- Concurrent Fifo Queues -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; -- The <b>Util.Concurrent.Fifos</b> generic defines a queue of objects which -- can be shared by multiple threads. First, the queue size is configured -- by using the <b>Set_Size</b> procedure. Then, a thread can insert elements -- in the queue by using the <b>Enqueue</b> procedure. The thread will block -- if the queue is full. Another thread can use the <b>Dequeue</b> procedure -- to fetch the oldest element from the queue. The thread will block -- until an element is inserted if the queue is empty. generic type Element_Type is private; -- The default queue size. Default_Size : in Positive; -- After a dequeue, clear the element stored in the queue. Clear_On_Dequeue : in Boolean := False; package Util.Concurrent.Fifos is FOREVER : constant Duration := -1.0; -- Exception raised if the enqueue or dequeue timeout exceeded. Timeout : exception; -- Fifo of objects type Fifo is new Ada.Finalization.Limited_Controlled with private; -- Put the element in the queue. procedure Enqueue (Into : in out Fifo; Item : in Element_Type; Wait : in Duration := FOREVER); -- Get an element from the queue. -- Wait until one element gets available. procedure Dequeue (From : in out Fifo; Item : out Element_Type; Wait : in Duration := FOREVER); -- Get the number of elements in the queue. function Get_Count (From : in Fifo) return Natural; -- Set the queue size. procedure Set_Size (Into : in out Fifo; Capacity : in Positive); -- Initializes the queue. overriding procedure Initialize (Object : in out Fifo); -- Release the queue elements. overriding procedure Finalize (Object : in out Fifo); private -- To store the queue elements, we use an array which is allocated dynamically -- by the <b>Set_Size</b> protected operation. The generated code is smaller -- compared to the use of Ada vectors container. type Element_Array is array (Natural range <>) of Element_Type; type Element_Array_Access is access all Element_Array; Null_Element_Array : constant Element_Array_Access := null; -- Queue of objects. protected type Protected_Fifo is -- Put the element in the queue. -- If the queue is full, wait until some room is available. entry Enqueue (Item : in Element_Type); -- Get an element from the queue. -- Wait until one element gets available. entry Dequeue (Item : out Element_Type); -- Get the number of elements in the queue. function Get_Count return Natural; -- Set the queue size. procedure Set_Size (Capacity : in Natural); private First : Positive := 1; Last : Positive := 1; Count : Natural := 0; Elements : Element_Array_Access := Null_Element_Array; end Protected_Fifo; type Fifo is new Ada.Finalization.Limited_Controlled with record Buffer : Protected_Fifo; end record; end Util.Concurrent.Fifos;
Lib/Platform/Windows/Win64.asm
PiotrSikora/WAVM
22
89774
.code EXECUTION_CONTEXT_RIP EQU 0 EXECUTION_CONTEXT_CS EQU 8 EXECUTION_CONTEXT_RFLAGS EQU 16 EXECUTION_CONTEXT_RSP EQU 24 EXECUTION_CONTEXT_SS EQU 32 EXECUTION_CONTEXT_R12 EQU 40 EXECUTION_CONTEXT_R13 EQU 48 EXECUTION_CONTEXT_R14 EQU 56 EXECUTION_CONTEXT_R15 EQU 64 EXECUTION_CONTEXT_RDI EQU 72 EXECUTION_CONTEXT_RSI EQU 80 EXECUTION_CONTEXT_RBX EQU 88 EXECUTION_CONTEXT_RBP EQU 96 EXECUTION_CONTEXT_XMM6 EQU 112 EXECUTION_CONTEXT_XMM7 EQU 128 EXECUTION_CONTEXT_XMM8 EQU 144 EXECUTION_CONTEXT_XMM9 EQU 160 EXECUTION_CONTEXT_XMM10 EQU 176 EXECUTION_CONTEXT_XMM11 EQU 192 EXECUTION_CONTEXT_XMM12 EQU 208 EXECUTION_CONTEXT_XMM13 EQU 224 EXECUTION_CONTEXT_XMM14 EQU 240 EXECUTION_CONTEXT_XMM15 EQU 256 saveExecutionStateImpl PROC pushfq pop r10 mov QWORD PTR [rcx + EXECUTION_CONTEXT_RIP], r8 mov WORD PTR [rcx + EXECUTION_CONTEXT_CS], cs mov QWORD PTR [rcx + EXECUTION_CONTEXT_RFLAGS],r10 mov QWORD PTR [rcx + EXECUTION_CONTEXT_RSP], r9 mov WORD PTR [rcx + EXECUTION_CONTEXT_SS], ss mov QWORD PTR [rcx + EXECUTION_CONTEXT_R12], r12 mov QWORD PTR [rcx + EXECUTION_CONTEXT_R13], r13 mov QWORD PTR [rcx + EXECUTION_CONTEXT_R14], r14 mov QWORD PTR [rcx + EXECUTION_CONTEXT_R15], r15 mov QWORD PTR [rcx + EXECUTION_CONTEXT_RDI], rdi mov QWORD PTR [rcx + EXECUTION_CONTEXT_RSI], rsi mov QWORD PTR [rcx + EXECUTION_CONTEXT_RBX], rbx mov QWORD PTR [rcx + EXECUTION_CONTEXT_RBP], rbp movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM6], xmm6 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM7], xmm7 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM8], xmm8 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM9], xmm9 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM10], xmm10 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM11], xmm11 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM12], xmm12 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM13], xmm13 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM14], xmm14 movdqa XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM15], xmm15 mov rax, rdx ret saveExecutionStateImpl ENDP ; extern "C" I64 saveExecutionState(ExecutionContext* outContext,I64 returnCode); saveExecutionState PROC mov r8, QWORD PTR [rsp] lea r9, [rsp+8] jmp saveExecutionStateImpl saveExecutionState ENDP ; extern "C" [[noreturn]] void loadExecutionState(ExecutionContext* context,I64 returnCode); loadExecutionState PROC ; We save the registers for the benefits of the .PUSHFRAME in forkedStackTrampoline, but can't load them. ;mov cs, WORD PTR [rcx + EXECUTION_CONTEXT_CS] ;mov ss, WORD PTR [rcx + EXECUTION_CONTEXT_SS] mov r10, QWORD PTR [rcx + EXECUTION_CONTEXT_RIP] mov r11, QWORD PTR [rcx + EXECUTION_CONTEXT_RFLAGS] mov rsp, QWORD PTR [rcx + EXECUTION_CONTEXT_RSP] mov r12, QWORD PTR [rcx + EXECUTION_CONTEXT_R12] mov r13, QWORD PTR [rcx + EXECUTION_CONTEXT_R13] mov r14, QWORD PTR [rcx + EXECUTION_CONTEXT_R14] mov r15, QWORD PTR [rcx + EXECUTION_CONTEXT_R15] mov rdi, QWORD PTR [rcx + EXECUTION_CONTEXT_RDI] mov rsi, QWORD PTR [rcx + EXECUTION_CONTEXT_RSI] mov rbx, QWORD PTR [rcx + EXECUTION_CONTEXT_RBX] mov rbp, QWORD PTR [rcx + EXECUTION_CONTEXT_RBP] movdqa xmm6, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM6] movdqa xmm7, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM7] movdqa xmm8, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM8] movdqa xmm9, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM9] movdqa xmm10, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM10] movdqa xmm11, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM11] movdqa xmm12, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM12] movdqa xmm13, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM13] movdqa xmm14, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM14] movdqa xmm15, XMMWORD PTR [rcx + EXECUTION_CONTEXT_XMM15] push r11 popfq mov rax, rdx jmp r10 loadExecutionState ENDP forkedStackTrampoline PROC FRAME .PUSHFRAME .SAVEREG r12, EXECUTION_CONTEXT_R12 .SAVEREG r13, EXECUTION_CONTEXT_R13 .SAVEREG r14, EXECUTION_CONTEXT_R14 .SAVEREG r15, EXECUTION_CONTEXT_R15 .SAVEREG rdi, EXECUTION_CONTEXT_RDI .SAVEREG rsi, EXECUTION_CONTEXT_RSI .SAVEREG rbx, EXECUTION_CONTEXT_RBX .SAVEREG rbp, EXECUTION_CONTEXT_RBP .SAVEXMM128 xmm6, EXECUTION_CONTEXT_XMM6 .SAVEXMM128 xmm7, EXECUTION_CONTEXT_XMM7 .SAVEXMM128 xmm8, EXECUTION_CONTEXT_XMM8 .SAVEXMM128 xmm9, EXECUTION_CONTEXT_XMM9 .SAVEXMM128 xmm10, EXECUTION_CONTEXT_XMM10 .SAVEXMM128 xmm11, EXECUTION_CONTEXT_XMM11 .SAVEXMM128 xmm12, EXECUTION_CONTEXT_XMM12 .SAVEXMM128 xmm13, EXECUTION_CONTEXT_XMM13 .SAVEXMM128 xmm14, EXECUTION_CONTEXT_XMM14 .SAVEXMM128 xmm15, EXECUTION_CONTEXT_XMM15 .ENDPROLOG forkedStackTrampolineEntry:: mov rcx, rsp mov rdx, rax jmp loadExecutionState forkedStackTrampoline ENDP ; extern "C" I64 switchToForkedStackContext(ExecutionContext* forkedContext,U8* trampolineFramePointer) noexcept(false); switchToForkedStackContext PROC FRAME sub rsp, 8 .ALLOCSTACK 8 .ENDPROLOG mov r10, forkedStackTrampolineEntry mov QWORD PTR [rdx-8], r10 mov [rsp+16], rcx mov rcx, rdx mov r8, return mov r9, rsp call saveExecutionStateImpl mov rcx, [rsp+16] mov rdx, 1 jmp loadExecutionState return: add rsp, 8 ret switchToForkedStackContext ENDP getStackPointer PROC lea rax, [rsp+8] ret getStackPointer ENDP End
lab_7/asm/sad.asm
MarkoN95/DDC-Labs
0
94758
# # Sum of Absolute Differences Algorithm # # Authors: # <NAME> # <NAME> # .text main: lui $s0, 0x0000 # base address located in $s0 ori $s0, 0x0000 addi $t0, $0, 5 # left_image[0] sw $t0, 0($s0) addi $t0, $0, 16 # left_image[1] sw $t0, 4($s0) addi $t0, $0, 7 # left_image[2] sw $t0, 8($s0) addi $t0, $0, 1 # left_image[3] sw $t0, 12($s0) addi $t0, $0, 1 # left_image[4] sw $t0, 16($s0) addi $t0, $0, 13 # left_image[5] sw $t0, 20($s0) addi $t0, $0, 2 # left_image[6] sw $t0, 24($s0) addi $t0, $0, 8 # left_image[7] sw $t0, 28($s0) addi $t0, $0, 10 # left_image[8] sw $t0, 32($s0) addi $t0, $0, 4 # right_image[0] sw $t0, 36($s0) addi $t0, $0, 15 # right_image[1] sw $t0, 40($s0) addi $t0, $0, 8 # right_image[2] sw $t0, 44($s0) addi $t0, $0, 0 # right_image[3] sw $t0, 48($s0) addi $t0, $0, 2 # right_image[4] sw $t0, 52($s0) addi $t0, $0, 12 # right_image[5] sw $t0, 56($s0) addi $t0, $0, 3 # right_image[6] sw $t0, 60($s0) addi $t0, $0, 7 # right_image[7] sw $t0, 64($s0) addi $t0, $0, 11 # right_image[8] sw $t0, 68($s0) addi $s1, $0, 0 # $s1 = i = 0 addi $s2, $0, 9 # $s2 = image_size = 9 addi $s3, $s0, 72 # $s3 = int sad_array[9] (addresses [72, 104]) loop: beq $s1, $s2, end_loop # exit if i == image_size sll $t0, $s1, 2 # make i word aligned add $t0, $s0, $t0 # add the base address of $s0 lw $a0, 0($t0) # load left_image[i] addi $t0, $t0, 36 # right_image base address has offset 4 * image_size = 36 lw $a1, 0($t0) # load right_image[i] jal abs_diff sll $t0, $s1, 2 # make i word aligned add $t0, $s3, $t0 # add the base address of sad_array sw $v0, 0($t0) # store sad_array[i] addi $s1, $s1, 1 # i++ j loop end_loop: add $a0, $0, $s3 # load sad_array add $a1, $0, $s2 # load image_size jal recursive_sum add $t2, $0, $v0 # store result in $t2 end: j end abs_diff: sub $t1, $a0, $a1 sra $t2, $t1, 31 xor $t1, $t1, $t2 sub $v0, $t1, $t2 jr $ra recursive_sum: addi $sp, $sp, -8 # Adjust sp addi $t0, $a1, -1 # Compute size - 1 sw $t0, 0($sp) # Save size - 1 to stack sw $ra, 4($sp) # Save return address bne $a1, $zero, else # size == 0 ? addi $v0, $0, 0 # If size == 0, set return value to 0 addi $sp, $sp, 8 # Adjust sp jr $ra # Return else: add $a1, $t0, $0 # update the second argument jal recursive_sum lw $t0, 0($sp) # Restore size - 1 from stack sll $t1, $t0, 2 # Multiply size by 4 add $t1, $t1, $a0 # Compute & arr[ size - 1 ] lw $t2, 0($t1) # $t2 = arr[ size - 1 ] add $v0, $v0, $t2 # retval = $v0 + arr[size - 1] lw $ra, 4($sp) # restore return address from stack addi $sp, $sp, 8 # Adjust sp jr $ra # Return