#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
#include <fstream>
#include <thread>
#include <chrono>
#include <atomic>

using namespace std;

int n;
int *a = NULL;
int *b = NULL;
int *c = NULL;
atomic<int> cnt(0);
bool run = false;

__global__ void kernel(int* a, int* b, int*c, int l, int r){
    int i = blockIdx.x*blockDim.x+threadIdx.x;
    if(l <= i && i < r)
        c[i] = a[i] + b[i];
}

void slave(int id){
    cudaSetDevice(id);
    cudaSetDeviceFlags(cudaDeviceMapHost);

    cnt++;

    while(!run) this_thread::sleep_for(chrono::milliseconds(20));

    kernel<<<(n/3+31), 32>>>(a, b, c, n/3*id, n/3*(id+1));
    cudaDeviceSynchronize();
    cnt++;
}

int main(){
    ifstream in("input.txt");
    ofstream out("output.txt");

    thread slave0(slave, 0);
    thread slave1(slave, 1);

    while(cnt != 2) this_thread::sleep_for(chrono::milliseconds(20));
    
    in >> n;
    
    cudaHostAlloc(&a, n*sizeof(int), cudaHostAllocMapped);
    cudaHostAlloc(&b, n*sizeof(int), cudaHostAllocMapped);
    cudaHostAlloc(&c, n*sizeof(int), cudaHostAllocMapped);

    for(int i = 0; i < n ; i++) in >> a[i];
    for(int i = 0; i < n ; i++) in >> b[i];

    run = true;

    for(int i = n/3*2; i < n; i++)
        c[i] = a[i] + b[i];

    if(slave0.joinable())
        slave0.join();
    if(slave1.joinable())
        slave1.join();

    for(int i = 0; i < n; i++)
        out << c[i] << ' ';
    return 0;
}
	.file	"tmpxft_001fe42a_00000000-6_main.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.section	.text._ZNSt6thread24_M_thread_deps_never_runEv,"axG",@progbits,_ZNSt6thread24_M_thread_deps_never_runEv,comdat
	.weak	_ZNSt6thread24_M_thread_deps_never_runEv
	.type	_ZNSt6thread24_M_thread_deps_never_runEv, @function
_ZNSt6thread24_M_thread_deps_never_runEv:
.LFB3845:
	.cfi_startproc
	endbr64
	ret
	.cfi_endproc
.LFE3845:
	.size	_ZNSt6thread24_M_thread_deps_never_runEv, .-_ZNSt6thread24_M_thread_deps_never_runEv
	.section	.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev,"axG",@progbits,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED5Ev,comdat
	.align 2
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev
	.type	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev, @function
_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev:
.LFB5202:
	.cfi_startproc
	endbr64
	leaq	16+_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE(%rip), %rax
	movq	%rax, (%rdi)
	jmp	_ZNSt6thread6_StateD2Ev@PLT
	.cfi_endproc
.LFE5202:
	.size	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev, .-_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED1Ev
	.set	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED1Ev,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED2Ev
	.section	.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev,"axG",@progbits,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED5Ev,comdat
	.align 2
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.type	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev, @function
_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev:
.LFB5204:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movq	%rdi, 8(%rsp)
	call	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED1Ev
	movq	8(%rsp), %rdi
	movl	$24, %esi
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	jmp	_ZdlPvm@PLT
	.cfi_endproc
.LFE5204:
	.size	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev, .-_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.text
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4261:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4261:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv,"axG",@progbits,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv,comdat
	.align 2
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.type	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv, @function
_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv:
.LFB5205:
	.cfi_startproc
	endbr64
	movl	8(%rdi), %edx
	movq	16(%rdi), %rax
	movl	%edx, %edi
	jmp	*%rax
	.cfi_endproc
.LFE5205:
	.size	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv, .-_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.text
	.type	_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0, @function
_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0:
.LFB5225:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rdx
	movq	%rdx, 24(%rsp)
	xorl	%edx, %edx
	testq	%rdi, %rdi
	jle	.L7
	movq	%rdi, %rax
	movl	$1000, %ecx
	leaq	8(%rsp), %rbx
	cqto
	idivq	%rcx
	imulq	$1000000, %rdx, %rdx
	movq	%rax, 8(%rsp)
	movq	%rdx, 16(%rsp)
.L10:
	movq	%rbx, %rsi
	movq	%rbx, %rdi
	call	nanosleep@PLT
	incl	%eax
	jne	.L7
	call	__errno_location@PLT
	cmpl	$4, (%rax)
	je	.L10
