#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 */
scalar_t__ isdate(char *);
int strlen(char *);
scalar_t__ strstr(char *, char *);
bool isheader(char *str) {
  if (str[0] == '\0')
    return false;
  if (str[strlen(str) - 1] == '.')
    return false;
  if (strstr(str, "http://") || strstr(str, "https://"))
    return false;
  if (isdate(str))
    return false;
  return true;
}


x86 assembly (clang, -O0):
<isheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1158 <isheader+0x28>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <isheader+0xc4>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    118e <isheader+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <isheader+0xc4>
mov    -0x10(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
jne    11c2 <isheader+0x92>
mov    -0x10(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11ce <isheader+0x9e>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <isheader+0xc4>
mov    -0x10(%rbp),%rdi
call   1040 <isdate@plt>
cmp    $0x0,%rax
je     11ed <isheader+0xbd>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <isheader+0xc4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isheader>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmpb   $0x0,(%rdi)
je     1184 <isheader+0x54>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0x2e,-0x1(%rax,%rbx,1)
je     1184 <isheader+0x54>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
jne    1184 <isheader+0x54>
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
jne    1184 <isheader+0x54>
mov    %rbx,%rdi
call   1040 <isdate@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
define i32 @isheader(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %36
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %11, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 46
br i1 %19, label %20, label %21
20: ; preds = %10
store i32 0, i32* %2
br label %36
21: ; preds = %10
%22 = load i8*, i8** %3
%23 = call i64 @strstr(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = call i64 @strstr(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25, %21
store i32 0, i32* %2
br label %36
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = call i64 @isdate(i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %2
br label %36
35: ; preds = %30
store i32 1, i32* %2
br label %36
36: ; preds = %35, %34, %29, %20, %9
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
define i32 @isheader(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 46
br i1 %10, label %21, label %11
11: ; preds = %4
%12 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = tail call i64 @isdate(i8* %0)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %17, %11, %14, %4, %1
%22 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 0, %14 ], [ 0, %11 ], [ %20, %17 ]
ret i32 %22
}