#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*/ estripa(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ puts(char *);
void saiArquivo(char *nome) {
  FILE *arq;
  char str_buf[256 + 2];
  arq = fopen(nome, "r");
  while (fgets(str_buf, 256 + 1, arq) != NULL) {
    estripa(str_buf);
    puts(str_buf);
  }
  fclose(arq);
}


x86 assembly (clang, -O0):
<saiArquivo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x101,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11af <saiArquivo+0x5f>
lea    -0x120(%rbp),%rdi
call   1050 <estripa@plt>
lea    -0x120(%rbp),%rdi
call   1030 <puts@plt>
jmp    1173 <saiArquivo+0x23>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saiArquivo>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x101,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11b5 <saiArquivo+0x65>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <estripa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x101,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1190 <saiArquivo+0x40>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define void @saiArquivo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [258 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
br label %7
7: ; preds = %12, %1
%8 = getelementptr inbounds [258 x i8], [258 x i8]* %4, i64 0, i64 0
%9 = load i32*, i32** %3
%10 = call i32* @fgets(i8* %8, i32 257, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = getelementptr inbounds [258 x i8], [258 x i8]* %4, i64 0, i64 0
%14 = call i32 @estripa(i8* %13)
%15 = getelementptr inbounds [258 x i8], [258 x i8]* %4, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
br label %7
17: ; preds = %7
%18 = load i32*, i32** %3
%19 = call i32 @fclose(i32* %18)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @saiArquivo(i8* nocapture %0) {
%2 = alloca [258 x i8]
%3 = getelementptr inbounds [258 x i8], [258 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32* @fgets(i8* %3, i32 257, i32* %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %12, label %7
7: ; preds = %1, %7
%8 = call i32 @estripa(i8* %3)
%9 = call i32 @puts(i8* %3)
%10 = call i32* @fgets(i8* %3, i32 257, i32* %4)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %7
12: ; preds = %7, %1
%13 = call i32 @fclose(i32* %4)
ret void
}