/* *
 * Copyright 1993-2012 NVIDIA Corporation.  All rights reserved.
 *
 * Please refer to the NVIDIA end user license agreement (EULA) associated
 * with this source code for terms and conditions that govern your use of
 * this software. Any use, reproduction, disclosure, or distribution of
 * this software and related documentation outside the terms of the EULA
 * is strictly prohibited.
 */
#include <stdio.h>
#include <string>
#include <cstring>
#include <iostream>
#include <fstream>
#include "trajectory_data.cuh"

#define DEBUG true

file_trajectory_data load_trajectory_data_from_file(std::string file_name)
{

	if (DEBUG)
	{
		std::cout << "Loading data from " << file_name << std::endl;
	}

	// First count the number of trajectories and number of points to allow for linear time vector construction
	std::ifstream first_input_file;
	first_input_file.open(file_name);

	// Error check input file stream
	if (!first_input_file.is_open())
	{
		std::cerr << "Input file unable to open" << std::endl;
	}

	std::string line;
	getline(first_input_file, line); // Throw away header;

	int cur_trajectory_number = -1;
	int num_trajectories = 0;
	int num_points = 0;

	// Read in each line of the file
	while (getline(first_input_file, line))
	{
		if (DEBUG)
		{
			std::cout << line << std::endl;
		}

		// For this file type, each point is a line. Trajectories described using trajectory number.
		num_points++;

		// Extract trajectory number from line.
		// Test input is of the form: trajectory_number, x, y, t

		// Parse input
		point point;
		char * cstr = new char [line.length()+1]; // Convert to line for tokenization. Not the best way to do this I know.
		std::strcpy(cstr, line.c_str());
		point.trajectory_number = std::stoi(strtok(cstr, ","));

		if (point.trajectory_number != cur_trajectory_number) {
			//We are on a new trajectory, increment trajectory count
			num_trajectories++;
			cur_trajectory_number = point.trajectory_number;
		}

		delete[] cstr;
	}

	first_input_file.close();

	/**
	 * We now have a count of the number of points and trajectories. Allocate arrays for points and trajectory indices.
	 */
	point* points = new point[num_points];
	trajectory_index* 	trajectories = new trajectory_index[num_trajectories];
	int point_index = 0;
	trajectory_index* cur_trajectory_index = trajectories;
	int cur_trajectory_length = 0;
	cur_trajectory_index->traj_start = points;
	cur_trajectory_number = 1;

	if (DEBUG)
	{
		std::cout << "File has " << num_points << " points and " << num_trajectories << " trajectories" << std::endl;
	}

	// Open file for reading and parsing
	std::ifstream input_file;
	input_file.open(file_name);

	// Error check input file stream
	if (!input_file.is_open())
	{
		std::cerr << "Input file unable to open" << std::endl;
	}

	getline(input_file, line); // Throw away header;

	// Read in each line of the file
	while (getline(input_file, line))
	{
		// Extract trajectory information from line.
		// Test input is of the form:
		// trajectory_number, x, y, t

		if (DEBUG)
		{
			std::cout << line << std::endl;
		}

		point *point = &points[point_index]; // Variable to read line information into

		// Parse each input line into point{points, trajectories, num_points, num_trajectories};
		char * cstr = new char [line.length()+1]; // Convert to line for tokenization. Not the best way to do this I know.
		std::strcpy(cstr, line.c_str());
		point->trajectory_number = std::stoi(strtok(cstr, ","));
		point->t = std::stod(strtok(NULL, ","));
		point->x = std::stod(strtok(NULL, ","));
		point->y = std::stod(strtok(NULL, ","));

		delete[] cstr;

		// Update point and trajectory index information

		if (point->trajectory_number != cur_trajectory_number)
		{
			// Update trajectory number
			cur_trajectory_index->traj_number = cur_trajectory_number;
			cur_trajectory_number = point->trajectory_number;

			// Update number of points in trajectory
			cur_trajectory_index->traj_length = cur_trajectory_length;
			cur_trajectory_length = 0;

			// Set up the next trajectory index
			cur_trajectory_index++;
			cur_trajectory_index->traj_start = point;
		}
		point_index++;
		cur_trajectory_length++;

	}

	input_file.close();

	// Add index information for last trajectory
	cur_trajectory_index->traj_number = cur_trajectory_number;
	cur_trajectory_index->traj_length = cur_trajectory_length;

	if(DEBUG)
	{
		std::cout << "Finished reading in a file with contents: " << std::endl;
		// Did the file read correctly?

		// Print all points{points, trajectories, num_points, num_trajectories};
		for (int i = 0; i < num_points; i++) {
			point point = points[i];
			std::cout << "Traj_num: " << point.trajectory_number << " x: " << point.x << " y: " << point.y << " t: " << point.t << std::endl;
		}

		// Print the trajectory indices we made
		for (int i = 0; i < num_trajectories; i++) {
			trajectory_index index = trajectories[i];
			std::cout << "TrajectoryID: "<< index.traj_number << " traj_length: " << index.traj_length << " traj_start*: " << index.traj_start << std::endl;
		}

		// Print metadata
		std::cout << "Number of points: " << num_points << std::endl;
		std::cout << "Number of trajectories: " << num_trajectories << std::endl;
	}

	file_trajectory_data data = {points, trajectories, num_points, num_trajectories};
	return data;
}

	.file	"tmpxft_0038d8ed_00000000-6_trajectory_data.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4139:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4139:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0, @function
_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0:
.LFB4858:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	orl	$8, %edx
	movq	%rdi, %rbx
	addq	$16, %rdi
	call	_ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	testq	%rax, %rax
	movq	(%rbx), %rax
	jne	.L3
	addq	-24(%rax), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L3:
	.cfi_restore_state
	addq	-24(%rax), %rbx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@PLT
	.cfi_endproc
.LFE4858:
	.size	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0, .-_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4860:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4860:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4162:
	.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
.LFE4162:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB4241:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L9
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L9:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4241:
	.size	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.text._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"axG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
	.weak	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
	.type	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_, @function
_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_:
.LFB4236:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4236
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	%r8d, 12(%rsp)
	leaq	28(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__errno_location@PLT
	movl	12(%rsp), %edx
	leaq	32(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%rax, %rbp
	movl	(%rax), %eax
	movl	%eax, 28(%rsp)
	xorl	%eax, %eax
	movl	%eax, 0(%rbp)
.LEHB0:
	call	*%r15
	movq	32(%rsp), %rdx
	cmpq	%rbx, %rdx
	jne	.L13
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	movq	%r14, %rdi
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L13:
	cmpl	$34, 0(%rbp)
	je	.L15
	movl	$2147483648, %ecx
	movl	$4294967295, %esi
	addq	%rax, %rcx
	cmpq	%rcx, %rsi
	jnb	.L16
.L15:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	movq	%r14, %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE0:
.L16:
	testq	%r12, %r12
	je	.L18
	subq	%rbx, %rdx
	movq	%rdx, (%r12)
.L18:
	movq	%r13, %rdi
	movl	%eax, 12(%rsp)
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movl	12(%rsp), %eax
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	jmp	.L26
.L22:
	endbr64
	movq	%rax, %rbx
.L19:
	movq	%r13, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L26:
	call	__stack_chk_fail@PLT
.L21:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	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
.LFE4236:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"aG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
.LLSDA4236:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4236-.LLSDACSB4236
.LLSDACSB4236:
	.uleb128 .LEHB0-.LFB4236
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L22-.LFB4236
	.uleb128 0
	.uleb128 .LEHB1-.LFB4236
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4236:
	.section	.text._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"axG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
	.size	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_, .-_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
	.section	.text._ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB4295:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L29
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L29:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4295:
	.size	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"stod"
	.text
	.type	_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0, @function
_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0:
.LFB4861:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4861
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %r13
	call	__errno_location@PLT
	leaq	32(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%rax, %rbp
	movl	(%rax), %eax
	movl	%eax, 28(%rsp)
	xorl	%eax, %eax
	movl	%eax, 0(%rbp)
	call	strtod@PLT
	movq	32(%rsp), %rax
	cmpq	%rax, %rbx
	jne	.L33
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	leaq	.LC0(%rip), %rdi
.LEHB2:
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L33:
	cmpl	$34, 0(%rbp)
	jne	.L35
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	leaq	.LC0(%rip), %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE2:
.L35:
	testq	%r12, %r12
	je	.L37
	subq	%rbx, %rax
	movq	%rax, (%r12)
.L37:
	movq	%r13, %rdi
	movsd	%xmm0, 8(%rsp)
	call	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movsd	8(%rsp), %xmm0
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	jmp	.L45
.L41:
	endbr64
	movq	%rax, %rbx
.L38:
	movq	%r13, %rdi
	call	_ZZN9__gnu_cxx6__stoaIddcJEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L45:
	call	__stack_chk_fail@PLT
.L40:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4861:
	.section	.gcc_except_table,"a",@progbits
.LLSDA4861:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4861-.LLSDACSB4861
.LLSDACSB4861:
	.uleb128 .LEHB2-.LFB4861
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L41-.LFB4861
	.uleb128 0
	.uleb128 .LEHB3-.LFB4861
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE4861:
	.text
	.size	_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0, .-_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC1:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4498:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L49
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	leaq	.LC1(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L49:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L51
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L51:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L52
.L54:
	call	__stack_chk_fail@PLT
.L52:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4498:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC2:
	.string	"Loading data from "
.LC3:
	.string	"Input file unable to open"
.LC4:
	.string	","
.LC5:
	.string	"stoi"
.LC7:
	.string	"File has "
.LC8:
	.string	" points and "
.LC9:
	.string	" trajectories"
.LC10:
	.string	"Finished reading in a file with contents: "
.LC11:
	.string	"Traj_num: "
.LC12:
	.string	" x: "
.LC13:
	.string	" y: "
.LC14:
	.string	" t: "
.LC15:
	.string	"TrajectoryID: "
.LC16:
	.string	" traj_length: "
.LC17:
	.string	" traj_start*: "
.LC18:
	.string	"Number of points: "
.LC19:
	.string	"Number of trajectories: "
	.text
	.globl	_Z30load_trajectory_data_from_fileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_Z30load_trajectory_data_from_fileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, @function
_Z30load_trajectory_data_from_fileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE:
.LFB4135:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4135
	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
	movq	%rsi, %rbx
	leaq	.LC2(%rip), %rsi
	subq	$1192, %rsp
	.cfi_def_cfa_offset 1248
	movq	%rdi, 16(%rsp)
	leaq	_ZSt4cout(%rip), %rdi
	leaq	136(%rsp), %rbp
	movq	%fs:40, %rax
	movq	%rax, 1176(%rsp)
	xorl	%eax, %eax
.LEHB4:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE4:
	movq	(%rbx), %rsi
	movl	$8, %edx
	movq	%rbp, %rdi
.LEHB5:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
.LEHE5:
	leaq	256(%rsp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L56
.L58:
	leaq	72(%rsp), %rax
	xorl	%r8d, %r8d
	movq	%rbp, %rdi
	movb	$0, 88(%rsp)
	movq	%rax, 24(%rsp)
	movq	24(%rsp), %rsi
	leaq	88(%rsp), %rax
	movq	%rax, 72(%rsp)
	movq	%r8, 80(%rsp)
.LEHB6:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
.LEHE6:
	xorl	%edi, %edi
	orl	$-1, %r14d
	leaq	.LC4(%rip), %r15
	movl	%edi, 12(%rsp)
	movl	%edi, 8(%rsp)
	jmp	.L57
.L56:
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
.LEHB7:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE7:
	jmp	.L58
.L102:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L101
	movq	24(%rsp), %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB8:
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	80(%rsp), %rax
	incl	12(%rsp)
	leaq	1(%rax), %r13
	movq	%r13, %rdi
	call	_Znam@PLT
	movq	72(%rsp), %rsi
	movq	%r13, %rdx
	movq	%rax, %r12
	movq	%rax, %rdi
	call	__strcpy_chk@PLT
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	strtok@PLT
	leaq	71(%rsp), %rdx
	leaq	656(%rsp), %rdi
	movq	%rax, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE8:
	movq	656(%rsp), %rdx
	movq	__isoc23_strtol@GOTPCREL(%rip), %rdi
	movl	$10, %r8d
	xorl	%ecx, %ecx
	leaq	656(%rsp), %rax
	leaq	.LC5(%rip), %rsi
	movq	%rax, 32(%rsp)
.LEHB9:
	call	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
.LEHE9:
	movq	32(%rsp), %rdi
	movl	%eax, %r13d
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	cmpl	%r13d, %r14d
	je	.L59
	incl	8(%rsp)
.L59:
	movq	%r12, %rdi
	movl	%r13d, %r14d
	call	_ZdaPv@PLT
.L57:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
.LEHB10:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	jmp	.L102
.L101:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movslq	12(%rsp), %rbp
	movq	%rbp, %rdi
	salq	$5, %rdi
	call	_Znam@PLT
	movq	%rax, %r14
.L61:
	subq	$1, %rbp
	jb	.L103
	xorl	%esi, %esi
	movq	$0x000000000, 8(%rax)
	addq	$32, %rax
	movl	%esi, -32(%rax)
	movq	$0x000000000, -16(%rax)
	movq	$0x000000000, -8(%rax)
	jmp	.L61
.L103:
	movabsq	$384307168202282325, %rax
	movslq	8(%rsp), %rdi
	cmpq	%rdi, %rax
	jb	.L63
	imulq	$24, %rdi, %rdi
	call	_Znam@PLT
	movq	%r14, 8(%rax)
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%rax, 32(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L104
.L63:
	movq	1176(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L97
	call	__cxa_throw_bad_array_new_length@PLT
.L104:
	movl	12(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	8(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	656(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 40(%rsp)
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE10:
	movq	(%rbx), %rsi
	movq	40(%rsp), %rdi
	movl	$8, %edx
.LEHB11:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
	leaq	776(%rsp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L66
.L68:
	movq	24(%rsp), %rsi
	movq	40(%rsp), %rdi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	xorl	%ecx, %ecx
	leaq	72(%rsp), %rax
	movq	32(%rsp), %r12
	movq	%r14, %rbp
	movl	%ecx, 24(%rsp)
	movq	%r14, %rbx
	movl	$1, %r15d
	movq	%rax, 56(%rsp)
	jmp	.L67
.L66:
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	jmp	.L68
.L106:
	movq	(%rax), %rdx
	leaq	_ZSt4cout(%rip), %r13
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L105
	movq	56(%rsp), %rsi
	movq	%r13, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	80(%rsp), %rax
	leaq	1(%rax), %r13
	movq	%r13, %rdi
	call	_Znam@PLT
	movq	72(%rsp), %rsi
	movq	%r13, %rdx
	movq	%rax, %rdi
	movq	%rax, 48(%rsp)
	call	__strcpy_chk@PLT
	movq	48(%rsp), %rdi
	leaq	.LC4(%rip), %rsi
	call	strtok@PLT
	leaq	71(%rsp), %rdx
	leaq	104(%rsp), %rdi
	movq	%rax, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE11:
	movq	104(%rsp), %rdx
	movq	__isoc23_strtol@GOTPCREL(%rip), %rdi
	xorl	%ecx, %ecx
	leaq	104(%rsp), %r13
	movl	$10, %r8d
	leaq	.LC5(%rip), %rsi
.LEHB12:
	call	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
.LEHE12:
	movl	%eax, (%rbx)
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	.LC4(%rip), %rsi
	xorl	%edi, %edi
	call	strtok@PLT
	leaq	71(%rsp), %rdx
	movq	%r13, %rdi
	movq	%rax, %rsi
.LEHB13:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE13:
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
.LEHB14:
	call	_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0
.LEHE14:
	movsd	%xmm0, 24(%rbx)
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	.LC4(%rip), %rsi
	xorl	%edi, %edi
	call	strtok@PLT
	leaq	71(%rsp), %rdx
	movq	%r13, %rdi
	movq	%rax, %rsi
.LEHB15:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE15:
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
.LEHB16:
	call	_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0
.LEHE16:
	movsd	%xmm0, 8(%rbx)
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	.LC4(%rip), %rsi
	xorl	%edi, %edi
	call	strtok@PLT
	leaq	71(%rsp), %rdx
	movq	%r13, %rdi
	movq	%rax, %rsi
.LEHB17:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE17:
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
.LEHB18:
	call	_ZNSt7__cxx114stodERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPm.isra.0
.LEHE18:
	movsd	%xmm0, 16(%rbx)
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	48(%rsp), %rdi
	call	_ZdaPv@PLT
	movl	(%rbx), %eax
	cmpl	%r15d, %eax
	je	.L69
	xorl	%edx, %edx
	movl	24(%rsp), %ecx
	movl	%r15d, (%r12)
	addq	$24, %r12
	movq	%rbx, 8(%r12)
	movl	%ecx, -8(%r12)
	movl	%edx, 24(%rsp)
.L69:
	incl	24(%rsp)
	addq	$32, %rbx
	movl	%eax, %r15d
.L67:
	leaq	656(%rsp), %rax
	movq	56(%rsp), %rsi
	movq	%rax, %rdi
	movq	%rax, 48(%rsp)
.LEHB19:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	jmp	.L106
.L105:
	movq	48(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movl	24(%rsp), %eax
	movl	%r15d, (%r12)
	leaq	.LC10(%rip), %rsi
	movq	%r13, %rdi
	movl	%eax, 16(%r12)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movslq	12(%rsp), %rbx
	leaq	.LC11(%rip), %r12
	salq	$5, %rbx
	addq	%r14, %rbx
.L71:
	cmpq	%rbx, %rbp
	je	.L107
	movsd	8(%rbp), %xmm1
	movsd	24(%rbp), %xmm2
	movq	%r12, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movl	0(%rbp), %r13d
	movq	16(%rbp), %r15
	movsd	%xmm1, 24(%rsp)
	movsd	%xmm2, 48(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r13d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC12(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC13(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r15, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC14(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	48(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	addq	$32, %rbp
	jmp	.L71
.L107:
	movq	32(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	_ZSt4cout(%rip), %rbp
.L73:
	cmpl	%r12d, 8(%rsp)
	jle	.L108
	movl	16(%rbx), %eax
	leaq	.LC15(%rip), %rsi
	movq	%rbp, %rdi
	movl	(%rbx), %r15d
	movq	8(%rbx), %r13
	movl	%eax, 24(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r15d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC16(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	24(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC17(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZNSo9_M_insertIPKvEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	incl	%r12d
	addq	$24, %rbx
	jmp	.L73
.L108:
	leaq	.LC18(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC19(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	8(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE19:
	movq	16(%rsp), %rax
	movq	32(%rsp), %rcx
	movq	40(%rsp), %rdi
	movq	%rcx, 8(%rax)
	movl	12(%rsp), %ecx
	movq	%r14, (%rax)
	movl	%ecx, 16(%rax)
	movl	8(%rsp), %ecx
	movl	%ecx, 20(%rax)
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	56(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	136(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1176(%rsp), %rax
	subq	%fs:40, %rax
	je	.L84
	jmp	.L97
.L89:
	endbr64
	movq	%rax, %rbx
.L75:
	movq	32(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L76
.L91:
	endbr64
	jmp	.L100
.L92:
	endbr64
	jmp	.L100
.L93:
	endbr64
	jmp	.L100
.L94:
	endbr64
.L100:
	movq	%rax, %rbx
.L81:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L78
.L90:
	endbr64
	movq	%rax, %rbx
.L78:
	leaq	656(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L76
.L88:
	endbr64
	movq	%rax, %rbx
.L76:
	leaq	72(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L82
.L87:
	endbr64
	movq	%rax, %rbx
.L82:
	leaq	136(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1176(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L97
	movq	%rbx, %rdi
.LEHB20:
	call	_Unwind_Resume@PLT
.LEHE20:
.L97:
	call	__stack_chk_fail@PLT
.L84:
	movq	16(%rsp), %rax
	addq	$1192, %rsp
	.cfi_def_cfa_offset 56
	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
.LFE4135:
	.section	.gcc_except_table
.LLSDA4135:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4135-.LLSDACSB4135
.LLSDACSB4135:
	.uleb128 .LEHB4-.LFB4135
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB5-.LFB4135
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L87-.LFB4135
	.uleb128 0
	.uleb128 .LEHB6-.LFB4135
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L88-.LFB4135
	.uleb128 0
	.uleb128 .LEHB7-.LFB4135
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L87-.LFB4135
	.uleb128 0
	.uleb128 .LEHB8-.LFB4135
	.uleb128 .LEHE8-.LEHB8
	.uleb128 .L88-.LFB4135
	.uleb128 0
	.uleb128 .LEHB9-.LFB4135
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L89-.LFB4135
	.uleb128 0
	.uleb128 .LEHB10-.LFB4135
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L88-.LFB4135
	.uleb128 0
	.uleb128 .LEHB11-.LFB4135
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L90-.LFB4135
	.uleb128 0
	.uleb128 .LEHB12-.LFB4135
	.uleb128 .LEHE12-.LEHB12
	.uleb128 .L91-.LFB4135
	.uleb128 0
	.uleb128 .LEHB13-.LFB4135
	.uleb128 .LEHE13-.LEHB13
	.uleb128 .L90-.LFB4135
	.uleb128 0
	.uleb128 .LEHB14-.LFB4135
	.uleb128 .LEHE14-.LEHB14
	.uleb128 .L92-.LFB4135
	.uleb128 0
	.uleb128 .LEHB15-.LFB4135
	.uleb128 .LEHE15-.LEHB15
	.uleb128 .L90-.LFB4135
	.uleb128 0
	.uleb128 .LEHB16-.LFB4135
	.uleb128 .LEHE16-.LEHB16
	.uleb128 .L93-.LFB4135
	.uleb128 0
	.uleb128 .LEHB17-.LFB4135
	.uleb128 .LEHE17-.LEHB17
	.uleb128 .L90-.LFB4135
	.uleb128 0
	.uleb128 .LEHB18-.LFB4135
	.uleb128 .LEHE18-.LEHB18
	.uleb128 .L94-.LFB4135
	.uleb128 0
	.uleb128 .LEHB19-.LFB4135
	.uleb128 .LEHE19-.LEHB19
	.uleb128 .L90-.LFB4135
	.uleb128 0
	.uleb128 .LEHB20-.LFB4135
	.uleb128 .LEHE20-.LEHB20
	.uleb128 0
	.uleb128 0
.LLSDACSE4135:
	.text
	.size	_Z30load_trajectory_data_from_fileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .-_Z30load_trajectory_data_from_fileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.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:

/*
 * trajectory_data.cuh
 *
 *  Created on: Sep 2, 2020
 *      Author: clark
 */

#ifndef TRAJECTORY_DATA_CUH_
#define TRAJECTORY_DATA_CUH_

// Includes
#include <vector>
#include <string>

// Structs

// Trajectory data will be organized as a vector of these points. This will make transfer of data to GPU possible.
// Trajectory level information will be maintained in a trajectory index if necessary
struct point
{
	int trajectory_number;
	double x;
	double y;
	double t;
	__device__ __host__ point():trajectory_number(0),x(0.0),y(0.0),t(0.0){}
	__device__ __host__ point(int trajectory_number, double x, double y, double t):
			trajectory_number(trajectory_number), x(x), y(y), t(t){}
};

struct trajectory_index
{
	int 				traj_number;
	point* 				traj_start;
	int 				traj_length;
};

struct file_trajectory_data
{
	point* 				points;
	trajectory_index* 	trajectories;
	int 				num_points;
	int 				num_trajectories;
};

// Prototypes
file_trajectory_data load_trajectory_data_from_file(std::string file_name);


#endif /* TRAJECTORY_DATA_CUH_ */

	.text
	.file	"trajectory_data.hip"
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.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_

	.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
