#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__ get_extension(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int is_html_file(char *filename) {
  char extension[10];
  if (get_extension(extension, filename) != 0)
    return 0;
  if (!strcmp(extension, "htm") || !strcmp(extension, "html")) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_html_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_extension@plt>
cmp    $0x0,%rax
je     114f <is_html_file+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1194 <is_html_file+0x74>
lea    -0x1a(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1181 <is_html_file+0x61>
lea    -0x1a(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118d <is_html_file+0x6d>
movl   $0x1,-0x4(%rbp)
jmp    1194 <is_html_file+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_html_file>:
sub    $0x18,%rsp
mov    %rdi,%rsi
lea    0xe(%rsp),%rdi
call   1030 <get_extension@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1130 <is_html_file+0x20>
add    $0x18,%rsp
ret
cmpl   $0x6d7468,0xe(%rsp)
je     1154 <is_html_file+0x44>
mov    $0x6c6d7468,%ecx
xor    0xe(%rsp),%ecx
movzbl 0x12(%rsp),%edx
xor    %eax,%eax
or     %ecx,%edx
sete   %al
add    $0x18,%rsp
ret
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"htm\00"
@.str.1 = [5 x i8] c"html\00"
define i32 @is_html_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [10 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i64 @get_extension(i8* %5, i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %20
10: ; preds = %1
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14, %10
store i32 1, i32* %2
br label %20
19: ; preds = %14
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [4 x i8] c"htm\00"
@.str.1 = [5 x i8] c"html\00"
define i32 @is_html_file(i8* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i64 @get_extension(i8* %3, i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = call i32 @bcmp(i8* dereferenceable(4) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = call i32 @bcmp(i8* dereferenceable(5) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %1
%14 = phi i32 [ 0, %1 ], [ 1, %6 ], [ %12, %9 ]
ret i32 %14
}