summaryrefslogtreecommitdiff
path: root/3/5_arith_and_logic/reverse_assemble.c
blob: 6413f987320558857a7f6e86fb70abb44ec763a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

/*
 * x in %rdi, y in %rsi, z in %rdx
 * arith3:
 *   orq %rsi, %rdx
 *   sarq $9, %rdx
 *   notq %rdx
 *   movq %rdx, %bax <------- what is this register??
 *   subq %rsi, %rbx
 *   ret
 */
short arith3(short x, short y, short z) {
    short p1 = z | y;
    short p2 = p1>>9;
    short p3 = ~p2;
    short p4 = p3;
    return p4;
}

int main() {

}