Skip to Content
Learning Malware Analysis
book

Learning Malware Analysis

by Monnappa K A
June 2018
Beginner
510 pages
13h 7m
English
Packt Publishing
Content preview from Learning Malware Analysis

6.4 If-Else Statement

Now, let's try to understand how the if/else statement is translated to assembly language. Let's take an example of the following C code:

if (x == 0) {    x = 5;}else {    x = 1;}

In the preceding code, try to determine under what circumstances the jump would be taken (control would be transferred). There are two circumstances: the jump will be taken to the else block if the x is not equal to 0, or, if x is equal to 0 (if x == 0), then after the execution of x=5 (the end of the if block), a jump will be taken to bypass the else block, to execute the code after the else block.

The following is the assembly translation of the C program; notice that in the first line, the value of x is compared with 0, and the jump (conditional ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Malware Analysis

Practical Malware Analysis

Michael Sikorski, Andrew Honig
Mastering Malware Analysis

Mastering Malware Analysis

Alexey Kleymenov, Amr Thabet
Evasive Malware

Evasive Malware

Kyle Cucci

Publisher Resources

ISBN: 9781788392501Other