.init:

08048520 <_init>:
 8048520:	53                   	push   %ebx
 8048521:	83 ec 08             	sub    $0x8,%esp
 8048524:	e8 f7 00 00 00       	call   8048620 <__x86.get_pc_thunk.bx>
 8048529:	81 c3 d7 1a 00 00    	add    $0x1ad7,%ebx
 804852f:	8b 83 fc ff ff ff    	mov    -0x4(%ebx),%eax
 8048535:	85 c0                	test   %eax,%eax
 8048537:	74 05                	je     804853e <_init+0x1e>
 8048539:	e8 42 00 00 00       	call   8048580 <__gmon_start__@plt>
 804853e:	83 c4 08             	add    $0x8,%esp
 8048541:	5b                   	pop    %ebx
 8048542:	c3                   	ret    

Disassembly of section .plt:

08048550 <_ZNSolsEi@plt-0x10>:
 8048550:	ff 35 04 a0 04 08    	pushl  0x804a004
 8048556:	ff 25 08 a0 04 08    	jmp    *0x804a008
 804855c:	00 00                	add    %al,(%eax)
	...

08048560 <_ZNSolsEi@plt>:
 8048560:	ff 25 0c a0 04 08    	jmp    *0x804a00c
 8048566:	68 00 00 00 00       	push   $0x0
 804856b:	e9 e0 ff ff ff       	jmp    8048550 <_init+0x30>

08048570 <__cxa_atexit@plt>:
 8048570:	ff 25 10 a0 04 08    	jmp    *0x804a010
 8048576:	68 08 00 00 00       	push   $0x8
 804857b:	e9 d0 ff ff ff       	jmp    8048550 <_init+0x30>

08048580 <__gmon_start__@plt>:
 8048580:	ff 25 14 a0 04 08    	jmp    *0x804a014
 8048586:	68 10 00 00 00       	push   $0x10
 804858b:	e9 c0 ff ff ff       	jmp    8048550 <_init+0x30>

08048590 <_ZNSt8ios_base4InitC1Ev@plt>:
 8048590:	ff 25 18 a0 04 08    	jmp    *0x804a018
 8048596:	68 18 00 00 00       	push   $0x18
 804859b:	e9 b0 ff ff ff       	jmp    8048550 <_init+0x30>

080485a0 <__libc_start_main@plt>:
 80485a0:	ff 25 1c a0 04 08    	jmp    *0x804a01c
 80485a6:	68 20 00 00 00       	push   $0x20
 80485ab:	e9 a0 ff ff ff       	jmp    8048550 <_init+0x30>

080485b0 <_ZNSt8ios_base4InitD1Ev@plt>:
 80485b0:	ff 25 20 a0 04 08    	jmp    *0x804a020
 80485b6:	68 28 00 00 00       	push   $0x28
 80485bb:	e9 90 ff ff ff       	jmp    8048550 <_init+0x30>

080485c0 <_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@plt>:
 80485c0:	ff 25 24 a0 04 08    	jmp    *0x804a024
 80485c6:	68 30 00 00 00       	push   $0x30
 80485cb:	e9 80 ff ff ff       	jmp    8048550 <_init+0x30>

080485d0 <_ZNSolsEPFRSoS_E@plt>:
 80485d0:	ff 25 28 a0 04 08    	jmp    *0x804a028
 80485d6:	68 38 00 00 00       	push   $0x38
 80485db:	e9 70 ff ff ff       	jmp    8048550 <_init+0x30>

080485e0 <_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@plt>:
 80485e0:	ff 25 2c a0 04 08    	jmp    *0x804a02c
 80485e6:	68 40 00 00 00       	push   $0x40
 80485eb:	e9 60 ff ff ff       	jmp    8048550 <_init+0x30>

Disassembly of section .text:

080485f0 <_start>:
 80485f0:	31 ed                	xor    %ebp,%ebp
 80485f2:	5e                   	pop    %esi
 80485f3:	89 e1                	mov    %esp,%ecx
 80485f5:	83 e4 f0             	and    $0xfffffff0,%esp
 80485f8:	50                   	push   %eax
 80485f9:	54                   	push   %esp
 80485fa:	52                   	push   %edx
 80485fb:	68 50 88 04 08       	push   $0x8048850
 8048600:	68 e0 87 04 08       	push   $0x80487e0
 8048605:	51                   	push   %ecx
 8048606:	56                   	push   %esi
 8048607:	68 65 87 04 08       	push   $0x8048765
 804860c:	e8 8f ff ff ff       	call   80485a0 <__libc_start_main@plt>
 8048611:	f4                   	hlt    
 8048612:	66 90                	xchg   %ax,%ax
 8048614:	66 90                	xchg   %ax,%ax
 8048616:	66 90                	xchg   %ax,%ax
 8048618:	66 90                	xchg   %ax,%ax
 804861a:	66 90                	xchg   %ax,%ax
 804861c:	66 90                	xchg   %ax,%ax
 804861e:	66 90                	xchg   %ax,%ax

08048620 <__x86.get_pc_thunk.bx>:
 8048620:	8b 1c 24             	mov    (%esp),%ebx
 8048623:	c3                   	ret    
 8048624:	66 90                	xchg   %ax,%ax
 8048626:	66 90                	xchg   %ax,%ax
 8048628:	66 90                	xchg   %ax,%ax
 804862a:	66 90                	xchg   %ax,%ax
 804862c:	66 90                	xchg   %ax,%ax
 804862e:	66 90                	xchg   %ax,%ax

08048630 <deregister_tm_clones>:
 8048630:	b8 3b a0 04 08       	mov    $0x804a03b,%eax
 8048635:	2d 38 a0 04 08       	sub    $0x804a038,%eax
 804863a:	83 f8 06             	cmp    $0x6,%eax
 804863d:	77 01                	ja     8048640 <deregister_tm_clones+0x10>
 804863f:	c3                   	ret    
 8048640:	b8 00 00 00 00       	mov    $0x0,%eax
 8048645:	85 c0                	test   %eax,%eax
 8048647:	74 f6                	je     804863f <deregister_tm_clones+0xf>
 8048649:	55                   	push   %ebp
 804864a:	89 e5                	mov    %esp,%ebp
 804864c:	83 ec 18             	sub    $0x18,%esp
 804864f:	c7 04 24 38 a0 04 08 	movl   $0x804a038,(%esp)
 8048656:	ff d0                	call   *%eax
 8048658:	c9                   	leave  
 8048659:	c3                   	ret    
 804865a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

08048660 <register_tm_clones>:
 8048660:	b8 38 a0 04 08       	mov    $0x804a038,%eax
 8048665:	2d 38 a0 04 08       	sub    $0x804a038,%eax
 804866a:	c1 f8 02             	sar    $0x2,%eax
 804866d:	89 c2                	mov    %eax,%edx
 804866f:	c1 ea 1f             	shr    $0x1f,%edx
 8048672:	01 d0                	add    %edx,%eax
 8048674:	d1 f8                	sar    %eax
 8048676:	75 01                	jne    8048679 <register_tm_clones+0x19>
 8048678:	c3                   	ret    
 8048679:	ba 00 00 00 00       	mov    $0x0,%edx
 804867e:	85 d2                	test   %edx,%edx
 8048680:	74 f6                	je     8048678 <register_tm_clones+0x18>
 8048682:	55                   	push   %ebp
 8048683:	89 e5                	mov    %esp,%ebp
 8048685:	83 ec 18             	sub    $0x18,%esp
 8048688:	89 44 24 04          	mov    %eax,0x4(%esp)
 804868c:	c7 04 24 38 a0 04 08 	movl   $0x804a038,(%esp)
 8048693:	ff d2                	call   *%edx
 8048695:	c9                   	leave  
 8048696:	c3                   	ret    
 8048697:	89 f6                	mov    %esi,%esi
 8048699:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

