avoid-reusing-input-variables
Use when input variables are modified and reused for computation instead of using separate variables
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when input variables are modified and reused for computation instead of using separate variables
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when printf statements output strings without trailing newlines
Use when array is accessed with direct user input as index (0-based indexing)
Use when the program accesses a precomputed table using an offset (e.g., arr[n-1]) that introduces an arithmetic operation between the symbolic input and the index
Use when loop variables iterate over character values (e.g., ASCII codes) to represent different operations or choices
Use when code uses a loop to search for an input value in an array and then uses the found index for further computation
Use when code reads a fixed number of characters into an array and only accesses individual elements
| name | avoid-reusing-input-variables |
| description | Use when input variables are modified and reused for computation instead of using separate variables |
A KLEE-coverage code transformation. Applying it rewrites C source so symbolic execution explores more of the program's behavior.
When input variables are modified and reused for computation instead of using separate variables
Introduce a new variable to store the result of computations instead of modifying the original input variables
KLEE can better track constraints when input variables remain unchanged, as modifying inputs creates more complex symbolic expressions that are harder to reason about and may limit path exploration
Before:
#include<stdio.h>
int main(void)
{
int a,b;
scanf("%d %d",&a,&b);
a+=b;
if(a>23)a-=24;
printf("%d\n",a);
return 0;
}
After:
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d",&a,&b);
c=a+b;
if(c>=24) c-=24;
printf("%d",c);
return 0;
}
a70a4f99