Skip to content
Snippets Groups Projects
Commit 6d7560d3 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[ioccc] add 2020 IOCCC winners

parent fef53ef7
No related branches found
No related tags found
No related merge requests found
Showing
with 517 additions and 0 deletions
/* Generated by Frama-C */
#include "errno.h"
#include "stdarg.h"
#include "stddef.h"
#include "stdint.h"
#include "stdio.h"
int main(void)
{
int __retres;
int64_t e;
int64_t k;
int64_t n;
uint32_t h[20] = {(unsigned int)0};
uint32_t i = (unsigned int)0;
uint32_t x = ~ i / (uint32_t)15;
uint32_t f = x * x - x;
uint32_t a = f ^ x;
uint32_t b = f ^ x * (uint32_t)9;
uint32_t c = ~ a;
uint32_t d = ~ b;
int64_t z = (long)0;
int64_t g = (long)0;
int64_t l = (long)566548;
int64_t p = (long)585873;
int64_t o = (long)882346;
int64_t m = (long)64336;
while (1) {
i = (unsigned int)0;
h[i] += a;
a = h[i];
h[1] += b;
b = h[1];
h[2] += c;
c = h[2];
h[3] += d;
d = h[3];
if (! f) break;
n = (long)64;
while (1) {
int64_t tmp_2;
int64_t tmp_1;
if (n == (int64_t)8) {
h[5] = (unsigned int)g;
h[4] = (unsigned int)(g >> 32);
f = (unsigned int)(z >= (int64_t)0);
tmp_2 = (long)f;
}
else tmp_2 = n;
if (! tmp_2) break;
n -= (int64_t)1;
if (z < (int64_t)0) tmp_1 = (long)0;
else {
int64_t tmp_0;
int tmp;
tmp = getchar();
z = (long)tmp;
if (z >= (int64_t)0) {
g += (int64_t)8;
tmp_0 = z;
}
else tmp_0 = (long)128;
tmp_1 = tmp_0;
}
x = (unsigned int)((tmp_1 << 24) | (long)(x >> 8));
h[(int64_t)4 + n / (int64_t)4] = x;
}
e = (long)0;
k = ~ e << 40;
while (1) {
unsigned int tmp_5;
uint32_t tmp_6;
x = i / (uint32_t)16;
if (! (x < (uint32_t)4)) break;
n = (((e * m + k * p) >> 21) + e * l) + k * o;
k = ((((k * m - e * p) >> 21) + k * l) - e * o) >> 20;
e = n >> 20;
n = (long)((((((i | (unsigned int)12) * (unsigned int)152) % (unsigned int)543) % (unsigned int)82) % (unsigned int)4 +
((i % (unsigned int)4) * (unsigned int)43) / (unsigned int)8) + (unsigned int)4);
if (x > (uint32_t)2) tmp_5 = ~ d | b;
else {
unsigned int tmp_4;
if (x > (uint32_t)1) tmp_4 = b ^ d;
else {
unsigned int tmp_3;
if (x) tmp_3 = (b ^ c) & d; else tmp_3 = (c ^ d) & ~ b;
tmp_4 = tmp_3;
}
tmp_5 = tmp_4;
}
tmp_6 = i;
i += (uint32_t)1;
x = (unsigned int)((long)((a + (tmp_5 ^ c)) + h[(unsigned int)19 -
(((x * (uint32_t)7) / (uint32_t)2 & (unsigned int)5) -
~ (x * (uint32_t)5 & (unsigned int)6) * tmp_6) % (unsigned int)16]) + (
(e >> 40) ^ (e >> 8)));
a = d;
d = c;
c = b;
b += (x << n) | (x >> ((int64_t)32 - n));
}
}
while (i < (uint32_t)33) {
uint32_t tmp_9;
uint32_t tmp_7;
a = (h[i / (uint32_t)8] >> ((i % (unsigned int)8) * (unsigned int)4 ^ (unsigned int)4)) & (unsigned int)15;
tmp_7 = i;
i += (uint32_t)1;
;
if (tmp_7 < (uint32_t)32) {
int tmp_8;
if (a > (uint32_t)9) tmp_8 = 'a' - 10; else tmp_8 = '0';
a += (uint32_t)tmp_8;
tmp_9 = a;
}
else tmp_9 = (unsigned int)'\n';
putchar((int)tmp_9);
}
__retres = 0;
return __retres;
}
[metrics] Defined functions (1)
=====================
main (0 call);
Specified-only functions (0)
============================
Undefined and unspecified functions (0)
=======================================
'Extern' global variables (0)
=============================
Potential entry points (1)
==========================
main;
Global metrics
==============
Sloc = 107
Decision point = 12
Global variables = 0
If = 12
Loop = 4
Goto = 0
Assignment = 68
Exit point = 1
Function = 1
Function call = 2
Pointer dereferencing = 0
Cyclomatic complexity = 13
directory file line function property kind status property
2020/kurdyukov1 prog.extra.c 25 main index_bound Unknown (long)((long)(tmp / 4) + 4) < 20
2020/kurdyukov1 prog.extra.c 25 main signed_overflow Unknown n + 1 ≤ 9223372036854775807
2020/kurdyukov1 prog.extra.c 26 main signed_overflow Unknown g + 8 ≤ 9223372036854775807
2020/kurdyukov1 prog.extra.c 31 main float_to_int Unknown \mul_double(tmp_9, (double)8) * (double)((int)(8 << 26)) < 4294967296
[metrics] Eva coverage statistics
=======================
Syntactically reachable functions = 1 (out of 1)
Semantically reached functions = 1
Coverage estimation = 100.0%
[metrics] Statements analyzed by Eva
--------------------------
105 stmts in analyzed functions, 105 stmts analyzed (100.0%)
main: 105 stmts out of 105 (100.0%)
/* Generated by Frama-C */
#include "errno.h"
#include "math.h"
#include "stdarg.h"
#include "stddef.h"
#include "stdint.h"
#include "stdio.h"
int main(void)
{
int __retres;
int64_t n;
uint32_t i = (unsigned int)0;
uint32_t h[20] = {(unsigned int)0};
uint32_t x = ~ i / (uint32_t)15;
uint32_t f = x * x - x;
uint32_t a = f ^ x;
uint32_t b = f ^ x * (uint32_t)9;
uint32_t c = ~ a;
uint32_t d = ~ b;
int64_t z = (long)0;
int64_t g = (long)0;
while (1) {
i = (unsigned int)0;
n = (long)i;
h[n] += a;
a = h[n];
h[1] += b;
b = h[1];
h[2] += c;
c = h[2];
h[3] += d;
d = h[3];
if (! f) break;
while (1) {
uint32_t tmp_3;
int64_t tmp;
int64_t tmp_2;
if (n == (int64_t)56) {
h[18] = (unsigned int)g;
h[19] = (unsigned int)(g >> 32);
f = (unsigned int)(z >= (int64_t)0);
tmp_3 = f;
}
else tmp_3 = (unsigned int)(n < (int64_t)64);
if (! tmp_3) break;
tmp = n;
n += (int64_t)1;
if (z < (int64_t)0) tmp_2 = (long)0;
else {
int64_t tmp_1;
int tmp_0;
tmp_0 = getchar();
z = (long)tmp_0;
if (z >= (int64_t)0) {
g += (int64_t)8;
tmp_1 = z;
}
else tmp_1 = (long)128;
tmp_2 = tmp_1;
}
x = (unsigned int)((tmp_2 << 24) | (long)(x >> 8));
h[tmp / (int64_t)4 + (int64_t)4] = x;
}
while (1) {
unsigned int tmp_6;
uint32_t tmp_7;
double tmp_9;
double tmp_8;
x = i >> 4;
if (! (x < (uint32_t)4)) break;
n = (long)((((((i | (unsigned int)12) * (unsigned int)152) % (unsigned int)543) % (unsigned int)82) % (unsigned int)4 +
((i % (unsigned int)4) * (unsigned int)43) / (unsigned int)8) + (unsigned int)4);
if (x > (uint32_t)2) tmp_6 = ~ d | b;
else {
unsigned int tmp_5;
if (x > (uint32_t)1) tmp_5 = b ^ d;
else {
unsigned int tmp_4;
if (x) tmp_4 = (b ^ c) & d; else tmp_4 = (c ^ d) & ~ b;
tmp_5 = tmp_4;
}
tmp_6 = tmp_5;
}
tmp_7 = i;
i += (uint32_t)1;
x = (a + (tmp_6 ^ c)) + h[(((x * (uint32_t)7) / (uint32_t)2 & (unsigned int)5) -
~ (x * (uint32_t)5 & (unsigned int)6) * tmp_7) % (unsigned int)16 + (unsigned int)4];
tmp_8 = sin((double)i);
tmp_9 = fabs(tmp_8);
a = (unsigned int)((tmp_9 * (double)8) * (double)(8 << 26));
x += a;
a = d;
d = c;
c = b;
b += (x << n) | (x >> ((int64_t)32 - n));
}
}
while (n < (int64_t)33) {
uint32_t tmp_12;
int64_t tmp_10;
a = (h[n / (int64_t)8] >> ((n % (long)8) * (long)4 ^ (long)4)) & (unsigned int)15;
tmp_10 = n;
n += (int64_t)1;
;
if (tmp_10 < (int64_t)32) {
int tmp_11;
if (a > (uint32_t)9) tmp_11 = 'a' - 10; else tmp_11 = '0';
a += (uint32_t)tmp_11;
tmp_12 = a;
}
else tmp_12 = (unsigned int)'\n';
putchar((int)tmp_12);
}
__retres = 0;
return __retres;
}
[metrics] Defined functions (1)
=====================
main (0 call);
Specified-only functions (0)
============================
Undefined and unspecified functions (0)
=======================================
'Extern' global variables (0)
=============================
Potential entry points (1)
==========================
main;
Global metrics
==============
Sloc = 105
Decision point = 12
Global variables = 0
If = 12
Loop = 4
Goto = 0
Assignment = 64
Exit point = 1
Function = 1
Function call = 4
Pointer dereferencing = 0
Cyclomatic complexity = 13
directory file line function property kind status property
2020/kurdyukov1 prog.orig.c 11 main index_bound Unknown (unsigned int)(tmp_2 / 4) < 16
2020/kurdyukov1 prog.orig.c 11 main signed_overflow Unknown g + 8 ≤ 9223372036854775807
2020/kurdyukov1 prog.orig.c 13 main shift Invalid or unreachable 0 ≤ (long)(~e)
[metrics] Eva coverage statistics
=======================
Syntactically reachable functions = 1 (out of 1)
Semantically reached functions = 1
Coverage estimation = 100.0%
[metrics] Statements analyzed by Eva
--------------------------
106 stmts in analyzed functions, 69 stmts analyzed (65.1%)
main: 69 stmts out of 106 (65.1%)
2020/kurdyukov1/prog.orig.c:13:[nonterm] warning: non-terminating statement
stack: main
/* Generated by Frama-C */
#include "errno.h"
#include "stdarg.h"
#include "stddef.h"
#include "stdint.h"
#include "stdio.h"
int main(void)
{
int __retres;
uint32_t i;
uint32_t x;
uint32_t s[16];
int64_t e;
int64_t k;
int64_t y;
uint32_t f = (unsigned int)0;
uint32_t n = (unsigned int)0;
uint32_t a = (unsigned int)1732584193;
uint32_t b = 4023233417;
uint32_t q = (unsigned int)32;
uint32_t c = ~ a;
uint32_t d = ~ b;
x = a;
uint32_t h[8] =
{x,
b,
c,
d,
(unsigned int)80200,
(unsigned int)745,
(unsigned int)108189,
(unsigned int)38200};
int64_t z = (long)0;
int64_t g = (long)0;
int64_t l = (long)566548;
int64_t m = (long)64336;
int64_t o = (long)882346;
int64_t p = (long)585873;
while (! f) {
uint32_t tmp_2;
int64_t tmp_5;
uint32_t tmp_6;
tmp_2 = n;
n += (uint32_t)1;
if (z < (int64_t)0) tmp_5 = (long)0;
else {
int64_t tmp_4;
int tmp_3;
tmp_3 = getchar();
z = (long)tmp_3;
if (z >= (int64_t)0) {
g += (int64_t)8;
tmp_4 = z;
}
else tmp_4 = (long)128;
tmp_5 = tmp_4;
}
x = (unsigned int)((long)(x >> 8) | (tmp_5 << 24));
s[tmp_2 / (uint32_t)4] = x;
if (n == (uint32_t)56) {
s[14] = (unsigned int)g;
s[15] = (unsigned int)(g >> q);
f = (unsigned int)(z < (int64_t)0);
tmp_6 = f;
}
else tmp_6 = n / (uint32_t)64;
if (tmp_6) {
i = (unsigned int)0;
e = (long)i;
k = ~ e << 40;
while (i < (uint32_t)64) {
unsigned int tmp_1;
y = (((e * m + k * p) >> 21) + e * l) + k * o;
k = ((((k * m - e * p) >> 21) + k * l) - e * o) >> 20;
e = y >> 20;
x = i / (uint32_t)16 + (uint32_t)4;
n = h[x];
if (x > (uint32_t)4) {
unsigned int tmp_0;
if (x > (uint32_t)6) tmp_0 = ~ d | b;
else {
unsigned int tmp;
if (x > (uint32_t)5) tmp = b ^ d; else tmp = (b ^ c) & d;
tmp_0 = tmp;
}
tmp_1 = tmp_0 ^ c;
}
else tmp_1 = ((c ^ d) & b) ^ d;
x = (unsigned int)((long)((a + tmp_1) + s[(((n / (uint32_t)8) % (unsigned int)8) * i +
n % (unsigned int)8) & (unsigned int)15]) + (
(e >> 8) ^ (e >> 40)));
n = (((n >> ((i % (unsigned int)4) * (unsigned int)3 + (unsigned int)6)) & (unsigned int)7) +
(i % (unsigned int)4) * (unsigned int)6) + (unsigned int)2;
i += (uint32_t)1;
a = d;
d = c;
c = b;
b += (x << n) | (x >> (q - n));
}
n = (unsigned int)0;
h[n] += a;
a = h[n];
h[1] += b;
b = h[1];
h[2] += c;
c = h[2];
h[3] += d;
d = h[3];
}
}
while (n < (uint32_t)33) {
uint32_t tmp_8;
a = (h[n / (uint32_t)8] >> ((n % (unsigned int)8) * (unsigned int)4 ^ (unsigned int)4)) & (unsigned int)15;
n += (uint32_t)1;
;
if (n > q) tmp_8 = (unsigned int)'\n';
else {
int tmp_7;
if (a < (uint32_t)10) tmp_7 = '0'; else tmp_7 = 'a' - 10;
tmp_8 = a + (uint32_t)tmp_7;
}
putchar((int)tmp_8);
}
__retres = 0;
return __retres;
}
[metrics] Defined functions (1)
=====================
main (0 call);
Specified-only functions (0)
============================
Undefined and unspecified functions (0)
=======================================
'Extern' global variables (0)
=============================
Potential entry points (1)
==========================
main;
Global metrics
==============
Sloc = 106
Decision point = 12
Global variables = 0
If = 12
Loop = 3
Goto = 0
Assignment = 68
Exit point = 1
Function = 1
Function call = 2
Pointer dereferencing = 0
Cyclomatic complexity = 13
directory file line function property kind status property
2020/kurdyukov2 prog.ppm.c 17 main mem_access Unknown \valid_read(V)
2020/kurdyukov2 prog.ppm.c 17 main precondition of atoi Unknown valid_nptr: \valid_read(nptr)
2020/kurdyukov2 prog.ppm.c 18 main mem_access Invalid or unreachable \valid_read(V)
FRAMAC_SHARE/libc stdio.h 150 fopen precondition Unknown valid_filename: valid_read_string(filename)
FRAMAC_SHARE/libc stdio.h 151 fopen precondition Unknown valid_mode: valid_read_string(mode)
FRAMAC_SHARE/libc stdlib.h 78 atoi precondition Unknown valid_nptr: \valid_read(nptr)
[metrics] Eva coverage statistics
=======================
Syntactically reachable functions = 1 (out of 1)
Semantically reached functions = 1
Coverage estimation = 100.0%
[metrics] Statements analyzed by Eva
--------------------------
746 stmts in analyzed functions, 19 stmts analyzed (2.5%)
main: 19 stmts out of 746 (2.5%)
2020/kurdyukov2/prog.ppm.c:18:[nonterm] warning: non-terminating function call
stack: main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment