// File: /workspace/github_cpp_makefile_star2_O1/besm6[P]pascal-re/pascompl.cc
// Function: typeCheck::typeCheck(Types*, Types*)
typeCheck::typeCheck(TypesPtr type1, TypesPtr type2)
{
    super.push_back(this);
    rangeMismatch = false;
    if (type1->k == kindRange) {
        typ120z = type1->cast<RangeT>().base;
    } else {
        typ120z = type1;
    }
    if (not checkTypes or (type1 == type2)) {
L1:     ret = true;
    } else {
        kind1 = type1->k;
        kind2 = type2->k;
        if (kind1 == kind2) {
            switch (kind1) {
            case kindReal:
                /* empty */ break;
            case kindScalar: {
                /*(chain)*/
                if (type1->cast<ScalarT>().numen == type2->cast<ScalarT>().numen) {
                    enums1 = type1->cast<ScalarT>().enums;
                    enums2 = type2->cast<ScalarT>().enums;
                    while ((enums1 != NULL) and (enums2 != NULL)) {
                        if (enums1->id != enums2->id)
                            break; // exit chain;
                        enums1 = enums1->list();
                        enums2 = enums2->list();
                    };
                    if ((enums1 == NULL) and (enums2 == NULL))
                        goto L1;
                }
            } break;
            case kindRange: {
                RangeT & r1 = type1->cast<RangeT>();
                RangeT & r2 = type2->cast<RangeT>();
                baseMatch = (r1.base == r2.base);
                typ120z = r1.base;
                rangeMismatch = (r1.left != r2.left) or (r1.right != r2.right);
                ret = baseMatch;
                return;
            } break;
            case kindPtr: {
                if ((type1 == pointerType) or (type2 == pointerType))
                    goto L1;
                basetyp1 = type1->cast<PtrT>().pbase;
                basetyp2 = type2->cast<PtrT>().pbase;
                if (chain != NULL) {
                    link = chain;
                    while (link != NULL) {
                        if (((link->type1 == basetyp1) and
                             (link->type2 == basetyp2)) or
                            ((link->type2 == basetyp1) and
                             (link->type1 == basetyp2)))
                            goto L1;
                        link = link->next;
                    }
                    allocWithTypeCheck();
                } else {
                    setup(type1);
                    allocWithTypeCheck();
                    chain = NULL;
                    rollup(type1);
                    return;
                }
            }; break;
            case kindSet:
                goto L1;
            case kindArray: {
                ArrayT & a1 = type1->cast<ArrayT>();
                ArrayT & a2 = type2->cast<ArrayT>();
                span1 = a1.range->right - a1.range->left;
                span2 = a2.range->right - a2.range->left;
                if (typeCheck(a1.base, a2.base) and
                    (span1 == span2) and
                    (a1.pck == a2.pck) and
                    not rangeMismatch) {
                    if (a1.pck) {
                        if (a1.pcksize == a2.pcksize)
                            goto L1;
                    } else
                        goto L1;
                }
            } break;
            case kindFile: {
                if (typeCheck(type1->cast<FileT>().fbase, type2->cast<FileT>().fbase))
                    goto L1;
            } break;
            case kindRecord: {
                if (checkRecord(type1->cast<RecordT>().fields, type2->cast<RecordT>().fields))
                    goto L1;
            } break;
            case kindCases:
                break; // not checked
            } /* case */
        } else {
            if (kind1 == kindRange) {
                    rangeMismatch = true;
                    typ120z = type2;
                    if (type1->cast<RangeT>().base == type2)
                        goto L1;
                } else if ((kind2 == kindRange) and
                           (type1 == type2->cast<RangeT>().base))
                goto L1;
        }
        ret = false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rsi
movq %rdi, (%rsi)
leaq 0xb4fdd(%rip), %rdi     # 0xbd3b0
callq 0x1aedc
movb $0x0, 0x5c5a9(%rip)     # 0x64988
movl 0x10(%r15), %eax
movq %r15, %rcx
cmpl $0x2, %eax
jne 0x83ef
movq 0x18(%r15), %rcx
movq %rcx, 0x5c5d2(%rip)     # 0x649c8
cmpq %r14, %r15
je 0x86f1
cmpb $0x0, 0x5c57c(%rip)     # 0x64982
je 0x86f1
movl %eax, 0x4(%rbx)
movl 0x10(%r14), %ecx
movl %ecx, 0x8(%rbx)
cmpl %ecx, %eax
jne 0x8482
leal -0x1(%rax), %edx
cmpl $0x6, %edx
ja 0x86b9
leaq 0x1404b(%rip), %rsi     # 0x1c478
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
cmpl $0x1, %ecx
jne 0x874d
movq 0x20(%r15), %rax
cmpq 0x20(%r14), %rax
jne 0x86b9
movq 0x18(%r15), %rcx
movq %rcx, 0x28(%rbx)
movq 0x18(%r14), %rax
movq %rax, 0x30(%rbx)
testq %rcx, %rcx
sete %dl
testq %rax, %rax
sete %sil
orb %dl, %sil
je 0x84bc
testq %rax, %rax
sete %al
testb %al, %dl
je 0x86b9
jmp 0x86f1
cmpl $0x2, %eax
jne 0x84a4
movb $0x1, 0x5c4fa(%rip)     # 0x64988
movq %r14, 0x5c533(%rip)     # 0x649c8
cmpq %r14, 0x18(%r15)
jne 0x86b9
jmp 0x86f1
cmpl $0x2, %ecx
jne 0x86b9
cmpq %r15, 0x18(%r14)
jne 0x86b9
jmp 0x86f1
movq (%rcx), %rsi
cmpq (%rax), %rsi
jne 0x846f
cmpl $0x0, 0x20(%rcx)
je 0x8700
movq 0x28(%rcx), %rcx
movq %rcx, 0x28(%rbx)
cmpl $0x0, 0x20(%rax)
je 0x8700
movq 0x28(%rax), %rax
movq %rax, 0x30(%rbx)
testq %rcx, %rcx
sete %dl
je 0x846f
testq %rax, %rax
jne 0x84bc
jmp 0x846f
cmpl $0x5, %ecx
jne 0x8736
movq 0x20(%r15), %rax
movq 0x30(%rax), %rcx
subq 0x28(%rax), %rcx
movq %rcx, 0x38(%rbx)
movq 0x20(%r14), %rax
movq 0x30(%rax), %rcx
subq 0x28(%rax), %rcx
movq %rcx, 0x40(%rbx)
movq 0x18(%r15), %rsi
movq 0x18(%r14), %rdx
movq %rsp, %r12
movq %r12, %rdi
callq 0x83b2
cmpb $0x1, (%r12)
jne 0x86b1
movq 0x38(%rbx), %rax
cmpq 0x40(%rbx), %rax
jne 0x86b1
movb 0x28(%r15), %al
cmpb 0x28(%r14), %al
jne 0x86b1
addq $-0x8, 0xb4e4f(%rip)    # 0xbd3b8
cmpb $0x0, 0x5c418(%rip)     # 0x64988
jne 0x86b9
testb %al, %al
je 0x86f1
movq 0x38(%r15), %rax
cmpq 0x38(%r14), %rax
jne 0x86b9
jmp 0x86f1
cmpl $0x2, %eax
jne 0x871f
cmpl $0x2, %ecx
jne 0x871f
movq 0x18(%r15), %rax
movq 0x18(%r14), %rcx
cmpq %rcx, %rax
sete 0x1(%rbx)
movq %rax, 0x5c40f(%rip)     # 0x649c8
movq 0x28(%r15), %rdx
xorq 0x28(%r14), %rdx
movq 0x30(%r14), %rsi
xorq 0x30(%r15), %rsi
orq %rdx, %rsi
setne 0x5c3b5(%rip)           # 0x64988
cmpq %rcx, %rax
sete (%rbx)
jmp 0x86f4
movq 0x5c3f3(%rip), %rdx     # 0x649d8
cmpq %r15, %rdx
sete %sil
cmpq %r14, %rdx
sete %dl
orb %sil, %dl
jne 0x86f1
cmpl $0x3, %eax
jne 0x8792
movq 0x18(%r15), %rax
movq %rax, 0x18(%rbx)
cmpl $0x3, %ecx
jne 0x8792
movq 0x18(%r14), %rdx
movq %rdx, 0x20(%rbx)
movq 0x5c40c(%rip), %rcx     # 0x64a30
testq %rcx, %rcx
je 0x86be
movq 0x8(%rcx), %rsi
cmpq %rax, %rsi
jne 0x8640
cmpq %rdx, 0x10(%rcx)
je 0x86ed
movq 0x10(%rcx), %rdi
xorq %rax, %rdi
xorq %rdx, %rsi
orq %rdi, %rsi
je 0x86ed
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x862d
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1599e
jmp 0x86b9
cmpl $0x6, %ecx
jne 0x8764
movq 0x20(%r15), %rdi
movq 0x20(%r14), %rsi
callq 0x8310
testb %al, %al
je 0x86b9
jmp 0x86f1
cmpl $0x7, %ecx
jne 0x877b
movq 0x18(%r15), %rsi
movq 0x18(%r14), %rdx
movq %rsp, %r14
movq %r14, %rdi
callq 0x83b2
addq $-0x8, 0xb4d0f(%rip)    # 0xbd3b8
cmpb $0x0, (%r14)
je 0x86b9
jmp 0x86f1
addq $-0x8, 0xb4cff(%rip)    # 0xbd3b8
movb $0x0, (%rbx)
jmp 0x86f4
movq 0x1bbbb(%rip), %rax     # 0x24280
leaq 0x1c104(%rip), %rcx     # 0x247d0
leaq (%rcx,%rax,8), %r14
movq %rbx, %rdi
callq 0x1599e
movq $0x0, 0x5c34d(%rip) # 0x64a30
movq %r14, %rdi
callq 0x3d3a
jmp 0x86f4
movq %rcx, 0x10(%rbx)
movb $0x1, (%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x14ed3(%rip), %rdi     # 0x1d5da
leaq 0x14ea6(%rip), %rsi     # 0x1d5b4
leaq 0x14fd8(%rip), %rcx     # 0x1d6ed
movl $0x2d5, %edx            # imm = 0x2D5
callq 0x3170
leaq 0x15122(%rip), %rdi     # 0x1d848
leaq 0x14e87(%rip), %rsi     # 0x1d5b4
leaq 0x1522b(%rip), %rcx     # 0x1d95f
jmp 0x87a7
leaq 0x1510b(%rip), %rdi     # 0x1d848
leaq 0x14e70(%rip), %rsi     # 0x1d5b4
leaq 0x151d7(%rip), %rcx     # 0x1d922
jmp 0x87a7
leaq 0x150f4(%rip), %rdi     # 0x1d848
leaq 0x14e59(%rip), %rsi     # 0x1d5b4
leaq 0x1521b(%rip), %rcx     # 0x1d97d
jmp 0x87a7
leaq 0x150dd(%rip), %rdi     # 0x1d848
leaq 0x14e42(%rip), %rsi     # 0x1d5b4
leaq 0x151c7(%rip), %rcx     # 0x1d940
jmp 0x87a7
leaq 0x150c6(%rip), %rdi     # 0x1d848
leaq 0x14e2b(%rip), %rsi     # 0x1d5b4
leaq 0x15228(%rip), %rcx     # 0x1d9b8
jmp 0x87a7
leaq 0x150af(%rip), %rdi     # 0x1d848
leaq 0x14e14(%rip), %rsi     # 0x1d5b4
leaq 0x151f5(%rip), %rcx     # 0x1d99c
movl $0x1f7, %edx            # imm = 0x1F7
callq 0x3170