// File: kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/check.cpp
// Function: AST_struct_access::fill_and_check(symbol_table*, bool)
void AST_struct_access::fill_and_check(symbol_table* st, bool lval){
    value->fill_and_check(st, lval);
    
    type_descriptor* td = types.types[value->type];
    
    if ( value->type == INVALID ){
        type = INVALID;
        return;
    }
    
    if (    typeid(*td) != typeid(struct_type) 
         && typeid(*td) != typeid(union_type) 
    )
    {
        logger->buf << "Intento de acceso a campo en tipo '"
                    << types.types[value->type]->name << "'.";
        logger->error(line, column);
        type = INVALID;
    } else {
        sym = ((struct_type*)td)->fields->lookup( field );
        
        if ( sym != 0 ){
            type = sym->getType();
            
            if ( sym->isConst() ){
                logger->buf << "Intento de acceso a constante '"
                            << sym->getName() << "' definida en "
                            << sym->getLine() << ':' << sym->getColumn();
                logger->error(line, column);
            }
            union_access = typeid(*td) == typeid(struct_type);
        } else {
            logger->buf << "Tipo '" << types.types[value->type]->name
                        << "' no posee campo '" << field << "'.";
            logger->error(line, column);
            type = INVALID;
        }
        
    }
}

// Assembly:
subq $0xf8, %rsp
movb %dl, %al
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
andb $0x1, %al
movb %al, 0xe7(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x48(%rax), %rdi
movq 0xe8(%rsp), %rsi
movb 0xe7(%rsp), %cl
movq (%rdi), %rax
andb $0x1, %cl
movzbl %cl, %edx
callq *0x10(%rax)
movq 0x80(%rsp), %rax
movq 0x48(%rax), %rax
movslq 0x10(%rax), %rsi
leaq 0x61668(%rip), %rdi     # 0x6e4e0
callq 0x1fc90
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0xd8(%rsp)
movq 0x48(%rax), %rax
cmpl $0x1, 0x10(%rax)
jne 0xceb1
movq 0x80(%rsp), %rax
movl $0x1, 0x10(%rax)
jmp 0xd2a5
movq 0xd8(%rsp), %rax
movq %rax, 0x78(%rsp)
cmpq $0x0, %rax
jne 0xcec9
callq 0x6420
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rdi
leaq 0x60d5c(%rip), %rsi     # 0x6dc38
callq 0x201f0
testb $0x1, %al
jne 0xceea
jmp 0xcfb6
movq 0xd8(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
jne 0xcf02
callq 0x6420
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rdi
leaq 0x60d3b(%rip), %rsi     # 0x6dc50
callq 0x201f0
testb $0x1, %al
jne 0xcf23
jmp 0xcfb6
leaq 0x615ae(%rip), %rax     # 0x6e4d8
movq (%rax), %rdi
addq $0x38, %rdi
addq $0x10, %rdi
leaq 0x45a15(%rip), %rsi     # 0x52951
callq 0x6370
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0x68(%rsp)
movq 0x48(%rax), %rax
movslq 0x10(%rax), %rsi
leaq 0x61580(%rip), %rdi     # 0x6e4e0
callq 0x1fc90
movq 0x68(%rsp), %rdi
movq (%rax), %rsi
addq $0x8, %rsi
callq 0x6340
movq %rax, %rdi
leaq 0x4a737(%rip), %rsi     # 0x576b7
callq 0x6370
movq 0x80(%rsp), %rax
leaq 0x61544(%rip), %rcx     # 0x6e4d8
movq (%rcx), %rdi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x2f440
movq 0x80(%rsp), %rax
movl $0x1, 0x10(%rax)
jmp 0xd2a5
movq 0x80(%rsp), %rsi
movq 0xd8(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x50(%rsp)
addq $0x50, %rsi
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x6170
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2a040
movq %rax, 0x60(%rsp)
jmp 0xcfff
movq 0x80(%rsp), %rax
movq 0x60(%rsp), %rcx
movq %rcx, 0x70(%rax)
leaq 0xb8(%rsp), %rdi
callq 0x6778
movq 0x80(%rsp), %rax
cmpq $0x0, 0x70(%rax)
je 0xd1f4
movq 0x80(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x295f0
movl %eax, %ecx
movq 0x80(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x70(%rax), %rdi
callq 0x295e0
testb $0x1, %al
jne 0xd060
jmp 0xd1af
leaq 0x61471(%rip), %rax     # 0x6e4d8
movq (%rax), %rdi
addq $0x48, %rdi
leaq 0x45849(%rip), %rsi     # 0x528be
callq 0x6370
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq 0x70(%rax), %rsi
leaq 0x88(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x295b0
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x6340
movq %rax, 0x48(%rsp)
jmp 0xd0b6
movq 0x48(%rsp), %rdi
leaq 0x4581c(%rip), %rsi     # 0x528de
callq 0x6370
movq %rax, 0x30(%rsp)
jmp 0xd0ce
movq 0x80(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x29600
movl %eax, 0x2c(%rsp)
jmp 0xd0e5
movl 0x2c(%rsp), %esi
movq 0x30(%rsp), %rdi
callq 0x6690
movq %rax, 0x20(%rsp)
jmp 0xd0fa
movq 0x20(%rsp), %rdi
movl $0x3a, %esi
callq 0x6480
movq %rax, 0x18(%rsp)
jmp 0xd110
movq 0x80(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x29610
movl %eax, 0x14(%rsp)
jmp 0xd127
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %rdi
callq 0x6690
jmp 0xd137
leaq 0x88(%rsp), %rdi
callq 0x6778
movq 0x80(%rsp), %rax
leaq 0x61385(%rip), %rcx     # 0x6e4d8
movq (%rcx), %rdi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x2f440
jmp 0xd1af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x6778
jmp 0xd2ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x6778
jmp 0xd2ad
movq 0xd8(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0xd1c7
callq 0x6420
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rdi
leaq 0x60a5e(%rip), %rsi     # 0x6dc38
callq 0x20340
movb %al, %cl
movq 0x80(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x78(%rax)
jmp 0xd2a3
leaq 0x612dd(%rip), %rax     # 0x6e4d8
movq (%rax), %rdi
addq $0x38, %rdi
addq $0x10, %rdi
leaq 0x45768(%rip), %rsi     # 0x52975
callq 0x6370
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq %rcx, (%rsp)
movq 0x48(%rax), %rax
movslq 0x10(%rax), %rsi
leaq 0x612b0(%rip), %rdi     # 0x6e4e0
callq 0x1fc90
movq (%rsp), %rdi
movq (%rax), %rsi
addq $0x8, %rsi
callq 0x6340
movq %rax, %rdi
leaq 0x4572d(%rip), %rsi     # 0x5297c
callq 0x6370
movq 0x80(%rsp), %rsi
movq %rax, %rdi
addq $0x50, %rsi
callq 0x6340
movq %rax, %rdi
leaq 0x4a445(%rip), %rsi     # 0x576b7
callq 0x6370
movq 0x80(%rsp), %rax
leaq 0x61252(%rip), %rcx     # 0x6e4d8
movq (%rcx), %rdi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x2f440
movq 0x80(%rsp), %rax
movl $0x1, 0x10(%rax)
jmp 0xd2a5
addq $0xf8, %rsp
retq
movq 0xb0(%rsp), %rdi
callq 0x66b0
nopw (%rax,%rax)