| 407 | |
| 408 | |
| 409 | static void ConditionalJump(Architecture* arch, LowLevelILFunction& il, uint32_t cond, uint32_t t, uint32_t f) |
| 410 | { |
| 411 | BNLowLevelILLabel* trueLabel = il.GetLabelForAddress(arch, t); |
| 412 | BNLowLevelILLabel* falseLabel = il.GetLabelForAddress(arch, f); |
| 413 | |
| 414 | if (trueLabel && falseLabel) |
| 415 | { |
| 416 | il.AddInstruction(il.If(GetCondition(il, cond), *trueLabel, *falseLabel)); |
| 417 | return; |
| 418 | } |
| 419 | |
| 420 | LowLevelILLabel trueCode, falseCode; |
| 421 | |
| 422 | if (trueLabel) |
| 423 | { |
| 424 | il.AddInstruction(il.If(GetCondition(il, cond), *trueLabel, falseCode)); |
| 425 | il.MarkLabel(falseCode); |
| 426 | il.AddInstruction(il.Jump(il.ConstPointer(4, f))); |
| 427 | return; |
| 428 | } |
| 429 | |
| 430 | if (falseLabel) |
| 431 | { |
| 432 | il.AddInstruction(il.If(GetCondition(il, cond), trueCode, *falseLabel)); |
| 433 | il.MarkLabel(trueCode); |
| 434 | il.AddInstruction(il.Jump(il.ConstPointer(4, t))); |
| 435 | return; |
| 436 | } |
| 437 | |
| 438 | il.AddInstruction(il.If(GetCondition(il, cond), trueCode, falseCode)); |
| 439 | il.MarkLabel(trueCode); |
| 440 | il.AddInstruction(il.Jump(il.ConstPointer(4, t))); |
| 441 | il.MarkLabel(falseCode); |
| 442 | il.AddInstruction(il.Jump(il.ConstPointer(4, f))); |
| 443 | } |
| 444 | |
| 445 | |
| 446 | static void CompareWithZeroAndConditionalJump(Architecture* arch, LowLevelILFunction& il, uint32_t reg, |
no test coverage detected