Advanced-Hexrays-Decompiler-reverse-engineering
What is the CTREE API ?
// Ctree item code. At the beginning of this list there are expression
/// codes (cot_...), followed by statement codes (cit_...).
enum ctype_t
{
cot_empty = 0,
cot_comma = 1, ///< x, y
cot_asg = 2, ///< x = y
cot_asgbor = 3, ///< x |= y
cot_asgxor = 4, ///< x ^= y
cot_asgband = 5, ///< x &= y
cot_asgadd = 6, ///< x += y
cot_asgsub = 7, ///< x -= y
cot_asgmul = 8, ///< x *= y
cot_asgsshr = 9, ///< x >>= y signed
cot_asgushr = 10, ///< x >>= y unsigned
cot_asgshl = 11, ///< x <<= y
cot_asgsdiv = 12, ///< x /= y signed
cot_asgudiv = 13, ///< x /= y unsigned
cot_asgsmod = 14, ///< x %= y signed
cot_asgumod = 15, ///< x %= y unsigned
cot_tern = 16, ///< x ? y : z
cot_lor = 17, ///< x || y
cot_land = 18, ///< x && y
cot_bor = 19, ///< x | y
cot_xor = 20, ///< x ^ y
cot_band = 21, ///< x & y
cot_eq = 22, ///< x == y int or fpu (see EXFL_FPOP)
cot_ne = 23, ///< x != y int or fpu (see EXFL_FPOP)
cot_sge = 24, ///< x >= y signed or fpu (see EXFL_FPOP)
cot_uge = 25, ///< x >= y unsigned
cot_sle = 26, ///< x <= y signed or fpu (see EXFL_FPOP)
cot_ule = 27, ///< x <= y unsigned
cot_sgt = 28, ///< x > y signed or fpu (see EXFL_FPOP)
cot_ugt = 29, ///< x > y unsigned
cot_slt = 30, ///< x < y signed or fpu (see EXFL_FPOP)
.........
cit_empty = 70, ///< instruction types start here
cit_block = 71, ///< block-statement: { ... }
cit_expr = 72, ///< expression-statement: expr;
cit_if = 73, ///< if-statement
cit_for = 74, ///< for-statement
cit_while = 75, ///< while-statement
cit_do = 76, ///< do-statement
cit_switch = 77, ///< switch-statement
cit_break = 78, ///< break-statement
cit_continue = 79, ///< continue-statement
cit_return = 80, ///< return-statement
cit_goto = 81, ///< goto-statement
cit_asm = 82, ///< asm-statement
cit_try = 83, ///< C++ try-statement
cit_throw = 84, ///< C++ throw-statement
cit_end
};CTREE and pattern matching
A Trivial function








Reading some codegen


Conclusion
References
Last updated