#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <climits>
#include <cmath>

const int DIMENSION = 3;
const int BLOCK_SIZE = 1024;
const int BLOCK_ITEMS = 2048;
const int EXPONENT = 11;
const int DEVICE_ID = 0;
const int ELEMENTS = DIMENSION * DIMENSION;

void read_file(std::ifstream& file, const int number_of_matrices,
        const int number_of_matrices_std, std::vector<int>& v) {
    int first, second, third;
    std::string dump;

    for (int k = 0; k < number_of_matrices; k++) {
        file >> dump;

        for (int i = 0; i < ELEMENTS; i += DIMENSION) {
            file >> first >> second >> third;
            v[(number_of_matrices_std * i) + k] = first;
            v[(number_of_matrices_std * (i + 1)) + k] = second;
            v[(number_of_matrices_std * (i + 2)) + k] = third;
        }
    }
}

std::vector<int> set_host_v(char* filename) {
    int number_of_matrices;
    std::ifstream file(filename);

    if (file.is_open()) file >> number_of_matrices;

    int number_of_matrices_std = ceil(number_of_matrices / (double) BLOCK_ITEMS) * BLOCK_ITEMS;
    std::vector<int> v (ELEMENTS * number_of_matrices_std, INT_MAX);
    read_file(file, number_of_matrices, number_of_matrices_std, v);

    file.close();
    return v;
}

void set_device_v(int number_of_matrices, std::vector<int>& host_v, void*& device_v) {
    int block_size = ELEMENTS * number_of_matrices * sizeof(int);
    cudaMalloc(&device_v, block_size);
    cudaMemcpy(device_v, host_v.data(), block_size, cudaMemcpyHostToDevice);
}

__global__ void reduce_block(void* m) {
    int* m_int = (int*) m;
    int index = (BLOCK_ITEMS * blockIdx.x) + threadIdx.x;
    __shared__ int m_shared[BLOCK_ITEMS];

    m_shared[threadIdx.x] = m_int[index];
    m_shared[BLOCK_SIZE + threadIdx.x] = m_int[BLOCK_SIZE + index];

    for (int block_size = BLOCK_ITEMS; block_size > 1; block_size >>= 1) {
        int index_1 = threadIdx.x;
        int index_2 = index_1 + (block_size / 2);

        if (threadIdx.x >= (block_size >> 1))
            return;

        m_shared[index_1] = min(m_shared[index_1], m_shared[index_2]);
        __syncthreads();
    }

    if (threadIdx.x == 0)
        m_int[index] = m_shared[0];
}

__global__ void compress_block(void* v, int number_of_matrices, int offset) {
    int* v_int = (int*) v;

    int index_compressed =
        (blockIdx.x * number_of_matrices) + threadIdx.x +
        (offset * BLOCK_SIZE);

    int index_expanded =
        (blockIdx.x * number_of_matrices) + threadIdx.x * BLOCK_ITEMS +
        (offset * BLOCK_ITEMS * BLOCK_SIZE);

    v_int[index_compressed] = v_int[index_expanded];
    __syncthreads();
}

__global__ void compress_line(void* v, int line,
        int number_of_blocks, int next_number_of_blocks) {

    int index_expanded_1 = line * number_of_blocks * BLOCK_ITEMS + threadIdx.x;
    int index_compressed_1 = line * next_number_of_blocks * BLOCK_ITEMS + threadIdx.x;

    int index_expanded_2 = line * number_of_blocks * BLOCK_ITEMS +
        BLOCK_SIZE + threadIdx.x;
    int index_compressed_2 = line * next_number_of_blocks * BLOCK_ITEMS +
        BLOCK_SIZE + threadIdx.x;

    int* v_int = (int*) v;
    v_int[index_compressed_1] = v_int[index_expanded_1];
    v_int[index_compressed_2] = v_int[index_expanded_2];
}

__global__ void final_compress(void* v, int number_of_matrices) {
    int* v_int = (int*) v;
    for (int i = 0; i < ELEMENTS; i++) {
        v_int[i] = v_int[i * BLOCK_ITEMS];
    }
}

void print_result_matrix(void* device_v) {
    int result[ELEMENTS];

    cudaMemcpy((void*)result, device_v, ELEMENTS * sizeof(int), cudaMemcpyDeviceToHost);

    for (int i = 0; i < ELEMENTS; i++) {
        std::cout << result[i];
        if ((i + 1) % DIMENSION) std::cout << " ";
        else std::cout << std::endl;
    }
}

int main(int argc, char* argv[]) {
    void* device_v;
    cudaSetDevice(DEVICE_ID);

    std::vector<int> host_v = set_host_v(argv[1]);
    int number_of_matrices = host_v.size() / ELEMENTS;

    set_device_v(number_of_matrices, host_v, device_v);

    for (int k = number_of_matrices; k > 1; k >>= EXPONENT) {
        k = ceil(k / (double) BLOCK_ITEMS) * BLOCK_ITEMS;

        // Reduction
        int number_of_blocks = k >> EXPONENT;
        reduce_block<<< number_of_blocks * ELEMENTS, BLOCK_SIZE >>>(device_v);

        int next_number_of_blocks = ceil (number_of_blocks / (double) BLOCK_ITEMS);
        /* std::cout << next_number_of_blocks << " " << number_of_blocks << std::endl; */

        // Compression
        int threads_per_block = (number_of_blocks < BLOCK_SIZE)?
            number_of_blocks : BLOCK_SIZE;
        for (int i = 0; i < number_of_blocks >> 10; i++)
            compress_block<<< ELEMENTS, threads_per_block >>> (device_v, k, i);

        for (int i = 1; i < ELEMENTS && number_of_blocks > 1; i++)
            compress_line<<< 1, BLOCK_SIZE >>>
                (device_v, i, number_of_blocks, next_number_of_blocks);
    }

    final_compress<<<1,1>>>(device_v, number_of_matrices);
    print_result_matrix(device_v);

    cudaDeviceReset();
    return(0);
}

	.file	"tmpxft_0032acbe_00000000-6_main.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4203:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4203:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
	.type	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE, @function
