#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*/ fz_strlcat(char *, char *, int);
int /*<<< orphan*/ fz_strlcpy(char *, char *, int);
int /*<<< orphan*/ xps_clean_path(char *);
void xps_absolute_path(char *output, char *base_uri, char *path,
                       int output_size) {
  if (path[0] == '/') {
    fz_strlcpy(output, path, output_size);
  } else {
    fz_strlcpy(output, base_uri, output_size);
    fz_strlcat(output, "/", output_size);
    fz_strlcat(output, path, output_size);
  }
  xps_clean_path(output);
}


x86 assembly (clang, -O0):
<xps_absolute_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    116c <xps_absolute_path+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <fz_strlcpy@plt>
jmp    119f <xps_absolute_path+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <fz_strlcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe76(%rip),%rsi
call   1050 <fz_strlcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <fz_strlcat@plt>
mov    -0x8(%rbp),%rdi
call   1030 <xps_clean_path@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xps_absolute_path>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rdi,%rbx
cmpb   $0x2f,(%rdx)
jne    1152 <xps_absolute_path+0x22>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1040 <fz_strlcpy@plt>
jmp    117d <xps_absolute_path+0x4d>
mov    %rbx,%rdi
mov    %r14d,%edx
call   1040 <fz_strlcpy@plt>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
call   1050 <fz_strlcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <fz_strlcat@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <xps_clean_path@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define void @xps_absolute_path(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %7
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 47
br i1 %13, label %14, label %19
14: ; preds = %4
%15 = load i8*, i8** %5
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = call i32 @fz_strlcpy(i8* %15, i8* %16, i32 %17)
br label %31
19: ; preds = %4
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = call i32 @fz_strlcpy(i8* %20, i8* %21, i32 %22)
%24 = load i8*, i8** %5
%25 = load i32, i32* %8
%26 = call i32 @fz_strlcat(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i8*, i8** %5
%28 = load i8*, i8** %7
%29 = load i32, i32* %8
%30 = call i32 @fz_strlcat(i8* %27, i8* %28, i32 %29)
br label %31
31: ; preds = %19, %14
%32 = load i8*, i8** %5
%33 = call i32 @xps_clean_path(i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define void @xps_absolute_path(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 47
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @fz_strlcpy(i8* %0, i8* %2, i32 %3)
br label %13
9: ; preds = %4
%10 = tail call i32 @fz_strlcpy(i8* %0, i8* %1, i32 %3)
%11 = tail call i32 @fz_strlcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %3)
%12 = tail call i32 @fz_strlcat(i8* %0, i8* %2, i32 %3)
br label %13
13: ; preds = %9, %7
%14 = tail call i32 @xps_clean_path(i8* %0)
ret void
}