#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 *, ...);
int /*<<< orphan*/ pstring_red(char);
void dump_board(char board[40][40], int nrows, int ncols) {
  int i, j;
  printf("\n");
  for (i = 0; i < nrows; i++) {
    printf("    ");
    for (j = 0; j < ncols; j++) {
      if (board[i][j] >= 'A' && board[i][j] <= 'Z') {
        printf(" ");
        pstring_red(board[i][j]);
        printf(" ");
      } else {
        printf(" %c ", board[i][j]);
      }
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1245 <dump_board+0x125>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1229 <dump_board+0x109>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     11f1 <dump_board+0xd1>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jg     11f1 <dump_board+0xd1>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <pstring_red@plt>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1216 <dump_board+0xf6>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <dump_board+0xfb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1168 <dump_board+0x48>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <dump_board+0x27>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_board>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    11ef <dump_board+0xbf>
mov    %ebp,%r12d
mov    0x4(%rsp),%ebp
lea    0xea1(%rip),%r13
xor    %r14d,%r14d
jmp    1187 <dump_board+0x57>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x28,%rbx
cmp    %r12,%r14
je     11ef <dump_board+0xbf>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1170 <dump_board+0x40>
xor    %r15d,%r15d
jmp    11c3 <dump_board+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
je     1170 <dump_board+0x40>
movsbl (%rbx,%r15,1),%esi
lea    -0x41(%rsi),%eax
cmp    $0x19,%al
ja     11b0 <dump_board+0x80>
mov    $0x20,%edi
call   1030 <putchar@plt>
movsbl (%rbx,%r15,1),%edi
call   1050 <pstring_red@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11ba <dump_board+0x8a>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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