// File: /workspace/github_c_makefile_star2_O0/00pauln00[P]yapio/yapio.c
// Function: yapio_perform_io
static int
yapio_perform_io(yapio_test_ctx_t *ytc)
{
    yapio_test_group_t *ytg = ytc->ytc_group;
    int rc = 0;

    const yapio_blk_md_t *md_array =
        yapio_test_ctx_to_md_array(ytc, YAPIO_TEST_CTX_MDH_IN,
                                   &ytc->ytc_num_ops_expected);

    int j;
    for (j = 0, ytc->ytc_num_ops_completed_before_stonewall = 0;
         j < ytc->ytc_num_ops_expected;
         j++, ytc->ytc_num_ops_completed_before_stonewall++)
    {
        if (yapioStoneWalled)
        {
            log_msg(YAPIO_LL_DEBUG, "stonewalled %d",
                    ytc->ytc_num_ops_completed_before_stonewall);
            ytc->ytc_stonewalled = 1;
            break;
        }

        const yapio_blk_md_t *md = &md_array[j];

        if (!ytc->ytc_read)
            yapio_apply_contents_to_io_buffer(yapioIOBuf, ytg->ytg_blk_sz, md);

        /* Obtain this IO's offset from the
         */
        off_t off = yapio_get_rw_offset(md, ytg->ytg_blk_sz);
        if (off < 0)
        {
            log_msg(YAPIO_LL_ERROR, "yapio_get_rw_offset() failed");
            rc = -ERANGE;
            break;
        }

        if (md->ybm_skip_io)
        {
            log_msg(YAPIO_LL_DEBUG, "skipping IO # %d, offset = %lu", j, off);
            continue;
        }

        ssize_t io_rc, io_bytes = 0;
        do
        {
            char *adjusted_buf = yapioIOBuf + io_bytes;
            size_t adjusted_io_len = ytg->ytg_blk_sz - io_bytes;
            off_t adjusted_off = off + io_bytes;
            int fd_idx = md->ybm_owner_rank_fpp;
            int fd = yapio_get_fd(fd_idx);

            io_rc = ytc->ytc_read ?
                YAPIO_SYS_CALL(pread)(fd, adjusted_buf, adjusted_io_len,
                                      adjusted_off) :
                YAPIO_SYS_CALL(pwrite)(fd, adjusted_buf, adjusted_io_len,
                                       adjusted_off);

            log_msg(YAPIO_LL_DEBUG, "%s rc=%zd off=%lu@%d fr=%d",
                    ytc->ytc_read ? "pread" : "pwrite", io_rc, adjusted_off,
                    fd_idx, ytg->ytg_first_rank);

            if (io_rc > 0)
                io_bytes += io_rc;

        } while (io_rc > 0 && (size_t)io_bytes < ytg->ytg_blk_sz);

        if (io_rc < 0)
        {
            log_msg(YAPIO_LL_ERROR, "io failed at offset %lu: %s",
                    off, strerror(errno));
            rc = -errno;
            break;
        }

        if (ytc->ytc_read && yapioVerifyRead)
        {
            rc = yapio_verify_contents_of_io_buffer(yapioIOBuf,
                                                    ytg->ytg_blk_sz, md);
            if (rc)
                break;
        }
    }

//    if (!rc && !ytc->ytc_no_fsync)
    if (!ytc->ytc_no_fsync && !yapioStoneWalled)
    {
        int fsync_rc = yapio_fsync();
        if (fsync_rc)
        {
            log_msg(YAPIO_LL_ERROR, "fsync(): %s", strerror(-rc));
            if (!rc)
                rc = fsync_rc;
        }
    }

    return rc;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq 0x100(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0xf8(%rsp)
movl $0x0, 0xf4(%rsp)
movq 0x100(%rsp), %rdi
movq 0x100(%rsp), %rdx
addq $0x4, %rdx
xorl %esi, %esi
callq 0x24f0
movq %rax, 0xe8(%rsp)
movl $0x0, 0xe4(%rsp)
movq 0x100(%rsp), %rax
movl $0x0, 0x8(%rax)
movl 0xe4(%rsp), %eax
movq 0x100(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x82bc
testb $0x1, 0xe12e08(%rip)    # 0xe1ab88
je 0x7df7
movl $0x3, %eax
cmpl 0x7483(%rip), %eax      # 0xf210
jg 0x7de6
movq 0x724a(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x90(%rsp)
movl $0x3, %edi
callq 0x4890
movq 0x90(%rsp), %rdi
movq %rax, %rdx
movl 0x74d3(%rip), %r8d      # 0xf290
movq 0x100(%rsp), %rax
movl 0x8(%rax), %eax
leaq 0x4c92(%rip), %rsi      # 0xca61
leaq 0x4ca9(%rip), %rcx      # 0xca7f
movl $0x6a0, %r9d            # imm = 0x6A0
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2370
movq 0x100(%rsp), %rax
movb $0x1, 0x1(%rax)
jmp 0x82bc
movq 0xe8(%rsp), %rax
movslq 0xe4(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0xd8(%rsp)
movq 0x100(%rsp), %rax
movb (%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7e50
movq 0xe0fc9c(%rip), %rdi    # 0xe17ad0
movq 0xf8(%rsp), %rax
movq 0xb028(%rax), %rsi
movq 0xd8(%rsp), %rdx
callq 0xa0f0
movq 0xd8(%rsp), %rdi
movq 0xf8(%rsp), %rax
movq 0xb028(%rax), %rsi
callq 0xa1e0
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
jge 0x7ee5
movl $0x1, %eax
cmpl 0x7386(%rip), %eax      # 0xf210
jg 0x7ed5
movq 0x714d(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x88(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x88(%rsp), %rdi
movq %rax, %rdx
movl 0x73d6(%rip), %r8d      # 0xf290
leaq 0x4bcf(%rip), %rsi      # 0xca90
leaq 0x4bb7(%rip), %rcx      # 0xca7f
movl $0x6af, %r9d            # imm = 0x6AF
movb $0x0, %al
callq 0x2370
movl $0xffffffde, 0xf4(%rsp) # imm = 0xFFFFFFDE
jmp 0x82bc
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x3f, %rax
cmpq $0x0, %rax
je 0x7f6f
movl $0x3, %eax
cmpl 0x730a(%rip), %eax      # 0xf210
jg 0x7f6a
movq 0x70d1(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x80(%rsp)
movl $0x3, %edi
callq 0x4890
movq 0x80(%rsp), %rdi
movq %rax, %rdx
movl 0x735a(%rip), %r8d      # 0xf290
movl 0xe4(%rsp), %r10d
movq 0xd0(%rsp), %rax
leaq 0x4b6f(%rip), %rsi      # 0xcabc
leaq 0x4b2b(%rip), %rcx      # 0xca7f
movl $0x6b6, %r9d            # imm = 0x6B6
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x8295
movq $0x0, 0xc0(%rsp)
movq 0xe0fb4e(%rip), %rax    # 0xe17ad0
addq 0xc0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0xf8(%rsp), %rax
movq 0xb028(%rax), %rax
subq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xd0(%rsp), %rax
addq 0xc0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xd8(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %edi
callq 0xa210
movl %eax, 0xa0(%rsp)
movq 0x100(%rsp), %rax
movb (%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8038
movq 0x71fc(%rip), %rax      # 0xf208
movq 0x20(%rax), %rax
movl 0xa0(%rsp), %edi
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movq %rax, 0x78(%rsp)
jmp 0x8069
movq 0x71c9(%rip), %rax      # 0xf208
movq 0x28(%rax), %rax
movl 0xa0(%rsp), %edi
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl $0x3, %eax
cmpl 0x718f(%rip), %eax      # 0xf210
jg 0x812e
movq 0x6f52(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movl $0x3, %edi
callq 0x4890
movq 0x70(%rsp), %rdi
movq %rax, %rdx
movl 0x71e1(%rip), %r8d      # 0xf290
movq 0x100(%rsp), %rax
movb (%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %ecx
leaq 0x3391(%rip), %r14      # 0xb459
leaq 0x4a45(%rip), %rax      # 0xcb14
cmpl $0x0, %ecx
cmovneq %rax, %r14
movq 0xc8(%rsp), %rbx
movq 0xa8(%rsp), %r11
movl 0xa4(%rsp), %r10d
movq 0xf8(%rsp), %rax
movl 0xb018(%rax), %eax
leaq 0x49e7(%rip), %rsi      # 0xcaea
leaq 0x4975(%rip), %rcx      # 0xca7f
movl $0x6cb, %r9d            # imm = 0x6CB
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x2370
cmpq $0x0, 0xc8(%rsp)
jle 0x8151
movq 0xc8(%rsp), %rax
addq 0xc0(%rsp), %rax
movq %rax, 0xc0(%rsp)
jmp 0x8153
xorl %eax, %eax
cmpq $0x0, 0xc8(%rsp)
movb %al, 0x6f(%rsp)
jle 0x8182
movq 0xc0(%rsp), %rax
movq 0xf8(%rsp), %rcx
cmpq 0xb028(%rcx), %rax
setb %al
movb %al, 0x6f(%rsp)
movb 0x6f(%rsp), %al
testb $0x1, %al
jne 0x7f7b
cmpq $0x0, 0xc8(%rsp)
jge 0x823b
movl $0x1, %eax
cmpl 0x7068(%rip), %eax      # 0xf210
jg 0x8223
movq 0x6e2f(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movl $0x1, %edi
callq 0x4890
movq %rax, 0x50(%rsp)
movl 0x70c2(%rip), %eax      # 0xf290
movl %eax, 0x5c(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x60(%rsp)
callq 0x2230
movl (%rax), %edi
callq 0x21e0
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rdx
movl 0x5c(%rsp), %r8d
movq 0x60(%rsp), %r10
leaq 0x4914(%rip), %rsi      # 0xcb1a
leaq 0x4872(%rip), %rcx      # 0xca7f
movl $0x6d5, %r9d            # imm = 0x6D5
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x2370
callq 0x2230
movq %rax, %rcx
xorl %eax, %eax
subl (%rcx), %eax
movl %eax, 0xf4(%rsp)
jmp 0x82bc
movq 0x100(%rsp), %rax
movb (%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8293
testb $0x1, 0x6fc7(%rip)      # 0xf220
je 0x8293
movq 0xe0f86e(%rip), %rdi    # 0xe17ad0
movq 0xf8(%rsp), %rax
movq 0xb028(%rax), %rsi
movq 0xd8(%rsp), %rdx
callq 0xa250
movl %eax, 0xf4(%rsp)
cmpl $0x0, 0xf4(%rsp)
je 0x8291
jmp 0x82bc
jmp 0x8293
jmp 0x8295
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
movq 0x100(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x7d61
movq 0x100(%rsp), %rax
movb (%rax), %al
shrb $0x4, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x838b
testb $0x1, 0xe128aa(%rip)    # 0xe1ab88
jne 0x838b
callq 0xa4e0
movl %eax, 0x9c(%rsp)
cmpl $0x0, 0x9c(%rsp)
je 0x8389
movl $0x1, %eax
cmpl 0x6f07(%rip), %eax      # 0xf210
jg 0x836f
movq 0x6cce(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl $0x1, %edi
callq 0x4890
movq %rax, 0x38(%rsp)
movl 0x6f61(%rip), %eax      # 0xf290
movl %eax, 0x44(%rsp)
xorl %edi, %edi
subl 0xf4(%rsp), %edi
callq 0x21e0
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
movl 0x44(%rsp), %r8d
leaq 0x47ee(%rip), %rsi      # 0xcb45
leaq 0x4721(%rip), %rcx      # 0xca7f
movl $0x6e9, %r9d            # imm = 0x6E9
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2370
cmpl $0x0, 0xf4(%rsp)
jne 0x8387
movl 0x9c(%rsp), %eax
movl %eax, 0xf4(%rsp)
jmp 0x8389
jmp 0x838b
movl 0xf4(%rsp), %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
nopl (%rax)