080486a0 <__do_global_dtors_aux>:
 80486a0:	80 3d cc a0 04 08 00 	cmpb   $0x0,0x804a0cc
 80486a7:	75 13                	jne    80486bc <__do_global_dtors_aux+0x1c>
 80486a9:	55                   	push   %ebp
 80486aa:	89 e5                	mov    %esp,%ebp
 80486ac:	83 ec 08             	sub    $0x8,%esp
 80486af:	e8 7c ff ff ff       	call   8048630 <deregister_tm_clones>
 80486b4:	c6 05 cc a0 04 08 01 	movb   $0x1,0x804a0cc
 80486bb:	c9                   	leave  
 80486bc:	f3 c3                	repz ret 
 80486be:	66 90                	xchg   %ax,%ax

080486c0 <frame_dummy>:
 80486c0:	a1 08 9f 04 08       	mov    0x8049f08,%eax
 80486c5:	85 c0                	test   %eax,%eax
 80486c7:	74 1f                	je     80486e8 <frame_dummy+0x28>
 80486c9:	b8 00 00 00 00       	mov    $0x0,%eax
 80486ce:	85 c0                	test   %eax,%eax
 80486d0:	74 16                	je     80486e8 <frame_dummy+0x28>
 80486d2:	55                   	push   %ebp
 80486d3:	89 e5                	mov    %esp,%ebp
 80486d5:	83 ec 18             	sub    $0x18,%esp
 80486d8:	c7 04 24 08 9f 04 08 	movl   $0x8049f08,(%esp)
 80486df:	ff d0                	call   *%eax
 80486e1:	c9                   	leave  
 80486e2:	e9 79 ff ff ff       	jmp    8048660 <register_tm_clones>
 80486e7:	90                   	nop
 80486e8:	e9 73 ff ff ff       	jmp    8048660 <register_tm_clones>

080486ed <_Z9whatDoIDov>:
 80486ed:	55                   	push   %ebp
 80486ee:	89 e5                	mov    %esp,%ebp
 80486f0:	83 ec 38             	sub    $0x38,%esp
 80486f3:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
 80486fa:	c7 45 e4 02 00 00 00 	movl   $0x2,-0x1c(%ebp)
 8048701:	c7 45 e8 03 00 00 00 	movl   $0x3,-0x18(%ebp)
 8048708:	c7 45 ec 04 00 00 00 	movl   $0x4,-0x14(%ebp)
 804870f:	c7 45 f0 05 00 00 00 	movl   $0x5,-0x10(%ebp)
 8048716:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 8048719:	8b 55 e0             	mov    -0x20(%ebp),%edx
 804871c:	01 c2                	add    %eax,%edx
 804871e:	8b 45 e8             	mov    -0x18(%ebp),%eax
 8048721:	01 c2                	add    %eax,%edx
 8048723:	8b 45 ec             	mov    -0x14(%ebp),%eax
 8048726:	01 c2                	add    %eax,%edx
 8048728:	8b 45 f0             	mov    -0x10(%ebp),%eax
 804872b:	01 d0                	add    %edx,%eax
 804872d:	89 45 f4             	mov    %eax,-0xc(%ebp)
 8048730:	c7 44 24 04 70 88 04 	movl   $0x8048870,0x4(%esp)
 8048737:	08 
 8048738:	c7 04 24 40 a0 04 08 	movl   $0x804a040,(%esp)
 804873f:	e8 7c fe ff ff       	call   80485c0 <_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@plt>
 8048744:	8b 55 f4             	mov    -0xc(%ebp),%edx
 8048747:	89 54 24 04          	mov    %edx,0x4(%esp)
 804874b:	89 04 24             	mov    %eax,(%esp)
 804874e:	e8 0d fe ff ff       	call   8048560 <_ZNSolsEi@plt>
 8048753:	c7 44 24 04 e0 85 04 	movl   $0x80485e0,0x4(%esp)
 804875a:	08 
 804875b:	89 04 24             	mov    %eax,(%esp)
 804875e:	e8 6d fe ff ff       	call   80485d0 <_ZNSolsEPFRSoS_E@plt>
 8048763:	c9                   	leave  
 8048764:	c3                   	ret    

08048765 <main>:
 8048765:	55                   	push   %ebp
 8048766:	89 e5                	mov    %esp,%ebp
 8048768:	83 e4 f0             	and    $0xfffffff0,%esp
 804876b:	e8 7d ff ff ff       	call   80486ed <_Z9whatDoIDov>
 8048770:	b8 00 00 00 00       	mov    $0x0,%eax
 8048775:	c9                   	leave  
 8048776:	c3                   	ret    

08048777 <_Z41__static_initialization_and_destruction_0ii>:
 8048777:	55                   	push   %ebp
 8048778:	89 e5                	mov    %esp,%ebp
 804877a:	83 ec 18             	sub    $0x18,%esp
 804877d:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
 8048781:	75 31                	jne    80487b4 <_Z41__static_initialization_and_destruction_0ii+0x3d>
 8048783:	81 7d 0c ff ff 00 00 	cmpl   $0xffff,0xc(%ebp)
 804878a:	75 28                	jne    80487b4 <_Z41__static_initialization_and_destruction_0ii+0x3d>
 804878c:	c7 04 24 cd a0 04 08 	movl   $0x804a0cd,(%esp)
 8048793:	e8 f8 fd ff ff       	call   8048590 <_ZNSt8ios_base4InitC1Ev@plt>
 8048798:	c7 44 24 08 34 a0 04 	movl   $0x804a034,0x8(%esp)
 804879f:	08 
 80487a0:	c7 44 24 04 cd a0 04 	movl   $0x804a0cd,0x4(%esp)
 80487a7:	08 
 80487a8:	c7 04 24 b0 85 04 08 	movl   $0x80485b0,(%esp)
 80487af:	e8 bc fd ff ff       	call   8048570 <__cxa_atexit@plt>
 80487b4:	c9                   	leave  
 80487b5:	c3                   	ret    

080487b6 <_GLOBAL__sub_I__Z9whatDoIDov>:
 80487b6:	55                   	push   %ebp
 80487b7:	89 e5                	mov    %esp,%ebp
 80487b9:	83 ec 18             	sub    $0x18,%esp
 80487bc:	c7 44 24 04 ff ff 00 	movl   $0xffff,0x4(%esp)
 80487c3:	00 
 80487c4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 80487cb:	e8 a7 ff ff ff       	call   8048777 <_Z41__static_initialization_and_destruction_0ii>
 80487d0:	c9                   	leave  
 80487d1:	c3                   	ret    
 80487d2:	66 90                	xchg   %ax,%ax
 80487d4:	66 90                	xchg   %ax,%ax
 80487d6:	66 90                	xchg   %ax,%ax
 80487d8:	66 90                	xchg   %ax,%ax
 80487da:	66 90                	xchg   %ax,%ax
 80487dc:	66 90                	xchg   %ax,%ax
 80487de:	66 90                	xchg   %ax,%ax

