#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <unistd.h>
#include <utility>
#include <vector>

#define BLOCK_N 2 // 16 on Alan's PC, 2 on remote
#define THREAD_N 96 // 2048 on Alan's PC, 96 on remote

struct Point {
    double x;
    double y;
};

struct Dist {
    double da;
    double db;
    double dc;
    Dist(double a, double b, double c) : da(a), db(b), dc(c) {}
};

std::ostream& operator<<(std::ostream& stream, Point& p) {
    return stream << p.x << " " << p.y;
}

__device__ Point& operator+=(Point &a, const Point &b) {
    a.x += b.x;
    a.y += b.y;
    return a;
}

__device__ Point& operator/(Point &a, double d) {
    a.x /= d;
    a.y /= d;
    return a;
}

__device__ Point Trilaterate(const Point &a, const Point &b, const Point &c, const Dist &ref) {
    double A = (-2 * a.x) + (2 * b.x),
           B = (-2 * a.y) + (2 * b.y),
           C = (ref.da * ref.da) - (ref.db * ref.db) - (a.x * a.x) + (b.x * b.x) - (a.y * a.y) + (b.y * b.y),
           D = (-2 * b.x) + (2 * c.x),
           E = (-2 * b.y) + (2 * c.y),
           F = (ref.db * ref.db) - (ref.dc * ref.dc) - (b.x * b.x) + (c.x * c.x) - (b.y * b.y) + (c.y * c.y);
    if (A * E == D * B || B * D == E * A) { // Don't divide by 0
        return Point { 0, 0 };
    }
    // printf("P(%f, %f)\n", ((C * E) - (F * B)) / ((A * E) - (D * B)), ((C * D) - (F * A)) / ((B * D) - (E * A)));
    return Point { ((C * E) - (F * B)) / ((A * E) - (D * B)), ((C * D) - (F * A)) / ((B * D) - (E * A)) };
}

// Kernel definition
__global__ void FindPoint(const Point a, const Point b, const Point c, const Dist *dst, size_t num, Point *pts) {
    __shared__ Point t[THREAD_N];
    // const int i = blockIdx.x * blockDim.x + threadIdx.x;
    for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < num; i += blockDim.x * gridDim.x) {
    //if (i < num) {
        // printf("BlockIdx=%d, ThreadIdx=%d, i=%d, dst[i]=(%f,%f,%f)\n",
        //         blockIdx.x, threadIdx.x, i, dst[i].da, dst[i].db, dst[i].dc);
        int tid = threadIdx.x;
        t[tid] = Trilaterate(a, b, c, dst[i]);//dst[i + vec_n * THREAD_N]);
        // Have each thread calculate the trilateration of a dst[i]
        __syncthreads();
        // Avg every 4 points, store in pts
        for (int fold = 2; fold > 0; fold /= 2) {
            if (tid % 4 < fold) { // 4-point segment
                t[tid] += t[tid + fold];
            }
            __syncthreads();
        }
        if (tid % 4 == 0) pts[i / 4] = t[tid] / 4;
    //}
    }
}

// Set up guard points
void setGuards(std::ifstream &ifs, Point &a, Point &b, Point &c) {
    ifs >> a.x >> a.y
        >> b.x >> b.y
        >> c.x >> c.y;
}

/* The current CUDA API goes up to 3.0 SM support (Kepler). For newer
 * architectures, like Maxwell and Pascal, we use this function that
 * many industry professionals have agreed on to determine the number of
 * cores. Until the API is updated to include the numbers for >3.0 SM, we
 * will use this function to get the count.
 */
int getSPcores(cudaDeviceProp devProp) {
    int cores = 0;
    int mp = devProp.multiProcessorCount;
    switch (devProp.major) {
        case 2: // Fermi
            if (devProp.minor == 1) cores = mp * 48;
            else cores = mp * 32;
            break;
        case 3: // Kepler
            cores = mp * 192;
            break;
        case 5: // Maxwell
            cores = mp * 128;
            break;
        case 6: // Pascal
            if (devProp.minor == 1) cores = mp * 128;
            else if (devProp.minor == 0) cores = mp * 64;
            else std::cerr << "Unknown device type\n";
            break;
        default:
            std::cerr << "Unknown device type\n";
            break;
    }
    return cores;
}

int main(int argc, char* argv[]) {
    // Process flags
    std::string inputFile, outputFile;
    int flag;
    double UFactor = 1.0, VFactor = 1.0;
    opterr = 0;
    while ((flag = getopt(argc, argv, "hi:o:U:V:")) != -1) {
        switch(flag) {
            case 'i':
                inputFile = optarg;
                break;
            case 'o':
                outputFile = optarg;
                break;
            case 'U':
                UFactor = atof(optarg);
                break;
            case 'V':
                VFactor = atof(optarg);
                break;
            case 'h':
                std::cerr << "Usage: ./assign2 [-hioUV] <file-path>\n\n" <<
                             "Options:\n" <<
                             "-h\t\t Show usage string and exit\n" <<
                             "-i <file-path>\t Read input from provided file\n" <<
                             "-o <file-path>\t Write output to file\n" <<
                             "-U <factor for U>\t Block size = U (SMs) * factor for U\n" <<
                             "-V <factor for V>\t Thread size = V (Cores) * factor for V\n";
                exit(-1);
            case '?':
                if (optopt == 'i' || optopt == 'o' || optopt == 'U' || optopt == 'V') {
                    std::cerr << "Option -" << (char)optopt << " requires an argument.\n";
                } else if (isprint(optopt)) {
                    std::cerr << "Unknown option `-" << (char)optopt << "'.\n";
                } else {
                    std::cerr << "Unknown option character `\\x" << (char)optopt << "'.\n";
                }
                exit(-1);
            default:
                exit(-1);
        }
    }

    // Ensure filename was passed
    if (inputFile.empty()) {
        std::cerr << "Error: input filename required\n";
        exit(-1);
    }
    if (outputFile.empty()) {
        std::cerr << "Error: output filename required\n";
        exit(-1);
    }

    // Use API to determine U and V values
    int nDevices, U = -1, V = -1;
    cudaError_t err = cudaGetDeviceCount(&nDevices);
    if (err != cudaSuccess) {
        std::cerr << cudaGetErrorString(err) << "\n";
        exit(-1);
    } else {
        for (int i = 0; i < nDevices; i++) {
            cudaDeviceProp prop;
            cudaGetDeviceProperties(&prop, i);
            U = prop.multiProcessorCount;
            V = getSPcores(prop) / U; // Get number of cores per sm
        }
    }

    // Check values for U and V
    if (U == -1 || V == -1) {
        std::cerr << "Error: Could not fetch information on number of multiprocessors or cores\n";
        exit(-1);
    }

    // Open input file for reading
    std::ifstream ifs;
    ifs.open(inputFile, std::ios::in);
    if (!ifs.is_open()) {
        std::cerr << "Error: failed to open " << inputFile << "\n";
        exit(-1);
    }

    // Set up guard points
    Point a, b, c;
    setGuards(ifs, a, b, c);

    std::vector<Dist> data;

    while (true) {
        double da, db, dc;
        ifs >> da >> db >> dc;
        if (ifs.eof()) break;
        data.push_back(Dist(da, db, dc));
        //std::cerr << "Dist { " << da << " " << db << " " << dc << " }\n";
    }
    //std::cerr << "Size of dists: " << data.size() << "\n";
    ifs.close();

    Dist *dst;
    Point *pts;
    Point *res = new Point[data.size() / 4];
    err = cudaMalloc((void **)&dst, data.size() * sizeof(Dist));
    if (err != cudaSuccess) {
        std::cerr << cudaGetErrorString(err) << "\n";
        exit(-1);
    }
    err = cudaMalloc((void **)&pts, (data.size() / 4) * sizeof(Point));
    if (err != cudaSuccess) {
        std::cerr << cudaGetErrorString(err) << "\n";
        exit(-1);
    }

    err = cudaMemcpy(dst, data.data(), data.size() * sizeof(Dist), cudaMemcpyHostToDevice);
    if (err != cudaSuccess) {
        std::cerr << cudaGetErrorString(err) << "\n";
        exit(-1);
    }

    // Pass in our U and V for this run
    // std::cerr << U << ", " << UFactor << ", " << V << ", " << VFactor << "\n";
    int numBlocks = U * UFactor;
    int numThreads = V * VFactor;

    // Start timer
    cudaEvent_t start, stop;
    float elapsedTime;
    cudaEventCreate(&start);
    cudaEventRecord(start, 0);

    FindPoint<<<numBlocks, numThreads>>>(a, b, c, dst, data.size(), pts);

    // End timer
    cudaEventCreate(&stop);
    cudaEventRecord(stop, 0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&elapsedTime, start, stop);
    std::cerr << "Elapsed time: " << elapsedTime << " ms\n";

    err = cudaMemcpy(res, pts, (data.size() / 4) * sizeof(Point), cudaMemcpyDeviceToHost);
    if (err != cudaSuccess) {
        std::cerr << cudaGetErrorString(err) << "\n";
        exit(-1);
    }

    std::ofstream ofs;
    ofs.open(outputFile, std::ofstream::out | std::ofstream::trunc);
    for (int i = 0; i < data.size() / 4; i++) {
        ofs << res[i] << "\n";
    }
    ofs.close();

    cudaFree(dst);
    cudaFree(pts);
    delete[] res;

    return 0;
}

	.file	"tmpxft_0038fe2a_00000000-6_assign2.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4165:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4165:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.isra.0, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.isra.0:
.LFB4977:
	.cfi_startproc
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	strlen@PLT
	movq	8(%rbx), %rdx
	movq	%rbp, %rcx
	popq	%r9
	.cfi_def_cfa_offset 24
	movq	%rbx, %rdi
	movq	%rax, %r8
	popq	%rbx
	.cfi_def_cfa_offset 16
	xorl	%esi, %esi
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm@PLT
	.cfi_endproc
.LFE4977:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.isra.0, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_ZlsRSoR5Point
	.type	_ZlsRSoR5Point, @function
_ZlsRSoR5Point:
.LFB4145:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movsd	(%rsi), %xmm0
	movq	%rsi, %rbx
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rbx), %xmm0
	popq	%rbx
	.cfi_def_cfa_offset 8
	movq	%rax, %rdi
	jmp	_ZNSo9_M_insertIdEERSoT_@PLT
	.cfi_endproc
.LFE4145:
	.size	_ZlsRSoR5Point, .-_ZlsRSoR5Point
	.globl	_ZpLR5PointRKS_
	.type	_ZpLR5PointRKS_, @function
_ZpLR5PointRKS_:
.LFB4146:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4146:
	.size	_ZpLR5PointRKS_, .-_ZpLR5PointRKS_
	.globl	_ZdvR5Pointd
	.type	_ZdvR5Pointd, @function
