// File: AndreyVV-100[P]GachiLang/Frontend/Frontend.cpp
// Function: GetCond(element**)
element* GetCond      (element** el_now)
{
    parse_ass;
    require_ind;

    // Old code:

/*     const size_t without_backslash_0 = 1;

    const size_t    if_size  = sizeof (IF_STR)    - without_backslash_0;
    const size_t while_size  = sizeof (WHILE_STR) - without_backslash_0;

    if ((*el_now)->len != if_size    + 2 * MALE_LEN && 
        (*el_now)->len != while_size + 2 * MALE_LEN) 
        require_exit;

         if (strncmp (IF_STR,    (*el_now)->ind + MALE_LEN,    if_size) == 0)
        (*el_now)->type = IF;
    else if (strncmp (WHILE_STR, (*el_now)->ind + MALE_LEN, while_size) == 0)
        (*el_now)->type = WHILE;
    else
        require_exit;
 */

    if (strcmp (IF_STR, (*el_now)->ind) == 0)
        (*el_now)->type = IF;
    else if (strcmp (WHILE_STR, (*el_now)->ind) == 0)
        (*el_now)->type = WHILE;
    else
        require_exit;

    element* el_result = *el_now;
    next;

    el_result->left = GetE (el_now);
    check_parse (el_result->left);

    if ((*el_now)->type == ARITH && 
        (*el_now)->len  == 1     &&
      *((*el_now)->ind) != '>'   &&
      *((*el_now)->ind) != '<')
            require_exit;
            
    (*el_now)->left       = el_result->left;
    el_result->left       = *el_now;
    el_result->left->type = COND;
    next;

    el_result->left->right = GetE (el_now);
    check_parse (el_result->left->right);

    el_result->right = GetBody (el_now);
    check_parse (el_result->right);
    
    // Gypsy focuses
    if ((*el_now - 1)->type == LR)
    {
        // *el_now - 1 == el_result->right
        el_result->right    = el_result->right->left;
    }

    else
    {
        // (*el_now - 1)->type == BODY - useless element, I can use it for good deed.
        (*el_now - 1)->type = LR;
        strcpy((*el_now - 1)->ind, "$");    
    }

    (*el_now - 1)->left = el_result;
    el_result = *el_now - 1;
    // End of gypsy focuses
    return el_result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2dd5
jmp 0x2df4
leaq 0x345f(%rip), %rdi      # 0x623b
leaq 0x3242(%rip), %rsi      # 0x6025
movl $0x1e8, %edx            # imm = 0x1E8
leaq 0x356a(%rip), %rcx      # 0x6359
callq 0x1090
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2e00
jmp 0x2e1f
leaq 0x3433(%rip), %rdi      # 0x623a
leaq 0x3217(%rip), %rsi      # 0x6025
movl $0x1e8, %edx            # imm = 0x1E8
leaq 0x353f(%rip), %rcx      # 0x6359
callq 0x1090
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x9, (%rax)
jne 0x2e39
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0x2e7f
leaq 0x3402(%rip), %rdi      # 0x6242
leaq 0x3512(%rip), %rsi      # 0x6359
movl $0x1e9, %edx            # imm = 0x1E9
movb $0x0, %al
callq 0x1040
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x3404(%rip), %rdi      # 0x6269
movb $0x0, %al
callq 0x1040
leaq 0x62dd(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x358f(%rip), %rdi      # 0x6420
callq 0x1140
cmpl $0x0, %eax
jne 0x2eaa
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl $0xb, (%rax)
jmp 0x2f1d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x3574(%rip), %rdi      # 0x6430
callq 0x1140
cmpl $0x0, %eax
jne 0x2ed5
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl $0xc, (%rax)
jmp 0x2f1b
leaq 0x3366(%rip), %rdi      # 0x6242
leaq 0x3476(%rip), %rsi      # 0x6359
movl $0x203, %edx            # imm = 0x203
movb $0x0, %al
callq 0x1040
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x3368(%rip), %rdi      # 0x6269
movb $0x0, %al
callq 0x1040
leaq 0x6241(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
jmp 0x2f1d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x30, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3130
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x61f7(%rip), %rcx      # 0x9150
cmpq (%rcx), %rax
jne 0x2f71
leaq 0x61eb(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x6, (%rax)
jne 0x2ff7
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x1, 0x20(%rax)
jne 0x2ff7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
je 0x2ff7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
je 0x2ff7
leaq 0x328a(%rip), %rdi      # 0x6242
leaq 0x339a(%rip), %rsi      # 0x6359
movl $0x20f, %edx            # imm = 0x20F
movb $0x0, %al
callq 0x1040
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x328c(%rip), %rdi      # 0x6269
movb $0x0, %al
callq 0x1040
leaq 0x6165(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xf, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x30, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3130
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x60f0(%rip), %rcx      # 0x9150
cmpq (%rcx), %rax
jne 0x3078
leaq 0x60e4(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
movq -0x10(%rbp), %rdi
callq 0x2470
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
leaq 0x60b5(%rip), %rcx      # 0x9150
cmpq (%rcx), %rax
jne 0x30b0
leaq 0x60a9(%rip), %rax      # 0x9150
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x311e
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x3, -0x30(%rax)
jne 0x30d3
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x30f8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl $0x3, -0x30(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rax), %rdi
leaq 0x3283(%rip), %rsi      # 0x6376
callq 0x10f0
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, -0x28(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq $-0x30, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)