53 lines
800 B
ArmAsm
53 lines
800 B
ArmAsm
|
.file "rand.c"
|
||
|
.text
|
||
|
.p2align 4,,15
|
||
|
.globl rand
|
||
|
.type rand, @function
|
||
|
rand:
|
||
|
.LFB2:
|
||
|
.cfi_startproc
|
||
|
movabsq $next, %rax
|
||
|
imulq $1103515245, (%rax), %rdx
|
||
|
addq $12345, %rdx
|
||
|
movq %rdx, (%rax)
|
||
|
shrq $16, %rdx
|
||
|
movl %edx, %eax
|
||
|
movl %edx, %esi
|
||
|
leaq (%rax,%rax,2), %rax
|
||
|
shrq $32, %rax
|
||
|
movq %rax, %rcx
|
||
|
movl %edx, %eax
|
||
|
subl %ecx, %eax
|
||
|
shrl %eax
|
||
|
addl %ecx, %eax
|
||
|
shrl $30, %eax
|
||
|
movl %eax, %ecx
|
||
|
sall $31, %ecx
|
||
|
subl %eax, %ecx
|
||
|
subl %ecx, %esi
|
||
|
movl %esi, %eax
|
||
|
ret
|
||
|
.cfi_endproc
|
||
|
.LFE2:
|
||
|
.size rand, .-rand
|
||
|
.p2align 4,,15
|
||
|
.globl srand
|
||
|
.type srand, @function
|
||
|
srand:
|
||
|
.LFB3:
|
||
|
.cfi_startproc
|
||
|
movabsq $next, %rax
|
||
|
movl %edi, %edx
|
||
|
movq %rdx, (%rax)
|
||
|
ret
|
||
|
.cfi_endproc
|
||
|
.LFE3:
|
||
|
.size srand, .-srand
|
||
|
.data
|
||
|
.align 8
|
||
|
.type next, @object
|
||
|
.size next, 8
|
||
|
next:
|
||
|
.quad 7756
|
||
|
.ident "GCC: (GNU) 7.3.0"
|