#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
usage(char *s) {
  fprintf(
      stderr,
      "usage: jerasure_08 k w - Example schedule cache usage with RAID-6\n");
  fprintf(stderr, "       \n");
  fprintf(stderr, "       m=2.  k+m must be <= 2^w.  It sets up a RAID-6 "
                  "distribution matrix and encodes\n");
  fprintf(stderr,
          "       k sets of w*%d bytes. It creates a schedule cache for "
          "decoding.\n",
          sizeof(long));
  fprintf(stderr, "       It demonstrates using the schedule cache for both "
                  "encoding and decoding.\n");
  fprintf(stderr, "       Then it demonstrates using jerasure_do_parity() to "
                  "re-encode the first.\n");
  fprintf(stderr, "       coding device\n");
  fprintf(stderr, "       \n");
  fprintf(stderr, "This demonstrates: jerasure_generate_schedule_cache()\n");
  fprintf(stderr,
          "                   jerasure_smart_bitmatrix_to_schedule()\n");
  fprintf(stderr, "                   jerasure_schedule_encode()\n");
  fprintf(stderr, "                   jerasure_schedule_decode_cache()\n");
  fprintf(stderr, "                   jerasure_free_schedule()\n");
  fprintf(stderr, "                   jerasure_free_schedule_cache()\n");
  fprintf(stderr, "                   jerasure_get_stats()\n");
  fprintf(stderr, "                   jerasure_do_parity()\n");
  if (s != NULL)
    fprintf(stderr, "%s\n", s);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xef0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xee2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xf22(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xf4e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xf88(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xfc1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
lea    0xfa9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xfc9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xfed(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0x1005(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
lea    0x1023(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
lea    0x1039(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0x1055(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0x1067(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
je     12c7 <usage+0x1a7>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0x106a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2eb1(%rip),%rbx
mov    (%rbx),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xefb(%rip),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf38(%rip),%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf6b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfac(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfec(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfe6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x100d(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x1038(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x1057(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x107c(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x1099(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x10bc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0x10d5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r14,%r14
je     124b <usage+0x12b>
mov    (%rbx),%edi
lea    0x10e9(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"usage: jerasure_08 k w - Example schedule cache usage with RAID-6\0A\00"
@.str.1 = [9 x i8] c" \0A\00"
@.str.2 = [87 x i8] c" m=2. k+m must be <= 2^w. It sets up a RAID-6 distribution matrix and encodes\0A\00"
@.str.3 = [72 x i8] c" k sets of w*%d bytes. It creates a schedule cache for decoding.\0A\00"
@.str.4 = [81 x i8] c" It demonstrates using the schedule cache for both encoding and decoding.\0A\00"
@.str.5 = [80 x i8] c" Then it demonstrates using jerasure_do_parity() to re-encode the first.\0A\00"
@.str.6 = [22 x i8] c" coding device\0A\00"
@.str.7 = [55 x i8] c"This demonstrates: jerasure_generate_schedule_cache()\0A\00"
@.str.8 = [59 x i8] c" jerasure_smart_bitmatrix_to_schedule()\0A\00"
@.str.9 = [47 x i8] c" jerasure_schedule_encode()\0A\00"
@.str.10 = [53 x i8] c" jerasure_schedule_decode_cache()\0A\00"
@.str.11 = [45 x i8] c" jerasure_free_schedule()\0A\00"
@.str.12 = [51 x i8] c" jerasure_free_schedule_cache()\0A\00"
@.str.13 = [41 x i8] c" jerasure_get_stats()\0A\00"
@.str.14 = [41 x i8] c" jerasure_do_parity()\0A\00"
@.str.15 = [4 x i8] c"%s\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i64 8)
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%35 = load i8*, i8** %2
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %41
37: ; preds = %1
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %2
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %37, %1
%42 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"usage: jerasure_08 k w - Example schedule cache usage with RAID-6\0A\00"
@.str.1 = [9 x i8] c" \0A\00"
@.str.2 = [87 x i8] c" m=2. k+m must be <= 2^w. It sets up a RAID-6 distribution matrix and encodes\0A\00"
@.str.3 = [72 x i8] c" k sets of w*%d bytes. It creates a schedule cache for decoding.\0A\00"
@.str.4 = [81 x i8] c" It demonstrates using the schedule cache for both encoding and decoding.\0A\00"
@.str.5 = [80 x i8] c" Then it demonstrates using jerasure_do_parity() to re-encode the first.\0A\00"
@.str.6 = [22 x i8] c" coding device\0A\00"
@.str.7 = [55 x i8] c"This demonstrates: jerasure_generate_schedule_cache()\0A\00"
@.str.8 = [59 x i8] c" jerasure_smart_bitmatrix_to_schedule()\0A\00"
@.str.9 = [47 x i8] c" jerasure_schedule_encode()\0A\00"
@.str.10 = [53 x i8] c" jerasure_schedule_decode_cache()\0A\00"
@.str.11 = [45 x i8] c" jerasure_free_schedule()\0A\00"
@.str.12 = [51 x i8] c" jerasure_free_schedule_cache()\0A\00"
@.str.13 = [41 x i8] c" jerasure_get_stats()\0A\00"
@.str.14 = [41 x i8] c" jerasure_do_parity()\0A\00"
@.str.15 = [4 x i8] c"%s\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i64 8)
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%34 = icmp eq i8* %0, null
br i1 %34, label %38, label %35
35: ; preds = %1
%36 = load i32, i32* @stderr
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %0)
br label %38
38: ; preds = %35, %1
%39 = tail call i32 @exit(i32 1)
unreachable
}