// File: /workspace/github_c_makefile_star2_O3/info-telecom-strasbourg[P]code-generator/src/utils.cpp
// Function: cut_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string cut_file (string path) {
	bool to_exit = true;
	stringstream ss(path);
	string token;

    while ( getline(ss, token, '/') ) {
		if ( token == "." || token == ".." )
			continue;
        else if ( has_dot (token) ) {
			to_exit = false;
			break;
		}
	}

	if (to_exit)
		return path;

	int exit_code;
	vector<char*> cmd;

	LOAD_CMD ("dirname");
	LOAD_CMD (path.c_str());

	string out = execute(exit_code, DIRNAME_PATH, cmd);
	CHECK_CODE (exit_code);

	out.erase(remove(out.begin(), out.end(), '\n'), out.end());

	return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, 0x10(%rsp)
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x8(%rsp)
movl $0x18, %edx
callq 0x2310
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x80(%rsp), %r14
leaq 0x20(%rsp), %r12
leaq 0x183b(%rip), %r13      # 0x7965
leaq 0x1102(%rip), %rbp      # 0x7233
movq %r15, %rdi
movq %r12, %rsi
movl $0x2f, %edx
callq 0x2360
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x62a4
movq %r12, %rdi
movq %r13, %rsi
callq 0x2060
testl %eax, %eax
je 0x6131
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2060
testl %eax, %eax
je 0x6131
movq %r14, 0x70(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x3f06
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0x61b8
decq %rax
xorl %ecx, %ecx
cmpb $0x2e, (%rdi,%rcx)
sete %bl
je 0x61ba
leaq 0x1(%rcx), %rdx
cmpq %rcx, %rax
movq %rdx, %rcx
jne 0x61a1
jmp 0x61ba
xorl %ebx, %ebx
cmpq %r14, %rdi
je 0x61cf
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
testb %bl, %bl
je 0x6131
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x18ca(%rip), %rax      # 0x7abb
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
callq 0x3f9c
movq 0x8(%rsp), %rax
movq (%rax), %rax
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x40(%rsp), %rdi
callq 0x3f9c
movq 0x10(%rsp), %r14
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3dea
leaq 0x187f(%rip), %rdx      # 0x7ab2
leaq 0x4(%rsp), %rsi
leaq 0x58(%rsp), %rcx
movq %r14, %rdi
callq 0x5e42
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x625c
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
cmpl $0x1, 0x4(%rsp)
je 0x633c
movq (%r14), %rdi
movq 0x8(%r14), %rsi
addq %rdi, %rsi
leaq 0x18(%rsp), %rdx
movb $0xa, (%rdx)
callq 0x63e1
movq %rax, %rcx
subq (%r14), %rcx
movq %rcx, 0x8(%r14)
movb $0x0, (%rax)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x62ea
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x62ea
movq 0x10(%rsp), %r14
leaq 0x10(%r14), %rcx
movq %rcx, (%r14)
movq 0x8(%rsp), %rsi
movq (%rsi), %rdx
leaq 0x10(%rsi), %rax
cmpq %rax, %rdx
je 0x62cd
movq %rdx, (%r14)
movq (%rax), %rcx
movq %rcx, 0x10(%r14)
jmp 0x62d3
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%r14)
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6306
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x3c9b(%rip), %rsi      # 0x9fa8
leaq 0x90(%rsp), %rdi
callq 0x2110
leaq 0x110(%rsp), %rdi
callq 0x2080
movq %r14, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x2240
movq %rax, %rbx
movq (%r14), %rdi
addq $0x10, %r14
cmpq %r14, %rdi
je 0x6380
movq (%r14), %rsi
incq %rsi
jmp 0x6372
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x6380
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x6380
jmp 0x637d
jmp 0x637d
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x639c
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x639c
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x63b8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x3be9(%rip), %rsi      # 0x9fa8
leaq 0x90(%rsp), %rdi
callq 0x2110
leaq 0x110(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2340