#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 aeron_properties_file_load(char const *);
int aeron_properties_http_load(char const *);
int strlen(char *);
scalar_t__ strncmp(char *, char const *, int);
int aeron_properties_load(const char *url_or_filename) {
  int result = -1;
  if (strncmp("file://", url_or_filename, strlen("file://")) == 0) {
    result = aeron_properties_file_load(url_or_filename + strlen("file://"));
  } else if (strncmp("http://", url_or_filename, strlen("http://")) == 0) {
    result = aeron_properties_http_load(url_or_filename);
  } else {
    result = aeron_properties_file_load(url_or_filename);
  }
  return result;
}


x86 assembly (clang, -O0):
<aeron_properties_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe8c(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ad <aeron_properties_load+0x6d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe6e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
cltq
add    %rax,%rdi
call   1060 <aeron_properties_file_load@plt>
mov    %eax,-0xc(%rbp)
jmp    11ff <aeron_properties_load+0xbf>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe4c(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe3a(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ee <aeron_properties_load+0xae>
mov    -0x8(%rbp),%rdi
call   1050 <aeron_properties_http_load@plt>
mov    %eax,-0xc(%rbp)
jmp    11fa <aeron_properties_load+0xba>
mov    -0x8(%rbp),%rdi
call   1060 <aeron_properties_file_load@plt>
mov    %eax,-0xc(%rbp)
jmp    11ff <aeron_properties_load+0xbf>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aeron_properties_load>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1198 <aeron_properties_load+0x58>
lea    0xe99(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11a9 <aeron_properties_load+0x69>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <aeron_properties_http_load@plt>
lea    0xe61(%rip),%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <aeron_properties_file_load@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"file://\00"
@.str.1 = [8 x i8] c"http://\00"
define i32 @aeron_properties_load(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -1, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = call i32 @aeron_properties_file_load(i8* %12)
store i32 %13, i32* %3
br label %26
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%17 = call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = call i32 @aeron_properties_http_load(i8* %20)
store i32 %21, i32* %3
br label %25
22: ; preds = %14
%23 = load i8*, i8** %2
%24 = call i32 @aeron_properties_file_load(i8* %23)
store i32 %24, i32* %3
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [8 x i8] c"file://\00"
@.str.1 = [8 x i8] c"http://\00"
define i32 @aeron_properties_load(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @aeron_properties_file_load(i8* %8)
br label %18
10: ; preds = %1
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @aeron_properties_http_load(i8* %0)
br label %18
16: ; preds = %10
%17 = tail call i32 @aeron_properties_file_load(i8* %0)
br label %18
18: ; preds = %14, %16, %5
%19 = phi i32 [ %9, %5 ], [ %15, %14 ], [ %17, %16 ]
ret i32 %19
}