// File: /workspace/github_c_makefile_star2_O0/USArmyResearchLab[P]ARL_OpenSHMEM/test/barrier.c
// Function: main
int main (void)
{
	int i, npe;
	static long pSyncA[SHMEM_BARRIER_SYNC_SIZE];
	static long pSyncB[SHMEM_BARRIER_SYNC_SIZE];
	for (i = 0; i < SHMEM_BARRIER_SYNC_SIZE; i++) {
		pSyncA[i] = SHMEM_SYNC_VALUE;
		pSyncB[i] = SHMEM_SYNC_VALUE;
	}

	shmem_init();
	int me = shmem_my_pe();
	int npes = shmem_n_pes();

	if (me == 0) {
		printf("# SHMEM Barrier times for variable NPES\n" \
			"# NPES\tLatency (nanoseconds)\n");
	}

	for (npe = 1; npe <= npes; npe++)
	{
		shmem_barrier_all();
		ctimer_start();

		unsigned int t = ctimer();
		if (me < npe) {
			for (i = 0; i < NLOOP; i += 2) {
				shmem_barrier(0, 0, npe, pSyncA);
				shmem_barrier(0, 0, npe, pSyncB);
			}
		}
		t -= ctimer();

		if (me == 0) {
			unsigned int nsec = ctimer_nsec(t / NLOOP);
			printf("%5d %7u\n", npe, nsec);
		}
	}
	shmem_finalize();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movslq -0x38(%rbp), %rax
cmpq $0x8, %rax
jae 0x1391
movslq -0x38(%rbp), %rcx
leaq 0x5de5(%rip), %rax      # 0x7150
movq $0x0, (%rax,%rcx,8)
movslq -0x38(%rbp), %rcx
leaq 0x5e12(%rip), %rax      # 0x7190
movq $0x0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1356
callq 0x1610
leaq 0x5d93(%rip), %rax      # 0x7130
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x5d8b(%rip), %rax      # 0x7134
movl (%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x40(%rbp)
jne 0x13c2
leaq 0x3c65(%rip), %rdi      # 0x5020
movb $0x0, %al
callq 0x10e0
movl $0x1, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x157d
callq 0x1600
callq 0x1590
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdi
callq 0x1110
movq 0x5ddd(%rip), %rdx      # 0x71d0
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
subq %rdx, %rcx
cvtsi2sd %rcx, %xmm0
movq 0x5dce(%rip), %rcx      # 0x71d8
subq %rcx, %rax
cvtsi2sd %rax, %xmm1
movsd 0x3bee(%rip), %xmm2     # 0x5008
mulsd %xmm2, %xmm1
movsd 0x3bea(%rip), %xmm2     # 0x5010
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x3bd3(%rip), %xmm1     # 0x5018
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x8(%rbp)
movq $-0x1, %rax
subq -0x8(%rbp), %rax
movl %eax, -0x48(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x14ae
movl $0x0, -0x38(%rbp)
cmpl $0x64, -0x38(%rbp)
jge 0x14ac
movl -0x3c(%rbp), %edx
xorl %esi, %esi
leaq 0x5cc9(%rip), %rcx      # 0x7150
movl %esi, %edi
callq 0x15c0
movl -0x3c(%rbp), %edx
xorl %esi, %esi
leaq 0x5cf6(%rip), %rcx      # 0x7190
movl %esi, %edi
callq 0x15c0
movl -0x38(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x38(%rbp)
jmp 0x1475
jmp 0x14ae
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x1110
movq 0x5d0e(%rip), %rdx      # 0x71d0
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
subq %rdx, %rcx
cvtsi2sd %rcx, %xmm0
movq 0x5cff(%rip), %rcx      # 0x71d8
subq %rcx, %rax
cvtsi2sd %rax, %xmm1
movsd 0x3b1f(%rip), %xmm2     # 0x5008
mulsd %xmm2, %xmm1
movsd 0x3b1b(%rip), %xmm2     # 0x5010
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x3b04(%rip), %xmm1     # 0x5018
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x20(%rbp)
movq $-0x1, %rcx
subq -0x20(%rbp), %rcx
movl -0x48(%rbp), %eax
subq %rcx, %rax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x40(%rbp)
jne 0x156d
movl -0x48(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %eax
movl %eax, %edi
callq 0x15b0
movl %eax, -0x4c(%rbp)
movl -0x3c(%rbp), %esi
movl -0x4c(%rbp), %edx
leaq 0x3b00(%rip), %rdi      # 0x5066
movb $0x0, %al
callq 0x10e0
jmp 0x156f
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x13c9
callq 0x1fa0
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)