int main(int argc, char **argv) {
  float *b = g();
  printf("%p\n", b);
  free(b);
  int *arreglo;
  arreglo = (int *)malloc(4000 * sizeof(int));
  printf("%p\n", arreglo);
  arreglo[4000] = 3;
  free(arreglo);
  int *salida;
  salida = (int *)malloc(1 * sizeof(int));
  h(salida);
  printf("%d\n", *salida);
  double *d = i();
  printf("direccion de d fuera de la funcion i: %p. valor de d %lf\n", d, *d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <g@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x3e80,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
movl   $0x3,0x3e80(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1040 <h@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <i@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <g@plt>
movslq %eax,%rbx
lea    0xe8b(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x3e80,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <h@plt>
mov    (%rbx),%esi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <i@plt>
movslq %eax,%rsi
movsd  (%rsi),%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [58 x i8] c"direccion de d fuera de la funcion i: %p. valor de d %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @g()
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to float*
store float* %12, float** %6
%13 = load float*, float** %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %13)
%15 = load float*, float** %6
%16 = bitcast float* %15 to i8*
%17 = call i8* @malloc(i64 16000)
%18 = bitcast i8* %17 to i32*
store i32* %18, i32** %7
%19 = load i32*, i32** %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = load i32*, i32** %7
%22 = getelementptr inbounds i32, i32* %21, i64 4000
store i32 3, i32* %22
%23 = load i32*, i32** %7
%24 = bitcast i32* %23 to i8*
%25 = call i8* @malloc(i64 4)
%26 = bitcast i8* %25 to i32*
store i32* %26, i32** %8
%27 = load i32*, i32** %8
%28 = call i32 (i32*, ...) bitcast (i32 (...)* @h to i32 (i32*, ...)*)(i32* %27)
%29 = load i32*, i32** %8
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @i()
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to double*
store double* %34, double** %9
%35 = load double*, double** %9
%36 = load double*, double** %9
%37 = load double, double* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), double* %35, double %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [58 x i8] c"direccion de d fuera de la funcion i: %p. valor de d %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @g()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to float*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %5)
%7 = inttoptr i64 %4 to i8*
tail call void @free(i8* %7)
%8 = tail call dereferenceable_or_null(16000) i8* @malloc(i64 16000)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
tail call void @free(i8* %8)
%10 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%11 = bitcast i8* %10 to i32*
%12 = tail call i32 (i32*, ...) bitcast (i32 (...)* @h to i32 (i32*, ...)*)(i32* %11)
%13 = load i32, i32* %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = tail call i32 (...) @i()
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to double*
%18 = load double, double* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), double* %17, double %18)
ret i32 0
}