#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*/ exit(int /*<<< orphan*/);
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 *);
int /*<<< orphan*/ trim(char *, char *);
void trimfeed() {
  FILE *fp1, *fp2;
  char str1[200], str2[200];
  fp1 = fopen(".downloaded_feed", "r");
  if (fp1 == NULL) {
    printf("Cannot open file.. Check your internet connectivity");
    exit(0);
  }
  fp2 = fopen(".feed", "w");
  while (fgets(str1, 200, fp1)) {
    trim(str1, str2);
    fprintf(fp2, "%s", str2);
  }
  fclose(fp1);
  fclose(fp2);
}


x86 assembly (clang, -O0):
<trimfeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
lea    0xe7e(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b0 <trimfeed+0x40>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xe90(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xc8,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1215 <trimfeed+0xa5>
lea    -0xe0(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
call   1050 <trim@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xe44(%rip),%rsi
call   1070 <fprintf@plt>
jmp    11c7 <trimfeed+0x57>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimfeed>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x198,%rsp
lea    0xe7b(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     122a <trimfeed+0xba>
mov    %rax,%r14
lea    0xea3(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     120b <trimfeed+0x9b>
mov    %rsp,%r12
lea    0xd0(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <trim@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <fputs@plt>
mov    %r12,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    11e0 <trimfeed+0x70>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xde2(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c".downloaded_feed\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [52 x i8] c"Cannot open file.. Check your internet connectivity\00"
@.str.3 = [6 x i8] c".feed\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"%s\00"
define void @trimfeed() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca [200 x i8]
%4 = alloca [200 x i8]
%5 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %1
%6 = load i32*, i32** %1
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %12, i32** %2
br label %13
13: ; preds = %18, %11
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%15 = load i32*, i32** %1
%16 = call i64 @fgets(i8* %14, i32 200, i32* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%21 = call i32 @trim(i8* %19, i8* %20)
%22 = load i32*, i32** %2
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%24 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %23)
br label %13
25: ; preds = %13
%26 = load i32*, i32** %1
%27 = call i32 @fclose(i32* %26)
%28 = load i32*, i32** %2
%29 = call i32 @fclose(i32* %28)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c".downloaded_feed\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [52 x i8] c"Cannot open file.. Check your internet connectivity\00"
@.str.3 = [6 x i8] c".feed\00"
@.str.4 = [2 x i8] c"w\00"
define void @trimfeed() {
%1 = alloca [200 x i8]
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 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 %10
7: ; preds = %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %0
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = call i64 @fgets(i8* %3, i32 200, i32* %5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %10, %14
%15 = call i32 @trim(i8* %3, i8* %4)
%16 = call i32 @fputs(i8* %4, i32* %11)
%17 = call i64 @fgets(i8* %3, i32 200, i32* %5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %14
19: ; preds = %14, %10
%20 = call i32 @fclose(i32* %5)
%21 = call i32 @fclose(i32* %11)
ret void
}