// File: /workspace/github_c_makefile_star2_O1/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 0x17f6(%rip), %r13      # 0x7965
leaq 0x10bd(%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 0x62ea
movq %r12, %rdi
movq %r13, %rsi
callq 0x2060
testl %eax, %eax
je 0x6176
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2060
testl %eax, %eax
je 0x6176
movq %r14, 0x70(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x3f04
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rax
testq %rax, %rax
setne %bl
je 0x6200
cmpb $0x2e, (%rdi)
je 0x6200
movl $0x1, %ecx
cmpq %rcx, %rax
setne %bl
je 0x6200
cmpb $0x2e, (%rdi,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x61ee
cmpq %r14, %rdi
je 0x6215
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
testb %bl, %bl
je 0x6176
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x1884(%rip), %rax      # 0x7abb
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
callq 0x3f94
movq 0x8(%rsp), %rax
movq (%rax), %rax
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x40(%rsp), %rdi
callq 0x3f94
movq 0x10(%rsp), %r14
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3dea
leaq 0x1839(%rip), %rdx      # 0x7ab2
leaq 0x4(%rsp), %rsi
leaq 0x58(%rsp), %rcx
movq %r14, %rdi
callq 0x5e87
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x62a2
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
cmpl $0x1, 0x4(%rsp)
je 0x6382
movq (%r14), %rdi
movq 0x8(%r14), %rsi
addq %rdi, %rsi
leaq 0x18(%rsp), %rdx
movb $0xa, (%rdx)
callq 0x6427
movq %rax, %rcx
subq (%r14), %rcx
movq %rcx, 0x8(%r14)
movb $0x0, (%rax)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x6330
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x6330
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 0x6313
movq %rdx, (%r14)
movq (%rax), %rcx
movq %rcx, 0x10(%r14)
jmp 0x6319
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 0x634c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x3c55(%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 0x63c6
movq (%r14), %rsi
incq %rsi
jmp 0x63b8
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x63c6
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x63c6
jmp 0x63c3
jmp 0x63c3
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x63e2
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x63e2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x63fe
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x3ba3(%rip), %rsi      # 0x9fa8
leaq 0x90(%rsp), %rdi
callq 0x2110
leaq 0x110(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2340