.file	"task1.c"
	.intel_syntax noprefix
 # GNU C17 (MinGW.org GCC Build-2) version 9.2.0 (mingw32)
 #	compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP
 # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 # options passed:  -iprefix c:\mingw\bin\../lib/gcc/mingw32/9.2.0/ task1.c
 # -masm=intel -mtune=generic -march=i586 -Og -fverbose-asm
 # options enabled:  -faggressive-loop-optimizations -fassume-phsa
 # -fasynchronous-unwind-tables -fauto-inc-dec -fcombine-stack-adjustments
 # -fcommon -fcompare-elim -fcprop-registers -fdefer-pop
 # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
 # -feliminate-unused-debug-types -fforward-propagate
 # -ffp-int-builtin-inexact -ffunction-cse -fgcse-lm -fgnu-runtime
 # -fgnu-unique -fguess-branch-probability -fident -finline
 # -finline-atomics -fipa-profile -fipa-pure-const -fipa-reference
 # -fipa-reference-addressable -fipa-stack-alignment -fira-hoist-pressure
 # -fira-share-save-slots -fira-share-spill-slots -fivopts
 # -fkeep-inline-dllexport -fkeep-static-consts -fleading-underscore
 # -flifetime-dse -flto-odr-type-merging -fmath-errno -fmerge-constants
 # -fmerge-debug-strings -fomit-frame-pointer -fpeephole -fplt
 # -fprefetch-loop-arrays -freg-struct-return -freorder-blocks
 # -fsched-critical-path-heuristic -fsched-dep-count-heuristic
 # -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
 # -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
 # -fsched-stalled-insns-dep -fschedule-fusion -fsemantic-interposition
 # -fset-stack-executable -fshow-column -fshrink-wrap
 # -fshrink-wrap-separate -fsigned-zeros -fsplit-ivs-in-unroller
 # -fsplit-wide-types -fssa-backprop -fstdarg-opt
 # -fstrict-volatile-bitfields -fsync-libcalls -ftoplevel-reorder
 # -ftrapping-math -ftree-builtin-call-dce -ftree-ccp -ftree-ch
 # -ftree-coalesce-vars -ftree-copy-prop -ftree-cselim -ftree-dce
 # -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
 # -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon
 # -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop
 # -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-ter
 # -funit-at-a-time -funwind-tables -fverbose-asm -fzero-initialized-in-bss
 # -m32 -m80387 -m96bit-long-double -maccumulate-outgoing-args
 # -malign-double -malign-stringops -mavx256-split-unaligned-load
 # -mavx256-split-unaligned-store -mfancy-math-387 -mfp-ret-in-387
 # -mieee-fp -mlong-double-80 -mms-bitfields -mno-red-zone -mno-sse4
 # -mpush-args -msahf -mstack-arg-probe -mstv -mvzeroupper
	.text
	.def	___main;	.scl	2;	.type	32;	.endef
	.section .rdata,"dr"
LC0:
	.ascii "Reverse number is: %d\0"
	.text
	.globl	_main
	.def	_main;	.scl	2;	.type	32;	.endef
_main:
LFB0:
	.cfi_startproc
	push	ebp	 #
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	mov	ebp, esp	 #,
	.cfi_def_cfa_register 5
	push	esi	 #
	push	ebx	 #
	and	esp, -16	 #,
	sub	esp, 16	 #,
	.cfi_offset 6, -12
	.cfi_offset 3, -16
 # task1.c:2: int main(){
	call	___main	 #
 # task1.c:4:     int tmp_num, reverse_num = 0;
	mov	ecx, 0	 # reverse_num,
 # task1.c:3:     int num = 12345;
	mov	ebx, 12345	 # num,
L2:
 # task1.c:6:     while(num>=1){
	test	ebx, ebx	 # num
	jle	L5	 #,
 # task1.c:7:         tmp_num = num%10;
	mov	edx, 1717986919	 # tmp88,
	mov	eax, ebx	 # tmp105, num
	imul	edx	 # tmp88
	sar	edx, 2	 # tmp89,
	mov	eax, ebx	 # tmp90, num
	sar	eax, 31	 # tmp90,
	sub	edx, eax	 # tmp_num, tmp90
	mov	esi, edx	 # tmp_num, tmp_num
	lea	edx, [edx+edx*4]	 # tmp93,
	lea	eax, [edx+edx]	 # tmp94,
	sub	ebx, eax	 # num, tmp94
 # task1.c:8:         reverse_num = reverse_num * 10 + tmp_num;
	lea	eax, [ecx+ecx*4]	 # tmp97,
	lea	ecx, [eax+eax]	 # tmp98,
 # task1.c:8:         reverse_num = reverse_num * 10 + tmp_num;
	add	ecx, ebx	 # reverse_num, tmp_num
 # task1.c:9:         num = num/10;
	mov	ebx, esi	 # num, tmp_num
	jmp	L2	 #
L5:
 # task1.c:12:     printf("Reverse number is: %d", reverse_num);
	mov	DWORD PTR [esp+4], ecx	 #, reverse_num
	mov	DWORD PTR [esp], OFFSET FLAT:LC0	 #,
	call	_printf	 #
 # task1.c:14: }
	mov	eax, 0	 #,
	lea	esp, [ebp-8]	 #,
	pop	ebx	 #
	.cfi_restore 3
	pop	esi	 #
	.cfi_restore 6
	pop	ebp	 #
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret	
	.cfi_endproc
LFE0:
	.ident	"GCC: (MinGW.org GCC Build-2) 9.2.0"
	.def	_printf;	.scl	2;	.type	32;	.endef
 Write, Run & Share Assembly code online using OneCompiler's Assembly online compiler for free. It's one of the robust, feature-rich online compilers for Assembly language. Getting started with the OneCompiler's Assembly compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Assembly and start coding.
Assembly language(asm) is a low-level programming language, where the language instructions will be more similar to machine code instructions.
Every assembler may have it's own assembly language designed for a specific computers or an operating system.
Assembly language requires less execution time and memory. It is more helful for direct hardware manipulation, real-time critical applications. It is used in device drivers, low-level embedded systems etc.
Assembly language usually consists of three sections,
Data section
To initialize variables and constants, buffer size these values doesn't change at runtime.
bss section
To declare variables
text section
_start specifies the starting of this section where the actually code is written.
There are various define directives to allocate space for variables for both initialized and uninitialized data.
variable-name    define-directive    initial-value 
| Define Directive | Description | Allocated Space | 
|---|---|---|
| DB | Define Byte | 1 byte | 
| DW | Define Word | 2 bytes | 
| DD | Define Doubleword | 4 bytes | 
| DQ | Define Quadword | 8 bytes | 
| DT | Define Ten Bytes | 10 bytes | 
| Define Directive | Description | 
|---|---|
| RESB | Reserve a Byte | 
| RESW | Reserve a Word | 
| RESD | Reserve a Doubleword | 
| RESQ | Reserve a Quadword | 
| REST | Reserve a Ten Bytes | 
Constants can be defined using
CONSTANT_NAME EQU regular-exp or value
%assign constant_name value
%define constant_name value
Loops are used to iterate a set of statements for a specific number of times.
mov ECX,n
L1:
;<loop body>
loop L1
where n specifies the no of times loops should iterate.
Procedure is a sub-routine which contains set of statements. Usually procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
procedure_name:
   ;procedure body
   ret