#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 */

/* Variables and functions */
char *strstr(char const *, char const *);
int check_for_search(const char *line, const char *domain) {
  int ret = 0;
  char *comment = strstr(line, "#");
  char *search = strstr(line, "search");
  char *dom = strstr(line, domain);
  if (!search) {
    search = strstr(line, "domain");
  }
  if (dom && search) {
    if ((comment && comment > search) || comment == NULL)
      if ((comment && comment > dom) || comment == NULL)
        if (dom > search)
          ret = 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<check_for_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xece(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    117f <check_for_search+0x6f>
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1201 <check_for_search+0xf1>
cmpq   $0x0,-0x28(%rbp)
je     1201 <check_for_search+0xf1>
cmpq   $0x0,-0x20(%rbp)
je     11ae <check_for_search+0x9e>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     11b9 <check_for_search+0xa9>
cmpq   $0x0,-0x20(%rbp)
jne    11fc <check_for_search+0xec>
cmpq   $0x0,-0x20(%rbp)
je     11d2 <check_for_search+0xc2>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
ja     11dd <check_for_search+0xcd>
cmpq   $0x0,-0x20(%rbp)
jne    11f7 <check_for_search+0xe7>
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    11f2 <check_for_search+0xe2>
movl   $0x1,-0x14(%rbp)
jmp    11f7 <check_for_search+0xe7>
jmp    11fc <check_for_search+0xec>
jmp    1201 <check_for_search+0xf1>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_search>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x23,%esi
call   1030 <strchr@plt>
mov    %rax,%r14
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strstr@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strstr@plt>
mov    %rax,%r15
test   %r12,%r12
jne    1172 <check_for_search+0x52>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strstr@plt>
mov    %rax,%r12
xor    %eax,%eax
test   %r15,%r15
je     1197 <check_for_search+0x77>
test   %r12,%r12
je     1197 <check_for_search+0x77>
test   %r14,%r14
je     118d <check_for_search+0x6d>
cmp    %r12,%r14
jbe    1197 <check_for_search+0x77>
cmp    %r15,%r14
jbe    1197 <check_for_search+0x77>
cmp    %r12,%r15
jbe    1197 <check_for_search+0x77>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
@.str.1 = [7 x i8] c"search\00"
@.str.2 = [7 x i8] c"domain\00"
define i32 @check_for_search(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%9 = load i8*, i8** %3
%10 = call i8* @strstr(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %6
%11 = load i8*, i8** %3
%12 = call i8* @strstr(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %12, i8** %7
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i8* @strstr(i8* %13, i8* %14)
store i8* %15, i8** %8
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = call i8* @strstr(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i8* %20, i8** %7
br label %21
21: ; preds = %18, %2
%22 = load i8*, i8** %8
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %55
24: ; preds = %21
%25 = load i8*, i8** %7
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %55
27: ; preds = %24
%28 = load i8*, i8** %6
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i8*, i8** %6
%32 = load i8*, i8** %7
%33 = icmp ugt i8* %31, %32
br i1 %33, label %37, label %34
34: ; preds = %30, %27
%35 = load i8*, i8** %6
%36 = icmp eq i8* %35, null
br i1 %36, label %37, label %54
37: ; preds = %34, %30
%38 = load i8*, i8** %6
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i8*, i8** %6
%42 = load i8*, i8** %8
%43 = icmp ugt i8* %41, %42
br i1 %43, label %47, label %44
44: ; preds = %40, %37
%45 = load i8*, i8** %6
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %53
47: ; preds = %44, %40
%48 = load i8*, i8** %8
%49 = load i8*, i8** %7
%50 = icmp ugt i8* %48, %49
br i1 %50, label %51, label %52
51: ; preds = %47
store i32 1, i32* %5
br label %52
52: ; preds = %51, %47
br label %53
53: ; preds = %52, %44
br label %54
54: ; preds = %53, %34
br label %55
55: ; preds = %54, %24, %21
%56 = load i32, i32* %5
ret i32 %56
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"search\00"
@.str.2 = [7 x i8] c"domain\00"
define i32 @check_for_search(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 35)
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%6 = icmp eq i8* %4, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = phi i8* [ %4, %2 ], [ %8, %7 ]
%11 = icmp ne i8* %5, null
%12 = icmp ne i8* %10, null
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %14, label %25
14: ; preds = %9
%15 = icmp eq i8* %3, null
br i1 %15, label %22, label %16
16: ; preds = %14
%17 = icmp ugt i8* %3, %10
br i1 %17, label %18, label %25
18: ; preds = %16
%19 = icmp ugt i8* %3, %5
%20 = icmp ugt i8* %5, %10
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %24, label %25
22: ; preds = %14
%23 = icmp ugt i8* %5, %10
br i1 %23, label %24, label %25
24: ; preds = %18, %22
br label %25
25: ; preds = %16, %22, %24, %18, %9
%26 = phi i32 [ 1, %24 ], [ 0, %22 ], [ 0, %18 ], [ 0, %16 ], [ 0, %9 ]
ret i32 %26
}