// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: format_chooser
static s7_pointer format_chooser(s7_scheme *sc, s7_pointer f, int32_t args, s7_pointer expr, bool ops)
                {
                    if (args > 1)
                    {
                        s7_pointer port, str_arg;
                        port = cadr(expr);
                        str_arg = caddr(expr);
                        if (is_string(str_arg))
                        {
                            if ((ops) && ((args == 2) || (args == 3)))
                            {
                                s7_int len;
                                char *orig;
                                const char *p;

                                orig = string_value(str_arg);
                                p = strchr((const char *)orig, (int)'~');
                                if (!p)
                                {
                                    if (args == 2)
                                        return(sc->format_just_control_string);
                                    return(f);
                                }

                                len = string_length(str_arg);
                                if ((args == 2) &&
                                        (len > 1) &&
                                        (orig[len - 1] == '%') &&
                                        ((p - orig) == len - 2))
                                {
                                    orig[len - 2] = '\n';
                                    orig[len - 1] = '\0';
                                    string_length(str_arg) = len - 1;
                                    return(sc->format_just_control_string);
                                }

                                if ((args == 3) &&
                                        (len == 2) &&
                                        (port == sc->F) &&
                                        (orig[0] == '~') &&
                                        ((orig[1] == 'A') || (orig[1] == 'a')))
                                    return(sc->format_as_objstr);
                            }

                            /* this used to worry about optimized expr and particular cases -- why? I can't find a broken case */
                            if (!is_columnizing(string_value(str_arg)))
                                return(sc->format_allg_no_column);
                        }
                        if (port == sc->F)
                            return(sc->format_f);
                    }
                    return(f);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpl $0x2, %edx
jl 0xcf788
movq %rdi, %rbx
movq 0x10(%rcx), %rax
movq 0x8(%rax), %r12
movq 0x10(%rax), %rax
movq 0x8(%rax), %r13
cmpb $0x13, (%r13)
jne 0xcf776
testb %r8b, %r8b
je 0xcf6a4
movl %edx, %ebp
movl %edx, %eax
andl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
cmpl $0x2, %eax
jne 0xcf6a4
movq 0x10(%r13), %r15
pushq $0x7e
popq %rsi
movq %r15, %rdi
callq 0x81d0
testq %rax, %rax
je 0xcf661
movq 0x8(%r13), %rcx
cmpl $0x2, %ebp
jne 0xcf674
cmpq $0x2, %rcx
jl 0xcf674
cmpb $0x25, -0x1(%r15,%rcx)
jne 0xcf6a4
subq %r15, %rax
leaq -0x2(%rcx), %rdx
cmpq %rdx, %rax
jne 0xcf6a4
decq %rcx
movb $0xa, (%r15,%rax)
movb $0x0, (%r15,%rcx)
movq %rcx, 0x8(%r13)
movl $0x1bc0, %eax           # imm = 0x1BC0
jmp 0xcf784
movl $0x1bc0, %eax           # imm = 0x1BC0
cmpl $0x2, %ebp
je 0xcf784
jmp 0xcf788
cmpl $0x3, %ebp
jne 0xcf6a4
cmpq $0x2, %rcx
jne 0xcf6a4
cmpq 0x120(%rbx), %r12
jne 0xcf6a4
cmpb $0x7e, (%r15)
jne 0xcf6a4
movzbl 0x1(%r15), %ecx
movl $0x1bc8, %eax           # imm = 0x1BC8
orl $0x20, %ecx
cmpl $0x61, %ecx
je 0xcf784
movq 0x10(%r13), %rsi
movl $0x1bb8, %eax           # imm = 0x1BB8
movb (%rsi), %dl
testb %dl, %dl
je 0xcf784
movq %rsi, %rcx
incq %rsi
cmpb $0x7e, %dl
jne 0xcf6ad
movb 0x1(%rcx), %dl
movl %edx, %esi
andb $-0x21, %sil
cmpb $0x54, %sil
je 0xcf776
addq $0x2, %rcx
movzbl %dl, %edi
cmpl $0x2c, %edi
je 0xcf70b
testl %edi, %edi
je 0xcf784
leal -0x30(%rdx), %edi
cmpb $0xa, %dil
setae %dil
cmpb $0x4e, %sil
setne %r8b
movq %rcx, %rsi
testb %r8b, %dil
jne 0xcf6ad
jmp 0xcf70b
movb (%rcx), %dl
incq %rcx
leal -0x30(%rdx), %esi
cmpb $0xa, %sil
setae %dil
movl %edx, %esi
andb $-0x21, %sil
cmpb $0x4e, %sil
setne %r8b
testb %r8b, %dil
je 0xcf706
cmpb $0x54, %sil
je 0xcf776
cmpb $0x2c, %dl
je 0xcf744
movzbl %dl, %edx
movq %rcx, %rsi
testl %edx, %edx
jne 0xcf6ad
jmp 0xcf784
movq %rcx, %rsi
movb (%rsi), %cl
incq %rsi
leal -0x30(%rcx), %edx
cmpb $0xa, %dl
setb %dil
movl %ecx, %edx
andb $-0x21, %dl
cmpb $0x4e, %dl
sete %r8b
orb %dil, %r8b
jne 0xcf747
cmpb $0x54, %dl
je 0xcf776
testb %cl, %cl
jne 0xcf6ad
jmp 0xcf784
cmpq 0x120(%rbx), %r12
jne 0xcf788
movl $0x1bb0, %eax           # imm = 0x1BB0
movq (%rbx,%rax), %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq