diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-10-05 21:49:54 +0200 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-10-05 21:49:54 +0200 |
commit | c5fcf7179a83ef65c86c6a4a390029149e518649 (patch) | |
tree | d29ffc5b86a0d257453cedcf87d91a13d8bf3b0d /semestr-4/ask/lista5/zad5.c | |
parent | f8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff) |
Duzy commit ze smieciami
Diffstat (limited to 'semestr-4/ask/lista5/zad5.c')
-rw-r--r-- | semestr-4/ask/lista5/zad5.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/semestr-4/ask/lista5/zad5.c b/semestr-4/ask/lista5/zad5.c new file mode 100644 index 0000000..c1fe957 --- /dev/null +++ b/semestr-4/ask/lista5/zad5.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <stdint.h> + +long switch_prob(long rdi, long rsi) { + static void *array[] = { &&L1, &&L1, &&L2, &&L3, &&L4, &&L5 }; + long rax; + rsi -= 0x3c; + if (rsi > 0x5) { + goto L3; + } + goto *array[rsi]; +L1: + rax = rdi * 8; + return rax; +L4: + rax = rdi; + rax >>= 3; + retun rax; +L2: + rax = rdi; + rax <<= 4; + rax -= rdi; + rdi = rax; +L5: + rdi *= rdi; +L3: + rax = 0x4b + rdi; + return rax; +} + +long decode(long x, long n) { + long result; + n -= 0x3c; + switch (n) + { + case 0: + case 1: + return x + 8; + case 4: + return x >> 3; + case 2: + result = (x << 4) - x; + x = result; + case 5: + x *= x; + case 3: + default: + return 0x4b + x; + } +} + +int main() { + +}
\ No newline at end of file |