#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*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(size_t *);
size_t *malloc(int);
size_t *realloc(size_t *, size_t);
int /*<<< orphan*/ stderr;
void PrintBlockSplitPoints(const unsigned short *litlens,
                           const unsigned short *dists, size_t llsize,
                           const size_t *lz77splitpoints, size_t nlz77points) {
  size_t *splitpoints = 0;
  size_t npoints = 0;
  size_t i;
  size_t pos = 0;
  if (nlz77points > 0) {
    for (i = 0; i < llsize; i++) {
      size_t length = dists[i] == 0 ? 1 : litlens[i];
      if (lz77splitpoints[npoints] == i) {
        {
          if (!((*&npoints) & ((*&npoints) - 1))) {
            (*&splitpoints) =
                (*&npoints) == 0
                    ? malloc(sizeof(**&splitpoints))
                    : realloc((*&splitpoints),
                              (*&npoints) * 2 * sizeof(**&splitpoints));
          }
          (*&splitpoints)[(*&npoints)] = (pos);
          (*&npoints)++;
        };
        if (npoints == nlz77points)
          break;
      }
      pos += length;
    }
  }
  assert(npoints == nlz77points);
  fprintf(stderr, "block split points: ");
  for (i = 0; i < npoints; i++) {
    fprintf(stderr, "%d ", (int)splitpoints[i]);
  }
  fprintf(stderr, "(hex:");
  for (i = 0; i < npoints; i++) {
    fprintf(stderr, " %x", (int)splitpoints[i]);
  }
  fprintf(stderr, ")\n");
  free(splitpoints);
}


