// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_char_position_csi
static s7_pointer g_char_position_csi(s7_scheme *sc, s7_pointer args)
    {
        /* assume char arg1, no end */
        const char *porig, *p;
        char c;
        s7_pointer arg2;
        s7_int start, len;

        c = character(car(args));
        arg2 = cadr(args);

        if (!is_string(arg2))
            return(g_char_position(sc, args));

        len = string_length(arg2); /* can't return #f here if len==0 -- need start error check first */
        porig = string_value(arg2);

        if (is_pair(cddr(args)))
        {
            s7_pointer arg3;
            arg3 = caddr(args);
            if (!s7_is_integer(arg3))
                return(g_char_position(sc, args));
            start = s7_integer(arg3);
            if (start < 0)
                return(wrong_type_argument_with_type(sc, sc->char_position_symbol, 3, arg3, a_non_negative_integer_string));
            if (start >= len) return(sc->F);
        }
        else start = 0;

        if (len == 0) return(sc->F);
        p = strchr((const char *)(porig + start), (int)c);
        if (p)
            return(make_integer(sc, p - porig));
        return(sc->F);
    }

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movb 0x8(%rax), %al
movb %al, 0x8f(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x13, %eax
je 0x1d3ba7
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x8a950
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x1d3d98
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11340
testb $0x1, %al
jne 0x1d3c31
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x8a950
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
movq 0x68(%rsp), %rdi
callq 0x10790
movq %rax, 0x78(%rsp)
cmpq $0x0, 0x78(%rsp)
jge 0x1d3d6e
movq 0xa8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xa8(%rsp), %rax
movq 0xde0(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq $0x3, 0x60(%rsp)
movq 0x60(%rsp), %rax
andq $-0x800, %rax           # imm = 0xF800
cmpq $0x0, %rax
jne 0x1d3ca5
movq 0x60(%rsp), %rcx
leaq 0x427e9(%rip), %rax     # 0x216480
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
jmp 0x1d3d28
jmp 0x1d3ca7
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x1d3cd4
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq $0xb, (%rax)
movq 0x60(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdx
movq 0x68(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq 0x140(%rax), %r8
movq 0x4e9cc(%rip), %r9      # 0x222728
callq 0xc560
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
movq 0x78(%rsp), %rax
cmpq 0x70(%rsp), %rax
jl 0x1d3d96
movq 0xa8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
jmp 0x1d3da1
movq $0x0, 0x78(%rsp)
cmpq $0x0, 0x70(%rsp)
jne 0x1d3dc5
movq 0xa8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
movq 0x98(%rsp), %rdi
addq 0x78(%rsp), %rdi
movsbl 0x8f(%rsp), %esi
callq 0x91d0
movq %rax, 0x90(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x1d3ed5
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
andq $-0x800, %rax           # imm = 0xF800
cmpq $0x0, %rax
jne 0x1d3e39
movq 0x40(%rsp), %rcx
leaq 0x42655(%rip), %rax     # 0x216480
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
jmp 0x1d3ebc
jmp 0x1d3e3b
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x1d3e68
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq $0xb, (%rax)
movq 0x40(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x1d3eec
movq 0xa8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
addq $0xb8, %rsp
retq
nopl (%rax)