#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 */
int getSize(void *);
int getType(void *);
int /*<<< orphan*/ printf(char *, int, int, ...);
void mostrar(void *pAux) {
  int i;
  switch (getType(pAux)) {
  case 2:
    printf("\nEs un int con valor: %d y ocupa %d bytes", *((int *)pAux),
           getSize(pAux));
    break;
  case 3:
    printf("\nEs un short int con valor: %d y ocupa %d bytes", *((int *)pAux),
           getSize(pAux));
    break;
  case 1:
    printf("\nEs un char con valor: %c y ocupa %d byte", *((char *)pAux),
           getSize(pAux));
    break;
  case 4:
    printf("\nEs un float con valor: %f y ocupa %d bytes", *((float *)pAux),
           getSize(pAux));
    break;
  case 5:
    for (i = 0; i < (getSize(pAux) / sizeof(int)); i++) {
      printf("\nEs el lemento %d de un array de int con valor: %d y el array "
             "ocupa %d bytes",
             i, *((int *)pAux + i), getSize(pAux));
    }
    break;
  }
}


x86 assembly (clang, -O0):
<mostrar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getType@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     128a <mostrar+0x15a>
mov    -0x18(%rbp),%rax
lea    0xe9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <mostrar+0x15a>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <mostrar+0x15a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <mostrar+0x15a>
mov    -0x8(%rbp),%rax
cvttss2si (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <mostrar+0x15a>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    1285 <mostrar+0x155>
mov    -0xc(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getSize@plt>
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    %eax,%ecx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    121d <mostrar+0xed>
jmp    128a <mostrar+0x15a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostrar>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1040 <getType@plt>
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11c3 <mostrar+0x93>
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsbl (%r15),%ebx
mov    %r15,%rdi
call   1050 <getSize@plt>
lea    0xf04(%rip),%rdi
jmp    120a <mostrar+0xda>
mov    %r15,%rdi
call   1050 <getSize@plt>
cmp    $0x4,%eax
jb     11c3 <mostrar+0x93>
lea    0xf41(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,4),%ebp
mov    %r15,%rdi
call   1050 <getSize@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1050 <getSize@plt>
cltq
shr    $0x2,%rax
cmp    %rbx,%rax
ja     1190 <mostrar+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r15),%ebx
mov    %r15,%rdi
call   1050 <getSize@plt>
lea    0xe34(%rip),%rdi
jmp    120a <mostrar+0xda>
mov    (%r15),%ebx
mov    %r15,%rdi
call   1050 <getSize@plt>
lea    0xe4a(%rip),%rdi
jmp    120a <mostrar+0xda>
cvttss2si (%r15),%ebx
mov    %r15,%rdi
call   1050 <getSize@plt>
lea    0xe8e(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"\0AEs un int con valor: %d y ocupa %d bytes\00"
@.str.1 = [48 x i8] c"\0AEs un short int con valor: %d y ocupa %d bytes\00"
@.str.2 = [42 x i8] c"\0AEs un char con valor: %c y ocupa %d byte\00"
@.str.3 = [44 x i8] c"\0AEs un float con valor: %f y ocupa %d bytes\00"
@.str.4 = [77 x i8] c"\0AEs el lemento %d de un array de int con valor: %d y el array ocupa %d bytes\00"
define void @mostrar(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @getType(i8* %4)
switch i32 %5, label %59 [
i32 2, label %6
i32 3, label %13
i32 1, label %20
i32 4, label %27
i32 5, label %35
]
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = load i8*, i8** %2
%11 = call i32 @getSize(i8* %10)
%12 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
br label %59
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = load i8*, i8** %2
%18 = call i32 @getSize(i8* %17)
%19 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %18)
br label %59
20: ; preds = %1
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = load i8*, i8** %2
%25 = call i32 @getSize(i8* %24)
%26 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %25)
br label %59
27: ; preds = %1
%28 = load i8*, i8** %2
%29 = bitcast i8* %28 to float*
%30 = load float, float* %29
%31 = fptosi float %30 to i32
%32 = load i8*, i8** %2
%33 = call i32 @getSize(i8* %32)
%34 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %31, i32 %33)
br label %59
35: ; preds = %1
store i32 0, i32* %3
br label %36
36: ; preds = %55, %35
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = load i8*, i8** %2
%40 = call i32 @getSize(i8* %39)
%41 = sext i32 %40 to i64
%42 = udiv i64 %41, 4
%43 = icmp ult i64 %38, %42
br i1 %43, label %44, label %58
44: ; preds = %36
%45 = load i32, i32* %3
%46 = load i8*, i8** %2
%47 = bitcast i8* %46 to i32*
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %47, i64 %49
%51 = load i32, i32* %50
%52 = load i8*, i8** %2
%53 = call i32 @getSize(i8* %52)
%54 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.4, i64 0, i64 0), i32 %45, i32 %51, i32 %53)
br label %55
55: ; preds = %44
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %36
58: ; preds = %36
br label %59
59: ; preds = %1, %58, %27, %20, %13, %6
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"\0AEs un int con valor: %d y ocupa %d bytes\00"
@.str.1 = [48 x i8] c"\0AEs un short int con valor: %d y ocupa %d bytes\00"
@.str.2 = [42 x i8] c"\0AEs un char con valor: %c y ocupa %d byte\00"
@.str.3 = [44 x i8] c"\0AEs un float con valor: %f y ocupa %d bytes\00"
@.str.4 = [77 x i8] c"\0AEs el lemento %d de un array de int con valor: %d y el array ocupa %d bytes\00"
define void @mostrar(i8* %0) {
%2 = tail call i32 @getType(i8* %0)
switch i32 %2, label %41 [
i32 2, label %8
i32 3, label %13
i32 1, label %18
i32 4, label %23
i32 5, label %3
]
3: ; preds = %1
%4 = tail call i32 @getSize(i8* %0)
%5 = icmp ult i32 %4, 4
br i1 %5, label %41, label %6
6: ; preds = %3
%7 = bitcast i8* %0 to i32*
br label %29
8: ; preds = %1
%9 = bitcast i8* %0 to i32*
%10 = load i32, i32* %9
%11 = tail call i32 @getSize(i8* %0)
%12 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
br label %41
13: ; preds = %1
%14 = bitcast i8* %0 to i32*
%15 = load i32, i32* %14
%16 = tail call i32 @getSize(i8* %0)
%17 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16)
br label %41
18: ; preds = %1
%19 = load i8, i8* %0
%20 = sext i8 %19 to i32
%21 = tail call i32 @getSize(i8* %0)
%22 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21)
br label %41
23: ; preds = %1
%24 = bitcast i8* %0 to float*
%25 = load float, float* %24
%26 = fptosi float %25 to i32
%27 = tail call i32 @getSize(i8* %0)
%28 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27)
br label %41
29: ; preds = %6, %29
%30 = phi i64 [ 0, %6 ], [ %36, %29 ]
%31 = getelementptr inbounds i32, i32* %7, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 @getSize(i8* %0)
%34 = trunc i64 %30 to i32
%35 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.4, i64 0, i64 0), i32 %34, i32 %32, i32 %33)
%36 = add nuw nsw i64 %30, 1
%37 = tail call i32 @getSize(i8* %0)
%38 = sext i32 %37 to i64
%39 = lshr i64 %38, 2
%40 = icmp ugt i64 %39, %36
br i1 %40, label %29, label %41
41: ; preds = %29, %3, %1, %23, %18, %13, %8
ret void
}