x86 assembly (clang, -O0):
<PrintBlockSplitPoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    12a3 <PrintBlockSplitPoints+0x153>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    129e <PrintBlockSplitPoints+0x14e>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
jne    11c7 <PrintBlockSplitPoints+0x77>
mov    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11d6 <PrintBlockSplitPoints+0x86>
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cltq
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x40(%rbp),%rax
jne    1281 <PrintBlockSplitPoints+0x131>
mov    -0x38(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
jne    124d <PrintBlockSplitPoints+0xfd>
cmpq   $0x0,-0x38(%rbp)
jne    122c <PrintBlockSplitPoints+0xdc>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x60(%rbp)
jmp    1245 <PrintBlockSplitPoints+0xf5>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
shl    $0x1,%rsi
shl    $0x3,%rsi
call   1070 <realloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x48(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    127c <PrintBlockSplitPoints+0x12c>
jmp    129e <PrintBlockSplitPoints+0x14e>
jmp    1281 <PrintBlockSplitPoints+0x131>
mov    -0x50(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1197 <PrintBlockSplitPoints+0x47>
jmp    12a3 <PrintBlockSplitPoints+0x153>
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    131b <PrintBlockSplitPoints+0x1cb>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%edx
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    12d7 <PrintBlockSplitPoints+0x187>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    137e <PrintBlockSplitPoints+0x22e>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%edx
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    133a <PrintBlockSplitPoints+0x1ea>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintBlockSplitPoints>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbx
xor    %r12d,%r12d
mov    $0x0,%r14d
test   %r8,%r8
je     1229 <PrintBlockSplitPoints+0xd9>
test   %rdx,%rdx
je     1229 <PrintBlockSplitPoints+0xd9>
xor    %r12d,%r12d
xor    %ebp,%ebp
xor    %r15d,%r15d
xor    %r14d,%r14d
mov    %rcx,0x20(%rsp)
mov    %rdx,0x18(%rsp)
mov    %rsi,0x10(%rsp)
mov    %rdi,0x8(%rsp)
jmp    11dc <PrintBlockSplitPoints+0x8c>
mov    %r14,%rsi
shl    $0x4,%rsi
mov    %r12,%rdi
call   1070 <realloc@plt>
mov    %rax,%r12
mov    0x20(%rsp),%rcx
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdi
mov    %rbp,(%r12,%r14,8)
add    $0x1,%r14
cmp    %rbx,%r14
je     1226 <PrintBlockSplitPoints+0xd6>
add    %r13,%rbp
add    $0x1,%r15
cmp    %r15,%rdx
je     1229 <PrintBlockSplitPoints+0xd9>
cmpw   $0x0,(%rsi,%r15,2)
je     1200 <PrintBlockSplitPoints+0xb0>
movzwl (%rdi,%r15,2),%r13d
cmp    (%rcx,%r14,8),%r15
jne    11d0 <PrintBlockSplitPoints+0x80>
jmp    120c <PrintBlockSplitPoints+0xbc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%r13d
cmp    (%rcx,%r14,8),%r15
jne    11d0 <PrintBlockSplitPoints+0x80>
lea    -0x1(%r14),%rax
test   %rax,%r14
jne    11c3 <PrintBlockSplitPoints+0x73>
test   %r14,%r14
jne    119d <PrintBlockSplitPoints+0x4d>
mov    $0x8,%edi
call   1060 <malloc@plt>
jmp    11ac <PrintBlockSplitPoints+0x5c>
mov    %rbx,%r14
xor    %edi,%edi
cmp    %rbx,%r14
sete   %dil
call   1040 <assert@plt>
mov    0x2da2(%rip),%r15
mov    (%r15),%edi
lea    0xdb8(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
test   %r14,%r14
je     12bc <PrintBlockSplitPoints+0x16c>
lea    0xdba(%rip),%rbp
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r15),%edi
mov    (%r12,%rbx,8),%edx
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1260 <PrintBlockSplitPoints+0x110>
mov    (%r15),%edi
lea    0xd95(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
test   %r14,%r14
je     12cd <PrintBlockSplitPoints+0x17d>
lea    0xd88(%rip),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15),%edi
mov    (%r12,%rbx,8),%edx
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    12a0 <PrintBlockSplitPoints+0x150>
jmp    12cd <PrintBlockSplitPoints+0x17d>
mov    (%r15),%edi
lea    0xd53(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r15),%edi
lea    0xd4c(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r12,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"block split points: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [6 x i8] c"(hex:\00"
@.str.3 = [4 x i8] c" %x\00"
@.str.4 = [3 x i8] c")\0A\00"
define void @PrintBlockSplitPoints(i16* %0, i16* %1, i64 %2, i64* %3, i64 %4) {
%6 = alloca i16*
%7 = alloca i16*
%8 = alloca i64
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i16* %0, i16** %6
store i16* %1, i16** %7
store i64 %2, i64* %8
store i64* %3, i64** %9
store i64 %4, i64* %10
store i64* null, i64** %11
store i64 0, i64* %12
store i64 0, i64* %14
%16 = load i64, i64* %10
%17 = icmp ugt i64 %16, 0
br i1 %17, label %18, label %85
18: ; preds = %5
store i64 0, i64* %13
br label %19
19: ; preds = %81, %18
%20 = load i64, i64* %13
%21 = load i64, i64* %8
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %84
23: ; preds = %19
%24 = load i16*, i16** %7
%25 = load i64, i64* %13
%26 = getelementptr inbounds i16, i16* %24, i64 %25
%27 = load i16, i16* %26
%28 = zext i16 %27 to i32
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %23
br label %37
31: ; preds = %23
%32 = load i16*, i16** %6
%33 = load i64, i64* %13
%34 = getelementptr inbounds i16, i16* %32, i64 %33
%35 = load i16, i16* %34
%36 = zext i16 %35 to i32
br label %37
37: ; preds = %31, %30
%38 = phi i32 [ 1, %30 ], [ %36, %31 ]
%39 = sext i32 %38 to i64
store i64 %39, i64* %15
%40 = load i64*, i64** %9
%41 = load i64, i64* %12
%42 = getelementptr inbounds i64, i64* %40, i64 %41
%43 = load i64, i64* %42
%44 = load i64, i64* %13
%45 = icmp eq i64 %43, %44
br i1 %45, label %46, label %77
46: ; preds = %37
%47 = load i64, i64* %12
%48 = load i64, i64* %12
%49 = sub i64 %48, 1
%50 = and i64 %47, %49
%51 = icmp ne i64 %50, 0
br i1 %51, label %65, label %52
52: ; preds = %46
%53 = load i64, i64* %12
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i64* @malloc(i32 8)
br label %63
57: ; preds = %52
%58 = load i64*, i64** %11
%59 = load i64, i64* %12
%60 = mul i64 %59, 2
%61 = mul i64 %60, 8
%62 = call i64* @realloc(i64* %58, i64 %61)
br label %63
63: ; preds = %57, %55
%64 = phi i64* [ %56, %55 ], [ %62, %57 ]
store i64* %64, i64** %11
br label %65
65: ; preds = %63, %46
%66 = load i64, i64* %14
%67 = load i64*, i64** %11
%68 = load i64, i64* %12
%69 = getelementptr inbounds i64, i64* %67, i64 %68
store i64 %66, i64* %69
%70 = load i64, i64* %12
%71 = add i64 %70, 1
store i64 %71, i64* %12
%72 = load i64, i64* %12
%73 = load i64, i64* %10
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %76
75: ; preds = %65
br label %84
76: ; preds = %65
br label %77
77: ; preds = %76, %37
%78 = load i64, i64* %15
%79 = load i64, i64* %14
%80 = add i64 %79, %78
store i64 %80, i64* %14
br label %81
81: ; preds = %77
%82 = load i64, i64* %13
%83 = add i64 %82, 1
store i64 %83, i64* %13
br label %19
84: ; preds = %75, %19
br label %85
85: ; preds = %84, %5
%86 = load i64, i64* %12
%87 = load i64, i64* %10
%88 = icmp eq i64 %86, %87
%89 = zext i1 %88 to i32
%90 = call i32 @assert(i32 %89)
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %13
br label %93
93: ; preds = %105, %85
%94 = load i64, i64* %13
%95 = load i64, i64* %12
%96 = icmp ult i64 %94, %95
br i1 %96, label %97, label %108
97: ; preds = %93
%98 = load i32, i32* @stderr
%99 = load i64*, i64** %11
%100 = load i64, i64* %13
%101 = getelementptr inbounds i64, i64* %99, i64 %100
%102 = load i64, i64* %101
%103 = trunc i64 %102 to i32
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %97
%106 = load i64, i64* %13
%107 = add i64 %106, 1
store i64 %107, i64* %13
br label %93
108: ; preds = %93
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* %13
br label %111
111: ; preds = %123, %108
%112 = load i64, i64* %13
%113 = load i64, i64* %12
%114 = icmp ult i64 %112, %113
br i1 %114, label %115, label %126
115: ; preds = %111
%116 = load i32, i32* @stderr
%117 = load i64*, i64** %11
%118 = load i64, i64* %13
%119 = getelementptr inbounds i64, i64* %117, i64 %118
%120 = load i64, i64* %119
%121 = trunc i64 %120 to i32
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %121)
br label %123
123: ; preds = %115
%124 = load i64, i64* %13
%125 = add i64 %124, 1
store i64 %125, i64* %13
br label %111
126: ; preds = %111
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%129 = load i64*, i64** %11
%130 = call i32 @free(i64* %129)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"block split points: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [6 x i8] c"(hex:\00"
@.str.3 = [4 x i8] c" %x\00"
@.str.4 = [3 x i8] c")\0A\00"
define void @PrintBlockSplitPoints(i16* nocapture %0, i16* nocapture %1, i64 %2, i64* nocapture %3, i64 %4) {
%6 = icmp ne i64 %4, 0
%7 = icmp ne i64 %2, 0
%8 = and i1 %6, %7
br i1 %8, label %9, label %47
9: ; preds = %5, %41
%10 = phi i64* [ %43, %41 ], [ null, %5 ]
%11 = phi i64 [ %44, %41 ], [ 0, %5 ]
%12 = phi i64 [ %45, %41 ], [ 0, %5 ]
%13 = phi i64 [ %42, %41 ], [ 0, %5 ]
%14 = getelementptr inbounds i16, i16* %1, i64 %12
%15 = load i16, i16* %14
%16 = icmp eq i16 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %9
%18 = getelementptr inbounds i16, i16* %0, i64 %12
%19 = load i16, i16* %18
%20 = zext i16 %19 to i64
br label %21
21: ; preds = %9, %17
%22 = phi i64 [ %20, %17 ], [ 1, %9 ]
%23 = getelementptr inbounds i64, i64* %3, i64 %13
%24 = load i64, i64* %23
%25 = icmp eq i64 %24, %12
br i1 %25, label %26, label %41
26: ; preds = %21
%27 = tail call i64 @llvm.ctpop.i64(i64 %13)
%28 = icmp ult i64 %27, 2
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = icmp eq i64 %13, 0
br i1 %30, label %31, label %33
31: ; preds = %29
%32 = tail call i64* @malloc(i32 8)
br label %36
33: ; preds = %29
%34 = shl i64 %13, 4
%35 = tail call i64* @realloc(i64* %10, i64 %34)
br label %36
36: ; preds = %31, %33, %26
%37 = phi i64* [ %10, %26 ], [ %32, %31 ], [ %35, %33 ]
%38 = getelementptr inbounds i64, i64* %37, i64 %13
store i64 %11, i64* %38
%39 = add i64 %13, 1
%40 = icmp eq i64 %39, %4
br i1 %40, label %47, label %41
41: ; preds = %21, %36
%42 = phi i64 [ %39, %36 ], [ %13, %21 ]
%43 = phi i64* [ %37, %36 ], [ %10, %21 ]
%44 = add i64 %22, %11
%45 = add nuw i64 %12, 1
%46 = icmp eq i64 %45, %2
br i1 %46, label %47, label %9
47: ; preds = %41, %36, %5
%48 = phi i64 [ 0, %5 ], [ %42, %41 ], [ %4, %36 ]
%49 = phi i64* [ null, %5 ], [ %43, %41 ], [ %37, %36 ]
%50 = icmp eq i64 %48, %4
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%55 = icmp eq i64 %48, 0
br i1 %55, label %56, label %59
56: ; preds = %47
%57 = load i32, i32* @stderr
%58 = tail call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %80
59: ; preds = %47, %59
%60 = phi i64 [ %66, %59 ], [ 0, %47 ]
%61 = load i32, i32* @stderr
%62 = getelementptr inbounds i64, i64* %49, i64 %60
%63 = load i64, i64* %62
%64 = trunc i64 %63 to i32
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = add nuw i64 %60, 1
%67 = icmp eq i64 %66, %48
br i1 %67, label %68, label %59
68: ; preds = %59
%69 = load i32, i32* @stderr
%70 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br i1 %55, label %80, label %71
71: ; preds = %68, %71
%72 = phi i64 [ %78, %71 ], [ 0, %68 ]
%73 = load i32, i32* @stderr
%74 = getelementptr inbounds i64, i64* %49, i64 %72
%75 = load i64, i64* %74
%76 = trunc i64 %75 to i32
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = add nuw i64 %72, 1
%79 = icmp eq i64 %78, %48
br i1 %79, label %80, label %71
80: ; preds = %71, %56, %68
%81 = load i32, i32* @stderr
%82 = tail call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%83 = tail call i32 @free(i64* %49)
ret void
}