#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 search_next_tag(const char *s, const char **beginp, const char **endp) {
  const char *beg = NULL;
  for (; *s != 0; s++) {
    if (*s == '<') {
      beg = s;
      break;
    }
  }
  for (; *s != 0; s++) {
    if (*s == '>') {
      *beginp = beg;
      *endp = s;
      return 0;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<search_next_tag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115b <search_next_tag+0x5b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    1145 <search_next_tag+0x45>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    115b <search_next_tag+0x5b>
jmp    114a <search_next_tag+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <search_next_tag+0x18>
jmp    1160 <search_next_tag+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b8 <search_next_tag+0xb8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
jne    11a2 <search_next_tag+0xa2>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11bf <search_next_tag+0xbf>
jmp    11a7 <search_next_tag+0xa7>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <search_next_tag+0x60>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_next_tag>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <search_next_tag+0x11>
cmp    $0x3c,%al
je     1119 <search_next_tag+0x19>
add    $0x1,%rdi
jmp    1100 <search_next_tag>
xor    %ecx,%ecx
test   %al,%al
jne    1120 <search_next_tag+0x20>
jmp    1130 <search_next_tag+0x30>
mov    %rdi,%rcx
test   %al,%al
je     1130 <search_next_tag+0x30>
cmp    $0x3e,%al
je     1136 <search_next_tag+0x36>
movzbl 0x1(%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1120 <search_next_tag+0x20>
mov    $0xffffffff,%eax
ret
mov    %rcx,(%rsi)
mov    %rdi,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @search_next_tag(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i8* null, i8** %8
br label %9
9: ; preds = %22, %3
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 60
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = load i8*, i8** %5
store i8* %20, i8** %8
br label %25
21: ; preds = %14
br label %22
22: ; preds = %21
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
br label %9
25: ; preds = %19, %9
br label %26
26: ; preds = %42, %25
%27 = load i8*, i8** %5
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %45
31: ; preds = %26
%32 = load i8*, i8** %5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 62
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i8*, i8** %8
%38 = load i8**, i8*** %6
store i8* %37, i8** %38
%39 = load i8*, i8** %5
%40 = load i8**, i8*** %7
store i8* %39, i8** %40
store i32 0, i32* %4
br label %46
41: ; preds = %31
br label %42
42: ; preds = %41
%43 = load i8*, i8** %5
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %5
br label %26
45: ; preds = %26
store i32 -1, i32* %4
br label %46
46: ; preds = %45, %36
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
define i32 @search_next_tag(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i8* [ %0, %3 ], [ %8, %7 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %9
i8 60, label %10
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
br label %10
10: ; preds = %4, %9
%11 = phi i8* [ null, %9 ], [ %5, %4 ]
br label %12
12: ; preds = %16, %10
%13 = phi i8 [ %6, %10 ], [ %18, %16 ]
%14 = phi i8* [ %5, %10 ], [ %17, %16 ]
switch i8 %13, label %16 [
i8 0, label %19
i8 62, label %15
]
15: ; preds = %12
store i8* %11, i8** %1
store i8* %14, i8** %2
br label %19
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %14, i64 1
%18 = load i8, i8* %17
br label %12
19: ; preds = %12, %15
%20 = phi i32 [ 0, %15 ], [ -1, %12 ]
ret i32 %20
}