#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_pattern(char pattern[9][9]) {
  for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 9; j++) {
      if ((j % 3 == 0) && (j > 0)) {
        printf("|");
      }
      printf("%c", pattern[i][j]);
    }
    if ((i % 3 == 2) && (i < 8)) {
      printf("\n-----------");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_pattern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11e5 <print_pattern+0xd5>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    119d <print_pattern+0x8d>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116a <print_pattern+0x5a>
cmpl   $0x0,-0x10(%rbp)
jle    116a <print_pattern+0x5a>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x9,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <print_pattern+0x24>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    11c9 <print_pattern+0xb9>
cmpl   $0x8,-0xc(%rbp)
jge    11c9 <print_pattern+0xb9>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_pattern+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pattern>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
add    $0x8,%rbx
mov    $0x2,%r12d
mov    $0xaaaaaaab,%r15d
lea    0xebe(%rip),%r14
xor    %ebp,%ebp
jmp    1170 <print_pattern+0x50>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    $0x9,%rbx
add    $0xffffffff,%r12d
cmp    $0x9,%rbp
je     1203 <print_pattern+0xe3>
movsbl -0x8(%rbx),%edi
call   1030 <putchar@plt>
movsbl -0x7(%rbx),%edi
call   1030 <putchar@plt>
movsbl -0x6(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl -0x5(%rbx),%edi
call   1030 <putchar@plt>
movsbl -0x4(%rbx),%edi
call   1030 <putchar@plt>
movsbl -0x3(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl -0x2(%rbx),%edi
call   1030 <putchar@plt>
movsbl -0x1(%rbx),%edi
call   1030 <putchar@plt>
movsbl (%rbx),%edi
call   1030 <putchar@plt>
cmp    $0x7,%rbp
ja     1150 <print_pattern+0x30>
mov    %ebp,%eax
imul   %r15,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
add    %r12d,%eax
jne    1150 <print_pattern+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <print_pattern+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.2 = [13 x i8] c"\0A-----------\00"
define void @print_pattern([9 x i8]* nocapture %0) {
br label %3
2: ; preds = %50
ret void
3: ; preds = %1, %50
%4 = phi i64 [ 0, %1 ], [ %52, %50 ]
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = tail call i32 @putchar(i32 %11)
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = tail call i32 @putchar(i32 %15)
%17 = tail call i32 @putchar(i32 124)
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 @putchar(i32 %20)
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call i32 @putchar(i32 %24)
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 5
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
%30 = tail call i32 @putchar(i32 124)
%31 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 6
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 @putchar(i32 %33)
%35 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = tail call i32 @putchar(i32 %37)
%39 = getelementptr inbounds [9 x i8], [9 x i8]* %0, i64 %4, i64 8
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = tail call i32 @putchar(i32 %41)
%43 = trunc i64 %4 to i32
%44 = urem i32 %43, 3
%45 = icmp eq i32 %44, 2
%46 = icmp ult i64 %4, 8
%47 = and i1 %46, %45
br i1 %47, label %48, label %50
48: ; preds = %3
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48, %3
%51 = tail call i32 @putchar(i32 10)
%52 = add nuw nsw i64 %4, 1
%53 = icmp eq i64 %52, 9
br i1 %53, label %2, label %3
}