.L7:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5225:
	.size	_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0, .-_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0
	.section	.text._ZNSt6threadD2Ev,"axG",@progbits,_ZNSt6threadD5Ev,comdat
	.align 2
	.weak	_ZNSt6threadD2Ev
	.type	_ZNSt6threadD2Ev, @function
_ZNSt6threadD2Ev:
.LFB3848:
	.cfi_startproc
	endbr64
	cmpq	$0, (%rdi)
	je	.L15
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_ZSt9terminatev@PLT
.L15:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3848:
	.size	_ZNSt6threadD2Ev, .-_ZNSt6threadD2Ev
	.weak	_ZNSt6threadD1Ev
	.set	_ZNSt6threadD1Ev,_ZNSt6threadD2Ev
	.text
	.globl	_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii
	.type	_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii, @function
_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii:
.LFB4283:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L20
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z6kernelPiS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L20:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4283:
	.size	_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii, .-_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii
	.globl	_Z6kernelPiS_S_ii
	.type	_Z6kernelPiS_S_ii, @function
_Z6kernelPiS_S_ii:
.LFB4284:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii
	.cfi_endproc
.LFE4284:
	.size	_Z6kernelPiS_S_ii, .-_Z6kernelPiS_S_ii
	.globl	_Z5slavei
	.type	_Z5slavei, @function
_Z5slavei:
.LFB4257:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	call	cudaSetDevice@PLT
	movl	$8, %edi
	call	cudaSetDeviceFlags@PLT
	lock incl	cnt(%rip)
.L26:
	cmpb	$0, run(%rip)
	jne	.L30
	movl	$20, %edi
	call	_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0
	jmp	.L26
