#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 */
scalar_t__ git_release_ssh_get_home_directory(char **);
scalar_t__ git_release_ssh_is_folder(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int strlen(char *);
char *xmalloc(int);
int git_release_ssh_get_ssh_folder_from_current_user_home_directory(
    char **out) {
  int out_len = 0;
  char *home_directory = NULL;
  if (git_release_ssh_get_home_directory(&home_directory)) {
    return 6;
  }
  out_len = strlen(home_directory) + strlen("/.ssh") + sizeof(char);
  *out = xmalloc(out_len);
  snprintf(*out, out_len, "%s%s", home_directory, "/.ssh");
  if (git_release_ssh_is_folder(*out)) {
    return 7;
  }
  return 0;
}


x86 assembly (clang, -O0):
<git_release_ssh_get_ssh_folder_from_current_user_home_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <git_release_ssh_get_home_directory@plt>
cmp    $0x0,%rax
je     118a <git_release_ssh_get_ssh_folder_from_current_user_home_directory+0x3a>
movl   $0x6,-0x4(%rbp)
jmp    120e <git_release_ssh_get_ssh_folder_from_current_user_home_directory+0xbe>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
lea    0xe63(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <xmalloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0xe2d(%rip),%rdx
lea    0xe20(%rip),%r8
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <git_release_ssh_is_folder@plt>
cmp    $0x0,%rax
je     1207 <git_release_ssh_get_ssh_folder_from_current_user_home_directory+0xb7>
movl   $0x7,-0x4(%rbp)
jmp    120e <git_release_ssh_get_ssh_folder_from_current_user_home_directory+0xbe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<git_release_ssh_get_ssh_folder_from_current_user_home_directory>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1060 <git_release_ssh_get_home_directory@plt>
mov    %rax,%rcx
mov    $0x6,%eax
test   %rcx,%rcx
jne    11d0 <git_release_ssh_get_ssh_folder_from_current_user_home_directory+0x80>
mov    (%rsp),%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
lea    0xe76(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
lea    (%r14,%rax,1),%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <xmalloc@plt>
mov    %rax,(%rbx)
mov    (%rsp),%rcx
lea    0xe58(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r15,%r8
call   1040 <snprintf@plt>
mov    (%rbx),%rdi
call   1070 <git_release_ssh_is_folder@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0x7,%eax
cmove  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"/.ssh\00"
@.str.1 = [5 x i8] c"%s%s\00"
define i32 @git_release_ssh_get_ssh_folder_from_current_user_home_directory(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
store i8** %0, i8*** %3
store i32 0, i32* %4
store i8* null, i8** %5
%6 = call i64 @git_release_ssh_get_home_directory(i8** %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 6, i32* %2
br label %31
9: ; preds = %1
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = add nsw i32 %11, %12
%14 = sext i32 %13 to i64
%15 = add i64 %14, 1
%16 = trunc i64 %15 to i32
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = call i8* @xmalloc(i32 %17)
%19 = load i8**, i8*** %3
store i8* %18, i8** %19
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = load i32, i32* %4
%23 = load i8*, i8** %5
%24 = call i32 @snprintf(i8* %21, i32 %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%25 = load i8**, i8*** %3
%26 = load i8*, i8** %25
%27 = call i64 @git_release_ssh_is_folder(i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %9
store i32 7, i32* %2
br label %31
30: ; preds = %9
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29, %8
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@.str = [6 x i8] c"/.ssh\00"
@.str.1 = [5 x i8] c"%s%s\00"
define i32 @git_release_ssh_get_ssh_folder_from_current_user_home_directory(i8** nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call i64 @git_release_ssh_get_home_directory(i8** %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = add i32 %8, 1
%11 = add i32 %10, %9
%12 = call i8* @xmalloc(i32 %11)
store i8* %12, i8** %0
%13 = load i8*, i8** %2
%14 = call i32 @snprintf(i8* %12, i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %0
%16 = call i64 @git_release_ssh_is_folder(i8* %15)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i32 0, i32 7
br label %19
19: ; preds = %6, %1
%20 = phi i32 [ 6, %1 ], [ %18, %6 ]
ret i32 %20
}