#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 *, char *);
int /*<<< orphan*/ solve(char **, int, int);
int main(int argc, char **argv) {
  int i;
  char r1[] = "XXX";
  char r2[] = "XOX";
  char r3[] = "XXX";
  char *b[] = {r1, r2, r3};
  solve(b, 3, 3);
  for (i = 0; i < 3; i++)
    printf("%s\n", b[i]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1030 <solve@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11ad <main+0x8d>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movl   $0x585858,0xc(%rsp)
movl   $0x584f58,0x8(%rsp)
movl   $0x585858,0x4(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x4(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1030 <solve@plt>
mov    0x10(%rsp),%rsi
lea    0xe85(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.r1 = [4 x i8] c"XXX\00"
@__const.main.r2 = [4 x i8] c"XOX\00"
@__const.main.r3 = [4 x i8] c"XXX\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i8]
%8 = alloca [4 x i8]
%9 = alloca [4 x i8]
%10 = alloca [3 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [4 x i8]* %7 to i8*
%12 = bitcast [4 x i8]* %8 to i8*
%13 = bitcast [4 x i8]* %9 to i8*
%14 = getelementptr inbounds [3 x i8*], [3 x i8*]* %10, i64 0, i64 0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
store i8* %15, i8** %14
%16 = getelementptr inbounds i8*, i8** %14, i64 1
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
store i8* %17, i8** %16
%18 = getelementptr inbounds i8*, i8** %16, i64 1
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
store i8* %19, i8** %18
%20 = getelementptr inbounds [3 x i8*], [3 x i8*]* %10, i64 0, i64 0
%21 = call i32 @solve(i8** %20, i32 3, i32 3)
store i32 0, i32* %6
br label %22
22: ; preds = %31, %2
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 3
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i8*], [3 x i8*]* %10, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %22
34: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i8*]
%7 = bitcast i32* %3 to i8*
store i32 5789784, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 5787480, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 5789784, i32* %5
%10 = bitcast [3 x i8*]* %6 to i8*
%11 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 0
%12 = bitcast [3 x i8*]* %6 to i32**
store i32* %3, i32** %12
%13 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 1
%14 = bitcast i8** %13 to i32**
store i32* %4, i32** %14
%15 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 2
%16 = bitcast i8** %15 to i32**
store i32* %5, i32** %16
%17 = call i32 @solve(i8** %11, i32 3, i32 3)
%18 = load i8*, i8** %11
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %13
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %15
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
ret i32 0
}