summaryrefslogtreecommitdiff
path: root/3/5_arith_and_logic/reverse_assemble.c
diff options
context:
space:
mode:
Diffstat (limited to '3/5_arith_and_logic/reverse_assemble.c')
-rw-r--r--3/5_arith_and_logic/reverse_assemble.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/3/5_arith_and_logic/reverse_assemble.c b/3/5_arith_and_logic/reverse_assemble.c
new file mode 100644
index 0000000..6413f98
--- /dev/null
+++ b/3/5_arith_and_logic/reverse_assemble.c
@@ -0,0 +1,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() {
+
+}