// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rsi, -0x288(%rbp)
movq %rdi, -0x298(%rbp)
movq %rdi, %rax
movq %rax, -0x290(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x5030
movq -0x288(%rbp), %rsi
movl %eax, %edx
leaq -0x1a0(%rbp), %rdi
callq 0x3440
leaq -0x1c0(%rbp), %rdi
callq 0x33c0
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
movl $0x2f, %edx
callq 0x34c0
movq %rax, -0x2a0(%rbp)
jmp 0x8bb0
movq -0x2a0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3350
movb %al, -0x2a1(%rbp)
jmp 0x8bce
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x8bdd
jmp 0x8c93
leaq 0x1d60(%rip), %rsi      # 0xa944
leaq -0x1c0(%rbp), %rdi
callq 0x4de0
movb %al, -0x2a2(%rbp)
jmp 0x8bf8
movb -0x2a2(%rbp), %al
testb $0x1, %al
jne 0x8c2b
jmp 0x8c04
leaq 0x1628(%rip), %rsi      # 0xa233
leaq -0x1c0(%rbp), %rdi
callq 0x4de0
movb %al, -0x2a3(%rbp)
jmp 0x8c1f
movb -0x2a3(%rbp), %al
testb $0x1, %al
jne 0x8c2b
jmp 0x8c47
jmp 0x8b8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x8f0c
leaq -0x1f0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x30d0
jmp 0x8c5c
leaq -0x1f0(%rbp), %rdi
callq 0x8290
movb %al, -0x2a4(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x3140
movb -0x2a4(%rbp), %al
testb $0x1, %al
jne 0x8c86
jmp 0x8c8c
movb $0x0, -0x11(%rbp)
jmp 0x8c93
jmp 0x8c8e
jmp 0x8b8f
testb $0x1, -0x11(%rbp)
je 0x8cbb
movq -0x288(%rbp), %rsi
movq -0x298(%rbp), %rdi
callq 0x3130
movl $0x1, -0x1f4(%rbp)
jmp 0x8ee4
leaq -0x210(%rbp), %rdi
callq 0x4d90
leaq 0x1ddd(%rip), %rax      # 0xaaab
movq %rax, -0x218(%rbp)
leaq -0x210(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x4db0
jmp 0x8cea
jmp 0x8cec
jmp 0x8cee
jmp 0x8cf0
movq -0x288(%rbp), %rdi
callq 0x30c0
movq %rax, -0x220(%rbp)
leaq -0x210(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x4db0
jmp 0x8d18
jmp 0x8d1a
jmp 0x8d1c
movb $0x0, -0x221(%rbp)
leaq -0x240(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x4e10
jmp 0x8d38
movq -0x298(%rbp), %rdi
leaq 0x1d5c(%rip), %rdx      # 0xaaa2
leaq -0x1f8(%rbp), %rsi
leaq -0x240(%rbp), %rcx
callq 0x8780
jmp 0x8d5b
leaq -0x240(%rbp), %rdi
callq 0x4f00
cmpl $0x1, -0x1f8(%rbp)
jne 0x8db4
movl $0x1, %edi
callq 0x3310
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x8ed6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x4f00
jmp 0x8ed6
jmp 0x8db6
jmp 0x8db8
movq -0x298(%rbp), %rdi
callq 0x31e0
movq -0x298(%rbp), %rdi
movq %rax, -0x258(%rbp)
callq 0x3120
movq %rax, -0x260(%rbp)
movb $0xa, -0x261(%rbp)
movq -0x258(%rbp), %rdi
movq -0x260(%rbp), %rsi
leaq -0x261(%rbp), %rdx
callq 0x9000
movq %rax, -0x2b0(%rbp)
jmp 0x8e08
movq -0x2b0(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x9050
movq -0x298(%rbp), %rdi
callq 0x3120
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x9050
movq -0x298(%rbp), %rdi
movq -0x248(%rbp), %rsi
movq -0x270(%rbp), %rdx
callq 0x3050
movq %rax, -0x2b8(%rbp)
jmp 0x8e72
movq -0x2b8(%rbp), %rax
movq %rax, -0x280(%rbp)
movb $0x1, -0x221(%rbp)
movl $0x1, -0x1f4(%rbp)
testb $0x1, -0x221(%rbp)
jne 0x8ec8
jmp 0x8ebc
movq -0x298(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
callq 0x3140
jmp 0x8ed6
movq -0x298(%rbp), %rdi
callq 0x3140
leaq -0x210(%rbp), %rdi
callq 0x4f00
jmp 0x8ee4
leaq -0x210(%rbp), %rdi
callq 0x4f00
jmp 0x8f0c
leaq -0x1c0(%rbp), %rdi
callq 0x3140
leaq -0x1a0(%rbp), %rdi
callq 0x3180
movq -0x290(%rbp), %rax
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x1c0(%rbp), %rdi
callq 0x3140
leaq -0x1a0(%rbp), %rdi
callq 0x3180
movq -0x1c8(%rbp), %rdi
callq 0x3490