#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
#include "SAP.cuh"
using namespace std;
		    

int main(int argc, char ** argv){

	// Initialize key parameters of SAP algorithm
	int iterations;
	float step_size;

	// Query user for parameters
	cout << "Number of iterations (a positive integer): \n";
	cin >> iterations;
	cout << "Step size (real number between 0 and .5): \n";
	cin >> step_size;

	// Initialize parameters to characterize data
	int input_dim;
	int numb_points;
	int proj_dim;

	/*--------------- Begin importing data --------------*/

	// Read data points from a text file
	ifstream inFile;
	inFile.open("example_data_points.txt");
	if (!inFile){
		cerr << "Unable to open file with data points.\n";
	exit(1);
	}

	// First two rows give the input data dimension and 
	// the number of points
	inFile >> input_dim;
	inFile >> numb_points;

	// Initialize array to store data points
	float * h_points_in = new float[input_dim*numb_points];
	
	// Read in entries for data point from text file
	float x;
	int i = 0;
	while (i < input_dim*numb_points){
		inFile >> x;
		h_points_in[i] = x;
		i = i+1;
	}	

	inFile.close();
	
	// Read in initial projection
	inFile.open("initial_projection.txt");
	if (!inFile){
		cerr << "Unable to open initial projection file.\n";
	exit(1);
	}

	// Projection dimension is stored as first entry to text file
	inFile >> proj_dim;

	// Initialize array to store initial projection
	float * h_proj = new float[input_dim*proj_dim];

	// Read in entries of initial projection
	i = 0;
	while (i < proj_dim*input_dim){
		inFile >> x;
		h_proj[i] = x;
		i = i+1;
	}	

	inFile.close();

	// Create file to store the smallest secant norms
	float h_smallest_secant_norms[iterations];

	// Call the SAP algorithm
	SAP(input_dim, numb_points, h_points_in, proj_dim, h_proj, h_smallest_secant_norms, iterations, step_size);

	// Open file to store output projection
	ofstream myFile;
	myFile.open("output_projection.txt");

	for (int j = 0; j < proj_dim; j++){
		myFile << h_proj[j] << "\n";
	}

	myFile.close();
	
	// Delete arrays on host
	delete h_points_in;
	delete h_proj;

	return 0;

}










	.file	"tmpxft_002d0613_00000000-6_example_call.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4008:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4008:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0, @function
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0:
.LFB4726:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	testq	%rsi, %rsi
	jne	.L3
	movq	(%rdi), %rax
	movl	$1, %esi
	addq	-24(%rax), %rbx
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L3:
	.cfi_restore_state
	movq	%rsi, %rdi
	movq	%rsi, 8(%rsp)
	call	strlen@PLT
	movq	8(%rsp), %rsi
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	movq	%rax, %rdx
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	.cfi_endproc
.LFE4726:
	.size	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0, .-_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4031:
	.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
.LFE4031:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Number of iterations (a positive integer): \n"
.LC1:
	.string	"Step size (real number between 0 and .5): \n"
.LC2:
	.string	"example_data_points.txt"
.LC3:
	.string	"Unable to open file with data points.\n"
.LC4:
	.string	"initial_projection.txt"
.LC5:
	.string	"Unable to open initial projection file.\n"
.LC6:
	.string	"output_projection.txt"
.LC7:
	.string	"\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4005:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4005
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rsi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	_ZSt4cout(%rip), %r12
	pushq	%rbx
	movq	%r12, %rdi
	.cfi_offset 3, -56
	leaq	_ZSt3cin(%rip), %rbx
	subq	$1096, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.LEHB0:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	leaq	-1112(%rbp), %rsi
	movq	%rbx, %rdi
	call	_ZNSirsERi@PLT
	leaq	.LC1(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	leaq	-1108(%rbp), %rsi
	movq	%rbx, %rdi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	leaq	-576(%rbp), %rax
	movq	%rax, %rdi
	movq	%rax, -1128(%rbp)
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	-1128(%rbp), %rdi
	movl	$8, %edx
	leaq	.LC2(%rip), %rsi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	testb	$5, -288(%rbp)
	je	.L9
	leaq	.LC3(%rip), %rsi
.L41:
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	movl	$1, %edi
	call	exit@PLT
.L9:
	movq	-1128(%rbp), %rdi
	leaq	-1104(%rbp), %rsi
	call	_ZNSirsERi@PLT
	movq	-1128(%rbp), %rdi
	leaq	-1100(%rbp), %rsi
	call	_ZNSirsERi@PLT
	movabsq	$2305843009213693950, %rax
	movl	-1104(%rbp), %edi
	imull	-1100(%rbp), %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L10
	salq	$2, %rdi
	call	_Znam@PLT
	movq	%rax, %r13
	xorl	%ebx, %ebx
	leaq	-1092(%rbp), %r12
	jmp	.L11
.L10:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L38
	call	__cxa_throw_bad_array_new_length@PLT
.L13:
	movq	-1128(%rbp), %rdi
	movq	%r12, %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movss	-1092(%rbp), %xmm0
	movss	%xmm0, 0(%r13,%rbx,4)
	incq	%rbx
.L11:
	movl	-1104(%rbp), %eax
	imull	-1100(%rbp), %eax
	cmpl	%ebx, %eax
	jg	.L13
	movq	-1128(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	-1128(%rbp), %rdi
	movl	$8, %edx
	leaq	.LC4(%rip), %rsi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	.LC5(%rip), %rsi
	testb	$5, -288(%rbp)
	jne	.L41
	movq	-1128(%rbp), %rdi
	leaq	-1096(%rbp), %rsi
	call	_ZNSirsERi@PLT
	movabsq	$2305843009213693950, %rax
	movl	-1104(%rbp), %edi
	imull	-1096(%rbp), %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L16
	salq	$2, %rdi
	call	_Znam@PLT
	movq	%rax, %r12
	xorl	%ebx, %ebx
	leaq	-1092(%rbp), %r14
	jmp	.L17
.L16:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L38
	call	__cxa_throw_bad_array_new_length@PLT
.L19:
	movq	-1128(%rbp), %rdi
	movq	%r14, %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movss	-1092(%rbp), %xmm0
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
.L17:
	movl	-1096(%rbp), %eax
	imull	-1104(%rbp), %eax
	cmpl	%ebx, %eax
	jg	.L19
	movq	-1128(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movslq	-1112(%rbp), %rax
	movq	%rsp, %rsi
	leaq	15(,%rax,4), %rdx
	movq	%rax, %rcx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rsi
.L20:
	cmpq	%rsi, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L22
	orq	$0, -8(%rsp,%rax)
.L22:
	movq	%rsp, %r9
	pushq	%rsi
	movss	-1108(%rbp), %xmm0
	movq	%r12, %r8
	pushq	%rcx
	movl	-1096(%rbp), %ecx
	movq	%r13, %rdx
	movl	-1100(%rbp), %esi
	movl	-1104(%rbp), %edi
	.cfi_escape 0x2e,0x10
	call	_Z3SAPiiPfiS_S_if@PLT
	leaq	-1088(%rbp), %rbx
	popq	%rax
	popq	%rdx
	movq	%rbx, %rdi
	.cfi_escape 0x2e,0
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE1:
	movl	$16, %edx
	leaq	.LC6(%rip), %rsi
	movq	%rbx, %rdi
.LEHB2:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	xorl	%r14d, %r14d
	leaq	.LC7(%rip), %r15
.L23:
	cmpl	%r14d, -1096(%rbp)
	jle	.L43
	movq	%rbx, %rdi
	cvtss2sd	(%r12,%r14,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.isra.0
	incq	%r14
	jmp	.L23
.L43:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE2:
	movl	$4, %esi
	movq	%r13, %rdi
	call	_ZdlPvm@PLT
	movl	$4, %esi
	movq	%r12, %rdi
	call	_ZdlPvm@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-1128(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L28
	jmp	.L38
.L33:
	endbr64
	movq	%rax, %r12
.L25:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L26
.L32:
	endbr64
	movq	%rax, %r12
.L26:
	movq	-1128(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L38
	movq	%r12, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L38:
	call	__stack_chk_fail@PLT
.L28:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4005:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4005:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4005-.LLSDACSB4005
.LLSDACSB4005:
	.uleb128 .LEHB0-.LFB4005
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4005
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L32-.LFB4005
	.uleb128 0
	.uleb128 .LEHB2-.LFB4005
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L33-.LFB4005
	.uleb128 0
	.uleb128 .LEHB3-.LFB4005
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE4005:
	.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 <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
#include "SAP.cuh"
using namespace std;
		    

int main(int argc, char ** argv){

	// Initialize key parameters of SAP algorithm
	int iterations;
	float step_size;

	// Query user for parameters
	cout << "Number of iterations (a positive integer): \n";
	cin >> iterations;
	cout << "Step size (real number between 0 and .5): \n";
	cin >> step_size;

	// Initialize parameters to characterize data
	int input_dim;
	int numb_points;
	int proj_dim;

	/*--------------- Begin importing data --------------*/

	// Read data points from a text file
	ifstream inFile;
	inFile.open("example_data_points.txt");
	if (!inFile){
		cerr << "Unable to open file with data points.\n";
	exit(1);
	}

	// First two rows give the input data dimension and 
	// the number of points
	inFile >> input_dim;
	inFile >> numb_points;

	// Initialize array to store data points
	float * h_points_in = new float[input_dim*numb_points];
	
	// Read in entries for data point from text file
	float x;
	int i = 0;
	while (i < input_dim*numb_points){
		inFile >> x;
		h_points_in[i] = x;
		i = i+1;
	}	

	inFile.close();
	
	// Read in initial projection
	inFile.open("initial_projection.txt");
	if (!inFile){
		cerr << "Unable to open initial projection file.\n";
	exit(1);
	}

	// Projection dimension is stored as first entry to text file
	inFile >> proj_dim;

	// Initialize array to store initial projection
	float * h_proj = new float[input_dim*proj_dim];

	// Read in entries of initial projection
	i = 0;
	while (i < proj_dim*input_dim){
		inFile >> x;
		h_proj[i] = x;
		i = i+1;
	}	

	inFile.close();

	// Create file to store the smallest secant norms
	float h_smallest_secant_norms[iterations];

	// Call the SAP algorithm
	SAP(input_dim, numb_points, h_points_in, proj_dim, h_proj, h_smallest_secant_norms, iterations, step_size);

	// Open file to store output projection
	ofstream myFile;
	myFile.open("output_projection.txt");

	for (int j = 0; j < proj_dim; j++){
		myFile << h_proj[j] << "\n";
	}

	myFile.close();
	
	// Delete arrays on host
	delete h_points_in;
	delete h_proj;

	return 0;

}










	.text
	.file	"example_call.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.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
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$1064, %rsp                     # imm = 0x428
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$44, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	.cfi_escape 0x2e, 0x00
	leaq	-60(%rbp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZNSirsERi
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$43, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	.cfi_escape 0x2e, 0x00
	leaq	-64(%rbp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZNSi10_M_extractIfEERSiRT_
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	movq	-584(%rbp), %rax
	movq	-24(%rax), %rax
	testb	$5, -552(%rbp,%rax)
	jne	.LBB0_29
# %bb.2:
.Ltmp4:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	leaq	-48(%rbp), %rsi
	callq	_ZNSirsERi
.Ltmp5:
# %bb.3:
.Ltmp6:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	callq	_ZNSirsERi
.Ltmp7:
# %bb.4:
	movslq	-48(%rbp), %rax
	movslq	-56(%rbp), %r14
	imulq	%rax, %r14
	movq	%r14, %rax
	shlq	$2, %rax
	testl	%r14d, %r14d
	movq	$-1, %rdi
	cmovnsq	%rax, %rdi
.Ltmp9:
	.cfi_escape 0x2e, 0x00
	callq	_Znam
.Ltmp10:
# %bb.5:
	movq	%rax, %rbx
	testl	%r14d, %r14d
	jle	.LBB0_9
# %bb.6:                                # %.lr.ph.preheader
	xorl	%r12d, %r12d
	leaq	-584(%rbp), %r14
	leaq	-52(%rbp), %r15
.LBB0_7:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp12:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp13:
# %bb.8:                                # %_ZNSirsERf.exit
                                        #   in Loop: Header=BB0_7 Depth=1
	movss	-52(%rbp), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rbx,%r12,4)
	incq	%r12
	movslq	-48(%rbp), %rax
	movslq	-56(%rbp), %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, %r12
	jl	.LBB0_7
.LBB0_9:                                # %._crit_edge
.Ltmp15:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp16:
# %bb.10:
.Ltmp17:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	movl	$.L.str.4, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp18:
# %bb.11:
	movq	-584(%rbp), %rax
	movq	-24(%rax), %rax
	testb	$5, -552(%rbp,%rax)
	jne	.LBB0_32
# %bb.12:
.Ltmp21:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_ZNSirsERi
.Ltmp22:
# %bb.13:
	movslq	-48(%rbp), %rax
	movslq	-44(%rbp), %r15
	imulq	%rax, %r15
	movq	%r15, %rax
	shlq	$2, %rax
	testl	%r15d, %r15d
	movq	$-1, %rdi
	cmovnsq	%rax, %rdi
.Ltmp24:
	.cfi_escape 0x2e, 0x00
	callq	_Znam
.Ltmp25:
# %bb.14:                               # %.preheader39
	movq	%rax, %r14
	testl	%r15d, %r15d
	jle	.LBB0_18
# %bb.15:                               # %.lr.ph47.preheader
	xorl	%r13d, %r13d
	leaq	-584(%rbp), %r15
	leaq	-52(%rbp), %r12
.LBB0_16:                               # %.lr.ph47
                                        # =>This Inner Loop Header: Depth=1
.Ltmp26:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp27:
# %bb.17:                               # %_ZNSirsERf.exit37
                                        #   in Loop: Header=BB0_16 Depth=1
	movss	-52(%rbp), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r14,%r13,4)
	incq	%r13
	movslq	-44(%rbp), %rax
	movslq	-48(%rbp), %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, %r13
	jl	.LBB0_16
.LBB0_18:                               # %._crit_edge48
.Ltmp29:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp30:
# %bb.19:
	movq	%rsp, %r12
	movl	-60(%rbp), %eax
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %r9
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %r9
	movq	%r9, %rsp
	movl	-48(%rbp), %edi
	movl	-56(%rbp), %esi
	movl	-44(%rbp), %ecx
	movl	-60(%rbp), %eax
	movss	-64(%rbp), %xmm0                # xmm0 = mem[0],zero,zero,zero
.Ltmp31:
	.cfi_escape 0x2e, 0x10
	subq	$8, %rsp
	movq	%rbx, %rdx
	movq	%r14, %r8
	pushq	%rax
	callq	_Z3SAPiiPfiS_S_if
	addq	$16, %rsp
.Ltmp32:
# %bb.20:
.Ltmp34:
	.cfi_escape 0x2e, 0x00
	leaq	-1096(%rbp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp35:
# %bb.21:
.Ltmp37:
	.cfi_escape 0x2e, 0x00
	leaq	-1096(%rbp), %rdi
	movl	$.L.str.6, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp38:
# %bb.22:                               # %.preheader
	cmpl	$0, -44(%rbp)
	jle	.LBB0_27
# %bb.23:                               # %.lr.ph50.preheader
	xorl	%r13d, %r13d
	leaq	-1096(%rbp), %r15
.LBB0_24:                               # %.lr.ph50
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r13,4), %xmm0
.Ltmp39:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp40:
# %bb.25:                               # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB0_24 Depth=1
.Ltmp41:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.7, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp42:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB0_24 Depth=1
	incq	%r13
	movslq	-44(%rbp), %rax
	cmpq	%rax, %r13
	jl	.LBB0_24
.LBB0_27:                               # %._crit_edge51
.Ltmp44:
	.cfi_escape 0x2e, 0x00
	leaq	-1096(%rbp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp45:
# %bb.28:
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_ZdlPv
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_ZdlPv
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	-1088(%rbp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, -1096(%rbp,%rax)
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	-848(%rbp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt8ios_baseD2Ev
	movq	%r12, %rsp
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB0_29:
	.cfi_def_cfa %rbp, 16
.Ltmp2:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.3, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp3:
# %bb.30:
	.cfi_escape 0x2e, 0x00
	jmp	.LBB0_31
.LBB0_32:
.Ltmp19:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.5, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp20:
# %bb.33:
	.cfi_escape 0x2e, 0x00
.LBB0_31:
	movl	$1, %edi
	callq	exit
.LBB0_34:
.Ltmp36:
	jmp	.LBB0_40
.LBB0_35:
.Ltmp11:
	jmp	.LBB0_40
.LBB0_36:
.Ltmp46:
	jmp	.LBB0_44
.LBB0_37:                               # %.loopexit.split-lp
.Ltmp33:
	jmp	.LBB0_40
.LBB0_38:                               # %.loopexit.split-lp41
.Ltmp23:
	jmp	.LBB0_40
.LBB0_39:
.Ltmp8:
	jmp	.LBB0_40
.LBB0_41:                               # %.loopexit
.Ltmp28:
	jmp	.LBB0_40
.LBB0_42:                               # %.loopexit40
.Ltmp14:
.LBB0_40:
	movq	%rax, %rbx
	jmp	.LBB0_45
.LBB0_43:
.Ltmp43:
.LBB0_44:
	movq	%rax, %rbx
	.cfi_escape 0x2e, 0x00
	leaq	-1096(%rbp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB0_45:
	.cfi_escape 0x2e, 0x00
	leaq	-584(%rbp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	.cfi_escape 0x2e, 0x00
	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 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp7-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp13-.Ltmp12                #   Call between .Ltmp12 and .Ltmp13
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp22-.Ltmp15                #   Call between .Ltmp15 and .Ltmp22
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp25-.Ltmp24                #   Call between .Ltmp24 and .Ltmp25
	.uleb128 .Ltmp33-.Lfunc_begin0          #     jumps to .Ltmp33
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp26-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp27-.Ltmp26                #   Call between .Ltmp26 and .Ltmp27
	.uleb128 .Ltmp28-.Lfunc_begin0          #     jumps to .Ltmp28
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp32-.Ltmp29                #   Call between .Ltmp29 and .Ltmp32
	.uleb128 .Ltmp33-.Lfunc_begin0          #     jumps to .Ltmp33
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp34-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp35-.Ltmp34                #   Call between .Ltmp34 and .Ltmp35
	.uleb128 .Ltmp36-.Lfunc_begin0          #     jumps to .Ltmp36
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp37-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp38-.Ltmp37                #   Call between .Ltmp37 and .Ltmp38
	.uleb128 .Ltmp46-.Lfunc_begin0          #     jumps to .Ltmp46
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp39-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp42-.Ltmp39                #   Call between .Ltmp39 and .Ltmp42
	.uleb128 .Ltmp43-.Lfunc_begin0          #     jumps to .Ltmp43
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp44-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp45-.Ltmp44                #   Call between .Ltmp44 and .Ltmp45
	.uleb128 .Ltmp46-.Lfunc_begin0          #     jumps to .Ltmp46
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp2-.Lfunc_begin0           # >> Call Site 13 <<
	.uleb128 .Ltmp3-.Ltmp2                  #   Call between .Ltmp2 and .Ltmp3
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Ltmp20-.Ltmp19                #   Call between .Ltmp19 and .Ltmp20
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 15 <<
	.uleb128 .Lfunc_end0-.Ltmp20            #   Call between .Ltmp20 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Number of iterations (a positive integer): \n"
	.size	.L.str, 45

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Step size (real number between 0 and .5): \n"
	.size	.L.str.1, 44

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"example_data_points.txt"
	.size	.L.str.2, 24

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Unable to open file with data points.\n"
	.size	.L.str.3, 39

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"initial_projection.txt"
	.size	.L.str.4, 23

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Unable to open initial projection file.\n"
	.size	.L.str.5, 41

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"output_projection.txt"
	.size	.L.str.6, 22

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\n"
	.size	.L.str.7, 2

	.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 __gxx_personality_v0
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt3cin
	.addrsig_sym _ZSt4cerr
	.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
