#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 **aloca(int);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ multiplica(int **, int **, int **, int, int);
int **preenche(int **, int);
int /*<<< orphan*/ printf(char *);
main(int argc, char *argv[]) {
  int TAMMATRIZ = atoi(argv[1]);
  int NPROCESSOS = atoi(argv[2]);
  if (TAMMATRIZ < NPROCESSOS) {
    printf("TAM MATRIZ < NUM PROCESSOS nao e valido\n");
    exit(0);
  }
  int **m1, **m2, **m3;
  m1 = aloca(TAMMATRIZ);
  m2 = aloca(TAMMATRIZ);
  m3 = aloca(TAMMATRIZ);
  m1 = preenche(m1, TAMMATRIZ);
  m2 = preenche(m2, TAMMATRIZ);
  multiplica(m1, m2, m3, TAMMATRIZ, NPROCESSOS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ae <main+0x4e>
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
call   1030 <aloca@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <aloca@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <aloca@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <preenche@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <preenche@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1050 <multiplica@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1060 <atoi@plt>
cmp    %eax,%ebx
jl     11d9 <main+0x79>
mov    %eax,%r14d
mov    %ebx,%edi
call   1030 <aloca@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1030 <aloca@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1030 <aloca@plt>
mov    %rax,%r12
mov    %rbp,%rdi
mov    %ebx,%esi
call   1080 <preenche@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %ebx,%esi
call   1080 <preenche@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %r14d,%r8d
call   1050 <multiplica@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe20(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"TAM MATRIZ < NUM PROCESSOS nao e valido\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32**
%8 = alloca i32**
%9 = alloca i32**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %5
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
%25 = load i32, i32* %5
%26 = call i32** @aloca(i32 %25)
store i32** %26, i32*** %7
%27 = load i32, i32* %5
%28 = call i32** @aloca(i32 %27)
store i32** %28, i32*** %8
%29 = load i32, i32* %5
%30 = call i32** @aloca(i32 %29)
store i32** %30, i32*** %9
%31 = load i32**, i32*** %7
%32 = load i32, i32* %5
%33 = call i32** @preenche(i32** %31, i32 %32)
store i32** %33, i32*** %7
%34 = load i32**, i32*** %8
%35 = load i32, i32* %5
%36 = call i32** @preenche(i32** %34, i32 %35)
store i32** %36, i32*** %8
%37 = load i32**, i32*** %7
%38 = load i32**, i32*** %8
%39 = load i32**, i32*** %9
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = call i32 @multiplica(i32** %37, i32** %38, i32** %39, i32 %40, i32 %41)
ret i32 0
}

LLVM IR (-O2):
@str = [40 x i8] c"TAM MATRIZ < NUM PROCESSOS nao e valido\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = icmp slt i32 %5, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = tail call i32** @aloca(i32 %5)
%15 = tail call i32** @aloca(i32 %5)
%16 = tail call i32** @aloca(i32 %5)
%17 = tail call i32** @preenche(i32** %14, i32 %5)
%18 = tail call i32** @preenche(i32** %15, i32 %5)
%19 = tail call i32 @multiplica(i32** %17, i32** %18, i32** %16, i32 %5, i32 %8)
ret i32 0
}