#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Note we send in a pointer to the file pointer becuase this function needs to update the position of the file pointer
 */

void get_file_data(FILE **fp, int *nchans, int *nsamples, int *nsamp, int *nifs, int *nbits, float *tsamp, float *tstart, float *fch1, float *foff)
{

	fpos_t file_loc;

	char *string = (char *) malloc(80 * sizeof(char));

	int nchar;
	int nbytes = sizeof(int);

	long int total_data;

	double temp;

	while (1)
	{

		strcpy(string, "ERROR");
		fread(&nchar, sizeof(int), 1, *fp);

		if (feof(*fp))
			exit(0);

		if (nchar > 1 && nchar < 80)
		{

			fread(string, nchar, 1, *fp);
			string[nchar] = '\0';
			// For debugging only
			printf("\n%d\t%s", nchar, string), fflush(stdout);
			nbytes += nchar;

			if (strcmp(string, "HEADER_END") == 0)
				break;

			if (strcmp(string, "tsamp") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*tsamp = (float) temp;
			}
			else if (strcmp(string, "tstart") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*tstart = (float) temp;
			}
			else if (strcmp(string, "fch1") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*fch1 = (float) temp;
			}
			else if (strcmp(string, "foff") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*foff = (float) temp;
			}
			else if (strcmp(string, "nchans") == 0)
			{
				fread(nchans, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nifs") == 0)
			{
				fread(nifs, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nbits") == 0)
			{
				fread(nbits, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nsamples") == 0)
			{
				fread(nsamples, sizeof(int), 1, *fp);
			}
		}
	}

	// Check that we are working with one IF channel
	if (*nifs != 1)
	{
		printf("\nERROR!! Can only work with one IF channel!\n");
		exit(1);
	}

	fgetpos(*fp, &file_loc);
        long data_start = ftell(*fp);
	if (fseek(*fp, 0, SEEK_END) != 0) 
 	{
		printf("\nERROR!! Failed to seek to end of data file\n");
		exit(1);
	}
        total_data = ftell(*fp);
	if (total_data == -1)
	{
		printf("\nERROR!! Failed to seek to end of data file\n");
		exit(1);
	}
	total_data -= data_start;

	if (( *nbits ) == 32)
	{
		*nsamp = (total_data/sizeof(float)) - 1;
	}
	else if (( *nbits ) == 8)
	{
		*nsamp = (total_data/sizeof(unsigned char)) - 1;
	}
	else
	{
		printf("\n\n======================= ERROR =======================\n");
		printf(" Currently this code only runs with 8 and 32 bit data\n");
		printf("\n=====================================================\n");
	}

	// Move the file pointer back to the end of the header
	fsetpos(*fp, &file_loc);

}

	.file	"tmpxft_002e9948_00000000-6_host_get_file_data.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"\n%d\t%s"
.LC1:
	.string	"HEADER_END"
.LC2:
	.string	"tsamp"
.LC3:
	.string	"tstart"
.LC4:
	.string	"fch1"
.LC5:
	.string	"foff"
.LC6:
	.string	"nchans"
.LC7:
	.string	"nifs"
.LC8:
	.string	"nbits"
.LC9:
	.string	"nsamples"
.LC10:
	.string	"\nERROR!! Can only work with one IF channel!\n"
.LC11:
	.string	"\nERROR!! Failed to seek to end of data file\n"
.LC12:
	.string	"\n\n======================= ERROR =======================\n"
.LC13:
	.string	" Currently this code only runs with 8 and 32 bit data\n"
.LC14:
	.string	"\n=====================================================\n"
	.text
	.globl	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_
	.type	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_, @function
_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_:
.LFB2027:
	.cfi_startproc
	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
	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	%rdi, %rbx
	movl	$80, %edi
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	160(%rsp), %rax
	movq	%rsi, 16(%rsp)
	movq	%rdx, 24(%rsp)
	movq	168(%rsp), %r13
	movq	%r8, (%rsp)
	movq	176(%rsp), %r14
	movq	%r9, 8(%rsp)
	movq	184(%rsp), %r15
	movq	%rax, 32(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	%rax, %rbp
	leaq	60(%rsp), %rax
	movq	%rax, 40(%rsp)
.L5:
	movl	$1330795077, 0(%rbp)
	movq	(%rbx), %r8
	movl	$1, %ecx
	movl	$4, %edx
	movw	$82, 4(%rbp)
	movq	40(%rsp), %rdi
	movl	$4, %esi
	call	__fread_chk@PLT
	movq	(%rbx), %rdi
	call	feof@PLT
	testl	%eax, %eax
	je	.L4
	xorl	%edi, %edi
	jmp	.L29
.L4:
	movslq	60(%rsp), %rdx
	leal	-2(%rdx), %eax
	cmpl	$77, %eax
	ja	.L5
	movq	(%rbx), %r8
	movl	$1, %ecx
	movl	$80, %esi
	movq	%rbp, %rdi
	call	__fread_chk@PLT
	movslq	60(%rsp), %rax
	movq	%rbp, %rcx
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	movb	$0, 0(%rbp,%rax)
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L6
	leaq	.LC2(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movq	(%rbx), %r8
	leaq	64(%rsp), %rdi
	movl	$1, %ecx
	movl	$8, %edx
	movl	$8, %esi
	call	__fread_chk@PLT
	movq	32(%rsp), %rax
	cvtsd2ss	64(%rsp), %xmm0
	movss	%xmm0, (%rax)
	jmp	.L5
.L7:
	leaq	.LC3(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movq	(%rbx), %r8
	leaq	64(%rsp), %rdi
	movl	$1, %ecx
	movl	$8, %edx
	movl	$8, %esi
	call	__fread_chk@PLT
	cvtsd2ss	64(%rsp), %xmm0
	movss	%xmm0, 0(%r13)
	jmp	.L5
.L9:
	leaq	.LC4(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movq	(%rbx), %r8
	leaq	64(%rsp), %rdi
	movl	$1, %ecx
	movl	$8, %edx
	movl	$8, %esi
	call	__fread_chk@PLT
	cvtsd2ss	64(%rsp), %xmm0
	movss	%xmm0, (%r14)
	jmp	.L5
.L10:
	leaq	.LC5(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	movq	(%rbx), %r8
	leaq	64(%rsp), %rdi
	movl	$1, %ecx
	movl	$8, %edx
	movl	$8, %esi
	call	__fread_chk@PLT
	cvtsd2ss	64(%rsp), %xmm0
	movss	%xmm0, (%r15)
	jmp	.L5
.L11:
	leaq	.LC6(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L12
	movq	(%rbx), %r8
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	orq	$-1, %rsi
	jmp	.L27
.L12:
	leaq	.LC7(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	movq	(%rbx), %r8
	movq	(%rsp), %rdi
	movl	$1, %ecx
	orq	$-1, %rsi
	movl	$4, %edx
	jmp	.L27
.L13:
	leaq	.LC8(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	movq	(%rbx), %r8
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	orq	$-1, %rsi
	jmp	.L27
.L14:
	leaq	.LC9(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movq	(%rbx), %r8
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	orq	$-1, %rsi
.L27:
	call	__fread_chk@PLT
	jmp	.L5
.L6:
	movq	(%rsp), %rax
	cmpl	$1, (%rax)
	je	.L15
	leaq	.LC10(%rip), %rsi
.L30:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
.L29:
	call	exit@PLT
.L15:
	movq	(%rbx), %rdi
	leaq	72(%rsp), %r13
	movq	%r13, %rsi
	call	fgetpos@PLT
	movq	(%rbx), %rdi
	call	ftell@PLT
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	movl	$2, %edx
	movq	%rax, %rbp
	call	fseek@PLT
	testl	%eax, %eax
	je	.L16
.L17:
	leaq	.LC11(%rip), %rsi
	jmp	.L30
.L16:
	movq	(%rbx), %rdi
	call	ftell@PLT
	cmpq	$-1, %rax
	je	.L17
	movq	8(%rsp), %rcx
	subq	%rbp, %rax
	movl	(%rcx), %edx
	cmpl	$32, %edx
	jne	.L18
	shrq	$2, %rax
	jmp	.L28
.L18:
	cmpl	$8, %edx
	jne	.L20
.L28:
	decl	%eax
	movl	%eax, (%r12)
	jmp	.L19
.L20:
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L19:
	movq	(%rbx), %rdi
	movq	%r13, %rsi
	call	fsetpos@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$104, %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
.LFE2027:
	.size	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_, .-_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2053:
	.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
.LFE2053:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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
	.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 <string.h>

/* Note we send in a pointer to the file pointer becuase this function needs to update the position of the file pointer
 */

void get_file_data(FILE **fp, int *nchans, int *nsamples, int *nsamp, int *nifs, int *nbits, float *tsamp, float *tstart, float *fch1, float *foff)
{

	fpos_t file_loc;

	char *string = (char *) malloc(80 * sizeof(char));

	int nchar;
	int nbytes = sizeof(int);

	long int total_data;

	double temp;

	while (1)
	{

		strcpy(string, "ERROR");
		fread(&nchar, sizeof(int), 1, *fp);

		if (feof(*fp))
			exit(0);

		if (nchar > 1 && nchar < 80)
		{

			fread(string, nchar, 1, *fp);
			string[nchar] = '\0';
			// For debugging only
			printf("\n%d\t%s", nchar, string), fflush(stdout);
			nbytes += nchar;

			if (strcmp(string, "HEADER_END") == 0)
				break;

			if (strcmp(string, "tsamp") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*tsamp = (float) temp;
			}
			else if (strcmp(string, "tstart") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*tstart = (float) temp;
			}
			else if (strcmp(string, "fch1") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*fch1 = (float) temp;
			}
			else if (strcmp(string, "foff") == 0)
			{
				fread(&temp, sizeof(double), 1, *fp);
				*foff = (float) temp;
			}
			else if (strcmp(string, "nchans") == 0)
			{
				fread(nchans, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nifs") == 0)
			{
				fread(nifs, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nbits") == 0)
			{
				fread(nbits, sizeof(int), 1, *fp);
			}
			else if (strcmp(string, "nsamples") == 0)
			{
				fread(nsamples, sizeof(int), 1, *fp);
			}
		}
	}

	// Check that we are working with one IF channel
	if (*nifs != 1)
	{
		printf("\nERROR!! Can only work with one IF channel!\n");
		exit(1);
	}

	fgetpos(*fp, &file_loc);
        long data_start = ftell(*fp);
	if (fseek(*fp, 0, SEEK_END) != 0) 
 	{
		printf("\nERROR!! Failed to seek to end of data file\n");
		exit(1);
	}
        total_data = ftell(*fp);
	if (total_data == -1)
	{
		printf("\nERROR!! Failed to seek to end of data file\n");
		exit(1);
	}
	total_data -= data_start;

	if (( *nbits ) == 32)
	{
		*nsamp = (total_data/sizeof(float)) - 1;
	}
	else if (( *nbits ) == 8)
	{
		*nsamp = (total_data/sizeof(unsigned char)) - 1;
	}
	else
	{
		printf("\n\n======================= ERROR =======================\n");
		printf(" Currently this code only runs with 8 and 32 bit data\n");
		printf("\n=====================================================\n");
	}

	// Move the file pointer back to the end of the header
	fsetpos(*fp, &file_loc);

}

	.text
	.file	"host_get_file_data.hip"
	.globl	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_ # -- Begin function _Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_
	.type	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_,@function
_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_: # @_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.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	%r9, 24(%rsp)                   # 8-byte Spill
	movq	%r8, 32(%rsp)                   # 8-byte Spill
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	movq	%rsi, 48(%rsp)                  # 8-byte Spill
	movq	%rdi, %rbx
	movl	$80, %edi
	callq	malloc
	movq	%rax, %r14
	movw	$82, 4(%rax)
	movl	$1330795077, (%rax)             # imm = 0x4F525245
	movq	(%rbx), %rcx
	leaq	4(%rsp), %rdi
	movl	$4, %esi
	movl	$1, %edx
	callq	fread
	movq	(%rbx), %rdi
	callq	feof
	testl	%eax, %eax
	jne	.LBB0_23
# %bb.1:
	movq	128(%rsp), %r12
	leaq	8(%rsp), %r13
	leaq	4(%rsp), %r15
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	4(%rsp), %ebp
	leal	-2(%rbp), %eax
	cmpl	$77, %eax
	ja	.LBB0_22
# %bb.3:                                #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$1, %edx
	movq	%r14, %rdi
	movq	%rbp, %rsi
	callq	fread
	movb	$0, (%r14,%rbp)
	movl	$.L.str.1, %edi
	movl	%ebp, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	printf
	movq	stdout(%rip), %rdi
	callq	fflush
	movl	$.L.str.2, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_24
# %bb.4:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.3, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_13
# %bb.5:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.4, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_14
# %bb.6:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.5, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_16
# %bb.7:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.6, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_17
# %bb.8:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.7, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_18
# %bb.9:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.8, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_19
# %bb.10:                               #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.9, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_20
# %bb.11:                               #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.10, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB0_22
# %bb.12:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$4, %esi
	movl	$1, %edx
	movq	40(%rsp), %rdi                  # 8-byte Reload
	jmp	.LBB0_21
.LBB0_13:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$8, %esi
	movl	$1, %edx
	movq	%r13, %rdi
	callq	fread
	xorps	%xmm0, %xmm0
	cvtsd2ss	8(%rsp), %xmm0
	movss	%xmm0, (%r12)
	jmp	.LBB0_22
.LBB0_14:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$8, %esi
	movl	$1, %edx
	movq	%r13, %rdi
	callq	fread
	xorps	%xmm0, %xmm0
	cvtsd2ss	8(%rsp), %xmm0
	movq	136(%rsp), %rax
	jmp	.LBB0_15
.LBB0_16:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$8, %esi
	movl	$1, %edx
	movq	%r13, %rdi
	callq	fread
	xorps	%xmm0, %xmm0
	cvtsd2ss	8(%rsp), %xmm0
	movq	144(%rsp), %rax
	jmp	.LBB0_15
.LBB0_17:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$8, %esi
	movl	$1, %edx
	movq	%r13, %rdi
	callq	fread
	xorps	%xmm0, %xmm0
	cvtsd2ss	8(%rsp), %xmm0
	movq	152(%rsp), %rax
.LBB0_15:                               #   in Loop: Header=BB0_2 Depth=1
	movss	%xmm0, (%rax)
	jmp	.LBB0_22
.LBB0_18:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$4, %esi
	movl	$1, %edx
	movq	48(%rsp), %rdi                  # 8-byte Reload
	jmp	.LBB0_21
.LBB0_19:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$4, %esi
	movl	$1, %edx
	movq	32(%rsp), %rdi                  # 8-byte Reload
	jmp	.LBB0_21
.LBB0_20:                               #   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movl	$4, %esi
	movl	$1, %edx
	movq	24(%rsp), %rdi                  # 8-byte Reload
.LBB0_21:                               #   in Loop: Header=BB0_2 Depth=1
	callq	fread
.LBB0_22:                               #   in Loop: Header=BB0_2 Depth=1
	movw	$82, 4(%r14)
	movl	$1330795077, (%r14)             # imm = 0x4F525245
	movq	(%rbx), %rcx
	movl	$4, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	callq	fread
	movq	(%rbx), %rdi
	callq	feof
	testl	%eax, %eax
	je	.LBB0_2
.LBB0_23:                               # %._crit_edge
	xorl	%edi, %edi
	callq	exit
.LBB0_24:
	movq	32(%rsp), %rax                  # 8-byte Reload
	cmpl	$1, (%rax)
	jne	.LBB0_34
# %bb.25:
	movq	(%rbx), %rdi
	leaq	56(%rsp), %rsi
	callq	fgetpos
	movq	(%rbx), %rdi
	callq	ftell
	movq	%rax, %r14
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	movl	$2, %edx
	callq	fseek
	testl	%eax, %eax
	jne	.LBB0_33
# %bb.26:
	movq	(%rbx), %rdi
	callq	ftell
	cmpq	$-1, %rax
	je	.LBB0_33
# %bb.27:
	subq	%r14, %rax
	movq	24(%rsp), %rcx                  # 8-byte Reload
	movl	(%rcx), %ecx
	cmpl	$8, %ecx
	je	.LBB0_30
# %bb.28:
	cmpl	$32, %ecx
	jne	.LBB0_31
# %bb.29:
	shrq	$2, %rax
.LBB0_30:
	decl	%eax
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movl	%eax, (%rcx)
	jmp	.LBB0_32
.LBB0_31:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$.Lstr.2, %edi
	callq	puts@PLT
.LBB0_32:
	movq	(%rbx), %rdi
	leaq	56(%rsp), %rsi
	callq	fsetpos
	addq	$72, %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
.LBB0_33:
	.cfi_def_cfa_offset 128
	movl	$.Lstr.4, %edi
	jmp	.LBB0_35
.LBB0_34:
	movl	$.Lstr.5, %edi
.LBB0_35:
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_, .Lfunc_end0-_Z13get_file_dataPP8_IO_FILEPiS2_S2_S2_S2_PfS3_S3_S3_
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ERROR"
	.size	.L.str, 6

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"\n%d\t%s"
	.size	.L.str.1, 7

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"HEADER_END"
	.size	.L.str.2, 11

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"tsamp"
	.size	.L.str.3, 6

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"tstart"
	.size	.L.str.4, 7

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"fch1"
	.size	.L.str.5, 5

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"foff"
	.size	.L.str.6, 5

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"nchans"
	.size	.L.str.7, 7

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"nifs"
	.size	.L.str.8, 5

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"nbits"
	.size	.L.str.9, 6

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"nsamples"
	.size	.L.str.10, 9

	.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	"\n\n======================= ERROR ======================="
	.size	.Lstr, 56

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	" Currently this code only runs with 8 and 32 bit data"
	.size	.Lstr.1, 54

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\n====================================================="
	.size	.Lstr.2, 55

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"\nERROR!! Failed to seek to end of data file"
	.size	.Lstr.4, 44

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"\nERROR!! Can only work with one IF channel!"
	.size	.Lstr.5, 44

	.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
