#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 id_pool {
  int dummy;
};

/* Variables and functions */
struct id_pool *id_pool_new_init(int);
scalar_t__ ids_del_contiguous(struct id_pool *, int, int);
int ids_new_contiguous(struct id_pool *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  struct id_pool *pool = id_pool_new_init(64);
  int id_array[64];
  int first;
  if ((first = ids_new_contiguous(pool, 64)) < 0)
    printf("%d contig ids not allocated.\n", 64);
  else
    printf("%d contig ids allocated starting from %d\n", 64, first);
  if (ids_del_contiguous(pool, 5, 60) == 0)
    printf("%d contig ids freed with success.\n", 64);
  else
    printf("%d-%d contig ids could not be freed\n", 1, 65);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1060 <id_pool_new_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x40,%esi
call   1030 <ids_new_contiguous@plt>
mov    %eax,-0x124(%rbp)
cmp    $0x0,%eax
jge    119c <main+0x5c>
lea    0xe75(%rip),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11b5 <main+0x75>
mov    -0x124(%rbp),%edx
lea    0xe75(%rip),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3c,%edx
call   1040 <ids_del_contiguous@plt>
cmp    $0x0,%rax
jne    11ea <main+0xaa>
lea    0xe6f(%rip),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1202 <main+0xc2>
lea    0xe7a(%rip),%rdi
mov    $0x1,%esi
mov    $0x41,%edx
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x40,%edi
call   1060 <id_pool_new_init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x40,%esi
call   1030 <ids_new_contiguous@plt>
test   %eax,%eax
js     1176 <main+0x36>
lea    0xeb8(%rip),%rdi
mov    $0x40,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1189 <main+0x49>
lea    0xe83(%rip),%rdi
mov    $0x40,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3c,%edx
call   1040 <ids_del_contiguous@plt>
test   %rax,%rax
je     11ba <main+0x7a>
lea    0xec4(%rip),%rdi
mov    $0x1,%esi
mov    $0x41,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11cd <main+0x8d>
lea    0xe87(%rip),%rdi
mov    $0x40,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.id_pool = type { i32 }
@.str = [30 x i8] c"%d contig ids not allocated.\0A\00"
@.str.1 = [42 x i8] c"%d contig ids allocated starting from %d\0A\00"
@.str.2 = [35 x i8] c"%d contig ids freed with success.\0A\00"
@.str.3 = [37 x i8] c"%d-%d contig ids could not be freed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.id_pool*
%7 = alloca [64 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call %struct.id_pool* @id_pool_new_init(i32 64)
store %struct.id_pool* %9, %struct.id_pool** %6
%10 = load %struct.id_pool*, %struct.id_pool** %6
%11 = call i32 @ids_new_contiguous(%struct.id_pool* %10, i32 64)
store i32 %11, i32* %8
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 64)
br label %18
15: ; preds = %2
%16 = load i32, i32* %8
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %16)
br label %18
18: ; preds = %15, %13
%19 = load %struct.id_pool*, %struct.id_pool** %6
%20 = call i64 @ids_del_contiguous(%struct.id_pool* %19, i32 5, i32 60)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 64)
br label %26
24: ; preds = %18
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 65)
br label %26
26: ; preds = %24, %22
ret i32 0
}

LLVM IR (-O2):
%struct.id_pool = type { i32 }
@.str = [30 x i8] c"%d contig ids not allocated.\0A\00"
@.str.1 = [42 x i8] c"%d contig ids allocated starting from %d\0A\00"
@.str.2 = [35 x i8] c"%d contig ids freed with success.\0A\00"
@.str.3 = [37 x i8] c"%d-%d contig ids could not be freed\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.id_pool* @id_pool_new_init(i32 64)
%4 = tail call i32 @ids_new_contiguous(%struct.id_pool* %3, i32 64)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 64)
br label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %4)
br label %10
10: ; preds = %8, %6
%11 = tail call i64 @ids_del_contiguous(%struct.id_pool* %3, i32 5, i32 60)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 64)
br label %17
15: ; preds = %10
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 65)
br label %17
17: ; preds = %15, %13
ret i32 0
}