#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 errno;
int /*<<< orphan*/ printf(char *, char *, ...);
char *strerror(int);
int unlink(char *);
void eliminar_fichero(char *ruta) {
  int salida;
  salida = unlink(ruta);
  if (salida == 0) {
    printf("Borrado: %s \n", ruta);
  } else {
    if (errno == 2) {
      printf("Fichero desconocido: %s\n", ruta);
    } else {
      printf("Error borrando fichero %s: %d %s\n", ruta, errno,
             strerror(errno));
    }
  }
}


x86 assembly (clang, -O0):
<eliminar_fichero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1169 <eliminar_fichero+0x39>
mov    -0x8(%rbp),%rsi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cf <eliminar_fichero+0x9f>
mov    0x2e70(%rip),%rax
cmpl   $0x2,(%rax)
jne    1190 <eliminar_fichero+0x60>
mov    -0x8(%rbp),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ca <eliminar_fichero+0x9a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    %rax,%rcx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cf <eliminar_fichero+0x9f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eliminar_fichero>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %eax,%eax
je     1156 <eliminar_fichero+0x26>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ebp
cmp    $0x2,%ebp
jne    116d <eliminar_fichero+0x3d>
lea    0xeba(%rip),%rdi
jmp    115d <eliminar_fichero+0x2d>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
mov    %ebp,%edi
call   1050 <strerror@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Borrado: %s \0A\00"
@errno = global i32 0
@.str.1 = [25 x i8] c"Fichero desconocido: %s\0A\00"
@.str.2 = [34 x i8] c"Error borrando fichero %s: %d %s\0A\00"
define void @eliminar_fichero(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @unlink(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %24
11: ; preds = %1
%12 = load i32, i32* @errno
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %23
17: ; preds = %11
%18 = load i8*, i8** %2
%19 = load i32, i32* @errno
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %18, i32 %19, i8* %21)
br label %23
23: ; preds = %17, %14
br label %24
24: ; preds = %23, %8
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Borrado: %s \0A\00"
@errno = global i32 0
@.str.1 = [25 x i8] c"Fichero desconocido: %s\0A\00"
@.str.2 = [34 x i8] c"Error borrando fichero %s: %d %s\0A\00"
define void @eliminar_fichero(i8* %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
6: ; preds = %1
%7 = load i32, i32* @errno
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %14
11: ; preds = %6
%12 = tail call i8* @strerror(i32 %7)
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %7, i8* %12)
br label %14
14: ; preds = %9, %11, %4
ret void
}