#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*/ free(size_t *);
void reclaim(unsigned char *base, size_t start, size_t end) {
  size_t *a, *z;
  start = start + 6 * sizeof(size_t) - 1 & -4 * sizeof(size_t);
  end = (end & -4 * sizeof(size_t)) - 2 * sizeof(size_t);
  if (start > end || end - start < 4 * sizeof(size_t))
    return;
  a = (size_t *)(base + start);
  z = (size_t *)(base + end);
  a[-2] = 1;
  a[-1] = z[0] = end - start + 2 * sizeof(size_t) | 1;
  z[1] = 1;
  free(a);
}


x86 assembly (clang, -O0):
<reclaim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x30,%rax
sub    $0x1,%rax
and    $0xffffffffffffffe0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
and    $0xffffffffffffffe0,%rax
sub    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     1168 <reclaim+0x58>
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cmp    $0x20,%rax
jae    116d <reclaim+0x5d>
jmp    11c5 <reclaim+0xb5>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movq   $0x1,-0x10(%rax)
mov    -0x18(%rbp),%rcx
sub    -0x10(%rbp),%rcx
add    $0x10,%rcx
or     $0x1,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rcx,-0x8(%rax)
mov    -0x28(%rbp),%rax
movq   $0x1,0x8(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reclaim>:
add    $0x2f,%rsi
and    $0xffffffffffffffe0,%rsi
and    $0xffffffffffffffe0,%rdx
add    $0xfffffffffffffff0,%rdx
mov    %rdx,%rcx
sub    %rsi,%rcx
jb     112e <reclaim+0x1e>
cmp    $0x20,%rcx
jae    112f <reclaim+0x1f>
ret
lea    (%rdi,%rsi,1),%rax
movq   $0x1,-0x10(%rdi,%rsi,1)
add    $0x11,%rcx
mov    %rcx,(%rdi,%rdx,1)
mov    %rcx,-0x8(%rdi,%rsi,1)
movq   $0x1,0x8(%rdi,%rdx,1)
mov    %rax,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @reclaim(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %5
%10 = add i64 %9, 48
%11 = sub i64 %10, 1
%12 = and i64 %11, -32
store i64 %12, i64* %5
%13 = load i64, i64* %6
%14 = and i64 %13, -32
%15 = sub i64 %14, 16
store i64 %15, i64* %6
%16 = load i64, i64* %5
%17 = load i64, i64* %6
%18 = icmp ugt i64 %16, %17
br i1 %18, label %24, label %19
19: ; preds = %3
%20 = load i64, i64* %6
%21 = load i64, i64* %5
%22 = sub i64 %20, %21
%23 = icmp ult i64 %22, 32
br i1 %23, label %24, label %25
24: ; preds = %19, %3
br label %49
25: ; preds = %19
%26 = load i8*, i8** %4
%27 = load i64, i64* %5
%28 = getelementptr inbounds i8, i8* %26, i64 %27
%29 = bitcast i8* %28 to i64*
store i64* %29, i64** %7
%30 = load i8*, i8** %4
%31 = load i64, i64* %6
%32 = getelementptr inbounds i8, i8* %30, i64 %31
%33 = bitcast i8* %32 to i64*
store i64* %33, i64** %8
%34 = load i64*, i64** %7
%35 = getelementptr inbounds i64, i64* %34, i64 -2
store i64 1, i64* %35
%36 = load i64, i64* %6
%37 = load i64, i64* %5
%38 = sub i64 %36, %37
%39 = add i64 %38, 16
%40 = or i64 %39, 1
%41 = load i64*, i64** %8
%42 = getelementptr inbounds i64, i64* %41, i64 0
store i64 %40, i64* %42
%43 = load i64*, i64** %7
%44 = getelementptr inbounds i64, i64* %43, i64 -1
store i64 %40, i64* %44
%45 = load i64*, i64** %8
%46 = getelementptr inbounds i64, i64* %45, i64 1
store i64 1, i64* %46
%47 = load i64*, i64** %7
%48 = call i32 @free(i64* %47)
br label %49
49: ; preds = %25, %24
ret void
}

LLVM IR (-O2):
define void @reclaim(i8* nocapture %0, i64 %1, i64 %2) {
%4 = add i64 %1, 47
%5 = and i64 %4, -32
%6 = and i64 %2, -32
%7 = add i64 %6, -16
%8 = icmp ult i64 %7, %5
br i1 %8, label %25, label %9
9: ; preds = %3
%10 = sub i64 %7, %5
%11 = icmp ult i64 %10, 32
br i1 %11, label %25, label %12
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %0, i64 %5
%14 = bitcast i8* %13 to i64*
%15 = getelementptr inbounds i8, i8* %0, i64 %7
%16 = bitcast i8* %15 to i64*
%17 = getelementptr inbounds i8, i8* %13, i64 -16
%18 = bitcast i8* %17 to i64*
store i64 1, i64* %18
%19 = add i64 %10, 17
store i64 %19, i64* %16
%20 = getelementptr inbounds i8, i8* %13, i64 -8
%21 = bitcast i8* %20 to i64*
store i64 %19, i64* %21
%22 = getelementptr inbounds i8, i8* %15, i64 8
%23 = bitcast i8* %22 to i64*
store i64 1, i64* %23
%24 = tail call i32 @free(i64* %14)
br label %25
25: ; preds = %3, %9, %12
ret void
}