#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*/ insere_matriz(int, int, int **);
int /*<<< orphan*/ printf(char *);
scalar_t__ qmagico(int, int **);
int /*<<< orphan*/ scanf(char *, int *);
int main(int arc, char const *argv[]) {
  int i, j, n;
  int **matriz;
  printf("Digite o tamanho da matriz: ");
  scanf("%d", &n);
  printf("Digite os elementos da matriz\n");
  insere_matriz(n, n, matriz);
  if (qmagico(n, matriz)) {
    printf("A matriz é um quadrado mágico\n");
  } else
    printf("A matriz não é quadrado mágico\n");
  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    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1060 <insere_matriz@plt>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1040 <qmagico@plt>
cmp    $0x0,%rax
je     11b4 <main+0x74>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    11c0 <main+0x80>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
mov    %edi,%esi
call   1070 <insere_matriz@plt>
mov    0x4(%rsp),%edi
call   1050 <qmagico@plt>
test   %rax,%rax
lea    0xea6(%rip),%rax
lea    0xec1(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Digite o tamanho da matriz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Digite os elementos da matriz\0A\00"
@.str.3 = [33 x i8] c"A matriz \C3\A9 um quadrado m\C3\A1gico\0A\00"
@.str.4 = [35 x i8] c"A matriz n\C3\A3o \C3\A9 quadrado m\C3\A1gico\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 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%12 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %8
%14 = load i32, i32* %8
%15 = load i32**, i32*** %9
%16 = call i32 @insere_matriz(i32 %13, i32 %14, i32** %15)
%17 = load i32, i32* %8
%18 = load i32**, i32*** %9
%19 = call i64 @qmagico(i32 %17, i32** %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %25
23: ; preds = %2
%24 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Digite o tamanho da matriz: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [30 x i8] c"Digite os elementos da matriz\00"
@str.5 = [34 x i8] c"A matriz n\C3\A3o \C3\A9 quadrado m\C3\A1gico\00"
@str.6 = [32 x i8] c"A matriz \C3\A9 um quadrado m\C3\A1gico\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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* %3)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 @insere_matriz(i32 %8, i32 %8, i32** undef)
%10 = load i32, i32* %3
%11 = call i64 @qmagico(i32 %10, i32** undef)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
ret i32 0
}