#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__ compareTime(char *, char *);
int /*<<< orphan*/ extractCommand(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ substring(char *, int, int, char *);
int /*<<< orphan*/ system(char *);
int analyzefeed() {
  char str[200], str2[200], command[200], thisDate[80], lastDate[80];
  FILE *fp, *fp1;
  fp = fopen(".feed", "r");
  while (fgets(str, 200, fp)) {
    if (strncmp(str, "</image>", 8) == 0)
      break;
  }
  while (fgets(str, 200, fp)) {
    if (strncmp(str, "<pubDate>", 9) == 0)
      break;
  }
  substring(str, 14, 14, thisDate);
  fp1 = fopen("lastmsg.txt", "r");
  fgets(str2, 80, fp1);
  fclose(fp1);
  if (compareTime(thisDate, lastDate) == 0) {
    printf("No new message\n");
    return 0;
  } else if (compareTime(thisDate, lastDate) < 0) {
    printf("No new message\n");
    return 0;
  } else {
    printf("1 New Message\n");
    fp1 = fopen("lastmsg.txt", "w");
    fprintf(fp1, "%s", thisDate);
    fclose(fp1);
    while (fgets(str, 200, fp)) {
      if (strncmp(str, "<description>", 13) == 0)
        break;
    }
    extractCommand(str, command);
    printf("Command Found %s. Executing now\n", command);
    system(command);
    return 0;
  }
}


x86 assembly (clang, -O0):
<analyzefeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x320,%rsp
lea    0xe4e(%rip),%rdi
lea    0xe4d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x318(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x318(%rbp),%rdx
mov    $0xc8,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1213 <analyzefeed+0x73>
lea    -0xd0(%rbp),%rdi
lea    0xe13(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    120e <analyzefeed+0x6e>
jmp    1213 <analyzefeed+0x73>
jmp    11c5 <analyzefeed+0x25>
jmp    1218 <analyzefeed+0x78>
lea    -0xd0(%rbp),%rdi
mov    -0x318(%rbp),%rdx
mov    $0xc8,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1266 <analyzefeed+0xc6>
lea    -0xd0(%rbp),%rdi
lea    0xdc9(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1261 <analyzefeed+0xc1>
jmp    1266 <analyzefeed+0xc6>
jmp    1218 <analyzefeed+0x78>
lea    -0xd0(%rbp),%rdi
lea    -0x2c0(%rbp),%rcx
mov    $0xe,%edx
mov    %edx,%esi
call   1070 <substring@plt>
lea    0xd94(%rip),%rdi
lea    0xd78(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x320(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x320(%rbp),%rdx
mov    $0x50,%esi
call   1080 <fgets@plt>
mov    -0x320(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x2c0(%rbp),%rdi
lea    -0x310(%rbp),%rsi
call   10c0 <compareTime@plt>
cmp    $0x0,%rax
jne    12f5 <analyzefeed+0x155>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1403 <analyzefeed+0x263>
lea    -0x2c0(%rbp),%rdi
lea    -0x310(%rbp),%rsi
call   10c0 <compareTime@plt>
cmp    $0x0,%rax
jge    132c <analyzefeed+0x18c>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1403 <analyzefeed+0x263>
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcda(%rip),%rdi
lea    0xcfe(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x320(%rbp)
mov    -0x320(%rbp),%rdi
lea    -0x2c0(%rbp),%rdx
lea    0xcdf(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x320(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0xd0(%rbp),%rdi
mov    -0x318(%rbp),%rdx
mov    $0xc8,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     13c8 <analyzefeed+0x228>
lea    -0xd0(%rbp),%rdi
lea    0xca1(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    13c3 <analyzefeed+0x223>
jmp    13c8 <analyzefeed+0x228>
jmp    137a <analyzefeed+0x1da>
lea    -0xd0(%rbp),%rdi
lea    -0x270(%rbp),%rsi
call   10a0 <extractCommand@plt>
lea    -0x270(%rbp),%rsi
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x270(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x320,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyzefeed>:
push   %r15
push   %r14
push   %rbx
sub    $0x310,%rsp
lea    0xe3d(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r14
lea    0xa0(%rsp),%rbx
lea    0xe27(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     121a <analyzefeed+0x6a>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11f0 <analyzefeed+0x40>
lea    0xa0(%rsp),%rbx
lea    0xde8(%rip),%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     125a <analyzefeed+0xaa>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1230 <analyzefeed+0x80>
lea    0xa0(%rsp),%rdi
mov    %rsp,%r15
mov    $0xe,%esi
mov    $0xe,%edx
mov    %r15,%rcx
call   1090 <substring@plt>
lea    0xd9d(%rip),%rdi
lea    0xd81(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0x240(%rsp),%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0x50(%rsp),%rsi
mov    %r15,%rdi
call   10d0 <compareTime@plt>
test   %rax,%rax
je     137d <analyzefeed+0x1cd>
mov    %rsp,%rdi
lea    0x50(%rsp),%rsi
call   10d0 <compareTime@plt>
test   %rax,%rax
js     137d <analyzefeed+0x1cd>
lea    0xd7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xd32(%rip),%rdi
lea    0xd37(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1080 <fputs@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xa0(%rsp),%rbx
lea    0xd0f(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     134a <analyzefeed+0x19a>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xd,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1320 <analyzefeed+0x170>
lea    0xa0(%rsp),%rdi
lea    0x170(%rsp),%rbx
mov    %rbx,%rsi
call   10b0 <extractCommand@plt>
lea    0xcce(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
jmp    1389 <analyzefeed+0x1d9>
lea    0xce2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x310,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c".feed\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"</image>\00"
@.str.3 = [10 x i8] c"<pubDate>\00"
@.str.4 = [12 x i8] c"lastmsg.txt\00"
@.str.5 = [16 x i8] c"No new message\0A\00"
@.str.6 = [15 x i8] c"1 New Message\0A\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [14 x i8] c"<description>\00"
@.str.10 = [33 x i8] c"Command Found %s. Executing now\0A\00"
define i32 @analyzefeed() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = alloca [200 x i8]
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %7
br label %10
10: ; preds = %20, %0
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%12 = load i32*, i32** %7
%13 = call i64 @fgets(i8* %11, i32 200, i32* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
br label %21
20: ; preds = %15
br label %10
21: ; preds = %19, %10
br label %22
22: ; preds = %32, %21
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%24 = load i32*, i32** %7
%25 = call i64 @fgets(i8* %23, i32 200, i32* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %22
%28 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 9)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
br label %33
32: ; preds = %27
br label %22
33: ; preds = %31, %22
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%36 = call i32 @substring(i8* %34, i32 14, i32 14, i8* %35)
%37 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %37, i32** %8
%38 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%39 = load i32*, i32** %8
%40 = call i64 @fgets(i8* %38, i32 80, i32* %39)
%41 = load i32*, i32** %8
%42 = call i32 @fclose(i32* %41)
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%45 = call i64 @compareTime(i8* %43, i8* %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %33
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %83
49: ; preds = %33
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%52 = call i64 @compareTime(i8* %50, i8* %51)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %83
56: ; preds = %49
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%58 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %58, i32** %8
%59 = load i32*, i32** %8
%60 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%61 = call i32 @fprintf(i32* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %60)
%62 = load i32*, i32** %8
%63 = call i32 @fclose(i32* %62)
br label %64
64: ; preds = %74, %56
%65 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%66 = load i32*, i32** %7
%67 = call i64 @fgets(i8* %65, i32 200, i32* %66)
%68 = icmp ne i64 %67, 0
br i1 %68, label %69, label %75
69: ; preds = %64
%70 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%71 = call i64 @strncmp(i8* %70, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 13)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %69
br label %75
74: ; preds = %69
br label %64
75: ; preds = %73, %64
%76 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%77 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%78 = call i32 @extractCommand(i8* %76, i8* %77)
%79 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i8* %79)
%81 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%82 = call i32 @system(i8* %81)
store i32 0, i32* %1
br label %83
83: ; preds = %75, %54, %47
%84 = load i32, i32* %1
ret i32 %84
}

LLVM IR (-O2):
@.str = [6 x i8] c".feed\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"</image>\00"
@.str.3 = [10 x i8] c"<pubDate>\00"
@.str.4 = [12 x i8] c"lastmsg.txt\00"
@.str.7 = [2 x i8] c"w\00"
@.str.9 = [14 x i8] c"<description>\00"
@.str.10 = [33 x i8] c"Command Found %s. Executing now\0A\00"
@str = [14 x i8] c"1 New Message\00"
@str.12 = [15 x i8] c"No new message\00"
define i32 @analyzefeed() {
%1 = alloca [200 x i8]
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %15, %0
%13 = call i64 @fgets(i8* %6, i32 200, i32* %11)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %12
18: ; preds = %15, %12
br label %19
19: ; preds = %18, %22
%20 = call i64 @fgets(i8* %6, i32 200, i32* %11)
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 9)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %19
25: ; preds = %22, %19
%26 = call i32 @substring(i8* %6, i32 14, i32 14, i8* %9)
%27 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = call i64 @fgets(i8* %7, i32 80, i32* %27)
%29 = call i32 @fclose(i32* %27)
%30 = call i64 @compareTime(i8* %9, i8* %10)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
br label %54
34: ; preds = %25
%35 = call i64 @compareTime(i8* %9, i8* %10)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
br label %54
39: ; preds = %34
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%41 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%42 = call i32 @fputs(i8* %9, i32* %41)
%43 = call i32 @fclose(i32* %41)
br label %44
44: ; preds = %47, %39
%45 = call i64 @fgets(i8* %6, i32 200, i32* %11)
%46 = icmp eq i64 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 13)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %44
50: ; preds = %47, %44
%51 = call i32 @extractCommand(i8* %6, i8* %8)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%53 = call i32 @system(i8* %8)
br label %54
54: ; preds = %50, %37, %32
ret i32 0
}