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


x86 assembly (clang, -O0):
<fn_dynamic_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x5,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <init_char@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_char@plt>
mov    -0x10(%rbp),%rdi
call   1080 <print_char@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [46 x i8] c"[HEAP] 2 matrices gemelas tipo char dinamicas\00"
define void @fn_dynamic_char() {
%1 = tail call i64 @malloc(i32 5)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc(i32 5)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @init_char(i8* %2, i8* %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_char(i8* %2)
%9 = tail call i32 @print_char(i8* %4)
%10 = tail call i32 @free(i8* %2)
%11 = tail call i32 @free(i8* %4)
ret void
}