#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 */
void *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void *realloc(void *, int);
int main() {
  void *vector_din = NULL;
  void *vector_din_6_lug = NULL;
  int *vector_convertido = NULL;
  vector_din = malloc(4 * sizeof(int));
  if (vector_din == NULL)
    printf(" no se pudo asingar mem");
  vector_convertido = (int *)vector_din;
  vector_convertido[0] = 1;
  vector_convertido[1] = 2;
  vector_convertido[2] = 3;
  vector_convertido[3] = 4;
  vector_din_6_lug = realloc(vector_din, 6 * sizeof(int));
  if (vector_din_6_lug == NULL)
    printf(" no se pudo asingar mem");
  vector_convertido = (int *)vector_din_6_lug;
  printf("El neuvo vector en el [3]:%d\n", vector_convertido[3]);
  vector_convertido[4] = 5;
  vector_convertido[5] = 6;
  printf("El neuvo vector en el [5]:%d", vector_convertido[5]);
  printf("\n\nSaludos guachin!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117e <main+0x4e>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x3,0x8(%rax)
mov    -0x20(%rbp),%rax
movl   $0x4,0xc(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x18,%esi
call   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11dc <main+0xac>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movl   $0x5,0x10(%rax)
mov    -0x20(%rbp),%rax
movl   $0x6,0x14(%rax)
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1151 <main+0x21>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movaps 0xea8(%rip),%xmm0
movups %xmm0,(%rbx)
mov    %rbx,%rdi
mov    $0x18,%esi
call   1050 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117e <main+0x4e>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rbx),%esi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x600000005,%rax
mov    %rax,0x10(%rbx)
lea    0xea2(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c" no se pudo asingar mem\00"
@.str.1 = [30 x i8] c"El neuvo vector en el [3]:%d\0A\00"
@.str.2 = [29 x i8] c"El neuvo vector en el [5]:%d\00"
@.str.3 = [19 x i8] c"\0A\0ASaludos guachin!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
store i32 0, i32* %1
store i8* null, i8** %2
store i8* null, i8** %3
store i32* null, i32** %4
%5 = call i8* @malloc(i32 16)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i8*, i8** %2
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 1, i32* %14
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 2, i32* %16
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 2
store i32 3, i32* %18
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 3
store i32 4, i32* %20
%21 = load i8*, i8** %2
%22 = call i8* @realloc(i8* %21, i32 24)
store i8* %22, i8** %3
%23 = load i8*, i8** %3
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %10
%28 = load i8*, i8** %3
%29 = bitcast i8* %28 to i32*
store i32* %29, i32** %4
%30 = load i32*, i32** %4
%31 = getelementptr inbounds i32, i32* %30, i64 3
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i64 4
store i32 5, i32* %35
%36 = load i32*, i32** %4
%37 = getelementptr inbounds i32, i32* %36, i64 5
store i32 6, i32* %37
%38 = load i32*, i32** %4
%39 = getelementptr inbounds i32, i32* %38, i64 5
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c" no se pudo asingar mem\00"
@.str.1 = [30 x i8] c"El neuvo vector en el [3]:%d\0A\00"
@.str.2 = [29 x i8] c"El neuvo vector en el [5]:%d\00"
@.str.3 = [19 x i8] c"\0A\0ASaludos guachin!\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = bitcast i8* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %6
%7 = tail call i8* @realloc(i8* %1, i32 24)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = getelementptr inbounds i8, i8* %7, i64 12
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds i8, i8* %7, i64 16
%17 = bitcast i8* %16 to i32*
store i32 5, i32* %17
%18 = getelementptr inbounds i8, i8* %7, i64 20
%19 = bitcast i8* %18 to i32*
store i32 6, i32* %19
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 6)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}