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

// Remember that jumps flip conditionals
// Also testq rdi rdi and jge test if the sign bit is set
short test(short x, short y) {
    short val = 12 + y;
    if (x < 0) {
        if (x >= y)
            val = x | y;
        else
            val = x * y;
    } else if (y >= 10) {
        val = x / y;
    }
    return val;
}

int main(void) {
    return 0;
}