#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int cuadrado_magico[3][3];
  int i = 0, j = 0, vi = 0, vj = 0;
  int contador = 0;
  int limite = 3 * 3;
  int lim_i = 3 - 1;
  int lim_j = 3 - 1;
  i = 3 / 2;
  j = 0;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++)
      cuadrado_magico[i][j] = 0;
  }
  for (contador = 1; contador <= limite; contador++) {
    cuadrado_magico[i][j] = contador;
    vi = i;
    vj = j;
    i++;
    if (i > lim_i)
      i = 0;
    j--;
    if (j < 0)
      j = lim_j;
    if (cuadrado_magico[j][i] > 0) {
      i = vi;
      j = vj + 1;
    }
  }
  printf("Cuadrado magico: \n");
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++)
      printf(" %3d ", cuadrado_magico[i][j]);
    printf("\n");
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x9,-0x58(%rbp)
movl   $0x2,-0x5c(%rbp)
movl   $0x2,-0x60(%rbp)
movl   $0x1,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x44(%rbp)
jge    11c9 <main+0xb9>
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x48(%rbp)
jge    11b6 <main+0xa6>
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1184 <main+0x74>
jmp    11bb <main+0xab>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1173 <main+0x63>
movl   $0x1,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jg     1275 <main+0x165>
mov    -0x54(%rbp),%edx
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jle    121d <main+0x10d>
movl   $0x0,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    1236 <main+0x126>
mov    -0x60(%rbp),%eax
mov    %eax,-0x48(%rbp)
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1262 <main+0x152>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1267 <main+0x157>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11d0 <main+0xc0>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x44(%rbp)
jge    12f3 <main+0x1e3>
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x48(%rbp)
jge    12d7 <main+0x1c7>
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    129b <main+0x18b>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    128a <main+0x17a>
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Cuadrado magico: \0A\00"
@.str.1 = [6 x i8] c" %3d \00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x [3 x i32]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 9, i32* %12
store i32 2, i32* %13
store i32 2, i32* %14
store i32 1, i32* %7
store i32 0, i32* %8
store i32 0, i32* %7
br label %15
15: ; preds = %33, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %36
18: ; preds = %15
store i32 0, i32* %8
br label %19
19: ; preds = %29, %18
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 %24
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %22
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %19
32: ; preds = %19
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %15
36: ; preds = %15
store i32 1, i32* %11
br label %37
37: ; preds = %78, %36
%38 = load i32, i32* %11
%39 = load i32, i32* %12
%40 = icmp sle i32 %38, %39
br i1 %40, label %41, label %81
41: ; preds = %37
%42 = load i32, i32* %11
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 %44
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x i32], [3 x i32]* %45, i64 0, i64 %47
store i32 %42, i32* %48
%49 = load i32, i32* %7
store i32 %49, i32* %9
%50 = load i32, i32* %8
store i32 %50, i32* %10
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
%53 = load i32, i32* %7
%54 = load i32, i32* %13
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %57
56: ; preds = %41
store i32 0, i32* %7
br label %57
57: ; preds = %56, %41
%58 = load i32, i32* %8
%59 = add nsw i32 %58, -1
store i32 %59, i32* %8
%60 = load i32, i32* %8
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = load i32, i32* %14
store i32 %63, i32* %8
br label %64
64: ; preds = %62, %57
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 %66
%68 = load i32, i32* %7
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [3 x i32], [3 x i32]* %67, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = icmp sgt i32 %71, 0
br i1 %72, label %73, label %77
73: ; preds = %64
%74 = load i32, i32* %9
store i32 %74, i32* %7
%75 = load i32, i32* %10
%76 = add nsw i32 %75, 1
store i32 %76, i32* %8
br label %77
77: ; preds = %73, %64
br label %78
78: ; preds = %77
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %37
81: ; preds = %37
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %83
83: ; preds = %104, %81
%84 = load i32, i32* %7
%85 = icmp slt i32 %84, 3
br i1 %85, label %86, label %107
86: ; preds = %83
store i32 0, i32* %8
br label %87
87: ; preds = %99, %86
%88 = load i32, i32* %8
%89 = icmp slt i32 %88, 3
br i1 %89, label %90, label %102
90: ; preds = %87
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 %92
%94 = load i32, i32* %8
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x i32], [3 x i32]* %93, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %97)
br label %99
99: ; preds = %90
%100 = load i32, i32* %8
%101 = add nsw i32 %100, 1
store i32 %101, i32* %8
br label %87
102: ; preds = %87
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %104
104: ; preds = %102
%105 = load i32, i32* %7
%106 = add nsw i32 %105, 1
store i32 %106, i32* %7
br label %83
107: ; preds = %83
%108 = load i32, i32* @EXIT_SUCCESS
ret i32 %108
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c" %3d \00"
@EXIT_SUCCESS = global i32 0
@str = [18 x i8] c"Cuadrado magico: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 8)
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 9)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 3)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 4)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 6)
%15 = tail call i32 @putchar(i32 10)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}