#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 print_1D_array(int *array, int max_size, bool chessboard, bool debug) {
  const char QUEEN_CHAR[] = "Q";
  for (int i = 0; i < max_size; i++) {
    if (chessboard) {
      if (debug) {
        printf("%i  ", array[i]);
      } else {
        if (array[i] == 0) {
          printf(" %s ", QUEEN_CHAR);
        } else {
          printf(" \u2593 ");
        }
      }
    } else {
      printf("%i  ", array[i]);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_1D_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0xed4(%rip),%ax
mov    %ax,-0x16(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e2 <print_1D_array+0xd2>
cmpl   $0x0,-0x10(%rbp)
je     11b6 <print_1D_array+0xa6>
cmpl   $0x0,-0x14(%rbp)
je     1175 <print_1D_array+0x65>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <print_1D_array+0xa1>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    119e <print_1D_array+0x8e>
lea    -0x16(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ac <print_1D_array+0x9c>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <print_1D_array+0xa1>
jmp    11cf <print_1D_array+0xbf>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <print_1D_array+0xc4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <print_1D_array+0x27>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_1D_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movw   $0x51,0x6(%rsp)
test   %esi,%esi
jle    1199 <print_1D_array+0x79>
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %esi,%r13d
lea    0xeb8(%rip),%r15
xor    %r12d,%r12d
jmp    1163 <print_1D_array+0x43>
nopl   (%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r13
je     1199 <print_1D_array+0x79>
mov    (%rbx,%r12,4),%esi
test   %ebp,%ebp
je     1150 <print_1D_array+0x30>
test   %r14d,%r14d
jne    1150 <print_1D_array+0x30>
test   %esi,%esi
je     1184 <print_1D_array+0x64>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    115a <print_1D_array+0x3a>
lea    0xe7a(%rip),%rdi
lea    0x6(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    115a <print_1D_array+0x3a>
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):
@__const.print_1D_array.QUEEN_CHAR = [2 x i8] c"Q\00"
@.str = [5 x i8] c"%i \00"
@.str.1 = [5 x i8] c" %s \00"
@.str.2 = [6 x i8] c" \E2\96\93 \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_1D_array(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x i8]
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = bitcast [2 x i8]* %9 to i8*
store i32 0, i32* %10
br label %12
12: ; preds = %51, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %54
16: ; preds = %12
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %43
19: ; preds = %16
%20 = load i32, i32* %8
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %42
29: ; preds = %19
%30 = load i32*, i32** %5
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %37)
br label %41
39: ; preds = %29
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
br label %42
42: ; preds = %41, %22
br label %50
43: ; preds = %16
%44 = load i32*, i32** %5
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %43, %42
br label %51
51: ; preds = %50
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %12
54: ; preds = %12
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%i \00"
@.str.1 = [5 x i8] c" %s \00"
@.str.2 = [6 x i8] c" \E2\96\93 \00"
define void @print_1D_array(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i16
%6 = bitcast i16* %5 to i8*
store i16 81, i16* %5
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = icmp eq i32 %2, 0
%10 = icmp eq i32 %3, 0
%11 = zext i32 %1 to i64
br label %14
12: ; preds = %29, %4
%13 = call i32 @putchar(i32 10)
ret void
14: ; preds = %8, %29
%15 = phi i64 [ 0, %8 ], [ %30, %29 ]
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
br i1 %9, label %27, label %18
18: ; preds = %14
br i1 %10, label %21, label %19
19: ; preds = %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %29
21: ; preds = %18
%22 = icmp eq i32 %17, 0
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i16* %5)
br label %29
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %29
29: ; preds = %27, %23, %25, %19
%30 = add nuw nsw i64 %15, 1
%31 = icmp eq i64 %30, %11
br i1 %31, label %12, label %14
}