#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ getFilename(char *, char *);
int /*<<< orphan*/ getParentDirectoryName(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void test2() {
  printf(">>>2.Testear el correcto parseo de los path\n");
  char buff[12];
  printf("1-con el path: /pepe\n");
  getFilename("/pepe", buff);
  printf("nombre del directorio = %s\n", buff);
  getParentDirectoryName("/pepe", buff);
  printf("nombre del padre = %s\n", buff);
  printf("2-Con el archivo: /pepe/a.txt\n");
  getFilename("/pepe/a.txt", buff);
  printf("nombre del archivo = %s\n", buff);
  getParentDirectoryName("/pepe/a.txt", buff);
  printf("nombre del padre = %s\n", buff);
  printf(">>>test2 OK\n");
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xee4(%rip),%rdi
call   1050 <getFilename@plt>
lea    -0xc(%rbp),%rsi
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <getParentDirectoryName@plt>
lea    -0xc(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xeea(%rip),%rdi
call   1050 <getFilename@plt>
lea    -0xc(%rbp),%rsi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xec8(%rip),%rdi
call   1030 <getParentDirectoryName@plt>
lea    -0xc(%rbp),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <getFilename@plt>
lea    0xe81(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <getParentDirectoryName@plt>
lea    0xe81(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <getFilename@plt>
lea    0xe66(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <getParentDirectoryName@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c">>>2.Testear el correcto parseo de los path\0A\00"
@.str.1 = [22 x i8] c"1-con el path: /pepe\0A\00"
@.str.2 = [6 x i8] c"/pepe\00"
@.str.3 = [28 x i8] c"nombre del directorio = %s\0A\00"
@.str.4 = [23 x i8] c"nombre del padre = %s\0A\00"
@.str.5 = [31 x i8] c"2-Con el archivo: /pepe/a.txt\0A\00"
@.str.6 = [12 x i8] c"/pepe/a.txt\00"
@.str.7 = [25 x i8] c"nombre del archivo = %s\0A\00"
@.str.8 = [13 x i8] c">>>test2 OK\0A\00"
define void @test2() {
%1 = alloca [12 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = call i32 @getFilename(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%9 = call i32 @getParentDirectoryName(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%14 = call i32 @getFilename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%18 = call i32 @getParentDirectoryName(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [6 x i8] c"/pepe\00"
@.str.3 = [28 x i8] c"nombre del directorio = %s\0A\00"
@.str.4 = [23 x i8] c"nombre del padre = %s\0A\00"
@.str.6 = [12 x i8] c"/pepe/a.txt\00"
@.str.7 = [25 x i8] c"nombre del archivo = %s\0A\00"
@str = [44 x i8] c">>>2.Testear el correcto parseo de los path\00"
@str.9 = [21 x i8] c"1-con el path: /pepe\00"
@str.10 = [30 x i8] c"2-Con el archivo: /pepe/a.txt\00"
@str.11 = [12 x i8] c">>>test2 OK\00"
define void @test2() {
%1 = alloca [12 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
%5 = call i32 @getFilename(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%7 = call i32 @getParentDirectoryName(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
%10 = call i32 @getFilename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %3)
%12 = call i32 @getParentDirectoryName(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
ret void
}