Question

In: Computer Science

ASSEMBLY LANGUAGE x86: Reverse a string using the Run-time stack and a procedures You may want...

ASSEMBLY LANGUAGE x86: Reverse a string using the Run-time stack and a procedures You may want to use your project 4 as a starting point As in the last project we will get a string from the user put it into a buffer called 'source' (ReadString) Copy this string into a buffer called ‘destination’, in reverse order For this project you will use the run-time stack (push & pop) to reverse the string in ‘source’ You must still use indirect addressing (i.e. do not name source or destination in the reversal loop) Break your code up into the following procedures main askes user for string gets string from user (source) call revstr print reversed string (destination) revstr reverse what is in source into destination again, use indirect addressing in revstr (no names)

Solutions

Expert Solution

It's pretty difficult to directly write in assembly x86 so I have first written it in CPP then converted the code into x86.

This is the c++ code:

#include<bits/stdc++.h>
using namespace std;
void revstr(string s){
  stack<char> stc;
  for(int i=0;i<s.size();i++){
      stc.push(s[i]);
  }
  string destination="";
  while(!stc.empty()){
    destination+=stc.top();
    stc.pop();
  }
  cout <<destination;
}
int main()
{
  string source;
  cin>>source;
  revstr(source); 
  return 0;
}

This is the corresponding x86 assembly code:

__cxx_global_var_init:                  # @__cxx_global_var_init
        push    rbp
        mov     rbp, rsp
        movabs  rdi, offset std::__ioinit
        call    std::ios_base::Init::Init() [complete object constructor]
        movabs  rax, offset std::ios_base::Init::~Init() [complete object destructor]
        mov     rdi, rax
        movabs  rsi, offset std::__ioinit
        movabs  rdx, offset __dso_handle
        call    __cxa_atexit
        pop     rbp
        ret
revstr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): # @revstr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
.Lrevstr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)$local:
        push    rbp
        mov     rbp, rsp
        sub     rsp, 192
        lea     rax, [rbp - 80]
        mov     qword ptr [rbp - 152], rdi # 8-byte Spill
        mov     rdi, rax
        call    std::stack<char, std::deque<char, std::allocator<char> > >::stack<std::deque<char, std::allocator<char> >, void>()
        mov     dword ptr [rbp - 84], 0
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
        movsxd  rax, dword ptr [rbp - 84]
        mov     rdi, qword ptr [rbp - 152] # 8-byte Reload
        mov     qword ptr [rbp - 160], rax # 8-byte Spill
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const
        mov     rcx, qword ptr [rbp - 160] # 8-byte Reload
        cmp     rcx, rax
        jae     .LBB1_7
        movsxd  rsi, dword ptr [rbp - 84]
        mov     rdi, qword ptr [rbp - 152] # 8-byte Reload
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned long)
        mov     qword ptr [rbp - 168], rax # 8-byte Spill
        jmp     .LBB1_3
.LBB1_3:                                #   in Loop: Header=BB1_1 Depth=1
        lea     rdi, [rbp - 80]
        mov     rsi, qword ptr [rbp - 168] # 8-byte Reload
        call    std::stack<char, std::deque<char, std::allocator<char> > >::push(char const&)
        jmp     .LBB1_4
.LBB1_4:                                #   in Loop: Header=BB1_1 Depth=1
        jmp     .LBB1_5
.LBB1_5:                                #   in Loop: Header=BB1_1 Depth=1
        mov     eax, dword ptr [rbp - 84]
        add     eax, 1
        mov     dword ptr [rbp - 84], eax
        jmp     .LBB1_1
        mov     qword ptr [rbp - 96], rax
        mov     dword ptr [rbp - 100], edx
        jmp     .LBB1_19
.LBB1_7:
        lea     rax, [rbp - 144]
        mov     rdi, rax
        mov     qword ptr [rbp - 176], rax # 8-byte Spill
        call    std::allocator<char>::allocator() [complete object constructor]
        mov     esi, offset .L.str
        lea     rdi, [rbp - 136]
        mov     rdx, qword ptr [rbp - 176] # 8-byte Reload
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)
        jmp     .LBB1_8
.LBB1_8:
        lea     rdi, [rbp - 144]
        call    std::allocator<char>::~allocator() [complete object destructor]
.LBB1_9:                                # =>This Inner Loop Header: Depth=1
        lea     rdi, [rbp - 80]
        call    std::stack<char, std::deque<char, std::allocator<char> > >::empty() const
        mov     byte ptr [rbp - 177], al # 1-byte Spill
        jmp     .LBB1_10
.LBB1_10:                               #   in Loop: Header=BB1_9 Depth=1
        mov     al, byte ptr [rbp - 177] # 1-byte Reload
        xor     al, -1
        test    al, 1
        jne     .LBB1_11
        jmp     .LBB1_17
.LBB1_11:                               #   in Loop: Header=BB1_9 Depth=1
        lea     rdi, [rbp - 80]
        call    std::stack<char, std::deque<char, std::allocator<char> > >::top()
        mov     qword ptr [rbp - 192], rax # 8-byte Spill
        jmp     .LBB1_12
.LBB1_12:                               #   in Loop: Header=BB1_9 Depth=1
        mov     rax, qword ptr [rbp - 192] # 8-byte Reload
        movsx   esi, byte ptr [rax]
        lea     rdi, [rbp - 136]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(char)
        jmp     .LBB1_13
.LBB1_13:                               #   in Loop: Header=BB1_9 Depth=1
        lea     rdi, [rbp - 80]
        call    std::stack<char, std::deque<char, std::allocator<char> > >::pop()
        jmp     .LBB1_14
.LBB1_14:                               #   in Loop: Header=BB1_9 Depth=1
        jmp     .LBB1_9
        mov     qword ptr [rbp - 96], rax
        mov     dword ptr [rbp - 100], edx
        lea     rdi, [rbp - 144]
        call    std::allocator<char>::~allocator() [complete object destructor]
        jmp     .LBB1_19
        mov     qword ptr [rbp - 96], rax
        mov     dword ptr [rbp - 100], edx
        lea     rdi, [rbp - 136]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
        jmp     .LBB1_19
.LBB1_17:
        mov     edi, offset std::cout
        lea     rsi, [rbp - 136]
        call    std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
        jmp     .LBB1_18
.LBB1_18:
        lea     rdi, [rbp - 136]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
        lea     rdi, [rbp - 80]
        call    std::stack<char, std::deque<char, std::allocator<char> > >::~stack() [base object destructor]
        add     rsp, 192
        pop     rbp
        ret
.LBB1_19:
        lea     rdi, [rbp - 80]
        call    std::stack<char, std::deque<char, std::allocator<char> > >::~stack() [base object destructor]
        mov     rdi, qword ptr [rbp - 96]
        call    _Unwind_Resume
std::stack<char, std::deque<char, std::allocator<char> > >::stack<std::deque<char, std::allocator<char> >, void>(): # @std::stack<char, std::deque<char, std::allocator<char> > >::stack<std::deque<char, std::allocator<char> >, void>()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rdi, qword ptr [rbp - 8]
        call    std::deque<char, std::allocator<char> >::deque() [base object constructor]
        add     rsp, 16
        pop     rbp
        ret
std::stack<char, std::deque<char, std::allocator<char> > >::push(char const&): # @std::stack<char, std::deque<char, std::allocator<char> > >::push(char const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rdi, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        call    std::deque<char, std::allocator<char> >::push_back(char const&)
        add     rsp, 16
        pop     rbp
        ret
std::stack<char, std::deque<char, std::allocator<char> > >::empty() const: # @std::stack<char, std::deque<char, std::allocator<char> > >::empty() const
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rdi, qword ptr [rbp - 8]
        call    std::deque<char, std::allocator<char> >::empty() const
        and     al, 1
        movzx   eax, al
        add     rsp, 16
        pop     rbp
        ret
std::stack<char, std::deque<char, std::allocator<char> > >::top():   # @std::stack<char, std::deque<char, std::allocator<char> > >::top()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rdi, qword ptr [rbp - 8]
        call    std::deque<char, std::allocator<char> >::back()
        add     rsp, 16
        pop     rbp
        ret
std::stack<char, std::deque<char, std::allocator<char> > >::pop():   # @std::stack<char, std::deque<char, std::allocator<char> > >::pop()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rdi, qword ptr [rbp - 8]
        call    std::deque<char, std::allocator<char> >::pop_back()
        add     rsp, 16
        pop     rbp
        ret
std::stack<char, std::deque<char, std::allocator<char> > >::~stack() [base object destructor]:     # @std::stack<char, std::deque<char, std::allocator<char> > >::~stack() [base object destructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rdi, qword ptr [rbp - 8]
        call    std::deque<char, std::allocator<char> >::~deque() [base object destructor]
        add     rsp, 16
        pop     rbp
        ret
main:                                   # @main
        push    rbp
        mov     rbp, rsp
        sub     rsp, 96
        mov     dword ptr [rbp - 4], 0
        lea     rax, [rbp - 40]
        mov     rdi, rax
        mov     qword ptr [rbp - 96], rax # 8-byte Spill
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string() [complete object constructor]
        mov     edi, offset std::cin
        mov     rsi, qword ptr [rbp - 96] # 8-byte Reload
        call    std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)
        jmp     .LBB8_1
.LBB8_1:
        lea     rdi, [rbp - 88]
        lea     rsi, [rbp - 40]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
        jmp     .LBB8_2
.LBB8_2:
        lea     rdi, [rbp - 88]
        call    .Lrevstr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)$local
        jmp     .LBB8_3
.LBB8_3:
        lea     rdi, [rbp - 88]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
        mov     dword ptr [rbp - 4], 0
        lea     rdi, [rbp - 40]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
        mov     eax, dword ptr [rbp - 4]
        add     rsp, 96
        pop     rbp
        ret
        mov     qword ptr [rbp - 48], rax
        mov     dword ptr [rbp - 52], edx
        jmp     .LBB8_6
        mov     qword ptr [rbp - 48], rax
        mov     dword ptr [rbp - 52], edx
        lea     rdi, [rbp - 88]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
.LBB8_6:
        lea     rdi, [rbp - 40]
        call    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]
        mov     rdi, qword ptr [rbp - 48]
        call    _Unwind_Resume
std::deque<char, std::allocator<char> >::~deque() [base object destructor]:                # @std::deque<char, std::allocator<char> >::~deque() [base object destructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 112
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        lea     rcx, [rbp - 40]
        mov     rdi, rcx
        mov     rsi, rax
        mov     qword ptr [rbp - 96], rax # 8-byte Spill
        mov     qword ptr [rbp - 104], rcx # 8-byte Spill
        call    std::deque<char, std::allocator<char> >::begin()
        lea     rax, [rbp - 72]
        mov     rdi, rax
        mov     rsi, qword ptr [rbp - 96] # 8-byte Reload
        mov     qword ptr [rbp - 112], rax # 8-byte Spill
        call    std::deque<char, std::allocator<char> >::end()
        mov     rdi, qword ptr [rbp - 96] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator()
        mov     rdi, qword ptr [rbp - 96] # 8-byte Reload
        mov     rsi, qword ptr [rbp - 104] # 8-byte Reload
        mov     rdx, qword ptr [rbp - 112] # 8-byte Reload
        mov     rcx, rax
        call    std::deque<char, std::allocator<char> >::_M_destroy_data(std::_Deque_iterator<char, char&, char*>, std::_Deque_iterator<char, char&, char*>, std::allocator<char> const&)
        jmp     .LBB9_1
.LBB9_1:
        mov     rax, qword ptr [rbp - 96] # 8-byte Reload
        mov     rdi, rax
        call    std::_Deque_base<char, std::allocator<char> >::~_Deque_base() [base object destructor]
        add     rsp, 112
        pop     rbp
        ret
        mov     qword ptr [rbp - 80], rax
        mov     dword ptr [rbp - 84], edx
        mov     rax, qword ptr [rbp - 96] # 8-byte Reload
        mov     rdi, rax
        call    std::_Deque_base<char, std::allocator<char> >::~_Deque_base() [base object destructor]
        mov     rdi, qword ptr [rbp - 80]
        call    __clang_call_terminate
std::deque<char, std::allocator<char> >::_M_destroy_data(std::_Deque_iterator<char, char&, char*>, std::_Deque_iterator<char, char&, char*>, std::allocator<char> const&): # @std::deque<char, std::allocator<char> >::_M_destroy_data(std::_Deque_iterator<char, char&, char*>, std::_Deque_iterator<char, char&, char*>, std::allocator<char> const&)
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rcx
        pop     rbp
        ret
std::deque<char, std::allocator<char> >::begin():            # @std::deque<char, std::allocator<char> >::begin()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     rax, rdi
        mov     rcx, rdi
        mov     qword ptr [rbp - 8], rcx
        mov     qword ptr [rbp - 16], rsi
        mov     rcx, qword ptr [rbp - 16]
        add     rcx, 16
        mov     rsi, rcx
        mov     qword ptr [rbp - 24], rax # 8-byte Spill
        call    std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&)
        mov     rax, qword ptr [rbp - 24] # 8-byte Reload
        add     rsp, 32
        pop     rbp
        ret
std::deque<char, std::allocator<char> >::end():              # @std::deque<char, std::allocator<char> >::end()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     rax, rdi
        mov     rcx, rdi
        mov     qword ptr [rbp - 8], rcx
        mov     qword ptr [rbp - 16], rsi
        mov     rcx, qword ptr [rbp - 16]
        add     rcx, 48
        mov     rsi, rcx
        mov     qword ptr [rbp - 24], rax # 8-byte Spill
        call    std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&)
        mov     rax, qword ptr [rbp - 24] # 8-byte Reload
        add     rsp, 32
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator(): # @std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator()
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::~_Deque_base() [base object destructor]:         # @std::_Deque_base<char, std::allocator<char> >::~_Deque_base() [base object destructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        cmp     qword ptr [rax], 0
        mov     qword ptr [rbp - 16], rax # 8-byte Spill
        je      .LBB14_2
        mov     rax, qword ptr [rbp - 16] # 8-byte Reload
        mov     rsi, qword ptr [rax + 40]
        mov     rcx, qword ptr [rax + 72]
        add     rcx, 8
        mov     rdi, rax
        mov     rdx, rcx
        call    std::_Deque_base<char, std::allocator<char> >::_M_destroy_nodes(char**, char**)
        mov     rax, qword ptr [rbp - 16] # 8-byte Reload
        mov     rsi, qword ptr [rax]
        mov     rdx, qword ptr [rax + 8]
        mov     rdi, rax
        call    std::_Deque_base<char, std::allocator<char> >::_M_deallocate_map(char**, unsigned long)
