#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*/ eclass(int *, int, int *, int *, int);
int /*<<< orphan*/ free_ivector(int *, int, int);
int *ivector(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i, j, k, lclas = 0, nclass, *nf, *nflag, *nsav;
  static int lista[] = {0, 1, 1, 5, 2, 6, 2, 7, 11, 3, 4, 12},
             listb[] = {0, 5, 9, 13, 6, 10, 14, 3, 7, 15, 8, 4};
  nf = ivector(1, 15);
  nflag = ivector(1, 15);
  nsav = ivector(1, 15);
  eclass(nf, 15, lista, listb, 11);
  for (i = 1; i <= 15; i++)
    nflag[i] = 1;
  printf("\nNumbers from 1-%d divided according to\n", 15);
  printf("their value modulo 4:\n\n");
  for (i = 1; i <= 15; i++) {
    nclass = nf[i];
    if (nflag[nclass]) {
      nflag[nclass] = 0;
      lclas++;
      k = 0;
      for (j = i; j <= 15; j++)
        if (nf[j] == nf[i])
          nsav[++k] = j;
      printf("Class %2d:      ", lclas);
      for (j = 1; j <= k; j++)
        printf("%3d", nsav[j]);
      printf("\n");
    }
  }
  free_ivector(nsav, 1, 15);
  free_ivector(nflag, 1, 15);
  free_ivector(nf, 1, 15);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x1,%edi
mov    $0xf,%esi
call   1060 <ivector@plt>
mov    %rax,-0x20(%rbp)
mov    $0x1,%edi
mov    $0xf,%esi
call   1060 <ivector@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
mov    $0xf,%esi
call   1060 <ivector@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0xf,%esi
lea    0x2eb1(%rip),%rdx
lea    0x2eda(%rip),%rcx
mov    $0xb,%r8d
call   1030 <eclass@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     11df <main+0x9f>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b8 <main+0x78>
lea    0xe1a(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     1311 <main+0x1d1>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     12fe <main+0x1be>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jg     12a5 <main+0x165>
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x20(%rbp),%rcx
movslq -0x8(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1292 <main+0x152>
mov    -0xc(%rbp),%edx
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1297 <main+0x157>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1256 <main+0x116>
mov    -0x14(%rbp),%esi
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     12f0 <main+0x1b0>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12bd <main+0x17d>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1303 <main+0x1c3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1207 <main+0xc7>
mov    -0x30(%rbp),%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1050 <free_ivector@plt>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1050 <free_ivector@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1050 <free_ivector@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%edi
mov    $0xf,%esi
call   1080 <ivector@plt>
mov    %rax,%rbx
mov    $0x1,%edi
mov    $0xf,%esi
call   1080 <ivector@plt>
mov    %rax,%rbp
mov    $0x1,%edi
mov    $0xf,%esi
call   1080 <ivector@plt>
mov    %rax,%r15
lea    0x2eb5(%rip),%rdx
lea    0x2ede(%rip),%rcx
mov    %rbx,%rdi
mov    $0xf,%esi
mov    $0xb,%r8d
call   1040 <eclass@plt>
movaps 0xe34(%rip),%xmm0
movups %xmm0,0x4(%rbp)
movups %xmm0,0x14(%rbp)
movups %xmm0,0x24(%rbp)
movabs $0x100000001,%rax
mov    %rax,0x34(%rbp)
movl   $0x1,0x3c(%rbp)
lea    0xe1c(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe47(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r12d
lea    0xe31(%rip),%r13
xor    %esi,%esi
mov    %rbp,0x10(%rsp)
jmp    1251 <main+0xf1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%rbp
mov    0xc(%rsp),%esi
add    $0x1,%r12
cmp    $0x10,%r12
je     12ec <main+0x18c>
movslq (%rbx,%r12,4),%rax
cmpl   $0x0,0x0(%rbp,%rax,4)
je     1243 <main+0xe3>
movl   $0x0,0x0(%rbp,%rax,4)
add    $0x1,%esi
xor    %r14d,%r14d
mov    %r12,%rax
jmp    127a <main+0x11a>
nop
add    $0x1,%rax
cmp    $0x10,%rax
je     12a0 <main+0x140>
mov    (%rbx,%rax,4),%ecx
cmp    (%rbx,%r12,4),%ecx
jne    1270 <main+0x110>
movslq %r14d,%rcx
add    $0x1,%r14d
mov    %eax,0x4(%r15,%rcx,4)
jmp    1270 <main+0x110>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd92(%rip),%rdi
mov    %esi,0xc(%rsp)
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    1230 <main+0xd0>
add    $0x1,%r14d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbp,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    12d0 <main+0x170>
jmp    1230 <main+0xd0>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1070 <free_ivector@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1070 <free_ivector@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xf,%edx
call   1070 <free_ivector@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@main.lista = internal global [12 x i32] [i32 0, i32 1, i32 1, i32 5, i32 2, i32 6, i32 2, i32 7, i32 11, i32 3, i32 4, i32 12]
@main.listb = internal global [12 x i32] [i32 0, i32 5, i32 9, i32 13, i32 6, i32 10, i32 14, i32 3, i32 7, i32 15, i32 8, i32 4]
@.str = [41 x i8] c"\0ANumbers from 1-%d divided according to\0A\00"
@.str.2 = [17 x i8] c"Class %2d: \00"
@.str.3 = [4 x i8] c"%3d\00"
@str = [23 x i8] c"their value modulo 4:\0A\00"
define i32 @main() {
%1 = tail call i32* @ivector(i32 1, i32 15)
%2 = tail call i32* @ivector(i32 1, i32 15)
%3 = tail call i32* @ivector(i32 1, i32 15)
%4 = tail call i32 @eclass(i32* %1, i32 15, i32* getelementptr inbounds ([12 x i32], [12 x i32]* @main.lista, i64 0, i64 0), i32* getelementptr inbounds ([12 x i32], [12 x i32]* @main.listb, i64 0, i64 0), i32 11)
%5 = getelementptr inbounds i32, i32* %2, i64 1
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %2, i64 5
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %2, i64 9
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %2, i64 13
store i32 1, i32* %11
%12 = getelementptr inbounds i32, i32* %2, i64 14
store i32 1, i32* %12
%13 = getelementptr inbounds i32, i32* %2, i64 15
store i32 1, i32* %13
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 15)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %0, %58
%17 = phi i64 [ 1, %0 ], [ %60, %58 ]
%18 = phi i32 [ 0, %0 ], [ %59, %58 ]
%19 = getelementptr inbounds i32, i32* %1, i64 %17
%20 = load i32, i32* %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %2, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %58, label %25
25: ; preds = %16
store i32 0, i32* %22
%26 = add nsw i32 %18, 1
br label %27
27: ; preds = %25, %39
%28 = phi i64 [ %17, %25 ], [ %41, %39 ]
%29 = phi i32 [ 0, %25 ], [ %40, %39 ]
%30 = getelementptr inbounds i32, i32* %1, i64 %28
%31 = load i32, i32* %30
%32 = load i32, i32* %19
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %39
34: ; preds = %27
%35 = add nsw i32 %29, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %3, i64 %36
%38 = trunc i64 %28 to i32
store i32 %38, i32* %37
br label %39
39: ; preds = %27, %34
%40 = phi i32 [ %35, %34 ], [ %29, %27 ]
%41 = add nuw nsw i64 %28, 1
%42 = icmp eq i64 %41, 16
br i1 %42, label %43, label %27
43: ; preds = %39
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%45 = icmp slt i32 %40, 1
br i1 %45, label %56, label %46
46: ; preds = %43
%47 = add nuw i32 %40, 1
%48 = zext i32 %47 to i64
br label %49
49: ; preds = %46, %49
%50 = phi i64 [ 1, %46 ], [ %54, %49 ]
%51 = getelementptr inbounds i32, i32* %3, i64 %50
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = add nuw nsw i64 %50, 1
%55 = icmp eq i64 %54, %48
br i1 %55, label %56, label %49
56: ; preds = %49, %43
%57 = tail call i32 @putchar(i32 10)
br label %58
58: ; preds = %16, %56
%59 = phi i32 [ %26, %56 ], [ %18, %16 ]
%60 = add nuw nsw i64 %17, 1
%61 = icmp eq i64 %60, 16
br i1 %61, label %62, label %16
62: ; preds = %58
%63 = tail call i32 @free_ivector(i32* %3, i32 1, i32 15)
%64 = tail call i32 @free_ivector(i32* %2, i32 1, i32 15)
%65 = tail call i32 @free_ivector(i32* %1, i32 1, i32 15)
ret i32 0
}