aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/ask/lista5/zad5.c
blob: c1fe957c332d279fe9703bdc679e7cb2d3462de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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() {
    
}