#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 */
typedef int pid_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ ENOENT;
int /*<<< orphan*/ EX_OK;
int /*<<< orphan*/ EX_OSERR;
int /*<<< orphan*/ EX_UNAVAILABLE;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ _Exit(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int dup2(int, int /*<<< orphan*/);
scalar_t__ errno;
int execvp(char *, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free(char *);
char *gnupghome_arg();
int pipe(int *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
void call_gnupg_gen(void) {
  char *home_arg;
  int p[2];
  if (pipe(p) == -1) {
    fprintf(stderr, "%s: %s: %s\n", "prettykey", "pipe", strerror(errno));
    exit(EX_OSERR);
  }
  pid_t pid = fork();
  if (pid == -1) {
    fprintf(stderr, "%s: %s: %s\n", "prettykey", "fork", strerror(errno));
    exit(EX_OSERR);
  } else if (pid == 0) {
    close(p[0]);
    while ((dup2(p[1], STDOUT_FILENO) == -1)) {
      if (errno != EINTR) {
        fprintf(stderr, "%s: %s: %s\n", "prettykey", "dup2", strerror(errno));
        exit(EX_OSERR);
      }
    }
    close(p[1]);
    char *gnupg_args[] = {"gpg2",
                          home_arg = gnupghome_arg(),
                          "--full-gen-key",
                          "--expert",
                          "--command-file=commands.txt",
                          "--passphrase-file=passphrase.txt",
                          "--pinentry-mode=loopback",
                          NULL};
    if (execvp(gnupg_args[0], gnupg_args) == -1) {
      if (errno == ENOENT) {
        fprintf(stderr, "%s: %s was not found in your PATH.\n", "prettykey",
                "gpg2");
        exit(EX_UNAVAILABLE);
      } else {
        fprintf(stderr, "%s: %s: %s\n", "prettykey", "gpg2", strerror(errno));
        exit(EX_OSERR);
      }
    }
    free(home_arg);
    home_arg = NULL;
    _Exit(EX_OK);
  } else {
    int ret;
    close(p[1]);
    waitpid(pid, &ret, 0);
    if (ret == 0) {
      puts("Key generation succeeded.");
    } else {
      fprintf(stderr, "Key generation failed: %s returned an error.\n", "gpg2");
      _Exit(EX_OSERR);
    }
    _Exit(EX_OK);
  }
}


x86 assembly (clang, -O0):
<call_gnupg_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x10(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1238 <call_gnupg_gen+0x68>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2dd0(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x68(%rbp),%edi
mov    %rax,%r8
lea    0xdeb(%rip),%rsi
lea    0xdf0(%rip),%rdx
lea    0xdf3(%rip),%rcx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1297 <call_gnupg_gen+0xc7>
mov    0x2d85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2d71(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    %rax,%r8
lea    0xd8c(%rip),%rsi
lea    0xd91(%rip),%rdx
lea    0xd99(%rip),%rcx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
jne    145b <call_gnupg_gen+0x28b>
mov    -0x10(%rbp),%edi
call   1070 <close@plt>
mov    -0xc(%rbp),%edi
mov    0x2d3d(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    132d <call_gnupg_gen+0x15d>
mov    0x2d06(%rip),%rax
mov    (%rax),%rax
mov    0x2cf4(%rip),%rcx
cmp    (%rcx),%rax
je     1328 <call_gnupg_gen+0x158>
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2ce0(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x70(%rbp),%edi
mov    %rax,%r8
lea    0xcfb(%rip),%rsi
lea    0xd00(%rip),%rdx
lea    0xd0d(%rip),%rcx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
jmp    12a9 <call_gnupg_gen+0xd9>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
lea    0xce9(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1060 <gnupghome_arg@plt>
mov    %rax,-0x8(%rbp)
mov    %rax,-0x58(%rbp)
lea    0xcd4(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xcd8(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xcd6(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xce7(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xcfd(%rip),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   10b0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    143c <call_gnupg_gen+0x26c>
mov    0x2c25(%rip),%rax
mov    (%rax),%rax
mov    0x2beb(%rip),%rcx
cmp    (%rcx),%rax
jne    13f1 <call_gnupg_gen+0x221>
mov    0x2c13(%rip),%rax
mov    (%rax),%edi
lea    0xcca(%rip),%rsi
lea    0xc37(%rip),%rdx
lea    0xc49(%rip),%rcx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x2be0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2bcc(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    %rax,%r8
lea    0xbe7(%rip),%rsi
lea    0xbec(%rip),%rdx
lea    0xbfe(%rip),%rcx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b83(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
call   10d0 <_Exit@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    -0x14(%rbp),%edi
lea    -0x64(%rbp),%rsi
xor    %edx,%edx
call   10a0 <waitpid@plt>
cmpl   $0x0,-0x64(%rbp)
jne    148c <call_gnupg_gen+0x2bc>
lea    0xc3a(%rip),%rdi
call   1040 <puts@plt>
jmp    14b8 <call_gnupg_gen+0x2e8>
mov    0x2b45(%rip),%rax
mov    (%rax),%edi
lea    0xc3a(%rip),%rsi
lea    0xb82(%rip),%rdx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b07(%rip),%rax
mov    (%rax),%edi
call   10d0 <_Exit@plt>
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
call   10d0 <_Exit@plt>

x86 assembly (clang, -O2):
<call_gnupg_gen>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x8(%rsp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    121c <call_gnupg_gen+0x4c>
mov    0x2de7(%rip),%rax
mov    (%rax),%ebx
mov    0x2dd6(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xdf7(%rip),%rsi
lea    0xdfc(%rip),%rdx
lea    0xdff(%rip),%rcx
jmp    12bd <call_gnupg_gen+0xed>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     1261 <call_gnupg_gen+0x91>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    12d7 <call_gnupg_gen+0x107>
mov    0x2d9f(%rip),%rax
mov    (%rax),%ebx
mov    0x2d8e(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xdaf(%rip),%rsi
lea    0xdb4(%rip),%rdx
lea    0xdbc(%rip),%rcx
jmp    12bd <call_gnupg_gen+0xed>
mov    0x8(%rsp),%edi
call   1070 <close@plt>
mov    0x2d7f(%rip),%r14
mov    0x2d58(%rip),%r12
mov    0x2d49(%rip),%rbx
nop
mov    0xc(%rsp),%edi
mov    (%r14),%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    130a <call_gnupg_gen+0x13a>
mov    (%r12),%rdi
cmp    (%rbx),%rdi
je     1280 <call_gnupg_gen+0xb0>
mov    0x2d37(%rip),%rax
mov    (%rax),%ebx
call   10e0 <strerror@plt>
lea    0xd51(%rip),%rsi
lea    0xd56(%rip),%rdx
lea    0xd63(%rip),%rcx
mov    %ebx,%edi
mov    %rax,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   10a0 <waitpid@plt>
cmpl   $0x0,0x10(%rsp)
jne    13ca <call_gnupg_gen+0x1fa>
lea    0xdbc(%rip),%rdi
call   1040 <puts@plt>
jmp    13fe <call_gnupg_gen+0x22e>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
lea    0xd0b(%rip),%r14
mov    %r14,0x10(%rsp)
xor    %eax,%eax
call   1060 <gnupghome_arg@plt>
mov    %rax,%r15
mov    %rax,0x18(%rsp)
lea    0xcf5(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xcf8(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xcf5(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xd05(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xd1a(%rip),%rax
mov    %rax,0x40(%rsp)
movq   $0x0,0x48(%rsp)
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   10b0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    13f6 <call_gnupg_gen+0x226>
mov    (%r12),%rdi
mov    0x2c10(%rip),%rax
mov    0x2c41(%rip),%rcx
mov    (%rcx),%ebx
cmp    (%rax),%rdi
jne    140c <call_gnupg_gen+0x23c>
lea    0xcf3(%rip),%rsi
lea    0xc60(%rip),%rdx
lea    0xc72(%rip),%rcx
mov    %ebx,%edi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
lea    0xcfc(%rip),%rsi
lea    0xc44(%rip),%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
call   10d0 <_Exit@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x2bbb(%rip),%rax
mov    (%rax),%edi
call   10d0 <_Exit@plt>
call   10e0 <strerror@plt>
lea    0xbe8(%rip),%rsi
lea    0xbed(%rip),%rdx
lea    0xbff(%rip),%rcx
jmp    12bd <call_gnupg_gen+0xed>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s: %s: %s\0A\00"
@.str.1 = [10 x i8] c"prettykey\00"
@.str.2 = [5 x i8] c"pipe\00"
@errno = global i64 0
@EX_OSERR = global i32 0
@.str.3 = [5 x i8] c"fork\00"
@STDOUT_FILENO = global i32 0
@EINTR = global i64 0
@.str.4 = [5 x i8] c"dup2\00"
@.str.5 = [5 x i8] c"gpg2\00"
@.str.6 = [15 x i8] c"--full-gen-key\00"
@.str.7 = [9 x i8] c"--expert\00"
@.str.8 = [28 x i8] c"--command-file=commands.txt\00"
@.str.9 = [33 x i8] c"--passphrase-file=passphrase.txt\00"
@.str.10 = [25 x i8] c"--pinentry-mode=loopback\00"
@ENOENT = global i64 0
@.str.11 = [36 x i8] c"%s: %s was not found in your PATH.\0A\00"
@EX_UNAVAILABLE = global i32 0
@EX_OK = global i32 0
@.str.12 = [26 x i8] c"Key generation succeeded.\00"
@.str.13 = [46 x i8] c"Key generation failed: %s returned an error.\0A\00"
define void @call_gnupg_gen() {
%1 = alloca i8*
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca [8 x i8*]
%5 = alloca i32
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = call i32 @pipe(i32* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = load i64, i64* @errno
%12 = call i8* @strerror(i64 %11)
%13 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @EX_OSERR
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %0
%17 = call i32 (...) @fork()
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = load i64, i64* @errno
%23 = call i8* @strerror(i64 %22)
%24 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EX_OSERR
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %16
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %91
30: ; preds = %27
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %31
%33 = call i32 @close(i32 %32)
br label %34
34: ; preds = %51, %30
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%36 = load i32, i32* %35
%37 = load i32, i32* @STDOUT_FILENO
%38 = call i32 @dup2(i32 %36, i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %52
40: ; preds = %34
%41 = load i64, i64* @errno
%42 = load i64, i64* @EINTR
%43 = icmp ne i64 %41, %42
br i1 %43, label %44, label %51
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = load i64, i64* @errno
%47 = call i8* @strerror(i64 %46)
%48 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %47)
%49 = load i32, i32* @EX_OSERR
%50 = call i32 @exit(i32 %49)
unreachable
51: ; preds = %40
br label %34
52: ; preds = %34
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%54 = load i32, i32* %53
%55 = call i32 @close(i32 %54)
%56 = getelementptr inbounds [8 x i8*], [8 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %56
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = call i8* (...) @gnupghome_arg()
store i8* %58, i8** %1
store i8* %58, i8** %57
%59 = getelementptr inbounds i8*, i8** %57, i64 1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8** %59
%60 = getelementptr inbounds i8*, i8** %59, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %60
%61 = getelementptr inbounds i8*, i8** %60, i64 1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8** %61
%62 = getelementptr inbounds i8*, i8** %61, i64 1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8** %62
%63 = getelementptr inbounds i8*, i8** %62, i64 1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8** %63
%64 = getelementptr inbounds i8*, i8** %63, i64 1
store i8* null, i8** %64
%65 = getelementptr inbounds [8 x i8*], [8 x i8*]* %4, i64 0, i64 0
%66 = load i8*, i8** %65
%67 = getelementptr inbounds [8 x i8*], [8 x i8*]* %4, i64 0, i64 0
%68 = call i32 @execvp(i8* %66, i8** %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %86
70: ; preds = %52
%71 = load i64, i64* @errno
%72 = load i64, i64* @ENOENT
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %79
74: ; preds = %70
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%77 = load i32, i32* @EX_UNAVAILABLE
%78 = call i32 @exit(i32 %77)
unreachable
79: ; preds = %70
%80 = load i32, i32* @stderr
%81 = load i64, i64* @errno
%82 = call i8* @strerror(i64 %81)
%83 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %82)
%84 = load i32, i32* @EX_OSERR
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %52
%87 = load i8*, i8** %1
%88 = call i32 @free(i8* %87)
store i8* null, i8** %1
%89 = load i32, i32* @EX_OK
%90 = call i32 @_Exit(i32 %89)
unreachable
91: ; preds = %27
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%93 = load i32, i32* %92
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %3
%96 = call i32 @waitpid(i32 %95, i32* %5, i32 0)
%97 = load i32, i32* %5
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %91
%100 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %106
101: ; preds = %91
%102 = load i32, i32* @stderr
%103 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%104 = load i32, i32* @EX_OSERR
%105 = call i32 @_Exit(i32 %104)
unreachable
106: ; preds = %99
%107 = load i32, i32* @EX_OK
%108 = call i32 @_Exit(i32 %107)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s: %s: %s\0A\00"
@.str.1 = [10 x i8] c"prettykey\00"
@.str.2 = [5 x i8] c"pipe\00"
@errno = global i64 0
@EX_OSERR = global i32 0
@.str.3 = [5 x i8] c"fork\00"
@STDOUT_FILENO = global i32 0
@EINTR = global i64 0
@.str.4 = [5 x i8] c"dup2\00"
@.str.5 = [5 x i8] c"gpg2\00"
@.str.6 = [15 x i8] c"--full-gen-key\00"
@.str.7 = [9 x i8] c"--expert\00"
@.str.8 = [28 x i8] c"--command-file=commands.txt\00"
@.str.9 = [33 x i8] c"--passphrase-file=passphrase.txt\00"
@.str.10 = [25 x i8] c"--pinentry-mode=loopback\00"
@ENOENT = global i64 0
@.str.11 = [36 x i8] c"%s: %s was not found in your PATH.\0A\00"
@EX_UNAVAILABLE = global i32 0
@EX_OK = global i32 0
@.str.12 = [26 x i8] c"Key generation succeeded.\00"
@.str.13 = [46 x i8] c"Key generation failed: %s returned an error.\0A\00"
define void @call_gnupg_gen() {
%1 = alloca [2 x i32]
%2 = alloca [8 x i8*]
%3 = alloca i32
%4 = bitcast [2 x i32]* %1 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = call i32 @pipe(i32* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i64, i64* @errno
%11 = call i8* @strerror(i64 %10)
%12 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, 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 (...) @fork()
switch i32 %16, label %76 [
i32 -1, label %17
i32 0, label %24
]
17: ; preds = %15
%18 = load i32, i32* @stderr
%19 = load i64, i64* @errno
%20 = call i8* @strerror(i64 %19)
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EX_OSERR
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %15
%25 = load i32, i32* %5
%26 = call i32 @close(i32 %25)
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
br label %28
28: ; preds = %33, %24
%29 = load i32, i32* %27
%30 = load i32, i32* @STDOUT_FILENO
%31 = call i32 @dup2(i32 %29, i32 %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %43
33: ; preds = %28
%34 = load i64, i64* @errno
%35 = load i64, i64* @EINTR
%36 = icmp eq i64 %34, %35
br i1 %36, label %28, label %37
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = call i8* @strerror(i64 %34)
%40 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @EX_OSERR
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %28
%44 = load i32, i32* %27
%45 = call i32 @close(i32 %44)
%46 = bitcast [8 x i8*]* %2 to i8*
%47 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %47
%48 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 1
%49 = call i8* (...) @gnupghome_arg()
store i8* %49, i8** %48
%50 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8** %50
%51 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %51
%52 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8** %52
%53 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 5
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8** %53
%54 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 6
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8** %54
%55 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 7
store i8* null, i8** %55
%56 = call i32 @execvp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %47)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %72
58: ; preds = %43
%59 = load i64, i64* @errno
%60 = load i64, i64* @ENOENT
%61 = icmp eq i64 %59, %60
%62 = load i32, i32* @stderr
br i1 %61, label %63, label %67
63: ; preds = %58
%64 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* @EX_UNAVAILABLE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %58
%68 = call i8* @strerror(i64 %59)
%69 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %68)
%70 = load i32, i32* @EX_OSERR
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %43
%73 = call i32 @free(i8* %49)
%74 = load i32, i32* @EX_OK
%75 = call i32 @_Exit(i32 %74)
unreachable
76: ; preds = %15
%77 = bitcast i32* %3 to i8*
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%79 = load i32, i32* %78
%80 = call i32 @close(i32 %79)
%81 = call i32 @waitpid(i32 %16, i32* %3, i32 0)
%82 = load i32, i32* %3
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %76
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%86 = load i32, i32* @EX_OK
%87 = call i32 @_Exit(i32 %86)
unreachable
88: ; preds = %76
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%91 = load i32, i32* @EX_OSERR
%92 = call i32 @_Exit(i32 %91)
unreachable
}