#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*/ analisaTag(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                              int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void extrai_tweets(char nomearqin[], char nomearqout[]) {
  FILE *arqin = fopen(nomearqin, "r");
  FILE *arqout = fopen(nomearqout, "w");
  char c = fgetc(arqin);
  int escrever = 0;
  while (c != EOF) {
    if (c == '<') {
      analisaTag(arqin, arqout, &escrever);
      while (escrever == 1)
        analisaTag(arqin, arqout, &escrever);
    }
    c = fgetc(arqin);
  }
  fclose(arqin);
  fclose(arqout);
}


x86 assembly (clang, -O0):
<extrai_tweets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x21(%rbp)
movl   $0x0,-0x28(%rbp)
movsbl -0x21(%rbp),%eax
mov    0x2e52(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11f5 <extrai_tweets+0xb5>
movsbl -0x21(%rbp),%eax
cmp    $0x3c,%eax
jne    11e4 <extrai_tweets+0xa4>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <analisaTag@plt>
cmpl   $0x1,-0x28(%rbp)
jne    11df <extrai_tweets+0x9f>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <analisaTag@plt>
jmp    11bf <extrai_tweets+0x7f>
jmp    11e4 <extrai_tweets+0xa4>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x21(%rbp)
jmp    118b <extrai_tweets+0x4b>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extrai_tweets>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xeae(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xea1(%rip),%rsi
mov    %r14,%rdi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <fgetc@plt>
movl   $0x0,0x4(%rsp)
mov    0x2e65(%rip),%r12
cmp    (%r12),%al
jne    11a5 <extrai_tweets+0x65>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0x4(%rsp),%r15
jmp    11be <extrai_tweets+0x7e>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r12),%al
je     1189 <extrai_tweets+0x49>
cmp    $0x3c,%al
jne    11b0 <extrai_tweets+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <analisaTag@plt>
cmpl   $0x1,0x4(%rsp)
je     11d0 <extrai_tweets+0x90>
jmp    11b0 <extrai_tweets+0x70>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
define void @extrai_tweets(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %5
%11 = load i8*, i8** %4
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %6
%13 = load i32*, i32** %5
%14 = call signext i8 @fgetc(i32* %13)
store i8 %14, i8* %7
store i32 0, i32* %8
br label %15
15: ; preds = %37, %2
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %40
21: ; preds = %15
%22 = load i8, i8* %7
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 60
br i1 %24, label %25, label %37
25: ; preds = %21
%26 = load i32*, i32** %5
%27 = load i32*, i32** %6
%28 = call i32 @analisaTag(i32* %26, i32* %27, i32* %8)
br label %29
29: ; preds = %32, %25
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32*, i32** %5
%34 = load i32*, i32** %6
%35 = call i32 @analisaTag(i32* %33, i32* %34, i32* %8)
br label %29
36: ; preds = %29
br label %37
37: ; preds = %36, %21
%38 = load i32*, i32** %5
%39 = call signext i8 @fgetc(i32* %38)
store i8 %39, i8* %7
br label %15
40: ; preds = %15
%41 = load i32*, i32** %5
%42 = call i32 @fclose(i32* %41)
%43 = load i32*, i32** %6
%44 = call i32 @fclose(i32* %43)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@EOF = global i8 0
define void @extrai_tweets(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca i32
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call signext i8 @fgetc(i32* %4)
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %6, %8
br i1 %9, label %25, label %10
10: ; preds = %2, %21
%11 = phi i8 [ %22, %21 ], [ %6, %2 ]
%12 = icmp eq i8 %11, 60
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = call i32 @analisaTag(i32* %4, i32* %5, i32* %3)
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %13, %17
%18 = call i32 @analisaTag(i32* %4, i32* %5, i32* %3)
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 1
br i1 %20, label %17, label %21
21: ; preds = %17, %13, %10
%22 = call signext i8 @fgetc(i32* %4)
%23 = load i8, i8* @EOF
%24 = icmp eq i8 %22, %23
br i1 %24, label %25, label %10
25: ; preds = %21, %2
%26 = call i32 @fclose(i32* %4)
%27 = call i32 @fclose(i32* %5)
ret void
}