#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(char *);
scalar_t__ malloc(int);
scalar_t__ malloc_usable_size(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *ptr;
  ptr = (char *)malloc(0);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(15);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(25);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(40);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(48);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(49);
  printf("%u\n", (int)malloc_usable_size(ptr));
  ptr = (char *)malloc(60);
  printf("%u\n", (int)malloc_usable_size(ptr));
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    $0xf,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x19,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
mov    $0x31,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc_usable_size@plt>
mov    %eax,%esi
lea    0xdb6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
lea    0xea6(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xf,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x19,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x31,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 0)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @malloc_usable_size(i8* %5)
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i64 @malloc(i32 15)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i64 @malloc_usable_size(i8* %11)
%13 = trunc i64 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i64 @malloc(i32 25)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %2
%17 = load i8*, i8** %2
%18 = call i64 @malloc_usable_size(i8* %17)
%19 = trunc i64 %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i64 @malloc(i32 40)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %2
%23 = load i8*, i8** %2
%24 = call i64 @malloc_usable_size(i8* %23)
%25 = trunc i64 %24 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i64 @malloc(i32 48)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %2
%29 = load i8*, i8** %2
%30 = call i64 @malloc_usable_size(i8* %29)
%31 = trunc i64 %30 to i32
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = call i64 @malloc(i32 49)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %2
%35 = load i8*, i8** %2
%36 = call i64 @malloc_usable_size(i8* %35)
%37 = trunc i64 %36 to i32
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = call i64 @malloc(i32 60)
%40 = inttoptr i64 %39 to i8*
store i8* %40, i8** %2
%41 = load i8*, i8** %2
%42 = call i64 @malloc_usable_size(i8* %41)
%43 = trunc i64 %42 to i32
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %43)
%45 = load i8*, i8** %2
%46 = call i32 @free(i8* %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 0)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc_usable_size(i8* %2)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i64 @malloc(i32 15)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i64 @malloc_usable_size(i8* %7)
%9 = trunc i64 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i64 @malloc(i32 25)
%12 = inttoptr i64 %11 to i8*
%13 = tail call i64 @malloc_usable_size(i8* %12)
%14 = trunc i64 %13 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i64 @malloc(i32 40)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i64 @malloc_usable_size(i8* %17)
%19 = trunc i64 %18 to i32
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = tail call i64 @malloc(i32 48)
%22 = inttoptr i64 %21 to i8*
%23 = tail call i64 @malloc_usable_size(i8* %22)
%24 = trunc i64 %23 to i32
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = tail call i64 @malloc(i32 49)
%27 = inttoptr i64 %26 to i8*
%28 = tail call i64 @malloc_usable_size(i8* %27)
%29 = trunc i64 %28 to i32
%30 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = tail call i64 @malloc(i32 60)
%32 = inttoptr i64 %31 to i8*
%33 = tail call i64 @malloc_usable_size(i8* %32)
%34 = trunc i64 %33 to i32
%35 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = tail call i32 @free(i8* %32)
ret i32 0
}