#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 */
struct passwd {
  scalar_t__ pw_uid;
};

/* Variables and functions */
int HEXKEYBYTES;
int KEYCHECKSUMSIZE;
int /*<<< orphan*/ MAXNETNAMELEN;
int /*<<< orphan*/ err_string(int);
int /*<<< orphan*/ errx(int, char *, ...);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ genkeys(char *, char *, char *);
scalar_t__ geteuid();
char *getpass(char *);
struct passwd *getpwnam(char *);
int /*<<< orphan*/ host2netname(char *, char *, char *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int setpublicmap(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ user2netname(char *, int, char *);
int /*<<< orphan*/ xdecrypt(char *, char *);
int /*<<< orphan*/ xencrypt(char *, char *);
int main(int argc, char *argv[]) {
  char name[MAXNETNAMELEN + 1];
  char public[HEXKEYBYTES + 1];
  char secret[HEXKEYBYTES + 1];
  char crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
  char crypt2[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
  int status;
  char *pass;
  struct passwd *pw;
  if (argc != 3 ||
      !(strcmp(argv[1], "-u") == 0 || strcmp(argv[1], "-h") == 0)) {
    usage();
  }
  if (geteuid() != 0)
    errx(1, "must be superuser");
  if (strcmp(argv[1], "-u") == 0) {
    pw = getpwnam(argv[2]);
    if (pw == NULL)
      errx(1, "unknown user: %s", argv[2]);
    (void)user2netname(name, (int)pw->pw_uid, (char *)NULL);
  } else {
    (void)host2netname(name, argv[2], (char *)NULL);
  }
  (void)printf("Adding new key for %s.\n", name);
  pass = getpass("New password:");
  genkeys(public, secret, pass);
  memcpy(crypt1, secret, HEXKEYBYTES);
  memcpy(crypt1 + HEXKEYBYTES, secret, KEYCHECKSUMSIZE);
  crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE] = 0;
  xencrypt(crypt1, pass);
  memcpy(crypt2, crypt1, HEXKEYBYTES + KEYCHECKSUMSIZE + 1);
  xdecrypt(crypt2, getpass("Retype password:"));
  if (memcmp(crypt2, crypt2 + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0 ||
      memcmp(crypt2, secret, HEXKEYBYTES) != 0)
    errx(1, "password incorrect");
  if ((status = setpublicmap(name, public, crypt1))) {
    errx(1, "unable to update publickey database (%u): %s", status,
         err_string(status));
  }
  (void)printf("Your new key has been successfully stored away.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    0x2d79(%rip),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x78(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x28(%rbp)
mov    (%rcx),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x70(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
mov    (%rcx),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%edx
mov    %edx,%esi
mov    %edi,%edx
lea    0x1(%rdx,%rsi,1),%edx
mov    %rdx,%rdi
add    $0xf,%rdi
and    $0xfffffffffffffff0,%rdi
mov    %rsp,%rsi
sub    %rdi,%rsi
mov    %rsi,-0x68(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x38(%rbp)
mov    (%rcx),%edx
mov    (%rax),%eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    133e <main+0x12e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcef(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1345 <main+0x135>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcd4(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1345 <main+0x135>
mov    $0x0,%al
call   10f0 <usage@plt>
mov    $0x0,%al
call   1080 <geteuid@plt>
cmp    $0x0,%rax
je     1369 <main+0x159>
mov    $0x1,%edi
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc88(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13d9 <main+0x1c9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <getpwnam@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    13be <main+0x1ae>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    $0x1,%edi
lea    0xc61(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x80(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1100 <user2netname@plt>
jmp    13ee <main+0x1de>
mov    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1120 <host2netname@plt>
mov    -0x80(%rbp),%rsi
lea    0xc30(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc3a(%rip),%rdi
call   1110 <getpass@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdx
call   1040 <genkeys@plt>
mov    -0x70(%rbp),%rsi
mov    -0x68(%rbp),%rdi
mov    0x2ba8(%rip),%rax
mov    (%rax),%edx
call   10d0 <memcpy@plt>
mov    -0x70(%rbp),%rsi
mov    -0x68(%rbp),%rdi
mov    0x2b92(%rip),%rax
movslq (%rax),%rax
add    %rax,%rdi
mov    0x2b95(%rip),%rax
mov    (%rax),%edx
call   10d0 <memcpy@plt>
mov    -0x68(%rbp),%rdi
mov    0x2b73(%rip),%rax
mov    (%rax),%eax
mov    0x2b7a(%rip),%rcx
add    (%rcx),%eax
cltq
movb   $0x0,(%rdi,%rax,1)
mov    -0x50(%rbp),%rsi
call   10e0 <xencrypt@plt>
mov    -0x68(%rbp),%rsi
mov    -0x60(%rbp),%rdi
mov    0x2b4a(%rip),%rax
mov    (%rax),%edx
mov    0x2b51(%rip),%rax
add    (%rax),%edx
add    $0x1,%edx
call   10d0 <memcpy@plt>
lea    0xba7(%rip),%rdi
call   1110 <getpass@plt>
mov    -0x60(%rbp),%rdi
mov    %rax,%rsi
call   1030 <xdecrypt@plt>
mov    -0x60(%rbp),%rdi
mov    0x2b14(%rip),%rax
movslq (%rax),%rax
mov    %rdi,%rsi
add    %rax,%rsi
mov    0x2b14(%rip),%rax
mov    (%rax),%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
jne    1505 <main+0x2f5>
mov    -0x70(%rbp),%rsi
mov    -0x60(%rbp),%rdi
mov    0x2ae4(%rip),%rax
mov    (%rax),%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     1518 <main+0x308>
mov    $0x1,%edi
lea    0xb4f(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x68(%rbp),%rdx
mov    -0x78(%rbp),%rsi
mov    -0x80(%rbp),%rdi
call   10c0 <setpublicmap@plt>
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
je     1561 <main+0x351>
mov    -0x44(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x44(%rbp),%edi
call   1070 <err_string@plt>
mov    -0x84(%rbp),%edx
mov    %eax,%ecx
mov    $0x1,%edi
lea    0xb19(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
lea    0xb38(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1130 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    0x2d7c(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rdx
lea    0xf(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    0x2d62(%rip),%rcx
add    (%rcx),%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
cmp    $0x3,%edi
jne    12d1 <main+0xb1>
mov    0x8(%r14),%rdi
lea    0xd4e(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12d8 <main+0xb8>
mov    0x8(%r14),%rdi
lea    0xd3c(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12d8 <main+0xb8>
xor    %eax,%eax
call   1100 <usage@plt>
xor    %eax,%eax
call   1090 <geteuid@plt>
test   %rax,%rax
je     12f7 <main+0xd7>
lea    0xd1b(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <errx@plt>
mov    0x8(%r14),%rdi
lea    0xcfe(%rip),%rsi
call   10b0 <strcmp@plt>
mov    0x10(%r14),%rsi
test   %rax,%rax
jne    1349 <main+0x129>
mov    %rsi,%rdi
call   10c0 <getpwnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1337 <main+0x117>
mov    0x10(%r14),%rdx
lea    0xced(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <errx@plt>
mov    (%rbx),%esi
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
call   1110 <user2netname@plt>
jmp    1357 <main+0x137>
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
call   1130 <host2netname@plt>
lea    0xccb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcd2(%rip),%rdi
call   1120 <getpass@plt>
mov    %rax,%rbx
mov    -0x38(%rbp),%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   1050 <genkeys@plt>
mov    0x2c4b(%rip),%r14
mov    (%r14),%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   10e0 <memcpy@plt>
movslq (%r14),%rdi
add    %r15,%rdi
mov    %r12,%rsi
mov    0x2c3d(%rip),%r12
mov    (%r12),%edx
mov    %rsi,-0x40(%rbp)
call   10e0 <memcpy@plt>
movslq (%r14),%rax
movslq (%r12),%rcx
add    %rax,%rcx
movb   $0x0,(%r15,%rcx,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   10f0 <xencrypt@plt>
mov    (%r14),%eax
mov    (%r12),%ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   10e0 <memcpy@plt>
lea    0xc5e(%rip),%rdi
call   1120 <getpass@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1030 <xdecrypt@plt>
movslq (%r14),%rsi
add    %r13,%rsi
mov    (%r12),%edx
mov    %r13,%rdi
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    142c <main+0x20c>
mov    (%r14),%edx
mov    %r13,%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <memcmp@plt>
test   %rax,%rax
je     143f <main+0x21f>
lea    0xc2d(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <errx@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %r15,%rdx
call   10d0 <setpublicmap@plt>
test   %eax,%eax
je     1473 <main+0x253>
mov    %eax,%ebx
mov    %eax,%edi
call   1080 <err_string@plt>
lea    0xc10(%rip),%rsi
mov    $0x1,%edi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <errx@plt>
lea    0xc26(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.passwd = type { i64 }
@MAXNETNAMELEN = global i32 0
@HEXKEYBYTES = global i32 0
@KEYCHECKSUMSIZE = global i32 0
@.str = [3 x i8] c"-u\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [18 x i8] c"must be superuser\00"
@.str.3 = [17 x i8] c"unknown user: %s\00"
@.str.4 = [24 x i8] c"Adding new key for %s.\0A\00"
@.str.5 = [14 x i8] c"New password:\00"
@.str.6 = [17 x i8] c"Retype password:\00"
@.str.7 = [19 x i8] c"password incorrect\00"
@.str.8 = [45 x i8] c"unable to update publickey database (%u): %s\00"
@.str.9 = [49 x i8] c"Your new key has been successfully stored away.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8*
%14 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* @MAXNETNAMELEN
%16 = add nsw i32 %15, 1
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %6
%19 = alloca i8, i64 %17
store i64 %17, i64* %7
%20 = load i32, i32* @HEXKEYBYTES
%21 = add nsw i32 %20, 1
%22 = zext i32 %21 to i64
%23 = alloca i8, i64 %22
store i64 %22, i64* %8
%24 = load i32, i32* @HEXKEYBYTES
%25 = add nsw i32 %24, 1
%26 = zext i32 %25 to i64
%27 = alloca i8, i64 %26
store i64 %26, i64* %9
%28 = load i32, i32* @HEXKEYBYTES
%29 = load i32, i32* @KEYCHECKSUMSIZE
%30 = add nsw i32 %28, %29
%31 = add nsw i32 %30, 1
%32 = zext i32 %31 to i64
%33 = alloca i8, i64 %32
store i64 %32, i64* %10
%34 = load i32, i32* @HEXKEYBYTES
%35 = load i32, i32* @KEYCHECKSUMSIZE
%36 = add nsw i32 %34, %35
%37 = add nsw i32 %36, 1
%38 = zext i32 %37 to i64
%39 = alloca i8, i64 %38
store i64 %38, i64* %11
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 3
br i1 %41, label %54, label %42
42: ; preds = %2
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %56, label %48
48: ; preds = %42
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %48, %2
%55 = call i32 (...) @usage()
br label %56
56: ; preds = %54, %48, %42
%57 = call i64 (...) @geteuid()
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %85
67: ; preds = %61
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = call %struct.passwd* @getpwnam(i8* %70)
store %struct.passwd* %71, %struct.passwd** %14
%72 = load %struct.passwd*, %struct.passwd** %14
%73 = icmp eq %struct.passwd* %72, null
br i1 %73, label %74, label %79
74: ; preds = %67
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 2
%77 = load i8*, i8** %76
%78 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %77)
br label %79
79: ; preds = %74, %67
%80 = load %struct.passwd*, %struct.passwd** %14
%81 = getelementptr inbounds %struct.passwd, %struct.passwd* %80, i32 0, i32 0
%82 = load i64, i64* %81
%83 = trunc i64 %82 to i32
%84 = call i32 @user2netname(i8* %19, i32 %83, i8* null)
br label %90
85: ; preds = %61
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 2
%88 = load i8*, i8** %87
%89 = call i32 @host2netname(i8* %19, i8* %88, i8* null)
br label %90
90: ; preds = %85, %79
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%92 = call i8* @getpass(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i8* %92, i8** %13
%93 = load i8*, i8** %13
%94 = call i32 @genkeys(i8* %23, i8* %27, i8* %93)
%95 = load i32, i32* @HEXKEYBYTES
%96 = call i32 @memcpy(i8* %33, i8* %27, i32 %95)
%97 = load i32, i32* @HEXKEYBYTES
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %33, i64 %98
%100 = load i32, i32* @KEYCHECKSUMSIZE
%101 = call i32 @memcpy(i8* %99, i8* %27, i32 %100)
%102 = load i32, i32* @HEXKEYBYTES
%103 = load i32, i32* @KEYCHECKSUMSIZE
%104 = add nsw i32 %102, %103
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %33, i64 %105
store i8 0, i8* %106
%107 = load i8*, i8** %13
%108 = call i32 @xencrypt(i8* %33, i8* %107)
%109 = load i32, i32* @HEXKEYBYTES
%110 = load i32, i32* @KEYCHECKSUMSIZE
%111 = add nsw i32 %109, %110
%112 = add nsw i32 %111, 1
%113 = call i32 @memcpy(i8* %39, i8* %33, i32 %112)
%114 = call i8* @getpass(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%115 = call i32 @xdecrypt(i8* %39, i8* %114)
%116 = load i32, i32* @HEXKEYBYTES
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %39, i64 %117
%119 = load i32, i32* @KEYCHECKSUMSIZE
%120 = call i64 @memcmp(i8* %39, i8* %118, i32 %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %126, label %122
122: ; preds = %90
%123 = load i32, i32* @HEXKEYBYTES
%124 = call i64 @memcmp(i8* %39, i8* %27, i32 %123)
%125 = icmp ne i64 %124, 0
br i1 %125, label %126, label %128
126: ; preds = %122, %90
%127 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %128
128: ; preds = %126, %122
%129 = call i32 @setpublicmap(i8* %19, i8* %23, i8* %33)
store i32 %129, i32* %12
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %128
%132 = load i32, i32* %12
%133 = load i32, i32* %12
%134 = call i32 @err_string(i32 %133)
%135 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i32 %132, i32 %134)
br label %136
136: ; preds = %131, %128
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0))
%138 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i64 }
@MAXNETNAMELEN = global i32 0
@HEXKEYBYTES = global i32 0
@KEYCHECKSUMSIZE = global i32 0
@.str = [3 x i8] c"-u\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [18 x i8] c"must be superuser\00"
@.str.3 = [17 x i8] c"unknown user: %s\00"
@.str.4 = [24 x i8] c"Adding new key for %s.\0A\00"
@.str.5 = [14 x i8] c"New password:\00"
@.str.6 = [17 x i8] c"Retype password:\00"
@.str.7 = [19 x i8] c"password incorrect\00"
@.str.8 = [45 x i8] c"unable to update publickey database (%u): %s\00"
@str = [48 x i8] c"Your new key has been successfully stored away.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @MAXNETNAMELEN
%4 = add nsw i32 %3, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = load i32, i32* @HEXKEYBYTES
%8 = add i32 %7, 1
%9 = zext i32 %8 to i64
%10 = alloca i8, i64 %9
%11 = alloca i8, i64 %9
%12 = load i32, i32* @KEYCHECKSUMSIZE
%13 = add i32 %8, %12
%14 = zext i32 %13 to i64
%15 = alloca i8, i64 %14
%16 = alloca i8, i64 %14
%17 = icmp eq i32 %0, 3
br i1 %17, label %18, label %27
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %18
%24 = load i8*, i8** %19
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23, %2
%28 = tail call i32 (...) @usage()
br label %29
29: ; preds = %27, %23, %18
%30 = tail call i64 (...) @geteuid()
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = getelementptr inbounds i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = tail call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
br i1 %38, label %41, label %52
41: ; preds = %34
%42 = tail call %struct.passwd* @getpwnam(i8* %40)
%43 = icmp eq %struct.passwd* %42, null
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i8*, i8** %39
%46 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %44, %41
%48 = getelementptr inbounds %struct.passwd, %struct.passwd* %42, i64 0, i32 0
%49 = load i64, i64* %48
%50 = trunc i64 %49 to i32
%51 = call i32 @user2netname(i8* %6, i32 %50, i8* null)
br label %54
52: ; preds = %34
%53 = call i32 @host2netname(i8* %6, i8* %40, i8* null)
br label %54
54: ; preds = %52, %47
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%56 = call i8* @getpass(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @genkeys(i8* %10, i8* %11, i8* %56)
%58 = load i32, i32* @HEXKEYBYTES
%59 = call i32 @memcpy(i8* %15, i8* %11, i32 %58)
%60 = load i32, i32* @HEXKEYBYTES
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %15, i64 %61
%63 = load i32, i32* @KEYCHECKSUMSIZE
%64 = call i32 @memcpy(i8* %62, i8* %11, i32 %63)
%65 = load i32, i32* @HEXKEYBYTES
%66 = load i32, i32* @KEYCHECKSUMSIZE
%67 = add nsw i32 %66, %65
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %15, i64 %68
store i8 0, i8* %69
%70 = call i32 @xencrypt(i8* %15, i8* %56)
%71 = load i32, i32* @HEXKEYBYTES
%72 = load i32, i32* @KEYCHECKSUMSIZE
%73 = add i32 %71, 1
%74 = add i32 %73, %72
%75 = call i32 @memcpy(i8* %16, i8* %15, i32 %74)
%76 = call i8* @getpass(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @xdecrypt(i8* %16, i8* %76)
%78 = load i32, i32* @HEXKEYBYTES
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %16, i64 %79
%81 = load i32, i32* @KEYCHECKSUMSIZE
%82 = call i64 @memcmp(i8* %16, i8* %80, i32 %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %54
%85 = load i32, i32* @HEXKEYBYTES
%86 = call i64 @memcmp(i8* %16, i8* %11, i32 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %90, label %88
88: ; preds = %84, %54
%89 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %90
90: ; preds = %88, %84
%91 = call i32 @setpublicmap(i8* %6, i8* %10, i8* %15)
%92 = icmp eq i32 %91, 0
br i1 %92, label %96, label %93
93: ; preds = %90
%94 = call i32 @err_string(i32 %91)
%95 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i32 %91, i32 %94)
br label %96
96: ; preds = %93, %90
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%98 = call i32 @exit(i32 0)
unreachable
}