std::sys_common::backtrace::__rust_begin_short_backtrace:
subq $56, %rsp
movq %rdi, 32(%rsp)
callq core::ops::function::FnOnce::call_once
movq core::hint::black_box@GOTPCREL(%rip), %rax
callq *%rax
jmp .LBB0_2
.LBB0_2:
addq $56, %rsp
retq
.LBB0_3:
jmp .LBB0_4
.LBB0_4:
movq 40(%rsp), %rdi
callq _Unwind_Resume@PLT
ud2
movq %rax, 40(%rsp)
movl %edx, 48(%rsp)
jmp .LBB0_3
std::rt::lang_start:
subq $56, %rsp
leaq .L__unnamed_1(%rip), %rax
movq %rdi, 32(%rsp)
movq %rsi, 40(%rsp)
movq %rdx, 48(%rsp)
movq %rdi, 24(%rsp)
leaq 24(%rsp), %rcx
movq %rcx, %rdi
movq %rsi, 16(%rsp)
movq %rax, %rsi
movq 16(%rsp), %rax
movq %rdx, 8(%rsp)
movq %rax, %rdx
movq 8(%rsp), %rcx
callq *std::rt::lang_start_internal@GOTPCREL(%rip)
movq %rax, (%rsp)
movq (%rsp), %rax
addq $56, %rsp
retq
std::rt::lang_start::{{closure}}:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq (%rdi), %rdi
callq std::sys_common::backtrace::__rust_begin_short_backtrace
callq <() as std::process::Termination>::report
movl %eax, 12(%rsp)
movl 12(%rsp), %eax
addq $24, %rsp
retq
std::sys::unix::process::process_common::ExitCode::as_i32:
pushq %rax
movq %rdi, (%rsp)
movzbl (%rdi), %eax
popq %rcx
retq
core::fmt::ArgumentV1::new:
subq $72, %rsp
movq %rdi, 40(%rsp)
movq %rsi, 48(%rsp)
movq %rsi, 56(%rsp)
movq 56(%rsp), %rax
movq %rdi, 16(%rsp)
movq %rax, 8(%rsp)
movq 16(%rsp), %rax
movq %rax, 64(%rsp)
movq 64(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movq %rax, 24(%rsp)
movq 8(%rsp), %rcx
movq %rcx, 32(%rsp)
movq 24(%rsp), %rax
movq 32(%rsp), %rdx
addq $72, %rsp
retq
core::fmt::Arguments::new_v1:
subq $48, %rsp
movq %rdi, %rax
movq %rsi, 16(%rsp)
movq %rdx, 24(%rsp)
movq %rcx, 32(%rsp)
movq %r8, 40(%rsp)
movq $0, (%rsp)
movq %rsi, (%rdi)
movq %rdx, 8(%rdi)
movq (%rsp), %rdx
movq 8(%rsp), %rsi
movq %rdx, 16(%rdi)
movq %rsi, 24(%rdi)
movq %rcx, 32(%rdi)
movq %r8, 40(%rdi)
addq $48, %rsp
retq
core::ops::function::FnOnce::call_once{{vtable.shim}}:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq (%rdi), %rdi
callq core::ops::function::FnOnce::call_once
movl %eax, 4(%rsp)
movl 4(%rsp), %eax
addq $24, %rsp
retq
core::ops::function::FnOnce::call_once:
subq $24, %rsp
movq %rdi, 16(%rsp)
callq *%rdi
addq $24, %rsp
retq
core::ops::function::FnOnce::call_once:
subq $40, %rsp
movq %rdi, 8(%rsp)
leaq 8(%rsp), %rdi
callq std::rt::lang_start::{{closure}}
movl %eax, 4(%rsp)
jmp .LBB8_1
.LBB8_1:
jmp .LBB8_2
.LBB8_2:
movl 4(%rsp), %eax
addq $40, %rsp
retq
.LBB8_3:
jmp .LBB8_4
.LBB8_4:
movq 24(%rsp), %rdi
callq _Unwind_Resume@PLT
ud2
movq %rax, 24(%rsp)
movl %edx, 32(%rsp)
jmp .LBB8_3
core::ptr::drop_in_place:
subq $16, %rsp
movq %rdi, 8(%rsp)
addq $16, %rsp
retq
core::ptr::drop_in_place:
subq $24, %rsp
movq %rdi, 16(%rsp)
callq *core::ptr::drop_in_place@GOTPCREL(%rip)
addq $24, %rsp
retq
rand::distributions::integer::<impl rand::distributions::Distribution<u8> for rand::distributions::Standard>::sample:
subq $72, %rsp
movq %rdi, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rsi, 32(%rsp)
movq %rsi, 48(%rsp)
movq %rsi, 56(%rsp)
movq %rsi, %rdi
callq *core::ptr::non_null::NonNull<T>::as_ref@GOTPCREL(%rip)
addq $16, %rax
movq %rax, %rdi
callq *core::cell::UnsafeCell<T>::get@GOTPCREL(%rip)
movq %rax, 40(%rsp)
movq %rax, 64(%rsp)
movq %rax, %rdi
callq <rand_core::block::BlockRng<R> as rand_core::RngCore>::next_u32
movl %eax, 12(%rsp)
movl 12(%rsp), %eax
addq $72, %rsp
retq
rand::rng::Rng::gen:
subq $24, %rsp
leaq .L__unnamed_2(%rip), %rax
movq %rdi, 16(%rsp)
movq %rdi, 8(%rsp)
movq %rax, %rdi
movq 8(%rsp), %rsi
callq rand::distributions::integer::<impl rand::distributions::Distribution<u8> for rand::distributions::Standard>::sample
movb %al, 7(%rsp)
movb 7(%rsp), %al
addq $24, %rsp
retq
<() as std::process::Termination>::report:
subq $24, %rsp
xorl %edi, %edi
callq <std::process::ExitCode as std::process::Termination>::report
movl %eax, 12(%rsp)
movl 12(%rsp), %eax
addq $24, %rsp
retq
<std::process::ExitCode as std::process::Termination>::report:
pushq %rax
movb %dil, 7(%rsp)
leaq 7(%rsp), %rdi
callq std::sys::unix::process::process_common::ExitCode::as_i32
movl %eax, (%rsp)
movl (%rsp), %eax
popq %rcx
retq
<rand_core::block::BlockRng<R> as rand_core::RngCore>::next_u32:
subq $104, %rsp
movq %rdi, 88(%rsp)
movq (%rdi), %rax
movq %rdi, %rcx
addq $8, %rcx
movq %rdi, 80(%rsp)
movq %rcx, %rdi
movq %rax, 72(%rsp)
callq *<rand_chacha::chacha::Array64<T> as core::convert::AsRef<[T]>>::as_ref@GOTPCREL(%rip)
movq %rax, 64(%rsp)
movq %rdx, 56(%rsp)
movq 64(%rsp), %rdi
movq 56(%rsp), %rsi
callq *core::slice::<impl [T]>::len@GOTPCREL(%rip)
movq %rax, 48(%rsp)
movq 72(%rsp), %rax
movq 48(%rsp), %rcx
cmpq %rcx, %rax
jae .LBB15_4
jmp .LBB15_6
.LBB15_4:
xorl %eax, %eax
movl %eax, %esi
movq 80(%rsp), %rdi
callq *rand_core::block::BlockRng<R>::generate_and_set@GOTPCREL(%rip)
jmp .LBB15_6
.LBB15_6:
movq 80(%rsp), %rax
addq $8, %rax
movq %rax, %rdi
callq *<rand_chacha::chacha::Array64<T> as core::convert::AsRef<[T]>>::as_ref@GOTPCREL(%rip)
movq %rax, 40(%rsp)
movq %rdx, 32(%rsp)
movq 80(%rsp), %rax
movq (%rax), %rcx
movq 32(%rsp), %rdx
cmpq %rdx, %rcx
setb %sil
testb $1, %sil
movq %rcx, 24(%rsp)
jne .LBB15_8
jmp .LBB15_10
.LBB15_8:
movq 40(%rsp), %rax
movq 24(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movl %edx, 100(%rsp)
movq 80(%rsp), %rsi
movq (%rsi), %rdi
addq $1, %rdi
setb %r8b
testb $1, %r8b
movl %edx, 20(%rsp)
movq %rdi, 8(%rsp)
jne .LBB15_11
movq 80(%rsp), %rax
movq 8(%rsp), %rcx
movq %rcx, (%rax)
movl 20(%rsp), %edx
movl %edx, %eax
addq $104, %rsp
retq
.LBB15_10:
leaq .L__unnamed_3(%rip), %rdx
movq core::panicking::panic_bounds_check@GOTPCREL(%rip), %rax
movq 24(%rsp), %rdi
movq 32(%rsp), %rsi
callq *%rax
ud2
.LBB15_11:
leaq str.0(%rip), %rdi
leaq .L__unnamed_4(%rip), %rdx
movq core::panicking::panic@GOTPCREL(%rip), %rax
movl $28, %esi
callq *%rax
ud2
playground::main:
subq $136, %rsp
callq *rand::rngs::thread::thread_rng@GOTPCREL(%rip)
movq %rax, 24(%rsp)
leaq 24(%rsp), %rdi
callq rand::rng::Rng::gen
movb %al, 23(%rsp)
jmp .LBB16_2
.LBB16_2:
movb 23(%rsp), %al
movb %al, 111(%rsp)
leaq 111(%rsp), %rcx
movq %rcx, 96(%rsp)
movq 96(%rsp), %rcx
movq %rcx, 128(%rsp)
movq core::fmt::num::imp::<impl core::fmt::Display for u8>::fmt@GOTPCREL(%rip), %rsi
movq %rcx, %rdi
callq core::fmt::ArgumentV1::new
movq %rdx, 8(%rsp)
movq %rax, (%rsp)
jmp .LBB16_3
.LBB16_3:
movq (%rsp), %rax
movq %rax, 80(%rsp)
movq 8(%rsp), %rcx
movq %rcx, 88(%rsp)
leaq .L__unnamed_5(%rip), %rsi
leaq 32(%rsp), %rdi
movl $2, %edx
leaq 80(%rsp), %rcx
movl $1, %r8d
callq core::fmt::Arguments::new_v1
jmp .LBB16_4
.LBB16_4:
movq std::io::stdio::_print@GOTPCREL(%rip), %rax
leaq 32(%rsp), %rdi
callq *%rax
jmp .LBB16_5
.LBB16_5:
leaq 24(%rsp), %rdi
callq core::ptr::drop_in_place
addq $136, %rsp
retq
.LBB16_7:
leaq 24(%rsp), %rdi
callq core::ptr::drop_in_place
movq 112(%rsp), %rdi
callq _Unwind_Resume@PLT
ud2
movq %rax, 112(%rsp)
movl %edx, 120(%rsp)
jmp .LBB16_7
main:
subq $24, %rsp
movb __rustc_debug_gdb_scripts_section__(%rip), %al
movslq %edi, %rcx
leaq playground::main(%rip), %rdi
movq %rsi, 16(%rsp)
movq %rcx, %rsi
movq 16(%rsp), %rdx
movb %al, 15(%rsp)
callq std::rt::lang_start
addq $24, %rsp
retq
.L__unnamed_1:
.quad core::ptr::drop_in_place
.quad 8
.quad 8
.quad std::rt::lang_start::{{closure}}
.quad std::rt::lang_start::{{closure}}
.quad core::ops::function::FnOnce::call_once{{vtable.shim}}
.L__unnamed_2:
.L__unnamed_6:
.ascii "/playground/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_core-0.6.2/src/block.rs"
.L__unnamed_3:
.quad .L__unnamed_6
.asciz "X\000\000\000\000\000\000\000\271\000\000\000\025\000\000"
.L__unnamed_4:
.quad .L__unnamed_6
.asciz "X\000\000\000\000\000\000\000\272\000\000\000\t\000\000"
str.0:
.ascii "attempt to add with overflow"
.L__unnamed_7:
.byte 10
.L__unnamed_5:
.quad .L__unnamed_2
.zero 8
.quad .L__unnamed_7
.asciz "\001\000\000\000\000\000\000"
__rustc_debug_gdb_scripts_section__:
.asciz "\001gdb_load_rust_pretty_printers.py"
.byte 1
.byte 17
.byte 1
.byte 37
.byte 14
.byte 19
.byte 5
.byte 3
.byte 14
.byte 16
.byte 23
.byte 27
.byte 14
.ascii "\264B"
.byte 25
.byte 17
.byte 1
.byte 85
.byte 23
.byte 0
.byte 0
.byte 2
.byte 52
.byte 0
.byte 3
.byte 14
.byte 73
.byte 19
.byte 2
.byte 24
.byte 0
.byte 0
.byte 3
.byte 19
.byte 0
.byte 29
.byte 19
.byte 3
.byte 14
.byte 11
.byte 11
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 4
.byte 57
.byte 1
.byte 3
.byte 14
.byte 0
.byte 0
.byte 5
.byte 19
.byte 1
.byte 3
.byte 14
.byte 11
.byte 11
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 6
.byte 13
.byte 0
.byte 3
.byte 14
.byte 73
.byte 19
.ascii "\210\001"
.byte 15
.byte 56
.byte 11
.byte 0
.byte 0
.byte 7
.byte 46
.byte 1
.byte 17
.byte 1
.byte 18
.byte 6
.byte 64
.byte 24
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 8
.byte 52
.byte 0
.byte 2
.byte 24
.byte 3
.byte 14
.ascii "\210\001"
.byte 15
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 9
.byte 47
.byte 0
.byte 73
.byte 19
.byte 3
.byte 14
.byte 0
.byte 0
.byte 10
.byte 5
.byte 0
.byte 2
.byte 24
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 11
.byte 46
.byte 1
.byte 17
.byte 1
.byte 18
.byte 6
.byte 64
.byte 24
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 0
.byte 0
.byte 12
.byte 11
.byte 1
.byte 17
.byte 1
.byte 18
.byte 6
.byte 0
.byte 0
.byte 13
.byte 52
.byte 0
.byte 2
.byte 24
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 14
.byte 46
.byte 1
.byte 17
.byte 1
.byte 18
.byte 6
.byte 64
.byte 24
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 5
.byte 73
.byte 19
.byte 0
.byte 0
.byte 15
.byte 5
.byte 0
.byte 2
.byte 24
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 5
.byte 73
.byte 19
.byte 0
.byte 0
.byte 16
.byte 15
.byte 0
.byte 73
.byte 19
.byte 3
.byte 14
.byte 51
.byte 6
.byte 0
.byte 0
.byte 17
.byte 21
.byte 0
.byte 0
.byte 0
.byte 18
.byte 4
.byte 1
.byte 73
.byte 19
.byte 109
.byte 25
.byte 3
.byte 14
.byte 11
.byte 11
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 19
.byte 40
.byte 0
.byte 3
.byte 14
.byte 28
.byte 15
.byte 0
.byte 0
.byte 20
.byte 51
.byte 1
.byte 21
.byte 19
.byte 0
.byte 0
.byte 21
.byte 13
.byte 0
.byte 73
.byte 19
.ascii "\210\001"
.byte 15
.byte 56
.byte 11
.byte 52
.byte 25
.byte 0
.byte 0
.byte 22
.byte 25
.byte 1
.byte 22
.byte 11
.byte 0
.byte 0
.byte 23
.byte 19
.byte 0
.byte 3
.byte 14
.byte 11
.byte 11
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 24
.byte 13
.byte 0
.byte 3
.byte 14
.byte 73
.byte 19
.ascii "\210\001"
.byte 15
.byte 56
.byte 11
.byte 52
.byte 25
.byte 0
.byte 0
.byte 25
.byte 25
.byte 1
.byte 0
.byte 0
.byte 26
.byte 5
.byte 0
.byte 2
.byte 24
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 27
.byte 19
.byte 1
.byte 3
.byte 14
.byte 11
.byte 5
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 28
.byte 36
.byte 0
.byte 3
.byte 14
.byte 62
.byte 11
.byte 11
.byte 11
.byte 0
.byte 0
.byte 29
.byte 21
.byte 1
.byte 73
.byte 19
.byte 0
.byte 0
.byte 30
.byte 5
.byte 0
.byte 73
.byte 19
.byte 0
.byte 0
.byte 31
.byte 1
.byte 1
.byte 73
.byte 19
.byte 0
.byte 0
.byte 32
.byte 33
.byte 0
.byte 73
.byte 19
.byte 34
.byte 13
.byte 55
.byte 11
.byte 0
.byte 0
.byte 33
.byte 36
.byte 0
.byte 3
.byte 14
.byte 11
.byte 11
.byte 62
.byte 11
.byte 0
.byte 0
.byte 34
.byte 46
.byte 1
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 5
.byte 73
.byte 19
.byte 32
.byte 11
.byte 0
.byte 0
.byte 35
.byte 5
.byte 0
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 5
.byte 73
.byte 19
.byte 0
.byte 0
.byte 36
.byte 46
.byte 1
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 32
.byte 11
.byte 0
.byte 0
.byte 37
.byte 5
.byte 0
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 38
.byte 11
.byte 1
.byte 0
.byte 0
.byte 39
.byte 52
.byte 0
.byte 3
.byte 14
.ascii "\210\001"
.byte 15
.byte 58
.byte 11
.byte 59
.byte 11
.byte 73
.byte 19
.byte 0
.byte 0
.byte 40
.byte 29
.byte 1
.byte 49
.byte 19
.byte 17
.byte 1
.byte 18
.byte 6
.byte 88
.byte 11
.byte 89
.byte 11
.byte 87
.byte 11
.byte 0
.byte 0
.byte 41
.byte 5
.byte 0
.byte 2
.byte 24
.byte 49
.byte 19
.byte 0
.byte 0
.byte 42
.byte 29
.byte 1
.byte 49
.byte 19
.byte 17
.byte 1
.byte 18
.byte 6
.byte 88
.byte 11
.byte 89
.byte 5
.byte 87
.byte 11
.byte 0
.byte 0
.byte 43
.byte 52
.byte 0
.byte 2
.byte 24
.byte 49
.byte 19
.byte 0
.byte 0
.byte 44
.byte 13
.byte 0
.byte 3
.byte 14
.byte 73
.byte 19
.ascii "\210\001"
.byte 15
.byte 56
.byte 5
.byte 0
.byte 0
.byte 45
.byte 11
.byte 1
.byte 85
.byte 23
.byte 0
.byte 0
.byte 46
.byte 23
.byte 1
.byte 3
.byte 14
.byte 11
.byte 11
.ascii "\210\001"
.byte 15
.byte 0
.byte 0
.byte 47
.byte 46
.byte 1
.byte 17
.byte 1
.byte 18
.byte 6
.byte 64
.byte 24
.byte 110
.byte 14
.byte 3
.byte 14
.byte 58
.byte 11
.byte 59
.byte 11
.byte 106
.byte 25
.byte 0
.byte 0
.byte 0 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