#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 */
char *application_relative_source_directory(char *);
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
char timlib_get_delimiter(char *);
char *application_first_relative_source_directory(char *application_string) {
  static char first_relative_source_directory[128];
  char *relative_source_directory;
  char delimiter;
  relative_source_directory =
      application_relative_source_directory(application_string);
  if (!(delimiter = timlib_get_delimiter(relative_source_directory))) {
    delimiter = ':';
  }
  piece(first_relative_source_directory, delimiter, relative_source_directory,
        0);
  return first_relative_source_directory;
}


x86 assembly (clang, -O0):
<application_first_relative_source_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <application_relative_source_directory@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <timlib_get_delimiter@plt>
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
jne    1161 <application_first_relative_source_directory+0x31>
movb   $0x3a,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rdx
lea    0x2ee1(%rip),%rdi
xor    %ecx,%ecx
movsbl %al,%esi
call   1050 <piece@plt>
lea    0x2ed0(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<application_first_relative_source_directory>:
push   %r14
push   %rbx
push   %rax
call   1030 <application_relative_source_directory@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <timlib_get_delimiter@plt>
test   %al,%al
movzbl %al,%eax
mov    $0x3a,%ecx
cmovne %eax,%ecx
movsbl %cl,%esi
lea    0x2ef5(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1050 <piece@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@application_first_relative_source_directory.first_relative_source_directory = internal global [128 x i8] zeroinitializer
define i8* @application_first_relative_source_directory(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @application_relative_source_directory(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call signext i8 @timlib_get_delimiter(i8* %7)
store i8 %8, i8* %4
%9 = icmp ne i8 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
store i8 58, i8* %4
br label %11
11: ; preds = %10, %1
%12 = load i8, i8* %4
%13 = load i8*, i8** %3
%14 = call i32 @piece(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @application_first_relative_source_directory.first_relative_source_directory, i64 0, i64 0), i8 signext %12, i8* %13, i32 0)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @application_first_relative_source_directory.first_relative_source_directory, i64 0, i64 0)
}

LLVM IR (-O2):
@application_first_relative_source_directory.first_relative_source_directory = internal global [128 x i8] zeroinitializer
define i8* @application_first_relative_source_directory(i8* %0) {
%2 = tail call i8* @application_relative_source_directory(i8* %0)
%3 = tail call signext i8 @timlib_get_delimiter(i8* %2)
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i8 58, i8 %3
%6 = tail call i32 @piece(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @application_first_relative_source_directory.first_relative_source_directory, i64 0, i64 0), i8 signext %5, i8* %2, i32 0)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @application_first_relative_source_directory.first_relative_source_directory, i64 0, i64 0)
}