080487e0 <__libc_csu_init>:
 80487e0:	55                   	push   %ebp
 80487e1:	57                   	push   %edi
 80487e2:	31 ff                	xor    %edi,%edi
 80487e4:	56                   	push   %esi
 80487e5:	53                   	push   %ebx
 80487e6:	e8 35 fe ff ff       	call   8048620 <__x86.get_pc_thunk.bx>
 80487eb:	81 c3 15 18 00 00    	add    $0x1815,%ebx
 80487f1:	83 ec 1c             	sub    $0x1c,%esp
 80487f4:	8b 6c 24 30          	mov    0x30(%esp),%ebp
 80487f8:	8d b3 04 ff ff ff    	lea    -0xfc(%ebx),%esi
 80487fe:	e8 1d fd ff ff       	call   8048520 <_init>
 8048803:	8d 83 fc fe ff ff    	lea    -0x104(%ebx),%eax
 8048809:	29 c6                	sub    %eax,%esi
 804880b:	c1 fe 02             	sar    $0x2,%esi
 804880e:	85 f6                	test   %esi,%esi
 8048810:	74 27                	je     8048839 <__libc_csu_init+0x59>
 8048812:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 8048818:	8b 44 24 38          	mov    0x38(%esp),%eax
 804881c:	89 2c 24             	mov    %ebp,(%esp)
 804881f:	89 44 24 08          	mov    %eax,0x8(%esp)
 8048823:	8b 44 24 34          	mov    0x34(%esp),%eax
 8048827:	89 44 24 04          	mov    %eax,0x4(%esp)
 804882b:	ff 94 bb fc fe ff ff 	call   *-0x104(%ebx,%edi,4)
 8048832:	83 c7 01             	add    $0x1,%edi
 8048835:	39 f7                	cmp    %esi,%edi
 8048837:	75 df                	jne    8048818 <__libc_csu_init+0x38>
 8048839:	83 c4 1c             	add    $0x1c,%esp
 804883c:	5b                   	pop    %ebx
 804883d:	5e                   	pop    %esi
 804883e:	5f                   	pop    %edi
 804883f:	5d                   	pop    %ebp
 8048840:	c3                   	ret    
 8048841:	eb 0d                	jmp    8048850 <__libc_csu_fini>
 8048843:	90                   	nop
 8048844:	90                   	nop
 8048845:	90                   	nop
 8048846:	90                   	nop
 8048847:	90                   	nop
 8048848:	90                   	nop
 8048849:	90                   	nop
 804884a:	90                   	nop
 804884b:	90                   	nop
 804884c:	90                   	nop
 804884d:	90                   	nop
 804884e:	90                   	nop
 804884f:	90                   	nop

08048850 <__libc_csu_fini>:
 8048850:	f3 c3                	repz ret 

Disassembly of section .fini:

08048854 <_fini>:
 8048854:	53                   	push   %ebx
 8048855:	83 ec 08             	sub    $0x8,%esp
 8048858:	e8 c3 fd ff ff       	call   8048620 <__x86.get_pc_thunk.bx>
 804885d:	81 c3 a3 17 00 00    	add    $0x17a3,%ebx
 8048863:	83 c4 08             	add    $0x8,%esp
 8048866:	5b                   	pop    %ebx
 8048867:	c3                   	ret     

Assembly Online Compiler

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.

About Assembly

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.

Syntax help

Assembly language usually consists of three sections,

  1. Data section

    To initialize variables and constants, buffer size these values doesn't change at runtime.

  2. bss section

    To declare variables

  3. text section

    _start specifies the starting of this section where the actually code is written.

Variables

There are various define directives to allocate space for variables for both initialized and uninitialized data.

1. To allocate storage space to Initialized data

Syntax

variable-name    define-directive    initial-value 
Define DirectiveDescriptionAllocated Space
DBDefine Byte1 byte
DWDefine Word2 bytes
DDDefine Doubleword4 bytes
DQDefine Quadword8 bytes
DTDefine Ten Bytes10 bytes

2. To allocate storage space to un-initialized data

Define DirectiveDescription
RESBReserve a Byte
RESWReserve a Word
RESDReserve a Doubleword
RESQReserve a Quadword
RESTReserve a Ten Bytes

Constants

Constants can be defined using

1. equ

  • To define numeric constants
CONSTANT_NAME EQU regular-exp or value

2. %assign

  • To define numeric constants.
%assign constant_name value

3. %define

  • To define numeric or string constants.
%define constant_name value

Loops

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.

Procedures

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