// File: /workspace/github_c_makefile_star2_O0/eiselekd[P]MinimalLisp/lf.c
// Function: main
int
main(int argc, char **argv) 
{
    lfctx _cctx; struct lfctx *lfctx = &_cctx; ctx *lctx = (ctx *)&_cctx; 
    fctx *cctx = (fctx*)&_cctx; int c, i, l; FILE *f; char v[32]; struct v *list;
    struct v *fx = 0, *r; char *m = 0; int ml = 0, o;
    memset(&_cctx,0,sizeof(struct lfctx));
    
    atexit(colreset);
    signal(SIGINT, sigint);
    
    /* input */
    cctx->fc = -1;
    for (i = argc-1; i >= 1; i--) {
        l = strlen(argv[i]);
        if (argv[i][l-1] == 'f') {
            if (f = fopen(argv[i],"r")) {
                cctx->f[++cctx->fc] = f;
            }
        } else if (argv[i][l-1] == 'l') {
            FILE *f;
            if (argv[i] && (f = fopen(argv[i],"r"))) {
                o = ml;
                fseek(f, 0, SEEK_END); 
                ml += (l = ftell(f));
                fseek(f, 0, SEEK_SET);
                if (m) {
                    m = (char *)realloc(m,ml+1);
                } else {
                    m = (char *)malloc(ml+1);
                }
                fread(&m[o], 1, l, f);
                m[ml] = 0;
                fclose(f);
            }
        }
    }
    
    lf_init(&_cctx) ;
    
    r = mkCons(g_QUIT, 0);
    cctx->ip = r;
    fx = NEXT(cctx);
    
    FPRINTF(FDBG, "Compile Forth interpreter\n");
    while(fx) {
        fx = fop(fx)(cctx);
    }
    
    lf_remap(&_cctx);
    
    /* scan lisp program */
    if (!m)
        return 0;
    
    list = scan((ctx *)cctx, m);
    
    PUSH(list);
    
    printh ((ctx*)cctx, stdout, list);
    
    if (!(r = find(cctx, unique((ctx *)cctx, "evlist", 6)))) {
        return 0;
    }
    
    cctx->ip = mkCons(cdr(r), mkCons(g_END,0));
    fx = NEXT(cctx);
    EPUSH(lctx->env);
    
    FPRINTF(FDBG, "Execute Forth Lisp interpreter\n");
    /* execute lisp interpreter */
    while(fx) {
        fx = fop(fx)(cctx);
    }
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x198(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x198(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq $0x0, -0x200(%rbp)
movq $0x0, -0x210(%rbp)
movl $0x0, -0x214(%rbp)
leaq -0x198(%rbp), %rdi
xorl %esi, %esi
movl $0x188, %edx            # imm = 0x188
callq 0x2080
leaq -0x9d(%rip), %rdi       # 0x127c0
callq 0x12d40
movl $0x2, %edi
leaq -0xce(%rip), %rsi       # 0x127a0
callq 0x2090
movq -0x1b0(%rbp), %rax
movq $-0x1, 0x90(%rax)
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1b8(%rbp)
cmpl $0x1, -0x1b8(%rbp)
jl 0x12a97
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2050
movl %eax, -0x1bc(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x1bc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x66, %eax
jne 0x12938
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xb81(%rip), %rsi       # 0x13473
callq 0x2140
movq %rax, -0x1c8(%rbp)
cmpq $0x0, %rax
je 0x12933
movq -0x1c8(%rbp), %rdx
movq -0x1b0(%rbp), %rax
movq -0x1b0(%rbp), %rsi
movq 0x90(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x90(%rsi)
movq %rdx, 0x18(%rax,%rcx,8)
jmp 0x12a81
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x1bc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x6c, %eax
jne 0x12a7f
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x12a7d
movq -0x10(%rbp), %rax
movslq -0x1b8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xae7(%rip), %rsi       # 0x13473
callq 0x2140
movq %rax, -0x220(%rbp)
cmpq $0x0, %rax
je 0x12a7d
movl -0x214(%rbp), %eax
movl %eax, -0x218(%rbp)
movq -0x220(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2120
movq -0x220(%rbp), %rdi
callq 0x20b0
movl %eax, -0x1bc(%rbp)
addl -0x214(%rbp), %eax
movl %eax, -0x214(%rbp)
movq -0x220(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x2120
cmpq $0x0, -0x210(%rbp)
je 0x12a1e
movq -0x210(%rbp), %rdi
movl -0x214(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x2130
movq %rax, -0x210(%rbp)
jmp 0x12a36
movl -0x214(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x20e0
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rdi
movslq -0x218(%rbp), %rax
addq %rax, %rdi
movslq -0x1bc(%rbp), %rdx
movq -0x220(%rbp), %rcx
movl $0x1, %esi
callq 0x2030
movq -0x210(%rbp), %rax
movslq -0x214(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x220(%rbp), %rdi
callq 0x2040
jmp 0x12a7f
jmp 0x12a81
jmp 0x12a83
movl -0x1b8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1b8(%rbp)
jmp 0x12891
leaq -0x198(%rbp), %rdi
callq 0x11290
movq 0x4bc6(%rip), %rdi      # 0x17670
xorl %eax, %eax
movl %eax, %esi
callq 0x2380
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x130(%rax)
movq -0x1b0(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x2530
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x1b0(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x2560
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x130(%rax)
movq -0x1b0(%rbp), %rax
movq 0x138(%rax), %rdi
callq 0x2530
movq %rax, -0x200(%rbp)
cmpq $0x0, -0x200(%rbp)
je 0x12b58
movq -0x200(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x1b0(%rbp), %rdi
callq *%rax
movq %rax, -0x200(%rbp)
jmp 0x12b31
leaq -0x198(%rbp), %rdi
callq 0x12610
cmpq $0x0, -0x210(%rbp)
jne 0x12b7a
movl $0x0, -0x4(%rbp)
jmp 0x12d2c
movq -0x1b0(%rbp), %rdi
movq -0x210(%rbp), %rsi
callq 0x4380
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movq 0x120(%rax), %rsi
callq 0x2380
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x120(%rax)
movq -0x1b0(%rbp), %rdi
movq 0x440b(%rip), %rax      # 0x16fd8
movq (%rax), %rsi
movq -0x1f8(%rbp), %rdx
callq 0x2d20
movq -0x1b0(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x1b0(%rbp), %rdi
leaq 0xaf0(%rip), %rsi       # 0x136e8
movl $0x6, %edx
callq 0x3fb0
movq -0x228(%rbp), %rdi
movq %rax, %rsi
callq 0xfdd0
movq %rax, -0x208(%rbp)
cmpq $0x0, %rax
jne 0x12c2a
movl $0x0, -0x4(%rbp)
jmp 0x12d2c
movq -0x208(%rbp), %rdi
callq 0x2560
movq %rax, -0x230(%rbp)
movq 0x497c(%rip), %rdi      # 0x175c0
xorl %eax, %eax
movl %eax, %esi
callq 0x2380
movq -0x230(%rbp), %rdi
movq %rax, %rsi
callq 0x2380
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x130(%rax)
movq -0x1b0(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x2530
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x1b0(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x2560
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x130(%rax)
movq -0x1b0(%rbp), %rax
movq 0x138(%rax), %rdi
callq 0x2530
movq %rax, -0x200(%rbp)
movq -0x1a8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x1a0(%rbp), %rax
movq 0x178(%rax), %rsi
callq 0x2380
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movq %rcx, 0x178(%rax)
cmpq $0x0, -0x200(%rbp)
je 0x12d25
movq -0x200(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x1b0(%rbp), %rdi
callq *%rax
movq %rax, -0x200(%rbp)
jmp 0x12cfe
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax,%rax)