// File: /workspace/github_c_makefile_star2_O0/00pauln00[P]yapio/yapio.c
// Function: yapio_stats_collection
static void *
yapio_stats_collection(void *unused_arg)
{
    ssize_t num_remote_test_contexts;
    int i;
    /* Skip the first group since the leader rank is 'this' rank.
     */
    for (i = 1, num_remote_test_contexts = 0; i < yapioNumTestGroups; i++)
        num_remote_test_contexts += yapioTestGroups[i].ytg_num_contexts;

    if (!num_remote_test_contexts)
        return NULL;

    log_msg(YAPIO_LL_DEBUG, "num_remote_test_contexts=%zd",
            num_remote_test_contexts);

    MPI_Request requests[num_remote_test_contexts];

    int req_num;
    for (i = 1, req_num = 0; i < yapioNumTestGroups; i++)
    {
        yapio_test_group_t *ytg = &yapioTestGroups[i];
        int j;
        for (j = 0; j < ytg->ytg_num_contexts; j++)
        {
            MPI_OP_START;
            int rc = MPI_Irecv(&ytg->ytg_contexts[j], sizeof(yapio_test_ctx_t),
                               MPI_BYTE, ytg->ytg_first_rank, j,
                               MPI_COMM_WORLD, &requests[req_num++]);
            MPI_OP_END;

            if (rc != MPI_SUCCESS)
                log_msg(YAPIO_LL_FATAL, "MPI_Irecv failed: %d", rc);
        }
    }

    int remaining_reports = num_remote_test_contexts;
    while (remaining_reports && !yapioHaltStonewallThread)
    {
        int index, flag;
        MPI_Status status;

        MPI_OP_START;
        int rc = MPI_Testany(num_remote_test_contexts, requests, &index, &flag,
                             &status);
        MPI_OP_END;

        if (rc != MPI_SUCCESS)
            log_msg(YAPIO_LL_FATAL, "MPI_Testany failed: %d", rc);

        if (index != MPI_UNDEFINED)
        {
            remaining_reports--;

            log_msg(YAPIO_LL_DEBUG, "index=%d rc=%d flag=%d rem=%d",
                    i, rc, flag, remaining_reports);

            yapio_stat_ready();
        }

        usleep(YAPIO_STATS_SLEEP_USEC);
    }

    return unused_arg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xa8, %rsp
movq %rdi, -0x18(%rbp)
movl $0x1, -0x24(%rbp)
movq $0x0, -0x20(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x208474(%rip), %eax    # 0x20f2bc
jge 0x6e79
movslq -0x24(%rbp), %rcx
leaq 0x20847b(%rip), %rax    # 0x20f2d0
imulq $0xc088, %rcx, %rcx     # imm = 0xC088
addq %rcx, %rax
movslq 0xb010(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6e3f
cmpq $0x0, -0x20(%rbp)
jne 0x6e8d
movq $0x0, -0x10(%rbp)
jmp 0x7206
movl $0x3, %eax
cmpl 0x8378(%rip), %eax      # 0xf210
jg 0x6ef1
movq 0x813f(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movl $0x3, %edi
callq 0x4890
movq -0x88(%rbp), %rdi
movq %rax, %rdx
movl 0x83ca(%rip), %r8d      # 0xf290
movq -0x20(%rbp), %rax
leaq 0x55d6(%rip), %rsi      # 0xc4a7
leaq 0x55fb(%rip), %rcx      # 0xc4d3
movl $0xae0, %r9d            # imm = 0xAE0
subq $0x10, %rsp
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2370
addq $0x10, %rsp
movq -0x20(%rbp), %rax
movq %rsp, %rcx
movq %rcx, -0x30(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x90(%rbp)
movq %rcx, %rsp
movq %rax, -0x38(%rbp)
movl $0x1, -0x24(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x208389(%rip), %eax    # 0x20f2bc
jge 0x7079
movslq -0x24(%rbp), %rcx
leaq 0x20838c(%rip), %rax    # 0x20f2d0
imulq $0xc088, %rcx, %rcx     # imm = 0xC088
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0xb010(%rcx), %eax
jge 0x7069
leaq 0xe12b85(%rip), %rdi    # 0xe19af8
callq 0x2350
movq -0x90(%rbp), %rax
movq -0x48(%rbp), %rdi
addq $0x10, %rdi
movslq -0x4c(%rbp), %rcx
imulq $0xb0, %rcx, %rcx
addq %rcx, %rdi
movq -0x48(%rbp), %rcx
movl 0xb018(%rcx), %ecx
movl -0x4c(%rbp), %r8d
movl -0x3c(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x3c(%rbp)
movslq %edx, %rdx
shlq $0x3, %rdx
addq %rdx, %rax
movl $0xb0, %esi
movq 0x802c(%rip), %rdx      # 0xeff0
movq 0x8005(%rip), %r9       # 0xefd0
subq $0x10, %rsp
movq %rax, (%rsp)
callq 0x20d0
addq $0x10, %rsp
movl %eax, -0x50(%rbp)
leaq 0xe12b12(%rip), %rdi    # 0xe19af8
callq 0x2390
cmpl $0x0, -0x50(%rbp)
je 0x7059
xorl %eax, %eax
cmpl 0x8217(%rip), %eax      # 0xf210
jg 0x7057
movq 0x7fde(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, -0x98(%rbp)
xorl %edi, %edi
callq 0x4890
movq -0x98(%rbp), %rdi
movq %rax, %rdx
movl 0x826c(%rip), %r8d      # 0xf290
movl -0x50(%rbp), %eax
leaq 0x54bc(%rip), %rsi      # 0xc4ea
leaq 0x549e(%rip), %rcx      # 0xc4d3
movl $0xaf2, %r9d            # imm = 0xAF2
subq $0x10, %rsp
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2370
addq $0x10, %rsp
movl $0x1, %edi
callq 0x40f0
jmp 0x7059
jmp 0x705b
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6f59
jmp 0x706b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6f2a
movq -0x20(%rbp), %rax
movl %eax, -0x54(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x54(%rbp)
movb %al, -0x99(%rbp)
je 0x709c
movb 0xe13ae4(%rip), %al     # 0xe1ab78
xorb $-0x1, %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x70ab
jmp 0x71f7
leaq 0xe12a46(%rip), %rdi    # 0xe19af8
callq 0x2350
movq -0x90(%rbp), %rsi
movq -0x20(%rbp), %rax
movl %eax, %edi
leaq -0x58(%rbp), %rdx
leaq -0x5c(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x2160
movl %eax, -0x7c(%rbp)
leaq 0xe12a19(%rip), %rdi    # 0xe19af8
callq 0x2390
cmpl $0x0, -0x7c(%rbp)
je 0x7152
xorl %eax, %eax
cmpl 0x811e(%rip), %eax      # 0xf210
jg 0x7150
movq 0x7ee5(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
xorl %edi, %edi
callq 0x4890
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
movl 0x8173(%rip), %r8d      # 0xf290
movl -0x7c(%rbp), %eax
leaq 0x53e7(%rip), %rsi      # 0xc50e
leaq 0x53a5(%rip), %rcx      # 0xc4d3
movl $0xb02, %r9d            # imm = 0xB02
subq $0x10, %rsp
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2370
addq $0x10, %rsp
movl $0x1, %edi
callq 0x40f0
jmp 0x7152
cmpl $0xffff8002, -0x58(%rbp) # imm = 0xFFFF8002
je 0x71e8
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movl $0x3, %eax
cmpl 0x809d(%rip), %eax      # 0xf210
jg 0x71e3
movq 0x7e64(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movl $0x3, %edi
callq 0x4890
movq -0xb0(%rbp), %rdi
movq %rax, %rdx
movl 0x80ef(%rip), %r8d      # 0xf290
movl -0x24(%rbp), %ebx
movl -0x7c(%rbp), %r11d
movl -0x5c(%rbp), %r10d
movl -0x54(%rbp), %eax
leaq 0x537e(%rip), %rsi      # 0xc534
leaq 0x5316(%rip), %rcx      # 0xc4d3
movl $0xb09, %r9d            # imm = 0xB09
subq $0x20, %rsp
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movb $0x0, %al
callq 0x2370
addq $0x20, %rsp
callq 0x7ac0
movl $0x2710, %edi           # imm = 0x2710
callq 0x21d0
jmp 0x7080
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rsp
movq -0x10(%rbp), %rax
leaq -0x8(%rbp), %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)