_ZdvR5Pointd:
.LFB4147:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4147:
	.size	_ZdvR5Pointd, .-_ZdvR5Pointd
	.globl	_Z11TrilaterateRK5PointS1_S1_RK4Dist
	.type	_Z11TrilaterateRK5PointS1_S1_RK4Dist, @function
_Z11TrilaterateRK5PointS1_S1_RK4Dist:
.LFB4148:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4148:
	.size	_Z11TrilaterateRK5PointS1_S1_RK4Dist, .-_Z11TrilaterateRK5PointS1_S1_RK4Dist
	.globl	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
	.type	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_, @function
_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_:
.LFB4149:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rcx, %rbx
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	leaq	8(%r12), %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	leaq	8(%rbp), %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	leaq	8(%rbx), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	movq	%rax, %rdi
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZNSi10_M_extractIdEERSiRT_@PLT
	.cfi_endproc
.LFE4149:
	.size	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_, .-_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
	.section	.rodata.str1.1
.LC1:
	.string	"Unknown device type\n"
	.text
	.globl	_Z10getSPcores14cudaDeviceProp
	.type	_Z10getSPcores14cudaDeviceProp, @function
_Z10getSPcores14cudaDeviceProp:
.LFB4150:
	.cfi_startproc
	endbr64
	pushq	%rcx
	.cfi_def_cfa_offset 16
	movl	376(%rsp), %edx
	movd	404(%rsp), %xmm0
	cmpl	$5, %edx
	je	.L29
	movl	380(%rsp), %ecx
	jg	.L16
	movd	%xmm0, %esi
	cmpl	$2, %edx
	je	.L17
	imull	$192, %esi, %eax
	cmpl	$3, %edx
	je	.L14
	jmp	.L24
.L16:
	cmpl	$6, %edx
	je	.L20
	jmp	.L24
.L17:
	pslld	$5, %xmm0
	decl	%ecx
	movd	%xmm0, %eax
	jne	.L14
	imull	$48, %esi, %eax
	jmp	.L14
.L20:
	cmpl	$1, %ecx
	jne	.L23
.L29:
	pslld	$7, %xmm0
	jmp	.L28
.L23:
	testl	%ecx, %ecx
	jne	.L24
	pslld	$6, %xmm0
.L28:
	movd	%xmm0, %eax
	jmp	.L14
.L24:
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	xorl	%eax, %eax
.L14:
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4150:
	.size	_Z10getSPcores14cudaDeviceProp, .-_Z10getSPcores14cudaDeviceProp
	.globl	_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_
	.type	_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_, @function
