#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 130
#define EINVAL 129
#define ESRCH 128
int /*<<< orphan*/ printf(char *, ...);
void validaJoin(int e) {
  char *mensaje = "\n\t-Se produjo el error";
  switch (e) {
  case 0:
    printf("Hilo recibido satisfactoriamente.\n\n");
    break;
  case EDEADLK:
    printf("%s EDEADLK (A deadlock was detected or the value of thread "
           "specifies the calling thread.) \n\n",
           mensaje);
    break;
  case EINVAL:
    printf("%s EINVAL (The implementation has detected that the value "
           "specified by thread does not refer to a joinable thread.)\n\n",
           mensaje);
    break;
  case ESRCH:
    printf("%s ESRCH (No thread could be found corresponding to that specified "
           "by the given thread ID, thread.)\n\n",
           mensaje);
    break;
  }
}


x86 assembly (clang, -O0):
<validaJoin>:
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     1172 <validaJoin+0x62>
jmp    1139 <validaJoin+0x29>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     11b3 <validaJoin+0xa3>
jmp    114c <validaJoin+0x3c>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
je     119c <validaJoin+0x8c>
jmp    115f <validaJoin+0x4f>
mov    -0x14(%rbp),%eax
sub    $0x82,%eax
je     1185 <validaJoin+0x75>
jmp    11c5 <validaJoin+0xb5>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <validaJoin+0xb5>
mov    -0x10(%rbp),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <validaJoin+0xb5>
mov    -0x10(%rbp),%rsi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <validaJoin+0xb5>
mov    -0x10(%rbp),%rsi
lea    0xf50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaJoin>:
cmp    $0x80,%edi
jg     113d <validaJoin+0x1d>
test   %edi,%edi
je     1157 <validaJoin+0x37>
cmp    $0x80,%edi
jne    1156 <validaJoin+0x36>
lea    0xfaf(%rip),%rdi
jmp    116a <validaJoin+0x4a>
cmp    $0x81,%edi
je     1163 <validaJoin+0x43>
cmp    $0x82,%edi
jne    1156 <validaJoin+0x36>
lea    0xec3(%rip),%rdi
jmp    116a <validaJoin+0x4a>
ret
lea    0xff2(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf0a(%rip),%rdi
lea    0xe8f(%rip),%rsi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.1 = [36 x i8] c"Hilo recibido satisfactoriamente.\0A\0A\00"
@.str.2 = [93 x i8] c"%s EDEADLK (A deadlock was detected or the value of thread specifies the calling thread.) \0A\0A\00"
@.str.3 = [118 x i8] c"%s EINVAL (The implementation has detected that the value specified by thread does not refer to a joinable thread.)\0A\0A\00"
@.str.4 = [102 x i8] c"%s ESRCH (No thread could be found corresponding to that specified by the given thread ID, thread.)\0A\0A\00"
define void @validaJoin(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 %16 [
i32 0, label %5
i32 130, label %7
i32 129, label %10
i32 128, label %13
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %16
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %16
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %16
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.4, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %1, %13, %10, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.2 = [93 x i8] c"%s EDEADLK (A deadlock was detected or the value of thread specifies the calling thread.) \0A\0A\00"
@.str.3 = [118 x i8] c"%s EINVAL (The implementation has detected that the value specified by thread does not refer to a joinable thread.)\0A\0A\00"
@.str.4 = [102 x i8] c"%s ESRCH (No thread could be found corresponding to that specified by the given thread ID, thread.)\0A\0A\00"
@str = [35 x i8] c"Hilo recibido satisfactoriamente.\0A\00"
define void @validaJoin(i32 %0) {
switch i32 %0, label %10 [
i32 0, label %2
i32 130, label %4
i32 129, label %6
i32 128, label %8
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %10
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([118 x i8], [118 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %1, %8, %6, %4, %2
ret void
}