#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 getPosition(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int printBoard(int *board, int n, int sCount) {
  int i, j;
  printf("%d:\n", sCount);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++)
      if (i == getPosition(board, j))
        if (board[j] < 0)
          printf(" I");
        else
          printf(" C");
      else
        printf(" _");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printBoard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fd <printBoard+0xdd>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e1 <printBoard+0xc1>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <getPosition@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jne    11c0 <printBoard+0xa0>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    11ad <printBoard+0x8d>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <printBoard+0x9b>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <printBoard+0xae>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <printBoard+0xb3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115d <printBoard+0x3d>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <printBoard+0x2a>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBoard>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xeb9(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    11c4 <printBoard+0x94>
mov    %ebx,%r15d
lea    0xead(%rip),%r12
lea    0xea0(%rip),%r13
xor    %ebp,%ebp
jmp    1182 <printBoard+0x52>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r15d,%ebp
je     11c4 <printBoard+0x94>
xor    %ebx,%ebx
jmp    11a0 <printBoard+0x70>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     1170 <printBoard+0x40>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <getPosition@plt>
mov    %r12,%rdi
cmp    %eax,%ebp
jne    1190 <printBoard+0x60>
cmpl   $0x0,(%r14,%rbx,4)
mov    %r13,%rdi
js     1190 <printBoard+0x60>
lea    0xe46(%rip),%rdi
jmp    1190 <printBoard+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d:\0A\00"
@.str.1 = [3 x i8] c" I\00"
@.str.2 = [3 x i8] c" C\00"
@.str.3 = [3 x i8] c" _\00"
define i32 @printBoard(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %25, %6
%9 = phi i32 [ 0, %6 ], [ %27, %25 ]
br label %10
10: ; preds = %8, %20
%11 = phi i64 [ 0, %8 ], [ %23, %20 ]
%12 = trunc i64 %11 to i32
%13 = tail call i32 @getPosition(i32* %0, i32 %12)
%14 = icmp eq i32 %9, %13
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = getelementptr inbounds i32, i32* %0, i64 %11
%17 = load i32, i32* %16
%18 = icmp slt i32 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
br label %20
20: ; preds = %10, %15
%21 = phi i8* [ %19, %15 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %10 ]
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %21)
%23 = add nuw nsw i64 %11, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %10
25: ; preds = %20
%26 = tail call i32 @putchar(i32 10)
%27 = add nuw nsw i32 %9, 1
%28 = icmp eq i32 %27, %1
br i1 %28, label %29, label %8
29: ; preds = %25, %3
ret i32 undef
}