avoid-explicit-conditionals
Use when code uses explicit if-else branches based on input comparisons
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when code uses explicit if-else branches based on input comparisons
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-explicit-conditionals |
| description | Use when code uses explicit if-else branches based on input comparisons |
A KLEE-coverage code transformation. Applying it rewrites C source so symbolic execution explores more of the program's behavior.
When code uses explicit if-else branches based on input comparisons
Replace conditional branches with arithmetic/logical expressions that compute the result directly
Eliminates path explosion by converting multiple execution paths into a single path with symbolic expressions, allowing KLEE to explore the behavior more efficiently without branching
Before:
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
if(n == 1) printf("0\n");
else printf("1\n");
}
After:
#include<stdio.h>
int main(){puts(getchar()-48?"0":"1");}
a7c57eed