#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__ strcmp(char *, char const *);
scalar_t__ strncmp(char *, char const *, int);
int /*<<< orphan*/ strstr(char const *, char *);
int is_good_link(char const *link) {
  if (NULL == link)
    return 0;
  if (0 == strcmp("#", link))
    return 0;
  else if (0 == strncmp("mailto:", link, 7))
    return 0;
  if (!strstr(link, "html") && !strstr(link, "htm"))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_good_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1154 <is_good_link+0x24>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <is_good_link+0xc7>
mov    -0x10(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    117e <is_good_link+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <is_good_link+0xc7>
mov    -0x10(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11ad <is_good_link+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <is_good_link+0xc7>
jmp    11b2 <is_good_link+0x82>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%eax
jne    11f0 <is_good_link+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%eax
jne    11f0 <is_good_link+0xc0>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <is_good_link+0xc7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_good_link>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1195 <is_good_link+0x65>
mov    %rdi,%rbx
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1195 <is_good_link+0x65>
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1195 <is_good_link+0x65>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %eax,%eax
jne    1190 <is_good_link+0x60>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %eax,%eax
je     1195 <is_good_link+0x65>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
@.str.1 = [8 x i8] c"mailto:\00"
@.str.2 = [5 x i8] c"html\00"
@.str.3 = [4 x i8] c"htm\00"
define i32 @is_good_link(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* null, %4
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %28
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 0, %9
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 0, i32* %2
br label %28
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 7)
%15 = icmp eq i64 0, %14
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 0, i32* %2
br label %28
17: ; preds = %12
br label %18
18: ; preds = %17
%19 = load i8*, i8** %3
%20 = call i32 @strstr(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = call i32 @strstr(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i32 0, i32* %2
br label %28
27: ; preds = %22, %18
store i32 1, i32* %2
br label %28
28: ; preds = %27, %26, %16, %11, %6
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [2 x i8] c"#\00"
@.str.1 = [8 x i8] c"mailto:\00"
@.str.2 = [5 x i8] c"html\00"
@.str.3 = [4 x i8] c"htm\00"
define i32 @is_good_link(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 7)
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = tail call i32 @strstr(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %12, %9
br label %16
16: ; preds = %12, %6, %3, %1, %15
%17 = phi i32 [ 1, %15 ], [ 0, %1 ], [ 0, %3 ], [ 0, %6 ], [ 0, %12 ]
ret i32 %17
}