# Package: com.pnfsoftware.jeb.core.units.code.android.ir
Description: This package contains types used to publicly access and manipulate JEB's DEX Decompiler \(referred to as `dexdec`\) Intermediate Representation \(IR\) objects. Users can use this API to write custom IR optimizers, that will be run by `dexdec` when decompiling code. Interfaces and classes/enums in this package start with `ID...` or `D...`, respectively \-\- for "\(Interface\) `dexdec`" \(or dex/dalvik\)\). Exception classes are named `DexDec...Exception`. 

 *Design note: Note the symmetry with JEB's Generic Decompiler \(`gendec`\) naming conventions, whose public interfaces and types start with `IE...` or `E...`. That symmetry does not extend to naming only: `dexdec` IR type structure closely mirror, whenever possible, `gendec`'s.* 

 `dexdec` IR optimizer plugins may be written in Python or Java. 

 A sample skeleton plugin, in Python:  

```

 #?type=dexdec-ir
 from com.pnfsoftware.jeb.core.units.code.android.ir import AbstractDOptimizer
 
 class DOptSamplePython(AbstractDOptimizer):
   def perform(self):
     # do not perform optimizations, simply print out each IR instruction of the current IR CFG
     for blk in self.cfg:  # BasicBlock (of IDInstruction)
       for insn in blk:  # IDInstruction
         logger.info("%04X: %s" % (insn.getOffset(), insn))
     # no optimization performed
     return 0
 
```
  

 The same sample plugin, in Java:  

```

 //?type=dexdec-ir
 import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer;
 
 public class DOptSampleJava extends AbstractDOptimizer {
     @Override
     public int perform() {
         // do not perform optimizations, simply print out each IR instruction of the current IR CFG
         for(var b: cfg) {  // BasicBlock of IDInstruction
             for(var insn: b) {
                 logger.info("%04X: %s", insn.getOffset(), insn);
             }
         }
         // no optimization performed
         return 0;
     }
 }
 
```
 Refer to the sub\-directory `coreplugins/`, located in the JEB installation folder, for examples.
 Additional resources: refer to the User Manual and Technical Blogs, at https://www.pnfsoftware.com.
