void groupNumberAllocator(int *numGroup, unsigned int *group0,
                          unsigned int *group1, unsigned int *group2,
                          unsigned int *group3, unsigned int *group4,
                          unsigned int *group5) {
#pragma HLS INTERFACE s_axilite port = return bundle = BUS_CMD
#pragma HLS INTERFACE s_axilite register port = numGroup bundle = BUS_CMD
#pragma HLS INTERFACE axis register port = group0
#pragma HLS INTERFACE axis register port = group1
#pragma HLS INTERFACE axis register port = group2
#pragma HLS INTERFACE axis register port = group3
#pragma HLS INTERFACE axis register port = group4
#pragma HLS INTERFACE axis register port = group5
  int num = 0;
  num = *numGroup;
  if (num == 1) {
    *group0 = 0;
  }
  if (num == 2) {
    *group0 = 0;
    *group1 = 1;
  }
  if (num == 3) {
    *group0 = 0;
    *group1 = 1;
    *group2 = 2;
  }
  if (num == 4) {
    *group0 = 0;
    *group1 = 1;
    *group2 = 2;
    *group3 = 3;
  }
  if (num == 5) {
    *group0 = 0;
    *group1 = 1;
    *group2 = 2;
    *group3 = 3;
    *group4 = 4;
  }
  if (num == 6) {
    *group0 = 0;
    *group1 = 1;
    *group2 = 2;
    *group3 = 3;
    *group4 = 4;
    *group5 = 5;
  }
}


x86 assembly (clang, -O0):
<groupNumberAllocator>:
push   %rbp
mov    %rsp,%rbp
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    1144 <groupNumberAllocator+0x44>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x2,-0x34(%rbp)
jne    1162 <groupNumberAllocator+0x62>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x3,-0x34(%rbp)
jne    118a <groupNumberAllocator+0x8a>
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    11bc <groupNumberAllocator+0xbc>
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    11f8 <groupNumberAllocator+0xf8>
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    123e <groupNumberAllocator+0x13e>
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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<groupNumberAllocator>:
mov    (%rdi),%eax
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     11ab <groupNumberAllocator+0xab>
lea    0xeeb(%rip),%rdi
movslq (%rdi,%rax,4),%rax
add    %rdi,%rax
jmp    *%rax
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
mov    0x8(%rsp),%rax
movl   $0x0,(%rsi)
movl   $0x1,(%rdx)
movl   $0x2,(%rcx)
movl   $0x3,(%r8)
movl   $0x4,(%r9)
movl   $0x5,(%rax)
ret

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

LLVM IR (-O2):
define void @groupNumberAllocator(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) {
%8 = load i32, i32* %0
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
i32 5, label %13
i32 6, label %14
]
9: ; preds = %7
store i32 0, i32* %1
br label %15
10: ; preds = %7
store i32 0, i32* %1
store i32 1, i32* %2
br label %15
11: ; preds = %7
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
br label %15
12: ; preds = %7
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
br label %15
13: ; preds = %7
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 %15
14: ; preds = %7
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 %15
15: ; preds = %13, %12, %11, %10, %9, %7, %14
ret void
}