#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ startsWith(char const *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strlcat(char *, char const *, int);
int /*<<< orphan*/ strlcpy(char *, char const *, int);
scalar_t__ strncasecmp(char *, char const *, int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *strrchr(char *, char);
char *strstr(char const *, char *);
void makeUrl(char *buf, int size, const char *base, const char *rel) {
  char *sep;
  char *protol_prefix;
  char *option_start;
  if (!strncasecmp("android:AmlogicPlayer", base, 21)) {
    strncpy(buf, rel, size);
    return;
  }
  if (strncasecmp("http://", base, 7) && strncasecmp("https://", base, 8) &&
      strncasecmp("file://", base, 7) && strncasecmp("/", base, 1)) {
    fprintf(stderr, "Base URL must be absolute url");
    return;
  }
  if (!strncasecmp("http://", rel, 7) || !strncasecmp("https://", rel, 8)) {
    strncpy(buf, rel, size);
    return;
  }
  if (base && strstr(base, "://") && rel[0] == '/') {
    if (base != buf)
      strlcpy(buf, base, size);
    sep = strstr(buf, "://");
    if (sep) {
      sep += 3;
      sep = strchr(sep, '/');
      if (sep)
        *sep = '\0';
    }
    strlcat(buf, rel, size);
    return;
  }
  protol_prefix = strstr(rel, "://");
  option_start = strstr(rel, "?");
  if (!base || rel[0] == '/' || (option_start == NULL && protol_prefix) ||
      (option_start && protol_prefix != NULL && protol_prefix < option_start)) {
    strlcpy(buf, rel, size);
    return;
  }
  if (base != buf) {
    strlcpy(buf, base, size);
  }
  option_start = strchr(buf, '?');
  if (option_start) {
    option_start[0] = '\0';
  }
  sep = strrchr(buf, '/');
  if (sep) {
    sep[1] = '\0';
  } else {
    buf[0] = '\0';
  }
  while (startsWith(rel, "../") && sep) {
    sep[0] = '\0';
    sep = strrchr(buf, '/');
    if (!strcmp(sep ? &sep[1] : buf, "..")) {
      strlcat(buf, "/", size);
      break;
    }
    if (sep) {
      sep[1] = '\0';
    } else {
      buf[0] = '\0';
    }
    rel += 3;
  }
  strlcat(buf, rel, size);
}


x86 assembly (clang, -O0):
<makeUrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x15,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11eb <makeUrl+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
jmp    1585 <makeUrl+0x3e5>
mov    -0x18(%rbp),%rsi
lea    0xe20(%rip),%rdi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
je     1281 <makeUrl+0xe1>
mov    -0x18(%rbp),%rsi
lea    0xe09(%rip),%rdi
mov    $0x8,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
je     1281 <makeUrl+0xe1>
mov    -0x18(%rbp),%rsi
lea    0xdf3(%rip),%rdi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
je     1281 <makeUrl+0xe1>
mov    -0x18(%rbp),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x1,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
je     1281 <makeUrl+0xe1>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1585 <makeUrl+0x3e5>
mov    -0x20(%rbp),%rsi
lea    0xd8a(%rip),%rdi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
je     12bf <makeUrl+0x11f>
mov    -0x20(%rbp),%rsi
lea    0xd73(%rip),%rdi
mov    $0x8,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
jne    12d4 <makeUrl+0x134>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
jmp    1585 <makeUrl+0x3e5>
cmpq   $0x0,-0x18(%rbp)
je     1390 <makeUrl+0x1f0>
mov    -0x18(%rbp),%rdi
lea    0xd41(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     1390 <makeUrl+0x1f0>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1390 <makeUrl+0x1f0>
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1327 <makeUrl+0x187>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   10b0 <strlcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xcf9(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     137b <makeUrl+0x1db>
mov    -0x28(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1376 <makeUrl+0x1d6>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
jmp    137b <makeUrl+0x1db>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <strlcat@plt>
jmp    1585 <makeUrl+0x3e5>
mov    -0x20(%rbp),%rdi
lea    0xc90(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc9e(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     140d <makeUrl+0x26d>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     140d <makeUrl+0x26d>
cmpq   $0x0,-0x38(%rbp)
jne    13e9 <makeUrl+0x249>
cmpq   $0x0,-0x30(%rbp)
jne    140d <makeUrl+0x26d>
cmpq   $0x0,-0x38(%rbp)
je     1422 <makeUrl+0x282>
cmpq   $0x0,-0x30(%rbp)
je     1422 <makeUrl+0x282>
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1422 <makeUrl+0x282>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   10b0 <strlcpy@plt>
jmp    1585 <makeUrl+0x3e5>
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1440 <makeUrl+0x2a0>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   10b0 <strlcpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3f,%esi
call   1060 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1464 <makeUrl+0x2c4>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     148e <makeUrl+0x2ee>
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1495 <makeUrl+0x2f5>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    149a <makeUrl+0x2fa>
mov    -0x20(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   1040 <startsWith@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x39(%rbp)
je     14c7 <makeUrl+0x327>
cmpq   $0x0,-0x28(%rbp)
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    14d7 <makeUrl+0x337>
jmp    1575 <makeUrl+0x3d5>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     150c <makeUrl+0x36c>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1514 <makeUrl+0x374>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xb34(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1545 <makeUrl+0x3a5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xb16(%rip),%rsi
call   1050 <strlcat@plt>
jmp    1575 <makeUrl+0x3d5>
cmpq   $0x0,-0x28(%rbp)
je     155d <makeUrl+0x3bd>
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1564 <makeUrl+0x3c4>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    149a <makeUrl+0x2fa>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <strlcat@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeUrl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xe42(%rip),%rdi
mov    %rdx,%rsi
mov    $0x15,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     130f <makeUrl+0x16f>
lea    0xe3b(%rip),%rdi
mov    %rbp,%rsi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     125b <makeUrl+0xbb>
lea    0xe2a(%rip),%rdi
mov    %rbp,%rsi
mov    $0x8,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     125b <makeUrl+0xbb>
lea    0xe1a(%rip),%rdi
mov    %rbp,%rsi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     125b <makeUrl+0xbb>
lea    0xe29(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     125b <makeUrl+0xbb>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xde7(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <fprintf@plt>
lea    0xdb4(%rip),%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     130f <makeUrl+0x16f>
lea    0xd9f(%rip),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
je     130f <makeUrl+0x16f>
test   %rbp,%rbp
je     132b <makeUrl+0x18b>
lea    0xd8a(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <strstr@plt>
test   %rax,%rax
je     132b <makeUrl+0x18b>
cmpb   $0x2f,(%rbx)
jne    132b <makeUrl+0x18b>
cmp    %r15,%rbp
je     12c6 <makeUrl+0x126>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   10b0 <strlcpy@plt>
lea    0xd5e(%rip),%rsi
mov    %r15,%rdi
call   10c0 <strstr@plt>
test   %rax,%rax
je     12f3 <makeUrl+0x153>
add    $0x3,%rax
mov    %rax,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12f3 <makeUrl+0x153>
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <strlcat@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strncpy@plt>
lea    0xcf9(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <strstr@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1060 <strchr@plt>
test   %rbp,%rbp
je     136d <makeUrl+0x1cd>
cmpb   $0x2f,(%rbx)
je     136d <makeUrl+0x1cd>
test   %rax,%rax
jne    135e <makeUrl+0x1be>
test   %r12,%r12
jne    136d <makeUrl+0x1cd>
test   %rax,%rax
je     1389 <makeUrl+0x1e9>
test   %r12,%r12
je     1389 <makeUrl+0x1e9>
cmp    %rax,%r12
jae    1389 <makeUrl+0x1e9>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <strlcpy@plt>
cmp    %r15,%rbp
je     139c <makeUrl+0x1fc>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   10b0 <strlcpy@plt>
mov    %r15,%rdi
mov    $0x3f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     13b1 <makeUrl+0x211>
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,%rbp
add    $0x1,%rax
test   %rbp,%rbp
cmove  %r15,%rax
movb   $0x0,(%rax)
lea    0xc77(%rip),%rsi
mov    %rbx,%rdi
call   1040 <startsWith@plt>
test   %rax,%rax
je     12f3 <makeUrl+0x153>
test   %rbp,%rbp
je     12f3 <makeUrl+0x153>
lea    0xc5a(%rip),%r12
movb   $0x0,0x0(%rbp)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,%rbp
lea    0x1(%rax),%r13
test   %rax,%rax
mov    %r13,%rdi
cmove  %r15,%rdi
mov    %r12,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1457 <makeUrl+0x2b7>
test   %rbp,%rbp
cmove  %r15,%r13
movb   $0x0,0x0(%r13)
add    $0x3,%rbx
mov    %rbx,%rdi
lea    0xc0e(%rip),%rsi
call   1040 <startsWith@plt>
test   %rax,%rax
je     12f3 <makeUrl+0x153>
test   %rbp,%rbp
jne    13f7 <makeUrl+0x257>
jmp    12f3 <makeUrl+0x153>
lea    0xbf1(%rip),%rsi
mov    %r15,%rdi
mov    %r14d,%edx
call   1050 <strlcat@plt>
jmp    12f3 <makeUrl+0x153>

LLVM IR (-O0):
@.str = [22 x i8] c"android:AmlogicPlayer\00"
@.str.1 = [8 x i8] c"http://\00"
@.str.2 = [9 x i8] c"https://\00"
@.str.3 = [8 x i8] c"file://\00"
@.str.4 = [2 x i8] c"/\00"
@stderr = global i32 0
@.str.5 = [30 x i8] c"Base URL must be absolute url\00"
@.str.6 = [4 x i8] c"://\00"
@.str.7 = [2 x i8] c"?\00"
@.str.8 = [4 x i8] c"../\00"
@.str.9 = [3 x i8] c"..\00"
define void @makeUrl(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %7
%13 = call i64 @strncasecmp(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12, i32 21)
%14 = icmp ne i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %4
%16 = load i8*, i8** %5
%17 = load i8*, i8** %8
%18 = load i32, i32* %6
%19 = call i32 @strncpy(i8* %16, i8* %17, i32 %18)
br label %203
20: ; preds = %4
%21 = load i8*, i8** %7
%22 = call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 7)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %39
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %25, i32 8)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %39
28: ; preds = %24
%29 = load i8*, i8** %7
%30 = call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %29, i32 7)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load i8*, i8** %7
%34 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %33, i32 1)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %203
39: ; preds = %32, %28, %24, %20
%40 = load i8*, i8** %8
%41 = call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %40, i32 7)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i8*, i8** %8
%45 = call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %44, i32 8)
%46 = icmp ne i64 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %43, %39
%48 = load i8*, i8** %5
%49 = load i8*, i8** %8
%50 = load i32, i32* %6
%51 = call i32 @strncpy(i8* %48, i8* %49, i32 %50)
br label %203
52: ; preds = %43
%53 = load i8*, i8** %7
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %94
55: ; preds = %52
%56 = load i8*, i8** %7
%57 = call i8* @strstr(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%58 = icmp ne i8* %57, null
br i1 %58, label %59, label %94
59: ; preds = %55
%60 = load i8*, i8** %8
%61 = getelementptr inbounds i8, i8* %60, i64 0
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 47
br i1 %64, label %65, label %94
65: ; preds = %59
%66 = load i8*, i8** %7
%67 = load i8*, i8** %5
%68 = icmp ne i8* %66, %67
br i1 %68, label %69, label %74
69: ; preds = %65
%70 = load i8*, i8** %5
%71 = load i8*, i8** %7
%72 = load i32, i32* %6
%73 = call i32 @strlcpy(i8* %70, i8* %71, i32 %72)
br label %74
74: ; preds = %69, %65
%75 = load i8*, i8** %5
%76 = call i8* @strstr(i8* %75, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i8* %76, i8** %9
%77 = load i8*, i8** %9
%78 = icmp ne i8* %77, null
br i1 %78, label %79, label %89
79: ; preds = %74
%80 = load i8*, i8** %9
%81 = getelementptr inbounds i8, i8* %80, i64 3
store i8* %81, i8** %9
%82 = load i8*, i8** %9
%83 = call i8* @strchr(i8* %82, i8 signext 47)
store i8* %83, i8** %9
%84 = load i8*, i8** %9
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %88
86: ; preds = %79
%87 = load i8*, i8** %9
store i8 0, i8* %87
br label %88
88: ; preds = %86, %79
br label %89
89: ; preds = %88, %74
%90 = load i8*, i8** %5
%91 = load i8*, i8** %8
%92 = load i32, i32* %6
%93 = call i32 @strlcat(i8* %90, i8* %91, i32 %92)
br label %203
94: ; preds = %59, %55, %52
%95 = load i8*, i8** %8
%96 = call i8* @strstr(i8* %95, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i8* %96, i8** %10
%97 = load i8*, i8** %8
%98 = call i8* @strstr(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i8* %98, i8** %11
%99 = load i8*, i8** %7
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %123
101: ; preds = %94
%102 = load i8*, i8** %8
%103 = getelementptr inbounds i8, i8* %102, i64 0
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 47
br i1 %106, label %123, label %107
107: ; preds = %101
%108 = load i8*, i8** %11
%109 = icmp eq i8* %108, null
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load i8*, i8** %10
%112 = icmp ne i8* %111, null
br i1 %112, label %123, label %113
113: ; preds = %110, %107
%114 = load i8*, i8** %11
%115 = icmp ne i8* %114, null
br i1 %115, label %116, label %128
116: ; preds = %113
%117 = load i8*, i8** %10
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %128
119: ; preds = %116
%120 = load i8*, i8** %10
%121 = load i8*, i8** %11
%122 = icmp ult i8* %120, %121
br i1 %122, label %123, label %128
123: ; preds = %119, %110, %101, %94
%124 = load i8*, i8** %5
%125 = load i8*, i8** %8
%126 = load i32, i32* %6
%127 = call i32 @strlcpy(i8* %124, i8* %125, i32 %126)
br label %203
128: ; preds = %119, %116, %113
%129 = load i8*, i8** %7
%130 = load i8*, i8** %5
%131 = icmp ne i8* %129, %130
br i1 %131, label %132, label %137
132: ; preds = %128
%133 = load i8*, i8** %5
%134 = load i8*, i8** %7
%135 = load i32, i32* %6
%136 = call i32 @strlcpy(i8* %133, i8* %134, i32 %135)
br label %137
137: ; preds = %132, %128
%138 = load i8*, i8** %5
%139 = call i8* @strchr(i8* %138, i8 signext 63)
store i8* %139, i8** %11
%140 = load i8*, i8** %11
%141 = icmp ne i8* %140, null
br i1 %141, label %142, label %145
142: ; preds = %137
%143 = load i8*, i8** %11
%144 = getelementptr inbounds i8, i8* %143, i64 0
store i8 0, i8* %144
br label %145
145: ; preds = %142, %137
%146 = load i8*, i8** %5
%147 = call i8* @strrchr(i8* %146, i8 signext 47)
store i8* %147, i8** %9
%148 = load i8*, i8** %9
%149 = icmp ne i8* %148, null
br i1 %149, label %150, label %153
150: ; preds = %145
%151 = load i8*, i8** %9
%152 = getelementptr inbounds i8, i8* %151, i64 1
store i8 0, i8* %152
br label %156
153: ; preds = %145
%154 = load i8*, i8** %5
%155 = getelementptr inbounds i8, i8* %154, i64 0
store i8 0, i8* %155
br label %156
156: ; preds = %153, %150
br label %157
157: ; preds = %195, %156
%158 = load i8*, i8** %8
%159 = call i64 @startsWith(i8* %158, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %164
161: ; preds = %157
%162 = load i8*, i8** %9
%163 = icmp ne i8* %162, null
br label %164
164: ; preds = %161, %157
%165 = phi i1 [ false, %157 ], [ %163, %161 ]
br i1 %165, label %166, label %198
166: ; preds = %164
%167 = load i8*, i8** %9
%168 = getelementptr inbounds i8, i8* %167, i64 0
store i8 0, i8* %168
%169 = load i8*, i8** %5
%170 = call i8* @strrchr(i8* %169, i8 signext 47)
store i8* %170, i8** %9
%171 = load i8*, i8** %9
%172 = icmp ne i8* %171, null
br i1 %172, label %173, label %176
173: ; preds = %166
%174 = load i8*, i8** %9
%175 = getelementptr inbounds i8, i8* %174, i64 1
br label %178
176: ; preds = %166
%177 = load i8*, i8** %5
br label %178
178: ; preds = %176, %173
%179 = phi i8* [ %175, %173 ], [ %177, %176 ]
%180 = call i32 @strcmp(i8* %179, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%181 = icmp ne i32 %180, 0
br i1 %181, label %186, label %182
182: ; preds = %178
%183 = load i8*, i8** %5
%184 = load i32, i32* %6
%185 = call i32 @strlcat(i8* %183, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %184)
br label %198
186: ; preds = %178
%187 = load i8*, i8** %9
%188 = icmp ne i8* %187, null
br i1 %188, label %189, label %192
189: ; preds = %186
%190 = load i8*, i8** %9
%191 = getelementptr inbounds i8, i8* %190, i64 1
store i8 0, i8* %191
br label %195
192: ; preds = %186
%193 = load i8*, i8** %5
%194 = getelementptr inbounds i8, i8* %193, i64 0
store i8 0, i8* %194
br label %195
195: ; preds = %192, %189
%196 = load i8*, i8** %8
%197 = getelementptr inbounds i8, i8* %196, i64 3
store i8* %197, i8** %8
br label %157
198: ; preds = %182, %164
%199 = load i8*, i8** %5
%200 = load i8*, i8** %8
%201 = load i32, i32* %6
%202 = call i32 @strlcat(i8* %199, i8* %200, i32 %201)
br label %203
203: ; preds = %198, %123, %89, %47, %36, %15
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"android:AmlogicPlayer\00"
@.str.1 = [8 x i8] c"http://\00"
@.str.2 = [9 x i8] c"https://\00"
@.str.3 = [8 x i8] c"file://\00"
@.str.4 = [2 x i8] c"/\00"
@stderr = global i32 0
@.str.5 = [30 x i8] c"Base URL must be absolute url\00"
@.str.6 = [4 x i8] c"://\00"
@.str.8 = [4 x i8] c"../\00"
@.str.9 = [3 x i8] c"..\00"
define void @makeUrl(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2, i32 21)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @strncpy(i8* %0, i8* %3, i32 %1)
br label %109
9: ; preds = %4
%10 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 7)
%11 = icmp eq i64 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %9
%13 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 8)
%14 = icmp eq i64 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 7)
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %2, i32 1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %109
24: ; preds = %18, %15, %12, %9
%25 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 7)
%26 = icmp eq i64 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 8)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27, %24
%31 = tail call i32 @strncpy(i8* %0, i8* %3, i32 %1)
br label %109
32: ; preds = %27
%33 = icmp eq i8* %2, null
br i1 %33, label %54, label %34
34: ; preds = %32
%35 = tail call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp eq i8* %35, null
br i1 %36, label %54, label %37
37: ; preds = %34
%38 = load i8, i8* %3
%39 = icmp eq i8 %38, 47
br i1 %39, label %40, label %54
40: ; preds = %37
%41 = icmp eq i8* %2, %0
br i1 %41, label %44, label %42
42: ; preds = %40
%43 = tail call i32 @strlcpy(i8* %0, i8* %2, i32 %1)
br label %44
44: ; preds = %42, %40
%45 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%46 = icmp eq i8* %45, null
br i1 %46, label %52, label %47
47: ; preds = %44
%48 = getelementptr inbounds i8, i8* %45, i64 3
%49 = tail call i8* @strchr(i8* %48, i8 signext 47)
%50 = icmp eq i8* %49, null
br i1 %50, label %52, label %51
51: ; preds = %47
store i8 0, i8* %49
br label %52
52: ; preds = %47, %51, %44
%53 = tail call i32 @strlcat(i8* %0, i8* %3, i32 %1)
br label %109
54: ; preds = %37, %34, %32
%55 = tail call i8* @strstr(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%56 = tail call i8* bitcast (i8* (i8*, i8)* @strchr to i8* (i8*, i32)*)(i8* %3, i32 63)
br i1 %33, label %69, label %57
57: ; preds = %54
%58 = load i8, i8* %3
%59 = icmp eq i8 %58, 47
br i1 %59, label %69, label %60
60: ; preds = %57
%61 = icmp eq i8* %56, null
%62 = icmp ne i8* %55, null
%63 = select i1 %61, i1 %62, i1 false
br i1 %63, label %69, label %64
64: ; preds = %60
%65 = icmp ne i8* %56, null
%66 = select i1 %65, i1 %62, i1 false
%67 = icmp ult i8* %55, %56
%68 = select i1 %66, i1 %67, i1 false
br i1 %68, label %69, label %71
69: ; preds = %64, %60, %57, %54
%70 = tail call i32 @strlcpy(i8* %0, i8* %3, i32 %1)
br label %109
71: ; preds = %64
%72 = icmp eq i8* %2, %0
br i1 %72, label %75, label %73
73: ; preds = %71
%74 = tail call i32 @strlcpy(i8* %0, i8* %2, i32 %1)
br label %75
75: ; preds = %73, %71
%76 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 63)
%77 = icmp eq i8* %76, null
br i1 %77, label %79, label %78
78: ; preds = %75
store i8 0, i8* %76
br label %79
79: ; preds = %78, %75
%80 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%81 = icmp eq i8* %80, null
%82 = getelementptr inbounds i8, i8* %80, i64 1
%83 = select i1 %81, i8* %0, i8* %82
store i8 0, i8* %83
%84 = tail call i64 @startsWith(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%85 = icmp ne i64 %84, 0
%86 = icmp ne i8* %80, null
%87 = select i1 %85, i1 %86, i1 false
br i1 %87, label %88, label %106
88: ; preds = %79, %99
%89 = phi i8* [ %101, %99 ], [ %3, %79 ]
%90 = phi i8* [ %91, %99 ], [ %80, %79 ]
store i8 0, i8* %90
%91 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%92 = icmp eq i8* %91, null
%93 = getelementptr inbounds i8, i8* %91, i64 1
%94 = select i1 %92, i8* %0, i8* %93
%95 = tail call i32 @strcmp(i8* dereferenceable(1) %94, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %88
%98 = tail call i32 @strlcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %1)
br label %106
99: ; preds = %88
%100 = select i1 %92, i8* %0, i8* %93
store i8 0, i8* %100
%101 = getelementptr inbounds i8, i8* %89, i64 3
%102 = tail call i64 @startsWith(i8* %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%103 = icmp ne i64 %102, 0
%104 = icmp ne i8* %91, null
%105 = select i1 %103, i1 %104, i1 false
br i1 %105, label %88, label %106
106: ; preds = %99, %79, %97
%107 = phi i8* [ %89, %97 ], [ %3, %79 ], [ %101, %99 ]
%108 = tail call i32 @strlcat(i8* %0, i8* %107, i32 %1)
br label %109
109: ; preds = %106, %69, %52, %30, %21, %7
ret void
}