#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*/ c4pkg_github_repo_name(char const *);
char *string_concat(char *, char const *, char *, int /*<<< orphan*/, char *,
                    int /*<<< orphan*/ *);
char *c4pkg_github_get_package_url(const char *repo) {
  return repo ? string_concat("https://raw.githubusercontent.com/", repo,
                              "/master/pkgfiles/", c4pkg_github_repo_name(repo),
                              ".zip", NULL)
              : NULL;
}


x86 assembly (clang, -O0):
<c4pkg_github_get_package_url>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1176 <c4pkg_github_get_package_url+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <c4pkg_github_repo_name@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%ecx
lea    0xeab(%rip),%rdi
lea    0xec7(%rip),%rdx
lea    0xed2(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1040 <string_concat@plt>
mov    %rax,-0x10(%rbp)
jmp    1181 <c4pkg_github_get_package_url+0x61>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1181 <c4pkg_github_get_package_url+0x61>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c4pkg_github_get_package_url>:
test   %rdi,%rdi
je     1151 <c4pkg_github_get_package_url+0x31>
push   %rbx
mov    %rdi,%rbx
call   1030 <c4pkg_github_repo_name@plt>
lea    0xecb(%rip),%rdi
lea    0xee7(%rip),%rdx
lea    0xef2(%rip),%r8
mov    %rbx,%rsi
mov    %eax,%ecx
xor    %r9d,%r9d
pop    %rbx
jmp    1040 <string_concat@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [35 x i8] c"https://raw.githubusercontent.com/\00"
@.str.1 = [18 x i8] c"/master/pkgfiles/\00"
@.str.2 = [5 x i8] c".zip\00"
define i8* @c4pkg_github_get_package_url(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @c4pkg_github_repo_name(i8* %7)
%9 = call i8* @string_concat(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* null)
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %5
%12 = phi i8* [ %9, %5 ], [ null, %10 ]
ret i8* %12
}

LLVM IR (-O2):
@.str = [35 x i8] c"https://raw.githubusercontent.com/\00"
@.str.1 = [18 x i8] c"/master/pkgfiles/\00"
@.str.2 = [5 x i8] c".zip\00"
define i8* @c4pkg_github_get_package_url(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @c4pkg_github_repo_name(i8* %0)
%5 = tail call i8* @string_concat(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* null)
br label %6
6: ; preds = %1, %3
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}