#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 IDTracker_get(int);
int /*<<< orphan*/ IDTracker_reset();
int /*<<< orphan*/ IDTracker_set(int);
int /*<<< orphan*/ printf(char *, int, char *);
int main_test() {
  IDTracker_reset();
  for (int i = 0; i < 10000; i += 3) {
    IDTracker_set(i);
  }
  for (int i = 0; i < 10000; i++) {
    bool set = IDTracker_get(i);
    printf("%d %s \n", i, set ? "SET" : "NO");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <IDTracker_reset@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    1179 <main_test+0x39>
mov    -0x4(%rbp),%edi
call   1060 <IDTracker_set@plt>
mov    -0x4(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <main_test+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    11cd <main_test+0x8d>
mov    -0x8(%rbp),%edi
call   1050 <IDTracker_get@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
lea    0xe67(%rip),%rdx
lea    0xe5c(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main_test+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_test>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <IDTracker_reset@plt>
mov    $0xfffffffd,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x3,%ebx
mov    %ebx,%edi
call   1060 <IDTracker_set@plt>
cmp    $0x270d,%ebx
jb     1160 <main_test+0x20>
xor    %ebx,%ebx
lea    0xe91(%rip),%r15
lea    0xe86(%rip),%r12
lea    0xe77(%rip),%r14
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <IDTracker_get@plt>
test   %eax,%eax
mov    %r12,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x2710,%ebx
jne    1190 <main_test+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d %s \0A\00"
@.str.1 = [4 x i8] c"SET\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @IDTracker_reset()
store i32 0, i32* %1
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10000
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i32, i32* %1
%10 = call i32 @IDTracker_set(i32 %9)
br label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 3
store i32 %13, i32* %1
br label %5
14: ; preds = %5
store i32 0, i32* %2
br label %15
15: ; preds = %27, %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 10000
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i32, i32* %2
%20 = call i32 @IDTracker_get(i32 %19)
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %21, i8* %25)
br label %27
27: ; preds = %18
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %15
30: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d %s \0A\00"
@.str.1 = [4 x i8] c"SET\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main_test() {
%1 = tail call i32 (...) @IDTracker_reset()
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @IDTracker_set(i32 %3)
%5 = add nuw nsw i32 %3, 3
%6 = icmp ult i32 %3, 9997
br i1 %6, label %2, label %8
7: ; preds = %8
ret i32 0
8: ; preds = %2, %8
%9 = phi i32 [ %14, %8 ], [ 0, %2 ]
%10 = tail call i32 @IDTracker_get(i32 %9)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %12)
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %14, 10000
br i1 %15, label %7, label %8
}