#include <vector>
#include <algorithm>

#include <cstdlib>
#include <cstdio>
#include <time.h>

#include <cassert>

#define ITERATIONS 1
#define FINDS 10000

#define M 1046527

#define LINEAR 1
#define BINARY 2

using namespace std;

int main(int argc, char ** argv){
  long total_time = 0;
  struct timespec start, stop;
  std::vector<int> vec;

  unsigned long N = 32000;
  int method = 1;

  if(argc > 1){
    N = atol(argv[1]);
    if(N <= 0){
      printf("N must be greater than 0\n");
      return 1;
    }
  }

  if(argc > 2){
    method = atoi(argv[2]);
    if(method != 1 && method != 2){
      printf("Search method parameters may be 1 (Linear) or 2 (Binary).\n");
      return 1;
    }
  }

  vec.resize(N);
  srand(100);
  unsigned long numFound = 0;

  for(int i = 0; i < ITERATIONS; i++){
    for(int c = 0; c < N; c++){
      vec[c] = rand() % M;
    }

    clock_gettime(CLOCK_REALTIME,&start);

    if(method == LINEAR){
      for(int c = 0; c < FINDS; c++){
        if(find(vec.begin(),vec.end(),rand() % M) != vec.end()){
	  ++numFound;
	}
      }
    }else{
      sort(vec.begin(),vec.end());
      for(int c = 0; c < FINDS; c++){
        if(binary_search(vec.begin(),vec.end(),rand() % M)){
	  ++numFound;
	}
      }
    }

    clock_gettime(CLOCK_REALTIME,&stop);
   
    total_time += ((stop.tv_sec-start.tv_sec)*1000000000) + (stop.tv_nsec - start.tv_nsec);
  }

  printf("%lu ns\n", total_time);

  printf("Found: %lu\n",numFound);

  return 0;
}

	.file	"tmpxft_0032564c_00000000-6_search.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3164:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3164:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text._ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0,"axG",@progbits,_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_,comdat
	.type	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0, @function
_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0:
.LFB3443:
	.cfi_startproc
	leaq	-1(%rdx), %rax
	movq	%rsi, %r9
	movl	%ecx, %r8d
	movq	%rdx, %rsi
	movl	$2, %ecx
	cqto
	idivq	%rcx
	movq	%r9, %rcx
.L3:
	cmpq	%rax, %rcx
	jge	.L11
	leaq	1(%rcx), %rdx
	addq	%rdx, %rdx
	movl	-4(%rdi,%rdx,4), %r11d
	leaq	-1(%rdx), %r10
	cmpl	%r11d, (%rdi,%rdx,4)
	cmovge	%rdx, %r10
	movl	(%rdi,%r10,4), %edx
	movl	%edx, (%rdi,%rcx,4)
	movq	%r10, %rcx
	jmp	.L3
.L11:
	testl	$1, %esi
	jne	.L6
	leaq	-2(%rsi), %rax
	movl	$2, %esi
	cqto
	idivq	%rsi
	cmpq	%rax, %rcx
	jne	.L6
	leaq	1(%rcx,%rcx), %rax
	movl	(%rdi,%rax,4), %edx
	movl	%edx, (%rdi,%rcx,4)
	movq	%rax, %rcx
.L6:
	leaq	-1(%rcx), %rax
	movl	$2, %esi
.L9:
	cqto
	idivq	%rsi
	leaq	(%rdi,%rcx,4), %rdx
	cmpq	%rcx, %r9
	jge	.L7
	movl	(%rdi,%rax,4), %ecx
	cmpl	%ecx, %r8d
	jle	.L7
	movl	%ecx, (%rdx)
	leaq	-1(%rax), %rdx
	movq	%rax, %rcx
	movq	%rdx, %rax
	jmp	.L9
.L7:
	movl	%r8d, (%rdx)
	ret
	.cfi_endproc
.LFE3443:
	.size	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0, .-_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0
	.section	.text._ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0,"axG",@progbits,_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_,comdat
	.type	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0, @function
_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0:
.LFB3445:
	.cfi_startproc
	cmpq	%rsi, %rdi
	jne	.L24
	ret
.L24:
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$4, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	4(%rdi), %rbx
.L14:
	cmpq	%rbx, %r12
	je	.L28
	movl	(%rbx), %r13d
	movl	0(%rbp), %eax
	cmpl	%eax, %r13d
	jge	.L22
	movq	%rbx, %rdx
	subq	%rbp, %rdx
	cmpq	$4, %rdx
	jle	.L16
	movq	%r14, %rdi
	movq	%rbp, %rsi
	subq	%rdx, %rdi
	addq	%rbx, %rdi
	call	memmove@PLT
	jmp	.L17
.L16:
	jne	.L17
	movl	%eax, (%rbx)
.L17:
	movl	%r13d, 0(%rbp)
	jmp	.L18
.L22:
	movq	%rbx, %rax
.L15:
	movl	-4(%rax), %edx
	cmpl	%edx, %r13d
	jge	.L29
	movl	%edx, (%rax)
	subq	$4, %rax
	jmp	.L15
.L29:
	movl	%r13d, (%rax)
.L18:
	addq	$4, %rbx
	jmp	.L14
.L28:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3445:
	.size	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0, .-_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0
	.section	.text._ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0,"axG",@progbits,_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_,comdat
	.type	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0, @function
_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0:
.LFB3447:
	.cfi_startproc
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	4(%rdi), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdi, %rbx
.L31:
	movq	%rbp, %rax
	subq	%rbx, %rax
	cmpq	$64, %rax
	jle	.L30
	movq	%rax, %r13
	sarq	$2, %r13
	testq	%r14, %r14
	jne	.L32
	leaq	-2(%r13), %r12
	sarq	%r12
.L34:
	movl	(%rbx,%r12,4), %ecx
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0
	testq	%r12, %r12
	je	.L35
	decq	%r12
	jmp	.L34