.LBB14_2:
        mov     rdi, qword ptr [rbp - 16] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_Deque_impl::~_Deque_impl() [base object destructor]
        add     rsp, 16
        pop     rbp
        ret
__clang_call_terminate:                 # @__clang_call_terminate
        push    rax
        call    __cxa_begin_catch
        mov     qword ptr [rsp], rax    # 8-byte Spill
        call    std::terminate()
std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&):  # @std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&)
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rbp - 16]
        mov     rcx, qword ptr [rcx]
        mov     qword ptr [rax], rcx
        mov     rcx, qword ptr [rbp - 16]
        mov     rcx, qword ptr [rcx + 8]
        mov     qword ptr [rax + 8], rcx
        mov     rcx, qword ptr [rbp - 16]
        mov     rcx, qword ptr [rcx + 16]
        mov     qword ptr [rax + 16], rcx
        mov     rcx, qword ptr [rbp - 16]
        mov     rcx, qword ptr [rcx + 24]
        mov     qword ptr [rax + 24], rcx
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_destroy_nodes(char**, char**): # @std::_Deque_base<char, std::allocator<char> >::_M_destroy_nodes(char**, char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 48
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 8]
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rax
        mov     qword ptr [rbp - 40], rdi # 8-byte Spill
.LBB17_1:                               # =>This Inner Loop Header: Depth=1
        mov     rax, qword ptr [rbp - 32]
        cmp     rax, qword ptr [rbp - 24]
        jae     .LBB17_4
        mov     rax, qword ptr [rbp - 32]
        mov     rsi, qword ptr [rax]
        mov     rdi, qword ptr [rbp - 40] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_M_deallocate_node(char*)
        mov     rax, qword ptr [rbp - 32]
        add     rax, 8
        mov     qword ptr [rbp - 32], rax
        jmp     .LBB17_1
.LBB17_4:
        add     rsp, 48
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_deallocate_map(char**, unsigned long): # @std::_Deque_base<char, std::allocator<char> >::_M_deallocate_map(char**, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 64
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rsi, qword ptr [rbp - 8]
        lea     rax, [rbp - 32]
        mov     rdi, rax
        mov     qword ptr [rbp - 56], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_get_map_allocator() const
        mov     rsi, qword ptr [rbp - 16]
        mov     rdx, qword ptr [rbp - 24]
        mov     rdi, qword ptr [rbp - 56] # 8-byte Reload
        call    std::allocator_traits<std::allocator<char*> >::deallocate(std::allocator<char*>&, char**, unsigned long)
        jmp     .LBB18_1
.LBB18_1:
        lea     rdi, [rbp - 32]
        call    std::allocator<char*>::~allocator() [base object destructor]
        add     rsp, 64
        pop     rbp
        ret
        mov     qword ptr [rbp - 40], rax
        mov     dword ptr [rbp - 44], edx
        lea     rdi, [rbp - 32]
        call    std::allocator<char*>::~allocator() [base object destructor]
        mov     rdi, qword ptr [rbp - 40]
        call    __clang_call_terminate
std::_Deque_base<char, std::allocator<char> >::_Deque_impl::~_Deque_impl() [base object destructor]: # @std::_Deque_base<char, std::allocator<char> >::_Deque_impl::~_Deque_impl() [base object destructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     rdi, rax
        call    std::allocator<char>::~allocator() [base object destructor]
        add     rsp, 16
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_deallocate_node(char*): # @std::_Deque_base<char, std::allocator<char> >::_M_deallocate_node(char*)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 48
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rdi, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     eax, 1
        mov     qword ptr [rbp - 24], rdi # 8-byte Spill
        mov     rdi, rax
        mov     qword ptr [rbp - 32], rsi # 8-byte Spill
        call    std::__deque_buf_size(unsigned long)
        mov     qword ptr [rbp - 40], rax # 8-byte Spill
        jmp     .LBB20_1
.LBB20_1:
        mov     rdi, qword ptr [rbp - 24] # 8-byte Reload
        mov     rsi, qword ptr [rbp - 32] # 8-byte Reload
        mov     rdx, qword ptr [rbp - 40] # 8-byte Reload
        call    std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long)
        jmp     .LBB20_2
.LBB20_2:
        add     rsp, 48
        pop     rbp
        ret
        mov     rdi, rax
        mov     dword ptr [rbp - 44], edx # 4-byte Spill
        call    __clang_call_terminate
std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long): # @std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     rdx, qword ptr [rbp - 24]
        mov     rdi, rax
        call    __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long)
        add     rsp, 32
        pop     rbp
        ret
std::__deque_buf_size(unsigned long):                # @std::__deque_buf_size(unsigned long)
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        cmp     qword ptr [rbp - 8], 512
        jae     .LBB22_2
        mov     eax, 512
        xor     ecx, ecx
        mov     edx, ecx
        div     qword ptr [rbp - 8]
        mov     qword ptr [rbp - 16], rax # 8-byte Spill
        jmp     .LBB22_3
.LBB22_2:
        mov     eax, 1
        mov     qword ptr [rbp - 16], rax # 8-byte Spill
        jmp     .LBB22_3
.LBB22_3:
        mov     rax, qword ptr [rbp - 16] # 8-byte Reload
        pop     rbp
        ret
__gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long): # @__gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 16]
        call    operator delete(void*)
        add     rsp, 32
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_get_map_allocator() const: # @std::_Deque_base<char, std::allocator<char> >::_M_get_map_allocator() const
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     rax, rdi
        mov     rcx, rdi
        mov     qword ptr [rbp - 8], rcx
        mov     qword ptr [rbp - 16], rsi
        mov     rcx, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 24], rdi # 8-byte Spill
        mov     rdi, rcx
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator() const
        mov     rdi, qword ptr [rbp - 24] # 8-byte Reload
        mov     rsi, rax
        call    std::allocator<char*>::allocator<char>(std::allocator<char> const&)
        mov     rax, qword ptr [rbp - 32] # 8-byte Reload
        add     rsp, 32
        pop     rbp
        ret
std::allocator_traits<std::allocator<char*> >::deallocate(std::allocator<char*>&, char**, unsigned long): # @std::allocator_traits<std::allocator<char*> >::deallocate(std::allocator<char*>&, char**, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     rdx, qword ptr [rbp - 24]
        mov     rdi, rax
        call    __gnu_cxx::new_allocator<char*>::deallocate(char**, unsigned long)
        add     rsp, 32
        pop     rbp
        ret
std::allocator<char*>::~allocator() [base object destructor]:                          # @std::allocator<char*>::~allocator() [base object destructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     rdi, rax
        call    __gnu_cxx::new_allocator<char*>::~new_allocator() [base object destructor]
        add     rsp, 16
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator() const: # @std::_Deque_base<char, std::allocator<char> >::_M_get_Tp_allocator() const
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        pop     rbp
        ret
std::allocator<char*>::allocator<char>(std::allocator<char> const&):                # @std::allocator<char*>::allocator<char>(std::allocator<char> const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rdi, rax
        call    __gnu_cxx::new_allocator<char*>::new_allocator() [base object constructor]
        add     rsp, 16
        pop     rbp
        ret
__gnu_cxx::new_allocator<char*>::new_allocator() [base object constructor]:   # @__gnu_cxx::new_allocator<char*>::new_allocator() [base object constructor]
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        pop     rbp
        ret
__gnu_cxx::new_allocator<char*>::deallocate(char**, unsigned long): # @__gnu_cxx::new_allocator<char*>::deallocate(char**, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 16]
        mov     rdi, rax
        call    operator delete(void*)
        add     rsp, 32
        pop     rbp
        ret
__gnu_cxx::new_allocator<char*>::~new_allocator() [base object destructor]:   # @__gnu_cxx::new_allocator<char*>::~new_allocator() [base object destructor]
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        pop     rbp
        ret
std::deque<char, std::allocator<char> >::deque() [base object constructor]:                # @std::deque<char, std::allocator<char> >::deque() [base object constructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     rdi, rax
        call    std::_Deque_base<char, std::allocator<char> >::_Deque_base() [base object constructor]
        add     rsp, 16
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_Deque_base() [base object constructor]:         # @std::_Deque_base<char, std::allocator<char> >::_Deque_base() [base object constructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     rdi, rax
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_Deque_impl::_Deque_impl() [base object constructor]
        xor     ecx, ecx
        mov     esi, ecx
        mov     rdi, qword ptr [rbp - 32] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_M_initialize_map(unsigned long)
        jmp     .LBB33_1
.LBB33_1:
        add     rsp, 32
        pop     rbp
        ret
        mov     qword ptr [rbp - 16], rax
        mov     dword ptr [rbp - 20], edx
        mov     rdi, qword ptr [rbp - 32] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_Deque_impl::~_Deque_impl() [base object destructor]
        mov     rdi, qword ptr [rbp - 16]
        call    _Unwind_Resume
std::_Deque_base<char, std::allocator<char> >::_Deque_impl::_Deque_impl() [base object constructor]: # @std::_Deque_base<char, std::allocator<char> >::_Deque_impl::_Deque_impl() [base object constructor]
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, rax
        mov     rdi, rcx
        mov     qword ptr [rbp - 16], rax # 8-byte Spill
        call    std::allocator<char>::allocator() [base object constructor]
        mov     rax, qword ptr [rbp - 16] # 8-byte Reload
        mov     qword ptr [rax], 0
        mov     qword ptr [rax + 8], 0
        add     rax, 16
        mov     rdi, rax
        call    std::_Deque_iterator<char, char&, char*>::_Deque_iterator() [base object constructor]
        mov     rax, qword ptr [rbp - 16] # 8-byte Reload
        add     rax, 48
        mov     rdi, rax
        call    std::_Deque_iterator<char, char&, char*>::_Deque_iterator() [base object constructor]
        add     rsp, 16
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_initialize_map(unsigned long): # @std::_Deque_base<char, std::allocator<char> >::_M_initialize_map(unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 144
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rbp - 16]
        mov     edi, 1
        mov     qword ptr [rbp - 80], rax # 8-byte Spill
        mov     qword ptr [rbp - 88], rcx # 8-byte Spill
        call    std::__deque_buf_size(unsigned long)
        xor     edx, edx
        mov     rcx, qword ptr [rbp - 88] # 8-byte Reload
        mov     qword ptr [rbp - 96], rax # 8-byte Spill
        mov     rax, rcx
        mov     rsi, qword ptr [rbp - 96] # 8-byte Reload
        div     rsi
        add     rax, 1
        mov     qword ptr [rbp - 24], rax
        mov     qword ptr [rbp - 32], 8
        mov     rax, qword ptr [rbp - 24]
        add     rax, 2
        mov     qword ptr [rbp - 40], rax
        lea     rdi, [rbp - 32]
        lea     rsi, [rbp - 40]
        call    unsigned long const& std::max<unsigned long>(unsigned long const&, unsigned long const&)
        mov     rax, qword ptr [rax]
        mov     rcx, qword ptr [rbp - 80] # 8-byte Reload
        mov     qword ptr [rcx + 8], rax
        mov     rsi, qword ptr [rcx + 8]
        mov     rdi, rcx
        call    std::_Deque_base<char, std::allocator<char> >::_M_allocate_map(unsigned long)
        mov     rcx, qword ptr [rbp - 80] # 8-byte Reload
        mov     qword ptr [rcx], rax
        mov     rax, qword ptr [rcx]
        mov     rdx, qword ptr [rcx + 8]
        mov     rsi, qword ptr [rbp - 24]
        sub     rdx, rsi
        and     rdx, -2
        lea     rax, [rax + 4*rdx]
        mov     qword ptr [rbp - 48], rax
        mov     rax, qword ptr [rbp - 48]
        mov     rdx, qword ptr [rbp - 24]
        lea     rax, [rax + 8*rdx]
        mov     qword ptr [rbp - 56], rax
        mov     rsi, qword ptr [rbp - 48]
        mov     rdx, qword ptr [rbp - 56]
        mov     rdi, rcx
        call    std::_Deque_base<char, std::allocator<char> >::_M_create_nodes(char**, char**)
        jmp     .LBB35_1
.LBB35_1:
        jmp     .LBB35_6
        mov     qword ptr [rbp - 64], rax
        mov     dword ptr [rbp - 68], edx
        mov     rdi, qword ptr [rbp - 64]
        call    __cxa_begin_catch
        mov     rcx, qword ptr [rbp - 80] # 8-byte Reload
        mov     rsi, qword ptr [rcx]
        mov     rdx, qword ptr [rcx + 8]
        mov     rdi, rcx
        mov     qword ptr [rbp - 104], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_deallocate_map(char**, unsigned long)
        mov     rax, qword ptr [rbp - 80] # 8-byte Reload
        mov     qword ptr [rax], 0
        mov     qword ptr [rax + 8], 0
        call    __cxa_rethrow
        jmp     .LBB35_9
        mov     qword ptr [rbp - 64], rax
        mov     dword ptr [rbp - 68], edx
        call    __cxa_end_catch
        jmp     .LBB35_5
.LBB35_5:
        jmp     .LBB35_7
