#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*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(int ***);
int /*<<< orphan*/ jerasure_free_schedule(int **);
int /*<<< orphan*/ stderr;
void jerasure_free_schedule_cache(int k, int m, int ***cache) {
  int e1, e2;
  if (m != 2) {
    fprintf(stderr, "jerasure_free_schedule_cache(): m must equal 2\n");
    fflush(stderr);
    exit(1);
  }
  for (e1 = 0; e1 < k + m; e1++) {
    for (e2 = 0; e2 < e1; e2++) {
      jerasure_free_schedule(cache[e1 * (k + m) + e2]);
    }
    jerasure_free_schedule(cache[e1 * (k + m) + e1]);
  }
  free(cache);
}


x86 assembly (clang, -O0):
<jerasure_free_schedule_cache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1199 <jerasure_free_schedule_cache+0x49>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    121e <jerasure_free_schedule_cache+0xce>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f1 <jerasure_free_schedule_cache+0xa1>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    -0x8(%rbp),%edx
imul   %edx,%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <jerasure_free_schedule@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b8 <jerasure_free_schedule_cache+0x68>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    -0x8(%rbp),%edx
imul   %edx,%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <jerasure_free_schedule@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a0 <jerasure_free_schedule_cache+0x50>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jerasure_free_schedule_cache>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x8(%rsp)
cmp    $0x2,%esi
jne    120d <jerasure_free_schedule_cache+0xbd>
cmp    $0xffffffff,%edi
jl     11f5 <jerasure_free_schedule_cache+0xa5>
add    $0x2,%edi
movslq %edi,%rax
cmp    $0x2,%eax
mov    $0x1,%r13d
cmovge %eax,%r13d
mov    %rax,0x10(%rsp)
lea    0x0(,%rax,8),%r12
xor    %ebx,%ebx
mov    0x8(%rsp),%rbp
jmp    11c0 <jerasure_free_schedule_cache+0x70>
xchg   %ax,%ax
xor    %r14d,%r14d
add    %rbx,%r14
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%rdi
call   1060 <jerasure_free_schedule@plt>
add    $0x1,%rbx
add    %r12,%rbp
cmp    %r13,%rbx
je     11f5 <jerasure_free_schedule_cache+0xa5>
test   %rbx,%rbx
je     11a0 <jerasure_free_schedule_cache+0x50>
mov    %rbx,%r14
imul   0x10(%rsp),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r15,8),%rdi
call   1060 <jerasure_free_schedule@plt>
add    $0x1,%r15
cmp    %r15,%rbx
jne    11e0 <jerasure_free_schedule_cache+0x90>
jmp    11a3 <jerasure_free_schedule_cache+0x53>
mov    0x8(%rsp),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    0x2dcc(%rip),%rbx
mov    (%rbx),%edi
lea    0xde3(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"jerasure_free_schedule_cache(): m must equal 2\0A\00"
define void @jerasure_free_schedule_cache(i32 %0, i32 %1, i32*** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32***
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32*** %2, i32**** %6
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 @fflush(i32 %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %3
store i32 0, i32* %7
br label %18
18: ; preds = %58, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = icmp slt i32 %19, %22
br i1 %23, label %24, label %61
24: ; preds = %18
store i32 0, i32* %8
br label %25
25: ; preds = %42, %24
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %45
29: ; preds = %25
%30 = load i32***, i32**** %6
%31 = load i32, i32* %7
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = add nsw i32 %32, %33
%35 = mul nsw i32 %31, %34
%36 = load i32, i32* %8
%37 = add nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32**, i32*** %30, i64 %38
%40 = load i32**, i32*** %39
%41 = call i32 @jerasure_free_schedule(i32** %40)
br label %42
42: ; preds = %29
%43 = load i32, i32* %8
%44 = add nsw i32 %43, 1
store i32 %44, i32* %8
br label %25
45: ; preds = %25
%46 = load i32***, i32**** %6
%47 = load i32, i32* %7
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = add nsw i32 %48, %49
%51 = mul nsw i32 %47, %50
%52 = load i32, i32* %7
%53 = add nsw i32 %51, %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32**, i32*** %46, i64 %54
%56 = load i32**, i32*** %55
%57 = call i32 @jerasure_free_schedule(i32** %56)
br label %58
58: ; preds = %45
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %18
61: ; preds = %18
%62 = load i32***, i32**** %6
%63 = call i32 @free(i32*** %62)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"jerasure_free_schedule_cache(): m must equal 2\0A\00"
define void @jerasure_free_schedule_cache(i32 %0, i32 %1, i32*** nocapture %2) {
%4 = icmp eq i32 %1, 2
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = add i32 %0, 2
%7 = icmp sgt i32 %0, -2
br i1 %7, label %8, label %39
8: ; preds = %5
%9 = sext i32 %6 to i64
%10 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%11 = zext i32 %10 to i64
br label %18
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fflush(i32 %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %8, %31
%19 = phi i64 [ 0, %8 ], [ %37, %31 ]
%20 = icmp eq i64 %19, 0
br i1 %20, label %31, label %21
21: ; preds = %18
%22 = mul nsw i64 %19, %9
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %29, %23 ]
%25 = add nsw i64 %24, %22
%26 = getelementptr inbounds i32**, i32*** %2, i64 %25
%27 = load i32**, i32*** %26
%28 = tail call i32 @jerasure_free_schedule(i32** %27)
%29 = add nuw nsw i64 %24, 1
%30 = icmp eq i64 %29, %19
br i1 %30, label %31, label %23
31: ; preds = %23, %18
%32 = phi i64 [ 0, %18 ], [ %22, %23 ]
%33 = add nsw i64 %32, %19
%34 = getelementptr inbounds i32**, i32*** %2, i64 %33
%35 = load i32**, i32*** %34
%36 = tail call i32 @jerasure_free_schedule(i32** %35)
%37 = add nuw nsw i64 %19, 1
%38 = icmp eq i64 %37, %11
br i1 %38, label %39, label %18
39: ; preds = %31, %5
%40 = tail call i32 @free(i32*** %2)
ret void
}