// File: /workspace/github_c_makefile_star2_O2/ryvnf[P]czc/eval.c
// Function: eval_type
struct type *eval_type(struct type *t, struct ast *ast)
{
    struct type *type;
    switch (ast->tag) {
        case COMMA_EXPR:
            eval_type(NULL, ast_ast(ast, 0));
            type = eval_type(t, ast_ast(ast, 1));
            break;

        case COND_EXPR:
            type = eval_cond_type(t, ast);
            break;

        case ASGN_EXPR:
        case ADD_ASGN_EXPR:
        case SUB_ASGN_EXPR:
        case MUL_ASGN_EXPR:
        case DIV_ASGN_EXPR:
        case REM_ASGN_EXPR:
        case OR_ASGN_EXPR:
        case XOR_ASGN_EXPR:
        case AND_ASGN_EXPR:
        case SHL_ASGN_EXPR:
        case SHR_ASGN_EXPR:
            type = eval_asgn_type(ast);
            break;

        case LOR_EXPR:
        case LAND_EXPR:
            type = eval_binop_type(ast, BOOL_TYPE_FLAG);
            break;

        case EQ_EXPR:
        case NE_EXPR:
            type = eval_relop_type(ast, BOOL_TYPE_FLAG | INT_TYPE_FLAG | FLOAT_TYPE_FLAG |
                    PTR_TYPE_FLAG);
            break;

        case LT_EXPR:
        case GT_EXPR:
        case LE_EXPR:
        case GE_EXPR:
            type = eval_relop_type(ast, INT_TYPE_FLAG | FLOAT_TYPE_FLAG | PTR_TYPE_FLAG);
            break;

        case OR_EXPR:
        case XOR_EXPR:
        case AND_EXPR:
        case SHL_EXPR:
        case SHR_EXPR:
        case REM_EXPR:
            type = eval_binop_type(ast, INT_TYPE_FLAG);
            break;

        case ADD_EXPR:
            type = eval_add_type(ast);
            break;

        case SUB_EXPR:
            type = eval_sub_type(ast);
            break;

        case MUL_EXPR:
        case DIV_EXPR:
            type = eval_binop_type(ast, INT_TYPE_FLAG | FLOAT_TYPE_FLAG);
            break;

        case NOT_EXPR:
            type = eval_unop_type(ast, BOOL_TYPE_FLAG, false);
            break;

        case COMPL_EXPR:
            type = eval_unop_type(ast, INT_TYPE_FLAG, false);
            break;

        case UPLUS_EXPR:
        case NEG_EXPR:
            type = eval_unop_type(ast, INT_TYPE_FLAG | FLOAT_TYPE_FLAG, false);
            break;

        case REF_EXPR:
            type = eval_ref_type(ast);
            break;

        case PRE_INC_EXPR:
        case PRE_DEC_EXPR:
        case POST_INC_EXPR:
        case POST_DEC_EXPR:
            type = eval_unop_type(ast, INT_TYPE_FLAG | FLOAT_TYPE_FLAG | PTR_TYPE_FLAG, true);
            break;

        case SIZEOF_EXPR:
            type = eval_sizeof_type(ast);
            break;

        case CAST_EXPR:
            type = eval_cast_type(ast);
            break;

        case DEREF_EXPR:
            type = eval_deref_type(ast);
            break;

        case SUBSCR_EXPR:
            type = eval_subscr_type(ast);
            break;

        case CALL_EXPR:
            type = eval_call_type(ast);
            break;

        case MEMBER_EXPR:
            type = eval_member_type(ast);
            break;

        case INT_CONST:
            type = const_int_type;
            break;

        case FLOAT_CONST:
            type = const_float_type;
            break;

        case STR_LIT:
            type = eval_str_lit_type(ast);
            break;

        case TRUE_CONST:
            type = bool_type;
            break;

        case FALSE_CONST:
            type = bool_type;
            break;

        case NULL_CONST:
            type = void_ptr_type;
            break;

        case NAME:
            type = eval_name_type(t, ast);
            break;

        case DECL:
            type = eval_decl_type(ast);
            break;

        case INIT_EXPR:
            type = eval_init_type(t, ast);
            break;
    }

    if (type && type_type(type->tag) == SELFREF_TYPE_FLAG)
        fatal(ast->loc, "type cannot refer to itself in constant context");

