#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char const *argv[]) {
  FILE *arqentrada;
  int i, j, numseqs;
  int RETANG[8][9];
  int PADRAO[9];
  arqentrada = fopen(argv[1], "r");
  if (arqentrada == NULL) {
    printf("Não consegui abrir o arquivo.\n");
    return 0;
  }
  for (i = 0; i < 8; i++)
    for (j = 0; j < 9; j++)
      fscanf(arqentrada, "%d", &RETANG[i][j]);
  fscanf(arqentrada, "%d\n", &numseqs);
  for (i = 0; i < numseqs; i++) {
    for (j = 0; j < 9; j++)
      fscanf(arqentrada, "%d", &PADRAO[j]);
  }
  fclose(arqentrada);
  printf("Arquivo lido corretamente\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe98(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1194 <main+0x54>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    129b <main+0x15b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1204 <main+0xc4>
movl   $0x0,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jge    11f1 <main+0xb1>
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
lea    -0x150(%rbp),%rdx
imul   $0x24,%rax,%rax
add    %rax,%rdx
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe44(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ac <main+0x6c>
jmp    11f6 <main+0xb6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x5b>
mov    -0x18(%rbp),%rdi
lea    0xe16(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1050 <fscanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    127f <main+0x13f>
movl   $0x0,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jge    126c <main+0x12c>
mov    -0x18(%rbp),%rdi
movslq -0x20(%rbp),%rax
lea    -0x180(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdc9(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1232 <main+0xf2>
jmp    1271 <main+0x131>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    121f <main+0xdf>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd9a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    0x8(%rsi),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     132a <main+0x1ea>
mov    %rax,%rbx
xor    %ebp,%ebp
lea    0xe8c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
lea    (%rsp,%rbp,1),%rdx
add    $0x40,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x44,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x48,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x4c,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x50,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x54,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x58,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x5c,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    (%rsp,%rbp,1),%rdx
add    $0x60,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
add    $0x24,%rbp
cmp    $0x120,%rbp
jne    1180 <main+0x40>
lea    0xdc2(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <fscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1319 <main+0x1d9>
lea    0x2c(%rsp),%r15
xor    %r14d,%r14d
lea    0x30(%rsp),%r12
lea    0xd93(%rip),%r13
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x14(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x18(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x1c(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x20(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x24(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x28(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
add    $0x1,%r14d
cmp    0xc(%rsp),%r14d
jl     1280 <main+0x140>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xce1(%rip),%rdi
jmp    1331 <main+0x1f1>
lea    0xcf2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [32 x i8] c"N\C3\A3o consegui abrir o arquivo.\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [27 x i8] c"Arquivo lido corretamente\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [8 x [9 x i32]]
%11 = alloca [9 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %72
20: ; preds = %2
store i32 0, i32* %7
br label %21
21: ; preds = %41, %20
%22 = load i32, i32* %7
%23 = icmp slt i32 %22, 8
br i1 %23, label %24, label %44
24: ; preds = %21
store i32 0, i32* %8
br label %25
25: ; preds = %37, %24
%26 = load i32, i32* %8
%27 = icmp slt i32 %26, 9
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load i32*, i32** %6
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %10, i64 0, i64 %31
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %32, i64 0, i64 %34
%36 = call i32 @fscanf(i32* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %35)
br label %37
37: ; preds = %28
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %25
40: ; preds = %25
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %21
44: ; preds = %21
%45 = load i32*, i32** %6
%46 = call i32 @fscanf(i32* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %9)
store i32 0, i32* %7
br label %47
47: ; preds = %65, %44
%48 = load i32, i32* %7
%49 = load i32, i32* %9
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %68
51: ; preds = %47
store i32 0, i32* %8
br label %52
52: ; preds = %61, %51
%53 = load i32, i32* %8
%54 = icmp slt i32 %53, 9
br i1 %54, label %55, label %64
55: ; preds = %52
%56 = load i32*, i32** %6
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 %58
%60 = call i32 @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %59)
br label %61
61: ; preds = %55
%62 = load i32, i32* %8
%63 = add nsw i32 %62, 1
store i32 %63, i32* %8
br label %52
64: ; preds = %52
br label %65
65: ; preds = %64
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %47
68: ; preds = %47
%69 = load i32*, i32** %6
%70 = call i32 @fclose(i32* %69)
%71 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %72
72: ; preds = %68, %18
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [26 x i8] c"Arquivo lido corretamente\00"
@str.5 = [31 x i8] c"N\C3\A3o consegui abrir o arquivo.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [8 x [9 x i32]]
%5 = alloca [9 x i32]
%6 = bitcast i32* %3 to i8*
%7 = bitcast [8 x [9 x i32]]* %4 to i8*
%8 = bitcast [9 x i32]* %5 to i8*
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.5, i64 0, i64 0))
br label %68
15: ; preds = %2, %15
%16 = phi i64 [ %35, %15 ], [ 0, %2 ]
%17 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 0
%18 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 1
%20 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 2
%22 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 3
%24 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 4
%26 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 5
%28 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %27)
%29 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 6
%30 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %29)
%31 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 7
%32 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %31)
%33 = getelementptr inbounds [8 x [9 x i32]], [8 x [9 x i32]]* %4, i64 0, i64 %16, i64 8
%34 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %33)
%35 = add nuw nsw i64 %16, 1
%36 = icmp eq i64 %35, 8
br i1 %36, label %37, label %15
37: ; preds = %15
%38 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %3
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %65
41: ; preds = %37
%42 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
%43 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 1
%44 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 2
%45 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 3
%46 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 4
%47 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 5
%48 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 6
%49 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 7
%50 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 8
br label %51
51: ; preds = %41, %51
%52 = phi i32 [ %62, %51 ], [ 0, %41 ]
%53 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %42)
%54 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %43)
%55 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %44)
%56 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %45)
%57 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %46)
%58 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %47)
%59 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %48)
%60 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %49)
%61 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %50)
%62 = add nuw nsw i32 %52, 1
%63 = load i32, i32* %3
%64 = icmp slt i32 %62, %63
br i1 %64, label %51, label %65
65: ; preds = %51, %37
%66 = call i32 @fclose(i32* %11)
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %68
68: ; preds = %65, %13
ret i32 0
}