000027d1 <phase_4>:
27d1:   f3 0f 1e fb     endbr32
27d5:   57    push %edi
27d6:   56    push %esi
27d7:   53    push %ebx
27d8:   8b 7c 24 10     mov 0x10(%esp),%edi
27dc:   83 ec 0c    sub $0xc,%esp
27df:   57    push %edi
27e0:   e8 54 04 00 00    call 2c39 <string_length>
27e5:   83 c0 01    add $0x1,%eax
27e8:   89 04 24    mov %eax,(%esp)
27eb:   e8 fc ff ff ff    call 27ec <phase_4+0x1b>
27f0:   89 c6     mov %eax,%esi
27f2:   83 c4 10    add $0x10,%esp
27f5:   f6 07 df    testb $0xdf,(%edi)
27f8:   74 5b     je 2855 <phase_4+0x84>
27fa:   89 fb     mov %edi,%ebx
27fc:   83 c3 01    add $0x1,%ebx
27ff:   f6 03 df    testb $0xdf,(%ebx)
2802:   75 f8     jne 27fc <phase_4+0x2b>
2804:   39 df     cmp %ebx,%edi
2806:   74 4f     je 2857 <phase_4+0x86>
2808:   89 f2     mov %esi,%edx
280a:   89 d8     mov %ebx,%eax
280c:   83 e8 01    sub $0x1,%eax
280f:   0f b6 08    movzbl (%eax),%ecx
2812:   88 0a     mov %cl,(%edx)
2814:   83 c2 01    add $0x1,%edx
2817:   39 c7     cmp %eax,%edi
2819:   75 f1     jne 280c <phase_4+0x3b>
281b:   89 df     mov %ebx,%edi
281d:   29 c7     sub %eax,%edi
281f:   89 f8     mov %edi,%eax
2821:   01 f0     add %esi,%eax
2823:   0f b6 13    movzbl (%ebx),%edx
2826:   84 d2     test %dl,%dl
2828:   74 0f     je 2839 <phase_4+0x68>
282a:   88 10     mov %dl,(%eax)
282c:   83 c0 01    add $0x1,%eax
282f:   83 c3 01    add $0x1,%ebx
2832:   0f b6 13    movzbl (%ebx),%edx
2835:   84 d2     test %dl,%dl
2837:   75 f1     jne 282a <phase_4+0x59>
2839:   c6 00 00    movb $0x0,(%eax)
283c:   83 ec 08    sub $0x8,%esp
283f:   56    push %esi
2840:   68 18 42 00 00    push $0x4218
2845:   e8 11 04 00 00    call 2c5b <strings_not_equal>
284a:   83 c4 10    add $0x10,%esp
284d:   85 c0     test %eax,%eax
284f:   75 0d     jne 285e <phase_4+0x8d>
2851:   5b    pop %ebx
2852:   5e    pop %esi
2853:   5f    pop %edi
2854:   c3    ret
2855:   89 fb     mov %edi,%ebx
2857:   e8 a8 06 00 00    call 2f04 <explode_bomb>
285c:   eb aa     jmp 2808 <phase_4+0x37>
285e:   e8 a1 06 00 00    call 2f04 <explode_bomb>
2863:   eb ec     jmp 2851 <phase_4+0x80> 

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