// File: /workspace/github_c_makefile_star2_O2/baileywjohnson[P]mpi-matrix-mult/MyMPI.c
// Function: print_block_vector
void print_block_vector (
   void        *v,       /* IN - Address of vector */
   MPI_Datatype dtype,   /* IN - Vector element type */
   int          n,       /* IN - Elements in vector */
   MPI_Comm     comm)    /* IN - Communicator */
{
   int        datum_size; /* Bytes per vector element */
   int        i;
   int        prompt;     /* Dummy variable */
   MPI_Status status;     /* Result of receive */
   void       *tmp;       /* Other process's subvector */
   int        id;         /* Process rank */
   int        p;          /* Number of processes */

   MPI_Comm_size (comm, &p);
   MPI_Comm_rank (comm, &id);
   datum_size = get_size (dtype);

   if (!id) {
      print_subvector (v, dtype, BLOCK_SIZE(id,p,n));
      if (p > 1) {
         tmp = my_malloc (id,BLOCK_SIZE(p-1,p,n)*datum_size);
         for (i = 1; i < p; i++) {
            MPI_Send (&prompt, 1, MPI_INT, i, PROMPT_MSG,
               comm);
            MPI_Recv (tmp, BLOCK_SIZE(i,p,n), dtype, i,
               RESPONSE_MSG, comm, &status);
            print_subvector (tmp, dtype, BLOCK_SIZE(i,p,n));
         }
         free (tmp);
      }
      printf ("\n\n");
   } else {
      MPI_Recv (&prompt, 1, MPI_INT, 0, PROMPT_MSG, comm,
         &status);
      MPI_Send (v, BLOCK_SIZE(id,p,n), dtype, 0,
         RESPONSE_MSG, comm);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %r12
leaq 0x10(%rsp), %rsi
movq %rcx, %rdi
callq 0x1100
leaq 0x14(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1170
movq %r15, %rdi
callq 0x1b5c
cmpl $0x0, (%r14)
je 0x317e
leaq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq 0x2e77(%rip), %rdx      # 0x5fa8
leaq 0x1c(%rsp), %rdi
pushq $0x1
popq %rsi
xorl %ecx, %ecx
movl %esi, %r8d
movq %rbx, %r9
callq 0x1140
movl 0x14(%rsp), %ecx
leal 0x1(%rcx), %eax
imull %r13d, %eax
movl 0x10(%rsp), %edi
cltd
idivl %edi
movl %eax, %esi
imull %r13d, %ecx
movl %ecx, %eax
cltd
idivl %edi
subl %eax, %esi
pushq $0x2
popq %r8
movq %r12, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movq %rbx, %r9
callq 0x1040
jmp 0x329b
movl %eax, %ebp
movl %r13d, %eax
cltd
idivl 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x2a95
movl 0x10(%rsp), %ecx
cmpl $0x2, %ecx
jl 0x328f
movq %r15, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movl 0x14(%rsp), %edi
leal -0x1(%rcx), %eax
imull %r13d, %eax
cltd
idivl %ecx
movl %r13d, %esi
subl %eax, %esi
imull %ebp, %esi
callq 0x1bc5
movq %rax, 0x20(%rsp)
leal (,%r13,2), %ebp
pushq $0x1
popq %rax
movq %r13, 0x28(%rsp)
movl %eax, %r14d
movq 0x38(%rsp), %r15
movq 0x20(%rsp), %rbx
movq 0x30(%rsp), %r12
cmpl 0x10(%rsp), %r14d
jge 0x3285
leaq 0x1c(%rsp), %rdi
pushq $0x1
popq %rsi
movq 0x2da0(%rip), %rdx      # 0x5fa8
movl %r14d, %ecx
movl %esi, %r8d
movq %r15, %r9
callq 0x1040
leal 0x1(%r14), %eax
movl %eax, 0x18(%rsp)
movl 0x10(%rsp), %ecx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, %esi
movl %r13d, %eax
cltd
idivl %ecx
subl %eax, %esi
leaq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r12, %rdx
movl %r14d, %ecx
pushq $0x2
popq %r8
movq %r15, %r9
callq 0x1140
movl 0x10(%rsp), %esi
movl %ebp, %eax
cltd
idivl %esi
movl %eax, %ecx
movl %r13d, %eax
cltd
idivl %esi
subl %eax, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movl %ecx, %edx
callq 0x2a95
movq 0x28(%rsp), %rax
addl %eax, %ebp
addl %eax, %r13d
movl 0x18(%rsp), %eax
movl %eax, %r14d
jmp 0x31ee
movq 0x20(%rsp), %rdi
callq 0x10f0
leaq 0xf28(%rip), %rdi       # 0x41be
callq 0x1060
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq