#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 */
char EOF;
int /*<<< orphan*/ *fopen(char *, char *);
char fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int /*<<< orphan*/ printf(char *);
void main() {
  FILE *arquivo;
  int contador, id, valor;
  char acesso;
  arquivo = fopen("arq.txt", "r");
  if (arquivo == NULL)
    printf("arquivo não pode ser aberto");
  else {
    acesso = fscanf(arquivo, "%d %f \n", &id, &valor);
    while (acesso != EOF) {
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116b <main+0x3b>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <main+0x76>
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <fscanf@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
mov    0x2e57(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11a1 <main+0x71>
jmp    1186 <main+0x56>
jmp    11a6 <main+0x76>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1172 <main+0x42>
lea    0xed7(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%al
jne    1170 <main+0x40>
pop    %rax
ret
nopl   (%rax)
jmp    1170 <main+0x40>
lea    0xe91(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"arq.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"arquivo n\C3\A3o pode ser aberto\00"
@.str.3 = [8 x i8] c"%d %f \0A\00"
@EOF = global i8 0
define void @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %1
%7 = load i32*, i32** %1
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %22
11: ; preds = %0
%12 = load i32*, i32** %1
%13 = call signext i8 @fscanf(i32* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
store i8 %13, i8* %5
br label %14
14: ; preds = %20, %11
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = load i8, i8* @EOF
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %16, %18
br i1 %19, label %20, label %21
20: ; preds = %14
br label %14
21: ; preds = %14
br label %22
22: ; preds = %21, %9
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"arq.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"arquivo n\C3\A3o pode ser aberto\00"
@.str.3 = [8 x i8] c"%d %f \0A\00"
@EOF = global i8 0
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %14
9: ; preds = %0
%10 = call signext i8 @fscanf(i32* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %10, %11
br i1 %12, label %14, label %13
13: ; preds = %9, %13
br label %13
14: ; preds = %9, %7
ret void
}