#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*/ slabs_newslab(int);
void slabs_preallocate(unsigned int maxslabs) {
  int i;
  unsigned int prealloc = 0;
  for (i = 3; i <= 20; i++) {
    if (++prealloc > maxslabs)
      return;
    slabs_newslab(i);
  }
}


x86 assembly (clang, -O0):
<slabs_preallocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     1160 <slabs_preallocate+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    -0x4(%rbp),%eax
jbe    114a <slabs_preallocate+0x3a>
jmp    1160 <slabs_preallocate+0x50>
mov    -0x8(%rbp),%edi
call   1030 <slabs_newslab@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <slabs_preallocate+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slabs_preallocate>:
push   %rbx
test   %edi,%edi
je     123a <slabs_preallocate+0x12a>
mov    %edi,%ebx
mov    $0x3,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x1,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0x4,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x3,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0x5,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x3,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0x6,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x5,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0x7,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x5,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0x8,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x7,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0x9,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x7,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0xa,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x9,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0xb,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x9,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0xc,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xb,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0xd,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xb,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0xe,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xd,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0xf,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xd,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0x10,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xf,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0x11,%edi
call   1030 <slabs_newslab@plt>
cmp    $0xf,%ebx
je     123a <slabs_preallocate+0x12a>
mov    $0x12,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x11,%ebx
jb     123a <slabs_preallocate+0x12a>
mov    $0x13,%edi
call   1030 <slabs_newslab@plt>
cmp    $0x11,%ebx
jne    123c <slabs_preallocate+0x12c>
pop    %rbx
ret
mov    $0x14,%edi
pop    %rbx
jmp    1030 <slabs_newslab@plt>

LLVM IR (-O0):
define void @slabs_preallocate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 3, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 20
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %4
%10 = add i32 %9, 1
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = icmp ugt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %8
br label %20
14: ; preds = %8
%15 = load i32, i32* %3
%16 = call i32 @slabs_newslab(i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %13, %5
ret void
}

LLVM IR (-O2):
define void @slabs_preallocate(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %56, label %3
3: ; preds = %1
%4 = tail call i32 @slabs_newslab(i32 3)
%5 = icmp eq i32 %0, 1
br i1 %5, label %56, label %6
6: ; preds = %3
%7 = tail call i32 @slabs_newslab(i32 4)
%8 = icmp ult i32 %0, 3
br i1 %8, label %56, label %9
9: ; preds = %6
%10 = tail call i32 @slabs_newslab(i32 5)
%11 = icmp eq i32 %0, 3
br i1 %11, label %56, label %12
12: ; preds = %9
%13 = tail call i32 @slabs_newslab(i32 6)
%14 = icmp ult i32 %0, 5
br i1 %14, label %56, label %15
15: ; preds = %12
%16 = tail call i32 @slabs_newslab(i32 7)
%17 = icmp eq i32 %0, 5
br i1 %17, label %56, label %18
18: ; preds = %15
%19 = tail call i32 @slabs_newslab(i32 8)
%20 = icmp ult i32 %0, 7
br i1 %20, label %56, label %21
21: ; preds = %18
%22 = tail call i32 @slabs_newslab(i32 9)
%23 = icmp eq i32 %0, 7
br i1 %23, label %56, label %24
24: ; preds = %21
%25 = tail call i32 @slabs_newslab(i32 10)
%26 = icmp ult i32 %0, 9
br i1 %26, label %56, label %27
27: ; preds = %24
%28 = tail call i32 @slabs_newslab(i32 11)
%29 = icmp eq i32 %0, 9
br i1 %29, label %56, label %30
30: ; preds = %27
%31 = tail call i32 @slabs_newslab(i32 12)
%32 = icmp ult i32 %0, 11
br i1 %32, label %56, label %33
33: ; preds = %30
%34 = tail call i32 @slabs_newslab(i32 13)
%35 = icmp eq i32 %0, 11
br i1 %35, label %56, label %36
36: ; preds = %33
%37 = tail call i32 @slabs_newslab(i32 14)
%38 = icmp ult i32 %0, 13
br i1 %38, label %56, label %39
39: ; preds = %36
%40 = tail call i32 @slabs_newslab(i32 15)
%41 = icmp eq i32 %0, 13
br i1 %41, label %56, label %42
42: ; preds = %39
%43 = tail call i32 @slabs_newslab(i32 16)
%44 = icmp ult i32 %0, 15
br i1 %44, label %56, label %45
45: ; preds = %42
%46 = tail call i32 @slabs_newslab(i32 17)
%47 = icmp eq i32 %0, 15
br i1 %47, label %56, label %48
48: ; preds = %45
%49 = tail call i32 @slabs_newslab(i32 18)
%50 = icmp ult i32 %0, 17
br i1 %50, label %56, label %51
51: ; preds = %48
%52 = tail call i32 @slabs_newslab(i32 19)
%53 = icmp eq i32 %0, 17
br i1 %53, label %56, label %54
54: ; preds = %51
%55 = tail call i32 @slabs_newslab(i32 20)
br label %56
56: ; preds = %54, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %1
ret void
}