// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_file.c
// Function: bcore_file_path_minimized
st_s* bcore_file_path_minimized( sc_t path )
{
    if( !path ) return NULL;
    st_s* s = st_s_create();
    sc_t sc = path;
    while( *sc != 0 )
    {
        if( sc[0] == '/' )
        {
            while( sc[ 1 ] == '/' ) sc++;
            st_s_push_char( s, '/' );
            sc++;
        }
        else if( sc[0] == '.' && sc[1] == '/' )
        {
            sc += 2;
        }
        else if( sc[0] == '.' && sc[1] == '.' && sc[2] == '/' )
        {
            if( s->size > 1 && s->sc[ s->size - 1 ] == '/' )
            {
                st_s_pop_char( s );
                st_s_attach( &s, bcore_file_folder_path( s->sc ) );
                st_s_push_char( s, '/' );
            }
            else
            {
                st_s_push_sc( s, "../" );
            }
            sc += 3;
        }
        else
        {
            st_s_push_char( s, *sc );
            sc++;
        }
    }

    // if path is relative, ensure that s stays relative
    if( s->sc[ 0 ] == '/' && path[ 0 ] != '/' ) st_s_remove( s, 0, 1 );

    return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x9f210
movq $0x0, -0x8(%rbp)
jmp 0x9f3a6
movb $0x0, %al
callq 0xff2e0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x9f370
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x9f27b
jmp 0x9f241
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0x9f25c
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9f241
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0xffba0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9f36b
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x9f2a5
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0x9f2a5
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x9f369
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x9f34b
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2e, %eax
jne 0x9f34b
movq -0x20(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2f, %eax
jne 0x9f34b
movq -0x18(%rbp), %rax
cmpq $0x1, 0x10(%rax)
jbe 0x9f32d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x9f32d
movq -0x18(%rbp), %rdi
callq 0xffd20
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9f0e0
movq %rax, %rsi
leaq -0x18(%rbp), %rdi
callq 0x9f3b0
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0xffba0
jmp 0x9f33d
movq -0x18(%rbp), %rdi
leaq 0xae359(%rip), %rsi     # 0x14d691
callq 0x100040
movq -0x20(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x20(%rbp)
jmp 0x9f367
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movsbl (%rax), %esi
callq 0xffba0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9f369
jmp 0x9f36b
jmp 0x9f223
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x9f39e
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x9f39e
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x100a30
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq