Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char **argv) {
- int x = atoi(argv[1]);
- int y = atoi(argv[2]);
- for (int i = (x < y) * 2; i < 4 >> (x < y); ++i) {
- int res;
- switch (i) {
- case 0:
- if (__builtin_sadd_overflow(x, y, &res))
- res = 0;
- break;
- case 1:
- if (__builtin_smul_overflow(x, y, &res))
- res = 0;
- break;
- case 2:
- if (__builtin_ssub_overflow(x, y, &res))
- res = 0;
- break;
- case 3:
- res = !(x
- #ifdef UNNECESSARY_CODE
- < y || x
- #endif
- % y) * (x / y);
- break;
- }
- printf("%dn", res);
- }
- }
- cc -Ofast -DUNNECESSARY_CODE -S -o a1.s a.c
- cc -Ofast -S -o a2.s a.c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement