#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__ isalpha(char const);
int /*<<< orphan*/ memcmp(char const *, char *, int);
int strlen(char const *);
int rfile_fn_is_url(const char *fn) {
  const char *fnp;
  for (fnp = fn; *fnp && isalpha(*fnp); fnp++)
    ;
  return fnp > fn + 2 && strlen(fnp) > 3 && !memcmp(fnp, "://", 3);
}


x86 assembly (clang, -O0):
<rfile_fn_is_url>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     116f <rfile_fn_is_url+0x3f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    117f <rfile_fn_is_url+0x4f>
jmp    1195 <rfile_fn_is_url+0x65>
jmp    1184 <rfile_fn_is_url+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <rfile_fn_is_url+0x14>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rdx
add    $0x2,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x12(%rbp)
jbe    11e8 <rfile_fn_is_url+0xb8>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
mov    %al,-0x12(%rbp)
jle    11e8 <rfile_fn_is_url+0xb8>
mov    -0x10(%rbp),%rdi
lea    0xe2d(%rip),%rsi
mov    $0x3,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfile_fn_is_url>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1192 <rfile_fn_is_url+0x62>
mov    %rdi,%rbx
xor    %ebp,%ebp
nop
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     115a <rfile_fn_is_url+0x2a>
movzbl 0x1(%rbx,%rbp,1),%eax
add    $0x1,%rbp
test   %al,%al
jne    1140 <rfile_fn_is_url+0x10>
xor    %r14d,%r14d
cmp    $0x3,%rbp
jb     1195 <rfile_fn_is_url+0x65>
add    %rbp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
jl     1195 <rfile_fn_is_url+0x65>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <memcmp@plt>
xor    %r14d,%r14d
test   %eax,%eax
sete   %r14b
jmp    1195 <rfile_fn_is_url+0x65>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"://\00"
define i32 @rfile_fn_is_url(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %25, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %12, %9 ], [ %2, %1 ]
%6 = phi i64 [ %10, %9 ], [ 0, %1 ]
%7 = tail call i64 @isalpha(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = add nuw nsw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %9
%15 = phi i64 [ %6, %4 ], [ %10, %9 ]
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = icmp ugt i64 %15, 2
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = tail call i32 @strlen(i8* %16)
%20 = icmp sgt i32 %19, 3
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = tail call i32 @memcmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %1, %21, %18, %14
%26 = phi i32 [ 0, %18 ], [ 0, %14 ], [ %24, %21 ], [ 0, %1 ]
ret i32 %26
}