// File: amukherj[P]concurrencyts/./future.h
// Function: concurrencyts::when_any_result<std::vector<std::iterator_traits<__gnu_cxx::__normal_iterator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, std::vector<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>::value_type, std::allocator<std::iterator_traits<__gnu_cxx::__normal_iterator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, std::vector<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>::value_type>>> concurrencyts::make_when_any_result<__gnu_cxx::__normal_iterator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, std::vector<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>(unsigned long, __gnu_cxx::__normal_iterator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, std::vector<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>, __gnu_cxx::__normal_iterator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, std::vector<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<concurrencyts::future<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>)
auto make_when_any_result(size_t index, InputIt begin, InputIt end)
  -> when_any_result<std::vector<typename std::iterator_traits<InputIt>::value_type>>
{
  using ret_type = typename std::iterator_traits<InputIt>::value_type; 
  when_any_result<std::vector<ret_type>> result;

  for (auto it = begin; it != end; ++it) {
    result.futures.push_back(std::move(*it));
  }
  result.index = index;

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x115b0
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xb190
testb $0x1, %al
jne 0x11787
jmp 0x117ce
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x58(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xb1d0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0xaf50
jmp 0x117aa
jmp 0x117ac
leaq -0x30(%rbp), %rdi
callq 0xb220
jmp 0x11774
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0xb7e0
jmp 0x117f6
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, (%rax)
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x117ec
movq -0x50(%rbp), %rdi
callq 0xb7e0
movq -0x48(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x32d0
nop