#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 **allocate_matrix(int, int, char);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ free_matrix(int **, int, int);
int /*<<< orphan*/ get_cluster_sizes(int **, int, int, int, int *, int *);
scalar_t__ malloc_or_die(int);
int /*<<< orphan*/ mark_cluster_numbers(int **, int **, int **, int, int,
                                        int *);
int /*<<< orphan*/ populate_bonds(int **, int **, int, int, double);
int /*<<< orphan*/ print_lattice_and_cluster_numbers(int **, int **, int **,
                                                     int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sanity_check_cluster_numbers(int **, int **, int **, int,
                                                int);
int /*<<< orphan*/ set_A1(int *, int, int);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ usage(char *, char *, int);
void test_A_in_C(int argc, char **argv) {
  int M = 18;
  int N = 18;
  double p = 0.6;
  int print_lattice = 0;
  int argi;
  int **vbonds;
  int **hbonds;
  int **site_marks;
  int num_clusters;
  int *cluster_sizes;
  int C_clno;
  int A[2], A_clno;
  for (argi = 2; argi < argc; argi++) {
    if (sscanf(argv[argi], "M=%d", &M) == 1)
      ;
    else if (sscanf(argv[argi], "N=%d", &N) == 1)
      ;
    else if (sscanf(argv[argi], "MN=%d", &M) == 1)
      N = M;
    else if (sscanf(argv[argi], "p=%lf", &p) == 1)
      ;
    else if (sscanf(argv[argi], "pl=%d", &print_lattice) == 1)
      ;
    else
      usage(argv[0], argv[1], 0);
  }
  if ((M < 3) || (N < 3))
    usage(argv[0], argv[1], 1);
  vbonds = allocate_matrix(M, N, 0);
  hbonds = allocate_matrix(M, N, 0);
  site_marks = allocate_matrix(M, N, '.');
  set_A1(A, M, N);
  populate_bonds(vbonds, hbonds, M, N, p);
  mark_cluster_numbers(site_marks, vbonds, hbonds, M, N, &num_clusters);
  if (print_lattice)
    print_lattice_and_cluster_numbers(site_marks, vbonds, hbonds, M, N);
  sanity_check_cluster_numbers(site_marks, vbonds, hbonds, M, N);
  cluster_sizes = (int *)malloc_or_die(sizeof(int) * num_clusters);
  get_cluster_sizes(site_marks, M, N, num_clusters, cluster_sizes, &C_clno);
  A_clno = site_marks[A[0]][A[1]];
  if (print_lattice) {
    printf("A at %d, %d\n", A[0], A[1]);
    printf("A cluster number = %d\n", A_clno);
    printf("Largest cluster  = %d\n", C_clno);
  }
  printf("%s\n", (A_clno == C_clno) ? "Yes" : "No");
  free_matrix(vbonds, M, N);
  free_matrix(hbonds, M, N);
  free_matrix(site_marks, M, N);
  free(cluster_sizes);
}


x86 assembly (clang, -O0):
<test_A_in_C>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x12,-0x14(%rbp)
movl   $0x12,-0x18(%rbp)
movsd  0xe0b(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1333 <test_A_in_C+0x163>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde1(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    1240 <test_A_in_C+0x70>
jmp    1320 <test_A_in_C+0x150>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbb(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    126c <test_A_in_C+0x9c>
jmp    131b <test_A_in_C+0x14b>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd8e(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    129e <test_A_in_C+0xce>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1316 <test_A_in_C+0x146>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd62(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    12ca <test_A_in_C+0xfa>
jmp    1311 <test_A_in_C+0x141>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd3c(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    12f6 <test_A_in_C+0x126>
jmp    130c <test_A_in_C+0x13c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %edx,%edx
call   10e0 <usage@plt>
jmp    1311 <test_A_in_C+0x141>
jmp    1316 <test_A_in_C+0x146>
jmp    131b <test_A_in_C+0x14b>
jmp    1320 <test_A_in_C+0x150>
jmp    1325 <test_A_in_C+0x155>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1208 <test_A_in_C+0x38>
cmpl   $0x3,-0x14(%rbp)
jl     1347 <test_A_in_C+0x177>
cmpl   $0x3,-0x18(%rbp)
jge    1360 <test_A_in_C+0x190>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x1,%edx
call   10e0 <usage@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %edx,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %edx,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x2e,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,-0x40(%rbp)
lea    -0x5c(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1080 <set_A1@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
call   10a0 <populate_bonds@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    -0x44(%rbp),%r9
call   1060 <mark_cluster_numbers@plt>
cmpl   $0x0,-0x24(%rbp)
je     13fb <test_A_in_C+0x22b>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1090 <print_lattice_and_cluster_numbers@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1050 <sanity_check_cluster_numbers@plt>
movslq -0x44(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc_or_die@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x50(%rbp),%r8
lea    -0x54(%rbp),%r9
call   10f0 <get_cluster_sizes@plt>
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1496 <test_A_in_C+0x2c6>
mov    -0x5c(%rbp),%esi
mov    -0x58(%rbp),%edx
lea    0xbb2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x60(%rbp),%esi
lea    0xbae(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x54(%rbp),%esi
lea    0xbb4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x60(%rbp),%ecx
mov    -0x54(%rbp),%edx
lea    0xbbf(%rip),%rsi
lea    0xbb4(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <free_matrix@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <free_matrix@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <free_matrix@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_A_in_C>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%eax
movl   $0x12,0x8(%rsp)
movl   $0x12,0x4(%rsp)
movabs $0x3fe3333333333333,%rcx
33 e3 3f
mov    %rcx,0x18(%rsp)
movl   $0x0,0xc(%rsp)
mov    $0x12,%esi
mov    $0x12,%edi
cmp    $0x3,%eax
jl     12fe <test_A_in_C+0x11e>
mov    %eax,%ebp
mov    $0x2,%r12d
lea    0xdc4(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r13
jmp    125d <test_A_in_C+0x7d>
mov    0x8(%rsp),%eax
mov    %eax,0x4(%rsp)
add    $0x1,%r12
cmp    %r12,%rbp
je     12f6 <test_A_in_C+0x116>
mov    (%rbx,%r12,8),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
je     1250 <test_A_in_C+0x70>
mov    (%rbx,%r12,8),%rdi
lea    0xd88(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
je     1250 <test_A_in_C+0x70>
mov    (%rbx,%r12,8),%rdi
lea    0xd6d(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
je     1248 <test_A_in_C+0x68>
mov    (%rbx,%r12,8),%rdi
lea    0xd59(%rip),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
je     1250 <test_A_in_C+0x70>
mov    (%rbx,%r12,8),%rdi
lea    0xd43(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
je     1250 <test_A_in_C+0x70>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
xor    %edx,%edx
call   10f0 <usage@plt>
jmp    1250 <test_A_in_C+0x70>
mov    0x8(%rsp),%edi
mov    0x4(%rsp),%esi
cmp    $0x3,%edi
jl     1308 <test_A_in_C+0x128>
cmp    $0x2,%esi
jg     1321 <test_A_in_C+0x141>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
mov    $0x1,%edx
call   10f0 <usage@plt>
mov    0x8(%rsp),%edi
mov    0x4(%rsp),%esi
xor    %edx,%edx
call   10c0 <allocate_matrix@plt>
mov    %rax,%r14
mov    0x8(%rsp),%edi
mov    0x4(%rsp),%esi
xor    %edx,%edx
call   10c0 <allocate_matrix@plt>
mov    %rax,%r15
mov    0x8(%rsp),%edi
mov    0x4(%rsp),%esi
mov    $0x2e,%edx
call   10c0 <allocate_matrix@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
lea    0x20(%rsp),%rdi
call   1090 <set_A1@plt>
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
movsd  0x18(%rsp),%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <populate_bonds@plt>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
lea    0x14(%rsp),%r9
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <mark_cluster_numbers@plt>
cmpl   $0x0,0xc(%rsp)
je     13b7 <test_A_in_C+0x1d7>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <print_lattice_and_cluster_numbers@plt>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <sanity_check_cluster_numbers@plt>
mov    0x14(%rsp),%edi
shl    $0x2,%edi
call   10e0 <malloc_or_die@plt>
mov    %rax,%r12
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0x10(%rsp),%r9
mov    %rbx,%rdi
mov    %rax,%r8
call   1100 <get_cluster_sizes@plt>
movslq 0x20(%rsp),%rsi
mov    (%rbx,%rsi,8),%rax
movslq 0x24(%rsp),%rdx
mov    (%rax,%rdx,4),%ebp
cmpl   $0x0,0xc(%rsp)
je     1441 <test_A_in_C+0x261>
lea    0xbff(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xbfe(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xc01(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    0x10(%rsp),%ebp
lea    0xc06(%rip),%rax
lea    0xc03(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %r14,%rdi
call   1050 <free_matrix@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %r15,%rdi
call   1050 <free_matrix@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
call   1050 <free_matrix@plt>
mov    %r12,%rdi
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"M=%d\00"
@.str.1 = [5 x i8] c"N=%d\00"
@.str.2 = [6 x i8] c"MN=%d\00"
@.str.3 = [6 x i8] c"p=%lf\00"
@.str.4 = [6 x i8] c"pl=%d\00"
@.str.5 = [13 x i8] c"A at %d, %d\0A\00"
@.str.6 = [23 x i8] c"A cluster number = %d\0A\00"
@.str.7 = [23 x i8] c"Largest cluster = %d\0A\00"
@.str.8 = [4 x i8] c"%s\0A\00"
@.str.9 = [4 x i8] c"Yes\00"
@.str.10 = [3 x i8] c"No\00"
define void @test_A_in_C(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32**
%11 = alloca i32**
%12 = alloca i32**
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca [2 x i32]
%17 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 18, i32* %5
store i32 18, i32* %6
store double 6.000000e-01, double* %7
store i32 0, i32* %8
store i32 2, i32* %9
br label %18
18: ; preds = %81, %2
%19 = load i32, i32* %9
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %84
22: ; preds = %18
%23 = load i8**, i8*** %4
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %5)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %31
30: ; preds = %22
br label %80
31: ; preds = %22
%32 = load i8**, i8*** %4
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %40
39: ; preds = %31
br label %79
40: ; preds = %31
%41 = load i8**, i8*** %4
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %50
48: ; preds = %40
%49 = load i32, i32* %5
store i32 %49, i32* %6
br label %78
50: ; preds = %40
%51 = load i8**, i8*** %4
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 (i8*, i8*, ...) @sscanf(i8* %55, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double* %7)
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %59
58: ; preds = %50
br label %77
59: ; preds = %50
%60 = load i8**, i8*** %4
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 (i8*, i8*, ...) @sscanf(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %8)
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %68
67: ; preds = %59
br label %76
68: ; preds = %59
%69 = load i8**, i8*** %4
%70 = getelementptr inbounds i8*, i8** %69, i64 0
%71 = load i8*, i8** %70
%72 = load i8**, i8*** %4
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i32 @usage(i8* %71, i8* %74, i32 0)
br label %76
76: ; preds = %68, %67
br label %77
77: ; preds = %76, %58
br label %78
78: ; preds = %77, %48
br label %79
79: ; preds = %78, %39
br label %80
80: ; preds = %79, %30
br label %81
81: ; preds = %80
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %18
84: ; preds = %18
%85 = load i32, i32* %5
%86 = icmp slt i32 %85, 3
br i1 %86, label %90, label %87
87: ; preds = %84
%88 = load i32, i32* %6
%89 = icmp slt i32 %88, 3
br i1 %89, label %90, label %98
90: ; preds = %87, %84
%91 = load i8**, i8*** %4
%92 = getelementptr inbounds i8*, i8** %91, i64 0
%93 = load i8*, i8** %92
%94 = load i8**, i8*** %4
%95 = getelementptr inbounds i8*, i8** %94, i64 1
%96 = load i8*, i8** %95
%97 = call i32 @usage(i8* %93, i8* %96, i32 1)
br label %98
98: ; preds = %90, %87
%99 = load i32, i32* %5
%100 = load i32, i32* %6
%101 = call i32** @allocate_matrix(i32 %99, i32 %100, i8 signext 0)
store i32** %101, i32*** %10
%102 = load i32, i32* %5
%103 = load i32, i32* %6
%104 = call i32** @allocate_matrix(i32 %102, i32 %103, i8 signext 0)
store i32** %104, i32*** %11
%105 = load i32, i32* %5
%106 = load i32, i32* %6
%107 = call i32** @allocate_matrix(i32 %105, i32 %106, i8 signext 46)
store i32** %107, i32*** %12
%108 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%109 = load i32, i32* %5
%110 = load i32, i32* %6
%111 = call i32 @set_A1(i32* %108, i32 %109, i32 %110)
%112 = load i32**, i32*** %10
%113 = load i32**, i32*** %11
%114 = load i32, i32* %5
%115 = load i32, i32* %6
%116 = load double, double* %7
%117 = call i32 @populate_bonds(i32** %112, i32** %113, i32 %114, i32 %115, double %116)
%118 = load i32**, i32*** %12
%119 = load i32**, i32*** %10
%120 = load i32**, i32*** %11
%121 = load i32, i32* %5
%122 = load i32, i32* %6
%123 = call i32 @mark_cluster_numbers(i32** %118, i32** %119, i32** %120, i32 %121, i32 %122, i32* %13)
%124 = load i32, i32* %8
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %133
126: ; preds = %98
%127 = load i32**, i32*** %12
%128 = load i32**, i32*** %10
%129 = load i32**, i32*** %11
%130 = load i32, i32* %5
%131 = load i32, i32* %6
%132 = call i32 @print_lattice_and_cluster_numbers(i32** %127, i32** %128, i32** %129, i32 %130, i32 %131)
br label %133
133: ; preds = %126, %98
%134 = load i32**, i32*** %12
%135 = load i32**, i32*** %10
%136 = load i32**, i32*** %11
%137 = load i32, i32* %5
%138 = load i32, i32* %6
%139 = call i32 @sanity_check_cluster_numbers(i32** %134, i32** %135, i32** %136, i32 %137, i32 %138)
%140 = load i32, i32* %13
%141 = sext i32 %140 to i64
%142 = mul i64 4, %141
%143 = trunc i64 %142 to i32
%144 = call i64 @malloc_or_die(i32 %143)
%145 = inttoptr i64 %144 to i32*
store i32* %145, i32** %14
%146 = load i32**, i32*** %12
%147 = load i32, i32* %5
%148 = load i32, i32* %6
%149 = load i32, i32* %13
%150 = load i32*, i32** %14
%151 = call i32 @get_cluster_sizes(i32** %146, i32 %147, i32 %148, i32 %149, i32* %150, i32* %15)
%152 = load i32**, i32*** %12
%153 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%154 = load i32, i32* %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i32*, i32** %152, i64 %155
%157 = load i32*, i32** %156
%158 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 1
%159 = load i32, i32* %158
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i32, i32* %157, i64 %160
%162 = load i32, i32* %161
store i32 %162, i32* %17
%163 = load i32, i32* %8
%164 = icmp ne i32 %163, 0
br i1 %164, label %165, label %175
165: ; preds = %133
%166 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%167 = load i32, i32* %166
%168 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 1
%169 = load i32, i32* %168
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %167, i32 %169)
%171 = load i32, i32* %17
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %171)
%173 = load i32, i32* %15
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %173)
br label %175
175: ; preds = %165, %133
%176 = load i32, i32* %17
%177 = load i32, i32* %15
%178 = icmp eq i32 %176, %177
%179 = zext i1 %178 to i64
%180 = select i1 %178, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0)
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %180)
%182 = load i32**, i32*** %10
%183 = load i32, i32* %5
%184 = load i32, i32* %6
%185 = call i32 @free_matrix(i32** %182, i32 %183, i32 %184)
%186 = load i32**, i32*** %11
%187 = load i32, i32* %5
%188 = load i32, i32* %6
%189 = call i32 @free_matrix(i32** %186, i32 %187, i32 %188)
%190 = load i32**, i32*** %12
%191 = load i32, i32* %5
%192 = load i32, i32* %6
%193 = call i32 @free_matrix(i32** %190, i32 %191, i32 %192)
%194 = load i32*, i32** %14
%195 = call i32 @free(i32* %194)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"M=%d\00"
@.str.1 = [5 x i8] c"N=%d\00"
@.str.2 = [6 x i8] c"MN=%d\00"
@.str.3 = [6 x i8] c"p=%lf\00"
@.str.4 = [6 x i8] c"pl=%d\00"
@.str.5 = [13 x i8] c"A at %d, %d\0A\00"
@.str.6 = [23 x i8] c"A cluster number = %d\0A\00"
@.str.7 = [23 x i8] c"Largest cluster = %d\0A\00"
@.str.9 = [4 x i8] c"Yes\00"
@.str.10 = [3 x i8] c"No\00"
define void @test_A_in_C(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x i32]
%10 = bitcast i32* %3 to i8*
store i32 18, i32* %3
%11 = bitcast i32* %4 to i8*
store i32 18, i32* %4
%12 = bitcast double* %5 to i8*
store double 6.000000e-01, double* %5
%13 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = bitcast [2 x i32]* %9 to i8*
%17 = icmp sgt i32 %0, 2
br i1 %17, label %18, label %55
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = zext i32 %0 to i64
br label %21
21: ; preds = %18, %49
%22 = phi i64 [ 2, %18 ], [ %50, %49 ]
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 (i8*, i8*, ...) @sscanf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%26 = icmp eq i32 %25, 1
br i1 %26, label %49, label %27
27: ; preds = %21
%28 = load i8*, i8** %23
%29 = call i32 (i8*, i8*, ...) @sscanf(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%30 = icmp eq i32 %29, 1
br i1 %30, label %49, label %31
31: ; preds = %27
%32 = load i8*, i8** %23
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i32, i32* %3
store i32 %36, i32* %4
br label %49
37: ; preds = %31
%38 = load i8*, i8** %23
%39 = call i32 (i8*, i8*, ...) @sscanf(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double* %5)
%40 = icmp eq i32 %39, 1
br i1 %40, label %49, label %41
41: ; preds = %37
%42 = load i8*, i8** %23
%43 = call i32 (i8*, i8*, ...) @sscanf(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%44 = icmp eq i32 %43, 1
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = load i8*, i8** %1
%47 = load i8*, i8** %19
%48 = call i32 @usage(i8* %46, i8* %47, i32 0)
br label %49
49: ; preds = %21, %35, %45, %41, %37, %27
%50 = add nuw nsw i64 %22, 1
%51 = icmp eq i64 %50, %20
br i1 %51, label %52, label %21
52: ; preds = %49
%53 = load i32, i32* %3
%54 = load i32, i32* %4
br label %55
55: ; preds = %52, %2
%56 = phi i32 [ %54, %52 ], [ 18, %2 ]
%57 = phi i32 [ %53, %52 ], [ 18, %2 ]
%58 = icmp slt i32 %57, 3
%59 = icmp slt i32 %56, 3
%60 = select i1 %58, i1 true, i1 %59
br i1 %60, label %61, label %68
61: ; preds = %55
%62 = load i8*, i8** %1
%63 = getelementptr inbounds i8*, i8** %1, i64 1
%64 = load i8*, i8** %63
%65 = call i32 @usage(i8* %62, i8* %64, i32 1)
%66 = load i32, i32* %3
%67 = load i32, i32* %4
br label %68
68: ; preds = %55, %61
%69 = phi i32 [ %56, %55 ], [ %67, %61 ]
%70 = phi i32 [ %57, %55 ], [ %66, %61 ]
%71 = call i32** @allocate_matrix(i32 %70, i32 %69, i8 signext 0)
%72 = load i32, i32* %3
%73 = load i32, i32* %4
%74 = call i32** @allocate_matrix(i32 %72, i32 %73, i8 signext 0)
%75 = load i32, i32* %3
%76 = load i32, i32* %4
%77 = call i32** @allocate_matrix(i32 %75, i32 %76, i8 signext 46)
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%79 = load i32, i32* %3
%80 = load i32, i32* %4
%81 = call i32 @set_A1(i32* %78, i32 %79, i32 %80)
%82 = load i32, i32* %3
%83 = load i32, i32* %4
%84 = load double, double* %5
%85 = call i32 @populate_bonds(i32** %71, i32** %74, i32 %82, i32 %83, double %84)
%86 = load i32, i32* %3
%87 = load i32, i32* %4
%88 = call i32 @mark_cluster_numbers(i32** %77, i32** %71, i32** %74, i32 %86, i32 %87, i32* %7)
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, 0
br i1 %90, label %95, label %91
91: ; preds = %68
%92 = load i32, i32* %3
%93 = load i32, i32* %4
%94 = call i32 @print_lattice_and_cluster_numbers(i32** %77, i32** %71, i32** %74, i32 %92, i32 %93)
br label %95
95: ; preds = %91, %68
%96 = load i32, i32* %3
%97 = load i32, i32* %4
%98 = call i32 @sanity_check_cluster_numbers(i32** %77, i32** %71, i32** %74, i32 %96, i32 %97)
%99 = load i32, i32* %7
%100 = shl i32 %99, 2
%101 = call i64 @malloc_or_die(i32 %100)
%102 = inttoptr i64 %101 to i32*
%103 = load i32, i32* %3
%104 = load i32, i32* %4
%105 = load i32, i32* %7
%106 = call i32 @get_cluster_sizes(i32** %77, i32 %103, i32 %104, i32 %105, i32* %102, i32* %8)
%107 = load i32, i32* %78
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32*, i32** %77, i64 %108
%110 = load i32*, i32** %109
%111 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%112 = load i32, i32* %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i32, i32* %110, i64 %113
%115 = load i32, i32* %114
%116 = load i32, i32* %6
%117 = icmp eq i32 %116, 0
br i1 %117, label %123, label %118
118: ; preds = %95
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %107, i32 %112)
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %115)
%121 = load i32, i32* %8
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %121)
br label %123
123: ; preds = %118, %95
%124 = load i32, i32* %8
%125 = icmp eq i32 %115, %124
%126 = select i1 %125, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0)
%127 = call i32 @puts(i8* dereferenceable(1) %126)
%128 = load i32, i32* %3
%129 = load i32, i32* %4
%130 = call i32 @free_matrix(i32** %71, i32 %128, i32 %129)
%131 = load i32, i32* %3
%132 = load i32, i32* %4
%133 = call i32 @free_matrix(i32** %74, i32 %131, i32 %132)
%134 = load i32, i32* %3
%135 = load i32, i32* %4
%136 = call i32 @free_matrix(i32** %77, i32 %134, i32 %135)
%137 = call i32 @free(i32* %102)
ret void
}