#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(int **);
int /*<<< orphan*/ insere_matriz(int, int, int **);
scalar_t__ malloc(int);
scalar_t__ matriz_transposta(int, int **, int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ produto_matriz(int, int **, int **);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int nlinha, i;
  int **matriz, **matriz2, **matriz_produto;
  scanf("%d", &nlinha);
  printf("Insira  Matrizes de ordem =   %d \n", nlinha);
  matriz = (int **)malloc(nlinha * sizeof(int *));
  matriz2 = (int **)malloc(nlinha * sizeof(int *));
  matriz_produto = (int **)malloc(nlinha * sizeof(int *));
  insere_matriz(nlinha, nlinha, matriz);
  insere_matriz(nlinha, nlinha, matriz2);
  if (matriz_transposta(nlinha, matriz, matriz2)) {
    produto_matriz(nlinha, matriz, matriz2);
  } else {
    printf("A matriz 2 NAO É  transposta\n");
  }
  free(matriz);
  free(matriz2);
  free(matriz_produto);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1080 <insere_matriz@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1080 <insere_matriz@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1070 <matriz_transposta@plt>
cmp    $0x0,%rax
je     122d <main+0xbd>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1090 <produto_matriz@plt>
jmp    123b <main+0xcb>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe70(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    0xc(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    0xc(%rsp),%edi
mov    %edi,%esi
mov    %r14,%rdx
call   1090 <insere_matriz@plt>
mov    0xc(%rsp),%edi
mov    %edi,%esi
mov    %rbx,%rdx
call   1090 <insere_matriz@plt>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1080 <matriz_transposta@plt>
test   %rax,%rax
je     121a <main+0x9a>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10a0 <produto_matriz@plt>
jmp    1226 <main+0xa6>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"Insira Matrizes de ordem = %d \0A\00"
@.str.2 = [31 x i8] c"A matriz 2 NAO \C3\89 transposta\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32**
%9 = alloca i32**
%10 = alloca i32**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 8
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i32**
store i32** %19, i32*** %8
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 8
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i32**
store i32** %25, i32*** %9
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i32**
store i32** %31, i32*** %10
%32 = load i32, i32* %6
%33 = load i32, i32* %6
%34 = load i32**, i32*** %8
%35 = call i32 @insere_matriz(i32 %32, i32 %33, i32** %34)
%36 = load i32, i32* %6
%37 = load i32, i32* %6
%38 = load i32**, i32*** %9
%39 = call i32 @insere_matriz(i32 %36, i32 %37, i32** %38)
%40 = load i32, i32* %6
%41 = load i32**, i32*** %8
%42 = load i32**, i32*** %9
%43 = call i64 @matriz_transposta(i32 %40, i32** %41, i32** %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %2
%46 = load i32, i32* %6
%47 = load i32**, i32*** %8
%48 = load i32**, i32*** %9
%49 = call i32 @produto_matriz(i32 %46, i32** %47, i32** %48)
br label %52
50: ; preds = %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %50, %45
%53 = load i32**, i32*** %8
%54 = call i32 @free(i32** %53)
%55 = load i32**, i32*** %9
%56 = call i32 @free(i32** %55)
%57 = load i32**, i32*** %10
%58 = call i32 @free(i32** %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"Insira Matrizes de ordem = %d \0A\00"
@str = [30 x i8] c"A matriz 2 NAO \C3\89 transposta\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32**
%12 = load i32, i32* %3
%13 = shl i32 %12, 3
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32**
%16 = load i32, i32* %3
%17 = shl i32 %16, 3
%18 = call i64 @malloc(i32 %17)
%19 = load i32, i32* %3
%20 = call i32 @insere_matriz(i32 %19, i32 %19, i32** %11)
%21 = load i32, i32* %3
%22 = call i32 @insere_matriz(i32 %21, i32 %21, i32** %15)
%23 = load i32, i32* %3
%24 = call i64 @matriz_transposta(i32 %23, i32** %11, i32** %15)
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %2
%27 = load i32, i32* %3
%28 = call i32 @produto_matriz(i32 %27, i32** %11, i32** %15)
br label %31
29: ; preds = %2
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = inttoptr i64 %18 to i32**
%33 = call i32 @free(i32** %11)
%34 = call i32 @free(i32** %15)
%35 = call i32 @free(i32** %32)
ret i32 0
}