#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*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, ...);
void print_state(char *board) {
  int i = 0;
  int j = 0;
  char line[23 * 4 + 2];
  memset(&(line[0]), '-', sizeof(char) * (23 * 4 + 1));
  line[23 * 4 + 1] = '\0';
  printf("%s\n", line);
  for (; i < 23; ++i) {
    printf("|");
    for (j = 0; j < 23; ++j) {
      if (board[i * 23 + j] == 1) {
        printf(" X |");
      } else {
        printf("   |");
      }
    }
    printf("\n%s\n", line);
  }
}


x86 assembly (clang, -O0):
<print_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x2d,%esi
mov    $0x5d,%edx
call   1040 <memset@plt>
movb   $0x0,-0x13(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x17,-0xc(%rbp)
jge    11fb <print_state+0xdb>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x17,-0x10(%rbp)
jge    11db <print_state+0xbb>
mov    -0x8(%rbp),%rax
imul   $0x17,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x1,%eax
jne    11ba <print_state+0x9a>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c8 <print_state+0xa8>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cd <print_state+0xad>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <print_state+0x62>
lea    -0x70(%rbp),%rsi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <print_state+0x43>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_state>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x2d,%esi
mov    $0x5d,%edx
call   1060 <memset@plt>
movb   $0x0,0x5d(%rsp)
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xe86(%rip),%r12
lea    0xe84(%rip),%r13
lea    0xe82(%rip),%r15
xor    %ebp,%ebp
jmp    11ab <print_state+0x6b>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
add    $0x17,%rbx
cmp    $0x17,%rbp
je     11dc <print_state+0x9c>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0xffffffffffffffe9,%r14
jmp    11cc <print_state+0x8c>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <printf@plt>
inc    %r14
je     1190 <print_state+0x50>
cmpb   $0x1,0x17(%rbx,%r14,1)
mov    %r12,%rdi
je     11c0 <print_state+0x80>
mov    %r13,%rdi
jmp    11c0 <print_state+0x80>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.2 = [5 x i8] c" X |\00"
@.str.3 = [5 x i8] c" |\00"
@.str.4 = [5 x i8] c"\0A%s\0A\00"
define void @print_state(i8* nocapture %0) {
%2 = alloca [94 x i8]
%3 = getelementptr inbounds [94 x i8], [94 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i8 signext 45, i32 93)
%5 = getelementptr inbounds [94 x i8], [94 x i8]* %2, i64 0, i64 93
store i8 0, i8* %5
%6 = call i32 @puts(i8* %3)
br label %7
7: ; preds = %1, %21
%8 = phi i64 [ 0, %1 ], [ %23, %21 ]
%9 = call i32 @putchar(i32 124)
%10 = mul nuw nsw i64 %8, 23
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %19, %11 ]
%13 = add nuw nsw i64 %12, %10
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 1
%17 = select i1 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17)
%19 = add nuw nsw i64 %12, 1
%20 = icmp eq i64 %19, 23
br i1 %20, label %21, label %11
21: ; preds = %11
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%23 = add nuw nsw i64 %8, 1
%24 = icmp eq i64 %23, 23
br i1 %24, label %25, label %7
25: ; preds = %21
ret void
}