#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_matrix(int **, int, int);
int /*<<< orphan*/ mark_one_cluster(int **, int **, int **, int, int, int *,
                                    char);
int /*<<< orphan*/ plot_lattice_and_one_cluster(int **, int **, int **, int,
                                                int, int *, int *, char *);
int /*<<< orphan*/ plot_one_cluster_compactly(int **, int **, int **, int, int,
                                              int *, int *, char *);
int /*<<< orphan*/ populate_bonds(int **, int **, int, int, double);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ set_A1_A2(int *, int *, int, int);
int sscanf(char *, char *, ...);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ usage(char *, char *, int);
void test_plot_cluster(int argc, char **argv) {
  int M = 200;
  int N = 200;
  double p = 0.6;
  int argi;
  int **vbonds;
  int **hbonds;
  int **site_marks;
  int A1[2];
  int A2[2];
  char *image_file_name = "p2.ppm";
  int compact = 0;
  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 (strncmp(argv[argi], "f=", 2) == 0)
      image_file_name = &argv[argi][2];
    else if (sscanf(argv[argi], "c=%d", &compact) == 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_A2(A1, A2, M, N);
  populate_bonds(vbonds, hbonds, M, N, p);
  mark_one_cluster(site_marks, vbonds, hbonds, M, N, A1, '@');
  if (compact)
    plot_one_cluster_compactly(site_marks, vbonds, hbonds, M, N, A1, A2,
                               image_file_name);
  else
    plot_lattice_and_one_cluster(site_marks, vbonds, hbonds, M, N, A1, A2,
                                 image_file_name);
  printf("Wrote %s.\n", image_file_name);
  free_matrix(vbonds, M, N);
  free_matrix(hbonds, M, N);
  free_matrix(site_marks, M, N);
}


x86 assembly (clang, -O0):
<test_plot_cluster>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc8,-0x14(%rbp)
movl   $0xc8,-0x18(%rbp)
movsd  0xe2b(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe27(%rip),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1363 <test_plot_cluster+0x1b3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfd(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    122b <test_plot_cluster+0x7b>
jmp    1350 <test_plot_cluster+0x1a0>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd7(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    1257 <test_plot_cluster+0xa7>
jmp    134b <test_plot_cluster+0x19b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdaa(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    1289 <test_plot_cluster+0xd9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1346 <test_plot_cluster+0x196>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd7e(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    12b5 <test_plot_cluster+0x105>
jmp    1341 <test_plot_cluster+0x191>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd58(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    12f5 <test_plot_cluster+0x145>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x2,%rax
mov    %rax,-0x58(%rbp)
jmp    133c <test_plot_cluster+0x18c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd1b(%rip),%rsi
lea    -0x5c(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    1321 <test_plot_cluster+0x171>
jmp    1337 <test_plot_cluster+0x187>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %edx,%edx
call   10d0 <usage@plt>
jmp    133c <test_plot_cluster+0x18c>
jmp    1341 <test_plot_cluster+0x191>
jmp    1346 <test_plot_cluster+0x196>
jmp    134b <test_plot_cluster+0x19b>
jmp    1350 <test_plot_cluster+0x1a0>
jmp    1355 <test_plot_cluster+0x1a5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f3 <test_plot_cluster+0x43>
cmpl   $0x3,-0x14(%rbp)
jl     1377 <test_plot_cluster+0x1c7>
cmpl   $0x3,-0x18(%rbp)
jge    1390 <test_plot_cluster+0x1e0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x1,%edx
call   10d0 <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    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1080 <set_A1_A2@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    -0x48(%rbp),%r9
movl   $0x40,(%rsp)
call   1070 <mark_one_cluster@plt>
cmpl   $0x0,-0x5c(%rbp)
je     1450 <test_plot_cluster+0x2a0>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r10
mov    -0x58(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <plot_one_cluster_compactly@plt>
jmp    147d <test_plot_cluster+0x2cd>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r10
mov    -0x58(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <plot_lattice_and_one_cluster@plt>
mov    -0x58(%rbp),%rsi
lea    0xba0(%rip),%rdi
call   1090 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <free_matrix@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <free_matrix@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <free_matrix@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_plot_cluster>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
movl   $0xc8,0x10(%rsp)
movl   $0xc8,0xc(%rsp)
movabs $0x3fe3333333333333,%rax
33 e3 3f
mov    %rax,0x20(%rsp)
movl   $0x0,0x14(%rsp)
cmp    $0x3,%edi
jl     12fe <test_plot_cluster+0x14e>
mov    %edi,%r14d
lea    0xe05(%rip),%rax
mov    %rax,0x18(%rsp)
mov    $0x2,%r13d
lea    0xdfa(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%rbp
jmp    123d <test_plot_cluster+0x8d>
mov    0x10(%rsp),%eax
mov    %eax,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    %r13,%r14
je     1316 <test_plot_cluster+0x166>
mov    (%rbx,%r13,8),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1230 <test_plot_cluster+0x80>
mov    (%rbx,%r13,8),%rdi
lea    0xdaf(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1230 <test_plot_cluster+0x80>
mov    (%rbx,%r13,8),%rdi
lea    0xd94(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1219 <test_plot_cluster+0x69>
mov    (%rbx,%r13,8),%rdi
lea    0xd80(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1230 <test_plot_cluster+0x80>
mov    (%rbx,%r13,8),%rdi
lea    0xd6a(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
mov    (%rbx,%r13,8),%rdi
test   %rax,%rax
je     12f0 <test_plot_cluster+0x140>
lea    0xd53(%rip),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
je     1230 <test_plot_cluster+0x80>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
xor    %edx,%edx
call   10d0 <usage@plt>
jmp    1230 <test_plot_cluster+0x80>
add    $0x2,%rdi
mov    %rdi,0x18(%rsp)
jmp    1230 <test_plot_cluster+0x80>
lea    0xcfb(%rip),%r13
mov    $0xc8,%esi
mov    $0xc8,%edi
cmp    $0x3,%edi
jge    1328 <test_plot_cluster+0x178>
jmp    132d <test_plot_cluster+0x17d>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x18(%rsp),%r13
cmp    $0x3,%edi
jl     132d <test_plot_cluster+0x17d>
cmp    $0x2,%esi
jg     1346 <test_plot_cluster+0x196>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
mov    $0x1,%edx
call   10d0 <usage@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,%rbp
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
mov    $0x2e,%edx
call   10b0 <allocate_matrix@plt>
mov    %rax,%r14
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0x28(%rsp),%r12
lea    0x30(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1080 <set_A1_A2@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <populate_bonds@plt>
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
sub    $0x8,%rsp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r12,%r9
push   $0x40
call   1070 <mark_one_cluster@plt>
add    $0x10,%rsp
cmpl   $0x0,0x14(%rsp)
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
lea    0x28(%rsp),%r9
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
je     13fa <test_plot_cluster+0x24a>
push   %r13
push   %r15
call   1030 <plot_one_cluster_compactly@plt>
jmp    1403 <test_plot_cluster+0x253>
push   %r13
push   %r15
call   1060 <plot_lattice_and_one_cluster@plt>
add    $0x10,%rsp
lea    0xc12(%rip),%rdi
mov    %r13,%rsi
call   1090 <printf@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
call   1050 <free_matrix@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbp,%rdi
call   1050 <free_matrix@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %r14,%rdi
call   1050 <free_matrix@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"p2.ppm\00"
@.str.1 = [5 x i8] c"M=%d\00"
@.str.2 = [5 x i8] c"N=%d\00"
@.str.3 = [6 x i8] c"MN=%d\00"
@.str.4 = [6 x i8] c"p=%lf\00"
@.str.5 = [3 x i8] c"f=\00"
@.str.6 = [5 x i8] c"c=%d\00"
@.str.7 = [11 x i8] c"Wrote %s.\0A\00"
define void @test_plot_cluster(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
store i32 200, i32* %3
%10 = bitcast i32* %4 to i8*
store i32 200, i32* %4
%11 = bitcast double* %5 to i8*
store double 6.000000e-01, double* %5
%12 = bitcast [2 x i32]* %6 to i8*
%13 = bitcast [2 x i32]* %7 to i8*
%14 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%15 = icmp sgt i32 %0, 2
br i1 %15, label %16, label %61
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = zext i32 %0 to i64
br label %19
19: ; preds = %16, %54
%20 = phi i64 [ 2, %16 ], [ %56, %54 ]
%21 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %16 ], [ %55, %54 ]
%22 = getelementptr inbounds i8*, i8** %1, i64 %20
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%25 = icmp eq i32 %24, 1
br i1 %25, label %54, label %26
26: ; preds = %19
%27 = load i8*, i8** %22
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%29 = icmp eq i32 %28, 1
br i1 %29, label %54, label %30
30: ; preds = %26
%31 = load i8*, i8** %22
%32 = call i32 (i8*, i8*, ...) @sscanf(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i32, i32* %3
store i32 %35, i32* %4
br label %54
36: ; preds = %30
%37 = load i8*, i8** %22
%38 = call i32 (i8*, i8*, ...) @sscanf(i8* %37, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double* %5)
%39 = icmp eq i32 %38, 1
br i1 %39, label %54, label %40
40: ; preds = %36
%41 = load i8*, i8** %22
%42 = call i64 @strncmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%43 = icmp eq i64 %42, 0
%44 = load i8*, i8** %22
br i1 %43, label %45, label %47
45: ; preds = %40
%46 = getelementptr inbounds i8, i8* %44, i64 2
br label %54
47: ; preds = %40
%48 = call i32 (i8*, i8*, ...) @sscanf(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32* %8)
%49 = icmp eq i32 %48, 1
br i1 %49, label %54, label %50
50: ; preds = %47
%51 = load i8*, i8** %1
%52 = load i8*, i8** %17
%53 = call i32 @usage(i8* %51, i8* %52, i32 0)
br label %54
54: ; preds = %19, %34, %45, %47, %50, %36, %26
%55 = phi i8* [ %21, %19 ], [ %21, %26 ], [ %21, %34 ], [ %21, %36 ], [ %46, %45 ], [ %21, %47 ], [ %21, %50 ]
%56 = add nuw nsw i64 %20, 1
%57 = icmp eq i64 %56, %18
br i1 %57, label %58, label %19
58: ; preds = %54
%59 = load i32, i32* %3
%60 = load i32, i32* %4
br label %61
61: ; preds = %58, %2
%62 = phi i32 [ 200, %2 ], [ %60, %58 ]
%63 = phi i32 [ 200, %2 ], [ %59, %58 ]
%64 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ], [ %55, %58 ]
%65 = icmp slt i32 %63, 3
%66 = icmp slt i32 %62, 3
%67 = select i1 %65, i1 true, i1 %66
br i1 %67, label %68, label %75
68: ; preds = %61
%69 = load i8*, i8** %1
%70 = getelementptr inbounds i8*, i8** %1, i64 1
%71 = load i8*, i8** %70
%72 = call i32 @usage(i8* %69, i8* %71, i32 1)
%73 = load i32, i32* %3
%74 = load i32, i32* %4
br label %75
75: ; preds = %61, %68
%76 = phi i32 [ %62, %61 ], [ %74, %68 ]
%77 = phi i32 [ %63, %61 ], [ %73, %68 ]
%78 = call i32** @allocate_matrix(i32 %77, i32 %76, i8 signext 0)
%79 = load i32, i32* %3
%80 = load i32, i32* %4
%81 = call i32** @allocate_matrix(i32 %79, i32 %80, i8 signext 0)
%82 = load i32, i32* %3
%83 = load i32, i32* %4
%84 = call i32** @allocate_matrix(i32 %82, i32 %83, i8 signext 46)
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%86 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%87 = load i32, i32* %3
%88 = load i32, i32* %4
%89 = call i32 @set_A1_A2(i32* %85, i32* %86, i32 %87, i32 %88)
%90 = load i32, i32* %3
%91 = load i32, i32* %4
%92 = load double, double* %5
%93 = call i32 @populate_bonds(i32** %78, i32** %81, i32 %90, i32 %91, double %92)
%94 = load i32, i32* %3
%95 = load i32, i32* %4
%96 = call i32 @mark_one_cluster(i32** %84, i32** %78, i32** %81, i32 %94, i32 %95, i32* %85, i8 signext 64)
%97 = load i32, i32* %8
%98 = icmp eq i32 %97, 0
%99 = load i32, i32* %3
%100 = load i32, i32* %4
br i1 %98, label %103, label %101
101: ; preds = %75
%102 = call i32 @plot_one_cluster_compactly(i32** %84, i32** %78, i32** %81, i32 %99, i32 %100, i32* %85, i32* %86, i8* %64)
br label %105
103: ; preds = %75
%104 = call i32 @plot_lattice_and_one_cluster(i32** %84, i32** %78, i32** %81, i32 %99, i32 %100, i32* %85, i32* %86, i8* %64)
br label %105
105: ; preds = %103, %101
%106 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %64)
%107 = load i32, i32* %3
%108 = load i32, i32* %4
%109 = call i32 @free_matrix(i32** %78, i32 %107, i32 %108)
%110 = load i32, i32* %3
%111 = load i32, i32* %4
%112 = call i32 @free_matrix(i32** %81, i32 %110, i32 %111)
%113 = load i32, i32* %3
%114 = load i32, i32* %4
%115 = call i32 @free_matrix(i32** %84, i32 %113, i32 %114)
ret void
}