#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*/ read_map(char *, char **);
void main() {
  char map[10][10];
  int i = 0;
  int j = 0;
  read_map("map.txt", map);
  for (i; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      printf("%c", map[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1030 <read_map@plt>
cmpl   $0xa,-0x74(%rbp)
jge    11b3 <main+0x93>
movl   $0x0,-0x78(%rbp)
cmpl   $0xa,-0x78(%rbp)
jge    1197 <main+0x77>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0xa,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    115a <main+0x3a>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1149 <main+0x29>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rdi
mov    %rsp,%rsi
call   1030 <read_map@plt>
mov    $0x9,%ebx
nopl   0x0(%rax)
movsbl -0x9(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x8(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x7(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x6(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x5(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x4(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x3(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x2(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl -0x1(%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
movsbl (%rsp,%rbx,1),%edi
call   1040 <putchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0xa,%rbx
cmp    $0x6d,%rbx
jne    1140 <main+0x20>
add    $0x70,%rsp
pop    %rbx
ret

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

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