Hosted by Dailymotion. For legal issues report at the Copyright Center, report us on DMC, or use the Instant Removal tool.
Complex If-ElseIf-Else in x86-64 YASM Assembly - Full Guide with Code Examples
4 Views • Jan 04, 2026
Description
You'll see real working code that:
- Takes user integer input
- Tests against specific values (5, 6, etc.)
- Handles greater-than/less-than comparisons
- Properly branches so only one block executes
- Uses labels, cmp, conditional jumps (je, jl), and unconditional jumps (jmp) correctly
We cover the classic pattern: compare to conditional jump to true block to execute true code to jmp to end to false block falls through or jumps in. Everything is shown step-by-step with live compilation and runtime demos.
Perfect for anyone learning low-level programming, reverse engineering, or wanting to understand how compilers translate if-else chains into machine code. Prerequisites: basic conditional jumps (see my earlier videos).
Code shown works on Linux x86-64 with YASM/NASM syntax. Grab the concepts and apply them anywhere.
Introduction to If-Else in Assembly 00:00:00
Explaining the If-Else Design Pattern 00:00:56
Drawing the Basic If-Else Flow 00:01:01
Comparison and Conditional Jumps 00:02:30
Labels for True and False Blocks 00:03:07
Unconditional Jump to End 00:04:50
Diagram of Execution Flow 00:05:51
Alternative Pattern with Inverted Jump 00:07:00
Recapping the If-Else Pattern 00:08:45
Starting the Code Example 00:09:16
Setting Up Input and Strings 00:09:40
Calling External Functions 00:10:57
Entry Point and Prologue 00:11:40
Asking User for Integer Input 00:13:09
Creating the if_test Function 00:14:56
Preserving Callee-Saved Registers 00:15:51
Printing Begin Message 00:17:03
Implementing Simple If Block 00:18:29
Comparison and je Jump 00:19:18
True Block: Equality Message 00:21:08
Testing Simple If Examples 00:23:48
Transition to If-Else Blocks 00:24:21
Creating if_else_test Function 00:24:47
Setting Up Complex If-Else 00:26:25
First If: Equal to 5 00:27:22
True Block for Equal 5 00:28:33
Else If: Equal to 6 00:30:29
Else If: Less Than 10 00:34:17
Final Else Block 00:37:33
Done Label and Goodbye 00:38:23
Recap of Full Flow 00:39:06
Live Demo of All Branches 00:40:54
Signed vs Unsigned Jumps Note 00:43:38
Recommended Assembly Book 00:44:12
Conditional Jump Families 00:45:05
Closing and Practice Advice 00:46:48
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
Please help support us!
- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras
Keywords & Tags
More from User
AVL Tree Rotations Tutorial: Fixing Imbalance After Adding a Node
Neural Lantern
AVL Tree Rotation Types Explained for Self-Balancing Binary Search Trees
Neural Lantern
AVL Tree Tutorial: Balance Factors and Why They Fix Slow BSTs
Neural Lantern
Binary Search Tree Removals - Delete Nodes with 0, 1, or 2 Children
Neural Lantern
How to Search in a Binary Search Tree (BST) - Step by Step Explanation with Examples
Neural Lantern
Binary Search Tree Insertion Tutorial: Building a BST from Scratch Step by Step
Neural Lantern
Related Videos
x86-64 Assembly: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)
Neural Lantern
x86-64 Assembly: Integer Data Movement, Pointers, and Dereferencing Explained (YASM on Ubuntu)
Neural Lantern
x86-64 Assembly Pointers & Dereferencing Explained - Hybrid C++/YASM Example
Neural Lantern
Mastering x86-64 YASM Assembly: Functions Made Simple
Neural Lantern
x86-64 Assembly Jump Instructions Explained: Unconditional JMP with Full Example in Yasm
Neural Lantern
YASM x86-64 Assembly Functions Tutorial - Integers, Floats, Pointers, ABI, C++ Interoperability
Neural Lantern