void test_reconstruct(void) {
  printf("%s:\n", __FUNCTION__);
  {
    int erases[] = {0};
    int err;
    err = test_one_decoding_13_6(erases, 0);
    assert(0 == err);
  }
  {
    int erases[] = {0, 1, 9, 10 + 2, 10 + 4, 10 + 9};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 == err);
  }
  {
    int erases[] = {0, 9, (10 * 6) + 1, 10 + 2, 10 + 9, (10 * 6) + 3 + 2};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 == err);
  }
  {
    int erases[] = {11, 12, 10, 9};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 == err);
  }
  {
    int erases[] = {0, 1, 4, 8};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 != err);
  }
  {
    int erases[] = {10, 11, 14, 18};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 != err);
  }
  {
    int erases[] = {0, 1, 4, 8, 10, 11, 14, 18};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 != err);
  }
  {
    int erases[] = {
        11, 12, 10, 9, (10 * 6) + 3 + 0, (10 * 6) + 3 + 1, (10 * 6) + 3 + 2};
    int erases_count = sizeof(erases) / sizeof(int);
    int err;
    err = test_one_decoding_13_6(erases, erases_count);
    assert(0 != err);
  }
}


x86 assembly (clang, -O0):
<test_reconstruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    0xeae(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xe85(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe82(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7f(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xe58(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe55(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe52(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0x6,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xe4b(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe48(%rip),%rax
mov    %rax,-0x58(%rbp)
movl   $0x4,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x68(%rbp)
xor    %eax,%eax
cmp    -0x68(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xe19(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xe16(%rip),%rax
mov    %rax,-0x78(%rbp)
movl   $0x4,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x88(%rbp)
xor    %eax,%eax
cmp    -0x88(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xddb(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xdd5(%rip),%rax
mov    %rax,-0x98(%rbp)
movl   $0x4,-0xa4(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0xa8(%rbp)
xor    %eax,%eax
cmp    -0xa8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xd94(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xd8e(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    0xd88(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xd82(%rip),%rax
mov    %rax,-0xb8(%rbp)
movl   $0x8,-0xd4(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0xd8(%rbp)
xor    %eax,%eax
cmp    -0xd8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
mov    0xcd1(%rip),%rax
mov    %rax,-0x100(%rbp)
mov    0xccb(%rip),%rax
mov    %rax,-0xf8(%rbp)
mov    0xcc5(%rip),%rax
mov    %rax,-0xf0(%rbp)
mov    0xcc0(%rip),%eax
mov    %eax,-0xe8(%rbp)
movl   $0x7,-0x104(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x104(%rbp),%esi
mov    $0x0,%al
call   1050 <test_one_decoding_13_6@plt>
mov    %eax,-0x108(%rbp)
xor    %eax,%eax
cmp    -0x108(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1060 <assert@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_reconstruct>:
sub    $0x28,%rsp
lea    0xec5(%rip),%rdi
lea    0xec3(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1050 <assert@plt>
mov    0xebe(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1050 <assert@plt>
mov    0xea9(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xe8d(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1050 <assert@plt>
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1050 <assert@plt>
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
xor    %eax,%eax
call   1050 <assert@plt>
movaps 0xe72(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
xor    %eax,%eax
call   1050 <assert@plt>
movaps 0xe69(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
xor    %eax,%eax
call   1050 <assert@plt>
movups 0xde0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xdc8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <test_one_decoding_13_6@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
xor    %eax,%eax
call   1050 <assert@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s:\0A\00"
@__FUNCTION__.test_reconstruct = [17 x i8] c"test_reconstruct\00"
@__const.test_reconstruct.erases = [6 x i32] [i32 0, i32 1, i32 9, i32 12, i32 14, i32 19]
@__const.test_reconstruct.erases.1 = [6 x i32] [i32 0, i32 9, i32 61, i32 12, i32 19, i32 65]
@__const.test_reconstruct.erases.2 = [4 x i32] [i32 11, i32 12, i32 10, i32 9]
@__const.test_reconstruct.erases.3 = [4 x i32] [i32 0, i32 1, i32 4, i32 8]
@__const.test_reconstruct.erases.4 = [4 x i32] [i32 10, i32 11, i32 14, i32 18]
@__const.test_reconstruct.erases.5 = [8 x i32] [i32 0, i32 1, i32 4, i32 8, i32 10, i32 11, i32 14, i32 18]
@__const.test_reconstruct.erases.6 = [7 x i32] [i32 11, i32 12, i32 10, i32 9, i32 63, i32 64, i32 65]
define void @test_reconstruct() {
%1 = alloca [1 x i32]
%2 = alloca i32
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [6 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [4 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [4 x i32]
%13 = alloca i32
%14 = alloca i32
%15 = alloca [4 x i32]
%16 = alloca i32
%17 = alloca i32
%18 = alloca [8 x i32]
%19 = alloca i32
%20 = alloca i32
%21 = alloca [7 x i32]
%22 = alloca i32
%23 = alloca i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_reconstruct, i64 0, i64 0))
%25 = bitcast [1 x i32]* %1 to i8*
%26 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%27 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %26, i32 0)
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = icmp eq i32 0, %28
%30 = zext i1 %29 to i32
%31 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %30)
%32 = bitcast [6 x i32]* %3 to i8*
store i32 6, i32* %4
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%34 = load i32, i32* %4
%35 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %33, i32 %34)
store i32 %35, i32* %5
%36 = load i32, i32* %5
%37 = icmp eq i32 0, %36
%38 = zext i1 %37 to i32
%39 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %38)
%40 = bitcast [6 x i32]* %6 to i8*
store i32 6, i32* %7
%41 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%42 = load i32, i32* %7
%43 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %41, i32 %42)
store i32 %43, i32* %8
%44 = load i32, i32* %8
%45 = icmp eq i32 0, %44
%46 = zext i1 %45 to i32
%47 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %46)
%48 = bitcast [4 x i32]* %9 to i8*
store i32 4, i32* %10
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%50 = load i32, i32* %10
%51 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %49, i32 %50)
store i32 %51, i32* %11
%52 = load i32, i32* %11
%53 = icmp eq i32 0, %52
%54 = zext i1 %53 to i32
%55 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %54)
%56 = bitcast [4 x i32]* %12 to i8*
store i32 4, i32* %13
%57 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
%58 = load i32, i32* %13
%59 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %57, i32 %58)
store i32 %59, i32* %14
%60 = load i32, i32* %14
%61 = icmp ne i32 0, %60
%62 = zext i1 %61 to i32
%63 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %62)
%64 = bitcast [4 x i32]* %15 to i8*
store i32 4, i32* %16
%65 = getelementptr inbounds [4 x i32], [4 x i32]* %15, i64 0, i64 0
%66 = load i32, i32* %16
%67 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %65, i32 %66)
store i32 %67, i32* %17
%68 = load i32, i32* %17
%69 = icmp ne i32 0, %68
%70 = zext i1 %69 to i32
%71 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %70)
%72 = bitcast [8 x i32]* %18 to i8*
store i32 8, i32* %19
%73 = getelementptr inbounds [8 x i32], [8 x i32]* %18, i64 0, i64 0
%74 = load i32, i32* %19
%75 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %73, i32 %74)
store i32 %75, i32* %20
%76 = load i32, i32* %20
%77 = icmp ne i32 0, %76
%78 = zext i1 %77 to i32
%79 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %78)
%80 = bitcast [7 x i32]* %21 to i8*
store i32 7, i32* %22
%81 = getelementptr inbounds [7 x i32], [7 x i32]* %21, i64 0, i64 0
%82 = load i32, i32* %22
%83 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %81, i32 %82)
store i32 %83, i32* %23
%84 = load i32, i32* %23
%85 = icmp ne i32 0, %84
%86 = zext i1 %85 to i32
%87 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %86)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:\0A\00"
@__FUNCTION__.test_reconstruct = [17 x i8] c"test_reconstruct\00"
@__const.test_reconstruct.erases = [6 x i32] [i32 0, i32 1, i32 9, i32 12, i32 14, i32 19]
@__const.test_reconstruct.erases.1 = [6 x i32] [i32 0, i32 9, i32 61, i32 12, i32 19, i32 65]
@__const.test_reconstruct.erases.2 = [4 x i32] [i32 11, i32 12, i32 10, i32 9]
@__const.test_reconstruct.erases.3 = [4 x i32] [i32 0, i32 1, i32 4, i32 8]
@__const.test_reconstruct.erases.4 = [4 x i32] [i32 10, i32 11, i32 14, i32 18]
@__const.test_reconstruct.erases.5 = [8 x i32] [i32 0, i32 1, i32 4, i32 8, i32 10, i32 11, i32 14, i32 18]
@__const.test_reconstruct.erases.6 = [7 x i32] [i32 11, i32 12, i32 10, i32 9, i32 63, i32 64, i32 65]
define void @test_reconstruct() {
%1 = alloca [1 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = alloca [4 x i32]
%7 = alloca [8 x i32]
%8 = alloca [7 x i32]
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_reconstruct, i64 0, i64 0))
%10 = bitcast [1 x i32]* %1 to i8*
%11 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 0, i32* %11
%12 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %11, i32 0)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %14)
%16 = bitcast [6 x i32]* %2 to i8*
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%18 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %17, i32 6)
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %20)
%22 = bitcast [6 x i32]* %3 to i8*
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%24 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %23, i32 6)
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %26)
%28 = bitcast [4 x i32]* %4 to i8*
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%30 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %29, i32 4)
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %32)
%34 = bitcast [4 x i32]* %5 to i8*
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%36 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %35, i32 4)
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %38)
%40 = bitcast [4 x i32]* %6 to i8*
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%42 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %41, i32 4)
%43 = icmp ne i32 %42, 0
%44 = zext i1 %43 to i32
%45 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %44)
%46 = bitcast [8 x i32]* %7 to i8*
%47 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%48 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %47, i32 8)
%49 = icmp ne i32 %48, 0
%50 = zext i1 %49 to i32
%51 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %50)
%52 = bitcast [7 x i32]* %8 to i8*
%53 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%54 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @test_one_decoding_13_6 to i32 (i32*, i32, ...)*)(i32* %53, i32 7)
%55 = icmp ne i32 %54, 0
%56 = zext i1 %55 to i32
%57 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %56)
ret void
}