.LBB35_6:
        mov     rax, qword ptr [rbp - 80] # 8-byte Reload
        add     rax, 16
        mov     rsi, qword ptr [rbp - 48]
        mov     rdi, rax
        call    std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        mov     rax, qword ptr [rbp - 80] # 8-byte Reload
        add     rax, 48
        mov     rcx, qword ptr [rbp - 56]
        add     rcx, -8
        mov     rdi, rax
        mov     rsi, rcx
        call    std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        mov     rax, qword ptr [rbp - 80] # 8-byte Reload
        mov     rcx, qword ptr [rax + 24]
        mov     qword ptr [rax + 16], rcx
        mov     rcx, qword ptr [rax + 56]
        mov     rax, qword ptr [rbp - 16]
        mov     edi, 1
        mov     qword ptr [rbp - 112], rcx # 8-byte Spill
        mov     qword ptr [rbp - 120], rax # 8-byte Spill
        call    std::__deque_buf_size(unsigned long)
        mov     rcx, qword ptr [rbp - 120] # 8-byte Reload
        mov     qword ptr [rbp - 128], rax # 8-byte Spill
        mov     rax, rcx
        xor     edx, edx
        mov     rsi, qword ptr [rbp - 128] # 8-byte Reload
        div     rsi
        mov     rdi, qword ptr [rbp - 112] # 8-byte Reload
        add     rdi, rdx
        mov     rdx, qword ptr [rbp - 80] # 8-byte Reload
        mov     qword ptr [rdx + 48], rdi
        add     rsp, 144
        pop     rbp
        ret
.LBB35_7:
        mov     rdi, qword ptr [rbp - 64]
        call    _Unwind_Resume
        mov     rdi, rax
        mov     dword ptr [rbp - 132], edx # 4-byte Spill
        call    __clang_call_terminate
.LBB35_9:
std::_Deque_iterator<char, char&, char*>::_Deque_iterator() [base object constructor]:      # @std::_Deque_iterator<char, char&, char*>::_Deque_iterator() [base object constructor]
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     qword ptr [rax], 0
        mov     qword ptr [rax + 8], 0
        mov     qword ptr [rax + 16], 0
        mov     qword ptr [rax + 24], 0
        pop     rbp
        ret
unsigned long const& std::max<unsigned long>(unsigned long const&, unsigned long const&):                  # @unsigned long const& std::max<unsigned long>(unsigned long const&, unsigned long const&)
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 16], rdi
        mov     qword ptr [rbp - 24], rsi
        mov     rax, qword ptr [rbp - 16]
        mov     rax, qword ptr [rax]
        mov     rcx, qword ptr [rbp - 24]
        cmp     rax, qword ptr [rcx]
        jae     .LBB37_2
        mov     rax, qword ptr [rbp - 24]
        mov     qword ptr [rbp - 8], rax
        jmp     .LBB37_3
.LBB37_2:
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 8], rax
.LBB37_3:
        mov     rax, qword ptr [rbp - 8]
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_allocate_map(unsigned long): # @std::_Deque_base<char, std::allocator<char> >::_M_allocate_map(unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 64
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rsi, qword ptr [rbp - 8]
        lea     rax, [rbp - 24]
        mov     rdi, rax
        mov     qword ptr [rbp - 48], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_get_map_allocator() const
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, qword ptr [rbp - 48] # 8-byte Reload
        call    std::allocator_traits<std::allocator<char*> >::allocate(std::allocator<char*>&, unsigned long)
        mov     qword ptr [rbp - 56], rax # 8-byte Spill
        jmp     .LBB38_1
.LBB38_1:
        lea     rdi, [rbp - 24]
        call    std::allocator<char*>::~allocator() [base object destructor]
        mov     rax, qword ptr [rbp - 56] # 8-byte Reload
        add     rsp, 64
        pop     rbp
        ret
        mov     qword ptr [rbp - 32], rax
        mov     dword ptr [rbp - 36], edx
        lea     rdi, [rbp - 24]
        call    std::allocator<char*>::~allocator() [base object destructor]
        mov     rdi, qword ptr [rbp - 32]
        call    _Unwind_Resume
std::_Deque_base<char, std::allocator<char> >::_M_create_nodes(char**, char**): # @std::_Deque_base<char, std::allocator<char> >::_M_create_nodes(char**, char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 80
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rcx
        mov     qword ptr [rbp - 56], rax # 8-byte Spill
.LBB39_1:                               # =>This Inner Loop Header: Depth=1
        mov     rax, qword ptr [rbp - 32]
        cmp     rax, qword ptr [rbp - 24]
        jae     .LBB39_7
        mov     rdi, qword ptr [rbp - 56] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_M_allocate_node()
        mov     qword ptr [rbp - 64], rax # 8-byte Spill
        jmp     .LBB39_3
.LBB39_3:                               #   in Loop: Header=BB39_1 Depth=1
        mov     rax, qword ptr [rbp - 32]
        mov     rcx, qword ptr [rbp - 64] # 8-byte Reload
        mov     qword ptr [rax], rcx
        mov     rax, qword ptr [rbp - 32]
        add     rax, 8
        mov     qword ptr [rbp - 32], rax
        jmp     .LBB39_1
        mov     qword ptr [rbp - 40], rax
        mov     dword ptr [rbp - 44], edx
        mov     rdi, qword ptr [rbp - 40]
        call    __cxa_begin_catch
        mov     rsi, qword ptr [rbp - 16]
        mov     rdx, qword ptr [rbp - 32]
        mov     rdi, qword ptr [rbp - 56] # 8-byte Reload
        mov     qword ptr [rbp - 72], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_destroy_nodes(char**, char**)
        call    __cxa_rethrow
        jmp     .LBB39_13
.LBB39_7:
        jmp     .LBB39_10
        mov     qword ptr [rbp - 40], rax
        mov     dword ptr [rbp - 44], edx
        call    __cxa_end_catch
        jmp     .LBB39_9
.LBB39_9:
        jmp     .LBB39_11
.LBB39_10:
        add     rsp, 80
        pop     rbp
        ret
.LBB39_11:
        mov     rdi, qword ptr [rbp - 40]
        call    _Unwind_Resume
        mov     rdi, rax
        mov     dword ptr [rbp - 76], edx # 4-byte Spill
        call    __clang_call_terminate
.LBB39_13:
std::_Deque_iterator<char, char&, char*>::_M_set_node(char**): # @std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rbp - 16]
        mov     qword ptr [rax + 24], rcx
        mov     rcx, qword ptr [rbp - 16]
        mov     rcx, qword ptr [rcx]
        mov     qword ptr [rax + 8], rcx
        mov     rcx, qword ptr [rax + 8]
        mov     qword ptr [rbp - 24], rax # 8-byte Spill
        mov     qword ptr [rbp - 32], rcx # 8-byte Spill
        call    std::_Deque_iterator<char, char&, char*>::_S_buffer_size()
        mov     rcx, qword ptr [rbp - 32] # 8-byte Reload
        add     rcx, rax
        mov     rax, qword ptr [rbp - 24] # 8-byte Reload
        mov     qword ptr [rax + 16], rcx
        add     rsp, 32
        pop     rbp
        ret
std::allocator_traits<std::allocator<char*> >::allocate(std::allocator<char*>&, unsigned long): # @std::allocator_traits<std::allocator<char*> >::allocate(std::allocator<char*>&, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        xor     eax, eax
        mov     edx, eax
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rcx, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, rcx
        call    __gnu_cxx::new_allocator<char*>::allocate(unsigned long, void const*)
        add     rsp, 16
        pop     rbp
        ret
