#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 */
scalar_t__ EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int entrada(char letra[][2], char url[]) {
  int i = 0, k;
  FILE *arquivo = NULL;
  arquivo = fopen(url, "r");
  if (arquivo == NULL) {
    printf("erro no carregamento do arquivo\n");
    exit(EXIT_FAILURE);
  }
  while (fscanf(arquivo, "%c %c\n", &letra[i][0], &letra[i][1]) != EOF)
    i++;
  printf("Relacoes existentes no arquivo\n");
  for (k = 0; k < i; k++) {
    printf("%c", letra[k][0]);
    printf("%c\n", letra[k][1]);
  }
  fclose(arquivo);
  return i;
}


x86 assembly (clang, -O0):
<entrada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11aa <entrada+0x5a>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    11af <entrada+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rdx
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rcx
add    $0x1,%rcx
lea    0xe47(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2e00(%rip),%rcx
cmp    (%rcx),%rax
je     11ff <entrada+0xaf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <entrada+0x5f>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1263 <entrada+0x113>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,2),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl 0x1(%rax,%rcx,2),%esi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1214 <entrada+0xc4>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<entrada>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r12
lea    0xe78(%rip),%rsi
mov    %rax,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     123c <entrada+0xcc>
mov    %rax,%r14
mov    $0xffffffff,%ebp
lea    0xe5a(%rip),%r15
mov    0x2e39(%rip),%r13
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbx),%rcx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <fscanf@plt>
add    $0x1,%ebp
add    $0x2,%rbx
cmp    0x0(%r13),%rax
jne    11c0 <entrada+0x50>
lea    0xe23(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
je     1223 <entrada+0xb3>
mov    %ebp,%r13d
lea    0xe0c(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x1(%r12,%rbx,2),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1200 <entrada+0x90>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [33 x i8] c"erro no carregamento do arquivo\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"%c %c\0A\00"
@EOF = global i64 0
@.str.3 = [32 x i8] c"Relacoes existentes no arquivo\0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [4 x i8] c"%c\0A\00"
define i32 @entrada([2 x i8]* %0, i8* %1) {
%3 = alloca [2 x i8]*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store [2 x i8]* %0, [2 x i8]** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32* null, i32** %7
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
br label %17
17: ; preds = %32, %16
%18 = load i32*, i32** %7
%19 = load [2 x i8]*, [2 x i8]** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %19, i64 %21
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %22, i64 0, i64 0
%24 = load [2 x i8]*, [2 x i8]** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [2 x i8], [2 x i8]* %24, i64 %26
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %27, i64 0, i64 1
%29 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %28)
%30 = load i64, i64* @EOF
%31 = icmp ne i64 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %17
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %17
35: ; preds = %17
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %37
37: ; preds = %58, %35
%38 = load i32, i32* %6
%39 = load i32, i32* %5
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %61
41: ; preds = %37
%42 = load [2 x i8]*, [2 x i8]** %3
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x i8], [2 x i8]* %42, i64 %44
%46 = getelementptr inbounds [2 x i8], [2 x i8]* %45, i64 0, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = load [2 x i8]*, [2 x i8]** %3
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [2 x i8], [2 x i8]* %50, i64 %52
%54 = getelementptr inbounds [2 x i8], [2 x i8]* %53, i64 0, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %41
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %37
61: ; preds = %37
%62 = load i32*, i32** %7
%63 = call i32 @fclose(i32* %62)
%64 = load i32, i32* %5
ret i32 %64
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"%c %c\0A\00"
@EOF = global i64 0
@.str.5 = [4 x i8] c"%c\0A\00"
@str = [31 x i8] c"Relacoes existentes no arquivo\00"
@str.6 = [32 x i8] c"erro no carregamento do arquivo\00"
define i32 @entrada([2 x i8]* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2, %9
%10 = phi i64 [ %16, %9 ], [ 0, %2 ]
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i64 %10, i64 0
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i64 %10, i64 1
%13 = tail call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
%16 = add nuw i64 %10, 1
br i1 %15, label %17, label %9
17: ; preds = %9
%18 = trunc i64 %10 to i32
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%20 = icmp eq i32 %18, 0
br i1 %20, label %35, label %21
21: ; preds = %17
%22 = and i64 %10, 4294967295
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %33, %23 ]
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i64 %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 @putchar(i32 %27)
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i64 %24, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i64 %24, 1
%34 = icmp eq i64 %33, %22
br i1 %34, label %35, label %23
35: ; preds = %23, %17
%36 = tail call i32 @fclose(i32* %3)
ret i32 %18
}