#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*/ escreveTweet(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ limpaTag(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(char *, char *);
void analisaTag(FILE *arqin, FILE *arqout, int *escrever) {
  char c, tag_atual[48];
  int i = 0;
  c = fgetc(arqin);
  while (c != '>' && i < 48 - 1) {
    tag_atual[i++] = c;
    c = fgetc(arqin);
  }
  tag_atual[i] = '\0';
  if (!strcmp(tag_atual, "p class=\"ProfileTweet-text js-tweet-text u-dir\"")) {
    limpaTag(arqin);
    *escrever = 1;
    escreveTweet(arqin, arqout);
    return;
  }
  if (!strcmp(tag_atual, "/p") && *escrever == 1) {
    fprintf(arqout, "\n");
    *escrever = 0;
    return;
  }
  if (*escrever == 1) {
    if (c != '>')
      limpaTag(arqin);
    escreveTweet(arqin, arqout);
  }
}


x86 assembly (clang, -O0):
<analisaTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%ecx
xor    %eax,%eax
cmp    $0x3e,%ecx
mov    %al,-0x55(%rbp)
je     1193 <analisaTag+0x43>
cmpl   $0x2f,-0x54(%rbp)
setl   %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    11a3 <analisaTag+0x53>
jmp    11c8 <analisaTag+0x78>
mov    -0x19(%rbp),%cl
mov    -0x54(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
cltq
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
jmp    1177 <analisaTag+0x27>
movslq -0x54(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    -0x50(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    120f <analisaTag+0xbf>
mov    -0x8(%rbp),%rdi
call   1030 <limpaTag@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <escreveTweet@plt>
jmp    1284 <analisaTag+0x134>
lea    -0x50(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1254 <analisaTag+0x104>
mov    -0x18(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1254 <analisaTag+0x104>
mov    -0x10(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    1284 <analisaTag+0x134>
mov    -0x18(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1284 <analisaTag+0x134>
movsbl -0x19(%rbp),%eax
cmp    $0x3e,%eax
je     1277 <analisaTag+0x127>
mov    -0x8(%rbp),%rdi
call   1030 <limpaTag@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <escreveTweet@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analisaTag>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <fgetc@plt>
cmp    $0x3e,%al
jne    1177 <analisaTag+0x27>
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    11a0 <analisaTag+0x50>
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0x1(%rbp),%rbx
mov    %al,(%rsp,%rbp,1)
mov    %r12,%rdi
call   1040 <fgetc@plt>
cmp    $0x3e,%al
setne  %r13b
je     11a0 <analisaTag+0x50>
cmp    $0x2e,%rbp
mov    %rbx,%rbp
jb     1180 <analisaTag+0x30>
movb   $0x0,(%rsp,%rbx,1)
lea    0xe55(%rip),%rsi
mov    %rsp,%rdi
mov    $0x30,%edx
call   1060 <bcmp@plt>
test   %eax,%eax
je     11e5 <analisaTag+0x95>
mov    $0x702f,%eax
xor    (%rsp),%eax
movzbl 0x2(%rsp),%ecx
or     %ax,%cx
mov    (%r15),%eax
je     120d <analisaTag+0xbd>
cmp    $0x1,%eax
jne    1226 <analisaTag+0xd6>
test   %r13b,%r13b
je     11f4 <analisaTag+0xa4>
mov    %r12,%rdi
call   1030 <limpaTag@plt>
jmp    11f4 <analisaTag+0xa4>
mov    %r12,%rdi
call   1030 <limpaTag@plt>
movl   $0x1,(%r15)
mov    %r12,%rdi
mov    %r14,%rsi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <escreveTweet@plt>
cmp    $0x1,%eax
jne    1226 <analisaTag+0xd6>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
movl   $0x0,(%r15)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"p class=\22ProfileTweet-text js-tweet-text u-dir\22\00"
@.str.1 = [3 x i8] c"/p\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @analisaTag(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8
%8 = alloca [48 x i8]
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %9
%10 = load i32*, i32** %4
%11 = call signext i8 @fgetc(i32* %10)
store i8 %11, i8* %7
br label %12
12: ; preds = %21, %3
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 62
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 47
br label %19
19: ; preds = %16, %12
%20 = phi i1 [ false, %12 ], [ %18, %16 ]
br i1 %20, label %21, label %29
21: ; preds = %19
%22 = load i8, i8* %7
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds [48 x i8], [48 x i8]* %8, i64 0, i64 %25
store i8 %22, i8* %26
%27 = load i32*, i32** %4
%28 = call signext i8 @fgetc(i32* %27)
store i8 %28, i8* %7
br label %12
29: ; preds = %19
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [48 x i8], [48 x i8]* %8, i64 0, i64 %31
store i8 0, i8* %32
%33 = getelementptr inbounds [48 x i8], [48 x i8]* %8, i64 0, i64 0
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %29
%37 = load i32*, i32** %4
%38 = call i32 @limpaTag(i32* %37)
%39 = load i32*, i32** %6
store i32 1, i32* %39
%40 = load i32*, i32** %4
%41 = load i32*, i32** %5
%42 = call i32 @escreveTweet(i32* %40, i32* %41)
br label %70
43: ; preds = %29
%44 = getelementptr inbounds [48 x i8], [48 x i8]* %8, i64 0, i64 0
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %55, label %47
47: ; preds = %43
%48 = load i32*, i32** %6
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = load i32*, i32** %5
%53 = call i32 @fprintf(i32* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%54 = load i32*, i32** %6
store i32 0, i32* %54
br label %70
55: ; preds = %47, %43
%56 = load i32*, i32** %6
%57 = load i32, i32* %56
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %70
59: ; preds = %55
%60 = load i8, i8* %7
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 62
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i32*, i32** %4
%65 = call i32 @limpaTag(i32* %64)
br label %66
66: ; preds = %63, %59
%67 = load i32*, i32** %4
%68 = load i32*, i32** %5
%69 = call i32 @escreveTweet(i32* %67, i32* %68)
br label %70
70: ; preds = %36, %51, %66, %55
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"p class=\22ProfileTweet-text js-tweet-text u-dir\22\00"
@.str.1 = [3 x i8] c"/p\00"
define void @analisaTag(i32* %0, i32* %1, i32* nocapture %2) {
%4 = alloca [48 x i8]
%5 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 0
%6 = tail call signext i8 @fgetc(i32* %0)
%7 = icmp eq i8 %6, 62
br i1 %7, label %17, label %8
8: ; preds = %3, %8
%9 = phi i64 [ %11, %8 ], [ 0, %3 ]
%10 = phi i8 [ %13, %8 ], [ %6, %3 ]
%11 = add nuw nsw i64 %9, 1
%12 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 %9
store i8 %10, i8* %12
%13 = tail call signext i8 @fgetc(i32* %0)
%14 = icmp ne i8 %13, 62
%15 = icmp ult i64 %9, 46
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %8, label %17
17: ; preds = %8, %3
%18 = phi i64 [ 0, %3 ], [ %11, %8 ]
%19 = phi i1 [ false, %3 ], [ %14, %8 ]
%20 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 %18
store i8 0, i8* %20
%21 = call i32 @bcmp(i8* dereferenceable(48) %5, i8* dereferenceable(48) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 48)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = tail call i32 @limpaTag(i32* %0)
store i32 1, i32* %2
%25 = tail call i32 @escreveTweet(i32* %0, i32* %1)
br label %40
26: ; preds = %17
%27 = call i32 @bcmp(i8* dereferenceable(3) %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 3)
%28 = icmp eq i32 %27, 0
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 1
br i1 %28, label %31, label %34
31: ; preds = %26
br i1 %30, label %32, label %40
32: ; preds = %31
%33 = tail call i32 @fputc(i32 10, i32* %1)
store i32 0, i32* %2
br label %40
34: ; preds = %26
br i1 %30, label %35, label %40
35: ; preds = %34
br i1 %19, label %36, label %38
36: ; preds = %35
%37 = tail call i32 @limpaTag(i32* %0)
br label %38
38: ; preds = %36, %35
%39 = tail call i32 @escreveTweet(i32* %0, i32* %1)
br label %40
40: ; preds = %31, %34, %38, %32, %23
ret void
}