#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 */
struct dm_pool {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dm_pool_alloc(struct dm_pool *, int);
struct dm_pool *dm_pool_create(char *, int);
void check_leak_detection() {
  int i;
  struct dm_pool *p = dm_pool_create("", 1024);
  for (i = 0; i < 10; i++)
    dm_pool_alloc(p, (i + 1) * 37);
}


x86 assembly (clang, -O0):
<check_leak_detection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x400,%esi
call   1040 <dm_pool_create@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    116e <check_leak_detection+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   $0x25,%eax,%esi
call   1030 <dm_pool_alloc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <check_leak_detection+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_leak_detection>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x400,%esi
call   1040 <dm_pool_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x25,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x4a,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x6f,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x94,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0xb9,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0xde,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x103,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x128,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x14d,%esi
call   1030 <dm_pool_alloc@plt>
mov    %rbx,%rdi
mov    $0x172,%esi
pop    %rbx
jmp    1030 <dm_pool_alloc@plt>

LLVM IR (-O0):
%struct.dm_pool = type { i32 }
@.str = [1 x i8] zeroinitializer
define void @check_leak_detection() {
%1 = alloca i32
%2 = alloca %struct.dm_pool*
%3 = call %struct.dm_pool* @dm_pool_create(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 1024)
store %struct.dm_pool* %3, %struct.dm_pool** %2
store i32 0, i32* %1
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load %struct.dm_pool*, %struct.dm_pool** %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
%11 = mul nsw i32 %10, 37
%12 = call i32 @dm_pool_alloc(%struct.dm_pool* %8, i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
%struct.dm_pool = type { i32 }
@.str = [1 x i8] zeroinitializer
define void @check_leak_detection() {
%1 = tail call %struct.dm_pool* @dm_pool_create(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 1024)
%2 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 37)
%3 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 74)
%4 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 111)
%5 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 148)
%6 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 185)
%7 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 222)
%8 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 259)
%9 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 296)
%10 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 333)
%11 = tail call i32 @dm_pool_alloc(%struct.dm_pool* %1, i32 370)
ret void
}