#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*/ abort();
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");
    abort();
  }
  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     1178 <jerasure_free_schedule_cache+0x38>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1040 <abort@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11fd <jerasure_free_schedule_cache+0xbd>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d0 <jerasure_free_schedule_cache+0x90>
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    1197 <jerasure_free_schedule_cache+0x57>
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    117f <jerasure_free_schedule_cache+0x3f>
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    11fd <jerasure_free_schedule_cache+0xbd>
cmp    $0xffffffff,%edi
jl     11e5 <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    11b0 <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     11e5 <jerasure_free_schedule_cache+0xa5>
test   %rbx,%rbx
je     1190 <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    11d0 <jerasure_free_schedule_cache+0x90>
jmp    1193 <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    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1040 <abort@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 %15
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 = call i32 (...) @abort()
unreachable
15: ; preds = %3
store i32 0, i32* %7
br label %16
16: ; preds = %56, %15
%17 = load i32, i32* %7
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %18, %19
%21 = icmp slt i32 %17, %20
br i1 %21, label %22, label %59
22: ; preds = %16
store i32 0, i32* %8
br label %23
23: ; preds = %40, %22
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %43
27: ; preds = %23
%28 = load i32***, i32**** %6
%29 = load i32, i32* %7
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %30, %31
%33 = mul nsw i32 %29, %32
%34 = load i32, i32* %8
%35 = add nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32**, i32*** %28, i64 %36
%38 = load i32**, i32*** %37
%39 = call i32 @jerasure_free_schedule(i32** %38)
br label %40
40: ; preds = %27
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %23
43: ; preds = %23
%44 = load i32***, i32**** %6
%45 = load i32, i32* %7
%46 = load i32, i32* %4
%47 = load i32, i32* %5
%48 = add nsw i32 %46, %47
%49 = mul nsw i32 %45, %48
%50 = load i32, i32* %7
%51 = add nsw i32 %49, %50
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32**, i32*** %44, i64 %52
%54 = load i32**, i32*** %53
%55 = call i32 @jerasure_free_schedule(i32** %54)
br label %56
56: ; preds = %43
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %16
59: ; preds = %16
%60 = load i32***, i32**** %6
%61 = call i32 @free(i32*** %60)
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 %37
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 %16
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 = tail call i32 (...) @abort()
unreachable
16: ; preds = %8, %29
%17 = phi i64 [ 0, %8 ], [ %35, %29 ]
%18 = icmp eq i64 %17, 0
br i1 %18, label %29, label %19
19: ; preds = %16
%20 = mul nsw i64 %17, %9
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %27, %21 ]
%23 = add nsw i64 %22, %20
%24 = getelementptr inbounds i32**, i32*** %2, i64 %23
%25 = load i32**, i32*** %24
%26 = tail call i32 @jerasure_free_schedule(i32** %25)
%27 = add nuw nsw i64 %22, 1
%28 = icmp eq i64 %27, %17
br i1 %28, label %29, label %21
29: ; preds = %21, %16
%30 = phi i64 [ 0, %16 ], [ %20, %21 ]
%31 = add nsw i64 %30, %17
%32 = getelementptr inbounds i32**, i32*** %2, i64 %31
%33 = load i32**, i32*** %32
%34 = tail call i32 @jerasure_free_schedule(i32** %33)
%35 = add nuw nsw i64 %17, 1
%36 = icmp eq i64 %35, %11
br i1 %36, label %37, label %16
37: ; preds = %29, %5
%38 = tail call i32 @free(i32*** %2)
ret void
}