#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fxmlGetTagNameLen(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strncmp(char *, char *, int);
int fxmlIsCloseTagFor(char *s, char *name, int namelen) {
  if (*s == 0) {
    fprintf(stderr, "FXML: unexpected end of input in fxmlIsCloseTagFor.\n");
    return 0;
  }
  if (*(s + 1) != '/')
    return 0;
  int closelen = fxmlGetTagNameLen(s + 2);
  if (closelen != namelen)
    return 0;
  if (strncmp(s + 2, name, namelen) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<fxmlIsCloseTagFor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1174 <fxmlIsCloseTagFor+0x44>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <fxmlIsCloseTagFor+0xba>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
je     1191 <fxmlIsCloseTagFor+0x61>
movl   $0x0,-0x4(%rbp)
jmp    11ea <fxmlIsCloseTagFor+0xba>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
call   1040 <fxmlGetTagNameLen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     11b9 <fxmlIsCloseTagFor+0x89>
movl   $0x0,-0x4(%rbp)
jmp    11ea <fxmlIsCloseTagFor+0xba>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e3 <fxmlIsCloseTagFor+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11ea <fxmlIsCloseTagFor+0xba>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fxmlIsCloseTagFor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     1176 <fxmlIsCloseTagFor+0x46>
mov    %rdi,%rbp
xor    %ebx,%ebx
cmpb   $0x2f,0x1(%rdi)
jne    118d <fxmlIsCloseTagFor+0x5d>
mov    %edx,%r15d
mov    %rsi,%r14
add    $0x2,%rbp
mov    %rbp,%rdi
call   1040 <fxmlGetTagNameLen@plt>
cmp    %r15d,%eax
jne    118d <fxmlIsCloseTagFor+0x5d>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
jmp    118d <fxmlIsCloseTagFor+0x5d>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
call   1050 <fprintf@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"FXML: unexpected end of input in fxmlIsCloseTagFor.\0A\00"
define i32 @fxmlIsCloseTagFor(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %40
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 47
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 0, i32* %4
br label %40
23: ; preds = %16
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = call i32 @fxmlGetTagNameLen(i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = load i32, i32* %7
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %23
store i32 0, i32* %4
br label %40
31: ; preds = %23
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 2
%34 = load i8*, i8** %6
%35 = load i32, i32* %7
%36 = call i64 @strncmp(i8* %33, i8* %34, i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %31
store i32 1, i32* %4
br label %40
39: ; preds = %31
store i32 0, i32* %4
br label %40
40: ; preds = %39, %38, %30, %22, %13
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"FXML: unexpected end of input in fxmlIsCloseTagFor.\0A\00"
define i32 @fxmlIsCloseTagFor(i8* %0, i8* %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %21
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 47
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = tail call i32 @fxmlGetTagNameLen(i8* %14)
%16 = icmp eq i32 %15, %2
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = tail call i64 @strncmp(i8* %14, i8* %1, i32 %2)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %13, %17, %9, %6
%22 = phi i32 [ 0, %6 ], [ 0, %9 ], [ 0, %13 ], [ %20, %17 ]
ret i32 %22
}