#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 asize) {
  size_t csize = ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7);
  if ((csize - asize) >= (2 * 8)) {
    (*(unsigned int *)(((char *)(bp)-4)) = (((asize) | (1) | (1 << 1))));
    bp = ((char *)(bp) + ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7));
    (*(unsigned int *)(((char *)(bp)-4)) =
         (((csize - asize) | (0) | (1 << 1))));
    (*(unsigned int *)(((char *)(bp) +
                        ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7) - 8)) =
         (((csize - asize) | (0) | (1 << 1))));
  } else {
    (*(unsigned int *)(((char *)(bp)-4)) = (((csize) | (1) | (1 << 1))));
    (*(unsigned int *)((
         (char *)(((char *)(bp) +
                   ((*(unsigned int *)(((char *)(bp)-4))) & ~0x7))) -
         4)) = (((csize) | (1) | (1 << 1))));
  }
}


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
cmp    $0x10,%rax
jb     119e <place+0x9e>
mov    -0x10(%rbp),%rax
or     $0x1,%rax
or     $0x2,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,-0x4(%rax)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x4(%rcx),%ecx
and    $0xfffffff8,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
or     $0x0,%rax
or     $0x2,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,-0x4(%rax)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
or     $0x0,%rax
or     $0x2,%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)
jmp    11d5 <place+0xd5>
mov    -0x18(%rbp),%rax
or     $0x1,%rax
or     $0x2,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,-0x4(%rax)
mov    -0x18(%rbp),%rax
or     $0x1,%rax
or     $0x2,%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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<place>:
mov    -0x4(%rdi),%edx
and    $0xfffffff8,%edx
mov    %rdx,%rax
sub    %rsi,%rax
cmp    $0x10,%rax
jb     1137 <place+0x37>
mov    %esi,%ecx
or     $0x3,%ecx
mov    %ecx,-0x4(%rdi)
and    $0xfffffff8,%esi
lea    (%rdi,%rsi,1),%rdx
mov    %eax,%ecx
or     $0x2,%ecx
mov    %ecx,-0x4(%rdi,%rsi,1)
and    $0xfffffff8,%eax
add    %rdx,%rax
add    $0xfffffffffffffff8,%rax
mov    %ecx,(%rax)
ret
mov    %edx,%ecx
or     $0x3,%ecx
mov    %ecx,-0x4(%rdi)
lea    (%rdi,%rdx,1),%rax
add    $0xfffffffffffffffc,%rax
mov    %ecx,(%rax)
ret

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