__gnu_cxx::new_allocator<char*>::allocate(unsigned long, void const*): # @__gnu_cxx::new_allocator<char*>::allocate(unsigned long, void const*)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 8]
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    __gnu_cxx::new_allocator<char*>::max_size() const
        mov     rcx, qword ptr [rbp - 32] # 8-byte Reload
        cmp     rcx, rax
        jbe     .LBB42_2
        call    std::__throw_bad_alloc()
.LBB42_2:
        mov     rax, qword ptr [rbp - 16]
        shl     rax, 3
        mov     rdi, rax
        call    operator new(unsigned long)
        add     rsp, 32
        pop     rbp
        ret
__gnu_cxx::new_allocator<char*>::max_size() const: # @__gnu_cxx::new_allocator<char*>::max_size() const
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        movabs  rax, 2305843009213693951
        pop     rbp
        ret
std::_Deque_base<char, std::allocator<char> >::_M_allocate_node(): # @std::_Deque_base<char, std::allocator<char> >::_M_allocate_node()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        mov     edi, 1
        mov     qword ptr [rbp - 16], rax # 8-byte Spill
        call    std::__deque_buf_size(unsigned long)
        mov     rdi, qword ptr [rbp - 16] # 8-byte Reload
        mov     rsi, rax
        call    std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long)
        add     rsp, 16
        pop     rbp
        ret
std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long): # @std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        xor     eax, eax
        mov     edx, eax
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rcx, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, rcx
        call    __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*)
        add     rsp, 16
        pop     rbp
        ret
__gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*): # @__gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 8]
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    __gnu_cxx::new_allocator<char>::max_size() const
        mov     rcx, qword ptr [rbp - 32] # 8-byte Reload
        cmp     rcx, rax
        jbe     .LBB46_2
        call    std::__throw_bad_alloc()
.LBB46_2:
        mov     rax, qword ptr [rbp - 16]
        shl     rax, 0
        mov     rdi, rax
        call    operator new(unsigned long)
        add     rsp, 32
        pop     rbp
        ret
__gnu_cxx::new_allocator<char>::max_size() const: # @__gnu_cxx::new_allocator<char>::max_size() const
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     rax, -1
        pop     rbp
        ret
std::_Deque_iterator<char, char&, char*>::_S_buffer_size(): # @std::_Deque_iterator<char, char&, char*>::_S_buffer_size()
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     edi, 1
        call    std::__deque_buf_size(unsigned long)
        mov     qword ptr [rbp - 8], rax # 8-byte Spill
        jmp     .LBB48_1
.LBB48_1:
        mov     rax, qword ptr [rbp - 8] # 8-byte Reload
        add     rsp, 16
        pop     rbp
        ret
        mov     rdi, rax
        mov     dword ptr [rbp - 12], edx # 4-byte Spill
        call    __clang_call_terminate
std::deque<char, std::allocator<char> >::push_back(char const&):      # @std::deque<char, std::allocator<char> >::push_back(char const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rax + 48]
        mov     rdx, qword ptr [rax + 64]
        add     rdx, -1
        cmp     rcx, rdx
        mov     qword ptr [rbp - 24], rax # 8-byte Spill
        je      .LBB49_2
        mov     rax, qword ptr [rbp - 24] # 8-byte Reload
        mov     rcx, qword ptr [rbp - 24] # 8-byte Reload
        mov     rsi, qword ptr [rcx + 48]
        mov     rdx, qword ptr [rbp - 16]
        mov     rdi, rax
        call    void std::allocator_traits<std::allocator<char> >::construct<char, char const&>(std::allocator<char>&, char*, char const&)
        mov     rax, qword ptr [rbp - 24] # 8-byte Reload
        mov     rcx, qword ptr [rax + 48]
        add     rcx, 1
        mov     qword ptr [rax + 48], rcx
        jmp     .LBB49_3
.LBB49_2:
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, qword ptr [rbp - 24] # 8-byte Reload
        call    void std::deque<char, std::allocator<char> >::_M_push_back_aux<char const&>(char const&)
.LBB49_3:
        add     rsp, 32
        pop     rbp
        ret
void std::allocator_traits<std::allocator<char> >::construct<char, char const&>(std::allocator<char>&, char*, char const&): # @void std::allocator_traits<std::allocator<char> >::construct<char, char const&>(std::allocator<char>&, char*, char const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 48
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 8]
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, qword ptr [rbp - 24]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        mov     qword ptr [rbp - 40], rsi # 8-byte Spill
        call    char const& std::forward<char const&>(std::remove_reference<char const&>::type&)
        mov     rdi, qword ptr [rbp - 32] # 8-byte Reload
        mov     rsi, qword ptr [rbp - 40] # 8-byte Reload
        mov     rdx, rax
        call    void __gnu_cxx::new_allocator<char>::construct<char, char const&>(char*, char const&)
        add     rsp, 48
        pop     rbp
        ret
void std::deque<char, std::allocator<char> >::_M_push_back_aux<char const&>(char const&): # @void std::deque<char, std::allocator<char> >::_M_push_back_aux<char const&>(char const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 64
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     esi, 1
        mov     rdi, rax
        mov     qword ptr [rbp - 40], rax # 8-byte Spill
        call    std::deque<char, std::allocator<char> >::_M_reserve_map_at_back(unsigned long)
        mov     rdi, qword ptr [rbp - 40] # 8-byte Reload
        call    std::_Deque_base<char, std::allocator<char> >::_M_allocate_node()
        mov     rcx, qword ptr [rbp - 40] # 8-byte Reload
        mov     rdx, qword ptr [rcx + 72]
        mov     qword ptr [rdx + 8], rax
        mov     rsi, qword ptr [rcx + 48]
        mov     rdi, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 48], rsi # 8-byte Spill
        call    char const& std::forward<char const&>(std::remove_reference<char const&>::type&)
        mov     rdi, qword ptr [rbp - 40] # 8-byte Reload
        mov     rsi, qword ptr [rbp - 48] # 8-byte Reload
        mov     rdx, rax
        call    void std::allocator_traits<std::allocator<char> >::construct<char, char const&>(std::allocator<char>&, char*, char const&)
        jmp     .LBB51_1
.LBB51_1:
        mov     rax, qword ptr [rbp - 40] # 8-byte Reload
        add     rax, 48
        mov     rcx, qword ptr [rbp - 40] # 8-byte Reload
        mov     rdx, qword ptr [rcx + 72]
        add     rdx, 8
        mov     rdi, rax
        mov     rsi, rdx
        call    std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        mov     rax, qword ptr [rbp - 40] # 8-byte Reload
        mov     rcx, qword ptr [rax + 56]
        mov     qword ptr [rax + 48], rcx
        jmp     .LBB51_6
        mov     qword ptr [rbp - 24], rax
        mov     dword ptr [rbp - 28], edx
        mov     rdi, qword ptr [rbp - 24]
        call    __cxa_begin_catch
        mov     rcx, qword ptr [rbp - 40] # 8-byte Reload
        mov     rdx, qword ptr [rcx + 72]
        mov     rsi, qword ptr [rdx + 8]
        mov     rdi, rcx
        mov     qword ptr [rbp - 56], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_deallocate_node(char*)
        call    __cxa_rethrow
        jmp     .LBB51_9
        mov     qword ptr [rbp - 24], rax
        mov     dword ptr [rbp - 28], edx
        call    __cxa_end_catch
        jmp     .LBB51_5
