#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int STABIL(unsigned long *, unsigned long, unsigned long *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned long *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, unsigned long *, ...);
unsigned long *malloc(unsigned long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[]) {
  unsigned long n, d;
  unsigned long *matrix;
  unsigned long i, j, ij;
  int result;
  FILE *f;
  if (argc < 2)
    f = stdin;
  else {
    f = fopen(argv[1], "r");
    if (!f) {
      fprintf(stderr, "HALT: File %s not found!\n", argv[1]);
      fprintf(stderr, "      Usage: `STABIL filename` (read from file) or "
                      "`STABIL` (read from stdin)\n");
      return 1;
    }
  }
  fscanf(f, "%lu%lu", &d, &n);
  (matrix = malloc(n * n * sizeof *(matrix)));
  for (ij = 0, i = 0; i < n; ++i)
    for (j = 0; j < n; ++j, ++ij)
      fscanf(f, "%lu", matrix + ij);
  fclose(f);
  if (n > 0xffffUL) {
    fprintf(stderr, "HALT: Predicted integer overflow!\n");
    fprintf(stderr,
            "      Please do not use matrices larger than 65535x65535.\n");
    return 3;
  }
  result = STABIL(matrix, n, &d);
  switch (result) {
  case 1:
    fprintf(stderr, "HALT: Malformed input data!\n");
    fprintf(stderr, "      Enter first a dimension d, then a rank n, then the "
                    "entries of a matrix\n");
    fprintf(stderr, "      of dimension n x n whose entries are, as a set, {0, "
                    "1, ..., d-1} and whose\n");
    fprintf(stderr, "      diagonal and off-diagonal entries are disjoint.\n");
    break;
  case 2:
    fprintf(stderr, "HALT: Could not allocate sufficient memory!\n");
    break;
  case 0:
    printf("%lu \n%lu \n", d, n);
    for (ij = 0, i = 0; i < n; ++i) {
      for (j = 0; j < n; ++j, ++ij)
        printf("%lu ", matrix[ij]);
      printf("\n");
    }
  }
  free(matrix);
  return result;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    11b3 <main+0x33>
mov    0x2e41(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    121d <main+0x9d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1218 <main+0x98>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a0 <main+0x320>
jmp    121d <main+0x9d>
mov    -0x50(%rbp),%rdi
lea    0xe43(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
imul   -0x18(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    12d5 <main+0x155>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    12bf <main+0x13f>
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1273 <main+0xf3>
jmp    12c4 <main+0x144>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    125d <main+0xdd>
mov    -0x50(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0xffff,-0x18(%rbp)
jbe    1326 <main+0x1a6>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd76(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    14a0 <main+0x320>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1070 <STABIL@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x54(%rbp)
test   %eax,%eax
je     13ec <main+0x26c>
jmp    134d <main+0x1cd>
mov    -0x54(%rbp),%eax
sub    $0x1,%eax
je     136f <main+0x1ef>
jmp    135e <main+0x1de>
mov    -0x54(%rbp),%eax
sub    $0x2,%eax
je     13d0 <main+0x250>
jmp    1491 <main+0x311>
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
lea    0xd57(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c34(%rip),%rax
mov    (%rax),%edi
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1491 <main+0x311>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
lea    0xde4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1491 <main+0x311>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    148c <main+0x30c>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    146d <main+0x2ed>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1428 <main+0x2a8>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1412 <main+0x292>
jmp    1491 <main+0x311>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jg     11af <main+0x1f>
mov    0x2e3e(%rip),%rax
mov    (%rax),%rbp
jmp    11ce <main+0x3e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe43(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1315 <main+0x185>
lea    0xe96(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbp,%rdi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    (%rsp),%rbx
mov    %rbx,%rdi
imul   %rbx,%rdi
shl    $0x3,%rdi
call   10a0 <malloc@plt>
mov    %rax,0x8(%rsp)
test   %rbx,%rbx
je     125d <main+0xcd>
lea    0xe62(%rip),%r15
xor    %r12d,%r12d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
lea    (%rax,%r12,8),%rbx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%r14
mov    (%rsp),%rax
add    $0x8,%rbx
cmp    %rax,%r14
jb     1230 <main+0xa0>
add    $0x1,%r13
add    %r14,%r12
cmp    %rax,%r13
jb     1220 <main+0x90>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    (%rsp),%rsi
cmp    $0x10000,%rsi
jb     12a4 <main+0x114>
mov    0x2d5f(%rip),%rbx
mov    (%rbx),%edi
lea    0xdf0(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe03(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x3,%r15d
jmp    13e2 <main+0x252>
lea    0x10(%rsp),%rdx
mov    0x8(%rsp),%rdi
call   1080 <STABIL@plt>
mov    %eax,%r15d
test   %eax,%eax
je     134d <main+0x1bd>
cmp    $0x2,%r15d
je     13c1 <main+0x231>
cmp    $0x1,%r15d
jne    13d8 <main+0x248>
mov    0x2cff(%rip),%rbx
mov    (%rbx),%edi
lea    0xdee(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdfb(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe39(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xe7d(%rip),%rsi
jmp    13c8 <main+0x238>
mov    0x2cbc(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x8(%rbx),%rdx
lea    0xcd8(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xce1(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%r15d
jmp    13e2 <main+0x252>
mov    0x10(%rsp),%rsi
mov    (%rsp),%rdx
lea    0xe94(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpq   $0x0,(%rsp)
je     13d8 <main+0x248>
lea    0xe8a(%rip),%r13
xor    %r12d,%r12d
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
lea    (%rax,%r12,8),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    (%rsp),%rbp
jb     1390 <main+0x200>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%r14
add    %rbp,%r12
cmp    (%rsp),%r14
jb     1380 <main+0x1f0>
jmp    13d8 <main+0x248>
lea    0xdfc(%rip),%rsi
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"HALT: File %s not found!\0A\00"
@.str.2 = [79 x i8] c" Usage: `STABIL filename` (read from file) or `STABIL` (read from stdin)\0A\00"
@.str.3 = [7 x i8] c"%lu%lu\00"
@.str.4 = [4 x i8] c"%lu\00"
@.str.5 = [35 x i8] c"HALT: Predicted integer overflow!\0A\00"
@.str.6 = [59 x i8] c" Please do not use matrices larger than 65535x65535.\0A\00"
@.str.7 = [29 x i8] c"HALT: Malformed input data!\0A\00"
@.str.8 = [78 x i8] c" Enter first a dimension d, then a rank n, then the entries of a matrix\0A\00"
@.str.9 = [82 x i8] c" of dimension n x n whose entries are, as a set, {0, 1, ..., d-1} and whose\0A\00"
@.str.10 = [55 x i8] c" diagonal and off-diagonal entries are disjoint.\0A\00"
@.str.11 = [45 x i8] c"HALT: Could not allocate sufficient memory!\0A\00"
@.str.12 = [11 x i8] c"%lu \0A%lu \0A\00"
@.str.13 = [5 x i8] c"%lu \00"
@.str.14 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i32*, i32** @stdin
store i32* %17, i32** %13
br label %34
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %22, i32** %13
%23 = load i32*, i32** %13
%24 = icmp ne i32* %23, null
br i1 %24, label %33, label %25
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %127
33: ; preds = %18
br label %34
34: ; preds = %33, %16
%35 = load i32*, i32** %13
%36 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64* %7, i64* %6)
%37 = load i64, i64* %6
%38 = load i64, i64* %6
%39 = mul i64 %37, %38
%40 = mul i64 %39, 8
%41 = call i64* @malloc(i64 %40)
store i64* %41, i64** %8
store i64 0, i64* %11
store i64 0, i64* %9
br label %42
42: ; preds = %63, %34
%43 = load i64, i64* %9
%44 = load i64, i64* %6
%45 = icmp ult i64 %43, %44
br i1 %45, label %46, label %66
46: ; preds = %42
store i64 0, i64* %10
br label %47
47: ; preds = %57, %46
%48 = load i64, i64* %10
%49 = load i64, i64* %6
%50 = icmp ult i64 %48, %49
br i1 %50, label %51, label %62
51: ; preds = %47
%52 = load i32*, i32** %13
%53 = load i64*, i64** %8
%54 = load i64, i64* %11
%55 = getelementptr inbounds i64, i64* %53, i64 %54
%56 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %55)
br label %57
57: ; preds = %51
%58 = load i64, i64* %10
%59 = add i64 %58, 1
store i64 %59, i64* %10
%60 = load i64, i64* %11
%61 = add i64 %60, 1
store i64 %61, i64* %11
br label %47
62: ; preds = %47
br label %63
63: ; preds = %62
%64 = load i64, i64* %9
%65 = add i64 %64, 1
store i64 %65, i64* %9
br label %42
66: ; preds = %42
%67 = load i32*, i32** %13
%68 = call i32 @fclose(i32* %67)
%69 = load i64, i64* %6
%70 = icmp ugt i64 %69, 65535
br i1 %70, label %71, label %76
71: ; preds = %66
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%74 = load i32, i32* @stderr
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
store i32 3, i32* %3
br label %127
76: ; preds = %66
%77 = load i64*, i64** %8
%78 = load i64, i64* %6
%79 = call i32 @STABIL(i64* %77, i64 %78, i64* %7)
store i32 %79, i32* %12
%80 = load i32, i32* %12
switch i32 %80, label %123 [
i32 1, label %81
i32 2, label %90
i32 0, label %93
]
81: ; preds = %76
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.8, i64 0, i64 0))
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.9, i64 0, i64 0))
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
br label %123
90: ; preds = %76
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
br label %123
93: ; preds = %76
%94 = load i64, i64* %7
%95 = load i64, i64* %6
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i64 %94, i64 %95)
store i64 0, i64* %11
store i64 0, i64* %9
br label %97
97: ; preds = %119, %93
%98 = load i64, i64* %9
%99 = load i64, i64* %6
%100 = icmp ult i64 %98, %99
br i1 %100, label %101, label %122
101: ; preds = %97
store i64 0, i64* %10
br label %102
102: ; preds = %112, %101
%103 = load i64, i64* %10
%104 = load i64, i64* %6
%105 = icmp ult i64 %103, %104
br i1 %105, label %106, label %117
106: ; preds = %102
%107 = load i64*, i64** %8
%108 = load i64, i64* %11
%109 = getelementptr inbounds i64, i64* %107, i64 %108
%110 = load i64, i64* %109
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i64 %110)
br label %112
112: ; preds = %106
%113 = load i64, i64* %10
%114 = add i64 %113, 1
store i64 %114, i64* %10
%115 = load i64, i64* %11
%116 = add i64 %115, 1
store i64 %116, i64* %11
br label %102
117: ; preds = %102
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
br label %119
119: ; preds = %117
%120 = load i64, i64* %9
%121 = add i64 %120, 1
store i64 %121, i64* %9
br label %97
122: ; preds = %97
br label %123
123: ; preds = %122, %76, %90, %81
%124 = load i64*, i64** %8
%125 = call i32 @free(i64* %124)
%126 = load i32, i32* %12
store i32 %126, i32* %3
br label %127
127: ; preds = %123, %71, %25
%128 = load i32, i32* %3
ret i32 %128
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"HALT: File %s not found!\0A\00"
@.str.2 = [79 x i8] c" Usage: `STABIL filename` (read from file) or `STABIL` (read from stdin)\0A\00"
@.str.3 = [7 x i8] c"%lu%lu\00"
@.str.4 = [4 x i8] c"%lu\00"
@.str.5 = [35 x i8] c"HALT: Predicted integer overflow!\0A\00"
@.str.6 = [59 x i8] c" Please do not use matrices larger than 65535x65535.\0A\00"
@.str.7 = [29 x i8] c"HALT: Malformed input data!\0A\00"
@.str.8 = [78 x i8] c" Enter first a dimension d, then a rank n, then the entries of a matrix\0A\00"
@.str.9 = [82 x i8] c" of dimension n x n whose entries are, as a set, {0, 1, ..., d-1} and whose\0A\00"
@.str.10 = [55 x i8] c" diagonal and off-diagonal entries are disjoint.\0A\00"
@.str.11 = [45 x i8] c"HALT: Could not allocate sufficient memory!\0A\00"
@.str.12 = [11 x i8] c"%lu \0A%lu \0A\00"
@.str.13 = [5 x i8] c"%lu \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32*, i32** @stdin
br label %21
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %11
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0))
br label %92
21: ; preds = %10, %8
%22 = phi i32* [ %9, %8 ], [ %13, %10 ]
%23 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64* %4, i64* %3)
%24 = load i64, i64* %3
%25 = shl i64 %24, 3
%26 = mul i64 %25, %24
%27 = call i64* @malloc(i64 %26)
%28 = icmp eq i64 %24, 0
br i1 %28, label %44, label %29
29: ; preds = %21, %41
%30 = phi i64 [ %38, %41 ], [ 0, %21 ]
%31 = phi i64 [ %42, %41 ], [ 0, %21 ]
br label %32
32: ; preds = %29, %32
%33 = phi i64 [ %38, %32 ], [ %30, %29 ]
%34 = phi i64 [ %37, %32 ], [ 0, %29 ]
%35 = getelementptr inbounds i64, i64* %27, i64 %33
%36 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %35)
%37 = add nuw i64 %34, 1
%38 = add i64 %33, 1
%39 = load i64, i64* %3
%40 = icmp ult i64 %37, %39
br i1 %40, label %32, label %41
41: ; preds = %32
%42 = add nuw i64 %31, 1
%43 = icmp ult i64 %42, %39
br i1 %43, label %29, label %44
44: ; preds = %41, %21
%45 = call i32 @fclose(i32* %22)
%46 = load i64, i64* %3
%47 = icmp ugt i64 %46, 65535
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
br label %92
53: ; preds = %44
%54 = call i32 @STABIL(i64* %27, i64 %46, i64* %4)
switch i32 %54, label %90 [
i32 1, label %55
i32 2, label %86
i32 0, label %62
]
55: ; preds = %53
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.8, i64 0, i64 0))
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.9, i64 0, i64 0))
br label %86
62: ; preds = %53
%63 = load i64, i64* %4
%64 = load i64, i64* %3
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i64 %63, i64 %64)
%66 = load i64, i64* %3
%67 = icmp eq i64 %66, 0
br i1 %67, label %90, label %68
68: ; preds = %62, %81
%69 = phi i64 [ %78, %81 ], [ 0, %62 ]
%70 = phi i64 [ %83, %81 ], [ 0, %62 ]
br label %71
71: ; preds = %68, %71
%72 = phi i64 [ %78, %71 ], [ %69, %68 ]
%73 = phi i64 [ %77, %71 ], [ 0, %68 ]
%74 = getelementptr inbounds i64, i64* %27, i64 %72
%75 = load i64, i64* %74
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i64 %75)
%77 = add nuw i64 %73, 1
%78 = add i64 %72, 1
%79 = load i64, i64* %3
%80 = icmp ult i64 %77, %79
br i1 %80, label %71, label %81
81: ; preds = %71
%82 = call i32 @putchar(i32 10)
%83 = add nuw i64 %70, 1
%84 = load i64, i64* %3
%85 = icmp ult i64 %83, %84
br i1 %85, label %68, label %90
86: ; preds = %53, %55
%87 = phi i8* [ getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0), %55 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), %53 ]
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* %87)
br label %90
90: ; preds = %81, %86, %62, %53
%91 = call i32 @free(i64* %27)
br label %92
92: ; preds = %90, %48, %15
%93 = phi i32 [ 3, %48 ], [ %54, %90 ], [ 1, %15 ]
ret i32 %93
}