#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 */
typedef size_t ssize_t;

/* Variables and functions */
ssize_t fabr_find_range_end(const char *s) {
  for (size_t i = 0;; ++i) {
    char c = s[i];
    if (c == '\0')
      break;
    if (c == '\\') {
      ++i;
      continue;
    }
    if (c == ']')
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<fabr_find_range_end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
jne    1130 <fabr_find_range_end+0x30>
jmp    117e <fabr_find_range_end+0x7e>
movsbl -0x19(%rbp),%eax
cmp    $0x5c,%eax
jne    114e <fabr_find_range_end+0x4e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    116d <fabr_find_range_end+0x6d>
movsbl -0x19(%rbp),%eax
cmp    $0x5d,%eax
jne    1168 <fabr_find_range_end+0x68>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1186 <fabr_find_range_end+0x86>
jmp    116d <fabr_find_range_end+0x6d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <fabr_find_range_end+0x10>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabr_find_range_end>:
xor    %eax,%eax
jmp    1118 <fabr_find_range_end+0x18>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rax
add    $0x1,%rax
movzbl (%rdi,%rax,1),%ecx
cmp    $0x5c,%cl
je     1110 <fabr_find_range_end+0x10>
test   %cl,%cl
je     112b <fabr_find_range_end+0x2b>
cmp    $0x5d,%cl
jne    1114 <fabr_find_range_end+0x14>
ret
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @fabr_find_range_end(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8
store i8* %0, i8** %3
store i64 0, i64* %4
br label %6
6: ; preds = %29, %1
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = getelementptr inbounds i8, i8* %7, i64 %8
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %6
br label %32
15: ; preds = %6
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 92
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i64, i64* %4
%21 = add i64 %20, 1
store i64 %21, i64* %4
br label %29
22: ; preds = %15
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 93
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i64, i64* %4
store i64 %27, i64* %2
br label %33
28: ; preds = %22
br label %29
29: ; preds = %28, %19
%30 = load i64, i64* %4
%31 = add i64 %30, 1
store i64 %31, i64* %4
br label %6
32: ; preds = %14
store i64 -1, i64* %2
br label %33
33: ; preds = %32, %26
%34 = load i64, i64* %2
ret i64 %34
}

LLVM IR (-O2):
define i64 @fabr_find_range_end(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ 0, %1 ], [ %10, %8 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %12
i8 92, label %6
i8 93, label %11
]
6: ; preds = %2
%7 = add i64 %3, 1
br label %8
8: ; preds = %2, %6
%9 = phi i64 [ %7, %6 ], [ %3, %2 ]
%10 = add i64 %9, 1
br label %2
11: ; preds = %2
br label %12
12: ; preds = %2, %11
%13 = phi i64 [ %3, %11 ], [ -1, %2 ]
ret i64 %13
}