.LBB51_5:
        jmp     .LBB51_7
.LBB51_6:
        add     rsp, 64
        pop     rbp
        ret
.LBB51_7:
        mov     rdi, qword ptr [rbp - 24]
        call    _Unwind_Resume
        mov     rdi, rax
        mov     dword ptr [rbp - 60], edx # 4-byte Spill
        call    __clang_call_terminate
.LBB51_9:
void __gnu_cxx::new_allocator<char>::construct<char, char const&>(char*, char const&): # @void __gnu_cxx::new_allocator<char>::construct<char, char const&>(char*, char const&)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rax, qword ptr [rbp - 16]
        mov     rdi, qword ptr [rbp - 24]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    char const& std::forward<char const&>(std::remove_reference<char const&>::type&)
        mov     cl, byte ptr [rax]
        mov     rax, qword ptr [rbp - 32] # 8-byte Reload
        mov     byte ptr [rax], cl
        add     rsp, 32
        pop     rbp
        ret
char const& std::forward<char const&>(std::remove_reference<char const&>::type&): # @char const& std::forward<char const&>(std::remove_reference<char const&>::type&)
        push    rbp
        mov     rbp, rsp
        mov     qword ptr [rbp - 8], rdi
        mov     rax, qword ptr [rbp - 8]
        pop     rbp
        ret
std::deque<char, std::allocator<char> >::_M_reserve_map_at_back(unsigned long): # @std::deque<char, std::allocator<char> >::_M_reserve_map_at_back(unsigned long)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rbp - 16]
        add     rcx, 1
        mov     rdx, qword ptr [rax + 8]
        mov     rsi, qword ptr [rax + 72]
        mov     rdi, qword ptr [rax]
        sub     rsi, rdi
        sar     rsi, 3
        sub     rdx, rsi
        cmp     rcx, rdx
        mov     qword ptr [rbp - 24], rax # 8-byte Spill
        jbe     .LBB54_2
        xor     edx, edx
        mov     rsi, qword ptr [rbp - 16]
        mov     rdi, qword ptr [rbp - 24] # 8-byte Reload
        call    std::deque<char, std::allocator<char> >::_M_reallocate_map(unsigned long, bool)
.LBB54_2:
        add     rsp, 32
        pop     rbp
        ret
std::deque<char, std::allocator<char> >::_M_reallocate_map(unsigned long, bool): # @std::deque<char, std::allocator<char> >::_M_reallocate_map(unsigned long, bool)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 128
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        and     dl, 1
        mov     byte ptr [rbp - 17], dl
        mov     rax, qword ptr [rbp - 8]
        mov     rcx, qword ptr [rax + 72]
        mov     rsi, qword ptr [rax + 40]
        sub     rcx, rsi
        sar     rcx, 3
        add     rcx, 1
        mov     qword ptr [rbp - 32], rcx
        mov     rcx, qword ptr [rbp - 32]
        add     rcx, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 40], rcx
        mov     rcx, qword ptr [rax + 8]
        mov     rsi, qword ptr [rbp - 40]
        shl     rsi, 1
        cmp     rcx, rsi
        mov     qword ptr [rbp - 72], rax # 8-byte Spill
        jbe     .LBB55_8
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rcx, qword ptr [rax]
        mov     rdx, qword ptr [rax + 8]
        sub     rdx, qword ptr [rbp - 40]
        shr     rdx, 1
        shl     rdx, 3
        add     rcx, rdx
        test    byte ptr [rbp - 17], 1
        mov     qword ptr [rbp - 80], rcx # 8-byte Spill
        je      .LBB55_3
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 88], rax # 8-byte Spill
        jmp     .LBB55_4
.LBB55_3:
        xor     eax, eax
        mov     ecx, eax
        mov     qword ptr [rbp - 88], rcx # 8-byte Spill
        jmp     .LBB55_4
.LBB55_4:
        mov     rax, qword ptr [rbp - 88] # 8-byte Reload
        shl     rax, 3
        mov     rcx, qword ptr [rbp - 80] # 8-byte Reload
        add     rcx, rax
        mov     qword ptr [rbp - 48], rcx
        mov     rax, qword ptr [rbp - 48]
        mov     rcx, qword ptr [rbp - 72] # 8-byte Reload
        cmp     rax, qword ptr [rcx + 40]
        jae     .LBB55_6
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rdi, qword ptr [rax + 40]
        mov     rcx, qword ptr [rax + 72]
        add     rcx, 8
        mov     rdx, qword ptr [rbp - 48]
        mov     rsi, rcx
        call    char** std::copy<char**, char**>(char**, char**, char**)
        jmp     .LBB55_7
.LBB55_6:
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rdi, qword ptr [rax + 40]
        mov     rcx, qword ptr [rax + 72]
        add     rcx, 8
        mov     rdx, qword ptr [rbp - 48]
        mov     rsi, qword ptr [rbp - 32]
        shl     rsi, 3
        add     rdx, rsi
        mov     rsi, rcx
        call    char** std::copy_backward<char**, char**>(char**, char**, char**)
.LBB55_7:
        jmp     .LBB55_12
.LBB55_8:
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rcx, qword ptr [rax + 8]
        add     rax, 8
        mov     rdi, rax
        lea     rsi, [rbp - 16]
        mov     qword ptr [rbp - 96], rcx # 8-byte Spill
        call    unsigned long const& std::max<unsigned long>(unsigned long const&, unsigned long const&)
        mov     rcx, qword ptr [rbp - 96] # 8-byte Reload
        add     rcx, qword ptr [rax]
        add     rcx, 2
        mov     qword ptr [rbp - 56], rcx
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rsi, qword ptr [rbp - 56]
        mov     rdi, rax
        call    std::_Deque_base<char, std::allocator<char> >::_M_allocate_map(unsigned long)
        mov     qword ptr [rbp - 64], rax
        mov     rax, qword ptr [rbp - 64]
        mov     rcx, qword ptr [rbp - 56]
        sub     rcx, qword ptr [rbp - 40]
        shr     rcx, 1
        shl     rcx, 3
        add     rax, rcx
        test    byte ptr [rbp - 17], 1
        mov     qword ptr [rbp - 104], rax # 8-byte Spill
        je      .LBB55_10
        mov     rax, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 112], rax # 8-byte Spill
        jmp     .LBB55_11
.LBB55_10:
        xor     eax, eax
        mov     ecx, eax
        mov     qword ptr [rbp - 112], rcx # 8-byte Spill
        jmp     .LBB55_11
