#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 */
scalar_t__ strlen(char const *);
char *strrchr(char const *, char);
scalar_t__ strspn(char const *, char *);
int is_re_expr(const char expr[]) {
  const char *e = strrchr(expr, '/');
  return expr[0] == '/' && e != NULL && e != expr && e - expr > 1 &&
         strspn(e + 1, "iI") == strlen(e + 1);
}


x86 assembly (clang, -O0):
<is_re_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0x11(%rbp)
jne    11d5 <is_re_expr+0xa5>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     11d5 <is_re_expr+0xa5>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x11(%rbp)
je     11d5 <is_re_expr+0xa5>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    %rax,%rcx
xor    %eax,%eax
cmp    $0x1,%rcx
mov    %al,-0x11(%rbp)
jle    11d5 <is_re_expr+0xa5>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe51(%rip),%rsi
call   1050 <strspn@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_re_expr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,%r14
xor    %eax,%eax
cmpb   $0x2f,(%rbx)
jne    118a <is_re_expr+0x5a>
test   %r14,%r14
je     118a <is_re_expr+0x5a>
cmp    %rbx,%r14
je     118a <is_re_expr+0x5a>
mov    %r14,%rcx
sub    %rbx,%rcx
cmp    $0x2,%rcx
jl     118a <is_re_expr+0x5a>
add    $0x1,%r14
lea    0xe94(%rip),%rsi
mov    %r14,%rdi
call   1050 <strspn@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"iI\00"
define i32 @is_re_expr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 47
br i1 %10, label %11, label %33
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %33
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = icmp ne i8* %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = load i8*, i8** %2
%21 = ptrtoint i8* %19 to i64
%22 = ptrtoint i8* %20 to i64
%23 = sub i64 %21, %22
%24 = icmp sgt i64 %23, 1
br i1 %24, label %25, label %33
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = call i64 @strspn(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = call i64 @strlen(i8* %30)
%32 = icmp eq i64 %28, %31
br label %33
33: ; preds = %25, %18, %14, %11, %1
%34 = phi i1 [ false, %18 ], [ false, %14 ], [ false, %11 ], [ false, %1 ], [ %32, %25 ]
%35 = zext i1 %34 to i32
ret i32 %35
}

LLVM IR (-O2):
@.str = [3 x i8] c"iI\00"
define i32 @is_re_expr(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 47
%5 = icmp ne i8* %2, null
%6 = select i1 %4, i1 %5, i1 false
%7 = icmp ne i8* %2, %0
%8 = select i1 %6, i1 %7, i1 false
%9 = ptrtoint i8* %2 to i64
%10 = ptrtoint i8* %0 to i64
%11 = sub i64 %9, %10
%12 = icmp sgt i64 %11, 1
%13 = select i1 %8, i1 %12, i1 false
br i1 %13, label %14, label %20
14: ; preds = %1
%15 = getelementptr inbounds i8, i8* %2, i64 1
%16 = tail call i64 @strspn(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = tail call i64 @strlen(i8* %15)
%18 = icmp eq i64 %16, %17
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %14, %1
%21 = phi i32 [ 0, %1 ], [ %19, %14 ]
ret i32 %21
}