.L30:
	movl	$3, %ebp
	movl	$134217729, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	n(%rip), %eax
	salq	$5, %rcx
	movl	$1, 28(%rsp)
	movq	%rcx, 20(%rsp)
	cltd
	idivl	%ebp
	movq	%rcx, %rdx
	movl	$1, %ecx
	addl	$31, %eax
	movl	%eax, 8(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 12(%rsp)
	movq	8(%rsp), %rdi
	movl	16(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	movl	n(%rip), %eax
	leal	1(%rbx), %r8d
	movq	b(%rip), %rsi
	movq	a(%rip), %rdi
	cltd
	idivl	%ebp
	movq	c(%rip), %rdx
	imull	%eax, %r8d
	movl	%r8d, %ecx
	subl	%eax, %ecx
	call	_Z31__device_stub__Z6kernelPiS_S_iiPiS_S_ii
.L28:
	call	cudaDeviceSynchronize@PLT
	lock incl	cnt(%rip)
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4257:
	.size	_Z5slavei, .-_Z5slavei
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z6kernelPiS_S_ii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4286:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z6kernelPiS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4286:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev,"axG",@progbits,_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED5Ev,comdat
	.align 2
	.weak	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev
	.type	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev, @function
_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev:
.LFB4937:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rdi
	testq	%rdi, %rdi
	je	.L33
	movq	(%rdi), %rax
	jmp	*8(%rax)
.L33:
	ret
	.cfi_endproc
.LFE4937:
	.size	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev, .-_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev
	.weak	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED1Ev
	.set	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED1Ev,_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev
	.section	.text._ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,"axG",@progbits,_ZNSt6threadC5IRFviEJiEvEEOT_DpOT0_,comdat
	.align 2
	.weak	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
	.type	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_, @function
_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_:
.LFB4728:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4728
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rsi, %rbp
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsi, (%rdi)
	movl	$24, %edi
.LEHB0:
	call	_Znwm@PLT
.LEHE0:
	movl	(%r12), %edx
	leaq	16+_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE(%rip), %rcx
	movq	%rbx, %rdi
	movq	%rbp, 16(%rax)
	movq	%rsp, %rbp
	movl	%edx, 8(%rax)
	movq	%rbp, %rsi
	leaq	_ZNSt6thread24_M_thread_deps_never_runEv(%rip), %rdx
	movq	%rcx, (%rax)
	movq	%rax, (%rsp)
.LEHB1:
	call	_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE@PLT
.LEHE1:
	movq	%rbp, %rdi
	call	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED1Ev
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	jmp	.L40
.L39:
	endbr64
	movq	%rax, %rbx
.L36:
	movq	%rbp, %rdi
	call	_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED1Ev
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L40:
	call	__stack_chk_fail@PLT
.L38:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4728:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,"aG",@progbits,_ZNSt6threadC5IRFviEJiEvEEOT_DpOT0_,comdat
.LLSDA4728:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4728-.LLSDACSB4728
.LLSDACSB4728:
	.uleb128 .LEHB0-.LFB4728
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4728
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L39-.LFB4728
	.uleb128 0
	.uleb128 .LEHB2-.LFB4728
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4728:
	.section	.text._ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,"axG",@progbits,_ZNSt6threadC5IRFviEJiEvEEOT_DpOT0_,comdat
	.size	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_, .-_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
	.weak	_ZNSt6threadC1IRFviEJiEvEEOT_DpOT0_
	.set	_ZNSt6threadC1IRFviEJiEvEEOT_DpOT0_,_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
	.section	.rodata.str1.1
.LC1:
	.string	"input.txt"
.LC2:
	.string	"output.txt"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4258:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4258
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$8, %edx
	leaq	.LC1(%rip), %rsi
	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	$1080, %rsp
	.cfi_def_cfa_offset 1136
	movq	%fs:40, %rax
	movq	%rax, 1064(%rsp)
	xorl	%eax, %eax
	leaq	544(%rsp), %rbp
	leaq	32(%rsp), %r12
	movq	%rbp, %rdi
.LEHB3:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE3:
	movl	$16, %edx
	leaq	.LC2(%rip), %rsi
	movq	%r12, %rdi
.LEHB4:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE4:
	leaq	24(%rsp), %r14
	leaq	16(%rsp), %r13
	xorl	%eax, %eax
	leaq	_Z5slavei(%rip), %r15
	movq	%r14, %rdx
	movq	%r13, %rdi
	movl	%eax, 24(%rsp)
	movq	%r15, %rsi
.LEHB5:
	call	_ZNSt6threadC1IRFviEJiEvEEOT_DpOT0_
.LEHE5:
	leaq	12(%rsp), %rbx
	movq	%r15, %rsi
	movq	%r14, %rdi
	movl	$1, 12(%rsp)
	movq	%rbx, %rdx
.LEHB6:
	call	_ZNSt6threadC1IRFviEJiEvEEOT_DpOT0_
.LEHE6:
.L43:
	movl	cnt(%rip), %eax
	cmpl	$2, %eax
	je	.L71
	movl	$20, %edi
.LEHB7:
	call	_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.isra.0
	jmp	.L43
.L71:
	leaq	n(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZNSirsERi@PLT
	movslq	n(%rip), %rsi
	movl	$2, %edx
	leaq	a(%rip), %rdi
	salq	$2, %rsi
	call	cudaHostAlloc@PLT
	movslq	n(%rip), %rsi
	movl	$2, %edx
	leaq	b(%rip), %rdi
	salq	$2, %rsi
	call	cudaHostAlloc@PLT
	movslq	n(%rip), %rsi
	movl	$2, %edx
	leaq	c(%rip), %rdi
	salq	$2, %rsi
	call	cudaHostAlloc@PLT
	xorl	%r15d, %r15d
.L45:
	cmpl	%r15d, n(%rip)
	jle	.L72
	movq	a(%rip), %rax
	movq	%rbp, %rdi
	leaq	(%rax,%r15,4), %rsi
	call	_ZNSirsERi@PLT
	incq	%r15
	jmp	.L45
.L72:
	xorl	%r15d, %r15d
.L47:
	movl	n(%rip), %eax
	movq	b(%rip), %rcx
	cmpl	%r15d, %eax
	jle	.L73
	leaq	(%rcx,%r15,4), %rsi
	movq	%rbp, %rdi
	call	_ZNSirsERi@PLT
	incq	%r15
	jmp	.L47
.L73:
	movl	$3, %r8d
	cltd
	movb	$1, run(%rip)
	movq	a(%rip), %rsi
	idivl	%r8d
	movq	c(%rip), %rdi
	addl	%eax, %eax
	cltq
.L49:
	cmpl	%eax, n(%rip)
	jle	.L74
	movl	(%rcx,%rax,4), %edx
	addl	(%rsi,%rax,4), %edx
	movl	%edx, (%rdi,%rax,4)
	incq	%rax
	jmp	.L49
.L74:
	cmpq	$0, 16(%rsp)
	je	.L51
	movq	%r13, %rdi
	call	_ZNSt6thread4joinEv@PLT
.L51:
	cmpq	$0, 24(%rsp)
	je	.L52
	movq	%r14, %rdi
	call	_ZNSt6thread4joinEv@PLT
.L52:
	xorl	%r15d, %r15d
.L53:
	cmpl	%r15d, n(%rip)
	jle	.L75
	movq	c(%rip), %rax
	movq	%r12, %rdi
	movl	(%rax,%r15,4), %esi
	call	_ZNSolsEi@PLT
	movb	$32, 12(%rsp)
	movq	%rax, %rdi
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%rdi,%rax)
	je	.L54
	movl	$1, %edx
	movq	%rbx, %rsi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	jmp	.L55
.L54:
	movl	$32, %esi
	call	_ZNSo3putEc@PLT
.LEHE7:
.L55:
	incq	%r15
	jmp	.L53
.L75:
	movq	%r14, %rdi
	call	_ZNSt6threadD1Ev
	movq	%r13, %rdi
	call	_ZNSt6threadD1Ev
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1064(%rsp), %rax
	subq	%fs:40, %rax
	je	.L62
	jmp	.L69
.L67:
	endbr64
	movq	%rax, %rbx
.L57:
	movq	%r14, %rdi
	call	_ZNSt6threadD1Ev
	jmp	.L58
.L66:
	endbr64
	movq	%rax, %rbx
.L58:
	movq	%r13, %rdi
	call	_ZNSt6threadD1Ev
	jmp	.L59
.L65:
	endbr64
	movq	%rax, %rbx
.L59:
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L60
.L64:
	endbr64
	movq	%rax, %rbx
.L60:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1064(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L69
	movq	%rbx, %rdi
.LEHB8:
	call	_Unwind_Resume@PLT
.LEHE8:
.L69:
	call	__stack_chk_fail@PLT
.L62:
	addq	$1080, %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
.LFE4258:
	.section	.gcc_except_table,"a",@progbits
.LLSDA4258:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4258-.LLSDACSB4258
.LLSDACSB4258:
	.uleb128 .LEHB3-.LFB4258
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB4258
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L64-.LFB4258
	.uleb128 0
	.uleb128 .LEHB5-.LFB4258
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L65-.LFB4258
	.uleb128 0
	.uleb128 .LEHB6-.LFB4258
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L66-.LFB4258
	.uleb128 0
	.uleb128 .LEHB7-.LFB4258
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L67-.LFB4258
	.uleb128 0
	.uleb128 .LEHB8-.LFB4258
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
.LLSDACSE4258:
	.section	.text.startup
	.size	main, .-main
	.weak	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.rodata._ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"aG",@progbits,_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.align 32
	.type	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, @object
	.size	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 60
_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.string	"NSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE"
	.weak	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.data.rel.ro._ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"awG",@progbits,_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.align 8
	.type	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, @object
	.size	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 24
_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.quad	_ZTINSt6thread6_StateE
	.weak	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.data.rel.ro.local._ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"awG",@progbits,_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.align 8
	.type	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, @object
	.size	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 40
_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.quad	0
	.quad	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.quad	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED1Ev
	.quad	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.quad	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.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
	.globl	run
	.bss
	.type	run, @object
	.size	run, 1
run:
	.zero	1
	.globl	cnt
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	b
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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 <iostream>
#include <fstream>
#include <thread>
#include <chrono>
#include <atomic>

using namespace std;

int n;
int *a = NULL;
int *b = NULL;
int *c = NULL;
atomic<int> cnt(0);
bool run = false;

__global__ void kernel(int* a, int* b, int*c, int l, int r){
    int i = blockIdx.x*blockDim.x+threadIdx.x;
    if(l <= i && i < r)
        c[i] = a[i] + b[i];
}

void slave(int id){
    hipSetDevice(id);
    hipSetDeviceFlags(hipDeviceMapHost);

    cnt++;

    while(!run) this_thread::sleep_for(chrono::milliseconds(20));

    kernel<<<(n/3+31), 32>>>(a, b, c, n/3*id, n/3*(id+1));
    hipDeviceSynchronize();
    cnt++;
}

int main(){
    ifstream in("input.txt");
    ofstream out("output.txt");

    thread slave0(slave, 0);
    thread slave1(slave, 1);

    while(cnt != 2) this_thread::sleep_for(chrono::milliseconds(20));
    
    in >> n;
    
    hipHostAlloc(&a, n*sizeof(int), hipHostMallocMapped);
    hipHostAlloc(&b, n*sizeof(int), hipHostMallocMapped);
    hipHostAlloc(&c, n*sizeof(int), hipHostMallocMapped);

    for(int i = 0; i < n ; i++) in >> a[i];
    for(int i = 0; i < n ; i++) in >> b[i];

    run = true;

    for(int i = n/3*2; i < n; i++)
        c[i] = a[i] + b[i];

    if(slave0.joinable())
        slave0.join();
    if(slave1.joinable())
        slave1.join();

    for(int i = 0; i < n; i++)
        out << c[i] << ' ';
    return 0;
}
	.text
	.file	"main.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z21__device_stub__kernelPiS_S_ii # -- Begin function _Z21__device_stub__kernelPiS_S_ii
	.type	_Z21__device_stub__kernelPiS_S_ii,@function
_Z21__device_stub__kernelPiS_S_ii:      # @_Z21__device_stub__kernelPiS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z6kernelPiS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z21__device_stub__kernelPiS_S_ii, .Lfunc_end0-_Z21__device_stub__kernelPiS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z5slavei                       # -- Begin function _Z5slavei
	.type	_Z5slavei,@function
_Z5slavei:                              # @_Z5slavei
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	%edi, %ebx
	callq	hipSetDevice
	movl	$8, %edi
	callq	hipSetDeviceFlags
	lock		incl	cnt(%rip)
	cmpb	$0, run(%rip)
	jne	.LBB1_6
# %bb.1:                                # %.lr.ph
	leaq	8(%rsp), %r14
.LBB1_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_3 Depth 2
	movq	$0, 8(%rsp)
	movq	$20000000, 16(%rsp)             # imm = 0x1312D00
.LBB1_3:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r14, %rdi
	movq	%r14, %rsi
	callq	nanosleep
	cmpl	$-1, %eax
	jne	.LBB1_5
# %bb.4:                                #   in Loop: Header=BB1_3 Depth=2
	callq	__errno_location
	cmpl	$4, (%rax)
	je	.LBB1_3
.LBB1_5:                                # %_ZNSt11this_thread9sleep_forIlSt5ratioILl1ELl1000EEEEvRKNSt6chrono8durationIT_T0_EE.exit
                                        #   in Loop: Header=BB1_2 Depth=1
	cmpb	$0, run(%rip)
	je	.LBB1_2
.LBB1_6:                                # %._crit_edge
	movslq	n(%rip), %rax
	imulq	$1431655766, %rax, %rax         # imm = 0x55555556
	movq	%rax, %rcx
	shrq	$32, %rcx
	shrq	$63, %rax
	leal	(%rcx,%rax), %edi
	addl	$31, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$32, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_8
# %bb.7:
	movq	a(%rip), %rdi
	movq	b(%rip), %rsi
	movq	c(%rip), %rdx
	movslq	n(%rip), %rax
	imulq	$1431655766, %rax, %rax         # imm = 0x55555556
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	addl	%ecx, %eax
	movl	%eax, %ecx
	imull	%ebx, %ecx
	incl	%ebx
	imull	%eax, %ebx
	movl	%ebx, %r8d
	callq	_Z21__device_stub__kernelPiS_S_ii
.LBB1_8:
	callq	hipDeviceSynchronize
	lock		incl	cnt(%rip)
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z5slavei, .Lfunc_end1-_Z5slavei
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$1072, %rsp                     # imm = 0x430
	.cfi_def_cfa_offset 1104
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	552(%rsp), %rdi
	movl	$.L.str, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp0:
	leaq	40(%rsp), %rdi
	movl	$.L.str.1, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	leaq	24(%rsp), %rdx
	movl	$0, (%rdx)
.Ltmp3:
	leaq	16(%rsp), %rdi
	movl	$_Z5slavei, %esi
	callq	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
.Ltmp4:
# %bb.2:
	leaq	24(%rsp), %rdx
	movl	$1, (%rdx)
.Ltmp6:
	leaq	8(%rsp), %rdi
	movl	$_Z5slavei, %esi
	callq	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
.Ltmp7:
# %bb.3:
	movl	cnt(%rip), %eax
	cmpl	$2, %eax
	je	.LBB2_10
# %bb.4:                                # %.lr.ph
	leaq	24(%rsp), %rbx
.LBB2_5:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_6 Depth 2
	movq	$0, 24(%rsp)
	movq	$20000000, 32(%rsp)             # imm = 0x1312D00
.LBB2_6:                                #   Parent Loop BB2_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp9:
	movq	%rbx, %rdi
	movq	%rbx, %rsi
	callq	nanosleep
.Ltmp10:
# %bb.7:                                # %.noexc
                                        #   in Loop: Header=BB2_6 Depth=2
	cmpl	$-1, %eax
	jne	.LBB2_9
# %bb.8:                                #   in Loop: Header=BB2_6 Depth=2
	callq	__errno_location
	cmpl	$4, (%rax)
	je	.LBB2_6
.LBB2_9:                                #   in Loop: Header=BB2_5 Depth=1
	movl	cnt(%rip), %eax
	cmpl	$2, %eax
	jne	.LBB2_5
.LBB2_10:                               # %._crit_edge
.Ltmp12:
	leaq	552(%rsp), %rdi
	movl	$n, %esi
	callq	_ZNSirsERi
.Ltmp13:
# %bb.11:
	movslq	n(%rip), %rsi
	shlq	$2, %rsi
.Ltmp14:
	movl	$a, %edi
	movl	$2, %edx
	callq	hipHostAlloc
.Ltmp15:
# %bb.12:                               # %_ZL12hipHostAllocIiE10hipError_tPPT_mj.exit
	movslq	n(%rip), %rsi
	shlq	$2, %rsi
.Ltmp16:
	movl	$b, %edi
	movl	$2, %edx
	callq	hipHostAlloc
.Ltmp17:
# %bb.13:                               # %_ZL12hipHostAllocIiE10hipError_tPPT_mj.exit30
	movslq	n(%rip), %rsi
	shlq	$2, %rsi
.Ltmp18:
	movl	$c, %edi
	movl	$2, %edx
	callq	hipHostAlloc
.Ltmp19:
# %bb.14:                               # %_ZL12hipHostAllocIiE10hipError_tPPT_mj.exit32.preheader
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.LBB2_22
# %bb.15:                               # %.lr.ph51.preheader
	xorl	%r14d, %r14d
	leaq	552(%rsp), %rbx
	xorl	%r15d, %r15d
.LBB2_16:                               # %.lr.ph51
                                        # =>This Inner Loop Header: Depth=1
	movq	a(%rip), %rsi
	addq	%r14, %rsi
.Ltmp20:
	movq	%rbx, %rdi
	callq	_ZNSirsERi
.Ltmp21:
# %bb.17:                               # %_ZL12hipHostAllocIiE10hipError_tPPT_mj.exit32
                                        #   in Loop: Header=BB2_16 Depth=1
	incq	%r15
	movslq	n(%rip), %rax
	addq	$4, %r14
	cmpq	%rax, %r15
	jl	.LBB2_16
# %bb.18:                               # %.preheader
	testl	%eax, %eax
	jle	.LBB2_22
# %bb.19:                               # %.lr.ph53.preheader
	xorl	%r14d, %r14d
	leaq	552(%rsp), %rbx
	xorl	%r15d, %r15d
.LBB2_20:                               # %.lr.ph53
                                        # =>This Inner Loop Header: Depth=1
	movq	b(%rip), %rsi
	addq	%r14, %rsi
.Ltmp23:
	movq	%rbx, %rdi
	callq	_ZNSirsERi
.Ltmp24:
# %bb.21:                               #   in Loop: Header=BB2_20 Depth=1
	incq	%r15
	movslq	n(%rip), %rax
	addq	$4, %r14
	cmpq	%rax, %r15
	jl	.LBB2_20
.LBB2_22:                               # %._crit_edge54
	movb	$1, run(%rip)
	movslq	%eax, %rcx
	imulq	$1431655766, %rcx, %rax         # imm = 0x55555556
	movq	%rax, %rdx
	shrq	$63, %rdx
	shrq	$32, %rax
	addl	%edx, %eax
	addl	%eax, %eax
	cmpl	%ecx, %eax
	jge	.LBB2_25
# %bb.23:                               # %.lr.ph57
	movq	a(%rip), %rcx
	movq	b(%rip), %rdx
	movq	c(%rip), %rsi
	cltq
.LBB2_24:                               # =>This Inner Loop Header: Depth=1
	movl	(%rdx,%rax,4), %edi
	addl	(%rcx,%rax,4), %edi
	movl	%edi, (%rsi,%rax,4)
	incq	%rax
	movslq	n(%rip), %rdi
	cmpq	%rdi, %rax
	jl	.LBB2_24
.LBB2_25:                               # %._crit_edge58
	cmpq	$0, 16(%rsp)
	je	.LBB2_27
# %bb.26:
.Ltmp26:
	leaq	16(%rsp), %rdi
	callq	_ZNSt6thread4joinEv
.Ltmp27:
.LBB2_27:
	cmpq	$0, 8(%rsp)
	je	.LBB2_29
# %bb.28:
.Ltmp28:
	leaq	8(%rsp), %rdi
	callq	_ZNSt6thread4joinEv
.Ltmp29:
.LBB2_29:
	cmpl	$0, n(%rip)
	jle	.LBB2_39
# %bb.30:                               # %.lr.ph61.preheader
	xorl	%r15d, %r15d
	leaq	40(%rsp), %rbx
	leaq	24(%rsp), %r14
.LBB2_31:                               # %.lr.ph61
                                        # =>This Inner Loop Header: Depth=1
	movq	c(%rip), %rax
	movl	(%rax,%r15,4), %esi
.Ltmp31:
	movq	%rbx, %rdi
	callq	_ZNSolsEi
.Ltmp32:
# %bb.32:                               #   in Loop: Header=BB2_31 Depth=1
	movb	$32, 24(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB2_42
# %bb.33:                               #   in Loop: Header=BB2_31 Depth=1
.Ltmp33:
	movl	$1, %edx
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp34:
	jmp	.LBB2_43
.LBB2_42:                               #   in Loop: Header=BB2_31 Depth=1
.Ltmp35:
	movq	%rax, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
.Ltmp36:
.LBB2_43:                               #   in Loop: Header=BB2_31 Depth=1
	incq	%r15
	movslq	n(%rip), %rax
	cmpq	%rax, %r15
	jl	.LBB2_31
.LBB2_39:                               # %._crit_edge62
	cmpq	$0, 8(%rsp)
	jne	.LBB2_46
# %bb.40:                               # %_ZNSt6threadD2Ev.exit
	cmpq	$0, 16(%rsp)
	jne	.LBB2_46
# %bb.41:                               # %_ZNSt6threadD2Ev.exit36
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	48(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 40(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	288(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	552(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1072, %rsp                     # imm = 0x430
	.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
.LBB2_47:
	.cfi_def_cfa_offset 1104
.Ltmp8:
	movq	%rax, %rbx
	jmp	.LBB2_48
.LBB2_49:
.Ltmp5:
	movq	%rax, %rbx
	jmp	.LBB2_50
.LBB2_34:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB2_51
.LBB2_36:
.Ltmp30:
	jmp	.LBB2_45
.LBB2_38:
.Ltmp25:
	jmp	.LBB2_45
.LBB2_37:
.Ltmp22:
	jmp	.LBB2_45
.LBB2_44:
.Ltmp37:
	jmp	.LBB2_45
.LBB2_35:
.Ltmp11:
.LBB2_45:
	movq	%rax, %rbx
	cmpq	$0, 8(%rsp)
	jne	.LBB2_46
.LBB2_48:                               # %_ZNSt6threadD2Ev.exit42
	cmpq	$0, 16(%rsp)
	jne	.LBB2_46
.LBB2_50:                               # %_ZNSt6threadD2Ev.exit45
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB2_51:
	leaq	552(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.LBB2_46:
	callq	_ZSt9terminatev
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.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 .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 3 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp19-.Ltmp12                #   Call between .Ltmp12 and .Ltmp19
	.uleb128 .Ltmp30-.Lfunc_begin0          #     jumps to .Ltmp30
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp21-.Ltmp20                #   Call between .Ltmp20 and .Ltmp21
	.uleb128 .Ltmp22-.Lfunc_begin0          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp24-.Ltmp23                #   Call between .Ltmp23 and .Ltmp24
	.uleb128 .Ltmp25-.Lfunc_begin0          #     jumps to .Ltmp25
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp26-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp29-.Ltmp26                #   Call between .Ltmp26 and .Ltmp29
	.uleb128 .Ltmp30-.Lfunc_begin0          #     jumps to .Ltmp30
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp31-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp36-.Ltmp31                #   Call between .Ltmp31 and .Ltmp36
	.uleb128 .Ltmp37-.Lfunc_begin0          #     jumps to .Ltmp37
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp36-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Lfunc_end2-.Ltmp36            #   Call between .Ltmp36 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,"axG",@progbits,_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,comdat
	.weak	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_ # -- Begin function _ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
	.p2align	1, 0x90
	.type	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,@function
_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_:    # @_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	$0, (%rdi)
	movl	$24, %edi
	callq	_Znwm
	movq	$_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE+16, (%rax)
	movl	(%rbx), %ecx
	movl	%ecx, 8(%rax)
	movq	%r14, 16(%rax)
	leaq	8(%rsp), %rsi
	movq	%rax, (%rsi)
.Ltmp38:
	movl	$_ZNSt6thread24_M_thread_deps_never_runEv, %edx
	movq	%r15, %rdi
	callq	_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE
.Ltmp39:
# %bb.1:
	movq	8(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB3_3
# %bb.2:                                # %_ZNKSt14default_deleteINSt6thread6_StateEEclEPS1_.exit.i
	movq	(%rdi), %rax
	callq	*8(%rax)
.LBB3_3:                                # %_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev.exit
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB3_4:
	.cfi_def_cfa_offset 48
.Ltmp40:
	movq	%rax, %rbx
	movq	8(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB3_6
# %bb.5:                                # %_ZNKSt14default_deleteINSt6thread6_StateEEclEPS1_.exit.i7
	movq	(%rdi), %rax
	callq	*8(%rax)
.LBB3_6:                                # %_ZNSt10unique_ptrINSt6thread6_StateESt14default_deleteIS1_EED2Ev.exit8
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_, .Lfunc_end3-_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_
	.cfi_endproc
	.section	.gcc_except_table._ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,"aG",@progbits,_ZNSt6threadC2IRFviEJiEvEEOT_DpOT0_,comdat
	.p2align	2, 0x0
GCC_except_table3:
.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 .Ltmp38-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp38
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp38-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp39-.Ltmp38                #   Call between .Ltmp38 and .Ltmp39
	.uleb128 .Ltmp40-.Lfunc_begin1          #     jumps to .Ltmp40
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp39-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Lfunc_end3-.Ltmp39            #   Call between .Ltmp39 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6thread24_M_thread_deps_never_runEv,"axG",@progbits,_ZNSt6thread24_M_thread_deps_never_runEv,comdat
	.weak	_ZNSt6thread24_M_thread_deps_never_runEv # -- Begin function _ZNSt6thread24_M_thread_deps_never_runEv
	.p2align	1, 0x90
	.type	_ZNSt6thread24_M_thread_deps_never_runEv,@function
_ZNSt6thread24_M_thread_deps_never_runEv: # @_ZNSt6thread24_M_thread_deps_never_runEv
	.cfi_startproc
# %bb.0:
	retq
.Lfunc_end4:
	.size	_ZNSt6thread24_M_thread_deps_never_runEv, .Lfunc_end4-_ZNSt6thread24_M_thread_deps_never_runEv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev,"axG",@progbits,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev,comdat
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev # -- Begin function _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.p2align	1, 0x90
	.type	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev,@function
_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev: # @_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	callq	_ZNSt6thread6_StateD2Ev
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZdlPv                          # TAILCALL
.Lfunc_end5:
	.size	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev, .Lfunc_end5-_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv,"axG",@progbits,_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv,comdat
	.weak	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv # -- Begin function _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.p2align	1, 0x90
	.type	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv,@function
_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv: # @_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	movl	8(%rdi), %edi
	jmpq	*16(%rax)                       # TAILCALL
.Lfunc_end6:
	.size	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv, .Lfunc_end6-_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6kernelPiS_S_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	n,@object                       # @n
	.bss
	.globl	n
	.p2align	2, 0x0
n:
	.long	0                               # 0x0
	.size	n, 4

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

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

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

	.type	cnt,@object                     # @cnt
	.globl	cnt
	.p2align	2, 0x0
cnt:
	.zero	4
	.size	cnt, 4

	.type	run,@object                     # @run
	.globl	run
run:
	.byte	0                               # 0x0
	.size	run, 1

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

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"output.txt"
	.size	.L.str.1, 11

	.type	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,@object # @_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.rodata._ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"aG",@progbits,_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.weak	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.p2align	3, 0x0
_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.quad	0
	.quad	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.quad	_ZNSt6thread6_StateD2Ev
	.quad	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEED0Ev
	.quad	_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEE6_M_runEv
	.size	_ZTVNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 40

	.type	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,@object # @_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.rodata._ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"aG",@progbits,_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.weak	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.asciz	"NSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE"
	.size	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 60

	.type	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,@object # @_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.section	.rodata._ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,"aG",@progbits,_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE,comdat
	.weak	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.p2align	3, 0x0
_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.quad	_ZTINSt6thread6_StateE
	.size	_ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE, 24

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

	.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 _Z21__device_stub__kernelPiS_S_ii
	.addrsig_sym _Z5slavei
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _ZNSt6thread24_M_thread_deps_never_runEv
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym n
	.addrsig_sym a
	.addrsig_sym b
	.addrsig_sym c
	.addrsig_sym cnt
	.addrsig_sym _Z6kernelPiS_S_ii
	.addrsig_sym _ZTVN10__cxxabiv120__si_class_type_infoE
	.addrsig_sym _ZTSNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.addrsig_sym _ZTINSt6thread6_StateE
	.addrsig_sym _ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFviEiEEEEEE
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6kernelPiS_S_ii       ; -- Begin function _Z6kernelPiS_S_ii
	.globl	_Z6kernelPiS_S_ii
	.p2align	8
	.type	_Z6kernelPiS_S_ii,@function
_Z6kernelPiS_S_ii:                      ; @_Z6kernelPiS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b64 s[2:3], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmp_le_i32_e32 vcc_lo, s2, v1
	v_cmp_gt_i32_e64 s2, s3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b64 s[0:1], s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v3, v2
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6kernelPiS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 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	_Z6kernelPiS_S_ii, .Lfunc_end0-_Z6kernelPiS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 192
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 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
	.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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6kernelPiS_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6kernelPiS_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
