// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: search_load_path
static block_t *search_load_path(s7_scheme *sc, const char *name)
    {
        s7_pointer lst;

        lst = s7_load_path(sc);
        if (is_pair(lst))
        {
            block_t *b;
            char *filename;
            s7_pointer dir_names;
            /* linux: PATH_MAX: 4096, windows: MAX_PATH: unlimited?, Mac: 1016?, BSD: MAX_PATH_LENGTH: 1024 */
#if MS_WINDOWS || defined(__linux__)
#define FILENAME_MAX 4096
#else
#define FILENAME_MAX 1024
#endif
            b = mallocate(sc, FILENAME_MAX);
            filename = (char *)block_data(b);

            for (dir_names = lst; is_pair(dir_names); dir_names = cdr(dir_names))
            {
                const char *new_dir;
                new_dir = string_value(car(dir_names));
                if (new_dir)
                {
                    filename[0] = '\0';
                    if (new_dir[strlen(new_dir) - 1] == '/')
                        catstrs(filename, FILENAME_MAX, new_dir, name, NULL);
                    else catstrs(filename, FILENAME_MAX, new_dir, "/", name, NULL);
                    if (access(filename, F_OK) == 0)
                        return(b);
                }
            }
            liberate(sc, b);
        }
        return(NULL);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r13
movq 0x1280(%rdi), %rsi
callq 0x9a93
cmpb $0x1, (%rax)
jne 0x94e31
movq %rax, %r15
leaq 0x838(%r13), %r12
movq 0x898(%r13), %rbx
testq %rbx, %rbx
movq %r12, (%rsp)
je 0x94ce3
movq 0x18(%rbx), %rax
movq %rax, 0x898(%r13)
movq (%rbx), %r12
jmp 0x94d71
movq (%r12), %rbx
testq %rbx, %rbx
jne 0x94d28
movl $0x2800, %edi           # imm = 0x2800
callq 0x8480
movq %rax, %rbx
movq %rax, (%r12)
addq $0x28, %rax
movl $0xff, %ecx
movq %rax, -0x10(%rax)
movl $0x0, -0x20(%rax)
addq $0x28, %rax
decl %ecx
jne 0x94d06
movq $0x0, -0x10(%rax)
movl $0x0, -0x20(%rax)
movq 0x18(%rbx), %rax
movq %rax, 0x838(%r13)
movq 0x8c8(%r13), %r12
leaq 0x1000(%r12), %rax
cmpq $0x10000, %rax          # imm = 0x10000
jbe 0x94d59
movl $0x1000, %edi           # imm = 0x1000
callq 0x8480
movq %rax, %r12
jmp 0x94d67
addq 0x8d0(%r13), %r12
movq %rax, 0x8c8(%r13)
movq %r12, (%rbx)
movl $0xc, 0x8(%rbx)
movq $0x1000, 0x10(%rbx)     # imm = 0x1000
cmpb $0x1, (%r15)
jne 0x94df4
leaq 0x79e2e(%rip), %r13     # 0x10ebb4
movq 0x8(%r15), %rax
movq 0x10(%rax), %rbp
testq %rbp, %rbp
je 0x94dea
movb $0x0, (%r12)
movq %rbp, %rdi
callq 0x81a0
cmpb $0x2f, -0x1(%rbp,%rax)
jne 0x94dc1
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x9517
jmp 0x94ddc
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
movq %rbp, %rdx
movq %r13, %rcx
movq %r14, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x9517
movq %r12, %rdi
xorl %esi, %esi
callq 0x8590
testl %eax, %eax
je 0x94e33
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
je 0x94d86
movslq 0x8(%rbx), %rax
cmpq $0x11, %rax
jne 0x94e1f
movq (%rbx), %rdi
testq %rdi, %rdi
movq (%rsp), %r14
je 0x94e16
callq 0x8050
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
jmp 0x94e27
movq (%rsp), %r14
leaq (%r14,%rax,8), %r14
movq (%r14), %rax
movq %rax, 0x18(%rbx)
movq %rbx, (%r14)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq