// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: scheme_strcmp
static int32_t scheme_strcmp(s7_pointer s1, s7_pointer s2)
    {
        /* tricky here because str[i] must be treated as unsigned: (string<? (string (integer->char #xf0)) (string (integer->char #x70)))
         *   and null or lack thereof does not say anything about the string end
         */
        size_t i, len, len1, len2;
        char *str1, *str2;

        len1 = (size_t)string_length(s1);
        len2 = (size_t)string_length(s2);
        if (len1 > len2)
            len = len2;
        else len = len1;

        str1 = string_value(s1);
        str2 = string_value(s2);

        if (len < sizeof(size_t))
        {
            for (i = 0; i < len; i++)
            {
                if ((uint8_t)(str1[i]) < (uint8_t )(str2[i]))
                    return(-1);
                if ((uint8_t)(str1[i]) > (uint8_t)(str2[i]))
                    return(1);
            }
        }
        else
        {
            /* this algorithm from stackoverflow(?), with various changes (original did not work for large strings, etc) */
            size_t last, pos;
            size_t *ptr1, *ptr2;

            last = len / sizeof(size_t);
            for (ptr1 = (size_t *)str1, ptr2 = (size_t *)str2, i = 0; i < last; i++)
                if (ptr1[i] ^ ptr2[i])
                    break;

            for (pos = i * sizeof(size_t); pos < len; pos++)
            {
                if ((uint8_t)str1[pos] < (uint8_t)str2[pos])
                    return(-1);
                if ((uint8_t)str1[pos] > (uint8_t)str2[pos])
                    return(1);
            }
        }

        if (len1 < len2)
            return(-1);
        if (len1 > len2)
            return(1);
        return(0);
    }

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rsp)
movq -0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rsp)
movq -0x30(%rsp), %rax
cmpq -0x38(%rsp), %rax
jbe 0x1c2f0e
movq -0x38(%rsp), %rax
movq %rax, -0x28(%rsp)
jmp 0x1c2f18
movq -0x30(%rsp), %rax
movq %rax, -0x28(%rsp)
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rsp)
movq -0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rsp)
cmpq $0x8, -0x28(%rsp)
jae 0x1c2fc6
movq $0x0, -0x20(%rsp)
movq -0x20(%rsp), %rax
cmpq -0x28(%rsp), %rax
jae 0x1c2fc1
movq -0x40(%rsp), %rax
movq -0x20(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rsp), %rcx
movq -0x20(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x1c2f82
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c30e9
movq -0x40(%rsp), %rax
movq -0x20(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rsp), %rcx
movq -0x20(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jle 0x1c2faf
movl $0x1, -0x4(%rsp)
jmp 0x1c30e9
jmp 0x1c2fb1
movq -0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rsp)
jmp 0x1c2f49
jmp 0x1c30b5
movq -0x28(%rsp), %rax
shrq $0x3, %rax
movq %rax, -0x50(%rsp)
movq -0x40(%rsp), %rax
movq %rax, -0x60(%rsp)
movq -0x48(%rsp), %rax
movq %rax, -0x68(%rsp)
movq $0x0, -0x20(%rsp)
movq -0x20(%rsp), %rax
cmpq -0x50(%rsp), %rax
jae 0x1c3033
movq -0x60(%rsp), %rax
movq -0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x68(%rsp), %rcx
movq -0x20(%rsp), %rdx
xorq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x1c3021
jmp 0x1c3033
jmp 0x1c3023
movq -0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rsp)
jmp 0x1c2ff1
movq -0x20(%rsp), %rax
shlq $0x3, %rax
movq %rax, -0x58(%rsp)
movq -0x58(%rsp), %rax
cmpq -0x28(%rsp), %rax
jae 0x1c30b3
movq -0x40(%rsp), %rax
movq -0x58(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rsp), %rcx
movq -0x58(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x1c3077
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c30e9
movq -0x40(%rsp), %rax
movq -0x58(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rsp), %rcx
movq -0x58(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jle 0x1c30a1
movl $0x1, -0x4(%rsp)
jmp 0x1c30e9
jmp 0x1c30a3
movq -0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rsp)
jmp 0x1c3041
jmp 0x1c30b5
movq -0x30(%rsp), %rax
cmpq -0x38(%rsp), %rax
jae 0x1c30cb
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c30e9
movq -0x30(%rsp), %rax
cmpq -0x38(%rsp), %rax
jbe 0x1c30e1
movl $0x1, -0x4(%rsp)
jmp 0x1c30e9
movl $0x0, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nop