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


#include "scrImagePgmPpmPackage.h"

void get_string_nocomments( FILE* fdin, char* s )
{
	int i,done;
	
	done=0;
	while( !done )
	{
		fscanf( fdin, "%s", s );
		for( i=0; !done; ++i )
		{
			if( (s)[i] == '#' )
			{
				fgets( s, 256, fdin );
				break;
			}
			if( ! isspace(s[i]) )
				done = 1; 
		}
	}
}

int scr_read_pgm( char* name, unsigned char* image, int irows, int icols )
{
	int i,j, range, rows, cols;
	unsigned char* tpt;
	char*	ins;
	char	imgtype[4], whitespace;
	FILE*	fdin;

	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		return 0;
	/*	fprintf( stderr, "cannot open file %s\n enter new name->", name );
		gets( name );
		if( (fdin=fopen(name,"r")) == NULL )
		{
			fprintf( stderr, "cannot open file %s either, aborting\n", name );
			exit(-1);
		}
	*/
	}

	fscanf( fdin, "%s", imgtype );

	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );
	if( (irows!=rows) || (cols!=icols) )
	{
		fprintf( stderr, ": rows or columns don't match for file %s\n", name );
		fprintf( stderr, ": read %d %d, expected %d %d \n", rows,cols,irows,icols );
	}
	if( (strcmp(imgtype,"P5")==0) || (strcmp(imgtype,"p5")==0) )
	{
		fscanf( fdin, "%c", &whitespace );
		/* read binary form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt++ )
			{
				if( EOF == fscanf(fdin,"%c",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else if( (strcmp(imgtype,"P2")==0) || (strcmp(imgtype,"p2")==0) )
	{
		/* its ascii form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt++ )
			{
				if( EOF == fscanf(fdin,"%d",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else
	{
		/* not p2 or p5 */
		fprintf( stderr, "ERROR, called read pgm_byte but %s not a P2 or P5 image\n", name );
	}
	free( ins );
	fclose( fdin );
	return 1;
}

void scr_write_pgm( char* name, unsigned char* image, int rows, int cols, char* comment )
{
	int i,j;
	unsigned char* tpt;
	char fname[256];
	FILE* fdout;

	if( strlen(name) < 1 )
	{
		fprintf( stderr, "Image write called withoutd filename\n" );
		fprintf( stderr, "Please input filename->" );
		scanf( "%s", fname );
	}
	else
		strcpy( fname, name );
	if( (fdout=fopen(fname,"wb")) == NULL )
	{
		fprintf( stderr, "cannot open file >>%s<< for output\n", fname );
		fprintf( stderr, "continuing without write\n" );
	}
	if( comment )
		fprintf( fdout, "P5\n#%s \n%d %d\n255\n", comment, cols, rows );
	else
		fprintf( fdout, "P5\n%d %d\n255\n", cols, rows );
	tpt = image;
	for( i=0; i<rows; i++ )
	{
		for( j=0; j<cols; j++ )
		{
			fprintf( fdout, "%c", (unsigned char)*tpt++ );
		}
	}
	fprintf( fdout, "\n" );
	fclose( fdout );
}

int scr_read_ppm( char* name, unsigned char* image, int irows, int icols )
{
	int i,j, range, rows, cols;
	unsigned char* tpt;
	char*	ins;
	char	imgtype[4], whitespace;
	FILE*	fdin;

	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		return 0;
/*		fprintf( stderr, "cannot open file %s\n enter new name->", name );
		gets( name );
		if( (fdin=fopen(name,"rb")) == NULL )
		{
			fprintf( stderr, "cannot open file %s either, aborting\n", name );
			exit(-1);
		}
*/
	}

	fscanf( fdin, "%s", imgtype );
	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );
	if( (irows!=rows) || (cols!=icols) )
	{
		fprintf( stderr, ": rows or columns don't match for file %s\n", name );
		fprintf( stderr, ": read %d %d, expected %d %d \n", rows,cols,irows,icols );
	}
	if( (strcmp(imgtype,"P6")==0) || (strcmp(imgtype,"p6")==0) )
	{
		fscanf( fdin, "%c", &whitespace );
		/* read binary form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt+=3 )
			{
				if( EOF == fscanf(fdin,"%c",tpt+2) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%c",tpt+1) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%c",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else if( (strcmp(imgtype,"P3")==0) || (strcmp(imgtype,"p3")==0) )
	{
		/* its ascii form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt+=3 )
			{
				if( EOF == fscanf(fdin,"%d",tpt+2) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%d",tpt+1) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%d",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else
	{
		/* not p3 or p6 */
		fprintf( stderr, "ERROR, called read pgm_byte but %s not a P3 or P6 image\n", name );
	}
	free( ins );
	fclose( fdin );
	return 1;
}

void scr_write_ppm( char* name, unsigned char* image, int rows, int cols, char* comment )
{
	int i,j;
	unsigned char* tpt;
	char fname[256];
	FILE* fdout;

	if( strlen(name) < 1 )
	{
		fprintf( stderr, "Image write called withoutd filename\n" );
		fprintf( stderr, "Please input filename->" );
		scanf( "%s", fname );
	}
	else
		strcpy( fname, name );
	if( (fdout=fopen(fname,"wb")) == NULL )
	{
		fprintf( stderr, "cannot open file >>%s<< for output\n", fname );
		fprintf( stderr, "continuing without write\n" );
	}
	if( comment )
		fprintf( fdout, "P6\n#%s \n%d %d\n255\n", comment, cols, rows );
	else
		fprintf( fdout, "P6\n%d %d\n255\n", cols, rows );
	// the order is r g b
	tpt = image;
	for( i=0; i<rows; ++i )
	{
		for( j=0; j<cols; ++j,tpt+=3 )
		{
			fprintf( fdout, "%c%c%c", (unsigned char)(*(tpt+2)), (unsigned char)(*(tpt+1)), (unsigned char)(*tpt) );
		}
	}
	fprintf( fdout, "\n" );
	fclose( fdout );
}

/*void get_PgmPpmParams(char* name, int *irows, int *icols )
{
	int range, rows, cols;
	char	imgtype[4];
	FILE*	fdin;

	if( (fdin=fopen(name,"rb")) == NULL )
	{
		printf("File %s is not available - check\n",name);
		exit(1);
	}

	fscanf( fdin, "%s", imgtype );

	getout_comment(fdin);
	fscanf(fdin,"%d",&cols);
	fscanf(fdin,"%d",&rows);
	fscanf(fdin,"%d",&range);

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );

	*irows = rows;
	*icols = cols;
	fclose(fdin);
}*/

void get_PgmPpmParams(char* name, int *irows, int *icols )
{
	int range, rows, cols;
	char	imgtype[4];
	char*	ins;
	FILE*	fdin;
	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		printf("File %s is not available - check\n",name);
		exit(1);
	}
	
	fscanf( fdin, "%s", imgtype );

	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );

	*irows = rows;
	*icols = cols;
	fclose(fdin);
}

void getout_comment(FILE* fdin)
{
	char c;

	c = fgetc(fdin);
	do 
		c = fgetc(fdin);
	while (c != '\n');
}


	.file	"tmpxft_00353c29_00000000-6_scrImagePgmPpmPackage.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
	.text
	.globl	_Z21get_string_nocommentsP8_IO_FILEPc
	.type	_Z21get_string_nocommentsP8_IO_FILEPc, @function
_Z21get_string_nocommentsP8_IO_FILEPc:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rsi, %rbx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L3:
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	movq	%rbx, %r12
.L5:
	movsbl	(%r12), %edi
	cmpb	$35, %dil
	jne	.L4
	movq	%rbp, %rcx
	movl	$256, %edx
	orq	$-1, %rsi
	movq	%rbx, %rdi
	call	__fgets_chk@PLT
	jmp	.L3
.L4:
	call	isspace@PLT
	incq	%r12
	testl	%eax, %eax
	jne	.L5
	popq	%rax
	.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
.LFE2027:
	.size	_Z21get_string_nocommentsP8_IO_FILEPc, .-_Z21get_string_nocommentsP8_IO_FILEPc
	.section	.rodata.str1.1
.LC1:
	.string	"rb"
.LC2:
	.string	"%d"
.LC3:
	.string	": negative rows or columns. Check!! %s"
.LC4:
	.string	": rows or columns don't match for file %s\n"
.LC5:
	.string	": read %d %d, expected %d %d \n"
.LC6:
	.string	"P5"
.LC7:
	.string	"p5"
.LC8:
	.string	"%c"
.LC9:
	.string	"WARNING!! .not enought bytes for %s, on r%d c%d\n"
.LC10:
	.string	"P2"
.LC11:
	.string	"p2"
.LC12:
	.string	"ERROR, called read pgm_byte but %s not a P2 or P5 image\n"
	.text
	.globl	_Z12scr_read_pgmPcPhii
	.type	_Z12scr_read_pgmPcPhii, @function
_Z12scr_read_pgmPcPhii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%edx, %r14d
	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
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
	movl	$257, %edi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	8(%rsp), %rdi
	leaq	.LC1(%rip), %rsi
	movq	%rax, (%rsp)
	call	fopen@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
	testq	%rbx, %rbx
	je	.L11
	leaq	36(%rsp), %r12
	leaq	.LC0(%rip), %rsi
	movq	%rbx, %rdi
	movq	%r12, %rdx
	leaq	.LC2(%rip), %r13
	call	__isoc23_fscanf@PLT
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	(%rsp), %rdi
	leaq	32(%rsp), %rdx
	xorl	%eax, %eax
	movq	%r13, %rsi
	call	__isoc23_sscanf@PLT
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	(%rsp), %rdi
	leaq	28(%rsp), %rdx
	xorl	%eax, %eax
	movq	%r13, %rsi
	call	__isoc23_sscanf@PLT
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	(%rsp), %rdi
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	movq	%r13, %rsi
	call	__isoc23_sscanf@PLT
	cmpl	$0, 28(%rsp)
	jle	.L13
	cmpl	$0, 32(%rsp)
	jg	.L14
.L13:
	movq	8(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L14:
	cmpl	%r14d, 28(%rsp)
	jne	.L15
	cmpl	%r15d, 32(%rsp)
	je	.L16
.L15:
	movq	8(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC4(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	movl	%r14d, %r9d
	leaq	.LC5(%rip), %rdx
	pushq	%rax
	.cfi_def_cfa_offset 120
	movl	$2, %esi
	xorl	%eax, %eax
	pushq	%r15
	.cfi_def_cfa_offset 128
	movl	48(%rsp), %r8d
	movl	44(%rsp), %ecx
	call	__fprintf_chk@PLT
	popq	%rdx
	.cfi_def_cfa_offset 120
	popq	%rcx
	.cfi_def_cfa_offset 112
.L16:
	leaq	.LC6(%rip), %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L17
	leaq	.LC7(%rip), %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L18
.L17:
	leaq	.LC8(%rip), %r12
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	leaq	23(%rsp), %rdx
	movq	%r12, %rsi
	leaq	.LC9(%rip), %r13
	call	__isoc23_fscanf@PLT
.L19:
	cmpl	%r15d, 28(%rsp)
	jle	.L23
	xorl	%r14d, %r14d
.L22:
	leaq	0(%rbp,%r14), %rdx
	cmpl	%r14d, 32(%rsp)
	jle	.L42
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L20
	movq	8(%rsp), %rcx
	movl	%r14d, %r9d
	movl	%r15d, %r8d
	movq	%r13, %rdx
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L20:
	incq	%r14
	jmp	.L22
.L42:
	incl	%r15d
	movq	%rdx, %rbp
	jmp	.L19
.L18:
	leaq	.LC10(%rip), %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L24
	leaq	.LC11(%rip), %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	.L25
.L24:
	leaq	.LC9(%rip), %r12
.L26:
	cmpl	%r14d, 28(%rsp)
	jle	.L23
	xorl	%r15d, %r15d
.L29:
	leaq	0(%rbp,%r15), %rdx
	cmpl	%r15d, 32(%rsp)
	jle	.L43
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L27
	movq	8(%rsp), %rcx
	movl	%r15d, %r9d
	movl	%r14d, %r8d
	movq	%r12, %rdx
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L27:
	incq	%r15
	jmp	.L29
.L43:
	incl	%r14d
	movq	%rdx, %rbp
	jmp	.L26
.L25:
	movq	8(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC12(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L23:
	movq	(%rsp), %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movl	$1, %eax
.L11:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	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
.LFE2028:
	.size	_Z12scr_read_pgmPcPhii, .-_Z12scr_read_pgmPcPhii
	.section	.rodata.str1.1
.LC13:
	.string	"Image write called withoutd filename\n"
.LC14:
	.string	"Please input filename->"
.LC15:
	.string	"wb"
.LC16:
	.string	"cannot open file >>%s<< for output\n"
.LC17:
	.string	"continuing without write\n"
.LC18:
	.string	"P5\n#%s \n%d %d\n255\n"
.LC19:
	.string	"P5\n%d %d\n255\n"
.LC20:
	.string	"\n"
	.text
	.globl	_Z13scr_write_pgmPcPhiiS_
	.type	_Z13scr_write_pgmPcPhiiS_, @function
_Z13scr_write_pgmPcPhiiS_:
.LFB2029:
	.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
	movq	%r8, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%ecx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$280, %rsp
	.cfi_def_cfa_offset 336
	movq	%fs:40, %rax
	movq	%rax, 264(%rsp)
	xorl	%eax, %eax
	cmpb	$0, (%rdi)
	leaq	8(%rsp), %r15
	jne	.L45
	movq	stderr(%rip), %rdi
	leaq	.LC13(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC14(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	%r15, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	jmp	.L46
.L45:
	movq	%rdi, %rsi
	movl	$256, %edx
	movq	%r15, %rdi
	call	__strcpy_chk@PLT
.L46:
	leaq	.LC15(%rip), %rsi
	movq	%r15, %rdi
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L47
	movq	stderr(%rip), %rdi
	leaq	.LC16(%rip), %rdx
	movq	%r15, %rcx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC17(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L47:
	testq	%r14, %r14
	je	.L48
	movl	%r12d, %r9d
	movl	%ebp, %r8d
	movq	%r14, %rcx
	movl	$2, %esi
	leaq	.LC18(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L50:
	xorl	%r14d, %r14d
	jmp	.L49
.L48:
	movl	%r12d, %r8d
	movl	%ebp, %ecx
	leaq	.LC19(%rip), %rdx
	movq	%rbx, %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L50
.L57:
	xorl	%eax, %eax
	testl	%ebp, %ebp
	cmovns	%rbp, %rax
	incl	%r14d
	addq	%rax, %r13
.L49:
	cmpl	%r12d, %r14d
	jge	.L56
	xorl	%r15d, %r15d
.L52:
	cmpl	%r15d, %ebp
	jle	.L57
	movzbl	0(%r13,%r15), %ecx
	movl	$2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rdx
	incq	%r15
	call	__fprintf_chk@PLT
	jmp	.L52
.L56:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movl	$2, %esi
	leaq	.LC20(%rip), %rdx
	call	__fprintf_chk@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	264(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	call	__stack_chk_fail@PLT
.L53:
	addq	$280, %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
.LFE2029:
	.size	_Z13scr_write_pgmPcPhiiS_, .-_Z13scr_write_pgmPcPhiiS_
	.section	.rodata.str1.1
.LC21:
	.string	"P6"
.LC22:
	.string	"p6"
.LC23:
	.string	"P3"
.LC24:
	.string	"p3"
.LC25:
	.string	"ERROR, called read pgm_byte but %s not a P3 or P6 image\n"
	.text
	.globl	_Z12scr_read_ppmPcPhii
	.type	_Z12scr_read_ppmPcPhii, @function
_Z12scr_read_ppmPcPhii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r15d
	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	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, (%rsp)
	movl	$257, %edi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	(%rsp), %rdi
	leaq	.LC1(%rip), %rsi
	movq	%rax, 8(%rsp)
	call	fopen@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
	testq	%rbx, %rbx
	je	.L58
	leaq	36(%rsp), %r14
	leaq	.LC0(%rip), %rsi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	leaq	.LC2(%rip), %r13
	call	__isoc23_fscanf@PLT
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	8(%rsp), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	leaq	32(%rsp), %rdx
	call	__isoc23_sscanf@PLT
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	8(%rsp), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	call	__isoc23_sscanf@PLT
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	24(%rsp), %rdx
	call	__isoc23_sscanf@PLT
	cmpl	$0, 28(%rsp)
	jle	.L60
	cmpl	$0, 32(%rsp)
	jg	.L61
.L60:
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L61:
	cmpl	%ebp, 28(%rsp)
	jne	.L62
	cmpl	%r15d, 32(%rsp)
	je	.L63
.L62:
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC4(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	movl	%ebp, %r9d
	leaq	.LC5(%rip), %rdx
	pushq	%rax
	.cfi_def_cfa_offset 120
	movl	$2, %esi
	xorl	%eax, %eax
	pushq	%r15
	.cfi_def_cfa_offset 128
	movl	48(%rsp), %r8d
	movl	44(%rsp), %ecx
	call	__fprintf_chk@PLT
	popq	%rdx
	.cfi_def_cfa_offset 120
	popq	%rcx
	.cfi_def_cfa_offset 112
.L63:
	leaq	.LC21(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L64
	leaq	.LC22(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L65
.L64:
	leaq	.LC8(%rip), %r14
	leaq	23(%rsp), %rdx
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	movq	%r14, %rsi
	movq	%rbx, %rdi
	leaq	.LC9(%rip), %r15
	call	__isoc23_fscanf@PLT
.L66:
	cmpl	%ebp, 28(%rsp)
	jle	.L72
	xorl	%r13d, %r13d
.L71:
	cmpl	%r13d, 32(%rsp)
	jle	.L93
	xorl	%eax, %eax
	leaq	2(%r12), %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L67
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r13d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L67:
	xorl	%eax, %eax
	leaq	1(%r12), %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L68
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r13d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L68:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L69
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r13d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L69:
	incl	%r13d
	addq	$3, %r12
	jmp	.L71
.L93:
	incl	%ebp
	jmp	.L66
.L65:
	leaq	.LC23(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L73
	leaq	.LC24(%rip), %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.L74
.L73:
	leaq	.LC9(%rip), %r15
.L75:
	cmpl	%ebp, 28(%rsp)
	jle	.L72
	xorl	%r14d, %r14d
.L80:
	cmpl	%r14d, 32(%rsp)
	jle	.L94
	xorl	%eax, %eax
	leaq	2(%r12), %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L76
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r14d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L76:
	xorl	%eax, %eax
	leaq	1(%r12), %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L77
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r14d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L77:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	jne	.L78
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	movl	%r14d, %r9d
	xorl	%eax, %eax
	movl	%ebp, %r8d
	movq	%r15, %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L78:
	incl	%r14d
	addq	$3, %r12
	jmp	.L80
.L94:
	incl	%ebp
	jmp	.L75
.L74:
	movq	(%rsp), %rcx
	movq	stderr(%rip), %rdi
	leaq	.LC25(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L72:
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movl	$1, %eax
.L58:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L82
	call	__stack_chk_fail@PLT
.L82:
	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
.LFE2030:
	.size	_Z12scr_read_ppmPcPhii, .-_Z12scr_read_ppmPcPhii
	.section	.rodata.str1.1
.LC26:
	.string	"P6\n#%s \n%d %d\n255\n"
.LC27:
	.string	"P6\n%d %d\n255\n"
.LC28:
	.string	"%c%c%c"
	.text
	.globl	_Z13scr_write_ppmPcPhiiS_
	.type	_Z13scr_write_ppmPcPhiiS_, @function
_Z13scr_write_ppmPcPhiiS_:
.LFB2031:
	.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
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%ecx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$296, %rsp
	.cfi_def_cfa_offset 352
	movq	%fs:40, %rax
	movq	%rax, 280(%rsp)
	xorl	%eax, %eax
	cmpb	$0, (%rdi)
	leaq	24(%rsp), %r15
	jne	.L96
	movq	stderr(%rip), %rdi
	leaq	.LC13(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC14(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	%r15, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	jmp	.L97
.L96:
	movq	%rdi, %rsi
	movl	$256, %edx
	movq	%r15, %rdi
	call	__strcpy_chk@PLT
.L97:
	leaq	.LC15(%rip), %rsi
	movq	%r15, %rdi
	call	fopen@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L98
	movq	stderr(%rip), %rdi
	leaq	.LC16(%rip), %rdx
	movq	%r15, %rcx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC17(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L98:
	testq	%rbp, %rbp
	je	.L99
	movl	%r13d, %r9d
	movl	%r12d, %r8d
	movq	%rbp, %rcx
	movl	$2, %esi
	leaq	.LC26(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L101:
	xorl	%ebp, %ebp
	testl	%r12d, %r12d
	cmovns	%r12, %rbp
	xorl	%r10d, %r10d
	leaq	0(%rbp,%rbp,2), %rbp
	jmp	.L100
.L99:
	movl	%r13d, %r8d
	movl	%r12d, %ecx
	leaq	.LC27(%rip), %rdx
	movq	%rbx, %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L101
.L108:
	addq	%rbp, %r14
	incl	%r10d
.L100:
	cmpl	%r13d, %r10d
	jge	.L107
	movq	%r14, %r15
	xorl	%r11d, %r11d
.L103:
	cmpl	%r12d, %r11d
	jge	.L108
	movzbl	2(%r15), %ecx
	movzbl	(%r15), %r9d
	movl	$2, %esi
	xorl	%eax, %eax
	movzbl	1(%r15), %r8d
	leaq	.LC28(%rip), %rdx
	movq	%rbx, %rdi
	movl	%r11d, 12(%rsp)
	movl	%r10d, 8(%rsp)
	addq	$3, %r15
	call	__fprintf_chk@PLT
	movl	12(%rsp), %r11d
	movl	8(%rsp), %r10d
	incl	%r11d
	jmp	.L103
.L107:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movl	$2, %esi
	leaq	.LC20(%rip), %rdx
	call	__fprintf_chk@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	280(%rsp), %rax
	subq	%fs:40, %rax
	je	.L104
	call	__stack_chk_fail@PLT
.L104:
	addq	$296, %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
.LFE2031:
	.size	_Z13scr_write_ppmPcPhiiS_, .-_Z13scr_write_ppmPcPhiiS_
	.section	.rodata.str1.1
.LC29:
	.string	"File %s is not available - check\n"
	.text
	.globl	_Z16get_PgmPpmParamsPcPiS0_
	.type	_Z16get_PgmPpmParamsPcPiS0_, @function
_Z16get_PgmPpmParamsPcPiS0_:
.LFB2032:
	.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
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	movl	$257, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L110
	movl	$2, %edi
	movq	%r12, %rdx
	leaq	.LC29(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L110:
	movq	%rax, %rbx
	leaq	20(%rsp), %rdx
	movq	%rax, %rdi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rsi
	leaq	.LC2(%rip), %r15
	call	__isoc23_fscanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	16(%rsp), %rdx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	12(%rsp), %rdx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	_Z21get_string_nocommentsP8_IO_FILEPc
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	call	__isoc23_sscanf@PLT
	cmpl	$0, 12(%rsp)
	jle	.L111
	cmpl	$0, 16(%rsp)
	jg	.L112
.L111:
	movq	stderr(%rip), %rdi
	movq	%r12, %rcx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdx
	call	__fprintf_chk@PLT
.L112:
	movl	12(%rsp), %eax
	movq	%rbx, %rdi
	movl	%eax, (%r14)
	movl	16(%rsp), %eax
	movl	%eax, 0(%r13)
	call	fclose@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L113
	call	__stack_chk_fail@PLT
.L113:
	addq	$40, %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
.LFE2032:
	.size	_Z16get_PgmPpmParamsPcPiS0_, .-_Z16get_PgmPpmParamsPcPiS0_
	.globl	_Z14getout_commentP8_IO_FILE
	.type	_Z14getout_commentP8_IO_FILE, @function
_Z14getout_commentP8_IO_FILE:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	fgetc@PLT
.L116:
	movq	%rbx, %rdi
	call	fgetc@PLT
	cmpb	$10, %al
	jne	.L116
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z14getout_commentP8_IO_FILE, .-_Z14getout_commentP8_IO_FILE
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2059:
	.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
.LFE2059:
	.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 <math.h>
#include <ctype.h>
#include <string.h>


#include "scrImagePgmPpmPackage.h"

void get_string_nocomments( FILE* fdin, char* s )
{
	int i,done;
	
	done=0;
	while( !done )
	{
		fscanf( fdin, "%s", s );
		for( i=0; !done; ++i )
		{
			if( (s)[i] == '#' )
			{
				fgets( s, 256, fdin );
				break;
			}
			if( ! isspace(s[i]) )
				done = 1; 
		}
	}
}

int scr_read_pgm( char* name, unsigned char* image, int irows, int icols )
{
	int i,j, range, rows, cols;
	unsigned char* tpt;
	char*	ins;
	char	imgtype[4], whitespace;
	FILE*	fdin;

	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		return 0;
	/*	fprintf( stderr, "cannot open file %s\n enter new name->", name );
		gets( name );
		if( (fdin=fopen(name,"r")) == NULL )
		{
			fprintf( stderr, "cannot open file %s either, aborting\n", name );
			exit(-1);
		}
	*/
	}

	fscanf( fdin, "%s", imgtype );

	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );
	if( (irows!=rows) || (cols!=icols) )
	{
		fprintf( stderr, ": rows or columns don't match for file %s\n", name );
		fprintf( stderr, ": read %d %d, expected %d %d \n", rows,cols,irows,icols );
	}
	if( (strcmp(imgtype,"P5")==0) || (strcmp(imgtype,"p5")==0) )
	{
		fscanf( fdin, "%c", &whitespace );
		/* read binary form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt++ )
			{
				if( EOF == fscanf(fdin,"%c",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else if( (strcmp(imgtype,"P2")==0) || (strcmp(imgtype,"p2")==0) )
	{
		/* its ascii form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt++ )
			{
				if( EOF == fscanf(fdin,"%d",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else
	{
		/* not p2 or p5 */
		fprintf( stderr, "ERROR, called read pgm_byte but %s not a P2 or P5 image\n", name );
	}
	free( ins );
	fclose( fdin );
	return 1;
}

void scr_write_pgm( char* name, unsigned char* image, int rows, int cols, char* comment )
{
	int i,j;
	unsigned char* tpt;
	char fname[256];
	FILE* fdout;

	if( strlen(name) < 1 )
	{
		fprintf( stderr, "Image write called withoutd filename\n" );
		fprintf( stderr, "Please input filename->" );
		scanf( "%s", fname );
	}
	else
		strcpy( fname, name );
	if( (fdout=fopen(fname,"wb")) == NULL )
	{
		fprintf( stderr, "cannot open file >>%s<< for output\n", fname );
		fprintf( stderr, "continuing without write\n" );
	}
	if( comment )
		fprintf( fdout, "P5\n#%s \n%d %d\n255\n", comment, cols, rows );
	else
		fprintf( fdout, "P5\n%d %d\n255\n", cols, rows );
	tpt = image;
	for( i=0; i<rows; i++ )
	{
		for( j=0; j<cols; j++ )
		{
			fprintf( fdout, "%c", (unsigned char)*tpt++ );
		}
	}
	fprintf( fdout, "\n" );
	fclose( fdout );
}

int scr_read_ppm( char* name, unsigned char* image, int irows, int icols )
{
	int i,j, range, rows, cols;
	unsigned char* tpt;
	char*	ins;
	char	imgtype[4], whitespace;
	FILE*	fdin;

	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		return 0;
/*		fprintf( stderr, "cannot open file %s\n enter new name->", name );
		gets( name );
		if( (fdin=fopen(name,"rb")) == NULL )
		{
			fprintf( stderr, "cannot open file %s either, aborting\n", name );
			exit(-1);
		}
*/
	}

	fscanf( fdin, "%s", imgtype );
	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );
	if( (irows!=rows) || (cols!=icols) )
	{
		fprintf( stderr, ": rows or columns don't match for file %s\n", name );
		fprintf( stderr, ": read %d %d, expected %d %d \n", rows,cols,irows,icols );
	}
	if( (strcmp(imgtype,"P6")==0) || (strcmp(imgtype,"p6")==0) )
	{
		fscanf( fdin, "%c", &whitespace );
		/* read binary form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt+=3 )
			{
				if( EOF == fscanf(fdin,"%c",tpt+2) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%c",tpt+1) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%c",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else if( (strcmp(imgtype,"P3")==0) || (strcmp(imgtype,"p3")==0) )
	{
		/* its ascii form */
		tpt = image;
		for( i=0; i<rows; i++ )
		{
			for( j=0; j<cols; j++,tpt+=3 )
			{
				if( EOF == fscanf(fdin,"%d",tpt+2) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%d",tpt+1) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
				if( EOF == fscanf(fdin,"%d",tpt) ) 
					fprintf( stderr, "WARNING!! .not enought bytes for %s, on r%d c%d\n", name,i,j );
			}
		}
	}
	else
	{
		/* not p3 or p6 */
		fprintf( stderr, "ERROR, called read pgm_byte but %s not a P3 or P6 image\n", name );
	}
	free( ins );
	fclose( fdin );
	return 1;
}

void scr_write_ppm( char* name, unsigned char* image, int rows, int cols, char* comment )
{
	int i,j;
	unsigned char* tpt;
	char fname[256];
	FILE* fdout;

	if( strlen(name) < 1 )
	{
		fprintf( stderr, "Image write called withoutd filename\n" );
		fprintf( stderr, "Please input filename->" );
		scanf( "%s", fname );
	}
	else
		strcpy( fname, name );
	if( (fdout=fopen(fname,"wb")) == NULL )
	{
		fprintf( stderr, "cannot open file >>%s<< for output\n", fname );
		fprintf( stderr, "continuing without write\n" );
	}
	if( comment )
		fprintf( fdout, "P6\n#%s \n%d %d\n255\n", comment, cols, rows );
	else
		fprintf( fdout, "P6\n%d %d\n255\n", cols, rows );
	// the order is r g b
	tpt = image;
	for( i=0; i<rows; ++i )
	{
		for( j=0; j<cols; ++j,tpt+=3 )
		{
			fprintf( fdout, "%c%c%c", (unsigned char)(*(tpt+2)), (unsigned char)(*(tpt+1)), (unsigned char)(*tpt) );
		}
	}
	fprintf( fdout, "\n" );
	fclose( fdout );
}

/*void get_PgmPpmParams(char* name, int *irows, int *icols )
{
	int range, rows, cols;
	char	imgtype[4];
	FILE*	fdin;

	if( (fdin=fopen(name,"rb")) == NULL )
	{
		printf("File %s is not available - check\n",name);
		exit(1);
	}

	fscanf( fdin, "%s", imgtype );

	getout_comment(fdin);
	fscanf(fdin,"%d",&cols);
	fscanf(fdin,"%d",&rows);
	fscanf(fdin,"%d",&range);

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );

	*irows = rows;
	*icols = cols;
	fclose(fdin);
}*/

void get_PgmPpmParams(char* name, int *irows, int *icols )
{
	int range, rows, cols;
	char	imgtype[4];
	char*	ins;
	FILE*	fdin;
	ins = (char*)malloc(257);
	if( (fdin=fopen(name,"rb")) == NULL )
	{
		printf("File %s is not available - check\n",name);
		exit(1);
	}
	
	fscanf( fdin, "%s", imgtype );

	get_string_nocomments( fdin, ins );
	sscanf( ins,"%d", &cols );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &rows );

	get_string_nocomments( fdin,ins );
	sscanf( ins, "%d", &range );

	if( (rows<=0) || (cols<=0) )
		fprintf( stderr, ": negative rows or columns. Check!! %s", name );

	*irows = rows;
	*icols = cols;
	fclose(fdin);
}

void getout_comment(FILE* fdin)
{
	char c;

	c = fgetc(fdin);
	do 
		c = fgetc(fdin);
	while (c != '\n');
}


	.text
	.file	"scrImagePgmPpmPackage.hip"
	.globl	_Z21get_string_nocommentsP8_IO_FILEPc # -- Begin function _Z21get_string_nocommentsP8_IO_FILEPc
	.type	_Z21get_string_nocommentsP8_IO_FILEPc,@function
_Z21get_string_nocommentsP8_IO_FILEPc:  # @_Z21get_string_nocommentsP8_IO_FILEPc
	.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
	movq	%rdi, %r14
.LBB0_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_2 Depth 2
	movl	$.L.str, %esi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%rbx, %r15
.LBB0_2:                                #   Parent Loop BB0_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsbl	(%r15), %edi
	cmpl	$35, %edi
	je	.LBB0_5
# %bb.3:                                # %select.unfold
                                        #   in Loop: Header=BB0_2 Depth=2
	callq	isspace
	incq	%r15
	testl	%eax, %eax
	jne	.LBB0_2
	jmp	.LBB0_4
.LBB0_5:                                # %.loopexit
                                        #   in Loop: Header=BB0_1 Depth=1
	movq	%rbx, %rdi
	movl	$256, %esi                      # imm = 0x100
	movq	%r14, %rdx
	callq	fgets
	jmp	.LBB0_1
.LBB0_4:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z21get_string_nocommentsP8_IO_FILEPc, .Lfunc_end0-_Z21get_string_nocommentsP8_IO_FILEPc
	.cfi_endproc
                                        # -- End function
	.globl	_Z12scr_read_pgmPcPhii          # -- Begin function _Z12scr_read_pgmPcPhii
	.type	_Z12scr_read_pgmPcPhii,@function
_Z12scr_read_pgmPcPhii:                 # @_Z12scr_read_pgmPcPhii
	.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
	movl	%ecx, %r13d
	movl	%edx, 16(%rsp)                  # 4-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r14
	movl	$257, %edi                      # imm = 0x101
	callq	malloc
	movq	%rax, %rbx
	movl	$.L.str.1, %esi
	movq	%r14, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB1_1
# %bb.2:
	movq	%rax, %r15
	movq	%rsp, %rdx
	movl	$.L.str, %esi
	movq	%rax, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	4(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	8(%rsp), %rbp
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movq	%rbp, %rdx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	20(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB1_4
# %bb.3:
	movl	4(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB1_4
.LBB1_5:
	cmpl	16(%rsp), %eax                  # 4-byte Folded Reload
	jne	.LBB1_7
# %bb.6:
	cmpl	%r13d, %ecx
	jne	.LBB1_7
.LBB1_8:
	movzwl	(%rsp), %eax
	xorl	$13648, %eax                    # imm = 0x3550
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB1_10
# %bb.9:
	movzwl	(%rsp), %eax
	xorl	$13680, %eax                    # imm = 0x3570
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB1_10
# %bb.19:
	movzwl	(%rsp), %eax
	xorl	$12880, %eax                    # imm = 0x3250
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB1_21
# %bb.20:
	movzwl	(%rsp), %eax
	xorl	$12912, %eax                    # imm = 0x3270
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	jne	.LBB1_30
.LBB1_21:
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB1_31
# %bb.22:                               # %.preheader55.preheader
	movl	4(%rsp), %eax
	xorl	%ebp, %ebp
.LBB1_23:                               # %.preheader55
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_25 Depth 2
	testl	%eax, %eax
	jle	.LBB1_29
# %bb.24:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_23 Depth=1
	xorl	%r13d, %r13d
.LBB1_25:                               # %.lr.ph
                                        #   Parent Loop BB1_23 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r12,%r13), %rdx
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB1_26
.LBB1_27:                               #   in Loop: Header=BB1_25 Depth=2
	movl	4(%rsp), %eax
	incq	%r13
	cmpl	%eax, %r13d
	jl	.LBB1_25
	jmp	.LBB1_28
.LBB1_26:                               #   in Loop: Header=BB1_25 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB1_27
.LBB1_28:                               # %._crit_edge.loopexit
                                        #   in Loop: Header=BB1_23 Depth=1
	movl	8(%rsp), %ecx
	addq	%r13, %r12
.LBB1_29:                               # %._crit_edge
                                        #   in Loop: Header=BB1_23 Depth=1
	incl	%ebp
	cmpl	%ecx, %ebp
	jl	.LBB1_23
	jmp	.LBB1_31
.LBB1_10:
	leaq	15(%rsp), %rdx
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB1_31
# %bb.11:                               # %.preheader.preheader
	movl	4(%rsp), %eax
	xorl	%ebp, %ebp
.LBB1_12:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_14 Depth 2
	testl	%eax, %eax
	jle	.LBB1_18
# %bb.13:                               # %.lr.ph63.preheader
                                        #   in Loop: Header=BB1_12 Depth=1
	xorl	%r13d, %r13d
.LBB1_14:                               # %.lr.ph63
                                        #   Parent Loop BB1_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r12,%r13), %rdx
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB1_15
.LBB1_16:                               #   in Loop: Header=BB1_14 Depth=2
	movl	4(%rsp), %eax
	incq	%r13
	cmpl	%eax, %r13d
	jl	.LBB1_14
	jmp	.LBB1_17
.LBB1_15:                               #   in Loop: Header=BB1_14 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB1_16
.LBB1_17:                               # %._crit_edge64.loopexit
                                        #   in Loop: Header=BB1_12 Depth=1
	movl	8(%rsp), %ecx
	addq	%r13, %r12
.LBB1_18:                               # %._crit_edge64
                                        #   in Loop: Header=BB1_12 Depth=1
	incl	%ebp
	cmpl	%ecx, %ebp
	jl	.LBB1_12
.LBB1_31:                               # %.loopexit
	movq	%rbx, %rdi
	callq	free
	movq	%r15, %rdi
	callq	fclose
	movl	$1, %eax
	jmp	.LBB1_32
.LBB1_1:
	xorl	%eax, %eax
.LBB1_32:
	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
.LBB1_4:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rdi
	movl	$.L.str.3, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	8(%rsp), %eax
	movl	4(%rsp), %ecx
	jmp	.LBB1_5
.LBB1_7:
	movq	stderr(%rip), %rdi
	movl	$.L.str.4, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rdi
	movl	8(%rsp), %edx
	movl	4(%rsp), %ecx
	movl	$.L.str.5, %esi
	movl	16(%rsp), %r8d                  # 4-byte Reload
	movl	%r13d, %r9d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB1_8
.LBB1_30:
	movq	stderr(%rip), %rdi
	movl	$.L.str.12, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB1_31
.Lfunc_end1:
	.size	_Z12scr_read_pgmPcPhii, .Lfunc_end1-_Z12scr_read_pgmPcPhii
	.cfi_endproc
                                        # -- End function
	.globl	_Z13scr_write_pgmPcPhiiS_       # -- Begin function _Z13scr_write_pgmPcPhiiS_
	.type	_Z13scr_write_pgmPcPhiiS_,@function
_Z13scr_write_pgmPcPhiiS_:              # @_Z13scr_write_pgmPcPhiiS_
	.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	$264, %rsp                      # imm = 0x108
	.cfi_def_cfa_offset 320
	.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	%r8, %r12
	movl	%ecx, %ebx
	movl	%edx, %ebp
	movq	%rsi, %r14
	cmpb	$0, (%rdi)
	je	.LBB2_1
# %bb.2:
	movq	%rdi, %rsi
	movq	%rsp, %rdi
	callq	strcpy
.LBB2_3:
	movq	%rsp, %rdi
	movl	$.L.str.15, %esi
	callq	fopen
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB2_4
.LBB2_5:
	testq	%r12, %r12
	je	.LBB2_7
# %bb.6:
	movl	$.L.str.18, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	movl	%ebx, %ecx
	movl	%ebp, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB2_8
.LBB2_7:
	movl	$.L.str.19, %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	movl	%ebp, %ecx
	xorl	%eax, %eax
	callq	fprintf
.LBB2_8:
	testl	%ebp, %ebp
	jle	.LBB2_14
# %bb.9:                                # %.preheader.lr.ph
	xorl	%r12d, %r12d
.LBB2_10:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_12 Depth 2
	testl	%ebx, %ebx
	jle	.LBB2_13
# %bb.11:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB2_10 Depth=1
	movl	%ebx, %r13d
.LBB2_12:                               # %.lr.ph
                                        #   Parent Loop BB2_10 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movzbl	(%r14), %edi
	incq	%r14
	movq	%r15, %rsi
	callq	fputc@PLT
	decl	%r13d
	jne	.LBB2_12
.LBB2_13:                               # %._crit_edge
                                        #   in Loop: Header=BB2_10 Depth=1
	incl	%r12d
	cmpl	%ebp, %r12d
	jne	.LBB2_10
.LBB2_14:                               # %._crit_edge28
	movl	$10, %edi
	movq	%r15, %rsi
	callq	fputc@PLT
	movq	%r15, %rdi
	callq	fclose
	addq	$264, %rsp                      # imm = 0x108
	.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
.LBB2_1:
	.cfi_def_cfa_offset 320
	movq	stderr(%rip), %rcx
	movl	$.L.str.13, %edi
	movl	$37, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	stderr(%rip), %rcx
	movl	$.L.str.14, %edi
	movl	$23, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	%rsp, %rsi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	jmp	.LBB2_3
.LBB2_4:
	movq	stderr(%rip), %rdi
	movq	%rsp, %rdx
	movl	$.L.str.16, %esi
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rcx
	movl	$.L.str.17, %edi
	movl	$25, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	jmp	.LBB2_5
.Lfunc_end2:
	.size	_Z13scr_write_pgmPcPhiiS_, .Lfunc_end2-_Z13scr_write_pgmPcPhiiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z12scr_read_ppmPcPhii          # -- Begin function _Z12scr_read_ppmPcPhii
	.type	_Z12scr_read_ppmPcPhii,@function
_Z12scr_read_ppmPcPhii:                 # @_Z12scr_read_ppmPcPhii
	.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
	movl	%ecx, %r13d
	movl	%edx, 16(%rsp)                  # 4-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r14
	movl	$257, %edi                      # imm = 0x101
	callq	malloc
	movq	%rax, %rbx
	movl	$.L.str.1, %esi
	movq	%r14, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB3_1
# %bb.2:
	movq	%rax, %r15
	movq	%rsp, %rdx
	movl	$.L.str, %esi
	movq	%rax, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	4(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	8(%rsp), %rbp
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movq	%rbp, %rdx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	20(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB3_4
# %bb.3:
	movl	4(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB3_4
.LBB3_5:
	cmpl	16(%rsp), %eax                  # 4-byte Folded Reload
	jne	.LBB3_7
# %bb.6:
	cmpl	%r13d, %ecx
	jne	.LBB3_7
.LBB3_8:
	movzwl	(%rsp), %eax
	xorl	$13904, %eax                    # imm = 0x3650
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB3_10
# %bb.9:
	movzwl	(%rsp), %eax
	xorl	$13936, %eax                    # imm = 0x3670
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB3_10
# %bb.23:
	movzwl	(%rsp), %eax
	xorl	$13136, %eax                    # imm = 0x3350
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	je	.LBB3_25
# %bb.24:
	movzwl	(%rsp), %eax
	xorl	$13168, %eax                    # imm = 0x3370
	movzbl	2(%rsp), %ecx
	orw	%ax, %cx
	jne	.LBB3_38
.LBB3_25:
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB3_39
# %bb.26:                               # %.preheader75.preheader
	movl	4(%rsp), %eax
	xorl	%ebp, %ebp
.LBB3_27:                               # %.preheader75
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_29 Depth 2
	testl	%eax, %eax
	jle	.LBB3_37
# %bb.28:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB3_27 Depth=1
	xorl	%r13d, %r13d
.LBB3_29:                               # %.lr.ph
                                        #   Parent Loop BB3_27 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	2(%r12), %rdx
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_30
.LBB3_31:                               #   in Loop: Header=BB3_29 Depth=2
	leaq	1(%r12), %rdx
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_32
.LBB3_33:                               #   in Loop: Header=BB3_29 Depth=2
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_34
.LBB3_35:                               #   in Loop: Header=BB3_29 Depth=2
	incl	%r13d
	addq	$3, %r12
	movl	4(%rsp), %eax
	cmpl	%eax, %r13d
	jl	.LBB3_29
	jmp	.LBB3_36
.LBB3_30:                               #   in Loop: Header=BB3_29 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_31
.LBB3_32:                               #   in Loop: Header=BB3_29 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_33
.LBB3_34:                               #   in Loop: Header=BB3_29 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_35
.LBB3_36:                               # %._crit_edge.loopexit
                                        #   in Loop: Header=BB3_27 Depth=1
	movl	8(%rsp), %ecx
.LBB3_37:                               # %._crit_edge
                                        #   in Loop: Header=BB3_27 Depth=1
	incl	%ebp
	cmpl	%ecx, %ebp
	jl	.LBB3_27
	jmp	.LBB3_39
.LBB3_10:
	leaq	15(%rsp), %rdx
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB3_39
# %bb.11:                               # %.preheader.preheader
	movl	4(%rsp), %eax
	xorl	%ebp, %ebp
.LBB3_12:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_14 Depth 2
	testl	%eax, %eax
	jle	.LBB3_22
# %bb.13:                               # %.lr.ph83.preheader
                                        #   in Loop: Header=BB3_12 Depth=1
	xorl	%r13d, %r13d
.LBB3_14:                               # %.lr.ph83
                                        #   Parent Loop BB3_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	2(%r12), %rdx
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_15
.LBB3_16:                               #   in Loop: Header=BB3_14 Depth=2
	leaq	1(%r12), %rdx
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_17
.LBB3_18:                               #   in Loop: Header=BB3_14 Depth=2
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB3_19
.LBB3_20:                               #   in Loop: Header=BB3_14 Depth=2
	incl	%r13d
	addq	$3, %r12
	movl	4(%rsp), %eax
	cmpl	%eax, %r13d
	jl	.LBB3_14
	jmp	.LBB3_21
.LBB3_15:                               #   in Loop: Header=BB3_14 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_16
.LBB3_17:                               #   in Loop: Header=BB3_14 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_18
.LBB3_19:                               #   in Loop: Header=BB3_14 Depth=2
	movq	stderr(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%r14, %rdx
	movl	%ebp, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_20
.LBB3_21:                               # %._crit_edge84.loopexit
                                        #   in Loop: Header=BB3_12 Depth=1
	movl	8(%rsp), %ecx
.LBB3_22:                               # %._crit_edge84
                                        #   in Loop: Header=BB3_12 Depth=1
	incl	%ebp
	cmpl	%ecx, %ebp
	jl	.LBB3_12
.LBB3_39:                               # %.loopexit
	movq	%rbx, %rdi
	callq	free
	movq	%r15, %rdi
	callq	fclose
	movl	$1, %eax
	jmp	.LBB3_40
.LBB3_1:
	xorl	%eax, %eax
.LBB3_40:
	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
.LBB3_4:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rdi
	movl	$.L.str.3, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	8(%rsp), %eax
	movl	4(%rsp), %ecx
	jmp	.LBB3_5
.LBB3_7:
	movq	stderr(%rip), %rdi
	movl	$.L.str.4, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rdi
	movl	8(%rsp), %edx
	movl	4(%rsp), %ecx
	movl	$.L.str.5, %esi
	movl	16(%rsp), %r8d                  # 4-byte Reload
	movl	%r13d, %r9d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_8
.LBB3_38:
	movq	stderr(%rip), %rdi
	movl	$.L.str.25, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB3_39
.Lfunc_end3:
	.size	_Z12scr_read_ppmPcPhii, .Lfunc_end3-_Z12scr_read_ppmPcPhii
	.cfi_endproc
                                        # -- End function
	.globl	_Z13scr_write_ppmPcPhiiS_       # -- Begin function _Z13scr_write_ppmPcPhiiS_
	.type	_Z13scr_write_ppmPcPhiiS_,@function
_Z13scr_write_ppmPcPhiiS_:              # @_Z13scr_write_ppmPcPhiiS_
	.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	$264, %rsp                      # imm = 0x108
	.cfi_def_cfa_offset 320
	.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	%r8, %r12
	movl	%ecx, %ebx
	movl	%edx, %ebp
	movq	%rsi, %r14
	cmpb	$0, (%rdi)
	je	.LBB4_1
# %bb.2:
	movq	%rdi, %rsi
	movq	%rsp, %rdi
	callq	strcpy
.LBB4_3:
	movq	%rsp, %rdi
	movl	$.L.str.15, %esi
	callq	fopen
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB4_4
.LBB4_5:
	testq	%r12, %r12
	je	.LBB4_7
# %bb.6:
	movl	$.L.str.26, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	movl	%ebx, %ecx
	movl	%ebp, %r8d
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB4_8
.LBB4_7:
	movl	$.L.str.27, %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	movl	%ebp, %ecx
	xorl	%eax, %eax
	callq	fprintf
.LBB4_8:
	testl	%ebp, %ebp
	jle	.LBB4_14
# %bb.9:                                # %.preheader.lr.ph
	xorl	%r12d, %r12d
.LBB4_10:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_12 Depth 2
	testl	%ebx, %ebx
	jle	.LBB4_13
# %bb.11:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB4_10 Depth=1
	movl	%ebx, %r13d
.LBB4_12:                               # %.lr.ph
                                        #   Parent Loop BB4_10 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movzbl	2(%r14), %edx
	movzbl	1(%r14), %ecx
	movzbl	(%r14), %r8d
	movl	$.L.str.28, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	fprintf
	addq	$3, %r14
	decl	%r13d
	jne	.LBB4_12
.LBB4_13:                               # %._crit_edge
                                        #   in Loop: Header=BB4_10 Depth=1
	incl	%r12d
	cmpl	%ebp, %r12d
	jne	.LBB4_10
.LBB4_14:                               # %._crit_edge30
	movl	$10, %edi
	movq	%r15, %rsi
	callq	fputc@PLT
	movq	%r15, %rdi
	callq	fclose
	addq	$264, %rsp                      # imm = 0x108
	.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
.LBB4_1:
	.cfi_def_cfa_offset 320
	movq	stderr(%rip), %rcx
	movl	$.L.str.13, %edi
	movl	$37, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	stderr(%rip), %rcx
	movl	$.L.str.14, %edi
	movl	$23, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movq	%rsp, %rsi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	jmp	.LBB4_3
.LBB4_4:
	movq	stderr(%rip), %rdi
	movq	%rsp, %rdx
	movl	$.L.str.16, %esi
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rcx
	movl	$.L.str.17, %edi
	movl	$25, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	jmp	.LBB4_5
.Lfunc_end4:
	.size	_Z13scr_write_ppmPcPhiiS_, .Lfunc_end4-_Z13scr_write_ppmPcPhiiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z16get_PgmPpmParamsPcPiS0_     # -- Begin function _Z16get_PgmPpmParamsPcPiS0_
	.type	_Z16get_PgmPpmParamsPcPiS0_,@function
_Z16get_PgmPpmParamsPcPiS0_:            # @_Z16get_PgmPpmParamsPcPiS0_
	.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	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	movl	$257, %edi                      # imm = 0x101
	callq	malloc
	movq	%rax, %r13
	movl	$.L.str.1, %esi
	movq	%r15, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_5
# %bb.1:
	movq	%rax, %r12
	leaq	20(%rsp), %rdx
	movl	$.L.str, %esi
	movq	%rax, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	8(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	12(%rsp), %rbp
	movl	$.L.str.2, %esi
	movq	%r13, %rdi
	movq	%rbp, %rdx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_Z21get_string_nocommentsP8_IO_FILEPc
	leaq	16(%rsp), %rdx
	movl	$.L.str.2, %esi
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB5_3
# %bb.2:
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.LBB5_3
.LBB5_4:
	movl	%eax, (%r14)
	movl	%ecx, (%rbx)
	movq	%r12, %rdi
	callq	fclose
	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
.LBB5_3:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rdi
	movl	$.L.str.3, %esi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	12(%rsp), %eax
	movl	8(%rsp), %ecx
	jmp	.LBB5_4
.LBB5_5:
	movl	$.L.str.29, %edi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end5:
	.size	_Z16get_PgmPpmParamsPcPiS0_, .Lfunc_end5-_Z16get_PgmPpmParamsPcPiS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z14getout_commentP8_IO_FILE    # -- Begin function _Z14getout_commentP8_IO_FILE
	.type	_Z14getout_commentP8_IO_FILE,@function
_Z14getout_commentP8_IO_FILE:           # @_Z14getout_commentP8_IO_FILE
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	callq	fgetc
.LBB6_1:                                # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	fgetc
	cmpb	$10, %al
	jne	.LBB6_1
# %bb.2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z14getout_commentP8_IO_FILE, .Lfunc_end6-_Z14getout_commentP8_IO_FILE
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%s"
	.size	.L.str, 3

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"rb"
	.size	.L.str.1, 3

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%d"
	.size	.L.str.2, 3

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	": negative rows or columns. Check!! %s"
	.size	.L.str.3, 39

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	": rows or columns don't match for file %s\n"
	.size	.L.str.4, 43

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	": read %d %d, expected %d %d \n"
	.size	.L.str.5, 31

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

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"%c"
	.size	.L.str.8, 3

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"WARNING!! .not enought bytes for %s, on r%d c%d\n"
	.size	.L.str.9, 49

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"P2"
	.size	.L.str.10, 3

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"p2"
	.size	.L.str.11, 3

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"ERROR, called read pgm_byte but %s not a P2 or P5 image\n"
	.size	.L.str.12, 57

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Image write called withoutd filename\n"
	.size	.L.str.13, 38

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Please input filename->"
	.size	.L.str.14, 24

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"wb"
	.size	.L.str.15, 3

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"cannot open file >>%s<< for output\n"
	.size	.L.str.16, 36

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"continuing without write\n"
	.size	.L.str.17, 26

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"P5\n#%s \n%d %d\n255\n"
	.size	.L.str.18, 19

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"P5\n%d %d\n255\n"
	.size	.L.str.19, 14

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"P6"
	.size	.L.str.21, 3

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"p6"
	.size	.L.str.22, 3

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"P3"
	.size	.L.str.23, 3

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"p3"
	.size	.L.str.24, 3

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"ERROR, called read pgm_byte but %s not a P3 or P6 image\n"
	.size	.L.str.25, 57

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	"P6\n#%s \n%d %d\n255\n"
	.size	.L.str.26, 19

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"P6\n%d %d\n255\n"
	.size	.L.str.27, 14

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"%c%c%c"
	.size	.L.str.28, 7

	.type	.L.str.29,@object               # @.str.29
.L.str.29:
	.asciz	"File %s is not available - check\n"
	.size	.L.str.29, 34

	.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
