#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 incX(int, int, int, int);
int incY(int, int, int, int);
void groupIDGenerator(int *groupSize0, int *groupSize1, unsigned int *numGroup,
                      unsigned int *groupID, int *id0x, int *id0y, int *id1x,
                      int *id1y, int *id2x, int *id2y, int *id3x, int *id3y,
                      int *id4x, int *id4y, int *id5x, int *id5y) {
#pragma HLS INTERFACE s_axilite port = return bundle = BUS_CMD
#pragma HLS INTERFACE s_axilite register port = groupSize0 bundle = BUS_CMD
#pragma HLS INTERFACE s_axilite register port = groupSize1 bundle = BUS_CMD
#pragma HLS INTERFACE s_axilite register port = numGroup bundle = BUS_CMD
#pragma HLS INTERFACE axis register port = groupID
#pragma HLS INTERFACE axis register port = id0x
#pragma HLS INTERFACE axis register port = id0y
#pragma HLS INTERFACE axis register port = id1x
#pragma HLS INTERFACE axis register port = id1y
#pragma HLS INTERFACE axis register port = id2x
#pragma HLS INTERFACE axis register port = id2y
#pragma HLS INTERFACE axis register port = id3x
#pragma HLS INTERFACE axis register port = id3y
#pragma HLS INTERFACE axis register port = id4x
#pragma HLS INTERFACE axis register port = id4y
#pragma HLS INTERFACE axis register port = id5x
#pragma HLS INTERFACE axis register port = id5y
  int numOfX = *groupSize0;
  int numOfY = *groupSize1;
  int total = numOfX * numOfY;
  unsigned int currNumGroup = *numGroup;
  unsigned int finish = 0;
  unsigned int cnt = 0;
  unsigned int signal[6] = {0};
  int idx = 0;
  int idy = 0;
  int i = 0;
  while (finish != 1) {
    unsigned int currGroupID = *groupID;
    if (currGroupID == 0) {
      if (cnt >= total) {
        *id0x = -1;
        *id0y = -1;
        signal[0] = 1;
      } else {
        *id0x = idx;
        *id0y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    if (currGroupID == 1) {
      if (cnt >= total) {
        *id1x = -1;
        *id1y = -1;
        signal[1] = 1;
      } else {
        *id1x = idx;
        *id1y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    if (currGroupID == 2) {
      if (cnt >= total) {
        *id2x = -1;
        *id2y = -1;
        signal[2] = 1;
      } else {
        *id2x = idx;
        *id2y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    if (currGroupID == 3) {
      if (cnt >= total) {
        *id3x = -1;
        *id3y = -1;
        signal[3] = 1;
      } else {
        *id3x = idx;
        *id3y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    if (currGroupID == 4) {
      if (cnt >= total) {
        *id4x = -1;
        *id4y = -1;
        signal[4] = 1;
      } else {
        *id4x = idx;
        *id4y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    if (currGroupID == 5) {
      if (cnt >= total) {
        *id5x = -1;
        *id5y = -1;
        signal[5] = 1;
      } else {
        *id5x = idx;
        *id5y = idy;
        idx = incX(idx, idy, numOfX, numOfY);
        idy = incY(idx, idy, numOfX, numOfY);
        cnt = cnt + 1;
      }
    }
    for (i = 0; i < currNumGroup; i++) {
      if (signal[i] == 1)
        finish = 1;
      else {
        finish = 0;
        i = currNumGroup;
      }
    }
  }
}


x86 assembly (clang, -O0):
<groupIDGenerator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
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)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0x1,-0x44(%rbp)
je     152a <groupIDGenerator+0x3fa>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jne    1261 <groupIDGenerator+0x131>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     1219 <groupIDGenerator+0xe9>
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x30(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x60(%rbp)
jmp    125c <groupIDGenerator+0x12c>
mov    -0x64(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1261 <groupIDGenerator+0x131>
cmpl   $0x1,-0x70(%rbp)
jne    12df <groupIDGenerator+0x1af>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     1297 <groupIDGenerator+0x167>
mov    0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x5c(%rbp)
jmp    12da <groupIDGenerator+0x1aa>
mov    -0x64(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12df <groupIDGenerator+0x1af>
cmpl   $0x2,-0x70(%rbp)
jne    135d <groupIDGenerator+0x22d>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     1315 <groupIDGenerator+0x1e5>
mov    0x20(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x58(%rbp)
jmp    1358 <groupIDGenerator+0x228>
mov    -0x64(%rbp),%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    135d <groupIDGenerator+0x22d>
cmpl   $0x3,-0x70(%rbp)
jne    13db <groupIDGenerator+0x2ab>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     1393 <groupIDGenerator+0x263>
mov    0x30(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    0x38(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x54(%rbp)
jmp    13d6 <groupIDGenerator+0x2a6>
mov    -0x64(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    13db <groupIDGenerator+0x2ab>
cmpl   $0x4,-0x70(%rbp)
jne    1459 <groupIDGenerator+0x329>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     1411 <groupIDGenerator+0x2e1>
mov    0x40(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    0x48(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x50(%rbp)
jmp    1454 <groupIDGenerator+0x324>
mov    -0x64(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    0x48(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1459 <groupIDGenerator+0x329>
cmpl   $0x5,-0x70(%rbp)
jne    14d7 <groupIDGenerator+0x3a7>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jb     148f <groupIDGenerator+0x35f>
mov    0x50(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    0x58(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x4c(%rbp)
jmp    14d2 <groupIDGenerator+0x3a2>
mov    -0x64(%rbp),%ecx
mov    0x50(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%ecx
mov    0x58(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1050 <incX@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <incY@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    14d7 <groupIDGenerator+0x3a7>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jae    1525 <groupIDGenerator+0x3f5>
movslq -0x6c(%rbp),%rax
cmpl   $0x1,-0x60(%rbp,%rax,4)
jne    1505 <groupIDGenerator+0x3d5>
movl   $0x1,-0x44(%rbp)
jmp    1512 <groupIDGenerator+0x3e2>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x6c(%rbp)
jmp    1517 <groupIDGenerator+0x3e7>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    14de <groupIDGenerator+0x3ae>
jmp    11d0 <groupIDGenerator+0xa0>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<groupIDGenerator>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x38(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,0x40(%rsp)
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rsp)
mov    %eax,0x4(%rsp)
imul   %eax,%ecx
mov    (%rdx),%r12d
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
xor    %r15d,%r15d
lea    0xe97(%rip),%rbp
xor    %r14d,%r14d
xor    %edx,%edx
mov    %ecx,0x8(%rsp)
jmp    1190 <groupIDGenerator+0x70>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
test   %eax,%eax
jne    1417 <groupIDGenerator+0x2f7>
mov    0x40(%rsp),%rax
mov    (%rax),%eax
cmp    $0x5,%rax
ja     12fe <groupIDGenerator+0x1de>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
cmp    0x8(%rsp),%edx
jae    132d <groupIDGenerator+0x20d>
mov    0x30(%rsp),%rax
mov    %r14d,(%rax)
mov    0x38(%rsp),%rax
mov    %r15d,(%rax)
mov    %r14d,%edi
mov    %r15d,%esi
mov    0x4(%rsp),%r13d
mov    %edx,0xc(%rsp)
mov    %r13d,%edx
mov    (%rsp),%ebx
mov    %ebx,%ecx
call   1040 <incX@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %ebx,%ecx
jmp    1239 <groupIDGenerator+0x119>
cmp    0x8(%rsp),%edx
jae    134d <groupIDGenerator+0x22d>
mov    0x80(%rsp),%rax
mov    %r14d,(%rax)
mov    0x88(%rsp),%rax
mov    %r15d,(%rax)
mov    %r14d,%edi
mov    %r15d,%esi
mov    0x4(%rsp),%ebx
mov    %edx,0xc(%rsp)
mov    %ebx,%edx
mov    (%rsp),%r13d
mov    %r13d,%ecx
call   1040 <incX@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %r13d,%ecx
call   1030 <incY@plt>
mov    0xc(%rsp),%edx
jmp    12f8 <groupIDGenerator+0x1d8>
cmp    0x8(%rsp),%edx
jae    1373 <groupIDGenerator+0x253>
mov    0x90(%rsp),%rax
mov    %r14d,(%rax)
mov    0x98(%rsp),%rax
jmp    12c1 <groupIDGenerator+0x1a1>
cmp    0x8(%rsp),%edx
jae    139c <groupIDGenerator+0x27c>
mov    0xa0(%rsp),%rax
mov    %r14d,(%rax)
mov    0xa8(%rsp),%rax
jmp    12c1 <groupIDGenerator+0x1a1>
cmp    0x8(%rsp),%edx
jae    13c5 <groupIDGenerator+0x2a5>
mov    0xb0(%rsp),%rax
mov    %r14d,(%rax)
mov    0xb8(%rsp),%rax
jmp    12c1 <groupIDGenerator+0x1a1>
cmp    0x8(%rsp),%edx
jae    13ee <groupIDGenerator+0x2ce>
mov    0xc0(%rsp),%rax
mov    %r14d,(%rax)
mov    0xc8(%rsp),%rax
mov    %r15d,(%rax)
mov    %r14d,%edi
mov    %r15d,%esi
mov    0x4(%rsp),%ebx
mov    %edx,%r13d
mov    %ebx,%edx
mov    (%rsp),%ebp
mov    %ebp,%ecx
call   1040 <incX@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
lea    0xd10(%rip),%rbp
call   1030 <incY@plt>
mov    %r13d,%edx
mov    %eax,%r15d
add    $0x1,%edx
xor    %eax,%eax
test   %r12d,%r12d
jne    131c <groupIDGenerator+0x1fc>
jmp    1188 <groupIDGenerator+0x68>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmp    %r12d,%eax
jae    1180 <groupIDGenerator+0x60>
movslq %eax,%rcx
mov    0x10(%rsp,%rcx,4),%ecx
cmp    $0x1,%ecx
je     1310 <groupIDGenerator+0x1f0>
mov    %r12d,%eax
jmp    1310 <groupIDGenerator+0x1f0>
mov    0x30(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0x38(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x10(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
mov    0x80(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0x88(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x14(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
mov    0x90(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0x98(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x18(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
mov    0xa0(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0xa8(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x1c(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
mov    0xb0(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0xb8(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x20(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
mov    0xc0(%rsp),%rax
movl   $0xffffffff,(%rax)
mov    0xc8(%rsp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,0x24(%rsp)
jmp    12fe <groupIDGenerator+0x1de>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @groupIDGenerator(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32* %15) {
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32*
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca i32*
%30 = alloca i32*
%31 = alloca i32*
%32 = alloca i32*
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca [6 x i32]
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
store i32* %0, i32** %17
store i32* %1, i32** %18
store i32* %2, i32** %19
store i32* %3, i32** %20
store i32* %4, i32** %21
store i32* %5, i32** %22
store i32* %6, i32** %23
store i32* %7, i32** %24
store i32* %8, i32** %25
store i32* %9, i32** %26
store i32* %10, i32** %27
store i32* %11, i32** %28
store i32* %12, i32** %29
store i32* %13, i32** %30
store i32* %14, i32** %31
store i32* %15, i32** %32
%44 = load i32*, i32** %17
%45 = load i32, i32* %44
store i32 %45, i32* %33
%46 = load i32*, i32** %18
%47 = load i32, i32* %46
store i32 %47, i32* %34
%48 = load i32, i32* %33
%49 = load i32, i32* %34
%50 = mul nsw i32 %48, %49
store i32 %50, i32* %35
%51 = load i32*, i32** %19
%52 = load i32, i32* %51
store i32 %52, i32* %36
store i32 0, i32* %37
store i32 0, i32* %38
%53 = bitcast [6 x i32]* %39 to i8*
store i32 0, i32* %40
store i32 0, i32* %41
store i32 0, i32* %42
br label %54
54: ; preds = %251, %16
%55 = load i32, i32* %37
%56 = icmp ne i32 %55, 1
br i1 %56, label %57, label %252
57: ; preds = %54
%58 = load i32*, i32** %20
%59 = load i32, i32* %58
store i32 %59, i32* %43
%60 = load i32, i32* %43
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %88
62: ; preds = %57
%63 = load i32, i32* %38
%64 = load i32, i32* %35
%65 = icmp uge i32 %63, %64
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load i32*, i32** %21
store i32 -1, i32* %67
%68 = load i32*, i32** %22
store i32 -1, i32* %68
%69 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 0
store i32 1, i32* %69
br label %87
70: ; preds = %62
%71 = load i32, i32* %40
%72 = load i32*, i32** %21
store i32 %71, i32* %72
%73 = load i32, i32* %41
%74 = load i32*, i32** %22
store i32 %73, i32* %74
%75 = load i32, i32* %40
%76 = load i32, i32* %41
%77 = load i32, i32* %33
%78 = load i32, i32* %34
%79 = call i32 @incX(i32 %75, i32 %76, i32 %77, i32 %78)
store i32 %79, i32* %40
%80 = load i32, i32* %40
%81 = load i32, i32* %41
%82 = load i32, i32* %33
%83 = load i32, i32* %34
%84 = call i32 @incY(i32 %80, i32 %81, i32 %82, i32 %83)
store i32 %84, i32* %41
%85 = load i32, i32* %38
%86 = add i32 %85, 1
store i32 %86, i32* %38
br label %87
87: ; preds = %70, %66
br label %88
88: ; preds = %87, %57
%89 = load i32, i32* %43
%90 = icmp eq i32 %89, 1
br i1 %90, label %91, label %117
91: ; preds = %88
%92 = load i32, i32* %38
%93 = load i32, i32* %35
%94 = icmp uge i32 %92, %93
br i1 %94, label %95, label %99
95: ; preds = %91
%96 = load i32*, i32** %23
store i32 -1, i32* %96
%97 = load i32*, i32** %24
store i32 -1, i32* %97
%98 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 1
store i32 1, i32* %98
br label %116
99: ; preds = %91
%100 = load i32, i32* %40
%101 = load i32*, i32** %23
store i32 %100, i32* %101
%102 = load i32, i32* %41
%103 = load i32*, i32** %24
store i32 %102, i32* %103
%104 = load i32, i32* %40
%105 = load i32, i32* %41
%106 = load i32, i32* %33
%107 = load i32, i32* %34
%108 = call i32 @incX(i32 %104, i32 %105, i32 %106, i32 %107)
store i32 %108, i32* %40
%109 = load i32, i32* %40
%110 = load i32, i32* %41
%111 = load i32, i32* %33
%112 = load i32, i32* %34
%113 = call i32 @incY(i32 %109, i32 %110, i32 %111, i32 %112)
store i32 %113, i32* %41
%114 = load i32, i32* %38
%115 = add i32 %114, 1
store i32 %115, i32* %38
br label %116
116: ; preds = %99, %95
br label %117
117: ; preds = %116, %88
%118 = load i32, i32* %43
%119 = icmp eq i32 %118, 2
br i1 %119, label %120, label %146
120: ; preds = %117
%121 = load i32, i32* %38
%122 = load i32, i32* %35
%123 = icmp uge i32 %121, %122
br i1 %123, label %124, label %128
124: ; preds = %120
%125 = load i32*, i32** %25
store i32 -1, i32* %125
%126 = load i32*, i32** %26
store i32 -1, i32* %126
%127 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 2
store i32 1, i32* %127
br label %145
128: ; preds = %120
%129 = load i32, i32* %40
%130 = load i32*, i32** %25
store i32 %129, i32* %130
%131 = load i32, i32* %41
%132 = load i32*, i32** %26
store i32 %131, i32* %132
%133 = load i32, i32* %40
%134 = load i32, i32* %41
%135 = load i32, i32* %33
%136 = load i32, i32* %34
%137 = call i32 @incX(i32 %133, i32 %134, i32 %135, i32 %136)
store i32 %137, i32* %40
%138 = load i32, i32* %40
%139 = load i32, i32* %41
%140 = load i32, i32* %33
%141 = load i32, i32* %34
%142 = call i32 @incY(i32 %138, i32 %139, i32 %140, i32 %141)
store i32 %142, i32* %41
%143 = load i32, i32* %38
%144 = add i32 %143, 1
store i32 %144, i32* %38
br label %145
145: ; preds = %128, %124
br label %146
146: ; preds = %145, %117
%147 = load i32, i32* %43
%148 = icmp eq i32 %147, 3
br i1 %148, label %149, label %175
149: ; preds = %146
%150 = load i32, i32* %38
%151 = load i32, i32* %35
%152 = icmp uge i32 %150, %151
br i1 %152, label %153, label %157
153: ; preds = %149
%154 = load i32*, i32** %27
store i32 -1, i32* %154
%155 = load i32*, i32** %28
store i32 -1, i32* %155
%156 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 3
store i32 1, i32* %156
br label %174
157: ; preds = %149
%158 = load i32, i32* %40
%159 = load i32*, i32** %27
store i32 %158, i32* %159
%160 = load i32, i32* %41
%161 = load i32*, i32** %28
store i32 %160, i32* %161
%162 = load i32, i32* %40
%163 = load i32, i32* %41
%164 = load i32, i32* %33
%165 = load i32, i32* %34
%166 = call i32 @incX(i32 %162, i32 %163, i32 %164, i32 %165)
store i32 %166, i32* %40
%167 = load i32, i32* %40
%168 = load i32, i32* %41
%169 = load i32, i32* %33
%170 = load i32, i32* %34
%171 = call i32 @incY(i32 %167, i32 %168, i32 %169, i32 %170)
store i32 %171, i32* %41
%172 = load i32, i32* %38
%173 = add i32 %172, 1
store i32 %173, i32* %38
br label %174
174: ; preds = %157, %153
br label %175
175: ; preds = %174, %146
%176 = load i32, i32* %43
%177 = icmp eq i32 %176, 4
br i1 %177, label %178, label %204
178: ; preds = %175
%179 = load i32, i32* %38
%180 = load i32, i32* %35
%181 = icmp uge i32 %179, %180
br i1 %181, label %182, label %186
182: ; preds = %178
%183 = load i32*, i32** %29
store i32 -1, i32* %183
%184 = load i32*, i32** %30
store i32 -1, i32* %184
%185 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 4
store i32 1, i32* %185
br label %203
186: ; preds = %178
%187 = load i32, i32* %40
%188 = load i32*, i32** %29
store i32 %187, i32* %188
%189 = load i32, i32* %41
%190 = load i32*, i32** %30
store i32 %189, i32* %190
%191 = load i32, i32* %40
%192 = load i32, i32* %41
%193 = load i32, i32* %33
%194 = load i32, i32* %34
%195 = call i32 @incX(i32 %191, i32 %192, i32 %193, i32 %194)
store i32 %195, i32* %40
%196 = load i32, i32* %40
%197 = load i32, i32* %41
%198 = load i32, i32* %33
%199 = load i32, i32* %34
%200 = call i32 @incY(i32 %196, i32 %197, i32 %198, i32 %199)
store i32 %200, i32* %41
%201 = load i32, i32* %38
%202 = add i32 %201, 1
store i32 %202, i32* %38
br label %203
203: ; preds = %186, %182
br label %204
204: ; preds = %203, %175
%205 = load i32, i32* %43
%206 = icmp eq i32 %205, 5
br i1 %206, label %207, label %233
207: ; preds = %204
%208 = load i32, i32* %38
%209 = load i32, i32* %35
%210 = icmp uge i32 %208, %209
br i1 %210, label %211, label %215
211: ; preds = %207
%212 = load i32*, i32** %31
store i32 -1, i32* %212
%213 = load i32*, i32** %32
store i32 -1, i32* %213
%214 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 5
store i32 1, i32* %214
br label %232
215: ; preds = %207
%216 = load i32, i32* %40
%217 = load i32*, i32** %31
store i32 %216, i32* %217
%218 = load i32, i32* %41
%219 = load i32*, i32** %32
store i32 %218, i32* %219
%220 = load i32, i32* %40
%221 = load i32, i32* %41
%222 = load i32, i32* %33
%223 = load i32, i32* %34
%224 = call i32 @incX(i32 %220, i32 %221, i32 %222, i32 %223)
store i32 %224, i32* %40
%225 = load i32, i32* %40
%226 = load i32, i32* %41
%227 = load i32, i32* %33
%228 = load i32, i32* %34
%229 = call i32 @incY(i32 %225, i32 %226, i32 %227, i32 %228)
store i32 %229, i32* %41
%230 = load i32, i32* %38
%231 = add i32 %230, 1
store i32 %231, i32* %38
br label %232
232: ; preds = %215, %211
br label %233
233: ; preds = %232, %204
store i32 0, i32* %42
br label %234
234: ; preds = %248, %233
%235 = load i32, i32* %42
%236 = load i32, i32* %36
%237 = icmp ult i32 %235, %236
br i1 %237, label %238, label %251
238: ; preds = %234
%239 = load i32, i32* %42
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 %240
%242 = load i32, i32* %241
%243 = icmp eq i32 %242, 1
br i1 %243, label %244, label %245
244: ; preds = %238
store i32 1, i32* %37
br label %247
245: ; preds = %238
store i32 0, i32* %37
%246 = load i32, i32* %36
store i32 %246, i32* %42
br label %247
247: ; preds = %245, %244
br label %248
248: ; preds = %247
%249 = load i32, i32* %42
%250 = add nsw i32 %249, 1
store i32 %250, i32* %42
br label %234
251: ; preds = %234
br label %54
252: ; preds = %54
ret void
}

LLVM IR (-O2):
define void @groupIDGenerator(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7, i32* nocapture writeonly %8, i32* nocapture writeonly %9, i32* nocapture writeonly %10, i32* nocapture writeonly %11, i32* nocapture writeonly %12, i32* nocapture writeonly %13, i32* nocapture writeonly %14, i32* nocapture writeonly %15) {
%17 = alloca [6 x i32]
%18 = load i32, i32* %0
%19 = load i32, i32* %1
%20 = mul nsw i32 %19, %18
%21 = load i32, i32* %2
%22 = bitcast [6 x i32]* %17 to i8*
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 5
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 4
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 3
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 2
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 1
%28 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%29 = icmp eq i32 %21, 0
br label %35
30: ; preds = %86
%31 = zext i1 %91 to i32
br label %32
32: ; preds = %30, %82
%33 = phi i32 [ %31, %30 ], [ 0, %82 ]
%34 = icmp eq i32 %33, 1
br i1 %34, label %95, label %35
35: ; preds = %16, %32
%36 = phi i32 [ 0, %16 ], [ %85, %32 ]
%37 = phi i32 [ 0, %16 ], [ %84, %32 ]
%38 = phi i32 [ 0, %16 ], [ %83, %32 ]
%39 = load i32, i32* %3
switch i32 %39, label %82 [
i32 0, label %40
i32 1, label %47
i32 2, label %54
i32 3, label %61
i32 4, label %68
i32 5, label %75
]
40: ; preds = %35
%41 = icmp ult i32 %38, %20
br i1 %41, label %43, label %42
42: ; preds = %40
store i32 -1, i32* %4
store i32 -1, i32* %5
store i32 1, i32* %28
br label %82
43: ; preds = %40
store i32 %37, i32* %4
store i32 %36, i32* %5
%44 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%45 = tail call i32 @incY(i32 %44, i32 %36, i32 %18, i32 %19)
%46 = add nuw i32 %38, 1
br label %82
47: ; preds = %35
%48 = icmp ult i32 %38, %20
br i1 %48, label %50, label %49
49: ; preds = %47
store i32 -1, i32* %6
store i32 -1, i32* %7
store i32 1, i32* %27
br label %82
50: ; preds = %47
store i32 %37, i32* %6
store i32 %36, i32* %7
%51 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%52 = tail call i32 @incY(i32 %51, i32 %36, i32 %18, i32 %19)
%53 = add nuw i32 %38, 1
br label %82
54: ; preds = %35
%55 = icmp ult i32 %38, %20
br i1 %55, label %57, label %56
56: ; preds = %54
store i32 -1, i32* %8
store i32 -1, i32* %9
store i32 1, i32* %26
br label %82
57: ; preds = %54
store i32 %37, i32* %8
store i32 %36, i32* %9
%58 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%59 = tail call i32 @incY(i32 %58, i32 %36, i32 %18, i32 %19)
%60 = add nuw i32 %38, 1
br label %82
61: ; preds = %35
%62 = icmp ult i32 %38, %20
br i1 %62, label %64, label %63
63: ; preds = %61
store i32 -1, i32* %10
store i32 -1, i32* %11
store i32 1, i32* %25
br label %82
64: ; preds = %61
store i32 %37, i32* %10
store i32 %36, i32* %11
%65 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%66 = tail call i32 @incY(i32 %65, i32 %36, i32 %18, i32 %19)
%67 = add nuw i32 %38, 1
br label %82
68: ; preds = %35
%69 = icmp ult i32 %38, %20
br i1 %69, label %71, label %70
70: ; preds = %68
store i32 -1, i32* %12
store i32 -1, i32* %13
store i32 1, i32* %24
br label %82
71: ; preds = %68
store i32 %37, i32* %12
store i32 %36, i32* %13
%72 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%73 = tail call i32 @incY(i32 %72, i32 %36, i32 %18, i32 %19)
%74 = add nuw i32 %38, 1
br label %82
75: ; preds = %35
%76 = icmp ult i32 %38, %20
br i1 %76, label %78, label %77
77: ; preds = %75
store i32 -1, i32* %14
store i32 -1, i32* %15
store i32 1, i32* %23
br label %82
78: ; preds = %75
store i32 %37, i32* %14
store i32 %36, i32* %15
%79 = tail call i32 @incX(i32 %37, i32 %36, i32 %18, i32 %19)
%80 = tail call i32 @incY(i32 %79, i32 %36, i32 %18, i32 %19)
%81 = add nuw i32 %38, 1
br label %82
82: ; preds = %35, %43, %42, %50, %49, %57, %56, %64, %63, %71, %70, %77, %78
%83 = phi i32 [ %38, %77 ], [ %81, %78 ], [ %74, %71 ], [ %38, %70 ], [ %67, %64 ], [ %38, %63 ], [ %60, %57 ], [ %38, %56 ], [ %53, %50 ], [ %38, %49 ], [ %46, %43 ], [ %38, %42 ], [ %38, %35 ]
%84 = phi i32 [ %37, %77 ], [ %79, %78 ], [ %72, %71 ], [ %37, %70 ], [ %65, %64 ], [ %37, %63 ], [ %58, %57 ], [ %37, %56 ], [ %51, %50 ], [ %37, %49 ], [ %44, %43 ], [ %37, %42 ], [ %37, %35 ]
%85 = phi i32 [ %36, %77 ], [ %80, %78 ], [ %73, %71 ], [ %36, %70 ], [ %66, %64 ], [ %36, %63 ], [ %59, %57 ], [ %36, %56 ], [ %52, %50 ], [ %36, %49 ], [ %45, %43 ], [ %36, %42 ], [ %36, %35 ]
br i1 %29, label %32, label %86
86: ; preds = %82, %86
%87 = phi i32 [ %93, %86 ], [ 0, %82 ]
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 %88
%90 = load i32, i32* %89
%91 = icmp eq i32 %90, 1
%92 = select i1 %91, i32 %87, i32 %21
%93 = add nsw i32 %92, 1
%94 = icmp ult i32 %93, %21
br i1 %94, label %86, label %30
95: ; preds = %32
ret void
}