#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 color_label(int);
int /*<<< orphan*/ printf(char *, ...);
print_conflicts(char *conflicts, int num_colors) {
  printf(" ");
  for (int i = 0; i < num_colors; ++i) {
    printf(" %c", color_label(i));
  }
  printf("\n");
  for (int i = 0; i < num_colors; ++i) {
    printf("%c", color_label(i));
    for (int j = 0; j < num_colors; ++j) {
      if (conflicts[i + j * num_colors]) {
        printf(" @");
      } else {
        printf("  ");
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_conflicts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1176 <print_conflicts+0x56>
mov    -0x18(%rbp),%edi
call   1040 <color_label@plt>
mov    %eax,%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <print_conflicts+0x24>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    122f <print_conflicts+0x10f>
mov    -0x1c(%rbp),%edi
call   1040 <color_label@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1213 <print_conflicts+0xf3>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11f2 <print_conflicts+0xd2>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1200 <print_conflicts+0xe0>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <print_conflicts+0xe5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b6 <print_conflicts+0x96>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <print_conflicts+0x6b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_conflicts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    120e <print_conflicts+0xde>
lea    0xea7(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <color_label@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1160 <print_conflicts+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    1218 <print_conflicts+0xe8>
mov    %ebx,%ebx
lea    0xe72(%rip),%r13
lea    0xe68(%rip),%r12
xor    %r15d,%r15d
jmp    11cb <print_conflicts+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
mov    (%rsp),%r14
add    $0x1,%r14
cmp    %rbx,%r15
je     1218 <print_conflicts+0xe8>
mov    %r15d,%edi
call   1050 <color_label@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    %rbx,%rbp
mov    %r14,(%rsp)
jmp    1200 <print_conflicts+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <printf@plt>
add    %rbx,%r14
add    $0xffffffffffffffff,%rbp
je     11b0 <print_conflicts+0x80>
cmpb   $0x0,(%r14)
mov    %r13,%rdi
je     11f0 <print_conflicts+0xc0>
mov    %r12,%rdi
jmp    11f0 <print_conflicts+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c" @\00"
@.str.5 = [3 x i8] c" \00"
define i32 @print_conflicts(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %6
%16 = call i32 @color_label(i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %10
21: ; preds = %10
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %23
23: ; preds = %56, %21
%24 = load i32, i32* %7
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %59
27: ; preds = %23
%28 = load i32, i32* %7
%29 = call i32 @color_label(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %29)
store i32 0, i32* %8
br label %31
31: ; preds = %51, %27
%32 = load i32, i32* %8
%33 = load i32, i32* %5
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %54
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = load i32, i32* %5
%40 = mul nsw i32 %38, %39
%41 = add nsw i32 %37, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %36, i64 %42
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %35
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %50
48: ; preds = %35
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %31
54: ; preds = %31
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %23
59: ; preds = %23
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c" %c\00"
@.str.4 = [3 x i8] c" @\00"
@.str.5 = [3 x i8] c" \00"
define i32 @print_conflicts(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @putchar(i32 32)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i32 @putchar(i32 10)
br label %18
7: ; preds = %12
%8 = tail call i32 @putchar(i32 10)
br i1 %4, label %9, label %18
9: ; preds = %7
%10 = zext i32 %1 to i64
%11 = zext i32 %1 to i64
br label %19
12: ; preds = %2, %12
%13 = phi i32 [ %16, %12 ], [ 0, %2 ]
%14 = tail call i32 @color_label(i32 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i32 %13, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %7, label %12
18: ; preds = %24, %5, %7
ret i32 undef
19: ; preds = %24, %9
%20 = phi i64 [ 0, %9 ], [ %26, %24 ]
%21 = trunc i64 %20 to i32
%22 = tail call i32 @color_label(i32 %21)
%23 = tail call i32 @putchar(i32 %22)
br label %28
24: ; preds = %28
%25 = tail call i32 @putchar(i32 10)
%26 = add nuw nsw i64 %20, 1
%27 = icmp eq i64 %26, %11
br i1 %27, label %18, label %19
28: ; preds = %19, %28
%29 = phi i64 [ 0, %19 ], [ %37, %28 ]
%30 = mul nsw i64 %29, %10
%31 = add nuw nsw i64 %30, %20
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %35)
%37 = add nuw nsw i64 %29, 1
%38 = icmp eq i64 %37, %11
br i1 %38, label %24, label %28
}