// File: /workspace/github_c_makefile_star2_O1/openshmem-org[P]openshmem-examples/c/bcast1.c
// Function: main
int
main(void)
{
    int i;
    long *target;
    long *source;
    int me, npes;

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

    source = (long *) shmem_malloc(npes * sizeof(*source));
    for (i = 0; i < npes; i += 1) {
        source[i] = i + 1;
    }

    target = (long *) shmem_malloc(npes * sizeof(*target));
    for (i = 0; i < npes; i += 1) {
        target[i] = -999;
    }

    for (i = 0; i < SHMEM_BCAST_SYNC_SIZE; i += 1) {
        pSync[i] = SHMEM_SYNC_VALUE;
    }
    shmem_barrier_all();

    shmem_broadcast64(target, source, npes, 0, 0, 0, npes, pSync);

    for (i = 0; i < npes; i++) {
        printf("%-8d %ld\n", me, target[i]);
    }

    shmem_barrier_all();

    shmem_free(target);
    shmem_free(source);
    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x1090
callq 0x1060
movl %eax, %ebx
callq 0x1040
movl %eax, %r12d
movslq %eax, %r15
leaq (,%r15,8), %r13
movq %r13, %rdi
callq 0x1070
movq %rax, %r14
testl %r15d, %r15d
jle 0x129b
leal 0x1(%r12), %eax
leaq -0x1(%r15), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %eax
shlq $0x4, %rax
movdqa 0xdf5(%rip), %xmm1      # 0x2010
xorl %ecx, %ecx
movdqa 0xdfb(%rip), %xmm2      # 0x2020
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xdfb(%rip), %xmm4      # 0x2030
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm5     # xmm5 = xmm5[1,1,3,3]
pand %xmm6, %xmm5
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
por %xmm5, %xmm6
movdqa %xmm1, %xmm5
psubq %xmm3, %xmm5
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x1274
movq %xmm5, (%r14,%rcx)
pxor %xmm3, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x128e
pshufd $0xee, %xmm5, %xmm5     # xmm5 = xmm5[2,3,2,3]
movq %xmm5, 0x8(%r14,%rcx)
paddq %xmm4, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x1235
movq %r13, %rdi
callq 0x1070
movq %rax, %r13
testl %r12d, %r12d
jle 0x1348
leal 0x1(%r12), %eax
leaq -0x1(%r15), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %eax
shlq $0x4, %rax
movdqa 0xd40(%rip), %xmm1      # 0x2010
xorl %ecx, %ecx
movdqa 0xd46(%rip), %xmm2      # 0x2020
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xd46(%rip), %xmm4      # 0x2030
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x1324
movq $-0x3e7, (%r13,%rcx)    # imm = 0xFC19
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x133b
movq $-0x3e7, 0x8(%r13,%rcx) # imm = 0xFC19
paddq %xmm4, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x12ea
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x2d2c(%rip)     # 0x4080
leaq 0x2d25(%rip), %rbp      # 0x4080
callq 0x1080
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbp
pushq %r15
callq 0x10b0
addq $0x10, %rsp
testl %r12d, %r12d
jle 0x13a4
leaq 0xcb7(%rip), %r12       # 0x2040
xorl %ebp, %ebp
movq (%r13,%rbp,8), %rdx
movq %r12, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
incq %rbp
cmpq %rbp, %r15
jne 0x138b
callq 0x1080
movq %r13, %rdi
callq 0x10a0
movq %r14, %rdi
callq 0x10a0
callq 0x1050
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq