// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq 0x1280(%rdi), %rsi
callq 0xaa24
cmpb $0x1, (%rax)
jne 0x9b4eb
movq %rax, %r15
leaq 0x838(%r12), %r13
movq 0x898(%r12), %rbx
testq %rbx, %rbx
je 0x9b372
movq 0x18(%rbx), %rax
movq %rax, 0x898(%r12)
jmp 0x9b40b
cmpq $0x0, (%r13)
jne 0x9b3b2
movl $0x2800, %edi           # imm = 0x2800
callq 0x9480
movq %rax, (%r13)
addq $0x28, %rax
movl $0xff, %ecx
movq %rax, -0x10(%rax)
movl $0x0, -0x20(%rax)
addq $0x28, %rax
decl %ecx
jne 0x9b390
movq $0x0, -0x10(%rax)
movl $0x0, -0x20(%rax)
movq 0x838(%r12), %rbx
movq 0x18(%rbx), %rax
movq %rax, 0x838(%r12)
movl $0x0, 0x8(%rbx)
movq 0x8c8(%r12), %rax
leaq 0x1000(%rax), %rcx
cmpq $0x10001, %rcx          # imm = 0x10001
jb 0x9b3f1
movl $0x1000, %edi           # imm = 0x1000
callq 0x9480
jmp 0x9b401
addq 0x8d0(%r12), %rax
movq %rcx, 0x8c8(%r12)
movq %rax, (%rbx)
movl $0xc, 0x8(%rbx)
movq %r13, (%rsp)
movq $0x1000, 0x10(%rbx)     # imm = 0x1000
cmpb $0x1, (%r15)
sete %r13b
jne 0x9b4a8
movq (%rbx), %r12
movq 0x8(%r15), %rax
movq 0x10(%rax), %rbp
testq %rbp, %rbp
je 0x9b492
movb $0x0, (%r12)
movq %rbp, %rdi
callq 0x91a0
cmpb $0x2f, -0x1(%rbp,%rax)
jne 0x9b463
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xa4d7
jmp 0x9b482
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
movq %rbp, %rdx
leaq 0x7c62f(%rip), %rcx     # 0x117aa4
movq %r14, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0xa4d7
xorl %ebp, %ebp
movq %r12, %rdi
xorl %esi, %esi
callq 0x9590
testl %eax, %eax
je 0x9b495
movb $0x1, %bpl
testb %bpl, %bpl
je 0x9b4e5
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
sete %r13b
je 0x9b428
movslq 0x8(%rbx), %rax
cmpq $0x11, %rax
jne 0x9b4d3
movq (%rbx), %rdi
testq %rdi, %rdi
movq (%rsp), %r14
je 0x9b4ca
callq 0x9050
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
jmp 0x9b4db
movq (%rsp), %r14
leaq (%r14,%rax,8), %r14
movq (%r14), %rax
movq %rax, 0x18(%rbx)
movq %rbx, (%r14)
testb $0x1, %r13b
jne 0x9b4ed
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq