~manxi-david/pyeffect/pyeffect

« back to all changes in this revision

Viewing changes to src/Examples/if3.s

  • Committer: dvspeed
  • Date: 2011-12-26 13:18:36 UTC
  • Revision ID: manxi.david@gmail.com-20111226131836-mvoy9y32z0ujxvm1
-Change of folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.section .data
 
2
Byte0:
 
3
        .byte   0
 
4
Byte1:
 
5
        .byte   0
 
6
Byte2:
 
7
        .byte   0
 
8
Byte3:
 
9
        .byte   0
 
10
Byte4:
 
11
        .byte   0
 
12
Byte5:
 
13
        .byte   0
 
14
Byte6:
 
15
        .byte   0
 
16
Byte7:
 
17
        .byte   0
 
18
Byte8:
 
19
        .byte   4
 
20
Byte9:
 
21
        .byte   0
 
22
Byte10:
 
23
        .byte   0
 
24
Byte11:
 
25
        .byte   0
 
26
Byte12:
 
27
        .byte   0
 
28
Byte13:
 
29
        .byte   0
 
30
Byte14:
 
31
        .byte   0
 
32
Byte15:
 
33
        .byte   0
 
34
.section .text
 
35
.globl _start
 
36
_start:
 
37
#Begin of program:
 
38
        #       x=0
 
39
        #       y=4
 
40
        #       if x==5:
 
41
        cmpq    $5,     Byte0
 
42
        jne if1_0
 
43
        #               y=45
 
44
        movq    $45,    Byte8
 
45
        #               y=0
 
46
        movq    $0,     Byte8
 
47
        jmp return0
 
48
        if1_0:
 
49
        return0:
 
50
        #       if x==0:
 
51
        cmpq    $0,     Byte0
 
52
        jne if1_1
 
53
        #               if y==4:
 
54
        cmpq    $4,     Byte8
 
55
        jne if1_2
 
56
        #                       y=1
 
57
        movq    $1,     Byte8
 
58
        #                       y=100
 
59
        movq    $100,   Byte8
 
60
        #                       x=123
 
61
        movq    $123,   Byte0
 
62
        jmp return2
 
63
        if1_2:
 
64
        return2:
 
65
        jmp return1
 
66
        if1_1:
 
67
        return1:
 
68
        #       exit(y)
 
69
        movq    $60,    %rax
 
70
        movq    Byte8,  %rdi
 
71
        syscall
 
72
#End of program