#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 */
#define EBUSY 129
#define EINVAL 128
int /*<<< orphan*/ printf(char *, ...);
void validaMutexDestroy(int e) {
  char *mensaje = "\n\t-Se produjo el error";
  switch (e) {
  case 0:
    printf("Semaforo destruido satisfactoriamente.\n\n");
    break;
  case EBUSY:
    printf("%s EBUSY (Mutex is locked by a thread.) \n\n", mensaje);
    break;
  case EINVAL:
    printf("%s EINVAL (The value specified by mutex is invalid.)\n\n", mensaje);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<validaMutexDestroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     115f <validaMutexDestroy+0x4f>
jmp    1139 <validaMutexDestroy+0x29>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     1189 <validaMutexDestroy+0x79>
jmp    114c <validaMutexDestroy+0x3c>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
je     1172 <validaMutexDestroy+0x62>
jmp    11a0 <validaMutexDestroy+0x90>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <validaMutexDestroy+0x95>
mov    -0x10(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <validaMutexDestroy+0x95>
mov    -0x10(%rbp),%rsi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <validaMutexDestroy+0x95>
jmp    11a5 <validaMutexDestroy+0x95>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaMutexDestroy>:
cmp    $0x81,%edi
je     1140 <validaMutexDestroy+0x20>
cmp    $0x80,%edi
je     1149 <validaMutexDestroy+0x29>
test   %edi,%edi
jne    115e <validaMutexDestroy+0x3e>
lea    0xf3e(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xed0(%rip),%rdi
jmp    1150 <validaMutexDestroy+0x30>
lea    0xef2(%rip),%rdi
lea    0xea9(%rip),%rsi
xor    %eax,%eax
jmp    1040 <printf@plt>
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.1 = [41 x i8] c"Semaforo destruido satisfactoriamente.\0A\0A\00"
@.str.2 = [43 x i8] c"%s EBUSY (Mutex is locked by a thread.) \0A\0A\00"
@.str.3 = [55 x i8] c"%s EINVAL (The value specified by mutex is invalid.)\0A\0A\00"
define void @validaMutexDestroy(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
switch i32 %4, label %13 [
i32 0, label %5
i32 129, label %7
i32 128, label %10
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %14
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %14
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %14
13: ; preds = %1
br label %14
14: ; preds = %13, %10, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.2 = [43 x i8] c"%s EBUSY (Mutex is locked by a thread.) \0A\0A\00"
@.str.3 = [55 x i8] c"%s EINVAL (The value specified by mutex is invalid.)\0A\0A\00"
@str = [40 x i8] c"Semaforo destruido satisfactoriamente.\0A\00"
define void @validaMutexDestroy(i32 %0) {
switch i32 %0, label %8 [
i32 0, label %2
i32 129, label %4
i32 128, label %6
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %8
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %1, %6, %4, %2
ret void
}