#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 EDEADLK 129
#define EINVAL 128
int /*<<< orphan*/ printf(char *, char *);
void validaLock(int e) {
  char *mensaje = "\n\t-Se produjo el error";
  switch (e) {
  case EINVAL:
    printf("%s EINVAL ( The value specified by mutex is invalid.)\n\n",
           mensaje);
    break;
  case EDEADLK:
    printf("%s EDEADLK (A deadlock would occur if the thread blocked waiting "
           "for mutex.)\n\n",
           mensaje);
    break;
  }
}


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

x86 assembly (clang, -O2):
<validaLock>:
cmp    $0x80,%edi
je     1133 <validaLock+0x23>
cmp    $0x81,%edi
jne    1146 <validaLock+0x36>
lea    0xf28(%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 = [56 x i8] c"%s EINVAL ( The value specified by mutex is invalid.)\0A\0A\00"
@.str.2 = [79 x i8] c"%s EDEADLK (A deadlock would occur if the thread blocked waiting for mutex.)\0A\0A\00"
define void @validaLock(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 ([56 x i8], [56 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 ([79 x i8], [79 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 = [56 x i8] c"%s EINVAL ( The value specified by mutex is invalid.)\0A\0A\00"
@.str.2 = [79 x i8] c"%s EDEADLK (A deadlock would occur if the thread blocked waiting for mutex.)\0A\0A\00"
define void @validaLock(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 ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([56 x i8], [56 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
}