#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*/ assert(char const *);
char *strchr(char const *, char);
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int _detect_non_paragraph_sections(const char *text) {
  static const char *tags[] = {"pre>", "ul>", "h1>", "h2>", "h3>",
                               "h4>",  "h5>", "h6>", "i>",  "strong>",
                               "em>",  "b>",  0};
  const char *p = text;
  int f, ret = 0;
  assert(text);
  while ((p = strchr(p, '<'))) {
    p++;
    if (*p == '/')
      p++;
    for (f = 0; tags[f]; f++) {
      if (strncmp(p, tags[f], strlen(tags[f])) == 0) {
        if (*(p - 1) == '/')
          ret--;
        else
          ret++;
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<_detect_non_paragraph_sections>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3c,%esi
call   1050 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1252 <_detect_non_paragraph_sections+0x112>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11a8 <_detect_non_paragraph_sections+0x68>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2e96(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     124d <_detect_non_paragraph_sections+0x10d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2e78(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2e65(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    123a <_detect_non_paragraph_sections+0xfa>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
jne    122c <_detect_non_paragraph_sections+0xec>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1235 <_detect_non_paragraph_sections+0xf5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    123a <_detect_non_paragraph_sections+0xfa>
jmp    123f <_detect_non_paragraph_sections+0xff>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <_detect_non_paragraph_sections+0x6f>
jmp    1164 <_detect_non_paragraph_sections+0x24>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_detect_non_paragraph_sections>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1050 <strchr@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     11e5 <_detect_non_paragraph_sections+0xa5>
lea    0xe91(%rip),%r15
lea    0x2c3a(%rip),%r12
jmp    1192 <_detect_non_paragraph_sections+0x52>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x3c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11e5 <_detect_non_paragraph_sections+0xa5>
lea    0x1(%rax),%r13
cmpb   $0x2f,0x1(%rax)
lea    0x2(%rax),%rax
cmove  %rax,%r13
mov    $0x1,%ebx
mov    %r15,%rbp
jmp    11be <_detect_non_paragraph_sections+0x7e>
add    $0x1,%r14d
mov    (%r12,%rbx,8),%rbp
add    $0x1,%rbx
cmp    $0xd,%rbx
je     1180 <_detect_non_paragraph_sections+0x40>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11b0 <_detect_non_paragraph_sections+0x70>
cmpb   $0x2f,-0x1(%r13)
jne    11ac <_detect_non_paragraph_sections+0x6c>
add    $0xffffffff,%r14d
jmp    11b0 <_detect_non_paragraph_sections+0x70>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@_detect_non_paragraph_sections.tags = internal global [13 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* null]
@.str = [5 x i8] c"pre>\00"
@.str.1 = [4 x i8] c"ul>\00"
@.str.2 = [4 x i8] c"h1>\00"
@.str.3 = [4 x i8] c"h2>\00"
@.str.4 = [4 x i8] c"h3>\00"
@.str.5 = [4 x i8] c"h4>\00"
@.str.6 = [4 x i8] c"h5>\00"
@.str.7 = [4 x i8] c"h6>\00"
@.str.8 = [3 x i8] c"i>\00"
@.str.9 = [8 x i8] c"strong>\00"
@.str.10 = [4 x i8] c"em>\00"
@.str.11 = [3 x i8] c"b>\00"
define i32 @_detect_non_paragraph_sections(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
store i32 0, i32* %5
%7 = load i8*, i8** %2
%8 = call i32 @assert(i8* %7)
br label %9
9: ; preds = %60, %1
%10 = load i8*, i8** %3
%11 = call i8* @strchr(i8* %10, i8 signext 60)
store i8* %11, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %61
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 47
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
br label %23
23: ; preds = %20, %13
store i32 0, i32* %4
br label %24
24: ; preds = %57, %23
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [13 x i8*], [13 x i8*]* @_detect_non_paragraph_sections.tags, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %60
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [13 x i8*], [13 x i8*]* @_detect_non_paragraph_sections.tags, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [13 x i8*], [13 x i8*]* @_detect_non_paragraph_sections.tags, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @strlen(i8* %39)
%41 = call i64 @strncmp(i8* %31, i8* %35, i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %56
43: ; preds = %30
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i64 -1
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 47
br i1 %48, label %49, label %52
49: ; preds = %43
%50 = load i32, i32* %5
%51 = add nsw i32 %50, -1
store i32 %51, i32* %5
br label %55
52: ; preds = %43
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %55
55: ; preds = %52, %49
br label %56
56: ; preds = %55, %30
br label %57
57: ; preds = %56
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %24
60: ; preds = %24
br label %9
61: ; preds = %9
%62 = load i32, i32* %5
ret i32 %62
}

LLVM IR (-O2):
@_detect_non_paragraph_sections.tags = internal unnamed_addr constant [13 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* null]
@.str = [5 x i8] c"pre>\00"
@.str.1 = [4 x i8] c"ul>\00"
@.str.2 = [4 x i8] c"h1>\00"
@.str.3 = [4 x i8] c"h2>\00"
@.str.4 = [4 x i8] c"h3>\00"
@.str.5 = [4 x i8] c"h4>\00"
@.str.6 = [4 x i8] c"h5>\00"
@.str.7 = [4 x i8] c"h6>\00"
@.str.8 = [3 x i8] c"i>\00"
@.str.9 = [8 x i8] c"strong>\00"
@.str.10 = [4 x i8] c"em>\00"
@.str.11 = [3 x i8] c"b>\00"
define i32 @_detect_non_paragraph_sections(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 60)
%4 = icmp eq i8* %3, null
br i1 %4, label %37, label %8
5: ; preds = %31
%6 = tail call i8* @strchr(i8* dereferenceable(1) %15, i8 signext 60)
%7 = icmp eq i8* %6, null
br i1 %7, label %37, label %8
8: ; preds = %1, %5
%9 = phi i8* [ %6, %5 ], [ %3, %1 ]
%10 = phi i32 [ %32, %5 ], [ 0, %1 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 47
%14 = getelementptr inbounds i8, i8* %9, i64 2
%15 = select i1 %13, i8* %14, i8* %11
%16 = getelementptr inbounds i8, i8* %15, i64 -1
br label %17
17: ; preds = %8, %31
%18 = phi i64 [ 0, %8 ], [ %33, %31 ]
%19 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %8 ], [ %35, %31 ]
%20 = phi i32 [ %10, %8 ], [ %32, %31 ]
%21 = tail call i32 @strlen(i8* %19)
%22 = tail call i64 @strncmp(i8* %15, i8* %19, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %17
%25 = load i8, i8* %16
%26 = icmp eq i8 %25, 47
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = add nsw i32 %20, -1
br label %31
29: ; preds = %24
%30 = add nsw i32 %20, 1
br label %31
31: ; preds = %17, %29, %27
%32 = phi i32 [ %28, %27 ], [ %30, %29 ], [ %20, %17 ]
%33 = add nuw nsw i64 %18, 1
%34 = getelementptr inbounds [13 x i8*], [13 x i8*]* @_detect_non_paragraph_sections.tags, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = icmp eq i64 %33, 12
br i1 %36, label %5, label %17
37: ; preds = %5, %1
%38 = phi i32 [ 0, %1 ], [ %32, %5 ]
ret i32 %38
}