// File: /workspace/github_c_makefile_star2_O0/00pauln00[P]yapio/yapio.c
// Function: yapio_parse_test_recipe
static int
yapio_parse_test_recipe(const char *recipe_str)
{
    yapio_test_group_t *ytg = &yapioTestGroups[yapioNumTestGroups];

    yapio_test_group_init(ytg);

    size_t recipe_str_len = strnlen(recipe_str, YAPIO_RECIPE_STRLEN_MAX);
    if (recipe_str_len >= YAPIO_RECIPE_STRLEN_MAX)
    {
        log_msg(YAPIO_LL_ERROR, "recipe input string is too long");
        return -E2BIG;
    }

    int rc = 0;
    int rw, locality, io_pattern;
    int test_ctx_idx;
    size_t tmp;

    rw = locality = io_pattern = -1;

    unsigned i;
    for (i = 0; i < recipe_str_len; i++)
    {
        test_ctx_idx = ytg->ytg_num_contexts - 1;
        yapio_test_ctx_t *ytc = &ytg->ytg_contexts[test_ctx_idx];

        /* If mutually exclusive options have been violated then exit the loop.
         */
        if (rw > 0 || locality > 0 || io_pattern > 0)
            break;

        const char c = recipe_str[i];
        switch (c)
        {
        /* Recipe specific parameters (B,n,N,F) which are separated by ':'
         */
        case 'P':
            i += yapio_test_recipe_param_to_string(&recipe_str[i + 1],
                                                   ytg->ytg_prefix);
            break;
        case 'X':
            i += yapio_test_recipe_param_to_string(&recipe_str[i + 1],
                                                   ytg->ytg_suffix);
            ytg->ytg_restart_from_previous_job = true;
            break;
        case 'B':
            i += yapio_test_recipe_param_to_ull(&recipe_str[i + 1],
                                                &ytg->ytg_blk_sz);
            break;
        case 'n':
            i += yapio_test_recipe_param_to_ull(&recipe_str[i + 1],
                                                &ytg->ytg_num_blks_per_rank);
            break;
        case 'N':
            i += yapio_test_recipe_param_to_ull(&recipe_str[i + 1], &tmp);
            ytg->ytg_num_ranks = (int)tmp;
            break;
        case 'M':
            if (recipe_str[i + 1] != '.')
            {
                printf("Percentage should start by '.'\n");
                yapio_print_help(YAPIO_EXIT_ERR);
            }
            /* find where percentage stops */
            int len_pdot = strlen("M.");
            i += len_pdot;
            unsigned int end = i;
            while (end < recipe_str_len)
            {
                if (!isdigit(recipe_str[end]))
                    break;
                end++;
            }
            unsigned long int percent = 0;
            percent = strtoull(&recipe_str[i], NULL, 10);

            /* count number of skipped IOs */
            ytc->ytc_sparse_io = percent * ytg->ytg_num_blks_per_rank;
            while (i < end)
            {
                ytc->ytc_sparse_io = ytc->ytc_sparse_io / 10;
                i++;
            }
            printf("skip %d IOs\n", ytc->ytc_sparse_io);

            i = end - 1;
            break;
        case 'K':
            ytg->ytg_keep_file = true;
            i++;
            break;
        case 'F':
            ytg->ytg_file_per_process = true;
            i++;
            break;
        case 'w': //'w' and 'r' are mutually exclusive
            if (!++rw)
                ytc->ytc_read = 0;
            break;

        case 'r':
            if (!++rw)
                ytc->ytc_read = 1;
            break;

        case 's': //'s', 'S', and 'r' are mutually exclusive:
            if (!++io_pattern)
                ytc->ytc_io_pattern = YAPIO_IOP_SEQUENTIAL;
            break;

        case 'S':
            if (!++io_pattern)
                ytc->ytc_io_pattern = YAPIO_IOP_STRIDED;
            break;

        case 'R':
            if (!++io_pattern)
                ytc->ytc_io_pattern = YAPIO_IOP_RANDOM;
            break;

        case 'L':
            if (!++locality)
                ytc->ytc_remote_locality = 0;
            break;
        case 'D':
            if (!++locality)
                ytc->ytc_remote_locality = 1;
            break;
        case 'b':
            ytc->ytc_backwards = 1;
            break;
        case 'h':
            ytc->ytc_leave_holes = 1;
            break;
        case 'f':
            ytc->ytc_no_fsync = 1;
            break;

        case ',':
            ytg->ytg_num_contexts++;
            rw = locality = io_pattern = -1;
            break;

        default:
            log_msg_r0(YAPIO_LL_ERROR,
                       "invalid recipe character '%c': test %d, pos %u",
                       c, test_ctx_idx, i);
            return -EINVAL;
        }
    }

    if (rw)
    {
        if (rw > 0)
        {
            log_msg_r0(YAPIO_LL_ERROR,
                       "'r', 'w' are mutually exclusive: test %d, pos %u",
                       test_ctx_idx, i);
        }
        else
        {
            log_msg_r0(YAPIO_LL_ERROR, "'r' or 'w' not specified: test %d",
                       test_ctx_idx);
        }

        rc = -EINVAL;
    }
    else if (io_pattern)
    {
        if (io_pattern > 0)
        {
            log_msg_r0(YAPIO_LL_ERROR,
                       "'s', 'S', 'R' are mutually exclusive: test %d, pos %u",
                       test_ctx_idx, i);
        }
        else
        {
            log_msg_r0(YAPIO_LL_ERROR,
                       "'s', 'S' or 'R' not specified: test %d",
                       test_ctx_idx);
        }

        rc = -EINVAL;
    }
    else if (locality > 0)
    {
        if (locality > 0)
        {
            log_msg_r0(YAPIO_LL_ERROR,
                       "L', 'D' are mutually exclusive: test %d, pos %u",
                       test_ctx_idx, i);
        }
        rc = -EINVAL;
    }

    return rc;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movslq 0x20a856(%rip), %rcx    # 0x20f2bc
leaq 0x20a863(%rip), %rax    # 0x20f2d0
imulq $0xc088, %rcx, %rcx     # imm = 0xC088
addq %rcx, %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x5710
movq 0xb8(%rsp), %rdi
movl $0x1001, %esi           # imm = 0x1001
callq 0x2130
movq %rax, 0xa8(%rsp)
cmpq $0x1001, 0xa8(%rsp) # imm = 0x1001
jb 0x4b14
movl $0x1, %eax
cmpl 0xa751(%rip), %eax      # 0xf210
jg 0x4b04
movq 0xa518(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x58(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x58(%rsp), %rdi
movq %rax, %rdx
movl 0xa7a7(%rip), %r8d      # 0xf290
leaq 0x6fd7(%rip), %rsi      # 0xbac7
leaq 0x6fff(%rip), %rcx      # 0xbaf6
movl $0x2b5, %r9d            # imm = 0x2B5
movb $0x0, %al
callq 0x2370
movl $0xfffffff9, 0xc4(%rsp) # imm = 0xFFFFFFF9
jmp 0x53f4
movl $0x0, 0xa4(%rsp)
movl $0xffffffff, 0x98(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x9c(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0xa0(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
cmpq 0xa8(%rsp), %rax
jae 0x513b
movq 0xb0(%rsp), %rax
movl 0xb010(%rax), %eax
subl $0x1, %eax
movl %eax, 0x94(%rsp)
movq 0xb0(%rsp), %rax
addq $0x10, %rax
movslq 0x94(%rsp), %rcx
imulq $0xb0, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
cmpl $0x0, 0xa0(%rsp)
jg 0x4bb9
cmpl $0x0, 0x9c(%rsp)
jg 0x4bb9
cmpl $0x0, 0x98(%rsp)
jle 0x4bbe
jmp 0x513b
movq 0xb8(%rsp), %rax
movl 0x84(%rsp), %ecx
movb (%rax,%rcx), %al
movb %al, 0x77(%rsp)
movsbl 0x77(%rsp), %eax
addl $-0x2c, %eax
movl %eax, %ecx
movq %rcx, 0x50(%rsp)
subl $0x4b, %eax
ja 0x5094
movq 0x50(%rsp), %rax
leaq 0x6584(%rip), %rcx      # 0xb17c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdi
movq 0xb0(%rsp), %rsi
addq $0xb03f, %rsi           # imm = 0xB03F
callq 0x5790
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdi
movq 0xb0(%rsp), %rsi
addq $0xb038, %rsi           # imm = 0xB038
callq 0x5790
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0xb0(%rsp), %rax
movb $0x1, 0xb033(%rax)
jmp 0x5123
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdi
movq 0xb0(%rsp), %rsi
addq $0xb028, %rsi           # imm = 0xB028
callq 0x5840
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdi
movq 0xb0(%rsp), %rsi
addq $0xb020, %rsi           # imm = 0xB020
callq 0x5840
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdi
leaq 0x88(%rsp), %rsi
callq 0x5840
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0x88(%rsp), %rax
movl %eax, %ecx
movq 0xb0(%rsp), %rax
movl %ecx, 0xb01c(%rax)
jmp 0x5123
movq 0xb8(%rsp), %rax
movl 0x84(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
je 0x4d8c
leaq 0x6d93(%rip), %rdi      # 0xbb0e
movb $0x0, %al
callq 0x2060
movl $0x1, %edi
callq 0x4910
movl $0x2, 0x70(%rsp)
movl 0x70(%rsp), %eax
addl 0x84(%rsp), %eax
movl %eax, 0x84(%rsp)
movl 0x84(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
cmpq 0xa8(%rsp), %rax
jae 0x4df7
callq 0x2170
movq (%rax), %rax
movq 0xb8(%rsp), %rcx
movl 0x6c(%rsp), %edx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x4dea
jmp 0x4df7
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x4db1
movq $0x0, 0x60(%rsp)
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2320
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq 0xb0(%rsp), %rcx
imulq 0xb020(%rcx), %rax
movl %eax, %ecx
movq 0x78(%rsp), %rax
movl %ecx, 0xa8(%rax)
movl 0x84(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jae 0x4e88
movq 0x78(%rsp), %rax
movl 0xa8(%rax), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movq 0x78(%rsp), %rax
movl %ecx, 0xa8(%rax)
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x4e47
movq 0x78(%rsp), %rax
movl 0xa8(%rax), %esi
leaq 0x6c94(%rip), %rdi      # 0xbb2e
movb $0x0, %al
callq 0x2060
movl 0x6c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movq 0xb0(%rsp), %rax
movb $0x1, 0xb031(%rax)
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movq 0xb0(%rsp), %rax
movb $0x1, 0xb030(%rax)
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x5123
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
cmpl $0x0, %eax
jne 0x4f23
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, (%rax)
jmp 0x5123
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
cmpl $0x0, %eax
jne 0x4f4d
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x9, %cl
orb $0x8, %cl
movb %cl, (%rax)
jmp 0x5123
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
cmpl $0x0, %eax
jne 0x4f74
movq 0x78(%rsp), %rax
movl $0x0, 0xc(%rax)
jmp 0x5123
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
cmpl $0x0, %eax
jne 0x4f9b
movq 0x78(%rsp), %rax
movl $0x2, 0xc(%rax)
jmp 0x5123
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
cmpl $0x0, %eax
jne 0x4fc2
movq 0x78(%rsp), %rax
movl $0x1, 0xc(%rax)
jmp 0x5123
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
cmpl $0x0, %eax
jne 0x4fec
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x5, %cl
orb $0x0, %cl
movb %cl, (%rax)
jmp 0x5123
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
cmpl $0x0, %eax
jne 0x5016
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x5, %cl
orb $0x4, %cl
movb %cl, (%rax)
jmp 0x5123
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, (%rax)
jmp 0x5123
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, (%rax)
jmp 0x5123
movq 0x78(%rsp), %rax
movb (%rax), %cl
andb $-0x11, %cl
orb $0x10, %cl
movb %cl, (%rax)
jmp 0x5123
movq 0xb0(%rsp), %rax
movl 0xb010(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xb010(%rax)
movl $0xffffffff, 0x98(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x9c(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0xa0(%rsp) # imm = 0xFFFFFFFF
jmp 0x5123
callq 0x5910
testb $0x1, %al
jne 0x509f
jmp 0x5113
movl $0x1, %eax
cmpl 0xa166(%rip), %eax      # 0xf210
jg 0x5111
movq 0x9f2d(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x48(%rsp), %rdi
movq %rax, %rdx
movl 0xa1bc(%rip), %r8d      # 0xf290
movsbl 0x77(%rsp), %r11d
movl 0x94(%rsp), %r10d
movl 0x84(%rsp), %eax
leaq 0x6a4b(%rip), %rsi      # 0xbb3b
leaq 0x69ff(%rip), %rcx      # 0xbaf6
movl $0x33e, %r9d            # imm = 0x33E
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x5113
movl $0xffffffea, 0xc4(%rsp) # imm = 0xFFFFFFEA
jmp 0x53f4
jmp 0x5125
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x4b4b
cmpl $0x0, 0xa0(%rsp)
je 0x5242
cmpl $0x0, 0xa0(%rsp)
jle 0x51c9
callq 0x5910
testb $0x1, %al
jne 0x515e
jmp 0x51c7
movl $0x1, %eax
cmpl 0xa0a7(%rip), %eax      # 0xf210
jg 0x51c5
movq 0x9e6e(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x40(%rsp), %rdi
movq %rax, %rdx
movl 0xa0fd(%rip), %r8d      # 0xf290
movl 0x94(%rsp), %r10d
movl 0x84(%rsp), %eax
leaq 0x69d0(%rip), %rsi      # 0xbb79
leaq 0x6946(%rip), %rcx      # 0xbaf6
movl $0x349, %r9d            # imm = 0x349
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x51c7
jmp 0x5232
callq 0x5910
testb $0x1, %al
jne 0x51d4
jmp 0x5230
movl $0x1, %eax
cmpl 0xa031(%rip), %eax      # 0xf210
jg 0x522e
movq 0x9df8(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x38(%rsp), %rdi
movq %rax, %rdx
movl 0xa087(%rip), %r8d      # 0xf290
movl 0x94(%rsp), %eax
leaq 0x69a2(%rip), %rsi      # 0xbbb9
leaq 0x68d8(%rip), %rcx      # 0xbaf6
movl $0x34e, %r9d            # imm = 0x34E
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x5230
jmp 0x5232
movl $0xffffffea, 0xa4(%rsp) # imm = 0xFFFFFFEA
jmp 0x53e6
cmpl $0x0, 0x98(%rsp)
je 0x5349
cmpl $0x0, 0x98(%rsp)
jle 0x52d0
callq 0x5910
testb $0x1, %al
jne 0x5265
jmp 0x52ce
movl $0x1, %eax
cmpl 0x9fa0(%rip), %eax      # 0xf210
jg 0x52cc
movq 0x9d67(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x30(%rsp), %rdi
movq %rax, %rdx
movl 0x9ff6(%rip), %r8d      # 0xf290
movl 0x94(%rsp), %r10d
movl 0x84(%rsp), %eax
leaq 0x693a(%rip), %rsi      # 0xbbea
leaq 0x683f(%rip), %rcx      # 0xbaf6
movl $0x359, %r9d            # imm = 0x359
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x52ce
jmp 0x5339
callq 0x5910
testb $0x1, %al
jne 0x52db
jmp 0x5337
movl $0x1, %eax
cmpl 0x9f2a(%rip), %eax      # 0xf210
jg 0x5335
movq 0x9cf1(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x28(%rsp), %rdi
movq %rax, %rdx
movl 0x9f80(%rip), %r8d      # 0xf290
movl 0x94(%rsp), %eax
leaq 0x6911(%rip), %rsi      # 0xbc2f
leaq 0x67d1(%rip), %rcx      # 0xbaf6
movl $0x35f, %r9d            # imm = 0x35F
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x5337
jmp 0x5339
movl $0xffffffea, 0xa4(%rsp) # imm = 0xFFFFFFEA
jmp 0x53e4
cmpl $0x0, 0x9c(%rsp)
jle 0x53e2
cmpl $0x0, 0x9c(%rsp)
jle 0x53d7
callq 0x5910
testb $0x1, %al
jne 0x536c
jmp 0x53d5
movl $0x1, %eax
cmpl 0x9e99(%rip), %eax      # 0xf210
jg 0x53d3
movq 0x9c60(%rip), %rax      # 0xefe0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x1, %edi
callq 0x4890
movq 0x20(%rsp), %rdi
movq %rax, %rdx
movl 0x9eef(%rip), %r8d      # 0xf290
movl 0x94(%rsp), %r10d
movl 0x84(%rsp), %eax
leaq 0x68ae(%rip), %rsi      # 0xbc65
leaq 0x6738(%rip), %rcx      # 0xbaf6
movl $0x36a, %r9d            # imm = 0x36A
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2370
jmp 0x53d5
jmp 0x53d7
movl $0xffffffea, 0xa4(%rsp) # imm = 0xFFFFFFEA
jmp 0x53e4
jmp 0x53e6
movl 0xa4(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)