// File: alfanick[P]rest-cpp/src/rest/request.cpp
// Function: REST::Request::parse_query_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void Request::parse_query_string(std::string &query) {
  query.erase(query.find_last_not_of(" \n\r\t")+1);
  std::istringstream query_stream(query);
  std::string pair;
  while (std::getline(query_stream, pair, '&')) {
    std::string name, value;
    size_t value_position = pair.find("=");

    name = pair.substr(0, value_position);
    if (value_position != std::string::npos)
      value = pair.substr(value_position+1, pair.size() - value_position-1);

    parameters[Utils::uri_decode(name)] = Utils::uri_decode(value);
  }
}

// Assembly:
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, 0x2d0(%rsp)
movq %rsi, 0x2c8(%rsp)
movq 0x2d0(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x2c8(%rsp), %rdi
leaq 0x4948a(%rip), %rsi     # 0xe426a
movq $-0x1, %rdx
callq 0x98510
movq 0x48(%rsp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
movq $-0x1, %rdx
callq 0x8e070
movq 0x2c8(%rsp), %rsi
leaq 0x148(%rsp), %rdi
movl $0x8, %edx
callq 0x97990
leaq 0x128(%rsp), %rdi
callq 0x959e0
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rsi
movl $0x26, %edx
callq 0x98900
movq %rax, 0x38(%rsp)
jmp 0x9ae4c
movq 0x38(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x94b80
movb %al, 0x37(%rsp)
jmp 0x9ae66
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0x9ae73
jmp 0x9b08e
leaq 0xf8(%rsp), %rdi
callq 0x959e0
leaq 0xd8(%rsp), %rdi
callq 0x959e0
leaq 0x4be65(%rip), %rsi     # 0xe6cf9
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x28(%rsp)
leaq 0x128(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x995d0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rcx
leaq 0xb0(%rsp), %rdi
callq 0x93510
jmp 0x9aed8
leaq 0xf8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x94870
leaq 0xb0(%rsp), %rdi
callq 0x99830
cmpq $-0x1, 0xd0(%rsp)
je 0x9afa8
movq 0xd0(%rsp), %rax
incq %rax
movq %rax, 0x18(%rsp)
leaq 0x128(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x91060
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0xd0(%rsp), %rcx
notq %rcx
addq %rax, %rcx
leaq 0x90(%rsp), %rdi
callq 0x93510
jmp 0x9af52
leaq 0xd8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x94870
leaq 0x90(%rsp), %rdi
callq 0x99830
jmp 0x9afa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x9b0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x9b072
leaq 0x70(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x97ad0
jmp 0x9afbc
movq 0x40(%rsp), %rax
addq $0x58, %rax
movq %rax, 0x8(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x97ad0
jmp 0x9afde
movq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x98d00
movq %rax, (%rsp)
jmp 0x9aff3
movq (%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x94870
leaq 0x50(%rsp), %rdi
callq 0x99830
leaq 0x70(%rsp), %rdi
callq 0x99830
leaq 0xd8(%rsp), %rdi
callq 0x99830
leaq 0xf8(%rsp), %rdi
callq 0x99830
jmp 0x9ae2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x9b068
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x99830
leaq 0x70(%rsp), %rdi
callq 0x99830
leaq 0xd8(%rsp), %rdi
callq 0x99830
leaq 0xf8(%rsp), %rdi
callq 0x99830
jmp 0x9b0b0
leaq 0x128(%rsp), %rdi
callq 0x99830
leaq 0x148(%rsp), %rdi
callq 0x8f670
addq $0x2d8, %rsp            # imm = 0x2D8
retq
leaq 0x128(%rsp), %rdi
callq 0x99830
leaq 0x148(%rsp), %rdi
callq 0x8f670
movq 0x120(%rsp), %rdi
callq 0x981c0
nopw (%rax,%rax)