#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*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int nlinha, i;
  int **matriz, **matriz2;
  scanf("%d", &nlinha);
  printf("Insira  Matrizes de ordem =   %d \n", nlinha);
  matriz = (int **)malloc(nlinha * sizeof(int *));
  matriz2 = (int **)malloc(nlinha * sizeof(int *));
  insere_matriz(nlinha, nlinha, matriz);
  insere_matriz(nlinha, nlinha, matriz2);
  if (matriz_transposta(nlinha, matriz, matriz2)) {
    printf("A matriz 2 É transposta\n");
  } else {
    printf("A matriz 2 NAO É  transposta\n");
  }
  free(matriz);
  free(matriz2);
  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    0xe83(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%esi
lea    0xe73(%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)
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     1208 <main+0xa8>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1216 <main+0xb6>
lea    0xe31(%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>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edi
mov    %edi,%esi
mov    %r14,%rdx
call   1090 <insere_matriz@plt>
mov    0x4(%rsp),%edi
mov    %edi,%esi
mov    %rbx,%rdx
call   1090 <insere_matriz@plt>
mov    0x4(%rsp),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1080 <matriz_transposta@plt>
test   %rax,%rax
lea    0xe3c(%rip),%rax
lea    0xe53(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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 = [26 x i8] c"A matriz 2 \C3\89 transposta\0A\00"
@.str.3 = [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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i32**
store i32** %18, i32*** %8
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i32**
store i32** %24, i32*** %9
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = load i32**, i32*** %8
%28 = call i32 @insere_matriz(i32 %25, i32 %26, i32** %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %6
%31 = load i32**, i32*** %9
%32 = call i32 @insere_matriz(i32 %29, i32 %30, i32** %31)
%33 = load i32, i32* %6
%34 = load i32**, i32*** %8
%35 = load i32**, i32*** %9
%36 = call i64 @matriz_transposta(i32 %33, i32** %34, i32** %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %42
40: ; preds = %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = load i32**, i32*** %8
%44 = call i32 @free(i32** %43)
%45 = load i32**, i32*** %9
%46 = call i32 @free(i32** %45)
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"
@str.4 = [25 x i8] c"A matriz 2 \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 = call i32 @insere_matriz(i32 %16, i32 %16, i32** %11)
%18 = load i32, i32* %3
%19 = call i32 @insere_matriz(i32 %18, i32 %18, i32** %15)
%20 = load i32, i32* %3
%21 = call i64 @matriz_transposta(i32 %20, i32** %11, i32** %15)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0)
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = call i32 @free(i32** %11)
%26 = call i32 @free(i32** %15)
ret i32 0
}