.LBB55_11:
        mov     rax, qword ptr [rbp - 112] # 8-byte Reload
        shl     rax, 3
        mov     rcx, qword ptr [rbp - 104] # 8-byte Reload
        add     rcx, rax
        mov     qword ptr [rbp - 48], rcx
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        mov     rdi, qword ptr [rax + 40]
        mov     rcx, qword ptr [rax + 72]
        add     rcx, 8
        mov     rdx, qword ptr [rbp - 48]
        mov     rsi, rcx
        call    char** std::copy<char**, char**>(char**, char**, char**)
        mov     rcx, qword ptr [rbp - 72] # 8-byte Reload
        mov     rdx, qword ptr [rbp - 72] # 8-byte Reload
        mov     rsi, qword ptr [rdx]
        mov     rdx, qword ptr [rdx + 8]
        mov     rdi, rcx
        mov     qword ptr [rbp - 120], rax # 8-byte Spill
        call    std::_Deque_base<char, std::allocator<char> >::_M_deallocate_map(char**, unsigned long)
        mov     rax, qword ptr [rbp - 64]
        mov     rcx, qword ptr [rbp - 72] # 8-byte Reload
        mov     qword ptr [rcx], rax
        mov     rax, qword ptr [rbp - 56]
        mov     qword ptr [rcx + 8], rax
.LBB55_12:
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        add     rax, 16
        mov     rsi, qword ptr [rbp - 48]
        mov     rdi, rax
        call    std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        mov     rax, qword ptr [rbp - 72] # 8-byte Reload
        add     rax, 48
        mov     rcx, qword ptr [rbp - 48]
        mov     rdx, qword ptr [rbp - 32]
        shl     rdx, 3
        add     rcx, rdx
        add     rcx, -8
        mov     rdi, rax
        mov     rsi, rcx
        call    std::_Deque_iterator<char, char&, char*>::_M_set_node(char**)
        add     rsp, 128
        pop     rbp
        ret
char** std::copy<char**, char**>(char**, char**, char**):           # @char** std::copy<char**, char**>(char**, char**, char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 8]
        call    char** std::__miter_base<char**>(char**)
        mov     rdi, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    char** std::__miter_base<char**>(char**)
        mov     rdx, qword ptr [rbp - 24]
        mov     rdi, qword ptr [rbp - 32] # 8-byte Reload
        mov     rsi, rax
        call    char** std::__copy_move_a2<false, char**, char**>(char**, char**, char**)
        add     rsp, 32
        pop     rbp
        ret
char** std::copy_backward<char**, char**>(char**, char**, char**): # @char** std::copy_backward<char**, char**>(char**, char**, char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 32
        mov     qword ptr [rbp - 8], rdi
        mov     qword ptr [rbp - 16], rsi
        mov     qword ptr [rbp - 24], rdx
        mov     rdi, qword ptr [rbp - 8]
        call    char** std::__miter_base<char**>(char**)
        mov     rdi, qword ptr [rbp - 16]
        mov     qword ptr [rbp - 32], rax # 8-byte Spill
        call    char** std::__miter_base<char**>(char**)
        mov     rdx, qword ptr [rbp - 24]
        mov     rdi, qword ptr [rbp - 32] # 8-byte Reload
        mov     rsi, rax
        call    char** std::__copy_move_backward_a2<false, char**, char**>(char**, char**, char**)
        add     rsp, 32
        pop     rbp
        ret
char** std::__copy_move_a2<false, char**, char**>(char**, char**, char**): # @char** std::__copy_move_a2<false, char**, char**>(char**, char**, char**)
        push    rbp
        mov     rbp, rsp
        sub     rsp, 48
                    

Related Solutions

Write an X86-series assembly language program that checks whether input string is palindrome or not. A...
Write an X86-series assembly language program that checks whether input string is palindrome or not. A palindrome is a word, number, phrase or any other sequence which reads the same backward as forward e.g. madam, racecar. Sample Execution: Please enter a String: redivider The string is a palindrome Another Sample Execution: Please enter a String: abracadabra The string is not a palindrome
Using x86 assembly language, create a flowchart and write an example of code that will sort...
Using x86 assembly language, create a flowchart and write an example of code that will sort 2 arrays of unsigned doubleword integers in ascending order and output the largest element in each array. Any sorting procedure can be used, but this procedure must be called twice for each array. The first time it is called, the first array should be sorted and the second time it is called, the second array must be sorted. As well as outputting which is...
Assembly Language for x86 processors You are to write a program which should first ask for...
Assembly Language for x86 processors You are to write a program which should first ask for 4 random numbers from 0-20 (user will inpute these numbers in no preset order). Input these 5 numbers in variables called num1, num2, num3, num4, and num5. When done, your program should sort these numbers (you will use lots of conditions to check order). num1 should contain smallest number while num5 should contain the biggest. display the contents of num1 through num5 on the...
Assembly Language. Write a procedure that reverses order of a 1-D array using the stack. The...
Assembly Language. Write a procedure that reverses order of a 1-D array using the stack. The array is a string array, and the address along with the number of elements are passed through the stack. Then write a complete program to test your procedure.
Develop an x86 assembly language program that properly executes an "x to the y power" function:...
Develop an x86 assembly language program that properly executes an "x to the y power" function: int power(int x, int y) Compute the integer value that is x to the y power Do not concern yourself with the possibility of overflow You may only use only a loop structure to compute the value Remember that the return value must be placed in the EAX register Make sure that any registers (not EAX) used by this function are placed back to...
Code using assembly language Create a program using the Irvine32 procedures were the user can input...
Code using assembly language Create a program using the Irvine32 procedures were the user can input a list of 32-bit unsigned integers an “x” number of times, then display these integers to the console in reverse order. Hint: Use loops and PUSH & POP instructions. Extra Challenge: Inform the user with a message what to do; also, tell them what they are seeing.
Please write in x86 Assembly language on Visual Studio Write a program to compare two strings...
Please write in x86 Assembly language on Visual Studio Write a program to compare two strings in locations str1 and str2. Initialize str1 to Computer and initialize str2 to Compater. Assume Str1 holds the correct spelling and str2 may have an incorrect spelling. Use string instructions to check if str2 is correct and if not correct the mistake in str2.
Please complete in MASM (x86 assembly language). Use the code below to get started. Use a...
Please complete in MASM (x86 assembly language). Use the code below to get started. Use a loop with indirect or indexed addressing to reverse the elements of an integer array in place. Do not copy the elements to any other array. Use the SIZEOF, TYPE, and LENGTHOF operators to make the program as flexible as possible if the array size and type should be changed in the future. .386 .model flat,stdcall .stack 4096 ExitProcess PROTO,dwExitCode:DWORD .data    ; define your...
Write an x86 assembly language program that performs equivalently to the C++ source code file shown...
Write an x86 assembly language program that performs equivalently to the C++ source code file shown below.Please note that commented out behavior must be implemented in x86 assembly language. There is no standard, portable way to perform some of these actions in C++. #include void main() { // Use registers for these in your x86 assembly language program // Only use the .data segment for string (character array) variables int eax; int esi; int ecx; int edi; // Loop the...
Develop an x86 assembly language program that properly executes an "is even" function: bool isEven(int value)...
Develop an x86 assembly language program that properly executes an "is even" function: bool isEven(int value) If the value passed in is even, return 1 If the value passed in is odd, return 0 Remember that the return value must be placed in the EAX register Make sure that any registers (not EAX) used by this function are placed back to their initial states prior to exiting Allow an end user to test this function in the following manner: Prompt...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT