#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*/ EX_OSERR;
int asprintf(char **, char *, char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *gnupghome_dir();
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
char *gnupghome_arg() {
  int ret;
  char *str;
  char *tmp;
  tmp = gnupghome_dir();
  ret = asprintf(&str, "--homedir=%s", tmp);
  if (ret == -1 || !tmp) {
    fprintf(stderr, "%s: %s: %s\n", "prettykey", "asprintf", strerror(errno));
    exit(EX_OSERR);
  }
  free(tmp);
  return str;
}


x86 assembly (clang, -O0):
<gnupghome_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <gnupghome_dir@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1060 <asprintf@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     119f <gnupghome_arg+0x3f>
cmpq   $0x0,-0x18(%rbp)
jne    11e7 <gnupghome_arg+0x87>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%r8
lea    0xe47(%rip),%rsi
lea    0xe4c(%rip),%rdx
lea    0xe4f(%rip),%rcx
call   1040 <fprintf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnupghome_arg>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <gnupghome_dir@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rax,%rdx
call   1060 <asprintf@plt>
test   %rbx,%rbx
je     11a0 <gnupghome_arg+0x40>
cmp    $0xffffffff,%eax
je     11a0 <gnupghome_arg+0x40>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e39(%rip),%rax
mov    (%rax),%ebx
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe4f(%rip),%rsi
lea    0xe54(%rip),%rdx
lea    0xe57(%rip),%rcx
mov    %ebx,%edi
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"--homedir=%s\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.2 = [10 x i8] c"prettykey\00"
@.str.3 = [9 x i8] c"asprintf\00"
@errno = global i32 0
@EX_OSERR = global i32 0
define i8* @gnupghome_arg() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = call i8* (...) @gnupghome_dir()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %19, label %12
12: ; preds = %9, %0
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = call i8* @strerror(i32 %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EX_OSERR
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %9
%20 = load i8*, i8** %3
%21 = call i32 @free(i8* %20)
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@.str = [13 x i8] c"--homedir=%s\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.2 = [10 x i8] c"prettykey\00"
@.str.3 = [9 x i8] c"asprintf\00"
@errno = global i32 0
@EX_OSERR = global i32 0
define i8* @gnupghome_arg() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i8* (...) @gnupghome_dir()
%4 = call i32 @asprintf(i8** %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp ne i32 %4, -1
%6 = icmp ne i8* %3, null
%7 = and i1 %6, %5
br i1 %7, label %15, label %8
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @EX_OSERR
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = call i32 @free(i8* %3)
%17 = load i8*, i8** %1
ret i8* %17
}