// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: combine_ops
static int32_t combine_ops(s7_scheme *sc, s7_pointer func, s7_pointer expr, combine_op_t cop, s7_pointer e1, s7_pointer e2) /* sc needed for debugger stuff */
                {
                    int32_t arg_op;
                    s7_pointer arg;

                    switch (cop)
                    {
                        case E_C_P:
                            arg_op = op_no_hop(e1);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_S:      return(OP_SAFE_C_opSq);
                                case OP_SAFE_C_D:      return(OP_SAFE_C_opDq);
                                case OP_SAFE_C_SS:     return(OP_SAFE_C_opSSq);
                                case OP_SAFE_C_SC:     return(OP_SAFE_C_opSCq);
                                case OP_SAFE_C_CS:     return(OP_SAFE_C_opCSq);
                                case OP_SAFE_C_opSq:   return(OP_SAFE_C_op_opSq_q);
                                case OP_SAFE_C_S_opSq: return(OP_SAFE_C_op_S_opSq_q);
                                case OP_SAFE_C_opSq_S: return(OP_SAFE_C_op_opSq_S_q);
                                case OP_SAFE_C_A:      return(OP_SAFE_C_opAq);
                                case OP_SAFE_C_AA:     return(OP_SAFE_C_opAAq);
                                case OP_SAFE_C_AAA:    return(OP_SAFE_C_opAAAq);
                                                       /* deeper opA...q nestings are rare */
                            }
                            return(OP_SAFE_C_P); /* this splits out to A in optimize_func one_arg */

                        case E_C_SP:
                            arg = e2;
                            arg_op = op_no_hop(arg);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_S:
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    return(OP_SAFE_C_S_opSq);

                                case OP_SAFE_C_D:
                                    set_opt1_pair(cdr(expr), cdr(arg));
                                    return(OP_SAFE_C_S_opDq);

                                case OP_SAFE_C_SC:
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    set_opt2_con(cdr(expr), caddr(arg));
                                    return(OP_SAFE_C_S_opSCq);

                                case OP_SAFE_C_CS:	  /* expr is (* a (- 1 b)), e2 is (- 1 b) */
                                    /* set_opt1_con(cdr(expr), cadr(arg)); */
                                    set_opt2_sym(cdr(expr), caddr(arg));
                                    return(OP_SAFE_C_S_opCSq);

                                case OP_SAFE_C_SS:	  /* (* a (- b c)) */
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    set_opt2_sym(cdr(expr), caddr(arg));
                                    return(OP_SAFE_C_S_opSSq);

                                case OP_SAFE_C_opSq_C:      return(OP_SAFE_C_S_op_opSq_Cq);
                                case OP_SAFE_C_S_opSSq:	    return(OP_SAFE_C_S_op_S_opSSqq);
                                case OP_SAFE_C_S_opSq:	    return(OP_SAFE_C_S_op_S_opSqq);
                                case OP_SAFE_C_opSSq_opSSq: return(OP_SAFE_C_S_op_opSSq_opSSqq);
                                case OP_SAFE_C_A:	    return(OP_SAFE_C_S_opAq);
                                case OP_SAFE_C_AA:	    return(OP_SAFE_C_S_opAAq);
                                case OP_SAFE_C_AAA:  	    return(OP_SAFE_C_S_opAAAq);
                            }
                            return(OP_SAFE_C_SP); /* if fxable -> AA later */

                        case E_C_PS:
                            arg = e1;
                            arg_op = op_no_hop(arg);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_S:     return(OP_SAFE_C_opSq_S);
                                case OP_SAFE_C_SS:    return(OP_SAFE_C_opSSq_S);
                                case OP_SAFE_C_D:     return(OP_SAFE_C_opDq_S);
                                case OP_SAFE_C_CS:    return(OP_SAFE_C_opCSq_S);
                                case OP_SAFE_C_A:     return(OP_SAFE_C_opAq_S);
                                case OP_SAFE_C_opSSq:
                                                      set_opt1_pair(cdr(expr), cadadr(expr));
                                                      return(OP_SAFE_C_op_opSSq_q_S);
                                case OP_SAFE_C_opSSq_S:
                                                      set_opt3_pair(expr, cadadr(expr));
                                                      return(OP_SAFE_C_op_opSSq_Sq_S);
                            }
                            return(OP_SAFE_C_PS);

                        case E_C_PC:
                            arg = e1;
                            arg_op = op_no_hop(arg);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_S:
                                    set_opt1_con(cdr(expr), (is_quoted_pair(cadr(e1))) ? cadadr(e1) : cadr(e1));
                                    set_opt2_con(cdr(expr), e2);
                                    return(OP_SAFE_C_opSq_C);
                                case OP_SAFE_C_CS:    return(OP_SAFE_C_opCSq_C);
                                case OP_SAFE_C_SC:    return(OP_SAFE_C_opSCq_C);
                                case OP_SAFE_C_opSq:  return(OP_SAFE_C_op_opSq_q_C);
                                case OP_SAFE_C_opSSq: return(OP_SAFE_C_op_opSSq_q_C);
                                case OP_SAFE_C_SS:    return(OP_SAFE_C_opSSq_C);
                            }
                            set_opt2_con(cdr(expr), caddr(expr));
                            return(OP_SAFE_C_PC);

                        case E_C_CP:
                            arg = e2;
                            arg_op = op_no_hop(arg);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_D:
                                    set_opt1_pair(cdr(expr), cdr(arg));
                                    return(OP_SAFE_C_C_opDq);

                                case OP_SAFE_C_S:
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    return(OP_SAFE_C_C_opSq);

                                case OP_SAFE_C_CS:
                                    /* set_opt1_con(cdr(expr), cadr(arg)); */
                                    set_opt2_sym(cdr(expr), caddr(arg));
                                    return(OP_SAFE_C_C_opCSq);

                                case OP_SAFE_C_SC:
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    set_opt2_con(cdr(expr), caddr(arg));
                                    return(OP_SAFE_C_C_opSCq);

                                case OP_SAFE_C_SS:
                                    set_opt1_sym(cdr(expr), cadr(arg));
                                    if ((is_real(e1)) &&
                                            (symbol_id(car(arg)) == 0) &&
                                            (s7_d_pd_function(slot_value(global_slot(car(arg))))))
                                    {
                                        s7_p_dd_t fp;
                                        fp = s7_p_dd_function(func);
                                        if (fp)
                                        {
                                            /* direct_c_c_opssq calls number_to_real on e1 */
                                            set_opt3_direct(cddr(expr), s7_d_pd_function(slot_value(global_slot(car(arg)))));
                                            set_opt2_direct(cdr(expr), fp);
                                            set_direct_opt(expr);
                                        }
                                    }
                                    return(OP_SAFE_C_C_opSSq);
                            }
                            return(OP_SAFE_C_CP);

                        case E_C_PP:
                            arg = e2;
                            arg_op = op_no_hop(arg);
                            switch (arg_op)
                            {
                                case OP_SAFE_C_S:
                                    if (is_safe_c_s(e1))
                                    {
                                        s7_p_dd_t fp;
                                        fp = s7_p_dd_function(func);
                                        if (fp)
                                        {
                                            if ((symbol_id(car(e1)) == 0) && (s7_d_p_function(slot_value(global_slot(car(e1))))) &&
                                                    (symbol_id(car(e2)) == 0) && (s7_d_p_function(slot_value(global_slot(car(e2))))))
                                            {
                                                set_opt3_direct(cdr(expr), s7_d_p_function(slot_value(global_slot(car(e1)))));
                                                set_opt3_direct(cddr(expr), s7_d_p_function(slot_value(global_slot(car(e2)))));
                                                set_opt2_direct(cdr(expr), fp);
                                                set_direct_opt(expr);
                                            }
                                        }
                                        return(OP_SAFE_C_opSq_opSq);
                                    }
                                    if (optimize_op_match(e1, OP_SAFE_C_SS))
                                        return(OP_SAFE_C_opSSq_opSq);
                                    break;

                                case OP_SAFE_C_SS:
                                    if (optimize_op_match(e1, OP_SAFE_C_SS))
                                        return(OP_SAFE_C_opSSq_opSSq);
                                    if (is_safe_c_s(e1))
                                        return(OP_SAFE_C_opSq_opSSq);
                                    break;
                            }
                            return(OP_SAFE_C_PP);

                        default:
                            break;
                    }
                    /* fprintf(stderr, "%s[%d]: unopt %s\n", __func__, __LINE__, DISPLAY(expr)); */
                    return(OP_UNOPT);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, %r15
movq %r8, %r12
movq %rdx, %r14
movq %rsi, %r13
movl %ecx, %eax
leaq 0x28688(%rip), %rcx     # 0x111adc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x4(%r12), %eax
andl $-0x2, %eax
cmpl $0x1f, %eax
jle 0xe96ce
cmpl $0x6b, %eax
jg 0xe9773
cmpl $0x20, %eax
je 0xe99d4
cmpl $0x28, %eax
je 0xe99c0
cmpl $0x30, %eax
jne 0xe9a99
movl $0x68, %ebx
jmp 0xe9a9e
movzwl 0x4(%r12), %eax
andl $-0x2, %eax
leal -0x4(%rax), %ecx
cmpl $0x6, %ecx
ja 0xe9719
leaq 0x2865f(%rip), %rax     # 0x111b18
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r12), %rax
addq $0x10, %r12
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
jne 0xe94e7
movq 0x8(%rax), %rcx
addq $0x10, %rax
cmpq 0x17b0(%rdi), %rcx
cmoveq %rax, %r12
movq (%r12), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movq 0x10(%r14), %rax
movq %r15, 0x20(%rax)
movl $0x32, %ebx
jmp 0xe9a9e
movzwl 0x4(%r15), %eax
andl $-0x2, %eax
movl $0x156, %ebx            # imm = 0x156
addl $-0x2, %eax
cmpl $0x8, %eax
ja 0xe9a9e
leaq 0x285cb(%rip), %rcx     # 0x111af4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%r15), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movl $0x44, %ebx
jmp 0xe9a9e
movzwl 0x4(%r15), %eax
andl $-0x2, %eax
cmpl $0x31, %eax
jg 0xe96a0
leal -0x2(%rax), %ecx
cmpl $0x8, %ecx
ja 0xe9989
leaq 0x285ec(%rip), %rax     # 0x111b58
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r15), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movl $0x3e, %ebx
jmp 0xe9a9e
movzwl 0x4(%r15), %eax
andl $-0x2, %eax
cmpl $0x6, %eax
je 0xe9735
cmpl $0x4, %eax
jne 0xe9888
movzwl 0x4(%r12), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpw $0x4, %cx
jne 0xe9868
movq %r13, %rdi
callq 0xb5fe0
movl $0x34, %ebx
testq %rax, %rax
je 0xe9a9e
movq %rax, %r13
movq 0x8(%r12), %rax
cmpq $0x0, 0x20(%rax)
jne 0xe9a9e
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x4774d
testq %rax, %rax
je 0xe9a9e
movq %rax, %r12
movq 0x8(%r15), %rax
cmpq $0x0, 0x20(%rax)
jne 0xe9a9e
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x4774d
testq %rax, %rax
je 0xe9a9e
movq 0x10(%r14), %rax
movq %r12, 0x28(%rax)
movq 0x10(%r14), %rax
movq $-0x40001, %r12         # imm = 0xFFFBFFFF
andq %r12, (%rax)
movq 0x8(%r15), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x4774d
movq 0x10(%r14), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x28(%rcx)
movq 0x10(%r14), %rax
movq 0x10(%rax), %rax
andq %r12, (%rax)
movq 0x10(%r14), %rax
movq %r13, 0x20(%rax)
jmp 0xe985e
movzwl 0x4(%r12), %eax
andl $-0x2, %eax
cmpl $0x21, %eax
jg 0xe96f4
addl $-0x2, %eax
cmpl $0x8, %eax
ja 0xe997f
leaq 0x284a7(%rip), %rcx     # 0x111b34
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x46, %ebx
jmp 0xe9a9e
cmpl $0x6b, %eax
jg 0xe9798
cmpl $0x32, %eax
je 0xe9a7d
cmpl $0x36, %eax
je 0xe9a8b
cmpl $0x48, %eax
jne 0xe99e8
movl $0x60, %ebx
jmp 0xe9a9e
addl $-0x2, %eax
cmpl $0x8, %eax
ja 0xe9a99
leaq 0x2849b(%rip), %rcx     # 0x111b7c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1e, %ebx
jmp 0xe9a9e
cmpl $0x22, %eax
je 0xe9934
cmpl $0x4e, %eax
je 0xe9952
cmpl $0x6c, %eax
jne 0xe997f
movl $0x8e, %ebx
jmp 0xe9a9e
cmpl $0x20, %eax
je 0xe9975
cmpl $0x22, %eax
jne 0xe97bd
movl $0x5a, %ebx
jmp 0xe9a9e
cmpw $0x801, (%r12)          # imm = 0x801
jne 0xe9756
movzwl 0x4(%r12), %eax
andl $-0x2, %eax
movl $0x48, %ebx
cmpw $0x6, %ax
je 0xe9a9e
movzwl 0x4(%r12), %eax
andl $-0x2, %eax
movl $0x4c, %ebx
cmpw $0x4, %ax
jne 0xe9888
jmp 0xe9a9e
cmpl $0x6c, %eax
je 0xe99de
cmpl $0x6e, %eax
je 0xe99ca
cmpl $0x74, %eax
jne 0xe9a99
movl $0x8a, %ebx
jmp 0xe9a9e
cmpl $0x6c, %eax
je 0xe9a84
cmpl $0x6e, %eax
je 0xe9a92
cmpl $0x74, %eax
jne 0xe99e8
movl $0x92, %ebx
jmp 0xe9a9e
movq 0x10(%r14), %rax
movq 0x10(%rax), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x20(%rax)
movl $0x15e, %ebx            # imm = 0x15E
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movzbl (%r12), %eax
leaq 0x691bd(%rip), %rcx     # 0x1529b0
movl $0x42, %ebx
cmpb $0x1, (%rax,%rcx)
jne 0xe9a9e
movq 0x8(%r15), %rax
cmpq $0x0, 0x20(%rax)
jne 0xe9a9e
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x476e5
testq %rax, %rax
je 0xe9a9e
movq %rax, %r15
movq %r13, %rdi
callq 0xb5fe0
testq %rax, %rax
je 0xe9a9e
movq 0x10(%r14), %rcx
movq 0x10(%rcx), %rcx
movq %r15, 0x28(%rcx)
movq 0x10(%r14), %rcx
movq 0x10(%rcx), %rcx
andq $-0x40001, (%rcx)       # imm = 0xFFFBFFFF
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
orb $0x8, 0x3(%r14)
jmp 0xe9a9e
andl $0xfffe, %eax           # imm = 0xFFFE
cmpw $0x6, %ax
jne 0xe9888
movl $0x4a, %ebx
movzwl (%r12), %eax
cmpl $0x801, %eax            # imm = 0x801
je 0xe9a9e
movl $0x150, %ebx            # imm = 0x150
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movl $0x38, %ebx
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
movl $0x2a, %ebx
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
movl $0x3a, %ebx
jmp 0xe9a9e
movl $0x3c, %ebx
jmp 0xe9a9e
movl $0x40, %ebx
jmp 0xe9a9e
movl $0x52, %ebx
jmp 0xe9a9e
movl $0x4e, %ebx
jmp 0xe9a9e
movl $0x50, %ebx
jmp 0xe9a9e
movl $0x30, %ebx
jmp 0xe9a9e
movq 0x10(%r14), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl $0x5e, %ebx
jmp 0xe9a9e
movq 0x10(%r14), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%r14)
andb $-0x5, 0x2(%r14)
movl $0x62, %ebx
jmp 0xe9a9e
movl $0x5c, %ebx
jmp 0xe9a9e
movl $0x15c, %ebx            # imm = 0x15C
jmp 0xe9a9e
cmpl $0x28, %eax
jne 0xe99e8
movl $0x58, %ebx
jmp 0xe9a9e
movl $0x26, %ebx
jmp 0xe9a9e
movl $0x24, %ebx
jmp 0xe9a9e
movl $0x22, %ebx
jmp 0xe9a9e
movl $0x20, %ebx
jmp 0xe9a9e
movl $0x66, %ebx
jmp 0xe9a9e
movl $0x88, %ebx
jmp 0xe9a9e
movl $0x64, %ebx
jmp 0xe9a9e
movl $0x86, %ebx
jmp 0xe9a9e
movl $0x154, %ebx            # imm = 0x154
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
movl $0x2e, %ebx
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
movl $0x2c, %ebx
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movl $0x28, %ebx
jmp 0xe9a9e
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x18(%rcx)
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx)
movl $0x36, %ebx
jmp 0xe9a9e
movl $0x54, %ebx
jmp 0xe9a9e
movl $0x8c, %ebx
jmp 0xe9a9e
movl $0x56, %ebx
jmp 0xe9a9e
movl $0x90, %ebx
jmp 0xe9a9e
movl $0x9c, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq