#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*/ F_OK;
scalar_t__ access(char const *, int /*<<< orphan*/);
char *joinpath(char const *, char *, char const *, int /*<<< orphan*/ *);
char *strdup(char const *);
char *get_key_path(const char *home, const char *fragment) {
  if (fragment[0] == '-' || access(fragment, F_OK) == 0)
    return strdup(fragment);
  return joinpath(home, ".ssh", fragment, NULL);
}


x86 assembly (clang, -O0):
<get_key_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     116c <get_key_path+0x3c>
mov    -0x18(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0x0,%rax
jne    117e <get_key_path+0x4e>
mov    -0x18(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    119a <get_key_path+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe73(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <joinpath@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_key_path>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmpb   $0x2d,(%rsi)
je     1170 <get_key_path+0x40>
mov    %rdi,%r14
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <access@plt>
test   %rax,%rax
je     1170 <get_key_path+0x40>
lea    0xea4(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <joinpath@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strdup@plt>

LLVM IR (-O0):
@F_OK = global i32 0
@.str = [5 x i8] c".ssh\00"
define i8* @get_key_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 45
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i32, i32* @F_OK
%14 = call i64 @access(i8* %12, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11, %2
%17 = load i8*, i8** %5
%18 = call i8* @strdup(i8* %17)
store i8* %18, i8** %3
br label %23
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = call i8* @joinpath(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21, i32* null)
store i8* %22, i8** %3
br label %23
23: ; preds = %19, %16
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
@F_OK = global i32 0
@.str = [5 x i8] c".ssh\00"
define i8* @get_key_path(i8* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 45
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @F_OK
%7 = tail call i64 @access(i8* %1, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5, %2
%10 = tail call i8* @strdup(i8* %1)
br label %13
11: ; preds = %5
%12 = tail call i8* @joinpath(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i32* null)
br label %13
13: ; preds = %11, %9
%14 = phi i8* [ %10, %9 ], [ %12, %11 ]
ret i8* %14
}