#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
void *fcn_hijo(void *arg) {
  int N = 20;
  int *mayor = (int *)malloc(sizeof(int));
  int m[N];
  int i;
  for (i = 0; i < N; i++) {
    m[i] = i;
  }
  for (i = 0; i < N; i++) {
    if (m[i] > *mayor) {
      *mayor = m[i];
    }
  }
  printf("Hola soy el hijo!\n");
  return (void *)mayor;
}


x86 assembly (clang, -O0):
<fcn_hijo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1197 <fcn_hijo+0x77>
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116f <fcn_hijo+0x4f>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e5 <fcn_hijo+0xc5>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    11d2 <fcn_hijo+0xb2>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11d7 <fcn_hijo+0xb7>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119e <fcn_hijo+0x7e>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcn_hijo>:
push   %rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    (%rax),%eax
test   %eax,%eax
jle    1141 <fcn_hijo+0x21>
cmp    $0x9,%eax
ja     114f <fcn_hijo+0x2f>
movl   $0xa,(%rbx)
jmp    1154 <fcn_hijo+0x34>
movl   $0x1,(%rbx)
movl   $0xa,(%rbx)
jmp    1154 <fcn_hijo+0x34>
cmp    $0x12,%eax
ja     115a <fcn_hijo+0x3a>
movl   $0x13,(%rbx)
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Hola soy el hijo!\0A\00"
define i8* @fcn_hijo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %2
store i32 20, i32* %3
%8 = call i64 @malloc(i32 4)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %4
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i32, i64 %11
store i64 %11, i64* %6
store i32 0, i32* %7
br label %14
14: ; preds = %23, %1
%15 = load i32, i32* %7
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %7
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %13, i64 %21
store i32 %19, i32* %22
br label %23
23: ; preds = %18
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %14
26: ; preds = %14
store i32 0, i32* %7
br label %27
27: ; preds = %46, %26
%28 = load i32, i32* %7
%29 = load i32, i32* %3
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %49
31: ; preds = %27
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %13, i64 %33
%35 = load i32, i32* %34
%36 = load i32*, i32** %4
%37 = load i32, i32* %36
%38 = icmp sgt i32 %35, %37
br i1 %38, label %39, label %45
39: ; preds = %31
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %13, i64 %41
%43 = load i32, i32* %42
%44 = load i32*, i32** %4
store i32 %43, i32* %44
br label %45
45: ; preds = %39, %31
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %27
49: ; preds = %27
%50 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%51 = load i32*, i32** %4
%52 = bitcast i32* %51 to i8*
%53 = load i8*, i8** %5
ret i8* %52
}

LLVM IR (-O2):
@str = [18 x i8] c"Hola soy el hijo!\00"
define i8* @fcn_hijo(i8* nocapture readnone %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %3
br label %9
7: ; preds = %1
%8 = icmp ult i32 %4, 10
br i1 %8, label %9, label %10
9: ; preds = %7, %6
store i32 10, i32* %3
br label %12
10: ; preds = %7
%11 = icmp ult i32 %4, 19
br i1 %11, label %12, label %13
12: ; preds = %10, %9
store i32 19, i32* %3
br label %13
13: ; preds = %10, %12
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%15 = inttoptr i64 %2 to i8*
ret i8* %15
}