#include <bits/stdc++.h>

using namespace std;

const int MAXX = 1e8;


#define CSC(call)                            \
do {                                \
  cudaError_t res = call;                      \
  if (res != cudaSuccess) {                    \
    fprintf(stderr, "ERROR in %s:%d. Message: %s\n",      \
        __FILE__, __LINE__, cudaGetErrorString(res));    \
    exit(0);                          \
  }                                \
} while(0)


struct pnt {
    int x, y;
};



int main() {


    int w, h;
    char inputFile[256], outputFile[256];
    cin >> inputFile >> outputFile;

    FILE *fp = fopen(inputFile, "rb");
    fread(&w, sizeof(int), 1, fp);
    fread(&h, sizeof(int), 1, fp);

    uchar4 *data = (uchar4 *) malloc(sizeof(uchar4) * w * h);
    fread(data, sizeof(uchar4), w * h, fp);
    fclose(fp);

    int nc, np;
    cin >> nc;
    vector<vector<pnt>> classes(nc);
    int4 avg[32];
    double cov[32][3][3];
    double cov_inv[32][3][3];
    double dets[32];
    for (int i = 0; i < nc; ++i) {
        cin >> np;
        classes[i].resize(np);
            // input + counting averages
        for (int j = 0; j < np; ++j) {
            cin >> classes[i][j].x >> classes[i][j].y;
            uchar4 ps = data[classes[i][j].y * w + classes[i][j].x];
            avg[i].x += ps.x;
            avg[i].y += ps.y;
            avg[i].z += ps.z;
        }
        avg[i].x /= np;
        avg[i].y /= np;
        avg[i].z /= np;

        // counting cov
        for (int j = 0; j < np; ++j) {
            uchar4 ps = data[classes[i][j].y * w + classes[i][j].x];


            int diff[3];
            diff[0] = ps.x - avg[i].x;
            diff[1] = ps.y - avg[i].y;
            diff[2] = ps.z - avg[i].z;

            for (int k = 0; k < 3; ++k) {
                for (int m = 0; m < 3; ++m) {
                    cov[i][k][m] += diff[k] * diff[m];
                }
            }
        }
        for (int k = 0; k < 3; ++k) {
            for (int m = 0; m < 3; ++m) {
                cov[i][k][m] /= (np - 1);
            }
        }

        // counting cov_inverse + determinants
        double det = cov[i][0][0] * (cov[i][1][1] * cov[i][2][2] - cov[i][2][1] * cov[i][1][2])
                     - cov[i][0][1] * (cov[i][1][0] * cov[i][2][2] - cov[i][2][0] * cov[i][1][2])
                     + cov[i][0][2] * (cov[i][1][0] * cov[i][2][1] - cov[i][2][0] * cov[i][1][1]);


        cov_inv[i][0][0] = (cov[i][1][1] * cov[i][2][2] - cov[i][2][1] * cov[i][1][2]) / det;
        cov_inv[i][1][0] = -(cov[i][1][0] * cov[i][2][2] - cov[i][2][0] * cov[i][1][2]) / det;
        cov_inv[i][2][0] = (cov[i][1][0] * cov[i][2][1] - cov[i][2][0] * cov[i][1][1]) / det;

        cov_inv[i][0][1] = -(cov[i][0][1] * cov[i][2][2] - cov[i][2][1] * cov[i][0][2]) / det;
        cov_inv[i][1][1] = (cov[i][0][0] * cov[i][2][2] - cov[i][2][0] * cov[i][0][2]) / det;
        cov_inv[i][2][1] = -(cov[i][0][0] * cov[i][2][1] - cov[i][2][0] * cov[i][0][1]) / det;

        cov_inv[i][0][2] = (cov[i][0][1] * cov[i][1][2] - cov[i][1][1] * cov[i][0][2]) / det;
        cov_inv[i][1][2] = -(cov[i][0][0] * cov[i][1][2] - cov[i][1][0] * cov[i][0][2]) / det;
        cov_inv[i][2][2] = (cov[i][0][0] * cov[i][1][1] - cov[i][1][0] * cov[i][0][1]) / det;

        dets[i] = det;
    }


    cudaEvent_t start, stop;
    float time;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);
    cudaEventRecord(start, 0);

    for (int y = 0; y < h; ++y){
        for (int x = 0; x < w; ++x){
            uchar4 ps = data[y * w + x];

            double mx = -MAXX;
            int idx = -1;
            for (int i = 0; i < nc; ++i){

                int diff[3];
                diff[0] = ps.x - avg[i].x;
                diff[1] = ps.y - avg[i].y;
                diff[2] = ps.z - avg[i].z;

                double tmp[3];
                for(int j = 0; j < 3; ++j){
                    tmp[j] = 0;
                    for(int k = 0; k < 3; ++k){
                        tmp[j] += (diff[k] * cov_inv[i][k][j]);
                    }
                }
                double ans = 0;
                for(int j = 0; j < 3; ++j){
                    ans += (tmp[j] * diff[j]);
                }
                ans = -ans - log(abs(dets[i]));

                if(ans > mx){
                    mx = ans;
                    idx = i;
                }
            }

            data[y * w + x].w = idx;
        }
    }

    cudaEventRecord(stop, 0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&time, start, stop);
    fprintf(stderr, "%.2f\n", time);
    cudaEventDestroy(stop);
    cudaEventDestroy(start);


    fp = fopen(outputFile, "wb");
    fwrite(&w, sizeof(int), 1, fp);
    fwrite(&h, sizeof(int), 1, fp);
    fwrite(data, sizeof(uchar4), w * h, fp);
    fclose(fp);

    free(data);
    return 0;
}

	.file	"tmpxft_00383e7f_00000000-6_cpu.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB10828:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE10828:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB10851:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE10851:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_,"axG",@progbits,_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_,comdat
	.weak	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_
	.type	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_, @function
_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_:
.LFB11530:
	.cfi_startproc
	endbr64
	movabsq	$9223372036854775807, %rdx
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	_ZSt17__istream_extractRSiPcl@PLT
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE11530:
	.size	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_, .-_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_
	.section	.text._ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev,"axG",@progbits,_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.type	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev, @function
_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev:
.LFB11541:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %r12
	movq	%rdi, %rbx
	movq	(%rdi), %rbp
.L7:
	cmpq	%rbp, %r12
	je	.L16
	movq	0(%rbp), %rdi
	testq	%rdi, %rdi
	je	.L8
	movq	16(%rbp), %rsi
	subq	%rdi, %rsi
	call	_ZdlPvm@PLT
.L8:
	addq	$24, %rbp
	jmp	.L7
.L16:
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	.L6
	movq	16(%rbx), %rsi
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	subq	%rdi, %rsi
	jmp	_ZdlPvm@PLT
.L6:
	.cfi_restore_state
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE11541:
	.size	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev, .-_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.weak	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED1Ev
	.set	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED1Ev,_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.section	.text._ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_,"axG",@progbits,_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_,comdat
	.weak	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_
	.type	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_, @function
_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_:
.LFB12467:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	je	.L17
	xorl	%eax, %eax
	movq	%rax, (%rdi)
	leaq	8(%rdi), %rax
	decq	%rsi
	je	.L17
	leaq	(%rax,%rsi,8), %rdx
	movq	%rax, %rcx
.L19:
	cmpq	%rcx, %rdx
	je	.L26
	movq	(%rdi), %rsi
	addq	$8, %rcx
	movq	%rsi, -8(%rcx)
	jmp	.L19
.L26:
	subq	%rdi, %rdx
	leaq	-8(%rax,%rdx), %rax
.L17:
	ret
	.cfi_endproc
.LFE12467:
	.size	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_, .-_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_
	.section	.rodata._ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm.str1.1,"aMS",@progbits,1
.LC0:
	.string	"vector::_M_default_append"
	.section	.text._ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm,"axG",@progbits,_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm,comdat
	.align 2
	.weak	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	.type	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm, @function
_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm:
.LFB11975:
	.cfi_startproc
	endbr64
	testq	%rsi, %rsi
	je	.L41
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rdi
	movq	16(%rbp), %rax
	movq	0(%rbp), %r13
	subq	%rdi, %rax
	sarq	$3, %rax
	cmpq	%rsi, %rax
	jb	.L29
	call	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_
	movq	%rax, 8(%rbp)
	jmp	.L27
.L29:
	movabsq	$1152921504606846975, %rax
	movq	%rdi, %rdx
	subq	%r13, %rdx
	movq	%rdx, %r15
	sarq	$3, %r15
	subq	%r15, %rax
	cmpq	%rsi, %rax
	jnb	.L30
	leaq	.LC0(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L30:
	cmpq	%r15, %rsi
	movq	%r15, %r14
	movq	%rdx, 8(%rsp)
	movabsq	$1152921504606846975, %rax
	cmovnb	%rsi, %r14
	addq	%r15, %r14
	cmpq	%rax, %r14
	cmova	%rax, %r14
	salq	$3, %r14
	movq	%r14, %rdi
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rbx, %rsi
	movq	%rax, %r12
	leaq	(%rax,%rdx), %rdi
	call	_ZNSt27__uninitialized_default_n_1ILb1EE18__uninit_default_nIP3pntmEET_S4_T0_
	movq	8(%rsp), %rdx
	testq	%rdx, %rdx
	je	.L31
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
	jmp	.L32
.L31:
	testq	%r13, %r13
	je	.L33
.L32:
	movq	16(%rbp), %rsi
	movq	%r13, %rdi
	subq	%r13, %rsi
	call	_ZdlPvm@PLT
.L33:
	addq	%r15, %rbx
	movq	%r12, 0(%rbp)
	leaq	(%r12,%rbx,8), %rax
	addq	%r14, %r12
	movq	%rax, 8(%rbp)
	movq	%r12, 16(%rbp)
.L27:
	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
.L41:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE11975:
	.size	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm, .-_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"rb"
.LC4:
	.string	"cannot create std::vector larger than max_size()"
.LC7:
	.string	"%.2f\n"
.LC8:
	.string	"wb"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB10825:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA10825
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$1992, %rsp
	.cfi_def_cfa_offset 6144
	leaq	_ZSt3cin(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 6072(%rsp)
	xorl	%eax, %eax
	leaq	5560(%rsp), %rbx
	movq	%rbx, %rsi
.LEHB0:
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_
	leaq	5816(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_
	movq	%rbx, %rdi
	leaq	.LC3(%rip), %rsi
	call	fopen@PLT
	leaq	76(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	movq	%rax, %rbx
	movq	%rax, %r8
	movl	$4, %esi
	call	__fread_chk@PLT
	movq	%rbx, %r8
	movl	$1, %ecx
	movl	$4, %edx
	movl	$4, %esi
	leaq	80(%rsp), %rdi
	call	__fread_chk@PLT
	movslq	76(%rsp), %rbp
	movslq	80(%rsp), %rax
	imulq	%rax, %rbp
	leaq	0(,%rbp,4), %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rbx, %r8
	movq	%rbp, %rcx
	movl	$4, %edx
	movq	%r13, %rsi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	__fread_chk@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	leaq	84(%rsp), %rsi
	movq	%r12, %rdi
	call	_ZNSirsERi@PLT
	movslq	84(%rsp), %rbx
	movabsq	$384307168202282325, %rax
	cmpq	%rbx, %rax
	jnb	.L45
	movq	6072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L90
	leaq	.LC4(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L45:
	imulq	$24, %rbx, %rbp
	xorl	%eax, %eax
	testq	%rbx, %rbx
	je	.L47
	movq	%rbp, %rdi
	call	_Znwm@PLT
.LEHE0:
.L47:
	addq	%rax, %rbp
	movq	%rax, 112(%rsp)
	movq	%rax, %rdx
	movq	%rbp, 128(%rsp)
.L48:
	testq	%rbx, %rbx
	je	.L93
	xorl	%ecx, %ecx
	decq	%rbx
	addq	$24, %rdx
	movq	%rcx, -24(%rdx)
	movq	%rcx, -16(%rdx)
	movq	%rcx, -8(%rdx)
	jmp	.L48
.L93:
	leaq	3256(%rsp), %rcx
	movq	%rax, %r15
	xorl	%eax, %eax
	movq	%rbp, 120(%rsp)
	movq	%rcx, 24(%rsp)
	leaq	432(%rsp), %rcx
	movq	24(%rsp), %r12
	leaq	952(%rsp), %rbp
	movq	%rcx, 32(%rsp)
	movq	%rcx, %rbx
	movq	%rax, 16(%rsp)
.L50:
	movl	16(%rsp), %eax
	cmpl	%eax, 84(%rsp)
	jle	.L94
	leaq	88(%rsp), %rsi
	leaq	_ZSt3cin(%rip), %rdi
.LEHB1:
	call	_ZNSirsERi@PLT
	movq	8(%r15), %rdx
	movq	(%r15), %rcx
	movslq	88(%rsp), %rsi
	movq	%rdx, %rax
	subq	%rcx, %rax
	sarq	$3, %rax
	cmpq	%rsi, %rax
	jnb	.L51
	subq	%rax, %rsi
	movq	%r15, %rdi
	call	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	jmp	.L52
.L51:
	cmpq	%rax, %rsi
	jnb	.L52
	leaq	(%rcx,%rsi,8), %rax
	cmpq	%rax, %rdx
	je	.L52
	movq	%rax, 8(%r15)
.L52:
	xorl	%r14d, %r14d
.L54:
	movl	88(%rsp), %ecx
	cmpl	%r14d, %ecx
	jle	.L95
	movq	(%r15), %rsi
	leaq	0(,%r14,8), %r13
	leaq	_ZSt3cin(%rip), %rdi
	addq	%r13, %rsi
	call	_ZNSirsERi@PLT
	movq	(%r15), %rsi
	movq	%rax, %rdi
	addq	%r13, %rsi
	addq	$4, %rsi
	call	_ZNSirsERi@PLT
	addq	(%r15), %r13
	movq	8(%rsp), %rcx
	incq	%r14
	movl	4(%r13), %eax
	imull	76(%rsp), %eax
	addl	0(%r13), %eax
	cltq
	leaq	(%rcx,%rax,4), %rax
	movzbl	(%rax), %edx
	addl	%edx, (%rbx)
	movzbl	1(%rax), %edx
	movzbl	2(%rax), %eax
	addl	%edx, 4(%rbx)
	addl	%eax, 8(%rbx)
	jmp	.L54
.L95:
	movl	(%rbx), %eax
	cltd
	idivl	%ecx
	movl	%eax, 40(%rsp)
	movl	%eax, (%rbx)
	movl	4(%rbx), %eax
	cltd
	idivl	%ecx
	movl	%eax, 4(%rbx)
	movl	%eax, %r14d
	movl	8(%rbx), %eax
	cltd
	idivl	%ecx
	movl	76(%rsp), %edx
	movl	%edx, 48(%rsp)
	xorl	%edx, %edx
	movl	%eax, 8(%rbx)
.L56:
	cmpl	%edx, %ecx
	jle	.L96
	movq	(%r15), %rdi
	movl	48(%rsp), %esi
	movq	%rbp, %r9
	xorl	%r8d, %r8d
	movl	40(%rsp), %r11d
	imull	4(%rdi,%rdx,8), %esi
	addl	(%rdi,%rdx,8), %esi
	movq	8(%rsp), %rdi
	movslq	%esi, %rsi
	leaq	(%rdi,%rsi,4), %rsi
	movzbl	(%rsi), %edi
	subl	%r11d, %edi
	movl	%edi, 152(%rsp)
	movzbl	1(%rsi), %edi
	movzbl	2(%rsi), %esi
	subl	%r14d, %edi
	subl	%eax, %esi
	movl	%edi, 156(%rsp)
	movl	%esi, 160(%rsp)
.L57:
	leaq	152(%rsp), %r10
	movq	%r9, %rdi
	xorl	%esi, %esi
	movl	(%r10,%r8,4), %r11d
.L58:
	movl	(%r10,%rsi,4), %r13d
	incq	%rsi
	addq	$8, %rdi
	imull	%r11d, %r13d
	cvtsi2sdl	%r13d, %xmm0
	addsd	-8(%rdi), %xmm0
	movsd	%xmm0, -8(%rdi)
	cmpq	$3, %rsi
	jne	.L58
	incq	%r8
	addq	$24, %r9
	cmpq	$3, %r8
	jne	.L57
	incq	%rdx
	jmp	.L56
.L96:
	decl	%ecx
	movq	%rbp, %rsi
	movl	$3, %edi
	cvtsi2sdl	%ecx, %xmm1
.L61:
	movq	%rsi, %rax
	xorl	%edx, %edx
.L62:
	movsd	(%rax), %xmm0
	incl	%edx
	addq	$8, %rax
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -8(%rax)
	cmpl	$3, %edx
	jne	.L62
	addq	$24, %rsi
	decl	%edi
	jne	.L61
	movsd	32(%rbp), %xmm7
	movsd	56(%rbp), %xmm2
	addq	$72, %r12
	addq	$72, %rbp
	movsd	-8(%rbp), %xmm4
	movsd	-32(%rbp), %xmm1
	addq	$16, %rbx
	addq	$24, %r15
	movaps	%xmm2, %xmm0
	movaps	%xmm7, %xmm12
	movsd	-48(%rbp), %xmm6
	movaps	%xmm2, %xmm11
	mulsd	%xmm1, %xmm0
	movsd	-24(%rbp), %xmm10
	movaps	%xmm4, %xmm9
	movsd	-72(%rbp), %xmm3
	mulsd	%xmm4, %xmm12
	movsd	-64(%rbp), %xmm5
	movsd	-56(%rbp), %xmm8
	mulsd	%xmm6, %xmm9
	movq	16(%rsp), %rax
	incq	16(%rsp)
	mulsd	%xmm6, %xmm11
	movaps	%xmm5, %xmm13
	subsd	%xmm0, %xmm12
	movaps	%xmm1, %xmm0
	mulsd	%xmm10, %xmm0
	subsd	%xmm0, %xmm9
	movaps	%xmm7, %xmm0
	mulsd	%xmm10, %xmm0
	mulsd	%xmm9, %xmm13
	xorps	.LC5(%rip), %xmm9
	subsd	%xmm0, %xmm11
	movaps	%xmm3, %xmm0
	mulsd	%xmm12, %xmm0
	subsd	%xmm13, %xmm0
	movaps	%xmm8, %xmm13
	mulsd	%xmm11, %xmm13
	addsd	%xmm13, %xmm0
	movsd	%xmm0, 176(%rsp,%rax,8)
	divsd	%xmm0, %xmm9
	divsd	%xmm0, %xmm11
	movsd	%xmm9, -48(%r12)
	movaps	%xmm4, %xmm9
	mulsd	%xmm5, %xmm9
	mulsd	%xmm3, %xmm4
	divsd	%xmm0, %xmm12
	movsd	%xmm11, -24(%r12)
	movaps	%xmm2, %xmm11
	mulsd	%xmm8, %xmm11
	mulsd	%xmm3, %xmm2
	subsd	%xmm11, %xmm9
	xorps	.LC5(%rip), %xmm9
	divsd	%xmm0, %xmm9
	movsd	%xmm12, -72(%r12)
	movsd	%xmm9, -64(%r12)
	movaps	%xmm10, %xmm9
	mulsd	%xmm8, %xmm9
	mulsd	%xmm5, %xmm10
	subsd	%xmm9, %xmm4
	subsd	%xmm10, %xmm2
	xorps	.LC5(%rip), %xmm2
	divsd	%xmm0, %xmm4
	divsd	%xmm0, %xmm2
	movsd	%xmm4, -40(%r12)
	movaps	%xmm7, %xmm4
	mulsd	%xmm8, %xmm4
	mulsd	%xmm6, %xmm8
	movsd	%xmm2, -16(%r12)
	movaps	%xmm1, %xmm2
	mulsd	%xmm5, %xmm2
	mulsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm5
	mulsd	%xmm7, %xmm3
	subsd	%xmm4, %xmm2
	subsd	%xmm8, %xmm1
	xorps	.LC5(%rip), %xmm1
	subsd	%xmm5, %xmm3
	divsd	%xmm0, %xmm2
	divsd	%xmm0, %xmm1
	movsd	%xmm2, -56(%r12)
	divsd	%xmm0, %xmm3
	movsd	%xmm1, -32(%r12)
	movsd	%xmm3, -8(%r12)
	jmp	.L50
.L94:
	leaq	96(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	104(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	xorl	%r12d, %r12d
.L65:
	cmpl	%r12d, 80(%rsp)
	jle	.L97
	xorl	%r14d, %r14d
.L74:
	movl	76(%rsp), %eax
	cmpl	%r14d, %eax
	jle	.L98
	imull	%r12d, %eax
	movq	8(%rsp), %rcx
	movq	32(%rsp), %rbp
	xorl	%ebx, %ebx
	movsd	.LC2(%rip), %xmm2
	orl	$-1, %r13d
	addl	%r14d, %eax
	cltq
	leaq	(%rcx,%rax,4), %r15
	movb	2(%r15), %al
	movzbl	(%r15), %r8d
	movzbl	1(%r15), %r9d
	movb	%al, 16(%rsp)
.L66:
	cmpl	%ebx, 84(%rsp)
	jle	.L99
	movl	%r8d, %eax
	subl	0(%rbp), %eax
	leaq	140(%rsp), %r10
	movl	%eax, 140(%rsp)
	movl	%r9d, %eax
	subl	4(%rbp), %eax
	movl	%eax, 144(%rsp)
	imulq	$72, %rbx, %rsi
	movzbl	16(%rsp), %eax
	subl	8(%rbp), %eax
	movl	%eax, 148(%rsp)
	movq	24(%rsp), %rax
	addq	%rax, %rsi
	xorl	%eax, %eax
.L68:
	leaq	(%rsi,%rax), %rdi
	xorl	%edx, %edx
	xorps	%xmm0, %xmm0
.L67:
	cvtsi2sdl	(%r10,%rdx,4), %xmm1
	mulsd	(%rdi), %xmm1
	incq	%rdx
	addq	$24, %rdi
	addsd	%xmm1, %xmm0
	cmpq	$3, %rdx
	jne	.L67
	movsd	%xmm0, 152(%rsp,%rax)
	addq	$8, %rax
	leaq	152(%rsp), %rdx
	cmpq	$24, %rax
	jne	.L68
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
	leaq	140(%rsp), %rsi
.L69:
	cvtsi2sdl	(%rsi,%rax,4), %xmm1
	mulsd	(%rdx,%rax,8), %xmm1
	incq	%rax
	addsd	%xmm1, %xmm0
	cmpq	$3, %rax
	jne	.L69
	movaps	%xmm0, %xmm1
	xorps	.LC5(%rip), %xmm1
	movsd	176(%rsp,%rbx,8), %xmm0
	movl	%r9d, 60(%rsp)
	andps	.LC6(%rip), %xmm0
	movl	%r8d, 56(%rsp)
	movsd	%xmm2, 48(%rsp)
	movsd	%xmm1, 40(%rsp)
	call	log@PLT
	movsd	40(%rsp), %xmm1
	movsd	48(%rsp), %xmm2
	movl	60(%rsp), %r9d
	movl	56(%rsp), %r8d
	subsd	%xmm0, %xmm1
	comisd	%xmm2, %xmm1
	maxsd	%xmm2, %xmm1
	cmova	%ebx, %r13d
	movaps	%xmm1, %xmm2
	incq	%rbx
	addq	$16, %rbp
	jmp	.L66
.L99:
	movb	%r13b, 3(%r15)
	incl	%r14d
	jmp	.L74
.L98:
	incl	%r12d
	jmp	.L65
.L97:
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	104(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	104(%rsp), %rdx
	movq	96(%rsp), %rsi
	leaq	92(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC7(%rip), %rdx
	movl	$2, %esi
	movb	$1, %al
	cvtss2sd	92(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	104(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	96(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	5816(%rsp), %rdi
	leaq	.LC8(%rip), %rsi
	call	fopen@PLT
	leaq	76(%rsp), %rdi
	movq	%rax, %rcx
	movl	$1, %edx
	movq	%rax, %rbx
	movl	$4, %esi
	call	fwrite@PLT
	leaq	80(%rsp), %rdi
	movq	%rbx, %rcx
	movl	$1, %edx
	movl	$4, %esi
	call	fwrite@PLT
	movl	76(%rsp), %edx
	imull	80(%rsp), %edx
	movq	%rbx, %rcx
	movl	$4, %esi
	movq	8(%rsp), %rdi
	movslq	%edx, %rdx
	call	fwrite@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
.LEHE1:
	movq	8(%rsp), %rdi
	call	free@PLT
	leaq	112(%rsp), %rdi
	call	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED1Ev
	movq	6072(%rsp), %rax
	subq	%fs:40, %rax
	je	.L77
	jmp	.L90
.L81:
	endbr64
	movq	%rax, %rbx
.L75:
	leaq	112(%rsp), %rdi
	call	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED1Ev
	movq	6072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L90
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L90:
	call	__stack_chk_fail@PLT
.L77:
	addq	$6088, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE10825:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA10825:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE10825-.LLSDACSB10825
.LLSDACSB10825:
	.uleb128 .LEHB0-.LFB10825
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB10825
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L81-.LFB10825
	.uleb128 0
	.uleb128 .LEHB2-.LFB10825
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE10825:
	.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
.LC2:
	.long	0
	.long	-1047013500
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC5:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.align 16
.LC6:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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 <bits/stdc++.h>

using namespace std;

const int MAXX = 1e8;


#define CSC(call)                            \
do {                                \
  hipError_t res = call;                      \
  if (res != hipSuccess) {                    \
    fprintf(stderr, "ERROR in %s:%d. Message: %s\n",      \
        __FILE__, __LINE__, hipGetErrorString(res));    \
    exit(0);                          \
  }                                \
} while(0)


struct pnt {
    int x, y;
};



int main() {


    int w, h;
    char inputFile[256], outputFile[256];
    cin >> inputFile >> outputFile;

    FILE *fp = fopen(inputFile, "rb");
    fread(&w, sizeof(int), 1, fp);
    fread(&h, sizeof(int), 1, fp);

    uchar4 *data = (uchar4 *) malloc(sizeof(uchar4) * w * h);
    fread(data, sizeof(uchar4), w * h, fp);
    fclose(fp);

    int nc, np;
    cin >> nc;
    vector<vector<pnt>> classes(nc);
    int4 avg[32];
    double cov[32][3][3];
    double cov_inv[32][3][3];
    double dets[32];
    for (int i = 0; i < nc; ++i) {
        cin >> np;
        classes[i].resize(np);
            // input + counting averages
        for (int j = 0; j < np; ++j) {
            cin >> classes[i][j].x >> classes[i][j].y;
            uchar4 ps = data[classes[i][j].y * w + classes[i][j].x];
            avg[i].x += ps.x;
            avg[i].y += ps.y;
            avg[i].z += ps.z;
        }
        avg[i].x /= np;
        avg[i].y /= np;
        avg[i].z /= np;

        // counting cov
        for (int j = 0; j < np; ++j) {
            uchar4 ps = data[classes[i][j].y * w + classes[i][j].x];


            int diff[3];
            diff[0] = ps.x - avg[i].x;
            diff[1] = ps.y - avg[i].y;
            diff[2] = ps.z - avg[i].z;

            for (int k = 0; k < 3; ++k) {
                for (int m = 0; m < 3; ++m) {
                    cov[i][k][m] += diff[k] * diff[m];
                }
            }
        }
        for (int k = 0; k < 3; ++k) {
            for (int m = 0; m < 3; ++m) {
                cov[i][k][m] /= (np - 1);
            }
        }

        // counting cov_inverse + determinants
        double det = cov[i][0][0] * (cov[i][1][1] * cov[i][2][2] - cov[i][2][1] * cov[i][1][2])
                     - cov[i][0][1] * (cov[i][1][0] * cov[i][2][2] - cov[i][2][0] * cov[i][1][2])
                     + cov[i][0][2] * (cov[i][1][0] * cov[i][2][1] - cov[i][2][0] * cov[i][1][1]);


        cov_inv[i][0][0] = (cov[i][1][1] * cov[i][2][2] - cov[i][2][1] * cov[i][1][2]) / det;
        cov_inv[i][1][0] = -(cov[i][1][0] * cov[i][2][2] - cov[i][2][0] * cov[i][1][2]) / det;
        cov_inv[i][2][0] = (cov[i][1][0] * cov[i][2][1] - cov[i][2][0] * cov[i][1][1]) / det;

        cov_inv[i][0][1] = -(cov[i][0][1] * cov[i][2][2] - cov[i][2][1] * cov[i][0][2]) / det;
        cov_inv[i][1][1] = (cov[i][0][0] * cov[i][2][2] - cov[i][2][0] * cov[i][0][2]) / det;
        cov_inv[i][2][1] = -(cov[i][0][0] * cov[i][2][1] - cov[i][2][0] * cov[i][0][1]) / det;

        cov_inv[i][0][2] = (cov[i][0][1] * cov[i][1][2] - cov[i][1][1] * cov[i][0][2]) / det;
        cov_inv[i][1][2] = -(cov[i][0][0] * cov[i][1][2] - cov[i][1][0] * cov[i][0][2]) / det;
        cov_inv[i][2][2] = (cov[i][0][0] * cov[i][1][1] - cov[i][1][0] * cov[i][0][1]) / det;

        dets[i] = det;
    }


    hipEvent_t start, stop;
    float time;
    hipEventCreate(&start);
    hipEventCreate(&stop);
    hipEventRecord(start, 0);

    for (int y = 0; y < h; ++y){
        for (int x = 0; x < w; ++x){
            uchar4 ps = data[y * w + x];

            double mx = -MAXX;
            int idx = -1;
            for (int i = 0; i < nc; ++i){

                int diff[3];
                diff[0] = ps.x - avg[i].x;
                diff[1] = ps.y - avg[i].y;
                diff[2] = ps.z - avg[i].z;

                double tmp[3];
                for(int j = 0; j < 3; ++j){
                    tmp[j] = 0;
                    for(int k = 0; k < 3; ++k){
                        tmp[j] += (diff[k] * cov_inv[i][k][j]);
                    }
                }
                double ans = 0;
                for(int j = 0; j < 3; ++j){
                    ans += (tmp[j] * diff[j]);
                }
                ans = -ans - log(abs(dets[i]));

                if(ans > mx){
                    mx = ans;
                    idx = i;
                }
            }

            data[y * w + x].w = idx;
        }
    }

    hipEventRecord(stop, 0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&time, start, stop);
    fprintf(stderr, "%.2f\n", time);
    hipEventDestroy(stop);
    hipEventDestroy(start);


    fp = fopen(outputFile, "wb");
    fwrite(&w, sizeof(int), 1, fp);
    fwrite(&h, sizeof(int), 1, fp);
    fwrite(data, sizeof(uchar4), w * h, fp);
    fclose(fp);

    free(data);
    return 0;
}

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

                                        # End of file scope inline assembly
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI0_0:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
.LCPI0_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_1:
	.quad	0xc197d78400000000              # double -1.0E+8
	.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	$6088, %rsp                     # imm = 0x17C8
	.cfi_def_cfa_offset 6144
	.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	_ZSt3cin(%rip), %rax
	movq	-24(%rax), %rax
	movq	$-257, %rbx                     # imm = 0xFEFF
	movq	_ZSt3cin+16(%rax), %r14
	addq	%rbx, %r14
	leaq	1216(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	movl	$256, %edx                      # imm = 0x100
	callq	_ZSt17__istream_extractRSiPcl
	movq	_ZSt3cin(%rip), %rcx
	movq	-24(%rcx), %rax
	cmpl	$0, _ZSt3cin+32(%rax)
	jne	.LBB0_5
# %bb.1:
	cmpq	$-257, %r14                     # imm = 0xFEFF
	ja	.LBB0_5
# %bb.2:
	movq	_ZSt3cin+232(%rax), %rdi
	movq	16(%rdi), %rax
	cmpq	24(%rdi), %rax
	jae	.LBB0_3
.LBB0_5:                                # %_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_.exit
	movq	-24(%rcx), %rax
	addq	_ZSt3cin+16(%rax), %rbx
	leaq	960(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	movl	$256, %edx                      # imm = 0x100
	callq	_ZSt17__istream_extractRSiPcl
	movq	_ZSt3cin(%rip), %rax
	movq	-24(%rax), %rax
	cmpl	$0, _ZSt3cin+32(%rax)
	jne	.LBB0_10
# %bb.6:                                # %_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_.exit
	cmpq	$-257, %rbx                     # imm = 0xFEFF
	ja	.LBB0_10
# %bb.7:
	movq	_ZSt3cin+232(%rax), %rdi
	movq	16(%rdi), %rax
	cmpq	24(%rdi), %rax
	jae	.LBB0_8
.LBB0_10:                               # %_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_.exit204
	leaq	1216(%rsp), %rdi
	movl	$.L.str, %esi
	callq	fopen
	movq	%rax, %r14
	leaq	72(%rsp), %rbx
	movl	$4, %esi
	movl	$1, %edx
	movq	%rbx, %rdi
	movq	%rax, %rcx
	callq	fread
	leaq	68(%rsp), %r15
	movl	$4, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r14, %rcx
	callq	fread
	movslq	(%rbx), %rbx
	movl	%ebx, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movslq	(%r15), %r15
	movq	%rbx, %rdi
	imulq	%r15, %rdi
	shlq	$2, %rdi
	callq	malloc
	movq	%rax, %rdi
	movq	%r15, %rax
	movq	%r15, 144(%rsp)                 # 8-byte Spill
	imull	%ebx, %eax
	movslq	%eax, %rdx
	movl	$4, %esi
	movq	%rdi, 24(%rsp)                  # 8-byte Spill
	movq	%r14, %rcx
	callq	fread
	movq	%r14, %rdi
	callq	fclose
	leaq	12(%rsp), %r15
	movl	$_ZSt3cin, %edi
	movq	%r15, %rsi
	callq	_ZNSirsERi
	movslq	(%r15), %rsi
	leaq	88(%rsp), %rdi
	leaq	3776(%rsp), %r14
	movq	%r14, %rdx
	callq	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_
	cmpl	$0, (%r15)
	jle	.LBB0_28
# %bb.11:                               # %.lr.ph222
	xorl	%ebx, %ebx
.LBB0_12:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_46 Depth 2
                                        #     Child Loop BB0_18 Depth 2
                                        #       Child Loop BB0_19 Depth 3
                                        #         Child Loop BB0_20 Depth 4
                                        #     Child Loop BB0_24 Depth 2
                                        #       Child Loop BB0_25 Depth 3
.Ltmp0:
	movl	$_ZSt3cin, %edi
	leaq	8(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp1:
# %bb.13:                               #   in Loop: Header=BB0_12 Depth=1
	leaq	(%rbx,%rbx,2), %r13
	leaq	(,%r13,8), %rdi
	addq	88(%rsp), %rdi
	movslq	8(%rsp), %rsi
.Ltmp2:
	callq	_ZNSt6vectorI3pntSaIS0_EE6resizeEm
.Ltmp3:
# %bb.14:                               # %.preheader211
                                        #   in Loop: Header=BB0_12 Depth=1
	movl	8(%rsp), %r8d
	movq	%rbx, 48(%rsp)                  # 8-byte Spill
	shlq	$4, %rbx
	leaq	(%rsp,%rbx), %r12
	addq	$192, %r12
	testl	%r8d, %r8d
	jle	.LBB0_15
# %bb.45:                               # %.lr.ph
                                        #   in Loop: Header=BB0_12 Depth=1
	movq	88(%rsp), %rax
	movq	(%rax,%r13,8), %rcx
	movl	$4, %r15d
	xorl	%ebp, %ebp
.LBB0_46:                               #   Parent Loop BB0_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%rcx,%r15), %rsi
	addq	$-4, %rsi
.Ltmp5:
	movl	$_ZSt3cin, %edi
	callq	_ZNSirsERi
.Ltmp6:
# %bb.47:                               #   in Loop: Header=BB0_46 Depth=2
	movq	88(%rsp), %rcx
	movq	(%rcx,%r13,8), %rsi
	addq	%r15, %rsi
.Ltmp7:
	movq	%rax, %rdi
	callq	_ZNSirsERi
.Ltmp8:
# %bb.48:                               #   in Loop: Header=BB0_46 Depth=2
	movq	88(%rsp), %rax
	movq	(%rax,%r13,8), %rcx
	movslq	(%rcx,%r15), %rax
	movslq	16(%rsp), %rdx                  # 4-byte Folded Reload
	imulq	%rax, %rdx
	movslq	-4(%rcx,%r15), %rdi
	addq	%rdx, %rdi
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movzbl	(%rdx,%rdi,4), %eax
	movzbl	1(%rdx,%rdi,4), %esi
	addl	(%r12), %eax
	movzbl	2(%rdx,%rdi,4), %edi
	movl	%eax, (%r12)
	addl	4(%r12), %esi
	movl	%esi, 4(%r12)
	addl	8(%r12), %edi
	movl	%edi, 8(%r12)
	incq	%rbp
	movslq	8(%rsp), %r8
	addq	$8, %r15
	cmpq	%r8, %rbp
	jl	.LBB0_46
	jmp	.LBB0_16
.LBB0_15:                               # %.preheader211.._crit_edge_crit_edge
                                        #   in Loop: Header=BB0_12 Depth=1
	movl	(%r12), %eax
	movl	4(%r12), %esi
	movl	8(%r12), %edi
.LBB0_16:                               # %._crit_edge
                                        #   in Loop: Header=BB0_12 Depth=1
	cltd
	idivl	%r8d
	movl	%eax, %ecx
	movl	%eax, 192(%rsp,%rbx)
	movl	%esi, %eax
	cltd
	idivl	%r8d
	movl	%eax, %esi
	movl	%eax, 196(%rsp,%rbx)
	movl	%edi, %eax
	cltd
	idivl	%r8d
	movl	%eax, 200(%rsp,%rbx)
	testl	%r8d, %r8d
	jle	.LBB0_23
# %bb.17:                               # %.lr.ph218
                                        #   in Loop: Header=BB0_12 Depth=1
	movq	88(%rsp), %rdx
	movq	(%rdx,%r13,8), %rdx
	movl	%r8d, %edi
	xorl	%r9d, %r9d
.LBB0_18:                               #   Parent Loop BB0_12 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_19 Depth 3
                                        #         Child Loop BB0_20 Depth 4
	movslq	4(%rdx,%r9,8), %r10
	movslq	16(%rsp), %r11                  # 4-byte Folded Reload
	imulq	%r10, %r11
	movslq	(%rdx,%r9,8), %r10
	addq	%r11, %r10
	movq	24(%rsp), %r15                  # 8-byte Reload
	movzbl	(%r15,%r10,4), %r11d
	movzbl	1(%r15,%r10,4), %ebx
	movzbl	2(%r15,%r10,4), %r10d
	subl	%ecx, %r11d
	movl	%r11d, 112(%rsp)
	subl	%esi, %ebx
	movl	%ebx, 116(%rsp)
	subl	%eax, %r10d
	movl	%r10d, 120(%rsp)
	movq	%r14, %r10
	xorl	%r11d, %r11d
.LBB0_19:                               # %.preheader208
                                        #   Parent Loop BB0_12 Depth=1
                                        #     Parent Loop BB0_18 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB0_20 Depth 4
	movl	112(%rsp,%r11,4), %ebx
	xorl	%r15d, %r15d
.LBB0_20:                               #   Parent Loop BB0_12 Depth=1
                                        #     Parent Loop BB0_18 Depth=2
                                        #       Parent Loop BB0_19 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	movl	112(%rsp,%r15,4), %ebp
	imull	%ebx, %ebp
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	addsd	(%r10,%r15,8), %xmm0
	movsd	%xmm0, (%r10,%r15,8)
	incq	%r15
	cmpq	$3, %r15
	jne	.LBB0_20
# %bb.21:                               #   in Loop: Header=BB0_19 Depth=3
	incq	%r11
	addq	$24, %r10
	cmpq	$3, %r11
	jne	.LBB0_19
# %bb.22:                               #   in Loop: Header=BB0_18 Depth=2
	incq	%r9
	cmpq	%rdi, %r9
	jne	.LBB0_18
.LBB0_23:                               # %.preheader210
                                        #   in Loop: Header=BB0_12 Depth=1
	decl	%r8d
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r8d, %xmm0
	movq	%r14, %rax
	xorl	%ecx, %ecx
	movq	48(%rsp), %rbx                  # 8-byte Reload
.LBB0_24:                               # %.preheader209
                                        #   Parent Loop BB0_12 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_25 Depth 3
	xorl	%edx, %edx
.LBB0_25:                               #   Parent Loop BB0_12 Depth=1
                                        #     Parent Loop BB0_24 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%rax,%rdx,8), %xmm1            # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movsd	%xmm1, (%rax,%rdx,8)
	incq	%rdx
	cmpq	$3, %rdx
	jne	.LBB0_25
# %bb.26:                               #   in Loop: Header=BB0_24 Depth=2
	incq	%rcx
	addq	$24, %rax
	cmpq	$3, %rcx
	jne	.LBB0_24
# %bb.27:                               #   in Loop: Header=BB0_12 Depth=1
	leaq	(,%rbx,8), %rax
	leaq	(%rax,%rax,8), %rax
	movsd	3808(%rsp,%rax), %xmm3          # xmm3 = mem[0],zero
	movsd	3840(%rsp,%rax), %xmm7          # xmm7 = mem[0],zero
	movapd	%xmm3, %xmm10
	mulsd	%xmm7, %xmm10
	movsd	3832(%rsp,%rax), %xmm8          # xmm8 = mem[0],zero
	movsd	3816(%rsp,%rax), %xmm4          # xmm4 = mem[0],zero
	movapd	%xmm8, %xmm0
	mulsd	%xmm4, %xmm0
	subsd	%xmm0, %xmm10
	movsd	3776(%rsp,%rax), %xmm0          # xmm0 = mem[0],zero
	movsd	3784(%rsp,%rax), %xmm1          # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm11
	mulsd	%xmm10, %xmm11
	movsd	3800(%rsp,%rax), %xmm2          # xmm2 = mem[0],zero
	movapd	%xmm7, %xmm12
	mulsd	%xmm2, %xmm12
	movsd	3824(%rsp,%rax), %xmm9          # xmm9 = mem[0],zero
	movapd	%xmm4, %xmm5
	mulsd	%xmm9, %xmm5
	subsd	%xmm5, %xmm12
	movapd	%xmm1, %xmm5
	mulsd	%xmm12, %xmm5
	subsd	%xmm5, %xmm11
	movsd	3792(%rsp,%rax), %xmm6          # xmm6 = mem[0],zero
	movapd	%xmm8, %xmm13
	mulsd	%xmm2, %xmm13
	movapd	%xmm3, %xmm5
	mulsd	%xmm9, %xmm5
	subsd	%xmm5, %xmm13
	movapd	%xmm6, %xmm5
	mulsd	%xmm13, %xmm5
	addsd	%xmm11, %xmm5
	divsd	%xmm5, %xmm10
	movsd	%xmm10, 1472(%rsp,%rax)
	movapd	.LCPI0_0(%rip), %xmm14          # xmm14 = [-0.0E+0,-0.0E+0]
	xorpd	%xmm14, %xmm12
	divsd	%xmm5, %xmm12
	movsd	%xmm12, 1496(%rsp,%rax)
	divsd	%xmm5, %xmm13
	movsd	%xmm13, 1520(%rsp,%rax)
	movapd	%xmm0, %xmm10
	mulsd	%xmm7, %xmm10
	mulsd	%xmm1, %xmm7
	movapd	%xmm0, %xmm11
	mulsd	%xmm8, %xmm11
	mulsd	%xmm6, %xmm8
	subsd	%xmm8, %xmm7
	xorpd	%xmm14, %xmm7
	divsd	%xmm5, %xmm7
	movsd	%xmm7, 1480(%rsp,%rax)
	movapd	%xmm1, %xmm7
	mulsd	%xmm9, %xmm7
	mulsd	%xmm6, %xmm9
	subsd	%xmm9, %xmm10
	divsd	%xmm5, %xmm10
	movsd	%xmm10, 1504(%rsp,%rax)
	subsd	%xmm7, %xmm11
	xorpd	%xmm14, %xmm11
	divsd	%xmm5, %xmm11
	movsd	%xmm11, 1528(%rsp,%rax)
	movapd	%xmm0, %xmm7
	mulsd	%xmm4, %xmm7
	mulsd	%xmm1, %xmm4
	mulsd	%xmm3, %xmm0
	mulsd	%xmm6, %xmm3
	subsd	%xmm3, %xmm4
	divsd	%xmm5, %xmm4
	movsd	%xmm4, 1488(%rsp,%rax)
	mulsd	%xmm2, %xmm6
	subsd	%xmm6, %xmm7
	xorpd	%xmm14, %xmm7
	divsd	%xmm5, %xmm7
	movsd	%xmm7, 1512(%rsp,%rax)
	mulsd	%xmm2, %xmm1
	subsd	%xmm1, %xmm0
	divsd	%xmm5, %xmm0
	movsd	%xmm0, 1536(%rsp,%rax)
	movsd	%xmm5, 704(%rsp,%rbx,8)
	incq	%rbx
	movslq	12(%rsp), %rax
	addq	$72, %r14
	cmpq	%rax, %rbx
	jl	.LBB0_12
.LBB0_28:                               # %._crit_edge223
.Ltmp10:
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
.Ltmp11:
# %bb.29:
.Ltmp12:
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
.Ltmp13:
# %bb.30:
	movq	56(%rsp), %rdi
.Ltmp14:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp15:
# %bb.31:                               # %.preheader207
	movl	144(%rsp), %eax                 # 4-byte Reload
	movq	%rax, 168(%rsp)                 # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB0_39
# %bb.32:                               # %.preheader206.lr.ph
	xorl	%eax, %eax
	movq	%rax, 40(%rsp)                  # 8-byte Spill
.LBB0_33:                               # %.preheader206
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_35 Depth 2
                                        #       Child Loop BB0_52 Depth 3
                                        #         Child Loop BB0_53 Depth 4
                                        #           Child Loop BB0_54 Depth 5
                                        #         Child Loop BB0_57 Depth 4
	cmpl	$0, 16(%rsp)                    # 4-byte Folded Reload
	jle	.LBB0_38
# %bb.34:                               # %.lr.ph237
                                        #   in Loop: Header=BB0_33 Depth=1
	movq	16(%rsp), %rcx                  # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx def $rcx
	imull	40(%rsp), %ecx                  # 4-byte Folded Reload
	movl	12(%rsp), %eax
	movq	24(%rsp), %rdx                  # 8-byte Reload
	leaq	(%rdx,%rcx,4), %rcx
	xorl	%edx, %edx
	movq	%rcx, 176(%rsp)                 # 8-byte Spill
.LBB0_35:                               #   Parent Loop BB0_33 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_52 Depth 3
                                        #         Child Loop BB0_53 Depth 4
                                        #           Child Loop BB0_54 Depth 5
                                        #         Child Loop BB0_57 Depth 4
	testl	%eax, %eax
	jle	.LBB0_36
# %bb.51:                               # %.lr.ph233
                                        #   in Loop: Header=BB0_35 Depth=2
	movzbl	2(%rcx,%rdx,4), %r15d
	movzbl	1(%rcx,%rdx,4), %r12d
	movq	%rdx, 184(%rsp)                 # 8-byte Spill
	movzbl	(%rcx,%rdx,4), %ebx
	movl	$-1, %r13d
	leaq	1472(%rsp), %rbp
	xorl	%r14d, %r14d
	movsd	.LCPI0_1(%rip), %xmm0           # xmm0 = mem[0],zero
.LBB0_52:                               #   Parent Loop BB0_33 Depth=1
                                        #     Parent Loop BB0_35 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB0_53 Depth 4
                                        #           Child Loop BB0_54 Depth 5
                                        #         Child Loop BB0_57 Depth 4
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
	movq	%r14, %rax
	shlq	$4, %rax
	movl	%ebx, %ecx
	subl	192(%rsp,%rax), %ecx
	movl	%r12d, %edx
	subl	196(%rsp,%rax), %edx
	movl	%ecx, 76(%rsp)
	movl	%r15d, %ecx
	subl	200(%rsp,%rax), %ecx
	movl	%edx, 80(%rsp)
	movl	%ecx, 84(%rsp)
	movq	%rbp, %rax
	xorl	%ecx, %ecx
.LBB0_53:                               #   Parent Loop BB0_33 Depth=1
                                        #     Parent Loop BB0_35 Depth=2
                                        #       Parent Loop BB0_52 Depth=3
                                        # =>      This Loop Header: Depth=4
                                        #           Child Loop BB0_54 Depth 5
	xorpd	%xmm0, %xmm0
	movq	%rax, %rdx
	xorl	%esi, %esi
.LBB0_54:                               #   Parent Loop BB0_33 Depth=1
                                        #     Parent Loop BB0_35 Depth=2
                                        #       Parent Loop BB0_52 Depth=3
                                        #         Parent Loop BB0_53 Depth=4
                                        # =>        This Inner Loop Header: Depth=5
	xorps	%xmm1, %xmm1
	cvtsi2sdl	76(%rsp,%rsi,4), %xmm1
	mulsd	(%rdx), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rsi
	addq	$24, %rdx
	cmpq	$3, %rsi
	jne	.LBB0_54
# %bb.55:                               #   in Loop: Header=BB0_53 Depth=4
	movsd	%xmm0, 112(%rsp,%rcx,8)
	incq	%rcx
	addq	$8, %rax
	cmpq	$3, %rcx
	jne	.LBB0_53
# %bb.56:                               # %.preheader.preheader
                                        #   in Loop: Header=BB0_52 Depth=3
	xorpd	%xmm1, %xmm1
	xorl	%eax, %eax
.LBB0_57:                               # %.preheader
                                        #   Parent Loop BB0_33 Depth=1
                                        #     Parent Loop BB0_35 Depth=2
                                        #       Parent Loop BB0_52 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	xorps	%xmm0, %xmm0
	cvtsi2sdl	76(%rsp,%rax,4), %xmm0
	mulsd	112(%rsp,%rax,8), %xmm0
	addsd	%xmm0, %xmm1
	incq	%rax
	cmpq	$3, %rax
	jne	.LBB0_57
# %bb.58:                               #   in Loop: Header=BB0_52 Depth=3
	xorpd	.LCPI0_0(%rip), %xmm1
	movapd	%xmm1, 144(%rsp)                # 16-byte Spill
	movsd	704(%rsp,%r14,8), %xmm0         # xmm0 = mem[0],zero
	andpd	.LCPI0_2(%rip), %xmm0
	callq	log
	movapd	144(%rsp), %xmm1                # 16-byte Reload
	subsd	%xmm0, %xmm1
	movsd	48(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	maxsd	%xmm0, %xmm1
	movapd	%xmm1, %xmm0
	cmoval	%r14d, %r13d
	incq	%r14
	movslq	12(%rsp), %rax
	addq	$72, %rbp
	cmpq	%rax, %r14
	jl	.LBB0_52
# %bb.59:                               #   in Loop: Header=BB0_35 Depth=2
	movq	176(%rsp), %rcx                 # 8-byte Reload
	movq	184(%rsp), %rdx                 # 8-byte Reload
	jmp	.LBB0_37
.LBB0_36:                               #   in Loop: Header=BB0_35 Depth=2
	movl	$-1, %r13d
.LBB0_37:                               # %._crit_edge234
                                        #   in Loop: Header=BB0_35 Depth=2
	movb	%r13b, 3(%rcx,%rdx,4)
	incq	%rdx
	cmpq	16(%rsp), %rdx                  # 8-byte Folded Reload
	jne	.LBB0_35
.LBB0_38:                               # %._crit_edge238
                                        #   in Loop: Header=BB0_33 Depth=1
	movq	40(%rsp), %rcx                  # 8-byte Reload
	incq	%rcx
	movq	%rcx, %rax
	movq	%rcx, 40(%rsp)                  # 8-byte Spill
	cmpq	168(%rsp), %rcx                 # 8-byte Folded Reload
	jne	.LBB0_33
.LBB0_39:                               # %._crit_edge240
	movq	32(%rsp), %rdi
.Ltmp16:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp17:
# %bb.40:
	movq	32(%rsp), %rdi
.Ltmp18:
	callq	hipEventSynchronize
.Ltmp19:
# %bb.41:
	movq	56(%rsp), %rsi
	movq	32(%rsp), %rdx
.Ltmp20:
	leaq	64(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp21:
# %bb.42:
	movq	stderr(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	64(%rsp), %xmm0
	movl	$.L.str.1, %esi
	movb	$1, %al
	callq	fprintf
	movq	32(%rsp), %rdi
.Ltmp22:
	callq	hipEventDestroy
.Ltmp23:
# %bb.43:
	movq	56(%rsp), %rdi
.Ltmp24:
	callq	hipEventDestroy
.Ltmp25:
# %bb.44:
	leaq	960(%rsp), %rdi
	movl	$.L.str.2, %esi
	callq	fopen
	movq	%rax, %r14
	leaq	72(%rsp), %r15
	movl	$4, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%rax, %rcx
	callq	fwrite
	leaq	68(%rsp), %r12
	movl	$4, %esi
	movl	$1, %edx
	movq	%r12, %rdi
	movq	%r14, %rcx
	callq	fwrite
	movslq	(%r15), %rax
	movslq	(%r12), %rdx
	imulq	%rax, %rdx
	movl	$4, %esi
	movq	24(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rdi
	movq	%r14, %rcx
	callq	fwrite
	movq	%r14, %rdi
	callq	fclose
	movq	%rbx, %rdi
	callq	free
	leaq	88(%rsp), %rdi
	callq	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	xorl	%eax, %eax
	addq	$6088, %rsp                     # imm = 0x17C8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_3:                                # %_ZNSt15basic_streambufIcSt11char_traitsIcEE5sgetcEv.exit.i
	.cfi_def_cfa_offset 6144
	movq	(%rdi), %rax
	callq	*72(%rax)
	movq	_ZSt3cin(%rip), %rcx
	cmpl	$-1, %eax
	jne	.LBB0_5
# %bb.4:
	movq	-24(%rcx), %rax
	leaq	_ZSt3cin(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$2, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
	movq	_ZSt3cin(%rip), %rcx
	jmp	.LBB0_5
.LBB0_8:                                # %_ZNSt15basic_streambufIcSt11char_traitsIcEE5sgetcEv.exit.i203
	movq	(%rdi), %rax
	callq	*72(%rax)
	cmpl	$-1, %eax
	jne	.LBB0_10
# %bb.9:
	movq	_ZSt3cin(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt3cin(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$2, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
	jmp	.LBB0_10
.LBB0_50:
.Ltmp26:
	jmp	.LBB0_61
.LBB0_60:
.Ltmp4:
	jmp	.LBB0_61
.LBB0_49:
.Ltmp9:
.LBB0_61:
	movq	%rax, %rbx
	leaq	88(%rsp), %rdi
	callq	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table0:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp3-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp3
	.uleb128 .Ltmp4-.Lfunc_begin0           #     jumps to .Ltmp4
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp5-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp8-.Ltmp5                  #   Call between .Ltmp5 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp25-.Ltmp10                #   Call between .Ltmp10 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin0          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Lfunc_end0-.Ltmp25            #   Call between .Ltmp25 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_,"axG",@progbits,_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_,comdat
	.weak	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_ # -- Begin function _ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_,@function
_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_: # @_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_
	.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
	movabsq	$384307168202282326, %rax       # imm = 0x555555555555556
	cmpq	%rax, %rsi
	jae	.LBB1_5
# %bb.1:                                # %_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EE17_S_check_init_lenEmRKS3_.exit
	movq	%rsi, %r14
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rdi)
	movq	$0, 16(%rdi)
	testq	%rsi, %rsi
	je	.LBB1_2
# %bb.3:                                # %.lr.ph.preheader.i.i.i.i
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv
	movq	%rax, (%rbx)
	shlq	$3, %r14
	leaq	(%r14,%r14,2), %rdx
	leaq	(%rax,%rdx), %r14
	movq	%r14, 16(%rbx)
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	jmp	.LBB1_4
.LBB1_2:                                # %_ZNSt12_Vector_baseISt6vectorI3pntSaIS1_EESaIS3_EEC2EmRKS4_.exit.thread
	movups	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	xorl	%r14d, %r14d
.LBB1_4:
	movq	%r14, 8(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB1_5:
	.cfi_def_cfa_offset 32
	movl	$.L.str.3, %edi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end1:
	.size	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_, .Lfunc_end1-_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EEC2EmRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorI3pntSaIS0_EE6resizeEm,"axG",@progbits,_ZNSt6vectorI3pntSaIS0_EE6resizeEm,comdat
	.weak	_ZNSt6vectorI3pntSaIS0_EE6resizeEm # -- Begin function _ZNSt6vectorI3pntSaIS0_EE6resizeEm
	.p2align	1, 0x90
	.type	_ZNSt6vectorI3pntSaIS0_EE6resizeEm,@function
_ZNSt6vectorI3pntSaIS0_EE6resizeEm:     # @_ZNSt6vectorI3pntSaIS0_EE6resizeEm
	.cfi_startproc
# %bb.0:
	movq	(%rdi), %rdx
	movq	8(%rdi), %rcx
	movq	%rcx, %r8
	subq	%rdx, %r8
	sarq	$3, %r8
	movq	%rsi, %rax
	subq	%r8, %rax
	jbe	.LBB2_1
# %bb.5:
	movq	%rax, %rsi
	jmp	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm # TAILCALL
.LBB2_1:
	jae	.LBB2_4
# %bb.2:
	leaq	(%rdx,%rsi,8), %rax
	cmpq	%rax, %rcx
	je	.LBB2_4
# %bb.3:
	movq	%rax, 8(%rdi)
.LBB2_4:                                # %_ZNSt6vectorI3pntSaIS0_EE15_M_erase_at_endEPS0_.exit
	retq
.Lfunc_end2:
	.size	_ZNSt6vectorI3pntSaIS0_EE6resizeEm, .Lfunc_end2-_ZNSt6vectorI3pntSaIS0_EE6resizeEm
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev,"axG",@progbits,_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev,comdat
	.weak	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev # -- Begin function _ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.p2align	1, 0x90
	.type	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev,@function
_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev: # @_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.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	(%rdi), %rbx
	movq	8(%rdi), %r15
	cmpq	%r15, %rbx
	je	.LBB3_6
# %bb.1:                                # %.lr.ph.i.i.i.preheader
	movq	%rdi, %r14
.LBB3_2:                                # %.lr.ph.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	.LBB3_4
# %bb.3:                                #   in Loop: Header=BB3_2 Depth=1
	callq	_ZdlPv
.LBB3_4:                                # %_ZSt8_DestroyISt6vectorI3pntSaIS1_EEEvPT_.exit.i.i.i
                                        #   in Loop: Header=BB3_2 Depth=1
	addq	$24, %rbx
	cmpq	%r15, %rbx
	jne	.LBB3_2
# %bb.5:                                # %_ZSt8_DestroyIPSt6vectorI3pntSaIS1_EES3_EvT_S5_RSaIT0_E.exitthread-pre-split
	movq	(%r14), %rbx
.LBB3_6:                                # %_ZSt8_DestroyIPSt6vectorI3pntSaIS1_EES3_EvT_S5_RSaIT0_E.exit
	testq	%rbx, %rbx
	je	.LBB3_7
# %bb.8:
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_ZdlPv                          # TAILCALL
.LBB3_7:                                # %_ZNSt12_Vector_baseISt6vectorI3pntSaIS1_EESaIS3_EED2Ev.exit
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev, .Lfunc_end3-_ZNSt6vectorIS_I3pntSaIS0_EESaIS2_EED2Ev
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv,@function
_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv: # @_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movabsq	$384307168202282326, %rax       # imm = 0x555555555555556
	cmpq	%rax, %rsi
	jae	.LBB4_1
# %bb.3:
	shlq	$3, %rsi
	leaq	(%rsi,%rsi,2), %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB4_1:
	.cfi_def_cfa_offset 16
	movabsq	$768614336404564651, %rax       # imm = 0xAAAAAAAAAAAAAAB
	cmpq	%rax, %rsi
	jb	.LBB4_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB4_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end4:
	.size	_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv, .Lfunc_end4-_ZNSt15__new_allocatorISt6vectorI3pntSaIS1_EEE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm,"axG",@progbits,_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm,comdat
	.weak	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm # -- Begin function _ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	.p2align	1, 0x90
	.type	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm,@function
_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm: # @_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	.cfi_startproc
# %bb.0:
	testq	%rsi, %rsi
	je	.LBB5_19
# %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %r15
	movq	16(%rdi), %rax
	subq	%r15, %rax
	sarq	$3, %rax
	cmpq	%rsi, %rax
	jae	.LBB5_2
# %bb.7:
	movq	(%rbx), %r12
	subq	%r12, %r15
	movq	%r15, %r13
	sarq	$3, %r13
	movl	$.L.str.4, %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc
	testq	%rax, %rax
	movq	%rax, (%rsp)                    # 8-byte Spill
	je	.LBB5_8
# %bb.9:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorI3pntE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB5_10
.LBB5_2:
	movq	$0, (%r15)
	cmpq	$1, %r14
	jne	.LBB5_4
# %bb.3:
	addq	$8, %r15
	movq	%r15, %rax
	jmp	.LBB5_6
.LBB5_4:
	leaq	(%r15,%r14,8), %rax
	shlq	$3, %r14
	movl	$8, %ecx
.LBB5_5:                                # %.lr.ph.i.i.i.i.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movq	(%r15), %rdx
	movq	%rdx, (%r15,%rcx)
	addq	$8, %rcx
	cmpq	%rcx, %r14
	jne	.LBB5_5
.LBB5_6:                                # %_ZSt27__uninitialized_default_n_aIP3pntmS0_ET_S2_T0_RSaIT1_E.exit
	movq	%rax, 8(%rbx)
	jmp	.LBB5_18
.LBB5_8:
	xorl	%ebp, %ebp
.LBB5_10:
	leaq	(,%r13,8), %r13
	addq	%rbp, %r13
	movq	$0, (%r13)
	cmpq	$1, %r14
	je	.LBB5_13
# %bb.11:
	leaq	(,%r14,8), %rax
	movl	$8, %ecx
.LBB5_12:                               # %.lr.ph.i.i.i.i.i.i.i30
                                        # =>This Inner Loop Header: Depth=1
	movq	(%r13), %rdx
	movq	%rdx, (%r13,%rcx)
	addq	$8, %rcx
	cmpq	%rcx, %rax
	jne	.LBB5_12
.LBB5_13:                               # %_ZSt27__uninitialized_default_n_aIP3pntmS0_ET_S2_T0_RSaIT1_E.exit34
	testq	%r15, %r15
	jle	.LBB5_15
# %bb.14:
	movq	%rbp, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB5_15:                               # %_ZNSt6vectorI3pntSaIS0_EE11_S_relocateEPS0_S3_S3_RS1_.exit
	testq	%r12, %r12
	je	.LBB5_17
# %bb.16:
	movq	%r12, %rdi
	callq	_ZdlPv
.LBB5_17:                               # %_ZNSt12_Vector_baseI3pntSaIS0_EE13_M_deallocateEPS0_m.exit37
	movq	%rbp, (%rbx)
	leaq	(,%r14,8), %rax
	addq	%r13, %rax
	movq	%rax, 8(%rbx)
	movq	(%rsp), %rax                    # 8-byte Reload
	leaq	(,%rax,8), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
.LBB5_18:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB5_19:
	retq
.Lfunc_end5:
	.size	_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm, .Lfunc_end5-_ZNSt6vectorI3pntSaIS0_EE17_M_default_appendEm
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc,@function
_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc: # @_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$1152921504606846975, %rcx      # imm = 0xFFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$3, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB6_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %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	_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc, .Lfunc_end6-_ZNKSt6vectorI3pntSaIS0_EE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorI3pntE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorI3pntE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorI3pntE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorI3pntE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorI3pntE8allocateEmPKv,@function
_ZNSt15__new_allocatorI3pntE8allocateEmPKv: # @_ZNSt15__new_allocatorI3pntE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$60, %rax
	jne	.LBB7_1
# %bb.3:
	shlq	$3, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB7_1:
	.cfi_def_cfa_offset 16
	shrq	$61, %rsi
	je	.LBB7_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB7_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end7:
	.size	_ZNSt15__new_allocatorI3pntE8allocateEmPKv, .Lfunc_end7-_ZNSt15__new_allocatorI3pntE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"rb"
	.size	.L.str, 3

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%.2f\n"
	.size	.L.str.1, 6

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"cannot create std::vector larger than max_size()"
	.size	.L.str.3, 49

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"vector::_M_default_append"
	.size	.L.str.4, 26

	.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 __gxx_personality_v0
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt3cin
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
