#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 */
struct lineFile {
  int dummy;
};

/* Variables and functions */
struct lineFile *lineFileOpen(char *, int);
struct lineFile *netLineFileOpen(char *);
scalar_t__ startsWith(char *, char *);
struct lineFile *astLFOpen(char *fileOrUrl) {
  if (startsWith("http://", fileOrUrl) || startsWith("https://", fileOrUrl) ||
      startsWith("ftp://", fileOrUrl))
    return netLineFileOpen(fileOrUrl);
  else
    return lineFileOpen(fileOrUrl, 1);
}


x86 assembly (clang, -O0):
<astLFOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <startsWith@plt>
cmp    $0x0,%rax
jne    118a <astLFOpen+0x5a>
mov    -0x10(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1040 <startsWith@plt>
cmp    $0x0,%rax
jne    118a <astLFOpen+0x5a>
mov    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1040 <startsWith@plt>
cmp    $0x0,%rax
je     119c <astLFOpen+0x6c>
mov    -0x10(%rbp),%rdi
call   1030 <netLineFileOpen@plt>
mov    %rax,-0x8(%rbp)
jmp    11ae <astLFOpen+0x7e>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <lineFileOpen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<astLFOpen>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <startsWith@plt>
test   %rax,%rax
jne    1170 <astLFOpen+0x40>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1040 <startsWith@plt>
test   %rax,%rax
jne    1170 <astLFOpen+0x40>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1040 <startsWith@plt>
test   %rax,%rax
je     1179 <astLFOpen+0x49>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <netLineFileOpen@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1050 <lineFileOpen@plt>

LLVM IR (-O0):
%struct.lineFile = type { i32 }
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
@.str.2 = [7 x i8] c"ftp://\00"
define %struct.lineFile* @astLFOpen(i8* %0) {
%2 = alloca %struct.lineFile*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @startsWith(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @startsWith(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = call i64 @startsWith(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11, %7, %1
%16 = load i8*, i8** %3
%17 = call %struct.lineFile* @netLineFileOpen(i8* %16)
store %struct.lineFile* %17, %struct.lineFile** %2
br label %21
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = call %struct.lineFile* @lineFileOpen(i8* %19, i32 1)
store %struct.lineFile* %20, %struct.lineFile** %2
br label %21
21: ; preds = %18, %15
%22 = load %struct.lineFile*, %struct.lineFile** %2
ret %struct.lineFile* %22
}

LLVM IR (-O2):
%struct.lineFile = type { i32 }
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
@.str.2 = [7 x i8] c"ftp://\00"
define %struct.lineFile* @astLFOpen(i8* %0) {
%2 = tail call i64 @startsWith(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i64 @startsWith(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i64 @startsWith(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7, %4, %1
%11 = tail call %struct.lineFile* @netLineFileOpen(i8* %0)
br label %14
12: ; preds = %7
%13 = tail call %struct.lineFile* @lineFileOpen(i8* %0, i32 1)
br label %14
14: ; preds = %12, %10
%15 = phi %struct.lineFile* [ %11, %10 ], [ %13, %12 ]
ret %struct.lineFile* %15
}