#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 /*<<< orphan*/ free(long *);
int /*<<< orphan*/ init_long(long *, long *);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_local_dynamic(unsigned long, unsigned long);
int /*<<< orphan*/ print_long(long *);
int /*<<< orphan*/ printf(char *);
void fn_dynamic_long(void) {
  long *lo1 = (long *)malloc(5 * sizeof(long));
  long *lo2 = (long *)malloc(5 * sizeof(long));
  init_long(lo1, lo2);
  printf("[HEAP] 2 matrices gemelas tipo long dinamicas\n");
  print_local_dynamic((unsigned long)lo1, (unsigned long)lo2);
  print_long(lo1);
  print_long(lo2);
  free(lo1);
  free(lo2);
}


x86 assembly (clang, -O0):
<fn_dynamic_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <init_long@plt>
lea    0xe68(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <print_local_dynamic@plt>
mov    -0x8(%rbp),%rdi
call   1080 <print_long@plt>
mov    -0x10(%rbp),%rdi
call   1080 <print_long@plt>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_dynamic_long>:
push   %r14
push   %rbx
push   %rax
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <init_long@plt>
lea    0xe70(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <print_local_dynamic@plt>
mov    %r14,%rdi
call   1080 <print_long@plt>
mov    %rbx,%rdi
call   1080 <print_long@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <free@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"[HEAP] 2 matrices gemelas tipo long dinamicas\0A\00"
define void @fn_dynamic_long() {
%1 = alloca i64*
%2 = alloca i64*
%3 = call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i64*
store i64* %4, i64** %1
%5 = call i64 @malloc(i32 40)
%6 = inttoptr i64 %5 to i64*
store i64* %6, i64** %2
%7 = load i64*, i64** %1
%8 = load i64*, i64** %2
%9 = call i32 @init_long(i64* %7, i64* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%11 = load i64*, i64** %1
%12 = ptrtoint i64* %11 to i64
%13 = load i64*, i64** %2
%14 = ptrtoint i64* %13 to i64
%15 = call i32 @print_local_dynamic(i64 %12, i64 %14)
%16 = load i64*, i64** %1
%17 = call i32 @print_long(i64* %16)
%18 = load i64*, i64** %2
%19 = call i32 @print_long(i64* %18)
%20 = load i64*, i64** %1
%21 = call i32 @free(i64* %20)
%22 = load i64*, i64** %2
%23 = call i32 @free(i64* %22)
ret void
}

LLVM IR (-O2):
@str = [46 x i8] c"[HEAP] 2 matrices gemelas tipo long dinamicas\00"
define void @fn_dynamic_long() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i64*
%3 = tail call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i64*
%5 = tail call i32 @init_long(i64* %2, i64* %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @print_local_dynamic(i64 %1, i64 %3)
%8 = tail call i32 @print_long(i64* %2)
%9 = tail call i32 @print_long(i64* %4)
%10 = tail call i32 @free(i64* %2)
%11 = tail call i32 @free(i64* %4)
ret void
}