.L35:
	movq	%rbp, %rax
	subq	$4, %rbp
	subq	%rbx, %rax
	cmpq	$4, %rax
	jle	.L30
	movl	(%rbx), %eax
	movl	0(%rbp), %ecx
	movq	%rbp, %rdx
	xorl	%esi, %esi
	subq	%rbx, %rdx
	movq	%rbx, %rdi
	movl	%eax, 0(%rbp)
	sarq	$2, %rdx
	call	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.isra.0
	jmp	.L35
.L32:
	sarq	$3, %rax
	movl	4(%rbx), %edi
	movl	-4(%rbp), %ecx
	movq	%r12, %rdx
	leaq	(%rbx,%rax,4), %r8
	movl	(%rbx), %eax
	movl	(%r8), %esi
	cmpl	%esi, %edi
	jge	.L38
	cmpl	%esi, %ecx
	jg	.L44
	cmpl	%edi, %ecx
	jle	.L41
	jmp	.L52
.L38:
	cmpl	%edi, %ecx
	jle	.L43
.L41:
	movl	%edi, (%rbx)
	movl	%eax, 4(%rbx)
.L40:
	movq	%rbp, %rax
	jmp	.L42
.L43:
	cmpl	%esi, %ecx
	jle	.L44
.L52:
	movl	%ecx, (%rbx)
	movl	%eax, -4(%rbp)
	jmp	.L40
.L44:
	movl	%esi, (%rbx)
	movl	%eax, (%r8)
	jmp	.L40
.L47:
	movl	%esi, 0(%r13)
	movl	%ecx, (%rdx)
	leaq	4(%r13), %rdx
.L42:
	movl	(%rbx), %edi
.L45:
	movq	%rdx, %r13
	movl	(%rdx), %ecx
	leaq	4(%rdx), %rdx
	cmpl	%edi, %ecx
	jl	.L45
	subq	$4, %rax
.L46:
	movq	%rax, %rdx
	movl	(%rax), %esi
	subq	$4, %rax
	cmpl	%esi, %edi
	jl	.L46
	movq	%rdx, %rax
	cmpq	%rdx, %r13
	jb	.L47
	decq	%r14
	movq	%rbp, %rsi
	movq	%r13, %rdi
	movq	%r13, %rbp
	movq	%r14, %rdx
	call	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0
	jmp	.L31
.L30:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3447:
	.size	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0, .-_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3187:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3187:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB3245:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L55
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L55:
	ret
	.cfi_endproc
.LFE3245:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.text._ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_,"axG",@progbits,_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_,comdat
	.weak	_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_
	.type	_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_, @function
_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_:
.LFB3253:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	je	.L68
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	%rdi, %rbx
	movq	%rbx, %rax
	sarq	$2, %rax
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	bsrq	%rax, %rdx
	movq	%rdi, 8(%rsp)
	xorq	$63, %rdx
	testq	%rax, %rax
	movl	$64, %eax
	cmovne	%edx, %eax
	movl	$63, %edx
	subl	%eax, %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	call	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_.isra.0
	cmpq	$64, %rbx
	movq	8(%rsp), %rdi
	jle	.L60
	leaq	64(%rdi), %rbx
	movq	%rbx, %rsi
	call	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0
	movq	%rbx, %rax
.L61:
	cmpq	%rbp, %rax
	je	.L71
	movl	(%rax), %ecx
	movq	%rax, %rdx
.L62:
	movl	-4(%rdx), %esi
	cmpl	%esi, %ecx
	jge	.L72
	movl	%esi, (%rdx)
	subq	$4, %rdx
	jmp	.L62
.L72:
	movl	%ecx, (%rdx)
	addq	$4, %rax
	jmp	.L61
.L60:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%rbp, %rsi
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.isra.0
.L71:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L68:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE3253:
	.size	_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_, .-_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_
	.section	.text._ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_,"axG",@progbits,_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_,comdat
	.weak	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_
	.type	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_, @function
_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_:
.LFB3394:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	je	.L73
	xorl	%r8d, %r8d
	leaq	4(%rdi), %rax
	movl	%r8d, (%rdi)
	decq	%rsi
	je	.L73
	leaq	(%rax,%rsi,4), %rdx
	movq	%rax, %rcx
.L75:
	cmpq	%rcx, %rdx
	je	.L82
	xorl	%esi, %esi
	addq	$4, %rcx
	movl	%esi, -4(%rcx)
	jmp	.L75
.L82:
	subq	%rdi, %rdx
	leaq	-4(%rax,%rdx), %rax
.L73:
	ret
	.cfi_endproc
.LFE3394:
	.size	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_, .-_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"N must be greater than 0\n"
.LC1:
	.string	"Search method parameters may be 1 (Linear) or 2 (Binary).\n"
.LC2:
	.string	"vector::_M_default_append"
.LC3:
	.string	"%lu ns\n"
.LC4:
	.string	"Found: %lu\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3150:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3150
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 32(%rsp)
	movq	%rax, 40(%rsp)
	movq	%rax, 48(%rsp)
	cmpl	$1, %edi
	jle	.L111
	movl	%edi, %r12d
	movq	8(%rsi), %rdi
	movq	%rsi, %rbp
	call	atol@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.L130
	cmpl	$2, %r12d
	je	.L112
	movq	16(%rbp), %rdi
	call	atoi@PLT
	movl	%eax, %r15d
	leal	-1(%rax), %eax
	cmpl	$1, %eax
	jbe	.L87
	leaq	.LC1(%rip), %rsi
.L130:
	movl	$2, %edi
	xorl	%eax, %eax
.LEHB0:
	call	__printf_chk@PLT
	movl	$1, %ebx
	jmp	.L107
.L112:
	movl	$1, %r15d
