Patent Document ID: 9298434
Application ID: 14695274

Base Claim:
1. A non-transitory computer readable storage media having instructions stored thereon that, when executed by a computer, implement a method for optimizing if statements in a program, the method comprising: obtaining for the program, a set of conditional expressions having an inclusion relation; computing a first provisional cost corresponding to the set of conditional expressions being positive, and a second provisional cost corresponding to the set of conditional expressions being negative; determining, for each conditional expression from the set of conditional expressions, a position in the program as a move destination for the conditional expression, using information of the set in which the conditional expression is included; and moving the conditional expression to the movie destination of the conditional expression, wherein moving the conditional expression comprises: in the case where a result of the conditional expression is not cached in a variable, generating an if statement for the conditional expression and caching a result of the conditional expression in a new variable, wherein the if statement is generated in increasing order of a total cost of the first provisional cost and the second provisional cost; and in the case where the result of the conditional expression is cached in the variable, replacing a conditional operator of the conditional expression with a logical operator, prior to caching the result in the new variable.

---

Claim 2:
2. The storage media of claim 1 , wherein obtaining the set of conditional expressions for the conditional expression comprises setting a positive condition and a negative condition for the conditional expression, and identifying, the conditional expressions with corresponding results determinable based on the result of the conditional expression.