#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 */
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int isSingletonTag(char *tag) {
  if (tag[strlen(tag) - 1] == '/')
    return 1;
  else if (!strncmp("br", tag, 2) || !strncmp("hr", tag, 2))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isSingletonTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1162 <isSingletonTag+0x42>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <isSingletonTag+0x96>
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     119e <isSingletonTag+0x7e>
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11aa <isSingletonTag+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <isSingletonTag+0x96>
jmp    11af <isSingletonTag+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSingletonTag>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
cltq
mov    $0x1,%ebp
cmpb   $0x2f,-0x1(%rax,%rbx,1)
je     116d <isSingletonTag+0x4d>
lea    0xec0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     116d <isSingletonTag+0x4d>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"br\00"
@.str.1 = [3 x i8] c"hr\00"
define i32 @isSingletonTag(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 47
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %2
br label %25
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15, i32 2)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19, i32 2)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %18, %14
store i32 1, i32* %2
br label %25
23: ; preds = %18
br label %24
24: ; preds = %23
store i32 0, i32* %2
br label %25
25: ; preds = %24, %22, %13
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [3 x i8] c"br\00"
@.str.1 = [3 x i8] c"hr\00"
define i32 @isSingletonTag(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 47
br i1 %7, label %15, label %8
8: ; preds = %1
%9 = tail call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0, i32 2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 2)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %8, %1
%16 = phi i32 [ 1, %1 ], [ 1, %8 ], [ %14, %11 ]
ret i32 %16
}