#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*/ isrcs(char const *, size_t *);
int /*<<< orphan*/ xasprintf(char **, char *, char const *, int, char const *);
char *checkoutpath(const char *prefix, const char *file) {
  char *path;
  size_t len;
  if (!isrcs(file, &len))
    return (NULL);
  xasprintf(&path, "%s/%.*s", prefix, (int)len - 2, file);
  return (path);
}


x86 assembly (clang, -O0):
<checkoutpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <isrcs@plt>
cmp    $0x0,%eax
jne    1153 <checkoutpath+0x33>
movq   $0x0,-0x8(%rbp)
jmp    117c <checkoutpath+0x5c>
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
sub    $0x2,%ecx
mov    -0x18(%rbp),%r8
lea    -0x20(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1040 <xasprintf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkoutpath>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <isrcs@plt>
test   %eax,%eax
je     1163 <checkoutpath+0x43>
mov    0x8(%rsp),%ecx
add    $0xfffffffe,%ecx
lea    0xeb4(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %r14,%rdx
mov    %rbx,%r8
call   1040 <xasprintf@plt>
mov    0x10(%rsp),%rax
jmp    1165 <checkoutpath+0x45>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s/%.*s\00"
define i8* @checkoutpath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @isrcs(i8* %8, i64* %7)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2
store i8* null, i8** %3
br label %20
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i64, i64* %7
%15 = trunc i64 %14 to i32
%16 = sub nsw i32 %15, 2
%17 = load i8*, i8** %5
%18 = call i32 @xasprintf(i8** %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %16, i8* %17)
%19 = load i8*, i8** %6
store i8* %19, i8** %3
br label %20
20: ; preds = %12, %11
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s/%.*s\00"
define i8* @checkoutpath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = call i32 @isrcs(i8* %1, i64* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = add nsw i32 %11, -2
%13 = call i32 @xasprintf(i8** %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %12, i8* %1)
%14 = load i8*, i8** %3
br label %15
15: ; preds = %2, %9
%16 = phi i8* [ %14, %9 ], [ null, %2 ]
ret i8* %16
}