_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE:
.LFB4186:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4186
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leal	(%rdx,%rdx,2), %ebp
	movslq	%edx, %rdx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%ebp, %rbp
	leaq	0(,%rdx,4), %rbx
	salq	$2, %rbp
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 8(%rsp)
	movl	%esi, 20(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	movb	$0, 72(%rsp)
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rax, 64(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, (%rsp)
.L3:
	cmpl	%r12d, 20(%rsp)
	jle	.L14
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
.LEHB0:
	call	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	leaq	44(%rsp), %rax
	leaq	0(,%r12,4), %r13
	movl	$3, %r15d
	movq	%rax, 24(%rsp)
.L4:
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_ZNSirsERi@PLT
	movq	%rax, %rdi
	leaq	48(%rsp), %rsi
	call	_ZNSirsERi@PLT
	movq	%rax, %rdi
	leaq	52(%rsp), %rsi
	call	_ZNSirsERi@PLT
.LEHE0:
	movq	(%r14), %rax
	movl	44(%rsp), %edx
	movl	%edx, (%rax,%r13)
	movl	48(%rsp), %ecx
	leaq	0(%r13,%rbx), %rdx
	addq	%rbp, %r13
	movl	%ecx, (%rax,%rdx)
	addq	%rdx, %rax
	movl	52(%rsp), %edx
	movl	%edx, (%rax,%rbx)
	decl	%r15d
	jne	.L4
	incq	%r12
	jmp	.L3
.L14:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L8
	jmp	.L11
.L9:
	endbr64
	movq	%rax, %rbx
.L6:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L11:
	call	__stack_chk_fail@PLT
.L8:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4186:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4186:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4186-.LLSDACSB4186
.LLSDACSB4186:
	.uleb128 .LEHB0-.LFB4186
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L9-.LFB4186
	.uleb128 0
	.uleb128 .LEHB1-.LFB4186
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4186:
	.text
	.size	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE, .-_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
	.globl	_Z12set_device_viRSt6vectorIiSaIiEERPv
	.type	_Z12set_device_viRSt6vectorIiSaIiEERPv, @function
_Z12set_device_viRSt6vectorIiSaIiEERPv:
.LFB4198:
	.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
	leal	(%rdi,%rdi,8), %ebx
	movq	%rdx, %rdi
	sall	$2, %ebx
	movslq	%ebx, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	(%r12), %rsi
	movq	0(%rbp), %rdi
	movq	%rbx, %rdx
	movl	$1, %ecx
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE4198:
	.size	_Z12set_device_viRSt6vectorIiSaIiEERPv, .-_Z12set_device_viRSt6vectorIiSaIiEERPv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_Z19print_result_matrixPv
	.type	_Z19print_result_matrixPv, @function
_Z19print_result_matrixPv:
.LFB4199:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %rsi
	movl	$2, %ecx
	movl	$36, %edx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	_ZSt4cout(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	$1, %ebx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
.L20:
	movl	-4(%r12,%rbx,4), %esi
	movq	%rbp, %rdi
	call	_ZNSolsEi@PLT
	imull	$-1431655765, %ebx, %eax
	cmpl	$1431655765, %eax
	jbe	.L18
	movl	$1, %edx
	leaq	.LC0(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	jmp	.L19
.L18:
	movq	%rbp, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L19:
	incq	%rbx
	cmpq	$10, %rbx
	jne	.L20
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4199:
	.size	_Z19print_result_matrixPv, .-_Z19print_result_matrixPv
	.globl	_Z32__device_stub__Z12reduce_blockPvPv
	.type	_Z32__device_stub__Z12reduce_blockPvPv, @function
_Z32__device_stub__Z12reduce_blockPvPv:
.LFB4225:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	44(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	pushq	24(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z12reduce_blockPv(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 128
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L24:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4225:
	.size	_Z32__device_stub__Z12reduce_blockPvPv, .-_Z32__device_stub__Z12reduce_blockPvPv
	.globl	_Z12reduce_blockPv
	.type	_Z12reduce_blockPv, @function
_Z12reduce_blockPv:
.LFB4226:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z12reduce_blockPvPv
	.cfi_endproc
.LFE4226:
	.size	_Z12reduce_blockPv, .-_Z12reduce_blockPv
	.globl	_Z36__device_stub__Z14compress_blockPviiPvii
	.type	_Z36__device_stub__Z14compress_blockPviiPvii, @function
_Z36__device_stub__Z14compress_blockPviiPvii:
.LFB4227:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movl	%edx, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L29
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z14compress_blockPvii(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L29:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4227:
	.size	_Z36__device_stub__Z14compress_blockPviiPvii, .-_Z36__device_stub__Z14compress_blockPviiPvii
	.globl	_Z14compress_blockPvii
	.type	_Z14compress_blockPvii, @function
_Z14compress_blockPvii:
.LFB4228:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z14compress_blockPviiPvii
	.cfi_endproc
.LFE4228:
	.size	_Z14compress_blockPvii, .-_Z14compress_blockPvii
	.globl	_Z36__device_stub__Z13compress_linePviiiPviii
	.type	_Z36__device_stub__Z13compress_linePviiiPviii, @function
_Z36__device_stub__Z13compress_linePviiiPviii:
.LFB4229:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z13compress_linePviii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L34:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4229:
	.size	_Z36__device_stub__Z13compress_linePviiiPviii, .-_Z36__device_stub__Z13compress_linePviiiPviii
	.globl	_Z13compress_linePviii
	.type	_Z13compress_linePviii, @function
_Z13compress_linePviii:
.LFB4230:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z13compress_linePviiiPviii
	.cfi_endproc
.LFE4230:
	.size	_Z13compress_linePviii, .-_Z13compress_linePviii
	.globl	_Z35__device_stub__Z14final_compressPviPvi
	.type	_Z35__device_stub__Z14final_compressPviPvi, @function
_Z35__device_stub__Z14final_compressPviPvi:
.LFB4231:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movl	%esi, 4(%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z14final_compressPvi(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L39:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4231:
	.size	_Z35__device_stub__Z14final_compressPviPvi, .-_Z35__device_stub__Z14final_compressPviPvi
	.globl	_Z14final_compressPvi
	.type	_Z14final_compressPvi, @function
_Z14final_compressPvi:
.LFB4232:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z14final_compressPviPvi
	.cfi_endproc
.LFE4232:
	.size	_Z14final_compressPvi, .-_Z14final_compressPvi
	.section	.rodata.str1.1
.LC1:
	.string	"_Z14final_compressPvi"
.LC2:
	.string	"_Z13compress_linePviii"
.LC3:
	.string	"_Z14compress_blockPvii"
.LC4:
	.string	"_Z12reduce_blockPv"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4234:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC1(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z14final_compressPvi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13compress_linePviii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC3(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14compress_blockPvii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC4(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12reduce_blockPv(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4234:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB4572:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L46
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L46:
	ret
	.cfi_endproc
.LFE4572:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.rodata.str1.1
.LC7:
	.string	"cannot create std::vector larger than max_size()"
	.text
	.globl	_Z10set_host_vPc
	.type	_Z10set_host_vPc, @function
_Z10set_host_vPc:
.LFB4188:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4188
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$8, %edx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdi, %rbx
	subq	$544, %rsp
	.cfi_def_cfa_offset 592
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB2:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE2:
	leaq	136(%rsp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	jne	.L49
.L52:
	cvtsi2sdl	12(%rsp), %xmm0
	mulsd	.LC5(%rip), %xmm0
	call	ceil@PLT
	mulsd	.LC6(%rip), %xmm0
	movabsq	$2305843009213693951, %rax
	cvttsd2sil	%xmm0, %r14d
	leal	(%r14,%r14,8), %r12d
	movslq	%r12d, %r12
	cmpq	%r12, %rax
	jnb	.L68
	jmp	.L72
.L49:
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
.LEHB3:
	call	_ZNSirsERi@PLT
	jmp	.L52
.L72:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L69
	leaq	.LC7(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L68:
	xorl	%eax, %eax
	leaq	0(,%r12,4), %r13
	movq	%rax, (%rbx)
	movq	%rax, 8(%rbx)
	movq	%rax, 16(%rbx)
	testq	%r12, %r12
	je	.L62
	movq	%r13, %rdi
	call	_Znwm@PLT
.LEHE3:
	jmp	.L54
.L62:
	xorl	%eax, %eax
.L54:
	addq	%rax, %r13
	movq	%rax, (%rbx)
	movq	%r13, 16(%rbx)
	testq	%r12, %r12
	je	.L55
.L56:
	cmpq	%rax, %r13
	je	.L55
	movl	$2147483647, (%rax)
	addq	$4, %rax
	jmp	.L56
.L55:
	movq	%rax, 8(%rbx)
	movl	12(%rsp), %esi
	movq	%rbx, %rcx
	movl	%r14d, %edx
	movq	%rbp, %rdi
.LEHB4:
	call	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE4:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L61
	jmp	.L69
.L64:
	endbr64
	movq	%rax, %r12
.L58:
	movq	%rbx, %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L59
.L63:
	endbr64
	movq	%rax, %r12
.L59:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L69
	movq	%r12, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L69:
	call	__stack_chk_fail@PLT
.L61:
	addq	$544, %rsp
	.cfi_def_cfa_offset 48
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4188:
	.section	.gcc_except_table
.LLSDA4188:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4188-.LLSDACSB4188
.LLSDACSB4188:
	.uleb128 .LEHB2-.LFB4188
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB3-.LFB4188
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L63-.LFB4188
	.uleb128 0
	.uleb128 .LEHB4-.LFB4188
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L64-.LFB4188
	.uleb128 0
	.uleb128 .LEHB5-.LFB4188
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE4188:
	.text
	.size	_Z10set_host_vPc, .-_Z10set_host_vPc
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4200:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4200
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	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
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
.LEHB6:
	call	cudaSetDevice@PLT
	leaq	48(%rsp), %rax
	movq	8(%rbx), %rsi
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_Z10set_host_vPc
.LEHE6:
	movq	56(%rsp), %rbx
	xorl	%edx, %edx
	movq	(%rsp), %rsi
	subq	48(%rsp), %rbx
	movl	$9, %ecx
	sarq	$2, %rbx
	movq	%rbx, %rax
	divq	%rcx
	leaq	16(%rsp), %rdx
	movl	%eax, %edi
	movl	%eax, 12(%rsp)
	movq	%rax, %rbx
.LEHB7:
	call	_Z12set_device_viRSt6vectorIiSaIiEERPv
.L74:
	cmpl	$1, %ebx
	jle	.L94
	cvtsi2sdl	%ebx, %xmm0
	mulsd	.LC5(%rip), %xmm0
	call	ceil@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	mulsd	.LC6(%rip), %xmm0
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, 44(%rsp)
	movq	%rdx, 36(%rsp)
	cvttsd2sil	%xmm0, %r12d
	movl	%r12d, %ebx
	sarl	$11, %ebx
	leal	(%rbx,%rbx,8), %eax
	movl	%eax, 24(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L75
	movq	16(%rsp), %rdi
	call	_Z32__device_stub__Z12reduce_blockPvPv
.L75:
	cvtsi2sdl	%ebx, %xmm0
	movl	%r12d, %r15d
	xorl	%ebp, %ebp
	movabsq	$4294968320, %r13
	mulsd	.LC5(%rip), %xmm0
	sarl	$21, %r15d
	call	ceil@PLT
	cvttsd2sil	%xmm0, %r14d
.L76:
	cmpl	%ebp, %r15d
	jle	.L98
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, %rdx
	movl	$1, %ecx
	movabsq	$4294967305, %rdi
	movl	$1, %esi
	movq	%r13, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L77
	movq	16(%rsp), %rdi
	movl	%ebp, %edx
	movl	%r12d, %esi
	call	_Z36__device_stub__Z14compress_blockPviiPvii
.L77:
	incl	%ebp
	jmp	.L76
.L98:
	movabsq	$4294968320, %r12
	movl	$1, %ebp
.L79:
	cmpl	$1, %ebx
	jle	.L94
	cmpl	$9, %ebp
	je	.L74
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r12, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%r12, 36(%rsp)
	movl	$1, 44(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L80
	movq	16(%rsp), %rdi
	movl	%r14d, %ecx
	movl	%ebx, %edx
	movl	%ebp, %esi
	call	_Z36__device_stub__Z13compress_linePviiiPviii
.L80:
	incl	%ebp
	jmp	.L79
.L94:
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 44(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 36(%rsp)
	movq	%rdi, 24(%rsp)
	movl	$1, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	movq	16(%rsp), %rdi
	testl	%eax, %eax
	jne	.L84
	movl	12(%rsp), %esi
	call	_Z35__device_stub__Z14final_compressPviPvi
.L84:
	movq	16(%rsp), %rdi
	call	_Z19print_result_matrixPv
	call	cudaDeviceReset@PLT
.LEHE7:
	movq	(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L87
	jmp	.L96
.L89:
	endbr64
	movq	%rax, %rbx
.L85:
	movq	(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L96
	movq	%rbx, %rdi
.LEHB8:
	call	_Unwind_Resume@PLT
.LEHE8:
.L96:
	call	__stack_chk_fail@PLT
.L87:
	addq	$88, %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
.LFE4200:
	.section	.gcc_except_table
.LLSDA4200:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4200-.LLSDACSB4200
.LLSDACSB4200:
	.uleb128 .LEHB6-.LFB4200
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB4200
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L89-.LFB4200
	.uleb128 0
	.uleb128 .LEHB8-.LFB4200
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
.LLSDACSE4200:
	.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
.LC5:
	.long	0
	.long	1061158912
	.align 8
.LC6:
	.long	0
	.long	1084227584
	.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 <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <climits>
#include <cmath>

const int DIMENSION = 3;
const int BLOCK_SIZE = 1024;
const int BLOCK_ITEMS = 2048;
const int EXPONENT = 11;
const int DEVICE_ID = 0;
const int ELEMENTS = DIMENSION * DIMENSION;

void read_file(std::ifstream& file, const int number_of_matrices,
        const int number_of_matrices_std, std::vector<int>& v) {
    int first, second, third;
    std::string dump;

    for (int k = 0; k < number_of_matrices; k++) {
        file >> dump;

        for (int i = 0; i < ELEMENTS; i += DIMENSION) {
            file >> first >> second >> third;
            v[(number_of_matrices_std * i) + k] = first;
            v[(number_of_matrices_std * (i + 1)) + k] = second;
            v[(number_of_matrices_std * (i + 2)) + k] = third;
        }
    }
}

std::vector<int> set_host_v(char* filename) {
    int number_of_matrices;
    std::ifstream file(filename);

    if (file.is_open()) file >> number_of_matrices;

    int number_of_matrices_std = ceil(number_of_matrices / (double) BLOCK_ITEMS) * BLOCK_ITEMS;
    std::vector<int> v (ELEMENTS * number_of_matrices_std, INT_MAX);
    read_file(file, number_of_matrices, number_of_matrices_std, v);

    file.close();
    return v;
}

void set_device_v(int number_of_matrices, std::vector<int>& host_v, void*& device_v) {
    int block_size = ELEMENTS * number_of_matrices * sizeof(int);
    hipMalloc(&device_v, block_size);
    hipMemcpy(device_v, host_v.data(), block_size, hipMemcpyHostToDevice);
}

__global__ void reduce_block(void* m) {
    int* m_int = (int*) m;
    int index = (BLOCK_ITEMS * blockIdx.x) + threadIdx.x;
    __shared__ int m_shared[BLOCK_ITEMS];

    m_shared[threadIdx.x] = m_int[index];
    m_shared[BLOCK_SIZE + threadIdx.x] = m_int[BLOCK_SIZE + index];

    for (int block_size = BLOCK_ITEMS; block_size > 1; block_size >>= 1) {
        int index_1 = threadIdx.x;
        int index_2 = index_1 + (block_size / 2);

        if (threadIdx.x >= (block_size >> 1))
            return;

        m_shared[index_1] = min(m_shared[index_1], m_shared[index_2]);
        __syncthreads();
    }

    if (threadIdx.x == 0)
        m_int[index] = m_shared[0];
}

__global__ void compress_block(void* v, int number_of_matrices, int offset) {
    int* v_int = (int*) v;

    int index_compressed =
        (blockIdx.x * number_of_matrices) + threadIdx.x +
        (offset * BLOCK_SIZE);

    int index_expanded =
        (blockIdx.x * number_of_matrices) + threadIdx.x * BLOCK_ITEMS +
        (offset * BLOCK_ITEMS * BLOCK_SIZE);

    v_int[index_compressed] = v_int[index_expanded];
    __syncthreads();
}

__global__ void compress_line(void* v, int line,
        int number_of_blocks, int next_number_of_blocks) {

    int index_expanded_1 = line * number_of_blocks * BLOCK_ITEMS + threadIdx.x;
    int index_compressed_1 = line * next_number_of_blocks * BLOCK_ITEMS + threadIdx.x;

    int index_expanded_2 = line * number_of_blocks * BLOCK_ITEMS +
        BLOCK_SIZE + threadIdx.x;
    int index_compressed_2 = line * next_number_of_blocks * BLOCK_ITEMS +
        BLOCK_SIZE + threadIdx.x;

    int* v_int = (int*) v;
    v_int[index_compressed_1] = v_int[index_expanded_1];
    v_int[index_compressed_2] = v_int[index_expanded_2];
}

__global__ void final_compress(void* v, int number_of_matrices) {
    int* v_int = (int*) v;
    for (int i = 0; i < ELEMENTS; i++) {
        v_int[i] = v_int[i * BLOCK_ITEMS];
    }
}

void print_result_matrix(void* device_v) {
    int result[ELEMENTS];

    hipMemcpy((void*)result, device_v, ELEMENTS * sizeof(int), hipMemcpyDeviceToHost);

    for (int i = 0; i < ELEMENTS; i++) {
        std::cout << result[i];
        if ((i + 1) % DIMENSION) std::cout << " ";
        else std::cout << std::endl;
    }
}

int main(int argc, char* argv[]) {
    void* device_v;
    hipSetDevice(DEVICE_ID);

    std::vector<int> host_v = set_host_v(argv[1]);
    int number_of_matrices = host_v.size() / ELEMENTS;

    set_device_v(number_of_matrices, host_v, device_v);

    for (int k = number_of_matrices; k > 1; k >>= EXPONENT) {
        k = ceil(k / (double) BLOCK_ITEMS) * BLOCK_ITEMS;

        // Reduction
        int number_of_blocks = k >> EXPONENT;
        reduce_block<<< number_of_blocks * ELEMENTS, BLOCK_SIZE >>>(device_v);

        int next_number_of_blocks = ceil (number_of_blocks / (double) BLOCK_ITEMS);
        /* std::cout << next_number_of_blocks << " " << number_of_blocks << std::endl; */

        // Compression
        int threads_per_block = (number_of_blocks < BLOCK_SIZE)?
            number_of_blocks : BLOCK_SIZE;
        for (int i = 0; i < number_of_blocks >> 10; i++)
            compress_block<<< ELEMENTS, threads_per_block >>> (device_v, k, i);

        for (int i = 1; i < ELEMENTS && number_of_blocks > 1; i++)
            compress_line<<< 1, BLOCK_SIZE >>>
                (device_v, i, number_of_blocks, next_number_of_blocks);
    }

    final_compress<<<1,1>>>(device_v, number_of_matrices);
    print_result_matrix(device_v);

    hipDeviceReset();
    return(0);
}

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

                                        # End of file scope inline assembly
	.globl	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE # -- Begin function _Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
	.type	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE,@function
_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE: # @_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
.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	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, 48(%rsp)                  # 8-byte Spill
	leaq	72(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
	testl	%esi, %esi
	jle	.LBB0_11
# %bb.1:                                # %.lr.ph.preheader
	movq	%rdi, %r14
	movslq	%edx, %r15
	movl	%esi, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	leaq	(,%r15,8), %r12
	shlq	$2, %r15
	leaq	(%r15,%r15,2), %r13
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
.LBB0_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
.Ltmp0:
	movq	%r14, %rdi
	leaq	56(%rsp), %rsi
	callq	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE
.Ltmp1:
# %bb.3:                                # %.preheader.preheader
                                        #   in Loop: Header=BB0_2 Depth=1
	movq	$-3, %rbp
	movq	%rbx, 40(%rsp)                  # 8-byte Spill
.LBB0_4:                                # %.preheader
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp3:
	movq	%r14, %rdi
	leaq	20(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp4:
# %bb.5:                                #   in Loop: Header=BB0_4 Depth=2
.Ltmp5:
	movq	%rax, %rdi
	leaq	16(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp6:
# %bb.6:                                #   in Loop: Header=BB0_4 Depth=2
.Ltmp7:
	movq	%rax, %rdi
	leaq	12(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp8:
# %bb.7:                                #   in Loop: Header=BB0_4 Depth=2
	movl	20(%rsp), %eax
	movq	48(%rsp), %rcx                  # 8-byte Reload
	movq	(%rcx), %rcx
	movl	%eax, (%rcx,%rbx)
	addq	%rbx, %rcx
	movl	16(%rsp), %eax
	movl	%eax, (%r15,%rcx)
	movl	12(%rsp), %eax
	movl	%eax, (%r12,%rcx)
	addq	$3, %rbp
	addq	%r13, %rbx
	cmpq	$6, %rbp
	jb	.LBB0_4
# %bb.8:                                #   in Loop: Header=BB0_2 Depth=1
	movq	24(%rsp), %rcx                  # 8-byte Reload
	incq	%rcx
	movq	40(%rsp), %rbx                  # 8-byte Reload
	addq	$4, %rbx
	movq	%rcx, %rax
	movq	%rcx, 24(%rsp)                  # 8-byte Spill
	cmpq	32(%rsp), %rcx                  # 8-byte Folded Reload
	jne	.LBB0_2
# %bb.9:                                # %._crit_edge
	movq	56(%rsp), %rdi
	leaq	72(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB0_11
# %bb.10:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB0_11:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_12:
	.cfi_def_cfa_offset 144
.Ltmp2:
	jmp	.LBB0_14
.LBB0_13:
.Ltmp9:
.LBB0_14:
	movq	%rax, %rbx
	movq	56(%rsp), %rdi
	leaq	72(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB0_16
# %bb.15:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i24
	callq	_ZdlPv
.LBB0_16:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit26
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end0:
	.size	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE, .Lfunc_end0-_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
	.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 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp8-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Lfunc_end0-.Ltmp8             #   Call between .Ltmp8 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z10set_host_vPc
.LCPI1_0:
	.quad	0x3f40000000000000              # double 4.8828125E-4
.LCPI1_1:
	.quad	0x40a0000000000000              # double 2048
	.text
	.globl	_Z10set_host_vPc
	.type	_Z10set_host_vPc,@function
_Z10set_host_vPc:                       # @_Z10set_host_vPc
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$536, %rsp                      # imm = 0x218
	.cfi_def_cfa_offset 560
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	leaq	16(%rsp), %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	leaq	136(%rsp), %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	xorpd	%xmm0, %xmm0
	testb	%al, %al
	je	.LBB1_3
# %bb.1:
.Ltmp10:
	leaq	16(%rsp), %rdi
	leaq	8(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp11:
# %bb.2:                                # %._crit_edge
	xorps	%xmm0, %xmm0
	cvtsi2sdl	8(%rsp), %xmm0
	mulsd	.LCPI1_0(%rip), %xmm0
.LBB1_3:
	callq	ceil@PLT
	mulsd	.LCPI1_1(%rip), %xmm0
	cvttsd2si	%xmm0, %r14d
	leal	(%r14,%r14,8), %eax
	movslq	%eax, %rsi
	leaq	12(%rsp), %rdx
	movl	$2147483647, (%rdx)             # imm = 0x7FFFFFFF
.Ltmp13:
	leaq	7(%rsp), %rcx
	movq	%rbx, %rdi
	callq	_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_
.Ltmp14:
# %bb.4:
	movl	8(%rsp), %esi
.Ltmp16:
	leaq	16(%rsp), %rdi
	movl	%r14d, %edx
	movq	%rbx, %rcx
	callq	_Z9read_fileRSt14basic_ifstreamIcSt11char_traitsIcEEiiRSt6vectorIiSaIiEE
.Ltmp17:
# %bb.5:
.Ltmp18:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp19:
# %bb.6:
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rax
	addq	$536, %rsp                      # imm = 0x218
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB1_10:
	.cfi_def_cfa_offset 560
.Ltmp12:
	jmp	.LBB1_11
.LBB1_7:
.Ltmp15:
.LBB1_11:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	movq	%rax, %r14
	jmp	.LBB1_12
.LBB1_8:
.Ltmp20:
	movq	%rax, %r14
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	.LBB1_12
# %bb.9:
	callq	_ZdlPv
.LBB1_12:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	leaq	16(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	_Z10set_host_vPc, .Lfunc_end1-_Z10set_host_vPc
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp10-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp10
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp11-.Ltmp10                #   Call between .Ltmp10 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin1          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp13-.Ltmp11                #   Call between .Ltmp11 and .Ltmp13
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp14-.Ltmp13                #   Call between .Ltmp13 and .Ltmp14
	.uleb128 .Ltmp15-.Lfunc_begin1          #     jumps to .Ltmp15
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp16-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Ltmp19-.Ltmp16                #   Call between .Ltmp16 and .Ltmp19
	.uleb128 .Ltmp20-.Lfunc_begin1          #     jumps to .Ltmp20
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin1          # >> Call Site 6 <<
	.uleb128 .Lfunc_end1-.Ltmp19            #   Call between .Ltmp19 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIiSaIiEEC2EmRKiRKS0_,"axG",@progbits,_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_,comdat
	.weak	_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_ # -- Begin function _ZNSt6vectorIiSaIiEEC2EmRKiRKS0_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_,@function
_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_:       # @_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB2_6
# %bb.1:                                # %_ZNSt6vectorIiSaIiEE17_S_check_init_lenEmRKS0_.exit
	movq	%rsi, %r14
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rdi)
	movq	$0, 16(%rdi)
	testq	%rsi, %rsi
	je	.LBB2_2
# %bb.3:
	movq	%rdx, %r15
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIiE8allocateEmPKv
	movq	%rax, (%rbx)
	leaq	(%rax,%r14,4), %rcx
	movq	%rcx, 16(%rbx)
	movl	(%r15), %edx
	shlq	$2, %r14
.LBB2_4:                                # %.lr.ph.i.i.i.i.i.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movl	%edx, (%rax,%r12)
	addq	$4, %r12
	cmpq	%r12, %r14
	jne	.LBB2_4
	jmp	.LBB2_5
.LBB2_2:                                # %_ZNSt12_Vector_baseIiSaIiEEC2EmRKS0_.exit.thread
	movups	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	xorl	%ecx, %ecx
.LBB2_5:                                # %.loopexit
	movq	%rcx, 8(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB2_6:
	.cfi_def_cfa_offset 48
	movl	$.L.str.1, %edi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end2:
	.size	_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_, .Lfunc_end2-_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z12set_device_viRSt6vectorIiSaIiEERPv # -- Begin function _Z12set_device_viRSt6vectorIiSaIiEERPv
	.type	_Z12set_device_viRSt6vectorIiSaIiEERPv,@function
_Z12set_device_viRSt6vectorIiSaIiEERPv: # @_Z12set_device_viRSt6vectorIiSaIiEERPv
	.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	%rdx, %rbx
	movq	%rsi, %r14
                                        # kill: def $edi killed $edi def $rdi
	shll	$2, %edi
	leal	(%rdi,%rdi,8), %eax
	movslq	%eax, %r15
	movq	%rdx, %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movq	(%rbx), %rdi
	movq	(%r14), %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end3:
	.size	_Z12set_device_viRSt6vectorIiSaIiEERPv, .Lfunc_end3-_Z12set_device_viRSt6vectorIiSaIiEERPv
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__reduce_blockPv # -- Begin function _Z27__device_stub__reduce_blockPv
	.type	_Z27__device_stub__reduce_blockPv,@function
_Z27__device_stub__reduce_blockPv:      # @_Z27__device_stub__reduce_blockPv
	.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	$64, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	movq	%rsp, %rbx
	movq	%rax, (%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z12reduce_blockPv, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$80, %rsp
	.cfi_adjust_cfa_offset -80
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z27__device_stub__reduce_blockPv, .Lfunc_end4-_Z27__device_stub__reduce_blockPv
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__compress_blockPvii # -- Begin function _Z29__device_stub__compress_blockPvii
	.type	_Z29__device_stub__compress_blockPvii,@function
_Z29__device_stub__compress_blockPvii:  # @_Z29__device_stub__compress_blockPvii
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	movq	%rsp, %rsi
	movl	%edx, (%rsi)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z14compress_blockPvii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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_end5:
	.size	_Z29__device_stub__compress_blockPvii, .Lfunc_end5-_Z29__device_stub__compress_blockPvii
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__compress_linePviii # -- Begin function _Z28__device_stub__compress_linePviii
	.type	_Z28__device_stub__compress_linePviii,@function
_Z28__device_stub__compress_linePviii:  # @_Z28__device_stub__compress_linePviii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13compress_linePviii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z28__device_stub__compress_linePviii, .Lfunc_end6-_Z28__device_stub__compress_linePviii
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__final_compressPvi # -- Begin function _Z29__device_stub__final_compressPvi
	.type	_Z29__device_stub__final_compressPvi,@function
_Z29__device_stub__final_compressPvi:   # @_Z29__device_stub__final_compressPvi
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z14final_compressPvi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end7:
	.size	_Z29__device_stub__final_compressPvi, .Lfunc_end7-_Z29__device_stub__final_compressPvi
	.cfi_endproc
                                        # -- End function
	.globl	_Z19print_result_matrixPv       # -- Begin function _Z19print_result_matrixPv
	.type	_Z19print_result_matrixPv,@function
_Z19print_result_matrixPv:              # @_Z19print_result_matrixPv
	.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	$48, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rsi
	movq	%rsp, %rdi
	movl	$36, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$1, %ebx
	xorl	%r15d, %r15d
	movabsq	$-6148914691236517205, %r12     # imm = 0xAAAAAAAAAAAAAAAB
	movl	$_ZSt4cout, %r13d
.LBB8_1:                                # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rax
	mulq	%r12
	movq	%rdx, %r14
	shrl	%r14d
	movl	(%rsp,%r15,4), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	leal	(%r14,%r14,2), %eax
	decb	%al
	cmpb	%r15b, %al
	jne	.LBB8_2
# %bb.3:                                #   in Loop: Header=BB8_1 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	jmp	.LBB8_4
.LBB8_2:                                #   in Loop: Header=BB8_1 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB8_4:                                #   in Loop: Header=BB8_1 Depth=1
	incq	%r15
	incq	%rbx
	cmpq	$9, %r15
	jne	.LBB8_1
# %bb.5:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z19print_result_matrixPv, .Lfunc_end8-_Z19print_result_matrixPv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI9_0:
	.quad	0x3f40000000000000              # double 4.8828125E-4
.LCPI9_1:
	.quad	0x40a0000000000000              # double 2048
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.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
	xorl	%edi, %edi
	callq	hipSetDevice
	movq	8(%rbx), %rsi
	leaq	32(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_Z10set_host_vPc
	movq	8(%rbx), %rax
	subq	(%rbx), %rax
	sarq	$2, %rax
	movabsq	$-2049638230412172401, %rcx     # imm = 0xE38E38E38E38E38F
	mulq	%rcx
	shrq	$3, %rdx
	movq	%rdx, %rax
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	shlq	$34, %rax
	leaq	(%rax,%rax,8), %rbx
	sarq	$32, %rbx
.Ltmp21:
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
.Ltmp22:
# %bb.1:                                # %.noexc
	movq	8(%rsp), %rdi
	movq	32(%rsp), %rsi
.Ltmp23:
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp24:
# %bb.2:                                # %_Z12set_device_viRSt6vectorIiSaIiEERPv.exit.preheader
	cmpl	$2, 16(%rsp)                    # 4-byte Folded Reload
	jl	.LBB9_20
# %bb.3:                                # %.lr.ph81.preheader
	movabsq	$4294968320, %r14               # imm = 0x100000400
	movq	16(%rsp), %r13                  # 8-byte Reload
                                        # kill: def $r13d killed $r13d killed $r13 def $r13
.LBB9_4:                                # %.lr.ph81
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_9 Depth 2
                                        #     Child Loop BB9_15 Depth 2
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13d, %xmm0
	mulsd	.LCPI9_0(%rip), %xmm0
	callq	ceil@PLT
	mulsd	.LCPI9_1(%rip), %xmm0
	cvttsd2si	%xmm0, %r12d
	movl	%r12d, %r13d
	sarl	$11, %r13d
	leal	(%r13,%r13,8), %edi
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdi
.Ltmp25:
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp26:
# %bb.5:                                #   in Loop: Header=BB9_4 Depth=1
	testl	%eax, %eax
	jne	.LBB9_7
# %bb.6:                                #   in Loop: Header=BB9_4 Depth=1
	movq	8(%rsp), %rdi
.Ltmp27:
	callq	_Z27__device_stub__reduce_blockPv
.Ltmp28:
.LBB9_7:                                #   in Loop: Header=BB9_4 Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13d, %xmm0
	mulsd	.LCPI9_0(%rip), %xmm0
	callq	ceil@PLT
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	%r12d, %ebp
	sarl	$21, %ebp
	testl	%ebp, %ebp
	jle	.LBB9_13
# %bb.8:                                # %.lr.ph
                                        #   in Loop: Header=BB9_4 Depth=1
	movl	$1024, %eax                     # imm = 0x400
	cmpl	%eax, %r13d
	movl	$1024, %ebx                     # imm = 0x400
	cmovll	%r13d, %ebx
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rbx
	xorl	%r15d, %r15d
.LBB9_9:                                #   Parent Loop BB9_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp30:
	movabsq	$4294967305, %rdi               # imm = 0x100000009
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp31:
# %bb.10:                               #   in Loop: Header=BB9_9 Depth=2
	testl	%eax, %eax
	jne	.LBB9_12
# %bb.11:                               #   in Loop: Header=BB9_9 Depth=2
	movq	8(%rsp), %rdi
.Ltmp32:
	movl	%r12d, %esi
	movl	%r15d, %edx
	callq	_Z29__device_stub__compress_blockPvii
.Ltmp33:
.LBB9_12:                               #   in Loop: Header=BB9_9 Depth=2
	incl	%r15d
	cmpl	%r15d, %ebp
	jne	.LBB9_9
.LBB9_13:                               # %.preheader
                                        #   in Loop: Header=BB9_4 Depth=1
	cmpl	$2, %r13d
	jl	.LBB9_20
# %bb.14:                               # %.lr.ph79.preheader
                                        #   in Loop: Header=BB9_4 Depth=1
	cvttsd2si	24(%rsp), %ebx          # 8-byte Folded Reload
	xorl	%ebp, %ebp
.LBB9_15:                               # %.lr.ph79
                                        #   Parent Loop BB9_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp35:
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp36:
# %bb.16:                               #   in Loop: Header=BB9_15 Depth=2
	incl	%ebp
	testl	%eax, %eax
	jne	.LBB9_18
# %bb.17:                               #   in Loop: Header=BB9_15 Depth=2
	movq	8(%rsp), %rdi
.Ltmp37:
	movl	%ebp, %esi
	movl	%r13d, %edx
	movl	%ebx, %ecx
	callq	_Z28__device_stub__compress_linePviii
.Ltmp38:
.LBB9_18:                               #   in Loop: Header=BB9_15 Depth=2
	cmpl	$8, %ebp
	jb	.LBB9_15
# %bb.19:                               # %_Z12set_device_viRSt6vectorIiSaIiEERPv.exit.loopexit
                                        #   in Loop: Header=BB9_4 Depth=1
	cmpl	$1, %r13d
	jg	.LBB9_4
.LBB9_20:                               # %_Z12set_device_viRSt6vectorIiSaIiEERPv.exit._crit_edge
.Ltmp40:
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp41:
# %bb.21:
	testl	%eax, %eax
	jne	.LBB9_23
# %bb.22:
	movq	8(%rsp), %rdi
.Ltmp42:
	movq	16(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_Z29__device_stub__final_compressPvi
.Ltmp43:
.LBB9_23:
	movq	8(%rsp), %rdi
.Ltmp44:
	callq	_Z19print_result_matrixPv
.Ltmp45:
# %bb.24:
.Ltmp46:
	callq	hipDeviceReset
.Ltmp47:
# %bb.25:
	movq	32(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB9_27
# %bb.26:
	callq	_ZdlPv
.LBB9_27:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	xorl	%eax, %eax
	addq	$56, %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
.LBB9_31:
	.cfi_def_cfa_offset 112
.Ltmp48:
	jmp	.LBB9_32
.LBB9_28:
.Ltmp29:
	jmp	.LBB9_32
.LBB9_29:
.Ltmp34:
	jmp	.LBB9_32
.LBB9_30:
.Ltmp39:
.LBB9_32:
	movq	%rax, %rbx
	movq	32(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB9_34
# %bb.33:
	callq	_ZdlPv
.LBB9_34:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit55
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end9:
	.size	main, .Lfunc_end9-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table9:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp21-.Lfunc_begin2          #   Call between .Lfunc_begin2 and .Ltmp21
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp24-.Ltmp21                #   Call between .Ltmp21 and .Ltmp24
	.uleb128 .Ltmp48-.Lfunc_begin2          #     jumps to .Ltmp48
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp25-.Ltmp24                #   Call between .Ltmp24 and .Ltmp25
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp28-.Ltmp25                #   Call between .Ltmp25 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin2          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp28-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp30-.Ltmp28                #   Call between .Ltmp28 and .Ltmp30
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Ltmp33-.Ltmp30                #   Call between .Ltmp30 and .Ltmp33
	.uleb128 .Ltmp34-.Lfunc_begin2          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin2          # >> Call Site 7 <<
	.uleb128 .Ltmp38-.Ltmp35                #   Call between .Ltmp35 and .Ltmp38
	.uleb128 .Ltmp39-.Lfunc_begin2          #     jumps to .Ltmp39
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp40-.Lfunc_begin2          # >> Call Site 8 <<
	.uleb128 .Ltmp47-.Ltmp40                #   Call between .Ltmp40 and .Ltmp47
	.uleb128 .Ltmp48-.Lfunc_begin2          #     jumps to .Ltmp48
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp47-.Lfunc_begin2          # >> Call Site 9 <<
	.uleb128 .Lfunc_end9-.Ltmp47            #   Call between .Ltmp47 and .Lfunc_end9
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIiE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIiE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIiE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIiE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIiE8allocateEmPKv,@function
_ZNSt15__new_allocatorIiE8allocateEmPKv: # @_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB10_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB10_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB10_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB10_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end10:
	.size	_ZNSt15__new_allocatorIiE8allocateEmPKv, .Lfunc_end10-_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB11_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB11_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12reduce_blockPv, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14compress_blockPvii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13compress_linePviii, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14final_compressPvi, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end11:
	.size	__hip_module_ctor, .Lfunc_end11-__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	.LBB12_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
.LBB12_2:
	retq
.Lfunc_end12:
	.size	__hip_module_dtor, .Lfunc_end12-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z12reduce_blockPv,@object      # @_Z12reduce_blockPv
	.section	.rodata,"a",@progbits
	.globl	_Z12reduce_blockPv
	.p2align	3, 0x0
_Z12reduce_blockPv:
	.quad	_Z27__device_stub__reduce_blockPv
	.size	_Z12reduce_blockPv, 8

	.type	_Z14compress_blockPvii,@object  # @_Z14compress_blockPvii
	.globl	_Z14compress_blockPvii
	.p2align	3, 0x0
_Z14compress_blockPvii:
	.quad	_Z29__device_stub__compress_blockPvii
	.size	_Z14compress_blockPvii, 8

	.type	_Z13compress_linePviii,@object  # @_Z13compress_linePviii
	.globl	_Z13compress_linePviii
	.p2align	3, 0x0
_Z13compress_linePviii:
	.quad	_Z28__device_stub__compress_linePviii
	.size	_Z13compress_linePviii, 8

	.type	_Z14final_compressPvi,@object   # @_Z14final_compressPvi
	.globl	_Z14final_compressPvi
	.p2align	3, 0x0
_Z14final_compressPvi:
	.quad	_Z29__device_stub__final_compressPvi
	.size	_Z14final_compressPvi, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	" "
	.size	.L.str, 2

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z12reduce_blockPv"
	.size	.L__unnamed_1, 19

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z14compress_blockPvii"
	.size	.L__unnamed_2, 23

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13compress_linePviii"
	.size	.L__unnamed_3, 23

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z14final_compressPvi"
	.size	.L__unnamed_4, 22

	.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 __gxx_personality_v0
	.addrsig_sym _Z27__device_stub__reduce_blockPv
	.addrsig_sym _Z29__device_stub__compress_blockPvii
	.addrsig_sym _Z28__device_stub__compress_linePviii
	.addrsig_sym _Z29__device_stub__final_compressPvi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z12reduce_blockPv
	.addrsig_sym _Z14compress_blockPvii
	.addrsig_sym _Z13compress_linePviii
	.addrsig_sym _Z14final_compressPvi
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z12reduce_blockPv      ; -- Begin function _Z12reduce_blockPv
	.globl	_Z12reduce_blockPv
	.p2align	8
	.type	_Z12reduce_blockPv,@function
_Z12reduce_blockPv:                     ; @_Z12reduce_blockPv
; %bb.0:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_lshl_or_b32 v1, s15, 11, v0
	s_movk_i32 s5, 0x800
                                        ; implicit-def: $sgpr3
                                        ; implicit-def: $sgpr2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_or_b32_e32 v3, 0x400, v1
	v_ashrrev_i32_e32 v2, 31, v1
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v1, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	s_mov_b32 s0, 0
	s_clause 0x1
	global_load_b32 v5, v[1:2], off
	global_load_b32 v4, v[3:4], off
	v_lshlrev_b32_e32 v3, 2, v0
                                        ; implicit-def: $sgpr1
	s_waitcnt vmcnt(0)
	ds_store_2addr_stride64_b32 v3, v5, v4 offset1:16
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s4, s5, 1
	s_or_b32 s2, s2, exec_lo
	s_or_b32 s3, s3, exec_lo
	s_mov_b32 s6, exec_lo
	v_cmpx_gt_u32_e64 s4, v0
	s_cbranch_execz .LBB0_3
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	v_lshl_add_u32 v4, s4, 2, v3
	s_cmp_lt_u32 s5, 4
	ds_load_b32 v5, v3
	ds_load_b32 v4, v4
	s_cselect_b32 s5, -1, 0
	s_and_not1_b32 s3, s3, exec_lo
	s_and_b32 s5, s5, exec_lo
	s_and_not1_b32 s2, s2, exec_lo
	s_or_b32 s3, s3, s5
	s_waitcnt lgkmcnt(0)
	v_min_i32_e32 v4, v5, v4
	ds_store_b32 v3, v4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_3:                                ; %Flow22
                                        ;   in Loop: Header=BB0_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s5, exec_lo, s3
	s_or_b32 s0, s5, s0
	s_and_not1_b32 s1, s1, exec_lo
	s_and_b32 s5, s2, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s1, s1, s5
	s_mov_b32 s5, s4
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB0_1
; %bb.4:                                ; %loop.exit.guard
	s_or_b32 exec_lo, exec_lo, s0
	s_xor_b32 s0, s1, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s0
	s_xor_b32 s1, exec_lo, s1
	s_cbranch_execz .LBB0_7
; %bb.5:                                ; %.critedge19
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB0_7
; %bb.6:
	v_mov_b32_e32 v0, 0
	ds_load_b32 v0, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[1:2], v0, off
.LBB0_7:                                ; %.critedge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12reduce_blockPv
		.amdhsa_group_segment_fixed_size 8192
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 8
		.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 6
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z12reduce_blockPv, .Lfunc_end0-_Z12reduce_blockPv
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 360
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8192 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z14compress_blockPvii  ; -- Begin function _Z14compress_blockPvii
	.globl	_Z14compress_blockPvii
	.p2align	8
	.type	_Z14compress_blockPvii,@function
_Z14compress_blockPvii:                 ; @_Z14compress_blockPvii
; %bb.0:
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_mul_u32_u24_e32 v0, 0x7ff, v0
	s_lshl_b32 s2, s3, 21
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_add3_u32 v2, v1, v0, s2
	v_lshl_add_u32 v0, s3, 10, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v3, 31, v2
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14compress_blockPvii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.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 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z14compress_blockPvii, .Lfunc_end1-_Z14compress_blockPvii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 156
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z13compress_linePviii  ; -- Begin function _Z13compress_linePviii
	.globl	_Z13compress_linePviii
	.p2align	8
	.type	_Z13compress_linePviii,@function
_Z13compress_linePviii:                 ; @_Z13compress_linePviii
; %bb.0:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x8
	s_load_b64 s[0:1], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_lshl_b32 s2, s4, 11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	s_mul_i32 s3, s2, s5
	s_mul_i32 s2, s2, s6
	v_or_b32_e32 v1, s3, v0
	v_or_b32_e32 v0, s2, v0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_co_u32 v2, vcc_lo, s0, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	global_load_b32 v6, v[2:3], off
	v_or_b32_e32 v2, 0x400, v1
	v_ashrrev_i32_e32 v1, 31, v0
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[4:5], 2, v[0:1]
	v_or_b32_e32 v0, 0x400, v0
	v_lshlrev_b64 v[1:2], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v3, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v1, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[3:4], v6, off
	global_load_b32 v2, v[1:2], off
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13compress_linePviii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 7
		.amdhsa_next_free_sgpr 8
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z13compress_linePviii, .Lfunc_end2-_Z13compress_linePviii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 240
; NumSgprs: 10
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 10
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z14final_compressPvi   ; -- Begin function _Z14final_compressPvi
	.globl	_Z14final_compressPvi
	.p2align	8
	.type	_Z14final_compressPvi,@function
_Z14final_compressPvi:                  ; @_Z14final_compressPvi
; %bb.0:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_mov_b32_e32 v0, 0
	s_mov_b64 s[2:3], 0
	s_waitcnt lgkmcnt(0)
	s_mov_b64 s[4:5], s[0:1]
.LBB3_1:                                ; =>This Inner Loop Header: Depth=1
	global_load_b32 v1, v0, s[4:5]
	s_add_u32 s6, s0, s2
	s_addc_u32 s7, s1, s3
	s_add_u32 s2, s2, 4
	s_addc_u32 s3, s3, 0
	s_add_u32 s4, s4, 0x2000
	s_addc_u32 s5, s5, 0
	s_cmp_eq_u32 s2, 36
	s_waitcnt vmcnt(0)
	global_store_b32 v0, v1, s[6:7]
	s_cbranch_scc0 .LBB3_1
; %bb.2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14final_compressPvi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 12
		.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 2
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z14final_compressPvi, .Lfunc_end3-_Z14final_compressPvi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 92
; NumSgprs: 8
; NumVgprs: 2
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 2
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 8192
    .kernarg_segment_align: 8
    .kernarg_segment_size: 8
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12reduce_blockPv
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z12reduce_blockPv.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14compress_blockPvii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14compress_blockPvii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13compress_linePviii
    .private_segment_fixed_size: 0
    .sgpr_count:     10
    .sgpr_spill_count: 0
    .symbol:         _Z13compress_linePviii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 12
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14final_compressPvi
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z14final_compressPvi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     2
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
