#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
int check_compress(FILE *fd) {
  int ret = 0;
  char line[5000] = {0};
  while (fgets(line, 5000, fd) != NULL) {
    char *stop_sign = "\r\n";
    if (strcmp(stop_sign, line) == 0) {
      break;
    }
    if (strstr(line, "Content-Encoding: gzip") != NULL) {
      ret = 1;
      break;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<check_compress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13b0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x13a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1388,%edx
call   1030 <memset@plt>
lea    -0x13a0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x1388,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11e6 <check_compress+0xa6>
lea    0xe71(%rip),%rax
mov    %rax,-0x13a8(%rbp)
mov    -0x13a8(%rbp),%rdi
lea    -0x13a0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b8 <check_compress+0x78>
jmp    11e6 <check_compress+0xa6>
lea    -0x13a0(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11e1 <check_compress+0xa1>
movl   $0x1,-0xc(%rbp)
jmp    11e6 <check_compress+0xa6>
jmp    1169 <check_compress+0x29>
mov    -0xc(%rbp),%eax
add    $0x13b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_compress>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1390,%rsp
mov    %rdi,%rbx
mov    %rsp,%rbp
xor    %r14d,%r14d
mov    $0x1388,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe92(%rip),%r15
lea    0xe8e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,%rdi
mov    $0x1388,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11bb <check_compress+0x7b>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11bb <check_compress+0x7b>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
je     1180 <check_compress+0x40>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x1390,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [23 x i8] c"Content-Encoding: gzip\00"
define i32 @check_compress(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [5000 x i8]
%5 = alloca i8*
store i32* %0, i32** %2
store i32 0, i32* %3
%6 = bitcast [5000 x i8]* %4 to i8*
br label %7
7: ; preds = %23, %1
%8 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%9 = load i32*, i32** %2
%10 = call i32* @fgets(i8* %8, i32 5000, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %24
12: ; preds = %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%15 = call i64 @strcmp(i8* %13, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
br label %24
18: ; preds = %12
%19 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%20 = call i32* @strstr(i8* %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
br label %7
24: ; preds = %22, %17, %7
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [23 x i8] c"Content-Encoding: gzip\00"
define i32 @check_compress(i32* nocapture %0) {
%2 = alloca [5000 x i8]
%3 = getelementptr inbounds [5000 x i8], [5000 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %10, %1
%5 = call i32* @fgets(i8* %3, i32 5000, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i32* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %4, label %13
13: ; preds = %10, %7, %4
%14 = phi i32 [ 0, %4 ], [ 1, %10 ], [ 0, %7 ]
ret i32 %14
}