#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 *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *p;
  p = malloc(2 * sizeof(int));
  printf("Dame la base: ");
  scanf("%d", p);
  printf("Dame la altura:");
  scanf("%d", p + 1);
  printf("\nArea=(%d*%d)/2 = %d", *p, *(p + 1), (*p * *(p + 1) / 2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1050 <scanf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
imul   0x4(%rcx),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rbx),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    (%rbx),%esi
mov    0x4(%rbx),%edx
mov    %edx,%eax
imul   %esi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Dame la base: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Dame la altura:\00"
@.str.3 = [21 x i8] c"\0AArea=(%d*%d)/2 = %d\00"
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 8)
store i32* %2, i32** %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i32*, i32** %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32*, i32** %1
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = load i32*, i32** %1
%11 = load i32, i32* %10
%12 = load i32*, i32** %1
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load i32*, i32** %1
%16 = load i32, i32* %15
%17 = load i32*, i32** %1
%18 = getelementptr inbounds i32, i32* %17, i64 1
%19 = load i32, i32* %18
%20 = mul nsw i32 %16, %19
%21 = sdiv i32 %20, 2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %14, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Dame la base: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Dame la altura:\00"
@.str.3 = [21 x i8] c"\0AArea=(%d*%d)/2 = %d\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 8)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = load i32, i32* %1
%8 = load i32, i32* %5
%9 = mul nsw i32 %8, %7
%10 = sdiv i32 %9, 2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %7, i32 %8, i32 %10)
ret i32 0
}