.L87:
	movabsq	$2305843009213693951, %rax
	cmpq	%rbx, %rax
	jnb	.L84
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L127
	leaq	.LC2(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L111:
	movl	$32000, %ebx
	movl	$1, %r15d
.L84:
	leaq	0(,%rbx,4), %r13
	movq	%r13, %rdi
	call	_Znwm@PLT
	movq	%rax, %rbp
	movq	%rbx, %rsi
	movq	%rax, %rdi
	xorl	%r14d, %r14d
	call	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIPimEET_S3_T0_
	leaq	0(%rbp,%r13), %r12
	movl	$100, %edi
	movq	%rbp, 32(%rsp)
	movq	%r12, 40(%rsp)
	movq	%r12, 48(%rsp)
	call	srand@PLT
.L89:
	call	rand@PLT
	movl	$1046527, %ecx
	cltd
	idivl	%ecx
	movl	%edx, 0(%rbp,%r14,4)
	incq	%r14
	cmpq	%rbx, %r14
	jne	.L89
	xorl	%edi, %edi
	movq	%rsp, %rsi
	movq	%r13, %r14
	call	clock_gettime@PLT
	sarq	$2, %r14
	decl	%r15d
	jne	.L90
	sarq	$4, %r13
	movl	$10000, %r15d
	xorl	%ebx, %ebx
	movl	$1046527, %r14d
.L101:
	call	rand@PLT
	movq	%rbp, %rsi
	movq	%r13, %rcx
	cltd
	idivl	%r14d
.L91:
	movq	%rsi, %rax
	testq	%rcx, %rcx
	je	.L132
	cmpl	(%rsi), %edx
	je	.L92
	cmpl	4(%rax), %edx
	jne	.L93
	addq	$4, %rax
	jmp	.L92
.L93:
	cmpl	8(%rax), %edx
	jne	.L94
	addq	$8, %rax
	jmp	.L92
.L94:
	leaq	16(%rax), %rsi
	cmpl	12(%rax), %edx
	jne	.L95
	addq	$12, %rax
	jmp	.L92
.L95:
	decq	%rcx
	jmp	.L91
.L132:
	movq	%r12, %rcx
	subq	%rsi, %rcx
	cmpq	$8, %rcx
	je	.L97
	cmpq	$12, %rcx
	je	.L98
	cmpq	$4, %rcx
	je	.L99
	jmp	.L100
.L98:
	cmpl	(%rsi), %edx
	je	.L92
	addq	$4, %rax
.L97:
	cmpl	(%rax), %edx
	je	.L92
	addq	$4, %rax
.L99:
	cmpl	(%rax), %edx
	jne	.L100
.L92:
	cmpq	%r12, %rax
	je	.L100
	incq	%rbx
.L100:
	decl	%r15d
	jne	.L101
	jmp	.L102
.L90:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movl	$10000, %r15d
	xorl	%ebx, %ebx
	call	_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_
	movl	$1046527, %r13d
.L106:
	call	rand@PLT
	movq	%rbp, %rcx
	cltd
	idivl	%r13d
	movq	%r14, %rax
.L104:
	movq	%rax, %rsi
	sarq	%rsi
	leaq	(%rcx,%rsi,4), %rdi
	cmpl	(%rdi), %edx
	jle	.L113
	subq	%rsi, %rax
	leaq	4(%rdi), %rcx
	decq	%rax
	jmp	.L103
.L113:
	movq	%rsi, %rax
.L103:
	testq	%rax, %rax
	jg	.L104
	cmpq	%rcx, %r12
	je	.L105
	cmpl	(%rcx), %edx
	jl	.L105
	incq	%rbx
.L105:
	decl	%r15d
	jne	.L106
.L102:
	leaq	16(%rsp), %rsi
	xorl	%edi, %edi
	call	clock_gettime@PLT
	movq	16(%rsp), %rdx
	subq	(%rsp), %rdx
	movl	$2, %edi
	imulq	$1000000000, %rdx, %rdx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	addq	24(%rsp), %rdx
	subq	8(%rsp), %rdx
	call	__printf_chk@PLT
	movq	%rbx, %rdx
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.LEHE0:
	xorl	%ebx, %ebx
.L107:
	leaq	32(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L110
	jmp	.L127
.L115:
	endbr64
	movq	%rax, %rbx
.L108:
	leaq	32(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L127
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L127:
	call	__stack_chk_fail@PLT
.L110:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3150:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3150:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3150-.LLSDACSB3150
.LLSDACSB3150:
	.uleb128 .LEHB0-.LFB3150
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L115-.LFB3150
	.uleb128 0
	.uleb128 .LEHB1-.LFB3150
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE3150:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <vector>
#include <algorithm>

#include <cstdlib>
#include <cstdio>
#include <time.h>

#include <cassert>

#define ITERATIONS 1
#define FINDS 10000

#define M 1046527

#define LINEAR 1
#define BINARY 2

using namespace std;

int main(int argc, char ** argv){
  long total_time = 0;
  struct timespec start, stop;
  std::vector<int> vec;

  unsigned long N = 32000;
  int method = 1;

  if(argc > 1){
    N = atol(argv[1]);
    if(N <= 0){
      printf("N must be greater than 0\n");
      return 1;
    }
  }

  if(argc > 2){
    method = atoi(argv[2]);
    if(method != 1 && method != 2){
      printf("Search method parameters may be 1 (Linear) or 2 (Binary).\n");
      return 1;
    }
  }

  vec.resize(N);
  srand(100);
  unsigned long numFound = 0;

  for(int i = 0; i < ITERATIONS; i++){
    for(int c = 0; c < N; c++){
      vec[c] = rand() % M;
    }

    clock_gettime(CLOCK_REALTIME,&start);

    if(method == LINEAR){
      for(int c = 0; c < FINDS; c++){
        if(find(vec.begin(),vec.end(),rand() % M) != vec.end()){
	  ++numFound;
	}
      }
    }else{
      sort(vec.begin(),vec.end());
      for(int c = 0; c < FINDS; c++){
        if(binary_search(vec.begin(),vec.end(),rand() % M)){
	  ++numFound;
	}
      }
    }

    clock_gettime(CLOCK_REALTIME,&stop);
   
    total_time += ((stop.tv_sec-start.tv_sec)*1000000000) + (stop.tv_nsec - start.tv_nsec);
  }

  printf("%lu ns\n", total_time);

  printf("Found: %lu\n",numFound);

  return 0;
}

	.text
	.file	"search.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorps	%xmm0, %xmm0
	movaps	%xmm0, (%rsp)
	movq	$0, 16(%rsp)
	movl	$1, %ebx
	movl	$32000, %r14d                   # imm = 0x7D00
	cmpl	$2, %edi
	jl	.LBB0_7
# %bb.1:
	movq	%rsi, %r15
	movl	%edi, %ebp
	movq	8(%rsi), %rdi
	callq	atol
	testq	%rax, %rax
	je	.LBB0_2
# %bb.4:
	movq	%rax, %r14
	cmpl	$2, %ebp
	je	.LBB0_7
# %bb.5:
	movq	16(%r15), %rdi
	callq	atoi
	movl	%eax, %ebx
	addl	$-3, %eax
	cmpl	$-3, %eax
	ja	.LBB0_7
# %bb.6:
	movl	$.Lstr, %edi
	jmp	.LBB0_3
.LBB0_7:                                # %.thread
.Ltmp0:
	movq	%rsp, %rdi
	movq	%r14, %rsi
	callq	_ZNSt6vectorIiSaIiEE6resizeEm
.Ltmp1:
# %bb.8:                                # %.preheader61
	movl	$100, %edi
	callq	srand
	xorl	%r15d, %r15d
.LBB0_9:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$-2143279079, %rax, %rcx        # imm = 0x80402819
	shrq	$32, %rcx
	addl	%eax, %ecx
	movl	%ecx, %edx
	shrl	$31, %edx
	sarl	$19, %ecx
	addl	%edx, %ecx
	imull	$1046527, %ecx, %ecx            # imm = 0xFF7FF
	subl	%ecx, %eax
	movq	(%rsp), %rcx
	movl	%eax, (%rcx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_9
# %bb.10:
	leaq	32(%rsp), %rsi
	xorl	%edi, %edi
	callq	clock_gettime
	cmpl	$1, %ebx
	jne	.LBB0_15
# %bb.11:                               # %.preheader.preheader
	movl	$10000, %ebp                    # imm = 0x2710
	movq	8(%rsp), %r15
	xorl	%ebx, %ebx
	leaq	28(%rsp), %r14
.LBB0_12:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rsp), %r12
	callq	rand
	cltq
	imulq	$-2143279079, %rax, %rcx        # imm = 0x80402819
	shrq	$32, %rcx
	addl	%eax, %ecx
	movl	%ecx, %edx
	shrl	$31, %edx
	sarl	$19, %ecx
	addl	%edx, %ecx
	imull	$1046527, %ecx, %ecx            # imm = 0xFF7FF
	subl	%ecx, %eax
	movl	%eax, 28(%rsp)
.Ltmp8:
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag
.Ltmp9:
# %bb.13:                               # %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
                                        #   in Loop: Header=BB0_12 Depth=1
	movq	8(%rsp), %r15
	xorl	%ecx, %ecx
	cmpq	%r15, %rax
	setne	%cl
	addq	%rcx, %rbx
	decl	%ebp
	jne	.LBB0_12
	jmp	.LBB0_22
.LBB0_15:
	movq	(%rsp), %rbx
	movq	8(%rsp), %r14
	cmpq	%r14, %rbx
	je	.LBB0_16
# %bb.25:
	movq	%r14, %rax
	subq	%rbx, %rax
	sarq	$2, %rax
	je	.LBB0_26
# %bb.27:                               # %cond.false
	bsrq	%rax, %rax
	xorq	$63, %rax
	jmp	.LBB0_28
.LBB0_2:
	movl	$.Lstr.1, %edi
.LBB0_3:                                # %_ZNSt6vectorIiSaIiEED2Ev.exit
	callq	puts@PLT
	movl	$1, %ebp
	jmp	.LBB0_24
.LBB0_26:
	movl	$64, %eax
.LBB0_28:                               # %cond.end
	addq	%rax, %rax
	movl	$126, %edx
	subq	%rax, %rdx
.Ltmp3:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_
.Ltmp4:
# %bb.29:                               # %.noexc
.Ltmp5:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
.Ltmp6:
.LBB0_16:                               # %_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_.exit.preheader
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
.LBB0_17:                               # %_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_.exit
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_18 Depth 2
	movq	(%rsp), %r15
	movq	8(%rsp), %r12
	callq	rand
	cltq
	imulq	$-2143279079, %rax, %rcx        # imm = 0x80402819
	shrq	$32, %rcx
	addl	%eax, %ecx
	movl	%ecx, %edx
	shrl	$31, %edx
	sarl	$19, %ecx
	addl	%edx, %ecx
	imull	$1046527, %ecx, %ecx            # imm = 0xFF7FF
	subl	%ecx, %eax
	movq	%r12, %rcx
	subq	%r15, %rcx
	sarq	$2, %rcx
	testq	%rcx, %rcx
	jle	.LBB0_19
.LBB0_18:                               # %_ZSt7advanceIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElEvRT_T0_.exit.i.i
                                        #   Parent Loop BB0_17 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%rcx, %rdx
	shrq	%rdx
	movq	%rdx, %rsi
	notq	%rsi
	addq	%rcx, %rsi
	leaq	(%r15,%rdx,4), %rcx
	addq	$4, %rcx
	cmpl	%eax, -4(%rcx)
	cmovlq	%rcx, %r15
	cmovgeq	%rdx, %rsi
	movq	%rsi, %rcx
	testq	%rsi, %rsi
	jg	.LBB0_18
.LBB0_19:                               # %_ZSt13__lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiNS0_5__ops14_Iter_less_valEET_S9_S9_RKT0_T1_.exit.i
                                        #   in Loop: Header=BB0_17 Depth=1
	cmpq	%r12, %r15
	je	.LBB0_21
# %bb.20:                               # %_ZSt13binary_searchIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiEbT_S7_RKT0_.exit
                                        #   in Loop: Header=BB0_17 Depth=1
	xorl	%ecx, %ecx
	cmpl	(%r15), %eax
	setge	%cl
	andl	$1, %ecx
	addq	%rcx, %rbx
.LBB0_21:                               # %_ZSt13binary_searchIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiEbT_S7_RKT0_.exit.thread
                                        #   in Loop: Header=BB0_17 Depth=1
	incl	%r14d
	cmpl	$10000, %r14d                   # imm = 0x2710
	jne	.LBB0_17
.LBB0_22:                               # %.loopexit
	xorl	%ebp, %ebp
	leaq	48(%rsp), %r14
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %rax
	movq	8(%r14), %rsi
	subq	32(%rsp), %rax
	imulq	$1000000000, %rax, %rax         # imm = 0x3B9ACA00
	subq	40(%rsp), %rsi
	addq	%rax, %rsi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB0_24
# %bb.23:
	callq	_ZdlPv
.LBB0_24:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	movl	%ebp, %eax
	addq	$64, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_30:
	.cfi_def_cfa_offset 112
.Ltmp7:
	jmp	.LBB0_32
.LBB0_31:
.Ltmp2:
	jmp	.LBB0_32
.LBB0_14:
.Ltmp10:
.LBB0_32:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB0_34
# %bb.33:
	callq	_ZdlPv
.LBB0_34:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit52
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table0:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp9-.Ltmp8                  #   Call between .Ltmp8 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp6-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Lfunc_end0-.Ltmp6             #   Call between .Ltmp6 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIiSaIiEE6resizeEm,"axG",@progbits,_ZNSt6vectorIiSaIiEE6resizeEm,comdat
	.weak	_ZNSt6vectorIiSaIiEE6resizeEm   # -- Begin function _ZNSt6vectorIiSaIiEE6resizeEm
	.p2align	1, 0x90
	.type	_ZNSt6vectorIiSaIiEE6resizeEm,@function
_ZNSt6vectorIiSaIiEE6resizeEm:          # @_ZNSt6vectorIiSaIiEE6resizeEm
	.cfi_startproc
# %bb.0:
	movq	(%rdi), %rdx
	movq	8(%rdi), %rcx
	movq	%rcx, %r8
	subq	%rdx, %r8
	sarq	$2, %r8
	movq	%rsi, %rax
	subq	%r8, %rax
	jbe	.LBB1_1
# %bb.5:
	movq	%rax, %rsi
	jmp	_ZNSt6vectorIiSaIiEE17_M_default_appendEm # TAILCALL
.LBB1_1:
	jae	.LBB1_4
# %bb.2:
	leaq	(%rdx,%rsi,4), %rax
	cmpq	%rax, %rcx
	je	.LBB1_4
# %bb.3:
	movq	%rax, 8(%rdi)
.LBB1_4:                                # %_ZNSt6vectorIiSaIiEE15_M_erase_at_endEPi.exit
	retq
.Lfunc_end1:
	.size	_ZNSt6vectorIiSaIiEE6resizeEm, .Lfunc_end1-_ZNSt6vectorIiSaIiEE6resizeEm
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorIiSaIiEE17_M_default_appendEm,"axG",@progbits,_ZNSt6vectorIiSaIiEE17_M_default_appendEm,comdat
	.weak	_ZNSt6vectorIiSaIiEE17_M_default_appendEm # -- Begin function _ZNSt6vectorIiSaIiEE17_M_default_appendEm
	.p2align	1, 0x90
	.type	_ZNSt6vectorIiSaIiEE17_M_default_appendEm,@function
_ZNSt6vectorIiSaIiEE17_M_default_appendEm: # @_ZNSt6vectorIiSaIiEE17_M_default_appendEm
	.cfi_startproc
# %bb.0:
	testq	%rsi, %rsi
	je	.LBB2_16
# %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %r15
	movq	16(%rdi), %rax
	subq	%r15, %rax
	sarq	$2, %rax
	cmpq	%rsi, %rax
	jae	.LBB2_2
# %bb.5:
	movq	(%rbx), %r12
	subq	%r12, %r15
	movq	%r15, %r13
	sarq	$2, %r13
	movl	$.L.str.4, %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	testq	%rax, %rax
	movq	%rax, (%rsp)                    # 8-byte Spill
	je	.LBB2_6
# %bb.7:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIiE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB2_8
.LBB2_2:
	movl	$0, (%r15)
	leaq	4(%r15), %rdi
	cmpq	$1, %r14
	je	.LBB2_4
# %bb.3:                                # %_ZSt6fill_nIPimiET_S1_T0_RKT1_.exit.loopexit.i.i.i
	leaq	-4(,%r14,4), %rdx
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	(%r15,%r14,4), %rdi
.LBB2_4:                                # %_ZSt27__uninitialized_default_n_aIPimiET_S1_T0_RSaIT1_E.exit
	movq	%rdi, 8(%rbx)
	jmp	.LBB2_15
.LBB2_6:
	xorl	%ebp, %ebp
.LBB2_8:
	leaq	(,%r13,4), %r13
	addq	%rbp, %r13
	movl	$0, (%r13)
	cmpq	$1, %r14
	je	.LBB2_10
# %bb.9:                                # %_ZSt6fill_nIPimiET_S1_T0_RKT1_.exit.loopexit.i.i.i30
	leaq	4(%r13), %rdi
	leaq	-4(,%r14,4), %rdx
	xorl	%esi, %esi
	callq	memset@PLT
.LBB2_10:                               # %_ZSt27__uninitialized_default_n_aIPimiET_S1_T0_RSaIT1_E.exit32
	testq	%r15, %r15
	jle	.LBB2_12
# %bb.11:
	movq	%rbp, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB2_12:                               # %_ZNSt6vectorIiSaIiEE11_S_relocateEPiS2_S2_RS0_.exit
	testq	%r12, %r12
	je	.LBB2_14
# %bb.13:
	movq	%r12, %rdi
	callq	_ZdlPv
.LBB2_14:                               # %_ZNSt12_Vector_baseIiSaIiEE13_M_deallocateEPim.exit35
	movq	%rbp, (%rbx)
	leaq	(,%r14,4), %rax
	addq	%r13, %rax
	movq	%rax, 8(%rbx)
	movq	(%rsp), %rax                    # 8-byte Reload
	leaq	(,%rax,4), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
.LBB2_15:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB2_16:
	retq
.Lfunc_end2:
	.size	_ZNSt6vectorIiSaIiEE17_M_default_appendEm, .Lfunc_end2-_ZNSt6vectorIiSaIiEE17_M_default_appendEm
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$2305843009213693951, %rcx      # imm = 0x1FFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$2, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB3_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB3_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end3:
	.size	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc, .Lfunc_end3-_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIiE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIiE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIiE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIiE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIiE8allocateEmPKv,@function
_ZNSt15__new_allocatorIiE8allocateEmPKv: # @_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB4_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB4_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB4_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB4_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end4:
	.size	_ZNSt15__new_allocatorIiE8allocateEmPKv, .Lfunc_end4-_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag,"axG",@progbits,_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag,comdat
	.weak	_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag # -- Begin function _ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag
	.type	_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag,@function
_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag: # @_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	movq	%rsi, %r9
	subq	%rdi, %r9
	movq	%r9, %rdi
	sarq	$4, %rdi
	testq	%rdi, %rdi
	jle	.LBB5_1
# %bb.2:                                # %.lr.ph
	movl	(%rdx), %r8d
	andq	$-16, %r9
	movq	%r9, %rcx
	addq	%rax, %rcx
	incq	%rdi
	addq	$8, %rax
.LBB5_3:                                # =>This Inner Loop Header: Depth=1
	cmpl	%r8d, -8(%rax)
	je	.LBB5_23
# %bb.4:                                #   in Loop: Header=BB5_3 Depth=1
	cmpl	%r8d, -4(%rax)
	je	.LBB5_21
# %bb.5:                                #   in Loop: Header=BB5_3 Depth=1
	cmpl	%r8d, (%rax)
	je	.LBB5_24
# %bb.6:                                #   in Loop: Header=BB5_3 Depth=1
	cmpl	%r8d, 4(%rax)
	je	.LBB5_22
# %bb.7:                                #   in Loop: Header=BB5_3 Depth=1
	decq	%rdi
	addq	$16, %rax
	cmpq	$1, %rdi
	jg	.LBB5_3
# %bb.8:                                # %._crit_edge.loopexit
	movq	%rsi, %r9
	subq	%rcx, %r9
	jmp	.LBB5_9
.LBB5_1:
	movq	%rax, %rcx
.LBB5_9:                                # %._crit_edge
	sarq	$2, %r9
	cmpq	$3, %r9
	je	.LBB5_15
# %bb.10:                               # %._crit_edge
	cmpq	$2, %r9
	je	.LBB5_14
# %bb.11:                               # %._crit_edge
	cmpq	$1, %r9
	jne	.LBB5_12
# %bb.13:                               # %._crit_edge._crit_edge57
	movl	(%rdx), %eax
	jmp	.LBB5_20
.LBB5_23:                               # %.loopexit.loopexit
	addq	$-8, %rax
.LBB5_24:                               # %.loopexit
	retq
.LBB5_21:                               # %.loopexit.loopexit.split.loop.exit
	addq	$-4, %rax
	retq
.LBB5_14:                               # %._crit_edge._crit_edge
	movl	(%rdx), %eax
	jmp	.LBB5_18
.LBB5_15:
	movl	(%rdx), %eax
	cmpl	%eax, (%rcx)
	je	.LBB5_16
# %bb.17:
	addq	$4, %rcx
.LBB5_18:
	cmpl	%eax, (%rcx)
	jne	.LBB5_19
.LBB5_16:
	movq	%rcx, %rax
	retq
.LBB5_22:                               # %.loopexit.loopexit.split.loop.exit64
	addq	$4, %rax
	retq
.LBB5_19:
	addq	$4, %rcx
.LBB5_20:
	cmpl	%eax, (%rcx)
	cmoveq	%rcx, %rsi
.LBB5_12:
	movq	%rsi, %rax
	retq
.Lfunc_end5:
	.size	_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag, .Lfunc_end5-_ZSt9__find_ifIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops16_Iter_equals_valIKiEEET_SB_SB_T0_St26random_access_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_,"axG",@progbits,_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_,comdat
	.weak	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_ # -- Begin function _ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_
	.type	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_,@function
_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_: # @_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	subq	%rdi, %r14
	sarq	$2, %r14
	cmpq	$17, %r14
	jl	.LBB6_12
# %bb.1:                                # %.lr.ph
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %rbx
	leaq	4(%rdi), %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	$-4, %rbp
	subq	%rdi, %rbp
.LBB6_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_5 Depth 2
                                        #       Child Loop BB6_6 Depth 3
                                        #       Child Loop BB6_8 Depth 3
	subq	$1, %r15
	jb	.LBB6_3
# %bb.4:                                #   in Loop: Header=BB6_2 Depth=1
	andq	$-2, %r14
	leaq	(%rbx,%r14,2), %rdx
	leaq	-4(%r12), %rcx
	movq	%rbx, %rdi
	movq	16(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rsi
	callq	_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_
	movq	%r14, %rax
	movq	%r12, %rcx
.LBB6_5:                                #   Parent Loop BB6_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_6 Depth 3
                                        #       Child Loop BB6_8 Depth 3
	movl	(%rbx), %edx
	leaq	(%rax,%rbp), %r14
.LBB6_6:                                #   Parent Loop BB6_2 Depth=1
                                        #     Parent Loop BB6_5 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%rax), %esi
	addq	$4, %rax
	addq	$4, %r14
	cmpl	%edx, %esi
	jl	.LBB6_6
# %bb.7:                                # %.preheader.i.i.preheader
                                        #   in Loop: Header=BB6_5 Depth=2
	leaq	-4(%rax), %r13
.LBB6_8:                                # %.preheader.i.i
                                        #   Parent Loop BB6_2 Depth=1
                                        #     Parent Loop BB6_5 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	-4(%rcx), %edi
	addq	$-4, %rcx
	cmpl	%edi, %edx
	jl	.LBB6_8
# %bb.9:                                #   in Loop: Header=BB6_5 Depth=2
	cmpq	%rcx, %r13
	jae	.LBB6_11
# %bb.10:                               #   in Loop: Header=BB6_5 Depth=2
	movl	%edi, (%r13)
	movl	%esi, (%rcx)
	jmp	.LBB6_5
.LBB6_11:                               # %_ZSt27__unguarded_partition_pivotIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEET_S9_S9_T0_.exit
                                        #   in Loop: Header=BB6_2 Depth=1
	movq	%r13, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_
	sarq	$2, %r14
	movq	%r13, %r12
	cmpq	$16, %r14
	jg	.LBB6_2
	jmp	.LBB6_12
.LBB6_3:
	leaq	15(%rsp), %rdx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	leaq	14(%rsp), %rdx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
.LBB6_12:                               # %.loopexit
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_, .Lfunc_end6-_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEElNS0_5__ops15_Iter_less_iterEEvT_S9_T0_T1_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,"axG",@progbits,_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,comdat
	.weak	_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_ # -- Begin function _ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.type	_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,@function
_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_: # @_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rsi, %rbx
	movq	%rsi, %rax
	subq	%rdi, %rax
	cmpq	$65, %rax
	jl	.LBB7_8
# %bb.1:
	leaq	64(%rdi), %r14
	movq	%r14, %rsi
	callq	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
.LBB7_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_5 Depth 2
	cmpq	%rbx, %r14
	je	.LBB7_7
# %bb.3:                                # %.lr.ph.i
                                        #   in Loop: Header=BB7_2 Depth=1
	movl	-4(%r14), %ecx
	movl	(%r14), %eax
	movq	%r14, %rdx
	cmpl	%ecx, %eax
	jge	.LBB7_6
# %bb.4:                                # %.lr.ph.i.i.preheader
                                        #   in Loop: Header=BB7_2 Depth=1
	movq	%r14, %rdx
.LBB7_5:                                # %.lr.ph.i.i
                                        #   Parent Loop BB7_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%ecx, (%rdx)
	movl	-8(%rdx), %ecx
	addq	$-4, %rdx
	cmpl	%ecx, %eax
	jl	.LBB7_5
.LBB7_6:                                # %_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops14_Val_less_iterEEvT_T0_.exit.i
                                        #   in Loop: Header=BB7_2 Depth=1
	movl	%eax, (%rdx)
	addq	$4, %r14
	jmp	.LBB7_2
.LBB7_8:
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_ # TAILCALL
.LBB7_7:                                # %_ZSt26__unguarded_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_.exit
	.cfi_def_cfa_offset 32
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_, .Lfunc_end7-_ZSt22__final_insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,"axG",@progbits,_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,comdat
	.weak	_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_ # -- Begin function _ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.type	_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,@function
_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_: # @_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %r15
	subq	%rdi, %r15
	cmpq	$5, %r15
	jl	.LBB8_3
# %bb.1:                                # %.lr.ph.preheader
	movq	%rsi, %rbx
	movq	%rdi, %r14
	addq	$-4, %rbx
.LBB8_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx), %ecx
	movl	(%r14), %eax
	movl	%eax, (%rbx)
	addq	$-4, %r15
	movq	%r15, %rdx
	sarq	$2, %rdx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_
	addq	$-4, %rbx
	cmpq	$4, %r15
	jg	.LBB8_2
.LBB8_3:                                # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_, .Lfunc_end8-_ZSt11__sort_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,"axG",@progbits,_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,comdat
	.weak	_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_ # -- Begin function _ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.type	_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_,@function
_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_: # @_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	subq	%rdi, %rbx
	sarq	$2, %rbx
	cmpq	$2, %rbx
	jl	.LBB9_3
# %bb.1:
	movq	%rdi, %r14
	leaq	-2(%rbx), %r15
	shrq	%r15
.LBB9_2:                                # =>This Inner Loop Header: Depth=1
	movl	(%r14,%r15,4), %ecx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_
	addq	$-1, %r15
	jb	.LBB9_2
.LBB9_3:                                # %.loopexit
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_, .Lfunc_end9-_ZSt11__make_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_RT0_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_,"axG",@progbits,_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_,comdat
	.weak	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_ # -- Begin function _ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_
	.type	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_,@function
_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_: # @_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_
	.cfi_startproc
# %bb.0:
	leaq	-1(%rdx), %rax
	shrq	$63, %rax
	leaq	(%rdx,%rax), %r8
	decq	%r8
	sarq	%r8
	movq	%rsi, %rax
	cmpq	%rsi, %r8
	jle	.LBB10_6
# %bb.1:                                # %.lr.ph.preheader
	movq	%rsi, %r9
.LBB10_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	leaq	(%r9,%r9), %rax
	movl	8(%rdi,%rax,4), %r10d
	cmpl	4(%rdi,%rax,4), %r10d
	jl	.LBB10_3
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB10_2 Depth=1
	leaq	2(,%r9,2), %rax
	jmp	.LBB10_5
.LBB10_3:                               #   in Loop: Header=BB10_2 Depth=1
	leaq	1(,%r9,2), %rax
.LBB10_5:                               # %.lr.ph
                                        #   in Loop: Header=BB10_2 Depth=1
	movl	(%rdi,%rax,4), %r10d
	movl	%r10d, (%rdi,%r9,4)
	movq	%rax, %r9
	cmpq	%r8, %rax
	jl	.LBB10_2
.LBB10_6:                               # %._crit_edge
	testb	$1, %dl
	jne	.LBB10_9
# %bb.7:
	addq	$-2, %rdx
	sarq	%rdx
	cmpq	%rdx, %rax
	jne	.LBB10_9
# %bb.8:
	leaq	(%rax,%rax), %rdx
	movl	4(%rdi,%rdx,4), %edx
	movl	%edx, (%rdi,%rax,4)
	leaq	1(,%rax,2), %rax
.LBB10_9:
	cmpq	%rsi, %rax
	jle	.LBB10_10
.LBB10_11:                              # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	leaq	-1(%rax), %rdx
	shrq	$63, %rdx
	addq	%rax, %rdx
	decq	%rdx
	sarq	%rdx
	movl	(%rdi,%rdx,4), %r8d
	cmpl	%ecx, %r8d
	jge	.LBB10_10
# %bb.12:                               #   in Loop: Header=BB10_11 Depth=1
	movl	%r8d, (%rdi,%rax,4)
	movq	%rdx, %rax
	cmpq	%rsi, %rdx
	jg	.LBB10_11
	jmp	.LBB10_13
.LBB10_10:
	movq	%rax, %rdx
.LBB10_13:                              # %_ZSt11__push_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops14_Iter_less_valEEvT_T0_SA_T1_RT2_.exit
	movl	%ecx, (%rdi,%rdx,4)
	retq
.Lfunc_end10:
	.size	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_, .Lfunc_end10-_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEliNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_,"axG",@progbits,_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_,comdat
	.weak	_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_ # -- Begin function _ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_
	.type	_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_,@function
_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_: # @_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_
	.cfi_startproc
# %bb.0:
	movl	(%rsi), %r8d
	movl	(%rdx), %r9d
	movl	(%rcx), %eax
	cmpl	%r9d, %r8d
	jge	.LBB11_6
# %bb.1:
	cmpl	%eax, %r9d
	jge	.LBB11_3
# %bb.2:
	movl	(%rdi), %eax
	movl	%r9d, (%rdi)
	movl	%eax, (%rdx)
	retq
.LBB11_6:
	cmpl	%eax, %r8d
	jge	.LBB11_8
# %bb.7:
	movl	(%rdi), %eax
	movl	%r8d, (%rdi)
	movl	%eax, (%rsi)
	retq
.LBB11_3:
	movl	(%rdi), %edx
	cmpl	%eax, %r8d
	jge	.LBB11_5
# %bb.4:
	movl	%eax, (%rdi)
	movl	%edx, (%rcx)
	retq
.LBB11_8:
	movl	(%rdi), %esi
	cmpl	%eax, %r9d
	jge	.LBB11_10
# %bb.9:
	movl	%eax, (%rdi)
	movl	%esi, (%rcx)
	retq
.LBB11_5:
	movl	%r8d, (%rdi)
	movl	%edx, (%rsi)
	retq
.LBB11_10:
	movl	%r9d, (%rdi)
	movl	%esi, (%rdx)
	retq
.Lfunc_end11:
	.size	_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_, .Lfunc_end11-_ZSt22__move_median_to_firstIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_S9_S9_T0_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,"axG",@progbits,_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,comdat
	.weak	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_ # -- Begin function _ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.type	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_,@function
_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_: # @_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.cfi_startproc
# %bb.0:
	cmpq	%rsi, %rdi
	je	.LBB12_14
# %bb.1:                                # %.preheader
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	4(%rdi), %rax
	cmpq	%rsi, %rax
	je	.LBB12_13
# %bb.2:                                # %.lr.ph
	movq	%r14, %r15
.LBB12_3:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB12_8 Depth 2
	movq	%r15, %rdi
	movq	%rax, %r15
	movl	4(%rdi), %ebp
	movl	(%r14), %ecx
	cmpl	%ecx, %ebp
	jge	.LBB12_6
# %bb.4:                                #   in Loop: Header=BB12_3 Depth=1
	movq	%r15, %rdx
	subq	%r14, %rdx
	movq	%rdx, %rax
	sarq	$2, %rax
	cmpq	$2, %rax
	jl	.LBB12_10
# %bb.5:                                #   in Loop: Header=BB12_3 Depth=1
	shlq	$2, %rax
	subq	%rax, %rdi
	addq	$8, %rdi
	movq	%r14, %rsi
	callq	memmove@PLT
.LBB12_12:                              # %_ZSt13move_backwardIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEES6_ET0_T_S8_S7_.exit
                                        #   in Loop: Header=BB12_3 Depth=1
	movq	%r14, %rax
	jmp	.LBB12_9
.LBB12_6:                               #   in Loop: Header=BB12_3 Depth=1
	movl	(%rdi), %ecx
	movq	%r15, %rax
	cmpl	%ecx, %ebp
	jge	.LBB12_9
# %bb.7:                                # %.lr.ph.i.preheader
                                        #   in Loop: Header=BB12_3 Depth=1
	movq	%r15, %rax
.LBB12_8:                               # %.lr.ph.i
                                        #   Parent Loop BB12_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%ecx, (%rax)
	movl	-8(%rax), %ecx
	addq	$-4, %rax
	cmpl	%ecx, %ebp
	jl	.LBB12_8
.LBB12_9:                               # %_ZSt13move_backwardIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEES6_ET0_T_S8_S7_.exit
                                        #   in Loop: Header=BB12_3 Depth=1
	movl	%ebp, (%rax)
	leaq	4(%r15), %rax
	cmpq	%rbx, %rax
	jne	.LBB12_3
	jmp	.LBB12_13
.LBB12_10:                              #   in Loop: Header=BB12_3 Depth=1
	movq	%r14, %rax
	cmpq	$4, %rdx
	jne	.LBB12_9
# %bb.11:                               #   in Loop: Header=BB12_3 Depth=1
	movl	%ecx, 4(%rdi)
	jmp	.LBB12_12
.LBB12_13:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB12_14:                              # %.loopexit
	retq
.Lfunc_end12:
	.size	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_, .Lfunc_end12-_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEENS0_5__ops15_Iter_less_iterEEvT_S9_T0_
	.cfi_endproc
                                        # -- End function
	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"%lu ns\n"
	.size	.L.str.2, 8

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Found: %lu\n"
	.size	.L.str.3, 12

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"vector::_M_default_append"
	.size	.L.str.4, 26

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Search method parameters may be 1 (Linear) or 2 (Binary)."
	.size	.Lstr, 58

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"N must be greater than 0"
	.size	.Lstr.1, 25

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _Unwind_Resume
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
