/**
 File name: bfs_cpu_array_multi.cu
 Author: Yuede Ji
 Last update: 21:54 10-02-2015
 Description: Using array to implent CPU version of bfs.
    Calculate the shortest distance between each other 
**/

#include <stdio.h>
#include <queue>
#include <stdlib.h>
#include <string.h>

using namespace std;
#define N 1024 // vertex number
//Using arrays to implement queue
#define imax(a, b) (a>b?a:b)

char filein[] = "/home/yuede/dataset/edge.dat";
char fileout[] = "/home/yuede/dataset/edge.cpu_multi";
//Using arrays to implement queue
int q[N];

int edge[N][N];
int visit[N];
int dist[N][N];

int bfs(int root)
{
    //memset(dist, 0, sizeof(int) * N * N);
    memset(visit, 0, sizeof(int) * N);
    q[0] = root;
    int l = 1; // record the size of the queue
    int front = 0; // identify the front element
    int end = 0; // identify the end element
    while(l>0)
    {
        int cur = q[front];
        ++front;
        --l;
        if(front >= N)
            front %= N;
        
        for(int i=0; edge[cur][i]!=0; ++i)
        {
            int v = edge[cur][i];
            if(visit[v])
                continue;
            dist[root][v] = dist[root][cur] + 1;
            ++end;
            if(end >= N)
                end %= N;
            q[end] = v;
            visit[v] = 1;
            ++l;
        }
    }
    return 0;
}
int main()
{
    FILE *fp_in = fopen(filein, "r");
    int v, e;
    int num_v=0;
    memset(edge, 0, N*N*sizeof(int));
    memset(visit, 0, N*sizeof(int));
    memset(dist, 0, N*N*sizeof(int));
    while(fscanf(fp_in, "%d %d", &v, &e)!=EOF)
    {
        ++num_v;
        for(int i=0; i<e; ++i)
        {
            int v1;
            fscanf(fp_in, "%d", &v1);
            edge[v][i] = v1;//v->v1
        }
    }
    fclose(fp_in);

    for(int i=0; i<num_v; ++i)
        bfs(i);
    FILE *fp_out = fopen(fileout, "w");
    //fprintf("num_v = %d\n", num_v);
    for(int i=0; i<num_v; ++i)
    {
        fprintf(fp_out, "%d", i);
        for(int j=0; j<num_v; ++j)
            fprintf(fp_out, " %d", imax(dist[i][j], dist[j][i]));
        fprintf(fp_out, "\n");
    }
    fclose(fp_out);
    printf("Finished!\n");
    return 0;
}

	.file	"tmpxft_002d1b8c_00000000-6_bfs_cpu_array_multi.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3163:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3163:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z3bfsi
	.type	_Z3bfsi, @function
_Z3bfsi:
.LFB3159:
	.cfi_startproc
	endbr64
	leaq	visit(%rip), %r9
	movslq	%edi, %rdx
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$1024, %ecx
	movq	%r9, %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	$1, %esi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	q(%rip), %r11
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	edge(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	dist(%rip), %rbx
	rep stosl
	movl	%edx, q(%rip)
	xorl	%edi, %edi
	salq	$10, %rdx
.L8:
	movslq	%edi, %rax
	incl	%edi
	decl	%esi
	movslq	(%r11,%rax,4), %rax
	cmpl	$1024, %edi
	jne	.L3
	xorl	%edi, %edi
.L3:
	movq	%rax, %r8
	addq	%rdx, %rax
	salq	$12, %r8
	addq	%rbp, %r8
.L4:
	movl	(%r8), %r10d
	testl	%r10d, %r10d
	je	.L13
	movslq	%r10d, %r12
	cmpl	$0, (%r9,%r12,4)
	jne	.L5
	movl	(%rbx,%rax,4), %r13d
	leaq	(%rdx,%r12), %r14
	incl	%ecx
	incl	%r13d
	movl	%r13d, (%rbx,%r14,4)
	cmpl	$1023, %ecx
	jle	.L6
	andl	$1023, %ecx
.L6:
	movslq	%ecx, %r13
	movl	$1, (%r9,%r12,4)
	incl	%esi
	movl	%r10d, (%r11,%r13,4)
.L5:
	addq	$4, %r8
	jmp	.L4
.L13:
	testl	%esi, %esi
	jg	.L8
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.LFE3159:
	.size	_Z3bfsi, .-_Z3bfsi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"w"
.LC4:
	.string	" %d"
.LC5:
	.string	"\n"
.LC6:
	.string	"Finished!\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3160:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	filein(%rip), %rdi
	leaq	.LC0(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	edge(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	leaq	visit(%rip), %rdx
	movl	$1048576, %ecx
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	rep stosl
	movq	%rdx, %rdi
	movl	$1024, %ecx
	leaq	dist(%rip), %rdx
	rep stosl
	movl	$1048576, %ecx
	movq	%rdx, %rdi
	rep stosl
.L15:
	xorl	%eax, %eax
	leaq	32(%rsp), %rcx
	leaq	28(%rsp), %rdx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	call	__isoc23_fscanf@PLT
	incl	%eax
	je	.L27
	incl	%ebx
	xorl	%r15d, %r15d
	leaq	.LC1(%rip), %r14
.L16:
	cmpl	%r15d, 32(%rsp)
	jle	.L15
	leaq	36(%rsp), %rdx
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	movslq	28(%rsp), %rax
	movslq	%r15d, %rdx
	incl	%r15d
	salq	$10, %rax
	addq	%rdx, %rax
	movl	36(%rsp), %edx
	movl	%edx, (%r12,%rax,4)
	jmp	.L16
.L27:
	movq	%rbp, %rdi
	xorl	%ebp, %ebp
	call	fclose@PLT
.L19:
	cmpl	%ebp, %ebx
	je	.L28
	movl	%ebp, %edi
	incl	%ebp
	call	_Z3bfsi
	jmp	.L19
.L28:
	leaq	.LC3(%rip), %rsi
	leaq	fileout(%rip), %rdi
	xorl	%ebp, %ebp
	call	fopen@PLT
	leaq	dist(%rip), %r12
	movq	%rax, 8(%rsp)
	movq	%r12, %r13
.L21:
	cmpl	%ebp, %ebx
	je	.L29
	movq	8(%rsp), %rdi
	movl	%ebp, %ecx
	leaq	.LC1(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	movq	%r12, %r15
	xorl	%r14d, %r14d
	call	__fprintf_chk@PLT
.L22:
	movl	(%r15), %eax
	movl	0(%r13,%r14,4), %ecx
	leaq	.LC4(%rip), %rdx
	movl	$2, %esi
	movq	8(%rsp), %rdi
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	xorl	%eax, %eax
	incq	%r14
	addq	$4096, %r15
	call	__fprintf_chk@PLT
	cmpl	%r14d, %ebx
	jg	.L22
	movq	8(%rsp), %rdi
	leaq	.LC5(%rip), %rdx
	xorl	%eax, %eax
	incl	%ebp
	movl	$2, %esi
	addq	$4, %r12
	addq	$4096, %r13
	call	__fprintf_chk@PLT
	jmp	.L21
.L29:
	movq	8(%rsp), %rdi
	call	fclose@PLT
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC6(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$56, %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
.LFE3160:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3186:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3186:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 4194304
dist:
	.zero	4194304
	.globl	visit
	.align 32
	.type	visit, @object
	.size	visit, 4096
visit:
	.zero	4096
	.globl	edge
	.align 32
	.type	edge, @object
	.size	edge, 4194304
edge:
	.zero	4194304
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 4096
q:
	.zero	4096
	.globl	fileout
	.data
	.align 32
	.type	fileout, @object
	.size	fileout, 35
fileout:
	.string	"/home/yuede/dataset/edge.cpu_multi"
	.globl	filein
	.align 16
	.type	filein, @object
	.size	filein, 29
filein:
	.string	"/home/yuede/dataset/edge.dat"
	.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:

/**
 File name: bfs_cpu_array_multi.cu
 Author: Yuede Ji
 Last update: 21:54 10-02-2015
 Description: Using array to implent CPU version of bfs.
    Calculate the shortest distance between each other 
**/


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <queue>
#include <stdlib.h>
#include <string.h>

using namespace std;
#define N 1024 // vertex number
//Using arrays to implement queue
#define imax(a, b) (a>b?a:b)

char filein[] = "/home/yuede/dataset/edge.dat";
char fileout[] = "/home/yuede/dataset/edge.cpu_multi";
//Using arrays to implement queue
int q[N];

int edge[N][N];
int visit[N];
int dist[N][N];

int bfs(int root)
{
    //memset(dist, 0, sizeof(int) * N * N);
    memset(visit, 0, sizeof(int) * N);
    q[0] = root;
    int l = 1; // record the size of the queue
    int front = 0; // identify the front element
    int end = 0; // identify the end element
    while(l>0)
    {
        int cur = q[front];
        ++front;
        --l;
        if(front >= N)
            front %= N;
        
        for(int i=0; edge[cur][i]!=0; ++i)
        {
            int v = edge[cur][i];
            if(visit[v])
                continue;
            dist[root][v] = dist[root][cur] + 1;
            ++end;
            if(end >= N)
                end %= N;
            q[end] = v;
            visit[v] = 1;
            ++l;
        }
    }
    return 0;
}
int main()
{
    FILE *fp_in = fopen(filein, "r");
    int v, e;
    int num_v=0;
    memset(edge, 0, N*N*sizeof(int));
    memset(visit, 0, N*sizeof(int));
    memset(dist, 0, N*N*sizeof(int));
    while(fscanf(fp_in, "%d %d", &v, &e)!=EOF)
    {
        ++num_v;
        for(int i=0; i<e; ++i)
        {
            int v1;
            fscanf(fp_in, "%d", &v1);
            edge[v][i] = v1;//v->v1
        }
    }
    fclose(fp_in);

    for(int i=0; i<num_v; ++i)
        bfs(i);
    FILE *fp_out = fopen(fileout, "w");
    //fprintf("num_v = %d\n", num_v);
    for(int i=0; i<num_v; ++i)
    {
        fprintf(fp_out, "%d", i);
        for(int j=0; j<num_v; ++j)
            fprintf(fp_out, " %d", imax(dist[i][j], dist[j][i]));
        fprintf(fp_out, "\n");
    }
    fclose(fp_out);
    printf("Finished!\n");
    return 0;
}

	.text
	.file	"bfs_cpu_array_multi.hip"
	.globl	_Z3bfsi                         # -- Begin function _Z3bfsi
	.type	_Z3bfsi,@function
_Z3bfsi:                                # @_Z3bfsi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebx
	xorl	%ebp, %ebp
	movl	$visit, %edi
	movl	$4096, %edx                     # imm = 0x1000
	xorl	%esi, %esi
	callq	memset@PLT
	movl	%ebx, q(%rip)
	movslq	%ebx, %rax
	movl	$1, %ecx
	movl	$1023, %edx                     # imm = 0x3FF
	shlq	$12, %rax
	xorl	%esi, %esi
.LBB0_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	movslq	%ebp, %r8
	movslq	q(,%r8,4), %rdi
	leal	1(%r8), %r9d
	decl	%ecx
	movl	%r9d, %ebp
	andl	%edx, %ebp
	cmpl	%edx, %r8d
	cmovll	%r9d, %ebp
	movq	%rdi, %r8
	shlq	$12, %r8
	movl	edge(%r8), %r9d
	testl	%r9d, %r9d
	je	.LBB0_1
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB0_2 Depth=1
	leaq	(%rax,%rdi,4), %rdi
	addq	$dist, %rdi
	leaq	edge+4(%r8), %r8
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movslq	%r9d, %r9
	cmpl	$0, visit(,%r9,4)
	jne	.LBB0_6
# %bb.5:                                #   in Loop: Header=BB0_4 Depth=2
	movl	(%rdi), %r10d
	incl	%r10d
	movl	%r10d, dist(%rax,%r9,4)
	leal	1(%rsi), %r10d
	movl	%r10d, %r11d
	andl	%edx, %r11d
	cmpl	%edx, %esi
	cmovll	%r10d, %r11d
	movslq	%r11d, %rsi
	movl	%r9d, q(,%rsi,4)
	movl	$1, visit(,%r9,4)
	incl	%ecx
	movl	%r11d, %esi
.LBB0_6:                                #   in Loop: Header=BB0_4 Depth=2
	movl	(%r8), %r9d
	addq	$4, %r8
	testl	%r9d, %r9d
	jne	.LBB0_4
.LBB0_1:                                # %.loopexit
                                        #   in Loop: Header=BB0_2 Depth=1
	testl	%ecx, %ecx
	jg	.LBB0_2
# %bb.7:
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z3bfsi, .Lfunc_end0-_Z3bfsi
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$filein, %edi
	movl	$.L.str, %esi
	callq	fopen
	movq	%rax, %rbx
	movl	$edge, %edi
	movl	$4194304, %edx                  # imm = 0x400000
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$visit, %edi
	movl	$4096, %edx                     # imm = 0x1000
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$dist, %edi
	movl	$4194304, %edx                  # imm = 0x400000
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rcx
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$-1, %eax
	je	.LBB1_12
# %bb.1:                                # %.lr.ph39.preheader
	movl	$1, %ecx
	leaq	12(%rsp), %r14
	leaq	4(%rsp), %r12
	xorl	%r15d, %r15d
.LBB1_3:                                # %.lr.ph39
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_5 Depth 2
	movl	%r15d, %ebp
	movq	%rcx, %r13
	cmpl	$0, 4(%rsp)
	jle	.LBB1_2
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_3 Depth=1
	xorl	%r15d, %r15d
.LBB1_5:                                # %.lr.ph
                                        #   Parent Loop BB1_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	12(%rsp), %eax
	movslq	8(%rsp), %rcx
	shlq	$12, %rcx
	movl	%eax, edge(%rcx,%r15,4)
	incq	%r15
	movslq	4(%rsp), %rax
	cmpq	%rax, %r15
	jl	.LBB1_5
.LBB1_2:                                # %.loopexit
                                        #   in Loop: Header=BB1_3 Depth=1
	leal	1(%rbp), %r15d
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	leaq	8(%rsp), %rdx
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	leaq	1(%r13), %rcx
	cmpl	$-1, %eax
	jne	.LBB1_3
# %bb.6:                                # %.lr.ph42.preheader
	movq	%rbx, %rdi
	callq	fclose
	incl	%ebp
	xorl	%ebx, %ebx
.LBB1_7:                                # %.lr.ph42
                                        # =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_Z3bfsi
	incl	%ebx
	cmpl	%ebx, %ebp
	jne	.LBB1_7
# %bb.8:                                # %.lr.ph47.preheader
	movl	$fileout, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	movq	%rax, %rbx
	movl	%r15d, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	$dist, %r12d
	movl	$dist, %r15d
	xorl	%r14d, %r14d
	movq	%r13, 24(%rsp)                  # 8-byte Spill
.LBB1_9:                                # %.lr.ph47
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_10 Depth 2
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	fprintf
	movq	%r12, 32(%rsp)                  # 8-byte Spill
	movq	%r15, %rbp
.LBB1_10:                               #   Parent Loop BB1_9 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rbp), %eax
	movl	(%r12), %edx
	cmpl	%edx, %eax
	cmovgl	%eax, %edx
	movl	$.L.str.4, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	fprintf
	addq	$4, %rbp
	addq	$4096, %r12                     # imm = 0x1000
	decq	%r13
	jne	.LBB1_10
# %bb.11:                               #   in Loop: Header=BB1_9 Depth=1
	movl	$10, %edi
	movq	%rbx, %rsi
	callq	fputc@PLT
	incq	%r14
	addq	$4096, %r15                     # imm = 0x1000
	movq	32(%rsp), %r12                  # 8-byte Reload
	addq	$4, %r12
	cmpq	16(%rsp), %r14                  # 8-byte Folded Reload
	movq	24(%rsp), %r13                  # 8-byte Reload
	jne	.LBB1_9
	jmp	.LBB1_13
.LBB1_12:                               # %._crit_edge43.thread
	movq	%rbx, %rdi
	callq	fclose
	movl	$fileout, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	movq	%rax, %rbx
.LBB1_13:                               # %._crit_edge48
	movq	%rbx, %rdi
	callq	fclose
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	filein,@object                  # @filein
	.data
	.globl	filein
	.p2align	4, 0x0
filein:
	.asciz	"/home/yuede/dataset/edge.dat"
	.size	filein, 29

	.type	fileout,@object                 # @fileout
	.globl	fileout
	.p2align	4, 0x0
fileout:
	.asciz	"/home/yuede/dataset/edge.cpu_multi"
	.size	fileout, 35

	.type	q,@object                       # @q
	.bss
	.globl	q
	.p2align	4, 0x0
q:
	.zero	4096
	.size	q, 4096

	.type	edge,@object                    # @edge
	.globl	edge
	.p2align	4, 0x0
edge:
	.zero	4194304
	.size	edge, 4194304

	.type	visit,@object                   # @visit
	.globl	visit
	.p2align	4, 0x0
visit:
	.zero	4096
	.size	visit, 4096

	.type	dist,@object                    # @dist
	.globl	dist
	.p2align	4, 0x0
dist:
	.zero	4194304
	.size	dist, 4194304

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%d %d"
	.size	.L.str.1, 6

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

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

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Finished!"
	.size	.Lstr, 10

	.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 filein
	.addrsig_sym fileout
	.addrsig_sym __hip_cuid_

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

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

	.end_amdgpu_metadata
