#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);
void listing(char grid[5][5]) {
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      printf("%c\n", grid[j][i]);
    }
  }
}


x86 assembly (clang, -O0):
<listing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1182 <listing+0x72>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    116f <listing+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
lea    0xea8(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <listing+0x24>
jmp    1174 <listing+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <listing+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listing>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%esi
lea    0xedf(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x5(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xa(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xf(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x14(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x6(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xb(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x10(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x15(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x2(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x7(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xc(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x11(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x16(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x3(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x8(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xd(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x12(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x17(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x9(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0xe(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x13(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movsbl 0x18(%rbx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

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