#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 */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_empty_board(uint16_t size) {
  for (uint16_t i = 0; i < 2 * size; i++) {
    for (uint16_t j = 0; j < size; j++) {
      if (i % 2 == 0) {
        if (j != size - 1)
          printf(".-");
        else
          printf(". %d", i / 2);
      } else {
        if (i != 2 * size - 1) {
          if (j != size - 1)
            printf("| ");
          else
            printf("|");
        } else {
          if (j != size - 1)
            printf("%d ", j);
          else
            printf("%d", j);
        }
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_empty_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    125a <print_empty_board+0x14a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    123e <print_empty_board+0x12e>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119e <print_empty_board+0x8e>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     117e <print_empty_board+0x6e>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1199 <print_empty_board+0x89>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <print_empty_board+0x11b>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11e9 <print_empty_board+0xd9>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11d6 <print_empty_board+0xc6>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e4 <print_empty_board+0xd4>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <print_empty_board+0x116>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1210 <print_empty_board+0x100>
mov    -0xc(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <print_empty_board+0x111>
mov    -0xc(%rbp),%esi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <print_empty_board+0x116>
jmp    122b <print_empty_board+0x11b>
jmp    1230 <print_empty_board+0x120>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <print_empty_board+0x2a>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_empty_board+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_empty_board>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    120e <print_empty_board+0xee>
mov    %edi,%ebx
lea    (%rbx,%rbx,1),%eax
lea    -0x1(%rax),%r14d
cmp    $0x2,%eax
mov    $0x1,%ecx
cmovge %eax,%ecx
mov    %ecx,(%rsp)
lea    -0x1(%rbx),%eax
mov    %eax,0x4(%rsp)
neg    %ebx
lea    0xea6(%rip),%rbp
xor    %r13d,%r13d
jmp    1178 <print_empty_board+0x58>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    (%rsp),%r13d
je     120e <print_empty_board+0xee>
mov    %r13d,%r15d
shr    %r15d
xor    %r12d,%r12d
jmp    119f <print_empty_board+0x7f>
lea    0xe79(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12d
mov    %ebx,%eax
add    %r12d,%eax
je     1160 <print_empty_board+0x40>
lea    (%rbx,%r12,1),%eax
test   $0x1,%r13b
jne    11c0 <print_empty_board+0xa0>
cmp    $0xffffffff,%eax
je     1183 <print_empty_board+0x63>
mov    %rbp,%rdi
jmp    11ec <print_empty_board+0xcc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %r14d,%r13d
jne    11e0 <print_empty_board+0xc0>
cmp    $0xffffffff,%eax
je     11f5 <print_empty_board+0xd5>
lea    0xe3a(%rip),%rdi
mov    %r12d,%esi
jmp    118d <print_empty_board+0x6d>
cs nopw 0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     1202 <print_empty_board+0xe2>
lea    0xe1c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1194 <print_empty_board+0x74>
lea    0xe09(%rip),%rdi
mov    0x4(%rsp),%esi
jmp    118d <print_empty_board+0x6d>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    1194 <print_empty_board+0x74>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c".-\00"
@.str.1 = [5 x i8] c". %d\00"
@.str.2 = [3 x i8] c"| \00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [3 x i8] c"%d\00"
define void @print_empty_board(i32 %0) {
%2 = shl i32 %0, 1
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = add nsw i32 %2, -1
%6 = add nsw i32 %0, -1
%7 = call i32 @llvm.smax.i32(i32 %2, i32 1)
br label %8
8: ; preds = %15, %4
%9 = phi i32 [ 0, %4 ], [ %17, %15 ]
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
%12 = icmp eq i32 %9, %5
%13 = lshr i32 %9, 1
br label %19
14: ; preds = %15, %1
ret void
15: ; preds = %38
%16 = tail call i32 @putchar(i32 10)
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, %7
br i1 %18, label %14, label %8
19: ; preds = %8, %38
%20 = phi i32 [ 0, %8 ], [ %39, %38 ]
%21 = icmp eq i32 %20, %6
br i1 %11, label %22, label %27
22: ; preds = %19
br i1 %21, label %25, label %23
23: ; preds = %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %38
25: ; preds = %22
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %38
27: ; preds = %19
br i1 %12, label %33, label %28
28: ; preds = %27
br i1 %21, label %31, label %29
29: ; preds = %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %38
31: ; preds = %28
%32 = tail call i32 @putchar(i32 124)
br label %38
33: ; preds = %27
br i1 %21, label %36, label %34
34: ; preds = %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %38
36: ; preds = %33
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %6)
br label %38
38: ; preds = %25, %23, %34, %36, %29, %31
%39 = add nuw nsw i32 %20, 1
%40 = icmp eq i32 %39, %0
br i1 %40, label %15, label %19
}