void localCoreIDAllocator(int *numCore, unsigned int *core0,
                          unsigned int *core1, unsigned int *core2,
                          unsigned int *core3, unsigned int *core4,
                          unsigned int *core5, unsigned int *core6) {
#pragma HLS INTERFACE s_axilite port = return bundle = BUS_CMD
#pragma HLS INTERFACE s_axilite register port = numCore bundle = BUS_CMD
#pragma HLS INTERFACE axis register port = core0
#pragma HLS INTERFACE axis register port = core1
#pragma HLS INTERFACE axis register port = core2
#pragma HLS INTERFACE axis register port = core3
#pragma HLS INTERFACE axis register port = core4
#pragma HLS INTERFACE axis register port = core5
#pragma HLS INTERFACE axis register port = core6
  int num = 0;
  num = *numCore;
  if (num == 1) {
    *core0 = 0;
  }
  if (num == 2) {
    *core0 = 0;
    *core1 = 1;
  }
  if (num == 3) {
    *core0 = 0;
    *core1 = 1;
    *core2 = 2;
  }
  if (num == 4) {
    *core0 = 0;
    *core1 = 1;
    *core2 = 2;
    *core3 = 3;
  }
  if (num == 5) {
    *core0 = 0;
    *core1 = 1;
    *core2 = 2;
    *core3 = 3;
    *core4 = 4;
  }
  if (num == 6) {
    *core0 = 0;
    *core1 = 1;
    *core2 = 2;
    *core3 = 3;
    *core4 = 4;
    *core5 = 5;
  }
  if (num == 7) {
    *core0 = 0;
    *core1 = 1;
    *core2 = 2;
    *core3 = 3;
    *core4 = 4;
    *core5 = 5;
    *core6 = 6;
  }
}


x86 assembly (clang, -O0):
<localCoreIDAllocator>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    1148 <localCoreIDAllocator+0x48>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x2,-0x34(%rbp)
jne    1166 <localCoreIDAllocator+0x66>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x3,-0x34(%rbp)
jne    118e <localCoreIDAllocator+0x8e>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
cmpl   $0x4,-0x34(%rbp)
jne    11c0 <localCoreIDAllocator+0xc0>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x3,(%rax)
cmpl   $0x5,-0x34(%rbp)
jne    11fc <localCoreIDAllocator+0xfc>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x30(%rbp),%rax
movl   $0x4,(%rax)
cmpl   $0x6,-0x34(%rbp)
jne    1242 <localCoreIDAllocator+0x142>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x30(%rbp),%rax
movl   $0x4,(%rax)
mov    0x10(%rbp),%rax
movl   $0x5,(%rax)
cmpl   $0x7,-0x34(%rbp)
jne    1292 <localCoreIDAllocator+0x192>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x30(%rbp),%rax
movl   $0x4,(%rax)
mov    0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    0x18(%rbp),%rax
movl   $0x6,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<localCoreIDAllocator>:
mov    (%rdi),%edi
add    $0xffffffff,%edi
cmp    $0x6,%edi
ja     11df <localCoreIDAllocator+0xdf>
mov    0x8(%rsp),%r10
lea    0xee6(%rip),%rax
movslq (%rax,%rdi,4),%rdi
add    %rax,%rdi
jmp    *%rdi
movl   $0x0,(%rsi)
ret
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
ret
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
ret
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
movl   $0x3,(%r8)
ret
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
movl   $0x3,(%r8)
movl   $0x4,(%r9)
ret
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
movl   $0x3,(%r8)
movl   $0x4,(%r9)
movl   $0x5,(%r10)
ret
mov    0x10(%rsp),%rax
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
movl   $0x3,(%r8)
movl   $0x4,(%r9)
movl   $0x5,(%r10)
movl   $0x6,(%rax)
ret

LLVM IR (-O0):
define void @localCoreIDAllocator(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7) {
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
store i32* %0, i32** %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store i32* %6, i32** %15
store i32* %7, i32** %16
store i32 0, i32* %17
%18 = load i32*, i32** %9
%19 = load i32, i32* %18
store i32 %19, i32* %17
%20 = load i32, i32* %17
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %8
%23 = load i32*, i32** %10
store i32 0, i32* %23
br label %24
24: ; preds = %22, %8
%25 = load i32, i32* %17
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32*, i32** %10
store i32 0, i32* %28
%29 = load i32*, i32** %11
store i32 1, i32* %29
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %17
%32 = icmp eq i32 %31, 3
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32*, i32** %10
store i32 0, i32* %34
%35 = load i32*, i32** %11
store i32 1, i32* %35
%36 = load i32*, i32** %12
store i32 2, i32* %36
br label %37
37: ; preds = %33, %30
%38 = load i32, i32* %17
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load i32*, i32** %10
store i32 0, i32* %41
%42 = load i32*, i32** %11
store i32 1, i32* %42
%43 = load i32*, i32** %12
store i32 2, i32* %43
%44 = load i32*, i32** %13
store i32 3, i32* %44
br label %45
45: ; preds = %40, %37
%46 = load i32, i32* %17
%47 = icmp eq i32 %46, 5
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load i32*, i32** %10
store i32 0, i32* %49
%50 = load i32*, i32** %11
store i32 1, i32* %50
%51 = load i32*, i32** %12
store i32 2, i32* %51
%52 = load i32*, i32** %13
store i32 3, i32* %52
%53 = load i32*, i32** %14
store i32 4, i32* %53
br label %54
54: ; preds = %48, %45
%55 = load i32, i32* %17
%56 = icmp eq i32 %55, 6
br i1 %56, label %57, label %64
57: ; preds = %54
%58 = load i32*, i32** %10
store i32 0, i32* %58
%59 = load i32*, i32** %11
store i32 1, i32* %59
%60 = load i32*, i32** %12
store i32 2, i32* %60
%61 = load i32*, i32** %13
store i32 3, i32* %61
%62 = load i32*, i32** %14
store i32 4, i32* %62
%63 = load i32*, i32** %15
store i32 5, i32* %63
br label %64
64: ; preds = %57, %54
%65 = load i32, i32* %17
%66 = icmp eq i32 %65, 7
br i1 %66, label %67, label %75
67: ; preds = %64
%68 = load i32*, i32** %10
store i32 0, i32* %68
%69 = load i32*, i32** %11
store i32 1, i32* %69
%70 = load i32*, i32** %12
store i32 2, i32* %70
%71 = load i32*, i32** %13
store i32 3, i32* %71
%72 = load i32*, i32** %14
store i32 4, i32* %72
%73 = load i32*, i32** %15
store i32 5, i32* %73
%74 = load i32*, i32** %16
store i32 6, i32* %74
br label %75
75: ; preds = %67, %64
ret void
}

LLVM IR (-O2):
define void @localCoreIDAllocator(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7) {
%9 = load i32, i32* %0
switch i32 %9, label %17 [
i32 1, label %10
i32 2, label %11
i32 3, label %12
i32 4, label %13
i32 5, label %14
i32 6, label %15
i32 7, label %16
]
10: ; preds = %8
store i32 0, i32* %1
br label %17
11: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
br label %17
12: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
br label %17
13: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
br label %17
14: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32 4, i32* %5
br label %17
15: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32 4, i32* %5
store i32 5, i32* %6
br label %17
16: ; preds = %8
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32 4, i32* %5
store i32 5, i32* %6
store i32 6, i32* %7
br label %17
17: ; preds = %15, %14, %13, %12, %11, %10, %8, %16
ret void
}