// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_quasiquote_1
static s7_pointer g_quasiquote_1(s7_scheme *sc, s7_pointer form, bool check_cycles)
                {
#define H_quasiquote "(quasiquote arg) is the same as `arg.  If arg is a list, it can contain \
                    comma (\"unquote\") and comma-atsign (\"apply values\") to pre-evaluate portions of the list. \
                    unquoted expressions are evaluated and plugged into the list, apply-values evaluates the expression \
                    and splices the resultant list into the outer list. `(1 ,(+ 1 1) ,@(list 3 4)) -> (1 2 3 4)."

                    if (!is_pair(form))
                    {
                        if (is_normal_symbol(form))
                            return(list_2(sc, sc->quote_symbol, form));
                        /* things that evaluate to themselves don't need to be quoted. */
                        return(form);
                    }

                    if (car(form) == sc->unquote_symbol)
                    {
                        if (!is_pair(cdr(form)))             /* (unquote) or (unquote . 1) */
                        {
                            if (is_null(cdr(form)))
                                eval_error(sc, "unquote: no argument, ~S", 24, form);
                            else eval_error(sc, "unquote: stray dot, ~S", 22, form);
                        }
                        if (is_not_null(cddr(form)))
                            eval_error(sc, "unquote: too many arguments, ~S", 31, form);
                        return(cadr(form));
                    }

                    /* it's a list, so return the list with each element handled as above.
                     *    we try to support dotted lists which makes the code much messier.
                     * if no element of the list is a list or unquote, just return the original quoted
                     */
                    if (((check_cycles) && (tree_is_cyclic(sc, form))) ||
                            (is_simple_code(sc, form)))
                        return(list_2(sc, sc->quote_symbol, form));

                    {
                        s7_int len, i;
                        s7_pointer orig, bq, old_scw;
                        bool dotted = false;

                        len = s7_list_length(sc, form);
                        if (len < 0)
                        {
                            len = -len;
                            dotted = true;
                        }
                        old_scw = sc->w;
                        push_stack_no_let_no_code(sc, OP_GC_PROTECT, sc->w);

                        sc->w = sc->nil;
                        for (i = 0; i <= len; i++)
                            sc->w = cons(sc, sc->nil, sc->w);

                        set_car(sc->w, sc->list_values_symbol);
                        if (!dotted)
                        {
                            for (orig = form, bq = cdr(sc->w), i = 0; i < len; i++, orig = cdr(orig), bq = cdr(bq))
                            {
                                if ((is_pair(cdr(orig))) &&             /* this was is_pair(orig) which seems to be always the case */
                                        (cadr(orig) == sc->unquote_symbol)) /* `(1 . ,(+ 1 1)) -> '(1 unquote (+ 1 1)) -> '(1 . 2) etc */
                                {
                                    if (!is_pair(cddr(orig)))
                                    {
                                        sc->w = old_scw;
                                        unstack(sc);
                                        eval_error(sc, "unquote: no argument, ~S", 24, form);
                                    }
                                    set_car(bq, g_quasiquote_1(sc, car(orig), false));
                                    set_cdr(bq, sc->nil);
                                    sc->w = list_3(sc, sc->append_symbol, sc->w, caddr(orig));
                                    break;
                                }
                                else set_car(bq, g_quasiquote_1(sc, car(orig), false));
                            }
                        }
                        else
                        {
                            /* `(1 2 . 3) */
                            len--;
                            for (orig = form, bq = cdr(sc->w), i = 0; i < len; i++, orig = cdr(orig), bq = cdr(bq))
                                set_car(bq, g_quasiquote_1(sc, car(orig), false));
                            set_car(bq, g_quasiquote_1(sc, car(orig), false));

                            sc->w = list_3(sc, sc->append_symbol, sc->w, g_quasiquote_1(sc, cdr(orig), false));
                            /* quasiquote might quote a symbol in cdr(orig), so it's not completely pointless */
                        }
                        bq = sc->w;
                        sc->w = old_scw;
                        unstack(sc);
                        return(bq);
                    }
                }

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movb %dl, %al
movq %rdi, 0x1a8(%rsp)
movq %rsi, 0x1a0(%rsp)
andb $0x1, %al
movb %al, 0x19f(%rsp)
movq 0x1a0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x1993be
movq 0x1a0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x1993a9
movq 0x1a0(%rsp), %rax
movzwl 0x6(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x1993a9
movq 0x1a8(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x17b0(%rax), %rax
movq %rax, 0xc0(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x180(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x19930f
movq 0x1a8(%rsp), %rdi
callq 0xc670
movq 0x1a8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x190(%rsp)
movq 0x190(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0xc0(%rsp), %rsi
movq 0xb8(%rsp), %rdi
movq 0x188(%rsp), %rcx
movq 0x190(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x180(%rsp), %rcx
movq 0x190(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x190(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x178(%rsp), %rdx
callq 0xd9f0
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a0(%rsp), %rax
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a0(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x17b8(%rcx), %rax
jne 0x1995f5
movq 0x1a0(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x199532
movq 0x1a0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x1994a5
movq 0x1a8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x1a8(%rsp), %rdi
leaq 0x58209(%rip), %rsi     # 0x1f1667
movl $0x18, %edx
callq 0xb880
movq 0xa0(%rsp), %rdi
movq %rax, %rsi
movq 0x1a0(%rsp), %rdx
callq 0xb830
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a8(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x1a8(%rsp), %rdi
leaq 0x58195(%rip), %rsi     # 0x1f1680
movl $0x16, %edx
callq 0xb880
movq 0x88(%rsp), %rdi
movq %rax, %rsi
movq 0x1a0(%rsp), %rdx
callq 0xb830
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x1995d8
movq 0x1a8(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x1a8(%rsp), %rdi
leaq 0x58100(%rip), %rsi     # 0x1f1697
movl $0x1f, %edx
callq 0xb880
movq 0x70(%rsp), %rdi
movq %rax, %rsi
movq 0x1a0(%rsp), %rdx
callq 0xb830
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
testb $0x1, 0x19f(%rsp)
je 0x199618
movq 0x1a8(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x2f870
testb $0x1, %al
jne 0x199636
movq 0x1a8(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x199f50
testb $0x1, %al
jne 0x199636
jmp 0x19973f
movq 0x1a8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x17b0(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x160(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x1996ab
movq 0x1a8(%rsp), %rdi
callq 0xc670
movq 0x1a8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdi
movq 0x168(%rsp), %rcx
movq 0x170(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x160(%rsp), %rcx
movq 0x170(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x170(%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rdx
callq 0xd9f0
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movb $0x0, 0x12f(%rsp)
movq 0x1a8(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x31900
movq %rax, 0x150(%rsp)
cmpq $0x0, 0x150(%rsp)
jge 0x199789
xorl %eax, %eax
subq 0x150(%rsp), %rax
movq %rax, 0x150(%rsp)
movb $0x1, 0x12f(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x130(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rcx
movq 0x1a8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x1a8(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1, %ecx
movq %rcx, 0x18(%rax)
movq 0x1a8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq $0x0, 0x148(%rsp)
movq 0x148(%rsp), %rax
cmpq 0x150(%rsp), %rax
jg 0x199923
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x118(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x110(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x199883
movq 0x1a8(%rsp), %rdi
callq 0xc670
movq 0x1a8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x118(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x110(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x120(%rsp), %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x148(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x148(%rsp)
jmp 0x199812
movq 0x1a8(%rsp), %rax
movq 0x1278(%rax), %rcx
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rcx, 0x8(%rax)
testb $0x1, 0x12f(%rsp)
jne 0x199ca5
movq 0x1a0(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x138(%rsp)
movq $0x0, 0x148(%rsp)
movq 0x148(%rsp), %rax
cmpq 0x150(%rsp), %rax
jge 0x199ca0
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x199c33
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x17b8(%rcx), %rax
jne 0x199c33
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x199a9f
movq 0x130(%rsp), %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $-0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x1a8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x1a8(%rsp), %rdi
leaq 0x57c06(%rip), %rsi     # 0x1f1667
movl $0x18, %edx
callq 0xb880
movq 0x48(%rsp), %rdi
movq %rax, %rsi
movq 0x1a0(%rsp), %rdx
callq 0xb830
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0x1b0(%rsp)
jmp 0x199f3a
movq 0x1a8(%rsp), %rdi
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x199230
movq %rax, %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x1a8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x1a8(%rsp), %rax
movq 0xbb8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0xf8(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0xf0(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x199b86
movq 0x1a8(%rsp), %rdi
callq 0xc670
movq 0x1a8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdi
movq 0xf8(%rsp), %rcx
movq 0x100(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0xf0(%rsp), %rcx
movq 0x100(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x100(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rdx
callq 0xd9f0
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rdx
callq 0xd9f0
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
jmp 0x199ca0
movq 0x1a8(%rsp), %rdi
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x199230
movq %rax, %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x199c5f
movq 0x148(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x148(%rsp)
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x140(%rsp)
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x138(%rsp)
jmp 0x19998a
jmp 0x199ee8
movq 0x150(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x150(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x138(%rsp)
movq $0x0, 0x148(%rsp)
movq 0x148(%rsp), %rax
cmpq 0x150(%rsp), %rax
jge 0x199d6a
movq 0x1a8(%rsp), %rdi
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x199230
movq %rax, %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x148(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x148(%rsp)
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x140(%rsp)
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x138(%rsp)
jmp 0x199cf0
movq 0x1a8(%rsp), %rdi
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x199230
movq %rax, %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x1a8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x1a8(%rsp), %rax
movq 0xbb8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x1a8(%rsp), %rdi
movq 0x140(%rsp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x199230
movq %rax, 0xd8(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0xd0(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x1a8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x199e3d
movq 0x1a8(%rsp), %rdi
callq 0xc670
movq 0x1a8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq 0xd8(%rsp), %rcx
movq 0xe0(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0xd0(%rsp), %rcx
movq 0xe0(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0xe0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rdx
callq 0xd9f0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0xd9f0
movq %rax, %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x138(%rsp)
movq 0x130(%rsp), %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x1a8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $-0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x138(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rax
addq $0x1b8, %rsp            # imm = 0x1B8
retq
nopw (%rax,%rax)