#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 int /*<<< orphan*/ local_proto;

/* Variables and functions */
scalar_t__ SC68strcmp(char const *, char const *);
int url68_local_protocol(const char *protocol) {
  int i;
  static const char *local_proto[] = {"", "FILE", "LOCAL", "NULL"};
  const int n_proto = sizeof(local_proto) / sizeof(*local_proto);
  i = 0;
  if (protocol) {
    for (; i < n_proto && SC68strcmp(protocol, local_proto[i]); ++i)
      ;
  }
  return i < n_proto;
}


x86 assembly (clang, -O0):
<url68_local_protocol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1193 <url68_local_protocol+0x83>
jmp    113a <url68_local_protocol+0x2a>
xor    %eax,%eax
cmpl   $0x4,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jge    116b <url68_local_protocol+0x5b>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rcx
lea    0x2ed8(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1030 <SC68strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    117b <url68_local_protocol+0x6b>
jmp    118e <url68_local_protocol+0x7e>
jmp    1180 <url68_local_protocol+0x70>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <url68_local_protocol+0x2a>
jmp    1193 <url68_local_protocol+0x83>
cmpl   $0x4,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<url68_local_protocol>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
test   %rdi,%rdi
je     1171 <url68_local_protocol+0x61>
mov    %rdi,%rbx
lea    0xedd(%rip),%rsi
call   1030 <SC68strcmp@plt>
test   %rax,%rax
je     1171 <url68_local_protocol+0x61>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <SC68strcmp@plt>
test   %rax,%rax
je     1171 <url68_local_protocol+0x61>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <SC68strcmp@plt>
test   %rax,%rax
je     1171 <url68_local_protocol+0x61>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1030 <SC68strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@url68_local_protocol.local_proto = internal global [4 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"FILE\00"
@.str.2 = [6 x i8] c"LOCAL\00"
@.str.3 = [5 x i8] c"NULL\00"
define i32 @url68_local_protocol(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 4, i32* %4
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %26
7: ; preds = %1
br label %8
8: ; preds = %22, %7
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* @url68_local_protocol.local_proto, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @SC68strcmp(i8* %12, i8* %16)
%18 = icmp ne i64 %17, 0
br label %19
19: ; preds = %11, %8
%20 = phi i1 [ false, %8 ], [ %18, %11 ]
br i1 %20, label %21, label %25
21: ; preds = %19
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %8
25: ; preds = %19
br label %26
26: ; preds = %25, %1
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 4
%29 = zext i1 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"FILE\00"
@.str.2 = [6 x i8] c"LOCAL\00"
@.str.3 = [5 x i8] c"NULL\00"
define i32 @url68_local_protocol(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = tail call i64 @SC68strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i64 @SC68strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i64 @SC68strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i64 @SC68strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %3, %6, %9, %1
%17 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 1, %6 ], [ 1, %9 ], [ %15, %12 ]
ret i32 %17
}