Clairifications on how to use the immediate operand and memlabel classses: The memlabel class maintains a counter that allows new sets of labels to be generated: memlabel elselabel = new memlabel("else"); // generate new label memlabel exitlabel = new memlabel("endif",true); // auto-increment counter because the counter is auto-incremented by the second calls, the next set of calls to new memlabel will produce new labels. The actual string representing each label is accesible vai (eg) elselabel.name --- The immediate class has three forms: new immediate(3) // prints as $3 new immediate("abc"); // prints as $abc new immediate("abc",true) // prints as abc (for jump and call labels). Here's how to add the following instructions to the Code arraylist. assume that the current value of the label counter (memlabel.counter) is 3: cmp $1, %eax jne else3 ... jmp exit3 else3: nop ... exit3: nop pushl $STR1 call printf corresponds to : memlabel elselabel = new memlabel("else"); // generate new label memlabel exitlabel = new memlabel("exit",true); // auto-increment counter Code.add(new operation("cmp",new immediate(1),EAX)); // cmp $1,eax Code.add(new operation("jne",new immediate(elselabel.name, true))); // jne else3 ... Code.add(new operation("jmp",new immediate(exitlabel.name, true))); // jmp exit3 Code.add(new operation(elselabel)); // else3: nop ... Code.add(new operation(exitlabel)); // exit3: nop Code.add(new operation("pushl", new immediate("STR1"))); // pushl $STR1 Code.add(new operation("call", new immediate("printf",true))); // call printf ------ Another thing to remember is that you can always generate any instruction by just passing a single string to new operation, as in: Code.add(new operation("call printf")); or Code.add(new operation("\n exitlabel3: nop")); However, if you do it this way, you will lose the ability to modify the code later.