#include <stdio.h>
#include <stdint.h>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define CHECK(call)\
{\
    const cudaError_t error = call;\
    if (error != cudaSuccess)\
    {\
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);\
        fprintf(stderr, "code: %d, reason: %s\n", error,\
                cudaGetErrorString(error));\
        exit(EXIT_FAILURE);\
    }\
}

struct GpuTimer
{
    cudaEvent_t start;
    cudaEvent_t stop;

    GpuTimer()
    {
        cudaEventCreate(&start);
        cudaEventCreate(&stop);
    }

    ~GpuTimer()
    {
        cudaEventDestroy(start);
        cudaEventDestroy(stop);
    }

    void Start()
    {
        cudaEventRecord(start, 0);                                                                 
        cudaEventSynchronize(start);
    }

    void Stop()
    {
        cudaEventRecord(stop, 0);
    }

    float Elapsed()
    {
        float elapsed;
        cudaEventSynchronize(stop);
        cudaEventElapsedTime(&elapsed, start, stop);
        return elapsed;
    }
};

void readPnm(char * fileName, int &width, int &height, uchar3 * &pixels)
{
    FILE * f = fopen(fileName, "r");
    if (f == NULL)
    {
        printf("Cannot read %s\n", fileName);
        exit(EXIT_FAILURE);
    }

    char type[3];
    fscanf(f, "%s", type);
    
    if (strcmp(type, "P3") != 0) // In this exercise, we don't touch other types
    {
        fclose(f);
        printf("Cannot read %s\n", fileName); 
        exit(EXIT_FAILURE); 
    }

    fscanf(f, "%i", &width);
    fscanf(f, "%i", &height);
    
    int max_val;
    fscanf(f, "%i", &max_val);
    if (max_val > 255) // In this exercise, we assume 1 byte per value
    {
        fclose(f);
        printf("Cannot read %s\n", fileName); 
        exit(EXIT_FAILURE); 
    }

    pixels = (uchar3 *)malloc(width * height * sizeof(uchar3));
    for (int i = 0; i < width * height; i++)
        fscanf(f, "%hhu%hhu%hhu", &pixels[i].x, &pixels[i].y, &pixels[i].z);

    fclose(f);
}

void writePnm(uchar3 *pixels, int width, int height, int originalWidth, char *fileName)
{
    FILE * f = fopen(fileName, "w");
    if (f == NULL)
    {
        printf("Cannot write %s\n", fileName);
        exit(EXIT_FAILURE);
    }   

    fprintf(f, "P3\n%i\n%i\n255\n", width, height); 

    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int i = r * originalWidth + c;
            fprintf(f, "%hhu\n%hhu\n%hhu\n", pixels[i].x, pixels[i].y, pixels[i].z);
        }
    }
    
    fclose(f);
}

int xSobel[3][3] = {{1,0,-1},{2,0,-2},{1,0,-1}};
int ySobel[3][3] = {{1,2,1},{0,0,0},{-1,-2,-1}};

__constant__ int d_xSobel[9] = {1, 0, -1, 2, 0, -2, 1, 0, -1};
__constant__ int d_ySobel[9] = {1, 2, 1, 0, 0, 0, -1, -2, -1};

__device__ int d_originalWidth;

__global__ void convertRgb2GrayKernel(uchar3 * inPixels, int width, int height, uint8_t * outPixels) {
    size_t row = blockIdx.y * blockDim.y + threadIdx.y;
    size_t col = blockIdx.x * blockDim.x + threadIdx.x;
    size_t idx = row * width + col;
    if (row < height && col < width) {
        outPixels[idx] = 0.299f * inPixels[idx].x
                    + 0.587f * inPixels[idx].y
                    + 0.114f * inPixels[idx].z;
    }
}

__global__ void computePriorityKernel(uint8_t * inPixels, int width, int height, int * priority) {
    int filterWidth = 3;

    size_t row = blockIdx.y * blockDim.y + threadIdx.y;
    size_t col = blockIdx.x * blockDim.x + threadIdx.x;

    size_t s_width = blockDim.x + filterWidth - 1;
    size_t s_height = blockDim.y + filterWidth - 1;

    // Each block loads data from GMEM to SMEM
    extern __shared__ uint8_t s_inPixels[];

    int readRow = row - (filterWidth >> 1), readCol, tmpRow, tmpCol;
    int firstReadCol = col - (filterWidth >> 1);
    size_t virtualRow = threadIdx.y, virtualCol;
    for (; virtualRow < s_height; readRow += blockDim.y, virtualRow += blockDim.y) {
        tmpRow = readRow;
        if (readRow < 0) {
            readRow = 0;
        } else if (readRow >= height) {
            readRow = height - 1;
        }
        readCol = firstReadCol;
        virtualCol = threadIdx.x;
        for (; virtualCol < s_width; readCol += blockDim.x, virtualCol += blockDim.x) {
            tmpCol = readCol;
            if (readCol < 0) {
                readCol = 0;
            } else if (readCol >= width) {
                readCol = width - 1;
            }
            s_inPixels[virtualRow * s_width + virtualCol] = inPixels[readRow * d_originalWidth + readCol];
            readCol = tmpCol;
        }
        readRow = tmpRow;
    } 
    __syncthreads();
    // ---------------------------------------

    // Each thread compute priority on SMEM
    int x = 0, y = 0;
    for (int i = 0; i < filterWidth; ++i) {
        for (int j = 0; j < filterWidth; ++j) {
            uint8_t closest = s_inPixels[(threadIdx.y + i) * s_width + threadIdx.x + j];
            size_t filterIdx = i * filterWidth + j;
            x += closest * d_xSobel[filterIdx];
            y += closest * d_ySobel[filterIdx];
        }
    }

    // Each thread writes result from SMEM to GMEM
    if (col < width && row < height) {
        size_t idx = row * d_originalWidth + col;
        priority[idx] = abs(x) + abs(y);
    }
}

__global__ void carvingKernel(int *leastSignificantPixel, uchar3 *outPixels, uint8_t *grayPixels, int * priority, int width) {
    int row = blockIdx.x;
    int baseIdx = row * d_originalWidth;
    for (int i = leastSignificantPixel[row]; i < width - 1; ++i) {
        outPixels[baseIdx + i] = outPixels[baseIdx + i + 1];
        grayPixels[baseIdx + i] = grayPixels[baseIdx + i + 1];
        priority[baseIdx + i] = priority[baseIdx + i + 1];
    }
}

void trace(int *score, int *leastSignificantPixel, int width, int height, int originalWidth) {
    int minCol = 0, r = height - 1;
    for (int c = 1; c < width; ++c) {
        if (score[r * originalWidth + c] < score[r * originalWidth + minCol])
            minCol = c;
    }
    for (; r >= 0; --r) {
        leastSignificantPixel[r] = minCol;
        if (r > 0) {
            int aboveIdx = (r - 1) * originalWidth + minCol;
            int min = score[aboveIdx], minColCpy = minCol;
            if (minColCpy > 0 && score[aboveIdx - 1] < min) {
                min = score[aboveIdx - 1];
                minCol = minColCpy - 1;
            }
            if (minColCpy < width - 1 && score[aboveIdx + 1] < min) {
                minCol = minColCpy + 1;
            }
        }
    }
}

__global__ void computeSeamScoreTableKernel(int *priority, int *score, int width, int height, int fromRow) {
    size_t halfBlock = blockDim.x >> 1;

    int col = blockIdx.x * halfBlock - halfBlock + threadIdx.x;

    if (fromRow == 0 && col >= 0 && col < width) {
        score[col] = priority[col];
    }
    __syncthreads();

    for (int stride = fromRow != 0 ? 0 : 1; stride < halfBlock && fromRow + stride < height; ++stride) {
        if (threadIdx.x < blockDim.x - (stride << 1)) {
            int curRow = fromRow + stride;
            int curCol = col + stride;

            if (curCol >= 0 && curCol < width) {
                int idx = curRow * d_originalWidth + curCol;
                int aboveIdx = (curRow - 1) * d_originalWidth + curCol;

                int min = score[aboveIdx];
                if (curCol > 0 && score[aboveIdx - 1] < min) {
                    min = score[aboveIdx - 1];
                }
                if (curCol < width - 1 && score[aboveIdx + 1] < min) {
                    min = score[aboveIdx + 1];
                }

                score[idx] = min + priority[idx];
            }
        }
        __syncthreads();
    }
}

void seamCarvingByDevice(uchar3 *inPixels, int width, int height, int targetWidth, uchar3* outPixels, dim3 blockSize) {
    GpuTimer timer;
    timer.Start();

    // allocate kernel memory
    uchar3 *d_inPixels;
    CHECK(cudaMalloc(&d_inPixels, width * height * sizeof(uchar3)));
    uint8_t * d_grayPixels;
    CHECK(cudaMalloc(&d_grayPixels, width * height * sizeof(uint8_t)));
    int * d_priority;
    CHECK(cudaMalloc(&d_priority, width * height * sizeof(int)));
    int * d_leastSignificantPixel;
    CHECK(cudaMalloc(&d_leastSignificantPixel, height * sizeof(int)));
    int * d_score;
    CHECK(cudaMalloc(&d_score, width * height * sizeof(int)));

    // allocate host memory
    int * priority = (int *)malloc(width * height * sizeof(int));
    int * leastSignificantPixel = (int *)malloc(height * sizeof(int));
    int * score = (int *)malloc(width * height * sizeof(int));

    // dynamically sized smem used to compute priority
    size_t smemSize = ((blockSize.x + 3 - 1) * (blockSize.y + 3 - 1)) * sizeof(uint8_t);
    
    // block size use to calculate seam score table
    int blockSizeDp = 256;
    int gridSizeDp = (((width - 1) / blockSizeDp + 1) << 1) + 1;
    int stripHeight = (blockSizeDp >> 1) + 1;

    // cache original width
    CHECK(cudaMemcpyToSymbol(d_originalWidth, &width, sizeof(int)));
    const int originalWidth = width;

    // copy input to device
    CHECK(cudaMemcpy(d_inPixels, inPixels, width * height * sizeof(uchar3), cudaMemcpyHostToDevice));

    // turn input image to grayscale
    dim3 gridSize((width-1)/blockSize.x + 1, (height-1)/blockSize.y + 1);
    convertRgb2GrayKernel<<<gridSize, blockSize>>>(d_inPixels, width, height, d_grayPixels);
    cudaDeviceSynchronize();
    CHECK(cudaGetLastError());

    // carve until reach desired width
    while (width > targetWidth) {
        // update priority
        computePriorityKernel<<<gridSize, blockSize, smemSize>>>(d_grayPixels, width, height, d_priority);
        cudaDeviceSynchronize();
        CHECK(cudaGetLastError());

        // compute min seam table
        for (int i = 0; i < height; i += (stripHeight >> 1)) {
            computeSeamScoreTableKernel<<<gridSizeDp, blockSizeDp>>>(d_priority, d_score, width, height, i);
            cudaDeviceSynchronize();
            CHECK(cudaGetLastError());
        }

        // find least significant pixel index of each row and store in d_leastSignificantPixel (SEQUENTIAL, in kernel or host)
        CHECK(cudaMemcpy(score, d_score, originalWidth * height * sizeof(int), cudaMemcpyDeviceToHost));
        trace(score, leastSignificantPixel, width, height, originalWidth);

        // carve
        CHECK(cudaMemcpy(d_leastSignificantPixel, leastSignificantPixel, height * sizeof(int), cudaMemcpyHostToDevice));
        carvingKernel<<<height, 1>>>(d_leastSignificantPixel, d_inPixels, d_grayPixels, d_priority, width);
        cudaDeviceSynchronize();
        CHECK(cudaGetLastError());
        
        --width;
    }

    CHECK(cudaMemcpy(outPixels, d_inPixels, originalWidth * height * sizeof(uchar3), cudaMemcpyDeviceToHost));

    CHECK(cudaFree(d_inPixels));
    CHECK(cudaFree(d_grayPixels));
    CHECK(cudaFree(d_priority));
    CHECK(cudaFree(d_leastSignificantPixel));
    CHECK(cudaFree(d_score));

    free(score);
    free(leastSignificantPixel);
    free(priority);

    timer.Stop();
    float time = timer.Elapsed();
    printf("Processing time (use device): %f ms\n\n", time);    
}

uint8_t getClosest(uint8_t *pixels, int r, int c, int width, int height, int originalWidth)
{
    if (r < 0) {
        r = 0;
    } else if (r >= height) {
        r = height - 1;
    }

    if (c < 0) {
        c = 0;
    } else if (c >= width) {
        c = width - 1;
    }

    return pixels[r * originalWidth + c];
}

int computePixelPriority(uint8_t * grayPixels, int row, int col, int width, int height, int originalWidth) {
    int x = 0, y = 0;
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            uint8_t closest = getClosest(grayPixels, row - 1 + i, col - 1 + j, width, height, originalWidth);
            x += closest * xSobel[i][j];
            y += closest * ySobel[i][j];
        }
    }
    return abs(x) + abs(y);
}

void convertRgb2Gray(uchar3 * inPixels, int width, int height, uint8_t * outPixels) {
    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int i = r * width + c;
            outPixels[i] = 0.299f * inPixels[i].x + 0.587f * inPixels[i].y + 0.114f * inPixels[i].z;
        }
    }
}

void computeSeamScoreTable(int *priority, int *score, int width, int height, int originalWidth) {
    for (int c = 0; c < width; ++c) {
        score[c] = priority[c];
    }
    for (int r = 1; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int idx = r * originalWidth + c;
            int aboveIdx = (r - 1) * originalWidth + c;

            int min = score[aboveIdx];
            if (c > 0 && score[aboveIdx - 1] < min) {
                min = score[aboveIdx - 1];
            }
            if (c < width - 1 && score[aboveIdx + 1] < min) {
                min = score[aboveIdx + 1];
            }

            score[idx] = min + priority[idx];
        }
    }
}

void seamCarvingByHost(uchar3 *inPixels, int width, int height, int targetWidth, uchar3* outPixels) {
    GpuTimer timer;
    timer.Start();

    memcpy(outPixels, inPixels, width * height * sizeof(uchar3));

    const int originalWidth = width;

    // allocate memory
    int *priority = (int *)malloc(width * height * sizeof(int));
    int *score = (int *)malloc(width * height * sizeof(int));
    uint8_t *grayPixels= (uint8_t *)malloc(width * height * sizeof(uint8_t));
    
    // turn input image to grayscale
    convertRgb2Gray(inPixels, width, height, grayPixels);

    // compute pixel priority
    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            priority[r * originalWidth + c] = computePixelPriority(grayPixels, r, c, width, height, width);
        }
    }

    while (width > targetWidth) {
        // compute min seam table
        computeSeamScoreTable(priority, score, width, height, originalWidth);

        // find min index of last row
        int minCol = 0, r = height - 1, prevMinCol;
        for (int c = 1; c < width; ++c) {
            if (score[r * originalWidth + c] < score[r * originalWidth + minCol])
                minCol = c;
        }

        // trace and remove seam from last to first row
        for (; r >= 0; --r) {
            // remove seam pixel on row r
            for (int i = minCol; i < width - 1; ++i) {
                outPixels[r * originalWidth + i] = outPixels[r * originalWidth + i + 1];
                grayPixels[r * originalWidth + i] = grayPixels[r * originalWidth + i + 1];
                priority[r * originalWidth + i] = priority[r * originalWidth + i + 1];
            }

            // update priority
            if (r < height - 1) {
                for (int affectedCol = max(0, prevMinCol - 2); affectedCol <= prevMinCol + 2 && affectedCol < width - 1; ++affectedCol) {
                    priority[(r + 1) * originalWidth + affectedCol] = computePixelPriority(grayPixels, r + 1, affectedCol, width - 1, height, originalWidth);
                }
            }

            // trace up
            if (r > 0) {
                prevMinCol = minCol;

                int aboveIdx = (r - 1) * originalWidth + minCol;
                int min = score[aboveIdx], minColCpy = minCol;
                if (minColCpy > 0 && score[aboveIdx - 1] < min) {
                    min = score[aboveIdx - 1];
                    minCol = minColCpy - 1;
                }
                if (minColCpy < width - 1 && score[aboveIdx + 1] < min) {
                    minCol = minColCpy + 1;
                }
            }
        }

        for (int affectedCol = max(0, minCol - 2); affectedCol <= minCol + 2 && affectedCol < width - 1; ++affectedCol) {
            priority[affectedCol] = computePixelPriority(grayPixels, 0, affectedCol, width - 1, height, originalWidth);
        }

        --width;
    }
    
    free(grayPixels);
    free(score);
    free(priority);

    timer.Stop();
    float time = timer.Elapsed();
    printf("Processing time (use host): %f ms\n\n", time);
}

float computeError(uchar3 * a1, uchar3 * a2, int n)
{
    float err = 0;
    for (int i = 0; i < n; i++)
    {
        err += abs((int)a1[i].x - (int)a2[i].x);
        err += abs((int)a1[i].y - (int)a2[i].y);
        err += abs((int)a1[i].z - (int)a2[i].z);
    }
    err /= (n * 3);
    return err;
}

char *concatStr(const char * s1, const char * s2)
{
    char * result = (char *)malloc(strlen(s1) + strlen(s2) + 1);
    strcpy(result, s1);
    strcat(result, s2);
    return result;
}

void printDeviceInfo()
{
    cudaDeviceProp devProv;
    CHECK(cudaGetDeviceProperties(&devProv, 0));
    printf("**********GPU info**********\n");
    printf("Name: %s\n", devProv.name);
    printf("Compute capability: %d.%d\n", devProv.major, devProv.minor);
    printf("Num SMs: %d\n", devProv.multiProcessorCount);
    printf("Max num threads per SM: %d\n", devProv.maxThreadsPerMultiProcessor); 
    printf("Max num warps per SM: %d\n", devProv.maxThreadsPerMultiProcessor / devProv.warpSize);
    printf("GMEM: %lu bytes\n", devProv.totalGlobalMem);
    printf("CMEM: %lu bytes\n", devProv.totalConstMem);
    printf("L2 cache: %i bytes\n", devProv.l2CacheSize);
    printf("SMEM / one SM: %lu bytes\n", devProv.sharedMemPerMultiprocessor);

    printf("****************************\n\n");

}

int main(int argc, char ** argv)
{   
    if (argc != 4 && argc != 6)
    {
        printf("The number of arguments is invalid\n");
        return EXIT_FAILURE;
    }

    printDeviceInfo();

    // Read input RGB image file
    int width, height;
    uchar3 *inPixels;
    readPnm(argv[1], width, height, inPixels);
    printf("Image size (width x height): %i x %i\n\n", width, height);

    int numSeamRemoved = stoi(argv[3]);
    if (numSeamRemoved <= 0 || numSeamRemoved >= width)
        return EXIT_FAILURE; // invalid ratio
    printf("Number of seam removed: %d\n\n", numSeamRemoved);

    int targetWidth = width - numSeamRemoved;

    // seam carving using host
    uchar3 * correctOutPixels = (uchar3 *)malloc(width * height * sizeof(uchar3));
    seamCarvingByHost(inPixels, width, height, targetWidth, correctOutPixels);

    // seam carving using device
    uchar3 * outPixels= (uchar3 *)malloc(width * height * sizeof(uchar3));
    dim3 blockSize(32, 32); // Default
    if (argc == 6)
    {
        blockSize.x = atoi(argv[4]);
        blockSize.y = atoi(argv[5]);
    } 
    seamCarvingByDevice(inPixels, width, height, targetWidth, outPixels, blockSize);

    // Compute mean absolute error between host result and device result
    float err = computeError(outPixels, correctOutPixels, width * height);
    printf("Error between device result and host result: %f\n", err);

    // Write results to files
    char *outFileNameBase = strtok(argv[2], "."); // Get rid of extension
    writePnm(correctOutPixels, targetWidth, height, width, concatStr(outFileNameBase, "_host.pnm"));
    writePnm(outPixels, targetWidth, height, width, concatStr(outFileNameBase, "_device.pnm"));

    // Free memories
    free(inPixels);
    free(correctOutPixels);
    free(outPixels);
}

	.file	"tmpxft_002bad4e_00000000-6_device.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3301:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3301:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD5Ev,comdat
	.align 2
	.weak	_ZN8GpuTimerD2Ev
	.type	_ZN8GpuTimerD2Ev, @function
_ZN8GpuTimerD2Ev:
.LFB3281:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3281
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
	call	cudaEventDestroy@PLT
	movq	8(%rbx), %rdi
	call	cudaEventDestroy@PLT
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3281:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZN8GpuTimerD2Ev,"aG",@progbits,_ZN8GpuTimerD5Ev,comdat
.LLSDA3281:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3281-.LLSDACSB3281
.LLSDACSB3281:
.LLSDACSE3281:
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD5Ev,comdat
	.size	_ZN8GpuTimerD2Ev, .-_ZN8GpuTimerD2Ev
	.weak	_ZN8GpuTimerD1Ev
	.set	_ZN8GpuTimerD1Ev,_ZN8GpuTimerD2Ev
	.section	.text._ZN8GpuTimer7ElapsedEv,"axG",@progbits,_ZN8GpuTimer7ElapsedEv,comdat
	.align 2
	.weak	_ZN8GpuTimer7ElapsedEv
	.type	_ZN8GpuTimer7ElapsedEv, @function
