#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int m, n, tam, res = 1, i;
  printf("Digite o valor de M: ");
  scanf("%d", &m);
  printf("Digite o valor de N: ");
  scanf("%d", &n);
  tam = (m * n);
  for (i = 0; i < tam; i++)
    res = (res + (i * 2));
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b7 <main+0x87>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118f <main+0x5f>
lea    0xe71(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Digite o valor de M: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Digite o valor de N: \00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %4
store i32 0, i32* %6
br label %14
14: ; preds = %23, %0
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = mul nsw i32 %20, 2
%22 = add nsw i32 %19, %21
store i32 %22, i32* %5
br label %23
23: ; preds = %18
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %14
26: ; preds = %14
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Digite o valor de M: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Digite o valor de N: \00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}