#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 brick_printer(char brick[][4]) {
  int x, y;
  for (y = 0; y <= 3; y++) {
    printf("{");
    for (x = 0; x <= 3; x++) {
      printf("%d, ", brick[y][x]);
    }
    printf("}\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<brick_printer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jg     119b <brick_printer+0x8b>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     117f <brick_printer+0x6f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <brick_printer+0x32>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <brick_printer+0x13>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brick_printer>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x7b,%edi
call   1030 <putchar@plt>
movsbl (%rbx),%esi
lea    0xeb4(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x1(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x2(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x3(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7e(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x5(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x6(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x7(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x9(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xa(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xb(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
movsbl 0xc(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xd(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xe(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xf(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d, \00"
@str = [2 x i8] c"}\00"
define void @brick_printer([4 x i8]* nocapture %0) {
%2 = tail call i32 @putchar(i32 123)
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 0
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @putchar(i32 123)
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 2
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 3
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%38 = tail call i32 @putchar(i32 123)
%39 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 1
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 2
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 3
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%56 = tail call i32 @putchar(i32 123)
%57 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 1
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 2
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 3
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%74 = tail call i32 @putchar(i32 10)
ret void
}