#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 /*<<< orphan*/ printf(char *, ...);
void dump_distrib_groups(int *distrib_groups, int nr_d) {
  int i, j;
  printf("\ndistribution groups dump:\n");
  for (i = 0; i < nr_d; i++) {
    printf("Group %d: ", i + 1);
    while (1) {
      if (*distrib_groups == -999) {
        distrib_groups++;
        printf("\n");
        break;
      } else {
        printf("%d ", *distrib_groups);
        distrib_groups++;
      }
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_distrib_groups>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c4 <dump_distrib_groups+0xb4>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0xfffffc19,(%rax)
jne    1183 <dump_distrib_groups+0x73>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <dump_distrib_groups+0x98>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <dump_distrib_groups+0x44>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <dump_distrib_groups+0x24>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_distrib_groups>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11cb <dump_distrib_groups+0x9b>
lea    0xeaa(%rip),%r14
lea    0xeae(%rip),%rbp
xor    %r12d,%r12d
jmp    118d <dump_distrib_groups+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x4,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r15d,%r12d
je     11cb <dump_distrib_groups+0x9b>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%esi
cmp    $0xfffffc19,%esi
je     1170 <dump_distrib_groups+0x40>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
add    $0x4,%rbx
cmp    $0xfffffc19,%esi
jne    11b0 <dump_distrib_groups+0x80>
jmp    1170 <dump_distrib_groups+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"\0Adistribution groups dump:\0A\00"
@.str.1 = [11 x i8] c"Group %d: \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%d \00"
define void @dump_distrib_groups(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %8
8: ; preds = %33, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %12, %30
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, -999
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
24: ; preds = %16
%25 = load i32*, i32** %3
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32*, i32** %3
%29 = getelementptr inbounds i32, i32* %28, i32 1
store i32* %29, i32** %3
br label %30
30: ; preds = %24
br label %16
31: ; preds = %20
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %8
36: ; preds = %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"Group %d: \00"
@.str.3 = [4 x i8] c"%d \00"
@str = [27 x i8] c"\0Adistribution groups dump:\00"
define void @dump_distrib_groups(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %25
5: ; preds = %2, %12
%6 = phi i32* [ %14, %12 ], [ %0, %2 ]
%7 = phi i32 [ %8, %12 ], [ 0, %2 ]
%8 = add nuw nsw i32 %7, 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -999
br i1 %11, label %12, label %18
12: ; preds = %18, %5
%13 = phi i32* [ %6, %5 ], [ %22, %18 ]
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 @putchar(i32 10)
%17 = icmp eq i32 %8, %1
br i1 %17, label %25, label %5
18: ; preds = %5, %18
%19 = phi i32 [ %23, %18 ], [ %10, %5 ]
%20 = phi i32* [ %22, %18 ], [ %6, %5 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%22 = getelementptr inbounds i32, i32* %20, i64 1
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, -999
br i1 %24, label %12, label %18
25: ; preds = %12, %2
%26 = tail call i32 @putchar(i32 10)
ret void
}