#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 get_preuse_bit(int const);
int get_size(int const);
int get_use_bit(int const);
int /*<<< orphan*/ printf(char *, int, int, ...);
void print_alloc_info(const int *mem, int address, int nwords) {
  printf("Allocated %d words at address %d >> ", nwords, address);
  printf("Block Size %d >> Use Bit %d >> Preuse Bit %d\n\n",
         get_size(mem[address]), get_use_bit(mem[address]),
         get_preuse_bit(mem[address]));
  return;
}


x86 assembly (clang, -O0):
<print_alloc_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <get_size@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <get_use_bit@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <get_preuse_bit@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_alloc_info>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xead(%rip),%rdi
mov    %edx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebp,%rbp
mov    (%rbx,%rbp,4),%edi
call   1030 <get_size@plt>
mov    %eax,%r14d
mov    (%rbx,%rbp,4),%edi
call   1060 <get_use_bit@plt>
mov    %eax,%r15d
mov    (%rbx,%rbp,4),%edi
call   1050 <get_preuse_bit@plt>
lea    0xe9f(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %eax,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Allocated %d words at address %d >> \00"
@.str.1 = [47 x i8] c"Block Size %d >> Use Bit %d >> Preuse Bit %d\0A\0A\00"
define void @print_alloc_info(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @get_size(i32 %14)
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @get_use_bit(i32 %20)
%22 = load i32*, i32** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @get_preuse_bit(i32 %26)
%28 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %21, i32 %27)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Allocated %d words at address %d >> \00"
@.str.1 = [47 x i8] c"Block Size %d >> Use Bit %d >> Preuse Bit %d\0A\0A\00"
define void @print_alloc_info(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %1)
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = tail call i32 @get_size(i32 %7)
%9 = load i32, i32* %6
%10 = tail call i32 @get_use_bit(i32 %9)
%11 = load i32, i32* %6
%12 = tail call i32 @get_preuse_bit(i32 %11)
%13 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
ret void
}