#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 *, char *);
void validaSemDestroy(int e) {
  char *mensaje = "\n\t-Se produjo el error";
  switch (e) {
  case EINVAL:
    printf("%s EINVAL (The sem argument is not a valid semaphore.) \n\n",
           mensaje);
    break;
  case EBUSY:
    printf("%s EBUSY (There are currently processes blocked on the semaphore.) "
           "\n\n",
           mensaje);
    break;
  }
}


x86 assembly (clang, -O0):
<validaSemDestroy>:
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)
sub    $0x80,%eax
je     114f <validaSemDestroy+0x3f>
jmp    113c <validaSemDestroy+0x2c>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
je     1164 <validaSemDestroy+0x54>
jmp    1174 <validaSemDestroy+0x64>
mov    -0x10(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1174 <validaSemDestroy+0x64>
mov    -0x10(%rbp),%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaSemDestroy>:
cmp    $0x80,%edi
je     1133 <validaSemDestroy+0x23>
cmp    $0x81,%edi
jne    1146 <validaSemDestroy+0x36>
lea    0xf2a(%rip),%rdi
lea    0xed2(%rip),%rsi
jmp    1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0xebf(%rip),%rsi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.1 = [58 x i8] c"%s EINVAL (The sem argument is not a valid semaphore.) \0A\0A\00"
@.str.2 = [70 x i8] c"%s EBUSY (There are currently processes blocked on the semaphore.) \0A\0A\00"
define void @validaSemDestroy(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 %11 [
i32 128, label %5
i32 129, label %8
]
5: ; preds = %1
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %1, %8, %5
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.1 = [58 x i8] c"%s EINVAL (The sem argument is not a valid semaphore.) \0A\0A\00"
@.str.2 = [70 x i8] c"%s EBUSY (There are currently processes blocked on the semaphore.) \0A\0A\00"
define void @validaSemDestroy(i32 %0) {
switch i32 %0, label %6 [
i32 128, label %3
i32 129, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), %1 ]
%5 = tail call i32 @printf(i8* %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %3, %1
ret void
}