    return type;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movl (%rsi), %eax
leaq 0xdc0d(%rip), %r14      # 0x12d58
leal -0x42d0(%rax), %ecx
cmpl $0x26, %ecx
jbe 0x5263
leal -0x4220(%rax), %ecx
cmpl $0xb, %ecx
jb 0x5281
leal -0x4280(%rax), %ecx
cmpl $0x30, %ecx
jbe 0x528e
leal -0x4260(%rax), %ecx
cmpl $0x4, %ecx
jb 0x52a2
leal -0x4250(%rax), %ecx
cmpl $0x2, %ecx
jb 0x52cb
leal -0x42c0(%rax), %ecx
cmpl $0x2, %ecx
jb 0x52b1
testl %eax, %eax
je 0x5394
cmpl $0x1, %eax
je 0x52d8
cmpl $0x2, %eax
je 0x52d8
cmpl $0x1000, %eax           # imm = 0x1000
je 0x53a0
cmpl $0x3000, %eax           # imm = 0x3000
je 0x53d1
cmpl $0x4000, %eax           # imm = 0x4000
je 0x53ad
cmpl $0x5000, %eax           # imm = 0x5000
je 0x53dd
cmpl $0x4210, %eax           # imm = 0x4210
je 0x53c1
cmpl $0x4230, %eax           # imm = 0x4230
je 0x52c1
cmpl $0x4240, %eax           # imm = 0x4240
je 0x52c1
cmpl $0x4270, %eax           # imm = 0x4270
je 0x529e
cmpl $0x42b1, %eax           # imm = 0x42B1
je 0x53b7
cmpl $0x42c2, %eax           # imm = 0x42C2
je 0x529e
cmpl $0x4200, %eax           # imm = 0x4200
jne 0x5350
movq %rbx, %rdi
xorl %esi, %esi
callq 0x26ce
xorl %edi, %edi
movq %rax, %rsi
callq 0x5137
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x26ce
movq %r15, %rdi
movq %rax, %rsi
callq 0x5137
jmp 0x5348
leaq 0x67aa(%rip), %rax      # 0xba14
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
jmp 0x5343
movq %rbx, %rdi
callq 0x566b
jmp 0x5348
movabsq $0x300010001, %rdx      # imm = 0x300010001
btq %rcx, %rdx
jae 0x52e1
pushq $0x2
jmp 0x52b3
pushq $0xe
popq %rsi
movq %rbx, %rdi
jmp 0x52d3
pushq $0x6
jmp 0x533d
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x53ea
jmp 0x5348
movq %rbx, %rdi
movl $0x80, %esi
jmp 0x52b7
movq %rbx, %rdi
movl $0x8e, %esi
callq 0x5454
leaq 0xda81(%rip), %r14      # 0x12d60
jmp 0x5350
cmpq $0x30, %rcx
jne 0x5178
movq %rbx, %rdi
callq 0x550a
jmp 0x5348
movq %rbx, %rdi
callq 0x57f5
jmp 0x5348
movq %rbx, %rdi
callq 0x599c
jmp 0x5348
movq %rbx, %rdi
callq 0x5779
jmp 0x5348
movq %rbx, %rdi
callq 0x5835
jmp 0x5348
movq %rbx, %rdi
callq 0x5744
jmp 0x5348
movq %rbx, %rdi
callq 0x57c9
jmp 0x5350
movq %rbx, %rdi
movl $0x80, %esi
jmp 0x5341
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x54b6
movq %rax, %r14
testq %r14, %r14
je 0x5371
movl $0x3ff, %eax            # imm = 0x3FF
andl (%r14), %eax
cmpl $0x100, %eax            # imm = 0x100
jne 0x5374
movq 0x8(%rbx), %rdi
leaq 0x6c2f(%rip), %rsi      # 0xbf99
xorl %eax, %eax
callq 0x4a05
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5bbe
jmp 0x5348
movq %rbx, %rdi
callq 0x58b1
jmp 0x5348
leaq 0xd9e5(%rip), %rax      # 0x12d80
movq (%rax), %r14
jmp 0x534b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5a7b
jmp 0x5348
movq %rbx, %rdi
callq 0x5b49
jmp 0x5348
movq %rbx, %rdi
callq 0x55ab
jmp 0x5348
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50ac
jmp 0x5348
leaq 0xd984(%rip), %r14      # 0x12d5c
jmp 0x5350
movq %rbx, %rdi
callq 0x5a50
jmp 0x5348