_ZN8GpuTimer7ElapsedEv:
.LFB3285:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	8(%rdi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	cudaEventSynchronize@PLT
	movq	8(%rbx), %rdx
	movq	(%rbx), %rsi
	leaq	4(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movss	4(%rsp), %xmm0
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3285:
	.size	_ZN8GpuTimer7ElapsedEv, .-_ZN8GpuTimer7ElapsedEv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"Cannot read %s\n"
.LC2:
	.string	"%s"
.LC3:
	.string	"P3"
.LC4:
	.string	"%i"
.LC5:
	.string	"%hhu%hhu%hhu"
	.text
	.globl	_Z7readPnmPcRiS0_RP6uchar3
	.type	_Z7readPnmPcRiS0_RP6uchar3, @function
_Z7readPnmPcRiS0_RP6uchar3:
.LFB3286:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rcx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	leaq	.LC0(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	testq	%rax, %rax
	je	.L16
	leaq	5(%rsp), %r15
	movq	%rax, %rdi
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rbx
	movq	%r15, %rdx
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	leaq	.LC3(%rip), %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L10
.L17:
	movq	%rbx, %rdi
	call	fclose@PLT
.L16:
	movl	$2, %edi
	movq	%r14, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	leaq	.LC4(%rip), %r15
	movq	%r12, %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%r15, %rsi
	call	__isoc23_fscanf@PLT
	movq	%rbp, %rdx
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	xorl	%eax, %eax
	movq	%rsp, %rdx
	movq	%r15, %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	cmpl	$255, (%rsp)
	jg	.L17
	movl	(%r12), %edi
	imull	0(%rbp), %edi
	xorl	%r15d, %r15d
	leaq	.LC5(%rip), %r14
	movslq	%edi, %rdi
	leaq	(%rdi,%rdi,2), %rdi
	call	malloc@PLT
	movq	%rax, 0(%r13)
.L12:
	movl	(%r12), %eax
	imull	0(%rbp), %eax
	cmpl	%r15d, %eax
	jle	.L18
	leaq	(%r15,%r15,2), %rdx
	addq	0(%r13), %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	leaq	1(%rdx), %rcx
	leaq	2(%rdx), %r8
	xorl	%eax, %eax
	incq	%r15
	call	__isoc23_fscanf@PLT
	jmp	.L12
.L18:
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	addq	$24, %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
.LFE3286:
	.size	_Z7readPnmPcRiS0_RP6uchar3, .-_Z7readPnmPcRiS0_RP6uchar3
	.section	.rodata.str1.1
.LC6:
	.string	"w"
.LC7:
	.string	"Cannot write %s\n"
.LC8:
	.string	"P3\n%i\n%i\n255\n"
.LC9:
	.string	"%hhu\n%hhu\n%hhu\n"
	.text
	.globl	_Z8writePnmP6uchar3iiiPc
	.type	_Z8writePnmP6uchar3iiiPc, @function
_Z8writePnmP6uchar3iiiPc:
.LFB3287:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	movq	%r8, %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	leaq	.LC6(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r8, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	fopen@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	jne	.L20
	movl	$2, %edi
	movq	%rbx, %rdx
	leaq	.LC7(%rip), %rsi
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L20:
	movq	(%rsp), %rdi
	movl	%r12d, %r8d
	movl	%ebp, %ecx
	leaq	.LC8(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
.L21:
	cmpl	%r12d, %r11d
	jge	.L23
	movslq	%r10d, %rbx
	xorl	%r13d, %r13d
	leaq	(%rbx,%rbx,2), %rbx
	addq	%r14, %rbx
.L24:
	cmpl	%ebp, %r13d
	jge	.L26
	movzbl	(%rbx), %ecx
	movzbl	2(%rbx), %r9d
	movl	$2, %esi
	xorl	%eax, %eax
	movzbl	1(%rbx), %r8d
	movq	(%rsp), %rdi
	incl	%r13d
	addq	$3, %rbx
	leaq	.LC9(%rip), %rdx
	movl	%r10d, 12(%rsp)
	movl	%r11d, 8(%rsp)
	call	__fprintf_chk@PLT
	movl	12(%rsp), %r10d
	movl	8(%rsp), %r11d
	jmp	.L24
.L26:
	incl	%r11d
	addl	%r15d, %r10d
	jmp	.L21
.L23:
	movq	(%rsp), %rdi
	addq	$24, %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
	jmp	fclose@PLT
	.cfi_endproc
.LFE3287:
	.size	_Z8writePnmP6uchar3iiiPc, .-_Z8writePnmP6uchar3iiiPc
	.globl	_Z5tracePiS_iii
	.type	_Z5tracePiS_iii, @function
_Z5tracePiS_iii:
.LFB3288:
	.cfi_startproc
	endbr64
	movq	%rsi, %r10
	movl	%edx, %esi
	movl	%ecx, %edx
	decl	%ecx
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$1, %r9d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%ecx, %ebx
	imull	%r8d, %ebx
	movslq	%ebx, %rax
	leaq	(%rdi,%rax,4), %rbp
	xorl	%eax, %eax
.L28:
	cmpl	%r9d, %esi
	jle	.L39
	leal	(%rbx,%rax), %r11d
	movslq	%r11d, %r11
	movl	(%rdi,%r11,4), %r11d
	cmpl	%r11d, 0(%rbp,%r9,4)
	cmovl	%r9d, %eax
	incq	%r9
	jmp	.L28
.L39:
	subl	$2, %edx
	movslq	%ecx, %rcx
	decl	%esi
	imull	%r8d, %edx
.L31:
	testl	%ecx, %ecx
	js	.L40
	movl	%eax, (%r10,%rcx,4)
	movl	%eax, %r9d
	je	.L32
	leal	(%rdx,%rax), %r9d
	movslq	%r9d, %r9
	movl	(%rdi,%r9,4), %r11d
	leaq	0(,%r9,4), %rbx
	movl	%eax, %r9d
	testl	%eax, %eax
	jle	.L33
	movl	-4(%rdi,%rbx), %ebp
	cmpl	%r11d, %ebp
	jge	.L33
	leal	-1(%rax), %r9d
	movl	%ebp, %r11d
.L33:
	cmpl	%eax, %esi
	jle	.L32
	cmpl	%r11d, 4(%rdi,%rbx)
	jge	.L32
	leal	1(%rax), %r9d
.L32:
	decq	%rcx
	subl	%r8d, %edx
	movl	%r9d, %eax
	jmp	.L31
.L40:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3288:
	.size	_Z5tracePiS_iii, .-_Z5tracePiS_iii
	.globl	_Z10getClosestPhiiiii
	.type	_Z10getClosestPhiiiii, @function
_Z10getClosestPhiiiii:
.LFB3290:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testl	%esi, %esi
	js	.L44
	cmpl	%r8d, %esi
	jl	.L42
	leal	-1(%r8), %esi
	jmp	.L42
.L44:
	xorl	%esi, %esi
.L42:
	testl	%edx, %edx
	js	.L45
	cmpl	%ecx, %edx
	jl	.L43
	leal	-1(%rcx), %edx
	jmp	.L43
.L45:
	xorl	%edx, %edx
.L43:
	imull	%r9d, %esi
	addl	%edx, %esi
	movslq	%esi, %rsi
	movb	(%rax,%rsi), %al
	ret
	.cfi_endproc
.LFE3290:
	.size	_Z10getClosestPhiiiii, .-_Z10getClosestPhiiiii
	.globl	_Z20computePixelPriorityPhiiiii
	.type	_Z20computePixelPriorityPhiiiii, @function
_Z20computePixelPriorityPhiiiii:
.LFB3291:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	-1(%rsi), %eax
	xorl	%r11d, %r11d
	leaq	ySobel(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	xSobel(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	pushq	%r10
	.cfi_def_cfa_offset 64
	xorl	%r10d, %r10d
	movl	%eax, (%rsp)
	leal	2(%rdx), %eax
	movl	%eax, 4(%rsp)
.L47:
	leal	-1(%r12), %r13d
	movq	%rbp, %rbx
.L48:
	movl	(%rsp), %esi
	movl	%r13d, %edx
	incl	%r13d
	call	_Z10getClosestPhiiiii
	movl	(%r14,%rbx), %esi
	movzbl	%al, %eax
	imull	%eax, %esi
	imull	(%r15,%rbx), %eax
	addq	$4, %rbx
	addl	%esi, %r11d
	addl	%eax, %r10d
	cmpl	%r13d, 4(%rsp)
	jne	.L48
	addq	$12, %rbp
	incl	(%rsp)
	cmpq	$36, %rbp
	jne	.L47
	movl	%r11d, %eax
	movl	%r10d, %edx
	negl	%eax
	cmovs	%r11d, %eax
	negl	%edx
	cmovs	%r10d, %edx
	addl	%edx, %eax
	popq	%rdx
	.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
.LFE3291:
	.size	_Z20computePixelPriorityPhiiiii, .-_Z20computePixelPriorityPhiiiii
	.globl	_Z15convertRgb2GrayP6uchar3iiPh
	.type	_Z15convertRgb2GrayP6uchar3iiPh, @function
_Z15convertRgb2GrayP6uchar3iiPh:
.LFB3292:
	.cfi_startproc
	endbr64
	xorl	%r11d, %r11d
	movq	%rdi, %r8
	movl	%edx, %r10d
	movq	%rcx, %rdi
	movss	.LC10(%rip), %xmm2
	movss	.LC11(%rip), %xmm3
	xorl	%r9d, %r9d
	movss	.LC12(%rip), %xmm4
	cmpl	%edx, %r11d
	jl	.L61
	ret
.L61:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
.L59:
	movslq	%r9d, %rdx
	xorl	%ecx, %ecx
	leaq	(%rdx,%rdx,2), %rax
	addq	%rdi, %rdx
	addq	%r8, %rax
.L56:
	cmpl	%ecx, %esi
	jle	.L62
	movzbl	(%rax), %ebx
	addq	$3, %rax
	cvtsi2ssl	%ebx, %xmm0
	movzbl	-2(%rax), %ebx
	cvtsi2ssl	%ebx, %xmm1
	movzbl	-1(%rax), %ebx
	mulss	%xmm2, %xmm0
	mulss	%xmm3, %xmm1
	addss	%xmm1, %xmm0
	cvtsi2ssl	%ebx, %xmm1
	mulss	%xmm4, %xmm1
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %ebx
	movb	%bl, (%rdx,%rcx)
	incq	%rcx
	jmp	.L56
.L62:
	incl	%r11d
	addl	%esi, %r9d
	cmpl	%r10d, %r11d
	jl	.L59
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3292:
	.size	_Z15convertRgb2GrayP6uchar3iiPh, .-_Z15convertRgb2GrayP6uchar3iiPh
	.globl	_Z21computeSeamScoreTablePiS_iii
	.type	_Z21computeSeamScoreTablePiS_iii, @function
_Z21computeSeamScoreTablePiS_iii:
.LFB3293:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r10
	movl	%edx, %r9d
	movq	%rsi, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%ecx, %ebx
.L64:
	cmpl	%eax, %r9d
	jle	.L76
	movl	(%r10,%rax,4), %edx
	movl	%edx, (%rdi,%rax,4)
	incq	%rax
	jmp	.L64
.L76:
	xorl	%eax, %eax
	movl	$1, %r11d
	leal	-1(%r9), %r12d
.L66:
	cmpl	%ebx, %r11d
	jge	.L63
	leal	(%rax,%r8), %ebp
	leaq	(%rdi,%rax,4), %rsi
	xorl	%ecx, %ecx
	movslq	%ebp, %rdx
	salq	$2, %rdx
.L71:
	cmpl	%r9d, %ecx
	jge	.L77
	movl	(%rsi), %eax
	testl	%ecx, %ecx
	je	.L67
	movl	-4(%rsi), %r13d
	cmpl	%r13d, %eax
	cmovg	%r13d, %eax
.L67:
	cmpl	%ecx, %r12d
	jle	.L68
	movl	4(%rsi), %r13d
	cmpl	%r13d, %eax
	cmovg	%r13d, %eax
.L68:
	addl	(%r10,%rdx), %eax
	incl	%ecx
	addq	$4, %rsi
	movl	%eax, (%rdi,%rdx)
	addq	$4, %rdx
	jmp	.L71
.L77:
	incl	%r11d
	movslq	%ebp, %rax
	jmp	.L66
.L63:
	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
.LFE3293:
	.size	_Z21computeSeamScoreTablePiS_iii, .-_Z21computeSeamScoreTablePiS_iii
	.section	.rodata.str1.1
.LC13:
	.string	"Processing time (use host): %f ms\n\n"
	.text
	.globl	_Z17seamCarvingByHostP6uchar3iiiS0_
	.type	_Z17seamCarvingByHostP6uchar3iiiS0_, @function
_Z17seamCarvingByHostP6uchar3iiiS0_:
.LFB3294:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3294
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r8, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movl	%edx, 4(%rsp)
	leaq	88(%rsp), %rdi
	movl	%ecx, 64(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
.LEHB0:
	call	cudaEventCreate@PLT
	leaq	96(%rsp), %rdi
	call	cudaEventCreate@PLT
.LEHE0:
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
.LEHB1:
	call	cudaEventRecord@PLT
	movq	88(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	4(%rsp), %r15d
	movq	%r14, %rdi
	movq	%rbx, %rsi
	imull	%ebp, %r15d
	movslq	%r15d, %r15
	leaq	(%r15,%r15,2), %rcx
	leaq	0(,%r15,4), %r12
	rep movsb
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	xorl	%r12d, %r12d
	movq	%rax, %r13
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movl	4(%rsp), %edx
	movl	%ebp, %esi
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movq	%rax, 16(%rsp)
	call	_Z15convertRgb2GrayP6uchar3iiPh
	xorl	%esi, %esi
.L79:
	movl	4(%rsp), %eax
	cmpl	%eax, %esi
	jge	.L81
	movslq	%r12d, %rax
	xorl	%ebx, %ebx
	leaq	0(%r13,%rax,4), %r15
.L82:
	movl	%ebx, %edx
	cmpl	%ebx, %ebp
	jle	.L114
	movl	4(%rsp), %r8d
	movq	16(%rsp), %rdi
	movl	%ebp, %r9d
	movl	%ebp, %ecx
	movl	%esi, 28(%rsp)
	call	_Z20computePixelPriorityPhiiiii
	movl	28(%rsp), %esi
	movl	%eax, (%r15,%rbx,4)
	incq	%rbx
	jmp	.L82
.L114:
	incl	%esi
	addl	%ebp, %r12d
	jmp	.L79
.L81:
	movl	4(%rsp), %eax
	movq	8(%rsp), %rdx
	leal	-1(%rbp), %r15d
	decl	%eax
	movl	%eax, 28(%rsp)
	imull	%ebp, %eax
	movl	%eax, 32(%rsp)
	movl	4(%rsp), %eax
	subl	$2, %eax
	imull	%ebp, %eax
	movl	%eax, 52(%rsp)
	movslq	32(%rsp), %rax
	leaq	(%rdx,%rax,4), %rax
	movq	%rax, 56(%rsp)
.L83:
	movl	64(%rsp), %eax
	leal	1(%r15), %r12d
	cmpl	%eax, %r12d
	jle	.L115
	movl	4(%rsp), %ecx
	movq	8(%rsp), %rsi
	movl	%ebp, %r8d
	movl	%r12d, %edx
	movq	%r13, %rdi
	xorl	%ebx, %ebx
	call	_Z21computeSeamScoreTablePiS_iii
	movl	$1, %eax
.L84:
	cmpl	%eax, %r12d
	jle	.L116
	movl	32(%rsp), %ecx
	movq	8(%rsp), %rsi
	leal	(%rcx,%rbx), %edx
	movq	56(%rsp), %rcx
	movslq	%edx, %rdx
	movl	(%rsi,%rdx,4), %edx
	cmpl	%edx, (%rcx,%rax,4)
	cmovl	%eax, %ebx
	incq	%rax
	jmp	.L84
.L116:
	movl	52(%rsp), %eax
	movl	32(%rsp), %r11d
	movl	28(%rsp), %r10d
	movl	%eax, 36(%rsp)
.L87:
	testl	%r10d, %r10d
	js	.L97
	movslq	%ebx, %rdx
	movslq	%r11d, %rax
	addq	%rdx, %rax
.L98:
	cmpl	%edx, %r15d
	jle	.L117
	leaq	(%rax,%rax,2), %rcx
	incq	%rdx
	movw	3(%r14,%rcx), %si
	movw	%si, (%r14,%rcx)
	movb	5(%r14,%rcx), %sil
	movb	%sil, 2(%r14,%rcx)
	movq	16(%rsp), %rcx
	movq	16(%rsp), %rsi
	movb	1(%rcx,%rax), %cl
	movb	%cl, (%rsi,%rax)
	movl	4(%r13,%rax,4), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	incq	%rax
	jmp	.L98
.L117:
	cmpl	%r10d, 28(%rsp)
	jg	.L89
.L95:
	testl	%r10d, %r10d
	jne	.L90
	movl	%ebx, %eax
	movl	24(%rsp), %ebx
	jmp	.L91
.L89:
	leal	1(%r10), %eax
	movl	%eax, 48(%rsp)
	movl	24(%rsp), %eax
	leal	-2(%rax), %r12d
	xorl	%eax, %eax
	testl	%r12d, %r12d
	cmovs	%eax, %r12d
	leal	(%r11,%rbp), %eax
	cltq
	leaq	0(%r13,%rax,4), %rax
	movslq	%r12d, %r12
	movq	%rax, 40(%rsp)
	movl	24(%rsp), %eax
	addl	$2, %eax
	movl	%eax, 68(%rsp)
.L92:
	movl	%r12d, %edx
	cmpl	%r12d, 68(%rsp)
	jl	.L95
	cmpl	%r12d, %r15d
	jle	.L95
	movl	4(%rsp), %r8d
	movl	48(%rsp), %esi
	movl	%ebp, %r9d
	movl	%r15d, %ecx
	movq	16(%rsp), %rdi
	movl	%r11d, 76(%rsp)
	movl	%r10d, 72(%rsp)
	call	_Z20computePixelPriorityPhiiiii
	movq	40(%rsp), %rdx
	movl	76(%rsp), %r11d
	movl	72(%rsp), %r10d
	movl	%eax, (%rdx,%r12,4)
	incq	%r12
	jmp	.L92
.L90:
	movl	36(%rsp), %eax
	movq	8(%rsp), %rdx
	addl	%ebx, %eax
	cltq
	movl	(%rdx,%rax,4), %edx
	leaq	0(,%rax,4), %rcx
	movl	%ebx, %eax
	testl	%ebx, %ebx
	jle	.L96
	movq	8(%rsp), %rsi
	movl	-4(%rsi,%rcx), %esi
	cmpl	%edx, %esi
	jge	.L96
	leal	-1(%rbx), %eax
	movl	%esi, %edx
.L96:
	cmpl	%r15d, %ebx
	jge	.L91
	movq	8(%rsp), %rdi
	cmpl	%edx, 4(%rdi,%rcx)
	jge	.L91
	leal	1(%rbx), %eax
.L91:
	movl	%ebx, 24(%rsp)
	decl	%r10d
	subl	%ebp, %r11d
	movl	%eax, %ebx
	subl	%ebp, 36(%rsp)
	jmp	.L87
.L97:
	leal	-2(%rbx), %r12d
	xorl	%eax, %eax
	testl	%r12d, %r12d
	cmovs	%eax, %r12d
	addl	$2, %ebx
	movslq	%r12d, %r12
.L99:
	movl	%r12d, %edx
	cmpl	%r12d, %ebx
	jl	.L100
	cmpl	%r15d, %r12d
	jge	.L100
	movl	4(%rsp), %r8d
	movq	16(%rsp), %rdi
	movl	%ebp, %r9d
	movl	%r15d, %ecx
	xorl	%esi, %esi
	call	_Z20computePixelPriorityPhiiiii
	movl	%eax, 0(%r13,%r12,4)
	incq	%r12
	jmp	.L99
.L100:
	decl	%r15d
	jmp	.L83
.L115:
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	88(%rsp), %rbx
	movq	%rbx, %rdi
	call	_ZN8GpuTimer7ElapsedEv
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.LEHE1:
	movq	%rbx, %rdi
	call	_ZN8GpuTimerD1Ev
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L105
	jmp	.L112
.L108:
	endbr64
	movq	%rax, %rbx
.L103:
	leaq	88(%rsp), %rdi
	call	_ZN8GpuTimerD1Ev
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L112:
	call	__stack_chk_fail@PLT
.L105:
	addq	$120, %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
.LFE3294:
	.section	.gcc_except_table,"a",@progbits
.LLSDA3294:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3294-.LLSDACSB3294
.LLSDACSB3294:
	.uleb128 .LEHB0-.LFB3294
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3294
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L108-.LFB3294
	.uleb128 0
	.uleb128 .LEHB2-.LFB3294
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3294:
	.text
	.size	_Z17seamCarvingByHostP6uchar3iiiS0_, .-_Z17seamCarvingByHostP6uchar3iiiS0_
	.globl	_Z12computeErrorP6uchar3S0_i
	.type	_Z12computeErrorP6uchar3S0_i, @function
_Z12computeErrorP6uchar3S0_i:
.LFB3295:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	xorps	%xmm0, %xmm0
.L119:
	cmpl	%edx, %r8d
	jge	.L121
	movzbl	(%rsi,%rax), %r9d
	movzbl	(%rdi,%rax), %ecx
	subl	%r9d, %ecx
	movl	%ecx, %r9d
	negl	%r9d
	cmovns	%r9d, %ecx
	movzbl	1(%rsi,%rax), %r9d
	cvtsi2ssl	%ecx, %xmm1
	movzbl	1(%rdi,%rax), %ecx
	subl	%r9d, %ecx
	movl	%ecx, %r9d
	negl	%r9d
	addss	%xmm1, %xmm0
	cmovns	%r9d, %ecx
	movzbl	2(%rsi,%rax), %r9d
	cvtsi2ssl	%ecx, %xmm1
	movzbl	2(%rdi,%rax), %ecx
	subl	%r9d, %ecx
	movl	%ecx, %r9d
	negl	%r9d
	addss	%xmm0, %xmm1
	cmovns	%r9d, %ecx
	incl	%r8d
	addq	$3, %rax
	cvtsi2ssl	%ecx, %xmm0
	addss	%xmm1, %xmm0
	jmp	.L119
.L121:
	leal	(%rdx,%rdx,2), %edx
	cvtsi2ssl	%edx, %xmm1
	divss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE3295:
	.size	_Z12computeErrorP6uchar3S0_i, .-_Z12computeErrorP6uchar3S0_i
	.globl	_Z9concatStrPKcS0_
	.type	_Z9concatStrPKcS0_, @function
_Z9concatStrPKcS0_:
.LFB3296:
	.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
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rsi, %rbx
	call	strlen@PLT
	movq	%rbx, %rdi
	movq	%rax, %r12
	call	strlen@PLT
	leaq	1(%r12,%rax), %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	__strcpy_chk@PLT
	movq	%r12, %rdx
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	__strcat_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3296:
	.size	_Z9concatStrPKcS0_, .-_Z9concatStrPKcS0_
	.section	.rodata.str1.1
.LC15:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/baopdh/Seam-Carving/main/device.cu"
.LC16:
	.string	"Error: %s:%d, "
.LC17:
	.string	"code: %d, reason: %s\n"
.LC18:
	.string	"**********GPU info**********\n"
.LC19:
	.string	"Name: %s\n"
.LC20:
	.string	"Compute capability: %d.%d\n"
.LC21:
	.string	"Num SMs: %d\n"
.LC22:
	.string	"Max num threads per SM: %d\n"
.LC23:
	.string	"Max num warps per SM: %d\n"
.LC24:
	.string	"GMEM: %lu bytes\n"
.LC25:
	.string	"CMEM: %lu bytes\n"
.LC26:
	.string	"L2 cache: %i bytes\n"
.LC27:
	.string	"SMEM / one SM: %lu bytes\n"
.LC28:
	.string	"****************************\n\n"
	.text
	.globl	_Z15printDeviceInfov
	.type	_Z15printDeviceInfov, @function
_Z15printDeviceInfov:
.LFB3297:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$1048, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1032(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	testl	%eax, %eax
	je	.L125
	movq	stderr(%rip), %rdi
	movl	%eax, %ebx
	xorl	%eax, %eax
	movl	$511, %r8d
	leaq	.LC15(%rip), %rcx
	leaq	.LC16(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	leaq	.LC17(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L125:
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC19(%rip), %rsi
	call	__printf_chk@PLT
	movl	364(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	360(%rsp), %edx
	leaq	.LC20(%rip), %rsi
	call	__printf_chk@PLT
	movl	388(%rsp), %edx
	leaq	.LC21(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	624(%rsp), %edx
	leaq	.LC22(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	624(%rsp), %eax
	movl	$2, %edi
	leaq	.LC23(%rip), %rsi
	cltd
	idivl	308(%rsp)
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	288(%rsp), %rdx
	leaq	.LC24(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	352(%rsp), %rdx
	leaq	.LC25(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	616(%rsp), %edx
	leaq	.LC26(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	640(%rsp), %rdx
	leaq	.LC27(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC28(%rip), %rsi
	call	__printf_chk@PLT
	movq	1032(%rsp), %rax
	subq	%fs:40, %rax
	je	.L126
	call	__stack_chk_fail@PLT
.L126:
	addq	$1048, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3297:
	.size	_Z15printDeviceInfov, .-_Z15printDeviceInfov
	.globl	_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh
	.type	_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh, @function
_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh:
.LFB3323:
	.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
	movq	%rcx, 8(%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	8(%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	.L128
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z21convertRgb2GrayKernelP6uchar3iiPh(%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
.L128:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L130
	call	__stack_chk_fail@PLT
.L130:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3323:
	.size	_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh, .-_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh
	.globl	_Z21convertRgb2GrayKernelP6uchar3iiPh
	.type	_Z21convertRgb2GrayKernelP6uchar3iiPh, @function
_Z21convertRgb2GrayKernelP6uchar3iiPh:
.LFB3324:
	.cfi_startproc
	endbr64
	jmp	_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh
	.cfi_endproc
.LFE3324:
	.size	_Z21convertRgb2GrayKernelP6uchar3iiPh, .-_Z21convertRgb2GrayKernelP6uchar3iiPh
	.globl	_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi
	.type	_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi, @function
_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi:
.LFB3325:
	.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
	movq	%rcx, 8(%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	8(%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	.L133
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z21computePriorityKernelPhiiPi(%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
.L133:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L135
	call	__stack_chk_fail@PLT
.L135:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3325:
	.size	_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi, .-_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi
	.globl	_Z21computePriorityKernelPhiiPi
	.type	_Z21computePriorityKernelPhiiPi, @function
_Z21computePriorityKernelPhiiPi:
.LFB3326:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi
	.cfi_endproc
.LFE3326:
	.size	_Z21computePriorityKernelPhiiPi, .-_Z21computePriorityKernelPhiiPi
	.globl	_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i
	.type	_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i, @function
_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i:
.LFB3327:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L138
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z13carvingKernelPiP6uchar3PhS_i(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L138:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L140
	call	__stack_chk_fail@PLT
.L140:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3327:
	.size	_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i, .-_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i
	.globl	_Z13carvingKernelPiP6uchar3PhS_i
	.type	_Z13carvingKernelPiP6uchar3PhS_i, @function
_Z13carvingKernelPiP6uchar3PhS_i:
.LFB3328:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i
	.cfi_endproc
.LFE3328:
	.size	_Z13carvingKernelPiP6uchar3PhS_i, .-_Z13carvingKernelPiP6uchar3PhS_i
	.globl	_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii
	.type	_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii, @function
_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii:
.LFB3329:
	.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	.L143
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z27computeSeamScoreTableKernelPiS_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
.L143:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L145
	call	__stack_chk_fail@PLT
.L145:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3329:
	.size	_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii, .-_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii
	.globl	_Z27computeSeamScoreTableKernelPiS_iii
	.type	_Z27computeSeamScoreTableKernelPiS_iii, @function
_Z27computeSeamScoreTableKernelPiS_iii:
.LFB3330:
	.cfi_startproc
	endbr64
	jmp	_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii
	.cfi_endproc
.LFE3330:
	.size	_Z27computeSeamScoreTableKernelPiS_iii, .-_Z27computeSeamScoreTableKernelPiS_iii
	.section	.rodata.str1.1
.LC29:
	.string	"Processing time (use device): %f ms\n\n"
	.text
	.globl	_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3
	.type	_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3, @function
_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3:
.LFB3289:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3289
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movl	%esi, 76(%rsp)
	leaq	168(%rsp), %rdi
	movl	256(%rsp), %r13d
	movl	%ecx, 72(%rsp)
	movl	260(%rsp), %r12d
	movq	%r8, 64(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
.LEHB3:
	call	cudaEventCreate@PLT
	leaq	176(%rsp), %rdi
	call	cudaEventCreate@PLT
.LEHE3:
	movq	168(%rsp), %rdi
	xorl	%esi, %esi
.LEHB4:
	call	cudaEventRecord@PLT
	movq	168(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	76(%rsp), %esi
	leaq	88(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	leaq	(%rsi,%rsi,2), %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L149
	movl	$265, %r8d
.L238:
	movq	stderr(%rip), %rdi
	leaq	.LC15(%rip), %rcx
	leaq	.LC16(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r14d, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%r14d, %ecx
.L196:
	movq	stderr(%rip), %rdi
	leaq	.LC17(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L149:
	movl	76(%rsp), %esi
	leaq	96(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	movl	$267, %r8d
	testl	%eax, %eax
	jne	.L238
	movl	76(%rsp), %esi
	leaq	104(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	movl	$269, %r8d
	testl	%eax, %eax
	jne	.L238
	movslq	%ebx, %rax
	leaq	112(%rsp), %rdi
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	movl	$271, %r8d
	testl	%eax, %eax
	jne	.L238
	movl	76(%rsp), %esi
	leaq	120(%rsp), %rdi
	imull	%ebx, %esi
	movslq	%esi, %rsi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	movl	$273, %r8d
	testl	%eax, %eax
	jne	.L238
	movl	76(%rsp), %r14d
	movq	8(%rsp), %rdi
	call	malloc@PLT
	movl	%r14d, %edi
	imull	%ebx, %edi
	movq	%rax, 16(%rsp)
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	leal	2(%r13), %edx
	movl	$256, %ecx
	movl	$1, %r8d
	movl	%edx, %esi
	movq	%rax, 24(%rsp)
	leal	2(%r12), %eax
	leaq	_ZL15d_originalWidth(%rip), %rdi
	imull	%eax, %esi
	leal	-1(%r14), %eax
	cltd
	idivl	%ecx
	movq	%rsi, 48(%rsp)
	xorl	%ecx, %ecx
	leaq	76(%rsp), %rsi
	movl	$4, %edx
	leal	3(%rax,%rax), %eax
	movl	%eax, 60(%rsp)
	call	cudaMemcpyToSymbol@PLT
	movl	%eax, %r14d
	movl	$289, %r8d
	testl	%eax, %eax
	jne	.L238
	movl	76(%rsp), %eax
	movq	88(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	%eax, %r14d
	movl	%eax, 56(%rsp)
	imull	%ebx, %r14d
	movslq	%r14d, %r14
	leaq	(%r14,%r14,2), %rax
	movq	%rax, %rdx
	movq	%rax, 32(%rsp)
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	movl	$293, %r8d
	testl	%eax, %eax
	jne	.L244
	movl	76(%rsp), %eax
	xorl	%edx, %edx
	movl	264(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %esi
	movl	$1, 140(%rsp)
	decl	%eax
	divl	%r13d
	xorl	%edx, %edx
	incl	%eax
	movl	%eax, 132(%rsp)
	leal	-1(%rbx), %eax
	divl	%r12d
	movq	256(%rsp), %rdx
	incl	%eax
	movl	%eax, 136(%rsp)
	movq	132(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L157
.L159:
	call	cudaDeviceSynchronize@PLT
	jmp	.L256
.L157:
	movq	96(%rsp), %rcx
	movl	76(%rsp), %esi
	movl	%ebx, %edx
	movq	88(%rsp), %rdi
	call	_Z51__device_stub__Z21convertRgb2GrayKernelP6uchar3iiPhP6uchar3iiPh
	jmp	.L159
.L256:
	call	cudaGetLastError@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.L160
	leaq	0(,%r14,4), %rax
	movabsq	$4294967552, %r15
	movq	%rax, 40(%rsp)
	jmp	.L161
.L160:
	movl	$299, %r8d
	jmp	.L244
.L176:
	decl	76(%rsp)
.L161:
	movl	72(%rsp), %eax
	cmpl	%eax, 76(%rsp)
	jle	.L257
	movl	%r13d, 256(%rsp)
	movl	264(%rsp), %ecx
	xorl	%r9d, %r9d
	movl	%r12d, 260(%rsp)
	movq	48(%rsp), %r8
	movq	256(%rsp), %rdx
	movq	132(%rsp), %rdi
	movl	140(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L162
.L164:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L187
	movl	$306, %r8d
.L244:
	movq	stderr(%rip), %rdi
	leaq	.LC15(%rip), %rcx
	leaq	.LC16(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%ebp, %ecx
	jmp	.L196
.L162:
	movq	104(%rsp), %rcx
	movl	76(%rsp), %esi
	movl	%ebx, %edx
	movq	96(%rsp), %rdi
	call	_Z45__device_stub__Z21computePriorityKernelPhiiPiPhiiPi
	jmp	.L164
.L187:
	xorl	%r14d, %r14d
.L165:
	cmpl	%ebx, %r14d
	jge	.L258
	movl	60(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movl	$1, %ecx
	movq	%r15, 156(%rsp)
	movl	%eax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 148(%rsp)
	movq	144(%rsp), %rdi
	movl	152(%rsp), %esi
	movl	$1, 164(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L166
.L168:
	call	cudaDeviceSynchronize@PLT
	jmp	.L259
.L166:
	movl	76(%rsp), %edx
	movq	120(%rsp), %rsi
	movl	%r14d, %r8d
	movl	%ebx, %ecx
	movq	104(%rsp), %rdi
	call	_Z52__device_stub__Z27computeSeamScoreTableKernelPiS_iiiPiS_iii
	jmp	.L168
.L259:
	call	cudaGetLastError@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L169
	movl	$312, %r8d
	jmp	.L244
.L169:
	addl	$64, %r14d
	jmp	.L165
.L258:
	movq	40(%rsp), %rdx
	movq	120(%rsp), %rsi
	movl	$2, %ecx
	movq	24(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L171
	movl	$316, %r8d
	jmp	.L244
.L171:
	movl	76(%rsp), %edx
	movq	16(%rsp), %rsi
	movl	%ebx, %ecx
	movq	24(%rsp), %rdi
	movl	56(%rsp), %r8d
	call	_Z5tracePiS_iii
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	112(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L172
	movl	$320, %r8d
	jmp	.L244
.L172:
	movabsq	$4294967297, %rdx
	movl	%ebx, 144(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rdx, 148(%rsp)
	movl	$1, %ecx
	movq	144(%rsp), %rdi
	movl	152(%rsp), %esi
	movq	%rdx, 156(%rsp)
	movl	$1, 164(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L173
.L175:
	call	cudaDeviceSynchronize@PLT
	jmp	.L260
.L173:
	movl	76(%rsp), %r8d
	movq	104(%rsp), %rcx
	movq	96(%rsp), %rdx
	movq	88(%rsp), %rsi
	movq	112(%rsp), %rdi
	call	_Z46__device_stub__Z13carvingKernelPiP6uchar3PhS_iPiP6uchar3PhS_i
	jmp	.L175
.L260:
	call	cudaGetLastError@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L176
	movl	$323, %r8d
	jmp	.L244
.L257:
	movq	32(%rsp), %rdx
	movq	88(%rsp), %rsi
	movl	$2, %ecx
	movq	64(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	movl	$328, %r8d
	testl	%eax, %eax
	jne	.L251
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$330, %r8d
	testl	%eax, %eax
	jne	.L251
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$331, %r8d
	testl	%eax, %eax
	jne	.L251
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$332, %r8d
	testl	%eax, %eax
	jne	.L251
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$333, %r8d
	testl	%eax, %eax
	jne	.L251
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L183
	movl	$334, %r8d
.L251:
	movq	stderr(%rip), %rdi
	leaq	.LC15(%rip), %rcx
	leaq	.LC16(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%ebx, %ecx
	jmp	.L196
.L183:
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	176(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	168(%rsp), %rbx
	movq	%rbx, %rdi
	call	_ZN8GpuTimer7ElapsedEv
	leaq	.LC29(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.LEHE4:
	movq	%rbx, %rdi
	call	_ZN8GpuTimerD1Ev
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L186
	jmp	.L193
.L188:
	endbr64
	movq	%rax, %rbx
.L184:
	leaq	168(%rsp), %rdi
	call	_ZN8GpuTimerD1Ev
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L193
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L193:
	call	__stack_chk_fail@PLT
.L186:
	addq	$200, %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
.LFE3289:
	.section	.gcc_except_table
.LLSDA3289:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3289-.LLSDACSB3289
.LLSDACSB3289:
	.uleb128 .LEHB3-.LFB3289
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB3289
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L188-.LFB3289
	.uleb128 0
	.uleb128 .LEHB5-.LFB3289
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3289:
	.text
	.size	_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3, .-_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3
	.section	.rodata.str1.1
.LC30:
	.string	"_Z27computeSeamScoreTableKernelPiS_iii"
.LC31:
	.string	"_Z13carvingKernelPiP6uchar3PhS_i"
.LC32:
	.string	"_Z21computePriorityKernelPhiiPi"
.LC33:
	.string	"_Z21convertRgb2GrayKernelP6uchar3iiPh"
.LC34:
	.string	"d_xSobel"
.LC35:
	.string	"d_ySobel"
.LC36:
	.string	"d_originalWidth"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3332:
	.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	.LC30(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z27computeSeamScoreTableKernelPiS_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	.LC31(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13carvingKernelPiP6uchar3PhS_i(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC32(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z21computePriorityKernelPhiiPi(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC33(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z21convertRgb2GrayKernelP6uchar3iiPh(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC34(%rip), %rdx
	movl	$36, %r9d
	leaq	_ZL8d_xSobel(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC35(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$36, %r9d
	leaq	_ZL8d_ySobel(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC36(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$4, %r9d
	movq	%rdx, %rcx
	leaq	_ZL15d_originalWidth(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r8
	.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
.LFE3332:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB3411:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L263
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L263:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3411:
	.size	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.rodata.str1.1
.LC37:
	.string	"The number of arguments is invalid\n"
.LC38:
	.string	"Image size (width x height): %i x %i\n\n"
.LC39:
	.string	"basic_string: construction from null is not valid"
.LC40:
	.string	"stoi"
.LC41:
	.string	"Number of seam removed: %d\n\n"
.LC42:
	.string	"Error between device result and host result: %f\n"
.LC43:
	.string	"."
.LC44:
	.string	"_host.pnm"
.LC45:
	.string	"_device.pnm"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3298:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3298
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	movl	%edi, %eax
	andl	$-3, %eax
	cmpl	$4, %eax
	je	.L267
	leaq	.LC37(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.LEHB6:
	call	__printf_chk@PLT
	jmp	.L268
.L267:
	movq	%rsi, %rbx
	movl	%edi, %r12d
	leaq	56(%rsp), %r14
	call	_Z15printDeviceInfov
	movq	8(%rbx), %rdi
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	call	_Z7readPnmPcRiS0_RP6uchar3
	movl	24(%rsp), %ecx
	movl	20(%rsp), %edx
	xorl	%eax, %eax
	leaq	.LC38(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	24(%rbx), %r13
	leaq	72(%rsp), %rax
	movq	%rax, 56(%rsp)
	testq	%r13, %r13
	jne	.L269
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L288
	leaq	.LC39(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L269:
	movq	%r13, %rdi
	leaq	40(%rsp), %rbp
	call	strlen@PLT
	cmpq	$15, %rax
	movq	%rax, 40(%rsp)
	leaq	0(%r13,%rax), %r15
	jbe	.L271
	xorl	%edx, %edx
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
.LEHE6:
	movq	%rax, 56(%rsp)
	movq	40(%rsp), %rax
	movq	%rax, 72(%rsp)
.L271:
	movq	56(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	40(%rsp), %rax
	movq	56(%rsp), %rdx
	movq	%rax, 64(%rsp)
	movb	$0, (%rdx,%rax)
	movq	56(%rsp), %r15
	call	__errno_location@PLT
	xorl	%esi, %esi
	movq	%r15, %rdi
	movl	$10, %edx
	movq	%rax, %r13
	movl	(%rax), %eax
	movl	%esi, 0(%r13)
	movq	%rbp, %rsi
	movl	%eax, 28(%rsp)
	call	__isoc23_strtol@PLT
	cmpq	40(%rsp), %r15
	leaq	28(%rsp), %r15
	movq	%rax, %rbp
	jne	.L272
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L288
	leaq	.LC40(%rip), %rdi
.LEHB7:
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L272:
	cmpl	$34, 0(%r13)
	je	.L274
	movl	$2147483648, %eax
	movl	$4294967295, %edx
	addq	%rbp, %rax
	cmpq	%rax, %rdx
	jnb	.L275
.L274:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L288
	leaq	.LC40(%rip), %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE7:
.L275:
	movq	%r15, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	%r14, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	testl	%ebp, %ebp
	jg	.L285
	jmp	.L268
.L284:
	endbr64
	movq	%rax, %rbx
.L278:
	movq	%r15, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	%r14, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L288
	movq	%rbx, %rdi
.LEHB8:
	call	_Unwind_Resume@PLT
.L285:
	cmpl	%ebp, 20(%rsp)
	jg	.L280
.L268:
	movl	$1, %eax
	jmp	.L266
.L280:
	movl	%ebp, %edx
	leaq	.LC41(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	20(%rsp), %r14d
	movl	24(%rsp), %r15d
	movl	%r14d, %edi
	movl	%r14d, %eax
	imull	%r15d, %edi
	subl	%ebp, %eax
	movl	%eax, 4(%rsp)
	movslq	%edi, %rdi
	leaq	(%rdi,%rdi,2), %rdi
	call	malloc@PLT
	movq	32(%rsp), %r13
	movl	%r15d, %edx
	movl	%r14d, %esi
	movl	4(%rsp), %ecx
	movq	%rax, %r8
	movq	%rax, %rbp
	movq	%r13, %rdi
	call	_Z17seamCarvingByHostP6uchar3iiiS0_
	movl	20(%rsp), %r14d
	movl	24(%rsp), %r15d
	movl	%r14d, %edi
	imull	%r15d, %edi
	movslq	%edi, %rdi
	leaq	(%rdi,%rdi,2), %rdi
	call	malloc@PLT
	movl	$1, 48(%rsp)
	movq	%rax, 8(%rsp)
	movabsq	$137438953504, %rax
	movq	%rax, 40(%rsp)
	cmpl	$6, %r12d
	jne	.L282
	movq	32(%rbx), %rdi
	call	atoi@PLT
	movq	40(%rbx), %rdi
	movl	%eax, 40(%rsp)
	call	atoi@PLT
	movl	%eax, 44(%rsp)
.L282:
	pushq	%rax
	.cfi_def_cfa_offset 168
	movl	%r15d, %edx
	movl	%r14d, %esi
	movq	%r13, %rdi
	pushq	%rax
	.cfi_def_cfa_offset 176
	movq	56(%rsp), %rax
	movq	24(%rsp), %r8
	movl	20(%rsp), %ecx
	movq	%rax, (%rsp)
	movl	64(%rsp), %eax
	movl	%eax, 8(%rsp)
	call	_Z19seamCarvingByDeviceP6uchar3iiiS0_4dim3
	movl	36(%rsp), %edx
	imull	40(%rsp), %edx
	movq	%rbp, %rsi
	movq	24(%rsp), %rdi
	call	_Z12computeErrorP6uchar3S0_i
	popq	%rdx
	.cfi_def_cfa_offset 168
	leaq	.LC42(%rip), %rsi
	popq	%rcx
	.cfi_def_cfa_offset 160
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	16(%rbx), %rdi
	leaq	.LC43(%rip), %rsi
	call	strtok@PLT
	leaq	.LC44(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	_Z9concatStrPKcS0_
	movl	20(%rsp), %ecx
	movl	24(%rsp), %edx
	movq	%rbp, %rdi
	movl	4(%rsp), %esi
	movq	%rax, %r8
	call	_Z8writePnmP6uchar3iiiPc
	leaq	.LC45(%rip), %rsi
	movq	%rbx, %rdi
	call	_Z9concatStrPKcS0_
	movl	20(%rsp), %ecx
	movl	24(%rsp), %edx
	movl	4(%rsp), %esi
	movq	8(%rsp), %rdi
	movq	%rax, %r8
	call	_Z8writePnmP6uchar3iiiPc
.LEHE8:
	movq	%r13, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	xorl	%eax, %eax
.L266:
	movq	88(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L283
.L288:
	call	__stack_chk_fail@PLT
.L283:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3298:
	.section	.gcc_except_table
.LLSDA3298:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3298-.LLSDACSB3298
.LLSDACSB3298:
	.uleb128 .LEHB6-.LFB3298
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB3298
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L284-.LFB3298
	.uleb128 0
	.uleb128 .LEHB8-.LFB3298
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
.LLSDACSE3298:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.local	_ZL15d_originalWidth
	.comm	_ZL15d_originalWidth,4,4
	.local	_ZL8d_ySobel
	.comm	_ZL8d_ySobel,36,32
	.local	_ZL8d_xSobel
	.comm	_ZL8d_xSobel,36,32
	.globl	ySobel
	.data
	.align 32
	.type	ySobel, @object
	.size	ySobel, 36
ySobel:
	.long	1
	.long	2
	.long	1
	.long	0
	.long	0
	.long	0
	.long	-1
	.long	-2
	.long	-1
	.globl	xSobel
	.align 32
	.type	xSobel, @object
	.size	xSobel, 36
xSobel:
	.long	1
	.long	0
	.long	-1
	.long	2
	.long	0
	.long	-2
	.long	1
	.long	0
	.long	-1
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC10:
	.long	1050220167
	.align 4
.LC11:
	.long	1058424226
	.align 4
.LC12:
	.long	1038710997
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdint.h>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define CHECK(call)\
{\
    const hipError_t error = call;\
    if (error != hipSuccess)\
    {\
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);\
        fprintf(stderr, "code: %d, reason: %s\n", error,\
                hipGetErrorString(error));\
        exit(EXIT_FAILURE);\
    }\
}

struct GpuTimer
{
    hipEvent_t start;
    hipEvent_t stop;

    GpuTimer()
    {
        hipEventCreate(&start);
        hipEventCreate(&stop);
    }

    ~GpuTimer()
    {
        hipEventDestroy(start);
        hipEventDestroy(stop);
    }

    void Start()
    {
        hipEventRecord(start, 0);                                                                 
        hipEventSynchronize(start);
    }

    void Stop()
    {
        hipEventRecord(stop, 0);
    }

    float Elapsed()
    {
        float elapsed;
        hipEventSynchronize(stop);
        hipEventElapsedTime(&elapsed, start, stop);
        return elapsed;
    }
};

void readPnm(char * fileName, int &width, int &height, uchar3 * &pixels)
{
    FILE * f = fopen(fileName, "r");
    if (f == NULL)
    {
        printf("Cannot read %s\n", fileName);
        exit(EXIT_FAILURE);
    }

    char type[3];
    fscanf(f, "%s", type);
    
    if (strcmp(type, "P3") != 0) // In this exercise, we don't touch other types
    {
        fclose(f);
        printf("Cannot read %s\n", fileName); 
        exit(EXIT_FAILURE); 
    }

    fscanf(f, "%i", &width);
    fscanf(f, "%i", &height);
    
    int max_val;
    fscanf(f, "%i", &max_val);
    if (max_val > 255) // In this exercise, we assume 1 byte per value
    {
        fclose(f);
        printf("Cannot read %s\n", fileName); 
        exit(EXIT_FAILURE); 
    }

    pixels = (uchar3 *)malloc(width * height * sizeof(uchar3));
    for (int i = 0; i < width * height; i++)
        fscanf(f, "%hhu%hhu%hhu", &pixels[i].x, &pixels[i].y, &pixels[i].z);

    fclose(f);
}

void writePnm(uchar3 *pixels, int width, int height, int originalWidth, char *fileName)
{
    FILE * f = fopen(fileName, "w");
    if (f == NULL)
    {
        printf("Cannot write %s\n", fileName);
        exit(EXIT_FAILURE);
    }   

    fprintf(f, "P3\n%i\n%i\n255\n", width, height); 

    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int i = r * originalWidth + c;
            fprintf(f, "%hhu\n%hhu\n%hhu\n", pixels[i].x, pixels[i].y, pixels[i].z);
        }
    }
    
    fclose(f);
}

int xSobel[3][3] = {{1,0,-1},{2,0,-2},{1,0,-1}};
int ySobel[3][3] = {{1,2,1},{0,0,0},{-1,-2,-1}};

__constant__ int d_xSobel[9] = {1, 0, -1, 2, 0, -2, 1, 0, -1};
__constant__ int d_ySobel[9] = {1, 2, 1, 0, 0, 0, -1, -2, -1};

__device__ int d_originalWidth;

__global__ void convertRgb2GrayKernel(uchar3 * inPixels, int width, int height, uint8_t * outPixels) {
    size_t row = blockIdx.y * blockDim.y + threadIdx.y;
    size_t col = blockIdx.x * blockDim.x + threadIdx.x;
    size_t idx = row * width + col;
    if (row < height && col < width) {
        outPixels[idx] = 0.299f * inPixels[idx].x
                    + 0.587f * inPixels[idx].y
                    + 0.114f * inPixels[idx].z;
    }
}

__global__ void computePriorityKernel(uint8_t * inPixels, int width, int height, int * priority) {
    int filterWidth = 3;

    size_t row = blockIdx.y * blockDim.y + threadIdx.y;
    size_t col = blockIdx.x * blockDim.x + threadIdx.x;

    size_t s_width = blockDim.x + filterWidth - 1;
    size_t s_height = blockDim.y + filterWidth - 1;

    // Each block loads data from GMEM to SMEM
    extern __shared__ uint8_t s_inPixels[];

    int readRow = row - (filterWidth >> 1), readCol, tmpRow, tmpCol;
    int firstReadCol = col - (filterWidth >> 1);
    size_t virtualRow = threadIdx.y, virtualCol;
    for (; virtualRow < s_height; readRow += blockDim.y, virtualRow += blockDim.y) {
        tmpRow = readRow;
        if (readRow < 0) {
            readRow = 0;
        } else if (readRow >= height) {
            readRow = height - 1;
        }
        readCol = firstReadCol;
        virtualCol = threadIdx.x;
        for (; virtualCol < s_width; readCol += blockDim.x, virtualCol += blockDim.x) {
            tmpCol = readCol;
            if (readCol < 0) {
                readCol = 0;
            } else if (readCol >= width) {
                readCol = width - 1;
            }
            s_inPixels[virtualRow * s_width + virtualCol] = inPixels[readRow * d_originalWidth + readCol];
            readCol = tmpCol;
        }
        readRow = tmpRow;
    } 
    __syncthreads();
    // ---------------------------------------

    // Each thread compute priority on SMEM
    int x = 0, y = 0;
    for (int i = 0; i < filterWidth; ++i) {
        for (int j = 0; j < filterWidth; ++j) {
            uint8_t closest = s_inPixels[(threadIdx.y + i) * s_width + threadIdx.x + j];
            size_t filterIdx = i * filterWidth + j;
            x += closest * d_xSobel[filterIdx];
            y += closest * d_ySobel[filterIdx];
        }
    }

    // Each thread writes result from SMEM to GMEM
    if (col < width && row < height) {
        size_t idx = row * d_originalWidth + col;
        priority[idx] = abs(x) + abs(y);
    }
}

__global__ void carvingKernel(int *leastSignificantPixel, uchar3 *outPixels, uint8_t *grayPixels, int * priority, int width) {
    int row = blockIdx.x;
    int baseIdx = row * d_originalWidth;
    for (int i = leastSignificantPixel[row]; i < width - 1; ++i) {
        outPixels[baseIdx + i] = outPixels[baseIdx + i + 1];
        grayPixels[baseIdx + i] = grayPixels[baseIdx + i + 1];
        priority[baseIdx + i] = priority[baseIdx + i + 1];
    }
}

void trace(int *score, int *leastSignificantPixel, int width, int height, int originalWidth) {
    int minCol = 0, r = height - 1;
    for (int c = 1; c < width; ++c) {
        if (score[r * originalWidth + c] < score[r * originalWidth + minCol])
            minCol = c;
    }
    for (; r >= 0; --r) {
        leastSignificantPixel[r] = minCol;
        if (r > 0) {
            int aboveIdx = (r - 1) * originalWidth + minCol;
            int min = score[aboveIdx], minColCpy = minCol;
            if (minColCpy > 0 && score[aboveIdx - 1] < min) {
                min = score[aboveIdx - 1];
                minCol = minColCpy - 1;
            }
            if (minColCpy < width - 1 && score[aboveIdx + 1] < min) {
                minCol = minColCpy + 1;
            }
        }
    }
}

__global__ void computeSeamScoreTableKernel(int *priority, int *score, int width, int height, int fromRow) {
    size_t halfBlock = blockDim.x >> 1;

    int col = blockIdx.x * halfBlock - halfBlock + threadIdx.x;

    if (fromRow == 0 && col >= 0 && col < width) {
        score[col] = priority[col];
    }
    __syncthreads();

    for (int stride = fromRow != 0 ? 0 : 1; stride < halfBlock && fromRow + stride < height; ++stride) {
        if (threadIdx.x < blockDim.x - (stride << 1)) {
            int curRow = fromRow + stride;
            int curCol = col + stride;

            if (curCol >= 0 && curCol < width) {
                int idx = curRow * d_originalWidth + curCol;
                int aboveIdx = (curRow - 1) * d_originalWidth + curCol;

                int min = score[aboveIdx];
                if (curCol > 0 && score[aboveIdx - 1] < min) {
                    min = score[aboveIdx - 1];
                }
                if (curCol < width - 1 && score[aboveIdx + 1] < min) {
                    min = score[aboveIdx + 1];
                }

                score[idx] = min + priority[idx];
            }
        }
        __syncthreads();
    }
}

void seamCarvingByDevice(uchar3 *inPixels, int width, int height, int targetWidth, uchar3* outPixels, dim3 blockSize) {
    GpuTimer timer;
    timer.Start();

    // allocate kernel memory
    uchar3 *d_inPixels;
    CHECK(hipMalloc(&d_inPixels, width * height * sizeof(uchar3)));
    uint8_t * d_grayPixels;
    CHECK(hipMalloc(&d_grayPixels, width * height * sizeof(uint8_t)));
    int * d_priority;
    CHECK(hipMalloc(&d_priority, width * height * sizeof(int)));
    int * d_leastSignificantPixel;
    CHECK(hipMalloc(&d_leastSignificantPixel, height * sizeof(int)));
    int * d_score;
    CHECK(hipMalloc(&d_score, width * height * sizeof(int)));

    // allocate host memory
    int * priority = (int *)malloc(width * height * sizeof(int));
    int * leastSignificantPixel = (int *)malloc(height * sizeof(int));
    int * score = (int *)malloc(width * height * sizeof(int));

    // dynamically sized smem used to compute priority
    size_t smemSize = ((blockSize.x + 3 - 1) * (blockSize.y + 3 - 1)) * sizeof(uint8_t);
    
    // block size use to calculate seam score table
    int blockSizeDp = 256;
    int gridSizeDp = (((width - 1) / blockSizeDp + 1) << 1) + 1;
    int stripHeight = (blockSizeDp >> 1) + 1;

    // cache original width
    CHECK(hipMemcpyToSymbol(HIP_SYMBOL(d_originalWidth), &width, sizeof(int)));
    const int originalWidth = width;

    // copy input to device
    CHECK(hipMemcpy(d_inPixels, inPixels, width * height * sizeof(uchar3), hipMemcpyHostToDevice));

    // turn input image to grayscale
    dim3 gridSize((width-1)/blockSize.x + 1, (height-1)/blockSize.y + 1);
    convertRgb2GrayKernel<<<gridSize, blockSize>>>(d_inPixels, width, height, d_grayPixels);
    hipDeviceSynchronize();
    CHECK(hipGetLastError());

    // carve until reach desired width
    while (width > targetWidth) {
        // update priority
        computePriorityKernel<<<gridSize, blockSize, smemSize>>>(d_grayPixels, width, height, d_priority);
        hipDeviceSynchronize();
        CHECK(hipGetLastError());

        // compute min seam table
        for (int i = 0; i < height; i += (stripHeight >> 1)) {
            computeSeamScoreTableKernel<<<gridSizeDp, blockSizeDp>>>(d_priority, d_score, width, height, i);
            hipDeviceSynchronize();
            CHECK(hipGetLastError());
        }

        // find least significant pixel index of each row and store in d_leastSignificantPixel (SEQUENTIAL, in kernel or host)
        CHECK(hipMemcpy(score, d_score, originalWidth * height * sizeof(int), hipMemcpyDeviceToHost));
        trace(score, leastSignificantPixel, width, height, originalWidth);

        // carve
        CHECK(hipMemcpy(d_leastSignificantPixel, leastSignificantPixel, height * sizeof(int), hipMemcpyHostToDevice));
        carvingKernel<<<height, 1>>>(d_leastSignificantPixel, d_inPixels, d_grayPixels, d_priority, width);
        hipDeviceSynchronize();
        CHECK(hipGetLastError());
        
        --width;
    }

    CHECK(hipMemcpy(outPixels, d_inPixels, originalWidth * height * sizeof(uchar3), hipMemcpyDeviceToHost));

    CHECK(hipFree(d_inPixels));
    CHECK(hipFree(d_grayPixels));
    CHECK(hipFree(d_priority));
    CHECK(hipFree(d_leastSignificantPixel));
    CHECK(hipFree(d_score));

    free(score);
    free(leastSignificantPixel);
    free(priority);

    timer.Stop();
    float time = timer.Elapsed();
    printf("Processing time (use device): %f ms\n\n", time);    
}

uint8_t getClosest(uint8_t *pixels, int r, int c, int width, int height, int originalWidth)
{
    if (r < 0) {
        r = 0;
    } else if (r >= height) {
        r = height - 1;
    }

    if (c < 0) {
        c = 0;
    } else if (c >= width) {
        c = width - 1;
    }

    return pixels[r * originalWidth + c];
}

int computePixelPriority(uint8_t * grayPixels, int row, int col, int width, int height, int originalWidth) {
    int x = 0, y = 0;
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            uint8_t closest = getClosest(grayPixels, row - 1 + i, col - 1 + j, width, height, originalWidth);
            x += closest * xSobel[i][j];
            y += closest * ySobel[i][j];
        }
    }
    return abs(x) + abs(y);
}

void convertRgb2Gray(uchar3 * inPixels, int width, int height, uint8_t * outPixels) {
    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int i = r * width + c;
            outPixels[i] = 0.299f * inPixels[i].x + 0.587f * inPixels[i].y + 0.114f * inPixels[i].z;
        }
    }
}

void computeSeamScoreTable(int *priority, int *score, int width, int height, int originalWidth) {
    for (int c = 0; c < width; ++c) {
        score[c] = priority[c];
    }
    for (int r = 1; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            int idx = r * originalWidth + c;
            int aboveIdx = (r - 1) * originalWidth + c;

            int min = score[aboveIdx];
            if (c > 0 && score[aboveIdx - 1] < min) {
                min = score[aboveIdx - 1];
            }
            if (c < width - 1 && score[aboveIdx + 1] < min) {
                min = score[aboveIdx + 1];
            }

            score[idx] = min + priority[idx];
        }
    }
}

void seamCarvingByHost(uchar3 *inPixels, int width, int height, int targetWidth, uchar3* outPixels) {
    GpuTimer timer;
    timer.Start();

    memcpy(outPixels, inPixels, width * height * sizeof(uchar3));

    const int originalWidth = width;

    // allocate memory
    int *priority = (int *)malloc(width * height * sizeof(int));
    int *score = (int *)malloc(width * height * sizeof(int));
    uint8_t *grayPixels= (uint8_t *)malloc(width * height * sizeof(uint8_t));
    
    // turn input image to grayscale
    convertRgb2Gray(inPixels, width, height, grayPixels);

    // compute pixel priority
    for (int r = 0; r < height; ++r) {
        for (int c = 0; c < width; ++c) {
            priority[r * originalWidth + c] = computePixelPriority(grayPixels, r, c, width, height, width);
        }
    }

    while (width > targetWidth) {
        // compute min seam table
        computeSeamScoreTable(priority, score, width, height, originalWidth);

        // find min index of last row
        int minCol = 0, r = height - 1, prevMinCol;
        for (int c = 1; c < width; ++c) {
            if (score[r * originalWidth + c] < score[r * originalWidth + minCol])
                minCol = c;
        }

        // trace and remove seam from last to first row
        for (; r >= 0; --r) {
            // remove seam pixel on row r
            for (int i = minCol; i < width - 1; ++i) {
                outPixels[r * originalWidth + i] = outPixels[r * originalWidth + i + 1];
                grayPixels[r * originalWidth + i] = grayPixels[r * originalWidth + i + 1];
                priority[r * originalWidth + i] = priority[r * originalWidth + i + 1];
            }

            // update priority
            if (r < height - 1) {
                for (int affectedCol = max(0, prevMinCol - 2); affectedCol <= prevMinCol + 2 && affectedCol < width - 1; ++affectedCol) {
                    priority[(r + 1) * originalWidth + affectedCol] = computePixelPriority(grayPixels, r + 1, affectedCol, width - 1, height, originalWidth);
                }
            }

            // trace up
            if (r > 0) {
                prevMinCol = minCol;

                int aboveIdx = (r - 1) * originalWidth + minCol;
                int min = score[aboveIdx], minColCpy = minCol;
                if (minColCpy > 0 && score[aboveIdx - 1] < min) {
                    min = score[aboveIdx - 1];
                    minCol = minColCpy - 1;
                }
                if (minColCpy < width - 1 && score[aboveIdx + 1] < min) {
                    minCol = minColCpy + 1;
                }
            }
        }

        for (int affectedCol = max(0, minCol - 2); affectedCol <= minCol + 2 && affectedCol < width - 1; ++affectedCol) {
            priority[affectedCol] = computePixelPriority(grayPixels, 0, affectedCol, width - 1, height, originalWidth);
        }

        --width;
    }
    
    free(grayPixels);
    free(score);
    free(priority);

    timer.Stop();
    float time = timer.Elapsed();
    printf("Processing time (use host): %f ms\n\n", time);
}

float computeError(uchar3 * a1, uchar3 * a2, int n)
{
    float err = 0;
    for (int i = 0; i < n; i++)
    {
        err += abs((int)a1[i].x - (int)a2[i].x);
        err += abs((int)a1[i].y - (int)a2[i].y);
        err += abs((int)a1[i].z - (int)a2[i].z);
    }
    err /= (n * 3);
    return err;
}

char *concatStr(const char * s1, const char * s2)
{
    char * result = (char *)malloc(strlen(s1) + strlen(s2) + 1);
    strcpy(result, s1);
    strcat(result, s2);
    return result;
}

void printDeviceInfo()
{
    hipDeviceProp_t devProv;
    CHECK(hipGetDeviceProperties(&devProv, 0));
    printf("**********GPU info**********\n");
    printf("Name: %s\n", devProv.name);
    printf("Compute capability: %d.%d\n", devProv.major, devProv.minor);
    printf("Num SMs: %d\n", devProv.multiProcessorCount);
    printf("Max num threads per SM: %d\n", devProv.maxThreadsPerMultiProcessor); 
    printf("Max num warps per SM: %d\n", devProv.maxThreadsPerMultiProcessor / devProv.warpSize);
    printf("GMEM: %lu bytes\n", devProv.totalGlobalMem);
    printf("CMEM: %lu bytes\n", devProv.totalConstMem);
    printf("L2 cache: %i bytes\n", devProv.l2CacheSize);
    printf("SMEM / one SM: %lu bytes\n", devProv.sharedMemPerMultiprocessor);

    printf("****************************\n\n");

}

int main(int argc, char ** argv)
{   
    if (argc != 4 && argc != 6)
    {
        printf("The number of arguments is invalid\n");
        return EXIT_FAILURE;
    }

    printDeviceInfo();

    // Read input RGB image file
    int width, height;
    uchar3 *inPixels;
    readPnm(argv[1], width, height, inPixels);
    printf("Image size (width x height): %i x %i\n\n", width, height);

    int numSeamRemoved = stoi(argv[3]);
    if (numSeamRemoved <= 0 || numSeamRemoved >= width)
        return EXIT_FAILURE; // invalid ratio
    printf("Number of seam removed: %d\n\n", numSeamRemoved);

    int targetWidth = width - numSeamRemoved;

    // seam carving using host
    uchar3 * correctOutPixels = (uchar3 *)malloc(width * height * sizeof(uchar3));
    seamCarvingByHost(inPixels, width, height, targetWidth, correctOutPixels);

    // seam carving using device
    uchar3 * outPixels= (uchar3 *)malloc(width * height * sizeof(uchar3));
    dim3 blockSize(32, 32); // Default
    if (argc == 6)
    {
        blockSize.x = atoi(argv[4]);
        blockSize.y = atoi(argv[5]);
    } 
    seamCarvingByDevice(inPixels, width, height, targetWidth, outPixels, blockSize);

    // Compute mean absolute error between host result and device result
    float err = computeError(outPixels, correctOutPixels, width * height);
    printf("Error between device result and host result: %f\n", err);

    // Write results to files
    char *outFileNameBase = strtok(argv[2], "."); // Get rid of extension
    writePnm(correctOutPixels, targetWidth, height, width, concatStr(outFileNameBase, "_host.pnm"));
    writePnm(outPixels, targetWidth, height, width, concatStr(outFileNameBase, "_device.pnm"));

    // Free memories
    free(inPixels);
    free(correctOutPixels);
    free(outPixels);
}

	.text
	.file	"device.hip"
	.globl	_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE # -- Begin function _Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE
	.type	_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE,@function
_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE: # @_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB0_3
# %bb.1:
	movq	%rax, %r12
	leaq	1(%rsp), %rbp
	movl	$.L.str.2, %esi
	movq	%rax, %rdi
	movq	%rbp, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movzwl	(%rbp), %eax
	xorl	$13136, %eax                    # imm = 0x3350
	movzbl	2(%rbp), %ecx
	orw	%ax, %cx
	jne	.LBB0_2
# %bb.4:
	movl	$.L.str.4, %esi
	movq	%r12, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	$.L.str.4, %esi
	movq	%r12, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	leaq	4(%rsp), %rbp
	movl	$.L.str.4, %esi
	movq	%r12, %rdi
	movq	%rbp, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$256, (%rbp)                    # imm = 0x100
	jge	.LBB0_2
# %bb.5:
	movslq	(%r15), %rax
	movslq	(%r14), %r13
	imulq	%rax, %r13
	leaq	(,%r13,2), %rdi
	addq	%r13, %rdi
	callq	malloc
	movq	%rax, (%rbx)
	testl	%r13d, %r13d
	jle	.LBB0_8
# %bb.6:                                # %.lr.ph.preheader
	movl	$2, %r13d
	xorl	%ebp, %ebp
.LBB0_7:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rax
	leaq	(%rax,%r13), %r8
	leaq	(%rax,%r13), %rdx
	addq	$-2, %rdx
	leaq	(%rax,%r13), %rcx
	decq	%rcx
	movl	$.L.str.5, %esi
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incq	%rbp
	movslq	(%r15), %rax
	movslq	(%r14), %rcx
	imulq	%rax, %rcx
	addq	$3, %r13
	cmpq	%rcx, %rbp
	jl	.LBB0_7
.LBB0_8:                                # %._crit_edge
	movq	%r12, %rdi
	callq	fclose
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_2:
	.cfi_def_cfa_offset 64
	movq	%r12, %rdi
	callq	fclose
.LBB0_3:
	movl	$.L.str.1, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE, .Lfunc_end0-_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE
	.cfi_endproc
                                        # -- End function
	.globl	_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc # -- Begin function _Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc
	.type	_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc,@function
_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc: # @_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r8, %r13
	movl	%ecx, %r12d
	movl	%edx, %ebp
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	$.L.str.6, %esi
	movq	%r8, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB1_8
# %bb.1:
	movq	%rax, %r15
	movl	$.L.str.8, %esi
	movq	%rax, %rdi
	movl	%ebx, 12(%rsp)                  # 4-byte Spill
	movl	%ebx, %edx
	movl	%ebp, %ecx
	xorl	%eax, %eax
	callq	fprintf
	testl	%ebp, %ebp
	jle	.LBB1_7
# %bb.2:                                # %.preheader.lr.ph
	movslq	%r12d, %rax
	movl	%ebp, %ecx
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movl	12(%rsp), %ecx                  # 4-byte Reload
	addq	$2, %r14
	leaq	(%rax,%rax,2), %r13
	leaq	(%rcx,%rcx,2), %rbp
	xorl	%ebx, %ebx
.LBB1_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_5 Depth 2
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_6
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB1_3 Depth=1
	xorl	%r12d, %r12d
.LBB1_5:                                #   Parent Loop BB1_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movzbl	-2(%r14,%r12), %edx
	movzbl	-1(%r14,%r12), %ecx
	movzbl	(%r14,%r12), %r8d
	movl	$.L.str.9, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	fprintf
	addq	$3, %r12
	cmpq	%r12, %rbp
	jne	.LBB1_5
.LBB1_6:                                # %._crit_edge
                                        #   in Loop: Header=BB1_3 Depth=1
	incq	%rbx
	addq	%r13, %r14
	cmpq	16(%rsp), %rbx                  # 8-byte Folded Reload
	jne	.LBB1_3
.LBB1_7:                                # %._crit_edge26
	movq	%r15, %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fclose                          # TAILCALL
.LBB1_8:
	.cfi_def_cfa_offset 80
	movl	$.L.str.7, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc, .Lfunc_end1-_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc
	.cfi_endproc
                                        # -- End function
	.globl	_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh # -- Begin function _Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.type	_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh,@function
_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh: # @_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%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	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	$_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh, %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_end2:
	.size	_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh, .Lfunc_end2-_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.cfi_endproc
                                        # -- End function
	.globl	_Z36__device_stub__computePriorityKernelPhiiPi # -- Begin function _Z36__device_stub__computePriorityKernelPhiiPi
	.type	_Z36__device_stub__computePriorityKernelPhiiPi,@function
_Z36__device_stub__computePriorityKernelPhiiPi: # @_Z36__device_stub__computePriorityKernelPhiiPi
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%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	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	$_Z21computePriorityKernelPhiiPi, %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_end3:
	.size	_Z36__device_stub__computePriorityKernelPhiiPi, .Lfunc_end3-_Z36__device_stub__computePriorityKernelPhiiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i # -- Begin function _Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.type	_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i,@function
_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i: # @_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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_end4:
	.size	_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i, .Lfunc_end4-_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z5tracePiS_iii                 # -- Begin function _Z5tracePiS_iii
	.type	_Z5tracePiS_iii,@function
_Z5tracePiS_iii:                        # @_Z5tracePiS_iii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $ecx killed $ecx def $rcx
	leal	-1(%rcx), %r9d
	xorl	%eax, %eax
	cmpl	$2, %edx
	jl	.LBB5_5
# %bb.1:                                # %.lr.ph
	movl	%r9d, %r10d
	imull	%r8d, %r10d
	movslq	%r10d, %rax
	movl	%edx, %r11d
	leaq	(%rdi,%rax,4), %rbx
	xorl	%r15d, %r15d
	movl	$1, %r14d
.LBB5_2:                                # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r14,4), %ebp
	leal	(%r15,%r10), %eax
	movslq	%eax, %r12
	movl	%r14d, %eax
	cmpl	(%rdi,%r12,4), %ebp
	jl	.LBB5_4
# %bb.3:                                #   in Loop: Header=BB5_2 Depth=1
	movl	%r15d, %eax
.LBB5_4:                                #   in Loop: Header=BB5_2 Depth=1
	incq	%r14
	movl	%eax, %r15d
	cmpq	%r14, %r11
	jne	.LBB5_2
.LBB5_5:                                # %.preheader
	testl	%ecx, %ecx
	jle	.LBB5_14
# %bb.6:                                # %.lr.ph50
	decl	%edx
	movl	%r9d, %r9d
	movslq	%r8d, %rcx
	leaq	1(%r9), %r8
	decq	%r9
	imulq	%rcx, %r9
	leaq	(%rdi,%r9,4), %rdi
	shlq	$2, %rcx
	negq	%rcx
.LBB5_7:                                # =>This Inner Loop Header: Depth=1
	movl	%eax, -4(%rsi,%r8,4)
	cmpq	$1, %r8
	je	.LBB5_14
# %bb.8:                                #   in Loop: Header=BB5_7 Depth=1
	movslq	%eax, %r9
	movl	(%rdi,%r9,4), %r11d
	testl	%eax, %eax
	jle	.LBB5_9
# %bb.10:                               #   in Loop: Header=BB5_7 Depth=1
	movl	-4(%rdi,%r9,4), %r10d
	xorl	%ebx, %ebx
	cmpl	%r11d, %r10d
	setl	%bl
	cmovll	%r10d, %r11d
	movl	%eax, %r10d
	subl	%ebx, %r10d
	jmp	.LBB5_11
.LBB5_9:                                #   in Loop: Header=BB5_7 Depth=1
	movl	%eax, %r10d
.LBB5_11:                               #   in Loop: Header=BB5_7 Depth=1
	cmpl	%edx, %eax
	jge	.LBB5_13
# %bb.12:                               #   in Loop: Header=BB5_7 Depth=1
	incl	%eax
	cmpl	%r11d, 4(%rdi,%r9,4)
	cmovll	%eax, %r10d
.LBB5_13:                               # %._crit_edge55
                                        #   in Loop: Header=BB5_7 Depth=1
	addq	%rcx, %rdi
	movl	%r10d, %eax
	decq	%r8
	jg	.LBB5_7
.LBB5_14:                               # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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
.Lfunc_end5:
	.size	_Z5tracePiS_iii, .Lfunc_end5-_Z5tracePiS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z42__device_stub__computeSeamScoreTableKernelPiS_iii # -- Begin function _Z42__device_stub__computeSeamScoreTableKernelPiS_iii
	.type	_Z42__device_stub__computeSeamScoreTableKernelPiS_iii,@function
_Z42__device_stub__computeSeamScoreTableKernelPiS_iii: # @_Z42__device_stub__computeSeamScoreTableKernelPiS_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	$_Z27computeSeamScoreTableKernelPiS_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_end6:
	.size	_Z42__device_stub__computeSeamScoreTableKernelPiS_iii, .Lfunc_end6-_Z42__device_stub__computeSeamScoreTableKernelPiS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3 # -- Begin function _Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3
	.type	_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3,@function
_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3: # @_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3
.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	$168, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r8, %r12
	movl	%ecx, 28(%rsp)                  # 4-byte Spill
	movl	%edx, %r14d
	movq	%rdi, %rbx
	movl	%esi, 12(%rsp)
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	leaq	64(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	-8(%r15), %rdi
.Ltmp0:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp1:
# %bb.1:                                # %.noexc
	movq	56(%rsp), %rdi
.Ltmp2:
	callq	hipEventSynchronize
.Ltmp3:
# %bb.2:                                # %_ZN8GpuTimer5StartEv.exit
	movslq	12(%rsp), %rax
	movslq	%r14d, %r15
	imulq	%r15, %rax
	leaq	(%rax,%rax,2), %rsi
.Ltmp5:
	leaq	16(%rsp), %rdi
	callq	hipMalloc
.Ltmp6:
# %bb.3:                                # %_ZL9hipMallocI15HIP_vector_typeIhLj3EEE10hipError_tPPT_m.exit
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_4
# %bb.9:
	movslq	12(%rsp), %rsi
	imulq	%r15, %rsi
.Ltmp10:
	leaq	48(%rsp), %rdi
	callq	hipMalloc
.Ltmp11:
# %bb.10:                               # %_ZL9hipMallocIhE10hipError_tPPT_m.exit
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_11
# %bb.13:
	movslq	12(%rsp), %rsi
	imulq	%r15, %rsi
	shlq	$2, %rsi
.Ltmp15:
	leaq	40(%rsp), %rdi
	callq	hipMalloc
.Ltmp16:
# %bb.14:                               # %_ZL9hipMallocIiE10hipError_tPPT_m.exit
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_15
# %bb.17:
	leaq	(,%r15,4), %rsi
.Ltmp20:
	leaq	88(%rsp), %rdi
	movq	%rsi, 128(%rsp)                 # 8-byte Spill
	callq	hipMalloc
.Ltmp21:
# %bb.18:                               # %_ZL9hipMallocIiE10hipError_tPPT_m.exit199
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_19
# %bb.21:
	movslq	12(%rsp), %rsi
	imulq	%r15, %rsi
	shlq	$2, %rsi
.Ltmp25:
	leaq	80(%rsp), %rdi
	callq	hipMalloc
.Ltmp26:
# %bb.22:                               # %_ZL9hipMallocIiE10hipError_tPPT_m.exit201
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_23
# %bb.25:
	movq	%r12, 144(%rsp)                 # 8-byte Spill
	leaq	224(%rsp), %rbp
	movq	128(%rsp), %rdi                 # 8-byte Reload
	callq	malloc
	movq	%rax, 120(%rsp)                 # 8-byte Spill
	leaq	12(%rsp), %r15
	movl	(%r15), %r12d
	movl	%r12d, %eax
	imull	%r14d, %eax
	movslq	%eax, %rdi
	shlq	$2, %rdi
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movl	(%rbp), %r13d
	movl	4(%rbp), %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	leal	-1(%r12), %eax
	addl	$254, %r12d
	testl	%eax, %eax
	cmovnsl	%eax, %r12d
.Ltmp30:
	movl	$d_originalWidth, %edi
	movl	$4, %edx
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
.Ltmp31:
# %bb.26:                               # %_Z17hipMemcpyToSymbolIiE10hipError_tRKT_PKvmm13hipMemcpyKind.exit
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB7_27
# %bb.29:
	movl	12(%rsp), %eax
	movq	16(%rsp), %rdi
	movl	%eax, 100(%rsp)                 # 4-byte Spill
	imull	%r14d, %eax
	cltq
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	leaq	(%rax,%rax,2), %rdx
.Ltmp35:
	movq	%rbx, %rsi
	movq	%rdx, 136(%rsp)                 # 8-byte Spill
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp36:
# %bb.30:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_31
# %bb.34:
	movl	12(%rsp), %eax
	decl	%eax
	xorl	%edx, %edx
	divl	%r13d
	movl	%eax, %ecx
	incl	%ecx
	leal	-1(%r14), %eax
	xorl	%edx, %edx
	divl	32(%rsp)                        # 4-byte Folded Reload
	movl	%eax, %ebp
	incl	%ebp
	shlq	$32, %rbp
	orq	%rcx, %rbp
	leaq	224(%rsp), %rax
	movq	(%rax), %rdx
	movl	8(%rax), %ecx
.Ltmp40:
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%rdx, 160(%rsp)                 # 8-byte Spill
	movl	%ecx, 104(%rsp)                 # 4-byte Spill
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp41:
# %bb.35:
	testl	%eax, %eax
	jne	.LBB7_37
# %bb.36:
	movq	16(%rsp), %rdi
	movl	12(%rsp), %esi
	movq	48(%rsp), %rcx
.Ltmp42:
	movl	%r14d, %edx
	callq	_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
.Ltmp43:
.LBB7_37:
.Ltmp44:
	callq	hipDeviceSynchronize
.Ltmp45:
# %bb.38:
.Ltmp46:
	callq	hipGetLastError
.Ltmp47:
# %bb.39:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_59
# %bb.40:                               # %.preheader218
	movl	28(%rsp), %eax                  # 4-byte Reload
	cmpl	%eax, 12(%rsp)
	jle	.LBB7_88
# %bb.41:                               # %.lr.ph264
	addl	$2, %r13d
	movq	32(%rsp), %rax                  # 8-byte Reload
	addl	$2, %eax
	imull	%r13d, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	sarl	$8, %r12d
	leal	3(,%r12,2), %eax
	movl	%eax, %r13d
	btsq	$32, %r13
	shlq	$2, 112(%rsp)                   # 8-byte Folded Spill
	movl	%r14d, %eax
	btsq	$32, %rax
	movq	%rax, 152(%rsp)                 # 8-byte Spill
	movabsq	$4294967552, %r15               # imm = 0x100000100
.LBB7_42:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_50 Depth 2
.Ltmp51:
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	160(%rsp), %rdx                 # 8-byte Reload
	movl	104(%rsp), %ecx                 # 4-byte Reload
	movq	32(%rsp), %r8                   # 8-byte Reload
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp52:
# %bb.43:                               #   in Loop: Header=BB7_42 Depth=1
	testl	%eax, %eax
	jne	.LBB7_45
# %bb.44:                               #   in Loop: Header=BB7_42 Depth=1
	movq	48(%rsp), %rdi
	movl	12(%rsp), %esi
	movq	40(%rsp), %rcx
.Ltmp53:
	movl	%r14d, %edx
	callq	_Z36__device_stub__computePriorityKernelPhiiPi
.Ltmp54:
.LBB7_45:                               #   in Loop: Header=BB7_42 Depth=1
.Ltmp55:
	callq	hipDeviceSynchronize
.Ltmp56:
# %bb.46:                               #   in Loop: Header=BB7_42 Depth=1
.Ltmp57:
	callq	hipGetLastError
.Ltmp58:
# %bb.47:                               #   in Loop: Header=BB7_42 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_61
# %bb.48:                               # %.preheader
                                        #   in Loop: Header=BB7_42 Depth=1
	testl	%r14d, %r14d
	jle	.LBB7_65
# %bb.49:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB7_42 Depth=1
	xorl	%r12d, %r12d
.LBB7_50:                               # %.lr.ph
                                        #   Parent Loop BB7_42 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp63:
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp64:
# %bb.51:                               #   in Loop: Header=BB7_50 Depth=2
	testl	%eax, %eax
	jne	.LBB7_53
# %bb.52:                               #   in Loop: Header=BB7_50 Depth=2
	movq	40(%rsp), %rdi
	movq	80(%rsp), %rsi
	movl	12(%rsp), %edx
.Ltmp65:
	movl	%r14d, %ecx
	movl	%r12d, %r8d
	callq	_Z42__device_stub__computeSeamScoreTableKernelPiS_iii
.Ltmp66:
.LBB7_53:                               #   in Loop: Header=BB7_50 Depth=2
.Ltmp67:
	callq	hipDeviceSynchronize
.Ltmp68:
# %bb.54:                               #   in Loop: Header=BB7_50 Depth=2
.Ltmp70:
	callq	hipGetLastError
.Ltmp71:
# %bb.55:                               #   in Loop: Header=BB7_50 Depth=2
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_56
# %bb.64:                               #   in Loop: Header=BB7_50 Depth=2
	addl	$64, %r12d
	cmpl	%r14d, %r12d
	jl	.LBB7_50
.LBB7_65:                               # %._crit_edge
                                        #   in Loop: Header=BB7_42 Depth=1
	movq	80(%rsp), %rsi
.Ltmp76:
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movq	112(%rsp), %rdx                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp77:
# %bb.66:                               #   in Loop: Header=BB7_42 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_67
# %bb.73:                               #   in Loop: Header=BB7_42 Depth=1
	movl	12(%rsp), %edx
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movq	120(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rsi
	movl	%r14d, %ecx
	movl	100(%rsp), %r8d                 # 4-byte Reload
	callq	_Z5tracePiS_iii
	movq	88(%rsp), %rdi
.Ltmp82:
	movq	%rbx, %rsi
	movq	128(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp83:
# %bb.74:                               #   in Loop: Header=BB7_42 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_75
# %bb.78:                               #   in Loop: Header=BB7_42 Depth=1
.Ltmp88:
	movq	152(%rsp), %rdi                 # 8-byte Reload
	movl	$1, %esi
	movabsq	$4294967297, %rdx               # imm = 0x100000001
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp89:
# %bb.79:                               #   in Loop: Header=BB7_42 Depth=1
	testl	%eax, %eax
	jne	.LBB7_81
# %bb.80:                               #   in Loop: Header=BB7_42 Depth=1
	movq	88(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rcx
	movl	12(%rsp), %r8d
.Ltmp90:
	callq	_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
.Ltmp91:
.LBB7_81:                               #   in Loop: Header=BB7_42 Depth=1
.Ltmp92:
	callq	hipDeviceSynchronize
.Ltmp93:
# %bb.82:                               #   in Loop: Header=BB7_42 Depth=1
.Ltmp95:
	callq	hipGetLastError
.Ltmp96:
# %bb.83:                               #   in Loop: Header=BB7_42 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_84
# %bb.87:                               #   in Loop: Header=BB7_42 Depth=1
	movl	12(%rsp), %eax
	decl	%eax
	movl	%eax, 12(%rsp)
	cmpl	28(%rsp), %eax                  # 4-byte Folded Reload
	jg	.LBB7_42
.LBB7_88:                               # %._crit_edge265
	movq	16(%rsp), %rsi
.Ltmp101:
	movq	144(%rsp), %rdi                 # 8-byte Reload
	movq	136(%rsp), %rdx                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp102:
# %bb.89:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_90
# %bb.92:
	movq	16(%rsp), %rdi
.Ltmp106:
	callq	hipFree
.Ltmp107:
# %bb.93:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_94
# %bb.96:
	movq	48(%rsp), %rdi
.Ltmp111:
	callq	hipFree
.Ltmp112:
# %bb.97:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_98
# %bb.100:
	movq	40(%rsp), %rdi
.Ltmp116:
	callq	hipFree
.Ltmp117:
# %bb.101:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_102
# %bb.104:
	movq	88(%rsp), %rdi
.Ltmp121:
	callq	hipFree
.Ltmp122:
# %bb.105:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_106
# %bb.108:
	movq	80(%rsp), %rdi
.Ltmp126:
	callq	hipFree
.Ltmp127:
# %bb.109:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB7_110
# %bb.112:
	movq	72(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	120(%rsp), %rdi                 # 8-byte Reload
	callq	free
	movq	64(%rsp), %rdi
.Ltmp131:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp132:
# %bb.113:                              # %_ZN8GpuTimer4StopEv.exit
	movq	64(%rsp), %rdi
.Ltmp134:
	callq	hipEventSynchronize
.Ltmp135:
# %bb.114:                              # %.noexc204
	movq	56(%rsp), %rsi
	movq	64(%rsp), %rdx
.Ltmp136:
	leaq	108(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp137:
# %bb.115:
	cvtss2sd	108(%rsp), %xmm0
	movl	$.L.str.13, %edi
	movb	$1, %al
	callq	printf
	leaq	56(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB7_56:
	.cfi_def_cfa_offset 224
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$314, %ecx                      # imm = 0x13A
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp73:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp74:
	jmp	.LBB7_32
.LBB7_4:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$267, %ecx                      # imm = 0x10B
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp7:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp8:
	jmp	.LBB7_5
.LBB7_11:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$269, %ecx                      # imm = 0x10D
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp12:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp13:
	jmp	.LBB7_5
.LBB7_15:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$271, %ecx                      # imm = 0x10F
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp17:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp18:
	jmp	.LBB7_5
.LBB7_19:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$273, %ecx                      # imm = 0x111
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp22:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp23:
	jmp	.LBB7_5
.LBB7_23:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$275, %ecx                      # imm = 0x113
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp27:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp28:
	jmp	.LBB7_5
.LBB7_27:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$291, %ecx                      # imm = 0x123
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp32:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp33:
.LBB7_5:
	movl	$.L.str.12, %esi
	movq	%rbx, %rdi
	movl	%ebp, %edx
	jmp	.LBB7_6
.LBB7_31:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$295, %ecx                      # imm = 0x127
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp37:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp38:
	jmp	.LBB7_32
.LBB7_59:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$301, %ecx                      # imm = 0x12D
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp48:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp49:
	jmp	.LBB7_32
.LBB7_90:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$330, %ecx                      # imm = 0x14A
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp103:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp104:
	jmp	.LBB7_32
.LBB7_94:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$332, %ecx                      # imm = 0x14C
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp108:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp109:
	jmp	.LBB7_32
.LBB7_98:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$333, %ecx                      # imm = 0x14D
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp113:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp114:
	jmp	.LBB7_32
.LBB7_102:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$334, %ecx                      # imm = 0x14E
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp118:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp119:
	jmp	.LBB7_32
.LBB7_106:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$335, %ecx                      # imm = 0x14F
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp123:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp124:
	jmp	.LBB7_32
.LBB7_110:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$336, %ecx                      # imm = 0x150
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp128:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp129:
	jmp	.LBB7_32
.LBB7_61:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$308, %ecx                      # imm = 0x134
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp60:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp61:
	jmp	.LBB7_32
.LBB7_67:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$318, %ecx                      # imm = 0x13E
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp79:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp80:
	jmp	.LBB7_32
.LBB7_75:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$322, %ecx                      # imm = 0x142
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp85:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp86:
	jmp	.LBB7_32
.LBB7_84:
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$325, %ecx                      # imm = 0x145
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp98:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp99:
.LBB7_32:
	movl	$.L.str.12, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
.LBB7_6:
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB7_116:
.Ltmp138:
	jmp	.LBB7_117
.LBB7_58:                               # %.loopexit.split-lp220
.Ltmp133:
	jmp	.LBB7_117
.LBB7_7:
.Ltmp4:
	jmp	.LBB7_117
.LBB7_85:                               # %.loopexit239
.Ltmp97:
	jmp	.LBB7_117
.LBB7_76:                               # %.loopexit234
.Ltmp84:
	jmp	.LBB7_117
.LBB7_71:                               # %.loopexit229
.Ltmp78:
	jmp	.LBB7_117
.LBB7_62:                               # %.loopexit224
.Ltmp59:
	jmp	.LBB7_117
.LBB7_57:                               # %.loopexit219
.Ltmp94:
	jmp	.LBB7_117
.LBB7_69:                               # %.loopexit
.Ltmp72:
	jmp	.LBB7_117
.LBB7_68:
.Ltmp69:
	jmp	.LBB7_117
.LBB7_86:                               # %.loopexit.split-lp240
.Ltmp100:
	jmp	.LBB7_117
.LBB7_77:                               # %.loopexit.split-lp235
.Ltmp87:
	jmp	.LBB7_117
.LBB7_72:                               # %.loopexit.split-lp230
.Ltmp81:
	jmp	.LBB7_117
.LBB7_63:                               # %.loopexit.split-lp225
.Ltmp62:
	jmp	.LBB7_117
.LBB7_111:
.Ltmp130:
	jmp	.LBB7_117
.LBB7_107:
.Ltmp125:
	jmp	.LBB7_117
.LBB7_103:
.Ltmp120:
	jmp	.LBB7_117
.LBB7_99:
.Ltmp115:
	jmp	.LBB7_117
.LBB7_95:
.Ltmp110:
	jmp	.LBB7_117
.LBB7_91:
.Ltmp105:
	jmp	.LBB7_117
.LBB7_60:
.Ltmp50:
	jmp	.LBB7_117
.LBB7_33:
.Ltmp39:
	jmp	.LBB7_117
.LBB7_28:
.Ltmp34:
	jmp	.LBB7_117
.LBB7_24:
.Ltmp29:
	jmp	.LBB7_117
.LBB7_20:
.Ltmp24:
	jmp	.LBB7_117
.LBB7_16:
.Ltmp19:
	jmp	.LBB7_117
.LBB7_12:
.Ltmp14:
	jmp	.LBB7_117
.LBB7_8:
.Ltmp9:
	jmp	.LBB7_117
.LBB7_70:                               # %.loopexit.split-lp
.Ltmp75:
.LBB7_117:
	movq	%rax, %rbx
	leaq	56(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end7:
	.size	_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3, .Lfunc_end7-_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3
	.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 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp3-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp3
	.uleb128 .Ltmp4-.Lfunc_begin0           #     jumps to .Ltmp4
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp6-.Ltmp5                  #   Call between .Ltmp5 and .Ltmp6
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp11-.Ltmp10                #   Call between .Ltmp10 and .Ltmp11
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp16-.Ltmp15                #   Call between .Ltmp15 and .Ltmp16
	.uleb128 .Ltmp19-.Lfunc_begin0          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp21-.Ltmp20                #   Call between .Ltmp20 and .Ltmp21
	.uleb128 .Ltmp24-.Lfunc_begin0          #     jumps to .Ltmp24
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp26-.Ltmp25                #   Call between .Ltmp25 and .Ltmp26
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp31-.Ltmp30                #   Call between .Ltmp30 and .Ltmp31
	.uleb128 .Ltmp34-.Lfunc_begin0          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp36-.Ltmp35                #   Call between .Ltmp35 and .Ltmp36
	.uleb128 .Ltmp39-.Lfunc_begin0          #     jumps to .Ltmp39
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp40-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp45-.Ltmp40                #   Call between .Ltmp40 and .Ltmp45
	.uleb128 .Ltmp133-.Lfunc_begin0         #     jumps to .Ltmp133
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp47-.Ltmp46                #   Call between .Ltmp46 and .Ltmp47
	.uleb128 .Ltmp50-.Lfunc_begin0          #     jumps to .Ltmp50
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp51-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp56-.Ltmp51                #   Call between .Ltmp51 and .Ltmp56
	.uleb128 .Ltmp94-.Lfunc_begin0          #     jumps to .Ltmp94
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp57-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp58-.Ltmp57                #   Call between .Ltmp57 and .Ltmp58
	.uleb128 .Ltmp59-.Lfunc_begin0          #     jumps to .Ltmp59
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp63-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Ltmp68-.Ltmp63                #   Call between .Ltmp63 and .Ltmp68
	.uleb128 .Ltmp69-.Lfunc_begin0          #     jumps to .Ltmp69
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp70-.Lfunc_begin0          # >> Call Site 15 <<
	.uleb128 .Ltmp71-.Ltmp70                #   Call between .Ltmp70 and .Ltmp71
	.uleb128 .Ltmp72-.Lfunc_begin0          #     jumps to .Ltmp72
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp76-.Lfunc_begin0          # >> Call Site 16 <<
	.uleb128 .Ltmp77-.Ltmp76                #   Call between .Ltmp76 and .Ltmp77
	.uleb128 .Ltmp78-.Lfunc_begin0          #     jumps to .Ltmp78
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp82-.Lfunc_begin0          # >> Call Site 17 <<
	.uleb128 .Ltmp83-.Ltmp82                #   Call between .Ltmp82 and .Ltmp83
	.uleb128 .Ltmp84-.Lfunc_begin0          #     jumps to .Ltmp84
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp88-.Lfunc_begin0          # >> Call Site 18 <<
	.uleb128 .Ltmp93-.Ltmp88                #   Call between .Ltmp88 and .Ltmp93
	.uleb128 .Ltmp94-.Lfunc_begin0          #     jumps to .Ltmp94
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp95-.Lfunc_begin0          # >> Call Site 19 <<
	.uleb128 .Ltmp96-.Ltmp95                #   Call between .Ltmp95 and .Ltmp96
	.uleb128 .Ltmp97-.Lfunc_begin0          #     jumps to .Ltmp97
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp101-.Lfunc_begin0         # >> Call Site 20 <<
	.uleb128 .Ltmp102-.Ltmp101              #   Call between .Ltmp101 and .Ltmp102
	.uleb128 .Ltmp105-.Lfunc_begin0         #     jumps to .Ltmp105
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp106-.Lfunc_begin0         # >> Call Site 21 <<
	.uleb128 .Ltmp107-.Ltmp106              #   Call between .Ltmp106 and .Ltmp107
	.uleb128 .Ltmp110-.Lfunc_begin0         #     jumps to .Ltmp110
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp111-.Lfunc_begin0         # >> Call Site 22 <<
	.uleb128 .Ltmp112-.Ltmp111              #   Call between .Ltmp111 and .Ltmp112
	.uleb128 .Ltmp115-.Lfunc_begin0         #     jumps to .Ltmp115
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp116-.Lfunc_begin0         # >> Call Site 23 <<
	.uleb128 .Ltmp117-.Ltmp116              #   Call between .Ltmp116 and .Ltmp117
	.uleb128 .Ltmp120-.Lfunc_begin0         #     jumps to .Ltmp120
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp121-.Lfunc_begin0         # >> Call Site 24 <<
	.uleb128 .Ltmp122-.Ltmp121              #   Call between .Ltmp121 and .Ltmp122
	.uleb128 .Ltmp125-.Lfunc_begin0         #     jumps to .Ltmp125
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp126-.Lfunc_begin0         # >> Call Site 25 <<
	.uleb128 .Ltmp127-.Ltmp126              #   Call between .Ltmp126 and .Ltmp127
	.uleb128 .Ltmp130-.Lfunc_begin0         #     jumps to .Ltmp130
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp131-.Lfunc_begin0         # >> Call Site 26 <<
	.uleb128 .Ltmp132-.Ltmp131              #   Call between .Ltmp131 and .Ltmp132
	.uleb128 .Ltmp133-.Lfunc_begin0         #     jumps to .Ltmp133
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp134-.Lfunc_begin0         # >> Call Site 27 <<
	.uleb128 .Ltmp137-.Ltmp134              #   Call between .Ltmp134 and .Ltmp137
	.uleb128 .Ltmp138-.Lfunc_begin0         #     jumps to .Ltmp138
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp73-.Lfunc_begin0          # >> Call Site 28 <<
	.uleb128 .Ltmp74-.Ltmp73                #   Call between .Ltmp73 and .Ltmp74
	.uleb128 .Ltmp75-.Lfunc_begin0          #     jumps to .Ltmp75
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 29 <<
	.uleb128 .Ltmp8-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 30 <<
	.uleb128 .Ltmp13-.Ltmp12                #   Call between .Ltmp12 and .Ltmp13
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin0          # >> Call Site 31 <<
	.uleb128 .Ltmp18-.Ltmp17                #   Call between .Ltmp17 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin0          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin0          # >> Call Site 32 <<
	.uleb128 .Ltmp23-.Ltmp22                #   Call between .Ltmp22 and .Ltmp23
	.uleb128 .Ltmp24-.Lfunc_begin0          #     jumps to .Ltmp24
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin0          # >> Call Site 33 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp32-.Lfunc_begin0          # >> Call Site 34 <<
	.uleb128 .Ltmp33-.Ltmp32                #   Call between .Ltmp32 and .Ltmp33
	.uleb128 .Ltmp34-.Lfunc_begin0          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp37-.Lfunc_begin0          # >> Call Site 35 <<
	.uleb128 .Ltmp38-.Ltmp37                #   Call between .Ltmp37 and .Ltmp38
	.uleb128 .Ltmp39-.Lfunc_begin0          #     jumps to .Ltmp39
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp48-.Lfunc_begin0          # >> Call Site 36 <<
	.uleb128 .Ltmp49-.Ltmp48                #   Call between .Ltmp48 and .Ltmp49
	.uleb128 .Ltmp50-.Lfunc_begin0          #     jumps to .Ltmp50
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp103-.Lfunc_begin0         # >> Call Site 37 <<
	.uleb128 .Ltmp104-.Ltmp103              #   Call between .Ltmp103 and .Ltmp104
	.uleb128 .Ltmp105-.Lfunc_begin0         #     jumps to .Ltmp105
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp108-.Lfunc_begin0         # >> Call Site 38 <<
	.uleb128 .Ltmp109-.Ltmp108              #   Call between .Ltmp108 and .Ltmp109
	.uleb128 .Ltmp110-.Lfunc_begin0         #     jumps to .Ltmp110
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp113-.Lfunc_begin0         # >> Call Site 39 <<
	.uleb128 .Ltmp114-.Ltmp113              #   Call between .Ltmp113 and .Ltmp114
	.uleb128 .Ltmp115-.Lfunc_begin0         #     jumps to .Ltmp115
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp118-.Lfunc_begin0         # >> Call Site 40 <<
	.uleb128 .Ltmp119-.Ltmp118              #   Call between .Ltmp118 and .Ltmp119
	.uleb128 .Ltmp120-.Lfunc_begin0         #     jumps to .Ltmp120
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp123-.Lfunc_begin0         # >> Call Site 41 <<
	.uleb128 .Ltmp124-.Ltmp123              #   Call between .Ltmp123 and .Ltmp124
	.uleb128 .Ltmp125-.Lfunc_begin0         #     jumps to .Ltmp125
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp128-.Lfunc_begin0         # >> Call Site 42 <<
	.uleb128 .Ltmp129-.Ltmp128              #   Call between .Ltmp128 and .Ltmp129
	.uleb128 .Ltmp130-.Lfunc_begin0         #     jumps to .Ltmp130
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin0          # >> Call Site 43 <<
	.uleb128 .Ltmp61-.Ltmp60                #   Call between .Ltmp60 and .Ltmp61
	.uleb128 .Ltmp62-.Lfunc_begin0          #     jumps to .Ltmp62
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp79-.Lfunc_begin0          # >> Call Site 44 <<
	.uleb128 .Ltmp80-.Ltmp79                #   Call between .Ltmp79 and .Ltmp80
	.uleb128 .Ltmp81-.Lfunc_begin0          #     jumps to .Ltmp81
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp85-.Lfunc_begin0          # >> Call Site 45 <<
	.uleb128 .Ltmp86-.Ltmp85                #   Call between .Ltmp85 and .Ltmp86
	.uleb128 .Ltmp87-.Lfunc_begin0          #     jumps to .Ltmp87
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp98-.Lfunc_begin0          # >> Call Site 46 <<
	.uleb128 .Ltmp99-.Ltmp98                #   Call between .Ltmp98 and .Ltmp99
	.uleb128 .Ltmp100-.Lfunc_begin0         #     jumps to .Ltmp100
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp99-.Lfunc_begin0          # >> Call Site 47 <<
	.uleb128 .Lfunc_end7-.Ltmp99            #   Call between .Ltmp99 and .Lfunc_end7
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD2Ev,comdat
	.weak	_ZN8GpuTimerD2Ev                # -- Begin function _ZN8GpuTimerD2Ev
	.p2align	1, 0x90
	.type	_ZN8GpuTimerD2Ev,@function
_ZN8GpuTimerD2Ev:                       # @_ZN8GpuTimerD2Ev
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
.Ltmp139:
	callq	hipEventDestroy
.Ltmp140:
# %bb.1:
	movq	8(%rbx), %rdi
.Ltmp141:
	callq	hipEventDestroy
.Ltmp142:
# %bb.2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB8_3:
	.cfi_def_cfa_offset 16
.Ltmp143:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end8:
	.size	_ZN8GpuTimerD2Ev, .Lfunc_end8-_ZN8GpuTimerD2Ev
	.cfi_endproc
	.section	.gcc_except_table._ZN8GpuTimerD2Ev,"aG",@progbits,_ZN8GpuTimerD2Ev,comdat
	.p2align	2, 0x0
GCC_except_table8:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Ltmp139-.Lfunc_begin1         # >> Call Site 1 <<
	.uleb128 .Ltmp142-.Ltmp139              #   Call between .Ltmp139 and .Ltmp142
	.uleb128 .Ltmp143-.Lfunc_begin1         #     jumps to .Ltmp143
	.byte	1                               #   On action: 1
.Lcst_end1:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z10getClosestPhiiiii           # -- Begin function _Z10getClosestPhiiiii
	.type	_Z10getClosestPhiiiii,@function
_Z10getClosestPhiiiii:                  # @_Z10getClosestPhiiiii
	.cfi_startproc
# %bb.0:
                                        # kill: def $r8d killed $r8d def $r8
                                        # kill: def $ecx killed $ecx def $rcx
	leal	-1(%r8), %eax
	cmpl	%r8d, %esi
	cmovll	%esi, %eax
	xorl	%r8d, %r8d
	testl	%esi, %esi
	cmovsl	%r8d, %eax
	leal	-1(%rcx), %esi
	cmpl	%ecx, %edx
	cmovll	%edx, %esi
	testl	%edx, %edx
	cmovsl	%r8d, %esi
	imull	%r9d, %eax
	addl	%esi, %eax
	cltq
	movb	(%rdi,%rax), %al
	retq
.Lfunc_end9:
	.size	_Z10getClosestPhiiiii, .Lfunc_end9-_Z10getClosestPhiiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z20computePixelPriorityPhiiiii # -- Begin function _Z20computePixelPriorityPhiiiii
	.type	_Z20computePixelPriorityPhiiiii,@function
_Z20computePixelPriorityPhiiiii:        # @_Z20computePixelPriorityPhiiiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, -20(%rsp)                 # 4-byte Spill
	movl	%ecx, %r9d
	decl	%esi
	decl	%edx
	movslq	%edx, %rax
	movq	%rax, -8(%rsp)                  # 8-byte Spill
	movslq	%ecx, %rdx
	decl	%r9d
	movslq	%esi, %rax
	movq	%rax, -16(%rsp)                 # 8-byte Spill
	movslq	%r8d, %r11
	decl	%r8d
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	xorl	%r10d, %r10d
.LBB10_1:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_2 Depth 2
	movq	-16(%rsp), %rax                 # 8-byte Reload
	addq	%r12, %rax
	cmpq	%r11, %rax
	movl	%r8d, %ebp
	cmovll	%eax, %ebp
	testq	%rax, %rax
	cmovsl	%r14d, %ebp
	imull	-20(%rsp), %ebp                 # 4-byte Folded Reload
	movq	$-12, %r13
	movq	-8(%rsp), %rax                  # 8-byte Reload
.LBB10_2:                               #   Parent Loop BB10_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%rdx, %rax
	movl	%r9d, %ecx
	cmovll	%eax, %ecx
	testq	%rax, %rax
	cmovsl	%r14d, %ecx
	addl	%ebp, %ecx
	movslq	%ecx, %rcx
	movzbl	(%rdi,%rcx), %ecx
	movl	xSobel+12(%r15,%r13), %esi
	imull	%ecx, %esi
	imull	ySobel+12(%r15,%r13), %ecx
	addl	%esi, %ebx
	addl	%ecx, %r10d
	incq	%rax
	addq	$4, %r13
	jne	.LBB10_2
# %bb.3:                                #   in Loop: Header=BB10_1 Depth=1
	incq	%r12
	addq	$12, %r15
	cmpq	$3, %r12
	jne	.LBB10_1
# %bb.4:
	movl	%ebx, %ecx
	negl	%ecx
	cmovsl	%ebx, %ecx
	movl	%r10d, %eax
	negl	%eax
	cmovsl	%r10d, %eax
	addl	%ecx, %eax
	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
.Lfunc_end10:
	.size	_Z20computePixelPriorityPhiiiii, .Lfunc_end10-_Z20computePixelPriorityPhiiiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh
.LCPI11_0:
	.long	0x3e991687                      # float 0.298999995
.LCPI11_1:
	.long	0x3f1645a2                      # float 0.587000012
.LCPI11_2:
	.long	0x3de978d5                      # float 0.114
	.text
	.globl	_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh
	.type	_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh,@function
_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh: # @_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB11_7
# %bb.1:                                # %.preheader.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	movl	%edx, %eax
	movl	%esi, %edx
	addq	$2, %rdi
	xorl	%r8d, %r8d
	movss	.LCPI11_0(%rip), %xmm0          # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI11_1(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	movss	.LCPI11_2(%rip), %xmm2          # xmm2 = mem[0],zero,zero,zero
	xorl	%r9d, %r9d
.LBB11_2:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB11_4 Depth 2
	testl	%esi, %esi
	jle	.LBB11_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB11_2 Depth=1
	movl	%r8d, %r11d
	leaq	(%rcx,%r11), %r10
	leaq	(%r11,%r11,2), %r11
	addq	%rdi, %r11
	xorl	%ebx, %ebx
.LBB11_4:                               #   Parent Loop BB11_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movzbl	-2(%r11), %ebp
	xorps	%xmm3, %xmm3
	cvtsi2ss	%ebp, %xmm3
	movzbl	-1(%r11), %ebp
	xorps	%xmm4, %xmm4
	cvtsi2ss	%ebp, %xmm4
	mulss	%xmm0, %xmm3
	mulss	%xmm1, %xmm4
	addss	%xmm3, %xmm4
	movzbl	(%r11), %ebp
	xorps	%xmm3, %xmm3
	cvtsi2ss	%ebp, %xmm3
	mulss	%xmm2, %xmm3
	addss	%xmm4, %xmm3
	cvttss2si	%xmm3, %ebp
	movb	%bpl, (%r10,%rbx)
	incq	%rbx
	addq	$3, %r11
	cmpq	%rbx, %rdx
	jne	.LBB11_4
.LBB11_5:                               # %._crit_edge
                                        #   in Loop: Header=BB11_2 Depth=1
	incq	%r9
	addl	%esi, %r8d
	cmpq	%rax, %r9
	jne	.LBB11_2
# %bb.6:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %rbp
.LBB11_7:                               # %._crit_edge20
	retq
.Lfunc_end11:
	.size	_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh, .Lfunc_end11-_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh
	.cfi_endproc
                                        # -- End function
	.globl	_Z21computeSeamScoreTablePiS_iii # -- Begin function _Z21computeSeamScoreTablePiS_iii
	.type	_Z21computeSeamScoreTablePiS_iii,@function
_Z21computeSeamScoreTablePiS_iii:       # @_Z21computeSeamScoreTablePiS_iii
	.cfi_startproc
# %bb.0:
                                        # kill: def $edx killed $edx def $rdx
	movl	%edx, %eax
	testl	%edx, %edx
	jle	.LBB12_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%r9d, %r9d
.LBB12_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rdi,%r9,4), %r10d
	movl	%r10d, (%rsi,%r9,4)
	incq	%r9
	cmpq	%r9, %rax
	jne	.LBB12_2
.LBB12_3:                               # %.preheader46
	cmpl	$2, %ecx
	jl	.LBB12_14
# %bb.4:                                # %.preheader.lr.ph
	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
	leal	-1(%rdx), %r9d
	movslq	%r9d, %r9
	movslq	%r8d, %r10
	movl	%ecx, %ecx
	leaq	(,%r10,4), %r8
	leaq	(%rdi,%r10,4), %rdi
	leaq	(%rsi,%r10,4), %r10
	movl	$1, %r11d
.LBB12_5:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB12_7 Depth 2
	testl	%edx, %edx
	jle	.LBB12_12
# %bb.6:                                # %.lr.ph49
                                        #   in Loop: Header=BB12_5 Depth=1
	xorl	%ebx, %ebx
.LBB12_7:                               #   Parent Loop BB12_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rsi,%rbx,4), %ebp
	testq	%rbx, %rbx
	je	.LBB12_9
# %bb.8:                                #   in Loop: Header=BB12_7 Depth=2
	movl	-4(%rsi,%rbx,4), %r14d
	cmpl	%ebp, %r14d
	cmovll	%r14d, %ebp
.LBB12_9:                               #   in Loop: Header=BB12_7 Depth=2
	cmpq	%r9, %rbx
	jge	.LBB12_11
# %bb.10:                               #   in Loop: Header=BB12_7 Depth=2
	movl	4(%rsi,%rbx,4), %r14d
	cmpl	%ebp, %r14d
	cmovll	%r14d, %ebp
.LBB12_11:                              #   in Loop: Header=BB12_7 Depth=2
	addl	(%rdi,%rbx,4), %ebp
	movl	%ebp, (%r10,%rbx,4)
	incq	%rbx
	cmpq	%rbx, %rax
	jne	.LBB12_7
.LBB12_12:                              # %._crit_edge
                                        #   in Loop: Header=BB12_5 Depth=1
	incq	%r11
	addq	%r8, %rsi
	addq	%r8, %rdi
	addq	%r8, %r10
	cmpq	%rcx, %r11
	jne	.LBB12_5
# %bb.13:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %rbp
.LBB12_14:                              # %._crit_edge51
	retq
.Lfunc_end12:
	.size	_Z21computeSeamScoreTablePiS_iii, .Lfunc_end12-_Z21computeSeamScoreTablePiS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_ # -- Begin function _Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_
	.type	_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_,@function
_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_: # @_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %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	$216, %rsp
	.cfi_def_cfa_offset 272
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r8, 96(%rsp)                   # 8-byte Spill
	movl	%ecx, 32(%rsp)                  # 4-byte Spill
	movl	%edx, %r14d
	movl	%esi, %ebp
	movq	%rdi, %rbx
	leaq	48(%rsp), %rdi
	callq	hipEventCreate
	leaq	56(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	-8(%r15), %rdi
.Ltmp144:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp145:
# %bb.1:                                # %.noexc
	movq	48(%rsp), %rdi
.Ltmp146:
	callq	hipEventSynchronize
.Ltmp147:
# %bb.2:                                # %_ZN8GpuTimer5StartEv.exit
	movl	%r14d, %eax
	imull	%ebp, %eax
	movslq	%eax, %r15
	leaq	(%r15,%r15,2), %rdx
	movq	96(%rsp), %rdi                  # 8-byte Reload
	movq	%rbx, %rsi
	callq	memcpy@PLT
	leaq	(,%r15,4), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movq	%r15, %rdi
	callq	malloc
	movq	%rbx, %rdi
	movl	%ebp, %esi
	movl	%r14d, %edx
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	%rax, %rcx
	callq	_Z15convertRgb2GrayP15HIP_vector_typeIhLj3EEiiPh
	movq	%r14, 24(%rsp)                  # 8-byte Spill
	testl	%r14d, %r14d
	movl	%ebp, 4(%rsp)                   # 4-byte Spill
	jle	.LBB13_8
# %bb.3:                                # %.preheader174.lr.ph
	movl	%ebp, %ebx
	movl	24(%rsp), %eax                  # 4-byte Reload
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	xorl	%r15d, %r15d
	movq	24(%rsp), %r14                  # 8-byte Reload
	movq	16(%rsp), %r13                  # 8-byte Reload
.LBB13_4:                               # %.preheader174
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB13_6 Depth 2
	testl	%ebp, %ebp
	jle	.LBB13_7
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB13_4 Depth=1
	movl	8(%rsp), %eax                   # 4-byte Reload
	movq	64(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbp
	xorl	%r12d, %r12d
.LBB13_6:                               #   Parent Loop BB13_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	movl	%r14d, %r8d
	movl	%ebx, %r9d
	callq	_Z20computePixelPriorityPhiiiii
	movl	%eax, (%rbp,%r12,4)
	incq	%r12
	cmpq	%r12, %rbx
	jne	.LBB13_6
.LBB13_7:                               # %._crit_edge
                                        #   in Loop: Header=BB13_4 Depth=1
	incq	%r15
	movl	4(%rsp), %ebp                   # 4-byte Reload
	movq	8(%rsp), %rax                   # 8-byte Reload
	addl	%ebp, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	cmpq	40(%rsp), %r15                  # 8-byte Folded Reload
	jne	.LBB13_4
.LBB13_8:                               # %.preheader173
	movl	32(%rsp), %r8d                  # 4-byte Reload
	cmpl	%r8d, %ebp
	movq	24(%rsp), %r14                  # 8-byte Reload
	movq	64(%rsp), %r12                  # 8-byte Reload
	movq	72(%rsp), %r13                  # 8-byte Reload
	movq	16(%rsp), %rdi                  # 8-byte Reload
	jle	.LBB13_42
# %bb.9:                                # %.lr.ph201
	leal	-1(%r14), %ebx
	movslq	%ebx, %rax
	movq	%rax, 192(%rsp)                 # 8-byte Spill
	imull	%ebp, %ebx
	movslq	%ebx, %rax
	movslq	%r14d, %rcx
	leaq	-1(%rcx), %rdx
	movslq	%ebp, %r9
	movslq	%r8d, %r8
	movq	%r8, 160(%rsp)                  # 8-byte Spill
	leaq	(,%rax,4), %r15
	addq	%r13, %r15
	movq	%rdx, 144(%rsp)                 # 8-byte Spill
	movq	%rdx, %rax
	imulq	%r9, %rax
	leaq	1(%rax), %rdx
	movq	%rdx, 136(%rsp)                 # 8-byte Spill
	leaq	(%rdi,%rax), %rdx
	incq	%rdx
	movq	%rdx, 128(%rsp)                 # 8-byte Spill
	movq	%r9, %rdx
	negq	%rdx
	movq	%rdx, 184(%rsp)                 # 8-byte Spill
	leaq	(%r12,%rax,4), %rax
	movq	%rax, 120(%rsp)                 # 8-byte Spill
	leaq	(,%r9,4), %rax
	negq	%rax
	movq	%rax, 176(%rsp)                 # 8-byte Spill
	imulq	%r9, %rcx
	leaq	(%r12,%rcx,4), %rax
	addq	$-8, %rax
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	movq	%r9, 104(%rsp)                  # 8-byte Spill
                                        # implicit-def: $eax
                                        # kill: killed $eax
	movq	%rbx, 168(%rsp)                 # 8-byte Spill
	movq	%r15, 152(%rsp)                 # 8-byte Spill
.LBB13_12:                              # =>This Loop Header: Depth=1
                                        #     Child Loop BB13_14 Depth 2
                                        #     Child Loop BB13_20 Depth 2
                                        #       Child Loop BB13_22 Depth 3
                                        #       Child Loop BB13_27 Depth 3
                                        #     Child Loop BB13_40 Depth 2
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	%r9d, %edx
	movl	%r14d, %ecx
	movl	%ebp, %r8d
	movq	%r9, %r12
	callq	_Z21computeSeamScoreTablePiS_iii
	movq	%r12, %r9
	movl	$0, %eax
	cmpq	$2, %r12
	movl	(%rsp), %r10d                   # 4-byte Reload
	jl	.LBB13_17
# %bb.13:                               # %.lr.ph181.preheader
                                        #   in Loop: Header=BB13_12 Depth=1
	movl	%r9d, %ecx
	xorl	%esi, %esi
	movl	$1, %edx
.LBB13_14:                              # %.lr.ph181
                                        #   Parent Loop BB13_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r15,%rdx,4), %edi
	leal	(%rsi,%rbx), %eax
	movslq	%eax, %r8
	movl	%edx, %eax
	cmpl	(%r13,%r8,4), %edi
	jl	.LBB13_16
# %bb.15:                               # %.lr.ph181
                                        #   in Loop: Header=BB13_14 Depth=2
	movl	%esi, %eax
.LBB13_16:                              # %.lr.ph181
                                        #   in Loop: Header=BB13_14 Depth=2
	incq	%rdx
	movl	%eax, %esi
	cmpq	%rdx, %rcx
	jne	.LBB13_14
.LBB13_17:                              # %.preheader172
                                        #   in Loop: Header=BB13_12 Depth=1
	decq	%r9
	testl	%r14d, %r14d
	movq	%r9, 8(%rsp)                    # 8-byte Spill
	jle	.LBB13_18
# %bb.19:                               # %.preheader.lr.ph
                                        #   in Loop: Header=BB13_12 Depth=1
	movq	112(%rsp), %rcx                 # 8-byte Reload
	movq	%rcx, 40(%rsp)                  # 8-byte Spill
	movq	136(%rsp), %rsi                 # 8-byte Reload
	movq	120(%rsp), %r13                 # 8-byte Reload
	movq	128(%rsp), %r14                 # 8-byte Reload
	movq	144(%rsp), %r8                  # 8-byte Reload
	movl	%r10d, %ecx
	movq	%rcx, 80(%rsp)                  # 8-byte Spill
	movq	16(%rsp), %rdi                  # 8-byte Reload
.LBB13_20:                              # %.preheader
                                        #   Parent Loop BB13_12 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB13_22 Depth 3
                                        #       Child Loop BB13_27 Depth 3
	movl	%eax, (%rsp)                    # 4-byte Spill
	movslq	%eax, %r10
	cmpq	%r10, %r9
	jle	.LBB13_23
# %bb.21:                               # %.lr.ph183
                                        #   in Loop: Header=BB13_20 Depth=2
	leaq	(%rsi,%r10), %rax
	leaq	(%rax,%rax,2), %rax
	addq	96(%rsp), %rax                  # 8-byte Folded Reload
	movq	%r10, %rcx
.LBB13_22:                              #   Parent Loop BB13_12 Depth=1
                                        #     Parent Loop BB13_20 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movb	2(%rax), %dl
	movb	%dl, -1(%rax)
	movzwl	(%rax), %edx
	movw	%dx, -3(%rax)
	movb	(%r14,%rcx), %dl
	movb	%dl, -1(%r14,%rcx)
	movl	4(%r13,%rcx,4), %edx
	movl	%edx, (%r13,%rcx,4)
	incq	%rcx
	addq	$3, %rax
	cmpq	%r9, %rcx
	jl	.LBB13_22
.LBB13_23:                              # %._crit_edge184
                                        #   in Loop: Header=BB13_20 Depth=2
	movq	%r10, 200(%rsp)                 # 8-byte Spill
	movq	%rsi, 208(%rsp)                 # 8-byte Spill
	movq	%r8, 32(%rsp)                   # 8-byte Spill
	cmpq	192(%rsp), %r8                  # 8-byte Folded Reload
	jge	.LBB13_29
# %bb.24:                               #   in Loop: Header=BB13_20 Depth=2
	movq	80(%rsp), %rcx                  # 8-byte Reload
	cmpl	$3, %ecx
	movl	$2, %eax
	cmovgel	%ecx, %eax
	leal	-2(%rax), %edx
	addl	$2, %ecx
	cmpl	%ecx, %edx
	jg	.LBB13_29
# %bb.25:                               #   in Loop: Header=BB13_20 Depth=2
	cmpq	%rdx, %r9
	jle	.LBB13_29
# %bb.26:                               # %.lr.ph188
                                        #   in Loop: Header=BB13_20 Depth=2
	movq	32(%rsp), %rdx                  # 8-byte Reload
	leal	1(%rdx), %r15d
	movl	%eax, %ebp
	movl	%ecx, %ebx
.LBB13_27:                              #   Parent Loop BB13_12 Depth=1
                                        #     Parent Loop BB13_20 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	leaq	-2(%rbp), %r12
	movl	%r15d, %esi
	movl	%r12d, %edx
	movl	%r9d, %ecx
	movq	24(%rsp), %r8                   # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8
	movl	4(%rsp), %r9d                   # 4-byte Reload
	callq	_Z20computePixelPriorityPhiiiii
	movq	8(%rsp), %r9                    # 8-byte Reload
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movq	40(%rsp), %rcx                  # 8-byte Reload
	movl	%eax, (%rcx,%rbp,4)
	cmpq	%rbx, %r12
	jge	.LBB13_29
# %bb.28:                               #   in Loop: Header=BB13_27 Depth=3
	leaq	-1(%rbp), %rax
	incq	%rbp
	cmpq	%r9, %rax
	jl	.LBB13_27
.LBB13_29:                              # %.loopexit
                                        #   in Loop: Header=BB13_20 Depth=2
	movq	32(%rsp), %r11                  # 8-byte Reload
	movq	%r11, %rcx
	subq	$1, %rcx
	jb	.LBB13_30
# %bb.31:                               #   in Loop: Header=BB13_20 Depth=2
	movq	%rcx, %rax
	imulq	104(%rsp), %rax                 # 8-byte Folded Reload
	movq	72(%rsp), %rdx                  # 8-byte Reload
	leaq	(%rdx,%rax,4), %rdx
	movq	200(%rsp), %rbx                 # 8-byte Reload
	movl	(%rdx,%rbx,4), %esi
	testl	%ebx, %ebx
	movl	(%rsp), %r10d                   # 4-byte Reload
	jle	.LBB13_32
# %bb.33:                               #   in Loop: Header=BB13_20 Depth=2
	movl	-4(%rdx,%rbx,4), %eax
	xorl	%r8d, %r8d
	cmpl	%esi, %eax
	setl	%r8b
	cmovll	%eax, %esi
	movl	%ebx, %eax
	subl	%r8d, %eax
	jmp	.LBB13_34
.LBB13_32:                              #   in Loop: Header=BB13_20 Depth=2
	movl	%r10d, %eax
.LBB13_34:                              #   in Loop: Header=BB13_20 Depth=2
	cmpq	%rbx, %r9
	jle	.LBB13_36
# %bb.35:                               #   in Loop: Header=BB13_20 Depth=2
	leal	1(%rbx), %r8d
	cmpl	%esi, 4(%rdx,%rbx,4)
	cmovll	%r8d, %eax
.LBB13_36:                              # %.loopexit._crit_edge
                                        #   in Loop: Header=BB13_20 Depth=2
	addq	184(%rsp), %r14                 # 8-byte Folded Reload
	movq	176(%rsp), %rdx                 # 8-byte Reload
	addq	%rdx, %r13
	movq	208(%rsp), %rsi                 # 8-byte Reload
	subq	104(%rsp), %rsi                 # 8-byte Folded Reload
	addq	%rdx, 40(%rsp)                  # 8-byte Folded Spill
	movl	%r10d, %edx
	movq	%rdx, 80(%rsp)                  # 8-byte Spill
	testq	%r11, %r11
	movq	%rcx, %r8
	jg	.LBB13_20
	jmp	.LBB13_37
.LBB13_18:                              #   in Loop: Header=BB13_12 Depth=1
	movq	16(%rsp), %rdi                  # 8-byte Reload
	jmp	.LBB13_37
.LBB13_30:                              #   in Loop: Header=BB13_12 Depth=1
	movl	(%rsp), %eax                    # 4-byte Reload
	movq	80(%rsp), %rcx                  # 8-byte Reload
	movl	%ecx, %r10d
.LBB13_37:                              # %._crit_edge192
                                        #   in Loop: Header=BB13_12 Depth=1
	movl	%r10d, (%rsp)                   # 4-byte Spill
	cmpl	$3, %eax
	movl	$2, %ecx
	cmovgel	%eax, %ecx
	leal	-2(%rcx), %edx
	addl	$2, %eax
	cmpl	%eax, %edx
	movq	24(%rsp), %r14                  # 8-byte Reload
	movl	4(%rsp), %ebp                   # 4-byte Reload
	movq	64(%rsp), %r12                  # 8-byte Reload
	movq	72(%rsp), %r13                  # 8-byte Reload
	jg	.LBB13_11
# %bb.38:                               # %._crit_edge192
                                        #   in Loop: Header=BB13_12 Depth=1
	cmpq	%rdx, %r9
	jle	.LBB13_11
# %bb.39:                               # %.lr.ph197.preheader
                                        #   in Loop: Header=BB13_12 Depth=1
	movl	%ecx, %r15d
	addq	$-2, %r15
	movl	%eax, %ebx
.LBB13_40:                              # %.lr.ph197
                                        #   Parent Loop BB13_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorl	%esi, %esi
	movl	%r15d, %edx
	movl	%r9d, %ecx
	movl	%r14d, %r8d
	movl	%ebp, %r9d
	callq	_Z20computePixelPriorityPhiiiii
	movq	8(%rsp), %r9                    # 8-byte Reload
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movl	%eax, (%r12,%r15,4)
	cmpq	%rbx, %r15
	jge	.LBB13_11
# %bb.41:                               # %.lr.ph197
                                        #   in Loop: Header=BB13_40 Depth=2
	incq	%r15
	cmpq	%r9, %r15
	jl	.LBB13_40
.LBB13_11:                              # %.loopexit171
                                        #   in Loop: Header=BB13_12 Depth=1
	cmpq	160(%rsp), %r9                  # 8-byte Folded Reload
	movq	168(%rsp), %rbx                 # 8-byte Reload
	movq	152(%rsp), %r15                 # 8-byte Reload
	jg	.LBB13_12
.LBB13_42:                              # %._crit_edge202
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	56(%rsp), %rdi
.Ltmp149:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp150:
# %bb.43:                               # %_ZN8GpuTimer4StopEv.exit
	movq	56(%rsp), %rdi
.Ltmp152:
	callq	hipEventSynchronize
.Ltmp153:
# %bb.44:                               # %.noexc169
	movq	48(%rsp), %rsi
	movq	56(%rsp), %rdx
.Ltmp154:
	leaq	92(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp155:
# %bb.45:
	cvtss2sd	92(%rsp), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	leaq	48(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	addq	$216, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB13_46:
	.cfi_def_cfa_offset 272
.Ltmp151:
	jmp	.LBB13_48
.LBB13_47:
.Ltmp156:
	jmp	.LBB13_48
.LBB13_10:
.Ltmp148:
.LBB13_48:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end13:
	.size	_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_, .Lfunc_end13-_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table13:
.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 .Ltmp144-.Lfunc_begin2         #   Call between .Lfunc_begin2 and .Ltmp144
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp144-.Lfunc_begin2         # >> Call Site 2 <<
	.uleb128 .Ltmp147-.Ltmp144              #   Call between .Ltmp144 and .Ltmp147
	.uleb128 .Ltmp148-.Lfunc_begin2         #     jumps to .Ltmp148
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp147-.Lfunc_begin2         # >> Call Site 3 <<
	.uleb128 .Ltmp149-.Ltmp147              #   Call between .Ltmp147 and .Ltmp149
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp149-.Lfunc_begin2         # >> Call Site 4 <<
	.uleb128 .Ltmp150-.Ltmp149              #   Call between .Ltmp149 and .Ltmp150
	.uleb128 .Ltmp151-.Lfunc_begin2         #     jumps to .Ltmp151
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp152-.Lfunc_begin2         # >> Call Site 5 <<
	.uleb128 .Ltmp155-.Ltmp152              #   Call between .Ltmp152 and .Ltmp155
	.uleb128 .Ltmp156-.Lfunc_begin2         #     jumps to .Ltmp156
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp155-.Lfunc_begin2         # >> Call Site 6 <<
	.uleb128 .Lfunc_end13-.Ltmp155          #   Call between .Ltmp155 and .Lfunc_end13
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i # -- Begin function _Z12computeErrorP15HIP_vector_typeIhLj3EES1_i
	.type	_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i,@function
_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i: # @_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i
	.cfi_startproc
# %bb.0:
                                        # kill: def $edx killed $edx def $rdx
	testl	%edx, %edx
	jle	.LBB14_1
# %bb.3:                                # %.lr.ph.preheader
	movl	%edx, %eax
	leaq	(%rax,%rax,2), %rax
	xorps	%xmm0, %xmm0
	xorl	%ecx, %ecx
	movl	$255, %r8d
.LBB14_4:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movzbl	(%rdi,%rcx), %r9d
	movzbl	(%rsi,%rcx), %r10d
	subl	%r10d, %r9d
	movl	%r9d, %r10d
	negl	%r10d
	cmovsl	%r9d, %r10d
	andl	%r8d, %r10d
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r10d, %xmm1
	movzbl	1(%rdi,%rcx), %r9d
	movzbl	1(%rsi,%rcx), %r10d
	subl	%r10d, %r9d
	movl	%r9d, %r10d
	negl	%r10d
	cmovsl	%r9d, %r10d
	andl	%r8d, %r10d
	xorps	%xmm2, %xmm2
	cvtsi2ss	%r10d, %xmm2
	addss	%xmm0, %xmm1
	movzbl	2(%rdi,%rcx), %r9d
	movzbl	2(%rsi,%rcx), %r10d
	subl	%r10d, %r9d
	movl	%r9d, %r10d
	negl	%r10d
	cmovsl	%r9d, %r10d
	andl	%r8d, %r10d
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r10d, %xmm0
	addss	%xmm1, %xmm2
	addss	%xmm2, %xmm0
	addq	$3, %rcx
	cmpq	%rcx, %rax
	jne	.LBB14_4
	jmp	.LBB14_2
.LBB14_1:
	xorps	%xmm0, %xmm0
.LBB14_2:                               # %._crit_edge
	leal	(%rdx,%rdx,2), %eax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%eax, %xmm1
	divss	%xmm1, %xmm0
	retq
.Lfunc_end14:
	.size	_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i, .Lfunc_end14-_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z9concatStrPKcS0_              # -- Begin function _Z9concatStrPKcS0_
	.type	_Z9concatStrPKcS0_,@function
_Z9concatStrPKcS0_:                     # @_Z9concatStrPKcS0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	callq	strlen
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	strlen
	leaq	(%r15,%rax), %rdi
	incq	%rdi
	callq	malloc
	movq	%rax, %r15
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	strcpy
	movq	%r15, %rdi
	movq	%rbx, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	strcat                          # TAILCALL
.Lfunc_end15:
	.size	_Z9concatStrPKcS0_, .Lfunc_end15-_Z9concatStrPKcS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z15printDeviceInfov            # -- Begin function _Z15printDeviceInfov
	.type	_Z15printDeviceInfov,@function
_Z15printDeviceInfov:                   # @_Z15printDeviceInfov
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB16_2
# %bb.1:
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	8(%rsp), %rbx
	movl	$.L.str.16, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rbx), %esi
	movl	364(%rbx), %edx
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	movl	388(%rbx), %esi
	movl	$.L.str.18, %edi
	xorl	%eax, %eax
	callq	printf
	movl	624(%rbx), %esi
	movl	$.L.str.19, %edi
	xorl	%eax, %eax
	callq	printf
	movl	624(%rbx), %eax
	cltd
	idivl	308(%rbx)
	movl	$.L.str.20, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	movq	288(%rbx), %rsi
	movl	$.L.str.21, %edi
	xorl	%eax, %eax
	callq	printf
	movq	352(%rbx), %rsi
	movl	$.L.str.22, %edi
	xorl	%eax, %eax
	callq	printf
	movl	616(%rbx), %esi
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	movq	640(%rbx), %rsi
	movl	$.L.str.24, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	addq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB16_2:
	.cfi_def_cfa_offset 1504
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.10, %esi
	movl	$.L.str.11, %edx
	movl	$513, %ecx                      # imm = 0x201
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end16:
	.size	_Z15printDeviceInfov, .Lfunc_end16-_Z15printDeviceInfov
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin3:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception3
# %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	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %eax
	andl	$-3, %eax
	cmpl	$4, %eax
	jne	.LBB17_1
# %bb.2:
	movq	%rsi, %rbx
	movl	%edi, %r14d
	.cfi_escape 0x2e, 0x00
	callq	_Z15printDeviceInfov
	movq	8(%rbx), %rdi
	.cfi_escape 0x2e, 0x00
	leaq	4(%rsp), %r15
	leaq	8(%rsp), %r12
	leaq	56(%rsp), %rcx
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_Z7readPnmPcRiS0_RP15HIP_vector_typeIhLj3EE
	movl	(%r15), %esi
	movl	(%r12), %edx
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.27, %edi
	xorl	%eax, %eax
	callq	printf
	movq	24(%rbx), %rsi
	.cfi_escape 0x2e, 0x00
	leaq	72(%rsp), %r15
	leaq	15(%rsp), %rdx
	movq	%r15, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	movq	(%r15), %r13
	.cfi_escape 0x2e, 0x00
	callq	__errno_location
	movq	%rax, %r15
	movl	(%rax), %eax
	movl	%eax, 16(%rsp)                  # 4-byte Spill
	movl	$0, (%r15)
	.cfi_escape 0x2e, 0x00
	leaq	64(%rsp), %rbp
	movq	%r13, %rdi
	movq	%rbp, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%r13, (%rbp)
	je	.LBB17_3
# %bb.10:
	movq	%rax, %r12
	movslq	%r12d, %rax
	cmpq	%r12, %rax
	jne	.LBB17_12
# %bb.11:
	movl	(%r15), %eax
	cmpl	$34, %eax
	je	.LBB17_12
# %bb.14:
	testl	%eax, %eax
	jne	.LBB17_16
# %bb.15:
	movl	16(%rsp), %eax                  # 4-byte Reload
	movl	%eax, (%r15)
.LBB17_16:
	leaq	88(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB17_18
# %bb.17:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB17_18:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movl	$1, %eax
	testl	%r12d, %r12d
	jle	.LBB17_23
# %bb.19:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	cmpl	%r12d, 4(%rsp)
	jle	.LBB17_23
# %bb.20:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.28, %edi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	4(%rsp), %r13d
	movl	%r13d, %ebp
	subl	%r12d, %ebp
	movl	8(%rsp), %r12d
	movl	%r12d, %eax
	imull	%r13d, %eax
	cltq
	leaq	(%rax,%rax,2), %rdi
	.cfi_escape 0x2e, 0x00
	callq	malloc
	movq	56(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movl	%r13d, %esi
	movl	%r12d, %edx
	movl	%ebp, 28(%rsp)                  # 4-byte Spill
	movl	%ebp, %ecx
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movq	%rax, %r8
	callq	_Z17seamCarvingByHostP15HIP_vector_typeIhLj3EEiiiS1_
	movl	4(%rsp), %ebp
	movl	8(%rsp), %r13d
	movl	%r13d, %eax
	imull	%ebp, %eax
	cltq
	leaq	(%rax,%rax,2), %rdi
	.cfi_escape 0x2e, 0x00
	callq	malloc
	movq	%rax, %r15
	movl	$32, %eax
	movl	$32, %r12d
	cmpl	$6, %r14d
	jne	.LBB17_22
# %bb.21:
	movq	32(%rbx), %rdi
	.cfi_escape 0x2e, 0x00
	callq	atoi
	movl	%eax, %r12d
	movq	40(%rbx), %rdi
	.cfi_escape 0x2e, 0x00
	callq	atoi
.LBB17_22:
	movl	%r12d, 32(%rsp)
	movl	%eax, 36(%rsp)
	movl	$1, %eax
	movl	%eax, 40(%rsp)
	.cfi_escape 0x2e, 0x10
	movq	32(%rsp), %r9
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movl	%ebp, %esi
	movl	%r13d, %edx
	movl	28(%rsp), %ebp                  # 4-byte Reload
	movl	%ebp, %ecx
	movq	%r15, %r8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	%r9
	.cfi_adjust_cfa_offset 8
	callq	_Z19seamCarvingByDeviceP15HIP_vector_typeIhLj3EEiiiS1_4dim3
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	8(%rsp), %edx
	imull	4(%rsp), %edx
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movq	48(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rsi
	callq	_Z12computeErrorP15HIP_vector_typeIhLj3EES1_i
	cvtss2sd	%xmm0, %xmm0
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.29, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rbx), %rdi
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.30, %esi
	callq	strtok
	movq	%rax, %rbx
	movl	8(%rsp), %r14d
	movl	4(%rsp), %r12d
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.31, %esi
	movq	%rax, %rdi
	callq	_Z9concatStrPKcS0_
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	movl	%ebp, %esi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	movq	%rax, %r8
	callq	_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc
	movl	8(%rsp), %r14d
	movl	4(%rsp), %r12d
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.32, %esi
	movq	%rbx, %rdi
	callq	_Z9concatStrPKcS0_
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movl	%ebp, %esi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	movq	%rax, %r8
	callq	_Z8writePnmP15HIP_vector_typeIhLj3EEiiiPc
	.cfi_escape 0x2e, 0x00
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
	jmp	.LBB17_23
.LBB17_1:
	.cfi_escape 0x2e, 0x00
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$1, %eax
.LBB17_23:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB17_3:
	.cfi_def_cfa_offset 160
.Ltmp159:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.33, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp160:
# %bb.4:
.LBB17_12:                              # %.critedge.i.i
.Ltmp157:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.33, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp158:
# %bb.13:
.LBB17_5:
.Ltmp161:
	movq	%rax, %rbx
	cmpl	$0, (%r15)
	jne	.LBB17_7
# %bb.6:
	movl	16(%rsp), %eax                  # 4-byte Reload
	movl	%eax, (%r15)
.LBB17_7:                               # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i
	leaq	88(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB17_9
# %bb.8:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i34
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB17_9:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit36
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end17:
	.size	main, .Lfunc_end17-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table17:
.Lexception3:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end3-.Lcst_begin3
.Lcst_begin3:
	.uleb128 .Lfunc_begin3-.Lfunc_begin3    # >> Call Site 1 <<
	.uleb128 .Ltmp159-.Lfunc_begin3         #   Call between .Lfunc_begin3 and .Ltmp159
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp159-.Lfunc_begin3         # >> Call Site 2 <<
	.uleb128 .Ltmp158-.Ltmp159              #   Call between .Ltmp159 and .Ltmp158
	.uleb128 .Ltmp161-.Lfunc_begin3         #     jumps to .Ltmp161
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp158-.Lfunc_begin3         # >> Call Site 3 <<
	.uleb128 .Lfunc_end17-.Ltmp158          #   Call between .Ltmp158 and .Lfunc_end17
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end3:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.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
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB18_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB18_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.34, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end18:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end18-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end19:
	.size	__clang_call_terminate, .Lfunc_end19-__clang_call_terminate
	.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	.LBB20_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	.LBB20_3
.LBB20_1:                               # %._crit_edge
	movq	(%rbx), %rax
.LBB20_3:
	testq	%r14, %r14
	je	.LBB20_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB20_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB20_7
.LBB20_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB20_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_end20:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end20-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_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	.LBB21_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB21_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh, %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	$_Z21computePriorityKernelPhiiPi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z27computeSeamScoreTableKernelPiS_iii, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$d_xSobel, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$36, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$d_ySobel, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$36, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$0, (%rsp)
	movl	$d_originalWidth, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end21:
	.size	__hip_module_ctor, .Lfunc_end21-__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	.LBB22_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
.LBB22_2:
	retq
.Lfunc_end22:
	.size	__hip_module_dtor, .Lfunc_end22-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Cannot read %s\n"
	.size	.L.str.1, 16

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

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%i"
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%hhu%hhu%hhu"
	.size	.L.str.5, 13

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Cannot write %s\n"
	.size	.L.str.7, 17

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"P3\n%i\n%i\n255\n"
	.size	.L.str.8, 14

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%hhu\n%hhu\n%hhu\n"
	.size	.L.str.9, 16

	.type	xSobel,@object                  # @xSobel
	.data
	.globl	xSobel
	.p2align	4, 0x0
xSobel:
	.long	1                               # 0x1
	.long	0                               # 0x0
	.long	4294967295                      # 0xffffffff
	.long	2                               # 0x2
	.long	0                               # 0x0
	.long	4294967294                      # 0xfffffffe
	.long	1                               # 0x1
	.long	0                               # 0x0
	.long	4294967295                      # 0xffffffff
	.size	xSobel, 36

	.type	ySobel,@object                  # @ySobel
	.globl	ySobel
	.p2align	4, 0x0
ySobel:
	.long	1                               # 0x1
	.long	2                               # 0x2
	.long	1                               # 0x1
	.zero	12
	.long	4294967295                      # 0xffffffff
	.long	4294967294                      # 0xfffffffe
	.long	4294967295                      # 0xffffffff
	.size	ySobel, 36

	.type	d_xSobel,@object                # @d_xSobel
	.local	d_xSobel
	.comm	d_xSobel,36,16
	.type	d_ySobel,@object                # @d_ySobel
	.local	d_ySobel
	.comm	d_ySobel,36,16
	.type	d_originalWidth,@object         # @d_originalWidth
	.local	d_originalWidth
	.comm	d_originalWidth,4,4
	.type	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh,@object # @_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.section	.rodata,"a",@progbits
	.globl	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.p2align	3, 0x0
_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh:
	.quad	_Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.size	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh, 8

	.type	_Z21computePriorityKernelPhiiPi,@object # @_Z21computePriorityKernelPhiiPi
	.globl	_Z21computePriorityKernelPhiiPi
	.p2align	3, 0x0
_Z21computePriorityKernelPhiiPi:
	.quad	_Z36__device_stub__computePriorityKernelPhiiPi
	.size	_Z21computePriorityKernelPhiiPi, 8

	.type	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i,@object # @_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.globl	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.p2align	3, 0x0
_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i:
	.quad	_Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.size	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i, 8

	.type	_Z27computeSeamScoreTableKernelPiS_iii,@object # @_Z27computeSeamScoreTableKernelPiS_iii
	.globl	_Z27computeSeamScoreTableKernelPiS_iii
	.p2align	3, 0x0
_Z27computeSeamScoreTableKernelPiS_iii:
	.quad	_Z42__device_stub__computeSeamScoreTableKernelPiS_iii
	.size	_Z27computeSeamScoreTableKernelPiS_iii, 8

	.type	.L.str.10,@object               # @.str.10
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.10:
	.asciz	"Error: %s:%d, "
	.size	.L.str.10, 15

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/baopdh/Seam-Carving/main/device.hip"
	.size	.L.str.11, 98

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"code: %d, reason: %s\n"
	.size	.L.str.12, 22

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Processing time (use device): %f ms\n\n"
	.size	.L.str.13, 38

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Processing time (use host): %f ms\n\n"
	.size	.L.str.14, 36

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Name: %s\n"
	.size	.L.str.16, 10

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Compute capability: %d.%d\n"
	.size	.L.str.17, 27

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Num SMs: %d\n"
	.size	.L.str.18, 13

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Max num threads per SM: %d\n"
	.size	.L.str.19, 28

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Max num warps per SM: %d\n"
	.size	.L.str.20, 26

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"GMEM: %lu bytes\n"
	.size	.L.str.21, 17

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"CMEM: %lu bytes\n"
	.size	.L.str.22, 17

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"L2 cache: %i bytes\n"
	.size	.L.str.23, 20

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"SMEM / one SM: %lu bytes\n"
	.size	.L.str.24, 26

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"Image size (width x height): %i x %i\n\n"
	.size	.L.str.27, 39

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"Number of seam removed: %d\n\n"
	.size	.L.str.28, 29

	.type	.L.str.29,@object               # @.str.29
.L.str.29:
	.asciz	"Error between device result and host result: %f\n"
	.size	.L.str.29, 49

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

	.type	.L.str.31,@object               # @.str.31
.L.str.31:
	.asciz	"_host.pnm"
	.size	.L.str.31, 10

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"_device.pnm"
	.size	.L.str.32, 12

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

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.34, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh"
	.size	.L__unnamed_1, 55

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z21computePriorityKernelPhiiPi"
	.size	.L__unnamed_2, 32

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i"
	.size	.L__unnamed_3, 50

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z27computeSeamScoreTableKernelPiS_iii"
	.size	.L__unnamed_4, 39

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"d_xSobel"
	.size	.L__unnamed_5, 9

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"d_ySobel"
	.size	.L__unnamed_6, 9

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"d_originalWidth"
	.size	.L__unnamed_7, 16

	.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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"**********GPU info**********"
	.size	.Lstr, 29

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"****************************\n"
	.size	.Lstr.1, 30

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"The number of arguments is invalid"
	.size	.Lstr.2, 35

	.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 _Z36__device_stub__convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.addrsig_sym _Z36__device_stub__computePriorityKernelPhiiPi
	.addrsig_sym _Z28__device_stub__carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.addrsig_sym _Z42__device_stub__computeSeamScoreTableKernelPiS_iii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym d_xSobel
	.addrsig_sym d_ySobel
	.addrsig_sym d_originalWidth
	.addrsig_sym _Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.addrsig_sym _Z21computePriorityKernelPhiiPi
	.addrsig_sym _Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.addrsig_sym _Z27computeSeamScoreTableKernelPiS_iii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh ; -- Begin function _Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.globl	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
	.p2align	8
	.type	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh,@function
_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh: ; @_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0x8
	v_bfe_u32 v2, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s5, s4, 16
	s_and_b32 s4, s4, 0xffff
	v_mad_u64_u32 v[0:1], null, s15, s5, v[2:3]
	v_mov_b32_e32 v1, 0
	v_mad_u64_u32 v[2:3], null, s14, s4, v[4:5]
	s_ashr_i32 s5, s2, 31
	s_ashr_i32 s7, s3, 31
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mov_b32_e32 v3, v1
	s_mov_b32 s6, s3
	s_mov_b32 s4, s2
	v_cmp_gt_u64_e32 vcc_lo, s[6:7], v[0:1]
	v_cmp_gt_u64_e64 s2, s[4:5], v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b64 s[2:3], s[0:1], 0x0
	v_mad_u64_u32 v[4:5], null, v0, s4, v[2:3]
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[2:3], null, v4, 3, s[2:3]
	v_mov_b32_e32 v1, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[5:6], null, v0, s5, v[1:2]
	v_mov_b32_e32 v0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[6:7], null, v5, 3, v[0:1]
	v_mov_b32_e32 v3, v6
	s_clause 0x1
	global_load_u16 v0, v[2:3], off
	global_load_u8 v1, v[2:3], off offset:2
	s_waitcnt vmcnt(1)
	v_cvt_f32_ubyte1_e32 v2, v0
	v_cvt_f32_ubyte0_e32 v0, v0
	s_waitcnt vmcnt(0)
	v_cvt_f32_ubyte0_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v2, 0x3f1645a2, v2
	v_fmamk_f32 v0, v0, 0x3e991687, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmamk_f32 v0, v1, 0x3de978d5, v0
	v_mov_b32_e32 v1, v5
	v_cvt_i32_f32_e32 v2, v0
	v_add_co_u32 v0, vcc_lo, s0, v4
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b8 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 8
		.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	_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh, .Lfunc_end0-_Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 316
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z21computePriorityKernelPhiiPi ; -- Begin function _Z21computePriorityKernelPhiiPi
	.globl	_Z21computePriorityKernelPhiiPi
	.p2align	8
	.type	_Z21computePriorityKernelPhiiPi,@function
_Z21computePriorityKernelPhiiPi:        ; @_Z21computePriorityKernelPhiiPi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b64 s[4:5], s[0:1], 0x8
	v_bfe_u32 v4, v0, 10, 10
	v_and_b32_e32 v2, 0x3ff, v0
	s_mov_b32 s7, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s13, s2, 0xffff
	v_mad_u64_u32 v[0:1], null, s15, s3, v[4:5]
	v_mov_b32_e32 v1, 0
	s_add_i32 s6, s13, 2
	s_add_i32 s8, s3, 2
	v_mul_u32_u24_e32 v8, s6, v4
	s_mul_i32 s12, s14, s13
	s_mov_b32 s14, exec_lo
	v_cmpx_gt_u32_e64 s8, v4
	s_cbranch_execz .LBB1_6
; %bb.1:                                ; %.lr.ph94
	s_getpc_b64 s[16:17]
	s_add_u32 s16, s16, d_originalWidth@rel32@lo+4
	s_addc_u32 s17, s17, d_originalWidth@rel32@hi+12
	v_mov_b32_e32 v5, v1
	s_load_b64 s[10:11], s[0:1], 0x0
	s_load_b32 s15, s[16:17], 0x0
	v_add_nc_u32_e32 v9, -1, v0
	v_mov_b32_e32 v3, v1
	v_cmp_gt_u32_e32 vcc_lo, s6, v2
	v_add3_u32 v10, v2, v8, 0
	s_mov_b32 s9, s7
	s_add_i32 s16, s5, -1
	s_add_i32 s17, s4, -1
	s_add_i32 s18, s12, -1
	s_mul_i32 s19, s6, s3
	s_mov_b32 s20, s7
.LBB1_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_4 Depth 2
	s_and_saveexec_b32 s21, vcc_lo
	s_cbranch_execz .LBB1_5
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_cmp_gt_i32_e64 s2, s5, v9
	v_mov_b32_e32 v12, v10
	s_mov_b32 s22, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v6, s16, v9, s2
	v_cmp_lt_i32_e64 s2, -1, v9
	v_cndmask_b32_e64 v6, 0, v6, s2
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_lo_u32 v11, s15, v6
	v_dual_mov_b32 v7, v3 :: v_dual_mov_b32 v6, v2
.LBB1_4:                                ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v13, s18, v6
	v_cmp_gt_i32_e64 s2, s4, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v14, s17, v13, s2
	v_cmp_lt_i32_e64 s2, -1, v13
	v_cndmask_b32_e64 v13, 0, v14, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v13, v11, v13
	v_ashrrev_i32_e32 v14, 31, v13
	v_add_co_u32 v13, s2, s10, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v14, s2, s11, v14, s2
	v_add_co_u32 v6, s2, v6, s13
	v_add_co_ci_u32_e64 v7, s2, 0, v7, s2
	global_load_u8 v13, v[13:14], off
	v_cmp_le_u64_e64 s2, s[6:7], v[6:7]
	s_delay_alu instid0(VALU_DEP_1)
	s_or_b32 s22, s2, s22
	s_waitcnt vmcnt(0)
	ds_store_b8 v12, v13
	v_add_nc_u32_e32 v12, s13, v12
	s_and_not1_b32 exec_lo, exec_lo, s22
	s_cbranch_execnz .LBB1_4
.LBB1_5:                                ; %Flow174
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s21
	v_add_co_u32 v4, s2, v4, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v5, s2, 0, v5, s2
	v_add_nc_u32_e32 v9, s3, v9
	v_add_nc_u32_e32 v10, s19, v10
	v_cmp_le_u64_e64 s2, s[8:9], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s20, s2, s20
	s_and_not1_b32 exec_lo, exec_lo, s20
	s_cbranch_execnz .LBB1_2
.LBB1_6:                                ; %Flow176
	s_or_b32 exec_lo, exec_lo, s14
	v_add3_u32 v7, v2, v8, 0
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v5, 0
	s_mov_b32 s7, 0
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, d_xSobel@rel32@lo+4
	s_addc_u32 s3, s3, d_xSobel@rel32@hi+12
	s_getpc_b64 s[8:9]
	s_add_u32 s8, s8, d_ySobel@rel32@lo+4
	s_addc_u32 s9, s9, d_ySobel@rel32@hi+12
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_7:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_8 Depth 2
	v_mov_b32_e32 v8, v7
	s_mov_b64 s[10:11], 0
.LBB1_8:                                ;   Parent Loop BB1_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s14, s2, s10
	s_addc_u32 s15, s3, s11
	s_add_u32 s16, s8, s10
	s_addc_u32 s17, s9, s11
	ds_load_u8 v10, v8
	s_load_b32 s13, s[14:15], 0x0
	s_load_b32 s14, s[16:17], 0x0
	v_dual_mov_b32 v4, v5 :: v_dual_mov_b32 v9, v3
	v_add_nc_u32_e32 v8, 1, v8
	s_add_u32 s10, s10, 4
	s_addc_u32 s11, s11, 0
	s_cmp_eq_u32 s10, 12
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[5:6], null, s13, v10, v[4:5]
	v_mad_u64_u32 v[3:4], null, s14, v10, v[9:10]
	s_cbranch_scc0 .LBB1_8
; %bb.9:                                ;   in Loop: Header=BB1_7 Depth=1
	s_add_i32 s7, s7, 1
	s_add_u32 s2, s2, 12
	s_addc_u32 s3, s3, 0
	v_add_nc_u32_e32 v7, s6, v7
	s_add_u32 s8, s8, 12
	s_addc_u32 s9, s9, 0
	s_cmp_eq_u32 s7, 3
	s_cbranch_scc0 .LBB1_7
; %bb.10:
	v_dual_mov_b32 v7, 0 :: v_dual_add_nc_u32 v6, s12, v2
	s_ashr_i32 s3, s4, 31
	s_mov_b32 s2, s4
	s_ashr_i32 s7, s5, 31
	s_mov_b32 s6, s5
	v_cmp_gt_u64_e32 vcc_lo, s[2:3], v[6:7]
	v_cmp_gt_u64_e64 s2, s[6:7], v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, s2, vcc_lo
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_12
; %bb.11:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, d_originalWidth@rel32@lo+4
	s_addc_u32 s3, s3, d_originalWidth@rel32@hi+12
	s_load_b64 s[0:1], s[0:1], 0x10
	s_load_b32 s2, s[2:3], 0x0
	v_sub_nc_u32_e32 v4, 0, v5
	v_lshlrev_b64 v[6:7], 2, v[6:7]
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[1:2], null, s2, v0, 0
	s_ashr_i32 s2, s2, 31
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[8:9], null, s2, v0, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mov_b32_e32 v2, v8
	v_sub_nc_u32_e32 v8, 0, v3
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_max_i32_e32 v2, v5, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_max_i32_e32 v3, v3, v8
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	v_add_nc_u32_e32 v2, v3, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, v0, v6
	v_add_co_ci_u32_e32 v1, vcc_lo, v1, v7, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB1_12:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z21computePriorityKernelPhiiPi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 15
		.amdhsa_next_free_sgpr 23
		.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	_Z21computePriorityKernelPhiiPi, .Lfunc_end1-_Z21computePriorityKernelPhiiPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 884
; NumSgprs: 25
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 25
; NumVGPRsForWavesPerEU: 15
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i ; -- Begin function _Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.globl	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
	.p2align	8
	.type	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i,@function
_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i: ; @_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
; %bb.0:
	s_load_b256 s[4:11], s[0:1], 0x0
	s_mov_b32 s2, s15
	s_ashr_i32 s3, s15, 31
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[12:13], s[2:3], 2
	s_load_b32 s3, s[0:1], 0x20
	s_waitcnt lgkmcnt(0)
	s_add_u32 s0, s4, s12
	s_addc_u32 s1, s5, s13
	s_load_b32 s12, s[0:1], 0x0
	s_add_i32 s13, s3, -1
	s_waitcnt lgkmcnt(0)
	s_cmp_ge_i32 s12, s13
	s_cbranch_scc1 .LBB2_3
; %bb.1:                                ; %.lr.ph.preheader
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, d_originalWidth@rel32@lo+4
	s_addc_u32 s1, s1, d_originalWidth@rel32@hi+12
	v_mov_b32_e32 v0, 0
	s_load_b32 s0, s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s0, s0, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s4, s12, s0
	s_mul_i32 s0, s4, 3
	s_ashr_i32 s5, s4, 31
	s_mul_hi_i32 s1, s4, 3
	s_add_u32 s0, s0, s6
	s_addc_u32 s1, s1, s7
	s_add_u32 s0, s0, 3
	s_addc_u32 s1, s1, 0
	s_lshl_b64 s[2:3], s[4:5], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s2, s2, s10
	s_addc_u32 s3, s3, s11
	s_add_u32 s2, s2, 4
	s_addc_u32 s3, s3, 0
	s_add_u32 s4, s4, s8
	s_addc_u32 s5, s5, s9
	s_add_u32 s4, s4, 1
	s_addc_u32 s5, s5, 0
.LBB2_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_clause 0x1
	global_load_u8 v1, v0, s[0:1] offset:2
	global_load_u16 v2, v0, s[0:1]
	s_add_i32 s12, s12, 1
	s_waitcnt vmcnt(1)
	global_store_b8 v0, v1, s[0:1] offset:-1
	s_waitcnt vmcnt(0)
	global_store_b16 v0, v2, s[0:1] offset:-3
	global_load_u8 v1, v0, s[4:5]
	s_add_u32 s0, s0, 3
	s_addc_u32 s1, s1, 0
	s_waitcnt vmcnt(0)
	global_store_b8 v0, v1, s[4:5] offset:-1
	global_load_b32 v1, v0, s[2:3]
	s_waitcnt vmcnt(0)
	global_store_b32 v0, v1, s[2:3] offset:-4
	s_add_u32 s2, s2, 4
	s_addc_u32 s3, s3, 0
	s_add_u32 s4, s4, 1
	s_addc_u32 s5, s5, 0
	s_cmp_ge_i32 s12, s13
	s_cbranch_scc0 .LBB2_2
.LBB2_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 36
		.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 3
		.amdhsa_next_free_sgpr 16
		.amdhsa_reserve_vcc 0
		.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_end2:
	.size	_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i, .Lfunc_end2-_Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 316
; NumSgprs: 16
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 16
; NumVGPRsForWavesPerEU: 3
; 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	_Z27computeSeamScoreTableKernelPiS_iii ; -- Begin function _Z27computeSeamScoreTableKernelPiS_iii
	.globl	_Z27computeSeamScoreTableKernelPiS_iii
	.p2align	8
	.type	_Z27computeSeamScoreTableKernelPiS_iii,@function
_Z27computeSeamScoreTableKernelPiS_iii: ; @_Z27computeSeamScoreTableKernelPiS_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x2c
	s_load_b256 s[4:11], s[0:1], 0x0
	s_add_i32 s15, s15, -1
	s_waitcnt lgkmcnt(0)
	s_bfe_u32 s1, s3, 0xf0001
	s_cmp_eq_u32 s10, 0
	v_mad_u64_u32 v[1:2], null, s1, s15, v[0:1]
	s_cselect_b32 s2, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, -1, v1
	v_cmp_gt_i32_e64 s0, s8, v1
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s11, s2, s0
	s_and_saveexec_b32 s0, s11
	s_cbranch_execz .LBB3_2
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_co_u32 v4, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v2, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v3, vcc_lo
	global_load_b32 v4, v[4:5], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v4, off
.LBB3_2:
	s_or_b32 exec_lo, exec_lo, s0
	v_cndmask_b32_e64 v2, 0, 1, s2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	v_cmp_le_u32_e32 vcc_lo, s1, v2
	v_readfirstlane_b32 s2, v2
	s_cbranch_vccnz .LBB3_14
; %bb.3:                                ; %.lr.ph
	v_mov_b32_e32 v5, 0
	s_and_b32 s0, s3, 0xffff
	s_delay_alu instid0(VALU_DEP_2)
	s_lshl_b32 s12, s2, 1
	s_add_i32 s11, s10, s2
	s_add_i32 s3, s8, -1
	s_sub_i32 s12, s0, s12
	s_add_i32 s13, s11, -1
	s_getpc_b64 s[16:17]
	s_add_u32 s16, s16, d_originalWidth@rel32@lo+4
	s_addc_u32 s17, s17, d_originalWidth@rel32@hi+12
.LBB3_4:                                ; =>This Inner Loop Header: Depth=1
	s_add_i32 s0, s10, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lt_i32 s0, s9
	s_mov_b32 s0, -1
	s_cbranch_scc0 .LBB3_13
; %bb.5:                                ;   in Loop: Header=BB3_4 Depth=1
	s_mov_b32 s14, exec_lo
	v_cmpx_gt_u32_e64 s12, v0
	s_cbranch_execz .LBB3_12
; %bb.6:                                ;   in Loop: Header=BB3_4 Depth=1
	v_add_nc_u32_e32 v2, s2, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_lt_i32_e32 vcc_lo, -1, v2
	v_cmp_gt_i32_e64 s0, s8, v2
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB3_12
; %bb.7:                                ;   in Loop: Header=BB3_4 Depth=1
	global_load_b32 v6, v5, s[16:17]
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[3:4], null, v6, s13, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v4, vcc_lo
	global_load_b32 v7, v[3:4], off
	v_cmpx_ne_u32_e32 0, v2
	s_cbranch_execz .LBB3_9
; %bb.8:                                ;   in Loop: Header=BB3_4 Depth=1
	global_load_b32 v8, v[3:4], off offset:-4
	s_waitcnt vmcnt(0)
	v_min_i32_e32 v7, v8, v7
.LBB3_9:                                ;   in Loop: Header=BB3_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_i32_e64 s3, v2
	s_cbranch_execz .LBB3_11
; %bb.10:                               ;   in Loop: Header=BB3_4 Depth=1
	global_load_b32 v3, v[3:4], off offset:4
	s_waitcnt vmcnt(0)
	v_min_i32_e32 v7, v3, v7
.LBB3_11:                               ;   in Loop: Header=BB3_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	v_mad_u64_u32 v[3:4], null, v6, s11, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[2:3], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v2, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v3, vcc_lo
	global_load_b32 v4, v[8:9], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v4, v4, v7
	global_store_b32 v[2:3], v4, off
.LBB3_12:                               ;   in Loop: Header=BB3_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s14
	s_add_i32 s2, s2, 1
	s_add_i32 s12, s12, -2
	s_add_i32 s11, s11, 1
	s_add_i32 s13, s13, 1
	s_cmp_ge_u32 s2, s1
	s_waitcnt_vscnt null, 0x0
	s_cselect_b32 s0, -1, 0
	s_barrier
	buffer_gl0_inv
.LBB3_13:                               ; %Flow84
                                        ;   in Loop: Header=BB3_4 Depth=1
	s_and_b32 vcc_lo, exec_lo, s0
	s_cbranch_vccz .LBB3_4
.LBB3_14:                               ; %.critedge
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z27computeSeamScoreTableKernelPiS_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 10
		.amdhsa_next_free_sgpr 18
		.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_end3:
	.size	_Z27computeSeamScoreTableKernelPiS_iii, .Lfunc_end3-_Z27computeSeamScoreTableKernelPiS_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 584
; NumSgprs: 20
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 1
; 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
	.protected	d_xSobel                ; @d_xSobel
	.type	d_xSobel,@object
	.data
	.globl	d_xSobel
	.p2align	4, 0x0
d_xSobel:
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	4294967295                      ; 0xffffffff
	.long	2                               ; 0x2
	.long	0                               ; 0x0
	.long	4294967294                      ; 0xfffffffe
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	4294967295                      ; 0xffffffff
	.size	d_xSobel, 36

	.protected	d_ySobel                ; @d_ySobel
	.type	d_ySobel,@object
	.globl	d_ySobel
	.p2align	4, 0x0
d_ySobel:
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	4294967295                      ; 0xffffffff
	.long	4294967294                      ; 0xfffffffe
	.long	4294967295                      ; 0xffffffff
	.size	d_ySobel, 36

	.protected	d_originalWidth         ; @d_originalWidth
	.type	d_originalWidth,@object
	.section	.bss,"aw",@nobits
	.globl	d_originalWidth
	.p2align	2, 0x0
d_originalWidth:
	.long	0                               ; 0x0
	.size	d_originalWidth, 4

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 d_xSobel
	.addrsig_sym d_ySobel
	.addrsig_sym d_originalWidth
	.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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .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:           _Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z21convertRgb2GrayKernelP15HIP_vector_typeIhLj3EEiiPh.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .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
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z21computePriorityKernelPhiiPi
    .private_segment_fixed_size: 0
    .sgpr_count:     25
    .sgpr_spill_count: 0
    .symbol:         _Z21computePriorityKernelPhiiPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 36
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     16
    .sgpr_spill_count: 0
    .symbol:         _Z13carvingKernelPiP15HIP_vector_typeIhLj3EEPhS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .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:           _Z27computeSeamScoreTableKernelPiS_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z27computeSeamScoreTableKernelPiS_iii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
