// File: /workspace/github_c_makefile_star2_O1/tyabu12[P]pl0compiler/compile.c
// Function: factor
void factor() {                 /* 式の因子のコンパイル                 */
    int tIndex, i;
    /* ishii KeyId k; */
    KindT k;
    if (token.kind == Id) {
        tIndex = searchT(token.u.id, varId);
        setIdKind(k = kindT(tIndex)); /* 印字のための情報のセット       */
        switch (k) {
        case varId: case parId: /* 変数名かパラメタ名                   */
            genCodeT(lod, tIndex);
            token = nextToken(); break;
        case constId:           /* 定数名                               */
            genCodeV(lit, val(tIndex));
            token = nextToken(); break;
        case funcId:            /* 関数呼び出し                         */
            token = nextToken();
            if (token.kind == Lparen){
                i = 0;          /* iは実引数の個数                      */
                token = nextToken();
                if (token.kind != Rparen) {
                    while (1) {
                        expression(); i++; /* 実引数のコンパイル        */
                        if (token.kind == Comma) { /* 次がコンマなら実引数が続く */
                            token = nextToken();
                            continue;
                        }
                        token = checkGet(token, Rparen);
                        break;
                    }
                } else
                    token = nextToken();
                if (pars(tIndex) != i)
                    errorMessage("\\#par"); /* pars(tIndex)は仮引数の個数 */
            } else {
                errorInsert(Lparen);
                errorInsert(Rparen);
            }
            genCodeT(cal, tIndex); /* call命令                          */
            break;
        }
    } else if (token.kind == Num) { /* 定数                             */
        genCodeV(lit, token.u.value);
        token = nextToken();
    } else if (token.kind == Lparen) { /* 「(」「因子」「)」            */
        token = nextToken();
        expression();
        token = checkGet(token, Rparen);
    } else if (token.kind == Read) { /* 標準入力から読み込み */
        genCodeO(rd);
        token = nextToken();
    }
    switch (token.kind) {       /* 因子の後がまた因子ならエラー         */
    case Id:
    case Num:
    case Lparen:
    case Read:
        errorMissingOp();
        factor();
    default:
        return;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movl 0x5bbe(%rip), %eax      # 0x9d68
cmpl $0x1f, %eax
jg 0x4228
cmpl $0xb, %eax
je 0x427b
cmpl $0x13, %eax
jne 0x42c1
leaq 0x2c(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4a16
movl 0x20(%rbx), %eax
movl %eax, 0x5baf(%rip)      # 0x9d88
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x5b91(%rip)     # 0x9d78
movups %xmm0, 0x5b7a(%rip)     # 0x9d68
callq 0x4055
movl 0x5b8f(%rip), %eax      # 0x9d88
movl %eax, 0x20(%rsp)
movups 0x5b74(%rip), %xmm0     # 0x9d78
movups %xmm0, 0x10(%rsp)
movups 0x5b58(%rip), %xmm0     # 0x9d68
movups %xmm0, (%rsp)
leaq 0x2c(%rsp), %rbx
movq %rbx, %rdi
movl $0x14, %esi
callq 0x4cda
jmp 0x42a3
cmpl $0x21, %eax
je 0x4287
cmpl $0x20, %eax
jne 0x42c1
leaq 0x5b2f(%rip), %rdi      # 0x9d6c
xorl %esi, %esi
callq 0x33f5
movl %eax, %ebx
movl %eax, %edi
callq 0x34bb
movl %eax, %ebp
movl %eax, %edi
callq 0x4db2
cmpl $0x3, %ebp
ja 0x42c1
movl %ebp, %eax
leaq 0x113c(%rip), %rcx      # 0x53a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, %edi
movl %ebx, %esi
callq 0x230e
jmp 0x4294
movl $0xc, %edi
callq 0x236e
jmp 0x4294
movl 0x5adf(%rip), %esi      # 0x9d6c
xorl %edi, %edi
callq 0x22c5
leaq 0x2c(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4a16
movl 0x20(%rbx), %eax
movl %eax, 0x5adc(%rip)      # 0x9d88
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x5abe(%rip)     # 0x9d78
movups %xmm0, 0x5aa7(%rip)     # 0x9d68
movl 0x5aa1(%rip), %eax      # 0x9d68
cmpq $0x21, %rax
ja 0x42e9
movabsq $0x300080800, %rcx      # imm = 0x300080800
btq %rax, %rcx
jae 0x42e9
xorl %eax, %eax
callq 0x489f
callq 0x419c
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4a16
movl 0x20(%r14), %eax
movl %eax, 0x5a7d(%rip)      # 0x9d88
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x5a5d(%rip)     # 0x9d78
movups %xmm0, 0x5a46(%rip)     # 0x9d68
cmpl $0x13, 0x5a3f(%rip)     # 0x9d68
jne 0x438a
xorl %ebp, %ebp
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4a16
movl 0x20(%r14), %eax
movl %eax, 0x5a42(%rip)      # 0x9d88
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x5a22(%rip)     # 0x9d78
movups %xmm0, 0x5a0b(%rip)     # 0x9d68
cmpl $0x14, 0x5a04(%rip)     # 0x9d68
jne 0x43a3
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4a16
jmp 0x442a
movl %ebx, %edi
callq 0x34e9
xorl %edi, %edi
movl %eax, %esi
jmp 0x428f
movl $0x13, %edi
callq 0x47c9
movl $0x14, %edi
callq 0x47c9
jmp 0x4462
callq 0x4055
movl $0x1, %ebp
cmpl $0x1b, 0x59b4(%rip)     # 0x9d68
jne 0x43f7
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4a16
movl 0x4c(%rsp), %eax
movl %eax, 0x59b9(%rip)      # 0x9d88
movups 0x2c(%rsp), %xmm0
movups 0x3c(%rsp), %xmm1
movups %xmm1, 0x5998(%rip)     # 0x9d78
movups %xmm0, 0x5981(%rip)     # 0x9d68
callq 0x4055
incl %ebp
cmpl $0x1b, 0x5973(%rip)     # 0x9d68
je 0x43bb
movl 0x598b(%rip), %eax      # 0x9d88
movl %eax, 0x20(%rsp)
movups 0x5970(%rip), %xmm0     # 0x9d78
movups %xmm0, 0x10(%rsp)
movups 0x5954(%rip), %xmm0     # 0x9d68
movups %xmm0, (%rsp)
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
movl $0x14, %esi
callq 0x4cda
movl 0x20(%r14), %eax
movl %eax, 0x5954(%rip)      # 0x9d88
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x5934(%rip)     # 0x9d78
movups %xmm0, 0x591d(%rip)     # 0x9d68
movl %ebx, %edi
callq 0x3500
cmpl %ebp, %eax
je 0x4462
leaq 0xf7a(%rip), %rdi       # 0x53d7
callq 0x4979
movl $0x4, %edi
movl %ebx, %esi
callq 0x230e
jmp 0x42c1