#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 galois_single_divide(int, unsigned int, unsigned int);
unsigned int jerasure_invert_matrix(int *, int *, unsigned int, unsigned int);
unsigned int jerasure_invertible_matrix(int *, unsigned int, unsigned int);
int *jerasure_matrix_multiply(int *, int *, unsigned int, unsigned int,
                              unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ jerasure_print_matrix(int *, unsigned int, unsigned int,
                                         unsigned int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  unsigned int k, w, i, j, n;
  int *matrix;
  int *matrix_copy;
  int *inverse;
  int *identity;
  if (argc != 3)
    usage(NULL);
  if (sscanf(argv[1], "%d", &k) == 0 || k <= 0)
    usage("Bad k");
  if (sscanf(argv[2], "%d", &w) == 0 || w <= 0 || w > 31)
    usage("Bad w");
  if (k >= (1 << w))
    usage("K too big");
  matrix = (int *)malloc(sizeof(int) * (k * k));
  matrix_copy = (int *)malloc(sizeof(int) * (k * k));
  inverse = (int *)malloc(sizeof(int) * (k * k));
  for (i = 0; i < k; i++) {
    for (j = 0; j < k; j++) {
      n = i ^ ((1 << w) - 1 - j);
      matrix[i * k + j] = (n == 0) ? 0 : galois_single_divide(1, n, w);
    }
  }
  printf("The Cauchy Matrix:\n");
  jerasure_print_matrix(matrix, k, k, w);
  memcpy(matrix_copy, matrix, sizeof(int) * k * k);
  i = jerasure_invertible_matrix(matrix_copy, k, w);
  printf("\nInvertible: %s\n", (i == 1) ? "Yes" : "No");
  if (i == 1) {
    printf("\nInverse:\n");
    memcpy(matrix_copy, matrix, sizeof(int) * k * k);
    i = jerasure_invert_matrix(matrix_copy, inverse, k, w);
    jerasure_print_matrix(inverse, k, k, w);
    identity = jerasure_matrix_multiply(inverse, matrix, k, k, k, k, w);
    printf("\nInverse times matrix (should be identity):\n");
    jerasure_print_matrix(identity, k, k, w);
  }
  return 0;
}


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   $0x3,-0x8(%rbp)
je     11c9 <main+0x29>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe28(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x0,%rax
je     11f5 <main+0x55>
cmpl   $0x0,-0x14(%rbp)
ja     1201 <main+0x61>
lea    0xe07(%rip),%rdi
call   10b0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf0(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x0,%rax
je     1237 <main+0x97>
cmpl   $0x0,-0x18(%rbp)
jbe    1237 <main+0x97>
cmpl   $0x1f,-0x18(%rbp)
jbe    1243 <main+0xa3>
lea    0xdcb(%rip),%rdi
call   10b0 <usage@plt>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jb     1266 <main+0xc6>
lea    0xdae(%rip),%rdi
call   10b0 <usage@plt>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    134c <main+0x1ac>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1339 <main+0x199>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
sub    -0x20(%rbp),%ecx
xor    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1302 <main+0x162>
xor    %eax,%eax
mov    %eax,-0x4c(%rbp)
jmp    1315 <main+0x175>
mov    -0x24(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
call   1030 <galois_single_divide@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edx
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x20(%rbp),%ecx
mov    %ecx,%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12c8 <main+0x128>
jmp    133e <main+0x19e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12b5 <main+0x115>
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1070 <jerasure_print_matrix@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    -0x14(%rbp),%ecx
imul   %rcx,%rax
mov    %eax,%edx
call   1080 <memcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <jerasure_invertible_matrix@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
lea    0xc9d(%rip),%rsi
lea    0xc92(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rsi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1463 <main+0x2c3>
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    -0x14(%rbp),%ecx
imul   %rcx,%rax
mov    %eax,%edx
call   1080 <memcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   10c0 <jerasure_invert_matrix@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1070 <jerasure_print_matrix@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <jerasure_matrix_multiply@plt>
mov    %rax,-0x48(%rbp)
lea    0xc06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1070 <jerasure_print_matrix@plt>
xor    %eax,%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
mov    %rsi,%rbx
cmp    $0x3,%edi
je     11cd <main+0x1d>
xor    %edi,%edi
call   10c0 <usage@plt>
mov    0x8(%rbx),%rdi
lea    0xe28(%rip),%rsi
lea    0x10(%rsp),%rdx
call   10b0 <sscanf@plt>
test   %rax,%rax
je     11ee <main+0x3e>
cmpl   $0x0,0x10(%rsp)
jne    11fa <main+0x4a>
lea    0xe0e(%rip),%rdi
call   10c0 <usage@plt>
mov    0x10(%rbx),%rdi
lea    0xdfb(%rip),%rsi
lea    0x14(%rsp),%rdx
call   10b0 <sscanf@plt>
test   %rax,%rax
je     1221 <main+0x71>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
je     1221 <main+0x71>
cmp    $0x20,%ecx
jb     1231 <main+0x81>
lea    0xde1(%rip),%rdi
call   10c0 <usage@plt>
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%edi
mov    %edi,%eax
shr    %cl,%eax
test   %eax,%eax
je     124d <main+0x9d>
lea    0xdcb(%rip),%rdi
call   10c0 <usage@plt>
mov    0x10(%rsp),%edi
imul   %edi,%edi
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    0x10(%rsp),%edi
imul   %edi,%edi
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
mov    0x10(%rsp),%edi
imul   %edi,%edi
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    0x10(%rsp),%edx
test   %edx,%edx
je     12f0 <main+0x140>
xor    %r13d,%r13d
jmp    1299 <main+0xe9>
nopl   0x0(%rax)
add    $0x1,%r13d
cmp    %edx,%r13d
jae    12f0 <main+0x140>
mov    $0xffffffff,%ebx
xor    %ebp,%ebp
jmp    12d8 <main+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %ecx,%edx
call   1040 <galois_single_divide@plt>
mov    0x10(%rsp),%edx
imul   %r13d,%edx
add    %ebp,%edx
mov    %eax,(%r12,%rdx,4)
add    $0x1,%ebp
mov    0x10(%rsp),%edx
add    $0xffffffff,%ebx
cmp    %edx,%ebp
jae    1290 <main+0xe0>
mov    0x14(%rsp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %ebx,%esi
sub    %eax,%esi
xor    %r13d,%esi
jne    12b0 <main+0x100>
xor    %eax,%eax
jmp    12c0 <main+0x110>
lea    0xd3a(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r12,%rdi
mov    %edx,%esi
call   1080 <jerasure_print_matrix@plt>
mov    0x10(%rsp),%edx
imul   %edx,%edx
shl    $0x2,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1090 <memcpy@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
mov    %r15,%rdi
call   1070 <jerasure_invertible_matrix@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
lea    0xceb(%rip),%rax
lea    0xce8(%rip),%rsi
cmove  %rax,%rsi
lea    0xcc8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%ebp
jne    13e6 <main+0x236>
lea    0xcdc(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%edx
imul   %edx,%edx
shl    $0x2,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1090 <memcpy@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
call   10d0 <jerasure_invert_matrix@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r14,%rdi
mov    %edx,%esi
call   1080 <jerasure_print_matrix@plt>
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%eax
mov    %eax,(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ecx,%edx
mov    %ecx,%r8d
mov    %ecx,%r9d
call   1060 <jerasure_matrix_multiply@plt>
mov    %rax,%rbx
lea    0xc7f(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %rbx,%rdi
mov    %edx,%esi
call   1080 <jerasure_print_matrix@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"Bad k\00"
@.str.2 = [6 x i8] c"Bad w\00"
@.str.3 = [10 x i8] c"K too big\00"
@.str.4 = [20 x i8] c"The Cauchy Matrix:\0A\00"
@.str.5 = [17 x i8] c"\0AInvertible: %s\0A\00"
@.str.6 = [4 x i8] c"Yes\00"
@.str.7 = [3 x i8] c"No\00"
@.str.8 = [11 x i8] c"\0AInverse:\0A\00"
@.str.9 = [45 x i8] c"\0AInverse times matrix (should be identity):\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca 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
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @usage(i8* null)
br label %19
19: ; preds = %17, %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load i32, i32* %6
%27 = icmp ule i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25, %19
%29 = call i32 @usage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i64 @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%35 = icmp eq i64 %34, 0
br i1 %35, label %42, label %36
36: ; preds = %30
%37 = load i32, i32* %7
%38 = icmp ule i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* %7
%41 = icmp ugt i32 %40, 31
br i1 %41, label %42, label %44
42: ; preds = %39, %36, %30
%43 = call i32 @usage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = shl i32 1, %46
%48 = icmp uge i32 %45, %47
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = call i32 @usage(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %44
%52 = load i32, i32* %6
%53 = load i32, i32* %6
%54 = mul i32 %52, %53
%55 = zext i32 %54 to i64
%56 = mul i64 4, %55
%57 = trunc i64 %56 to i32
%58 = call i64 @malloc(i32 %57)
%59 = inttoptr i64 %58 to i32*
store i32* %59, i32** %11
%60 = load i32, i32* %6
%61 = load i32, i32* %6
%62 = mul i32 %60, %61
%63 = zext i32 %62 to i64
%64 = mul i64 4, %63
%65 = trunc i64 %64 to i32
%66 = call i64 @malloc(i32 %65)
%67 = inttoptr i64 %66 to i32*
store i32* %67, i32** %12
%68 = load i32, i32* %6
%69 = load i32, i32* %6
%70 = mul i32 %68, %69
%71 = zext i32 %70 to i64
%72 = mul i64 4, %71
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to i32*
store i32* %75, i32** %13
store i32 0, i32* %8
br label %76
76: ; preds = %114, %51
%77 = load i32, i32* %8
%78 = load i32, i32* %6
%79 = icmp ult i32 %77, %78
br i1 %79, label %80, label %117
80: ; preds = %76
store i32 0, i32* %9
br label %81
81: ; preds = %110, %80
%82 = load i32, i32* %9
%83 = load i32, i32* %6
%84 = icmp ult i32 %82, %83
br i1 %84, label %85, label %113
85: ; preds = %81
%86 = load i32, i32* %8
%87 = load i32, i32* %7
%88 = shl i32 1, %87
%89 = sub nsw i32 %88, 1
%90 = load i32, i32* %9
%91 = sub i32 %89, %90
%92 = xor i32 %86, %91
store i32 %92, i32* %10
%93 = load i32, i32* %10
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %96
95: ; preds = %85
br label %100
96: ; preds = %85
%97 = load i32, i32* %10
%98 = load i32, i32* %7
%99 = call i32 @galois_single_divide(i32 1, i32 %97, i32 %98)
br label %100
100: ; preds = %96, %95
%101 = phi i32 [ 0, %95 ], [ %99, %96 ]
%102 = load i32*, i32** %11
%103 = load i32, i32* %8
%104 = load i32, i32* %6
%105 = mul i32 %103, %104
%106 = load i32, i32* %9
%107 = add i32 %105, %106
%108 = zext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %102, i64 %108
store i32 %101, i32* %109
br label %110
110: ; preds = %100
%111 = load i32, i32* %9
%112 = add i32 %111, 1
store i32 %112, i32* %9
br label %81
113: ; preds = %81
br label %114
114: ; preds = %113
%115 = load i32, i32* %8
%116 = add i32 %115, 1
store i32 %116, i32* %8
br label %76
117: ; preds = %76
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%119 = load i32*, i32** %11
%120 = load i32, i32* %6
%121 = load i32, i32* %6
%122 = load i32, i32* %7
%123 = call i32 @jerasure_print_matrix(i32* %119, i32 %120, i32 %121, i32 %122)
%124 = load i32*, i32** %12
%125 = load i32*, i32** %11
%126 = load i32, i32* %6
%127 = zext i32 %126 to i64
%128 = mul i64 4, %127
%129 = load i32, i32* %6
%130 = zext i32 %129 to i64
%131 = mul i64 %128, %130
%132 = trunc i64 %131 to i32
%133 = call i32 @memcpy(i32* %124, i32* %125, i32 %132)
%134 = load i32*, i32** %12
%135 = load i32, i32* %6
%136 = load i32, i32* %7
%137 = call i32 @jerasure_invertible_matrix(i32* %134, i32 %135, i32 %136)
store i32 %137, i32* %8
%138 = load i32, i32* %8
%139 = icmp eq i32 %138, 1
%140 = zext i1 %139 to i64
%141 = select i1 %139, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %141)
%143 = load i32, i32* %8
%144 = icmp eq i32 %143, 1
br i1 %144, label %145, label %181
145: ; preds = %117
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%147 = load i32*, i32** %12
%148 = load i32*, i32** %11
%149 = load i32, i32* %6
%150 = zext i32 %149 to i64
%151 = mul i64 4, %150
%152 = load i32, i32* %6
%153 = zext i32 %152 to i64
%154 = mul i64 %151, %153
%155 = trunc i64 %154 to i32
%156 = call i32 @memcpy(i32* %147, i32* %148, i32 %155)
%157 = load i32*, i32** %12
%158 = load i32*, i32** %13
%159 = load i32, i32* %6
%160 = load i32, i32* %7
%161 = call i32 @jerasure_invert_matrix(i32* %157, i32* %158, i32 %159, i32 %160)
store i32 %161, i32* %8
%162 = load i32*, i32** %13
%163 = load i32, i32* %6
%164 = load i32, i32* %6
%165 = load i32, i32* %7
%166 = call i32 @jerasure_print_matrix(i32* %162, i32 %163, i32 %164, i32 %165)
%167 = load i32*, i32** %13
%168 = load i32*, i32** %11
%169 = load i32, i32* %6
%170 = load i32, i32* %6
%171 = load i32, i32* %6
%172 = load i32, i32* %6
%173 = load i32, i32* %7
%174 = call i32* @jerasure_matrix_multiply(i32* %167, i32* %168, i32 %169, i32 %170, i32 %171, i32 %172, i32 %173)
store i32* %174, i32** %14
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%176 = load i32*, i32** %14
%177 = load i32, i32* %6
%178 = load i32, i32* %6
%179 = load i32, i32* %7
%180 = call i32 @jerasure_print_matrix(i32* %176, i32 %177, i32 %178, i32 %179)
br label %181
181: ; preds = %145, %117
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"Bad k\00"
@.str.2 = [6 x i8] c"Bad w\00"
@.str.3 = [10 x i8] c"K too big\00"
@.str.5 = [17 x i8] c"\0AInvertible: %s\0A\00"
@.str.6 = [4 x i8] c"Yes\00"
@.str.7 = [3 x i8] c"No\00"
@str = [19 x i8] c"The Cauchy Matrix:\00"
@str.10 = [10 x i8] c"\0AInverse:\00"
@str.11 = [44 x i8] c"\0AInverse times matrix (should be identity):\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @usage(i8* null)
br label %10
10: ; preds = %8, %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = icmp eq i64 %13, 0
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
%17 = select i1 %14, i1 true, i1 %16
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = call i32 @usage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %10, %18
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = call i64 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%24 = icmp eq i64 %23, 0
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 0
%27 = select i1 %24, i1 true, i1 %26
%28 = icmp ugt i32 %25, 31
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %30, label %33
30: ; preds = %20
%31 = call i32 @usage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%32 = load i32, i32* %4
br label %33
33: ; preds = %20, %30
%34 = phi i32 [ %25, %20 ], [ %32, %30 ]
%35 = load i32, i32* %3
%36 = lshr i32 %35, %34
%37 = icmp eq i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %33
%39 = call i32 @usage(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* %3
br label %41
41: ; preds = %38, %33
%42 = phi i32 [ %40, %38 ], [ %35, %33 ]
%43 = shl i32 %42, 2
%44 = mul i32 %43, %42
%45 = call i64 @malloc(i32 %44)
%46 = inttoptr i64 %45 to i32*
%47 = load i32, i32* %3
%48 = shl i32 %47, 2
%49 = mul i32 %48, %47
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to i32*
%52 = load i32, i32* %3
%53 = shl i32 %52, 2
%54 = mul i32 %53, %52
%55 = call i64 @malloc(i32 %54)
%56 = inttoptr i64 %55 to i32*
%57 = load i32, i32* %3
%58 = icmp eq i32 %57, 0
br i1 %58, label %87, label %59
59: ; preds = %41, %84
%60 = phi i32 [ %82, %84 ], [ %57, %41 ]
%61 = phi i32 [ %85, %84 ], [ 0, %41 ]
br label %62
62: ; preds = %59, %74
%63 = phi i32 [ %82, %74 ], [ %60, %59 ]
%64 = phi i32 [ %81, %74 ], [ 0, %59 ]
%65 = load i32, i32* %4
%66 = shl nsw i32 -1, %65
%67 = xor i32 %66, -1
%68 = sub i32 %67, %64
%69 = xor i32 %68, %61
%70 = icmp eq i32 %69, 0
br i1 %70, label %74, label %71
71: ; preds = %62
%72 = call i32 @galois_single_divide(i32 1, i32 %69, i32 %65)
%73 = load i32, i32* %3
br label %74
74: ; preds = %62, %71
%75 = phi i32 [ %73, %71 ], [ %63, %62 ]
%76 = phi i32 [ %72, %71 ], [ 0, %62 ]
%77 = mul i32 %75, %61
%78 = add i32 %77, %64
%79 = zext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %46, i64 %79
store i32 %76, i32* %80
%81 = add nuw i32 %64, 1
%82 = load i32, i32* %3
%83 = icmp ult i32 %81, %82
br i1 %83, label %62, label %84
84: ; preds = %74
%85 = add nuw i32 %61, 1
%86 = icmp ult i32 %85, %82
br i1 %86, label %59, label %87
87: ; preds = %84, %41
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%89 = load i32, i32* %3
%90 = load i32, i32* %4
%91 = call i32 @jerasure_print_matrix(i32* %46, i32 %89, i32 %89, i32 %90)
%92 = load i32, i32* %3
%93 = shl i32 %92, 2
%94 = mul i32 %93, %92
%95 = call i32 @memcpy(i32* %51, i32* %46, i32 %94)
%96 = load i32, i32* %3
%97 = load i32, i32* %4
%98 = call i32 @jerasure_invertible_matrix(i32* %51, i32 %96, i32 %97)
%99 = icmp eq i32 %98, 1
%100 = select i1 %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %100)
br i1 %99, label %102, label %121
102: ; preds = %87
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0))
%104 = load i32, i32* %3
%105 = shl i32 %104, 2
%106 = mul i32 %105, %104
%107 = call i32 @memcpy(i32* %51, i32* %46, i32 %106)
%108 = load i32, i32* %3
%109 = load i32, i32* %4
%110 = call i32 @jerasure_invert_matrix(i32* %51, i32* %56, i32 %108, i32 %109)
%111 = load i32, i32* %3
%112 = load i32, i32* %4
%113 = call i32 @jerasure_print_matrix(i32* %56, i32 %111, i32 %111, i32 %112)
%114 = load i32, i32* %3
%115 = load i32, i32* %4
%116 = call i32* @jerasure_matrix_multiply(i32* %56, i32* %46, i32 %114, i32 %114, i32 %114, i32 %114, i32 %115)
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
%118 = load i32, i32* %3
%119 = load i32, i32* %4
%120 = call i32 @jerasure_print_matrix(i32* %116, i32 %118, i32 %118, i32 %119)
br label %121
121: ; preds = %102, %87
ret i32 0
}