Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .globl asma
- asma:
- pushq %rbp /*push rbp onto stack*/
- movq %rsp, %rbp /*copy rsp into rbp*/
- movq %rdi, -24(%rbp) /*place argument a into stack*/
- movq %rsi, -32(%rbp) /*place argument b into stack*/
- movq %rdx, -40(%rbp) /*place argument c into stack*/
- movq -40(%rbp), %rax /*load variable c into rax*/
- shrl $6, %eax /*shift(right) c by 6*/
- movq %rax, -8(%rbp) /*store shifted value (longs)*/
- movq -40(%rbp), %rax /*load variable c into rax*/
- andl $63, %eax /*c AND 63, store into rax*/
- movq %rax, -16(%rbp) /*store rax value into stack (bits)*/
- movq -8(%rbp), %rax /*load var longs into rax*/
- andl $1, %eax /*rax MOD 2 and store into rax*/
- leaq 0(,%rax,8), %rdx /*store value into rdx (0 or 8)*/
- movq -24(%rbp), %rax /*load address of a into rax*/
- addq %rdx, %rax /*add 0 or 8 to the address*/
- movq (%rax), %rax /*load the value the address points to*/
- movq %rax, %r8 /*store value into r8*/
- movq -8(%rbp), %rax /*load var longs into rax*/
- addq $1, %rax /*longs+1*/
- andl $1, %eax /*(longs+1) MOD 2*/
- leaq 0(,%rax,8), %rdx /*store value into rdx (0 or 8)*/
- movq -24(%rbp), %rax /*load address of a into rax*/
- addq %rdx, %rax /*add 0 or 8 to the address*/
- movq (%rax), %rax /*load the value the address points to*/
- movq -16(%rbp), %rcx /*load var bits into rcx*/
- shld %cl, %rax, %r8 /*shift left by rdx bits*/
- movq -32(%rbp), %rdx /*load address of b into rdx*/
- movq %r8, (%rdx) /*store result as b[0]*/
- movq -32(%rbp), %rax /*load address of b into rax*/
- addq $8, %rax /*add 8 to the address in rax*/
- movq -8(%rbp), %rdx /*load var longs into rdx*/
- addq $1, %rdx /*longs+1*/
- andl $1, %edx /*(longs+1) MOD 2*/
- leaq 0(,%rdx,8), %rcx /*store value into rcx (0 or 8)*/
- movq -24(%rbp), %rdx /*load address of a into rdx*/
- addq %rcx, %rdx /*add 0 or 8 to the address of a*/
- movq (%rdx), %rdx /*load the value the address points to*/
- movq %rdx, %r8 /*store value into r8*/
- movq -8(%rbp), %rdx /*load var longs into rdx*/
- andl $1, %edx /*longs MOD 2*/
- leaq 0(,%rdx,8), %rcx /*store value into rcx (0 or 8)*/
- movq -24(%rbp), %rdx /*load address of a into rdx*/
- addq %rcx, %rdx /*add 8 or 0 to address in rdx*/
- movq (%rdx), %rdx /*load the value the address points to*/
- movq -16(%rbp), %rcx /*load var bits into rcx*/
- shld %cl, %rdx, %r8 /*shift left by rcx bits*/
- movq %r8, (%rax) /*store result as b[1]*/
- leave
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement