#include <iostream>
#include <math.h>
#include <fstream>
#include <vector>
#include <sstream>
#include <time.h>
#include <stdlib.h>

// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>

using namespace std;

const int THREADS_PER_BLOCK = 256;

/**
 * CUDA Kernel Device code
 */ 
/*****************************************************************************/

__global__ void scaleImageCuda (int *pixels, int minpix, int maxpix, int imageSize) {
	/* blockDim.x gives the number of threads per block, combining it
	with threadIdx.x and blockIdx.x gives the index of each global
	thread in the device */
	int index = (blockDim.x * blockIdx.x) + threadIdx.x;
	int value;
	/* Typical problems are not friendly multiples of blockDim.x.
	Avoid accesing data beyond the end of the arrays */
	if (index < imageSize) {
		value = round(((double)(pixels[index] - minpix) / (maxpix - minpix)) * 255);
		pixels[index] = value;
	}

    __syncthreads();
}

__global__ void edgeDetectionCuda (int *pixels, int *tempImage, int width, int height, int imageSize) {
	/* blockDim.x gives the number of threads per block, combining it
	with threadIdx.x and blockIdx.x gives the index of each global
	thread in the device */
	int index = (blockDim.x * blockIdx.x) + threadIdx.x;
	int x = 0, y = 0;
	int xG = 0, yG = 0;

	/* Typical problems are not friendly multiples of blockDim.x.
	Avoid accesing data beyond the end of the arrays */
	if (index < imageSize) {
		x = index % width;

		if (index != 0) {
			y = __double2int_rd((__int2double_rn(index) / __int2double_rn(width)));	
		}
		
		if (x < (width - 1) && y < (height - 1)
				&& (y > 0) && (x > 0)) {

			//index = x + (y * width)
			//Finds the horizontal gradient
			xG = (pixels[(x+1) + ((y-1) * width)]
						 + (2 * pixels[(x+1) + (y * width)])
						 + pixels[(x+1) + ((y+1) * width)]
								  - pixels[(x-1) + ((y-1) * width)]
										   - (2 * pixels[(x-1) + (y * width)])
										   - pixels[(x-1) + ((y+1) * width)]);

			//Finds the vertical gradient
			yG = (pixels[(x-1) + ((y+1) * width)]
						 + (2 * pixels[(x) + ((y + 1) * width)])
						 + pixels[(x+1) + ((y+1) * width)]
								  - pixels[(x-1) + ((y-1) * width)]
										   - (2 * pixels[(x) + ((y-1) * width)])
										   - pixels[(x+1) + ((y-1) * width)]);
			tempImage[index] = __double2int_rn(sqrt(__int2double_rn(xG * xG) + __int2double_rn(yG * yG)));

		} else {

			//Pads out of bound pixels with 0
			tempImage[index] = 0;

		}
	}

    //__syncthreads();
}

//Creating image class (base class)
class Image{

public:

	Image():
		height(0),
		width(0),
		maxPixelValue(0),
		minpix(0),
		maxpix(0),
		imageSize(0){}
	virtual ~Image(){}

	virtual void readImage(ifstream &inFile) = 0;
	virtual void writeImage(ofstream &outFile) = 0;

	void readHeader(ifstream &inFile);
	void scaleImage();
	void edgeDection();

	//Accessor methods
	int getHeight(){return height;}
	int getWidth(){return width;}
	int getMaxPixelValue(){return maxPixelValue;}

	//Mutator methods
	void setHeight(int h){height = h;}
	void setWidth(int w){width = w;}
	void setMaxPixelValue(int mpv){maxPixelValue = mpv;}

	//Member variables
protected:

	int height;
	int width;
	int maxPixelValue;
	int minpix;
	int maxpix;
	unsigned int imageSize;
	int * pixels;

	inline void findMin();
	inline void findMax();

};

//Binary image class (derived class)

class BinaryImage: public Image{

public:

	BinaryImage(){}
	~BinaryImage(){}

	void readImage(ifstream &inFile);
	void writeImage(ofstream &outFile);

};

class AsciiImage: public Image{

public:

	AsciiImage(){}
	~AsciiImage(){}

	void readImage(ifstream &infile);
	void writeImage(ofstream &outFile);

};

//Check if header contains comments
//Comments start with #
bool isComment(string comment){

	for(unsigned int i = 0; i < comment.length(); i++){

		if(comment[i] == '#') return true;

		if(!isspace(comment[i])) return false;

	}

	return true;
}

//Reads binary pixel values in image
void BinaryImage::readImage(ifstream &inFile){

	//Check if the file stream in open
	if(!inFile){

		cerr << "Could not read from file!" << endl;

		exit(1000);

	}

	//Making a temp array, and putting it on the heap
	char * byteArray = new char[imageSize + 1];

	//Read the bytes of the image, and puts data in byteArray
	inFile.read(byteArray, imageSize);

	//If reading in the data failed, return an error
	if(inFile.fail()){

		cerr << "Error: cannot read pixels." << endl;

		exit(1000);

	}

	//Set the last element in array to EOF character
	byteArray[imageSize] = '\0';

	//Put the data read from file into pixels
	pixels = (int *)malloc(imageSize * sizeof(int));
	for(unsigned int i = 0; i < imageSize; i++){

		pixels[i] = static_cast<int>
		(static_cast<unsigned char>(byteArray[i]));

	}

	//Delete the byteArray
	free(byteArray);

}

//Writes binary pixels to output file
void BinaryImage::writeImage(ofstream &outFile){

	//Check if the file stream is open
	if(!outFile){

		cerr << "Could not write to file." << endl;

		exit(1000);

	}

	//Write header
	outFile << "P5"       << " "  <<
			width         << " "  <<
			height        << " "  <<
			maxPixelValue << endl;

	//Take all pixel values from pixels and writes it to output file
	char * byteArray = new char[imageSize + 1];

	for(unsigned int i = 0; i < imageSize; i++){

		byteArray[i] = static_cast<char>(pixels[i]);

	}

	byteArray[imageSize] = '\0';

	outFile.write(byteArray, imageSize);

	if(outFile.fail()){

		cerr << "Error: error writing to file." << endl;

		exit(1000);

	}

	free(byteArray);
	free(pixels);
	//delete[] byteArray;

}

void AsciiImage::readImage(ifstream &inFile){

	//Check if the file opened properly
	if(!inFile){

		cerr << "Could not read from file." << endl;

		exit(1001);

	}

	int pixelValue;

	//Read in the Ascii values from file
	int i = 0;
	while(inFile >> pixelValue){

		pixels[i] = pixelValue;
		i++;

	}


}


void AsciiImage::writeImage(ofstream &outFile){

	//Check if file is open
	if(!outFile){

		cerr << "Could not write to file." << endl;

		exit(1001);

	}

	//Write Header
	outFile << "P2" << ' ' <<
			width << ' ' <<
			height << ' ' <<
			maxPixelValue << '\n';

	//Write the contents of pixels to the output file
	for(unsigned int i = 0; i < imageSize; i++){

		//Add a '\n' at the end of each row
		if(i % width == 0 && i != 0) outFile << '\n';

		outFile << pixels[i] << '\t';

	}

	free(pixels);
}

void Image::readHeader(ifstream &inFile){

	stringstream sStream;

	string line;

	//Check if the file opened successfully
	if(!inFile){

		cerr << "Error: Could not open file." << endl;

		exit(1002);

	}

	char readChar;

	string errorMessage = "Error: incorrect picture format.";

	getline(inFile, line);

	unsigned int lineSize = line.length();

	//After we read magic number, we read the next line and determine if it's valid
	for(unsigned int i = 0; i < lineSize; i++){

		if(!isspace(line[i])){

			cerr << errorMessage << endl;

			cerr << "Extra info after magic number." << endl;

			exit(1002);

		}

	}

	//Read through the rest of the header and skip through comments
	while(getline(inFile, line)){

		if(!(isComment(line))) break;

	}

	sStream << line;

	//Read in width.
	//If there is a problem, return error
	if(!(sStream >> width)){

		cerr << errorMessage << endl;

		cerr << "Cannot read width." << endl;

		exit(1002);

	}

	//Read in height
	//If there is a problem, return error
	if(!(sStream >> height)){

		cerr << errorMessage << endl;

		cerr << "Cannot read height." << endl;

		exit(1002);

	}

	//Check if there is extra information after width and height
	while(sStream >> readChar){

		if(!(isspace(readChar))){

			cerr << errorMessage << endl;

			cerr << "Extra info when reading height and width." << endl;

			exit(1002);

		}

	}

	//Make sure the height and width is positive
	if(width <= 0 || height <= 0){

		cerr << "Error: width and height cannot be negative" << endl;

		exit(1002);

	}

	//Check if there are any comments between height/width and maxPixelValue
	while(getline(inFile, line)){

		if(!(isComment(line))) break;

	}

	//Clear out the string stream
	sStream.str("");
	sStream.clear();

	sStream << line;

	//Read in the maxPixelValue
	if(!(sStream >> maxPixelValue)){

		cerr << errorMessage << endl;
		cerr << "Could not read maxPixelValue." << endl;

		exit(1002);

	}

	//Check if there is extra information after maxPixelValue
	while(sStream >> readChar){

		if(!(isspace(readChar))){

			cerr << errorMessage << endl;
			cerr << "Extra info after the max pixel value." << endl;

			exit(1002);

		}

	}

	if(maxPixelValue < 0 || maxPixelValue > 255){

		cerr << errorMessage << endl;
		cerr << "Invalid max pixel value." << endl;

		exit(1002);

	}

	imageSize = width * height;

}

//Finds the maxium pixel value in the image
void Image::findMax(){

	int maxVal = 0;

	for(unsigned int i = 0; i < imageSize; i++){

		if(pixels[i] > maxVal){

			maxVal = pixels[i];

		}

	}

	maxpix = maxVal;

}

//Finds the minimal pixel value of the image
void Image::findMin(){

	int minVal = 255;

	for(unsigned int i = 0; i < imageSize; i++){

		if(pixels[i] < minVal){

			minVal = pixels[i];

		}

	}

	minpix = minVal;

}

//Scales image so that the maximum pixel value is 255
void Image::scaleImage(){

	findMin();

	findMax();

	int *d_pixels;
	size_t size = imageSize * sizeof(int);
    cudaError_t err = cudaSuccess;

	/* Allocate memory in device */
	err = cudaMalloc((void **) &d_pixels, size);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to allocate device vector pixels (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to device */
	err = cudaMemcpy(d_pixels, pixels, size, cudaMemcpyHostToDevice);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to copy vector pixels from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Launch scaleImageCuda() kernel on device with N threads in N blocks */
	int blocks = (imageSize + (THREADS_PER_BLOCK - 1)) / THREADS_PER_BLOCK;
	scaleImageCuda<<<blocks, THREADS_PER_BLOCK>>>(d_pixels, minpix, maxpix, imageSize);
    err = cudaGetLastError();
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to launch scaleImageCuda kernel (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to tohost device */
	err = cudaMemcpy(pixels, d_pixels, size, cudaMemcpyDeviceToHost);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to copy vector pixels from device to host (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Clean-up */
	err = cudaFree(d_pixels);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to free device vector pixels (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = cudaDeviceReset();
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to deinitialize the device! error=%s\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	maxPixelValue = 255;

}

//Sobel edge detection function - detects edges and draws an outline
void Image::edgeDection(){
    cudaError_t err = cudaSuccess;
	size_t size = imageSize * sizeof(int);
	/* Allocate memory in host */
	int *tempImage = (int *)malloc(size);

	int *d_pixels, *d_tempImage;
	/* Allocate memory in device */
	err = cudaMalloc((void **) &d_pixels, size);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to allocate device array pixels (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = cudaMalloc((void **) &d_tempImage, size);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to allocate device array tempImage (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
	}

	/* Copy data to device */
	err = cudaMemcpy(d_pixels, pixels, size, cudaMemcpyHostToDevice);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to copy array pixels from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = cudaMemcpy(d_tempImage, tempImage, size, cudaMemcpyHostToDevice);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to copy array tempImage from host to device (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Launch edgeDetectionCuda() kernel on device with N threads in N blocks */
	int blocks = (imageSize + (THREADS_PER_BLOCK - 1)) / THREADS_PER_BLOCK;
	printf("blocks=%d\n", blocks);
	edgeDetectionCuda<<<blocks, THREADS_PER_BLOCK>>>(d_pixels, d_tempImage, width, height, imageSize);
    err = cudaGetLastError();
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to launch edgeDetectionCuda kernel (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to host */ 
	err = cudaMemcpy(tempImage, d_tempImage, size, cudaMemcpyDeviceToHost);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to copy array tempImage from device to host (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Clean-up device */
	err = cudaFree(d_tempImage);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to free array vector tempImage (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = cudaFree(d_pixels);
    if (err != cudaSuccess){
        fprintf(stderr, "Failed to free array vector pixels (error code %s)!\n", cudaGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	for(unsigned int i = 0; i < imageSize; i++){

		pixels[i] = tempImage[i];

	}

	/* Clean-up host */
	free(tempImage);
}

bool isBinary(ifstream &inFile);

void run(char **argv);

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

	if(argc != 3){

		cerr << "Usage: EdgeDetection imageName.pgm output.pgm";

		return 1;

	}

	//long start, end;

	//double total;

	//start = clock();

	run(argv);

	//end = clock();

	//total = (double)(end - start)/1000;

	//cout << "Execution time: " << total << endl;

	return 0;
}


bool isBinary(ifstream &inFile){

	char readChar = ' ';

	string errorMessage = "Error: incorrect picture format.";

	//If there is no character or the character is not equal to 'P'
	//then return an error
	if(!(inFile >> readChar) || ( readChar != 'P' )){

		cerr << errorMessage << endl;
		cerr << "P" << endl;

		exit(1002);

	}

	//If there is no character or the second character is not a 2 or 5
	//then return an error
	if(!(inFile >> readChar) || ( readChar != '2' && readChar != '5')){

		cerr << errorMessage << endl;
		cerr << readChar << endl;

		exit(1002);

	}

	if(readChar == '5') return true;

	return false;

}

void run(char **argv){

	ifstream inFile;

	inFile.open(argv[1], ios::binary | ios::in);

	ofstream outFile;

	outFile.open(argv[2], ios::binary
			            | ios::out
						| ios::trunc);

	if(isBinary(inFile)){

		BinaryImage binaryImage;

		binaryImage.readHeader(inFile);

		binaryImage.readImage(inFile);

		binaryImage.edgeDection();

		binaryImage.scaleImage();

		binaryImage.writeImage(outFile);

	}else{

		AsciiImage asciiImage;

		asciiImage.readHeader(inFile);

		asciiImage.readImage(inFile);

		asciiImage.edgeDection();

		asciiImage.scaleImage();

		asciiImage.writeImage(outFile);

	}

	inFile.close();
	outFile.close();

}



	.file	"tmpxft_0036add9_00000000-6_EdgeDetectionCuda.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.section	.text._ZN11BinaryImageD2Ev,"axG",@progbits,_ZN11BinaryImageD5Ev,comdat
	.align 2
	.weak	_ZN11BinaryImageD2Ev
	.type	_ZN11BinaryImageD2Ev, @function
_ZN11BinaryImageD2Ev:
.LFB4203:
	.cfi_startproc
	endbr64
	ret
	.cfi_endproc
.LFE4203:
	.size	_ZN11BinaryImageD2Ev, .-_ZN11BinaryImageD2Ev
	.weak	_ZN11BinaryImageD1Ev
	.set	_ZN11BinaryImageD1Ev,_ZN11BinaryImageD2Ev
	.section	.text._ZN10AsciiImageD2Ev,"axG",@progbits,_ZN10AsciiImageD5Ev,comdat
	.align 2
	.weak	_ZN10AsciiImageD2Ev
	.type	_ZN10AsciiImageD2Ev, @function
_ZN10AsciiImageD2Ev:
.LFB4210:
	.cfi_startproc
	endbr64
	ret
	.cfi_endproc
.LFE4210:
	.size	_ZN10AsciiImageD2Ev, .-_ZN10AsciiImageD2Ev
	.weak	_ZN10AsciiImageD1Ev
	.set	_ZN10AsciiImageD1Ev,_ZN10AsciiImageD2Ev
	.section	.text._ZN11BinaryImageD0Ev,"axG",@progbits,_ZN11BinaryImageD5Ev,comdat
	.align 2
	.weak	_ZN11BinaryImageD0Ev
	.type	_ZN11BinaryImageD0Ev, @function
_ZN11BinaryImageD0Ev:
.LFB4205:
	.cfi_startproc
	endbr64
	movl	$40, %esi
	jmp	_ZdlPvm@PLT
	.cfi_endproc
.LFE4205:
	.size	_ZN11BinaryImageD0Ev, .-_ZN11BinaryImageD0Ev
	.section	.text._ZN10AsciiImageD0Ev,"axG",@progbits,_ZN10AsciiImageD5Ev,comdat
	.align 2
	.weak	_ZN10AsciiImageD0Ev
	.type	_ZN10AsciiImageD0Ev, @function
_ZN10AsciiImageD0Ev:
.LFB4212:
	.cfi_startproc
	endbr64
	movl	$40, %esi
	jmp	_ZdlPvm@PLT
	.cfi_endproc
.LFE4212:
	.size	_ZN10AsciiImageD0Ev, .-_ZN10AsciiImageD0Ev
	.text
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4229:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4229:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB5004:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE5004:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Could not write to file."
.LC1:
	.string	"P2"
	.text
	.align 2
	.globl	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.type	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, @function
_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE:
.LFB4217:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	je	.L8
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1001, %edi
	call	exit@PLT
.L8:
	movq	%rsi, %r12
	movq	%rdi, %rbx
	leaq	.LC1(%rip), %rsi
	xorl	%ebp, %ebp
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$32, %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movl	12(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movl	$32, %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movl	8(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movl	$32, %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movl	16(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movl	$10, %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.L9:
	cmpl	28(%rbx), %ebp
	jnb	.L20
	movl	%ebp, %eax
	xorl	%edx, %edx
	divl	12(%rbx)
	testl	%edx, %edx
	jne	.L10
	testl	%ebp, %ebp
	je	.L10
	movl	$10, %esi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.L10:
	movq	32(%rbx), %rax
	movl	%ebp, %edx
	movq	%r12, %rdi
	incl	%ebp
	movl	(%rax,%rdx,4), %esi
	call	_ZNSolsEi@PLT
	movl	$9, %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	jmp	.L9
.L20:
	movq	32(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE4217:
	.size	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, .-_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.section	.rodata.str1.1
.LC2:
	.string	"Could not read from file."
	.text
	.align 2
	.globl	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.type	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, @function
_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE:
.LFB4216:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	je	.L27
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1001, %edi
	call	exit@PLT
.L27:
	movq	%rdi, %r12
	movq	%rsi, %rbx
	leaq	4(%rsp), %r13
	xorl	%ebp, %ebp
.L22:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	_ZNSirsERi@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L29
	movq	32(%r12), %rax
	movl	4(%rsp), %edx
	movl	%edx, (%rax,%rbp)
	addq	$4, %rbp
	jmp	.L22
.L29:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4216:
	.size	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, .-_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.section	.rodata.str1.1
.LC3:
	.string	"P5"
.LC4:
	.string	" "
.LC5:
	.string	"Error: error writing to file."
	.text
	.align 2
	.globl	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.type	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, @function
_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE:
.LFB4215:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	je	.L31
	leaq	.LC0(%rip), %rsi
	jmp	.L36
.L31:
	movq	%rsi, %rbp
	movq	%rdi, %rbx
	leaq	.LC3(%rip), %rsi
	movq	%rbp, %rdi
	leaq	.LC4(%rip), %r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	8(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	16(%rbx), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	28(%rbx), %eax
	leal	1(%rax), %edi
	call	_Znam@PLT
	movl	28(%rbx), %edx
	movq	%rax, %r12
	xorl	%eax, %eax
.L32:
	cmpl	%edx, %eax
	jnb	.L37
	movq	32(%rbx), %rcx
	movl	(%rcx,%rax,4), %ecx
	movb	%cl, (%r12,%rax)
	incq	%rax
	jmp	.L32
.L37:
	movb	$0, (%r12,%rdx)
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	_ZNSo5writeEPKcl@PLT
	movq	0(%rbp), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rbp,%rax)
	je	.L34
	leaq	.LC5(%rip), %rsi
.L36:
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1000, %edi
	call	exit@PLT
.L34:
	movq	%r12, %rdi
	call	free@PLT
	movq	32(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE4215:
	.size	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, .-_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.section	.rodata.str1.1
.LC6:
	.string	"Could not read from file!"
.LC7:
	.string	"Error: cannot read pixels."
	.text
	.align 2
	.globl	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.type	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, @function
_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE:
.LFB4214:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	je	.L39
	leaq	.LC6(%rip), %rsi
	jmp	.L44
.L39:
	movl	28(%rdi), %eax
	movq	%rdi, %r12
	movq	%rsi, %rbx
	leal	1(%rax), %edi
	call	_Znam@PLT
	movl	28(%r12), %edx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	movq	%rax, %rbp
	call	_ZNSi4readEPcl@PLT
	movq	(%rbx), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rbx,%rax)
	je	.L40
	leaq	.LC7(%rip), %rsi
.L44:
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1000, %edi
	call	exit@PLT
.L40:
	movl	28(%r12), %edi
	movb	$0, 0(%rbp,%rdi)
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	xorl	%edx, %edx
	movq	%rax, 32(%r12)
.L41:
	cmpl	%ebx, %edx
	jnb	.L45
	movzbl	0(%rbp,%rdx), %ecx
	movl	%ecx, (%rax,%rdx,4)
	incq	%rdx
	jmp	.L41
.L45:
	popq	%rbx
	.cfi_def_cfa_offset 24
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE4214:
	.size	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, .-_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.globl	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, @function
_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE:
.LFB4213:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %r12
	movq	%rdi, %rbx
.L47:
	movl	%ebp, %eax
	cmpq	%r12, %rax
	jnb	.L50
	movq	(%rbx), %rdx
	movsbl	(%rdx,%rax), %edi
	cmpb	$35, %dil
	je	.L50
	call	isspace@PLT
	testl	%eax, %eax
	je	.L51
	incl	%ebp
	jmp	.L47
.L50:
	movb	$1, %al
	jmp	.L46
.L51:
	xorl	%eax, %eax
.L46:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4213:
	.size	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .-_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.globl	_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii
	.type	_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii, @function
_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii:
.LFB4251:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L53
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z14scaleImageCudaPiiii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L53:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4251:
	.size	_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii, .-_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii
	.globl	_Z14scaleImageCudaPiiii
	.type	_Z14scaleImageCudaPiiii, @function
_Z14scaleImageCudaPiiii:
.LFB4252:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii
	.cfi_endproc
.LFE4252:
	.size	_Z14scaleImageCudaPiiii, .-_Z14scaleImageCudaPiiii
	.section	.rodata.str1.1
.LC8:
	.string	"Failed to allocate device vector pixels (error code %s)!\n"
.LC9:
	.string	"Failed to copy vector pixels from host to device (error code %s)!\n"
.LC10:
	.string	"Failed to launch scaleImageCuda kernel (error code %s)!\n"
.LC11:
	.string	"Failed to copy vector pixels from device to host (error code %s)!\n"
.LC12:
	.string	"Failed to free device vector pixels (error code %s)!\n"
.LC13:
	.string	"Failed to deinitialize the device! error=%s\n"
	.text
	.align 2
	.globl	_ZN5Image10scaleImageEv
	.type	_ZN5Image10scaleImageEv, @function
_ZN5Image10scaleImageEv:
.LFB4222:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%edx, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movl	28(%rdi), %ebp
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movl	$255, %eax
.L59:
	cmpl	%ebp, %edx
	jnb	.L73
	movq	32(%rbx), %rcx
	movl	(%rcx,%rdx,4), %ecx
	cmpl	%ecx, %eax
	cmovg	%ecx, %eax
	incq	%rdx
	jmp	.L59
.L73:
	movl	%eax, 20(%rbx)
	xorl	%edx, %edx
	xorl	%eax, %eax
.L61:
	cmpl	%ebp, %edx
	jnb	.L74
	movq	32(%rbx), %rcx
	movl	(%rcx,%rdx,4), %ecx
	cmpl	%ecx, %eax
	cmovl	%ecx, %eax
	incq	%rdx
	jmp	.L61
.L74:
	movl	%eax, 24(%rbx)
	salq	$2, %rbp
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L63
	call	cudaGetErrorString@PLT
	leaq	.LC8(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L72
.L63:
	movq	8(%rsp), %rdi
	movq	32(%rbx), %rsi
	movl	$1, %ecx
	movq	%rbp, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L64
	call	cudaGetErrorString@PLT
	leaq	.LC9(%rip), %rdx
	movq	%rax, %rcx
.L72:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L64:
	movl	28(%rbx), %eax
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rdx
	movl	$1, %ecx
	addl	$255, %eax
	shrl	$8, %eax
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L65
	movl	28(%rbx), %ecx
	movl	24(%rbx), %edx
	movl	20(%rbx), %esi
	movq	8(%rsp), %rdi
	call	_Z37__device_stub__Z14scaleImageCudaPiiiiPiiii
.L65:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L66
	call	cudaGetErrorString@PLT
	leaq	.LC10(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L72
.L66:
	movq	32(%rbx), %rdi
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L67
	call	cudaGetErrorString@PLT
	leaq	.LC11(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L72
.L67:
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L68
	call	cudaGetErrorString@PLT
	leaq	.LC12(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L72
.L68:
	call	cudaDeviceReset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L69
	call	cudaGetErrorString@PLT
	leaq	.LC13(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L72
.L69:
	movl	$255, 16(%rbx)
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L70
	call	__stack_chk_fail@PLT
.L70:
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4222:
	.size	_ZN5Image10scaleImageEv, .-_ZN5Image10scaleImageEv
	.globl	_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii
	.type	_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii, @function
_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii:
.LFB4253:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L75
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17edgeDetectionCudaPiS_iii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L75:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L77
	call	__stack_chk_fail@PLT
.L77:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4253:
	.size	_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii, .-_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii
	.globl	_Z17edgeDetectionCudaPiS_iii
	.type	_Z17edgeDetectionCudaPiS_iii, @function
_Z17edgeDetectionCudaPiS_iii:
.LFB4254:
	.cfi_startproc
	endbr64
	jmp	_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii
	.cfi_endproc
.LFE4254:
	.size	_Z17edgeDetectionCudaPiS_iii, .-_Z17edgeDetectionCudaPiS_iii
	.section	.rodata.str1.1
.LC14:
	.string	"Failed to allocate device array pixels (error code %s)!\n"
.LC15:
	.string	"Failed to allocate device array tempImage (error code %s)!\n"
.LC16:
	.string	"Failed to copy array pixels from host to device (error code %s)!\n"
.LC17:
	.string	"Failed to copy array tempImage from host to device (error code %s)!\n"
.LC18:
	.string	"blocks=%d\n"
.LC19:
	.string	"Failed to launch edgeDetectionCuda kernel (error code %s)!\n"
.LC20:
	.string	"Failed to copy array tempImage from device to host (error code %s)!\n"
.LC21:
	.string	"Failed to free array vector tempImage (error code %s)!\n"
.LC22:
	.string	"Failed to free array vector pixels (error code %s)!\n"
	.text
	.align 2
	.globl	_ZN5Image11edgeDectionEv
	.type	_ZN5Image11edgeDectionEv, @function
_ZN5Image11edgeDectionEv:
.LFB4223:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movl	28(%rdi), %ebp
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	salq	$2, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rsp, %rdi
	movq	%rbp, %rsi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L81
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC14(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L81:
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L82
	call	cudaGetErrorString@PLT
	leaq	.LC15(%rip), %rdx
	movq	%rax, %rcx
.L97:
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L82:
	movq	(%rsp), %rdi
	movq	32(%rbx), %rsi
	movl	$1, %ecx
	movq	%rbp, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L83
	call	cudaGetErrorString@PLT
	leaq	.LC16(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L83:
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rdx
	movq	%r12, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L84
	call	cudaGetErrorString@PLT
	leaq	.LC17(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L84:
	movl	28(%rbx), %eax
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	leal	255(%rax), %r13d
	xorl	%eax, %eax
	shrl	$8, %r13d
	movl	%r13d, %edx
	call	__printf_chk@PLT
	movl	%r13d, 16(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	$16777217, %edx
	movl	$1, %ecx
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	salq	$8, %rdx
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L85
	movl	8(%rbx), %ecx
	movl	12(%rbx), %edx
	movl	28(%rbx), %r8d
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_Z42__device_stub__Z17edgeDetectionCudaPiS_iiiPiS_iii
.L85:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L86
	call	cudaGetErrorString@PLT
	leaq	.LC19(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L86:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	movl	$2, %ecx
	movq	%rbp, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L87
	call	cudaGetErrorString@PLT
	leaq	.LC20(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L87:
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L88
	call	cudaGetErrorString@PLT
	leaq	.LC21(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L88:
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L89
	call	cudaGetErrorString@PLT
	leaq	.LC22(%rip), %rdx
	movq	%rax, %rcx
	jmp	.L97
.L89:
	cmpl	28(%rbx), %edi
	jnb	.L98
	movl	%edi, %eax
	movq	32(%rbx), %rdx
	incl	%edi
	movl	(%r12,%rax,4), %ecx
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L89
.L98:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L91
	call	__stack_chk_fail@PLT
.L91:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	movq	%r12, %rdi
	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
	jmp	free@PLT
	.cfi_endproc
.LFE4223:
	.size	_ZN5Image11edgeDectionEv, .-_ZN5Image11edgeDectionEv
	.section	.rodata.str1.1
.LC23:
	.string	"_Z17edgeDetectionCudaPiS_iii"
.LC24:
	.string	"_Z14scaleImageCudaPiiii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4256:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC23(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17edgeDetectionCudaPiS_iii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC24(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14scaleImageCudaPiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4256:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC25:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4595:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L102
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L107
	leaq	.LC25(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L102:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L104
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L104:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L105
.L107:
	call	__stack_chk_fail@PLT
.L105:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4595:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC26:
	.string	"Error: incorrect picture format."
.LC27:
	.string	"P"
	.text
	.globl	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
	.type	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE, @function
_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE:
.LFB4225:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4225
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC26(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbx
	leaq	7(%rsp), %rdx
	movb	$32, 6(%rsp)
	movq	%rbx, %rdi
	leaq	6(%rsp), %r12
.LEHB0:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE0:
	movq	%r12, %rsi
	movq	%rbp, %rdi
.LEHB1:
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L109
	cmpb	$80, 6(%rsp)
	jne	.L109
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	je	.L121
	jmp	.L111
.L109:
	leaq	_ZSt4cerr(%rip), %rbp
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC27(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L125:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1002, %edi
	call	exit@PLT
.L121:
	movb	6(%rsp), %al
	cmpb	$50, %al
	je	.L117
	movb	$1, %bpl
	cmpb	$53, %al
	je	.L112
.L111:
	leaq	_ZSt4cerr(%rip), %rbp
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movsbl	6(%rsp), %esi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.LEHE1:
	jmp	.L125
.L117:
	xorl	%ebp, %ebp
.L112:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L116
	jmp	.L122
.L119:
	endbr64
	movq	%rax, %rbp
.L114:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L122
	movq	%rbp, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L122:
	call	__stack_chk_fail@PLT
.L116:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	movl	%ebp, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4225:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4225:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4225-.LLSDACSB4225
.LLSDACSB4225:
	.uleb128 .LEHB0-.LFB4225
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4225
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L119-.LFB4225
	.uleb128 0
	.uleb128 .LEHB2-.LFB4225
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4225:
	.text
	.size	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE, .-_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
	.section	.rodata.str1.1
.LC28:
	.string	"Error: Could not open file."
.LC29:
	.string	"Extra info after magic number."
.LC30:
	.string	"Cannot read width."
.LC31:
	.string	"Cannot read height."
.LC32:
	.string	"Extra info when reading height and width."
.LC33:
	.string	"Error: width and height cannot be negative"
.LC34:
	.string	""
.LC35:
	.string	"Could not read maxPixelValue."
.LC36:
	.string	"Extra info after the max pixel value."
.LC37:
	.string	"Invalid max pixel value."
	.text
	.align 2
	.globl	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	.type	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE, @function
_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE:
.LFB4218:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4218
	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	%rsi, %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
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	144(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
.LEHB3:
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev@PLT
.LEHE3:
	leaq	64(%rsp), %rax
	movb	$0, 64(%rsp)
	movq	%rax, 48(%rsp)
	xorl	%eax, %eax
	movq	%rax, 56(%rsp)
	movq	(%r12), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%r12,%rax)
	leaq	48(%rsp), %rax
	movq	%rax, 8(%rsp)
	je	.L127
	leaq	.LC28(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
.LEHB4:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L129:
	movl	$1002, %edi
	call	exit@PLT
.L127:
	leaq	80(%rsp), %rax
	leaq	47(%rsp), %r15
	movq	%r15, %rdx
	leaq	.LC26(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE4:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
.LEHB5:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	48(%rsp), %r13
	movl	56(%rsp), %ebp
	addq	%r13, %rbp
.L128:
	cmpq	%rbp, %r13
	je	.L191
	movsbl	0(%r13), %edi
	incq	%r13
	call	isspace@PLT
	testl	%eax, %eax
	jne	.L128
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC29(%rip), %rsi
	jmp	.L183
.L191:
	leaq	112(%rsp), %rbp
.L131:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L134
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
	movq	%rbp, %rdi
	call	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	movq	%rbp, %rdi
	movl	%eax, %r13d
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	testb	%r13b, %r13b
	jne	.L131
.L134:
	leaq	160(%rsp), %r14
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	16(%rsp), %rdi
	leaq	12(%rbx), %rsi
	call	_ZNSirsERi@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	je	.L135
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC30(%rip), %rsi
	jmp	.L183
.L135:
	movq	16(%rsp), %rdi
	leaq	8(%rbx), %rsi
	call	_ZNSirsERi@PLT
	movq	(%rax), %rdx
	leaq	46(%rsp), %r13
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	je	.L136
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC31(%rip), %rsi
	jmp	.L183
.L194:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L192
	movsbl	46(%rsp), %edi
	call	isspace@PLT
	testl	%eax, %eax
	je	.L193
.L136:
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
	jmp	.L194
.L193:
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC32(%rip), %rsi
	jmp	.L183
.L192:
	cmpl	$0, 12(%rbx)
	jle	.L138
	cmpl	$0, 8(%rbx)
	leaq	112(%rsp), %rbp
	jg	.L139
.L138:
	leaq	.LC33(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	jmp	.L190
.L195:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L142
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
	movq	%rbp, %rdi
	call	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	movq	%rbp, %rdi
	movb	%al, 31(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movb	31(%rsp), %al
	testb	%al, %al
	je	.L142
.L139:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	jmp	.L195
.L142:
	movq	%r15, %rdx
	leaq	.LC34(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE5:
	leaq	168(%rsp), %rdi
	movq	%rbp, %rsi
.LEHB6:
	call	_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strERKNS_12basic_stringIcS2_S3_EE@PLT
.LEHE6:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	272(%rsp), %rdi
	xorl	%esi, %esi
.LEHB7:
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@PLT
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	16(%rsp), %rdi
	leaq	16(%rbx), %rsi
	call	_ZNSirsERi@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	je	.L143
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC35(%rip), %rsi
	jmp	.L183
.L198:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L196
	movsbl	46(%rsp), %edi
	call	isspace@PLT
	testl	%eax, %eax
	je	.L197
.L143:
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
	jmp	.L198
.L197:
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC36(%rip), %rsi
	jmp	.L183
.L196:
	cmpl	$255, 16(%rbx)
	jbe	.L145
	leaq	_ZSt4cerr(%rip), %rbx
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC37(%rip), %rsi
.L183:
	movq	%rbx, %rdi
.L190:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE7:
	jmp	.L129
.L145:
	movl	12(%rbx), %eax
	imull	8(%rbx), %eax
	movq	(%rsp), %rdi
	movl	%eax, 28(%rbx)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	16(%rsp), %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L150
	jmp	.L167
.L153:
	endbr64
	movq	%rax, %rbx
.L146:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L147
.L152:
	endbr64
	movq	%rax, %rbx
.L147:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L148
.L151:
	endbr64
	movq	%rax, %rbx
.L148:
	movq	8(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	16(%rsp), %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L167
	movq	%rbx, %rdi
.LEHB8:
	call	_Unwind_Resume@PLT
.LEHE8:
.L167:
	call	__stack_chk_fail@PLT
.L150:
	addq	$552, %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
.LFE4218:
	.section	.gcc_except_table
.LLSDA4218:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4218-.LLSDACSB4218
.LLSDACSB4218:
	.uleb128 .LEHB3-.LFB4218
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB4218
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L151-.LFB4218
	.uleb128 0
	.uleb128 .LEHB5-.LFB4218
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L152-.LFB4218
	.uleb128 0
	.uleb128 .LEHB6-.LFB4218
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L153-.LFB4218
	.uleb128 0
	.uleb128 .LEHB7-.LFB4218
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L152-.LFB4218
	.uleb128 0
	.uleb128 .LEHB8-.LFB4218
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
.LLSDACSE4218:
	.text
	.size	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE, .-_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	.globl	_Z3runPPc
	.type	_Z3runPPc, @function
_Z3runPPc:
.LFB4226:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4226
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$1088, %rsp
	.cfi_def_cfa_offset 1120
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	560(%rsp), %rbx
	movq	%rbx, %rdi
.LEHB9:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE9:
	movq	8(%rbp), %rsi
	movl	$12, %edx
	movq	%rbx, %rdi
.LEHB10:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	48(%rsp), %r12
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE10:
	movq	16(%rbp), %rsi
	movl	$52, %edx
	movq	%r12, %rdi
.LEHB11:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	%rbx, %rdi
	call	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
	xorl	%edx, %edx
	testb	%al, %al
	leaq	8(%rsp), %rbp
	movq	%rdx, 16(%rsp)
	movq	%rdx, 24(%rsp)
	movq	%rdx, 32(%rsp)
	je	.L200
	leaq	16+_ZTV11BinaryImage(%rip), %rax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	movq	%rax, 8(%rsp)
	call	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	movq	%rbp, %rdi
	call	_ZN5Image11edgeDectionEv
	movq	%rbp, %rdi
	call	_ZN5Image10scaleImageEv
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	jmp	.L201
.L200:
	leaq	16+_ZTV10AsciiImage(%rip), %rax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	movq	%rax, 8(%rsp)
	call	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	movq	%rbp, %rdi
	call	_ZN5Image11edgeDectionEv
	movq	%rbp, %rdi
	call	_ZN5Image10scaleImageEv
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
.L201:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE11:
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	je	.L205
	jmp	.L208
.L207:
	endbr64
	movq	%rax, %rbp
.L202:
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L203
.L206:
	endbr64
	movq	%rax, %rbp
.L203:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L208
	movq	%rbp, %rdi
.LEHB12:
	call	_Unwind_Resume@PLT
.LEHE12:
.L208:
	call	__stack_chk_fail@PLT
.L205:
	addq	$1088, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4226:
	.section	.gcc_except_table
.LLSDA4226:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4226-.LLSDACSB4226
.LLSDACSB4226:
	.uleb128 .LEHB9-.LFB4226
	.uleb128 .LEHE9-.LEHB9
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB10-.LFB4226
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L206-.LFB4226
	.uleb128 0
	.uleb128 .LEHB11-.LFB4226
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L207-.LFB4226
	.uleb128 0
	.uleb128 .LEHB12-.LFB4226
	.uleb128 .LEHE12-.LEHB12
	.uleb128 0
	.uleb128 0
.LLSDACSE4226:
	.text
	.size	_Z3runPPc, .-_Z3runPPc
	.section	.rodata.str1.1
.LC38:
	.string	"Usage: EdgeDetection imageName.pgm output.pgm"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4224:
	.cfi_startproc
	endbr64
	pushq	%rcx
	.cfi_def_cfa_offset 16
	cmpl	$3, %edi
	je	.L211
	leaq	.LC38(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1, %eax
	jmp	.L210
.L211:
	movq	%rsi, %rdi
	call	_Z3runPPc
	xorl	%eax, %eax
.L210:
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4224:
	.size	main, .-main
	.weak	_ZTS5Image
	.section	.rodata._ZTS5Image,"aG",@progbits,_ZTS5Image,comdat
	.type	_ZTS5Image, @object
	.size	_ZTS5Image, 7
_ZTS5Image:
	.string	"5Image"
	.weak	_ZTI5Image
	.section	.data.rel.ro._ZTI5Image,"awG",@progbits,_ZTI5Image,comdat
	.align 8
	.type	_ZTI5Image, @object
	.size	_ZTI5Image, 16
_ZTI5Image:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTS5Image
	.weak	_ZTS11BinaryImage
	.section	.rodata._ZTS11BinaryImage,"aG",@progbits,_ZTS11BinaryImage,comdat
	.align 8
	.type	_ZTS11BinaryImage, @object
	.size	_ZTS11BinaryImage, 14
_ZTS11BinaryImage:
	.string	"11BinaryImage"
	.weak	_ZTI11BinaryImage
	.section	.data.rel.ro._ZTI11BinaryImage,"awG",@progbits,_ZTI11BinaryImage,comdat
	.align 8
	.type	_ZTI11BinaryImage, @object
	.size	_ZTI11BinaryImage, 24
_ZTI11BinaryImage:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS11BinaryImage
	.quad	_ZTI5Image
	.weak	_ZTS10AsciiImage
	.section	.rodata._ZTS10AsciiImage,"aG",@progbits,_ZTS10AsciiImage,comdat
	.align 8
	.type	_ZTS10AsciiImage, @object
	.size	_ZTS10AsciiImage, 13
_ZTS10AsciiImage:
	.string	"10AsciiImage"
	.weak	_ZTI10AsciiImage
	.section	.data.rel.ro._ZTI10AsciiImage,"awG",@progbits,_ZTI10AsciiImage,comdat
	.align 8
	.type	_ZTI10AsciiImage, @object
	.size	_ZTI10AsciiImage, 24
_ZTI10AsciiImage:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS10AsciiImage
	.quad	_ZTI5Image
	.weak	_ZTV11BinaryImage
	.section	.data.rel.ro.local._ZTV11BinaryImage,"awG",@progbits,_ZTV11BinaryImage,comdat
	.align 8
	.type	_ZTV11BinaryImage, @object
	.size	_ZTV11BinaryImage, 48
_ZTV11BinaryImage:
	.quad	0
	.quad	_ZTI11BinaryImage
	.quad	_ZN11BinaryImageD1Ev
	.quad	_ZN11BinaryImageD0Ev
	.quad	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.quad	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.weak	_ZTV10AsciiImage
	.section	.data.rel.ro.local._ZTV10AsciiImage,"awG",@progbits,_ZTV10AsciiImage,comdat
	.align 8
	.type	_ZTV10AsciiImage, @object
	.size	_ZTV10AsciiImage, 48
_ZTV10AsciiImage:
	.quad	0
	.quad	_ZTI10AsciiImage
	.quad	_ZN10AsciiImageD1Ev
	.quad	_ZN10AsciiImageD0Ev
	.quad	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.quad	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.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 <iostream>
#include <math.h>
#include <fstream>
#include <vector>
#include <sstream>
#include <time.h>
#include <stdlib.h>

// For the CUDA runtime routines (prefixed with "cuda_")
#include <hip/hip_runtime.h>

using namespace std;

const int THREADS_PER_BLOCK = 256;

/**
 * CUDA Kernel Device code
 */ 
/*****************************************************************************/

__global__ void scaleImageCuda (int *pixels, int minpix, int maxpix, int imageSize) {
	/* blockDim.x gives the number of threads per block, combining it
	with threadIdx.x and blockIdx.x gives the index of each global
	thread in the device */
	int index = (blockDim.x * blockIdx.x) + threadIdx.x;
	int value;
	/* Typical problems are not friendly multiples of blockDim.x.
	Avoid accesing data beyond the end of the arrays */
	if (index < imageSize) {
		value = round(((double)(pixels[index] - minpix) / (maxpix - minpix)) * 255);
		pixels[index] = value;
	}

    __syncthreads();
}

__global__ void edgeDetectionCuda (int *pixels, int *tempImage, int width, int height, int imageSize) {
	/* blockDim.x gives the number of threads per block, combining it
	with threadIdx.x and blockIdx.x gives the index of each global
	thread in the device */
	int index = (blockDim.x * blockIdx.x) + threadIdx.x;
	int x = 0, y = 0;
	int xG = 0, yG = 0;

	/* Typical problems are not friendly multiples of blockDim.x.
	Avoid accesing data beyond the end of the arrays */
	if (index < imageSize) {
		x = index % width;

		if (index != 0) {
			y = __double2int_rd((__int2double_rn(index) / __int2double_rn(width)));	
		}
		
		if (x < (width - 1) && y < (height - 1)
				&& (y > 0) && (x > 0)) {

			//index = x + (y * width)
			//Finds the horizontal gradient
			xG = (pixels[(x+1) + ((y-1) * width)]
						 + (2 * pixels[(x+1) + (y * width)])
						 + pixels[(x+1) + ((y+1) * width)]
								  - pixels[(x-1) + ((y-1) * width)]
										   - (2 * pixels[(x-1) + (y * width)])
										   - pixels[(x-1) + ((y+1) * width)]);

			//Finds the vertical gradient
			yG = (pixels[(x-1) + ((y+1) * width)]
						 + (2 * pixels[(x) + ((y + 1) * width)])
						 + pixels[(x+1) + ((y+1) * width)]
								  - pixels[(x-1) + ((y-1) * width)]
										   - (2 * pixels[(x) + ((y-1) * width)])
										   - pixels[(x+1) + ((y-1) * width)]);
			tempImage[index] = __double2int_rn(sqrt(__int2double_rn(xG * xG) + __int2double_rn(yG * yG)));

		} else {

			//Pads out of bound pixels with 0
			tempImage[index] = 0;

		}
	}

    //__syncthreads();
}

//Creating image class (base class)
class Image{

public:

	Image():
		height(0),
		width(0),
		maxPixelValue(0),
		minpix(0),
		maxpix(0),
		imageSize(0){}
	virtual ~Image(){}

	virtual void readImage(ifstream &inFile) = 0;
	virtual void writeImage(ofstream &outFile) = 0;

	void readHeader(ifstream &inFile);
	void scaleImage();
	void edgeDection();

	//Accessor methods
	int getHeight(){return height;}
	int getWidth(){return width;}
	int getMaxPixelValue(){return maxPixelValue;}

	//Mutator methods
	void setHeight(int h){height = h;}
	void setWidth(int w){width = w;}
	void setMaxPixelValue(int mpv){maxPixelValue = mpv;}

	//Member variables
protected:

	int height;
	int width;
	int maxPixelValue;
	int minpix;
	int maxpix;
	unsigned int imageSize;
	int * pixels;

	inline void findMin();
	inline void findMax();

};

//Binary image class (derived class)

class BinaryImage: public Image{

public:

	BinaryImage(){}
	~BinaryImage(){}

	void readImage(ifstream &inFile);
	void writeImage(ofstream &outFile);

};

class AsciiImage: public Image{

public:

	AsciiImage(){}
	~AsciiImage(){}

	void readImage(ifstream &infile);
	void writeImage(ofstream &outFile);

};

//Check if header contains comments
//Comments start with #
bool isComment(string comment){

	for(unsigned int i = 0; i < comment.length(); i++){

		if(comment[i] == '#') return true;

		if(!isspace(comment[i])) return false;

	}

	return true;
}

//Reads binary pixel values in image
void BinaryImage::readImage(ifstream &inFile){

	//Check if the file stream in open
	if(!inFile){

		cerr << "Could not read from file!" << endl;

		exit(1000);

	}

	//Making a temp array, and putting it on the heap
	char * byteArray = new char[imageSize + 1];

	//Read the bytes of the image, and puts data in byteArray
	inFile.read(byteArray, imageSize);

	//If reading in the data failed, return an error
	if(inFile.fail()){

		cerr << "Error: cannot read pixels." << endl;

		exit(1000);

	}

	//Set the last element in array to EOF character
	byteArray[imageSize] = '\0';

	//Put the data read from file into pixels
	pixels = (int *)malloc(imageSize * sizeof(int));
	for(unsigned int i = 0; i < imageSize; i++){

		pixels[i] = static_cast<int>
		(static_cast<unsigned char>(byteArray[i]));

	}

	//Delete the byteArray
	free(byteArray);

}

//Writes binary pixels to output file
void BinaryImage::writeImage(ofstream &outFile){

	//Check if the file stream is open
	if(!outFile){

		cerr << "Could not write to file." << endl;

		exit(1000);

	}

	//Write header
	outFile << "P5"       << " "  <<
			width         << " "  <<
			height        << " "  <<
			maxPixelValue << endl;

	//Take all pixel values from pixels and writes it to output file
	char * byteArray = new char[imageSize + 1];

	for(unsigned int i = 0; i < imageSize; i++){

		byteArray[i] = static_cast<char>(pixels[i]);

	}

	byteArray[imageSize] = '\0';

	outFile.write(byteArray, imageSize);

	if(outFile.fail()){

		cerr << "Error: error writing to file." << endl;

		exit(1000);

	}

	free(byteArray);
	free(pixels);
	//delete[] byteArray;

}

void AsciiImage::readImage(ifstream &inFile){

	//Check if the file opened properly
	if(!inFile){

		cerr << "Could not read from file." << endl;

		exit(1001);

	}

	int pixelValue;

	//Read in the Ascii values from file
	int i = 0;
	while(inFile >> pixelValue){

		pixels[i] = pixelValue;
		i++;

	}


}


void AsciiImage::writeImage(ofstream &outFile){

	//Check if file is open
	if(!outFile){

		cerr << "Could not write to file." << endl;

		exit(1001);

	}

	//Write Header
	outFile << "P2" << ' ' <<
			width << ' ' <<
			height << ' ' <<
			maxPixelValue << '\n';

	//Write the contents of pixels to the output file
	for(unsigned int i = 0; i < imageSize; i++){

		//Add a '\n' at the end of each row
		if(i % width == 0 && i != 0) outFile << '\n';

		outFile << pixels[i] << '\t';

	}

	free(pixels);
}

void Image::readHeader(ifstream &inFile){

	stringstream sStream;

	string line;

	//Check if the file opened successfully
	if(!inFile){

		cerr << "Error: Could not open file." << endl;

		exit(1002);

	}

	char readChar;

	string errorMessage = "Error: incorrect picture format.";

	getline(inFile, line);

	unsigned int lineSize = line.length();

	//After we read magic number, we read the next line and determine if it's valid
	for(unsigned int i = 0; i < lineSize; i++){

		if(!isspace(line[i])){

			cerr << errorMessage << endl;

			cerr << "Extra info after magic number." << endl;

			exit(1002);

		}

	}

	//Read through the rest of the header and skip through comments
	while(getline(inFile, line)){

		if(!(isComment(line))) break;

	}

	sStream << line;

	//Read in width.
	//If there is a problem, return error
	if(!(sStream >> width)){

		cerr << errorMessage << endl;

		cerr << "Cannot read width." << endl;

		exit(1002);

	}

	//Read in height
	//If there is a problem, return error
	if(!(sStream >> height)){

		cerr << errorMessage << endl;

		cerr << "Cannot read height." << endl;

		exit(1002);

	}

	//Check if there is extra information after width and height
	while(sStream >> readChar){

		if(!(isspace(readChar))){

			cerr << errorMessage << endl;

			cerr << "Extra info when reading height and width." << endl;

			exit(1002);

		}

	}

	//Make sure the height and width is positive
	if(width <= 0 || height <= 0){

		cerr << "Error: width and height cannot be negative" << endl;

		exit(1002);

	}

	//Check if there are any comments between height/width and maxPixelValue
	while(getline(inFile, line)){

		if(!(isComment(line))) break;

	}

	//Clear out the string stream
	sStream.str("");
	sStream.clear();

	sStream << line;

	//Read in the maxPixelValue
	if(!(sStream >> maxPixelValue)){

		cerr << errorMessage << endl;
		cerr << "Could not read maxPixelValue." << endl;

		exit(1002);

	}

	//Check if there is extra information after maxPixelValue
	while(sStream >> readChar){

		if(!(isspace(readChar))){

			cerr << errorMessage << endl;
			cerr << "Extra info after the max pixel value." << endl;

			exit(1002);

		}

	}

	if(maxPixelValue < 0 || maxPixelValue > 255){

		cerr << errorMessage << endl;
		cerr << "Invalid max pixel value." << endl;

		exit(1002);

	}

	imageSize = width * height;

}

//Finds the maxium pixel value in the image
void Image::findMax(){

	int maxVal = 0;

	for(unsigned int i = 0; i < imageSize; i++){

		if(pixels[i] > maxVal){

			maxVal = pixels[i];

		}

	}

	maxpix = maxVal;

}

//Finds the minimal pixel value of the image
void Image::findMin(){

	int minVal = 255;

	for(unsigned int i = 0; i < imageSize; i++){

		if(pixels[i] < minVal){

			minVal = pixels[i];

		}

	}

	minpix = minVal;

}

//Scales image so that the maximum pixel value is 255
void Image::scaleImage(){

	findMin();

	findMax();

	int *d_pixels;
	size_t size = imageSize * sizeof(int);
    hipError_t err = hipSuccess;

	/* Allocate memory in device */
	err = hipMalloc((void **) &d_pixels, size);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to allocate device vector pixels (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to device */
	err = hipMemcpy(d_pixels, pixels, size, hipMemcpyHostToDevice);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to copy vector pixels from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Launch scaleImageCuda() kernel on device with N threads in N blocks */
	int blocks = (imageSize + (THREADS_PER_BLOCK - 1)) / THREADS_PER_BLOCK;
	scaleImageCuda<<<blocks, THREADS_PER_BLOCK>>>(d_pixels, minpix, maxpix, imageSize);
    err = hipGetLastError();
    if (err != hipSuccess){
        fprintf(stderr, "Failed to launch scaleImageCuda kernel (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to tohost device */
	err = hipMemcpy(pixels, d_pixels, size, hipMemcpyDeviceToHost);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to copy vector pixels from device to host (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Clean-up */
	err = hipFree(d_pixels);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to free device vector pixels (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

    err = hipDeviceReset();
    if (err != hipSuccess){
        fprintf(stderr, "Failed to deinitialize the device! error=%s\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	maxPixelValue = 255;

}

//Sobel edge detection function - detects edges and draws an outline
void Image::edgeDection(){
    hipError_t err = hipSuccess;
	size_t size = imageSize * sizeof(int);
	/* Allocate memory in host */
	int *tempImage = (int *)malloc(size);

	int *d_pixels, *d_tempImage;
	/* Allocate memory in device */
	err = hipMalloc((void **) &d_pixels, size);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to allocate device array pixels (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = hipMalloc((void **) &d_tempImage, size);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to allocate device array tempImage (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
	}

	/* Copy data to device */
	err = hipMemcpy(d_pixels, pixels, size, hipMemcpyHostToDevice);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to copy array pixels from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = hipMemcpy(d_tempImage, tempImage, size, hipMemcpyHostToDevice);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to copy array tempImage from host to device (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Launch edgeDetectionCuda() kernel on device with N threads in N blocks */
	int blocks = (imageSize + (THREADS_PER_BLOCK - 1)) / THREADS_PER_BLOCK;
	printf("blocks=%d\n", blocks);
	edgeDetectionCuda<<<blocks, THREADS_PER_BLOCK>>>(d_pixels, d_tempImage, width, height, imageSize);
    err = hipGetLastError();
    if (err != hipSuccess){
        fprintf(stderr, "Failed to launch edgeDetectionCuda kernel (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Copy data to host */ 
	err = hipMemcpy(tempImage, d_tempImage, size, hipMemcpyDeviceToHost);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to copy array tempImage from device to host (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	/* Clean-up device */
	err = hipFree(d_tempImage);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to free array vector tempImage (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }
	err = hipFree(d_pixels);
    if (err != hipSuccess){
        fprintf(stderr, "Failed to free array vector pixels (error code %s)!\n", hipGetErrorString(err));
        exit(EXIT_FAILURE);
    }

	for(unsigned int i = 0; i < imageSize; i++){

		pixels[i] = tempImage[i];

	}

	/* Clean-up host */
	free(tempImage);
}

bool isBinary(ifstream &inFile);

void run(char **argv);

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

	if(argc != 3){

		cerr << "Usage: EdgeDetection imageName.pgm output.pgm";

		return 1;

	}

	//long start, end;

	//double total;

	//start = clock();

	run(argv);

	//end = clock();

	//total = (double)(end - start)/1000;

	//cout << "Execution time: " << total << endl;

	return 0;
}


bool isBinary(ifstream &inFile){

	char readChar = ' ';

	string errorMessage = "Error: incorrect picture format.";

	//If there is no character or the character is not equal to 'P'
	//then return an error
	if(!(inFile >> readChar) || ( readChar != 'P' )){

		cerr << errorMessage << endl;
		cerr << "P" << endl;

		exit(1002);

	}

	//If there is no character or the second character is not a 2 or 5
	//then return an error
	if(!(inFile >> readChar) || ( readChar != '2' && readChar != '5')){

		cerr << errorMessage << endl;
		cerr << readChar << endl;

		exit(1002);

	}

	if(readChar == '5') return true;

	return false;

}

void run(char **argv){

	ifstream inFile;

	inFile.open(argv[1], ios::binary | ios::in);

	ofstream outFile;

	outFile.open(argv[2], ios::binary
			            | ios::out
						| ios::trunc);

	if(isBinary(inFile)){

		BinaryImage binaryImage;

		binaryImage.readHeader(inFile);

		binaryImage.readImage(inFile);

		binaryImage.edgeDection();

		binaryImage.scaleImage();

		binaryImage.writeImage(outFile);

	}else{

		AsciiImage asciiImage;

		asciiImage.readHeader(inFile);

		asciiImage.readImage(inFile);

		asciiImage.edgeDection();

		asciiImage.scaleImage();

		asciiImage.writeImage(outFile);

	}

	inFile.close();
	outFile.close();

}



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

                                        # End of file scope inline assembly
	.globl	_Z29__device_stub__scaleImageCudaPiiii # -- Begin function _Z29__device_stub__scaleImageCudaPiiii
	.type	_Z29__device_stub__scaleImageCudaPiiii,@function
_Z29__device_stub__scaleImageCudaPiiii: # @_Z29__device_stub__scaleImageCudaPiiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z14scaleImageCudaPiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.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
	retq
.Lfunc_end0:
	.size	_Z29__device_stub__scaleImageCudaPiiii, .Lfunc_end0-_Z29__device_stub__scaleImageCudaPiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__edgeDetectionCudaPiS_iii # -- Begin function _Z32__device_stub__edgeDetectionCudaPiS_iii
	.type	_Z32__device_stub__edgeDetectionCudaPiS_iii,@function
_Z32__device_stub__edgeDetectionCudaPiS_iii: # @_Z32__device_stub__edgeDetectionCudaPiS_iii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17edgeDetectionCudaPiS_iii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.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
	retq
.Lfunc_end1:
	.size	_Z32__device_stub__edgeDetectionCudaPiS_iii, .Lfunc_end1-_Z32__device_stub__edgeDetectionCudaPiS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE # -- Begin function _Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.type	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE,@function
_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: # @_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.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 %rbp, -16
	movq	8(%rdi), %rbx
	testq	%rbx, %rbx
	je	.LBB2_1
# %bb.4:                                # %.lr.ph
	movq	(%rdi), %r14
	movl	$1, %ebp
	xorl	%eax, %eax
.LBB2_5:                                # =>This Inner Loop Header: Depth=1
	movsbl	(%r14,%rax), %edi
	cmpl	$35, %edi
	je	.LBB2_6
# %bb.7:                                #   in Loop: Header=BB2_5 Depth=1
	callq	isspace
	testl	%eax, %eax
	je	.LBB2_8
# %bb.2:                                #   in Loop: Header=BB2_5 Depth=1
	movl	%ebp, %eax
	incl	%ebp
	cmpq	%rax, %rbx
	ja	.LBB2_5
# %bb.3:
	movb	$1, %al
                                        # implicit-def: $cl
	jmp	.LBB2_9
.LBB2_1:
	movb	$1, %al
	jmp	.LBB2_10
.LBB2_6:
	xorl	%eax, %eax
	movb	$1, %cl
	jmp	.LBB2_9
.LBB2_8:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
.LBB2_9:                                # %._crit_edge.loopexit
	orb	%cl, %al
.LBB2_10:                               # %._crit_edge
	andb	$1, %al
                                        # kill: def $al killed $al killed $eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, .Lfunc_end2-_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE # -- Begin function _ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.p2align	1, 0x90
	.type	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE,@function
_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE: # @_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	jne	.LBB3_1
# %bb.3:
	movq	%rsi, %r15
	movq	%rdi, %r14
	movl	28(%rdi), %r12d
	leal	1(%r12), %edi
	callq	_Znam
	movq	%rax, %rbx
	movq	%r15, %rdi
	movq	%rax, %rsi
	movq	%r12, %rdx
	callq	_ZNSi4readEPcl
	movq	(%r15), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%r15,%rax)
	jne	.LBB3_4
# %bb.5:
	movl	28(%r14), %r15d
	movb	$0, (%rbx,%r15)
	leaq	(,%r15,4), %rdi
	callq	malloc
	movq	%rax, 32(%r14)
	testq	%r15, %r15
	je	.LBB3_8
# %bb.6:                                # %.lr.ph.preheader
	xorl	%ecx, %ecx
.LBB3_7:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movzbl	(%rbx,%rcx), %edx
	movl	%edx, (%rax,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %r15
	jne	.LBB3_7
.LBB3_8:                                # %._crit_edge
	movq	%rbx, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.LBB3_1:
	.cfi_def_cfa_offset 48
	movl	$_ZSt4cerr, %edi
	movl	$.L.str, %esi
	jmp	.LBB3_2
.LBB3_4:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.1, %esi
.LBB3_2:
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1000, %edi                     # imm = 0x3E8
	callq	exit
.Lfunc_end3:
	.size	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, .Lfunc_end3-_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE # -- Begin function _ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.p2align	1, 0x90
	.type	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE,@function
_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE: # @_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	jne	.LBB4_1
# %bb.3:
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movl	$.L.str.3, %esi
	movl	$2, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	12(%rbx), %esi
	movq	%r14, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	8(%rbx), %esi
	movq	%r15, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	16(%rbx), %esi
	movq	%r15, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	28(%rbx), %r12d
	leal	1(%r12), %edi
	callq	_Znam
	movq	%rax, %r15
	testq	%r12, %r12
	je	.LBB4_4
# %bb.7:                                # %.lr.ph
	movq	32(%rbx), %rax
	xorl	%ecx, %ecx
.LBB4_8:                                # =>This Inner Loop Header: Depth=1
	movb	(%rax,%rcx,4), %dl
	movb	%dl, (%r15,%rcx)
	incq	%rcx
	cmpq	%rcx, %r12
	jne	.LBB4_8
	jmp	.LBB4_5
.LBB4_4:
	xorl	%r12d, %r12d
.LBB4_5:                                # %._crit_edge
	movb	$0, (%r15,%r12)
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_ZNSo5writeEPKcl
	movq	(%r14), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%r14,%rax)
	jne	.LBB4_6
# %bb.9:
	movq	%r15, %rdi
	callq	free
	movq	32(%rbx), %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.LBB4_1:
	.cfi_def_cfa_offset 48
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.2, %esi
	jmp	.LBB4_2
.LBB4_6:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.5, %esi
.LBB4_2:
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1000, %edi                     # imm = 0x3E8
	callq	exit
.Lfunc_end4:
	.size	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, .Lfunc_end4-_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE # -- Begin function _ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.p2align	1, 0x90
	.type	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE,@function
_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE: # @_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	jne	.LBB5_5
# %bb.1:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	4(%rsp), %rsi
	movq	%rbx, %rdi
	callq	_ZNSirsERi
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB5_4
# %bb.2:                                # %.lr.ph
	xorl	%r12d, %r12d
	leaq	4(%rsp), %r15
.LBB5_3:                                # =>This Inner Loop Header: Depth=1
	movl	4(%rsp), %eax
	movq	32(%r14), %rcx
	movl	%eax, (%rcx,%r12)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ZNSirsERi
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	addq	$4, %r12
	testb	$5, 32(%rax,%rcx)
	je	.LBB5_3
.LBB5_4:                                # %._crit_edge
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB5_5:
	.cfi_def_cfa_offset 48
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.6, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1001, %edi                     # imm = 0x3E9
	callq	exit
.Lfunc_end5:
	.size	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE, .Lfunc_end5-_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE # -- Begin function _ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.p2align	1, 0x90
	.type	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE,@function
_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE: # @_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	(%rsi), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%rsi,%rax)
	jne	.LBB6_25
# %bb.1:
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movl	$.L.str.7, %esi
	movl	$2, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movb	$32, 10(%rsp)
	movq	(%r14), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%r14,%rax)
	je	.LBB6_3
# %bb.2:
	leaq	10(%rsp), %rsi
	movl	$1, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rax, %rdi
	jmp	.LBB6_4
.LBB6_3:
	movq	%r14, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
	movq	%r14, %rdi
.LBB6_4:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit
	movl	12(%rbx), %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movb	$32, 11(%rsp)
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%r15,%rax)
	je	.LBB6_6
# %bb.5:
	leaq	11(%rsp), %rsi
	movl	$1, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rax, %r15
	jmp	.LBB6_7
.LBB6_6:
	movq	%r15, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
.LBB6_7:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit12
	movl	8(%rbx), %esi
	movq	%r15, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movb	$32, 12(%rsp)
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%r15,%rax)
	je	.LBB6_9
# %bb.8:
	leaq	12(%rsp), %rsi
	movl	$1, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rax, %r15
	jmp	.LBB6_10
.LBB6_9:
	movq	%r15, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
.LBB6_10:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit15
	movl	16(%rbx), %esi
	movq	%r15, %rdi
	callq	_ZNSolsEi
	movb	$10, 13(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB6_12
# %bb.11:
	leaq	13(%rsp), %rsi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB6_13
.LBB6_12:
	movq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNSo3putEc
.LBB6_13:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit18
	cmpl	$0, 28(%rbx)
	je	.LBB6_24
# %bb.14:                               # %.lr.ph
	xorl	%r15d, %r15d
	leaq	14(%rsp), %r12
	leaq	15(%rsp), %r13
.LBB6_15:                               # =>This Inner Loop Header: Depth=1
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	12(%rbx)
	testq	%r15, %r15
	je	.LBB6_20
# %bb.16:                               #   in Loop: Header=BB6_15 Depth=1
	testl	%edx, %edx
	jne	.LBB6_20
# %bb.17:                               #   in Loop: Header=BB6_15 Depth=1
	movb	$10, 14(%rsp)
	movq	(%r14), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%r14,%rax)
	je	.LBB6_19
# %bb.18:                               #   in Loop: Header=BB6_15 Depth=1
	movl	$1, %edx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB6_20
.LBB6_19:                               #   in Loop: Header=BB6_15 Depth=1
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNSo3putEc
.LBB6_20:                               #   in Loop: Header=BB6_15 Depth=1
	movq	32(%rbx), %rax
	movl	(%rax,%r15,4), %esi
	movq	%r14, %rdi
	callq	_ZNSolsEi
	movb	$9, 15(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB6_22
# %bb.21:                               #   in Loop: Header=BB6_15 Depth=1
	movl	$1, %edx
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB6_23
.LBB6_22:                               #   in Loop: Header=BB6_15 Depth=1
	movq	%rax, %rdi
	movl	$9, %esi
	callq	_ZNSo3putEc
.LBB6_23:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit24
                                        #   in Loop: Header=BB6_15 Depth=1
	incq	%r15
	movl	28(%rbx), %eax
	cmpq	%rax, %r15
	jb	.LBB6_15
.LBB6_24:                               # %._crit_edge
	movq	32(%rbx), %rdi
	callq	free
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.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
	retq
.LBB6_25:
	.cfi_def_cfa_offset 64
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.2, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1001, %edi                     # imm = 0x3E9
	callq	exit
.Lfunc_end6:
	.size	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE, .Lfunc_end6-_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.cfi_endproc
                                        # -- End function
	.globl	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE # -- Begin function _ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	.p2align	1, 0x90
	.type	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE,@function
_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE: # @_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 624
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movq	%rdi, %rbx
	leaq	176(%rsp), %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev
	leaq	56(%rsp), %r15
	movq	%r15, -16(%r15)
	movq	$0, -8(%r15)
	movb	$0, (%r15)
	movq	(%r14), %rax
	movq	-24(%rax), %rax
	testb	$5, 32(%r14,%rax)
	jne	.LBB7_1
# %bb.9:
	leaq	24(%rsp), %rax
	movq	%rax, -16(%rax)
.Ltmp5:
	leaq	8(%rsp), %rdi
	movl	$.L.str.9, %esi
	movl	$.L.str.9+32, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp6:
# %bb.10:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	movq	%rbx, 72(%rsp)                  # 8-byte Spill
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp8:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp9:
# %bb.11:                               # %.noexc
.Ltmp10:
	movsbl	%al, %edx
	leaq	40(%rsp), %rsi
	movq	%r14, %rdi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp11:
# %bb.12:                               # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
	movl	48(%rsp), %ebx
	testq	%rbx, %rbx
	je	.LBB7_16
# %bb.13:                               # %.lr.ph
	movq	40(%rsp), %r15
	xorl	%r12d, %r12d
.LBB7_14:                               # =>This Inner Loop Header: Depth=1
	movsbl	(%r15,%r12), %edi
	callq	isspace
	testl	%eax, %eax
	je	.LBB7_34
# %bb.15:                               #   in Loop: Header=BB7_14 Depth=1
	incq	%r12
	cmpq	%r12, %rbx
	jne	.LBB7_14
.LBB7_16:                               # %.preheader146
	leaq	160(%rsp), %r13
	leaq	40(%rsp), %r15
	leaq	144(%rsp), %r12
	movq	72(%rsp), %rbx                  # 8-byte Reload
.LBB7_17:                               # =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp22:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp23:
# %bb.18:                               # %.noexc36
                                        #   in Loop: Header=BB7_17 Depth=1
.Ltmp24:
	movsbl	%al, %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp25:
# %bb.19:                               #   in Loop: Header=BB7_17 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_24
# %bb.20:                               #   in Loop: Header=BB7_17 Depth=1
	movq	%r13, 144(%rsp)
	movq	40(%rsp), %rsi
	movq	48(%rsp), %rdx
	addq	%rsi, %rdx
.Ltmp26:
	movq	%r12, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp27:
# %bb.21:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit
                                        #   in Loop: Header=BB7_17 Depth=1
	movq	%r12, %rdi
	callq	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	movl	%eax, %ebp
	movq	144(%rsp), %rdi
	cmpq	%r13, %rdi
	je	.LBB7_23
# %bb.22:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
                                        #   in Loop: Header=BB7_17 Depth=1
	callq	_ZdlPv
.LBB7_23:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
                                        #   in Loop: Header=BB7_17 Depth=1
	testb	%bpl, %bpl
	jne	.LBB7_17
.LBB7_24:
	leaq	192(%rsp), %rdi
	movq	40(%rsp), %rsi
	movq	48(%rsp), %rdx
.Ltmp29:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp30:
# %bb.25:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit44
	leaq	12(%rbx), %r13
.Ltmp31:
	leaq	176(%rsp), %rdi
	movq	%r13, %rsi
	callq	_ZNSirsERi
.Ltmp32:
# %bb.26:
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_27
# %bb.44:
	leaq	8(%rbx), %rbp
.Ltmp41:
	leaq	176(%rsp), %rdi
	movq	%rbp, %rsi
	callq	_ZNSirsERi
.Ltmp42:
# %bb.45:
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_54
# %bb.46:
	leaq	176(%rsp), %r12
	leaq	7(%rsp), %r15
.LBB7_47:                               # %.preheader143
                                        # =>This Inner Loop Header: Depth=1
.Ltmp51:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp52:
# %bb.48:                               #   in Loop: Header=BB7_47 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_58
# %bb.49:                               #   in Loop: Header=BB7_47 Depth=1
	movsbl	7(%rsp), %edi
	callq	isspace
	testl	%eax, %eax
	jne	.LBB7_47
# %bb.50:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp104:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp105:
# %bb.51:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit63
.Ltmp106:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp107:
# %bb.52:                               # %_ZNSolsEPFRSoS_E.exit65
.Ltmp108:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.13, %esi
	movl	$41, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp109:
# %bb.53:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit67
.Ltmp110:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp111:
	jmp	.LBB7_3
.LBB7_58:
	cmpl	$0, (%r13)
	jle	.LBB7_84
# %bb.59:
	cmpl	$0, (%rbp)
	jle	.LBB7_84
# %bb.60:                               # %.preheader139
	leaq	128(%rsp), %rbx
	leaq	40(%rsp), %r13
	leaq	112(%rsp), %rbp
.LBB7_61:                               # =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp54:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp55:
# %bb.62:                               # %.noexc74
                                        #   in Loop: Header=BB7_61 Depth=1
.Ltmp56:
	movsbl	%al, %edx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp57:
# %bb.63:                               #   in Loop: Header=BB7_61 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_68
# %bb.64:                               #   in Loop: Header=BB7_61 Depth=1
	movq	%rbx, 112(%rsp)
	movq	40(%rsp), %rsi
	movq	48(%rsp), %rdx
	addq	%rsi, %rdx
.Ltmp58:
	movq	%rbp, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp59:
# %bb.65:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit79
                                        #   in Loop: Header=BB7_61 Depth=1
	movq	%rbp, %rdi
	callq	_Z9isCommentNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
	movl	%eax, %r15d
	movq	112(%rsp), %rdi
	cmpq	%rbx, %rdi
	je	.LBB7_67
# %bb.66:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i80
                                        #   in Loop: Header=BB7_61 Depth=1
	callq	_ZdlPv
.LBB7_67:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit82
                                        #   in Loop: Header=BB7_61 Depth=1
	testb	%r15b, %r15b
	jne	.LBB7_61
.LBB7_68:
	leaq	96(%rsp), %r14
	movq	%r14, -16(%r14)
.Ltmp61:
	leaq	80(%rsp), %rdi
	movl	$.L.str.15, %esi
	movl	$.L.str.15, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp62:
# %bb.69:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit87
	leaq	200(%rsp), %rdi
.Ltmp64:
	leaq	80(%rsp), %rsi
	callq	_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strERKNS_12basic_stringIcS2_S3_EE
.Ltmp65:
	movq	72(%rsp), %rbx                  # 8-byte Reload
# %bb.70:                               # %_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strERKNS_12basic_stringIcS2_S3_EE.exit
	movq	80(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB7_72
# %bb.71:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i89
	callq	_ZdlPv
.LBB7_72:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit91
	movq	176(%rsp), %rax
	addq	-24(%rax), %r12
.Ltmp67:
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp68:
	leaq	192(%rsp), %rdi
# %bb.73:
	movq	40(%rsp), %rsi
	movq	48(%rsp), %rdx
.Ltmp69:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp70:
# %bb.74:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit93
	leaq	16(%rbx), %r14
.Ltmp71:
	leaq	176(%rsp), %rdi
	movq	%r14, %rsi
	callq	_ZNSirsERi
.Ltmp72:
# %bb.75:
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_86
# %bb.76:
	leaq	176(%rsp), %r15
	leaq	7(%rsp), %r12
.LBB7_77:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
.Ltmp81:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp82:
# %bb.78:                               #   in Loop: Header=BB7_77 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB7_95
# %bb.79:                               #   in Loop: Header=BB7_77 Depth=1
	movsbl	7(%rsp), %edi
	callq	isspace
	testl	%eax, %eax
	jne	.LBB7_77
# %bb.80:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp92:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp93:
# %bb.81:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit107
.Ltmp94:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp95:
# %bb.82:                               # %_ZNSolsEPFRSoS_E.exit109
.Ltmp96:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.17, %esi
	movl	$37, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp97:
# %bb.83:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit111
.Ltmp98:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp99:
	jmp	.LBB7_3
.LBB7_95:
	cmpl	$256, (%r14)                    # imm = 0x100
	jae	.LBB7_96
# %bb.100:
	movl	8(%rbx), %eax
	imull	12(%rbx), %eax
	movl	%eax, 28(%rbx)
	movq	8(%rsp), %rdi
	leaq	24(%rsp), %rax
	cmpq	%rax, %rdi
	leaq	56(%rsp), %rbx
	je	.LBB7_102
# %bb.101:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i122
	callq	_ZdlPv
.LBB7_102:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit124
	movq	40(%rsp), %rdi
	cmpq	%rbx, %rdi
	je	.LBB7_104
# %bb.103:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i125
	callq	_ZdlPv
.LBB7_104:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit127
	leaq	176(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	304(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$568, %rsp                      # imm = 0x238
	.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
.LBB7_34:
	.cfi_def_cfa_offset 624
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp13:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp14:
# %bb.35:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp15:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp16:
# %bb.36:                               # %_ZNSolsEPFRSoS_E.exit31
.Ltmp17:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$30, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp18:
# %bb.37:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit33
.Ltmp19:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp20:
.LBB7_3:                                # %_ZNSolsEPFRSoS_E.exit
	movl	$1002, %edi                     # imm = 0x3EA
	callq	exit
.LBB7_1:
.Ltmp0:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.8, %esi
	movl	$27, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp1:
# %bb.2:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp2:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp3:
	jmp	.LBB7_3
.LBB7_27:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp33:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp34:
# %bb.28:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit46
.Ltmp35:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp36:
# %bb.29:                               # %_ZNSolsEPFRSoS_E.exit48
.Ltmp37:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp38:
# %bb.30:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit50
.Ltmp39:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp40:
	jmp	.LBB7_3
.LBB7_54:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp43:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp44:
# %bb.55:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit54
.Ltmp45:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp46:
# %bb.56:                               # %_ZNSolsEPFRSoS_E.exit56
.Ltmp47:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.12, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp48:
# %bb.57:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit58
.Ltmp49:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp50:
	jmp	.LBB7_3
.LBB7_84:
.Ltmp100:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.14, %esi
	movl	$42, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp101:
# %bb.85:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit71
.Ltmp102:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp103:
	jmp	.LBB7_3
.LBB7_86:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp73:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp74:
# %bb.87:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit95
.Ltmp75:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp76:
# %bb.88:                               # %_ZNSolsEPFRSoS_E.exit97
.Ltmp77:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.16, %esi
	movl	$29, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp78:
# %bb.89:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit99
.Ltmp79:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp80:
	jmp	.LBB7_3
.LBB7_96:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp84:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp85:
# %bb.97:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit115
.Ltmp86:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp87:
# %bb.98:                               # %_ZNSolsEPFRSoS_E.exit117
.Ltmp88:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.18, %esi
	movl	$24, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp89:
# %bb.99:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit119
.Ltmp90:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp91:
	jmp	.LBB7_3
.LBB7_4:
.Ltmp4:
	jmp	.LBB7_5
.LBB7_91:
.Ltmp66:
	movq	%rax, %rbx
	movq	80(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB7_93
# %bb.92:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i102
	callq	_ZdlPv
	jmp	.LBB7_93
.LBB7_90:
.Ltmp63:
	jmp	.LBB7_33
.LBB7_31:
.Ltmp7:
.LBB7_5:
	movq	%rax, %rbx
	jmp	.LBB7_6
.LBB7_32:
.Ltmp12:
	jmp	.LBB7_33
.LBB7_38:
.Ltmp21:
	jmp	.LBB7_33
.LBB7_39:                               # %.loopexit
.Ltmp83:
	jmp	.LBB7_33
.LBB7_41:                               # %.loopexit.split-lp.loopexit.split-lp.loopexit
.Ltmp53:
	jmp	.LBB7_33
.LBB7_40:                               # %.loopexit.split-lp.loopexit
.Ltmp60:
	jmp	.LBB7_33
.LBB7_42:                               # %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit
.Ltmp28:
	jmp	.LBB7_33
.LBB7_43:                               # %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp
.Ltmp112:
.LBB7_33:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit42
	movq	%rax, %rbx
.LBB7_93:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit104
	leaq	56(%rsp), %r15
	leaq	24(%rsp), %rax
	movq	8(%rsp), %rdi
	cmpq	%rax, %rdi
	je	.LBB7_6
# %bb.94:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i128
	callq	_ZdlPv
.LBB7_6:
	movq	40(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB7_8
# %bb.7:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i131
	callq	_ZdlPv
.LBB7_8:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit133
	leaq	176(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	304(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end7:
	.size	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE, .Lfunc_end7-_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table7:
.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 .Ltmp5-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp6-.Ltmp5                  #   Call between .Ltmp5 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp11-.Ltmp8                 #   Call between .Ltmp8 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp27-.Ltmp22                #   Call between .Ltmp22 and .Ltmp27
	.uleb128 .Ltmp28-.Lfunc_begin0          #     jumps to .Ltmp28
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp42-.Ltmp29                #   Call between .Ltmp29 and .Ltmp42
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp51-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp52-.Ltmp51                #   Call between .Ltmp51 and .Ltmp52
	.uleb128 .Ltmp53-.Lfunc_begin0          #     jumps to .Ltmp53
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp104-.Lfunc_begin0         # >> Call Site 7 <<
	.uleb128 .Ltmp111-.Ltmp104              #   Call between .Ltmp104 and .Ltmp111
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp54-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp59-.Ltmp54                #   Call between .Ltmp54 and .Ltmp59
	.uleb128 .Ltmp60-.Lfunc_begin0          #     jumps to .Ltmp60
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp61-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp62-.Ltmp61                #   Call between .Ltmp61 and .Ltmp62
	.uleb128 .Ltmp63-.Lfunc_begin0          #     jumps to .Ltmp63
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp64-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp65-.Ltmp64                #   Call between .Ltmp64 and .Ltmp65
	.uleb128 .Ltmp66-.Lfunc_begin0          #     jumps to .Ltmp66
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp67-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp72-.Ltmp67                #   Call between .Ltmp67 and .Ltmp72
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp81-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp82-.Ltmp81                #   Call between .Ltmp81 and .Ltmp82
	.uleb128 .Ltmp83-.Lfunc_begin0          #     jumps to .Ltmp83
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp92-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp99-.Ltmp92                #   Call between .Ltmp92 and .Ltmp99
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Ltmp20-.Ltmp13                #   Call between .Ltmp13 and .Ltmp20
	.uleb128 .Ltmp21-.Lfunc_begin0          #     jumps to .Ltmp21
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 15 <<
	.uleb128 .Ltmp3-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp3
	.uleb128 .Ltmp4-.Lfunc_begin0           #     jumps to .Ltmp4
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp33-.Lfunc_begin0          # >> Call Site 16 <<
	.uleb128 .Ltmp91-.Ltmp33                #   Call between .Ltmp33 and .Ltmp91
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp91-.Lfunc_begin0          # >> Call Site 17 <<
	.uleb128 .Lfunc_end7-.Ltmp91            #   Call between .Ltmp91 and .Lfunc_end7
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_ZN5Image10scaleImageEv         # -- Begin function _ZN5Image10scaleImageEv
	.p2align	1, 0x90
	.type	_ZN5Image10scaleImageEv,@function
_ZN5Image10scaleImageEv:                # @_ZN5Image10scaleImageEv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movl	28(%rdi), %r14d
	testq	%r14, %r14
	je	.LBB8_1
# %bb.2:                                # %.lr.ph.i
	movq	32(%rbx), %rax
	movl	$255, %ecx
	xorl	%edx, %edx
.LBB8_3:                                # =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdx,4), %esi
	cmpl	%ecx, %esi
	cmovll	%esi, %ecx
	incq	%rdx
	cmpq	%rdx, %r14
	jne	.LBB8_3
# %bb.4:                                # %_ZN5Image7findMinEv.exit
	movl	%ecx, 20(%rbx)
	xorl	%edx, %edx
	xorl	%ecx, %ecx
.LBB8_5:                                # =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdx,4), %esi
	cmpl	%ecx, %esi
	cmovgl	%esi, %ecx
	incq	%rdx
	cmpq	%rdx, %r14
	jne	.LBB8_5
# %bb.6:                                # %_ZN5Image7findMaxEv.exit.loopexit
	shlq	$2, %r14
	jmp	.LBB8_7
.LBB8_1:                                # %_ZN5Image7findMinEv.exit.thread
	movl	$255, 20(%rbx)
	xorl	%r14d, %r14d
	xorl	%ecx, %ecx
.LBB8_7:                                # %_ZN5Image7findMaxEv.exit
	movl	%ecx, 24(%rbx)
	movq	%rsp, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB8_8
# %bb.10:
	movq	(%rsp), %rdi
	movq	32(%rbx), %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_11
# %bb.12:
	movl	$255, %edi
	addl	28(%rbx), %edi
	shrl	$8, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_14
# %bb.13:
	movq	(%rsp), %rdi
	movl	20(%rbx), %esi
	movl	24(%rbx), %edx
	movl	28(%rbx), %ecx
	callq	_Z29__device_stub__scaleImageCudaPiiii
.LBB8_14:
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB8_15
# %bb.16:
	movq	32(%rbx), %rdi
	movq	(%rsp), %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB8_17
# %bb.18:
	movq	(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB8_19
# %bb.20:
	callq	hipDeviceReset
	testl	%eax, %eax
	jne	.LBB8_21
# %bb.22:
	movl	$255, 16(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB8_8:
	.cfi_def_cfa_offset 32
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.19, %esi
	jmp	.LBB8_9
.LBB8_11:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.20, %esi
	jmp	.LBB8_9
.LBB8_15:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	jmp	.LBB8_9
.LBB8_17:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.22, %esi
	jmp	.LBB8_9
.LBB8_19:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.23, %esi
	jmp	.LBB8_9
.LBB8_21:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
.LBB8_9:
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end8:
	.size	_ZN5Image10scaleImageEv, .Lfunc_end8-_ZN5Image10scaleImageEv
	.cfi_endproc
                                        # -- End function
	.globl	_ZN5Image11edgeDectionEv        # -- Begin function _ZN5Image11edgeDectionEv
	.p2align	1, 0x90
	.type	_ZN5Image11edgeDectionEv,@function
_ZN5Image11edgeDectionEv:               # @_ZN5Image11edgeDectionEv
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	28(%rdi), %r15d
	shlq	$2, %r15
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r14
	leaq	16(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB9_1
# %bb.3:
	leaq	8(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB9_4
# %bb.5:
	movq	16(%rsp), %rdi
	movq	32(%rbx), %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB9_6
# %bb.7:
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB9_8
# %bb.9:
	movl	$255, %r12d
	addl	28(%rbx), %r12d
	shrl	$8, %r12d
	movl	$.L.str.29, %edi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	printf
	btsq	$32, %r12
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movq	%r12, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_11
# %bb.10:
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	8(%rbx), %ecx
	movl	12(%rbx), %edx
	movl	28(%rbx), %r8d
	callq	_Z32__device_stub__edgeDetectionCudaPiS_iii
.LBB9_11:
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB9_12
# %bb.13:
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB9_14
# %bb.15:
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB9_16
# %bb.17:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB9_22
# %bb.18:                               # %.preheader
	cmpl	$0, 28(%rbx)
	je	.LBB9_21
# %bb.19:                               # %.lr.ph
	movq	32(%rbx), %rax
	xorl	%ecx, %ecx
.LBB9_20:                               # =>This Inner Loop Header: Depth=1
	movl	(%r14,%rcx,4), %edx
	movl	%edx, (%rax,%rcx,4)
	incq	%rcx
	movl	28(%rbx), %edx
	cmpq	%rdx, %rcx
	jb	.LBB9_20
.LBB9_21:                               # %._crit_edge
	movq	%r14, %rdi
	callq	free
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB9_1:
	.cfi_def_cfa_offset 64
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.25, %esi
	jmp	.LBB9_2
.LBB9_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.26, %esi
	jmp	.LBB9_2
.LBB9_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.27, %esi
	jmp	.LBB9_2
.LBB9_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.28, %esi
	jmp	.LBB9_2
.LBB9_12:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.30, %esi
	jmp	.LBB9_2
.LBB9_14:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.31, %esi
	jmp	.LBB9_2
.LBB9_16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.32, %esi
	jmp	.LBB9_2
.LBB9_22:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.33, %esi
.LBB9_2:
	movq	%rbx, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end9:
	.size	_ZN5Image11edgeDectionEv, .Lfunc_end9-_ZN5Image11edgeDectionEv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	cmpl	$3, %edi
	jne	.LBB10_1
# %bb.2:
	movq	%rsi, %rdi
	callq	_Z3runPPc
	xorl	%eax, %eax
	jmp	.LBB10_3
.LBB10_1:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.34, %esi
	movl	$45, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$1, %eax
.LBB10_3:
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	main, .Lfunc_end10-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z3runPPc                       # -- Begin function _Z3runPPc
	.type	_Z3runPPc,@function
_Z3runPPc:                              # @_Z3runPPc
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$1080, %rsp                     # imm = 0x438
	.cfi_def_cfa_offset 1104
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	leaq	560(%rsp), %r14
	movq	%r14, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
	movq	8(%rbx), %rsi
.Ltmp113:
	movq	%r14, %rdi
	movl	$12, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp114:
# %bb.1:
.Ltmp116:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp117:
# %bb.2:
	movq	16(%rbx), %rsi
.Ltmp119:
	leaq	48(%rsp), %rdi
	movl	$52, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp120:
# %bb.3:
.Ltmp121:
	leaq	560(%rsp), %rdi
	callq	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
.Ltmp122:
# %bb.4:
	xorps	%xmm0, %xmm0
	leaq	8(%rsp), %rdi
	testb	%al, %al
	je	.LBB11_10
# %bb.5:
	movups	%xmm0, 8(%rdi)
	movq	$0, 24(%rdi)
	movq	$_ZTV11BinaryImage+16, (%rdi)
.Ltmp134:
	leaq	560(%rsp), %rsi
	callq	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
.Ltmp135:
# %bb.6:
.Ltmp136:
	leaq	8(%rsp), %rdi
	leaq	560(%rsp), %rsi
	callq	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
.Ltmp137:
# %bb.7:
.Ltmp138:
	leaq	8(%rsp), %rdi
	callq	_ZN5Image11edgeDectionEv
.Ltmp139:
# %bb.8:
.Ltmp140:
	leaq	8(%rsp), %rdi
	callq	_ZN5Image10scaleImageEv
.Ltmp141:
# %bb.9:
.Ltmp142:
	leaq	8(%rsp), %rdi
	leaq	48(%rsp), %rsi
	callq	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
.Ltmp143:
	jmp	.LBB11_15
.LBB11_10:
	movups	%xmm0, 8(%rdi)
	movq	$0, 24(%rdi)
	movq	$_ZTV10AsciiImage+16, (%rdi)
.Ltmp123:
	leaq	560(%rsp), %rsi
	callq	_ZN5Image10readHeaderERSt14basic_ifstreamIcSt11char_traitsIcEE
.Ltmp124:
# %bb.11:
.Ltmp125:
	leaq	8(%rsp), %rdi
	leaq	560(%rsp), %rsi
	callq	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
.Ltmp126:
# %bb.12:
.Ltmp127:
	leaq	8(%rsp), %rdi
	callq	_ZN5Image11edgeDectionEv
.Ltmp128:
# %bb.13:
.Ltmp129:
	leaq	8(%rsp), %rdi
	callq	_ZN5Image10scaleImageEv
.Ltmp130:
# %bb.14:
.Ltmp131:
	leaq	8(%rsp), %rdi
	leaq	48(%rsp), %rsi
	callq	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
.Ltmp132:
.LBB11_15:
.Ltmp145:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp146:
# %bb.16:
.Ltmp147:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp148:
# %bb.17:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	56(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 48(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	296(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$1080, %rsp                     # imm = 0x438
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB11_18:
	.cfi_def_cfa_offset 1104
.Ltmp118:
	jmp	.LBB11_20
.LBB11_19:
.Ltmp115:
.LBB11_20:
	movq	%rax, %rbx
	jmp	.LBB11_25
.LBB11_21:
.Ltmp133:
	jmp	.LBB11_24
.LBB11_22:
.Ltmp144:
	jmp	.LBB11_24
.LBB11_23:
.Ltmp149:
.LBB11_24:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB11_25:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end11:
	.size	_Z3runPPc, .Lfunc_end11-_Z3runPPc
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table11:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp113-.Lfunc_begin1         #   Call between .Lfunc_begin1 and .Ltmp113
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp113-.Lfunc_begin1         # >> Call Site 2 <<
	.uleb128 .Ltmp114-.Ltmp113              #   Call between .Ltmp113 and .Ltmp114
	.uleb128 .Ltmp115-.Lfunc_begin1         #     jumps to .Ltmp115
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp116-.Lfunc_begin1         # >> Call Site 3 <<
	.uleb128 .Ltmp117-.Ltmp116              #   Call between .Ltmp116 and .Ltmp117
	.uleb128 .Ltmp118-.Lfunc_begin1         #     jumps to .Ltmp118
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp119-.Lfunc_begin1         # >> Call Site 4 <<
	.uleb128 .Ltmp122-.Ltmp119              #   Call between .Ltmp119 and .Ltmp122
	.uleb128 .Ltmp149-.Lfunc_begin1         #     jumps to .Ltmp149
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp134-.Lfunc_begin1         # >> Call Site 5 <<
	.uleb128 .Ltmp143-.Ltmp134              #   Call between .Ltmp134 and .Ltmp143
	.uleb128 .Ltmp144-.Lfunc_begin1         #     jumps to .Ltmp144
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp123-.Lfunc_begin1         # >> Call Site 6 <<
	.uleb128 .Ltmp132-.Ltmp123              #   Call between .Ltmp123 and .Ltmp132
	.uleb128 .Ltmp133-.Lfunc_begin1         #     jumps to .Ltmp133
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp145-.Lfunc_begin1         # >> Call Site 7 <<
	.uleb128 .Ltmp148-.Ltmp145              #   Call between .Ltmp145 and .Ltmp148
	.uleb128 .Ltmp149-.Lfunc_begin1         #     jumps to .Ltmp149
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp148-.Lfunc_begin1         # >> Call Site 8 <<
	.uleb128 .Lfunc_end11-.Ltmp148          #   Call between .Ltmp148 and .Lfunc_end11
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE # -- Begin function _Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
	.type	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE,@function
_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE: # @_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	leaq	15(%rsp), %r14
	movb	$32, (%r14)
	leaq	32(%rsp), %r15
	movq	%r15, -16(%r15)
	leaq	16(%rsp), %rdi
	movl	$.L.str.9, %esi
	movl	$.L.str.9+32, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp150:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp151:
# %bb.1:
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB12_3
# %bb.2:
	cmpb	$80, 15(%rsp)
	jne	.LBB12_3
# %bb.11:
.Ltmp152:
	leaq	15(%rsp), %rsi
	movq	%rbx, %rdi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp153:
# %bb.12:
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB12_15
# %bb.13:
	movzbl	15(%rsp), %ebx
	cmpl	$50, %ebx
	je	.LBB12_19
# %bb.14:
	cmpl	$53, %ebx
	jne	.LBB12_15
.LBB12_19:
	movq	16(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB12_21
# %bb.20:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i16
	callq	_ZdlPv
.LBB12_21:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit18
	cmpb	$53, %bl
	sete	%al
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB12_15:
	.cfi_def_cfa_offset 80
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp154:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp155:
# %bb.16:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit13
.Ltmp156:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp157:
# %bb.17:                               # %_ZNSolsEPFRSoS_E.exit14
	movsbl	15(%rsp), %esi
.Ltmp158:
	movl	$_ZSt4cerr, %edi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c
.Ltmp159:
# %bb.18:
.Ltmp160:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp161:
	jmp	.LBB12_7
.LBB12_3:
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp162:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp163:
# %bb.4:                                # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp164:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp165:
# %bb.5:                                # %_ZNSolsEPFRSoS_E.exit
.Ltmp166:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.35, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp167:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp168:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp169:
.LBB12_7:                               # %_ZNSolsEPFRSoS_E.exit12
	movl	$1002, %edi                     # imm = 0x3EA
	callq	exit
.LBB12_8:
.Ltmp170:
	movq	%rax, %rbx
	movq	16(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB12_10
# %bb.9:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB12_10:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end12:
	.size	_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE, .Lfunc_end12-_Z8isBinaryRSt14basic_ifstreamIcSt11char_traitsIcEE
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table12:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp150-.Lfunc_begin2         #   Call between .Lfunc_begin2 and .Ltmp150
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp150-.Lfunc_begin2         # >> Call Site 2 <<
	.uleb128 .Ltmp169-.Ltmp150              #   Call between .Ltmp150 and .Ltmp169
	.uleb128 .Ltmp170-.Lfunc_begin2         #     jumps to .Ltmp170
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp169-.Lfunc_begin2         # >> Call Site 3 <<
	.uleb128 .Lfunc_end12-.Ltmp169          #   Call between .Ltmp169 and .Lfunc_end12
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZN5ImageD2Ev,"axG",@progbits,_ZN5ImageD2Ev,comdat
	.weak	_ZN5ImageD2Ev                   # -- Begin function _ZN5ImageD2Ev
	.p2align	1, 0x90
	.type	_ZN5ImageD2Ev,@function
_ZN5ImageD2Ev:                          # @_ZN5ImageD2Ev
	.cfi_startproc
# %bb.0:
	retq
.Lfunc_end13:
	.size	_ZN5ImageD2Ev, .Lfunc_end13-_ZN5ImageD2Ev
	.cfi_endproc
                                        # -- End function
	.section	.text._ZN11BinaryImageD0Ev,"axG",@progbits,_ZN11BinaryImageD0Ev,comdat
	.weak	_ZN11BinaryImageD0Ev            # -- Begin function _ZN11BinaryImageD0Ev
	.p2align	1, 0x90
	.type	_ZN11BinaryImageD0Ev,@function
_ZN11BinaryImageD0Ev:                   # @_ZN11BinaryImageD0Ev
	.cfi_startproc
# %bb.0:
	jmp	_ZdlPv                          # TAILCALL
.Lfunc_end14:
	.size	_ZN11BinaryImageD0Ev, .Lfunc_end14-_ZN11BinaryImageD0Ev
	.cfi_endproc
                                        # -- End function
	.section	.text._ZN10AsciiImageD0Ev,"axG",@progbits,_ZN10AsciiImageD0Ev,comdat
	.weak	_ZN10AsciiImageD0Ev             # -- Begin function _ZN10AsciiImageD0Ev
	.p2align	1, 0x90
	.type	_ZN10AsciiImageD0Ev,@function
_ZN10AsciiImageD0Ev:                    # @_ZN10AsciiImageD0Ev
	.cfi_startproc
# %bb.0:
	jmp	_ZdlPv                          # TAILCALL
.Lfunc_end15:
	.size	_ZN10AsciiImageD0Ev, .Lfunc_end15-_ZN10AsciiImageD0Ev
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB16_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB16_3
.LBB16_1:                               # %._crit_edge
	movq	(%rbx), %rax
.LBB16_3:
	testq	%r14, %r14
	je	.LBB16_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB16_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB16_7
.LBB16_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB16_7:                               # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end16:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end16-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB17_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB17_3
.LBB17_1:                               # %._crit_edge
	movq	(%rbx), %rax
.LBB17_3:
	testq	%r14, %r14
	je	.LBB17_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB17_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB17_7
.LBB17_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB17_7:                               # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end17:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag, .Lfunc_end17-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB18_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB18_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14scaleImageCudaPiiii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17edgeDetectionCudaPiS_iii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end18:
	.size	__hip_module_ctor, .Lfunc_end18-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB19_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB19_2:
	retq
.Lfunc_end19:
	.size	__hip_module_dtor, .Lfunc_end19-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z14scaleImageCudaPiiii,@object # @_Z14scaleImageCudaPiiii
	.section	.rodata,"a",@progbits
	.globl	_Z14scaleImageCudaPiiii
	.p2align	3, 0x0
_Z14scaleImageCudaPiiii:
	.quad	_Z29__device_stub__scaleImageCudaPiiii
	.size	_Z14scaleImageCudaPiiii, 8

	.type	_Z17edgeDetectionCudaPiS_iii,@object # @_Z17edgeDetectionCudaPiS_iii
	.globl	_Z17edgeDetectionCudaPiS_iii
	.p2align	3, 0x0
_Z17edgeDetectionCudaPiS_iii:
	.quad	_Z32__device_stub__edgeDetectionCudaPiS_iii
	.size	_Z17edgeDetectionCudaPiS_iii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Could not read from file!"
	.size	.L.str, 26

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error: cannot read pixels."
	.size	.L.str.1, 27

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Could not write to file."
	.size	.L.str.2, 25

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Error: error writing to file."
	.size	.L.str.5, 30

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Could not read from file."
	.size	.L.str.6, 26

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Error: Could not open file."
	.size	.L.str.8, 28

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Error: incorrect picture format."
	.size	.L.str.9, 33

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Extra info after magic number."
	.size	.L.str.10, 31

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Cannot read width."
	.size	.L.str.11, 19

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Cannot read height."
	.size	.L.str.12, 20

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Extra info when reading height and width."
	.size	.L.str.13, 42

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Error: width and height cannot be negative"
	.size	.L.str.14, 43

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.zero	1
	.size	.L.str.15, 1

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Could not read maxPixelValue."
	.size	.L.str.16, 30

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Extra info after the max pixel value."
	.size	.L.str.17, 38

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Invalid max pixel value."
	.size	.L.str.18, 25

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Failed to allocate device vector pixels (error code %s)!\n"
	.size	.L.str.19, 58

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Failed to copy vector pixels from host to device (error code %s)!\n"
	.size	.L.str.20, 67

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"Failed to launch scaleImageCuda kernel (error code %s)!\n"
	.size	.L.str.21, 57

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"Failed to copy vector pixels from device to host (error code %s)!\n"
	.size	.L.str.22, 67

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"Failed to free device vector pixels (error code %s)!\n"
	.size	.L.str.23, 54

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"Failed to deinitialize the device! error=%s\n"
	.size	.L.str.24, 45

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"Failed to allocate device array pixels (error code %s)!\n"
	.size	.L.str.25, 57

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	"Failed to allocate device array tempImage (error code %s)!\n"
	.size	.L.str.26, 60

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"Failed to copy array pixels from host to device (error code %s)!\n"
	.size	.L.str.27, 66

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"Failed to copy array tempImage from host to device (error code %s)!\n"
	.size	.L.str.28, 69

	.type	.L.str.29,@object               # @.str.29
.L.str.29:
	.asciz	"blocks=%d\n"
	.size	.L.str.29, 11

	.type	.L.str.30,@object               # @.str.30
.L.str.30:
	.asciz	"Failed to launch edgeDetectionCuda kernel (error code %s)!\n"
	.size	.L.str.30, 60

	.type	.L.str.31,@object               # @.str.31
.L.str.31:
	.asciz	"Failed to copy array tempImage from device to host (error code %s)!\n"
	.size	.L.str.31, 69

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"Failed to free array vector tempImage (error code %s)!\n"
	.size	.L.str.32, 56

	.type	.L.str.33,@object               # @.str.33
.L.str.33:
	.asciz	"Failed to free array vector pixels (error code %s)!\n"
	.size	.L.str.33, 53

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"Usage: EdgeDetection imageName.pgm output.pgm"
	.size	.L.str.34, 46

	.type	.L.str.35,@object               # @.str.35
.L.str.35:
	.asciz	"P"
	.size	.L.str.35, 2

	.type	_ZTV11BinaryImage,@object       # @_ZTV11BinaryImage
	.section	.rodata,"a",@progbits
	.globl	_ZTV11BinaryImage
	.p2align	3, 0x0
_ZTV11BinaryImage:
	.quad	0
	.quad	_ZTI11BinaryImage
	.quad	_ZN5ImageD2Ev
	.quad	_ZN11BinaryImageD0Ev
	.quad	_ZN11BinaryImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.quad	_ZN11BinaryImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.size	_ZTV11BinaryImage, 48

	.type	_ZTS11BinaryImage,@object       # @_ZTS11BinaryImage
	.globl	_ZTS11BinaryImage
_ZTS11BinaryImage:
	.asciz	"11BinaryImage"
	.size	_ZTS11BinaryImage, 14

	.type	_ZTS5Image,@object              # @_ZTS5Image
	.section	.rodata._ZTS5Image,"aG",@progbits,_ZTS5Image,comdat
	.weak	_ZTS5Image
_ZTS5Image:
	.asciz	"5Image"
	.size	_ZTS5Image, 7

	.type	_ZTI5Image,@object              # @_ZTI5Image
	.section	.rodata._ZTI5Image,"aG",@progbits,_ZTI5Image,comdat
	.weak	_ZTI5Image
	.p2align	3, 0x0
_ZTI5Image:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTS5Image
	.size	_ZTI5Image, 16

	.type	_ZTI11BinaryImage,@object       # @_ZTI11BinaryImage
	.section	.rodata,"a",@progbits
	.globl	_ZTI11BinaryImage
	.p2align	3, 0x0
_ZTI11BinaryImage:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS11BinaryImage
	.quad	_ZTI5Image
	.size	_ZTI11BinaryImage, 24

	.type	_ZTV10AsciiImage,@object        # @_ZTV10AsciiImage
	.globl	_ZTV10AsciiImage
	.p2align	3, 0x0
_ZTV10AsciiImage:
	.quad	0
	.quad	_ZTI10AsciiImage
	.quad	_ZN5ImageD2Ev
	.quad	_ZN10AsciiImageD0Ev
	.quad	_ZN10AsciiImage9readImageERSt14basic_ifstreamIcSt11char_traitsIcEE
	.quad	_ZN10AsciiImage10writeImageERSt14basic_ofstreamIcSt11char_traitsIcEE
	.size	_ZTV10AsciiImage, 48

	.type	_ZTS10AsciiImage,@object        # @_ZTS10AsciiImage
	.globl	_ZTS10AsciiImage
_ZTS10AsciiImage:
	.asciz	"10AsciiImage"
	.size	_ZTS10AsciiImage, 13

	.type	_ZTI10AsciiImage,@object        # @_ZTI10AsciiImage
	.globl	_ZTI10AsciiImage
	.p2align	3, 0x0
_ZTI10AsciiImage:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS10AsciiImage
	.quad	_ZTI5Image
	.size	_ZTI10AsciiImage, 24

	.type	.L__unnamed_1,@object           # @0
	.section	.rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
	.asciz	"_Z14scaleImageCudaPiiii"
	.size	.L__unnamed_1, 24

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17edgeDetectionCudaPiS_iii"
	.size	.L__unnamed_2, 29

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.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 _Z29__device_stub__scaleImageCudaPiiii
	.addrsig_sym _Z32__device_stub__edgeDetectionCudaPiS_iii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z14scaleImageCudaPiiii
	.addrsig_sym _Z17edgeDetectionCudaPiS_iii
	.addrsig_sym _ZSt4cerr
	.addrsig_sym _ZTVN10__cxxabiv120__si_class_type_infoE
	.addrsig_sym _ZTS11BinaryImage
	.addrsig_sym _ZTVN10__cxxabiv117__class_type_infoE
	.addrsig_sym _ZTS5Image
	.addrsig_sym _ZTI5Image
	.addrsig_sym _ZTI11BinaryImage
	.addrsig_sym _ZTS10AsciiImage
	.addrsig_sym _ZTI10AsciiImage
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z14scaleImageCudaPiiii ; -- Begin function _Z14scaleImageCudaPiiii
	.globl	_Z14scaleImageCudaPiiii
	.p2align	8
	.type	_Z14scaleImageCudaPiiii,@function
_Z14scaleImageCudaPiiii:                ; @_Z14scaleImageCudaPiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s6, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_sub_i32 s0, s5, s4
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0)
	v_subrev_nc_u32_e32 v4, s4, v2
	v_cvt_f64_i32_e32 v[2:3], s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_i32_e32 v[4:5], v4
	v_div_scale_f64 v[6:7], null, v[2:3], v[2:3], v[4:5]
	v_div_scale_f64 v[12:13], vcc_lo, v[4:5], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[8:9], v[6:7]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[12:13], v[8:9]
	v_fma_f64 v[6:7], -v[6:7], v[10:11], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[10:11]
	v_div_fixup_f64 v[2:3], v[6:7], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[2:3], 0x406fe000, v[2:3]
	v_trunc_f64_e32 v[4:5], v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[2:3], -v[4:5]
	v_cmp_ge_f64_e64 s0, |v[6:7]|, 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v2, 0, 0x3ff00000, s0
	v_bfi_b32 v3, 0x7fffffff, v2, v3
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[2:3], v[4:5], v[2:3]
	v_cvt_i32_f64_e32 v2, v[2:3]
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14scaleImageCudaPiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z14scaleImageCudaPiiii, .Lfunc_end0-_Z14scaleImageCudaPiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 360
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17edgeDetectionCudaPiS_iii ; -- Begin function _Z17edgeDetectionCudaPiS_iii
	.globl	_Z17edgeDetectionCudaPiS_iii
	.p2align	8
	.type	_Z17edgeDetectionCudaPiS_iii,@function
_Z17edgeDetectionCudaPiS_iii:           ; @_Z17edgeDetectionCudaPiS_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b128 s[8:11], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s10, v1
	s_cbranch_execz .LBB1_8
; %bb.1:
	v_mov_b32_e32 v0, 0
	v_mov_b32_e32 v4, 0
	s_mov_b32 s2, exec_lo
	v_cmpx_ne_u32_e32 0, v1
	s_cbranch_execz .LBB1_3
; %bb.2:
	v_cvt_f64_i32_e32 v[2:3], v1
	v_cvt_f64_i32_e32 v[4:5], s8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[6:7], null, v[4:5], v[4:5], v[2:3]
	v_rcp_f64_e32 v[8:9], v[6:7]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]
	v_div_scale_f64 v[10:11], vcc_lo, v[2:3], v[4:5], v[2:3]
	v_mul_f64 v[12:13], v[10:11], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], -v[6:7], v[12:13], v[10:11]
	v_div_fmas_f64 v[6:7], v[6:7], v[8:9], v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[2:3], v[6:7], v[4:5], v[2:3]
	v_floor_f64_e32 v[2:3], v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f64_e32 v4, v[2:3]
.LBB1_3:
	s_or_b32 exec_lo, exec_lo, s2
	s_ashr_i32 s2, s8, 31
	s_load_b128 s[4:7], s[0:1], 0x0
	s_add_i32 s3, s8, s2
	s_add_i32 s0, s8, -1
	s_xor_b32 s2, s3, s2
	s_mov_b32 s1, exec_lo
	v_cvt_f32_u32_e32 v2, s2
	s_sub_i32 s3, 0, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v2, v2
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v2, 0x4f7ffffe, v2
	v_cvt_u32_f32_e32 v3, v2
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v5, s3, v3
	v_add_nc_u32_e32 v6, v1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v6, v6, v2
	v_mul_hi_u32 v5, v3, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, v3, v5
	v_mul_hi_u32 v3, v6, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v3, s2
	v_sub_nc_u32_e32 v3, v6, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v5, s2, v3
	v_cmp_le_u32_e32 vcc_lo, s2, v3
	v_cndmask_b32_e32 v3, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v5, s2, v3
	v_cmp_le_u32_e32 vcc_lo, s2, v3
	v_cndmask_b32_e32 v3, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v3, v3, v2
	v_sub_nc_u32_e32 v3, v3, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s0, v3
	s_cbranch_execz .LBB1_7
; %bb.4:
	v_min_i32_e32 v0, v4, v3
	s_add_i32 s0, s9, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s0, v4
	v_cmp_lt_i32_e64 s0, 0, v0
	v_mov_b32_e32 v0, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s0, vcc_lo
	s_and_saveexec_b32 s0, s2
	s_cbranch_execz .LBB1_6
; %bb.5:
	v_add_nc_u32_e32 v0, -1, v4
	v_mul_lo_u32 v4, v4, s8
	v_ashrrev_i32_e32 v10, 31, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v0, v0, s8
	v_ashrrev_i32_e32 v5, 31, v4
	v_add_nc_u32_e32 v9, s8, v4
	v_add_co_u32 v4, vcc_lo, v4, v3
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v8, 31, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, v5, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_ashrrev_i32_e32 v11, 31, v9
	v_add_co_u32 v7, vcc_lo, v0, v3
	v_add_co_ci_u32_e32 v8, vcc_lo, v8, v10, vcc_lo
	v_add_nc_u32_e32 v6, v9, v3
	v_add_co_u32 v9, vcc_lo, v9, v3
	v_add_co_ci_u32_e32 v10, vcc_lo, v11, v10, vcc_lo
	v_add_nc_u32_e32 v3, v0, v3
	v_lshlrev_b64 v[11:12], 2, v[7:8]
	v_ashrrev_i32_e32 v7, 31, v6
	s_delay_alu instid0(VALU_DEP_4)
	v_lshlrev_b64 v[8:9], 2, v[9:10]
	v_lshlrev_b64 v[13:14], 2, v[4:5]
	v_ashrrev_i32_e32 v4, 31, v3
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v10, vcc_lo, s4, v11
	v_lshlrev_b64 v[5:6], 2, v[6:7]
	v_add_co_ci_u32_e32 v11, vcc_lo, s5, v12, vcc_lo
	v_add_co_u32 v7, vcc_lo, s4, v8
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v9, vcc_lo
	v_add_co_u32 v5, vcc_lo, s4, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s5, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_u32 v3, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	v_add_co_u32 v12, vcc_lo, s4, v13
	v_add_co_ci_u32_e32 v13, vcc_lo, s5, v14, vcc_lo
	s_clause 0x7
	global_load_b32 v0, v[5:6], off
	global_load_b32 v3, v[3:4], off
	global_load_b32 v4, v[7:8], off offset:4
	global_load_b32 v5, v[7:8], off offset:-4
	global_load_b32 v6, v[12:13], off offset:-4
	global_load_b32 v7, v[10:11], off offset:4
	global_load_b32 v8, v[10:11], off offset:-4
	global_load_b32 v9, v[12:13], off offset:4
	s_waitcnt vmcnt(6)
	v_sub_nc_u32_e32 v0, v0, v3
	s_waitcnt vmcnt(2)
	v_add_nc_u32_e32 v10, v4, v7
	s_waitcnt vmcnt(1)
	v_add_nc_u32_e32 v11, v8, v5
	v_add_nc_u32_e32 v3, v7, v8
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v6, v9, v6
	v_lshlrev_b32_e32 v0, 1, v0
	v_sub_nc_u32_e32 v7, v10, v11
	v_sub_nc_u32_e32 v3, v4, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v4, v6, 1, v7
	v_add3_u32 v0, v3, v5, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v3, v4, v4
	v_mul_lo_u32 v0, v0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_f64_i32_e32 v[3:4], v3
	v_cvt_f64_i32_e32 v[5:6], v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[3:4], v[3:4], v[5:6]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[3:4]
	v_cndmask_b32_e64 v0, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v0, 8, v0
	v_ldexp_f64 v[3:4], v[3:4], v0
	v_cndmask_b32_e64 v0, 0, 0xffffff80, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_rsq_f64_e32 v[5:6], v[3:4]
	v_cmp_class_f64_e64 vcc_lo, v[3:4], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[7:8], v[3:4], v[5:6]
	v_mul_f64 v[5:6], v[5:6], 0.5
	v_fma_f64 v[9:10], -v[5:6], v[7:8], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[7:8], v[7:8], v[9:10], v[7:8]
	v_fma_f64 v[5:6], v[5:6], v[9:10], v[5:6]
	v_fma_f64 v[9:10], -v[7:8], v[7:8], v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], v[9:10], v[5:6], v[7:8]
	v_fma_f64 v[9:10], -v[7:8], v[7:8], v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], v[9:10], v[5:6], v[7:8]
	v_ldexp_f64 v[5:6], v[5:6], v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v4, v6, v4 :: v_dual_cndmask_b32 v3, v5, v3
	v_rndne_f64_e32 v[3:4], v[3:4]
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f64_e32 v0, v[3:4]
.LBB1_6:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s0
.LBB1_7:                                ; %.sink.split
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_or_b32 exec_lo, exec_lo, s1
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v1, vcc_lo, s6, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s7, v2, vcc_lo
	global_store_b32 v[1:2], v0, off
.LBB1_8:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17edgeDetectionCudaPiS_iii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 15
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z17edgeDetectionCudaPiS_iii, .Lfunc_end1-_Z17edgeDetectionCudaPiS_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1084
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 15
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14scaleImageCudaPiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14scaleImageCudaPiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17edgeDetectionCudaPiS_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17edgeDetectionCudaPiS_iii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
