#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 */
typedef scalar_t__ bp;

/* Variables and functions */
void place(void *bp, size_t size) {
  size_t total = ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7);
  size_t remain = total - size;
  if (remain >= (2 * 8)) {
    (*(unsigned int *)(((char *)(bp)-4)) = (((size) | (1))));
    (*(unsigned int *)(((char *)(bp) +
                        ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7) - 8)) =
         (((size) | (1))));
    (*(unsigned int *)((
         (char *)(((char *)(bp) +
                   ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7))) -
         4)) = (((remain) | (0))));
    (*(unsigned int *)((
         (char *)(((char *)(bp) +
                   ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7))) +
         ((*(unsigned int *)((
              (char *)(((char *)(bp) +
                        ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7))) -
              4))) &
          ~0x7) -
         8)) = (((remain) | (0))));
  }
}


x86 assembly (clang, -O0):
<place>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4(%rax),%eax
and    $0xfffffff8,%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x10,-0x20(%rbp)
jb     11ba <place+0xba>
mov    -0x10(%rbp),%rax
or     $0x1,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,-0x4(%rax)
mov    -0x10(%rbp),%rax
or     $0x1,%rax
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x4(%rcx),%ecx
and    $0xfffffff8,%ecx
mov    %ecx,%ecx
mov    %edx,-0x8(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
or     $0x0,%rax
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x4(%rcx),%ecx
and    $0xfffffff8,%ecx
mov    %ecx,%ecx
mov    %edx,-0x4(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
or     $0x0,%rax
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x4(%rcx),%ecx
and    $0xfffffff8,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%rsi
mov    -0x4(%rsi),%esi
and    $0xfffffff8,%esi
mov    %esi,%esi
mov    -0x4(%rcx,%rsi,1),%ecx
and    $0xfffffff8,%ecx
mov    %ecx,%ecx
mov    %edx,-0x8(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<place>:
mov    -0x4(%rdi),%eax
and    $0xfffffff8,%eax
sub    %rsi,%rax
cmp    $0x10,%rax
jb     113d <place+0x3d>
mov    %esi,%ecx
or     $0x1,%ecx
mov    %ecx,-0x4(%rdi)
and    $0xfffffff8,%esi
mov    %ecx,-0x8(%rdi,%rsi,1)
mov    -0x4(%rdi),%ecx
and    $0xfffffff8,%ecx
mov    %eax,-0x4(%rdi,%rcx,1)
mov    -0x4(%rdi),%ecx
and    $0xfffffff8,%ecx
lea    (%rdi,%rcx,1),%rdx
mov    -0x4(%rdi,%rcx,1),%ecx
and    $0xfffffff8,%ecx
mov    %eax,-0x8(%rcx,%rdx,1)
ret

LLVM IR (-O0):
define void @place(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 -4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = and i32 %10, -8
%12 = zext i32 %11 to i64
store i64 %12, i64* %5
%13 = load i64, i64* %5
%14 = load i64, i64* %4
%15 = sub i64 %13, %14
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = icmp uge i64 %16, 16
br i1 %17, label %18, label %78
18: ; preds = %2
%19 = load i64, i64* %4
%20 = or i64 %19, 1
%21 = trunc i64 %20 to i32
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 -4
%24 = bitcast i8* %23 to i32*
store i32 %21, i32* %24
%25 = load i64, i64* %4
%26 = or i64 %25, 1
%27 = trunc i64 %26 to i32
%28 = load i8*, i8** %3
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 -4
%31 = bitcast i8* %30 to i32*
%32 = load i32, i32* %31
%33 = and i32 %32, -8
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %28, i64 %34
%36 = getelementptr inbounds i8, i8* %35, i64 -8
%37 = bitcast i8* %36 to i32*
store i32 %27, i32* %37
%38 = load i64, i64* %6
%39 = or i64 %38, 0
%40 = trunc i64 %39 to i32
%41 = load i8*, i8** %3
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 -4
%44 = bitcast i8* %43 to i32*
%45 = load i32, i32* %44
%46 = and i32 %45, -8
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %41, i64 %47
%49 = getelementptr inbounds i8, i8* %48, i64 -4
%50 = bitcast i8* %49 to i32*
store i32 %40, i32* %50
%51 = load i64, i64* %6
%52 = or i64 %51, 0
%53 = trunc i64 %52 to i32
%54 = load i8*, i8** %3
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 -4
%57 = bitcast i8* %56 to i32*
%58 = load i32, i32* %57
%59 = and i32 %58, -8
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %54, i64 %60
%62 = load i8*, i8** %3
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i64 -4
%65 = bitcast i8* %64 to i32*
%66 = load i32, i32* %65
%67 = and i32 %66, -8
%68 = zext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %62, i64 %68
%70 = getelementptr inbounds i8, i8* %69, i64 -4
%71 = bitcast i8* %70 to i32*
%72 = load i32, i32* %71
%73 = and i32 %72, -8
%74 = zext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %61, i64 %74
%76 = getelementptr inbounds i8, i8* %75, i64 -8
%77 = bitcast i8* %76 to i32*
store i32 %53, i32* %77
br label %78
78: ; preds = %18, %2
ret void
}

LLVM IR (-O2):
define void @place(i8* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 -4
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = and i32 %5, -8
%7 = zext i32 %6 to i64
%8 = sub i64 %7, %1
%9 = icmp ugt i64 %8, 15
br i1 %9, label %10, label %36
10: ; preds = %2
%11 = trunc i64 %1 to i32
%12 = or i32 %11, 1
store i32 %12, i32* %4
%13 = and i64 %1, 4294967288
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = getelementptr inbounds i8, i8* %14, i64 -8
%16 = bitcast i8* %15 to i32*
store i32 %12, i32* %16
%17 = trunc i64 %8 to i32
%18 = load i32, i32* %4
%19 = and i32 %18, -8
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 -4
%23 = bitcast i8* %22 to i32*
store i32 %17, i32* %23
%24 = load i32, i32* %4
%25 = and i32 %24, -8
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = getelementptr inbounds i8, i8* %27, i64 -4
%29 = bitcast i8* %28 to i32*
%30 = load i32, i32* %29
%31 = and i32 %30, -8
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %27, i64 %32
%34 = getelementptr inbounds i8, i8* %33, i64 -8
%35 = bitcast i8* %34 to i32*
store i32 %17, i32* %35
br label %36
36: ; preds = %10, %2
ret void
}