file_name
stringlengths
33
36
verified_c_file_content
stringlengths
38
76k
dependency_acls
stringlengths
0
9.54k
function_implementation
stringlengths
12
11.9k
verified
bool
1 class
total_goals
int64
1
124
verified_goals
int64
1
124
error_cause
stringclasses
1 value
c_code_snippet
stringlengths
12
11.9k
acsl_snippet
stringlengths
0
9.54k
frama_c_files_v2/test_frama_c_2236.c
#include <limits.h> #include <string.h> char * p_chunked(char * x1637); char * p_(char * x1639); char * p_TransferEncoding(char * x1641); char * p_ContentLength(char * x1643); char * p_HTTP(char * x1645); /*@ requires ((strlen(x0)>=0) && \valid(x0+(0..(strlen(x0)+1)-1))); assigns \nothing; */ int p(char * x0) { int x2 = -1; char *x3 = p_HTTP(x0); int x5 = 1/*true*/; int x6 = 0; char *x7 = 0/*null*/; int x8 = 1/*true*/; int x9 = 0; char *x10 = 0/*null*/; int x11 = 1/*true*/; int x12 = 0; char *x13 = 0/*null*/; int x14 = 1/*true*/; int x15 = 0; char *x16 = 0/*null*/; int x17 = 1/*true*/; char *x19 = 0/*null*/; int x20 = 1/*true*/; char *x22 = 0/*null*/; int x23 = 1/*true*/; char x24 = '\0'; char *x25 = 0/*null*/; int x26 = 1/*true*/; char *x28 = 0/*null*/; int x29 = 1/*true*/; char *x31 = 0/*null*/; int x32 = 0 == x3; if (x32) { x31 = x0; } else { x29 = 0/*false*/; x31 = x3; } int x40 = x29; if (x40) { char *x41 = x31; x28 = x41; } else { char *x45 = x31; int x52 = 1/*true*/; char x53 = '\0'; char *x54 = 0/*null*/; char x46 = x45[0]; int x47 = x46 == '\0'; if (x47) { x54 = x45; } else { int x48 = x46 >= '0'; int x50; if (x48) { int x49 = x46 <= '9'; x50 = x49; } else { x50 = 0/*false*/; } if (x50) { x52 = 0/*false*/; x53 = x46; char *x51 = x45+1; x54 = x51; } else { x54 = x45; } } int x66 = x52; if (x66) { char *x67 = x54; x28 = x67; } else { char x70 = x53; char *x71 = x54; char *x72 = x71; int x73 = 1/*true*/; /*@ loop invariant ((strlen(x72)>=0) && \valid(x72+(0..(strlen(x72)+1)-1))); loop assigns x72, x73; */ for (;;) { int x74 = x73; if (!x74) break; char *x76 = x72; char x77 = x76[0]; int x78 = x77 == '\0'; if (x78) { x73 = 0/*false*/; } else { int x79 = x77 >= '0'; int x81; if (x79) { int x80 = x77 <= '9'; x81 = x80; } else { x81 = 0/*false*/; } if (x81) { char *x82 = x76+1; x72 = x82; } else { x73 = 0/*false*/; } } } char *x108 = x72; x26 = 0/*false*/; x28 = x108; } } int x116 = x26; if (x116) { char *x117 = x28; x25 = x117; } else { char *x121 = x28; char x122 = x121[0]; int x123 = x122 == '\0'; if (x123) { x25 = x121; } else { int x124 = x122 == '.'; if (x124) { x23 = 0/*false*/; x24 = x122; char *x125 = x121+1; x25 = x125; } else { x25 = x121; } } } int x139 = x23; if (x139) { char *x140 = x25; x22 = x140; } else { char x143 = x24; char *x144 = x25; int x151 = 1/*true*/; char x152 = '\0'; char *x153 = 0/*null*/; char x145 = x144[0]; int x146 = x145 == '\0'; if (x146) { x153 = x144; } else { int x147 = x145 >= '0'; int x149; if (x147) { int x148 = x145 <= '9'; x149 = x148; } else { x149 = 0/*false*/; } if (x149) { x151 = 0/*false*/; x152 = x145; char *x150 = x144+1; x153 = x150; } else { x153 = x144; } } int x165 = x151; if (x165) { char *x166 = x153; x22 = x166; } else { char x169 = x152; char *x170 = x153; char *x171 = x170; int x172 = 1/*true*/; /*@ loop invariant ((strlen(x171)>=0) && \valid(x171+(0..(strlen(x171)+1)-1))); loop assigns x171, x172; */ for (;;) { int x173 = x172; if (!x173) break; char *x175 = x171; char x176 = x175[0]; int x177 = x176 == '\0'; if (x177) { x172 = 0/*false*/; } else { int x178 = x176 >= '0'; int x180; if (x178) { int x179 = x176 <= '9'; x180 = x179; } else { x180 = 0/*false*/; } if (x180) { char *x181 = x175+1; x171 = x181; } else { x172 = 0/*false*/; } } } char *x207 = x171; x20 = 0/*false*/; x22 = x207; } } int x215 = x20; if (x215) { char *x216 = x22; x19 = x216; } else { char *x220 = x22; char *x221 = x220; int x222 = 1/*true*/; /*@ loop invariant ((strlen(x221)>=0) && \valid(x221+(0..(strlen(x221)+1)-1))); loop assigns x221, x222; */ for (;;) { int x223 = x222; if (!x223) break; char *x225 = x221; char x226 = x225[0]; int x227 = x226 == '\0'; if (x227) { x222 = 0/*false*/; } else { int x228 = x226 == ' '; if (x228) { char *x229 = x225+1; x221 = x229; } else { x222 = 0/*false*/; } } } char *x255 = x221; x17 = 0/*false*/; x19 = x255; } int x261 = x17; if (x261) { char *x262 = x19; x16 = x262; } else { char *x266 = x19; int x273 = 1/*true*/; int x274 = 0; char *x275 = 0/*null*/; int x276 = 1/*true*/; char x277 = '\0'; char *x278 = 0/*null*/; char x267 = x266[0]; int x268 = x267 == '\0'; if (x268) { x278 = x266; } else { int x269 = x267 >= '0'; int x271; if (x269) { int x270 = x267 <= '9'; x271 = x270; } else { x271 = 0/*false*/; } if (x271) { x276 = 0/*false*/; x277 = x267; char *x272 = x266+1; x278 = x272; } else { x278 = x266; } } int x290 = x276; if (x290) { char *x291 = x278; x275 = x291; } else { char x294 = x277; char *x296 = x278; x273 = 0/*false*/; char x295 = x294 - '0'; x274 = x295; x275 = x296; } int x302 = x273; if (x302) { char *x303 = x275; x16 = x303; } else { int x306 = x274; char *x307 = x275; char *x308 = x307; int x309 = 1/*true*/; int x310 = x306; int x343 = INT_MAX; int x344 = x343 / 10; int x345 = x344 - 10; /*@ loop invariant (((strlen(x308)>=0) && \valid(x308+(0..(strlen(x308)+1)-1))) && ((x310==-1) || (0<=x310))); loop assigns x308, x309, x310; */ for (;;) { int x311 = x309; if (!x311) break; char *x313 = x308; int x320 = 1/*true*/; char x321 = '\0'; char *x322 = 0/*null*/; char x314 = x313[0]; int x315 = x314 == '\0'; if (x315) { x322 = x313; } else { int x316 = x314 >= '0'; int x318; if (x316) { int x317 = x314 <= '9'; x318 = x317; } else { x318 = 0/*false*/; } if (x318) { x320 = 0/*false*/; x321 = x314; char *x319 = x313+1; x322 = x319; } else { x322 = x313; } } int x334 = x320; if (x334) { char *x335 = x322; x309 = 0/*false*/; } else { char x338 = x321; char *x340 = x322; int x341 = x310; int x342 = x341 < 0; int x350; if (x342) { x350 = x341; } else { int x346 = x341 > x345; int x349; if (x346) { x349 = -1; } else { char x339 = x338 - '0'; int x347 = x341 * 10; int x348 = x347 + x339; x349 = x348; } x350 = x349; } x310 = x350; x308 = x340; } } int x378 = x310; char *x379 = x308; x14 = 0/*false*/; x15 = x378; x16 = x379; } } int x387 = x14; if (x387) { char *x388 = x16; x13 = x388; } else { int x391 = x15; char *x392 = x16; char *x393 = x392; int x394 = 1/*true*/; /*@ loop invariant ((strlen(x393)>=0) && \valid(x393+(0..(strlen(x393)+1)-1))); loop assigns x393, x394; */ for (;;) { int x395 = x394; if (!x395) break; char *x397 = x393; char x398 = x397[0]; int x399 = x398 == '\0'; if (x399) { x394 = 0/*false*/; } else { int x404 = x398 == '\r'; if (x404) { x394 = 0/*false*/; } else { char *x401 = x397+1; x393 = x401; } } } char *x428 = x393; int x429 = 1/*true*/; char *x431 = 0/*null*/; x429 = 0/*false*/; x431 = x428; int x435 = x429; if (x435) { char *x436 = x431; x13 = x436; } else { char *x440 = x431; char *x441 = p_(x440); int x443 = 1/*true*/; char *x445 = 0/*null*/; int x446 = 0 == x441; if (x446) { x445 = x440; } else { x443 = 0/*false*/; x445 = x441; } int x454 = x443; if (x454) { char *x455 = x445; x13 = x455; } else { char *x459 = x445; x11 = 0/*false*/; x12 = x391; x13 = x459; } } } int x469 = x11; if (x469) { char *x470 = x13; x10 = x470; } else { int x473 = x12; char *x474 = x13; char *x475 = x474; int x476 = 1/*true*/; int x477 = 0; int x343 = INT_MAX; int x344 = x343 / 10; int x345 = x344 - 10; int x1122 = -2 == -2; /*@ loop invariant ((strlen(x475)>=0) && \valid(x475+(0..(strlen(x475)+1)-1))); loop assigns x475, x476, x477; */ for (;;) { int x478 = x476; if (!x478) break; char *x480 = x475; char *x481 = p_ContentLength(x480); int x483 = 1/*true*/; int x484 = 0; char *x485 = 0/*null*/; int x486 = 1/*true*/; int x487 = 0; char *x488 = 0/*null*/; int x489 = 1/*true*/; int x490 = 0; char *x491 = 0/*null*/; int x492 = 1/*true*/; int x493 = 0; char *x494 = 0/*null*/; int x495 = 1/*true*/; int x496 = 0; char *x497 = 0/*null*/; int x498 = 1/*true*/; int x499 = 0; char *x500 = 0/*null*/; int x501 = 1/*true*/; char *x503 = 0/*null*/; int x504 = 0 == x481; if (x504) { x503 = x480; } else { x501 = 0/*false*/; x503 = x481; } int x512 = x501; if (x512) { char *x513 = x503; } else { char *x516 = x503; x498 = 0/*false*/; x499 = 1; x500 = x516; } int x522 = x498; if (x522) { char *x523 = p_TransferEncoding(x480); int x525 = 1/*true*/; char *x527 = 0/*null*/; int x528 = 0 == x523; if (x528) { x527 = x480; } else { x525 = 0/*false*/; x527 = x523; } int x536 = x525; if (x536) { char *x537 = x527; } else { char *x540 = x527; x495 = 0/*false*/; x496 = 2; x497 = x540; } } else { int x547 = x499; char *x548 = x500; x495 = 0/*false*/; x496 = x547; x497 = x548; } int x554 = x495; if (x554) { char *x555 = x480; int x556 = 1/*true*/; /*@ loop invariant ((strlen(x555)>=0) && \valid(x555+(0..(strlen(x555)+1)-1))); loop assigns x555, x556; */ for (;;) { int x557 = x556; if (!x557) break; char *x559 = x555; char x560 = x559[0]; int x561 = x560 == '\0'; if (x561) { x556 = 0/*false*/; } else { int x563 = x560 == ':'; int x565; if (x563) { x565 = 0/*false*/; } else { int x564 = x560 != ' '; x565 = x564; } if (x565) { char *x566 = x559+1; x555 = x566; } else { x556 = 0/*false*/; } } } char *x592 = x555; x492 = 0/*false*/; x493 = 0; x494 = x592; } else { int x597 = x496; char *x598 = x497; x492 = 0/*false*/; x493 = x597; x494 = x598; } int x604 = x492; if (x604) { char *x605 = x494; x491 = x605; } else { int x608 = x493; char *x609 = x494; char *x610 = x609; int x611 = 1/*true*/; /*@ loop invariant ((strlen(x610)>=0) && \valid(x610+(0..(strlen(x610)+1)-1))); loop assigns x610, x611; */ for (;;) { int x612 = x611; if (!x612) break; char *x614 = x610; char x615 = x614[0]; int x616 = x615 == '\0'; if (x616) { x611 = 0/*false*/; } else { int x617 = x615 == ' '; if (x617) { char *x618 = x614+1; x610 = x618; } else { x611 = 0/*false*/; } } } char *x644 = x610; x489 = 0/*false*/; x490 = x608; x491 = x644; } int x650 = x489; if (x650) { char *x651 = x491; x488 = x651; } else { int x654 = x490; char *x655 = x491; int x660 = 1/*true*/; char x661 = '\0'; char *x662 = 0/*null*/; char x656 = x655[0]; int x657 = x656 == '\0'; if (x657) { x662 = x655; } else { int x658 = x656 == ':'; if (x658) { x660 = 0/*false*/; x661 = x656; char *x659 = x655+1; x662 = x659; } else { x662 = x655; } } int x674 = x660; if (x674) { char *x675 = x662; x488 = x675; } else { char x678 = x661; char *x679 = x662; x486 = 0/*false*/; x487 = x654; x488 = x679; } } int x687 = x486; if (x687) { char *x688 = x488; x485 = x688; } else { int x691 = x487; char *x692 = x488; char *x693 = x692; int x694 = 1/*true*/; /*@ loop invariant ((strlen(x693)>=0) && \valid(x693+(0..(strlen(x693)+1)-1))); loop assigns x693, x694; */ for (;;) { int x695 = x694; if (!x695) break; char *x697 = x693; char x698 = x697[0]; int x699 = x698 == '\0'; if (x699) { x694 = 0/*false*/; } else { int x700 = x698 == ' '; if (x700) { char *x701 = x697+1; x693 = x701; } else { x694 = 0/*false*/; } } } char *x727 = x693; x483 = 0/*false*/; x484 = x691; x485 = x727; } int x733 = x483; if (x733) { char *x734 = x485; x476 = 0/*false*/; } else { int x737 = x484; char *x738 = x485; char *x740 = p_chunked(x738); char *x749 = x738; int x750 = 1/*true*/; /*@ loop invariant ((strlen(x749)>=0) && \valid(x749+(0..(strlen(x749)+1)-1))); loop assigns x749, x750; */ for (;;) { int x751 = x750; if (!x751) break; char *x753 = x749; char x754 = x753[0]; int x755 = x754 == '\0'; if (x755) { x750 = 0/*false*/; } else { int x760 = x754 == '\r'; if (x760) { x750 = 0/*false*/; } else { char *x757 = x753+1; x749 = x757; } } } char *x784 = x749; int x739 = x737 == 2; if (x739) { int x785 = 1/*true*/; int x786 = 0; char *x787 = 0/*null*/; int x788 = 1/*true*/; int x789 = 0; char *x790 = 0/*null*/; int x791 = 1/*true*/; char *x793 = 0/*null*/; int x794 = 0 == x740; if (x794) { x793 = x738; } else { x791 = 0/*false*/; x793 = x740; } int x802 = x791; if (x802) { char *x803 = x793; x790 = x803; } else { char *x807 = x793; x788 = 0/*false*/; x789 = -3; x790 = x807; } int x813 = x788; if (x813) { char *x814 = x790; x787 = x814; } else { int x817 = x789; char *x818 = x790; char *x819 = x818; int x820 = 1/*true*/; /*@ loop invariant ((strlen(x819)>=0) && \valid(x819+(0..(strlen(x819)+1)-1))); loop assigns x819, x820; */ for (;;) { int x821 = x820; if (!x821) break; char *x823 = x819; char x824 = x823[0]; int x825 = x824 == '\0'; if (x825) { x820 = 0/*false*/; } else { int x826 = x824 == ' '; if (x826) { char *x827 = x823+1; x819 = x827; } else { x820 = 0/*false*/; } } } char *x853 = x819; x785 = 0/*false*/; x786 = x817; x787 = x853; } int x859 = x785; if (x859) { char *x860 = x787; x476 = 0/*false*/; } else { int x863 = x786; char *x864 = x787; char *x865 = p_(x864); int x867 = 1/*true*/; char *x869 = 0/*null*/; int x870 = 0 == x865; if (x870) { x869 = x864; } else { x867 = 0/*false*/; x869 = x865; } int x878 = x867; if (x878) { char *x879 = x869; x476 = 0/*false*/; } else { char *x883 = x869; int x884 = x477; int x885 = x863 == -2; int x886; if (x885) { x886 = x884; } else { x886 = x863; } x477 = x886; x475 = x883; } } } else { int x742 = x737 == 1; if (x742) { int x894 = 1/*true*/; int x895 = 0; char *x896 = 0/*null*/; int x897 = 1/*true*/; int x898 = 0; char *x899 = 0/*null*/; int x900 = 1/*true*/; int x901 = 0; char *x902 = 0/*null*/; int x903 = 1/*true*/; char x904 = '\0'; char *x905 = 0/*null*/; char x743 = x738[0]; int x744 = x743 == '\0'; if (x744) { x905 = x738; } else { int x745 = x743 >= '0'; int x747; if (x745) { int x746 = x743 <= '9'; x747 = x746; } else { x747 = 0/*false*/; } if (x747) { x903 = 0/*false*/; x904 = x743; char *x748 = x738+1; x905 = x748; } else { x905 = x738; } } int x917 = x903; if (x917) { char *x918 = x905; x902 = x918; } else { char x921 = x904; char *x923 = x905; x900 = 0/*false*/; char x922 = x921 - '0'; x901 = x922; x902 = x923; } int x929 = x900; if (x929) { char *x930 = x902; x899 = x930; } else { int x933 = x901; char *x934 = x902; char *x935 = x934; int x936 = 1/*true*/; int x937 = x933; /*@ loop invariant (((strlen(x935)>=0) && \valid(x935+(0..(strlen(x935)+1)-1))) && ((x937==-1) || (0<=x937))); loop assigns x935, x936, x937; */ for (;;) { int x938 = x936; if (!x938) break; char *x940 = x935; int x947 = 1/*true*/; char x948 = '\0'; char *x949 = 0/*null*/; char x941 = x940[0]; int x942 = x941 == '\0'; if (x942) { x949 = x940; } else { int x943 = x941 >= '0'; int x945; if (x943) { int x944 = x941 <= '9'; x945 = x944; } else { x945 = 0/*false*/; } if (x945) { x947 = 0/*false*/; x948 = x941; char *x946 = x940+1; x949 = x946; } else { x949 = x940; } } int x961 = x947; if (x961) { char *x962 = x949; x936 = 0/*false*/; } else { char x965 = x948; char *x967 = x949; int x968 = x937; int x969 = x968 < 0; int x974; if (x969) { x974 = x968; } else { int x970 = x968 > x345; int x973; if (x970) { x973 = -1; } else { char x966 = x965 - '0'; int x971 = x968 * 10; int x972 = x971 + x966; x973 = x972; } x974 = x973; } x937 = x974; x935 = x967; } } int x1002 = x937; char *x1003 = x935; x897 = 0/*false*/; x898 = x1002; x899 = x1003; } int x1009 = x897; if (x1009) { char *x1010 = x899; x896 = x1010; } else { int x1013 = x898; char *x1014 = x899; char *x1015 = x1014; int x1016 = 1/*true*/; /*@ loop invariant ((strlen(x1015)>=0) && \valid(x1015+(0..(strlen(x1015)+1)-1))); loop assigns x1015, x1016; */ for (;;) { int x1017 = x1016; if (!x1017) break; char *x1019 = x1015; char x1020 = x1019[0]; int x1021 = x1020 == '\0'; if (x1021) { x1016 = 0/*false*/; } else { int x1022 = x1020 == ' '; if (x1022) { char *x1023 = x1019+1; x1015 = x1023; } else { x1016 = 0/*false*/; } } } char *x1049 = x1015; x894 = 0/*false*/; x895 = x1013; x896 = x1049; } int x1055 = x894; if (x1055) { char *x1056 = x896; x476 = 0/*false*/; } else { int x1059 = x895; char *x1060 = x896; char *x1061 = p_(x1060); int x1063 = 1/*true*/; char *x1065 = 0/*null*/; int x1066 = 0 == x1061; if (x1066) { x1065 = x1060; } else { x1063 = 0/*false*/; x1065 = x1061; } int x1074 = x1063; if (x1074) { char *x1075 = x1065; x476 = 0/*false*/; } else { char *x1079 = x1065; int x1080 = x477; int x1081 = x1059 == -2; int x1082; if (x1081) { x1082 = x1080; } else { x1082 = x1059; } x477 = x1082; x475 = x1079; } } } else { int x1090 = 1/*true*/; char *x1092 = 0/*null*/; x1090 = 0/*false*/; x1092 = x784; int x1096 = x1090; if (x1096) { char *x1097 = x1092; x476 = 0/*false*/; } else { char *x1101 = x1092; char *x1102 = p_(x1101); int x1104 = 1/*true*/; char *x1106 = 0/*null*/; int x1107 = 0 == x1102; if (x1107) { x1106 = x1101; } else { x1104 = 0/*false*/; x1106 = x1102; } int x1115 = x1104; if (x1115) { char *x1116 = x1106; x476 = 0/*false*/; } else { char *x1120 = x1106; int x1121 = x477; int x1123; if (x1122) { x1123 = x1121; } else { x1123 = -2; } x477 = x1123; x475 = x1120; } } } } } } int x1154 = x477; char *x1155 = x475; x8 = 0/*false*/; x9 = x1154; x10 = x1155; } int x1161 = x8; if (x1161) { char *x1162 = x10; x7 = x1162; } else { int x1165 = x9; char *x1166 = x10; char *x1167 = p_(x1166); int x1169 = 1/*true*/; char *x1171 = 0/*null*/; int x1172 = 0 == x1167; if (x1172) { x1171 = x1166; } else { x1169 = 0/*false*/; x1171 = x1167; } int x1180 = x1169; if (x1180) { char *x1181 = x1171; x7 = x1181; } else { char *x1185 = x1171; x5 = 0/*false*/; x6 = x1165; x7 = x1185; } } int x1193 = x5; if (x1193) { char *x1194 = x7; } else { int x1196 = x6; char *x1197 = x7; char *x1199 = x1197; int x1200 = 1/*true*/; int x1201 = 0; int x343 = INT_MAX; int x1361 = x343 / 16; int x1362 = x1361 - 16; /*@ loop invariant (((strlen(x1199)>=0) && \valid(x1199+(0..(strlen(x1199)+1)-1))) && ((x1201==-1) || (0<=x1201))); loop assigns x1199, x1200, x1201; */ for (;;) { int x1202 = x1200; if (!x1202) break; char *x1204 = x1199; int x1211 = 1/*true*/; int x1212 = 0; char *x1213 = 0/*null*/; int x1214 = 1/*true*/; int x1215 = 0; char *x1216 = 0/*null*/; int x1217 = 1/*true*/; int x1218 = 0; char *x1219 = 0/*null*/; int x1220 = 1/*true*/; int x1221 = 0; char *x1222 = 0/*null*/; int x1223 = 1/*true*/; char x1224 = '\0'; char *x1225 = 0/*null*/; char x1205 = x1204[0]; int x1206 = x1205 == '\0'; if (x1206) { x1225 = x1204; } else { int x1207 = x1205 >= '0'; int x1209; if (x1207) { int x1208 = x1205 <= '9'; x1209 = x1208; } else { x1209 = 0/*false*/; } if (x1209) { x1223 = 0/*false*/; x1224 = x1205; char *x1210 = x1204+1; x1225 = x1210; } else { x1225 = x1204; } } int x1237 = x1223; if (x1237) { char *x1238 = x1225; } else { char x1240 = x1224; char *x1242 = x1225; x1220 = 0/*false*/; char x1241 = x1240 - '0'; x1221 = x1241; x1222 = x1242; } int x1248 = x1220; if (x1248) { int x1252 = 1/*true*/; char x1253 = '\0'; char *x1254 = 0/*null*/; if (x1206) { x1254 = x1204; } else { int x1249 = x1205 >= 'a'; int x1251; if (x1249) { int x1250 = x1205 <= 'f'; x1251 = x1250; } else { x1251 = 0/*false*/; } if (x1251) { x1252 = 0/*false*/; x1253 = x1205; char *x1210 = x1204+1; x1254 = x1210; } else { x1254 = x1204; } } int x1266 = x1252; if (x1266) { char *x1267 = x1254; x1219 = x1267; } else { char x1270 = x1253; char *x1273 = x1254; x1217 = 0/*false*/; char x1271 = x1270 - 'a'; int x1272 = 10 + x1271; x1218 = x1272; x1219 = x1273; } } else { int x1280 = x1221; char *x1281 = x1222; x1217 = 0/*false*/; x1218 = x1280; x1219 = x1281; } int x1287 = x1217; if (x1287) { char *x1288 = x1219; x1216 = x1288; } else { int x1291 = x1218; char *x1292 = x1219; char *x1293 = x1292; int x1294 = 1/*true*/; int x1295 = x1291; /*@ loop invariant (((strlen(x1293)>=0) && \valid(x1293+(0..(strlen(x1293)+1)-1))) && ((x1295==-1) || (0<=x1295))); loop assigns x1293, x1294, x1295; */ for (;;) { int x1296 = x1294; if (!x1296) break; char *x1298 = x1293; int x1305 = 1/*true*/; int x1306 = 0; char *x1307 = 0/*null*/; int x1308 = 1/*true*/; char x1309 = '\0'; char *x1310 = 0/*null*/; char x1299 = x1298[0]; int x1300 = x1299 == '\0'; if (x1300) { x1310 = x1298; } else { int x1301 = x1299 >= '0'; int x1303; if (x1301) { int x1302 = x1299 <= '9'; x1303 = x1302; } else { x1303 = 0/*false*/; } if (x1303) { x1308 = 0/*false*/; x1309 = x1299; char *x1304 = x1298+1; x1310 = x1304; } else { x1310 = x1298; } } int x1322 = x1308; if (x1322) { char *x1323 = x1310; } else { char x1325 = x1309; char *x1327 = x1310; x1305 = 0/*false*/; char x1326 = x1325 - '0'; x1306 = x1326; x1307 = x1327; } int x1333 = x1305; if (x1333) { int x1337 = 1/*true*/; char x1338 = '\0'; char *x1339 = 0/*null*/; if (x1300) { x1339 = x1298; } else { int x1334 = x1299 >= 'a'; int x1336; if (x1334) { int x1335 = x1299 <= 'f'; x1336 = x1335; } else { x1336 = 0/*false*/; } if (x1336) { x1337 = 0/*false*/; x1338 = x1299; char *x1304 = x1298+1; x1339 = x1304; } else { x1339 = x1298; } } int x1351 = x1337; if (x1351) { char *x1352 = x1339; x1294 = 0/*false*/; } else { char x1355 = x1338; char *x1358 = x1339; int x1359 = x1295; int x1360 = x1359 < 0; int x1367; if (x1360) { x1367 = x1359; } else { int x1363 = x1359 > x1362; int x1366; if (x1363) { x1366 = -1; } else { char x1356 = x1355 - 'a'; int x1357 = 10 + x1356; int x1364 = x1359 * 16; int x1365 = x1364 + x1357; x1366 = x1365; } x1367 = x1366; } x1295 = x1367; x1293 = x1358; } } else { int x1373 = x1306; char *x1374 = x1307; int x1375 = x1295; int x1376 = x1375 < 0; int x1381; if (x1376) { x1381 = x1375; } else { int x1377 = x1375 > x1362; int x1380; if (x1377) { x1380 = -1; } else { int x1378 = x1375 * 16; int x1379 = x1378 + x1373; x1380 = x1379; } x1381 = x1380; } x1295 = x1381; x1293 = x1374; } } int x1409 = x1295; char *x1410 = x1293; x1214 = 0/*false*/; x1215 = x1409; x1216 = x1410; } int x1416 = x1214; if (x1416) { char *x1417 = x1216; x1213 = x1417; } else { int x1420 = x1215; char *x1421 = x1216; char *x1422 = p_(x1421); int x1424 = 1/*true*/; char *x1426 = 0/*null*/; int x1427 = 0 == x1422; if (x1427) { x1426 = x1421; } else { x1424 = 0/*false*/; x1426 = x1422; } int x1435 = x1424; if (x1435) { char *x1436 = x1426; x1213 = x1436; } else { char *x1440 = x1426; x1211 = 0/*false*/; x1212 = x1420; x1213 = x1440; } } int x1448 = x1211; if (x1448) { char *x1449 = x1213; x1200 = 0/*false*/; } else { int x1452 = x1212; char *x1453 = x1213; int x1455 = 1/*true*/; char *x1456 = x1453; /*@ loop invariant ((0<=x1458) && ((strlen(x1456)>=0) && \valid(x1456+(0..(strlen(x1456)+1)-1)))); loop assigns x1458, x1455, x1456; loop variant (x1452-x1458); */ for(int x1458=0; x1458 < x1452; x1458++) { int x1459 = x1455; if (x1459) { char *x1460 = x1456; char x1461 = x1460[0]; int x1462 = x1461 == '\0'; if (x1462) { x1455 = 0/*false*/; } else { char *x1463 = x1460+1; x1456 = x1463; } } else { } } int x1492 = x1455; char *x1493 = x1456; int x1454 = x1452 < 0; if (x1454) { x1200 = 0/*false*/; } else { int x1496 = 1/*true*/; char *x1498 = 0/*null*/; if (x1492) { x1496 = 0/*false*/; x1498 = x1493; } else { x1498 = x1453; } int x1506 = x1496; if (x1506) { char *x1507 = x1498; x1200 = 0/*false*/; } else { char *x1511 = x1498; int x1512 = x1201; int x1513 = x1512 < 0; int x1518; if (x1513) { x1518 = x1512; } else { int x1514 = x343 - x1452; int x1515 = x1512 > x1514; int x1517; if (x1515) { x1517 = -1; } else { int x1516 = x1512 + x1452; x1517 = x1516; } x1518 = x1517; } x1201 = x1518; x1199 = x1511; } } } } int x1550 = x1201; char *x1551 = x1199; int x1553 = 1/*true*/; char *x1554 = x1197; /*@ loop invariant ((0<=x1556) && ((strlen(x1554)>=0) && \valid(x1554+(0..(strlen(x1554)+1)-1)))); loop assigns x1556, x1553, x1554; loop variant (x1196-x1556); */ for(int x1556=0; x1556 < x1196; x1556++) { int x1557 = x1553; if (x1557) { char *x1558 = x1554; char x1559 = x1558[0]; int x1560 = x1559 == '\0'; if (x1560) { x1553 = 0/*false*/; } else { char *x1561 = x1558+1; x1554 = x1561; } } else { } } int x1590 = x1553; char *x1591 = x1554; int x1198 = x1196 == -3; if (x1198) { char x1592 = x1551[0]; int x1593 = x1592 == '\0'; if (x1593) { x2 = x1550; } else { } } else { int x1552 = x1196 < 0; if (x1552) { } else { int x1598 = 1/*true*/; char *x1600 = 0/*null*/; if (x1590) { x1598 = 0/*false*/; x1600 = x1591; } else { x1600 = x1197; } int x1608 = x1598; if (x1608) { char *x1609 = x1600; } else { char *x1612 = x1600; char x1613 = x1612[0]; int x1614 = x1613 == '\0'; if (x1614) { x2 = x1196; } else { } } } } } int x1626 = x2; return x1626; } /*@ requires ((strlen(x1647)>=0) && \valid(x1647+(0..(strlen(x1647)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_HTTP(char * x1647) { char *x1649 = x1647; int x1654 = 1/*true*/; char x1655 = '\0'; char *x1656 = 0/*null*/; char x1650 = x1647[0]; int x1651 = x1650 == '\0'; if (x1651) { x1656 = x1647; } else { int x1652 = x1650 == 'H'; if (x1652) { x1654 = 0/*false*/; x1655 = x1650; char *x1653 = x1647+1; x1656 = x1653; } else { x1656 = x1647; } } int x1668 = x1654; if (x1668) { char *x1669 = x1656; x1649 = 0; } else { char x1672 = x1655; char *x1673 = x1656; int x1678 = 1/*true*/; char x1679 = '\0'; char *x1680 = 0/*null*/; char x1674 = x1673[0]; int x1675 = x1674 == '\0'; if (x1675) { x1680 = x1673; } else { int x1676 = x1674 == 'T'; if (x1676) { x1678 = 0/*false*/; x1679 = x1674; char *x1677 = x1673+1; x1680 = x1677; } else { x1680 = x1673; } } int x1692 = x1678; if (x1692) { char *x1693 = x1680; x1649 = 0; } else { char x1696 = x1679; char *x1697 = x1680; int x1702 = 1/*true*/; char x1703 = '\0'; char *x1704 = 0/*null*/; char x1698 = x1697[0]; int x1699 = x1698 == '\0'; if (x1699) { x1704 = x1697; } else { int x1700 = x1698 == 'T'; if (x1700) { x1702 = 0/*false*/; x1703 = x1698; char *x1701 = x1697+1; x1704 = x1701; } else { x1704 = x1697; } } int x1716 = x1702; if (x1716) { char *x1717 = x1704; x1649 = 0; } else { char x1720 = x1703; char *x1721 = x1704; int x1726 = 1/*true*/; char x1727 = '\0'; char *x1728 = 0/*null*/; char x1722 = x1721[0]; int x1723 = x1722 == '\0'; if (x1723) { x1728 = x1721; } else { int x1724 = x1722 == 'P'; if (x1724) { x1726 = 0/*false*/; x1727 = x1722; char *x1725 = x1721+1; x1728 = x1725; } else { x1728 = x1721; } } int x1740 = x1726; if (x1740) { char *x1741 = x1728; x1649 = 0; } else { char x1744 = x1727; char *x1745 = x1728; int x1750 = 1/*true*/; char x1751 = '\0'; char *x1752 = 0/*null*/; char x1746 = x1745[0]; int x1747 = x1746 == '\0'; if (x1747) { x1752 = x1745; } else { int x1748 = x1746 == '/'; if (x1748) { x1750 = 0/*false*/; x1751 = x1746; char *x1749 = x1745+1; x1752 = x1749; } else { x1752 = x1745; } } int x1764 = x1750; if (x1764) { char *x1765 = x1752; x1649 = 0; } else { char x1768 = x1751; char *x1769 = x1752; x1649 = x1769; } } } } } char *x1781 = x1649; return x1781; } /*@ requires ((strlen(x1803)>=0) && \valid(x1803+(0..(strlen(x1803)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_(char * x1803) { char *x1805 = x1803; int x1810 = 1/*true*/; char x1811 = '\0'; char *x1812 = 0/*null*/; char x1806 = x1803[0]; int x1807 = x1806 == '\0'; if (x1807) { x1812 = x1803; } else { int x1808 = x1806 == '\r'; if (x1808) { x1810 = 0/*false*/; x1811 = x1806; char *x1809 = x1803+1; x1812 = x1809; } else { x1812 = x1803; } } int x1824 = x1810; if (x1824) { char *x1825 = x1812; x1805 = 0; } else { char x1828 = x1811; char *x1829 = x1812; int x1834 = 1/*true*/; char x1835 = '\0'; char *x1836 = 0/*null*/; char x1830 = x1829[0]; int x1831 = x1830 == '\0'; if (x1831) { x1836 = x1829; } else { int x1832 = x1830 == '\n'; if (x1832) { x1834 = 0/*false*/; x1835 = x1830; char *x1833 = x1829+1; x1836 = x1833; } else { x1836 = x1829; } } int x1848 = x1834; if (x1848) { char *x1849 = x1836; x1805 = 0; } else { char x1852 = x1835; char *x1853 = x1836; x1805 = x1853; } } char *x1859 = x1805; return x1859; } /*@ requires ((strlen(x1881)>=0) && \valid(x1881+(0..(strlen(x1881)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_ContentLength(char * x1881) { char *x1883 = x1881; int x1888 = 1/*true*/; char x1889 = '\0'; char *x1890 = 0/*null*/; char x1884 = x1881[0]; int x1885 = x1884 == '\0'; if (x1885) { x1890 = x1881; } else { int x1886 = x1884 == 'C'; if (x1886) { x1888 = 0/*false*/; x1889 = x1884; char *x1887 = x1881+1; x1890 = x1887; } else { x1890 = x1881; } } int x1902 = x1888; if (x1902) { char *x1903 = x1890; x1883 = 0; } else { char x1906 = x1889; char *x1907 = x1890; int x1912 = 1/*true*/; char x1913 = '\0'; char *x1914 = 0/*null*/; char x1908 = x1907[0]; int x1909 = x1908 == '\0'; if (x1909) { x1914 = x1907; } else { int x1910 = x1908 == 'o'; if (x1910) { x1912 = 0/*false*/; x1913 = x1908; char *x1911 = x1907+1; x1914 = x1911; } else { x1914 = x1907; } } int x1926 = x1912; if (x1926) { char *x1927 = x1914; x1883 = 0; } else { char x1930 = x1913; char *x1931 = x1914; int x1936 = 1/*true*/; char x1937 = '\0'; char *x1938 = 0/*null*/; char x1932 = x1931[0]; int x1933 = x1932 == '\0'; if (x1933) { x1938 = x1931; } else { int x1934 = x1932 == 'n'; if (x1934) { x1936 = 0/*false*/; x1937 = x1932; char *x1935 = x1931+1; x1938 = x1935; } else { x1938 = x1931; } } int x1950 = x1936; if (x1950) { char *x1951 = x1938; x1883 = 0; } else { char x1954 = x1937; char *x1955 = x1938; int x1960 = 1/*true*/; char x1961 = '\0'; char *x1962 = 0/*null*/; char x1956 = x1955[0]; int x1957 = x1956 == '\0'; if (x1957) { x1962 = x1955; } else { int x1958 = x1956 == 't'; if (x1958) { x1960 = 0/*false*/; x1961 = x1956; char *x1959 = x1955+1; x1962 = x1959; } else { x1962 = x1955; } } int x1974 = x1960; if (x1974) { char *x1975 = x1962; x1883 = 0; } else { char x1978 = x1961; char *x1979 = x1962; int x1984 = 1/*true*/; char x1985 = '\0'; char *x1986 = 0/*null*/; char x1980 = x1979[0]; int x1981 = x1980 == '\0'; if (x1981) { x1986 = x1979; } else { int x1982 = x1980 == 'e'; if (x1982) { x1984 = 0/*false*/; x1985 = x1980; char *x1983 = x1979+1; x1986 = x1983; } else { x1986 = x1979; } } int x1998 = x1984; if (x1998) { char *x1999 = x1986; x1883 = 0; } else { char x2002 = x1985; char *x2003 = x1986; int x2008 = 1/*true*/; char x2009 = '\0'; char *x2010 = 0/*null*/; char x2004 = x2003[0]; int x2005 = x2004 == '\0'; if (x2005) { x2010 = x2003; } else { int x2006 = x2004 == 'n'; if (x2006) { x2008 = 0/*false*/; x2009 = x2004; char *x2007 = x2003+1; x2010 = x2007; } else { x2010 = x2003; } } int x2022 = x2008; if (x2022) { char *x2023 = x2010; x1883 = 0; } else { char x2026 = x2009; char *x2027 = x2010; int x2032 = 1/*true*/; char x2033 = '\0'; char *x2034 = 0/*null*/; char x2028 = x2027[0]; int x2029 = x2028 == '\0'; if (x2029) { x2034 = x2027; } else { int x2030 = x2028 == 't'; if (x2030) { x2032 = 0/*false*/; x2033 = x2028; char *x2031 = x2027+1; x2034 = x2031; } else { x2034 = x2027; } } int x2046 = x2032; if (x2046) { char *x2047 = x2034; x1883 = 0; } else { char x2050 = x2033; char *x2051 = x2034; int x2056 = 1/*true*/; char x2057 = '\0'; char *x2058 = 0/*null*/; char x2052 = x2051[0]; int x2053 = x2052 == '\0'; if (x2053) { x2058 = x2051; } else { int x2054 = x2052 == '-'; if (x2054) { x2056 = 0/*false*/; x2057 = x2052; char *x2055 = x2051+1; x2058 = x2055; } else { x2058 = x2051; } } int x2070 = x2056; if (x2070) { char *x2071 = x2058; x1883 = 0; } else { char x2074 = x2057; char *x2075 = x2058; int x2080 = 1/*true*/; char x2081 = '\0'; char *x2082 = 0/*null*/; char x2076 = x2075[0]; int x2077 = x2076 == '\0'; if (x2077) { x2082 = x2075; } else { int x2078 = x2076 == 'L'; if (x2078) { x2080 = 0/*false*/; x2081 = x2076; char *x2079 = x2075+1; x2082 = x2079; } else { x2082 = x2075; } } int x2094 = x2080; if (x2094) { char *x2095 = x2082; x1883 = 0; } else { char x2098 = x2081; char *x2099 = x2082; int x2104 = 1/*true*/; char x2105 = '\0'; char *x2106 = 0/*null*/; char x2100 = x2099[0]; int x2101 = x2100 == '\0'; if (x2101) { x2106 = x2099; } else { int x2102 = x2100 == 'e'; if (x2102) { x2104 = 0/*false*/; x2105 = x2100; char *x2103 = x2099+1; x2106 = x2103; } else { x2106 = x2099; } } int x2118 = x2104; if (x2118) { char *x2119 = x2106; x1883 = 0; } else { char x2122 = x2105; char *x2123 = x2106; int x2128 = 1/*true*/; char x2129 = '\0'; char *x2130 = 0/*null*/; char x2124 = x2123[0]; int x2125 = x2124 == '\0'; if (x2125) { x2130 = x2123; } else { int x2126 = x2124 == 'n'; if (x2126) { x2128 = 0/*false*/; x2129 = x2124; char *x2127 = x2123+1; x2130 = x2127; } else { x2130 = x2123; } } int x2142 = x2128; if (x2142) { char *x2143 = x2130; x1883 = 0; } else { char x2146 = x2129; char *x2147 = x2130; int x2152 = 1/*true*/; char x2153 = '\0'; char *x2154 = 0/*null*/; char x2148 = x2147[0]; int x2149 = x2148 == '\0'; if (x2149) { x2154 = x2147; } else { int x2150 = x2148 == 'g'; if (x2150) { x2152 = 0/*false*/; x2153 = x2148; char *x2151 = x2147+1; x2154 = x2151; } else { x2154 = x2147; } } int x2166 = x2152; if (x2166) { char *x2167 = x2154; x1883 = 0; } else { char x2170 = x2153; char *x2171 = x2154; int x2176 = 1/*true*/; char x2177 = '\0'; char *x2178 = 0/*null*/; char x2172 = x2171[0]; int x2173 = x2172 == '\0'; if (x2173) { x2178 = x2171; } else { int x2174 = x2172 == 't'; if (x2174) { x2176 = 0/*false*/; x2177 = x2172; char *x2175 = x2171+1; x2178 = x2175; } else { x2178 = x2171; } } int x2190 = x2176; if (x2190) { char *x2191 = x2178; x1883 = 0; } else { char x2194 = x2177; char *x2195 = x2178; int x2200 = 1/*true*/; char x2201 = '\0'; char *x2202 = 0/*null*/; char x2196 = x2195[0]; int x2197 = x2196 == '\0'; if (x2197) { x2202 = x2195; } else { int x2198 = x2196 == 'h'; if (x2198) { x2200 = 0/*false*/; x2201 = x2196; char *x2199 = x2195+1; x2202 = x2199; } else { x2202 = x2195; } } int x2214 = x2200; if (x2214) { char *x2215 = x2202; x1883 = 0; } else { char x2218 = x2201; char *x2219 = x2202; x1883 = x2219; } } } } } } } } } } } } } } char *x2249 = x1883; return x2249; } /*@ requires ((strlen(x2271)>=0) && \valid(x2271+(0..(strlen(x2271)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_TransferEncoding(char * x2271) { char *x2273 = x2271; int x2278 = 1/*true*/; char x2279 = '\0'; char *x2280 = 0/*null*/; char x2274 = x2271[0]; int x2275 = x2274 == '\0'; if (x2275) { x2280 = x2271; } else { int x2276 = x2274 == 'T'; if (x2276) { x2278 = 0/*false*/; x2279 = x2274; char *x2277 = x2271+1; x2280 = x2277; } else { x2280 = x2271; } } int x2292 = x2278; if (x2292) { char *x2293 = x2280; x2273 = 0; } else { char x2296 = x2279; char *x2297 = x2280; int x2302 = 1/*true*/; char x2303 = '\0'; char *x2304 = 0/*null*/; char x2298 = x2297[0]; int x2299 = x2298 == '\0'; if (x2299) { x2304 = x2297; } else { int x2300 = x2298 == 'r'; if (x2300) { x2302 = 0/*false*/; x2303 = x2298; char *x2301 = x2297+1; x2304 = x2301; } else { x2304 = x2297; } } int x2316 = x2302; if (x2316) { char *x2317 = x2304; x2273 = 0; } else { char x2320 = x2303; char *x2321 = x2304; int x2326 = 1/*true*/; char x2327 = '\0'; char *x2328 = 0/*null*/; char x2322 = x2321[0]; int x2323 = x2322 == '\0'; if (x2323) { x2328 = x2321; } else { int x2324 = x2322 == 'a'; if (x2324) { x2326 = 0/*false*/; x2327 = x2322; char *x2325 = x2321+1; x2328 = x2325; } else { x2328 = x2321; } } int x2340 = x2326; if (x2340) { char *x2341 = x2328; x2273 = 0; } else { char x2344 = x2327; char *x2345 = x2328; int x2350 = 1/*true*/; char x2351 = '\0'; char *x2352 = 0/*null*/; char x2346 = x2345[0]; int x2347 = x2346 == '\0'; if (x2347) { x2352 = x2345; } else { int x2348 = x2346 == 'n'; if (x2348) { x2350 = 0/*false*/; x2351 = x2346; char *x2349 = x2345+1; x2352 = x2349; } else { x2352 = x2345; } } int x2364 = x2350; if (x2364) { char *x2365 = x2352; x2273 = 0; } else { char x2368 = x2351; char *x2369 = x2352; int x2374 = 1/*true*/; char x2375 = '\0'; char *x2376 = 0/*null*/; char x2370 = x2369[0]; int x2371 = x2370 == '\0'; if (x2371) { x2376 = x2369; } else { int x2372 = x2370 == 's'; if (x2372) { x2374 = 0/*false*/; x2375 = x2370; char *x2373 = x2369+1; x2376 = x2373; } else { x2376 = x2369; } } int x2388 = x2374; if (x2388) { char *x2389 = x2376; x2273 = 0; } else { char x2392 = x2375; char *x2393 = x2376; int x2398 = 1/*true*/; char x2399 = '\0'; char *x2400 = 0/*null*/; char x2394 = x2393[0]; int x2395 = x2394 == '\0'; if (x2395) { x2400 = x2393; } else { int x2396 = x2394 == 'f'; if (x2396) { x2398 = 0/*false*/; x2399 = x2394; char *x2397 = x2393+1; x2400 = x2397; } else { x2400 = x2393; } } int x2412 = x2398; if (x2412) { char *x2413 = x2400; x2273 = 0; } else { char x2416 = x2399; char *x2417 = x2400; int x2422 = 1/*true*/; char x2423 = '\0'; char *x2424 = 0/*null*/; char x2418 = x2417[0]; int x2419 = x2418 == '\0'; if (x2419) { x2424 = x2417; } else { int x2420 = x2418 == 'e'; if (x2420) { x2422 = 0/*false*/; x2423 = x2418; char *x2421 = x2417+1; x2424 = x2421; } else { x2424 = x2417; } } int x2436 = x2422; if (x2436) { char *x2437 = x2424; x2273 = 0; } else { char x2440 = x2423; char *x2441 = x2424; int x2446 = 1/*true*/; char x2447 = '\0'; char *x2448 = 0/*null*/; char x2442 = x2441[0]; int x2443 = x2442 == '\0'; if (x2443) { x2448 = x2441; } else { int x2444 = x2442 == 'r'; if (x2444) { x2446 = 0/*false*/; x2447 = x2442; char *x2445 = x2441+1; x2448 = x2445; } else { x2448 = x2441; } } int x2460 = x2446; if (x2460) { char *x2461 = x2448; x2273 = 0; } else { char x2464 = x2447; char *x2465 = x2448; int x2470 = 1/*true*/; char x2471 = '\0'; char *x2472 = 0/*null*/; char x2466 = x2465[0]; int x2467 = x2466 == '\0'; if (x2467) { x2472 = x2465; } else { int x2468 = x2466 == '-'; if (x2468) { x2470 = 0/*false*/; x2471 = x2466; char *x2469 = x2465+1; x2472 = x2469; } else { x2472 = x2465; } } int x2484 = x2470; if (x2484) { char *x2485 = x2472; x2273 = 0; } else { char x2488 = x2471; char *x2489 = x2472; int x2494 = 1/*true*/; char x2495 = '\0'; char *x2496 = 0/*null*/; char x2490 = x2489[0]; int x2491 = x2490 == '\0'; if (x2491) { x2496 = x2489; } else { int x2492 = x2490 == 'E'; if (x2492) { x2494 = 0/*false*/; x2495 = x2490; char *x2493 = x2489+1; x2496 = x2493; } else { x2496 = x2489; } } int x2508 = x2494; if (x2508) { char *x2509 = x2496; x2273 = 0; } else { char x2512 = x2495; char *x2513 = x2496; int x2518 = 1/*true*/; char x2519 = '\0'; char *x2520 = 0/*null*/; char x2514 = x2513[0]; int x2515 = x2514 == '\0'; if (x2515) { x2520 = x2513; } else { int x2516 = x2514 == 'n'; if (x2516) { x2518 = 0/*false*/; x2519 = x2514; char *x2517 = x2513+1; x2520 = x2517; } else { x2520 = x2513; } } int x2532 = x2518; if (x2532) { char *x2533 = x2520; x2273 = 0; } else { char x2536 = x2519; char *x2537 = x2520; int x2542 = 1/*true*/; char x2543 = '\0'; char *x2544 = 0/*null*/; char x2538 = x2537[0]; int x2539 = x2538 == '\0'; if (x2539) { x2544 = x2537; } else { int x2540 = x2538 == 'c'; if (x2540) { x2542 = 0/*false*/; x2543 = x2538; char *x2541 = x2537+1; x2544 = x2541; } else { x2544 = x2537; } } int x2556 = x2542; if (x2556) { char *x2557 = x2544; x2273 = 0; } else { char x2560 = x2543; char *x2561 = x2544; int x2566 = 1/*true*/; char x2567 = '\0'; char *x2568 = 0/*null*/; char x2562 = x2561[0]; int x2563 = x2562 == '\0'; if (x2563) { x2568 = x2561; } else { int x2564 = x2562 == 'o'; if (x2564) { x2566 = 0/*false*/; x2567 = x2562; char *x2565 = x2561+1; x2568 = x2565; } else { x2568 = x2561; } } int x2580 = x2566; if (x2580) { char *x2581 = x2568; x2273 = 0; } else { char x2584 = x2567; char *x2585 = x2568; int x2590 = 1/*true*/; char x2591 = '\0'; char *x2592 = 0/*null*/; char x2586 = x2585[0]; int x2587 = x2586 == '\0'; if (x2587) { x2592 = x2585; } else { int x2588 = x2586 == 'd'; if (x2588) { x2590 = 0/*false*/; x2591 = x2586; char *x2589 = x2585+1; x2592 = x2589; } else { x2592 = x2585; } } int x2604 = x2590; if (x2604) { char *x2605 = x2592; x2273 = 0; } else { char x2608 = x2591; char *x2609 = x2592; int x2614 = 1/*true*/; char x2615 = '\0'; char *x2616 = 0/*null*/; char x2610 = x2609[0]; int x2611 = x2610 == '\0'; if (x2611) { x2616 = x2609; } else { int x2612 = x2610 == 'i'; if (x2612) { x2614 = 0/*false*/; x2615 = x2610; char *x2613 = x2609+1; x2616 = x2613; } else { x2616 = x2609; } } int x2628 = x2614; if (x2628) { char *x2629 = x2616; x2273 = 0; } else { char x2632 = x2615; char *x2633 = x2616; int x2638 = 1/*true*/; char x2639 = '\0'; char *x2640 = 0/*null*/; char x2634 = x2633[0]; int x2635 = x2634 == '\0'; if (x2635) { x2640 = x2633; } else { int x2636 = x2634 == 'n'; if (x2636) { x2638 = 0/*false*/; x2639 = x2634; char *x2637 = x2633+1; x2640 = x2637; } else { x2640 = x2633; } } int x2652 = x2638; if (x2652) { char *x2653 = x2640; x2273 = 0; } else { char x2656 = x2639; char *x2657 = x2640; int x2662 = 1/*true*/; char x2663 = '\0'; char *x2664 = 0/*null*/; char x2658 = x2657[0]; int x2659 = x2658 == '\0'; if (x2659) { x2664 = x2657; } else { int x2660 = x2658 == 'g'; if (x2660) { x2662 = 0/*false*/; x2663 = x2658; char *x2661 = x2657+1; x2664 = x2661; } else { x2664 = x2657; } } int x2676 = x2662; if (x2676) { char *x2677 = x2664; x2273 = 0; } else { char x2680 = x2663; char *x2681 = x2664; x2273 = x2681; } } } } } } } } } } } } } } } } } char *x2717 = x2273; return x2717; } /*@ requires ((strlen(x2739)>=0) && \valid(x2739+(0..(strlen(x2739)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_chunked(char * x2739) { char *x2741 = x2739; int x2746 = 1/*true*/; char x2747 = '\0'; char *x2748 = 0/*null*/; char x2742 = x2739[0]; int x2743 = x2742 == '\0'; if (x2743) { x2748 = x2739; } else { int x2744 = x2742 == 'c'; if (x2744) { x2746 = 0/*false*/; x2747 = x2742; char *x2745 = x2739+1; x2748 = x2745; } else { x2748 = x2739; } } int x2760 = x2746; if (x2760) { char *x2761 = x2748; x2741 = 0; } else { char x2764 = x2747; char *x2765 = x2748; int x2770 = 1/*true*/; char x2771 = '\0'; char *x2772 = 0/*null*/; char x2766 = x2765[0]; int x2767 = x2766 == '\0'; if (x2767) { x2772 = x2765; } else { int x2768 = x2766 == 'h'; if (x2768) { x2770 = 0/*false*/; x2771 = x2766; char *x2769 = x2765+1; x2772 = x2769; } else { x2772 = x2765; } } int x2784 = x2770; if (x2784) { char *x2785 = x2772; x2741 = 0; } else { char x2788 = x2771; char *x2789 = x2772; int x2794 = 1/*true*/; char x2795 = '\0'; char *x2796 = 0/*null*/; char x2790 = x2789[0]; int x2791 = x2790 == '\0'; if (x2791) { x2796 = x2789; } else { int x2792 = x2790 == 'u'; if (x2792) { x2794 = 0/*false*/; x2795 = x2790; char *x2793 = x2789+1; x2796 = x2793; } else { x2796 = x2789; } } int x2808 = x2794; if (x2808) { char *x2809 = x2796; x2741 = 0; } else { char x2812 = x2795; char *x2813 = x2796; int x2818 = 1/*true*/; char x2819 = '\0'; char *x2820 = 0/*null*/; char x2814 = x2813[0]; int x2815 = x2814 == '\0'; if (x2815) { x2820 = x2813; } else { int x2816 = x2814 == 'n'; if (x2816) { x2818 = 0/*false*/; x2819 = x2814; char *x2817 = x2813+1; x2820 = x2817; } else { x2820 = x2813; } } int x2832 = x2818; if (x2832) { char *x2833 = x2820; x2741 = 0; } else { char x2836 = x2819; char *x2837 = x2820; int x2842 = 1/*true*/; char x2843 = '\0'; char *x2844 = 0/*null*/; char x2838 = x2837[0]; int x2839 = x2838 == '\0'; if (x2839) { x2844 = x2837; } else { int x2840 = x2838 == 'k'; if (x2840) { x2842 = 0/*false*/; x2843 = x2838; char *x2841 = x2837+1; x2844 = x2841; } else { x2844 = x2837; } } int x2856 = x2842; if (x2856) { char *x2857 = x2844; x2741 = 0; } else { char x2860 = x2843; char *x2861 = x2844; int x2866 = 1/*true*/; char x2867 = '\0'; char *x2868 = 0/*null*/; char x2862 = x2861[0]; int x2863 = x2862 == '\0'; if (x2863) { x2868 = x2861; } else { int x2864 = x2862 == 'e'; if (x2864) { x2866 = 0/*false*/; x2867 = x2862; char *x2865 = x2861+1; x2868 = x2865; } else { x2868 = x2861; } } int x2880 = x2866; if (x2880) { char *x2881 = x2868; x2741 = 0; } else { char x2884 = x2867; char *x2885 = x2868; int x2890 = 1/*true*/; char x2891 = '\0'; char *x2892 = 0/*null*/; char x2886 = x2885[0]; int x2887 = x2886 == '\0'; if (x2887) { x2892 = x2885; } else { int x2888 = x2886 == 'd'; if (x2888) { x2890 = 0/*false*/; x2891 = x2886; char *x2889 = x2885+1; x2892 = x2889; } else { x2892 = x2885; } } int x2904 = x2890; if (x2904) { char *x2905 = x2892; x2741 = 0; } else { char x2908 = x2891; char *x2909 = x2892; x2741 = x2909; } } } } } } } char *x2925 = x2741; return x2925; }
#include <string.h> /*@ requires ((strlen(x1881)>=0) && \valid(x1881+(0..(strlen(x1881)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */
char * p_ContentLength(char * x1881) { char *x1883 = x1881; int x1888 = 1/*true*/; char x1889 = '\0'; char *x1890 = 0/*null*/; char x1884 = x1881[0]; int x1885 = x1884 == '\0'; if (x1885) { x1890 = x1881; } else { int x1886 = x1884 == 'C'; if (x1886) { x1888 = 0/*false*/; x1889 = x1884; char *x1887 = x1881+1; x1890 = x1887; } else { x1890 = x1881; } } int x1902 = x1888; if (x1902) { char *x1903 = x1890; x1883 = 0; } else { char x1906 = x1889; char *x1907 = x1890; int x1912 = 1/*true*/; char x1913 = '\0'; char *x1914 = 0/*null*/; char x1908 = x1907[0]; int x1909 = x1908 == '\0'; if (x1909) { x1914 = x1907; } else { int x1910 = x1908 == 'o'; if (x1910) { x1912 = 0/*false*/; x1913 = x1908; char *x1911 = x1907+1; x1914 = x1911; } else { x1914 = x1907; } } int x1926 = x1912; if (x1926) { char *x1927 = x1914; x1883 = 0; } else { char x1930 = x1913; char *x1931 = x1914; int x1936 = 1/*true*/; char x1937 = '\0'; char *x1938 = 0/*null*/; char x1932 = x1931[0]; int x1933 = x1932 == '\0'; if (x1933) { x1938 = x1931; } else { int x1934 = x1932 == 'n'; if (x1934) { x1936 = 0/*false*/; x1937 = x1932; char *x1935 = x1931+1; x1938 = x1935; } else { x1938 = x1931; } } int x1950 = x1936; if (x1950) { char *x1951 = x1938; x1883 = 0; } else { char x1954 = x1937; char *x1955 = x1938; int x1960 = 1/*true*/; char x1961 = '\0'; char *x1962 = 0/*null*/; char x1956 = x1955[0]; int x1957 = x1956 == '\0'; if (x1957) { x1962 = x1955; } else { int x1958 = x1956 == 't'; if (x1958) { x1960 = 0/*false*/; x1961 = x1956; char *x1959 = x1955+1; x1962 = x1959; } else { x1962 = x1955; } } int x1974 = x1960; if (x1974) { char *x1975 = x1962; x1883 = 0; } else { char x1978 = x1961; char *x1979 = x1962; int x1984 = 1/*true*/; char x1985 = '\0'; char *x1986 = 0/*null*/; char x1980 = x1979[0]; int x1981 = x1980 == '\0'; if (x1981) { x1986 = x1979; } else { int x1982 = x1980 == 'e'; if (x1982) { x1984 = 0/*false*/; x1985 = x1980; char *x1983 = x1979+1; x1986 = x1983; } else { x1986 = x1979; } } int x1998 = x1984; if (x1998) { char *x1999 = x1986; x1883 = 0; } else { char x2002 = x1985; char *x2003 = x1986; int x2008 = 1/*true*/; char x2009 = '\0'; char *x2010 = 0/*null*/; char x2004 = x2003[0]; int x2005 = x2004 == '\0'; if (x2005) { x2010 = x2003; } else { int x2006 = x2004 == 'n'; if (x2006) { x2008 = 0/*false*/; x2009 = x2004; char *x2007 = x2003+1; x2010 = x2007; } else { x2010 = x2003; } } int x2022 = x2008; if (x2022) { char *x2023 = x2010; x1883 = 0; } else { char x2026 = x2009; char *x2027 = x2010; int x2032 = 1/*true*/; char x2033 = '\0'; char *x2034 = 0/*null*/; char x2028 = x2027[0]; int x2029 = x2028 == '\0'; if (x2029) { x2034 = x2027; } else { int x2030 = x2028 == 't'; if (x2030) { x2032 = 0/*false*/; x2033 = x2028; char *x2031 = x2027+1; x2034 = x2031; } else { x2034 = x2027; } } int x2046 = x2032; if (x2046) { char *x2047 = x2034; x1883 = 0; } else { char x2050 = x2033; char *x2051 = x2034; int x2056 = 1/*true*/; char x2057 = '\0'; char *x2058 = 0/*null*/; char x2052 = x2051[0]; int x2053 = x2052 == '\0'; if (x2053) { x2058 = x2051; } else { int x2054 = x2052 == '-'; if (x2054) { x2056 = 0/*false*/; x2057 = x2052; char *x2055 = x2051+1; x2058 = x2055; } else { x2058 = x2051; } } int x2070 = x2056; if (x2070) { char *x2071 = x2058; x1883 = 0; } else { char x2074 = x2057; char *x2075 = x2058; int x2080 = 1/*true*/; char x2081 = '\0'; char *x2082 = 0/*null*/; char x2076 = x2075[0]; int x2077 = x2076 == '\0'; if (x2077) { x2082 = x2075; } else { int x2078 = x2076 == 'L'; if (x2078) { x2080 = 0/*false*/; x2081 = x2076; char *x2079 = x2075+1; x2082 = x2079; } else { x2082 = x2075; } } int x2094 = x2080; if (x2094) { char *x2095 = x2082; x1883 = 0; } else { char x2098 = x2081; char *x2099 = x2082; int x2104 = 1/*true*/; char x2105 = '\0'; char *x2106 = 0/*null*/; char x2100 = x2099[0]; int x2101 = x2100 == '\0'; if (x2101) { x2106 = x2099; } else { int x2102 = x2100 == 'e'; if (x2102) { x2104 = 0/*false*/; x2105 = x2100; char *x2103 = x2099+1; x2106 = x2103; } else { x2106 = x2099; } } int x2118 = x2104; if (x2118) { char *x2119 = x2106; x1883 = 0; } else { char x2122 = x2105; char *x2123 = x2106; int x2128 = 1/*true*/; char x2129 = '\0'; char *x2130 = 0/*null*/; char x2124 = x2123[0]; int x2125 = x2124 == '\0'; if (x2125) { x2130 = x2123; } else { int x2126 = x2124 == 'n'; if (x2126) { x2128 = 0/*false*/; x2129 = x2124; char *x2127 = x2123+1; x2130 = x2127; } else { x2130 = x2123; } } int x2142 = x2128; if (x2142) { char *x2143 = x2130; x1883 = 0; } else { char x2146 = x2129; char *x2147 = x2130; int x2152 = 1/*true*/; char x2153 = '\0'; char *x2154 = 0/*null*/; char x2148 = x2147[0]; int x2149 = x2148 == '\0'; if (x2149) { x2154 = x2147; } else { int x2150 = x2148 == 'g'; if (x2150) { x2152 = 0/*false*/; x2153 = x2148; char *x2151 = x2147+1; x2154 = x2151; } else { x2154 = x2147; } } int x2166 = x2152; if (x2166) { char *x2167 = x2154; x1883 = 0; } else { char x2170 = x2153; char *x2171 = x2154; int x2176 = 1/*true*/; char x2177 = '\0'; char *x2178 = 0/*null*/; char x2172 = x2171[0]; int x2173 = x2172 == '\0'; if (x2173) { x2178 = x2171; } else { int x2174 = x2172 == 't'; if (x2174) { x2176 = 0/*false*/; x2177 = x2172; char *x2175 = x2171+1; x2178 = x2175; } else { x2178 = x2171; } } int x2190 = x2176; if (x2190) { char *x2191 = x2178; x1883 = 0; } else { char x2194 = x2177; char *x2195 = x2178; int x2200 = 1/*true*/; char x2201 = '\0'; char *x2202 = 0/*null*/; char x2196 = x2195[0]; int x2197 = x2196 == '\0'; if (x2197) { x2202 = x2195; } else { int x2198 = x2196 == 'h'; if (x2198) { x2200 = 0/*false*/; x2201 = x2196; char *x2199 = x2195+1; x2202 = x2199; } else { x2202 = x2195; } } int x2214 = x2200; if (x2214) { char *x2215 = x2202; x1883 = 0; } else { char x2218 = x2201; char *x2219 = x2202; x1883 = x2219; } } } } } } } } } } } } } } char *x2249 = x1883; return x2249; }
true
102
102
char * p_ContentLength(char * x1881) { char *x1883 = x1881; int x1888 = 1/*true*/; char x1889 = '\0'; char *x1890 = 0/*null*/; char x1884 = x1881[0]; int x1885 = x1884 == '\0'; if (x1885) { x1890 = x1881; } else { int x1886 = x1884 == 'C'; if (x1886) { x1888 = 0/*false*/; x1889 = x1884; char *x1887 = x1881+1; x1890 = x1887; } else { x1890 = x1881; } } int x1902 = x1888; if (x1902) { char *x1903 = x1890; x1883 = 0; } else { char x1906 = x1889; char *x1907 = x1890; int x1912 = 1/*true*/; char x1913 = '\0'; char *x1914 = 0/*null*/; char x1908 = x1907[0]; int x1909 = x1908 == '\0'; if (x1909) { x1914 = x1907; } else { int x1910 = x1908 == 'o'; if (x1910) { x1912 = 0/*false*/; x1913 = x1908; char *x1911 = x1907+1; x1914 = x1911; } else { x1914 = x1907; } } int x1926 = x1912; if (x1926) { char *x1927 = x1914; x1883 = 0; } else { char x1930 = x1913; char *x1931 = x1914; int x1936 = 1/*true*/; char x1937 = '\0'; char *x1938 = 0/*null*/; char x1932 = x1931[0]; int x1933 = x1932 == '\0'; if (x1933) { x1938 = x1931; } else { int x1934 = x1932 == 'n'; if (x1934) { x1936 = 0/*false*/; x1937 = x1932; char *x1935 = x1931+1; x1938 = x1935; } else { x1938 = x1931; } } int x1950 = x1936; if (x1950) { char *x1951 = x1938; x1883 = 0; } else { char x1954 = x1937; char *x1955 = x1938; int x1960 = 1/*true*/; char x1961 = '\0'; char *x1962 = 0/*null*/; char x1956 = x1955[0]; int x1957 = x1956 == '\0'; if (x1957) { x1962 = x1955; } else { int x1958 = x1956 == 't'; if (x1958) { x1960 = 0/*false*/; x1961 = x1956; char *x1959 = x1955+1; x1962 = x1959; } else { x1962 = x1955; } } int x1974 = x1960; if (x1974) { char *x1975 = x1962; x1883 = 0; } else { char x1978 = x1961; char *x1979 = x1962; int x1984 = 1/*true*/; char x1985 = '\0'; char *x1986 = 0/*null*/; char x1980 = x1979[0]; int x1981 = x1980 == '\0'; if (x1981) { x1986 = x1979; } else { int x1982 = x1980 == 'e'; if (x1982) { x1984 = 0/*false*/; x1985 = x1980; char *x1983 = x1979+1; x1986 = x1983; } else { x1986 = x1979; } } int x1998 = x1984; if (x1998) { char *x1999 = x1986; x1883 = 0; } else { char x2002 = x1985; char *x2003 = x1986; int x2008 = 1/*true*/; char x2009 = '\0'; char *x2010 = 0/*null*/; char x2004 = x2003[0]; int x2005 = x2004 == '\0'; if (x2005) { x2010 = x2003; } else { int x2006 = x2004 == 'n'; if (x2006) { x2008 = 0/*false*/; x2009 = x2004; char *x2007 = x2003+1; x2010 = x2007; } else { x2010 = x2003; } } int x2022 = x2008; if (x2022) { char *x2023 = x2010; x1883 = 0; } else { char x2026 = x2009; char *x2027 = x2010; int x2032 = 1/*true*/; char x2033 = '\0'; char *x2034 = 0/*null*/; char x2028 = x2027[0]; int x2029 = x2028 == '\0'; if (x2029) { x2034 = x2027; } else { int x2030 = x2028 == 't'; if (x2030) { x2032 = 0/*false*/; x2033 = x2028; char *x2031 = x2027+1; x2034 = x2031; } else { x2034 = x2027; } } int x2046 = x2032; if (x2046) { char *x2047 = x2034; x1883 = 0; } else { char x2050 = x2033; char *x2051 = x2034; int x2056 = 1/*true*/; char x2057 = '\0'; char *x2058 = 0/*null*/; char x2052 = x2051[0]; int x2053 = x2052 == '\0'; if (x2053) { x2058 = x2051; } else { int x2054 = x2052 == '-'; if (x2054) { x2056 = 0/*false*/; x2057 = x2052; char *x2055 = x2051+1; x2058 = x2055; } else { x2058 = x2051; } } int x2070 = x2056; if (x2070) { char *x2071 = x2058; x1883 = 0; } else { char x2074 = x2057; char *x2075 = x2058; int x2080 = 1/*true*/; char x2081 = '\0'; char *x2082 = 0/*null*/; char x2076 = x2075[0]; int x2077 = x2076 == '\0'; if (x2077) { x2082 = x2075; } else { int x2078 = x2076 == 'L'; if (x2078) { x2080 = 0/*false*/; x2081 = x2076; char *x2079 = x2075+1; x2082 = x2079; } else { x2082 = x2075; } } int x2094 = x2080; if (x2094) { char *x2095 = x2082; x1883 = 0; } else { char x2098 = x2081; char *x2099 = x2082; int x2104 = 1/*true*/; char x2105 = '\0'; char *x2106 = 0/*null*/; char x2100 = x2099[0]; int x2101 = x2100 == '\0'; if (x2101) { x2106 = x2099; } else { int x2102 = x2100 == 'e'; if (x2102) { x2104 = 0/*false*/; x2105 = x2100; char *x2103 = x2099+1; x2106 = x2103; } else { x2106 = x2099; } } int x2118 = x2104; if (x2118) { char *x2119 = x2106; x1883 = 0; } else { char x2122 = x2105; char *x2123 = x2106; int x2128 = 1/*true*/; char x2129 = '\0'; char *x2130 = 0/*null*/; char x2124 = x2123[0]; int x2125 = x2124 == '\0'; if (x2125) { x2130 = x2123; } else { int x2126 = x2124 == 'n'; if (x2126) { x2128 = 0/*false*/; x2129 = x2124; char *x2127 = x2123+1; x2130 = x2127; } else { x2130 = x2123; } } int x2142 = x2128; if (x2142) { char *x2143 = x2130; x1883 = 0; } else { char x2146 = x2129; char *x2147 = x2130; int x2152 = 1/*true*/; char x2153 = '\0'; char *x2154 = 0/*null*/; char x2148 = x2147[0]; int x2149 = x2148 == '\0'; if (x2149) { x2154 = x2147; } else { int x2150 = x2148 == 'g'; if (x2150) { x2152 = 0/*false*/; x2153 = x2148; char *x2151 = x2147+1; x2154 = x2151; } else { x2154 = x2147; } } int x2166 = x2152; if (x2166) { char *x2167 = x2154; x1883 = 0; } else { char x2170 = x2153; char *x2171 = x2154; int x2176 = 1/*true*/; char x2177 = '\0'; char *x2178 = 0/*null*/; char x2172 = x2171[0]; int x2173 = x2172 == '\0'; if (x2173) { x2178 = x2171; } else { int x2174 = x2172 == 't'; if (x2174) { x2176 = 0/*false*/; x2177 = x2172; char *x2175 = x2171+1; x2178 = x2175; } else { x2178 = x2171; } } int x2190 = x2176; if (x2190) { char *x2191 = x2178; x1883 = 0; } else { char x2194 = x2177; char *x2195 = x2178; int x2200 = 1/*true*/; char x2201 = '\0'; char *x2202 = 0/*null*/; char x2196 = x2195[0]; int x2197 = x2196 == '\0'; if (x2197) { x2202 = x2195; } else { int x2198 = x2196 == 'h'; if (x2198) { x2200 = 0/*false*/; x2201 = x2196; char *x2199 = x2195+1; x2202 = x2199; } else { x2202 = x2195; } } int x2214 = x2200; if (x2214) { char *x2215 = x2202; x1883 = 0; } else { char x2218 = x2201; char *x2219 = x2202; x1883 = x2219; } } } } } } } } } } } } } } char *x2249 = x1883; return x2249; }
#include <string.h> /*@ requires ((strlen(x1881)>=0) && \valid(x1881+(0..(strlen(x1881)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */
frama_c_files_v2/test_frama_c_2236.c
#include <limits.h> #include <string.h> char * p_chunked(char * x1637); char * p_(char * x1639); char * p_TransferEncoding(char * x1641); char * p_ContentLength(char * x1643); char * p_HTTP(char * x1645); /*@ requires ((strlen(x0)>=0) && \valid(x0+(0..(strlen(x0)+1)-1))); assigns \nothing; */ int p(char * x0) { int x2 = -1; char *x3 = p_HTTP(x0); int x5 = 1/*true*/; int x6 = 0; char *x7 = 0/*null*/; int x8 = 1/*true*/; int x9 = 0; char *x10 = 0/*null*/; int x11 = 1/*true*/; int x12 = 0; char *x13 = 0/*null*/; int x14 = 1/*true*/; int x15 = 0; char *x16 = 0/*null*/; int x17 = 1/*true*/; char *x19 = 0/*null*/; int x20 = 1/*true*/; char *x22 = 0/*null*/; int x23 = 1/*true*/; char x24 = '\0'; char *x25 = 0/*null*/; int x26 = 1/*true*/; char *x28 = 0/*null*/; int x29 = 1/*true*/; char *x31 = 0/*null*/; int x32 = 0 == x3; if (x32) { x31 = x0; } else { x29 = 0/*false*/; x31 = x3; } int x40 = x29; if (x40) { char *x41 = x31; x28 = x41; } else { char *x45 = x31; int x52 = 1/*true*/; char x53 = '\0'; char *x54 = 0/*null*/; char x46 = x45[0]; int x47 = x46 == '\0'; if (x47) { x54 = x45; } else { int x48 = x46 >= '0'; int x50; if (x48) { int x49 = x46 <= '9'; x50 = x49; } else { x50 = 0/*false*/; } if (x50) { x52 = 0/*false*/; x53 = x46; char *x51 = x45+1; x54 = x51; } else { x54 = x45; } } int x66 = x52; if (x66) { char *x67 = x54; x28 = x67; } else { char x70 = x53; char *x71 = x54; char *x72 = x71; int x73 = 1/*true*/; /*@ loop invariant ((strlen(x72)>=0) && \valid(x72+(0..(strlen(x72)+1)-1))); loop assigns x72, x73; */ for (;;) { int x74 = x73; if (!x74) break; char *x76 = x72; char x77 = x76[0]; int x78 = x77 == '\0'; if (x78) { x73 = 0/*false*/; } else { int x79 = x77 >= '0'; int x81; if (x79) { int x80 = x77 <= '9'; x81 = x80; } else { x81 = 0/*false*/; } if (x81) { char *x82 = x76+1; x72 = x82; } else { x73 = 0/*false*/; } } } char *x108 = x72; x26 = 0/*false*/; x28 = x108; } } int x116 = x26; if (x116) { char *x117 = x28; x25 = x117; } else { char *x121 = x28; char x122 = x121[0]; int x123 = x122 == '\0'; if (x123) { x25 = x121; } else { int x124 = x122 == '.'; if (x124) { x23 = 0/*false*/; x24 = x122; char *x125 = x121+1; x25 = x125; } else { x25 = x121; } } } int x139 = x23; if (x139) { char *x140 = x25; x22 = x140; } else { char x143 = x24; char *x144 = x25; int x151 = 1/*true*/; char x152 = '\0'; char *x153 = 0/*null*/; char x145 = x144[0]; int x146 = x145 == '\0'; if (x146) { x153 = x144; } else { int x147 = x145 >= '0'; int x149; if (x147) { int x148 = x145 <= '9'; x149 = x148; } else { x149 = 0/*false*/; } if (x149) { x151 = 0/*false*/; x152 = x145; char *x150 = x144+1; x153 = x150; } else { x153 = x144; } } int x165 = x151; if (x165) { char *x166 = x153; x22 = x166; } else { char x169 = x152; char *x170 = x153; char *x171 = x170; int x172 = 1/*true*/; /*@ loop invariant ((strlen(x171)>=0) && \valid(x171+(0..(strlen(x171)+1)-1))); loop assigns x171, x172; */ for (;;) { int x173 = x172; if (!x173) break; char *x175 = x171; char x176 = x175[0]; int x177 = x176 == '\0'; if (x177) { x172 = 0/*false*/; } else { int x178 = x176 >= '0'; int x180; if (x178) { int x179 = x176 <= '9'; x180 = x179; } else { x180 = 0/*false*/; } if (x180) { char *x181 = x175+1; x171 = x181; } else { x172 = 0/*false*/; } } } char *x207 = x171; x20 = 0/*false*/; x22 = x207; } } int x215 = x20; if (x215) { char *x216 = x22; x19 = x216; } else { char *x220 = x22; char *x221 = x220; int x222 = 1/*true*/; /*@ loop invariant ((strlen(x221)>=0) && \valid(x221+(0..(strlen(x221)+1)-1))); loop assigns x221, x222; */ for (;;) { int x223 = x222; if (!x223) break; char *x225 = x221; char x226 = x225[0]; int x227 = x226 == '\0'; if (x227) { x222 = 0/*false*/; } else { int x228 = x226 == ' '; if (x228) { char *x229 = x225+1; x221 = x229; } else { x222 = 0/*false*/; } } } char *x255 = x221; x17 = 0/*false*/; x19 = x255; } int x261 = x17; if (x261) { char *x262 = x19; x16 = x262; } else { char *x266 = x19; int x273 = 1/*true*/; int x274 = 0; char *x275 = 0/*null*/; int x276 = 1/*true*/; char x277 = '\0'; char *x278 = 0/*null*/; char x267 = x266[0]; int x268 = x267 == '\0'; if (x268) { x278 = x266; } else { int x269 = x267 >= '0'; int x271; if (x269) { int x270 = x267 <= '9'; x271 = x270; } else { x271 = 0/*false*/; } if (x271) { x276 = 0/*false*/; x277 = x267; char *x272 = x266+1; x278 = x272; } else { x278 = x266; } } int x290 = x276; if (x290) { char *x291 = x278; x275 = x291; } else { char x294 = x277; char *x296 = x278; x273 = 0/*false*/; char x295 = x294 - '0'; x274 = x295; x275 = x296; } int x302 = x273; if (x302) { char *x303 = x275; x16 = x303; } else { int x306 = x274; char *x307 = x275; char *x308 = x307; int x309 = 1/*true*/; int x310 = x306; int x343 = INT_MAX; int x344 = x343 / 10; int x345 = x344 - 10; /*@ loop invariant (((strlen(x308)>=0) && \valid(x308+(0..(strlen(x308)+1)-1))) && ((x310==-1) || (0<=x310))); loop assigns x308, x309, x310; */ for (;;) { int x311 = x309; if (!x311) break; char *x313 = x308; int x320 = 1/*true*/; char x321 = '\0'; char *x322 = 0/*null*/; char x314 = x313[0]; int x315 = x314 == '\0'; if (x315) { x322 = x313; } else { int x316 = x314 >= '0'; int x318; if (x316) { int x317 = x314 <= '9'; x318 = x317; } else { x318 = 0/*false*/; } if (x318) { x320 = 0/*false*/; x321 = x314; char *x319 = x313+1; x322 = x319; } else { x322 = x313; } } int x334 = x320; if (x334) { char *x335 = x322; x309 = 0/*false*/; } else { char x338 = x321; char *x340 = x322; int x341 = x310; int x342 = x341 < 0; int x350; if (x342) { x350 = x341; } else { int x346 = x341 > x345; int x349; if (x346) { x349 = -1; } else { char x339 = x338 - '0'; int x347 = x341 * 10; int x348 = x347 + x339; x349 = x348; } x350 = x349; } x310 = x350; x308 = x340; } } int x378 = x310; char *x379 = x308; x14 = 0/*false*/; x15 = x378; x16 = x379; } } int x387 = x14; if (x387) { char *x388 = x16; x13 = x388; } else { int x391 = x15; char *x392 = x16; char *x393 = x392; int x394 = 1/*true*/; /*@ loop invariant ((strlen(x393)>=0) && \valid(x393+(0..(strlen(x393)+1)-1))); loop assigns x393, x394; */ for (;;) { int x395 = x394; if (!x395) break; char *x397 = x393; char x398 = x397[0]; int x399 = x398 == '\0'; if (x399) { x394 = 0/*false*/; } else { int x404 = x398 == '\r'; if (x404) { x394 = 0/*false*/; } else { char *x401 = x397+1; x393 = x401; } } } char *x428 = x393; int x429 = 1/*true*/; char *x431 = 0/*null*/; x429 = 0/*false*/; x431 = x428; int x435 = x429; if (x435) { char *x436 = x431; x13 = x436; } else { char *x440 = x431; char *x441 = p_(x440); int x443 = 1/*true*/; char *x445 = 0/*null*/; int x446 = 0 == x441; if (x446) { x445 = x440; } else { x443 = 0/*false*/; x445 = x441; } int x454 = x443; if (x454) { char *x455 = x445; x13 = x455; } else { char *x459 = x445; x11 = 0/*false*/; x12 = x391; x13 = x459; } } } int x469 = x11; if (x469) { char *x470 = x13; x10 = x470; } else { int x473 = x12; char *x474 = x13; char *x475 = x474; int x476 = 1/*true*/; int x477 = 0; int x343 = INT_MAX; int x344 = x343 / 10; int x345 = x344 - 10; int x1122 = -2 == -2; /*@ loop invariant ((strlen(x475)>=0) && \valid(x475+(0..(strlen(x475)+1)-1))); loop assigns x475, x476, x477; */ for (;;) { int x478 = x476; if (!x478) break; char *x480 = x475; char *x481 = p_ContentLength(x480); int x483 = 1/*true*/; int x484 = 0; char *x485 = 0/*null*/; int x486 = 1/*true*/; int x487 = 0; char *x488 = 0/*null*/; int x489 = 1/*true*/; int x490 = 0; char *x491 = 0/*null*/; int x492 = 1/*true*/; int x493 = 0; char *x494 = 0/*null*/; int x495 = 1/*true*/; int x496 = 0; char *x497 = 0/*null*/; int x498 = 1/*true*/; int x499 = 0; char *x500 = 0/*null*/; int x501 = 1/*true*/; char *x503 = 0/*null*/; int x504 = 0 == x481; if (x504) { x503 = x480; } else { x501 = 0/*false*/; x503 = x481; } int x512 = x501; if (x512) { char *x513 = x503; } else { char *x516 = x503; x498 = 0/*false*/; x499 = 1; x500 = x516; } int x522 = x498; if (x522) { char *x523 = p_TransferEncoding(x480); int x525 = 1/*true*/; char *x527 = 0/*null*/; int x528 = 0 == x523; if (x528) { x527 = x480; } else { x525 = 0/*false*/; x527 = x523; } int x536 = x525; if (x536) { char *x537 = x527; } else { char *x540 = x527; x495 = 0/*false*/; x496 = 2; x497 = x540; } } else { int x547 = x499; char *x548 = x500; x495 = 0/*false*/; x496 = x547; x497 = x548; } int x554 = x495; if (x554) { char *x555 = x480; int x556 = 1/*true*/; /*@ loop invariant ((strlen(x555)>=0) && \valid(x555+(0..(strlen(x555)+1)-1))); loop assigns x555, x556; */ for (;;) { int x557 = x556; if (!x557) break; char *x559 = x555; char x560 = x559[0]; int x561 = x560 == '\0'; if (x561) { x556 = 0/*false*/; } else { int x563 = x560 == ':'; int x565; if (x563) { x565 = 0/*false*/; } else { int x564 = x560 != ' '; x565 = x564; } if (x565) { char *x566 = x559+1; x555 = x566; } else { x556 = 0/*false*/; } } } char *x592 = x555; x492 = 0/*false*/; x493 = 0; x494 = x592; } else { int x597 = x496; char *x598 = x497; x492 = 0/*false*/; x493 = x597; x494 = x598; } int x604 = x492; if (x604) { char *x605 = x494; x491 = x605; } else { int x608 = x493; char *x609 = x494; char *x610 = x609; int x611 = 1/*true*/; /*@ loop invariant ((strlen(x610)>=0) && \valid(x610+(0..(strlen(x610)+1)-1))); loop assigns x610, x611; */ for (;;) { int x612 = x611; if (!x612) break; char *x614 = x610; char x615 = x614[0]; int x616 = x615 == '\0'; if (x616) { x611 = 0/*false*/; } else { int x617 = x615 == ' '; if (x617) { char *x618 = x614+1; x610 = x618; } else { x611 = 0/*false*/; } } } char *x644 = x610; x489 = 0/*false*/; x490 = x608; x491 = x644; } int x650 = x489; if (x650) { char *x651 = x491; x488 = x651; } else { int x654 = x490; char *x655 = x491; int x660 = 1/*true*/; char x661 = '\0'; char *x662 = 0/*null*/; char x656 = x655[0]; int x657 = x656 == '\0'; if (x657) { x662 = x655; } else { int x658 = x656 == ':'; if (x658) { x660 = 0/*false*/; x661 = x656; char *x659 = x655+1; x662 = x659; } else { x662 = x655; } } int x674 = x660; if (x674) { char *x675 = x662; x488 = x675; } else { char x678 = x661; char *x679 = x662; x486 = 0/*false*/; x487 = x654; x488 = x679; } } int x687 = x486; if (x687) { char *x688 = x488; x485 = x688; } else { int x691 = x487; char *x692 = x488; char *x693 = x692; int x694 = 1/*true*/; /*@ loop invariant ((strlen(x693)>=0) && \valid(x693+(0..(strlen(x693)+1)-1))); loop assigns x693, x694; */ for (;;) { int x695 = x694; if (!x695) break; char *x697 = x693; char x698 = x697[0]; int x699 = x698 == '\0'; if (x699) { x694 = 0/*false*/; } else { int x700 = x698 == ' '; if (x700) { char *x701 = x697+1; x693 = x701; } else { x694 = 0/*false*/; } } } char *x727 = x693; x483 = 0/*false*/; x484 = x691; x485 = x727; } int x733 = x483; if (x733) { char *x734 = x485; x476 = 0/*false*/; } else { int x737 = x484; char *x738 = x485; char *x740 = p_chunked(x738); char *x749 = x738; int x750 = 1/*true*/; /*@ loop invariant ((strlen(x749)>=0) && \valid(x749+(0..(strlen(x749)+1)-1))); loop assigns x749, x750; */ for (;;) { int x751 = x750; if (!x751) break; char *x753 = x749; char x754 = x753[0]; int x755 = x754 == '\0'; if (x755) { x750 = 0/*false*/; } else { int x760 = x754 == '\r'; if (x760) { x750 = 0/*false*/; } else { char *x757 = x753+1; x749 = x757; } } } char *x784 = x749; int x739 = x737 == 2; if (x739) { int x785 = 1/*true*/; int x786 = 0; char *x787 = 0/*null*/; int x788 = 1/*true*/; int x789 = 0; char *x790 = 0/*null*/; int x791 = 1/*true*/; char *x793 = 0/*null*/; int x794 = 0 == x740; if (x794) { x793 = x738; } else { x791 = 0/*false*/; x793 = x740; } int x802 = x791; if (x802) { char *x803 = x793; x790 = x803; } else { char *x807 = x793; x788 = 0/*false*/; x789 = -3; x790 = x807; } int x813 = x788; if (x813) { char *x814 = x790; x787 = x814; } else { int x817 = x789; char *x818 = x790; char *x819 = x818; int x820 = 1/*true*/; /*@ loop invariant ((strlen(x819)>=0) && \valid(x819+(0..(strlen(x819)+1)-1))); loop assigns x819, x820; */ for (;;) { int x821 = x820; if (!x821) break; char *x823 = x819; char x824 = x823[0]; int x825 = x824 == '\0'; if (x825) { x820 = 0/*false*/; } else { int x826 = x824 == ' '; if (x826) { char *x827 = x823+1; x819 = x827; } else { x820 = 0/*false*/; } } } char *x853 = x819; x785 = 0/*false*/; x786 = x817; x787 = x853; } int x859 = x785; if (x859) { char *x860 = x787; x476 = 0/*false*/; } else { int x863 = x786; char *x864 = x787; char *x865 = p_(x864); int x867 = 1/*true*/; char *x869 = 0/*null*/; int x870 = 0 == x865; if (x870) { x869 = x864; } else { x867 = 0/*false*/; x869 = x865; } int x878 = x867; if (x878) { char *x879 = x869; x476 = 0/*false*/; } else { char *x883 = x869; int x884 = x477; int x885 = x863 == -2; int x886; if (x885) { x886 = x884; } else { x886 = x863; } x477 = x886; x475 = x883; } } } else { int x742 = x737 == 1; if (x742) { int x894 = 1/*true*/; int x895 = 0; char *x896 = 0/*null*/; int x897 = 1/*true*/; int x898 = 0; char *x899 = 0/*null*/; int x900 = 1/*true*/; int x901 = 0; char *x902 = 0/*null*/; int x903 = 1/*true*/; char x904 = '\0'; char *x905 = 0/*null*/; char x743 = x738[0]; int x744 = x743 == '\0'; if (x744) { x905 = x738; } else { int x745 = x743 >= '0'; int x747; if (x745) { int x746 = x743 <= '9'; x747 = x746; } else { x747 = 0/*false*/; } if (x747) { x903 = 0/*false*/; x904 = x743; char *x748 = x738+1; x905 = x748; } else { x905 = x738; } } int x917 = x903; if (x917) { char *x918 = x905; x902 = x918; } else { char x921 = x904; char *x923 = x905; x900 = 0/*false*/; char x922 = x921 - '0'; x901 = x922; x902 = x923; } int x929 = x900; if (x929) { char *x930 = x902; x899 = x930; } else { int x933 = x901; char *x934 = x902; char *x935 = x934; int x936 = 1/*true*/; int x937 = x933; /*@ loop invariant (((strlen(x935)>=0) && \valid(x935+(0..(strlen(x935)+1)-1))) && ((x937==-1) || (0<=x937))); loop assigns x935, x936, x937; */ for (;;) { int x938 = x936; if (!x938) break; char *x940 = x935; int x947 = 1/*true*/; char x948 = '\0'; char *x949 = 0/*null*/; char x941 = x940[0]; int x942 = x941 == '\0'; if (x942) { x949 = x940; } else { int x943 = x941 >= '0'; int x945; if (x943) { int x944 = x941 <= '9'; x945 = x944; } else { x945 = 0/*false*/; } if (x945) { x947 = 0/*false*/; x948 = x941; char *x946 = x940+1; x949 = x946; } else { x949 = x940; } } int x961 = x947; if (x961) { char *x962 = x949; x936 = 0/*false*/; } else { char x965 = x948; char *x967 = x949; int x968 = x937; int x969 = x968 < 0; int x974; if (x969) { x974 = x968; } else { int x970 = x968 > x345; int x973; if (x970) { x973 = -1; } else { char x966 = x965 - '0'; int x971 = x968 * 10; int x972 = x971 + x966; x973 = x972; } x974 = x973; } x937 = x974; x935 = x967; } } int x1002 = x937; char *x1003 = x935; x897 = 0/*false*/; x898 = x1002; x899 = x1003; } int x1009 = x897; if (x1009) { char *x1010 = x899; x896 = x1010; } else { int x1013 = x898; char *x1014 = x899; char *x1015 = x1014; int x1016 = 1/*true*/; /*@ loop invariant ((strlen(x1015)>=0) && \valid(x1015+(0..(strlen(x1015)+1)-1))); loop assigns x1015, x1016; */ for (;;) { int x1017 = x1016; if (!x1017) break; char *x1019 = x1015; char x1020 = x1019[0]; int x1021 = x1020 == '\0'; if (x1021) { x1016 = 0/*false*/; } else { int x1022 = x1020 == ' '; if (x1022) { char *x1023 = x1019+1; x1015 = x1023; } else { x1016 = 0/*false*/; } } } char *x1049 = x1015; x894 = 0/*false*/; x895 = x1013; x896 = x1049; } int x1055 = x894; if (x1055) { char *x1056 = x896; x476 = 0/*false*/; } else { int x1059 = x895; char *x1060 = x896; char *x1061 = p_(x1060); int x1063 = 1/*true*/; char *x1065 = 0/*null*/; int x1066 = 0 == x1061; if (x1066) { x1065 = x1060; } else { x1063 = 0/*false*/; x1065 = x1061; } int x1074 = x1063; if (x1074) { char *x1075 = x1065; x476 = 0/*false*/; } else { char *x1079 = x1065; int x1080 = x477; int x1081 = x1059 == -2; int x1082; if (x1081) { x1082 = x1080; } else { x1082 = x1059; } x477 = x1082; x475 = x1079; } } } else { int x1090 = 1/*true*/; char *x1092 = 0/*null*/; x1090 = 0/*false*/; x1092 = x784; int x1096 = x1090; if (x1096) { char *x1097 = x1092; x476 = 0/*false*/; } else { char *x1101 = x1092; char *x1102 = p_(x1101); int x1104 = 1/*true*/; char *x1106 = 0/*null*/; int x1107 = 0 == x1102; if (x1107) { x1106 = x1101; } else { x1104 = 0/*false*/; x1106 = x1102; } int x1115 = x1104; if (x1115) { char *x1116 = x1106; x476 = 0/*false*/; } else { char *x1120 = x1106; int x1121 = x477; int x1123; if (x1122) { x1123 = x1121; } else { x1123 = -2; } x477 = x1123; x475 = x1120; } } } } } } int x1154 = x477; char *x1155 = x475; x8 = 0/*false*/; x9 = x1154; x10 = x1155; } int x1161 = x8; if (x1161) { char *x1162 = x10; x7 = x1162; } else { int x1165 = x9; char *x1166 = x10; char *x1167 = p_(x1166); int x1169 = 1/*true*/; char *x1171 = 0/*null*/; int x1172 = 0 == x1167; if (x1172) { x1171 = x1166; } else { x1169 = 0/*false*/; x1171 = x1167; } int x1180 = x1169; if (x1180) { char *x1181 = x1171; x7 = x1181; } else { char *x1185 = x1171; x5 = 0/*false*/; x6 = x1165; x7 = x1185; } } int x1193 = x5; if (x1193) { char *x1194 = x7; } else { int x1196 = x6; char *x1197 = x7; char *x1199 = x1197; int x1200 = 1/*true*/; int x1201 = 0; int x343 = INT_MAX; int x1361 = x343 / 16; int x1362 = x1361 - 16; /*@ loop invariant (((strlen(x1199)>=0) && \valid(x1199+(0..(strlen(x1199)+1)-1))) && ((x1201==-1) || (0<=x1201))); loop assigns x1199, x1200, x1201; */ for (;;) { int x1202 = x1200; if (!x1202) break; char *x1204 = x1199; int x1211 = 1/*true*/; int x1212 = 0; char *x1213 = 0/*null*/; int x1214 = 1/*true*/; int x1215 = 0; char *x1216 = 0/*null*/; int x1217 = 1/*true*/; int x1218 = 0; char *x1219 = 0/*null*/; int x1220 = 1/*true*/; int x1221 = 0; char *x1222 = 0/*null*/; int x1223 = 1/*true*/; char x1224 = '\0'; char *x1225 = 0/*null*/; char x1205 = x1204[0]; int x1206 = x1205 == '\0'; if (x1206) { x1225 = x1204; } else { int x1207 = x1205 >= '0'; int x1209; if (x1207) { int x1208 = x1205 <= '9'; x1209 = x1208; } else { x1209 = 0/*false*/; } if (x1209) { x1223 = 0/*false*/; x1224 = x1205; char *x1210 = x1204+1; x1225 = x1210; } else { x1225 = x1204; } } int x1237 = x1223; if (x1237) { char *x1238 = x1225; } else { char x1240 = x1224; char *x1242 = x1225; x1220 = 0/*false*/; char x1241 = x1240 - '0'; x1221 = x1241; x1222 = x1242; } int x1248 = x1220; if (x1248) { int x1252 = 1/*true*/; char x1253 = '\0'; char *x1254 = 0/*null*/; if (x1206) { x1254 = x1204; } else { int x1249 = x1205 >= 'a'; int x1251; if (x1249) { int x1250 = x1205 <= 'f'; x1251 = x1250; } else { x1251 = 0/*false*/; } if (x1251) { x1252 = 0/*false*/; x1253 = x1205; char *x1210 = x1204+1; x1254 = x1210; } else { x1254 = x1204; } } int x1266 = x1252; if (x1266) { char *x1267 = x1254; x1219 = x1267; } else { char x1270 = x1253; char *x1273 = x1254; x1217 = 0/*false*/; char x1271 = x1270 - 'a'; int x1272 = 10 + x1271; x1218 = x1272; x1219 = x1273; } } else { int x1280 = x1221; char *x1281 = x1222; x1217 = 0/*false*/; x1218 = x1280; x1219 = x1281; } int x1287 = x1217; if (x1287) { char *x1288 = x1219; x1216 = x1288; } else { int x1291 = x1218; char *x1292 = x1219; char *x1293 = x1292; int x1294 = 1/*true*/; int x1295 = x1291; /*@ loop invariant (((strlen(x1293)>=0) && \valid(x1293+(0..(strlen(x1293)+1)-1))) && ((x1295==-1) || (0<=x1295))); loop assigns x1293, x1294, x1295; */ for (;;) { int x1296 = x1294; if (!x1296) break; char *x1298 = x1293; int x1305 = 1/*true*/; int x1306 = 0; char *x1307 = 0/*null*/; int x1308 = 1/*true*/; char x1309 = '\0'; char *x1310 = 0/*null*/; char x1299 = x1298[0]; int x1300 = x1299 == '\0'; if (x1300) { x1310 = x1298; } else { int x1301 = x1299 >= '0'; int x1303; if (x1301) { int x1302 = x1299 <= '9'; x1303 = x1302; } else { x1303 = 0/*false*/; } if (x1303) { x1308 = 0/*false*/; x1309 = x1299; char *x1304 = x1298+1; x1310 = x1304; } else { x1310 = x1298; } } int x1322 = x1308; if (x1322) { char *x1323 = x1310; } else { char x1325 = x1309; char *x1327 = x1310; x1305 = 0/*false*/; char x1326 = x1325 - '0'; x1306 = x1326; x1307 = x1327; } int x1333 = x1305; if (x1333) { int x1337 = 1/*true*/; char x1338 = '\0'; char *x1339 = 0/*null*/; if (x1300) { x1339 = x1298; } else { int x1334 = x1299 >= 'a'; int x1336; if (x1334) { int x1335 = x1299 <= 'f'; x1336 = x1335; } else { x1336 = 0/*false*/; } if (x1336) { x1337 = 0/*false*/; x1338 = x1299; char *x1304 = x1298+1; x1339 = x1304; } else { x1339 = x1298; } } int x1351 = x1337; if (x1351) { char *x1352 = x1339; x1294 = 0/*false*/; } else { char x1355 = x1338; char *x1358 = x1339; int x1359 = x1295; int x1360 = x1359 < 0; int x1367; if (x1360) { x1367 = x1359; } else { int x1363 = x1359 > x1362; int x1366; if (x1363) { x1366 = -1; } else { char x1356 = x1355 - 'a'; int x1357 = 10 + x1356; int x1364 = x1359 * 16; int x1365 = x1364 + x1357; x1366 = x1365; } x1367 = x1366; } x1295 = x1367; x1293 = x1358; } } else { int x1373 = x1306; char *x1374 = x1307; int x1375 = x1295; int x1376 = x1375 < 0; int x1381; if (x1376) { x1381 = x1375; } else { int x1377 = x1375 > x1362; int x1380; if (x1377) { x1380 = -1; } else { int x1378 = x1375 * 16; int x1379 = x1378 + x1373; x1380 = x1379; } x1381 = x1380; } x1295 = x1381; x1293 = x1374; } } int x1409 = x1295; char *x1410 = x1293; x1214 = 0/*false*/; x1215 = x1409; x1216 = x1410; } int x1416 = x1214; if (x1416) { char *x1417 = x1216; x1213 = x1417; } else { int x1420 = x1215; char *x1421 = x1216; char *x1422 = p_(x1421); int x1424 = 1/*true*/; char *x1426 = 0/*null*/; int x1427 = 0 == x1422; if (x1427) { x1426 = x1421; } else { x1424 = 0/*false*/; x1426 = x1422; } int x1435 = x1424; if (x1435) { char *x1436 = x1426; x1213 = x1436; } else { char *x1440 = x1426; x1211 = 0/*false*/; x1212 = x1420; x1213 = x1440; } } int x1448 = x1211; if (x1448) { char *x1449 = x1213; x1200 = 0/*false*/; } else { int x1452 = x1212; char *x1453 = x1213; int x1455 = 1/*true*/; char *x1456 = x1453; /*@ loop invariant ((0<=x1458) && ((strlen(x1456)>=0) && \valid(x1456+(0..(strlen(x1456)+1)-1)))); loop assigns x1458, x1455, x1456; loop variant (x1452-x1458); */ for(int x1458=0; x1458 < x1452; x1458++) { int x1459 = x1455; if (x1459) { char *x1460 = x1456; char x1461 = x1460[0]; int x1462 = x1461 == '\0'; if (x1462) { x1455 = 0/*false*/; } else { char *x1463 = x1460+1; x1456 = x1463; } } else { } } int x1492 = x1455; char *x1493 = x1456; int x1454 = x1452 < 0; if (x1454) { x1200 = 0/*false*/; } else { int x1496 = 1/*true*/; char *x1498 = 0/*null*/; if (x1492) { x1496 = 0/*false*/; x1498 = x1493; } else { x1498 = x1453; } int x1506 = x1496; if (x1506) { char *x1507 = x1498; x1200 = 0/*false*/; } else { char *x1511 = x1498; int x1512 = x1201; int x1513 = x1512 < 0; int x1518; if (x1513) { x1518 = x1512; } else { int x1514 = x343 - x1452; int x1515 = x1512 > x1514; int x1517; if (x1515) { x1517 = -1; } else { int x1516 = x1512 + x1452; x1517 = x1516; } x1518 = x1517; } x1201 = x1518; x1199 = x1511; } } } } int x1550 = x1201; char *x1551 = x1199; int x1553 = 1/*true*/; char *x1554 = x1197; /*@ loop invariant ((0<=x1556) && ((strlen(x1554)>=0) && \valid(x1554+(0..(strlen(x1554)+1)-1)))); loop assigns x1556, x1553, x1554; loop variant (x1196-x1556); */ for(int x1556=0; x1556 < x1196; x1556++) { int x1557 = x1553; if (x1557) { char *x1558 = x1554; char x1559 = x1558[0]; int x1560 = x1559 == '\0'; if (x1560) { x1553 = 0/*false*/; } else { char *x1561 = x1558+1; x1554 = x1561; } } else { } } int x1590 = x1553; char *x1591 = x1554; int x1198 = x1196 == -3; if (x1198) { char x1592 = x1551[0]; int x1593 = x1592 == '\0'; if (x1593) { x2 = x1550; } else { } } else { int x1552 = x1196 < 0; if (x1552) { } else { int x1598 = 1/*true*/; char *x1600 = 0/*null*/; if (x1590) { x1598 = 0/*false*/; x1600 = x1591; } else { x1600 = x1197; } int x1608 = x1598; if (x1608) { char *x1609 = x1600; } else { char *x1612 = x1600; char x1613 = x1612[0]; int x1614 = x1613 == '\0'; if (x1614) { x2 = x1196; } else { } } } } } int x1626 = x2; return x1626; } /*@ requires ((strlen(x1647)>=0) && \valid(x1647+(0..(strlen(x1647)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_HTTP(char * x1647) { char *x1649 = x1647; int x1654 = 1/*true*/; char x1655 = '\0'; char *x1656 = 0/*null*/; char x1650 = x1647[0]; int x1651 = x1650 == '\0'; if (x1651) { x1656 = x1647; } else { int x1652 = x1650 == 'H'; if (x1652) { x1654 = 0/*false*/; x1655 = x1650; char *x1653 = x1647+1; x1656 = x1653; } else { x1656 = x1647; } } int x1668 = x1654; if (x1668) { char *x1669 = x1656; x1649 = 0; } else { char x1672 = x1655; char *x1673 = x1656; int x1678 = 1/*true*/; char x1679 = '\0'; char *x1680 = 0/*null*/; char x1674 = x1673[0]; int x1675 = x1674 == '\0'; if (x1675) { x1680 = x1673; } else { int x1676 = x1674 == 'T'; if (x1676) { x1678 = 0/*false*/; x1679 = x1674; char *x1677 = x1673+1; x1680 = x1677; } else { x1680 = x1673; } } int x1692 = x1678; if (x1692) { char *x1693 = x1680; x1649 = 0; } else { char x1696 = x1679; char *x1697 = x1680; int x1702 = 1/*true*/; char x1703 = '\0'; char *x1704 = 0/*null*/; char x1698 = x1697[0]; int x1699 = x1698 == '\0'; if (x1699) { x1704 = x1697; } else { int x1700 = x1698 == 'T'; if (x1700) { x1702 = 0/*false*/; x1703 = x1698; char *x1701 = x1697+1; x1704 = x1701; } else { x1704 = x1697; } } int x1716 = x1702; if (x1716) { char *x1717 = x1704; x1649 = 0; } else { char x1720 = x1703; char *x1721 = x1704; int x1726 = 1/*true*/; char x1727 = '\0'; char *x1728 = 0/*null*/; char x1722 = x1721[0]; int x1723 = x1722 == '\0'; if (x1723) { x1728 = x1721; } else { int x1724 = x1722 == 'P'; if (x1724) { x1726 = 0/*false*/; x1727 = x1722; char *x1725 = x1721+1; x1728 = x1725; } else { x1728 = x1721; } } int x1740 = x1726; if (x1740) { char *x1741 = x1728; x1649 = 0; } else { char x1744 = x1727; char *x1745 = x1728; int x1750 = 1/*true*/; char x1751 = '\0'; char *x1752 = 0/*null*/; char x1746 = x1745[0]; int x1747 = x1746 == '\0'; if (x1747) { x1752 = x1745; } else { int x1748 = x1746 == '/'; if (x1748) { x1750 = 0/*false*/; x1751 = x1746; char *x1749 = x1745+1; x1752 = x1749; } else { x1752 = x1745; } } int x1764 = x1750; if (x1764) { char *x1765 = x1752; x1649 = 0; } else { char x1768 = x1751; char *x1769 = x1752; x1649 = x1769; } } } } } char *x1781 = x1649; return x1781; } /*@ requires ((strlen(x1803)>=0) && \valid(x1803+(0..(strlen(x1803)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_(char * x1803) { char *x1805 = x1803; int x1810 = 1/*true*/; char x1811 = '\0'; char *x1812 = 0/*null*/; char x1806 = x1803[0]; int x1807 = x1806 == '\0'; if (x1807) { x1812 = x1803; } else { int x1808 = x1806 == '\r'; if (x1808) { x1810 = 0/*false*/; x1811 = x1806; char *x1809 = x1803+1; x1812 = x1809; } else { x1812 = x1803; } } int x1824 = x1810; if (x1824) { char *x1825 = x1812; x1805 = 0; } else { char x1828 = x1811; char *x1829 = x1812; int x1834 = 1/*true*/; char x1835 = '\0'; char *x1836 = 0/*null*/; char x1830 = x1829[0]; int x1831 = x1830 == '\0'; if (x1831) { x1836 = x1829; } else { int x1832 = x1830 == '\n'; if (x1832) { x1834 = 0/*false*/; x1835 = x1830; char *x1833 = x1829+1; x1836 = x1833; } else { x1836 = x1829; } } int x1848 = x1834; if (x1848) { char *x1849 = x1836; x1805 = 0; } else { char x1852 = x1835; char *x1853 = x1836; x1805 = x1853; } } char *x1859 = x1805; return x1859; } /*@ requires ((strlen(x1881)>=0) && \valid(x1881+(0..(strlen(x1881)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_ContentLength(char * x1881) { char *x1883 = x1881; int x1888 = 1/*true*/; char x1889 = '\0'; char *x1890 = 0/*null*/; char x1884 = x1881[0]; int x1885 = x1884 == '\0'; if (x1885) { x1890 = x1881; } else { int x1886 = x1884 == 'C'; if (x1886) { x1888 = 0/*false*/; x1889 = x1884; char *x1887 = x1881+1; x1890 = x1887; } else { x1890 = x1881; } } int x1902 = x1888; if (x1902) { char *x1903 = x1890; x1883 = 0; } else { char x1906 = x1889; char *x1907 = x1890; int x1912 = 1/*true*/; char x1913 = '\0'; char *x1914 = 0/*null*/; char x1908 = x1907[0]; int x1909 = x1908 == '\0'; if (x1909) { x1914 = x1907; } else { int x1910 = x1908 == 'o'; if (x1910) { x1912 = 0/*false*/; x1913 = x1908; char *x1911 = x1907+1; x1914 = x1911; } else { x1914 = x1907; } } int x1926 = x1912; if (x1926) { char *x1927 = x1914; x1883 = 0; } else { char x1930 = x1913; char *x1931 = x1914; int x1936 = 1/*true*/; char x1937 = '\0'; char *x1938 = 0/*null*/; char x1932 = x1931[0]; int x1933 = x1932 == '\0'; if (x1933) { x1938 = x1931; } else { int x1934 = x1932 == 'n'; if (x1934) { x1936 = 0/*false*/; x1937 = x1932; char *x1935 = x1931+1; x1938 = x1935; } else { x1938 = x1931; } } int x1950 = x1936; if (x1950) { char *x1951 = x1938; x1883 = 0; } else { char x1954 = x1937; char *x1955 = x1938; int x1960 = 1/*true*/; char x1961 = '\0'; char *x1962 = 0/*null*/; char x1956 = x1955[0]; int x1957 = x1956 == '\0'; if (x1957) { x1962 = x1955; } else { int x1958 = x1956 == 't'; if (x1958) { x1960 = 0/*false*/; x1961 = x1956; char *x1959 = x1955+1; x1962 = x1959; } else { x1962 = x1955; } } int x1974 = x1960; if (x1974) { char *x1975 = x1962; x1883 = 0; } else { char x1978 = x1961; char *x1979 = x1962; int x1984 = 1/*true*/; char x1985 = '\0'; char *x1986 = 0/*null*/; char x1980 = x1979[0]; int x1981 = x1980 == '\0'; if (x1981) { x1986 = x1979; } else { int x1982 = x1980 == 'e'; if (x1982) { x1984 = 0/*false*/; x1985 = x1980; char *x1983 = x1979+1; x1986 = x1983; } else { x1986 = x1979; } } int x1998 = x1984; if (x1998) { char *x1999 = x1986; x1883 = 0; } else { char x2002 = x1985; char *x2003 = x1986; int x2008 = 1/*true*/; char x2009 = '\0'; char *x2010 = 0/*null*/; char x2004 = x2003[0]; int x2005 = x2004 == '\0'; if (x2005) { x2010 = x2003; } else { int x2006 = x2004 == 'n'; if (x2006) { x2008 = 0/*false*/; x2009 = x2004; char *x2007 = x2003+1; x2010 = x2007; } else { x2010 = x2003; } } int x2022 = x2008; if (x2022) { char *x2023 = x2010; x1883 = 0; } else { char x2026 = x2009; char *x2027 = x2010; int x2032 = 1/*true*/; char x2033 = '\0'; char *x2034 = 0/*null*/; char x2028 = x2027[0]; int x2029 = x2028 == '\0'; if (x2029) { x2034 = x2027; } else { int x2030 = x2028 == 't'; if (x2030) { x2032 = 0/*false*/; x2033 = x2028; char *x2031 = x2027+1; x2034 = x2031; } else { x2034 = x2027; } } int x2046 = x2032; if (x2046) { char *x2047 = x2034; x1883 = 0; } else { char x2050 = x2033; char *x2051 = x2034; int x2056 = 1/*true*/; char x2057 = '\0'; char *x2058 = 0/*null*/; char x2052 = x2051[0]; int x2053 = x2052 == '\0'; if (x2053) { x2058 = x2051; } else { int x2054 = x2052 == '-'; if (x2054) { x2056 = 0/*false*/; x2057 = x2052; char *x2055 = x2051+1; x2058 = x2055; } else { x2058 = x2051; } } int x2070 = x2056; if (x2070) { char *x2071 = x2058; x1883 = 0; } else { char x2074 = x2057; char *x2075 = x2058; int x2080 = 1/*true*/; char x2081 = '\0'; char *x2082 = 0/*null*/; char x2076 = x2075[0]; int x2077 = x2076 == '\0'; if (x2077) { x2082 = x2075; } else { int x2078 = x2076 == 'L'; if (x2078) { x2080 = 0/*false*/; x2081 = x2076; char *x2079 = x2075+1; x2082 = x2079; } else { x2082 = x2075; } } int x2094 = x2080; if (x2094) { char *x2095 = x2082; x1883 = 0; } else { char x2098 = x2081; char *x2099 = x2082; int x2104 = 1/*true*/; char x2105 = '\0'; char *x2106 = 0/*null*/; char x2100 = x2099[0]; int x2101 = x2100 == '\0'; if (x2101) { x2106 = x2099; } else { int x2102 = x2100 == 'e'; if (x2102) { x2104 = 0/*false*/; x2105 = x2100; char *x2103 = x2099+1; x2106 = x2103; } else { x2106 = x2099; } } int x2118 = x2104; if (x2118) { char *x2119 = x2106; x1883 = 0; } else { char x2122 = x2105; char *x2123 = x2106; int x2128 = 1/*true*/; char x2129 = '\0'; char *x2130 = 0/*null*/; char x2124 = x2123[0]; int x2125 = x2124 == '\0'; if (x2125) { x2130 = x2123; } else { int x2126 = x2124 == 'n'; if (x2126) { x2128 = 0/*false*/; x2129 = x2124; char *x2127 = x2123+1; x2130 = x2127; } else { x2130 = x2123; } } int x2142 = x2128; if (x2142) { char *x2143 = x2130; x1883 = 0; } else { char x2146 = x2129; char *x2147 = x2130; int x2152 = 1/*true*/; char x2153 = '\0'; char *x2154 = 0/*null*/; char x2148 = x2147[0]; int x2149 = x2148 == '\0'; if (x2149) { x2154 = x2147; } else { int x2150 = x2148 == 'g'; if (x2150) { x2152 = 0/*false*/; x2153 = x2148; char *x2151 = x2147+1; x2154 = x2151; } else { x2154 = x2147; } } int x2166 = x2152; if (x2166) { char *x2167 = x2154; x1883 = 0; } else { char x2170 = x2153; char *x2171 = x2154; int x2176 = 1/*true*/; char x2177 = '\0'; char *x2178 = 0/*null*/; char x2172 = x2171[0]; int x2173 = x2172 == '\0'; if (x2173) { x2178 = x2171; } else { int x2174 = x2172 == 't'; if (x2174) { x2176 = 0/*false*/; x2177 = x2172; char *x2175 = x2171+1; x2178 = x2175; } else { x2178 = x2171; } } int x2190 = x2176; if (x2190) { char *x2191 = x2178; x1883 = 0; } else { char x2194 = x2177; char *x2195 = x2178; int x2200 = 1/*true*/; char x2201 = '\0'; char *x2202 = 0/*null*/; char x2196 = x2195[0]; int x2197 = x2196 == '\0'; if (x2197) { x2202 = x2195; } else { int x2198 = x2196 == 'h'; if (x2198) { x2200 = 0/*false*/; x2201 = x2196; char *x2199 = x2195+1; x2202 = x2199; } else { x2202 = x2195; } } int x2214 = x2200; if (x2214) { char *x2215 = x2202; x1883 = 0; } else { char x2218 = x2201; char *x2219 = x2202; x1883 = x2219; } } } } } } } } } } } } } } char *x2249 = x1883; return x2249; } /*@ requires ((strlen(x2271)>=0) && \valid(x2271+(0..(strlen(x2271)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_TransferEncoding(char * x2271) { char *x2273 = x2271; int x2278 = 1/*true*/; char x2279 = '\0'; char *x2280 = 0/*null*/; char x2274 = x2271[0]; int x2275 = x2274 == '\0'; if (x2275) { x2280 = x2271; } else { int x2276 = x2274 == 'T'; if (x2276) { x2278 = 0/*false*/; x2279 = x2274; char *x2277 = x2271+1; x2280 = x2277; } else { x2280 = x2271; } } int x2292 = x2278; if (x2292) { char *x2293 = x2280; x2273 = 0; } else { char x2296 = x2279; char *x2297 = x2280; int x2302 = 1/*true*/; char x2303 = '\0'; char *x2304 = 0/*null*/; char x2298 = x2297[0]; int x2299 = x2298 == '\0'; if (x2299) { x2304 = x2297; } else { int x2300 = x2298 == 'r'; if (x2300) { x2302 = 0/*false*/; x2303 = x2298; char *x2301 = x2297+1; x2304 = x2301; } else { x2304 = x2297; } } int x2316 = x2302; if (x2316) { char *x2317 = x2304; x2273 = 0; } else { char x2320 = x2303; char *x2321 = x2304; int x2326 = 1/*true*/; char x2327 = '\0'; char *x2328 = 0/*null*/; char x2322 = x2321[0]; int x2323 = x2322 == '\0'; if (x2323) { x2328 = x2321; } else { int x2324 = x2322 == 'a'; if (x2324) { x2326 = 0/*false*/; x2327 = x2322; char *x2325 = x2321+1; x2328 = x2325; } else { x2328 = x2321; } } int x2340 = x2326; if (x2340) { char *x2341 = x2328; x2273 = 0; } else { char x2344 = x2327; char *x2345 = x2328; int x2350 = 1/*true*/; char x2351 = '\0'; char *x2352 = 0/*null*/; char x2346 = x2345[0]; int x2347 = x2346 == '\0'; if (x2347) { x2352 = x2345; } else { int x2348 = x2346 == 'n'; if (x2348) { x2350 = 0/*false*/; x2351 = x2346; char *x2349 = x2345+1; x2352 = x2349; } else { x2352 = x2345; } } int x2364 = x2350; if (x2364) { char *x2365 = x2352; x2273 = 0; } else { char x2368 = x2351; char *x2369 = x2352; int x2374 = 1/*true*/; char x2375 = '\0'; char *x2376 = 0/*null*/; char x2370 = x2369[0]; int x2371 = x2370 == '\0'; if (x2371) { x2376 = x2369; } else { int x2372 = x2370 == 's'; if (x2372) { x2374 = 0/*false*/; x2375 = x2370; char *x2373 = x2369+1; x2376 = x2373; } else { x2376 = x2369; } } int x2388 = x2374; if (x2388) { char *x2389 = x2376; x2273 = 0; } else { char x2392 = x2375; char *x2393 = x2376; int x2398 = 1/*true*/; char x2399 = '\0'; char *x2400 = 0/*null*/; char x2394 = x2393[0]; int x2395 = x2394 == '\0'; if (x2395) { x2400 = x2393; } else { int x2396 = x2394 == 'f'; if (x2396) { x2398 = 0/*false*/; x2399 = x2394; char *x2397 = x2393+1; x2400 = x2397; } else { x2400 = x2393; } } int x2412 = x2398; if (x2412) { char *x2413 = x2400; x2273 = 0; } else { char x2416 = x2399; char *x2417 = x2400; int x2422 = 1/*true*/; char x2423 = '\0'; char *x2424 = 0/*null*/; char x2418 = x2417[0]; int x2419 = x2418 == '\0'; if (x2419) { x2424 = x2417; } else { int x2420 = x2418 == 'e'; if (x2420) { x2422 = 0/*false*/; x2423 = x2418; char *x2421 = x2417+1; x2424 = x2421; } else { x2424 = x2417; } } int x2436 = x2422; if (x2436) { char *x2437 = x2424; x2273 = 0; } else { char x2440 = x2423; char *x2441 = x2424; int x2446 = 1/*true*/; char x2447 = '\0'; char *x2448 = 0/*null*/; char x2442 = x2441[0]; int x2443 = x2442 == '\0'; if (x2443) { x2448 = x2441; } else { int x2444 = x2442 == 'r'; if (x2444) { x2446 = 0/*false*/; x2447 = x2442; char *x2445 = x2441+1; x2448 = x2445; } else { x2448 = x2441; } } int x2460 = x2446; if (x2460) { char *x2461 = x2448; x2273 = 0; } else { char x2464 = x2447; char *x2465 = x2448; int x2470 = 1/*true*/; char x2471 = '\0'; char *x2472 = 0/*null*/; char x2466 = x2465[0]; int x2467 = x2466 == '\0'; if (x2467) { x2472 = x2465; } else { int x2468 = x2466 == '-'; if (x2468) { x2470 = 0/*false*/; x2471 = x2466; char *x2469 = x2465+1; x2472 = x2469; } else { x2472 = x2465; } } int x2484 = x2470; if (x2484) { char *x2485 = x2472; x2273 = 0; } else { char x2488 = x2471; char *x2489 = x2472; int x2494 = 1/*true*/; char x2495 = '\0'; char *x2496 = 0/*null*/; char x2490 = x2489[0]; int x2491 = x2490 == '\0'; if (x2491) { x2496 = x2489; } else { int x2492 = x2490 == 'E'; if (x2492) { x2494 = 0/*false*/; x2495 = x2490; char *x2493 = x2489+1; x2496 = x2493; } else { x2496 = x2489; } } int x2508 = x2494; if (x2508) { char *x2509 = x2496; x2273 = 0; } else { char x2512 = x2495; char *x2513 = x2496; int x2518 = 1/*true*/; char x2519 = '\0'; char *x2520 = 0/*null*/; char x2514 = x2513[0]; int x2515 = x2514 == '\0'; if (x2515) { x2520 = x2513; } else { int x2516 = x2514 == 'n'; if (x2516) { x2518 = 0/*false*/; x2519 = x2514; char *x2517 = x2513+1; x2520 = x2517; } else { x2520 = x2513; } } int x2532 = x2518; if (x2532) { char *x2533 = x2520; x2273 = 0; } else { char x2536 = x2519; char *x2537 = x2520; int x2542 = 1/*true*/; char x2543 = '\0'; char *x2544 = 0/*null*/; char x2538 = x2537[0]; int x2539 = x2538 == '\0'; if (x2539) { x2544 = x2537; } else { int x2540 = x2538 == 'c'; if (x2540) { x2542 = 0/*false*/; x2543 = x2538; char *x2541 = x2537+1; x2544 = x2541; } else { x2544 = x2537; } } int x2556 = x2542; if (x2556) { char *x2557 = x2544; x2273 = 0; } else { char x2560 = x2543; char *x2561 = x2544; int x2566 = 1/*true*/; char x2567 = '\0'; char *x2568 = 0/*null*/; char x2562 = x2561[0]; int x2563 = x2562 == '\0'; if (x2563) { x2568 = x2561; } else { int x2564 = x2562 == 'o'; if (x2564) { x2566 = 0/*false*/; x2567 = x2562; char *x2565 = x2561+1; x2568 = x2565; } else { x2568 = x2561; } } int x2580 = x2566; if (x2580) { char *x2581 = x2568; x2273 = 0; } else { char x2584 = x2567; char *x2585 = x2568; int x2590 = 1/*true*/; char x2591 = '\0'; char *x2592 = 0/*null*/; char x2586 = x2585[0]; int x2587 = x2586 == '\0'; if (x2587) { x2592 = x2585; } else { int x2588 = x2586 == 'd'; if (x2588) { x2590 = 0/*false*/; x2591 = x2586; char *x2589 = x2585+1; x2592 = x2589; } else { x2592 = x2585; } } int x2604 = x2590; if (x2604) { char *x2605 = x2592; x2273 = 0; } else { char x2608 = x2591; char *x2609 = x2592; int x2614 = 1/*true*/; char x2615 = '\0'; char *x2616 = 0/*null*/; char x2610 = x2609[0]; int x2611 = x2610 == '\0'; if (x2611) { x2616 = x2609; } else { int x2612 = x2610 == 'i'; if (x2612) { x2614 = 0/*false*/; x2615 = x2610; char *x2613 = x2609+1; x2616 = x2613; } else { x2616 = x2609; } } int x2628 = x2614; if (x2628) { char *x2629 = x2616; x2273 = 0; } else { char x2632 = x2615; char *x2633 = x2616; int x2638 = 1/*true*/; char x2639 = '\0'; char *x2640 = 0/*null*/; char x2634 = x2633[0]; int x2635 = x2634 == '\0'; if (x2635) { x2640 = x2633; } else { int x2636 = x2634 == 'n'; if (x2636) { x2638 = 0/*false*/; x2639 = x2634; char *x2637 = x2633+1; x2640 = x2637; } else { x2640 = x2633; } } int x2652 = x2638; if (x2652) { char *x2653 = x2640; x2273 = 0; } else { char x2656 = x2639; char *x2657 = x2640; int x2662 = 1/*true*/; char x2663 = '\0'; char *x2664 = 0/*null*/; char x2658 = x2657[0]; int x2659 = x2658 == '\0'; if (x2659) { x2664 = x2657; } else { int x2660 = x2658 == 'g'; if (x2660) { x2662 = 0/*false*/; x2663 = x2658; char *x2661 = x2657+1; x2664 = x2661; } else { x2664 = x2657; } } int x2676 = x2662; if (x2676) { char *x2677 = x2664; x2273 = 0; } else { char x2680 = x2663; char *x2681 = x2664; x2273 = x2681; } } } } } } } } } } } } } } } } } char *x2717 = x2273; return x2717; } /*@ requires ((strlen(x2739)>=0) && \valid(x2739+(0..(strlen(x2739)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */ char * p_chunked(char * x2739) { char *x2741 = x2739; int x2746 = 1/*true*/; char x2747 = '\0'; char *x2748 = 0/*null*/; char x2742 = x2739[0]; int x2743 = x2742 == '\0'; if (x2743) { x2748 = x2739; } else { int x2744 = x2742 == 'c'; if (x2744) { x2746 = 0/*false*/; x2747 = x2742; char *x2745 = x2739+1; x2748 = x2745; } else { x2748 = x2739; } } int x2760 = x2746; if (x2760) { char *x2761 = x2748; x2741 = 0; } else { char x2764 = x2747; char *x2765 = x2748; int x2770 = 1/*true*/; char x2771 = '\0'; char *x2772 = 0/*null*/; char x2766 = x2765[0]; int x2767 = x2766 == '\0'; if (x2767) { x2772 = x2765; } else { int x2768 = x2766 == 'h'; if (x2768) { x2770 = 0/*false*/; x2771 = x2766; char *x2769 = x2765+1; x2772 = x2769; } else { x2772 = x2765; } } int x2784 = x2770; if (x2784) { char *x2785 = x2772; x2741 = 0; } else { char x2788 = x2771; char *x2789 = x2772; int x2794 = 1/*true*/; char x2795 = '\0'; char *x2796 = 0/*null*/; char x2790 = x2789[0]; int x2791 = x2790 == '\0'; if (x2791) { x2796 = x2789; } else { int x2792 = x2790 == 'u'; if (x2792) { x2794 = 0/*false*/; x2795 = x2790; char *x2793 = x2789+1; x2796 = x2793; } else { x2796 = x2789; } } int x2808 = x2794; if (x2808) { char *x2809 = x2796; x2741 = 0; } else { char x2812 = x2795; char *x2813 = x2796; int x2818 = 1/*true*/; char x2819 = '\0'; char *x2820 = 0/*null*/; char x2814 = x2813[0]; int x2815 = x2814 == '\0'; if (x2815) { x2820 = x2813; } else { int x2816 = x2814 == 'n'; if (x2816) { x2818 = 0/*false*/; x2819 = x2814; char *x2817 = x2813+1; x2820 = x2817; } else { x2820 = x2813; } } int x2832 = x2818; if (x2832) { char *x2833 = x2820; x2741 = 0; } else { char x2836 = x2819; char *x2837 = x2820; int x2842 = 1/*true*/; char x2843 = '\0'; char *x2844 = 0/*null*/; char x2838 = x2837[0]; int x2839 = x2838 == '\0'; if (x2839) { x2844 = x2837; } else { int x2840 = x2838 == 'k'; if (x2840) { x2842 = 0/*false*/; x2843 = x2838; char *x2841 = x2837+1; x2844 = x2841; } else { x2844 = x2837; } } int x2856 = x2842; if (x2856) { char *x2857 = x2844; x2741 = 0; } else { char x2860 = x2843; char *x2861 = x2844; int x2866 = 1/*true*/; char x2867 = '\0'; char *x2868 = 0/*null*/; char x2862 = x2861[0]; int x2863 = x2862 == '\0'; if (x2863) { x2868 = x2861; } else { int x2864 = x2862 == 'e'; if (x2864) { x2866 = 0/*false*/; x2867 = x2862; char *x2865 = x2861+1; x2868 = x2865; } else { x2868 = x2861; } } int x2880 = x2866; if (x2880) { char *x2881 = x2868; x2741 = 0; } else { char x2884 = x2867; char *x2885 = x2868; int x2890 = 1/*true*/; char x2891 = '\0'; char *x2892 = 0/*null*/; char x2886 = x2885[0]; int x2887 = x2886 == '\0'; if (x2887) { x2892 = x2885; } else { int x2888 = x2886 == 'd'; if (x2888) { x2890 = 0/*false*/; x2891 = x2886; char *x2889 = x2885+1; x2892 = x2889; } else { x2892 = x2885; } } int x2904 = x2890; if (x2904) { char *x2905 = x2892; x2741 = 0; } else { char x2908 = x2891; char *x2909 = x2892; x2741 = x2909; } } } } } } } char *x2925 = x2741; return x2925; }
#include <string.h> /*@ requires ((strlen(x2739)>=0) && \valid(x2739+(0..(strlen(x2739)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */
char * p_chunked(char * x2739) { char *x2741 = x2739; int x2746 = 1/*true*/; char x2747 = '\0'; char *x2748 = 0/*null*/; char x2742 = x2739[0]; int x2743 = x2742 == '\0'; if (x2743) { x2748 = x2739; } else { int x2744 = x2742 == 'c'; if (x2744) { x2746 = 0/*false*/; x2747 = x2742; char *x2745 = x2739+1; x2748 = x2745; } else { x2748 = x2739; } } int x2760 = x2746; if (x2760) { char *x2761 = x2748; x2741 = 0; } else { char x2764 = x2747; char *x2765 = x2748; int x2770 = 1/*true*/; char x2771 = '\0'; char *x2772 = 0/*null*/; char x2766 = x2765[0]; int x2767 = x2766 == '\0'; if (x2767) { x2772 = x2765; } else { int x2768 = x2766 == 'h'; if (x2768) { x2770 = 0/*false*/; x2771 = x2766; char *x2769 = x2765+1; x2772 = x2769; } else { x2772 = x2765; } } int x2784 = x2770; if (x2784) { char *x2785 = x2772; x2741 = 0; } else { char x2788 = x2771; char *x2789 = x2772; int x2794 = 1/*true*/; char x2795 = '\0'; char *x2796 = 0/*null*/; char x2790 = x2789[0]; int x2791 = x2790 == '\0'; if (x2791) { x2796 = x2789; } else { int x2792 = x2790 == 'u'; if (x2792) { x2794 = 0/*false*/; x2795 = x2790; char *x2793 = x2789+1; x2796 = x2793; } else { x2796 = x2789; } } int x2808 = x2794; if (x2808) { char *x2809 = x2796; x2741 = 0; } else { char x2812 = x2795; char *x2813 = x2796; int x2818 = 1/*true*/; char x2819 = '\0'; char *x2820 = 0/*null*/; char x2814 = x2813[0]; int x2815 = x2814 == '\0'; if (x2815) { x2820 = x2813; } else { int x2816 = x2814 == 'n'; if (x2816) { x2818 = 0/*false*/; x2819 = x2814; char *x2817 = x2813+1; x2820 = x2817; } else { x2820 = x2813; } } int x2832 = x2818; if (x2832) { char *x2833 = x2820; x2741 = 0; } else { char x2836 = x2819; char *x2837 = x2820; int x2842 = 1/*true*/; char x2843 = '\0'; char *x2844 = 0/*null*/; char x2838 = x2837[0]; int x2839 = x2838 == '\0'; if (x2839) { x2844 = x2837; } else { int x2840 = x2838 == 'k'; if (x2840) { x2842 = 0/*false*/; x2843 = x2838; char *x2841 = x2837+1; x2844 = x2841; } else { x2844 = x2837; } } int x2856 = x2842; if (x2856) { char *x2857 = x2844; x2741 = 0; } else { char x2860 = x2843; char *x2861 = x2844; int x2866 = 1/*true*/; char x2867 = '\0'; char *x2868 = 0/*null*/; char x2862 = x2861[0]; int x2863 = x2862 == '\0'; if (x2863) { x2868 = x2861; } else { int x2864 = x2862 == 'e'; if (x2864) { x2866 = 0/*false*/; x2867 = x2862; char *x2865 = x2861+1; x2868 = x2865; } else { x2868 = x2861; } } int x2880 = x2866; if (x2880) { char *x2881 = x2868; x2741 = 0; } else { char x2884 = x2867; char *x2885 = x2868; int x2890 = 1/*true*/; char x2891 = '\0'; char *x2892 = 0/*null*/; char x2886 = x2885[0]; int x2887 = x2886 == '\0'; if (x2887) { x2892 = x2885; } else { int x2888 = x2886 == 'd'; if (x2888) { x2890 = 0/*false*/; x2891 = x2886; char *x2889 = x2885+1; x2892 = x2889; } else { x2892 = x2885; } } int x2904 = x2890; if (x2904) { char *x2905 = x2892; x2741 = 0; } else { char x2908 = x2891; char *x2909 = x2892; x2741 = x2909; } } } } } } } char *x2925 = x2741; return x2925; }
true
53
53
char * p_chunked(char * x2739) { char *x2741 = x2739; int x2746 = 1/*true*/; char x2747 = '\0'; char *x2748 = 0/*null*/; char x2742 = x2739[0]; int x2743 = x2742 == '\0'; if (x2743) { x2748 = x2739; } else { int x2744 = x2742 == 'c'; if (x2744) { x2746 = 0/*false*/; x2747 = x2742; char *x2745 = x2739+1; x2748 = x2745; } else { x2748 = x2739; } } int x2760 = x2746; if (x2760) { char *x2761 = x2748; x2741 = 0; } else { char x2764 = x2747; char *x2765 = x2748; int x2770 = 1/*true*/; char x2771 = '\0'; char *x2772 = 0/*null*/; char x2766 = x2765[0]; int x2767 = x2766 == '\0'; if (x2767) { x2772 = x2765; } else { int x2768 = x2766 == 'h'; if (x2768) { x2770 = 0/*false*/; x2771 = x2766; char *x2769 = x2765+1; x2772 = x2769; } else { x2772 = x2765; } } int x2784 = x2770; if (x2784) { char *x2785 = x2772; x2741 = 0; } else { char x2788 = x2771; char *x2789 = x2772; int x2794 = 1/*true*/; char x2795 = '\0'; char *x2796 = 0/*null*/; char x2790 = x2789[0]; int x2791 = x2790 == '\0'; if (x2791) { x2796 = x2789; } else { int x2792 = x2790 == 'u'; if (x2792) { x2794 = 0/*false*/; x2795 = x2790; char *x2793 = x2789+1; x2796 = x2793; } else { x2796 = x2789; } } int x2808 = x2794; if (x2808) { char *x2809 = x2796; x2741 = 0; } else { char x2812 = x2795; char *x2813 = x2796; int x2818 = 1/*true*/; char x2819 = '\0'; char *x2820 = 0/*null*/; char x2814 = x2813[0]; int x2815 = x2814 == '\0'; if (x2815) { x2820 = x2813; } else { int x2816 = x2814 == 'n'; if (x2816) { x2818 = 0/*false*/; x2819 = x2814; char *x2817 = x2813+1; x2820 = x2817; } else { x2820 = x2813; } } int x2832 = x2818; if (x2832) { char *x2833 = x2820; x2741 = 0; } else { char x2836 = x2819; char *x2837 = x2820; int x2842 = 1/*true*/; char x2843 = '\0'; char *x2844 = 0/*null*/; char x2838 = x2837[0]; int x2839 = x2838 == '\0'; if (x2839) { x2844 = x2837; } else { int x2840 = x2838 == 'k'; if (x2840) { x2842 = 0/*false*/; x2843 = x2838; char *x2841 = x2837+1; x2844 = x2841; } else { x2844 = x2837; } } int x2856 = x2842; if (x2856) { char *x2857 = x2844; x2741 = 0; } else { char x2860 = x2843; char *x2861 = x2844; int x2866 = 1/*true*/; char x2867 = '\0'; char *x2868 = 0/*null*/; char x2862 = x2861[0]; int x2863 = x2862 == '\0'; if (x2863) { x2868 = x2861; } else { int x2864 = x2862 == 'e'; if (x2864) { x2866 = 0/*false*/; x2867 = x2862; char *x2865 = x2861+1; x2868 = x2865; } else { x2868 = x2861; } } int x2880 = x2866; if (x2880) { char *x2881 = x2868; x2741 = 0; } else { char x2884 = x2867; char *x2885 = x2868; int x2890 = 1/*true*/; char x2891 = '\0'; char *x2892 = 0/*null*/; char x2886 = x2885[0]; int x2887 = x2886 == '\0'; if (x2887) { x2892 = x2885; } else { int x2888 = x2886 == 'd'; if (x2888) { x2890 = 0/*false*/; x2891 = x2886; char *x2889 = x2885+1; x2892 = x2889; } else { x2892 = x2885; } } int x2904 = x2890; if (x2904) { char *x2905 = x2892; x2741 = 0; } else { char x2908 = x2891; char *x2909 = x2892; x2741 = x2909; } } } } } } } char *x2925 = x2741; return x2925; }
#include <string.h> /*@ requires ((strlen(x2739)>=0) && \valid(x2739+(0..(strlen(x2739)+1)-1))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..(strlen(\result)+1)-1)))); */
frama_c_files_v2/test_frama_c_1184.c
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x; assigns p->y; assigns p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */ void init(Point* p) { p->x = 0; p->y = 0; p->z = 0; } /*@ requires \valid(p); assigns *p; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */ void set_zero(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x, p->y, p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */
void init(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
true
11
11
void init(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x, p->y, p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */
frama_c_files_v2/test_frama_c_1184.c
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x; assigns p->y; assigns p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */ void init(Point* p) { p->x = 0; p->y = 0; p->z = 0; } /*@ requires \valid(p); assigns *p; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */ void set_zero(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x, p->y, p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */
void set_zero(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
true
11
11
void set_zero(Point* p) { p->x = 0; p->y = 0; p->z = 0; }
struct Point { int x; int y; int z; }; typedef struct Point Point; /*@ requires \valid(p); assigns p->x, p->y, p->z; ensures p->x == 0; ensures p->y == 0; ensures p->z == 0; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; }
true
4
4
struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; }
#include<stdbool.h> struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; }
true
4
4
struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; }
#include<stdbool.h> struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; }
true
5
5
struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; }
#include<stdbool.h> struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; }
true
4
4
struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; }
#include<stdbool.h> struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; }
true
5
5
struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; }
#include<stdbool.h> struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
true
5
5
struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */
frama_c_files_v2/test_frama_c_519.c
/* Tested with: * * Frama-C Aluminium * * Alt-Ergo 1.01 * * Why3 platform, version 0.87.3 * */ #include <stdbool.h> #define MAXV 1000000 /*@ requires 1 <= N <= 1000000; @ requires \valid(a + (0..N-1)); @ requires \forall integer j; 0 <= j < 1000000 ==> 1 <= a[j] <= N; @ ensures @ \forall integer i, j; 0 <= i < 1000000 && 0 <= j < 1000000 && a[i] != a[j] ==> \result == 0 || @ \exists integer i, j; 0 <= i < 1000000 && 0 <= j < 1000000 && a[i] == a[j] ==> \result == a[i]; @*/ int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer j; 1 <= j < i ==> f[j-1] == false; @ loop assigns i, f[0..(MAXV-1)]; @ loop variant MAXV - i + 1; @*/ for(int i = 1; i <= MAXV; ++i) f[i - 1] = false; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; 0 <= j < i ==> f[a[j] - 1] == true; @ loop assigns i, f[0..N-1]; @ loop variant N - i; @*/ for(int i = 0; i < N; ++i) if (f[a[i] - 1]) return a[i]; else f[a[i] - 1] = true; return 0; }
#include <stdbool.h> #define MAXV 1000000 /*@ requires 1 <= N <= 1000000; @ requires \valid(a + (0..N-1)); @ requires \forall integer j; 0 <= j < N ==> 1 <= a[j] <= N; @ ensures @ (\forall integer i, j; 0 <= i < N && 0 <= j < N && a[i] != a[j] ==> \result == 0) || @ (\exists integer i, j; 0 <= i < N && 0 <= j < N && a[i] == a[j] ==> \result == a[i]); @*/
int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer j; 1 <= j < i ==> f[j-1] == false; @ loop assigns i, f[0..(MAXV-1)]; @ loop variant MAXV - i + 1; @*/ for(int i = 1; i <= MAXV; ++i) f[i - 1] = false; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; 0 <= j < i ==> (1 <= a[j] && a[j] <= N && f[a[j] - 1] == true); @ loop assigns i, f[0..(MAXV-1)]; @ loop variant N - i; @*/ for(int i = 0; i < N; ++i) if (f[a[i] - 1]) return a[i]; else f[a[i] - 1] = true; return 0; }
true
32
32
int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer j; 1 <= j < i ==> f[j-1] == false; @ loop assigns i, f[0..(MAXV-1)]; @ loop variant MAXV - i + 1; @*/ for(int i = 1; i <= MAXV; ++i) f[i - 1] = false; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; 0 <= j < i ==> (1 <= a[j] && a[j] <= N && f[a[j] - 1] == true); @ loop assigns i, f[0..(MAXV-1)]; @ loop variant N - i; @*/ for(int i = 0; i < N; ++i) if (f[a[i] - 1]) return a[i]; else f[a[i] - 1] = true; return 0; }
#include <stdbool.h> #define MAXV 1000000 /*@ requires 1 <= N <= 1000000; @ requires \valid(a + (0..N-1)); @ requires \forall integer j; 0 <= j < N ==> 1 <= a[j] <= N; @ ensures @ (\forall integer i, j; 0 <= i < N && 0 <= j < N && a[i] != a[j] ==> \result == 0) || @ (\exists integer i, j; 0 <= i < N && 0 <= j < N && a[i] == a[j] ==> \result == a[i]); @*/
frama_c_files_v2/test_frama_c_2492.c
#define HASHTBL_LEN 17 typedef struct { int b; int size; } Buckets; typedef struct { Buckets data[HASHTBL_LEN]; int size; } Hashtbl; /*@ requires \valid(tbl); @ requires \valid(tbl->data+(0 .. HASHTBL_LEN - 1)); @ requires 0 <= d < HASHTBL_LEN; @ @ assigns tbl->data[d], tbl->size; // approximation sur tbl->data[d]; si on écrit tbl->data[d].size, pas de problème @ */ int add(Hashtbl *tbl, int d) { unsigned int h = d; tbl->data[h].size = 0; // si on inline d, pas de probleme tbl->size = 0; return 0; }
#define HASHTBL_LEN 17 typedef struct { int size; } Buckets; typedef struct { Buckets data[HASHTBL_LEN]; int size; } Hashtbl; /*@ requires \valid(tbl); @ requires \valid(tbl->data+(0 .. HASHTBL_LEN - 1)); @ requires 0 <= d < HASHTBL_LEN; @ @ assigns tbl->data[d].size, tbl->size; @ */
int add(Hashtbl *tbl, int d) { unsigned int h = d; tbl->data[h].size = 0; // si on inline d, pas de probleme tbl->size = 0; return 0; }
true
8
8
int add(Hashtbl *tbl, int d) { unsigned int h = d; tbl->data[h].size = 0; // si on inline d, pas de probleme tbl->size = 0; return 0; }
#define HASHTBL_LEN 17 typedef struct { int size; } Buckets; typedef struct { Buckets data[HASHTBL_LEN]; int size; } Hashtbl; /*@ requires \valid(tbl); @ requires \valid(tbl->data+(0 .. HASHTBL_LEN - 1)); @ requires 0 <= d < HASHTBL_LEN; @ @ assigns tbl->data[d].size, tbl->size; @ */
frama_c_files_v2/test_frama_c_1570.c
#define INT_MIN (-2147483648) #define INT_MAX 2147483647 /*@ requires INT_MIN <= a + b <= INT_MAX; assigns \nothing; ensures \result == a + b; */ int sum(int a, int b) { return a + b; }
#define INT_MIN (-2147483648) #define INT_MAX 2147483647 /*@ requires INT_MIN <= (long long)a + b <= INT_MAX; assigns \nothing; ensures \result == a + b; */
int sum(int a, int b) { return a + b; }
true
6
6
int sum(int a, int b) { return a + b; }
#define INT_MIN (-2147483648) #define INT_MAX 2147483647 /*@ requires INT_MIN <= (long long)a + b <= INT_MAX; assigns \nothing; ensures \result == a + b; */
frama_c_files_v2/test_frama_c_809.c
#include <limits.h> struct A { unsigned int size; unsigned int pos; }; typedef struct A A; /*@ requires \valid(a); requires length <= 64; requires a->pos + length <= UINT_MAX; requires a->pos + length <= a->size; assigns a->pos; ensures a->pos == \old(a->pos) + length; */ void foo(A* a, unsigned int length) { a->pos += length; } /*@ requires \valid(a); requires length <= 64; requires a->pos + length <= UINT_MAX; requires a->pos + length <= a->size; assigns a->pos; ensures a->pos == \old(a->pos) + length; */ void bar(A* a, unsigned int length) { foo(a, length); a->pos -= length; foo(a, length); }
#include <limits.h> struct A { unsigned int size; unsigned int pos; }; typedef struct A A; /*@ requires \valid(a); requires length <= 64; requires a->pos + length <= UINT_MAX; requires a->pos + length <= a->size; assigns a->pos; ensures a->pos == \old(a->pos) + length; */
void foo(A* a, unsigned int length) { a->pos += length; }
true
6
6
void foo(A* a, unsigned int length) { a->pos += length; }
#include <limits.h> struct A { unsigned int size; unsigned int pos; }; typedef struct A A; /*@ requires \valid(a); requires length <= 64; requires a->pos + length <= UINT_MAX; requires a->pos + length <= a->size; assigns a->pos; ensures a->pos == \old(a->pos) + length; */
frama_c_files_v2/test_frama_c_1826.c
/* run.config_qualif DONTRUN: */ #define NULL ((void *) 0L) /*@ ensures e1: \result == \null; ensures e2: \result == 0; ensures e3: \result == (int *) \null; ensures e4: \result == (int *) 0; ensures e5: \result == (int *)((void *)0); */ int * f (void) { return NULL; }
#define NULL ((void *) 0L) /*@ ensures e1: \result == \null; ensures e2: \result == 0; ensures e3: \result == (int *) \null; ensures e4: \result == (int *) 0; ensures e5: \result == (int *)((void *)0); */
int * f (void) { return NULL; }
true
7
7
int * f (void) { return NULL; }
#define NULL ((void *) 0L) /*@ ensures e1: \result == \null; ensures e2: \result == 0; ensures e3: \result == (int *) \null; ensures e4: \result == (int *) 0; ensures e5: \result == (int *)((void *)0); */
frama_c_files_v2/test_frama_c_162.c
/* run.config COMMENT: bts #1478 about wrong detection of initializers in pre-analysis */ int global_i; int* global_i_ptr = &global_i; int global_i = 0; /*@ requires global_i == 0; requires \valid(global_i_ptr); requires global_i_ptr == &global_i; */ void loop(void) { } int main(void) { loop(); return 0; }
int global_i; int* global_i_ptr = &global_i; /*@ requires global_i == 0; requires \valid(global_i_ptr); requires global_i_ptr == &global_i; */
void loop(void) { }
true
2
2
void loop(void) { }
int global_i; int* global_i_ptr = &global_i; /*@ requires global_i == 0; requires \valid(global_i_ptr); requires global_i_ptr == &global_i; */
frama_c_files_v2/test_frama_c_2943.c
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ //requires SPEC_INT_MIN < a <= SPEC_INT_MAX; requires SPEC_INT_MIN < a; assigns \nothing; ensures \result >= 0; behavior positive: assumes a > 0; ensures \result == a; behavior zero: assumes a == 0; ensures \result == 0; ensures \result == a; behavior negative: assumes a < 0; ensures \result == -a; complete behaviors; disjoint behaviors; */ int spec_abs2(int a) { int abs; if (a < 0) { abs = -a; } else { abs = a; } return abs; } #ifdef OUT_OF_TASK #include <stdio.h> int main(void) { printf("res: %d\n", spec_abs2(SPEC_INT_MIN + 1)); return 0; } #endif
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ requires SPEC_INT_MIN < a <= SPEC_INT_MAX; assigns \nothing; ensures \result >= 0; behavior positive: assumes a > 0; ensures \result == a; behavior zero: assumes a == 0; ensures \result == 0; behavior negative: assumes a < 0; ensures \result == -a; complete behaviors; disjoint behaviors; */
int spec_abs2(int a) { int abs; if (a < 0) { abs = -a; } else { abs = a; } return abs; }
true
11
11
int spec_abs2(int a) { int abs; if (a < 0) { abs = -a; } else { abs = a; } return abs; }
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ requires SPEC_INT_MIN < a <= SPEC_INT_MAX; assigns \nothing; ensures \result >= 0; behavior positive: assumes a > 0; ensures \result == a; behavior zero: assumes a == 0; ensures \result == 0; behavior negative: assumes a < 0; ensures \result == -a; complete behaviors; disjoint behaviors; */
frama_c_files_v2/test_frama_c_1238.c
typedef struct _list { int i; } *list; /*@ requires \valid(p); */ void f(list p) {} /*@ requires \valid(p); */ void g(struct _list* p) {}
typedef struct _list { int i; } *list; /*@ requires \valid(p); */
void f(list p) {}
true
2
2
void f(list p) {}
typedef struct _list { int i; } *list; /*@ requires \valid(p); */
frama_c_files_v2/test_frama_c_2000.c
struct account { int lower_limit; int balance; int upper_limit; }; /*@ predicate valid_account{L}(struct account* account) = \valid(account) && account->lower_limit <= account->balance <= account->upper_limit; */ /*@ requires valid_account(account) && 0<= amount <= account->upper_limit - account -> balance; assigns account->balance; ensures valid_account(account) && account->balance == \at(account->balance,Pre) + amount; */ void deposit(struct account* account, int amount) { account->balance += amount; } /*@ requires valid_account(account) && 0<= amount <= account -> balance -account->lower_limit; assigns account->balance; ensures valid_account(account) && account->balance == \at(account->balance,Pre) - amount; */ void withdraw(struct account* account, int amount) { account->balance -= amount; } /*@ requires valid_account(account); assigns \nothing; ensures \result == account -> balance; */ int get_balance(struct account* account) { return account ->balance; } /*@ requires \valid(account) && lower_limit <= 0 <= upper_limit; assigns account->balance, account->lower_limit, account->upper_limit; ensures valid_account(account) && account->balance == 0 && account->lower_limit == lower_limit && account->upper_limit == upper_limit; */ void init_account(struct account* account, int lower_limit, int upper_limit) { account->lower_limit = lower_limit; account -> upper_limit = upper_limit; account->balance = 0; } int main () { struct account _Account; struct account* myAccount = &_Account; init_account(myAccount,-100,200); deposit(myAccount,10); withdraw(myAccount,20); int current_balance = get_balance(myAccount); //@ assert current_balance == -10; return 0; }
struct account { int lower_limit; int balance; int upper_limit; }; /*@ predicate valid_account{L}(struct account* account) = \valid(account) && account->lower_limit <= account->balance <= account->upper_limit; */ /*@ requires valid_account(account); assigns \nothing; ensures \result == account -> balance; */
int get_balance(struct account* account) { return account ->balance; }
true
5
5
int get_balance(struct account* account) { return account ->balance; }
struct account { int lower_limit; int balance; int upper_limit; }; /*@ predicate valid_account{L}(struct account* account) = \valid(account) && account->lower_limit <= account->balance <= account->upper_limit; */ /*@ requires valid_account(account); assigns \nothing; ensures \result == account -> balance; */
frama_c_files_v2/test_frama_c_1177.c
// Side effects can be controlled on an individual basis. #include <limits.h> extern int a; /*@ requires x > INT_MIN; assigns a; // allow assignment to a (but only to a). ensures 0 <= x ==> \result == x; ensures 0 > x ==> \result == -x; */ int abs_int(int x) { a = x; return (x >= 0) ? x : -x; }
#include <limits.h> extern int a; /*@ requires x > INT_MIN; assigns a; // allow assignment to a (but only to a). ensures 0 <= x ==> \result == x; ensures 0 > x ==> \result == -x; */
int abs_int(int x) { a = x; return (x >= 0) ? x : -x; }
true
8
8
int abs_int(int x) { a = x; return (x >= 0) ? x : -x; }
#include <limits.h> extern int a; /*@ requires x > INT_MIN; assigns a; // allow assignment to a (but only to a). ensures 0 <= x ==> \result == x; ensures 0 > x ==> \result == -x; */
frama_c_files_v2/test_frama_c_1484.c
#include <stdint.h> #include <stddef.h> #define NUM_ELEMS (8) /*@ requires expected != test; @ requires \let n = NUM_ELEMS; @ \valid_read(expected + (0.. n-1)) && \valid_read(test + (0.. n-1)); @ assigns \nothing; @ behavior matches: @ assumes \let n = NUM_ELEMS; @ \forall integer i; 0 <= i < n ==> expected[i] == test[i]; @ ensures \result == 1; @ behavior not_matches: @ assumes \let n = NUM_ELEMS; @ \exists integer i; 0 <= i < n && expected[i] != test[i]; @ ensures \result == 0; @ complete behaviors; @ disjoint behaviors; @*/ int array_equals(const uint32_t expected[static NUM_ELEMS], const uint32_t test[static NUM_ELEMS]) { /*@ loop invariant \let n = NUM_ELEMS; 0 <= i <= n; @ loop invariant \forall integer k; 0 <= k < i ==> expected[k] == test[k]; @ loop assigns i; @ loop variant \let n = NUM_ELEMS; n-i; @*/ for (size_t i = 0; i < NUM_ELEMS; i++) { if (expected[i] != test[i]) { return 0; } } return 1; }
#include <stdint.h> #include <stddef.h> #define NUM_ELEMS (8) /*@ requires expected != test; @ requires \let n = NUM_ELEMS; @ \valid_read(expected + (0.. n-1)) && \valid_read(test + (0.. n-1)); @ assigns \nothing; @ behavior matches: @ assumes \let n = NUM_ELEMS; @ \forall integer i; 0 <= i < n ==> expected[i] == test[i]; @ ensures \result == 1; @ behavior not_matches: @ assumes \let n = NUM_ELEMS; @ \exists integer i; 0 <= i < n && expected[i] != test[i]; @ ensures \result == 0; @ complete behaviors; @ disjoint behaviors; @*/
int array_equals(const uint32_t expected[static NUM_ELEMS], const uint32_t test[static NUM_ELEMS]) { /*@ loop invariant \let n = NUM_ELEMS; 0 <= i <= n; @ loop invariant \forall integer k; 0 <= k < i ==> expected[k] == test[k]; @ loop assigns i; @ loop variant \let n = NUM_ELEMS; n-i; @*/ for (size_t i = 0; i < NUM_ELEMS; i++) { if (expected[i] != test[i]) { return 0; } } return 1; }
true
18
18
int array_equals(const uint32_t expected[static NUM_ELEMS], const uint32_t test[static NUM_ELEMS]) { /*@ loop invariant \let n = NUM_ELEMS; 0 <= i <= n; @ loop invariant \forall integer k; 0 <= k < i ==> expected[k] == test[k]; @ loop assigns i; @ loop variant \let n = NUM_ELEMS; n-i; @*/ for (size_t i = 0; i < NUM_ELEMS; i++) { if (expected[i] != test[i]) { return 0; } } return 1; }
#include <stdint.h> #include <stddef.h> #define NUM_ELEMS (8) /*@ requires expected != test; @ requires \let n = NUM_ELEMS; @ \valid_read(expected + (0.. n-1)) && \valid_read(test + (0.. n-1)); @ assigns \nothing; @ behavior matches: @ assumes \let n = NUM_ELEMS; @ \forall integer i; 0 <= i < n ==> expected[i] == test[i]; @ ensures \result == 1; @ behavior not_matches: @ assumes \let n = NUM_ELEMS; @ \exists integer i; 0 <= i < n && expected[i] != test[i]; @ ensures \result == 0; @ complete behaviors; @ disjoint behaviors; @*/
frama_c_files_v2/test_frama_c_1213.c
struct MaxAndMin{ int max; int min; }; /*@ requires size > 0 && \valid_read(a+(0..size-1)); ensures \forall integer i ; 0 <= i < size ==> ( a[i] <= \result.max && \result.min <= a[i] ) ; */ struct MaxAndMin findMaxAndMin(int* a,int size){ struct MaxAndMin s; struct MaxAndMin* p = &s; int** q = &a; p->min = (*q)[0]; p->max = (*q)[0]; int i = 0; /*@ loop assigns i, s.max, s.min; loop invariant *p==s && *q==a && size >0 && (i<=size && (i>=0 && (\forall integer j ;0 <= j < i ==> ( a[j] <=s.max && s.min <=a[j])))); loop variant size - i; */ while (i < size){ if (p->max < (*q)[i]) p->max = (*q)[i]; if (p->min > (*q)[i]) p->min = (*q) [i]; i = i + 1; } return s; }
struct MaxAndMin{ int max; int min; }; /*@ requires size > 0 && \valid_read(a+(0..size-1)); ensures \forall integer i ; 0 <= i < size ==> ( a[i] <= \result.max && \result.min <= a[i] ) ; */
struct MaxAndMin findMaxAndMin(int* a,int size){ struct MaxAndMin s; struct MaxAndMin* p = &s; int** q = &a; p->min = (*q)[0]; p->max = (*q)[0]; int i = 0; /*@ loop assigns i, s.max, s.min; loop invariant *p==s && *q==a && size >0 && (i<=size && (i>=0 && (\forall integer j ;0 <= j < i ==> ( a[j] <=s.max && s.min <=a[j])))); loop variant size - i; */ while (i < size){ if (p->max < (*q)[i]) p->max = (*q)[i]; if (p->min > (*q)[i]) p->min = (*q) [i]; i = i + 1; } return s; }
true
29
29
struct MaxAndMin findMaxAndMin(int* a,int size){ struct MaxAndMin s; struct MaxAndMin* p = &s; int** q = &a; p->min = (*q)[0]; p->max = (*q)[0]; int i = 0; /*@ loop assigns i, s.max, s.min; loop invariant *p==s && *q==a && size >0 && (i<=size && (i>=0 && (\forall integer j ;0 <= j < i ==> ( a[j] <=s.max && s.min <=a[j])))); loop variant size - i; */ while (i < size){ if (p->max < (*q)[i]) p->max = (*q)[i]; if (p->min > (*q)[i]) p->min = (*q) [i]; i = i + 1; } return s; }
struct MaxAndMin{ int max; int min; }; /*@ requires size > 0 && \valid_read(a+(0..size-1)); ensures \forall integer i ; 0 <= i < size ==> ( a[i] <= \result.max && \result.min <= a[i] ) ; */
frama_c_files_v2/test_frama_c_219.c
/* run.config STDOPT: +"-pp-annot" */ /* run.config_qualif STDOPT: +"-pp-annot" */ #define ST(a) (((a)&2)!=0) /*@ behavior sum_ok: ensures ok: ST(\result) <==> ST(a) || ST(b) ; complete behaviors sum_ok; */ char sum( char a , char b ) { return a|b; } #define BIT_TEST(x,n) (((x)&(1<<(n)))!=0) /*@ requires \true; ensures bit_zero: BIT_TEST(\result,0) <==> BIT_TEST(x,31); ensures other_bits: \forall int k ; 0 <= k && k < 31 ==> ( BIT_TEST(\result,1+k) <==> BIT_TEST(x,k)); */ unsigned rotate_left (unsigned x) { return (x << 1) | (x >> 31); }
#define ST(a) (((a)&2)!=0) /*@ behavior sum_ok: ensures ok: ST(\result) <==> ST(a) || ST(b) ; complete behaviors sum_ok; */
char sum( char a , char b ) { return a|b; }
true
4
4
char sum( char a , char b ) { return a|b; }
#define ST(a) (((a)&2)!=0) /*@ behavior sum_ok: ensures ok: ST(\result) <==> ST(a) || ST(b) ; complete behaviors sum_ok; */
frama_c_files_v2/test_frama_c_219.c
/* run.config STDOPT: +"-pp-annot" */ /* run.config_qualif STDOPT: +"-pp-annot" */ #define ST(a) (((a)&2)!=0) /*@ behavior sum_ok: ensures ok: ST(\result) <==> ST(a) || ST(b) ; complete behaviors sum_ok; */ char sum( char a , char b ) { return a|b; } #define BIT_TEST(x,n) (((x)&(1<<(n)))!=0) /*@ requires \true; ensures bit_zero: BIT_TEST(\result,0) <==> BIT_TEST(x,31); ensures other_bits: \forall int k ; 0 <= k && k < 31 ==> ( BIT_TEST(\result,1+k) <==> BIT_TEST(x,k)); */ unsigned rotate_left (unsigned x) { return (x << 1) | (x >> 31); }
#define BIT_TEST(x,n) (((x)&(1<<(n)))!=0) /*@ requires \true; ensures bit_zero: BIT_TEST(\result,0) <==> BIT_TEST(x,31); ensures other_bits: \forall integer k ; 0 <= k < 31 ==> ( BIT_TEST(\result,1+k) <==> BIT_TEST(x,k)); */
unsigned rotate_left (unsigned x) { return (x << 1) | (x >> 31); }
true
4
4
unsigned rotate_left (unsigned x) { return (x << 1) | (x >> 31); }
#define BIT_TEST(x,n) (((x)&(1<<(n)))!=0) /*@ requires \true; ensures bit_zero: BIT_TEST(\result,0) <==> BIT_TEST(x,31); ensures other_bits: \forall integer k ; 0 <= k < 31 ==> ( BIT_TEST(\result,1+k) <==> BIT_TEST(x,k)); */
frama_c_files_v2/test_frama_c_898.c
/* run.config OPT: -rpp */ /* * Based on http://stackoverflow.com/questions/23907134/comparing-two-arrays-using-dictionary-order-in-an-array-of-arrays-java * */ struct AInt{ int t[10]; int length; }; /*@ requires 0 <= o1.length && o1.length <= 10; @ requires 0 <= o2.length && o2.length <= 10; @ assigns \result \from o1,o2; */ int compare(struct AInt o1, struct AInt o2){ int index, aentry, bentry; index = 0; /*@ loop invariant 0 <= index && index <= o2.length && index <= o1.length; @ loop invariant \forall integer k; 0 <= k < index ==> o1.t[k] == o2.t[k]; @ loop assigns index,aentry,bentry; @ loop variant o1.length - index; */ while ((index < o1.length) && (index < o2.length)) { aentry = o1.t[index]; bentry = o2.t[index]; if (aentry < bentry) { return -1; } if (aentry > bentry) { return 1; } index++; } if (o1.length < o2.length) return -1; if (o1.length > o2.length) return 1; return 0; }
struct AInt{ int t[10]; int length; }; /*@ requires 0 <= o1.length && o1.length <= 10; @ requires 0 <= o2.length && o2.length <= 10; @ assigns \result \from o1.length,o1.t[0..9],o2.length,o2.t[0..9]; */
int compare(struct AInt o1, struct AInt o2){ int index, aentry, bentry; index = 0; /*@ loop invariant 0 <= index && index <= o2.length && index <= o1.length; @ loop invariant \forall integer k; 0 <= k < index ==> o1.t[k] == o2.t[k]; @ loop assigns index,aentry,bentry; @ loop variant o1.length - index; */ while ((index < o1.length) && (index < o2.length)) { aentry = o1.t[index]; bentry = o2.t[index]; if (aentry < bentry) { return -1; } if (aentry > bentry) { return 1; } index++; } if (o1.length < o2.length) return -1; if (o1.length > o2.length) return 1; return 0; }
true
23
23
int compare(struct AInt o1, struct AInt o2){ int index, aentry, bentry; index = 0; /*@ loop invariant 0 <= index && index <= o2.length && index <= o1.length; @ loop invariant \forall integer k; 0 <= k < index ==> o1.t[k] == o2.t[k]; @ loop assigns index,aentry,bentry; @ loop variant o1.length - index; */ while ((index < o1.length) && (index < o2.length)) { aentry = o1.t[index]; bentry = o2.t[index]; if (aentry < bentry) { return -1; } if (aentry > bentry) { return 1; } index++; } if (o1.length < o2.length) return -1; if (o1.length > o2.length) return 1; return 0; }
struct AInt{ int t[10]; int length; }; /*@ requires 0 <= o1.length && o1.length <= 10; @ requires 0 <= o2.length && o2.length <= 10; @ assigns \result \from o1.length,o1.t[0..9],o2.length,o2.t[0..9]; */
frama_c_files_v2/test_frama_c_1585.c
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */ void reset (struct S* s) { s->x = 0; } /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */ void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; } /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */ void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; } /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */ int is_pos(struct S* s) { return s->x > 0; }
struct S { int x; }; /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */
void reset (struct S* s) { s->x = 0; }
true
5
5
void reset (struct S* s) { s->x = 0; }
struct S { int x; }; /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */
frama_c_files_v2/test_frama_c_1585.c
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */ void reset (struct S* s) { s->x = 0; } /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */ void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; } /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */ void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; } /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */ int is_pos(struct S* s) { return s->x > 0; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */
void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; }
true
8
8
void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */
frama_c_files_v2/test_frama_c_1585.c
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */ void reset (struct S* s) { s->x = 0; } /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */ void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; } /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */ void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; } /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */ int is_pos(struct S* s) { return s->x > 0; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */
void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; }
true
8
8
void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */
frama_c_files_v2/test_frama_c_1585.c
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns s->x; ensures s->x == 0; */ void reset (struct S* s) { s->x = 0; } /*@ requires \valid(s); requires s->x < INT_MAX; assigns s->x; ensures s->x > \at(s->x,Pre); */ void inc(struct S* s) { //@ assert s->x < INT_MAX; s->x++; } /*@ requires \valid(s); requires s->x > INT_MIN; assigns s->x; ensures s->x < \at(s->x,Pre); */ void dec(struct S* s) { //@ assert s->x > INT_MIN; s->x--; } /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */ int is_pos(struct S* s) { return s->x > 0; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */
int is_pos(struct S* s) { return s->x > 0; }
true
8
8
int is_pos(struct S* s) { return s->x > 0; }
struct S { int x; }; #include <limits.h> /*@ requires \valid(s); assigns \nothing; behavior is_true: assumes s->x > 0; ensures \result == 1; behavior is_false: assumes s->x <= 0; ensures \result == 0; complete behaviors is_true, is_false; disjoint behaviors is_true, is_false; */
frama_c_files_v2/test_frama_c_2847.c
struct S { char *x; int *y; }; /*@ requires \valid(s) && \valid_read(s->x) && \valid_read(s->y) && (int)(*s->x) + *s->y >= -2147483648 && (int)(*s->x) + *s->y <= 2147483647; ensures \result == (int)(*s->x) + *s->y; assigns \nothing; */ int f(struct S* s) { return *s->x + *s->y; }
struct S { char *x; int *y; }; /*@ requires \valid(s) && \valid_read(s->x) && \valid_read(s->y) && (int)(*s->x) + *s->y >= -2147483648 && (int)(*s->x) + *s->y <= 2147483647; ensures \result == (int)(*s->x) + *s->y; assigns \nothing; */
int f(struct S* s) { return *s->x + *s->y; }
true
10
10
int f(struct S* s) { return *s->x + *s->y; }
struct S { char *x; int *y; }; /*@ requires \valid(s) && \valid_read(s->x) && \valid_read(s->y) && (int)(*s->x) + *s->y >= -2147483648 && (int)(*s->x) + *s->y <= 2147483647; ensures \result == (int)(*s->x) + *s->y; assigns \nothing; */
frama_c_files_v2/test_frama_c_2323.c
//In the assigns clause of g(), parameter p refers to g()'s argument, not to the global variable p. //This problem can be circumvented using ghost variables. typedef struct { int a; } las; las * p; /*@ requires \valid(p); assigns p->a; @*/ void f() { p->a = 5; } /*@ requires \valid(p); assigns p->a; @*/ void g(int * p_arg) { f(); }
typedef struct { int a; } las; las * p; /*@ requires \valid(p); assigns p->a; @*/
void f() { p->a = 5; }
true
4
4
void f() { p->a = 5; }
typedef struct { int a; } las; las * p; /*@ requires \valid(p); assigns p->a; @*/
frama_c_files_v2/test_frama_c_703.c
#ifndef __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 #define __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 1 /* Declaration of SREG */ extern volatile unsigned char SREG; void sysclockInit(); /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros(); /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs); #endif /* __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 */ #include <stdio.h> /* Dummy implementations to allow Frama-C to parse the code */ void sysclockInit() {} /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros() { SREG = 0; /* dummy assignment */ return 0; } /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs) { SREG = 0; /* dummy assignment */ }
extern volatile unsigned char SREG; /*@ requires \valid(&SREG); assigns SREG; */
void sysclockInit() {}
true
3
3
void sysclockInit() {}
extern volatile unsigned char SREG; /*@ requires \valid(&SREG); assigns SREG; */
frama_c_files_v2/test_frama_c_703.c
#ifndef __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 #define __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 1 /* Declaration of SREG */ extern volatile unsigned char SREG; void sysclockInit(); /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros(); /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs); #endif /* __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 */ #include <stdio.h> /* Dummy implementations to allow Frama-C to parse the code */ void sysclockInit() {} /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros() { SREG = 0; /* dummy assignment */ return 0; } /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs) { SREG = 0; /* dummy assignment */ }
extern volatile unsigned char SREG; /*@ requires \valid(&SREG); assigns SREG; */
unsigned long int micros() { SREG = 0; /* dummy assignment */ return 0; }
true
4
4
unsigned long int micros() { SREG = 0; /* dummy assignment */ return 0; }
extern volatile unsigned char SREG; /*@ requires \valid(&SREG); assigns SREG; */
frama_c_files_v2/test_frama_c_703.c
#ifndef __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 #define __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 1 /* Declaration of SREG */ extern volatile unsigned char SREG; void sysclockInit(); /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros(); /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs); #endif /* __is_included__eb42c25c_df0f_11eb_ba7e_b499badf00a1 */ #include <stdio.h> /* Dummy implementations to allow Frama-C to parse the code */ void sysclockInit() {} /*@ requires \valid(&SREG); assigns SREG; */ unsigned long int micros() { SREG = 0; /* dummy assignment */ return 0; } /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */ void delay(unsigned long millisecs) { SREG = 0; /* dummy assignment */ }
extern volatile unsigned char SREG; /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */
void delay(unsigned long millisecs) { SREG = 0; /* dummy assignment */ }
true
3
3
void delay(unsigned long millisecs) { SREG = 0; /* dummy assignment */ }
extern volatile unsigned char SREG; /*@ requires millisecs >= 0; requires \valid(&SREG); assigns SREG; */
frama_c_files_v2/test_frama_c_2049.c
#include <stdio.h> #include <limits.h> #include <stddef.h> #define MAX_SIZE 1000 // Define a maximum size for the array /*@ requires validSize: MAX_SIZE > size > 0 ; requires validArr: \valid_read(arr + (0 .. size - 1)) ; assigns \nothing ; ensures largest: \forall integer i; 0 <= i < size ==> \result >= arr[i] ; ensures existsInArr: \exists integer i; 0 <= i < size && arr[i] == \result ; */ int arrayMax(int* arr, size_t size) { int result = arr[0]; size_t i = 0; /*@ loop invariant largest: \forall integer k; 0 <= k < i ==> result >= arr[k]; loop invariant pos: 0 <= i <= size; loop invariant existsInArr: \exists integer k; 0 <= k < size && arr[k] == result ; loop assigns i, result; loop variant size - i; */ while (i < size) { if (arr[i] > result) result = arr[i]; i++; } return result; }
#include <stddef.h> #define MAX_SIZE 1000 /*@ requires validSize: size <= 1000 && size > 0 ; //MAX_SIZE requires validArr: \valid_read(arr + (0 .. size - 1)) ; assigns \nothing ; ensures largest: \forall integer i; 0 <= i < size ==> \result >= arr[i] ; ensures existsInArr: \exists integer i; 0 <= i < size && arr[i] == \result ; */
int arrayMax(int* arr, size_t size) { int result = arr[0]; size_t i = 0; /*@ loop invariant largest: \forall integer k; 0 <= k < i ==> result >= arr[k]; loop invariant pos: 0 <= i <= size; loop invariant existsInArr: \exists integer k; 0 <= k < size && arr[k] == result ; loop assigns i, result; loop variant size - i; */ while (i < size) { if (arr[i] > result) result = arr[i]; i++; } return result; }
true
17
17
int arrayMax(int* arr, size_t size) { int result = arr[0]; size_t i = 0; /*@ loop invariant largest: \forall integer k; 0 <= k < i ==> result >= arr[k]; loop invariant pos: 0 <= i <= size; loop invariant existsInArr: \exists integer k; 0 <= k < size && arr[k] == result ; loop assigns i, result; loop variant size - i; */ while (i < size) { if (arr[i] > result) result = arr[i]; i++; } return result; }
#include <stddef.h> #define MAX_SIZE 1000 /*@ requires validSize: size <= 1000 && size > 0 ; //MAX_SIZE requires validArr: \valid_read(arr + (0 .. size - 1)) ; assigns \nothing ; ensures largest: \forall integer i; 0 <= i < size ==> \result >= arr[i] ; ensures existsInArr: \exists integer i; 0 <= i < size && arr[i] == \result ; */
frama_c_files_v2/test_frama_c_690.c
#include <limits.h> /*@ requires 0 < x0 && x0 < 100 && 0 < x1 && x1 < 100 && \valid(x2 + (0..(x0 * x1) - 1)) && (\forall integer i; 0 <= i < (x0 * x1) ==> 0 <= x2[i] < 256); assigns x2[0..(x0*x1)-1]; ensures \forall integer i; 0 <= i < (x0 * x1) ==> x2[i] == 7; */ void p(int x0, int x1, int * x2) { /*@ loop invariant 0<=x5<=x0; loop invariant (\forall integer i; 0 <= i < (x5 * x1) ==> x2[i] == 7); loop invariant (\forall integer i; (x5 * x1) <= i < (x0 * x1) ==> 0 <= x2[i] < 256); loop assigns x5, x2[0..(x0*x1)-1]; loop variant x0-x5; */ for(int x5=0; x5 < x0; x5++) { int x11 = x5 * x1; /*@ loop invariant 0<=x13<=x1; loop invariant (x11==(x5*x1)); loop invariant (\forall integer i; 0 <= i < (x5 * x1 + x13) ==> x2[i] == 7); loop invariant (\forall integer i; (x5 * x1 + x13) <= i < (x0 * x1) ==> (0 <= x2[i] < 256 || x2[i] == 7)); loop assigns x13, x2[0..(x0*x1)-1]; loop variant x1-x13; */ for(int x13=0; x13 < x1; x13++) { int x42 = x11 + x13; int x43 = x2[x42]; x2[x42] = 7; //@ assert x2[x42] == 7; } } }
#include <limits.h> /*@ requires 0 < x0 <= 10 && 0 < x1 <= 10 && \valid(x2 + (0..(x0 * x1) - 1)) && (\forall integer i; 0 <= i < (x0 * x1) ==> 0 <= x2[i] < 256); assigns x2[0..(x0*x1)-1]; ensures \forall integer i; 0 <= i < (x0 * x1) ==> x2[i] == 7; */
void p(int x0, int x1, int * x2) { /*@ loop invariant 0<=x5<=x0; loop invariant (x5*x1) >= 0; loop invariant (x0*x1) >= 0; loop invariant \forall integer i; 0 <= i < (x5 * x1) ==> x2[i] == 7; loop invariant \forall integer i; (x5 * x1) <= i < (x0 * x1) ==> (0 <= x2[i] < 256 || x2[i] == 7); loop assigns x5, x2[0..(x0*x1)-1]; loop variant x0-x5; */ for(int x5=0; x5 < x0; x5++) { int x11 = x5 * x1; /*@ loop invariant 0<=x13<=x1; loop invariant (x11==(x5*x1)); loop invariant (x5*x1 + x13) >= 0; loop invariant (x0*x1) >= 0; loop invariant \forall integer i; 0 <= i < (x5 * x1 + x13) ==> x2[i] == 7; loop invariant \forall integer i; (x5 * x1 + x13) <= i < (x0 * x1) ==> (0 <= x2[i] < 256 || x2[i] == 7); loop assigns x13, x2[0..(x0*x1)-1]; loop variant x1-x13; */ for(int x13=0; x13 < x1; x13++) { int x42 = x11 + x13; int x43 = x2[x42]; x2[x42] = 7; //@ assert x2[x42] == 7; } } }
true
45
45
void p(int x0, int x1, int * x2) { /*@ loop invariant 0<=x5<=x0; loop invariant (x5*x1) >= 0; loop invariant (x0*x1) >= 0; loop invariant \forall integer i; 0 <= i < (x5 * x1) ==> x2[i] == 7; loop invariant \forall integer i; (x5 * x1) <= i < (x0 * x1) ==> (0 <= x2[i] < 256 || x2[i] == 7); loop assigns x5, x2[0..(x0*x1)-1]; loop variant x0-x5; */ for(int x5=0; x5 < x0; x5++) { int x11 = x5 * x1; /*@ loop invariant 0<=x13<=x1; loop invariant (x11==(x5*x1)); loop invariant (x5*x1 + x13) >= 0; loop invariant (x0*x1) >= 0; loop invariant \forall integer i; 0 <= i < (x5 * x1 + x13) ==> x2[i] == 7; loop invariant \forall integer i; (x5 * x1 + x13) <= i < (x0 * x1) ==> (0 <= x2[i] < 256 || x2[i] == 7); loop assigns x13, x2[0..(x0*x1)-1]; loop variant x1-x13; */ for(int x13=0; x13 < x1; x13++) { int x42 = x11 + x13; int x43 = x2[x42]; x2[x42] = 7; //@ assert x2[x42] == 7; } } }
#include <limits.h> /*@ requires 0 < x0 <= 10 && 0 < x1 <= 10 && \valid(x2 + (0..(x0 * x1) - 1)) && (\forall integer i; 0 <= i < (x0 * x1) ==> 0 <= x2[i] < 256); assigns x2[0..(x0*x1)-1]; ensures \forall integer i; 0 <= i < (x0 * x1) ==> x2[i] == 7; */
frama_c_files_v2/test_frama_c_1238.c
typedef struct _list { int i; } *list; /*@ requires \valid(p); */ void f(list p) {} /*@ requires \valid(p); */ void g(struct _list* p) {}
typedef struct _list { int i; } *list; /*@ requires \valid(p); */
void g(struct _list* p) {}
true
2
2
void g(struct _list* p) {}
typedef struct _list { int i; } *list; /*@ requires \valid(p); */
frama_c_files_v2/test_frama_c_2622.c
// =================== Exercies 1 =================== /*@ @ ensures \result >= a; @ ensures \result >= b; @ ensures \result >= c; @ ensures \result == a || \result == b || \result == c; @ assigns \nothing; */ int max3(int a, int b, int c) { if (a >= b && a >= c) return a; if (b >= b && b >= c) return b; return c; } // =================== Exercies 2 =================== /*@ @ requires 0 < n <= 100000000; @ requires \valid(t+(0..n - 1)); @ @ ensures \forall int i; 0 <= i < n ==> t[i] == 2 * i; */ void double_(int t[], int n) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> t[j] == 2 * j; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { t[i] = 2 * i; } } // =================== Exercies 3 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ ensures \result == 0; */ int increasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] > arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] <= arr[i - 1]) return 0; } return 1; } // =================== Exercies 4 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int decreasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] < arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] >= arr[i - 1]) return 0; } return 1; } /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior increaing: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior decreasing: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == -1; @ behavior none: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int monotomic(int arr[], int n) { if (increasing(arr, n)) return 1; if (decreasing(arr, n)) return -1; return 0; }
/*@ @ requires 0 < n <= 100000000; @ requires \valid(t+(0..n - 1)); @ ensures \forall integer i; 0 <= i < n ==> t[i] == 2 * i; @ assigns t[0..n-1]; */
void double_(int t[], int n) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall integer j; 0 <= j < i ==> t[j] == 2 * j; @ loop assigns t[0..n-1], i; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { t[i] = 2 * i; } }
true
17
17
void double_(int t[], int n) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall integer j; 0 <= j < i ==> t[j] == 2 * j; @ loop assigns t[0..n-1], i; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { t[i] = 2 * i; } }
/*@ @ requires 0 < n <= 100000000; @ requires \valid(t+(0..n - 1)); @ ensures \forall integer i; 0 <= i < n ==> t[i] == 2 * i; @ assigns t[0..n-1]; */
frama_c_files_v2/test_frama_c_1554.c
typedef enum{ VRAI=1, FALSE=0 }T_BOOLEEN; /*@logic T_BOOLEEN test (integer b)= @ @ ((b==1)? @ (T_BOOLEEN)VRAI @ : (T_BOOLEEN)FALSE); @*/ /*@ensures \result == test(boo); @*/ T_BOOLEEN test(int boo) { T_BOOLEEN b; if (boo==1) b = VRAI; else b= FALSE; return b; }
typedef enum{ VRAI=1, FALSE=0 }T_BOOLEEN; /*@logic T_BOOLEEN test (integer b)= @ @ ((b==1)? @ (T_BOOLEEN)VRAI @ : (T_BOOLEEN)FALSE); @*/
T_BOOLEEN test(int boo) { T_BOOLEEN b; if (boo==1) b = VRAI; else b= FALSE; return b; }
true
2
2
T_BOOLEEN test(int boo) { T_BOOLEEN b; if (boo==1) b = VRAI; else b= FALSE; return b; }
typedef enum{ VRAI=1, FALSE=0 }T_BOOLEEN; /*@logic T_BOOLEEN test (integer b)= @ @ ((b==1)? @ (T_BOOLEEN)VRAI @ : (T_BOOLEEN)FALSE); @*/
frama_c_files_v2/test_frama_c_1731.c
/* Run with: * * frama-c -wp -wp-prover alt-ergo -wp-rte -wp-timeout 60 -wp-verbose 0 samenum.c -then -report * * Tested with Frama-C Phosphorus-20170501. */ #define MAXN 1000000 #define MAXV 2000000 /*@ predicate isPair{L}(integer N, int* x, integer i, integer j) = @ 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate existsPair{L}(integer N, int* x) = @ \exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate isValidSolution{L}(integer N, int* x, integer r) = @ existsPair{L}(N, x) ? @ (\exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L) ==> r == j - i) && @ (\forall integer n, m; 0 <= n < m < N && \at(x[n], L) == \at(x[m], L) ==> r >= m - n) @ : r == 0; @*/ /*@ requires 0 <= N <= MAXN; @ requires \valid(x + (0..N-1)); @ requires \forall integer j; 0 <= j < N ==> 0 <= x[j] <= MAXV; @ ensures isValidSolution(N, x, \result); @*/ int samenum(int N, int *x) { int p[MAXV+1]; /*@ loop invariant 0 <= i <= MAXV+1; @ loop invariant \forall integer j; 0 <= j < i ==> p[j] == -1; @ loop assigns i, p[0 .. MAXV]; @ loop variant MAXV - i; @*/ for (int i = 0; i <= MAXV; ++i) p[i] = -1; int best = 0; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; i <= j < N ==> p[x[j]] >= -1; @ loop invariant \forall integer j; 0 <= j < i ==> (best >= j - p[x[j]] || p[x[j]] == j); @ loop invariant best >= 0; @ loop invariant \forall integer j; 0 <= j <= MAXV && p[j] >= 0 <==> (\exists integer k; 0 <= k < i && x[k] == j); @ loop invariant \forall integer j, k; 0 <= k <= j < i && x[j] == x[k] ==> p[x[j]] <= k; @ loop invariant isValidSolution(i, x, best); @ loop assigns i, best, p[0 .. MAXV]; @ loop variant N - i; @*/ for (int i = 0; i < N; ++i) { if (p[x[i]] == -1) p[x[i]] = i; else if (i-p[x[i]] > best) best = i-p[x[i]]; } return best; }
#define MAXN 1000000 #define MAXV 2000000 /*@ predicate isPair{L}(integer N, int* x, integer i, integer j) = @ 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate existsPair{L}(integer N, int* x) = @ \exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate isValidSolution{L}(integer N, int* x, integer r) = @ existsPair{L}(N, x) ? @ (\exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L) ==> r == j - i) && @ (\forall integer n, m; 0 <= n < m < N && \at(x[n], L) == \at(x[m], L) ==> r >= m - n) @ : r == 0; @*/ /*@ requires 0 <= N <= MAXN; @ requires \valid(x + (0..N-1)); @ requires \forall integer j; 0 <= j < N ==> 0 <= x[j] <= MAXV; @ ensures isValidSolution(N, x, \result); @*/
int samenum(int N, int *x) { int p[MAXV+1]; /*@ loop invariant 0 <= i <= MAXV+1; @ loop invariant \forall integer j; 0 <= j < i ==> p[j] == -1; @ loop assigns i, p[0 .. MAXV]; @ loop variant MAXV - i; @*/ for (int i = 0; i <= MAXV; ++i) p[i] = -1; int best = 0; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; i <= j < N ==> p[x[j]] >= -1; @ loop invariant \forall integer j; 0 <= j < i ==> (best >= j - p[x[j]] || p[x[j]] == j); @ loop invariant best >= 0; @ loop invariant \forall integer j; 0 <= j <= MAXV && p[j] >= 0 <==> (\exists integer k; 0 <= k < i && x[k] == j); @ loop invariant \forall integer j, k; 0 <= k <= j < i && x[j] == x[k] ==> p[x[j]] <= k; @ loop invariant isValidSolution(i, x, best); @ loop assigns i, best, p[0 .. MAXV]; @ loop variant N - i; @*/ for (int i = 0; i < N; ++i) { if (p[x[i]] == -1) p[x[i]] = i; else if (i-p[x[i]] > best) best = i-p[x[i]]; } return best; }
true
47
47
int samenum(int N, int *x) { int p[MAXV+1]; /*@ loop invariant 0 <= i <= MAXV+1; @ loop invariant \forall integer j; 0 <= j < i ==> p[j] == -1; @ loop assigns i, p[0 .. MAXV]; @ loop variant MAXV - i; @*/ for (int i = 0; i <= MAXV; ++i) p[i] = -1; int best = 0; /*@ loop invariant 0 <= i <= N; @ loop invariant \forall integer j; i <= j < N ==> p[x[j]] >= -1; @ loop invariant \forall integer j; 0 <= j < i ==> (best >= j - p[x[j]] || p[x[j]] == j); @ loop invariant best >= 0; @ loop invariant \forall integer j; 0 <= j <= MAXV && p[j] >= 0 <==> (\exists integer k; 0 <= k < i && x[k] == j); @ loop invariant \forall integer j, k; 0 <= k <= j < i && x[j] == x[k] ==> p[x[j]] <= k; @ loop invariant isValidSolution(i, x, best); @ loop assigns i, best, p[0 .. MAXV]; @ loop variant N - i; @*/ for (int i = 0; i < N; ++i) { if (p[x[i]] == -1) p[x[i]] = i; else if (i-p[x[i]] > best) best = i-p[x[i]]; } return best; }
#define MAXN 1000000 #define MAXV 2000000 /*@ predicate isPair{L}(integer N, int* x, integer i, integer j) = @ 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate existsPair{L}(integer N, int* x) = @ \exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L); @*/ /*@ predicate isValidSolution{L}(integer N, int* x, integer r) = @ existsPair{L}(N, x) ? @ (\exists integer i, j; 0 <= i < j < N && \at(x[i], L) == \at(x[j], L) ==> r == j - i) && @ (\forall integer n, m; 0 <= n < m < N && \at(x[n], L) == \at(x[m], L) ==> r >= m - n) @ : r == 0; @*/ /*@ requires 0 <= N <= MAXN; @ requires \valid(x + (0..N-1)); @ requires \forall integer j; 0 <= j < N ==> 0 <= x[j] <= MAXV; @ ensures isValidSolution(N, x, \result); @*/
frama_c_files_v2/test_frama_c_510.c
/* Run with: * * frama-c -wp -wp-prover alt-ergo -wp-rte -wp-print -wp-timeout 300 -wp-verbose 0 ex9_final.c -then -report * * Tested with Frama-C Sulfur-20171101. * Η ορθότητα του προγράμματος εξασφαλίζεται πρώτον από το loop invariant της γραμμής 52, που λέει ουσιαστικά ότι, από * όλες τις θέσεις του a που η επανάληψη έχει προσπεράσει, καμία τιμή σε αυτές τις θέσεις * δεν έχει αντίγραφο σε προηγούμενη θέση του a, και δεύτερον από το ensures της γραμμής 38, της οποίας το predicate * ελέγχει για την ορθότητα του αποτελέσματος που επιστρέφεται από τη συνάρτηση. */ #include <stdbool.h> #define MAXV 1000000 /*@ predicate noDouble{L}(int n, int *a) = @ \forall integer i; 0 <= i < n-1 ==> @ \forall integer j; i+1 <= j < n ==> \at(a[i], L) != \at(a[j], L); @*/ /*@ predicate existsDoubleRes{L}(int n, int *a, int res) = @ \exists integer i, j; 0 <= i < j < n ==> res == \at(a[i], L) && res == \at(a[j], L); @*/ /*@ predicate validateResult{L}(int n, int *a, int res) = @ res == 0 ? @ noDouble{L}(n, a) : @ existsDoubleRes{L}(n, a, res); @*/ /*@ requires 0 < N <= MAXV; @ requires \valid(a + (0..(N-1))); @ requires \forall integer i; 0 <= i < N ==> 1 <= a[i] <= MAXV; @ assigns \nothing; @ ensures 0 <= \result <= MAXV; @ ensures validateResult(N, a, \result); @*/ int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer k; 1 <= k < i ==> f[k-1] == false; @ loop variant MAXV-i; @*/ for (int i = 1; i <= MAXV; ++i) f[i-1] = false; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 0 <= i <= N; @ loop invariant \forall integer k; 0<=k<i ==> f[a[k]-1] == true; @ loop invariant \forall integer k; 0 < k < i ==> @ \forall integer l; 0 <= l < k ==> a[k] != a[l]; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) if (f[a[i]-1]) return a[i]; else f[a[i]-1] = true; return 0; }
#include <stdbool.h> #define MAXV 1000000 /*@ predicate noDouble{L}(int n, int *a) = @ \forall integer i; 0 <= i < n-1 ==> @ \forall integer j; i+1 <= j < n ==> \at(a[i], L) != \at(a[j], L); @*/ /*@ predicate existsDoubleRes{L}(int n, int *a, int res) = @ \exists integer i, j; 0 <= i < j < n ==> res == \at(a[i], L) && res == \at(a[j], L); @*/ /*@ predicate validateResult{L}(int n, int *a, int res) = @ res == 0 ? @ noDouble{L}(n, a) : @ existsDoubleRes{L}(n, a, res); @*/ /*@ requires 0 < N <= MAXV; @ requires \valid(a + (0..(N-1))); @ requires \forall integer i; 0 <= i < N ==> 1 <= a[i] <= MAXV; @ assigns \nothing; @ ensures 0 <= \result <= MAXV; @ ensures validateResult(N, a, \result); @*/
int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer k; 1 <= k < i ==> f[k-1] == false; @ loop variant MAXV-i; @*/ for (int i = 1; i <= MAXV; ++i) f[i-1] = false; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 0 <= i <= N; @ loop invariant \forall integer k; 0<=k<i ==> f[a[k]-1] == true; @ loop invariant \forall integer k; 0 < k < i ==> @ \forall integer l; 0 <= l < k ==> a[k] != a[l]; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) if (f[a[i]-1]) return a[i]; else f[a[i]-1] = true; return 0; }
true
39
39
int findDouble(int N, int a[]) { bool f[MAXV]; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 1 <= i <= (MAXV+1); @ loop invariant \forall integer k; 1 <= k < i ==> f[k-1] == false; @ loop variant MAXV-i; @*/ for (int i = 1; i <= MAXV; ++i) f[i-1] = false; /*@ loop assigns i, f[0..(MAXV-1)]; @ loop invariant 0 <= i <= N; @ loop invariant \forall integer k; 0<=k<i ==> f[a[k]-1] == true; @ loop invariant \forall integer k; 0 < k < i ==> @ \forall integer l; 0 <= l < k ==> a[k] != a[l]; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) if (f[a[i]-1]) return a[i]; else f[a[i]-1] = true; return 0; }
#include <stdbool.h> #define MAXV 1000000 /*@ predicate noDouble{L}(int n, int *a) = @ \forall integer i; 0 <= i < n-1 ==> @ \forall integer j; i+1 <= j < n ==> \at(a[i], L) != \at(a[j], L); @*/ /*@ predicate existsDoubleRes{L}(int n, int *a, int res) = @ \exists integer i, j; 0 <= i < j < n ==> res == \at(a[i], L) && res == \at(a[j], L); @*/ /*@ predicate validateResult{L}(int n, int *a, int res) = @ res == 0 ? @ noDouble{L}(n, a) : @ existsDoubleRes{L}(n, a, res); @*/ /*@ requires 0 < N <= MAXV; @ requires \valid(a + (0..(N-1))); @ requires \forall integer i; 0 <= i < N ==> 1 <= a[i] <= MAXV; @ assigns \nothing; @ ensures 0 <= \result <= MAXV; @ ensures validateResult(N, a, \result); @*/
frama_c_files_v2/test_frama_c_2620.c
struct counter {int seconds,minutes,hours;}; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */ void tick() { if (c.seconds<59) c.seconds++; else { c.seconds = (c.seconds+1)%60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes+1)%60; if(c.hours <23) c.hours++; else c.hours=0; } }
struct counter {int seconds,minutes,hours;}; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */
void tick() { if (c.seconds<59) c.seconds++; else { c.seconds = (c.seconds+1)%60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes+1)%60; if(c.hours <23) c.hours++; else c.hours=0; } }
true
19
19
void tick() { if (c.seconds<59) c.seconds++; else { c.seconds = (c.seconds+1)%60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes+1)%60; if(c.hours <23) c.hours++; else c.hours=0; } }
struct counter {int seconds,minutes,hours;}; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */
frama_c_files_v2/test_frama_c_1298.c
#include <limits.h> /*@ assigns \nothing; ensures (\result==(x0*x0)); */ int square(int x0) { int x2 = x0 * x0; return x2; } /*@ assigns \nothing; ensures (\result==(((x6*x6)*x6)*x6)); */ int pow4(int x6) { int x8 = square(x6); int x9 = square(x8); return x9; } /*@ assigns \nothing; ensures (\result==(((x15*x15)*x15)*x15)); */ int pow4b(int x15) { int x17 = square(x15); int x18 = x17 * x17; return x18; }
#include <limits.h> /*@ requires x0 >= 0 && x0 <= 46340; // sqrt(INT_MAX) assigns \nothing; ensures \result == x0 * x0; */
int square(int x0) { int x2 = x0 * x0; return x2; }
true
6
6
int square(int x0) { int x2 = x0 * x0; return x2; }
#include <limits.h> /*@ requires x0 >= 0 && x0 <= 46340; // sqrt(INT_MAX) assigns \nothing; ensures \result == x0 * x0; */
frama_c_files_v2/test_frama_c_1382.c
#include <limits.h> #include <string.h> /*@ predicate match_w(char * x0) = ((x0[0]=='a') && (x0[1]=='a'));*/ /*@ assigns \nothing; ensures \result <==> match_w(x0); */ int match_w(char * x0) { char x2 = x0[0]; int x3 = x2 == 'a'; int x7; if (x3) { char x4 = x0[1]; int x5 = x4 == 'a'; int x6; if (x5) { x6 = 1/*true*/; } else { x6 = 0/*false*/; } x7 = x6; } else { x7 = 0/*false*/; } return x7; } /*@ predicate match_any_w(char * x8) = (\exists integer x10; (((0<=x10) && (x10<strlen(x8))) && match_w((x8+x10))));*/ /*@ requires ((strlen(x22)>=0) && \valid(x22+(0..(strlen(x22)+1)-1))); assigns \nothing; ensures ((((\result ==> match_any_w(x22)) && (match_any_w(x22) ==> \result)) && ((!\result) ==> (!match_any_w(x22)))) && ((!match_any_w(x22)) ==> (!\result))); */ int matcher(char * x22) { int x24 = 0; int x25 = 0; /*@ loop invariant (((((((0<=x25) && (x25<=strlen(x22))) && (0<=x24)) && (x24<=2)) && ((strlen(x22)>=0) && \valid(x22+(0..(strlen(x22)+1)-1)))) && (\forall int x89; (((0<=x89) && (x89<(x25-x24))) ==> (!match_w((x22+x89)))))) && (((x24==1) ==> ((x25>=1) && (x22[(x25-1)]=='a'))) && ((x24==2) ==> ((x25>=2) && ((x22[(x25-2)]=='a') && (x22[(x25-1)]=='a')))))); loop assigns x24, x25; loop variant ((((strlen(x22)*2)-(2*x25))+2)-x24); */ for (;;) { int x26 = x25; char x27 = x22[x26]; int x29 = x27 == '\0'; int x33; if (x29) { x33 = 0/*false*/; } else { int x30 = x24; int x31 = x30 < 2; x33 = x31; } if (!x33) break; int x35 = x24; int x36 = x35 == 0; if (x36) { int x37 = x25; char x38 = x22[x37]; int x39 = 'a' == x38; if (x39) { x24 += 1; x25 += 1; } else { x24 = 0; x25 += 1; } } else { int x48 = x35 == 1; if (x48) { int x49 = x25; char x50 = x22[x49]; int x51 = 'a' == x50; if (x51) { x24 += 1; x25 += 1; } else { x24 = 0; } } else { } } } int x153 = x24; int x154 = x153 == 2; return x154; }
#include <string.h> /*@ predicate match_w(char *x0) = x0[0] == 'a' && x0[1] == 'a'; */ /*@ requires \valid_read(x0 + (0 .. 1)); assigns \nothing; ensures \result <==> match_w(x0); */
int match_w(char *x0) { return (x0[0] == 'a' && x0[1] == 'a'); }
true
8
8
int match_w(char *x0) { return (x0[0] == 'a' && x0[1] == 'a'); }
#include <string.h> /*@ predicate match_w(char *x0) = x0[0] == 'a' && x0[1] == 'a'; */ /*@ requires \valid_read(x0 + (0 .. 1)); assigns \nothing; ensures \result <==> match_w(x0); */
frama_c_files_v2/test_frama_c_2919.c
struct list { int hd; struct list *next; }; /*@ inductive reachable{L}(struct list *root, struct list *to) { @ case empty: \forall struct list *l; reachable(l,l); @ case non_empty: \forall struct list *l1, *l2; \valid(l1) && reachable(l1->next, l2) ==> reachable(l1, l2); @ } */ /*@ requires reachable(p, \null); assigns { q->hd | struct list *q; reachable(p,q)}; */ void incr_list(struct list *p) { while (p) { p->hd++; p = p->next;} }
struct list { int hd; struct list *next; }; /*@ inductive reachable{L}(struct list *root, struct list *to) { @ case empty: \forall struct list *l; reachable(l,l); @ case non_empty: \forall struct list *l1, *l2; \valid(l1) && reachable(l1->next, l2) ==> reachable(l1, l2); @ } */ /*@ requires reachable(p, \null); requires \forall struct list *q; reachable(p, q) ==> \valid(q); assigns p->hd, p->next; // minimal assigns (adjusted for syntax) */
void incr_list(struct list *p) { while (p) { p->hd++; p = p->next; } }
true
7
7
void incr_list(struct list *p) { while (p) { p->hd++; p = p->next; } }
struct list { int hd; struct list *next; }; /*@ inductive reachable{L}(struct list *root, struct list *to) { @ case empty: \forall struct list *l; reachable(l,l); @ case non_empty: \forall struct list *l1, *l2; \valid(l1) && reachable(l1->next, l2) ==> reachable(l1, l2); @ } */ /*@ requires reachable(p, \null); requires \forall struct list *q; reachable(p, q) ==> \valid(q); assigns p->hd, p->next; // minimal assigns (adjusted for syntax) */
frama_c_files_v2/test_frama_c_892.c
/*@ predicate sorted{L}(long *t, integer a, integer b) = @ \forall integer i,j; a <= i <= j <= b ==> t[i] <= t[j]; @*/ /*@ requires n >= 0 && \valid_range(t,0,n-1); @ ensures -1 <= \result < n; @ behavior success: @ ensures \result >= 0 ==> t[\result] == v; @ behavior failure: @ assumes sorted(t,0,n-1); @ ensures \result == -1 ==> @ \forall integer k; 0 <= k < n ==> t[k] != v; @*/ int binary_search(long t[], int n, long v) { int l = 0, u = n-1; /*@ loop invariant @ 0 <= l && u <= n-1; @ for failure: @ loop invariant @ \forall integer k; 0 <= k < n && t[k] == v ==> l <= k <= u; @ loop variant u-l; @*/ while (l <= u ) { int m = (l + u) / 2; //@ assert l <= m <= u; if (t[m] < v) l = m + 1; else if (t[m] > v) u = m - 1; else return m; } return -1; }
/*@ predicate sorted{L}(long *t, integer a, integer b) = @ \forall integer i, j; a <= i <= j <= b ==> t[i] <= t[j]; @*/ /*@ requires n >= 0 && \valid_range(t, 0, n - 1); @ requires sorted(t, 0, n - 1); @ ensures -1 <= \result < n; @ behavior success: @ assumes \exists integer k; 0 <= k < n && t[k] == v; @ ensures t[\result] == v; @ behavior failure: @ assumes \forall integer k; 0 <= k < n ==> t[k] != v; @ ensures \result == -1; @ complete behaviors; @ disjoint behaviors; @*/
int binary_search(long t[], int n, long v) { int l = 0, u = n - 1; /*@ loop invariant 0 <= l && u < n; loop invariant \forall integer k; 0 <= k < l ==> t[k] < v; loop invariant \forall integer k; u < k < n ==> t[k] > v; loop assigns l, u; loop variant u - l + 1; @*/ while (l <= u) { int m = l + (u - l) / 2; if (t[m] < v) { l = m + 1; } else if (t[m] > v) { u = m - 1; } else { return m; } } return -1; }
true
25
25
int binary_search(long t[], int n, long v) { int l = 0, u = n - 1; /*@ loop invariant 0 <= l && u < n; loop invariant \forall integer k; 0 <= k < l ==> t[k] < v; loop invariant \forall integer k; u < k < n ==> t[k] > v; loop assigns l, u; loop variant u - l + 1; @*/ while (l <= u) { int m = l + (u - l) / 2; if (t[m] < v) { l = m + 1; } else if (t[m] > v) { u = m - 1; } else { return m; } } return -1; }
/*@ predicate sorted{L}(long *t, integer a, integer b) = @ \forall integer i, j; a <= i <= j <= b ==> t[i] <= t[j]; @*/ /*@ requires n >= 0 && \valid_range(t, 0, n - 1); @ requires sorted(t, 0, n - 1); @ ensures -1 <= \result < n; @ behavior success: @ assumes \exists integer k; 0 <= k < n && t[k] == v; @ ensures t[\result] == v; @ behavior failure: @ assumes \forall integer k; 0 <= k < n ==> t[k] != v; @ ensures \result == -1; @ complete behaviors; @ disjoint behaviors; @*/
frama_c_files_v2/test_frama_c_1431.c
// This program used an advanced ACSL clause: \max() // Note: Some versions of 'wp' plugin may not support the \lambda clause. // The program may not verify in every machine. /*@ requires n > 0; requires \valid_read(arr+(0..n-1)); ensures \result == \max(0, n-1, \lambda integer i; arr[i]); assigns \nothing; */ int array_max_advanced(int* arr, int n) { int max = arr[0]; for (int i = 0; i < n; i++) { if (arr[i] > max) { max = arr[i]; } } return max; }
/*@ requires n > 0; requires \valid_read(arr + (0 .. n - 1)); assigns \nothing; ensures \forall integer i; 0 <= i < n ==> \result >= arr[i]; ensures \exists integer i; 0 <= i < n && \result == arr[i]; */
int array_max_advanced(int* arr, int n) { int max = arr[0]; /*@ loop invariant 1 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> max >= arr[k]; loop invariant \exists integer k; 0 <= k < i && max == arr[k]; loop assigns i, max; loop variant n - i; */ for (int i = 1; i < n; i++) { if (arr[i] > max) { max = arr[i]; } } return max; }
true
18
18
int array_max_advanced(int* arr, int n) { int max = arr[0]; /*@ loop invariant 1 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> max >= arr[k]; loop invariant \exists integer k; 0 <= k < i && max == arr[k]; loop assigns i, max; loop variant n - i; */ for (int i = 1; i < n; i++) { if (arr[i] > max) { max = arr[i]; } } return max; }
/*@ requires n > 0; requires \valid_read(arr + (0 .. n - 1)); assigns \nothing; ensures \forall integer i; 0 <= i < n ==> \result >= arr[i]; ensures \exists integer i; 0 <= i < n && \result == arr[i]; */
frama_c_files_v2/test_frama_c_1768.c
// Returns the index of an element in a given array /*@ requires n>0; requires \valid(t+(0..n-1)); behavior success: assumes \exists integer i; 0<=i<n && t[i] == e; ensures 0 <= \result < n && t[\result]==e; behavior failure: assumes \forall integer i; 0<=i<n ==> t[i]!=e; ensures \result==-1; */ int index(int t[],int n,int e) { /*@ loop invariant 0<=i<=n; loop invariant \forall integer j; 0<=j<i ==> t[j] == e; loop variant n-i; */ for(int i=0;i<n;i++) { if( t[i] == e ) return i; } return -1; }
/*@ requires n>0; requires \valid(t+(0..n-1)); behavior success: assumes \exists integer i; 0<=i<n && t[i] == e; ensures 0 <= \result < n && t[\result]==e; behavior failure: assumes \forall integer i; 0<=i<n ==> t[i]!=e; ensures \result==-1; */
int index(int t[],int n,int e) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] != e; loop assigns i; loop variant n - i; */ for (int i = 0; i < n; i++) { if (t[i] == e) return i; } return -1; }
true
13
13
int index(int t[],int n,int e) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] != e; loop assigns i; loop variant n - i; */ for (int i = 0; i < n; i++) { if (t[i] == e) return i; } return -1; }
/*@ requires n>0; requires \valid(t+(0..n-1)); behavior success: assumes \exists integer i; 0<=i<n && t[i] == e; ensures 0 <= \result < n && t[\result]==e; behavior failure: assumes \forall integer i; 0<=i<n ==> t[i]!=e; ensures \result==-1; */
frama_c_files_v2/test_frama_c_2188.c
/*@ @ requires n > 0; @ requires \valid(a+(0..n - 1)); @ @ assigns \nothing; @ behavior okay_: @ assumes \exists int i; 0 <= i < n && a[i] == val; @ ensures 0 <= \result < n; @ ensures \forall int i; 0 <= i < \result ==> a[i] != val; @ ensures a[\result] == val; @ behavior not_okay_: @ assumes \forall int i; 0 <= i < n && a[i] != val; @ ensures \result == n; */ int find(int a[], int n, int val) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> a[j] != val; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { if (a[i] == val) return i; } return n; }
/*@ @ requires n > 0; @ requires \valid(a+(0..n - 1)); @ @ assigns \nothing; @ behavior okay_: @ assumes \exists int i; 0 <= i < n && a[i] == val; @ ensures 0 <= \result < n; @ ensures \forall int i; 0 <= i < \result ==> a[i] != val; @ ensures a[\result] == val; @ behavior not_okay_: @ assumes \forall int i; 0 <= i < n && a[i] != val; @ ensures \result == n; */
int find(int a[], int n, int val) { int i = 0; /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> a[j] != val; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (a[i] == val) return i; i++; } return n; }
true
18
18
int find(int a[], int n, int val) { int i = 0; /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> a[j] != val; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (a[i] == val) return i; i++; } return n; }
/*@ @ requires n > 0; @ requires \valid(a+(0..n - 1)); @ @ assigns \nothing; @ behavior okay_: @ assumes \exists int i; 0 <= i < n && a[i] == val; @ ensures 0 <= \result < n; @ ensures \forall int i; 0 <= i < \result ==> a[i] != val; @ ensures a[\result] == val; @ behavior not_okay_: @ assumes \forall int i; 0 <= i < n && a[i] != val; @ ensures \result == n; */
frama_c_files_v2/test_frama_c_894.c
/*@ requires n>0; requires \valid(t+(0..n-1)); ensures \forall integer i; 0<=i<n ==> t[\result]<=t[i]; ensures \exists integer i; 0<=i<n && t[\result]<=t[i]; */ int minarray(int t[],int n) { int index=0; /*@ loop invariant 0<=i<=n; loop invariant 0<=index<n; loop invariant \forall integer j; 0<=j<i ==> t[index]<=t[j]; loop variant n-1-i; */ for(int i=0;i<n;i++) { if ( t[i] < t[index] ) index = i; } return index; }
/*@ requires n>0; requires \valid(t+(0..n-1)); ensures \forall integer i; 0<=i<n ==> t[\result]<=t[i]; ensures \exists integer i; 0<=i<n && t[\result]<=t[i]; */
int minarray(int t[],int n) { int index=0; int i = 0; /*@ loop invariant 0<=i<=n; loop invariant 0<=index<n; loop invariant \forall integer j; 0<=j<i ==> t[index]<=t[j]; loop assigns i, index; loop variant n-i; */ while (i < n) { if ( t[i] < t[index] ) index = i; i++; } return index; }
true
16
16
int minarray(int t[],int n) { int index=0; int i = 0; /*@ loop invariant 0<=i<=n; loop invariant 0<=index<n; loop invariant \forall integer j; 0<=j<i ==> t[index]<=t[j]; loop assigns i, index; loop variant n-i; */ while (i < n) { if ( t[i] < t[index] ) index = i; i++; } return index; }
/*@ requires n>0; requires \valid(t+(0..n-1)); ensures \forall integer i; 0<=i<n ==> t[\result]<=t[i]; ensures \exists integer i; 0<=i<n && t[\result]<=t[i]; */
frama_c_files_v2/test_frama_c_2622.c
// =================== Exercies 1 =================== /*@ @ ensures \result >= a; @ ensures \result >= b; @ ensures \result >= c; @ ensures \result == a || \result == b || \result == c; @ assigns \nothing; */ int max3(int a, int b, int c) { if (a >= b && a >= c) return a; if (b >= b && b >= c) return b; return c; } // =================== Exercies 2 =================== /*@ @ requires 0 < n <= 100000000; @ requires \valid(t+(0..n - 1)); @ @ ensures \forall int i; 0 <= i < n ==> t[i] == 2 * i; */ void double_(int t[], int n) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> t[j] == 2 * j; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { t[i] = 2 * i; } } // =================== Exercies 3 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ ensures \result == 0; */ int increasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] > arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] <= arr[i - 1]) return 0; } return 1; } // =================== Exercies 4 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int decreasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] < arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] >= arr[i - 1]) return 0; } return 1; } /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior increaing: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior decreasing: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == -1; @ behavior none: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int monotomic(int arr[], int n) { if (increasing(arr, n)) return 1; if (decreasing(arr, n)) return -1; return 0; }
/*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ ensures \result == 0; */ int increasing(int arr[], int n);
int increasing(int arr[], int n) { int i = 1; /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] > arr[j - 1]; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (arr[i] <= arr[i - 1]) return 0; i++; } return 1; }
true
18
18
int increasing(int arr[], int n) { int i = 1; /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] > arr[j - 1]; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (arr[i] <= arr[i - 1]) return 0; i++; } return 1; }
/*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ ensures \result == 0; */ int increasing(int arr[], int n);
frama_c_files_v2/test_frama_c_2622.c
// =================== Exercies 1 =================== /*@ @ ensures \result >= a; @ ensures \result >= b; @ ensures \result >= c; @ ensures \result == a || \result == b || \result == c; @ assigns \nothing; */ int max3(int a, int b, int c) { if (a >= b && a >= c) return a; if (b >= b && b >= c) return b; return c; } // =================== Exercies 2 =================== /*@ @ requires 0 < n <= 100000000; @ requires \valid(t+(0..n - 1)); @ @ ensures \forall int i; 0 <= i < n ==> t[i] == 2 * i; */ void double_(int t[], int n) { /*@ @ loop invariant 0 <= i <= n; @ loop invariant \forall int j; 0 <= j < i ==> t[j] == 2 * j; @ loop variant n - i; */ for (int i = 0; i < n; ++i) { t[i] = 2 * i; } } // =================== Exercies 3 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ ensures \result == 0; */ int increasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] > arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] <= arr[i - 1]) return 0; } return 1; } // =================== Exercies 4 =================== /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int decreasing(int arr[], int n) { /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] < arr[j - 1]; @ loop variant n - i; */ for (int i = 1; i < n; ++i) { if (arr[i] >= arr[i - 1]) return 0; } return 1; } /*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior increaing: @ assumes \forall int i; 1 <= i < n ==> arr[i] > arr[i - 1]; @ ensures \result == 1; @ behavior decreasing: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == -1; @ behavior none: @ assumes \exists int i; 1 <= i < n && arr[i] <= arr[i - 1]; @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int monotomic(int arr[], int n) { if (increasing(arr, n)) return 1; if (decreasing(arr, n)) return -1; return 0; }
/*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int decreasing(int arr[], int n);
int decreasing(int arr[], int n) { int i = 1; /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] < arr[j - 1]; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (arr[i] >= arr[i - 1]) return 0; i++; } return 1; }
true
18
18
int decreasing(int arr[], int n) { int i = 1; /*@ @ loop invariant 1 <= i <= n; @ loop invariant \forall int j; 1 <= j < i ==> arr[j] < arr[j - 1]; @ loop assigns i; @ loop variant n - i; */ while (i < n) { if (arr[i] >= arr[i - 1]) return 0; i++; } return 1; }
/*@ @ requires \valid(arr+(0.. n - 1)); @ requires n > 0; @ @ assigns \nothing; @ behavior true_: @ assumes \forall int i; 1 <= i < n ==> arr[i] < arr[i - 1]; @ ensures \result == 1; @ behavior false_: @ assumes \exists int i; 1 <= i < n && arr[i] >= arr[i - 1]; @ ensures \result == 0; */ int decreasing(int arr[], int n);
frama_c_files_v2/test_frama_c_534.c
/*@ @ requires 0 <= n <= 1000; @ ensures 2 * \result == n * (n + 1); @ assigns \nothing; */ int sum_n(int n) { int res = 0; /*@ @ loop invariant 0 <= i <= n + 1; @ loop invariant 2 * res == i * (i - 1); @ loop variant n - i + 1; */ for (int i = 0; i <= n; ++i) { res += i; } return res; }
/*@ @ requires 0 <= n <= 1000; @ ensures 2 * \result == n * (n + 1); @ assigns \nothing; */
int sum_n(int n) { int res = 0; int i = 0; /*@ @ loop invariant 0 <= i <= n + 1; @ loop invariant 2 * res == i * (i - 1); @ loop assigns i, res; @ loop variant n - i + 1; */ for (; i <= n; ++i) { res += i; } return res; }
true
14
14
int sum_n(int n) { int res = 0; int i = 0; /*@ @ loop invariant 0 <= i <= n + 1; @ loop invariant 2 * res == i * (i - 1); @ loop assigns i, res; @ loop variant n - i + 1; */ for (; i <= n; ++i) { res += i; } return res; }
/*@ @ requires 0 <= n <= 1000; @ ensures 2 * \result == n * (n + 1); @ assigns \nothing; */
frama_c_files_v2/test_frama_c_2783.c
#include <limits.h> #include <string.h> char * p_HTTP(char * x1096); char * p_(char * x1098); char * p_ContentLength(char * x1100); /*@ requires ((strlen(x0)>=0) && \valid(x0+(0..strlen(x0)))); assigns \nothing; */ int p(char * x0) { int x2 = -1; char *x3 = p_HTTP(x0); int x5 = 1/*true*/; int x6 = 0; char *x7 = 0/*null*/; int x8 = 1/*true*/; int x9 = 0; char *x10 = 0/*null*/; int x11 = 1/*true*/; int x12 = 0; char *x13 = 0/*null*/; int x14 = 1/*true*/; int x15 = 0; char *x16 = 0/*null*/; int x17 = 1/*true*/; char *x19 = 0/*null*/; int x20 = 1/*true*/; char *x22 = 0/*null*/; int x23 = 1/*true*/; char x24 = '\0'; char *x25 = 0/*null*/; int x26 = 1/*true*/; char *x28 = 0/*null*/; int x29 = 1/*true*/; char *x31 = 0/*null*/; int x32 = 0 == x3; if (x32) { x31 = x0; } else { x29 = 0/*false*/; x31 = x3; } int x40 = x29; if (x40) { char *x41 = x31; x28 = x41; } else { char *x45 = x31; int x52 = 1/*true*/; char x53 = '\0'; char *x54 = 0/*null*/; char x46 = x45[0]; int x47 = x46 == '\0'; if (x47) { x54 = x45; } else { int x48 = x46 >= '0'; int x50; if (x48) { int x49 = x46 <= '9'; x50 = x49; } else { x50 = 0/*false*/; } if (x50) { x52 = 0/*false*/; x53 = x46; char *x51 = x45+1; x54 = x51; } else { x54 = x45; } } int x66 = x52; if (x66) { char *x67 = x54; x28 = x67; } else { char x70 = x53; char *x71 = x54; char *x72 = x71; int x73 = 1/*true*/; /*@ loop invariant ((strlen(x72)>=0) && \valid(x72+(0..strlen(x72)))); loop assigns x72, x73; */ for (;;) { int x74 = x73; if (!x74) break; char *x76 = x72; char x77 = x76[0]; int x78 = x77 == '\0'; if (x78) { x73 = 0/*false*/; } else { int x79 = x77 >= '0'; int x81; if (x79) { int x80 = x77 <= '9'; x81 = x80; } else { x81 = 0/*false*/; } if (x81) { char *x82 = x76+1; x72 = x82; } else { x73 = 0/*false*/; } } } char *x106 = x72; x26 = 0/*false*/; x28 = x106; } } int x114 = x26; if (x114) { char *x115 = x28; x25 = x115; } else { char *x119 = x28; char x120 = x119[0]; int x121 = x120 == '\0'; if (x121) { x25 = x119; } else { int x122 = x120 == '.'; if (x122) { x23 = 0/*false*/; x24 = x120; char *x123 = x119+1; x25 = x123; } else { x25 = x119; } } } int x137 = x23; if (x137) { char *x138 = x25; x22 = x138; } else { char x141 = x24; char *x142 = x25; int x149 = 1/*true*/; char x150 = '\0'; char *x151 = 0/*null*/; char x143 = x142[0]; int x144 = x143 == '\0'; if (x144) { x151 = x142; } else { int x145 = x143 >= '0'; int x147; if (x145) { int x146 = x143 <= '9'; x147 = x146; } else { x147 = 0/*false*/; } if (x147) { x149 = 0/*false*/; x150 = x143; char *x148 = x142+1; x151 = x148; } else { x151 = x142; } } int x163 = x149; if (x163) { char *x164 = x151; x22 = x164; } else { char x167 = x150; char *x168 = x151; char *x169 = x168; int x170 = 1/*true*/; /*@ loop invariant ((strlen(x169)>=0) && \valid(x169+(0..strlen(x169)))); loop assigns x169, x170; */ for (;;) { int x171 = x170; if (!x171) break; char *x173 = x169; char x174 = x173[0]; int x175 = x174 == '\0'; if (x175) { x170 = 0/*false*/; } else { int x176 = x174 >= '0'; int x178; if (x176) { int x177 = x174 <= '9'; x178 = x177; } else { x178 = 0/*false*/; } if (x178) { char *x179 = x173+1; x169 = x179; } else { x170 = 0/*false*/; } } } char *x203 = x169; x20 = 0/*false*/; x22 = x203; } } int x211 = x20; if (x211) { char *x212 = x22; x19 = x212; } else { char *x216 = x22; char *x217 = x216; int x218 = 1/*true*/; /*@ loop invariant ((strlen(x217)>=0) && \valid(x217+(0..strlen(x217)))); loop assigns x217, x218; */ for (;;) { int x219 = x218; if (!x219) break; char *x221 = x217; char x222 = x221[0]; int x223 = x222 == '\0'; if (x223) { x218 = 0/*false*/; } else { int x224 = x222 == ' '; if (x224) { char *x225 = x221+1; x217 = x225; } else { x218 = 0/*false*/; } } } char *x249 = x217; x17 = 0/*false*/; x19 = x249; } int x255 = x17; if (x255) { char *x256 = x19; x16 = x256; } else { char *x260 = x19; int x267 = 1/*true*/; int x268 = 0; char *x269 = 0/*null*/; int x270 = 1/*true*/; char x271 = '\0'; char *x272 = 0/*null*/; char x261 = x260[0]; int x262 = x261 == '\0'; if (x262) { x272 = x260; } else { int x263 = x261 >= '0'; int x265; if (x263) { int x264 = x261 <= '9'; x265 = x264; } else { x265 = 0/*false*/; } if (x265) { x270 = 0/*false*/; x271 = x261; char *x266 = x260+1; x272 = x266; } else { x272 = x260; } } int x284 = x270; if (x284) { char *x285 = x272; x269 = x285; } else { char x288 = x271; char *x290 = x272; x267 = 0/*false*/; char x289 = x288 - '0'; x268 = x289; x269 = x290; } int x296 = x267; if (x296) { char *x297 = x269; x16 = x297; } else { int x300 = x268; char *x301 = x269; char *x302 = x301; int x303 = 1/*true*/; int x304 = x300; int x337 = INT_MAX; int x338 = x337 / 10; int x339 = x338 - 10; /*@ loop invariant (((strlen(x302)>=0) && \valid(x302+(0..strlen(x302)))) && ((x304==-1) || (0<=x304))); loop assigns x302, x303, x304; */ for (;;) { int x305 = x303; if (!x305) break; char *x307 = x302; int x314 = 1/*true*/; char x315 = '\0'; char *x316 = 0/*null*/; char x308 = x307[0]; int x309 = x308 == '\0'; if (x309) { x316 = x307; } else { int x310 = x308 >= '0'; int x312; if (x310) { int x311 = x308 <= '9'; x312 = x311; } else { x312 = 0/*false*/; } if (x312) { x314 = 0/*false*/; x315 = x308; char *x313 = x307+1; x316 = x313; } else { x316 = x307; } } int x328 = x314; if (x328) { char *x329 = x316; x303 = 0/*false*/; } else { char x332 = x315; char *x334 = x316; int x335 = x304; int x336 = x335 < 0; int x344; if (x336) { x344 = x335; } else { int x340 = x335 > x339; int x343; if (x340) { x343 = -1; } else { char x333 = x332 - '0'; int x341 = x335 * 10; int x342 = x341 + x333; x343 = x342; } x344 = x343; } x304 = x344; x302 = x334; } } int x370 = x304; char *x371 = x302; x14 = 0/*false*/; x15 = x370; x16 = x371; } } int x379 = x14; if (x379) { char *x380 = x16; x13 = x380; } else { int x383 = x15; char *x384 = x16; char *x385 = x384; int x386 = 1/*true*/; /*@ loop invariant ((strlen(x385)>=0) && \valid(x385+(0..strlen(x385)))); loop assigns x385, x386; */ for (;;) { int x387 = x386; if (!x387) break; char *x389 = x385; char x390 = x389[0]; int x391 = x390 == '\0'; if (x391) { x386 = 0/*false*/; } else { int x396 = x390 == '\r'; if (x396) { x386 = 0/*false*/; } else { char *x393 = x389+1; x385 = x393; } } } char *x418 = x385; int x419 = 1/*true*/; char *x421 = 0/*null*/; x419 = 0/*false*/; x421 = x418; int x425 = x419; if (x425) { char *x426 = x421; x13 = x426; } else { char *x430 = x421; char *x431 = p_(x430); int x433 = 1/*true*/; char *x435 = 0/*null*/; int x436 = 0 == x431; if (x436) { x435 = x430; } else { x433 = 0/*false*/; x435 = x431; } int x444 = x433; if (x444) { char *x445 = x435; x13 = x445; } else { char *x449 = x435; x11 = 0/*false*/; x12 = x383; x13 = x449; } } } int x459 = x11; if (x459) { char *x460 = x13; x10 = x460; } else { int x463 = x12; char *x464 = x13; char *x465 = x464; int x466 = 1/*true*/; int x467 = 0; int x337 = INT_MAX; int x338 = x337 / 10; int x339 = x338 - 10; int x953 = -2 == -2; /*@ loop invariant ((strlen(x465)>=0) && \valid(x465+(0..strlen(x465)))); loop assigns x465, x466, x467; */ for (;;) { int x468 = x466; if (!x468) break; char *x470 = x465; char *x471 = p_ContentLength(x470); int x473 = 1/*true*/; int x474 = 0; char *x475 = 0/*null*/; int x476 = 1/*true*/; int x477 = 0; char *x478 = 0/*null*/; int x479 = 1/*true*/; int x480 = 0; char *x481 = 0/*null*/; int x482 = 1/*true*/; int x483 = 0; char *x484 = 0/*null*/; int x485 = 1/*true*/; int x486 = 0; char *x487 = 0/*null*/; int x488 = 1/*true*/; char *x490 = 0/*null*/; int x491 = 0 == x471; if (x491) { x490 = x470; } else { x488 = 0/*false*/; x490 = x471; } int x499 = x488; if (x499) { char *x500 = x490; } else { char *x503 = x490; x485 = 0/*false*/; x486 = 1; x487 = x503; } int x509 = x485; if (x509) { char *x510 = x470; int x511 = 1/*true*/; /*@ loop invariant ((strlen(x510)>=0) && \valid(x510+(0..strlen(x510)))); loop assigns x510, x511; */ for (;;) { int x512 = x511; if (!x512) break; char *x514 = x510; char x515 = x514[0]; int x516 = x515 == '\0'; if (x516) { x511 = 0/*false*/; } else { int x518 = x515 == ':'; int x520; if (x518) { x520 = 0/*false*/; } else { int x519 = x515 != ' '; x520 = x519; } if (x520) { char *x521 = x514+1; x510 = x521; } else { x511 = 0/*false*/; } } } char *x545 = x510; x482 = 0/*false*/; x483 = 0; x484 = x545; } else { int x550 = x486; char *x551 = x487; x482 = 0/*false*/; x483 = x550; x484 = x551; } int x557 = x482; if (x557) { char *x558 = x484; x481 = x558; } else { int x561 = x483; char *x562 = x484; char *x563 = x562; int x564 = 1/*true*/; /*@ loop invariant ((strlen(x563)>=0) && \valid(x563+(0..strlen(x563)))); loop assigns x563, x564; */ for (;;) { int x565 = x564; if (!x565) break; char *x567 = x563; char x568 = x567[0]; int x569 = x568 == '\0'; if (x569) { x564 = 0/*false*/; } else { int x570 = x568 == ' '; if (x570) { char *x571 = x567+1; x563 = x571; } else { x564 = 0/*false*/; } } } char *x595 = x563; x479 = 0/*false*/; x480 = x561; x481 = x595; } int x601 = x479; if (x601) { char *x602 = x481; x478 = x602; } else { int x605 = x480; char *x606 = x481; int x611 = 1/*true*/; char x612 = '\0'; char *x613 = 0/*null*/; char x607 = x606[0]; int x608 = x607 == '\0'; if (x608) { x613 = x606; } else { int x609 = x607 == ':'; if (x609) { x611 = 0/*false*/; x612 = x607; char *x610 = x606+1; x613 = x610; } else { x613 = x606; } } int x625 = x611; if (x625) { char *x626 = x613; x478 = x626; } else { char x629 = x612; char *x630 = x613; x476 = 0/*false*/; x477 = x605; x478 = x630; } } int x638 = x476; if (x638) { char *x639 = x478; x475 = x639; } else { int x642 = x477; char *x643 = x478; char *x644 = x643; int x645 = 1/*true*/; /*@ loop invariant ((strlen(x644)>=0) && \valid(x644+(0..strlen(x644)))); loop assigns x644, x645; */ for (;;) { int x646 = x645; if (!x646) break; char *x648 = x644; char x649 = x648[0]; int x650 = x649 == '\0'; if (x650) { x645 = 0/*false*/; } else { int x651 = x649 == ' '; if (x651) { char *x652 = x648+1; x644 = x652; } else { x645 = 0/*false*/; } } } char *x676 = x644; x473 = 0/*false*/; x474 = x642; x475 = x676; } int x682 = x473; if (x682) { char *x683 = x475; x466 = 0/*false*/; } else { int x686 = x474; char *x687 = x475; char *x695 = x687; int x696 = 1/*true*/; /*@ loop invariant ((strlen(x695)>=0) && \valid(x695+(0..strlen(x695)))); loop assigns x695, x696; */ for (;;) { int x697 = x696; if (!x697) break; char *x699 = x695; char x700 = x699[0]; int x701 = x700 == '\0'; if (x701) { x696 = 0/*false*/; } else { int x706 = x700 == '\r'; if (x706) { x696 = 0/*false*/; } else { char *x703 = x699+1; x695 = x703; } } } char *x728 = x695; int x688 = x686 == 1; if (x688) { int x729 = 1/*true*/; int x730 = 0; char *x731 = 0/*null*/; int x732 = 1/*true*/; int x733 = 0; char *x734 = 0/*null*/; int x735 = 1/*true*/; int x736 = 0; char *x737 = 0/*null*/; int x738 = 1/*true*/; char x739 = '\0'; char *x740 = 0/*null*/; char x689 = x687[0]; int x690 = x689 == '\0'; if (x690) { x740 = x687; } else { int x691 = x689 >= '0'; int x693; if (x691) { int x692 = x689 <= '9'; x693 = x692; } else { x693 = 0/*false*/; } if (x693) { x738 = 0/*false*/; x739 = x689; char *x694 = x687+1; x740 = x694; } else { x740 = x687; } } int x752 = x738; if (x752) { char *x753 = x740; x737 = x753; } else { char x756 = x739; char *x758 = x740; x735 = 0/*false*/; char x757 = x756 - '0'; x736 = x757; x737 = x758; } int x764 = x735; if (x764) { char *x765 = x737; x734 = x765; } else { int x768 = x736; char *x769 = x737; char *x770 = x769; int x771 = 1/*true*/; int x772 = x768; /*@ loop invariant (((strlen(x770)>=0) && \valid(x770+(0..strlen(x770)))) && ((x772==-1) || (0<=x772))); loop assigns x770, x771, x772; */ for (;;) { int x773 = x771; if (!x773) break; char *x775 = x770; int x782 = 1/*true*/; char x783 = '\0'; char *x784 = 0/*null*/; char x776 = x775[0]; int x777 = x776 == '\0'; if (x777) { x784 = x775; } else { int x778 = x776 >= '0'; int x780; if (x778) { int x779 = x776 <= '9'; x780 = x779; } else { x780 = 0/*false*/; } if (x780) { x782 = 0/*false*/; x783 = x776; char *x781 = x775+1; x784 = x781; } else { x784 = x775; } } int x796 = x782; if (x796) { char *x797 = x784; x771 = 0/*false*/; } else { char x800 = x783; char *x802 = x784; int x803 = x772; int x804 = x803 < 0; int x809; if (x804) { x809 = x803; } else { int x805 = x803 > x339; int x808; if (x805) { x808 = -1; } else { char x801 = x800 - '0'; int x806 = x803 * 10; int x807 = x806 + x801; x808 = x807; } x809 = x808; } x772 = x809; x770 = x802; } } int x835 = x772; char *x836 = x770; x732 = 0/*false*/; x733 = x835; x734 = x836; } int x842 = x732; if (x842) { char *x843 = x734; x731 = x843; } else { int x846 = x733; char *x847 = x734; char *x848 = x847; int x849 = 1/*true*/; /*@ loop invariant ((strlen(x848)>=0) && \valid(x848+(0..strlen(x848)))); loop assigns x848, x849; */ for (;;) { int x850 = x849; if (!x850) break; char *x852 = x848; char x853 = x852[0]; int x854 = x853 == '\0'; if (x854) { x849 = 0/*false*/; } else { int x855 = x853 == ' '; if (x855) { char *x856 = x852+1; x848 = x856; } else { x849 = 0/*false*/; } } } char *x880 = x848; x729 = 0/*false*/; x730 = x846; x731 = x880; } int x886 = x729; if (x886) { char *x887 = x731; x466 = 0/*false*/; } else { int x890 = x730; char *x891 = x731; char *x892 = p_(x891); int x894 = 1/*true*/; char *x896 = 0/*null*/; int x897 = 0 == x892; if (x897) { x896 = x891; } else { x894 = 0/*false*/; x896 = x892; } int x905 = x894; if (x905) { char *x906 = x896; x466 = 0/*false*/; } else { char *x910 = x896; int x911 = x467; int x912 = x890 == -2; int x913; if (x912) { x913 = x911; } else { x913 = x890; } x467 = x913; x465 = x910; } } } else { int x921 = 1/*true*/; char *x923 = 0/*null*/; x921 = 0/*false*/; x923 = x728; int x927 = x921; if (x927) { char *x928 = x923; x466 = 0/*false*/; } else { char *x932 = x923; char *x933 = p_(x932); int x935 = 1/*true*/; char *x937 = 0/*null*/; int x938 = 0 == x933; if (x938) { x937 = x932; } else { x935 = 0/*false*/; x937 = x933; } int x946 = x935; if (x946) { char *x947 = x937; x466 = 0/*false*/; } else { char *x951 = x937; int x952 = x467; int x954; if (x953) { x954 = x952; } else { x954 = -2; } x467 = x954; x465 = x951; } } } } } int x981 = x467; char *x982 = x465; x8 = 0/*false*/; x9 = x981; x10 = x982; } int x988 = x8; if (x988) { char *x989 = x10; x7 = x989; } else { int x992 = x9; char *x993 = x10; char *x994 = p_(x993); int x996 = 1/*true*/; char *x998 = 0/*null*/; int x999 = 0 == x994; if (x999) { x998 = x993; } else { x996 = 0/*false*/; x998 = x994; } int x1007 = x996; if (x1007) { char *x1008 = x998; x7 = x1008; } else { char *x1012 = x998; x5 = 0/*false*/; x6 = x992; x7 = x1012; } } int x1020 = x5; if (x1020) { char *x1021 = x7; } else { int x1023 = x6; char *x1024 = x7; int x1026 = 1/*true*/; char *x1027 = x1024; /*@ loop invariant ((0<=x1029) && ((strlen(x1027)>=0) && \valid(x1027+(0..strlen(x1027))))); loop assigns x1029, x1026, x1027; loop variant (x6-x1029); */ for(int x1029=0; x1029 < x1023; x1029++) { int x1030 = x1026; if (x1030) { char *x1031 = x1027; char x1032 = x1031[0]; int x1033 = x1032 == '\0'; if (x1033) { x1026 = 0/*false*/; } else { char *x1034 = x1031+1; x1027 = x1034; } } else { } } int x1060 = x1026; char *x1061 = x1027; int x1025 = x1023 < 0; if (x1025) { } else { int x1062 = 1/*true*/; char *x1064 = 0/*null*/; if (x1060) { x1062 = 0/*false*/; x1064 = x1061; } else { x1064 = x1024; } int x1072 = x1062; if (x1072) { char *x1073 = x1064; } else { char *x1076 = x1064; char x1077 = x1076[0]; int x1078 = x1077 == '\0'; if (x1078) { x2 = x1023; } else { } } } } int x1088 = x2; return x1088; } /*@ requires ((strlen(x1102)>=0) && \valid(x1102+(0..strlen(x1102)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_HTTP(char * x1102) { char *x1104 = x1102; int x1109 = 1/*true*/; char x1110 = '\0'; char *x1111 = 0/*null*/; char x1105 = x1102[0]; int x1106 = x1105 == '\0'; if (x1106) { x1111 = x1102; } else { int x1107 = x1105 == 'H'; if (x1107) { x1109 = 0/*false*/; x1110 = x1105; char *x1108 = x1102+1; x1111 = x1108; } else { x1111 = x1102; } } int x1123 = x1109; if (x1123) { char *x1124 = x1111; x1104 = 0; } else { char x1127 = x1110; char *x1128 = x1111; int x1133 = 1/*true*/; char x1134 = '\0'; char *x1135 = 0/*null*/; char x1129 = x1128[0]; int x1130 = x1129 == '\0'; if (x1130) { x1135 = x1128; } else { int x1131 = x1129 == 'T'; if (x1131) { x1133 = 0/*false*/; x1134 = x1129; char *x1132 = x1128+1; x1135 = x1132; } else { x1135 = x1128; } } int x1147 = x1133; if (x1147) { char *x1148 = x1135; x1104 = 0; } else { char x1151 = x1134; char *x1152 = x1135; int x1157 = 1/*true*/; char x1158 = '\0'; char *x1159 = 0/*null*/; char x1153 = x1152[0]; int x1154 = x1153 == '\0'; if (x1154) { x1159 = x1152; } else { int x1155 = x1153 == 'T'; if (x1155) { x1157 = 0/*false*/; x1158 = x1153; char *x1156 = x1152+1; x1159 = x1156; } else { x1159 = x1152; } } int x1171 = x1157; if (x1171) { char *x1172 = x1159; x1104 = 0; } else { char x1175 = x1158; char *x1176 = x1159; int x1181 = 1/*true*/; char x1182 = '\0'; char *x1183 = 0/*null*/; char x1177 = x1176[0]; int x1178 = x1177 == '\0'; if (x1178) { x1183 = x1176; } else { int x1179 = x1177 == 'P'; if (x1179) { x1181 = 0/*false*/; x1182 = x1177; char *x1180 = x1176+1; x1183 = x1180; } else { x1183 = x1176; } } int x1195 = x1181; if (x1195) { char *x1196 = x1183; x1104 = 0; } else { char x1199 = x1182; char *x1200 = x1183; int x1205 = 1/*true*/; char x1206 = '\0'; char *x1207 = 0/*null*/; char x1201 = x1200[0]; int x1202 = x1201 == '\0'; if (x1202) { x1207 = x1200; } else { int x1203 = x1201 == '/'; if (x1203) { x1205 = 0/*false*/; x1206 = x1201; char *x1204 = x1200+1; x1207 = x1204; } else { x1207 = x1200; } } int x1219 = x1205; if (x1219) { char *x1220 = x1207; x1104 = 0; } else { char x1223 = x1206; char *x1224 = x1207; x1104 = x1224; } } } } } char *x1236 = x1104; return x1236; } /*@ requires ((strlen(x1252)>=0) && \valid(x1252+(0..strlen(x1252)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_(char * x1252) { char *x1254 = x1252; int x1259 = 1/*true*/; char x1260 = '\0'; char *x1261 = 0/*null*/; char x1255 = x1252[0]; int x1256 = x1255 == '\0'; if (x1256) { x1261 = x1252; } else { int x1257 = x1255 == '\r'; if (x1257) { x1259 = 0/*false*/; x1260 = x1255; char *x1258 = x1252+1; x1261 = x1258; } else { x1261 = x1252; } } int x1273 = x1259; if (x1273) { char *x1274 = x1261; x1254 = 0; } else { char x1277 = x1260; char *x1278 = x1261; int x1283 = 1/*true*/; char x1284 = '\0'; char *x1285 = 0/*null*/; char x1279 = x1278[0]; int x1280 = x1279 == '\0'; if (x1280) { x1285 = x1278; } else { int x1281 = x1279 == '\n'; if (x1281) { x1283 = 0/*false*/; x1284 = x1279; char *x1282 = x1278+1; x1285 = x1282; } else { x1285 = x1278; } } int x1297 = x1283; if (x1297) { char *x1298 = x1285; x1254 = 0; } else { char x1301 = x1284; char *x1302 = x1285; x1254 = x1302; } } char *x1308 = x1254; return x1308; } /*@ requires ((strlen(x1324)>=0) && \valid(x1324+(0..strlen(x1324)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_ContentLength(char * x1324) { char *x1326 = x1324; int x1331 = 1/*true*/; char x1332 = '\0'; char *x1333 = 0/*null*/; char x1327 = x1324[0]; int x1328 = x1327 == '\0'; if (x1328) { x1333 = x1324; } else { int x1329 = x1327 == 'C'; if (x1329) { x1331 = 0/*false*/; x1332 = x1327; char *x1330 = x1324+1; x1333 = x1330; } else { x1333 = x1324; } } int x1345 = x1331; if (x1345) { char *x1346 = x1333; x1326 = 0; } else { char x1349 = x1332; char *x1350 = x1333; int x1355 = 1/*true*/; char x1356 = '\0'; char *x1357 = 0/*null*/; char x1351 = x1350[0]; int x1352 = x1351 == '\0'; if (x1352) { x1357 = x1350; } else { int x1353 = x1351 == 'o'; if (x1353) { x1355 = 0/*false*/; x1356 = x1351; char *x1354 = x1350+1; x1357 = x1354; } else { x1357 = x1350; } } int x1369 = x1355; if (x1369) { char *x1370 = x1357; x1326 = 0; } else { char x1373 = x1356; char *x1374 = x1357; int x1379 = 1/*true*/; char x1380 = '\0'; char *x1381 = 0/*null*/; char x1375 = x1374[0]; int x1376 = x1375 == '\0'; if (x1376) { x1381 = x1374; } else { int x1377 = x1375 == 'n'; if (x1377) { x1379 = 0/*false*/; x1380 = x1375; char *x1378 = x1374+1; x1381 = x1378; } else { x1381 = x1374; } } int x1393 = x1379; if (x1393) { char *x1394 = x1381; x1326 = 0; } else { char x1397 = x1380; char *x1398 = x1381; int x1403 = 1/*true*/; char x1404 = '\0'; char *x1405 = 0/*null*/; char x1399 = x1398[0]; int x1400 = x1399 == '\0'; if (x1400) { x1405 = x1398; } else { int x1401 = x1399 == 't'; if (x1401) { x1403 = 0/*false*/; x1404 = x1399; char *x1402 = x1398+1; x1405 = x1402; } else { x1405 = x1398; } } int x1417 = x1403; if (x1417) { char *x1418 = x1405; x1326 = 0; } else { char x1421 = x1404; char *x1422 = x1405; int x1427 = 1/*true*/; char x1428 = '\0'; char *x1429 = 0/*null*/; char x1423 = x1422[0]; int x1424 = x1423 == '\0'; if (x1424) { x1429 = x1422; } else { int x1425 = x1423 == 'e'; if (x1425) { x1427 = 0/*false*/; x1428 = x1423; char *x1426 = x1422+1; x1429 = x1426; } else { x1429 = x1422; } } int x1441 = x1427; if (x1441) { char *x1442 = x1429; x1326 = 0; } else { char x1445 = x1428; char *x1446 = x1429; int x1451 = 1/*true*/; char x1452 = '\0'; char *x1453 = 0/*null*/; char x1447 = x1446[0]; int x1448 = x1447 == '\0'; if (x1448) { x1453 = x1446; } else { int x1449 = x1447 == 'n'; if (x1449) { x1451 = 0/*false*/; x1452 = x1447; char *x1450 = x1446+1; x1453 = x1450; } else { x1453 = x1446; } } int x1465 = x1451; if (x1465) { char *x1466 = x1453; x1326 = 0; } else { char x1469 = x1452; char *x1470 = x1453; int x1475 = 1/*true*/; char x1476 = '\0'; char *x1477 = 0/*null*/; char x1471 = x1470[0]; int x1472 = x1471 == '\0'; if (x1472) { x1477 = x1470; } else { int x1473 = x1471 == 't'; if (x1473) { x1475 = 0/*false*/; x1476 = x1471; char *x1474 = x1470+1; x1477 = x1474; } else { x1477 = x1470; } } int x1489 = x1475; if (x1489) { char *x1490 = x1477; x1326 = 0; } else { char x1493 = x1476; char *x1494 = x1477; int x1499 = 1/*true*/; char x1500 = '\0'; char *x1501 = 0/*null*/; char x1495 = x1494[0]; int x1496 = x1495 == '\0'; if (x1496) { x1501 = x1494; } else { int x1497 = x1495 == '-'; if (x1497) { x1499 = 0/*false*/; x1500 = x1495; char *x1498 = x1494+1; x1501 = x1498; } else { x1501 = x1494; } } int x1513 = x1499; if (x1513) { char *x1514 = x1501; x1326 = 0; } else { char x1517 = x1500; char *x1518 = x1501; int x1523 = 1/*true*/; char x1524 = '\0'; char *x1525 = 0/*null*/; char x1519 = x1518[0]; int x1520 = x1519 == '\0'; if (x1520) { x1525 = x1518; } else { int x1521 = x1519 == 'L'; if (x1521) { x1523 = 0/*false*/; x1524 = x1519; char *x1522 = x1518+1; x1525 = x1522; } else { x1525 = x1518; } } int x1537 = x1523; if (x1537) { char *x1538 = x1525; x1326 = 0; } else { char x1541 = x1524; char *x1542 = x1525; int x1547 = 1/*true*/; char x1548 = '\0'; char *x1549 = 0/*null*/; char x1543 = x1542[0]; int x1544 = x1543 == '\0'; if (x1544) { x1549 = x1542; } else { int x1545 = x1543 == 'e'; if (x1545) { x1547 = 0/*false*/; x1548 = x1543; char *x1546 = x1542+1; x1549 = x1546; } else { x1549 = x1542; } } int x1561 = x1547; if (x1561) { char *x1562 = x1549; x1326 = 0; } else { char x1565 = x1548; char *x1566 = x1549; int x1571 = 1/*true*/; char x1572 = '\0'; char *x1573 = 0/*null*/; char x1567 = x1566[0]; int x1568 = x1567 == '\0'; if (x1568) { x1573 = x1566; } else { int x1569 = x1567 == 'n'; if (x1569) { x1571 = 0/*false*/; x1572 = x1567; char *x1570 = x1566+1; x1573 = x1570; } else { x1573 = x1566; } } int x1585 = x1571; if (x1585) { char *x1586 = x1573; x1326 = 0; } else { char x1589 = x1572; char *x1590 = x1573; int x1595 = 1/*true*/; char x1596 = '\0'; char *x1597 = 0/*null*/; char x1591 = x1590[0]; int x1592 = x1591 == '\0'; if (x1592) { x1597 = x1590; } else { int x1593 = x1591 == 'g'; if (x1593) { x1595 = 0/*false*/; x1596 = x1591; char *x1594 = x1590+1; x1597 = x1594; } else { x1597 = x1590; } } int x1609 = x1595; if (x1609) { char *x1610 = x1597; x1326 = 0; } else { char x1613 = x1596; char *x1614 = x1597; int x1619 = 1/*true*/; char x1620 = '\0'; char *x1621 = 0/*null*/; char x1615 = x1614[0]; int x1616 = x1615 == '\0'; if (x1616) { x1621 = x1614; } else { int x1617 = x1615 == 't'; if (x1617) { x1619 = 0/*false*/; x1620 = x1615; char *x1618 = x1614+1; x1621 = x1618; } else { x1621 = x1614; } } int x1633 = x1619; if (x1633) { char *x1634 = x1621; x1326 = 0; } else { char x1637 = x1620; char *x1638 = x1621; int x1643 = 1/*true*/; char x1644 = '\0'; char *x1645 = 0/*null*/; char x1639 = x1638[0]; int x1640 = x1639 == '\0'; if (x1640) { x1645 = x1638; } else { int x1641 = x1639 == 'h'; if (x1641) { x1643 = 0/*false*/; x1644 = x1639; char *x1642 = x1638+1; x1645 = x1642; } else { x1645 = x1638; } } int x1657 = x1643; if (x1657) { char *x1658 = x1645; x1326 = 0; } else { char x1661 = x1644; char *x1662 = x1645; x1326 = x1662; } } } } } } } } } } } } } } char *x1692 = x1326; return x1692; }
#include <string.h> /*@ requires ((strlen(x1324)>=0) && \valid(x1324+(0..strlen(x1324)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */
char * p_ContentLength(char * x1324) { char *x1326 = x1324; int x1331 = 1/*true*/; char x1332 = '\0'; char *x1333 = 0/*null*/; char x1327 = x1324[0]; int x1328 = x1327 == '\0'; if (x1328) { x1333 = x1324; } else { int x1329 = x1327 == 'C'; if (x1329) { x1331 = 0/*false*/; x1332 = x1327; char *x1330 = x1324+1; x1333 = x1330; } else { x1333 = x1324; } } int x1345 = x1331; if (x1345) { char *x1346 = x1333; x1326 = 0; } else { char x1349 = x1332; char *x1350 = x1333; int x1355 = 1/*true*/; char x1356 = '\0'; char *x1357 = 0/*null*/; char x1351 = x1350[0]; int x1352 = x1351 == '\0'; if (x1352) { x1357 = x1350; } else { int x1353 = x1351 == 'o'; if (x1353) { x1355 = 0/*false*/; x1356 = x1351; char *x1354 = x1350+1; x1357 = x1354; } else { x1357 = x1350; } } int x1369 = x1355; if (x1369) { char *x1370 = x1357; x1326 = 0; } else { char x1373 = x1356; char *x1374 = x1357; int x1379 = 1/*true*/; char x1380 = '\0'; char *x1381 = 0/*null*/; char x1375 = x1374[0]; int x1376 = x1375 == '\0'; if (x1376) { x1381 = x1374; } else { int x1377 = x1375 == 'n'; if (x1377) { x1379 = 0/*false*/; x1380 = x1375; char *x1378 = x1374+1; x1381 = x1378; } else { x1381 = x1374; } } int x1393 = x1379; if (x1393) { char *x1394 = x1381; x1326 = 0; } else { char x1397 = x1380; char *x1398 = x1381; int x1403 = 1/*true*/; char x1404 = '\0'; char *x1405 = 0/*null*/; char x1399 = x1398[0]; int x1400 = x1399 == '\0'; if (x1400) { x1405 = x1398; } else { int x1401 = x1399 == 't'; if (x1401) { x1403 = 0/*false*/; x1404 = x1399; char *x1402 = x1398+1; x1405 = x1402; } else { x1405 = x1398; } } int x1417 = x1403; if (x1417) { char *x1418 = x1405; x1326 = 0; } else { char x1421 = x1404; char *x1422 = x1405; int x1427 = 1/*true*/; char x1428 = '\0'; char *x1429 = 0/*null*/; char x1423 = x1422[0]; int x1424 = x1423 == '\0'; if (x1424) { x1429 = x1422; } else { int x1425 = x1423 == 'e'; if (x1425) { x1427 = 0/*false*/; x1428 = x1423; char *x1426 = x1422+1; x1429 = x1426; } else { x1429 = x1422; } } int x1441 = x1427; if (x1441) { char *x1442 = x1429; x1326 = 0; } else { char x1445 = x1428; char *x1446 = x1429; int x1451 = 1/*true*/; char x1452 = '\0'; char *x1453 = 0/*null*/; char x1447 = x1446[0]; int x1448 = x1447 == '\0'; if (x1448) { x1453 = x1446; } else { int x1449 = x1447 == 'n'; if (x1449) { x1451 = 0/*false*/; x1452 = x1447; char *x1450 = x1446+1; x1453 = x1450; } else { x1453 = x1446; } } int x1465 = x1451; if (x1465) { char *x1466 = x1453; x1326 = 0; } else { char x1469 = x1452; char *x1470 = x1453; int x1475 = 1/*true*/; char x1476 = '\0'; char *x1477 = 0/*null*/; char x1471 = x1470[0]; int x1472 = x1471 == '\0'; if (x1472) { x1477 = x1470; } else { int x1473 = x1471 == 't'; if (x1473) { x1475 = 0/*false*/; x1476 = x1471; char *x1474 = x1470+1; x1477 = x1474; } else { x1477 = x1470; } } int x1489 = x1475; if (x1489) { char *x1490 = x1477; x1326 = 0; } else { char x1493 = x1476; char *x1494 = x1477; int x1499 = 1/*true*/; char x1500 = '\0'; char *x1501 = 0/*null*/; char x1495 = x1494[0]; int x1496 = x1495 == '\0'; if (x1496) { x1501 = x1494; } else { int x1497 = x1495 == '-'; if (x1497) { x1499 = 0/*false*/; x1500 = x1495; char *x1498 = x1494+1; x1501 = x1498; } else { x1501 = x1494; } } int x1513 = x1499; if (x1513) { char *x1514 = x1501; x1326 = 0; } else { char x1517 = x1500; char *x1518 = x1501; int x1523 = 1/*true*/; char x1524 = '\0'; char *x1525 = 0/*null*/; char x1519 = x1518[0]; int x1520 = x1519 == '\0'; if (x1520) { x1525 = x1518; } else { int x1521 = x1519 == 'L'; if (x1521) { x1523 = 0/*false*/; x1524 = x1519; char *x1522 = x1518+1; x1525 = x1522; } else { x1525 = x1518; } } int x1537 = x1523; if (x1537) { char *x1538 = x1525; x1326 = 0; } else { char x1541 = x1524; char *x1542 = x1525; int x1547 = 1/*true*/; char x1548 = '\0'; char *x1549 = 0/*null*/; char x1543 = x1542[0]; int x1544 = x1543 == '\0'; if (x1544) { x1549 = x1542; } else { int x1545 = x1543 == 'e'; if (x1545) { x1547 = 0/*false*/; x1548 = x1543; char *x1546 = x1542+1; x1549 = x1546; } else { x1549 = x1542; } } int x1561 = x1547; if (x1561) { char *x1562 = x1549; x1326 = 0; } else { char x1565 = x1548; char *x1566 = x1549; int x1571 = 1/*true*/; char x1572 = '\0'; char *x1573 = 0/*null*/; char x1567 = x1566[0]; int x1568 = x1567 == '\0'; if (x1568) { x1573 = x1566; } else { int x1569 = x1567 == 'n'; if (x1569) { x1571 = 0/*false*/; x1572 = x1567; char *x1570 = x1566+1; x1573 = x1570; } else { x1573 = x1566; } } int x1585 = x1571; if (x1585) { char *x1586 = x1573; x1326 = 0; } else { char x1589 = x1572; char *x1590 = x1573; int x1595 = 1/*true*/; char x1596 = '\0'; char *x1597 = 0/*null*/; char x1591 = x1590[0]; int x1592 = x1591 == '\0'; if (x1592) { x1597 = x1590; } else { int x1593 = x1591 == 'g'; if (x1593) { x1595 = 0/*false*/; x1596 = x1591; char *x1594 = x1590+1; x1597 = x1594; } else { x1597 = x1590; } } int x1609 = x1595; if (x1609) { char *x1610 = x1597; x1326 = 0; } else { char x1613 = x1596; char *x1614 = x1597; int x1619 = 1/*true*/; char x1620 = '\0'; char *x1621 = 0/*null*/; char x1615 = x1614[0]; int x1616 = x1615 == '\0'; if (x1616) { x1621 = x1614; } else { int x1617 = x1615 == 't'; if (x1617) { x1619 = 0/*false*/; x1620 = x1615; char *x1618 = x1614+1; x1621 = x1618; } else { x1621 = x1614; } } int x1633 = x1619; if (x1633) { char *x1634 = x1621; x1326 = 0; } else { char x1637 = x1620; char *x1638 = x1621; int x1643 = 1/*true*/; char x1644 = '\0'; char *x1645 = 0/*null*/; char x1639 = x1638[0]; int x1640 = x1639 == '\0'; if (x1640) { x1645 = x1638; } else { int x1641 = x1639 == 'h'; if (x1641) { x1643 = 0/*false*/; x1644 = x1639; char *x1642 = x1638+1; x1645 = x1642; } else { x1645 = x1638; } } int x1657 = x1643; if (x1657) { char *x1658 = x1645; x1326 = 0; } else { char x1661 = x1644; char *x1662 = x1645; x1326 = x1662; } } } } } } } } } } } } } } char *x1692 = x1326; return x1692; }
true
102
102
char * p_ContentLength(char * x1324) { char *x1326 = x1324; int x1331 = 1/*true*/; char x1332 = '\0'; char *x1333 = 0/*null*/; char x1327 = x1324[0]; int x1328 = x1327 == '\0'; if (x1328) { x1333 = x1324; } else { int x1329 = x1327 == 'C'; if (x1329) { x1331 = 0/*false*/; x1332 = x1327; char *x1330 = x1324+1; x1333 = x1330; } else { x1333 = x1324; } } int x1345 = x1331; if (x1345) { char *x1346 = x1333; x1326 = 0; } else { char x1349 = x1332; char *x1350 = x1333; int x1355 = 1/*true*/; char x1356 = '\0'; char *x1357 = 0/*null*/; char x1351 = x1350[0]; int x1352 = x1351 == '\0'; if (x1352) { x1357 = x1350; } else { int x1353 = x1351 == 'o'; if (x1353) { x1355 = 0/*false*/; x1356 = x1351; char *x1354 = x1350+1; x1357 = x1354; } else { x1357 = x1350; } } int x1369 = x1355; if (x1369) { char *x1370 = x1357; x1326 = 0; } else { char x1373 = x1356; char *x1374 = x1357; int x1379 = 1/*true*/; char x1380 = '\0'; char *x1381 = 0/*null*/; char x1375 = x1374[0]; int x1376 = x1375 == '\0'; if (x1376) { x1381 = x1374; } else { int x1377 = x1375 == 'n'; if (x1377) { x1379 = 0/*false*/; x1380 = x1375; char *x1378 = x1374+1; x1381 = x1378; } else { x1381 = x1374; } } int x1393 = x1379; if (x1393) { char *x1394 = x1381; x1326 = 0; } else { char x1397 = x1380; char *x1398 = x1381; int x1403 = 1/*true*/; char x1404 = '\0'; char *x1405 = 0/*null*/; char x1399 = x1398[0]; int x1400 = x1399 == '\0'; if (x1400) { x1405 = x1398; } else { int x1401 = x1399 == 't'; if (x1401) { x1403 = 0/*false*/; x1404 = x1399; char *x1402 = x1398+1; x1405 = x1402; } else { x1405 = x1398; } } int x1417 = x1403; if (x1417) { char *x1418 = x1405; x1326 = 0; } else { char x1421 = x1404; char *x1422 = x1405; int x1427 = 1/*true*/; char x1428 = '\0'; char *x1429 = 0/*null*/; char x1423 = x1422[0]; int x1424 = x1423 == '\0'; if (x1424) { x1429 = x1422; } else { int x1425 = x1423 == 'e'; if (x1425) { x1427 = 0/*false*/; x1428 = x1423; char *x1426 = x1422+1; x1429 = x1426; } else { x1429 = x1422; } } int x1441 = x1427; if (x1441) { char *x1442 = x1429; x1326 = 0; } else { char x1445 = x1428; char *x1446 = x1429; int x1451 = 1/*true*/; char x1452 = '\0'; char *x1453 = 0/*null*/; char x1447 = x1446[0]; int x1448 = x1447 == '\0'; if (x1448) { x1453 = x1446; } else { int x1449 = x1447 == 'n'; if (x1449) { x1451 = 0/*false*/; x1452 = x1447; char *x1450 = x1446+1; x1453 = x1450; } else { x1453 = x1446; } } int x1465 = x1451; if (x1465) { char *x1466 = x1453; x1326 = 0; } else { char x1469 = x1452; char *x1470 = x1453; int x1475 = 1/*true*/; char x1476 = '\0'; char *x1477 = 0/*null*/; char x1471 = x1470[0]; int x1472 = x1471 == '\0'; if (x1472) { x1477 = x1470; } else { int x1473 = x1471 == 't'; if (x1473) { x1475 = 0/*false*/; x1476 = x1471; char *x1474 = x1470+1; x1477 = x1474; } else { x1477 = x1470; } } int x1489 = x1475; if (x1489) { char *x1490 = x1477; x1326 = 0; } else { char x1493 = x1476; char *x1494 = x1477; int x1499 = 1/*true*/; char x1500 = '\0'; char *x1501 = 0/*null*/; char x1495 = x1494[0]; int x1496 = x1495 == '\0'; if (x1496) { x1501 = x1494; } else { int x1497 = x1495 == '-'; if (x1497) { x1499 = 0/*false*/; x1500 = x1495; char *x1498 = x1494+1; x1501 = x1498; } else { x1501 = x1494; } } int x1513 = x1499; if (x1513) { char *x1514 = x1501; x1326 = 0; } else { char x1517 = x1500; char *x1518 = x1501; int x1523 = 1/*true*/; char x1524 = '\0'; char *x1525 = 0/*null*/; char x1519 = x1518[0]; int x1520 = x1519 == '\0'; if (x1520) { x1525 = x1518; } else { int x1521 = x1519 == 'L'; if (x1521) { x1523 = 0/*false*/; x1524 = x1519; char *x1522 = x1518+1; x1525 = x1522; } else { x1525 = x1518; } } int x1537 = x1523; if (x1537) { char *x1538 = x1525; x1326 = 0; } else { char x1541 = x1524; char *x1542 = x1525; int x1547 = 1/*true*/; char x1548 = '\0'; char *x1549 = 0/*null*/; char x1543 = x1542[0]; int x1544 = x1543 == '\0'; if (x1544) { x1549 = x1542; } else { int x1545 = x1543 == 'e'; if (x1545) { x1547 = 0/*false*/; x1548 = x1543; char *x1546 = x1542+1; x1549 = x1546; } else { x1549 = x1542; } } int x1561 = x1547; if (x1561) { char *x1562 = x1549; x1326 = 0; } else { char x1565 = x1548; char *x1566 = x1549; int x1571 = 1/*true*/; char x1572 = '\0'; char *x1573 = 0/*null*/; char x1567 = x1566[0]; int x1568 = x1567 == '\0'; if (x1568) { x1573 = x1566; } else { int x1569 = x1567 == 'n'; if (x1569) { x1571 = 0/*false*/; x1572 = x1567; char *x1570 = x1566+1; x1573 = x1570; } else { x1573 = x1566; } } int x1585 = x1571; if (x1585) { char *x1586 = x1573; x1326 = 0; } else { char x1589 = x1572; char *x1590 = x1573; int x1595 = 1/*true*/; char x1596 = '\0'; char *x1597 = 0/*null*/; char x1591 = x1590[0]; int x1592 = x1591 == '\0'; if (x1592) { x1597 = x1590; } else { int x1593 = x1591 == 'g'; if (x1593) { x1595 = 0/*false*/; x1596 = x1591; char *x1594 = x1590+1; x1597 = x1594; } else { x1597 = x1590; } } int x1609 = x1595; if (x1609) { char *x1610 = x1597; x1326 = 0; } else { char x1613 = x1596; char *x1614 = x1597; int x1619 = 1/*true*/; char x1620 = '\0'; char *x1621 = 0/*null*/; char x1615 = x1614[0]; int x1616 = x1615 == '\0'; if (x1616) { x1621 = x1614; } else { int x1617 = x1615 == 't'; if (x1617) { x1619 = 0/*false*/; x1620 = x1615; char *x1618 = x1614+1; x1621 = x1618; } else { x1621 = x1614; } } int x1633 = x1619; if (x1633) { char *x1634 = x1621; x1326 = 0; } else { char x1637 = x1620; char *x1638 = x1621; int x1643 = 1/*true*/; char x1644 = '\0'; char *x1645 = 0/*null*/; char x1639 = x1638[0]; int x1640 = x1639 == '\0'; if (x1640) { x1645 = x1638; } else { int x1641 = x1639 == 'h'; if (x1641) { x1643 = 0/*false*/; x1644 = x1639; char *x1642 = x1638+1; x1645 = x1642; } else { x1645 = x1638; } } int x1657 = x1643; if (x1657) { char *x1658 = x1645; x1326 = 0; } else { char x1661 = x1644; char *x1662 = x1645; x1326 = x1662; } } } } } } } } } } } } } } char *x1692 = x1326; return x1692; }
#include <string.h> /*@ requires ((strlen(x1324)>=0) && \valid(x1324+(0..strlen(x1324)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */
frama_c_files_v2/test_frama_c_826.c
int m = 0; int t[10]; int *q = &m; /*@ requires *p <= 100 && *p >= -100 && \valid(p); ensures \result == \old(*p)+ 1; */ int incr(int *p) { q = p; *p = *p + 1; return *p; }
int m = 0; int *q = &m; /*@ requires *p <= 100 && *p >= -100 && \valid(p); ensures \result == \old(*p)+ 1; */
int incr(int *p) { q = p; *p = *p + 1; return *p; }
true
7
7
int incr(int *p) { q = p; *p = *p + 1; return *p; }
int m = 0; int *q = &m; /*@ requires *p <= 100 && *p >= -100 && \valid(p); ensures \result == \old(*p)+ 1; */
frama_c_files_v2/test_frama_c_2476.c
/* run.config_ci COMMENT: test option -e-acsl-instrument; cannot run Eva on this example LOG: gen_@[email protected] STDOPT:#"-e-acsl-instrument='@@all,-uninstrument1,-uninstrument2'" */ #include <stdarg.h> int uninstrument1(int *p) { *p = 0; return 0; } /*@ requires \valid(p); */ int uninstrument2(int *p) { { int *q = p; *p = 0; goto L; } L: return 0; } int instrument1(int *p) { *p = 0; return 0; } /*@ requires \valid(p); */ int instrument2(int *p) { { int *q = p; *p = 0; goto L; } L: return 0; } /* test combination of -e-acsl-instrument and -variadic-no-translation; see gitlab's issue #88 */ int vol(int n, ...) { va_list vl; va_start(vl, n); int r = va_arg(vl, int); va_end(vl); return 1; } int main(void) { int x; int y = 0; instrument1(&x); uninstrument1(&x); instrument2(&x); uninstrument2(&x); /*@ assert \initialized(&x); */ /*@ assert \initialized(&y); */ return vol(6, 1); }
#include <stdarg.h> /*@ requires \valid(p); */
int instrument2(int *p) { { int *q = p; *p = 0; goto L; } L: return 0; }
true
3
3
int instrument2(int *p) { { int *q = p; *p = 0; goto L; } L: return 0; }
#include <stdarg.h> /*@ requires \valid(p); */
frama_c_files_v2/test_frama_c_2778.c
/*@ axiomatic abs { @ logic int abs(int x); @ axiom pos: \forall int x; x >= 0 ==> abs(x) == x; @ axiom neg: \forall int x; x <= 0 ==> abs(x) == -x; @ } */ /*@ ensures \result == abs(x); @ assigns \nothing; */ int abs(int x); /*@ ensures (\result == x || \result == y) @ && \result >= x && \result >= y; @ assigns \nothing; */ int max(int x, int y); /*@ ensures \result >= 0; @ assigns \nothing; */ int max_abs(int x, int y) { x = abs(x); y = abs(y); return max(x, y); }
/*@ axiomatic abs { @ logic int abs(int x); @ axiom pos: \forall int x; x >= 0 ==> abs(x) == x; @ axiom neg: \forall int x; x <= 0 ==> abs(x) == -x; @ } */ /*@ ensures \result == abs(x); @ assigns \nothing; */
int abs(int x) { if (x >= 0) return x; else return -x; }
true
6
6
int abs(int x) { if (x >= 0) return x; else return -x; }
/*@ axiomatic abs { @ logic int abs(int x); @ axiom pos: \forall int x; x >= 0 ==> abs(x) == x; @ axiom neg: \forall int x; x <= 0 ==> abs(x) == -x; @ } */ /*@ ensures \result == abs(x); @ assigns \nothing; */
frama_c_files_v2/test_frama_c_1198.c
/*@ requires n>0 && \valid(t+(0..n-1)); ensures \forall integer i; 0<=i<n ==> t[i] == val; */ void fill(int t[],int val,int n) { /*@ loop invariant 0<=i<=n; loop invariant \forall integer j; 0<=j<i ==> t[j] == val; loop variant n-i; */ for(int i=0;i<n;i++) { t[i]=val; } }
/*@ requires n > 0 && \valid(t + (0 .. n - 1)); assigns t[0 .. n-1]; ensures \forall integer i; 0 <= i < n ==> t[i] == val; */
void fill(int t[], int val, int n) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] == val; loop assigns i, t[0 .. n - 1]; loop variant n - i; */ for (int i = 0; i < n; i++) { t[i] = val; } }
true
15
15
void fill(int t[], int val, int n) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] == val; loop assigns i, t[0 .. n - 1]; loop variant n - i; */ for (int i = 0; i < n; i++) { t[i] = val; } }
/*@ requires n > 0 && \valid(t + (0 .. n - 1)); assigns t[0 .. n-1]; ensures \forall integer i; 0 <= i < n ==> t[i] == val; */
frama_c_files_v2/test_frama_c_1276.c
/*@ assigns \nothing; ensures \result == (a + b) / 2; */ int avr(int a, int b) { int avr; if (a >= 0 && b >= 0) { if (b > a) { avr = a + (b - a) / 2; } else { avr = b + (a - b) / 2; } } else if (a < 0 && b < 0) { if (b > a) { avr = b + (a - b) / 2; } else { avr = a + (b - a) / 2; } } else { avr = (a + b) / 2; } return avr; }
/*@ assigns \nothing; ensures \result == (a + b) / 2; */
int avr(int a, int b) { int avr; if (a >= 0 && b >= 0) { if (b > a) { avr = a + (b - a) / 2; } else { avr = b + (a - b) / 2; } } else if (a < 0 && b < 0) { if (b > a) { avr = b + (a - b) / 2; } else { avr = a + (b - a) / 2; } } else { avr = (a + b) / 2; } return avr; }
true
26
26
int avr(int a, int b) { int avr; if (a >= 0 && b >= 0) { if (b > a) { avr = a + (b - a) / 2; } else { avr = b + (a - b) / 2; } } else if (a < 0 && b < 0) { if (b > a) { avr = b + (a - b) / 2; } else { avr = a + (b - a) / 2; } } else { avr = (a + b) / 2; } return avr; }
/*@ assigns \nothing; ensures \result == (a + b) / 2; */
frama_c_files_v2/test_frama_c_2012.c
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */ __inline static unsigned int __bswap_32(unsigned int __bsx) { unsigned int tmp; tmp = __builtin_bswap32(__bsx); return tmp; } __inline static __uint64_t __bswap_64(__uint64_t __bsx) { __uint64_t tmp; tmp = __builtin_bswap64(__bsx); return tmp; } __inline static __uint16_t __uint16_identity(__uint16_t __x) { return __x; } __inline static __uint32_t __uint32_identity(__uint32_t __x) { return __x; } __inline static __uint64_t __uint64_identity(__uint64_t __x) { return __x; } /*@ predicate diffSize{L1, L2}(ℤ i) = t(__e_acsl_heap_allocation_size,L1) - t(__e_acsl_heap_allocation_size,L2) ≡ i; */ extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_memory_init)( int *x_0, char ***x_1, unsigned long x_2); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_store_block)( void *x_0, unsigned long x_1); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_full_init)( void *x_0); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_delete_block)( void *x_0); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_memory_clean)( void); int main(int argc, char **argv) { int __retres; __e_acsl_memory_init(& argc,& argv,8UL); __e_acsl_memory_init(& argc,& argv,8UL); __e_acsl_store_block((void *)(& argc),4UL); { int *p; __e_acsl_store_block((void *)(& p),8UL); __e_acsl_store_block((void *)(& p),8UL); switch (argc) { default: ; __e_acsl_full_init((void *)(& p)); __e_acsl_full_init((void *)(& p)); p = & argc; break; } __e_acsl_delete_block((void *)(& p)); __e_acsl_delete_block((void *)(& p)); } __retres = 0; __e_acsl_delete_block((void *)(& argc)); __e_acsl_memory_clean(); __e_acsl_delete_block((void *)(& argc)); __e_acsl_memory_clean(); return __retres; }
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */
__inline static __uint64_t __uint64_identity(__uint64_t __x) { return __x; }
true
2
2
__inline static __uint64_t __uint64_identity(__uint64_t __x) { return __x; }
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */
frama_c_files_v2/test_frama_c_1754.c
/*@ assigns \nothing; ensures \result == (a+b)/2; */ int average(int a, int b) { int average = 0; int greater; int smaller; if (a > b) { greater = a; smaller = b; } else { greater = b; smaller = a; } if (a >= 0 && b >= 0) { average = smaller + (greater - smaller) / 2; } else if (a < 0 && b < 0) { average = greater + (smaller - greater) / 2; } else if ((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) { average = (a + b) / 2; } return average; } #ifdef OUT_OF_TASK #include <stdio.h> int main(void) { printf("res: %d\n", average(3,30)); printf("res: %d\n", average(-5,-20)); printf("res: %d\n", average(7,-10)); printf("res: %d\n", average(-2,15)); return 0; } #endif
/*@ assigns \nothing; ensures \result == (a+b)/2; */
int average(int a, int b) { int average = 0; int greater; int smaller; if (a > b) { greater = a; smaller = b; } else { greater = b; smaller = a; } if (a >= 0 && b >= 0) { average = smaller + (greater - smaller) / 2; } else if (a < 0 && b < 0) { average = greater + (smaller - greater) / 2; } else if ((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) { average = (a + b) / 2; } return average; }
true
20
20
int average(int a, int b) { int average = 0; int greater; int smaller; if (a > b) { greater = a; smaller = b; } else { greater = b; smaller = a; } if (a >= 0 && b >= 0) { average = smaller + (greater - smaller) / 2; } else if (a < 0 && b < 0) { average = greater + (smaller - greater) / 2; } else if ((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) { average = (a + b) / 2; } return average; }
/*@ assigns \nothing; ensures \result == (a+b)/2; */
frama_c_files_v2/test_frama_c_1738.c
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */ int dfa_aabany(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 17 || id == 14 || id == 11 || id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { return 1/*true*/; } else { return 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { return 1/*true*/; } else { return 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { return 1/*true*/; } else { return 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 6; } else { int x10 = x7 == 'B'; int x28; if (x10) { return 1/*true*/; } else { x28 = 0; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 6; } else { x30 = 0; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 3; } else { x32 = 0; } id = x32; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { x23 = 1/*true*/; } else { x23 = 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { x24 = 1/*true*/; } else { x24 = 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { x26 = 1/*true*/; } else { x26 = 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 0/*false*/; } else { int x10 = x7 == 'B'; int x28; if (x10) { x28 = 1/*true*/; } else { x28 = 0/*false*/; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 0/*false*/; } else { x30 = 0/*false*/; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 0/*false*/; } else { x32 = 0/*false*/; } id = x32; } else { return -1; /*error: invalid state */ } return id; }
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */
int dfa_aabany(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 17 || id == 14 || id == 11 || id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { return 1/*true*/; } else { return 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { return 1/*true*/; } else { return 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { return 1/*true*/; } else { return 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 6; } else { int x10 = x7 == 'B'; int x28; if (x10) { return 1/*true*/; } else { x28 = 0; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 6; } else { x30 = 0; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 3; } else { x32 = 0; } id = x32; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { x23 = 1/*true*/; } else { x23 = 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { x24 = 1/*true*/; } else { x24 = 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { x26 = 1/*true*/; } else { x26 = 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 0/*false*/; } else { int x10 = x7 == 'B'; int x28; if (x10) { x28 = 1/*true*/; } else { x28 = 0/*false*/; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 0/*false*/; } else { x30 = 0/*false*/; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 0/*false*/; } else { x32 = 0/*false*/; } id = x32; } else { return -1; /*error: invalid state */ } return id; }
true
58
58
int dfa_aabany(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 17 || id == 14 || id == 11 || id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { return 1/*true*/; } else { return 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { return 1/*true*/; } else { return 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { return 1/*true*/; } else { return 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 6; } else { int x10 = x7 == 'B'; int x28; if (x10) { return 1/*true*/; } else { x28 = 0; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 6; } else { x30 = 0; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 3; } else { x32 = 0; } id = x32; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 17) { char x18 = c; int x19 = x18 == 'A'; int x23; if (x19) { x23 = 1/*true*/; } else { x23 = 1/*true*/; } id = x23; } else if (id == 14) { char x15 = c; int x16 = x15 == 'A'; int x24; if (x16) { x24 = 1/*true*/; } else { x24 = 1/*true*/; } id = x24; } else if (id == 11) { char x12 = c; int x13 = x12 == 'A'; int x26; if (x13) { x26 = 1/*true*/; } else { x26 = 1/*true*/; } id = x26; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x29; if (x8) { x29 = 0/*false*/; } else { int x10 = x7 == 'B'; int x28; if (x10) { x28 = 1/*true*/; } else { x28 = 0/*false*/; } x29 = x28; } id = x29; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x30; if (x5) { x30 = 0/*false*/; } else { x30 = 0/*false*/; } id = x30; } else if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x32; if (x2) { x32 = 0/*false*/; } else { x32 = 0/*false*/; } id = x32; } else { return -1; /*error: invalid state */ } return id; }
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */
frama_c_files_v2/test_frama_c_2012.c
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */ __inline static unsigned int __bswap_32(unsigned int __bsx) { unsigned int tmp; tmp = __builtin_bswap32(__bsx); return tmp; } __inline static __uint64_t __bswap_64(__uint64_t __bsx) { __uint64_t tmp; tmp = __builtin_bswap64(__bsx); return tmp; } __inline static __uint16_t __uint16_identity(__uint16_t __x) { return __x; } __inline static __uint32_t __uint32_identity(__uint32_t __x) { return __x; } __inline static __uint64_t __uint64_identity(__uint64_t __x) { return __x; } /*@ predicate diffSize{L1, L2}(ℤ i) = t(__e_acsl_heap_allocation_size,L1) - t(__e_acsl_heap_allocation_size,L2) ≡ i; */ extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_memory_init)( int *x_0, char ***x_1, unsigned long x_2); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_store_block)( void *x_0, unsigned long x_1); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_full_init)( void *x_0); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_delete_block)( void *x_0); extern __attribute__((__FC_BUILTIN__)) int ( /* missing proto */ __e_acsl_memory_clean)( void); int main(int argc, char **argv) { int __retres; __e_acsl_memory_init(& argc,& argv,8UL); __e_acsl_memory_init(& argc,& argv,8UL); __e_acsl_store_block((void *)(& argc),4UL); { int *p; __e_acsl_store_block((void *)(& p),8UL); __e_acsl_store_block((void *)(& p),8UL); switch (argc) { default: ; __e_acsl_full_init((void *)(& p)); __e_acsl_full_init((void *)(& p)); p = & argc; break; } __e_acsl_delete_block((void *)(& p)); __e_acsl_delete_block((void *)(& p)); } __retres = 0; __e_acsl_delete_block((void *)(& argc)); __e_acsl_memory_clean(); __e_acsl_delete_block((void *)(& argc)); __e_acsl_memory_clean(); return __retres; }
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */
__inline static __uint16_t __uint16_identity(__uint16_t __x) { return __x; }
true
2
2
__inline static __uint16_t __uint16_identity(__uint16_t __x) { return __x; }
/* Generated by Frama-C */ typedef unsigned long size_t; struct __e_acsl_mpz_struct { int _mp_alloc ; int _mp_size ; unsigned long *_mp_d ; }; typedef struct __e_acsl_mpz_struct __e_acsl_mpz_struct; typedef __e_acsl_mpz_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpz_t)[1]; struct __e_acsl_mpq_struct { __e_acsl_mpz_struct _mp_num ; __e_acsl_mpz_struct _mp_den ; }; typedef struct __e_acsl_mpq_struct __e_acsl_mpq_struct; typedef __e_acsl_mpq_struct ( __attribute__((__FC_BUILTIN__)) __e_acsl_mpq_t)[1]; typedef struct _IO_FILE FILE; /*@ ghost extern int __e_acsl_init; */ extern size_t __e_acsl_heap_allocation_size; typedef unsigned short __uint16_t; typedef unsigned int __uint32_t; typedef unsigned long __uint64_t; typedef long __off_t; typedef long __off64_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next ; struct _IO_FILE *_sbuf ; int _pos ; }; struct _IO_FILE { int _flags ; char *_IO_read_ptr ; char *_IO_read_end ; char *_IO_read_base ; char *_IO_write_base ; char *_IO_write_ptr ; char *_IO_write_end ; char *_IO_buf_base ; char *_IO_buf_end ; char *_IO_save_base ; char *_IO_backup_base ; char *_IO_save_end ; struct _IO_marker *_markers ; struct _IO_FILE *_chain ; int _fileno ; int _flags2 ; __off_t _old_offset ; unsigned short _cur_column ; signed char _vtable_offset ; char _shortbuf[1] ; _IO_lock_t *_lock ; __off64_t _offset ; void *__pad1 ; void *__pad2 ; void *__pad3 ; void *__pad4 ; size_t __pad5 ; int _mode ; char _unused2[((unsigned long)15 * sizeof(int) - (unsigned long)4 * sizeof(void *)) - sizeof(size_t)] ; }; /* compiler builtin: unsigned int __builtin_bswap32(unsigned int); */ /* compiler builtin: unsigned long __builtin_bswap64(unsigned long); */
frama_c_files_v2/test_frama_c_2580.c
/*@ requires k>0; @ ensures \result<1; @*/ int f(int k, int g); int f(int k, int g){ return 0; } void main(){ f(1,0); }
/*@ requires k>0; @ ensures \result<1; @*/ int f(int k, int g);
int f(int k, int g){ return 0; }
true
3
3
int f(int k, int g){ return 0; }
/*@ requires k>0; @ ensures \result<1; @*/ int f(int k, int g);
frama_c_files_v2/test_frama_c_2323.c
//In the assigns clause of g(), parameter p refers to g()'s argument, not to the global variable p. //This problem can be circumvented using ghost variables. typedef struct { int a; } las; las * p; /*@ requires alid(p); assigns p->a; @*/ void f() { p->a = 5; } /*@ requires alid(p); assigns p->a; @*/ void g(int * p_arg) { f(); }
typedef struct { int a; } las; las * p; /*@ assigns p->a; @*/
void g(int * p_arg) { f(); }
true
4
4
void g(int * p_arg) { f(); }
typedef struct { int a; } las; las * p; /*@ assigns p->a; @*/
frama_c_files_v2/test_frama_c_1089.c
/* @ requires \valid(t+(start..end)) && start <= i <= end && start <= j <= end; @*/ void swap(int t[], int i, int j, int start, int end) { int tmp = t[i]; t[i] = t[j]; t[j] = tmp; } /*@ requires 0 <= p <= r && \valid(A+(p..r)); @*/ int partition (int A[], int p, int r) { int x = A[r]; int j, i = p-1; /*@ loop invariant p <= j <= r && p-1 <= i < j; @ loop assigns i, j, A[p..r]; @ loop variant r-j; @*/ for (j=p; j<r; j++) if (A[j] <= x) { i++; swap(A, i, j, p, r); } swap(A,i+1,r,p,r); return i+1; }
/*@ @ requires \valid(t+(start..end)) && start <= i <= end && start <= j <= end; @ assigns t[i], t[j]; @ ensures t[i] == \old(t[j]) && t[j] == \old(t[i]); @*/
void swap(int t[], int i, int j, int start, int end) { int tmp = t[i]; t[i] = t[j]; t[j] = tmp; }
true
9
9
void swap(int t[], int i, int j, int start, int end) { int tmp = t[i]; t[i] = t[j]; t[j] = tmp; }
/*@ @ requires \valid(t+(start..end)) && start <= i <= end && start <= j <= end; @ assigns t[i], t[j]; @ ensures t[i] == \old(t[j]) && t[j] == \old(t[i]); @*/
frama_c_files_v2/test_frama_c_1616.c
/* Generated by Frama-C */ #include "stdio.h" #include "stdlib.h" extern int __e_acsl_sound_verdict; /*@ assigns \nothing; */ int *__gen_e_acsl_f(int *x, int *y); /*@ assigns \nothing; */ int *f(int *x, int *y) { return x; } int main(void) { int __retres; int *p; int x = 0; int *q = malloc(sizeof(int)); int *r = malloc(sizeof(int)); p = __gen_e_acsl_f(&x, q); q = __gen_e_acsl_f(&x, r); __retres = 0; return __retres; } /*@ assigns \nothing; */ int *__gen_e_acsl_f(int *x, int *y) { int *__retres; __retres = f(x, y); return __retres; }
#include "stdio.h" #include "stdlib.h" /*@ assigns \nothing; */
int *f(int *x, int *y) { return x; }
true
3
3
int *f(int *x, int *y) { return x; }
#include "stdio.h" #include "stdlib.h" /*@ assigns \nothing; */
frama_c_files_v2/test_frama_c_2544.c
/* run.config EXECNOW: make tests/aorai/Aorai_test.cmxs OPT: -aorai-ltl tests/aorai/goto.ltl -aorai-test 1 -aorai-acceptance -load-module tests/aorai/Aorai_test.cmxs -aorai-test-number @PTEST_NUMBER@ */ int status=0; int rr=1; //@ global invariant inv : 0<=rr<=5000; /*@ requires rr<5000; @ behavior j : @ ensures rr<5001; */ void opa() { rr++; } void opb () { status=1; } void opc () { rr=60000; } int main(){ if (rr<5000) goto L; opc(); L4: goto L5; L: opa(); goto L2; opc(); L6: return 1; L3: goto L4; opc(); goto L2; L2 : goto L3; L5: opb(); goto L6; }
int status=0; int rr=1; //@ global invariant inv : 0<=rr<=5000; /*@ requires rr<5000; @ behavior j : @ ensures rr<5001; */
void opc () { if (rr < 5000) { rr++; } }
true
4
4
void opc () { if (rr < 5000) { rr++; } }
int status=0; int rr=1; //@ global invariant inv : 0<=rr<=5000; /*@ requires rr<5000; @ behavior j : @ ensures rr<5001; */
frama_c_files_v2/test_frama_c_2783.c
#include <limits.h> #include <string.h> char * p_HTTP(char * x1096); char * p_(char * x1098); char * p_ContentLength(char * x1100); /*@ requires ((strlen(x0)>=0) && \valid(x0+(0..strlen(x0)))); assigns \nothing; */ int p(char * x0) { int x2 = -1; char *x3 = p_HTTP(x0); int x5 = 1/*true*/; int x6 = 0; char *x7 = 0/*null*/; int x8 = 1/*true*/; int x9 = 0; char *x10 = 0/*null*/; int x11 = 1/*true*/; int x12 = 0; char *x13 = 0/*null*/; int x14 = 1/*true*/; int x15 = 0; char *x16 = 0/*null*/; int x17 = 1/*true*/; char *x19 = 0/*null*/; int x20 = 1/*true*/; char *x22 = 0/*null*/; int x23 = 1/*true*/; char x24 = '\0'; char *x25 = 0/*null*/; int x26 = 1/*true*/; char *x28 = 0/*null*/; int x29 = 1/*true*/; char *x31 = 0/*null*/; int x32 = 0 == x3; if (x32) { x31 = x0; } else { x29 = 0/*false*/; x31 = x3; } int x40 = x29; if (x40) { char *x41 = x31; x28 = x41; } else { char *x45 = x31; int x52 = 1/*true*/; char x53 = '\0'; char *x54 = 0/*null*/; char x46 = x45[0]; int x47 = x46 == '\0'; if (x47) { x54 = x45; } else { int x48 = x46 >= '0'; int x50; if (x48) { int x49 = x46 <= '9'; x50 = x49; } else { x50 = 0/*false*/; } if (x50) { x52 = 0/*false*/; x53 = x46; char *x51 = x45+1; x54 = x51; } else { x54 = x45; } } int x66 = x52; if (x66) { char *x67 = x54; x28 = x67; } else { char x70 = x53; char *x71 = x54; char *x72 = x71; int x73 = 1/*true*/; /*@ loop invariant ((strlen(x72)>=0) && \valid(x72+(0..strlen(x72)))); loop assigns x72, x73; */ for (;;) { int x74 = x73; if (!x74) break; char *x76 = x72; char x77 = x76[0]; int x78 = x77 == '\0'; if (x78) { x73 = 0/*false*/; } else { int x79 = x77 >= '0'; int x81; if (x79) { int x80 = x77 <= '9'; x81 = x80; } else { x81 = 0/*false*/; } if (x81) { char *x82 = x76+1; x72 = x82; } else { x73 = 0/*false*/; } } } char *x106 = x72; x26 = 0/*false*/; x28 = x106; } } int x114 = x26; if (x114) { char *x115 = x28; x25 = x115; } else { char *x119 = x28; char x120 = x119[0]; int x121 = x120 == '\0'; if (x121) { x25 = x119; } else { int x122 = x120 == '.'; if (x122) { x23 = 0/*false*/; x24 = x120; char *x123 = x119+1; x25 = x123; } else { x25 = x119; } } } int x137 = x23; if (x137) { char *x138 = x25; x22 = x138; } else { char x141 = x24; char *x142 = x25; int x149 = 1/*true*/; char x150 = '\0'; char *x151 = 0/*null*/; char x143 = x142[0]; int x144 = x143 == '\0'; if (x144) { x151 = x142; } else { int x145 = x143 >= '0'; int x147; if (x145) { int x146 = x143 <= '9'; x147 = x146; } else { x147 = 0/*false*/; } if (x147) { x149 = 0/*false*/; x150 = x143; char *x148 = x142+1; x151 = x148; } else { x151 = x142; } } int x163 = x149; if (x163) { char *x164 = x151; x22 = x164; } else { char x167 = x150; char *x168 = x151; char *x169 = x168; int x170 = 1/*true*/; /*@ loop invariant ((strlen(x169)>=0) && \valid(x169+(0..strlen(x169)))); loop assigns x169, x170; */ for (;;) { int x171 = x170; if (!x171) break; char *x173 = x169; char x174 = x173[0]; int x175 = x174 == '\0'; if (x175) { x170 = 0/*false*/; } else { int x176 = x174 >= '0'; int x178; if (x176) { int x177 = x174 <= '9'; x178 = x177; } else { x178 = 0/*false*/; } if (x178) { char *x179 = x173+1; x169 = x179; } else { x170 = 0/*false*/; } } } char *x203 = x169; x20 = 0/*false*/; x22 = x203; } } int x211 = x20; if (x211) { char *x212 = x22; x19 = x212; } else { char *x216 = x22; char *x217 = x216; int x218 = 1/*true*/; /*@ loop invariant ((strlen(x217)>=0) && \valid(x217+(0..strlen(x217)))); loop assigns x217, x218; */ for (;;) { int x219 = x218; if (!x219) break; char *x221 = x217; char x222 = x221[0]; int x223 = x222 == '\0'; if (x223) { x218 = 0/*false*/; } else { int x224 = x222 == ' '; if (x224) { char *x225 = x221+1; x217 = x225; } else { x218 = 0/*false*/; } } } char *x249 = x217; x17 = 0/*false*/; x19 = x249; } int x255 = x17; if (x255) { char *x256 = x19; x16 = x256; } else { char *x260 = x19; int x267 = 1/*true*/; int x268 = 0; char *x269 = 0/*null*/; int x270 = 1/*true*/; char x271 = '\0'; char *x272 = 0/*null*/; char x261 = x260[0]; int x262 = x261 == '\0'; if (x262) { x272 = x260; } else { int x263 = x261 >= '0'; int x265; if (x263) { int x264 = x261 <= '9'; x265 = x264; } else { x265 = 0/*false*/; } if (x265) { x270 = 0/*false*/; x271 = x261; char *x266 = x260+1; x272 = x266; } else { x272 = x260; } } int x284 = x270; if (x284) { char *x285 = x272; x269 = x285; } else { char x288 = x271; char *x290 = x272; x267 = 0/*false*/; char x289 = x288 - '0'; x268 = x289; x269 = x290; } int x296 = x267; if (x296) { char *x297 = x269; x16 = x297; } else { int x300 = x268; char *x301 = x269; char *x302 = x301; int x303 = 1/*true*/; int x304 = x300; int x337 = INT_MAX; int x338 = x337 / 10; int x339 = x338 - 10; /*@ loop invariant (((strlen(x302)>=0) && \valid(x302+(0..strlen(x302)))) && ((x304==-1) || (0<=x304))); loop assigns x302, x303, x304; */ for (;;) { int x305 = x303; if (!x305) break; char *x307 = x302; int x314 = 1/*true*/; char x315 = '\0'; char *x316 = 0/*null*/; char x308 = x307[0]; int x309 = x308 == '\0'; if (x309) { x316 = x307; } else { int x310 = x308 >= '0'; int x312; if (x310) { int x311 = x308 <= '9'; x312 = x311; } else { x312 = 0/*false*/; } if (x312) { x314 = 0/*false*/; x315 = x308; char *x313 = x307+1; x316 = x313; } else { x316 = x307; } } int x328 = x314; if (x328) { char *x329 = x316; x303 = 0/*false*/; } else { char x332 = x315; char *x334 = x316; int x335 = x304; int x336 = x335 < 0; int x344; if (x336) { x344 = x335; } else { int x340 = x335 > x339; int x343; if (x340) { x343 = -1; } else { char x333 = x332 - '0'; int x341 = x335 * 10; int x342 = x341 + x333; x343 = x342; } x344 = x343; } x304 = x344; x302 = x334; } } int x370 = x304; char *x371 = x302; x14 = 0/*false*/; x15 = x370; x16 = x371; } } int x379 = x14; if (x379) { char *x380 = x16; x13 = x380; } else { int x383 = x15; char *x384 = x16; char *x385 = x384; int x386 = 1/*true*/; /*@ loop invariant ((strlen(x385)>=0) && \valid(x385+(0..strlen(x385)))); loop assigns x385, x386; */ for (;;) { int x387 = x386; if (!x387) break; char *x389 = x385; char x390 = x389[0]; int x391 = x390 == '\0'; if (x391) { x386 = 0/*false*/; } else { int x396 = x390 == '\r'; if (x396) { x386 = 0/*false*/; } else { char *x393 = x389+1; x385 = x393; } } } char *x418 = x385; int x419 = 1/*true*/; char *x421 = 0/*null*/; x419 = 0/*false*/; x421 = x418; int x425 = x419; if (x425) { char *x426 = x421; x13 = x426; } else { char *x430 = x421; char *x431 = p_(x430); int x433 = 1/*true*/; char *x435 = 0/*null*/; int x436 = 0 == x431; if (x436) { x435 = x430; } else { x433 = 0/*false*/; x435 = x431; } int x444 = x433; if (x444) { char *x445 = x435; x13 = x445; } else { char *x449 = x435; x11 = 0/*false*/; x12 = x383; x13 = x449; } } } int x459 = x11; if (x459) { char *x460 = x13; x10 = x460; } else { int x463 = x12; char *x464 = x13; char *x465 = x464; int x466 = 1/*true*/; int x467 = 0; int x337 = INT_MAX; int x338 = x337 / 10; int x339 = x338 - 10; int x953 = -2 == -2; /*@ loop invariant ((strlen(x465)>=0) && \valid(x465+(0..strlen(x465)))); loop assigns x465, x466, x467; */ for (;;) { int x468 = x466; if (!x468) break; char *x470 = x465; char *x471 = p_ContentLength(x470); int x473 = 1/*true*/; int x474 = 0; char *x475 = 0/*null*/; int x476 = 1/*true*/; int x477 = 0; char *x478 = 0/*null*/; int x479 = 1/*true*/; int x480 = 0; char *x481 = 0/*null*/; int x482 = 1/*true*/; int x483 = 0; char *x484 = 0/*null*/; int x485 = 1/*true*/; int x486 = 0; char *x487 = 0/*null*/; int x488 = 1/*true*/; char *x490 = 0/*null*/; int x491 = 0 == x471; if (x491) { x490 = x470; } else { x488 = 0/*false*/; x490 = x471; } int x499 = x488; if (x499) { char *x500 = x490; } else { char *x503 = x490; x485 = 0/*false*/; x486 = 1; x487 = x503; } int x509 = x485; if (x509) { char *x510 = x470; int x511 = 1/*true*/; /*@ loop invariant ((strlen(x510)>=0) && \valid(x510+(0..strlen(x510)))); loop assigns x510, x511; */ for (;;) { int x512 = x511; if (!x512) break; char *x514 = x510; char x515 = x514[0]; int x516 = x515 == '\0'; if (x516) { x511 = 0/*false*/; } else { int x518 = x515 == ':'; int x520; if (x518) { x520 = 0/*false*/; } else { int x519 = x515 != ' '; x520 = x519; } if (x520) { char *x521 = x514+1; x510 = x521; } else { x511 = 0/*false*/; } } } char *x545 = x510; x482 = 0/*false*/; x483 = 0; x484 = x545; } else { int x550 = x486; char *x551 = x487; x482 = 0/*false*/; x483 = x550; x484 = x551; } int x557 = x482; if (x557) { char *x558 = x484; x481 = x558; } else { int x561 = x483; char *x562 = x484; char *x563 = x562; int x564 = 1/*true*/; /*@ loop invariant ((strlen(x563)>=0) && \valid(x563+(0..strlen(x563)))); loop assigns x563, x564; */ for (;;) { int x565 = x564; if (!x565) break; char *x567 = x563; char x568 = x567[0]; int x569 = x568 == '\0'; if (x569) { x564 = 0/*false*/; } else { int x570 = x568 == ' '; if (x570) { char *x571 = x567+1; x563 = x571; } else { x564 = 0/*false*/; } } } char *x595 = x563; x479 = 0/*false*/; x480 = x561; x481 = x595; } int x601 = x479; if (x601) { char *x602 = x481; x478 = x602; } else { int x605 = x480; char *x606 = x481; int x611 = 1/*true*/; char x612 = '\0'; char *x613 = 0/*null*/; char x607 = x606[0]; int x608 = x607 == '\0'; if (x608) { x613 = x606; } else { int x609 = x607 == ':'; if (x609) { x611 = 0/*false*/; x612 = x607; char *x610 = x606+1; x613 = x610; } else { x613 = x606; } } int x625 = x611; if (x625) { char *x626 = x613; x478 = x626; } else { char x629 = x612; char *x630 = x613; x476 = 0/*false*/; x477 = x605; x478 = x630; } } int x638 = x476; if (x638) { char *x639 = x478; x475 = x639; } else { int x642 = x477; char *x643 = x478; char *x644 = x643; int x645 = 1/*true*/; /*@ loop invariant ((strlen(x644)>=0) && \valid(x644+(0..strlen(x644)))); loop assigns x644, x645; */ for (;;) { int x646 = x645; if (!x646) break; char *x648 = x644; char x649 = x648[0]; int x650 = x649 == '\0'; if (x650) { x645 = 0/*false*/; } else { int x651 = x649 == ' '; if (x651) { char *x652 = x648+1; x644 = x652; } else { x645 = 0/*false*/; } } } char *x676 = x644; x473 = 0/*false*/; x474 = x642; x475 = x676; } int x682 = x473; if (x682) { char *x683 = x475; x466 = 0/*false*/; } else { int x686 = x474; char *x687 = x475; char *x695 = x687; int x696 = 1/*true*/; /*@ loop invariant ((strlen(x695)>=0) && \valid(x695+(0..strlen(x695)))); loop assigns x695, x696; */ for (;;) { int x697 = x696; if (!x697) break; char *x699 = x695; char x700 = x699[0]; int x701 = x700 == '\0'; if (x701) { x696 = 0/*false*/; } else { int x706 = x700 == '\r'; if (x706) { x696 = 0/*false*/; } else { char *x703 = x699+1; x695 = x703; } } } char *x728 = x695; int x688 = x686 == 1; if (x688) { int x729 = 1/*true*/; int x730 = 0; char *x731 = 0/*null*/; int x732 = 1/*true*/; int x733 = 0; char *x734 = 0/*null*/; int x735 = 1/*true*/; int x736 = 0; char *x737 = 0/*null*/; int x738 = 1/*true*/; char x739 = '\0'; char *x740 = 0/*null*/; char x689 = x687[0]; int x690 = x689 == '\0'; if (x690) { x740 = x687; } else { int x691 = x689 >= '0'; int x693; if (x691) { int x692 = x689 <= '9'; x693 = x692; } else { x693 = 0/*false*/; } if (x693) { x738 = 0/*false*/; x739 = x689; char *x694 = x687+1; x740 = x694; } else { x740 = x687; } } int x752 = x738; if (x752) { char *x753 = x740; x737 = x753; } else { char x756 = x739; char *x758 = x740; x735 = 0/*false*/; char x757 = x756 - '0'; x736 = x757; x737 = x758; } int x764 = x735; if (x764) { char *x765 = x737; x734 = x765; } else { int x768 = x736; char *x769 = x737; char *x770 = x769; int x771 = 1/*true*/; int x772 = x768; /*@ loop invariant (((strlen(x770)>=0) && \valid(x770+(0..strlen(x770)))) && ((x772==-1) || (0<=x772))); loop assigns x770, x771, x772; */ for (;;) { int x773 = x771; if (!x773) break; char *x775 = x770; int x782 = 1/*true*/; char x783 = '\0'; char *x784 = 0/*null*/; char x776 = x775[0]; int x777 = x776 == '\0'; if (x777) { x784 = x775; } else { int x778 = x776 >= '0'; int x780; if (x778) { int x779 = x776 <= '9'; x780 = x779; } else { x780 = 0/*false*/; } if (x780) { x782 = 0/*false*/; x783 = x776; char *x781 = x775+1; x784 = x781; } else { x784 = x775; } } int x796 = x782; if (x796) { char *x797 = x784; x771 = 0/*false*/; } else { char x800 = x783; char *x802 = x784; int x803 = x772; int x804 = x803 < 0; int x809; if (x804) { x809 = x803; } else { int x805 = x803 > x339; int x808; if (x805) { x808 = -1; } else { char x801 = x800 - '0'; int x806 = x803 * 10; int x807 = x806 + x801; x808 = x807; } x809 = x808; } x772 = x809; x770 = x802; } } int x835 = x772; char *x836 = x770; x732 = 0/*false*/; x733 = x835; x734 = x836; } int x842 = x732; if (x842) { char *x843 = x734; x731 = x843; } else { int x846 = x733; char *x847 = x734; char *x848 = x847; int x849 = 1/*true*/; /*@ loop invariant ((strlen(x848)>=0) && \valid(x848+(0..strlen(x848)))); loop assigns x848, x849; */ for (;;) { int x850 = x849; if (!x850) break; char *x852 = x848; char x853 = x852[0]; int x854 = x853 == '\0'; if (x854) { x849 = 0/*false*/; } else { int x855 = x853 == ' '; if (x855) { char *x856 = x852+1; x848 = x856; } else { x849 = 0/*false*/; } } } char *x880 = x848; x729 = 0/*false*/; x730 = x846; x731 = x880; } int x886 = x729; if (x886) { char *x887 = x731; x466 = 0/*false*/; } else { int x890 = x730; char *x891 = x731; char *x892 = p_(x891); int x894 = 1/*true*/; char *x896 = 0/*null*/; int x897 = 0 == x892; if (x897) { x896 = x891; } else { x894 = 0/*false*/; x896 = x892; } int x905 = x894; if (x905) { char *x906 = x896; x466 = 0/*false*/; } else { char *x910 = x896; int x911 = x467; int x912 = x890 == -2; int x913; if (x912) { x913 = x911; } else { x913 = x890; } x467 = x913; x465 = x910; } } } else { int x921 = 1/*true*/; char *x923 = 0/*null*/; x921 = 0/*false*/; x923 = x728; int x927 = x921; if (x927) { char *x928 = x923; x466 = 0/*false*/; } else { char *x932 = x923; char *x933 = p_(x932); int x935 = 1/*true*/; char *x937 = 0/*null*/; int x938 = 0 == x933; if (x938) { x937 = x932; } else { x935 = 0/*false*/; x937 = x933; } int x946 = x935; if (x946) { char *x947 = x937; x466 = 0/*false*/; } else { char *x951 = x937; int x952 = x467; int x954; if (x953) { x954 = x952; } else { x954 = -2; } x467 = x954; x465 = x951; } } } } } int x981 = x467; char *x982 = x465; x8 = 0/*false*/; x9 = x981; x10 = x982; } int x988 = x8; if (x988) { char *x989 = x10; x7 = x989; } else { int x992 = x9; char *x993 = x10; char *x994 = p_(x993); int x996 = 1/*true*/; char *x998 = 0/*null*/; int x999 = 0 == x994; if (x999) { x998 = x993; } else { x996 = 0/*false*/; x998 = x994; } int x1007 = x996; if (x1007) { char *x1008 = x998; x7 = x1008; } else { char *x1012 = x998; x5 = 0/*false*/; x6 = x992; x7 = x1012; } } int x1020 = x5; if (x1020) { char *x1021 = x7; } else { int x1023 = x6; char *x1024 = x7; int x1026 = 1/*true*/; char *x1027 = x1024; /*@ loop invariant ((0<=x1029) && ((strlen(x1027)>=0) && \valid(x1027+(0..strlen(x1027))))); loop assigns x1029, x1026, x1027; loop variant (x6-x1029); */ for(int x1029=0; x1029 < x1023; x1029++) { int x1030 = x1026; if (x1030) { char *x1031 = x1027; char x1032 = x1031[0]; int x1033 = x1032 == '\0'; if (x1033) { x1026 = 0/*false*/; } else { char *x1034 = x1031+1; x1027 = x1034; } } else { } } int x1060 = x1026; char *x1061 = x1027; int x1025 = x1023 < 0; if (x1025) { } else { int x1062 = 1/*true*/; char *x1064 = 0/*null*/; if (x1060) { x1062 = 0/*false*/; x1064 = x1061; } else { x1064 = x1024; } int x1072 = x1062; if (x1072) { char *x1073 = x1064; } else { char *x1076 = x1064; char x1077 = x1076[0]; int x1078 = x1077 == '\0'; if (x1078) { x2 = x1023; } else { } } } } int x1088 = x2; return x1088; } /*@ requires ((strlen(x1102)>=0) && \valid(x1102+(0..strlen(x1102)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_HTTP(char * x1102) { char *x1104 = x1102; int x1109 = 1/*true*/; char x1110 = '\0'; char *x1111 = 0/*null*/; char x1105 = x1102[0]; int x1106 = x1105 == '\0'; if (x1106) { x1111 = x1102; } else { int x1107 = x1105 == 'H'; if (x1107) { x1109 = 0/*false*/; x1110 = x1105; char *x1108 = x1102+1; x1111 = x1108; } else { x1111 = x1102; } } int x1123 = x1109; if (x1123) { char *x1124 = x1111; x1104 = 0; } else { char x1127 = x1110; char *x1128 = x1111; int x1133 = 1/*true*/; char x1134 = '\0'; char *x1135 = 0/*null*/; char x1129 = x1128[0]; int x1130 = x1129 == '\0'; if (x1130) { x1135 = x1128; } else { int x1131 = x1129 == 'T'; if (x1131) { x1133 = 0/*false*/; x1134 = x1129; char *x1132 = x1128+1; x1135 = x1132; } else { x1135 = x1128; } } int x1147 = x1133; if (x1147) { char *x1148 = x1135; x1104 = 0; } else { char x1151 = x1134; char *x1152 = x1135; int x1157 = 1/*true*/; char x1158 = '\0'; char *x1159 = 0/*null*/; char x1153 = x1152[0]; int x1154 = x1153 == '\0'; if (x1154) { x1159 = x1152; } else { int x1155 = x1153 == 'T'; if (x1155) { x1157 = 0/*false*/; x1158 = x1153; char *x1156 = x1152+1; x1159 = x1156; } else { x1159 = x1152; } } int x1171 = x1157; if (x1171) { char *x1172 = x1159; x1104 = 0; } else { char x1175 = x1158; char *x1176 = x1159; int x1181 = 1/*true*/; char x1182 = '\0'; char *x1183 = 0/*null*/; char x1177 = x1176[0]; int x1178 = x1177 == '\0'; if (x1178) { x1183 = x1176; } else { int x1179 = x1177 == 'P'; if (x1179) { x1181 = 0/*false*/; x1182 = x1177; char *x1180 = x1176+1; x1183 = x1180; } else { x1183 = x1176; } } int x1195 = x1181; if (x1195) { char *x1196 = x1183; x1104 = 0; } else { char x1199 = x1182; char *x1200 = x1183; int x1205 = 1/*true*/; char x1206 = '\0'; char *x1207 = 0/*null*/; char x1201 = x1200[0]; int x1202 = x1201 == '\0'; if (x1202) { x1207 = x1200; } else { int x1203 = x1201 == '/'; if (x1203) { x1205 = 0/*false*/; x1206 = x1201; char *x1204 = x1200+1; x1207 = x1204; } else { x1207 = x1200; } } int x1219 = x1205; if (x1219) { char *x1220 = x1207; x1104 = 0; } else { char x1223 = x1206; char *x1224 = x1207; x1104 = x1224; } } } } } char *x1236 = x1104; return x1236; } /*@ requires ((strlen(x1252)>=0) && \valid(x1252+(0..strlen(x1252)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_(char * x1252) { char *x1254 = x1252; int x1259 = 1/*true*/; char x1260 = '\0'; char *x1261 = 0/*null*/; char x1255 = x1252[0]; int x1256 = x1255 == '\0'; if (x1256) { x1261 = x1252; } else { int x1257 = x1255 == '\r'; if (x1257) { x1259 = 0/*false*/; x1260 = x1255; char *x1258 = x1252+1; x1261 = x1258; } else { x1261 = x1252; } } int x1273 = x1259; if (x1273) { char *x1274 = x1261; x1254 = 0; } else { char x1277 = x1260; char *x1278 = x1261; int x1283 = 1/*true*/; char x1284 = '\0'; char *x1285 = 0/*null*/; char x1279 = x1278[0]; int x1280 = x1279 == '\0'; if (x1280) { x1285 = x1278; } else { int x1281 = x1279 == '\n'; if (x1281) { x1283 = 0/*false*/; x1284 = x1279; char *x1282 = x1278+1; x1285 = x1282; } else { x1285 = x1278; } } int x1297 = x1283; if (x1297) { char *x1298 = x1285; x1254 = 0; } else { char x1301 = x1284; char *x1302 = x1285; x1254 = x1302; } } char *x1308 = x1254; return x1308; } /*@ requires ((strlen(x1324)>=0) && \valid(x1324+(0..strlen(x1324)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */ char * p_ContentLength(char * x1324) { char *x1326 = x1324; int x1331 = 1/*true*/; char x1332 = '\0'; char *x1333 = 0/*null*/; char x1327 = x1324[0]; int x1328 = x1327 == '\0'; if (x1328) { x1333 = x1324; } else { int x1329 = x1327 == 'C'; if (x1329) { x1331 = 0/*false*/; x1332 = x1327; char *x1330 = x1324+1; x1333 = x1330; } else { x1333 = x1324; } } int x1345 = x1331; if (x1345) { char *x1346 = x1333; x1326 = 0; } else { char x1349 = x1332; char *x1350 = x1333; int x1355 = 1/*true*/; char x1356 = '\0'; char *x1357 = 0/*null*/; char x1351 = x1350[0]; int x1352 = x1351 == '\0'; if (x1352) { x1357 = x1350; } else { int x1353 = x1351 == 'o'; if (x1353) { x1355 = 0/*false*/; x1356 = x1351; char *x1354 = x1350+1; x1357 = x1354; } else { x1357 = x1350; } } int x1369 = x1355; if (x1369) { char *x1370 = x1357; x1326 = 0; } else { char x1373 = x1356; char *x1374 = x1357; int x1379 = 1/*true*/; char x1380 = '\0'; char *x1381 = 0/*null*/; char x1375 = x1374[0]; int x1376 = x1375 == '\0'; if (x1376) { x1381 = x1374; } else { int x1377 = x1375 == 'n'; if (x1377) { x1379 = 0/*false*/; x1380 = x1375; char *x1378 = x1374+1; x1381 = x1378; } else { x1381 = x1374; } } int x1393 = x1379; if (x1393) { char *x1394 = x1381; x1326 = 0; } else { char x1397 = x1380; char *x1398 = x1381; int x1403 = 1/*true*/; char x1404 = '\0'; char *x1405 = 0/*null*/; char x1399 = x1398[0]; int x1400 = x1399 == '\0'; if (x1400) { x1405 = x1398; } else { int x1401 = x1399 == 't'; if (x1401) { x1403 = 0/*false*/; x1404 = x1399; char *x1402 = x1398+1; x1405 = x1402; } else { x1405 = x1398; } } int x1417 = x1403; if (x1417) { char *x1418 = x1405; x1326 = 0; } else { char x1421 = x1404; char *x1422 = x1405; int x1427 = 1/*true*/; char x1428 = '\0'; char *x1429 = 0/*null*/; char x1423 = x1422[0]; int x1424 = x1423 == '\0'; if (x1424) { x1429 = x1422; } else { int x1425 = x1423 == 'e'; if (x1425) { x1427 = 0/*false*/; x1428 = x1423; char *x1426 = x1422+1; x1429 = x1426; } else { x1429 = x1422; } } int x1441 = x1427; if (x1441) { char *x1442 = x1429; x1326 = 0; } else { char x1445 = x1428; char *x1446 = x1429; int x1451 = 1/*true*/; char x1452 = '\0'; char *x1453 = 0/*null*/; char x1447 = x1446[0]; int x1448 = x1447 == '\0'; if (x1448) { x1453 = x1446; } else { int x1449 = x1447 == 'n'; if (x1449) { x1451 = 0/*false*/; x1452 = x1447; char *x1450 = x1446+1; x1453 = x1450; } else { x1453 = x1446; } } int x1465 = x1451; if (x1465) { char *x1466 = x1453; x1326 = 0; } else { char x1469 = x1452; char *x1470 = x1453; int x1475 = 1/*true*/; char x1476 = '\0'; char *x1477 = 0/*null*/; char x1471 = x1470[0]; int x1472 = x1471 == '\0'; if (x1472) { x1477 = x1470; } else { int x1473 = x1471 == 't'; if (x1473) { x1475 = 0/*false*/; x1476 = x1471; char *x1474 = x1470+1; x1477 = x1474; } else { x1477 = x1470; } } int x1489 = x1475; if (x1489) { char *x1490 = x1477; x1326 = 0; } else { char x1493 = x1476; char *x1494 = x1477; int x1499 = 1/*true*/; char x1500 = '\0'; char *x1501 = 0/*null*/; char x1495 = x1494[0]; int x1496 = x1495 == '\0'; if (x1496) { x1501 = x1494; } else { int x1497 = x1495 == '-'; if (x1497) { x1499 = 0/*false*/; x1500 = x1495; char *x1498 = x1494+1; x1501 = x1498; } else { x1501 = x1494; } } int x1513 = x1499; if (x1513) { char *x1514 = x1501; x1326 = 0; } else { char x1517 = x1500; char *x1518 = x1501; int x1523 = 1/*true*/; char x1524 = '\0'; char *x1525 = 0/*null*/; char x1519 = x1518[0]; int x1520 = x1519 == '\0'; if (x1520) { x1525 = x1518; } else { int x1521 = x1519 == 'L'; if (x1521) { x1523 = 0/*false*/; x1524 = x1519; char *x1522 = x1518+1; x1525 = x1522; } else { x1525 = x1518; } } int x1537 = x1523; if (x1537) { char *x1538 = x1525; x1326 = 0; } else { char x1541 = x1524; char *x1542 = x1525; int x1547 = 1/*true*/; char x1548 = '\0'; char *x1549 = 0/*null*/; char x1543 = x1542[0]; int x1544 = x1543 == '\0'; if (x1544) { x1549 = x1542; } else { int x1545 = x1543 == 'e'; if (x1545) { x1547 = 0/*false*/; x1548 = x1543; char *x1546 = x1542+1; x1549 = x1546; } else { x1549 = x1542; } } int x1561 = x1547; if (x1561) { char *x1562 = x1549; x1326 = 0; } else { char x1565 = x1548; char *x1566 = x1549; int x1571 = 1/*true*/; char x1572 = '\0'; char *x1573 = 0/*null*/; char x1567 = x1566[0]; int x1568 = x1567 == '\0'; if (x1568) { x1573 = x1566; } else { int x1569 = x1567 == 'n'; if (x1569) { x1571 = 0/*false*/; x1572 = x1567; char *x1570 = x1566+1; x1573 = x1570; } else { x1573 = x1566; } } int x1585 = x1571; if (x1585) { char *x1586 = x1573; x1326 = 0; } else { char x1589 = x1572; char *x1590 = x1573; int x1595 = 1/*true*/; char x1596 = '\0'; char *x1597 = 0/*null*/; char x1591 = x1590[0]; int x1592 = x1591 == '\0'; if (x1592) { x1597 = x1590; } else { int x1593 = x1591 == 'g'; if (x1593) { x1595 = 0/*false*/; x1596 = x1591; char *x1594 = x1590+1; x1597 = x1594; } else { x1597 = x1590; } } int x1609 = x1595; if (x1609) { char *x1610 = x1597; x1326 = 0; } else { char x1613 = x1596; char *x1614 = x1597; int x1619 = 1/*true*/; char x1620 = '\0'; char *x1621 = 0/*null*/; char x1615 = x1614[0]; int x1616 = x1615 == '\0'; if (x1616) { x1621 = x1614; } else { int x1617 = x1615 == 't'; if (x1617) { x1619 = 0/*false*/; x1620 = x1615; char *x1618 = x1614+1; x1621 = x1618; } else { x1621 = x1614; } } int x1633 = x1619; if (x1633) { char *x1634 = x1621; x1326 = 0; } else { char x1637 = x1620; char *x1638 = x1621; int x1643 = 1/*true*/; char x1644 = '\0'; char *x1645 = 0/*null*/; char x1639 = x1638[0]; int x1640 = x1639 == '\0'; if (x1640) { x1645 = x1638; } else { int x1641 = x1639 == 'h'; if (x1641) { x1643 = 0/*false*/; x1644 = x1639; char *x1642 = x1638+1; x1645 = x1642; } else { x1645 = x1638; } } int x1657 = x1643; if (x1657) { char *x1658 = x1645; x1326 = 0; } else { char x1661 = x1644; char *x1662 = x1645; x1326 = x1662; } } } } } } } } } } } } } } char *x1692 = x1326; return x1692; }
#include <string.h> /*@ requires ((strlen(x1102)>=0) && \valid(x1102+(0..strlen(x1102)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */
char * p_HTTP(char * x1102) { char *x1104 = x1102; int x1109 = 1/*true*/; char x1110 = '\0'; char *x1111 = 0/*null*/; char x1105 = x1102[0]; int x1106 = x1105 == '\0'; if (x1106) { x1111 = x1102; } else { int x1107 = x1105 == 'H'; if (x1107) { x1109 = 0/*false*/; x1110 = x1105; char *x1108 = x1102+1; x1111 = x1108; } else { x1111 = x1102; } } int x1123 = x1109; if (x1123) { char *x1124 = x1111; x1104 = 0; } else { char x1127 = x1110; char *x1128 = x1111; int x1133 = 1/*true*/; char x1134 = '\0'; char *x1135 = 0/*null*/; char x1129 = x1128[0]; int x1130 = x1129 == '\0'; if (x1130) { x1135 = x1128; } else { int x1131 = x1129 == 'T'; if (x1131) { x1133 = 0/*false*/; x1134 = x1129; char *x1132 = x1128+1; x1135 = x1132; } else { x1135 = x1128; } } int x1147 = x1133; if (x1147) { char *x1148 = x1135; x1104 = 0; } else { char x1151 = x1134; char *x1152 = x1135; int x1157 = 1/*true*/; char x1158 = '\0'; char *x1159 = 0/*null*/; char x1153 = x1152[0]; int x1154 = x1153 == '\0'; if (x1154) { x1159 = x1152; } else { int x1155 = x1153 == 'T'; if (x1155) { x1157 = 0/*false*/; x1158 = x1153; char *x1156 = x1152+1; x1159 = x1156; } else { x1159 = x1152; } } int x1171 = x1157; if (x1171) { char *x1172 = x1159; x1104 = 0; } else { char x1175 = x1158; char *x1176 = x1159; int x1181 = 1/*true*/; char x1182 = '\0'; char *x1183 = 0/*null*/; char x1177 = x1176[0]; int x1178 = x1177 == '\0'; if (x1178) { x1183 = x1176; } else { int x1179 = x1177 == 'P'; if (x1179) { x1181 = 0/*false*/; x1182 = x1177; char *x1180 = x1176+1; x1183 = x1180; } else { x1183 = x1176; } } int x1195 = x1181; if (x1195) { char *x1196 = x1183; x1104 = 0; } else { char x1199 = x1182; char *x1200 = x1183; int x1205 = 1/*true*/; char x1206 = '\0'; char *x1207 = 0/*null*/; char x1201 = x1200[0]; int x1202 = x1201 == '\0'; if (x1202) { x1207 = x1200; } else { int x1203 = x1201 == '/'; if (x1203) { x1205 = 0/*false*/; x1206 = x1201; char *x1204 = x1200+1; x1207 = x1204; } else { x1207 = x1200; } } int x1219 = x1205; if (x1219) { char *x1220 = x1207; x1104 = 0; } else { char x1223 = x1206; char *x1224 = x1207; x1104 = x1224; } } } } } char *x1236 = x1104; return x1236; }
true
39
39
char * p_HTTP(char * x1102) { char *x1104 = x1102; int x1109 = 1/*true*/; char x1110 = '\0'; char *x1111 = 0/*null*/; char x1105 = x1102[0]; int x1106 = x1105 == '\0'; if (x1106) { x1111 = x1102; } else { int x1107 = x1105 == 'H'; if (x1107) { x1109 = 0/*false*/; x1110 = x1105; char *x1108 = x1102+1; x1111 = x1108; } else { x1111 = x1102; } } int x1123 = x1109; if (x1123) { char *x1124 = x1111; x1104 = 0; } else { char x1127 = x1110; char *x1128 = x1111; int x1133 = 1/*true*/; char x1134 = '\0'; char *x1135 = 0/*null*/; char x1129 = x1128[0]; int x1130 = x1129 == '\0'; if (x1130) { x1135 = x1128; } else { int x1131 = x1129 == 'T'; if (x1131) { x1133 = 0/*false*/; x1134 = x1129; char *x1132 = x1128+1; x1135 = x1132; } else { x1135 = x1128; } } int x1147 = x1133; if (x1147) { char *x1148 = x1135; x1104 = 0; } else { char x1151 = x1134; char *x1152 = x1135; int x1157 = 1/*true*/; char x1158 = '\0'; char *x1159 = 0/*null*/; char x1153 = x1152[0]; int x1154 = x1153 == '\0'; if (x1154) { x1159 = x1152; } else { int x1155 = x1153 == 'T'; if (x1155) { x1157 = 0/*false*/; x1158 = x1153; char *x1156 = x1152+1; x1159 = x1156; } else { x1159 = x1152; } } int x1171 = x1157; if (x1171) { char *x1172 = x1159; x1104 = 0; } else { char x1175 = x1158; char *x1176 = x1159; int x1181 = 1/*true*/; char x1182 = '\0'; char *x1183 = 0/*null*/; char x1177 = x1176[0]; int x1178 = x1177 == '\0'; if (x1178) { x1183 = x1176; } else { int x1179 = x1177 == 'P'; if (x1179) { x1181 = 0/*false*/; x1182 = x1177; char *x1180 = x1176+1; x1183 = x1180; } else { x1183 = x1176; } } int x1195 = x1181; if (x1195) { char *x1196 = x1183; x1104 = 0; } else { char x1199 = x1182; char *x1200 = x1183; int x1205 = 1/*true*/; char x1206 = '\0'; char *x1207 = 0/*null*/; char x1201 = x1200[0]; int x1202 = x1201 == '\0'; if (x1202) { x1207 = x1200; } else { int x1203 = x1201 == '/'; if (x1203) { x1205 = 0/*false*/; x1206 = x1201; char *x1204 = x1200+1; x1207 = x1204; } else { x1207 = x1200; } } int x1219 = x1205; if (x1219) { char *x1220 = x1207; x1104 = 0; } else { char x1223 = x1206; char *x1224 = x1207; x1104 = x1224; } } } } } char *x1236 = x1104; return x1236; }
#include <string.h> /*@ requires ((strlen(x1102)>=0) && \valid(x1102+(0..strlen(x1102)))); assigns \nothing; ensures ((0==\result) || ((strlen(\result)>=0) && \valid(\result+(0..strlen(\result))))); */
frama_c_files_v2/test_frama_c_2031.c
/*@ predicate canSee{L}(integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); predicate countRangeFrom{L}(integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countRangeFrom{L}(N, x, i+1, c-1) : countRangeFrom{L}(N, x, i+1, c); */ /*@ requires N > 0; requires \valid(a + (0..N-1)); ensures countRangeFrom(N, a, 0, \result); */ int count(int N, int* a) { int max = a[N-1]; int result = 1; /*@ loop invariant -1 <= i <= N-2; loop invariant result + i <= N-1; loop invariant \exists integer j; i < j < N && a[j] == max; loop invariant \forall integer j; i < j < N ==> a[j] <= max; loop invariant countRangeFrom(N, a, i+1, result); loop assigns i, max, result; loop variant i+1; */ for (int i = N-2; i >= 0; --i) if (a[i] > max) { max = a[i]; ++result; } return result; }
/*@ predicate canSee{L}(integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); predicate countRangeFrom{L}(integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countRangeFrom{L}(N, x, i+1, c-1) : countRangeFrom{L}(N, x, i+1, c); */ /*@ requires N > 0; requires \valid(a + (0..N-1)); ensures countRangeFrom(N, a, 0, \result); */
int count(int N, int* a) { int max = a[N-1]; int result = 1; /*@ loop invariant -1 <= i <= N-2; loop invariant result + i <= N-1; loop invariant \exists integer j; i < j < N && a[j] == max; loop invariant \forall integer j; i < j < N ==> a[j] <= max; loop invariant countRangeFrom(N, a, i+1, result); loop assigns i, max, result; loop variant i+1; */ for (int i = N-2; i >= 0; --i) if (a[i] > max) { max = a[i]; ++result; } return result; }
true
23
23
int count(int N, int* a) { int max = a[N-1]; int result = 1; /*@ loop invariant -1 <= i <= N-2; loop invariant result + i <= N-1; loop invariant \exists integer j; i < j < N && a[j] == max; loop invariant \forall integer j; i < j < N ==> a[j] <= max; loop invariant countRangeFrom(N, a, i+1, result); loop assigns i, max, result; loop variant i+1; */ for (int i = N-2; i >= 0; --i) if (a[i] > max) { max = a[i]; ++result; } return result; }
/*@ predicate canSee{L}(integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); predicate countRangeFrom{L}(integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countRangeFrom{L}(N, x, i+1, c-1) : countRangeFrom{L}(N, x, i+1, c); */ /*@ requires N > 0; requires \valid(a + (0..N-1)); ensures countRangeFrom(N, a, 0, \result); */
frama_c_files_v2/test_frama_c_2603.c
/* run.config_qualif OPT: -pp-annot -wp -wp-par 1 -wp-prop="-qed_ko" OPT: -pp-annot -wp -wp-par 1 -wp-prop qed_ko -wp-timeout 2 */ #define OK 33 #define KO 55 int k ; int inp[5] ; int out[5] ; /*@ requires 0 <= k < 5 ; @ ensures \result == out[\old(k)] ; @ ensures inp[\old(k)] == u; @ ensures k == \old(k)+1 ; @ assigns k,inp[k] ; @ */ int g(int u); /*@ requires k == 0 ; @ assigns k, inp[0], inp[1]; @ behavior FST_FAIL: @ assumes out[0] != OK ; @ ensures k == 1 ; @ ensures inp[0] == a ; @ ensures \result == KO ; @ behavior SND_FAIL: @ assumes out[0] == OK ; @ assumes out[1] != OK ; @ ensures k == 2 ; @ ensures inp[0] == a ; @ ensures inp[1] == b ; @ ensures \result == KO ; @ behavior SUCCESS: @ assumes out[0] == OK ; @ assumes out[1] == OK ; @ ensures k == 2 ; @ ensures inp[0] == a ; @ ensures inp[1] == b ; @ ensures \result == OK ; @ complete behaviors FST_FAIL, SND_FAIL, SUCCESS; @ disjoint behaviors FST_FAIL, SND_FAIL, SUCCESS; @ */ int f(int a,int b) { int x ; int y ; x = g(a); if (x != OK) return KO ; y = g(b); if (y != OK) return KO ; return OK ; }
#define OK 33 int k ; int inp[5] ; int out[5] ; /*@ requires 0 <= k < 5 ; @ ensures \result == out[\old(k)] ; @ ensures inp[\old(k)] == u; @ ensures k == \old(k)+1 ; @ assigns k,inp[k] ; @ */ int g(int u);
int g(int u) { int t = out[k]; inp[k] = u; k ++; return t; }
true
12
12
int g(int u) { int t = out[k]; inp[k] = u; k ++; return t; }
#define OK 33 int k ; int inp[5] ; int out[5] ; /*@ requires 0 <= k < 5 ; @ ensures \result == out[\old(k)] ; @ ensures inp[\old(k)] == u; @ ensures k == \old(k)+1 ; @ assigns k,inp[k] ; @ */ int g(int u);
frama_c_files_v2/test_frama_c_2862.c
/* run.config_qualif DONTRUN: [PB] temporary removed since a difference has to be validated. */ /* run.config_qualif OPT: -wp-par 1 -load-script tests/wp_plugin/combined.ml */ /* ZD : this should not be here such as it cannot be tested by all frama-c developer */ /*@ axiomatic A { @ predicate P(int x); @ }*/ /*@ ensures P(\result); @ assigns \nothing; */ int f(int i); /*@ assigns \nothing; */ int g(int j); void job(int *t, int A) { /*@ assert 50 <= A <= 100; */ /*@ loop invariant 0 <= i <= 50; @ loop invariant \forall integer k; 0 <= k < i ==> P(t[k]); @ loop assigns i,t[0..49]; @ */ for(int i = 0; i < 50; i++) t[i] = f(i); /*@ loop invariant A <= j <= 100; @ loop assigns j,t[A..99]; @ */ for(int j = A; j < 100; j++) t[j] = g(j); /*@ assert \forall integer k; 0 <= k < 50 ==> P(t[k]); */ } int T[100]; void main(void) { job(T, 50); // job(T, 48); }
/*@ assigns \nothing; */
int g(int j) { return 0; // Dummy implementation to satisfy verification }
true
3
3
int g(int j) { return 0; // Dummy implementation to satisfy verification }
/*@ assigns \nothing; */
frama_c_files_v2/test_frama_c_1783.c
/*@ assigns \nothing; */ void foo() {}
/*@ assigns \nothing; */
void foo() {}
true
3
3
void foo() {}
/*@ assigns \nothing; */
frama_c_files_v2/test_frama_c_2233.c
/* run.config OPT: -rpp */ /* * Based on http://codedbot.com/questions/402185/java-comparator-violates-general-contract * */ struct SolutionComparator { int getValue; int solutionCost; }; /*@ requires 0 <= h < 100; @ requires 0 <= o1.getValue <= 10 && 0 <= o1.solutionCost <= 10 && 0 <= o2.getValue <= 10 && 0 <= o2.solutionCost <=10; @ assigns \nothing; */ int compare(struct SolutionComparator o1, struct SolutionComparator o2, int h) { int v1 = o1.getValue; int v2 = o2.getValue; if ((v1 == -1) && (v2 == -1)) return 0; else if (v1 == -1) return 1; else if (v2 == -1) return -1; else if (v1 == v2){ //return (int)Math.signum(solutionCost(o1) - solutionCost(o2)); int comp = o1.solutionCost - o2.solutionCost; if (comp > 0) return 1; else if (comp < 0) return -1; else return 0; } else { //return (int)Math.signum(Math.abs(target-v1) - Math.abs(target-v2)); int target = h; int comp1 = target-v1; int abscomp1 = 0; if (comp1 >= 0) abscomp1 = comp1; else abscomp1 = -comp1; int comp2 = target-v2; int abscomp2 = 0; if (comp2 >= 0) abscomp2 = comp2; else abscomp2 = -comp2; int comp3 = abscomp1 - abscomp2; if (comp3 > 0) return 1; else if (comp3 < 0) return -1; else return 0; } }
struct SolutionComparator { int getValue; int solutionCost; }; /*@ requires 0 <= h < 100; @ requires 0 <= o1.getValue <= 10 && 0 <= o1.solutionCost <= 10 && 0 <= o2.getValue <= 10 && 0 <= o2.solutionCost <=10; @ assigns \nothing; */
int compare(struct SolutionComparator o1, struct SolutionComparator o2, int h) { int v1 = o1.getValue; int v2 = o2.getValue; if ((v1 == -1) && (v2 == -1)) return 0; else if (v1 == -1) return 1; else if (v2 == -1) return -1; else if (v1 == v2){ //return (int)Math.signum(solutionCost(o1) - solutionCost(o2)); int comp = o1.solutionCost - o2.solutionCost; if (comp > 0) return 1; else if (comp < 0) return -1; else return 0; } else { //return (int)Math.signum(Math.abs(target-v1) - Math.abs(target-v2)); int target = h; int comp1 = target-v1; int abscomp1 = 0; if (comp1 >= 0) abscomp1 = comp1; else abscomp1 = -comp1; int comp2 = target-v2; int abscomp2 = 0; if (comp2 >= 0) abscomp2 = comp2; else abscomp2 = -comp2; int comp3 = abscomp1 - abscomp2; if (comp3 > 0) return 1; else if (comp3 < 0) return -1; else return 0; } }
true
25
25
int compare(struct SolutionComparator o1, struct SolutionComparator o2, int h) { int v1 = o1.getValue; int v2 = o2.getValue; if ((v1 == -1) && (v2 == -1)) return 0; else if (v1 == -1) return 1; else if (v2 == -1) return -1; else if (v1 == v2){ //return (int)Math.signum(solutionCost(o1) - solutionCost(o2)); int comp = o1.solutionCost - o2.solutionCost; if (comp > 0) return 1; else if (comp < 0) return -1; else return 0; } else { //return (int)Math.signum(Math.abs(target-v1) - Math.abs(target-v2)); int target = h; int comp1 = target-v1; int abscomp1 = 0; if (comp1 >= 0) abscomp1 = comp1; else abscomp1 = -comp1; int comp2 = target-v2; int abscomp2 = 0; if (comp2 >= 0) abscomp2 = comp2; else abscomp2 = -comp2; int comp3 = abscomp1 - abscomp2; if (comp3 > 0) return 1; else if (comp3 < 0) return -1; else return 0; } }
struct SolutionComparator { int getValue; int solutionCost; }; /*@ requires 0 <= h < 100; @ requires 0 <= o1.getValue <= 10 && 0 <= o1.solutionCost <= 10 && 0 <= o2.getValue <= 10 && 0 <= o2.solutionCost <=10; @ assigns \nothing; */
frama_c_files_v2/test_frama_c_2058.c
// remplir un tableau avec une valeur donnée /*@ requires \valid (t+(0..n-1)); requires n > 0; assigns t[0..n-1]; ensures \forall integer i; 0 <= i < n ==> t[i] == val; */ void fill_array(int t[], int n, int val) { int i = 0; /*@ loop invariant \forall integer j; 0 <= j < i ==> t[j] == val; loop invariant 0 <= i <= n; loop variant n-i; */ while (i < n) { t[i] = val; i++; } }
/*@ requires \valid(t + (0..n-1)); requires n > 0; assigns t[0..n-1]; ensures \forall integer i; 0 <= i < n ==> t[i] == val; */
void fill_array(int t[], int n, int val) { int i = 0; /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] == val; loop assigns i, t[0..n-1]; loop variant n - i; */ while (i < n) { t[i] = val; i++; } }
true
15
15
void fill_array(int t[], int n, int val) { int i = 0; /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> t[j] == val; loop assigns i, t[0..n-1]; loop variant n - i; */ while (i < n) { t[i] = val; i++; } }
/*@ requires \valid(t + (0..n-1)); requires n > 0; assigns t[0..n-1]; ensures \forall integer i; 0 <= i < n ==> t[i] == val; */
frama_c_files_v2/test_frama_c_944.c
#define N 12 int array[ N ]; /*@ ensures 0 <= esult < N; */ int get_index(void); void main() { int i = get_index(); array[ i ] = 3; } #ifndef FRAMA_C int get_index(void) { int i = 7; return i; } #endif
#define N 12 int array[ N ]; int get_index(void);
#ifndef FRAMA_C int get_index(void) { int i = 7; return i; } #endif
true
2
2
#ifndef FRAMA_C int get_index(void) { int i = 7; return i; } #endif
#define N 12 int array[ N ]; int get_index(void);
frama_c_files_v2/test_frama_c_2478.c
//@ predicate null(char *x) = x == 0; //@ predicate eq(char *x, char *y) = x == y; //@predicate my_null(char *x) = x == (void*)0; void f(char *x) { x = 0; //@ assert x == (void*)0; //@ assert my_null(x); //@ assert null(x); //@ assert eq(x,0); } //@ ensures \result == \true; int g() { return 1; } /*@ predicate foo (integer x) = x != 0; */ /*@ ensures foo(1); */ int h() { return 1; }
int g() { return 1; }
true
2
2
int g() { return 1; }
frama_c_files_v2/test_frama_c_2778.c
/*@ axiomatic abs { @ logic int abs(int x); @ axiom pos: \forall int x; x >= 0 ==> abs(x) == x; @ axiom neg: \forall int x; x <= 0 ==> abs(x) == -x; @ } */ /*@ ensures \result == abs(x); @ assigns \nothing; */ int abs(int x); /*@ ensures (\result == x || \result == y) @ && \result >= x && \result >= y; @ assigns \nothing; */ int max(int x, int y); /*@ ensures \result >= 0; @ assigns \nothing; */ int max_abs(int x, int y) { x = abs(x); y = abs(y); return max(x, y); }
/*@ ensures (\result == x || \result == y) @ && \result >= x && \result >= y; @ assigns \nothing; */
int max(int x, int y) { if (x > y) return x; else return y; }
true
5
5
int max(int x, int y) { if (x > y) return x; else return y; }
/*@ ensures (\result == x || \result == y) @ && \result >= x && \result >= y; @ assigns \nothing; */
frama_c_files_v2/test_frama_c_2729.c
#include<stdbool.h> #define round(X) (double) (X) /*@ axiomatic fp_funs { logic double Dadd(double X, double Y) = round(X+Y); logic double Dsub(double X, double Y) = round(X-Y); logic double Dmul(double X, double Y) = round(X*Y); logic double Dneg(double X) = round(0-X); logic double Dabs(double X) = round(X); //TODO define correctly logic double Ddiv(double X, double Y) = X; // (Y != 0.0 ? round(X/Y) : 0.0) ; // } // axiomatic int_funs { logic integer Iadd(integer X, integer Y) = X+Y; logic integer Isub(integer X, integer Y) = X-Y; logic integer Imul(integer X, integer Y) = X*Y; logic integer Ineg(integer X) = 0-X; // logic integer Idiv(integer X, integer Y) = (Y != 0 ? X/Y : 0) ; // } // axiomatic error_bounds { logic real ulp_dp(real X) = \round_double(\Up,X)-\round_double(\Down,X); logic real errAdd_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X + Y) + E_X + E_Y)/2; logic real errSub_dp(real X, real E_X, real Y, real E_Y) = E_X + E_Y + ulp_dp(\abs(X - Y) + E_X + E_Y)/2; logic real errMul_dp(real X, real E_X, real Y, real E_Y) = \abs(X)*E_Y+\abs(Y)*E_X+E_X*E_Y + ulp_dp(\abs(X)*\abs(Y) + \abs(X)*E_Y + E_X*\abs(Y) + E_X*E_Y)/2; logic real errDiv_dp(real X, real E_X, real Y, real E_Y) = ( ((Y*Y - E_Y*\abs(Y)) != 0 && (\abs(Y) - E_Y) !=0)? (\abs(Y)*E_X + \abs(X)*E_Y) / (Y*Y - E_Y*\abs(Y)) + ulp_dp((\abs(X) + E_X) / (\abs(Y) - E_Y)) / 2 : 0 ); logic real errNeg_dp(real X, real E_X) = E_X; logic real errAdd_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; logic real errSub_i(integer X, real E_X, integer Y, real E_Y) = E_X + E_Y; } */ struct maybeInt { bool isValid; int value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeInt none () { struct maybeInt result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeInt some (int val) { struct maybeInt result = { true, val }; return result; } struct maybeFloat { bool isValid; float value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeFloat noneFloat () { struct maybeFloat result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeFloat someFloat (float val) { struct maybeFloat result = { true, val }; return result; } struct maybeDouble { bool isValid; double value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeDouble noneDouble () { struct maybeDouble result = { false, 0 }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeDouble someDouble (double val) { struct maybeDouble result = { true, val }; return result; } struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */ struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; } /*@ assigns \nothing; ensures \result.isValid; ensures \result.value == val; */ struct maybeBool someBool (bool val) { struct maybeBool result = { true, val }; return result; }
#include<stdbool.h> struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; }
true
4
4
struct maybeBool noneBool () { struct maybeBool result = { false, false }; return result; }
#include<stdbool.h> struct maybeBool { bool isValid; bool value; }; /*@ assigns \nothing; ensures ! \result.isValid; */
frama_c_files_v2/test_frama_c_1670.c
/* run.config OPT: -load-module lib/plugins/Report -rte -rte-precond -then -val -then -report -report-print-properties OPT: -load-module lib/plugins/Report -val -then -rte -rte-precond -then -report -report-print-properties */ // Fuse with precond.c when bts #1208 is solved int x = 0; /*@ requires i >= -1; assigns x; ensures x == i; */ void f (int i) { x = i; } /*@ requires x <= 8; assigns x; ensures x == \old(x) + 1 || x == \old(x); */ void g(); void g() { if (x < 8) { x++; } } /*@ requires -1 <= 8; // Ensure x <= 8 after the calls to f in the if(c) blocks. requires x <= 8; assigns x; */ void main (int c) { if (c) { f(1); if(c) f(-1); } //@ assert x <= 8; g (); //@ assert x <= 8; g (); }
int x = 0; /*@ requires x <= 8; assigns x; ensures x == \old(x) + 1 || x == \old(x); */
void g(); void g() { if (x < 8) { x++; } }
true
5
5
void g(); void g() { if (x < 8) { x++; } }
int x = 0; /*@ requires x <= 8; assigns x; ensures x == \old(x) + 1 || x == \old(x); */
frama_c_files_v2/test_frama_c_2896.c
/*@ ensures \result>=a && \result>=b && \result>=c; ensures \result==a || \result==b || \result==c; ensures a>=b && a>=c ==> \result==a; ensures b>=a && b>=c ==> \result==b; ensures c>=a && c>=b ==> \result==c; */ int max3(int a,int b,int c) { int max; if((a >= b) && (a >= c)) { max = a; } else if((b >= a) && (b >= c)) { max = b; } else if((c >= a) && (c >= b)) { max = c; } return max; }
/*@ ensures \result>=a && \result>=b && \result>=c; ensures \result==a || \result==b || \result==c; ensures a>=b && a>=c ==> \result==a; ensures b>=a && b>=c ==> \result==b; ensures c>=a && c>=b ==> \result==c; */
int max3(int a,int b,int c) { int max; if((a >= b) && (a >= c)) { max = a; } else if((b >= a) && (b >= c)) { max = b; } else if((c >= a) && (c >= b)) { max = c; } return max; }
true
7
7
int max3(int a,int b,int c) { int max; if((a >= b) && (a >= c)) { max = a; } else if((b >= a) && (b >= c)) { max = b; } else if((c >= a) && (c >= b)) { max = c; } return max; }
/*@ ensures \result>=a && \result>=b && \result>=c; ensures \result==a || \result==b || \result==c; ensures a>=b && a>=c ==> \result==a; ensures b>=a && b>=c ==> \result==b; ensures c>=a && c>=b ==> \result==c; */
frama_c_files_v2/test_frama_c_2649.c
/*@ predicate canSee{L} (integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); */ /*@ predicate countTall{L} (integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countTall{L}(N, x, i + 1, c - 1) : countTall{L}(N, x, i + 1, c); */ /*@ requires N >= 1 && N <= 1000000; requires \valid (x + (0 .. N -1)); ensures \forall integer i; 0 <= i < N ==> x[i] == \old(x[i]); ensures countTall (N, x, 0, \result); */ int countWhoCanSee (int N, int x[]) { int tallest = x[N - 1]; int count = 1; /*@ loop invariant -1 <= i < N -1; loop invariant count + i <= N - 1; loop invariant \forall integer j; i < j < N ==> tallest >= x[j]; loop invariant \exists integer j; i < j < N && tallest == x[j]; loop invariant countTall (N, x, i + 1, count); loop assigns tallest, i, count; loop variant i + 1; */ for (int i = N - 2; i >= 0; --i) if (tallest < x[i]) { tallest = x[i]; count++; } return count; }
/*@ predicate canSee{L} (integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); predicate countTall{L} (integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countTall{L}(N, x, i + 1, c - 1) : countTall{L}(N, x, i + 1, c); */ /*@ requires N >= 1 && N <= 1000000; requires \valid(x + (0 .. N - 1)); ensures \forall integer i; 0 <= i < N ==> x[i] == \old(x[i]); ensures countTall(N, x, 0, \result); */
int countWhoCanSee(int N, int x[]) { int tallest = x[N - 1]; int count = 1; /*@ loop invariant -1 <= i < N - 1; loop invariant count + i <= N - 1; loop invariant \forall integer j; i < j < N ==> tallest >= x[j]; loop invariant \exists integer j; i < j < N && tallest == x[j]; loop invariant countTall(N, x, i + 1, count); loop assigns tallest, i, count; loop variant i + 1; */ for (int i = N - 2; i >= 0; --i) if (tallest < x[i]) { tallest = x[i]; count++; } return count; }
true
24
24
int countWhoCanSee(int N, int x[]) { int tallest = x[N - 1]; int count = 1; /*@ loop invariant -1 <= i < N - 1; loop invariant count + i <= N - 1; loop invariant \forall integer j; i < j < N ==> tallest >= x[j]; loop invariant \exists integer j; i < j < N && tallest == x[j]; loop invariant countTall(N, x, i + 1, count); loop assigns tallest, i, count; loop variant i + 1; */ for (int i = N - 2; i >= 0; --i) if (tallest < x[i]) { tallest = x[i]; count++; } return count; }
/*@ predicate canSee{L} (integer N, int *x, integer i) = \forall integer j; i < j < N ==> \at(x[i], L) > \at(x[j], L); predicate countTall{L} (integer N, int *x, integer i, integer c) = i >= N ? c == 0 : canSee{L}(N, x, i) ? countTall{L}(N, x, i + 1, c - 1) : countTall{L}(N, x, i + 1, c); */ /*@ requires N >= 1 && N <= 1000000; requires \valid(x + (0 .. N - 1)); ensures \forall integer i; 0 <= i < N ==> x[i] == \old(x[i]); ensures countTall(N, x, 0, \result); */
frama_c_files_v2/test_frama_c_2533.c
/* run.config OPT: -load-module lib/plugins/Obfuscator -obfuscate -journal-disable */ /*@ ensures \valid(q); */ int f(int *q) ; #define LV X_9999999999999999999999999999999999999999999999999999 int global_LV; enum { OK = 1, NOT_OK = 0 } e ; /*@ ensures \valid(p); */ void main (int * p) { int LV = 0; e = OK ; f(p); }
/*@ requires \valid(q); ensures \valid(q); */ int f(int *q);
/*@ requires \valid(q); ensures \valid(q); */ int f(int *q) { *q = 1; return 0; }
true
4
4
/*@ requires \valid(q); ensures \valid(q); */ int f(int *q) { *q = 1; return 0; }
/*@ requires \valid(q); ensures \valid(q); */ int f(int *q);
frama_c_files_v2/test_frama_c_2248.c
int remove_copy_array (int* a, int length, int* dest, int value ) { int i_a = 0; int i_dest = 0; /*@ loop invariant 0 <= i_a <= length; loop invariant i_dest <= i_a; loop invariant 0 <= i_dest <= length; loop invariant \forall integer k; 0 <= k < i_dest ==> dest[k] != value; loop invariant i_dest == predicate_remove_copy{Pre,Here}(a, dest, i_a-1, i_dest-1, value); */ for ( ; i_a != length; ++i_a) if (a[i_a] != value) { dest[i_dest] = a[i_a]; /*@assert i_dest+1==predicate_remove_copy{Pre,Here}(a,dest,i_a,i_dest,value); */ ++i_dest; } return i_dest; }
/*@ axiomatic Predicate_remove_copy { logic integer predicate_remove_copy{La,Lb}(int* a, int* b, integer i_a, integer i_b, int value); axiom predicate_remove_copy_empty{La,Lb}: \forall int* a, int* b, value, integer i_a, i_b; 0 > i_a && 0 > i_b ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == 0; axiom predicate_remove_copy_equal_value{La,Lb}: \forall int* a, int* b, value, integer i_a, integer i_b; 0 <= i_a && \at(a[i_a],La) == value ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb}(a, b, i_a-1, i_b, value); axiom predicate_remove_copy_not_equal_value{La,Lb}: \forall int* a, int* b, value, integer i_a, i_b; 0 <= i_a && 0 <= i_b && (\at(a[i_a],La) != value <==> \at(a[i_a],La) == \at(b[i_b],Lb)) ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb}(a, b, i_a-1, i_b-1, value) + 1; axiom predicate_remove_copy_label{La,Lb1,Lb2}: \forall int* a, int* b, value, integer i_a, i_b; (\forall integer i; 0 <= i <= i_b ==> \at(b[i],Lb1) == \at(b[i],Lb2)) ==> predicate_remove_copy{La,Lb1}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb2}(a, b, i_a, i_b, value); } */ /*@ requires 0 <= length; requires \valid_range(a, 0, length - 1); requires \valid_range(dest, 0, length - 1); ensures 0 <= \result <= length; ensures \forall integer k; 0 <= k < \result ==> dest[k] != value; ensures \result == predicate_remove_copy{Old,Here}(a, dest, length - 1, \result - 1, value); */
int remove_copy_array(int* a, int length, int* dest, int value) { int i_a = 0; int i_dest = 0; /*@ loop invariant 0 <= i_a <= length; loop invariant i_dest <= i_a; loop invariant 0 <= i_dest <= length; loop invariant \forall integer k; 0 <= k < i_dest ==> dest[k] != value; loop invariant i_a == 0 ==> i_dest == 0; loop invariant i_dest == predicate_remove_copy{Pre,Here}(a, dest, i_a - 1, i_dest - 1, value); loop assigns i_a, i_dest, dest[0..length - 1]; loop variant length - i_a; */ for (; i_a < length; ++i_a) { if (a[i_a] != value) { dest[i_dest] = a[i_a]; //@ assert i_dest + 1 == predicate_remove_copy{Pre,Here}(a, dest, i_a, i_dest, value); ++i_dest; } } return i_dest; }
true
28
28
int remove_copy_array(int* a, int length, int* dest, int value) { int i_a = 0; int i_dest = 0; /*@ loop invariant 0 <= i_a <= length; loop invariant i_dest <= i_a; loop invariant 0 <= i_dest <= length; loop invariant \forall integer k; 0 <= k < i_dest ==> dest[k] != value; loop invariant i_a == 0 ==> i_dest == 0; loop invariant i_dest == predicate_remove_copy{Pre,Here}(a, dest, i_a - 1, i_dest - 1, value); loop assigns i_a, i_dest, dest[0..length - 1]; loop variant length - i_a; */ for (; i_a < length; ++i_a) { if (a[i_a] != value) { dest[i_dest] = a[i_a]; //@ assert i_dest + 1 == predicate_remove_copy{Pre,Here}(a, dest, i_a, i_dest, value); ++i_dest; } } return i_dest; }
/*@ axiomatic Predicate_remove_copy { logic integer predicate_remove_copy{La,Lb}(int* a, int* b, integer i_a, integer i_b, int value); axiom predicate_remove_copy_empty{La,Lb}: \forall int* a, int* b, value, integer i_a, i_b; 0 > i_a && 0 > i_b ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == 0; axiom predicate_remove_copy_equal_value{La,Lb}: \forall int* a, int* b, value, integer i_a, integer i_b; 0 <= i_a && \at(a[i_a],La) == value ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb}(a, b, i_a-1, i_b, value); axiom predicate_remove_copy_not_equal_value{La,Lb}: \forall int* a, int* b, value, integer i_a, i_b; 0 <= i_a && 0 <= i_b && (\at(a[i_a],La) != value <==> \at(a[i_a],La) == \at(b[i_b],Lb)) ==> predicate_remove_copy{La,Lb}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb}(a, b, i_a-1, i_b-1, value) + 1; axiom predicate_remove_copy_label{La,Lb1,Lb2}: \forall int* a, int* b, value, integer i_a, i_b; (\forall integer i; 0 <= i <= i_b ==> \at(b[i],Lb1) == \at(b[i],Lb2)) ==> predicate_remove_copy{La,Lb1}(a, b, i_a, i_b, value) == predicate_remove_copy{La,Lb2}(a, b, i_a, i_b, value); } */ /*@ requires 0 <= length; requires \valid_range(a, 0, length - 1); requires \valid_range(dest, 0, length - 1); ensures 0 <= \result <= length; ensures \forall integer k; 0 <= k < \result ==> dest[k] != value; ensures \result == predicate_remove_copy{Old,Here}(a, dest, length - 1, \result - 1, value); */
frama_c_files_v2/test_frama_c_981.c
#include <stdio.h> #include <stdlib.h> int n, at, x; int t[1000]; //@ predicate ord{L}(int direc_var) = \forall integer i; 0 <= i <= n-2 ==> (direc_var ? t[i] < t[i+1] : t[i] > t[i+1]); //@ predicate noin{L} = \forall integer i; 0 <= i < n ==> t[i] != x; /*@ axiomatic zalozenia_zadania { axiom n_in_range{L}: 2 <= n <= 1000; axiom all_in_range{L}: \forall integer i; 0 <= i < n ==> -100000 <= t[i] <= 100000; axiom x_in_range{L}: -100000 <= x <= 100000; axiom strong_order_one_way_or_another{L}: ord((int)0) || ord((int)1); } */ /*@ assigns at; ensures at==-1 && noin || t[at]==x; */ void bins() { int from = 0; int to = n-1; //@ assert from<to; int direc = t[0]<=t[1]; //@ assert ord(direc); /*@ loop assigns at, to, from; loop invariant from<=to; loop invariant from==to && at==-1 && noin || at==from-1 && (direc? t[at]<x : t[at]>x) || at==to+1 && (direc? t[at]>x : t[at]<x) || from <= at && at <= to; loop variant to-from; */ while(1) { //@ assert from>=0; //@ assert from<to; at = (from+to)/2; //@ assert from <= at && at <= to; //@ assert to==from+1 ==> at==from && at==to-1; //@ assert to==from+2 ==> at==from+1 && at==to-1; if(direc? t[at]<x : t[at]>x) { //nope: @ assert from < at; //@ ghost int old_to = to; to = at-1; //@ assert old_to > to; //@ assert from <= to; } else if(direc? t[at]>x : t[at]<x) { //@ assert at < to; //@ ghost int old_from = from; from = at+1; //@ assert from > old_from; //@ assert from <= to; } else { //@ assert t[at]==x; break; } if(from==to) { //@ assert t[from]!=x; //@ assert noin; at = -1; break; } } } int main() { scanf("%d", &n); for(int i=0;i<n;i++) scanf("%d", &t[i]); scanf("%d", &x); bins(); printf("%d\n", at); return 0; }
#include <stdio.h> #include <stdlib.h> int n, at, x; int t[1000]; //@ predicate ord{L}(int direc_var) = \forall integer i; 0 <= i <= n-2 ==> (direc_var ? t[i] < t[i+1] : t[i] > t[i+1]); //@ predicate noin{L} = \forall integer i; 0 <= i < n ==> t[i] != x; /*@ axiomatic zalozenia_zadania { axiom n_in_range{L}: 2 <= n <= 1000; axiom all_in_range{L}: \forall integer i; 0 <= i < n ==> -100000 <= t[i] <= 100000; axiom x_in_range{L}: -100000 <= x <= 100000; axiom strong_order_one_way_or_another{L}: ord((int)0) || ord((int)1); } */ /*@ assigns at; ensures at==-1 && noin || t[at]==x; */
void bins() { int from = 0; int to = n-1; //@ assert from<to; int direc = t[0]<=t[1]; //@ assert ord(direc); /*@ loop assigns at, to, from; loop invariant from<=to; loop invariant from==to && at==-1 && noin || at==from-1 && (direc? t[at]<x : t[at]>x) || at==to+1 && (direc? t[at]>x : t[at]<x) || from <= at && at <= to; loop variant to-from; */ while(1) { //@ assert from>=0; //@ assert from<to; at = (from+to)/2; //@ assert from <= at && at <= to; //@ assert to==from+1 ==> at==from && at==to-1; //@ assert to==from+2 ==> at==from+1 && at==to-1; if(direc? t[at]<x : t[at]>x) { //nope: @ assert from < at; //@ ghost int old_to = to; to = at-1; //@ assert old_to > to; //@ assert from <= to; } else if(direc? t[at]>x : t[at]<x) { //@ assert at < to; //@ ghost int old_from = from; from = at+1; //@ assert from > old_from; //@ assert from <= to; } else { //@ assert t[at]==x; break; } if(from==to) { //@ assert t[from]!=x; //@ assert noin; at = -1; break; } } }
true
50
50
void bins() { int from = 0; int to = n-1; //@ assert from<to; int direc = t[0]<=t[1]; //@ assert ord(direc); /*@ loop assigns at, to, from; loop invariant from<=to; loop invariant from==to && at==-1 && noin || at==from-1 && (direc? t[at]<x : t[at]>x) || at==to+1 && (direc? t[at]>x : t[at]<x) || from <= at && at <= to; loop variant to-from; */ while(1) { //@ assert from>=0; //@ assert from<to; at = (from+to)/2; //@ assert from <= at && at <= to; //@ assert to==from+1 ==> at==from && at==to-1; //@ assert to==from+2 ==> at==from+1 && at==to-1; if(direc? t[at]<x : t[at]>x) { //nope: @ assert from < at; //@ ghost int old_to = to; to = at-1; //@ assert old_to > to; //@ assert from <= to; } else if(direc? t[at]>x : t[at]<x) { //@ assert at < to; //@ ghost int old_from = from; from = at+1; //@ assert from > old_from; //@ assert from <= to; } else { //@ assert t[at]==x; break; } if(from==to) { //@ assert t[from]!=x; //@ assert noin; at = -1; break; } } }
#include <stdio.h> #include <stdlib.h> int n, at, x; int t[1000]; //@ predicate ord{L}(int direc_var) = \forall integer i; 0 <= i <= n-2 ==> (direc_var ? t[i] < t[i+1] : t[i] > t[i+1]); //@ predicate noin{L} = \forall integer i; 0 <= i < n ==> t[i] != x; /*@ axiomatic zalozenia_zadania { axiom n_in_range{L}: 2 <= n <= 1000; axiom all_in_range{L}: \forall integer i; 0 <= i < n ==> -100000 <= t[i] <= 100000; axiom x_in_range{L}: -100000 <= x <= 100000; axiom strong_order_one_way_or_another{L}: ord((int)0) || ord((int)1); } */ /*@ assigns at; ensures at==-1 && noin || t[at]==x; */
frama_c_files_v2/test_frama_c_2183.c
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ requires \true; requires a > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. requires b > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. assigns \nothing; ensures \result == \abs(\abs(a) - \abs(b)); */ unsigned distance_abs(int a, int b) { unsigned ua = a < 0 ? -a : a; unsigned ub = b < 0 ? -b : b; //unsigned ua = a < 0 ? ((unsigned)-((long)a)) : a; // Найдите ошибку в реализации. Ответ. //unsigned ub = b < 0 ? ((unsigned)-((long)b)) : b; // Найдите ошибку в реализации. Ответ. return ua > ub ? ua - ub : ub - ua; } #ifdef OUT_OF_TASK #include <stdio.h> int main(void) { printf("res: %u\n", distance_abs(3,30)); printf("res: %u\n", distance_abs(-5,-20)); printf("res: %u\n", distance_abs(7,-10)); printf("res: %u\n", distance_abs(-2,15)); return 0; } #endif
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ requires \true; requires a > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. requires b > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. assigns \nothing; ensures \result == \abs(\abs(a) - \abs(b)); */
unsigned distance_abs(int a, int b) { unsigned ua = a < 0 ? -a : a; unsigned ub = b < 0 ? -b : b; //unsigned ua = a < 0 ? ((unsigned)-((long)a)) : a; // Найдите ошибку в реализации. Ответ. //unsigned ub = b < 0 ? ((unsigned)-((long)b)) : b; // Найдите ошибку в реализации. Ответ. return ua > ub ? ua - ub : ub - ua; }
true
11
11
unsigned distance_abs(int a, int b) { unsigned ua = a < 0 ? -a : a; unsigned ub = b < 0 ? -b : b; //unsigned ua = a < 0 ? ((unsigned)-((long)a)) : a; // Найдите ошибку в реализации. Ответ. //unsigned ub = b < 0 ? ((unsigned)-((long)b)) : b; // Найдите ошибку в реализации. Ответ. return ua > ub ? ua - ub : ub - ua; }
#define SPEC_INT_MIN -2147483648 #define SPEC_INT_MAX 2147483647 /*@ requires \true; requires a > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. requires b > SPEC_INT_MIN; // Найдите ошибку в спецификации. Ответ. assigns \nothing; ensures \result == \abs(\abs(a) - \abs(b)); */
frama_c_files_v2/test_frama_c_1707.c
#include <string.h> /*@ predicate match_aab(char* s) = s[0]=='a' && s[1]=='a' && s[2]=='b'; predicate match_anyaab(char* s) = \exists int i; 0 <= i < strlen(s) && match_aab(s+i); */ /*@ requires strlen(s)>=0 && \valid(s+(0..strlen(s))); requires strlen(s)*2+3 <= INT_MAX; assigns \nothing; ensures \result==0 || \result==1; ensures match_anyaab(s) <==> \result==1; ensures !match_anyaab(s) <==> \result==0; */ int match(char *s) { int j = 0; int k = 0; /*@ loop invariant (0 <= k <= strlen(s)); loop invariant (0 <= j <= 3); loop invariant strlen(s)>=0 && \valid(s+(0..strlen(s))); loop invariant (\forall int i; 0 <= i < k-j ==> !match_aab(s+i)); loop invariant (j==1 ==> k>=1 && s[k-1]=='a'); loop invariant (j==2 ==> k>=2 && s[k-2]=='a' && s[k-1]=='a'); loop invariant (j==3 ==> k>=3 && s[k-3]=='a' && s[k-2]=='a' && s[k-1]=='b'); loop assigns j, k; loop variant strlen(s)*2 - k*2 + j; */ while (s[k] != '\0' && j < 3) { if (j == 0) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; k += 1; } } else if (j == 1) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; } } else if (j == 2) { if (s[k] == 'b') { j += 1; k += 1; } else { j = 1; } } else { return -1; } } return j==3; }
#include <string.h> /*@ predicate match_aab(char* s) = s[0]=='a' && s[1]=='a' && s[2]=='b'; predicate match_anyaab(char* s) = \exists int i; 0 <= i < strlen(s) && match_aab(s+i); */ /*@ requires strlen(s)>=0 && \valid(s+(0..strlen(s))); requires strlen(s)*2+3 <= INT_MAX; assigns \nothing; ensures \result==0 || \result==1; ensures match_anyaab(s) <==> \result==1; ensures !match_anyaab(s) <==> \result==0; */
int match(char *s) { int j = 0; int k = 0; /*@ loop invariant (0 <= k <= strlen(s)); loop invariant (0 <= j <= 3); loop invariant strlen(s)>=0 && \valid(s+(0..strlen(s))); loop invariant (\forall int i; 0 <= i < k-j ==> !match_aab(s+i)); loop invariant (j==1 ==> k>=1 && s[k-1]=='a'); loop invariant (j==2 ==> k>=2 && s[k-2]=='a' && s[k-1]=='a'); loop invariant (j==3 ==> k>=3 && s[k-3]=='a' && s[k-2]=='a' && s[k-1]=='b'); loop assigns j, k; loop variant strlen(s)*2 - k*2 + j; */ while (s[k] != '\0' && j < 3) { if (j == 0) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; k += 1; } } else if (j == 1) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; } } else if (j == 2) { if (s[k] == 'b') { j += 1; k += 1; } else { j = 1; } } else { return -1; } } return j==3; }
true
36
36
int match(char *s) { int j = 0; int k = 0; /*@ loop invariant (0 <= k <= strlen(s)); loop invariant (0 <= j <= 3); loop invariant strlen(s)>=0 && \valid(s+(0..strlen(s))); loop invariant (\forall int i; 0 <= i < k-j ==> !match_aab(s+i)); loop invariant (j==1 ==> k>=1 && s[k-1]=='a'); loop invariant (j==2 ==> k>=2 && s[k-2]=='a' && s[k-1]=='a'); loop invariant (j==3 ==> k>=3 && s[k-3]=='a' && s[k-2]=='a' && s[k-1]=='b'); loop assigns j, k; loop variant strlen(s)*2 - k*2 + j; */ while (s[k] != '\0' && j < 3) { if (j == 0) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; k += 1; } } else if (j == 1) { if (s[k] == 'a') { j += 1; k += 1; } else { j = 0; } } else if (j == 2) { if (s[k] == 'b') { j += 1; k += 1; } else { j = 1; } } else { return -1; } } return j==3; }
#include <string.h> /*@ predicate match_aab(char* s) = s[0]=='a' && s[1]=='a' && s[2]=='b'; predicate match_anyaab(char* s) = \exists int i; 0 <= i < strlen(s) && match_aab(s+i); */ /*@ requires strlen(s)>=0 && \valid(s+(0..strlen(s))); requires strlen(s)*2+3 <= INT_MAX; assigns \nothing; ensures \result==0 || \result==1; ensures match_anyaab(s) <==> \result==1; ensures !match_anyaab(s) <==> \result==0; */
frama_c_files_v2/test_frama_c_2607.c
#include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <stdbool.h> #define boxArea(box) (box >= 1 && box <= 9 ? TRUE : FALSE) #define validCoord(x, y) ((x < 0 || x > N-1 || y < 0 || y > N-1) ? FALSE : TRUE) #define emptyBox(box) (box == ' ' ? TRUE : FALSE) #define OTHER(player) (player == playerX ? playerO : playerX) //#define playerX 'X' //#define playerO 'O' #define TRUE 1 #define FALSE 0 // #define open_spot ((char)' ') #define GAMEWIN 1 #define GAMETIE 0 #define GAMELOSE -1 #define INCOMPLETE 2 #define value_type char #define N 3 const char playerX = 'X'; const char playerO = 'O'; const char open_spot=' '; int game_result = -15; // **Functions** void initialize(char board[N][N]); void print_board(char board[N][N]); int comp_turn(char board[N][N], char player); int player_turn(char board[N][N], char player); bool gridTurn(char board[N][N], char player, int grid_var); int coordTurn(char board[N][N], char player, int x, int y); int win_check(char board[N][N], char player); int diag_check(char board[N][N], char player); int tie_check(char board[N][N]); int minNum(char board[N][N], char player); int maxNum(char board[N][N], char player); void new_board_check(char board[N][N], char new_board[N][N]); void minimax(char board[N][N], char player); bool end_game(int play); /*@ predicate zeroed(char *a, integer numCols) = orall int i; 0<=i<numCols ==> a[i] == ' '; predicate zeroed2d(char (*a)[N], integer numRows) = orall int i; 0<=i<numRows ==> zeroed(&a[i][0], N); */ // predicate zeroed2d{A}(char **a, integer n, integer m) = // orall int i; 0<=i<n ==> zeroed(a[i], m); /*@ predicate HasValue(char* a, integer m, integer n, char v) = \exists integer i; m <= i < n && a[i] == v; predicate HasValue(char* a, integer n, char v) = HasValue(a, 0, n, v); predicate HasValue2d(char (*a)[N], integer numRows, char v) = \exists integer i; 0<=i<numRows && HasValue(&a[i][0], N, v); */ /*@ predicate Won(char (*a)[N], char p) = (\exists integer i; 0<=i<N && orall integer j; 0<=j<N==>a[i][j]== p) || (\exists integer i; 0<=i<N && orall integer j; 0<=j<N==>a[j][i]== p) || ( orall integer i; 0<=i<N==>a[i][i]==p) || (a[2][0]==p && a[1][1]==p && a[0][2]); @*/ int main() { char board[N][N]; initialize(board); print_board(board); while (TRUE) { if (player_turn(board, playerX) == TRUE) break; if (comp_turn(board, playerO) == TRUE) break; } return 0; } // Initialize board /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0.. (N-1) ][0..2]; @ ensures zeroed2d(board,N); @*/ void initialize(char board[N][N]) { /*@ @ loop invariant 0<=i<=N; @ loop invariant zeroed2d(board, i); @ loop assigns i, board[0.. (N-1) ][0..2]; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) { /*@ loop invariant 0<=i<= N && 0<=j<=N; @ loop invariant zeroed2d(board, i); @ loop invariant zeroed(&board[i][0],j); @ loop assigns j, board[0.. (N-1) ][0..2]; @ loop variant N-j; @*/ for (int j = 0; j < N; ++j) { board[i][j] = ' '; } } } /*@ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0..(N-1)][0..2]; @*/ void print_board(char board[N][N]) { //printf(" "); int i; /*@ loop invariant 0<=i<=N; @ loop assigns i, board[0.. (N-1)][0..2]; @ loop variant N-i; @*/ for (i = 0; i < N; ++i) { //printf("| %c | %c | %c | ", board[0][i], board[1][i], board[2][i]); } //printf(" "); } /*@ @ assigns othing; @ behavior GameWin: assumes play == GAMEWIN; ensures esult == TRUE; @ behavior GameTie: assumes play == GAMETIE; ensures esult == TRUE; @ behavior return_false: assumes play != GAMEWIN && play != GAMETIE; ensures esult == FALSE; @*/ bool end_game(int play) { if (play == GAMEWIN) { //printf(" Winner is: Computer "); return TRUE; } else if (play == GAMETIE) { //printf(" Tie game "); return TRUE; } return FALSE; } /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0.. (N-1) ][0..2], game_result; @*/ int comp_turn(char board[N][N], char player) { //printf(" Computer's turn "); minimax(board, player); print_board(board); int play = win_check(board, player); return end_game(play); } // Player's turn /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0.. (N-1) ][0..2], game_result; @*/ int player_turn(char board[N][N], char player) { int grid_var; /*@ @ loop assigns grid_var, board[0.. (N-1) ][0..2], game_result; @*/ while (TRUE) { //printf("Enter number: "); // Allows the user to pick a spot according to the diagram //scanf("%d", &grid_var); //printf(" Player's turn "); if (gridTurn(board, player, grid_var) == 0) // If incorrect location is chosen, make user try again break; //printf("Wrong selection, try again "); } print_board(board); int play = win_check(board, player); return end_game(play); } /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0.. (N-1) ][0..2]; @ behavior box_area: assumes boxArea(grid_var) == FALSE; ensures esult == TRUE; @*/ bool gridTurn(char board[N][N], char player, int grid_var) { if (boxArea(grid_var) == FALSE) { return TRUE; } //Calculates i, j coordinates on grid int i, j; /*@ @ ensures j >= 0; @ ensures emptyBox(board[i][j]) == FALSE ==> TRUE; @ ensures grid_var < 4 ==> j == 0; @ ensures j == 1 ==> grid_var < 7; @ ensures j == 2 ==> grid_var < 10; @ assigns i,j, grid_var; @*/ if (grid_var < 4) { j = 0; } else if (grid_var < 7) { j = 1; } else { j = 2; } i = grid_var - 1 - (j * N); /*@ @ ensures i == grid_var-1-(j*N); @ ensures orall integer i, j; emptyBox(board[i][j]) == FALSE ==> TRUE; @*/ if (emptyBox(board[i][j]) == FALSE) { return TRUE; } board[i][j] = player; return FALSE; } /*@ @ behavior validCoord: assumes validCoord(x,y) == FALSE; ensures esult == TRUE; @ behavior emptyBox: assumes emptyBox(board[x][y]) == FALSE; ensures esult == TRUE; @ behavior return_false: assumes validCoord(x,y) == TRUE && emptyBox(board[x][y]) == TRUE; ensures board[x][y] == player; ensures esult == FALSE; complete behaviors validCoord, emptyBox, return_false; @*/ int coordTurn(char board[N][N], char player, int x, int y) { // Check if coordinates are valid if (validCoord(x, y) == FALSE) { return TRUE; } if (emptyBox(board[x][y]) == FALSE) { return TRUE; } board[x][y] = player; return FALSE; } /*@ @ requires alid_read(board[0..(N-1)]+(0..2)); @ assigns othing; @ ensures (board[0][0] != open_spot && board[0][0] == board[1][0] && board[1][0] == board[2][0]) && board[0][0] == player ==> GAMEWIN; @ ensures (board[0][1] != open_spot && board[0][1] == board[1][1] && board[1][1] == board[2][1]) && board[0][1] == player ==> GAMEWIN; @ ensures (board[0][2] != open_spot && board[0][2] == board[1][2] && board[1][2] == board[2][2]) && board[0][2] == player ==> GAMEWIN; @ ensures (board[0][0] != open_spot && board[0][0] == board[1][0] && board[1][0] == board[2][0]) && board[0][0] != player ==> GAMELOSE; @ ensures (board[0][1] != open_spot && board[0][1] == board[1][1] && board[1][1] == board[2][1]) && board[0][1] != player ==> GAMELOSE; @ ensures (board[0][2] != open_spot && board[0][2] == board[1][2] && board[1][2] == board[2][2]) && board[0][2] != player ==> GAMELOSE; @ ensures (board[0][0] != open_spot && board[0][0] == board[0][1] && board[0][1] == board[0][2]) && board[0][0] == player ==> GAMEWIN; @ ensures (board[1][0] != open_spot && board[1][0] == board[1][1] && board[1][1] == board[1][2]) && board[1][0] == player ==> GAMEWIN; @ ensures (board[2][0] != open_spot && board[2][0] == board[2][1] && board[2][1] == board[2][2]) && board[2][0] == player ==> GAMEWIN; @ ensures (board[0][0] != open_spot && board[0][0] == board[0][1] && board[0][1] == board[0][2]) && board[0][0] != player ==> GAMELOSE; @ ensures (board[1][0] != open_spot && board[1][0] == board[1][1] && board[1][1] == board[1][2]) && board[1][0] != player ==> GAMELOSE; @ ensures (board[2][0] != open_spot && board[2][0] == board[2][1] && board[2][1] == board[2][2]) && board[2][0] != player ==> GAMELOSE; @ ensures orall integer diag; diag ==> (diag != FALSE); @*/ int win_check(char board[N][N], char player) { int i, j; // For rows and columns /*@ @ loop invariant win_check_outerLoop: 0<=i<=N; @ loop assigns i; @ loop variant N-i; @*/ for (i = 0; i < N; ++i) { // Row if (board[0][i] != open_spot) { if (board[0][i] == board[1][i] && board[1][i] == board[2][i]) { return board[0][i] == player ? GAMEWIN : GAMELOSE; } } // Column if (board[i][0] != open_spot) { if (board[i][0] == board[i][1] && board[i][1] == board[i][2]) { return board[i][0] == player ? GAMEWIN : GAMELOSE; } } } //check the diagonal int diag = diag_check(board, player); if (diag != FALSE){ return diag; } // check for a tie return tie_check(board); } /*@ @ requires alid_read(board[0..(N-1)]+(0.. (N-1))); @ assigns othing; @ behavior left_true: assumes board[0][0] != open_spot && board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] == player; ensures esult == GAMEWIN; @ behavior right_true: assumes board[0][0] != open_spot && board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != player; ensures esult == GAMELOSE; @ behavior left_false: assumes board[2][0] != open_spot && board[2][0] == board[1][1] && board[1][1] == board[0][2] && board[2][0] == player; ensures esult == GAMEWIN; @ behavior right_false: assumes board[2][0] != open_spot && board[2][0] == board[1][1] && board[1][1] == board[0][2] && board[2][0] != player; ensures esult == GAMELOSE; @*/ int diag_check(char board[N][N], char player){ // Check left diagonal if (board[0][0] != open_spot && board[0][0] == board[1][1] && board[1][1] == board[2][2]) { return board[0][0] == player ? GAMEWIN : GAMELOSE; } // Check right diagonal if (board[2][0] != open_spot && board[2][0] == board[1][1] && board[1][1] == board[0][2]) { return board[2][0] == player ? GAMEWIN : GAMELOSE; } return FALSE; } /*@ @ requires alid_read(board[0..(N-1)]+(0.. (N-1))); @ assigns othing; @ behavior incomplete_game: assumes HasValue2d(board, N, open_spot); ensures esult == INCOMPLETE; @ behavior tie_game: assumes !HasValue2d(board, N, open_spot); ensures esult == GAMETIE; @*/ int tie_check(char board[N][N]){ // Check for a tie /*@ @ loop invariant outer: 0<=i<=N; @ loop invariant outer_prev_rows: !HasValue2d(board, i, open_spot); @ loop assigns i; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) { /*@ @ loop invariant inner_range: 0<=i<=N && 0<=j<=N; @ loop invariant inner_prev_rows: !HasValue2d(board, i, open_spot); @ loop invariant inner_left: !HasValue(&board[i][0], j, open_spot); @ loop assigns j; @ loop variant N-j; @*/ for (int j = 0; j < N; ++j) { if (board[i][j] == open_spot) // Incomplete board return INCOMPLETE; } } return GAMETIE; } /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns func_min_assign: game_result, board[0.. (N-1) ][0..2]; @ @ behavior test: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot; ensures esult == game_result; @ behavior test2: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && Won(board,player); ensures game_result == GAMEWIN && esult == game_result ; @ behavior test3: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && Won(board,player); ensures game_result == GAMELOSE && esult == game_result ; @ behavior test4: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && !Won(board,playerX) && !Won(board, playerO); ensures game_result == GAMETIE && esult == game_result ; @ @*/ int minNum(char board[N][N], char player) { game_result = win_check(board, OTHER(player)); if (game_result != INCOMPLETE) return game_result; int min = 10; /*@ @ loop invariant 0<=i<=N; @ loop assigns i, min, game_result; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) { /*@ @ loop invariant 0<=i<=N && 0<=j<=N; @ loop assigns j, min, game_result; @ loop variant N-j; @*/ for (int j = 0; j < N; ++j) { if (board[i][j] != ' ') continue; char new_board[N][N]; new_board_check( board, new_board); new_board[i][j] = player; int temp = maxNum(new_board, OTHER(player)); if (temp < min) min = temp; } } return min; } /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns funct_assign: game_result, board[0.. (N-1) ][0..2]; @ @ behavior test: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot; ensures esult == game_result; @ behavior test2: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && Won(board,player); ensures game_result == GAMEWIN && esult == game_result ; @ behavior test3: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && Won(board,player); ensures game_result == GAMELOSE && esult == game_result ; @ behavior test4: assumes orall int i, j; 0<=j<=i<=N && board[i][j] != open_spot && !Won(board,playerX) && !Won(board, playerO); ensures game_result == GAMETIE && esult == game_result ; @ @*/ int maxNum(char board[N][N], char player) { game_result = win_check(board, player); if (game_result != INCOMPLETE) return game_result; int max = -10; /*@ @ loop invariant outerloop: 0<=i<=N; @ loop assigns outer_assign: i, max, game_result; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) { /*@ @ loop invariant inner_loop: 0<=i<=N && 0<=j<=N; @ loop assigns inner_assign: j, max, game_result; @ loop variant N-j; @*/ for (int j = 0; j < N; ++j) { if (board[i][j] != ' ') continue; char new_board[N][N]; new_board_check( board, new_board); new_board[i][j] = player; int temp = minNum(new_board, OTHER(player)); if (temp > max) max = temp; } } return max; } /*@ @ requires alid_read(board[0..(N-1)]+(0..2)); @ requires alid(new_board[0..(N-1)]+(0..2)); @ assigns new_board[0.. (N-1) ][0..2]; @ ensures orall int i,j; 0<=i<=N && 0<=j<=N ==> new_board[i][j] == board[i][j]; @*/ void new_board_check(char board[N][N], char new_board[N][N]){ /*@ @ loop invariant 0<=x<=N; @ loop assigns x, new_board[0.. (N-1) ][0..2]; @ loop variant N-x; @*/ for (int x = 0; x < N; ++x) { /*@ @ loop invariant 0<=x<=N && 0<=y<=N; @ loop assigns y, new_board[0.. (N-1) ][0..2]; @ loop variant N-y; @*/ for (int y = 0; y < N; ++y) { new_board[x][y] = board[x][y]; } } } /*@ @ requires alid(board[0..(N-1)]+(0.. (N-1))); @ assigns board[0.. (N-1) ][0..2], game_result; @*/ void minimax(char board[N][N], char player) { //@ assigns max, mval_i, mval_j; int max, mval_i, mval_j; max = -10; /*@ @ loop invariant minimax_first_loop: 0<=i<=N; @ loop assigns i, max,mval_i,mval_j, game_result; @ loop variant N-i; @*/ for (int i = 0; i < N; ++i) { /*@ @ loop invariant minimax_second_loop: 0<=i<=N && 0<=j<=N; @ loop assigns j, max,mval_i,mval_j, game_result; @ loop variant N-j; @*/ for (int j = 0; j < N; ++j) { if (board[i][j] != ' ') continue; char new_board[N][N]; new_board_check( board, new_board); new_board[i][j] = player; int temp = minNum(new_board, OTHER(player)); // Computer is at top of tree if (temp > max) { // Finish with the highest outcome of minNum loop max = temp; mval_i = i; mval_j = j; } } } if (coordTurn(board, player, mval_i, mval_j) == TRUE) { //printf("Minimax error "); exit(0); } }
#include <stdbool.h> #define TRUE 1 #define FALSE 0 #define GAMEWIN 1 #define GAMETIE 0 /*@ assigns \nothing; behavior GameWin: assumes play == GAMEWIN; ensures \result == TRUE; behavior GameTie: assumes play == GAMETIE; ensures \result == TRUE; behavior return_false: assumes play != GAMEWIN && play != GAMETIE; ensures \result == FALSE; */
bool end_game(int play) { if (play == GAMEWIN) { return TRUE; } else if (play == GAMETIE) { return TRUE; } return FALSE; }
true
8
8
bool end_game(int play) { if (play == GAMEWIN) { return TRUE; } else if (play == GAMETIE) { return TRUE; } return FALSE; }
#include <stdbool.h> #define TRUE 1 #define FALSE 0 #define GAMEWIN 1 #define GAMETIE 0 /*@ assigns \nothing; behavior GameWin: assumes play == GAMEWIN; ensures \result == TRUE; behavior GameTie: assumes play == GAMETIE; ensures \result == TRUE; behavior return_false: assumes play != GAMEWIN && play != GAMETIE; ensures \result == FALSE; */
frama_c_files_v2/test_frama_c_2330.c
/* run.config EXECNOW: make tests/aorai/Aorai_test.cmxs OPT: -aorai-ltl tests/aorai/test_switch2.ltl -aorai-test 1 -aorai-acceptance -load-module tests/aorai/Aorai_test.cmxs -aorai-test-number @PTEST_NUMBER@ */ int status=0; int rr=1; //@ global invariant inv : 0<=rr<=50; /*@ requires rr<50; @ behavior j : @ ensures rr<51; */ void opa() { rr++; } void opb () { status=1; } void opc() { rr=9000; } int main(){ switch (rr) { case 1 : opa(); break; case 3 : opa(); default : opc(); } opb(); return 1; }
/* run.config EXECNOW: make tests/aorai/Aorai_test.cmxs OPT: -aorai-ltl tests/aorai/test_switch2.ltl -aorai-test 1 -aorai-acceptance -load-module tests/aorai/Aorai_test.cmxs -aorai-test-number @PTEST_NUMBER@ */ int status=0; int rr=1; //@ global invariant inv : 0<=rr<=50; /*@ requires rr<50; @ behavior j : @ ensures rr<51; */
void opb () { status=1; }
true
3
3
void opb () { status=1; }
/* run.config EXECNOW: make tests/aorai/Aorai_test.cmxs OPT: -aorai-ltl tests/aorai/test_switch2.ltl -aorai-test 1 -aorai-acceptance -load-module tests/aorai/Aorai_test.cmxs -aorai-test-number @PTEST_NUMBER@ */ int status=0; int rr=1; //@ global invariant inv : 0<=rr<=50; /*@ requires rr<50; @ behavior j : @ ensures rr<51; */
frama_c_files_v2/test_frama_c_2068.c
typedef enum { Max, Min } kind; int extremum (kind k, int x, int y) { return ((k == Max ? x > y : x < y) ? x: y); } /*@ requires k == Max || k == Min; assigns othing; ensures esult == x || esult == y; behavior is_max: assumes k == Max; ensures esult >= x && esult >= y; behavior is_min: assumes k == Min; ensures esult <= x && esult <= y; complete behaviors is_max, is_min; disjoint behaviors is_max, is_min; complete behaviors; disjoint behaviors; */ int extremum (kind k, int x, int y);
/*@ requires k == Max || k == Min; assigns othing; ensures esult == x || esult == y; behavior is_max: assumes k == Max; ensures esult >= x && esult >= y; behavior is_min: assumes k == Min; ensures esult <= x && esult <= y; complete behaviors is_max, is_min; disjoint behaviors is_max, is_min; complete behaviors; disjoint behaviors; */
typedef enum { Max, Min } kind; int extremum (kind k, int x, int y) { return ((k == Max ? x > y : x < y) ? x: y); }
true
2
2
typedef enum { Max, Min } kind; int extremum (kind k, int x, int y) { return ((k == Max ? x > y : x < y) ? x: y); }
/*@ requires k == Max || k == Min; assigns othing; ensures esult == x || esult == y; behavior is_max: assumes k == Max; ensures esult >= x && esult >= y; behavior is_min: assumes k == Min; ensures esult <= x && esult <= y; complete behaviors is_max, is_min; disjoint behaviors is_max, is_min; complete behaviors; disjoint behaviors; */
frama_c_files_v2/test_frama_c_1366.c
/* run.config COMMENT: function call STDOPT: +"-val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free -no-val-malloc-returns-null" */ #include <stdlib.h> /*@ ensures \valid(\result); */ int *f(int *x, int *y) { *y = 1; return x; } int main() { int x = 0, *p, *q = malloc(sizeof(int)), *r = malloc(sizeof(int)); p = f(&x, q); q = f(&x, r); return 0; }
#include <stdlib.h> /*@ requires \valid(x); requires \valid(y); ensures \valid(\result); */
int *f(int *x, int *y) { *y = 1; return x; }
true
4
4
int *f(int *x, int *y) { *y = 1; return x; }
#include <stdlib.h> /*@ requires \valid(x); requires \valid(y); ensures \valid(\result); */
frama_c_files_v2/test_frama_c_1510.c
/*@ requires n > 0; requires \valid(a+(0..n-1)); requires \valid(b+(0..n-1)); assigns \nothing; behavior same: assumes \forall integer k; 0 <= k < n ==> a[k] == b[k]; ensures \result==1; behavior different: assumes \exists integer k; 0 <= k < n && a[k] != b[k]; ensures \result==0; complete behaviors same, different; disjoint behaviors same, different; */ /* NOTE : the opposite of the proposition \forall integer k; 0 <= k < n ==> a[k] == b[k] is the proposition \exists integer k; 0 <= k < n && a[k] != b[k] INDEED ! - the negation of (A ==> B) is A && (negation of B) - seen from another point of view, "the negation of forall k, A" is "exists k, the negation of A" (this is 100% logical if you think of it a bit) */ int equal(const int* a, int n, const int* b) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> a[k] == b[k]; loop assigns i; loop variant n-i; */ for(int i=0; i<n; i++) { if (a[i] != b[i]) { return 0; } } return 1; }
/*@ requires n > 0; requires \valid(a+(0..n-1)); requires \valid(b+(0..n-1)); assigns \nothing; behavior same: assumes \forall integer k; 0 <= k < n ==> a[k] == b[k]; ensures \result==1; behavior different: assumes \exists integer k; 0 <= k < n && a[k] != b[k]; ensures \result==0; complete behaviors same, different; disjoint behaviors same, different; */
int equal(const int* a, int n, const int* b) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> a[k] == b[k]; loop assigns i; loop variant n-i; */ for(int i=0; i<n; i++) { if (a[i] != b[i]) { return 0; } } return 1; }
true
19
19
int equal(const int* a, int n, const int* b) { /*@ loop invariant 0 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> a[k] == b[k]; loop assigns i; loop variant n-i; */ for(int i=0; i<n; i++) { if (a[i] != b[i]) { return 0; } } return 1; }
/*@ requires n > 0; requires \valid(a+(0..n-1)); requires \valid(b+(0..n-1)); assigns \nothing; behavior same: assumes \forall integer k; 0 <= k < n ==> a[k] == b[k]; ensures \result==1; behavior different: assumes \exists integer k; 0 <= k < n && a[k] != b[k]; ensures \result==0; complete behaviors same, different; disjoint behaviors same, different; */
frama_c_files_v2/test_frama_c_1783.c
/*@ requires \valid(t+(0..max)); @ requires max>=0; @ assigns \nothing; */ int isPresent(int t[], int max, int val); int isPresent(int t[], int max, int val) { return isPresentRec(t, 0, max, val); } /*@ requires \valid(t+(0..max)); @ requires max>=0; @ requires 0<=i<=max; @ decreases max-i; @ ensures i<=\result<=max || \result==-1 ; @ ensures \result!=-1 ==> t[\result]==val; @ ensures \result==-1 ==> (\forall integer j; i<=j<=max ==> t[j]!=val); @ assigns \nothing; */ int isPresentRec(int t[], int i, int max, int val) { if(t[i]==val) return i; if(max==i) return -1; return isPresentRec(t, i+1, max, val); }
/*@ requires \valid(t+(0..max)); @ requires max>=0; @ assigns \nothing; */ int isPresent(int t[], int max, int val);
/*@ requires \valid(t+(0..max)); @ requires max>=0; @ ensures 0<=\result<=max || \result==-1 ; @ ensures \result!=-1 ==> t[\result]==val; @ ensures \result==-1 ==> (\forall integer i; 0<=i<=max ==> t[i]!=val); @ assigns \nothing; */ int isPresent(int t[], int max, int val) { return isPresentRec(t, 0, max, val); } /*@ requires \valid(t+(0..max)); @ requires max >= 0; @ requires 0 <= i <= max; @ decreases max - i; @ ensures i <= \result <= max || \result == -1; @ ensures \result != -1 ==> t[\result] == val; @ ensures \result == -1 ==> (\forall integer j; i <= j <= max ==> t[j] != val); @ assigns \nothing; */ int isPresentRec(int t[], int i, int max, int val) { if (t[i] == val) return i; if (i == max) return -1; return isPresentRec(t, i + 1, max, val); }
true
28
28
/*@ requires \valid(t+(0..max)); @ requires max>=0; @ ensures 0<=\result<=max || \result==-1 ; @ ensures \result!=-1 ==> t[\result]==val; @ ensures \result==-1 ==> (\forall integer i; 0<=i<=max ==> t[i]!=val); @ assigns \nothing; */ int isPresent(int t[], int max, int val) { return isPresentRec(t, 0, max, val); } /*@ requires \valid(t+(0..max)); @ requires max >= 0; @ requires 0 <= i <= max; @ decreases max - i; @ ensures i <= \result <= max || \result == -1; @ ensures \result != -1 ==> t[\result] == val; @ ensures \result == -1 ==> (\forall integer j; i <= j <= max ==> t[j] != val); @ assigns \nothing; */ int isPresentRec(int t[], int i, int max, int val) { if (t[i] == val) return i; if (i == max) return -1; return isPresentRec(t, i + 1, max, val); }
/*@ requires \valid(t+(0..max)); @ requires max>=0; @ assigns \nothing; */ int isPresent(int t[], int max, int val);
frama_c_files_v2/test_frama_c_2292.c
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */ int dfa_aab(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 3; } else { x16 = 0; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 6; } else { x13 = 0; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 6; } else { x14 = 0; } id = x14; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 0/*false*/; } else { x16 = 0/*false*/; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 0/*false*/; } else { x13 = 1/*true*/; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 0/*false*/; } else { x14 = 0/*false*/; } id = x14; } else { return -1; /*error: invalid state */ } return id; }
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */
int dfa_aab(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 3; } else { x16 = 0; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 6; } else { x13 = 0; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 6; } else { x14 = 0; } id = x14; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 0/*false*/; } else { x16 = 0/*false*/; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 0/*false*/; } else { x13 = 1/*true*/; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 0/*false*/; } else { x14 = 0/*false*/; } id = x14; } else { return -1; /*error: invalid state */ } return id; }
true
39
39
int dfa_aab(char* input) { if (*input == '\0') return 0/*false*/; int id = 0; char c; /*@ loop invariant strlen(input)>0 && \valid(input+(0..strlen(input))); loop invariant id == 6 || id == 3 || id == 0; loop assigns id, c, input; loop variant strlen(input); */ while (input[1] != '\0') { c = *input++; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 3; } else { x16 = 0; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 6; } else { x13 = 0; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 6; } else { x14 = 0; } id = x14; } else { return -1; /*error: invalid state*/ } } c = *input; if (id == 0) { char x1 = c; int x2 = x1 == 'A'; int x16; if (x2) { x16 = 0/*false*/; } else { x16 = 0/*false*/; } id = x16; } else if (id == 6) { char x7 = c; int x8 = x7 == 'A'; int x13; if (x8) { x13 = 0/*false*/; } else { x13 = 1/*true*/; } id = x13; } else if (id == 3) { char x4 = c; int x5 = x4 == 'A'; int x14; if (x5) { x14 = 0/*false*/; } else { x14 = 0/*false*/; } id = x14; } else { return -1; /*error: invalid state */ } return id; }
#include <string.h> /*@ requires strlen(input)>=0 && \valid(input+(0..strlen(input))); assigns \nothing; ensures \result==0 || \result==1; */
frama_c_files_v2/test_frama_c_996.c
struct counter { int seconds, minutes, hours; }; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */ void tick() { if (c.seconds < 59) c.seconds++; else { c.seconds = (c.seconds + 1) % 60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes + 1) % 60; if (c.hours < 23) c.hours++; else c.hours = 0; } }
struct counter { int seconds, minutes, hours; }; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */
void tick() { if (c.seconds < 59) c.seconds++; else { c.seconds = (c.seconds + 1) % 60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes + 1) % 60; if (c.hours < 23) c.hours++; else c.hours = 0; } }
true
19
19
void tick() { if (c.seconds < 59) c.seconds++; else { c.seconds = (c.seconds + 1) % 60; if (c.minutes < 59) c.minutes++; else c.minutes = (c.minutes + 1) % 60; if (c.hours < 23) c.hours++; else c.hours = 0; } }
struct counter { int seconds, minutes, hours; }; struct counter c; /*@ requires 0<=c.seconds<60 && 0<=c.minutes<60 && 0<=c.hours<24; behavior one: assumes c.seconds < 59 && c.minutes < 59; ensures c.seconds == \old(c.seconds)+1; behavior two: assumes c.seconds == 59 && c.minutes < 59; ensures c.seconds == 0; ensures c.minutes == \old(c.minutes)+1; behavior three: assumes c.seconds < 59 && c.minutes == 59; ensures c.seconds == \old(c.seconds)+1; behavior four: assumes c.seconds == 59 && c.minutes == 59 && c.hours < 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == \old(c.hours)+1; behavior five: assumes c.seconds == 59 && c.minutes == 59 && c.hours == 23 ; ensures c.seconds == 0; ensures c.minutes == 0; ensures c.hours == 0; complete behaviors; disjoint behaviors; */
frama_c_files_v2/test_frama_c_1127.c
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures -1<=\result<=9; ensures d(c)==\result; */ int d(char c) { return ('0' <= c && c <= '9') ? c - '0' : -1; } /*@ assigns \nothing; ensures '0'<=\result<='9' || \result==' '; ensures e(i)==\result; */ char e(int i) { return (0 <= i && i <= 9) ? i + '0' : ' '; } /*@ assigns \nothing; ensures '0'<=c<='9' ==> \result==c; ensures c!=\result ==> \result==' '; ensures e(d(c))==\result; */ char ed(char c) { return e(d(c)); } /*@ assigns \nothing; ensures 0<=i<=9 ==> \result==i; ensures i!=\result ==> \result==-1; ensures d(e(i))==\result; */ int de(int i) { return d(e(i)); } /*@ assigns \nothing; ensures d(e(d(c)))==d(c); */ int ded(char c) { return d(e(d(c))); } /*@ assigns \nothing; ensures e(d(e(i)))==e(i); */ char ede(int i) { return e(d(e(i))); }
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures d(e(d(c)))==d(c); */
int ded(char c) { return d(e(d(c))); }
true
10
10
int ded(char c) { return d(e(d(c))); }
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures d(e(d(c)))==d(c); */
frama_c_files_v2/test_frama_c_1127.c
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures -1<=\result<=9; ensures d(c)==\result; */ int d(char c) { return ('0' <= c && c <= '9') ? c - '0' : -1; } /*@ assigns \nothing; ensures '0'<=\result<='9' || \result==' '; ensures e(i)==\result; */ char e(int i) { return (0 <= i && i <= 9) ? i + '0' : ' '; } /*@ assigns \nothing; ensures '0'<=c<='9' ==> \result==c; ensures c!=\result ==> \result==' '; ensures e(d(c))==\result; */ char ed(char c) { return e(d(c)); } /*@ assigns \nothing; ensures 0<=i<=9 ==> \result==i; ensures i!=\result ==> \result==-1; ensures d(e(i))==\result; */ int de(int i) { return d(e(i)); } /*@ assigns \nothing; ensures d(e(d(c)))==d(c); */ int ded(char c) { return d(e(d(c))); } /*@ assigns \nothing; ensures e(d(e(i)))==e(i); */ char ede(int i) { return e(d(e(i))); }
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures e(d(e(i)))==e(i); */
char ede(int i) { return e(d(e(i))); }
true
11
11
char ede(int i) { return e(d(e(i))); }
#include <string.h> /*@ logic integer d(integer c) = (0 <= c - '0' <= 9) ? c - '0' : -1; logic integer e(integer i) = (0 <= i <= 9) ? i + '0' : ' '; */ /*@ assigns \nothing; ensures e(d(e(i)))==e(i); */
frama_c_files_v2/test_frama_c_715.c
/*@ requires n > 0; requires \forall int i; 0<= i <= n-1 ==> \valid(p + i); assigns \nothing; ensures \forall int i; 0 <= i <= n-1 ==> \result >= p[i]; ensures \exists int i; 0 <= i <= n-1 && \result == p[i]; */ int max_seq(int* p, int n); int max_seq(int* p, int n) { int res = *p; int i; /*@ ghost int idx = 0; */ /*@ loop invariant \forall integer j; 0 <= j <= i ==> res >= *(p+j); loop invariant \valid(p+idx) && *(p+idx) == res; */ for(i = 0; i < n; i++) { if (res < *p) { res = *p; /*@ ghost idx = i;*/ } p++; } return res; }
/*@ requires n > 0; requires \forall int i; 0<= i <= n-1 ==> \valid(p + i); assigns \nothing; ensures \forall int i; 0 <= i <= n-1 ==> \result >= p[i]; ensures \exists int i; 0 <= i <= n-1 && \result == p[i]; */ int max_seq(int* p, int n);
int max_seq(int* p, int n) { int res = p[0]; int idx = 0; /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> res >= p[j]; loop invariant res == p[idx]; loop invariant 0 <= idx < n; loop assigns i, res, idx; loop variant n - i; */ for (int i = 0; i < n; i++) { if (p[i] > res) { res = p[i]; idx = i; } } return res; }
true
20
20
int max_seq(int* p, int n) { int res = p[0]; int idx = 0; /*@ loop invariant 0 <= i <= n; loop invariant \forall integer j; 0 <= j < i ==> res >= p[j]; loop invariant res == p[idx]; loop invariant 0 <= idx < n; loop assigns i, res, idx; loop variant n - i; */ for (int i = 0; i < n; i++) { if (p[i] > res) { res = p[i]; idx = i; } } return res; }
/*@ requires n > 0; requires \forall int i; 0<= i <= n-1 ==> \valid(p + i); assigns \nothing; ensures \forall int i; 0 <= i <= n-1 ==> \result >= p[i]; ensures \exists int i; 0 <= i <= n-1 && \result == p[i]; */ int max_seq(int* p, int n);
frama_c_files_v2/test_frama_c_1304.c
#include<limits.h> /*@ requires x >= 1; requires y >= 1; requires z>= 1; requires x<=INT_MAX && y<=INT_MAX && z<=INT_MAX; requires x+y<=INT_MAX && y+z<=INT_MAX && z+x<=INT_MAX; ensures (x+y <= z || y+z <=x || x+z <=y) ==> \result == 0; ensures x+y > z && y+z >x && x+z >y && x == y && y == z ==> \result==1; ensures x+y > z && y+z >x && x+z >y && (x != y || y != z) ==> \result==0; assigns \nothing; */ int triangle(int x,int y,int z) { if(x+y > z && y+z >x && x+z >y) { if(x == y && y == z){ return 1; } else if(x == y || y == z || x==z){ return 0; } else if((x!=y)&&(y!=z)&&(z!=x)) { return 0; } } return 0; } int main() { int t = triangle(4,4,4); return 0; }
#include<limits.h> /*@ requires x >= 1; requires y >= 1; requires z>= 1; requires x<=INT_MAX && y<=INT_MAX && z<=INT_MAX; requires x+y<=INT_MAX && y+z<=INT_MAX && z+x<=INT_MAX; ensures (x+y <= z || y+z <=x || x+z <=y) ==> \result == 0; ensures x+y > z && y+z >x && x+z >y && x == y && y == z ==> \result==1; ensures x+y > z && y+z >x && x+z >y && (x != y || y != z) ==> \result==0; assigns \nothing; */
int triangle(int x,int y,int z) { if(x+y > z && y+z >x && x+z >y) { if(x == y && y == z){ return 1; } else if(x == y || y == z || x==z){ return 0; } else if((x!=y)&&(y!=z)&&(z!=x)) { return 0; } } return 0; }
true
15
15
int triangle(int x,int y,int z) { if(x+y > z && y+z >x && x+z >y) { if(x == y && y == z){ return 1; } else if(x == y || y == z || x==z){ return 0; } else if((x!=y)&&(y!=z)&&(z!=x)) { return 0; } } return 0; }
#include<limits.h> /*@ requires x >= 1; requires y >= 1; requires z>= 1; requires x<=INT_MAX && y<=INT_MAX && z<=INT_MAX; requires x+y<=INT_MAX && y+z<=INT_MAX && z+x<=INT_MAX; ensures (x+y <= z || y+z <=x || x+z <=y) ==> \result == 0; ensures x+y > z && y+z >x && x+z >y && x == y && y == z ==> \result==1; ensures x+y > z && y+z >x && x+z >y && (x != y || y != z) ==> \result==0; assigns \nothing; */
frama_c_files_v2/test_frama_c_2814.c
/*@ requires length > 0 && \valid(a+(0..length-1)); assigns \nothing; // Changed assigns clause to \nothing ensures 0<=\result<length && (\forall integer j; 0<=j<length ==> a[\result]<=a[j]); */ int find_min(int* a, int length) { int min, min_idx; min_idx = 0; min = a[0]; /*@ loop invariant 0<=i<=length ; loop invariant 0<=min_idx<length; loop invariant \forall integer j; 0<=j<i ==> min<=a[j]; loop invariant a[min_idx]==min; loop assigns min, min_idx, i; loop variant length - i; */ for (int i = 1; i<length; i++) { // Corrected loop condition to i < length if (a[i] < min) { min_idx = i; /* min_idx = i; */ min = a[i]; } } return min_idx; }
/*@ requires length > 0 && \valid(a+(0..length-1)); assigns \nothing; // Changed assigns clause to \nothing ensures 0<=\result<length && (\forall integer j; 0<=j<length ==> a[\result]<=a[j]); */
int find_min(int* a, int length) { int min, min_idx; min_idx = 0; min = a[0]; /*@ loop invariant 0<=i<=length ; loop invariant 0<=min_idx<length; loop invariant \forall integer j; 0<=j<i ==> min<=a[j]; loop invariant a[min_idx]==min; loop assigns min, min_idx, i; loop variant length - i; */ for (int i = 1; i<length; i++) { // Corrected loop condition to i < length if (a[i] < min) { min_idx = i; /* min_idx = i; */ min = a[i]; } } return min_idx; }
true
21
21
int find_min(int* a, int length) { int min, min_idx; min_idx = 0; min = a[0]; /*@ loop invariant 0<=i<=length ; loop invariant 0<=min_idx<length; loop invariant \forall integer j; 0<=j<i ==> min<=a[j]; loop invariant a[min_idx]==min; loop assigns min, min_idx, i; loop variant length - i; */ for (int i = 1; i<length; i++) { // Corrected loop condition to i < length if (a[i] < min) { min_idx = i; /* min_idx = i; */ min = a[i]; } } return min_idx; }
/*@ requires length > 0 && \valid(a+(0..length-1)); assigns \nothing; // Changed assigns clause to \nothing ensures 0<=\result<length && (\forall integer j; 0<=j<length ==> a[\result]<=a[j]); */