nihonium
/
mipt_clang
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

154 lines
1.2 KiB
Markdown

3 years ago
# zero
```
3 years ago
xor %eax, %eax
3 years ago
```
# one
```
3 years ago
xor %eax, %eax
inc %eax
3 years ago
```
# next
```
3 years ago
inc %ax
3 years ago
```
# prev
```
3 years ago
dec %ax
3 years ago
```
# sum
```
3 years ago
mov %ax, %dx
add %bx, %dx
3 years ago
```
# sub
```
3 years ago
mov %rax, %rdx
sub %rbx, %rdx
3 years ago
```
# imul
```
3 years ago
imul %bl
mov %ax, %dx
3 years ago
```
# idiv
```
cwd
3 years ago
idiv %bx
mov %ax, %dx
```
# lea
```
lea (%rax, %rbx, 8), %rdx
```
# lea1
```
lea (%rax, %rax, 4), %rdx
```
# lea32
```
lea (%eax, %ebx, 8), %edx
```
# egalite
```
cmp %ax, %bx
jne nya
mov $1, %dx
jmp nya_
nya:
mov $0, %dx
nya_:
```
# factorial
```
xor %edx, %edx
inc %edx
cmp $0, %al
je end
mov %al, %cl
mov %ecx, %eax
loop:
mov %eax, %edx
3 years ago
cmp $1, %ecx
3 years ago
jle end
dec %ecx
mul %ecx
jmp loop
end:
```
# factorial64
```
xor %rdx, %rdx
inc %rdx
cmp $0, %al
je end
mov %al, %cl
mov %rcx, %rax
loop:
mov %rax, %rdx
3 years ago
cmp $1, %rcx
3 years ago
jle end
dec %rcx
mul %rcx
jmp loop
end:
```
# antifa
```
xor %ecx, %ecx
inc %ecx
loop:
cmp $1, %eax
je end
inc %ecx
cdq
div %ecx
jmp loop
end:
mov %ecx, %ebx
```
# antifa64
```
xor %rcx, %rcx
inc %rcx
loop:
cmp $1, %rax
je end
inc %rcx
cqo
div %rcx
jmp loop
end:
mov %rcx, %rbx
```
# vector
```
xor %rbx, %rbx
cmp $0, %rcx
je end
dec %rcx
loop:
lea (%rax, %rcx, 8), %rdx
add (%rdx), %rbx
dec %rcx
cmp $-1, %rcx
je end
jmp loop
end:
3 years ago
```