_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_:
.LFB4187:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rcx, 24(%rsp)
	leaq	48(%rsp), %rcx
	movq	%r8, 16(%rsp)
	movq	%r9, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rdi, 104(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rsi, 112(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 120(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movl	$1, 64(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	48(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z9FindPoint5PointS_S_PK4DistmPS_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 192
	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 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L31:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4187:
	.size	_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_, .-_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_
	.globl	_Z9FindPoint5PointS_S_PK4DistmPS_
	.type	_Z9FindPoint5PointS_S_PK4DistmPS_, @function
_Z9FindPoint5PointS_S_PK4DistmPS_:
.LFB4188:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movq	%rdi, %rcx
	movq	%rsi, %r8
	movq	%rdx, %r9
	leaq	16(%rsp), %rsi
	movq	%rsp, %rdx
	leaq	32(%rsp), %rdi
	movq	%xmm0, 32(%rsp)
	movq	%xmm1, 40(%rsp)
	movq	%xmm2, 16(%rsp)
	movq	%xmm3, 24(%rsp)
	movq	%xmm4, (%rsp)
	movq	%xmm5, 8(%rsp)
	call	_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_
	addq	$56, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4188:
	.size	_Z9FindPoint5PointS_S_PK4DistmPS_, .-_Z9FindPoint5PointS_S_PK4DistmPS_
	.section	.rodata.str1.1
.LC2:
	.string	"_Z9FindPoint5PointS_S_PK4DistmPS_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4190:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC2(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9FindPoint5PointS_S_PK4DistmPS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4190:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorI4DistSaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorI4DistSaIS0_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorI4DistSaIS0_EED2Ev
	.type	_ZNSt6vectorI4DistSaIS0_EED2Ev, @function
_ZNSt6vectorI4DistSaIS0_EED2Ev:
.LFB4535:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L39
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L39:
	ret
	.cfi_endproc
.LFE4535:
	.size	_ZNSt6vectorI4DistSaIS0_EED2Ev, .-_ZNSt6vectorI4DistSaIS0_EED2Ev
	.weak	_ZNSt6vectorI4DistSaIS0_EED1Ev
	.set	_ZNSt6vectorI4DistSaIS0_EED1Ev,_ZNSt6vectorI4DistSaIS0_EED2Ev
	.section	.rodata._ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_.str1.1,"aMS",@progbits,1
.LC3:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_,"axG",@progbits,_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	.type	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_, @function
_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_:
.LFB4842:
	.cfi_startproc
	endbr64
	movabsq	$-6148914691236517205, %rax
	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
	movq	%rsi, %rbx
	movabsq	$384307168202282325, %rsi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %r15
	movq	(%rdi), %r13
	movq	%r15, %rbp
	subq	%r13, %rbp
	sarq	$3, %rbp
	imulq	%rax, %rbp
	cmpq	%rsi, %rbp
	jne	.L42
	leaq	.LC3(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L42:
	cmpq	%r13, %r15
	movl	$1, %eax
	movq	%rbx, %rcx
	movq	%rdi, %r12
	cmovne	%rbp, %rax
	addq	%rax, %rbp
	setc	%al
	subq	%r13, %rcx
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L54
	xorl	%r14d, %r14d
	testq	%rbp, %rbp
	je	.L47
	movabsq	$384307168202282325, %rax
	cmpq	%rax, %rbp
	cmova	%rax, %rbp
	jmp	.L46
.L54:
	movq	%rsi, %rbp
.L46:
	imulq	$24, %rbp, %rdi
	movq	%rdx, 8(%rsp)
	movq	%rcx, (%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movq	%rax, %r14
.L47:
	movq	16(%rdx), %rax
	movups	(%rdx), %xmm0
	movq	%r14, %rdx
	movq	%rax, 16(%r14,%rcx)
	movq	%r13, %rax
	movups	%xmm0, (%r14,%rcx)
.L48:
	addq	$24, %rdx
	cmpq	%rax, %rbx
	je	.L61
	movups	(%rax), %xmm1
	movq	16(%rax), %rcx
	addq	$24, %rax
	movq	%rcx, -8(%rdx)
	movups	%xmm1, -24(%rdx)
	jmp	.L48
.L61:
	movabsq	$768614336404564651, %rax
	subq	%r13, %rbx
	shrq	$3, %rbx
	imulq	%rax, %rbx
	movabsq	$2305843009213693951, %rax
	andq	%rax, %rbx
	imulq	$24, %rbx, %rcx
	leaq	1(%rbx), %rax
	imulq	$24, %rax, %rax
	addq	%r13, %rcx
	addq	%r14, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
.L50:
	cmpq	%r15, %rdx
	je	.L62
	movups	(%rdx), %xmm2
	movq	16(%rdx), %rdi
	addq	$24, %rsi
	addq	$24, %rdx
	movups	%xmm2, -24(%rsi)
	movq	%rdi, -8(%rsi)
	jmp	.L50
.L62:
	subq	%rcx, %rdx
	movabsq	$768614336404564651, %rcx
	shrq	$3, %rdx
	imulq	%rcx, %rdx
	movabsq	$2305843009213693951, %rcx
	andq	%rcx, %rdx
	imulq	$24, %rdx, %rdx
	leaq	(%rax,%rdx), %rbx
	testq	%r13, %r13
	je	.L52
	movq	16(%r12), %rsi
	movq	%r13, %rdi
	subq	%r13, %rsi
	call	_ZdlPvm@PLT
.L52:
	imulq	$24, %rbp, %rbp
	movq	%r14, (%r12)
	movq	%rbx, 8(%r12)
	addq	%rbp, %r14
	movq	%r14, 16(%r12)
	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
.LFE4842:
	.size	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_, .-_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	.section	.rodata.str1.1
.LC5:
	.string	"Usage: ./assign2 [-hioUV] <file-path>\n\n"
.LC6:
	.string	"Options:\n"
.LC7:
	.string	"-h\t\t Show usage string and exit\n"
.LC8:
	.string	"-i <file-path>\t Read input from provided file\n"
.LC9:
	.string	"-o <file-path>\t Write output to file\n"
.LC10:
	.string	"-U <factor for U>\t Block size = U (SMs) * factor for U\n"
.LC11:
	.string	"-V <factor for V>\t Thread size = V (Cores) * factor for V\n"
.LC12:
	.string	"Option -"
.LC13:
	.string	" requires an argument.\n"
.LC14:
	.string	"Unknown option `-"
.LC15:
	.string	"'.\n"
.LC16:
	.string	"Unknown option character `\\x"
.LC17:
	.string	"hi:o:U:V:"
.LC18:
	.string	"Error: input filename required\n"
.LC19:
	.string	"Error: output filename required\n"
.LC20:
	.string	"\n"
.LC21:
	.string	"Error: Could not fetch information on number of multiprocessors or cores\n"
.LC22:
	.string	"Error: failed to open "
.LC23:
	.string	"Elapsed time: "
.LC24:
	.string	" ms\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4151:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4151
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	movl	%edi, %r14d
	pushq	%r13
	.cfi_offset 13, -40
	leaq	.LC17(%rip), %r13
	pushq	%r12
	.cfi_offset 12, -48
	movq	%rsi, %r12
	xorl	%esi, %esi
	pushq	%rbx
	subq	$1896, %rsp
	.cfi_offset 3, -56
	movsd	.LC4(%rip), %xmm1
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-1648(%rbp), %rax
	movq	%rdx, -1656(%rbp)
	movq	%rax, -1664(%rbp)
	leaq	-1616(%rbp), %rax
	movb	$0, -1648(%rbp)
	movq	%rax, -1632(%rbp)
	movq	%rcx, -1624(%rbp)
	movb	$0, -1616(%rbp)
	movl	%esi, opterr(%rip)
	movsd	%xmm1, -1872(%rbp)
	movsd	%xmm1, -1896(%rbp)
.L64:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movl	%r14d, %edi
	call	getopt@PLT
	movl	%eax, %ebx
	cmpl	$-1, %eax
	je	.L153
	cmpl	$86, %ebx
	je	.L65
	jg	.L66
	cmpl	$63, %ebx
	je	.L67
	cmpl	$85, %ebx
	jne	.L69
	movq	optarg(%rip), %rdi
	call	atof@PLT
	movsd	%xmm0, -1896(%rbp)
	jmp	.L64
.L66:
	cmpl	$105, %ebx
	je	.L70
	cmpl	$111, %ebx
	je	.L71
	cmpl	$104, %ebx
	je	.L72
	jmp	.L69
.L70:
	leaq	-1664(%rbp), %rdi
	jmp	.L138
.L71:
	leaq	-1632(%rbp), %rdi
.L138:
	movq	optarg(%rip), %rsi
.LEHB0:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.isra.0
	jmp	.L64
.L65:
	movq	optarg(%rip), %rdi
	call	atof@PLT
	movsd	%xmm0, -1872(%rbp)
	jmp	.L64
.L72:
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC6(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC7(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC11(%rip), %rsi
.L129:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L69
.L67:
	movl	optopt(%rip), %edi
	leaq	_ZSt4cerr(%rip), %rbx
	leal	-85(%rdi), %eax
	cmpl	$26, %eax
	ja	.L75
	movl	$68157443, %edx
	btq	%rax, %rdx
	jnc	.L75
	leaq	.LC12(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsbl	optopt(%rip), %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	leaq	.LC13(%rip), %rsi
	jmp	.L129
.L75:
	call	isprint@PLT
	leaq	.LC14(%rip), %rsi
	testl	%eax, %eax
	jne	.L152
	leaq	.LC16(%rip), %rsi
.L152:
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsbl	optopt(%rip), %esi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	leaq	.LC15(%rip), %rsi
	jmp	.L129
.L81:
	leaq	-1852(%rbp), %rdi
	call	cudaGetDeviceCount@PLT
	movl	$-1, -1876(%rbp)
	movl	%eax, %edi
	xorl	%r12d, %r12d
	leaq	-1088(%rbp), %rax
	movq	%rax, -1864(%rbp)
	testl	%edi, %edi
	jne	.L154
.L82:
	cmpl	%r12d, -1852(%rbp)
	jg	.L83
	cmpl	$-1, %ebx
	je	.L116
	cmpl	$-1, -1876(%rbp)
	je	.L116
	movq	-1864(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	-1664(%rbp), %rsi
	leaq	-1072(%rbp), %rdi
	movl	$8, %edx
.LEHB1:
	call	_ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	-1088(%rbp), %rdx
	movq	-1864(%rbp), %rdi
	addq	-24(%rdx), %rdi
	testq	%rax, %rax
	jne	.L86
	movl	$4, %esi
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L87:
	leaq	-968(%rbp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	jne	.L88
	leaq	.LC22(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	-1664(%rbp), %rsi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	leaq	.LC20(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE1:
.L69:
	orl	$-1, %edi
	call	exit@PLT
.L153:
	cmpq	$0, -1656(%rbp)
	leaq	.LC18(%rip), %rsi
	je	.L144
	cmpq	$0, -1624(%rbp)
	jne	.L81
	leaq	.LC19(%rip), %rsi
.L144:
	leaq	_ZSt4cerr(%rip), %rdi
	jmp	.L129
.L154:
.LEHB2:
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC20(%rip), %rsi
	jmp	.L129
.L83:
	movq	-1864(%rbp), %rdi
	movl	%r12d, %esi
	call	cudaGetDeviceProperties_v2@PLT
	subq	$1040, %rsp
	movl	-700(%rbp), %ebx
	movl	$258, %ecx
	movq	-1864(%rbp), %rsi
	movq	%rsp, %rdi
	rep movsl
	.cfi_escape 0x2e,0x90,0x8
	call	_Z10getSPcores14cudaDeviceProp
.LEHE2:
	cltd
	addq	$1040, %rsp
	incl	%r12d
	idivl	%ebx
	movl	%eax, -1876(%rbp)
	jmp	.L82
.L116:
	leaq	.LC21(%rip), %rsi
	jmp	.L144
.L86:
	xorl	%esi, %esi
.LEHB3:
	.cfi_escape 0x2e,0
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@PLT
	jmp	.L87
.L88:
	movq	-1864(%rbp), %rdi
	leaq	-1760(%rbp), %rcx
	leaq	-1776(%rbp), %rdx
	leaq	-1792(%rbp), %rsi
	call	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
.LEHE3:
	xorl	%eax, %eax
	movq	%rax, -1712(%rbp)
	movq	%rax, -1704(%rbp)
	movq	%rax, -1696(%rbp)
	leaq	-1808(%rbp), %rax
	movq	%rax, -1912(%rbp)
.L92:
	movq	-1912(%rbp), %rsi
	movq	-1864(%rbp), %rdi
.LEHB4:
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	-1744(%rbp), %rax
	movq	%rax, %rsi
	movq	%rax, -1920(%rbp)
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	-1728(%rbp), %rax
	movq	%rax, %rsi
	movq	%rax, -1928(%rbp)
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	testb	$2, -800(%rbp)
	jne	.L89
	movsd	-1808(%rbp), %xmm0
	movq	-1704(%rbp), %rsi
	movsd	%xmm0, -1688(%rbp)
	movsd	-1744(%rbp), %xmm0
	movsd	%xmm0, -1680(%rbp)
	movsd	-1728(%rbp), %xmm0
	movsd	%xmm0, -1672(%rbp)
	cmpq	-1696(%rbp), %rsi
	je	.L90
	movups	-1688(%rbp), %xmm3
	addq	$24, %rsi
	movups	%xmm3, -24(%rsi)
	movq	-1672(%rbp), %rax
	movq	%rax, -8(%rsi)
	movq	%rsi, -1704(%rbp)
	jmp	.L92
.L90:
	leaq	-1688(%rbp), %rdx
	leaq	-1712(%rbp), %rdi
	call	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	jmp	.L92
.L89:
	movq	-1864(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	-1712(%rbp), %r15
	movq	-1704(%rbp), %r12
	movabsq	$-6148914691236517205, %rax
	subq	%r15, %r12
	movq	%r12, %r14
	sarq	$3, %r14
	imulq	%rax, %r14
	movq	%r14, %rax
	shrq	$2, %rax
	movq	%rax, -1904(%rbp)
	testq	%r12, %r12
	js	.L93
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, -1888(%rbp)
	call	_Znam@PLT
	leaq	-1848(%rbp), %rdi
	movq	%r12, %rsi
	movq	%rax, %r13
	call	cudaMalloc@PLT
	jmp	.L155
.L93:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L122
	call	__cxa_throw_bad_array_new_length@PLT
.L155:
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L148
	movq	-1888(%rbp), %rsi
	leaq	-1840(%rbp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L148
	movq	-1848(%rbp), %rdi
	movl	$1, %ecx
	movq	%r12, %rdx
	movq	%r15, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L148
	cvtsi2sdl	%ebx, %xmm0
	mulsd	-1896(%rbp), %xmm0
	leaq	-1832(%rbp), %rdi
	cvttsd2sil	%xmm0, %ebx
	cvtsi2sdl	-1876(%rbp), %xmm0
	mulsd	-1872(%rbp), %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, %r15d
	call	cudaEventCreate@PLT
	movq	-1832(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movabsq	$4294967297, %rax
	movl	%r15d, -1808(%rbp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, -1804(%rbp)
	movl	-1800(%rbp), %ecx
	movq	%rax, -1816(%rbp)
	movq	-1808(%rbp), %rdx
	movl	%ebx, -1820(%rbp)
	movl	-1812(%rbp), %esi
	movq	-1820(%rbp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L99
	movups	-1792(%rbp), %xmm6
	movups	-1776(%rbp), %xmm7
	leaq	-1688(%rbp), %rdx
	movq	%r14, %r8
	movups	-1760(%rbp), %xmm1
	movq	-1840(%rbp), %r9
	movq	-1848(%rbp), %rcx
	movq	-1928(%rbp), %rsi
	movups	%xmm6, -1744(%rbp)
	movq	-1920(%rbp), %rdi
	movups	%xmm7, -1728(%rbp)
	movups	%xmm1, -1688(%rbp)
	call	_Z47__device_stub__Z9FindPoint5PointS_S_PK4DistmPS_RK5PointS1_S1_PK4DistmPS_
.L99:
	movq	-1912(%rbp), %rdi
	call	cudaEventCreate@PLT
	movq	-1808(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-1808(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-1808(%rbp), %rdx
	movq	-1832(%rbp), %rsi
	leaq	-1820(%rbp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC23(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	-1820(%rbp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC24(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	-1888(%rbp), %rdx
	movq	-1840(%rbp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L100
.L148:
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	.LC20(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L69
.L100:
	leaq	-1600(%rbp), %rax
	movq	%rax, %rdi
	movq	%rax, %r15
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE4:
	movq	-1632(%rbp), %rsi
	leaq	-1592(%rbp), %rdi
	movl	$48, %edx
.LEHB5:
	call	_ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movq	-1600(%rbp), %rdx
	movq	-24(%rdx), %rdi
	addq	%r15, %rdi
	testq	%rax, %rax
	jne	.L101
	movl	$4, %esi
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L103:
	xorl	%ebx, %ebx
	leaq	.LC20(%rip), %r12
	jmp	.L102
.L101:
	xorl	%esi, %esi
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@PLT
	jmp	.L103
.L104:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	salq	$4, %rsi
	addq	%r13, %rsi
	call	_ZlsRSoR5Point
	movq	%rax, %rdi
	movq	%r12, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%rbx
.L102:
	cmpq	%rbx, -1904(%rbp)
	jne	.L104
	movq	%r15, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	-1848(%rbp), %rdi
	call	cudaFree@PLT
	movq	-1840(%rbp), %rdi
	call	cudaFree@PLT
.LEHE5:
	movq	%r13, %rdi
	call	_ZdaPv@PLT
	movq	%r15, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-1712(%rbp), %rdi
	call	_ZNSt6vectorI4DistSaIS0_EED1Ev
	leaq	-1088(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-1632(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	-1664(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L110
	jmp	.L122
.L115:
	endbr64
	movq	%rax, %rbx
.L105:
	movq	%r15, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L106
.L114:
	endbr64
	movq	%rax, %rbx
.L106:
	leaq	-1712(%rbp), %rdi
	call	_ZNSt6vectorI4DistSaIS0_EED1Ev
	jmp	.L107
.L113:
	endbr64
	movq	%rax, %rbx
.L107:
	movq	-1864(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L108
.L112:
	endbr64
	movq	%rax, %rbx
.L108:
	leaq	-1632(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	-1664(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L122
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L122:
	call	__stack_chk_fail@PLT
.L110:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4151:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4151:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4151-.LLSDACSB4151
.LLSDACSB4151:
	.uleb128 .LEHB0-.LFB4151
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L112-.LFB4151
	.uleb128 0
	.uleb128 .LEHB1-.LFB4151
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L113-.LFB4151
	.uleb128 0
	.uleb128 .LEHB2-.LFB4151
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L112-.LFB4151
	.uleb128 0
	.uleb128 .LEHB3-.LFB4151
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L113-.LFB4151
	.uleb128 0
	.uleb128 .LEHB4-.LFB4151
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L114-.LFB4151
	.uleb128 0
	.uleb128 .LEHB5-.LFB4151
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L115-.LFB4151
	.uleb128 0
	.uleb128 .LEHB6-.LFB4151
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE4151:
	.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC4:
	.long	0
	.long	1072693248
	.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 <fstream>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <unistd.h>
#include <utility>
#include <vector>

#define BLOCK_N 2 // 16 on Alan's PC, 2 on remote
#define THREAD_N 96 // 2048 on Alan's PC, 96 on remote

struct Point {
    double x;
    double y;
};

struct Dist {
    double da;
    double db;
    double dc;
    Dist(double a, double b, double c) : da(a), db(b), dc(c) {}
};

std::ostream& operator<<(std::ostream& stream, Point& p) {
    return stream << p.x << " " << p.y;
}

__device__ Point& operator+=(Point &a, const Point &b) {
    a.x += b.x;
    a.y += b.y;
    return a;
}

__device__ Point& operator/(Point &a, double d) {
    a.x /= d;
    a.y /= d;
    return a;
}

__device__ Point Trilaterate(const Point &a, const Point &b, const Point &c, const Dist &ref) {
    double A = (-2 * a.x) + (2 * b.x),
           B = (-2 * a.y) + (2 * b.y),
           C = (ref.da * ref.da) - (ref.db * ref.db) - (a.x * a.x) + (b.x * b.x) - (a.y * a.y) + (b.y * b.y),
           D = (-2 * b.x) + (2 * c.x),
           E = (-2 * b.y) + (2 * c.y),
           F = (ref.db * ref.db) - (ref.dc * ref.dc) - (b.x * b.x) + (c.x * c.x) - (b.y * b.y) + (c.y * c.y);
    if (A * E == D * B || B * D == E * A) { // Don't divide by 0
        return Point { 0, 0 };
    }
    // printf("P(%f, %f)\n", ((C * E) - (F * B)) / ((A * E) - (D * B)), ((C * D) - (F * A)) / ((B * D) - (E * A)));
    return Point { ((C * E) - (F * B)) / ((A * E) - (D * B)), ((C * D) - (F * A)) / ((B * D) - (E * A)) };
}

// Kernel definition
__global__ void FindPoint(const Point a, const Point b, const Point c, const Dist *dst, size_t num, Point *pts) {
    __shared__ Point t[THREAD_N];
    // const int i = blockIdx.x * blockDim.x + threadIdx.x;
    for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < num; i += blockDim.x * gridDim.x) {
    //if (i < num) {
        // printf("BlockIdx=%d, ThreadIdx=%d, i=%d, dst[i]=(%f,%f,%f)\n",
        //         blockIdx.x, threadIdx.x, i, dst[i].da, dst[i].db, dst[i].dc);
        int tid = threadIdx.x;
        t[tid] = Trilaterate(a, b, c, dst[i]);//dst[i + vec_n * THREAD_N]);
        // Have each thread calculate the trilateration of a dst[i]
        __syncthreads();
        // Avg every 4 points, store in pts
        for (int fold = 2; fold > 0; fold /= 2) {
            if (tid % 4 < fold) { // 4-point segment
                t[tid] += t[tid + fold];
            }
            __syncthreads();
        }
        if (tid % 4 == 0) pts[i / 4] = t[tid] / 4;
    //}
    }
}

// Set up guard points
void setGuards(std::ifstream &ifs, Point &a, Point &b, Point &c) {
    ifs >> a.x >> a.y
        >> b.x >> b.y
        >> c.x >> c.y;
}

/* The current CUDA API goes up to 3.0 SM support (Kepler). For newer
 * architectures, like Maxwell and Pascal, we use this function that
 * many industry professionals have agreed on to determine the number of
 * cores. Until the API is updated to include the numbers for >3.0 SM, we
 * will use this function to get the count.
 */
int getSPcores(hipDeviceProp_t devProp) {
    int cores = 0;
    int mp = devProp.multiProcessorCount;
    switch (devProp.major) {
        case 2: // Fermi
            if (devProp.minor == 1) cores = mp * 48;
            else cores = mp * 32;
            break;
        case 3: // Kepler
            cores = mp * 192;
            break;
        case 5: // Maxwell
            cores = mp * 128;
            break;
        case 6: // Pascal
            if (devProp.minor == 1) cores = mp * 128;
            else if (devProp.minor == 0) cores = mp * 64;
            else std::cerr << "Unknown device type\n";
            break;
        default:
            std::cerr << "Unknown device type\n";
            break;
    }
    return cores;
}

int main(int argc, char* argv[]) {
    // Process flags
    std::string inputFile, outputFile;
    int flag;
    double UFactor = 1.0, VFactor = 1.0;
    opterr = 0;
    while ((flag = getopt(argc, argv, "hi:o:U:V:")) != -1) {
        switch(flag) {
            case 'i':
                inputFile = optarg;
                break;
            case 'o':
                outputFile = optarg;
                break;
            case 'U':
                UFactor = atof(optarg);
                break;
            case 'V':
                VFactor = atof(optarg);
                break;
            case 'h':
                std::cerr << "Usage: ./assign2 [-hioUV] <file-path>\n\n" <<
                             "Options:\n" <<
                             "-h\t\t Show usage string and exit\n" <<
                             "-i <file-path>\t Read input from provided file\n" <<
                             "-o <file-path>\t Write output to file\n" <<
                             "-U <factor for U>\t Block size = U (SMs) * factor for U\n" <<
                             "-V <factor for V>\t Thread size = V (Cores) * factor for V\n";
                exit(-1);
            case '?':
                if (optopt == 'i' || optopt == 'o' || optopt == 'U' || optopt == 'V') {
                    std::cerr << "Option -" << (char)optopt << " requires an argument.\n";
                } else if (isprint(optopt)) {
                    std::cerr << "Unknown option `-" << (char)optopt << "'.\n";
                } else {
                    std::cerr << "Unknown option character `\\x" << (char)optopt << "'.\n";
                }
                exit(-1);
            default:
                exit(-1);
        }
    }

    // Ensure filename was passed
    if (inputFile.empty()) {
        std::cerr << "Error: input filename required\n";
        exit(-1);
    }
    if (outputFile.empty()) {
        std::cerr << "Error: output filename required\n";
        exit(-1);
    }

    // Use API to determine U and V values
    int nDevices, U = -1, V = -1;
    hipError_t err = hipGetDeviceCount(&nDevices);
    if (err != hipSuccess) {
        std::cerr << hipGetErrorString(err) << "\n";
        exit(-1);
    } else {
        for (int i = 0; i < nDevices; i++) {
            hipDeviceProp_t prop;
            hipGetDeviceProperties(&prop, i);
            U = prop.multiProcessorCount;
            V = getSPcores(prop) / U; // Get number of cores per sm
        }
    }

    // Check values for U and V
    if (U == -1 || V == -1) {
        std::cerr << "Error: Could not fetch information on number of multiprocessors or cores\n";
        exit(-1);
    }

    // Open input file for reading
    std::ifstream ifs;
    ifs.open(inputFile, std::ios::in);
    if (!ifs.is_open()) {
        std::cerr << "Error: failed to open " << inputFile << "\n";
        exit(-1);
    }

    // Set up guard points
    Point a, b, c;
    setGuards(ifs, a, b, c);

    std::vector<Dist> data;

    while (true) {
        double da, db, dc;
        ifs >> da >> db >> dc;
        if (ifs.eof()) break;
        data.push_back(Dist(da, db, dc));
        //std::cerr << "Dist { " << da << " " << db << " " << dc << " }\n";
    }
    //std::cerr << "Size of dists: " << data.size() << "\n";
    ifs.close();

    Dist *dst;
    Point *pts;
    Point *res = new Point[data.size() / 4];
    err = hipMalloc((void **)&dst, data.size() * sizeof(Dist));
    if (err != hipSuccess) {
        std::cerr << hipGetErrorString(err) << "\n";
        exit(-1);
    }
    err = hipMalloc((void **)&pts, (data.size() / 4) * sizeof(Point));
    if (err != hipSuccess) {
        std::cerr << hipGetErrorString(err) << "\n";
        exit(-1);
    }

    err = hipMemcpy(dst, data.data(), data.size() * sizeof(Dist), hipMemcpyHostToDevice);
    if (err != hipSuccess) {
        std::cerr << hipGetErrorString(err) << "\n";
        exit(-1);
    }

    // Pass in our U and V for this run
    // std::cerr << U << ", " << UFactor << ", " << V << ", " << VFactor << "\n";
    int numBlocks = U * UFactor;
    int numThreads = V * VFactor;

    // Start timer
    hipEvent_t start, stop;
    float elapsedTime;
    hipEventCreate(&start);
    hipEventRecord(start, 0);

    FindPoint<<<numBlocks, numThreads>>>(a, b, c, dst, data.size(), pts);

    // End timer
    hipEventCreate(&stop);
    hipEventRecord(stop, 0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&elapsedTime, start, stop);
    std::cerr << "Elapsed time: " << elapsedTime << " ms\n";

    err = hipMemcpy(res, pts, (data.size() / 4) * sizeof(Point), hipMemcpyDeviceToHost);
    if (err != hipSuccess) {
        std::cerr << hipGetErrorString(err) << "\n";
        exit(-1);
    }

    std::ofstream ofs;
    ofs.open(outputFile, std::ofstream::out | std::ofstream::trunc);
    for (int i = 0; i < data.size() / 4; i++) {
        ofs << res[i] << "\n";
    }
    ofs.close();

    hipFree(dst);
    hipFree(pts);
    delete[] res;

    return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_ZlsRSoR5Point                  # -- Begin function _ZlsRSoR5Point
	.type	_ZlsRSoR5Point,@function
_ZlsRSoR5Point:                         # @_ZlsRSoR5Point
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rsi, %rbx
	movsd	(%rsi), %xmm0                   # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	8(%rbx), %xmm0                  # xmm0 = mem[0],zero
	movq	%r14, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSo9_M_insertIdEERSoT_        # TAILCALL
.Lfunc_end0:
	.size	_ZlsRSoR5Point, .Lfunc_end0-_ZlsRSoR5Point
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_ # -- Begin function _Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
	.type	_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_,@function
_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_: # @_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
	.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	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	112(%rsp), %rax
	movsd	%xmm0, (%rax)
	movsd	%xmm1, 8(%rax)
	leaq	96(%rsp), %rcx
	movsd	%xmm2, (%rcx)
	movsd	%xmm3, 8(%rcx)
	leaq	80(%rsp), %r8
	movsd	%xmm4, (%r8)
	movsd	%xmm5, 8(%r8)
	leaq	40(%rsp), %r9
	movq	%rdi, (%r9)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	128(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%r8, 16(%rbx)
	movq	%r9, 24(%rbx)
	movq	%rdi, 32(%rbx)
	movq	%rsi, 40(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%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	$_Z9FindPoint5PointS_S_PK4DistmPS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_, .Lfunc_end1-_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_ # -- Begin function _Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
	.type	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_,@function
_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_: # @_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
	.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	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	callq	_ZNSi10_M_extractIdEERSiRT_
	addq	$8, %r15
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	addq	$8, %r14
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	addq	$8, %rbx
	movq	%rax, %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	_ZNSi10_M_extractIdEERSiRT_     # TAILCALL
.Lfunc_end2:
	.size	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_, .Lfunc_end2-_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
	.cfi_endproc
                                        # -- End function
	.globl	_Z10getSPcores20hipDeviceProp_tR0600 # -- Begin function _Z10getSPcores20hipDeviceProp_tR0600
	.type	_Z10getSPcores20hipDeviceProp_tR0600,@function
_Z10getSPcores20hipDeviceProp_tR0600:   # @_Z10getSPcores20hipDeviceProp_tR0600
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	376(%rsp), %ecx
	addl	$-2, %ecx
	cmpl	$4, %ecx
	ja	.LBB3_9
# %bb.1:
	leaq	16(%rsp), %rdx
	movl	388(%rdx), %eax
	jmpq	*.LJTI3_0(,%rcx,8)
.LBB3_2:
	cmpl	$1, 364(%rdx)
	jne	.LBB3_10
# %bb.3:
	shll	$4, %eax
	jmp	.LBB3_4
.LBB3_5:
	shll	$6, %eax
.LBB3_4:
	leal	(%rax,%rax,2), %eax
	jmp	.LBB3_12
.LBB3_6:
	movl	364(%rdx), %ecx
	testl	%ecx, %ecx
	je	.LBB3_11
# %bb.7:
	cmpl	$1, %ecx
	jne	.LBB3_9
.LBB3_8:
	shll	$7, %eax
	jmp	.LBB3_12
.LBB3_9:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.1, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorl	%eax, %eax
	jmp	.LBB3_12
.LBB3_10:
	shll	$5, %eax
	jmp	.LBB3_12
.LBB3_11:
	shll	$6, %eax
.LBB3_12:
                                        # kill: def $eax killed $eax killed $rax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z10getSPcores20hipDeviceProp_tR0600, .Lfunc_end3-_Z10getSPcores20hipDeviceProp_tR0600
	.cfi_endproc
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
.LJTI3_0:
	.quad	.LBB3_2
	.quad	.LBB3_5
	.quad	.LBB3_9
	.quad	.LBB3_8
	.quad	.LBB3_6
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI4_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	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	$3656, %rsp                     # imm = 0xE48
	.cfi_def_cfa_offset 3712
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movl	%edi, %ebp
	leaq	1608(%rsp), %rcx
	movq	%rcx, -16(%rcx)
	xorl	%eax, %eax
	movq	%rax, -8(%rcx)
	movb	%al, (%rcx)
	leaq	1576(%rsp), %rcx
	movq	%rcx, -16(%rcx)
	movq	%rax, -8(%rcx)
	movb	%al, (%rcx)
	movl	$0, opterr(%rip)
	movsd	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero
	leaq	1592(%rsp), %r13
	movsd	%xmm0, 1552(%rsp)               # 8-byte Spill
.LBB4_1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_2 Depth 2
	movsd	%xmm0, 1544(%rsp)               # 8-byte Spill
.LBB4_2:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   Parent Loop BB4_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$.L.str.2, %edx
	movl	%ebp, %edi
	movq	%rbx, %rsi
	callq	getopt
	cmpl	$103, %eax
	jg	.LBB4_7
# %bb.3:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB4_2 Depth=2
	cmpl	$84, %eax
	jle	.LBB4_12
# %bb.4:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB4_2 Depth=2
	cmpl	$85, %eax
	je	.LBB4_11
# %bb.5:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB4_2 Depth=2
	cmpl	$86, %eax
	jne	.LBB4_96
# %bb.6:                                #   in Loop: Header=BB4_2 Depth=2
	movq	optarg(%rip), %rdi
	callq	atof
	movsd	%xmm0, 1552(%rsp)               # 8-byte Spill
	jmp	.LBB4_2
.LBB4_7:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB4_2 Depth=2
	movq	%r13, %r14
	cmpl	$105, %eax
	je	.LBB4_10
# %bb.8:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
                                        #   in Loop: Header=BB4_2 Depth=2
	cmpl	$111, %eax
	jne	.LBB4_85
# %bb.9:                                #   in Loop: Header=BB4_2 Depth=2
	leaq	1560(%rsp), %r14
.LBB4_10:                               # %.invoke
                                        #   in Loop: Header=BB4_2 Depth=2
	movq	optarg(%rip), %r15
	movq	8(%r14), %r12
	movq	%r15, %rdi
	callq	strlen
.Ltmp24:
	movq	%r14, %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	movq	%r15, %rcx
	movq	%rax, %r8
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
.Ltmp25:
	jmp	.LBB4_2
.LBB4_11:                               #   in Loop: Header=BB4_1 Depth=1
	movq	optarg(%rip), %rdi
	callq	atof
	jmp	.LBB4_1
.LBB4_12:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
	cmpl	$-1, %eax
	jne	.LBB4_75
# %bb.13:
	cmpq	$0, 1600(%rsp)
	je	.LBB4_94
# %bb.14:
	cmpq	$0, 1568(%rsp)
	je	.LBB4_95
# %bb.15:
.Ltmp27:
	leaq	1516(%rsp), %rdi
	callq	hipGetDeviceCount
.Ltmp28:
# %bb.16:
	testl	%eax, %eax
	jne	.LBB4_97
# %bb.17:                               # %.preheader135
	cmpl	$0, 1516(%rsp)
	jle	.LBB4_93
# %bb.18:                               # %.lr.ph
	xorl	%ebx, %ebx
	leaq	2184(%rsp), %r14
.LBB4_19:                               # =>This Inner Loop Header: Depth=1
.Ltmp35:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
.Ltmp36:
# %bb.20:                               #   in Loop: Header=BB4_19 Depth=1
	movl	2572(%rsp), %ebp
.Ltmp37:
	movl	$184, %ecx
	movq	%rsp, %rdi
	movq	%r14, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	callq	_Z10getSPcores20hipDeviceProp_tR0600
.Ltmp38:
# %bb.21:                               #   in Loop: Header=BB4_19 Depth=1
	incl	%ebx
	cmpl	1516(%rsp), %ebx
	jl	.LBB4_19
# %bb.22:
	cltd
	idivl	%ebp
	cmpl	$-1, %ebp
	je	.LBB4_93
# %bb.23:
	movl	%eax, %ebx
	cmpl	$-1, %eax
	je	.LBB4_93
# %bb.24:
.Ltmp40:
	leaq	2184(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp41:
# %bb.25:
.Ltmp43:
	leaq	2184(%rsp), %rdi
	leaq	1592(%rsp), %rsi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
.Ltmp44:
# %bb.26:
	leaq	2304(%rsp), %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB4_100
# %bb.27:
.Ltmp52:
	movl	%ebx, 1536(%rsp)                # 4-byte Spill
	leaq	2184(%rsp), %rdi
	leaq	1656(%rsp), %rsi
	leaq	1640(%rsp), %rdx
	leaq	1624(%rsp), %rcx
	callq	_Z9setGuardsRSt14basic_ifstreamIcSt11char_traitsIcEER5PointS5_S5_
.Ltmp53:
# %bb.28:
	xorpd	%xmm0, %xmm0
	leaq	1472(%rsp), %rbx
	movapd	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	leaq	2184(%rsp), %r14
	leaq	1504(%rsp), %r15
	leaq	1496(%rsp), %r12
	leaq	1520(%rsp), %r13
.LBB4_29:                               # =>This Inner Loop Header: Depth=1
.Ltmp55:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp56:
# %bb.30:                               # %_ZNSirsERd.exit
                                        #   in Loop: Header=BB4_29 Depth=1
.Ltmp57:
	movq	%rax, %rdi
	movq	%r12, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp58:
# %bb.31:                               # %_ZNSirsERd.exit110
                                        #   in Loop: Header=BB4_29 Depth=1
.Ltmp59:
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp60:
# %bb.32:                               #   in Loop: Header=BB4_29 Depth=1
	movq	2184(%rsp), %rax
	movq	-24(%rax), %rax
	testb	$2, 2216(%rsp,%rax)
	jne	.LBB4_36
# %bb.33:                               #   in Loop: Header=BB4_29 Depth=1
	movsd	1504(%rsp), %xmm0               # xmm0 = mem[0],zero
	movsd	1496(%rsp), %xmm1               # xmm1 = mem[0],zero
	movsd	1520(%rsp), %xmm2               # xmm2 = mem[0],zero
	movsd	%xmm0, 1672(%rsp)
	movsd	%xmm1, 1680(%rsp)
	movsd	%xmm2, 1688(%rsp)
	movq	1480(%rsp), %rsi
	cmpq	1488(%rsp), %rsi
	je	.LBB4_35
# %bb.34:                               #   in Loop: Header=BB4_29 Depth=1
	movq	1688(%rsp), %rax
	movq	%rax, 16(%rsi)
	movupd	1672(%rsp), %xmm0
	movupd	%xmm0, (%rsi)
	addq	$24, 1480(%rsp)
	jmp	.LBB4_29
.LBB4_35:                               #   in Loop: Header=BB4_29 Depth=1
.Ltmp140:
	movq	%rbx, %rdi
	leaq	1672(%rsp), %rdx
	callq	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
.Ltmp141:
	jmp	.LBB4_29
.LBB4_36:
.Ltmp62:
	leaq	2184(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp63:
# %bb.37:
	movq	1480(%rsp), %r14
	subq	1472(%rsp), %r14
	movq	%r14, %rax
	sarq	$3, %rax
	movabsq	$-6148914691236517205, %r12     # imm = 0xAAAAAAAAAAAAAAAB
	imulq	%r12, %rax
	movq	%rax, %rcx
	shrq	$62, %rcx
	shlq	$2, %rax
	andq	$-16, %rax
	xorl	%edi, %edi
	negq	%rcx
	sbbq	%rdi, %rdi
	orq	%rax, %rdi
.Ltmp65:
	callq	_Znam
.Ltmp66:
# %bb.38:
.Ltmp67:
	movq	%rax, %rbx
	leaq	1504(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
.Ltmp68:
# %bb.39:
	testl	%eax, %eax
	jne	.LBB4_103
# %bb.40:
	movq	1480(%rsp), %rsi
	subq	1472(%rsp), %rsi
	sarq	$3, %rsi
	movabsq	$-6148914691236517204, %r14     # imm = 0xAAAAAAAAAAAAAAAC
	imulq	%r14, %rsi
	andq	$-16, %rsi
.Ltmp75:
	leaq	1496(%rsp), %rdi
	callq	hipMalloc
.Ltmp76:
# %bb.41:
	testl	%eax, %eax
	jne	.LBB4_106
# %bb.42:
	movq	1504(%rsp), %rdi
	movq	1472(%rsp), %rsi
	movq	1480(%rsp), %rdx
	subq	%rsi, %rdx
.Ltmp83:
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp84:
# %bb.43:
	testl	%eax, %eax
	jne	.LBB4_109
# %bb.44:
.Ltmp92:
	leaq	1520(%rsp), %rdi
	callq	hipEventCreate
.Ltmp93:
# %bb.45:
	movq	1520(%rsp), %rdi
.Ltmp94:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp95:
# %bb.46:
	cvtsi2sd	%ebp, %xmm0
	movsd	1544(%rsp), %xmm1               # 8-byte Reload
                                        # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	cvttsd2si	%xmm1, %eax
	xorps	%xmm0, %xmm0
	cvtsi2sdl	1536(%rsp), %xmm0       # 4-byte Folded Reload
	movsd	1552(%rsp), %xmm1               # 8-byte Reload
                                        # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	cvttsd2si	%xmm1, %ecx
	movl	%eax, %edi
	btsq	$32, %rdi
	movl	%ecx, %edx
	btsq	$32, %rdx
.Ltmp96:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp97:
# %bb.47:
	testl	%eax, %eax
	jne	.LBB4_49
# %bb.48:
	movsd	1656(%rsp), %xmm0               # xmm0 = mem[0],zero
	movsd	1664(%rsp), %xmm1               # xmm1 = mem[0],zero
	movsd	1640(%rsp), %xmm2               # xmm2 = mem[0],zero
	movsd	1648(%rsp), %xmm3               # xmm3 = mem[0],zero
	movsd	1624(%rsp), %xmm4               # xmm4 = mem[0],zero
	movsd	1632(%rsp), %xmm5               # xmm5 = mem[0],zero
	movq	1480(%rsp), %rsi
	subq	1472(%rsp), %rsi
	movq	1504(%rsp), %rdi
	sarq	$3, %rsi
	imulq	%r12, %rsi
	movq	1496(%rsp), %rdx
.Ltmp98:
	callq	_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
.Ltmp99:
.LBB4_49:
.Ltmp100:
	leaq	1528(%rsp), %rdi
	callq	hipEventCreate
.Ltmp101:
# %bb.50:
	movq	1528(%rsp), %rdi
.Ltmp102:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp103:
# %bb.51:
	movq	1528(%rsp), %rdi
.Ltmp104:
	callq	hipEventSynchronize
.Ltmp105:
# %bb.52:
	movq	1520(%rsp), %rsi
	movq	1528(%rsp), %rdx
.Ltmp106:
	leaq	1540(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp107:
# %bb.53:
.Ltmp108:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp109:
# %bb.54:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit113
	xorps	%xmm0, %xmm0
	cvtss2sd	1540(%rsp), %xmm0
.Ltmp110:
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp111:
# %bb.55:                               # %_ZNSolsEf.exit
.Ltmp112:
	movl	$.L.str.21, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp113:
# %bb.56:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit116
	movq	1480(%rsp), %rdx
	subq	1472(%rsp), %rdx
	movq	1496(%rsp), %rsi
	sarq	$3, %rdx
	imulq	%r14, %rdx
	andq	$-16, %rdx
.Ltmp114:
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp115:
# %bb.57:
	testl	%eax, %eax
	jne	.LBB4_112
# %bb.58:
.Ltmp123:
	leaq	1672(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp124:
# %bb.59:
.Ltmp126:
	leaq	1672(%rsp), %rdi
	leaq	1560(%rsp), %rsi
	movl	$48, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
.Ltmp127:
# %bb.60:                               # %.preheader
	movq	1480(%rsp), %rax
	subq	1472(%rsp), %rax
	sarq	$3, %rax
	imulq	%r12, %rax
	cmpq	$4, %rax
	jb	.LBB4_65
# %bb.61:                               # %.lr.ph150.preheader
	xorl	%r13d, %r13d
	leaq	1672(%rsp), %r14
	movq	%rbx, %r15
.LBB4_62:                               # %.lr.ph150
                                        # =>This Inner Loop Header: Depth=1
.Ltmp128:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZlsRSoR5Point
.Ltmp129:
# %bb.63:                               #   in Loop: Header=BB4_62 Depth=1
.Ltmp130:
	movl	$.L.str.17, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp131:
# %bb.64:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit118
                                        #   in Loop: Header=BB4_62 Depth=1
	incq	%r13
	movq	1480(%rsp), %rax
	subq	1472(%rsp), %rax
	sarq	$3, %rax
	imulq	%r12, %rax
	shrq	$2, %rax
	addq	$16, %r15
	cmpq	%r13, %rax
	ja	.LBB4_62
.LBB4_65:                               # %._crit_edge151
.Ltmp133:
	leaq	1672(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp134:
# %bb.66:
	movq	1504(%rsp), %rdi
.Ltmp135:
	callq	hipFree
.Ltmp136:
# %bb.67:
	movq	1496(%rsp), %rdi
.Ltmp137:
	callq	hipFree
.Ltmp138:
# %bb.68:
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	1680(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 1672(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	1920(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	1472(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB4_70
# %bb.69:
	callq	_ZdlPv
.LBB4_70:                               # %_ZNSt6vectorI4DistSaIS0_EED2Ev.exit
	leaq	2184(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	1560(%rsp), %rdi
	leaq	1576(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_72
# %bb.71:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB4_72:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	1592(%rsp), %rdi
	leaq	1608(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_74
# %bb.73:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i119
	callq	_ZdlPv
.LBB4_74:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit121
	xorl	%eax, %eax
	addq	$3656, %rsp                     # imm = 0xE48
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB4_75:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
	.cfi_def_cfa_offset 3712
	cmpl	$63, %eax
	jne	.LBB4_96
# %bb.76:
	movl	optopt(%rip), %edi
	leal	-85(%rdi), %eax
	cmpl	$26, %eax
	ja	.LBB4_82
# %bb.77:
	movl	$68157443, %ecx                 # imm = 0x4100003
	btl	%eax, %ecx
	jae	.LBB4_82
# %bb.78:
.Ltmp0:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp1:
# %bb.79:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit106
	movsbl	optopt(%rip), %esi
.Ltmp2:
	movl	$_ZSt4cerr, %edi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c
.Ltmp3:
# %bb.80:
	movl	$.L.str.11, %esi
.LBB4_81:                               # %.invoke175
.Ltmp8:
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp9:
	jmp	.LBB4_96
.LBB4_82:                               # %.invoke178
                                        # kill: def $edi killed $edi killed $rdi
	callq	isprint
	testl	%eax, %eax
	movl	$.L.str.14, %eax
	movl	$.L.str.12, %esi
	cmoveq	%rax, %rsi
	movl	$28, %eax
	movl	$17, %edx
	cmoveq	%rax, %rdx
.Ltmp4:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp5:
# %bb.83:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit107.invoke
	movsbl	optopt(%rip), %esi
.Ltmp6:
	movl	$_ZSt4cerr, %edi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c
.Ltmp7:
# %bb.84:
	movl	$.L.str.13, %esi
	jmp	.LBB4_81
.LBB4_85:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc.exit
	cmpl	$104, %eax
	jne	.LBB4_96
# %bb.86:
.Ltmp10:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.3, %esi
	movl	$39, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp11:
# %bb.87:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp12:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.4, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp13:
# %bb.88:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit101
.Ltmp14:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.5, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp15:
# %bb.89:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit102
.Ltmp16:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.6, %esi
	movl	$46, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp17:
# %bb.90:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit103
.Ltmp18:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.7, %esi
	movl	$37, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp19:
# %bb.91:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit104
.Ltmp20:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.8, %esi
	movl	$55, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp21:
# %bb.92:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit105
.Ltmp22:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.9, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp23:
	jmp	.LBB4_96
.LBB4_93:                               # %.thread
.Ltmp143:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.18, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp144:
	jmp	.LBB4_96
.LBB4_94:
.Ltmp148:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.15, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp149:
	jmp	.LBB4_96
.LBB4_95:
.Ltmp146:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.16, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp147:
.LBB4_96:
	movl	$-1, %edi
	callq	exit
.LBB4_97:
.Ltmp29:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp30:
# %bb.98:
.Ltmp31:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp32:
# %bb.99:
.Ltmp33:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp34:
	jmp	.LBB4_96
.LBB4_100:
.Ltmp45:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.19, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp46:
# %bb.101:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit109
	movq	1592(%rsp), %rsi
	movq	1600(%rsp), %rdx
.Ltmp47:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp48:
# %bb.102:                              # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp49:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp50:
	jmp	.LBB4_96
.LBB4_103:
.Ltmp69:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp70:
# %bb.104:
.Ltmp71:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp72:
# %bb.105:
.Ltmp73:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp74:
	jmp	.LBB4_96
.LBB4_106:
.Ltmp77:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp78:
# %bb.107:
.Ltmp79:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp80:
# %bb.108:
.Ltmp81:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp82:
	jmp	.LBB4_96
.LBB4_109:
.Ltmp85:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp86:
# %bb.110:
.Ltmp87:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp88:
# %bb.111:
.Ltmp89:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp90:
	jmp	.LBB4_96
.LBB4_112:
.Ltmp116:
	movl	%eax, %edi
	callq	hipGetErrorString
.Ltmp117:
# %bb.113:
.Ltmp118:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp119:
# %bb.114:
.Ltmp120:
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp121:
	jmp	.LBB4_96
.LBB4_115:
.Ltmp125:
	jmp	.LBB4_133
.LBB4_116:
.Ltmp64:
	jmp	.LBB4_133
.LBB4_117:
.Ltmp54:
	jmp	.LBB4_120
.LBB4_118:
.Ltmp42:
	jmp	.LBB4_131
.LBB4_119:
.Ltmp51:
.LBB4_120:
	movq	%rax, %rbx
	jmp	.LBB4_136
.LBB4_121:                              # %.loopexit
.Ltmp26:
	jmp	.LBB4_131
.LBB4_122:
.Ltmp145:
	jmp	.LBB4_131
.LBB4_123:
.Ltmp139:
	jmp	.LBB4_129
.LBB4_124:
.Ltmp91:
	jmp	.LBB4_133
.LBB4_125:
.Ltmp142:
	jmp	.LBB4_133
.LBB4_126:
.Ltmp122:
	jmp	.LBB4_133
.LBB4_127:                              # %.loopexit.split-lp
.Ltmp150:
	jmp	.LBB4_131
.LBB4_128:
.Ltmp132:
.LBB4_129:
	movq	%rax, %rbx
	leaq	1672(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	jmp	.LBB4_134
.LBB4_130:
.Ltmp39:
.LBB4_131:
	movq	%rax, %rbx
	jmp	.LBB4_137
.LBB4_132:
.Ltmp61:
.LBB4_133:
	movq	%rax, %rbx
.LBB4_134:
	movq	1472(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB4_136
# %bb.135:
	callq	_ZdlPv
.LBB4_136:
	leaq	2184(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB4_137:
	leaq	1576(%rsp), %rax
	movq	1560(%rsp), %rdi
	cmpq	%rax, %rdi
	je	.LBB4_139
# %bb.138:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i124
	callq	_ZdlPv
.LBB4_139:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit126
	movq	1592(%rsp), %rdi
	leaq	1608(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_141
# %bb.140:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i127
	callq	_ZdlPv
.LBB4_141:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit129
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.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 .Ltmp24-.Lfunc_begin0          # >> Call Site 1 <<
	.uleb128 .Ltmp25-.Ltmp24                #   Call between .Ltmp24 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin0          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin0          # >> Call Site 2 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp145-.Lfunc_begin0         #     jumps to .Ltmp145
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp38-.Ltmp35                #   Call between .Ltmp35 and .Ltmp38
	.uleb128 .Ltmp39-.Lfunc_begin0          #     jumps to .Ltmp39
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp40-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp41-.Ltmp40                #   Call between .Ltmp40 and .Ltmp41
	.uleb128 .Ltmp42-.Lfunc_begin0          #     jumps to .Ltmp42
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp43-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp44-.Ltmp43                #   Call between .Ltmp43 and .Ltmp44
	.uleb128 .Ltmp51-.Lfunc_begin0          #     jumps to .Ltmp51
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp52-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp53-.Ltmp52                #   Call between .Ltmp52 and .Ltmp53
	.uleb128 .Ltmp54-.Lfunc_begin0          #     jumps to .Ltmp54
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp55-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp60-.Ltmp55                #   Call between .Ltmp55 and .Ltmp60
	.uleb128 .Ltmp61-.Lfunc_begin0          #     jumps to .Ltmp61
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp140-.Lfunc_begin0         # >> Call Site 8 <<
	.uleb128 .Ltmp141-.Ltmp140              #   Call between .Ltmp140 and .Ltmp141
	.uleb128 .Ltmp142-.Lfunc_begin0         #     jumps to .Ltmp142
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp62-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp63-.Ltmp62                #   Call between .Ltmp62 and .Ltmp63
	.uleb128 .Ltmp64-.Lfunc_begin0          #     jumps to .Ltmp64
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp84-.Ltmp65                #   Call between .Ltmp65 and .Ltmp84
	.uleb128 .Ltmp91-.Lfunc_begin0          #     jumps to .Ltmp91
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp92-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp115-.Ltmp92               #   Call between .Ltmp92 and .Ltmp115
	.uleb128 .Ltmp122-.Lfunc_begin0         #     jumps to .Ltmp122
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp123-.Lfunc_begin0         # >> Call Site 12 <<
	.uleb128 .Ltmp124-.Ltmp123              #   Call between .Ltmp123 and .Ltmp124
	.uleb128 .Ltmp125-.Lfunc_begin0         #     jumps to .Ltmp125
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp126-.Lfunc_begin0         # >> Call Site 13 <<
	.uleb128 .Ltmp127-.Ltmp126              #   Call between .Ltmp126 and .Ltmp127
	.uleb128 .Ltmp139-.Lfunc_begin0         #     jumps to .Ltmp139
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp128-.Lfunc_begin0         # >> Call Site 14 <<
	.uleb128 .Ltmp131-.Ltmp128              #   Call between .Ltmp128 and .Ltmp131
	.uleb128 .Ltmp132-.Lfunc_begin0         #     jumps to .Ltmp132
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp133-.Lfunc_begin0         # >> Call Site 15 <<
	.uleb128 .Ltmp138-.Ltmp133              #   Call between .Ltmp133 and .Ltmp138
	.uleb128 .Ltmp139-.Lfunc_begin0         #     jumps to .Ltmp139
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 16 <<
	.uleb128 .Ltmp23-.Ltmp0                 #   Call between .Ltmp0 and .Ltmp23
	.uleb128 .Ltmp150-.Lfunc_begin0         #     jumps to .Ltmp150
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp143-.Lfunc_begin0         # >> Call Site 17 <<
	.uleb128 .Ltmp144-.Ltmp143              #   Call between .Ltmp143 and .Ltmp144
	.uleb128 .Ltmp145-.Lfunc_begin0         #     jumps to .Ltmp145
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp148-.Lfunc_begin0         # >> Call Site 18 <<
	.uleb128 .Ltmp147-.Ltmp148              #   Call between .Ltmp148 and .Ltmp147
	.uleb128 .Ltmp150-.Lfunc_begin0         #     jumps to .Ltmp150
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin0          # >> Call Site 19 <<
	.uleb128 .Ltmp34-.Ltmp29                #   Call between .Ltmp29 and .Ltmp34
	.uleb128 .Ltmp145-.Lfunc_begin0         #     jumps to .Ltmp145
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp45-.Lfunc_begin0          # >> Call Site 20 <<
	.uleb128 .Ltmp50-.Ltmp45                #   Call between .Ltmp45 and .Ltmp50
	.uleb128 .Ltmp51-.Lfunc_begin0          #     jumps to .Ltmp51
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp69-.Lfunc_begin0          # >> Call Site 21 <<
	.uleb128 .Ltmp90-.Ltmp69                #   Call between .Ltmp69 and .Ltmp90
	.uleb128 .Ltmp91-.Lfunc_begin0          #     jumps to .Ltmp91
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp116-.Lfunc_begin0         # >> Call Site 22 <<
	.uleb128 .Ltmp121-.Ltmp116              #   Call between .Ltmp116 and .Ltmp121
	.uleb128 .Ltmp122-.Lfunc_begin0         #     jumps to .Ltmp122
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp121-.Lfunc_begin0         # >> Call Site 23 <<
	.uleb128 .Lfunc_end4-.Ltmp121           #   Call between .Ltmp121 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_,"axG",@progbits,_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_,comdat
	.weak	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_ # -- Begin function _ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_,@function
_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_: # @_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, 8(%rsp)                   # 8-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.22, %edx
	callq	_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc
	movq	%rax, %rsi
	movq	(%rbx), %r12
	movq	8(%rbx), %r14
	movq	%r15, %rax
	subq	%r12, %rax
	sarq	$3, %rax
	movabsq	$-6148914691236517205, %rbp     # imm = 0xAAAAAAAAAAAAAAAB
	imulq	%rax, %rbp
	testq	%rsi, %rsi
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	je	.LBB5_1
# %bb.2:
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorI4DistE8allocateEmPKv
	movq	%rax, %r13
	jmp	.LBB5_3
.LBB5_1:
	xorl	%r13d, %r13d
.LBB5_3:                                # %_ZNSt12_Vector_baseI4DistSaIS0_EE11_M_allocateEm.exit
	leaq	(,%rbp,2), %rax
	addq	%rbp, %rax
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movq	16(%rdx), %rcx
	movq	%rcx, 16(%r13,%rax,8)
	movups	(%rdx), %xmm0
	movups	%xmm0, (%r13,%rax,8)
	movq	%r13, %rbp
	cmpq	%r15, %r12
	je	.LBB5_6
# %bb.4:                                # %.lr.ph.i.i.i.preheader
	movq	%r13, %rbp
	movq	%r12, %rax
.LBB5_5:                                # %.lr.ph.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movq	16(%rax), %rcx
	movq	%rcx, 16(%rbp)
	movups	(%rax), %xmm0
	movups	%xmm0, (%rbp)
	addq	$24, %rax
	addq	$24, %rbp
	cmpq	%r15, %rax
	jne	.LBB5_5
.LBB5_6:                                # %_ZNSt6vectorI4DistSaIS0_EE11_S_relocateEPS0_S3_S3_RS1_.exit
	addq	$24, %rbp
	cmpq	%r15, %r14
	je	.LBB5_8
.LBB5_7:                                # %.lr.ph.i.i.i17
                                        # =>This Inner Loop Header: Depth=1
	movq	16(%r15), %rax
	movq	%rax, 16(%rbp)
	movups	(%r15), %xmm0
	movups	%xmm0, (%rbp)
	addq	$24, %r15
	addq	$24, %rbp
	cmpq	%r14, %r15
	jne	.LBB5_7
.LBB5_8:                                # %_ZNSt6vectorI4DistSaIS0_EE11_S_relocateEPS0_S3_S3_RS1_.exit22
	testq	%r12, %r12
	je	.LBB5_10
# %bb.9:
	movq	%r12, %rdi
	callq	_ZdlPv
.LBB5_10:                               # %_ZNSt12_Vector_baseI4DistSaIS0_EE13_M_deallocateEPS0_m.exit
	movq	%r13, (%rbx)
	movq	%rbp, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%rax,2), %rax
	leaq	(,%rax,8), %rax
	addq	%r13, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_, .Lfunc_end5-_ZNSt6vectorI4DistSaIS0_EE17_M_realloc_insertIJS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc,@function
_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc: # @_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$384307168202282325, %rcx       # imm = 0x555555555555555
	movq	8(%rdi), %rax
	subq	(%rdi), %rax
	sarq	$3, %rax
	movabsq	$-6148914691236517205, %rdi     # imm = 0xAAAAAAAAAAAAAAAB
	imulq	%rax, %rdi
	movq	%rcx, %rax
	subq	%rdi, %rax
	cmpq	%rsi, %rax
	jb	.LBB6_2
# %bb.1:
	cmpq	%rsi, %rdi
	cmovaq	%rdi, %rsi
	leaq	(%rsi,%rdi), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%rdi, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB6_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end6:
	.size	_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc, .Lfunc_end6-_ZNKSt6vectorI4DistSaIS0_EE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorI4DistE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorI4DistE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorI4DistE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorI4DistE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorI4DistE8allocateEmPKv,@function
_ZNSt15__new_allocatorI4DistE8allocateEmPKv: # @_ZNSt15__new_allocatorI4DistE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movabsq	$384307168202282326, %rax       # imm = 0x555555555555556
	cmpq	%rax, %rsi
	jae	.LBB7_1
# %bb.3:
	shlq	$3, %rsi
	leaq	(%rsi,%rsi,2), %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB7_1:
	.cfi_def_cfa_offset 16
	movabsq	$768614336404564651, %rax       # imm = 0xAAAAAAAAAAAAAAB
	cmpq	%rax, %rsi
	jb	.LBB7_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB7_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end7:
	.size	_ZNSt15__new_allocatorI4DistE8allocateEmPKv, .Lfunc_end7-_ZNSt15__new_allocatorI4DistE8allocateEmPKv
	.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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9FindPoint5PointS_S_PK4DistmPS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	" "
	.size	.L.str, 2

	.type	_Z9FindPoint5PointS_S_PK4DistmPS_,@object # @_Z9FindPoint5PointS_S_PK4DistmPS_
	.section	.rodata,"a",@progbits
	.globl	_Z9FindPoint5PointS_S_PK4DistmPS_
	.p2align	3, 0x0
_Z9FindPoint5PointS_S_PK4DistmPS_:
	.quad	_Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
	.size	_Z9FindPoint5PointS_S_PK4DistmPS_, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"Unknown device type\n"
	.size	.L.str.1, 21

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"hi:o:U:V:"
	.size	.L.str.2, 10

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Usage: ./assign2 [-hioUV] <file-path>\n\n"
	.size	.L.str.3, 40

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Options:\n"
	.size	.L.str.4, 10

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"-h\t\t Show usage string and exit\n"
	.size	.L.str.5, 33

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"-i <file-path>\t Read input from provided file\n"
	.size	.L.str.6, 47

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"-o <file-path>\t Write output to file\n"
	.size	.L.str.7, 38

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"-U <factor for U>\t Block size = U (SMs) * factor for U\n"
	.size	.L.str.8, 56

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"-V <factor for V>\t Thread size = V (Cores) * factor for V\n"
	.size	.L.str.9, 59

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

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	" requires an argument.\n"
	.size	.L.str.11, 24

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Unknown option `-"
	.size	.L.str.12, 18

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"'.\n"
	.size	.L.str.13, 4

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Unknown option character `\\x"
	.size	.L.str.14, 29

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Error: input filename required\n"
	.size	.L.str.15, 32

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Error: output filename required\n"
	.size	.L.str.16, 33

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

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Error: Could not fetch information on number of multiprocessors or cores\n"
	.size	.L.str.18, 74

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Error: failed to open "
	.size	.L.str.19, 23

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Elapsed time: "
	.size	.L.str.20, 15

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	" ms\n"
	.size	.L.str.21, 5

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"vector::_M_realloc_insert"
	.size	.L.str.22, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9FindPoint5PointS_S_PK4DistmPS_"
	.size	.L__unnamed_1, 34

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

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z24__device_stub__FindPoint5PointS_S_PK4DistmPS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z9FindPoint5PointS_S_PK4DistmPS_
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9FindPoint5PointS_S_PK4DistmPS_ ; -- Begin function _Z9FindPoint5PointS_S_PK4DistmPS_
	.globl	_Z9FindPoint5PointS_S_PK4DistmPS_
	.p2align	8
	.type	_Z9FindPoint5PointS_S_PK4DistmPS_,@function
_Z9FindPoint5PointS_S_PK4DistmPS_:      ; @_Z9FindPoint5PointS_S_PK4DistmPS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x54
	s_load_b128 s[4:7], s[0:1], 0x30
	s_add_u32 s2, s0, 0x48
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s10, s8, 0xffff
	s_mov_b32 s8, exec_lo
	v_mad_u64_u32 v[4:5], null, s15, s10, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v5, 31, v4
	v_cmpx_gt_u64_e64 s[6:7], v[4:5]
	s_cbranch_execz .LBB0_11
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b256 s[12:19], s[0:1], 0x0
	s_load_b128 s[20:23], s[0:1], 0x20
	s_load_b32 s2, s[2:3], 0x0
	s_load_b64 s[8:9], s[0:1], 0x40
	v_and_b32_e32 v30, 3, v0
	v_lshlrev_b32_e32 v31, 4, v0
	s_mov_b32 s3, 0
	s_delay_alu instid0(VALU_DEP_2)
	v_cmp_eq_u32_e64 s0, 0, v30
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[1:2], s[16:17], s[16:17]
	v_add_f64 v[10:11], s[18:19], s[18:19]
	v_mul_f64 v[14:15], s[16:17], s[16:17]
	v_mul_f64 v[16:17], s[20:21], s[20:21]
	v_mul_f64 v[18:19], s[18:19], s[18:19]
	v_mul_f64 v[20:21], s[22:23], s[22:23]
	v_mul_f64 v[22:23], s[12:13], s[12:13]
	v_mul_f64 v[24:25], s[14:15], s[14:15]
	s_mul_i32 s10, s2, s10
	v_fma_f64 v[6:7], s[12:13], -2.0, v[1:2]
	v_fma_f64 v[8:9], s[22:23], 2.0, -v[10:11]
	v_fma_f64 v[10:11], s[14:15], -2.0, v[10:11]
	v_fma_f64 v[12:13], s[20:21], 2.0, -v[1:2]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[1:2], v[6:7], v[8:9]
	v_mul_f64 v[32:33], v[10:11], v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f64 v[26:27], -v[10:11], v[12:13], v[1:2]
	v_fma_f64 v[28:29], v[10:11], v[12:13], -v[1:2]
	v_cmp_neq_f64_e64 s1, v[1:2], v[32:33]
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	v_mov_b32_e32 v0, 0
	v_mov_b32_e32 v1, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 vcc_lo, exec_lo, s1
	v_dual_mov_b32 v3, v1 :: v_dual_mov_b32 v2, v0
	s_cbranch_vccnz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	v_mad_u64_u32 v[32:33], null, v4, 24, s[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mov_b32_e32 v0, v33
	v_mad_u64_u32 v[1:2], null, v5, 24, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v33, v1
	s_clause 0x1
	global_load_b128 v[0:3], v[32:33], off
	global_load_b64 v[32:33], v[32:33], off offset:16
	s_waitcnt vmcnt(1)
	v_mul_f64 v[2:3], v[2:3], v[2:3]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[32:33], -v[32:33], v[32:33], v[2:3]
	v_fma_f64 v[0:1], v[0:1], v[0:1], -v[2:3]
	v_add_f64 v[2:3], v[32:33], -v[14:15]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[0:1], v[0:1], -v[22:23]
	v_add_f64 v[2:3], v[16:17], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[0:1], v[14:15], v[0:1]
	v_add_f64 v[2:3], v[2:3], -v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[0:1], v[0:1], -v[24:25]
	v_add_f64 v[2:3], v[20:21], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[0:1], v[18:19], v[0:1]
	v_mul_f64 v[32:33], v[10:11], v[2:3]
	v_mul_f64 v[2:3], v[6:7], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[32:33], v[8:9], v[0:1], -v[32:33]
	v_fma_f64 v[2:3], v[12:13], v[0:1], -v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[0:1], null, v[26:27], v[26:27], v[32:33]
	v_div_scale_f64 v[34:35], null, v[28:29], v[28:29], v[2:3]
	v_div_scale_f64 v[44:45], vcc_lo, v[32:33], v[26:27], v[32:33]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rcp_f64_e32 v[36:37], v[0:1]
	v_rcp_f64_e32 v[38:39], v[34:35]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[40:41], -v[0:1], v[36:37], 1.0
	v_fma_f64 v[42:43], -v[34:35], v[38:39], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[36:37], v[36:37], v[40:41], v[36:37]
	v_fma_f64 v[38:39], v[38:39], v[42:43], v[38:39]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[40:41], -v[0:1], v[36:37], 1.0
	v_fma_f64 v[42:43], -v[34:35], v[38:39], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f64 v[36:37], v[36:37], v[40:41], v[36:37]
	v_div_scale_f64 v[40:41], s2, v[2:3], v[28:29], v[2:3]
	v_fma_f64 v[38:39], v[38:39], v[42:43], v[38:39]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[42:43], v[44:45], v[36:37]
	v_mul_f64 v[46:47], v[40:41], v[38:39]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[0:1], -v[0:1], v[42:43], v[44:45]
	v_fma_f64 v[34:35], -v[34:35], v[46:47], v[40:41]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f64 v[0:1], v[0:1], v[36:37], v[42:43]
	s_mov_b32 vcc_lo, s2
	v_div_fmas_f64 v[34:35], v[34:35], v[38:39], v[46:47]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[0:1], v[0:1], v[26:27], v[32:33]
	v_div_fixup_f64 v[2:3], v[34:35], v[28:29], v[2:3]
.LBB0_4:                                ; %_Z11TrilaterateRK5PointS1_S1_RK4Dist.exit
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_mov_b32 s2, 2
	ds_store_b128 v31, v[0:3]
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB0_5:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_mov_b32 s11, exec_lo
	v_cmpx_gt_u32_e64 s2, v30
	s_cbranch_execz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	v_lshl_add_u32 v0, s2, 4, v31
	ds_load_b128 v[0:3], v0
	ds_load_b128 v[32:35], v31
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[0:1], v[0:1], v[32:33]
	v_add_f64 v[2:3], v[2:3], v[34:35]
	ds_store_b128 v31, v[0:3]
.LBB0_7:                                ;   in Loop: Header=BB0_5 Depth=2
	s_or_b32 exec_lo, exec_lo, s11
	s_lshr_b32 s11, s2, 1
	s_cmp_lt_u32 s2, 2
	s_mov_b32 s2, s11
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	s_and_saveexec_b32 s2, s0
	s_cbranch_execz .LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_2 Depth=1
	ds_load_b128 v[0:3], v31
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v5, 30, v5
	v_add_nc_u32_e32 v5, v4, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v32, 2, v5
	s_waitcnt lgkmcnt(0)
	v_ldexp_f64 v[0:1], v[0:1], -2
	v_ldexp_f64 v[2:3], v[2:3], -2
	v_ashrrev_i32_e32 v33, 31, v32
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[32:33], 4, v[32:33]
	v_add_co_u32 v32, vcc_lo, s8, v32
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v33, vcc_lo, s9, v33, vcc_lo
	ds_store_b128 v31, v[0:3]
	global_store_b128 v[32:33], v[0:3], off
.LBB0_10:                               ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	v_add_nc_u32_e32 v4, s10, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v5, 31, v4
	v_cmp_le_u64_e32 vcc_lo, s[6:7], v[4:5]
	s_or_b32 s3, vcc_lo, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB0_2
.LBB0_11:                               ; %Flow48
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9FindPoint5PointS_S_PK4DistmPS_
		.amdhsa_group_segment_fixed_size 1536
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 328
		.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 48
		.amdhsa_next_free_sgpr 24
		.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	_Z9FindPoint5PointS_S_PK4DistmPS_, .Lfunc_end0-_Z9FindPoint5PointS_S_PK4DistmPS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1024
; NumSgprs: 26
; NumVgprs: 48
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 1536 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 5
; NumSGPRsForWavesPerEU: 26
; NumVGPRsForWavesPerEU: 48
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           16
        .value_kind:     by_value
      - .offset:         16
        .size:           16
        .value_kind:     by_value
      - .offset:         32
        .size:           16
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           8
        .value_kind:     by_value
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         76
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         84
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         86
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         88
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         90
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         92
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         94
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         136
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 1536
    .kernarg_segment_align: 8
    .kernarg_segment_size: 328
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9FindPoint5PointS_S_PK4DistmPS_
    .private_segment_fixed_size: 0
    .sgpr_count:     26
    .sgpr_spill_count: 0
    .symbol:         _Z9FindPoint5PointS_S_PK4DistmPS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     48
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
