#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 EAGAIN 129
#define EINVAL 128
int /*<<< orphan*/ printf(char *, ...);
void validaCreate(int e) {
  char *mensaje = "\n\t-Se produjo el error";
  switch (e) {
  case 0:
    printf("\nHilo creado satisfactoriamente.\n");
    break;
  case EAGAIN:
    printf(
        "%s EAGAIN (The system lacked the necessary resources to create "
        "another thread, or the system-imposed limit on the total number of "
        "threads in a process [PTHREAD_THREADS_MAX] would be exceeded.) \n\n",
        mensaje);
    break;
  case EINVAL:
    printf(" EINVAL (The value specified by attr is invalid.)\n\n");
    break;
  }
}


x86 assembly (clang, -O0):
<validaCreate>:
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 <validaCreate+0x4f>
jmp    1139 <validaCreate+0x29>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     1189 <validaCreate+0x79>
jmp    114c <validaCreate+0x3c>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
je     1172 <validaCreate+0x62>
jmp    1197 <validaCreate+0x87>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <validaCreate+0x87>
mov    -0x10(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <validaCreate+0x87>
lea    0xf6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaCreate>:
cmp    $0x81,%edi
je     1140 <validaCreate+0x20>
cmp    $0x80,%edi
je     1155 <validaCreate+0x35>
test   %edi,%edi
jne    1161 <validaCreate+0x41>
lea    0xfd3(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xed0(%rip),%rdi
lea    0xeb2(%rip),%rsi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xf7f(%rip),%rdi
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.1 = [34 x i8] c"\0AHilo creado satisfactoriamente.\0A\00"
@.str.2 = [196 x i8] c"%s EAGAIN (The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process [PTHREAD_THREADS_MAX] would be exceeded.) \0A\0A\00"
@.str.3 = [52 x i8] c" EINVAL (The value specified by attr is invalid.)\0A\0A\00"
define void @validaCreate(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 %12 [
i32 0, label %5
i32 129, label %7
i32 128, label %10
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %12
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %1, %10, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\09-Se produjo el error\00"
@.str.2 = [196 x i8] c"%s EAGAIN (The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process [PTHREAD_THREADS_MAX] would be exceeded.) \0A\0A\00"
@str = [51 x i8] c" EINVAL (The value specified by attr is invalid.)\0A\00"
@str.4 = [33 x i8] c"\0AHilo creado satisfactoriamente.\00"
define void @validaCreate(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 ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0))
br label %8
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([196 x i8], [196 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %1, %6, %4, %2
ret void
}