#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 ecryptfs_unwrap_passphrase(char *, char *, char *, char *);
int ecryptfs_wrap_passphrase(char *, char *, char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ from_hex(char *, char *, int);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  char passphrase[64 + 8];
  int passphrase_size;
  char decrypted_passphrase[64 + 1];
  int decrypted_passphrase_size;
  char salt[8 + 1];
  char *path;
  int i, j;
  int rc = 0;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s path\n", argv[0]);
    exit(1);
  }
  path = argv[1];
  from_hex(salt, "0011223344556677", 8);
  memcpy(passphrase, "012345679abcdef0\0", 17);
  passphrase_size = strlen(passphrase);
  if ((rc = ecryptfs_wrap_passphrase(path, "testwrappw", salt, passphrase))) {
    fprintf(stderr,
            "ecryptfs_wrap_passphrase() returned "
            "rc = [%d]\n",
            rc);
    rc = 1;
    goto out;
  }
  if ((rc = ecryptfs_unwrap_passphrase(decrypted_passphrase, path, "testwrappw",
                                       salt))) {
    fprintf(stderr,
            "ecryptfs_unwrap_passphrase() returned "
            "rc = [%d]\n",
            rc);
    rc = 1;
    goto out;
  }
  decrypted_passphrase_size = strlen(decrypted_passphrase);
  if (decrypted_passphrase_size != passphrase_size) {
    fprintf(stderr, "Invalid decrypted size [%d]; expected [%d]\n",
            decrypted_passphrase_size, passphrase_size);
    rc = 1;
    goto out;
  }
  if (memcmp(decrypted_passphrase, passphrase, passphrase_size) != 0) {
    fprintf(stderr, "decrypted passphrase = [%s]; expected [%s]\n",
            decrypted_passphrase, passphrase);
    rc = 1;
    goto out;
  }
  from_hex(salt, "0011223344556677", 8);
  for (i = 0; i < 64; i++) {
    passphrase[i] = 'a' + i;
    passphrase[i + 1] = '\0';
    if ((rc = ecryptfs_wrap_passphrase(path, "testwrappw", salt, passphrase))) {
      fprintf(stderr,
              "ecryptfs_wrap_passphrase() returned "
              "rc = [%d]\n",
              rc);
      rc = 1;
      goto out;
    }
    if ((rc = ecryptfs_unwrap_passphrase(decrypted_passphrase, path,
                                         "testwrappw", salt))) {
      fprintf(stderr,
              "ecryptfs_unwrap_passphrase() returned "
              "rc = [%d]\n",
              rc);
      rc = 1;
      goto out;
    }
    decrypted_passphrase_size = strlen(decrypted_passphrase);
    if (decrypted_passphrase_size != (i + 1)) {
      fprintf(stderr,
              "Invalid decrypted size [%d]; expected "
              "[%d]\n",
              decrypted_passphrase_size, (i + 1));
      rc = 1;
      goto out;
    }
    if (memcmp(decrypted_passphrase, passphrase, (i + 1)) != 0) {
      fprintf(stderr,
              "decrypted passphrase = [%s]; expected "
              "[%s]\n",
              decrypted_passphrase, passphrase);
      rc = 1;
      goto out;
    }
  }
  from_hex(salt, "0011223344556677", 8);
  for (i = 0; i < 65; i++)
    passphrase[i] = 'a' + i;
  passphrase[66] = '\0';
  passphrase_size = strlen(passphrase);
  if ((rc = ecryptfs_wrap_passphrase(path, "testwrappw", salt, passphrase)) ==
      0) {
    fprintf(stderr,
            "ecryptfs_wrap_passphrase() returned rc = 0; "
            "expected error result instead\n",
            rc);
    rc = 1;
    goto out;
  }
  rc = 0;
out:
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xd4(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11d5 <main+0x55>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xc8(%rbp)
lea    -0xbd(%rbp),%rdi
lea    0xe1e(%rip),%rsi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
lea    -0x60(%rbp),%rdi
lea    0xf28(%rip),%rsi
mov    $0x11,%edx
call   1070 <memcpy@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0xc8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xdeb(%rip),%rsi
call   1080 <ecryptfs_wrap_passphrase@plt>
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
je     1276 <main+0xf6>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%edx
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
lea    -0xbd(%rbp),%rcx
lea    0xd8f(%rip),%rdx
call   1030 <ecryptfs_unwrap_passphrase@plt>
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
je     12d2 <main+0x152>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%edx
lea    0xd9f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x64(%rbp),%eax
je     1322 <main+0x1a2>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    -0xb4(%rbp),%edx
mov    -0x64(%rbp),%ecx
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x64(%rbp),%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1370 <main+0x1f0>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
lea    -0xb0(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xd5e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xbd(%rbp),%rdi
lea    0xc92(%rip),%rsi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
movl   $0x0,-0xcc(%rbp)
cmpl   $0x40,-0xcc(%rbp)
jge    1545 <main+0x3c5>
mov    -0xcc(%rbp),%eax
add    $0x61,%eax
mov    %al,%cl
movslq -0xcc(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
mov    -0xc8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xc43(%rip),%rsi
call   1080 <ecryptfs_wrap_passphrase@plt>
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
je     141e <main+0x29e>
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%edx
lea    0xc24(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
lea    -0xbd(%rbp),%rcx
lea    0xbe7(%rip),%rdx
call   1030 <ecryptfs_unwrap_passphrase@plt>
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
je     147a <main+0x2fa>
mov    0x2b8b(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%edx
lea    0xbf7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    -0xcc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     14d8 <main+0x358>
mov    0x2b36(%rip),%rax
mov    (%rax),%edi
mov    -0xb4(%rbp),%edx
mov    -0xcc(%rbp),%ecx
add    $0x1,%ecx
lea    0xbca(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0xcc(%rbp),%edx
add    $0x1,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     152c <main+0x3ac>
mov    0x2ade(%rip),%rax
mov    (%rax),%edi
lea    -0xb0(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xba2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
jmp    1531 <main+0x3b1>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1392 <main+0x212>
lea    -0xbd(%rbp),%rdi
lea    0xabd(%rip),%rsi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
movl   $0x0,-0xcc(%rbp)
cmpl   $0x41,-0xcc(%rbp)
jge    159e <main+0x41e>
mov    -0xcc(%rbp),%eax
add    $0x61,%eax
mov    %al,%cl
movslq -0xcc(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1567 <main+0x3e7>
movb   $0x0,-0x1e(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0xc8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xa5a(%rip),%rsi
call   1080 <ecryptfs_wrap_passphrase@plt>
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
jne    1607 <main+0x487>
mov    0x29fe(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%edx
lea    0xaf3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0xd4(%rbp)
jmp    1611 <main+0x491>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
cmp    $0x2,%edi
jne    1412 <main+0x292>
mov    0x8(%rsi),%r14
lea    0xeab(%rip),%rsi
lea    0x7(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
lea    0xfb1(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x11,%edx
call   1070 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0xe7f(%rip),%rsi
mov    %r14,%rdi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1080 <ecryptfs_wrap_passphrase@plt>
test   %eax,%eax
je     1206 <main+0x86>
mov    0x2de5(%rip),%rcx
mov    (%rcx),%edi
lea    0xe68(%rip),%rsi
jmp    1233 <main+0xb3>
lea    0xe54(%rip),%rdx
lea    0x60(%rsp),%rdi
lea    0x7(%rsp),%rcx
mov    %r14,%rsi
call   1030 <ecryptfs_unwrap_passphrase@plt>
test   %eax,%eax
je     1253 <main+0xd3>
mov    0x2db6(%rip),%rcx
mov    (%rcx),%edi
lea    0xe68(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x60(%rsp),%rdi
call   1040 <strlen@plt>
cmp    %r15d,%eax
jne    129c <main+0x11c>
lea    0x60(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15d,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     12ba <main+0x13a>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
lea    0x60(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    123c <main+0xbc>
mov    0x2d3d(%rip),%rcx
mov    (%rcx),%edi
lea    0xe20(%rip),%rsi
mov    %eax,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    123c <main+0xbc>
lea    0xd8f(%rip),%rsi
lea    0x7(%rsp),%rdi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
mov    $0x61,%r15b
mov    $0x1,%ebx
lea    0xd82(%rip),%r12
lea    0x60(%rsp),%rbp
cmp    $0x41,%rbx
je     1361 <main+0x1e1>
mov    %r15b,0xf(%rsp,%rbx,1)
movb   $0x0,0x10(%rsp,%rbx,1)
mov    %r14,%rdi
mov    %r12,%rsi
lea    0x7(%rsp),%r13
mov    %r13,%rdx
lea    0x10(%rsp),%rcx
call   1080 <ecryptfs_wrap_passphrase@plt>
test   %eax,%eax
jne    11f4 <main+0x74>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1030 <ecryptfs_unwrap_passphrase@plt>
test   %eax,%eax
jne    1223 <main+0xa3>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
cmp    %rcx,%rbx
jne    13f9 <main+0x279>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
mov    %ebx,%edx
call   1050 <memcmp@plt>
add    $0x1,%r15b
add    $0x1,%rbx
test   %rax,%rax
je     12e4 <main+0x164>
jmp    1279 <main+0xf9>
lea    0xce8(%rip),%rsi
lea    0x7(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%edx
call   10a0 <from_hex@plt>
movaps 0xc7f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xc83(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xc87(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xc8b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movb   $0xa1,0x50(%rsp)
movb   $0x0,0x52(%rsp)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    0xc99(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1080 <ecryptfs_wrap_passphrase@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1241 <main+0xc1>
mov    0x2bf7(%rip),%rax
mov    (%rax),%edi
lea    0xd32(%rip),%rsi
xor    %edx,%edx
jmp    1235 <main+0xb5>
mov    0x2be0(%rip),%rcx
mov    (%rcx),%edi
lea    0xcc3(%rip),%rsi
mov    %eax,%edx
mov    %ebx,%ecx
jmp    12b1 <main+0x131>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xc1b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s path\0A\00"
@.str.1 = [17 x i8] c"0011223344556677\00"
@.str.2 = [18 x i8] c"012345679abcdef0\00\00"
@.str.3 = [11 x i8] c"testwrappw\00"
@.str.4 = [47 x i8] c"ecryptfs_wrap_passphrase() returned rc = [%d]\0A\00"
@.str.5 = [49 x i8] c"ecryptfs_unwrap_passphrase() returned rc = [%d]\0A\00"
@.str.6 = [44 x i8] c"Invalid decrypted size [%d]; expected [%d]\0A\00"
@.str.7 = [44 x i8] c"decrypted passphrase = [%s]; expected [%s]\0A\00"
@.str.8 = [75 x i8] c"ecryptfs_wrap_passphrase() returned rc = 0; expected error result instead\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [72 x i8]
%7 = alloca i32
%8 = alloca [65 x i8]
%9 = alloca i32
%10 = alloca [9 x i8]
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %14
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
store i8* %27, i8** %11
%28 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%29 = call i32 @from_hex(i8* %28, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
%30 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%31 = call i32 @memcpy(i8* %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 17)
%32 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
store i32 %33, i32* %7
%34 = load i8*, i8** %11
%35 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%36 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%37 = call i32 @ecryptfs_wrap_passphrase(i8* %34, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %35, i8* %36)
store i32 %37, i32* %14
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %24
%40 = load i32, i32* @stderr
%41 = load i32, i32* %14
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %41)
store i32 1, i32* %14
br label %170
43: ; preds = %24
%44 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%45 = load i8*, i8** %11
%46 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%47 = call i32 @ecryptfs_unwrap_passphrase(i8* %44, i8* %45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %46)
store i32 %47, i32* %14
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %43
%50 = load i32, i32* @stderr
%51 = load i32, i32* %14
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %51)
store i32 1, i32* %14
br label %170
53: ; preds = %43
%54 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%55 = call i32 @strlen(i8* %54)
store i32 %55, i32* %9
%56 = load i32, i32* %9
%57 = load i32, i32* %7
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %64
59: ; preds = %53
%60 = load i32, i32* @stderr
%61 = load i32, i32* %9
%62 = load i32, i32* %7
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %61, i32 %62)
store i32 1, i32* %14
br label %170
64: ; preds = %53
%65 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%66 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%67 = load i32, i32* %7
%68 = call i64 @memcmp(i8* %65, i8* %66, i32 %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %64
%71 = load i32, i32* @stderr
%72 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%73 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %72, i8* %73)
store i32 1, i32* %14
br label %170
75: ; preds = %64
%76 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%77 = call i32 @from_hex(i8* %76, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
store i32 0, i32* %12
br label %78
78: ; preds = %137, %75
%79 = load i32, i32* %12
%80 = icmp slt i32 %79, 64
br i1 %80, label %81, label %140
81: ; preds = %78
%82 = load i32, i32* %12
%83 = add nsw i32 97, %82
%84 = trunc i32 %83 to i8
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 %86
store i8 %84, i8* %87
%88 = load i32, i32* %12
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 %90
store i8 0, i8* %91
%92 = load i8*, i8** %11
%93 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%94 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%95 = call i32 @ecryptfs_wrap_passphrase(i8* %92, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %93, i8* %94)
store i32 %95, i32* %14
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %81
%98 = load i32, i32* @stderr
%99 = load i32, i32* %14
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %99)
store i32 1, i32* %14
br label %170
101: ; preds = %81
%102 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%103 = load i8*, i8** %11
%104 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%105 = call i32 @ecryptfs_unwrap_passphrase(i8* %102, i8* %103, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %104)
store i32 %105, i32* %14
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %101
%108 = load i32, i32* @stderr
%109 = load i32, i32* %14
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %109)
store i32 1, i32* %14
br label %170
111: ; preds = %101
%112 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%113 = call i32 @strlen(i8* %112)
store i32 %113, i32* %9
%114 = load i32, i32* %9
%115 = load i32, i32* %12
%116 = add nsw i32 %115, 1
%117 = icmp ne i32 %114, %116
br i1 %117, label %118, label %124
118: ; preds = %111
%119 = load i32, i32* @stderr
%120 = load i32, i32* %9
%121 = load i32, i32* %12
%122 = add nsw i32 %121, 1
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %120, i32 %122)
store i32 1, i32* %14
br label %170
124: ; preds = %111
%125 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%126 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%127 = load i32, i32* %12
%128 = add nsw i32 %127, 1
%129 = call i64 @memcmp(i8* %125, i8* %126, i32 %128)
%130 = icmp ne i64 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %124
%132 = load i32, i32* @stderr
%133 = getelementptr inbounds [65 x i8], [65 x i8]* %8, i64 0, i64 0
%134 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %132, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %133, i8* %134)
store i32 1, i32* %14
br label %170
136: ; preds = %124
br label %137
137: ; preds = %136
%138 = load i32, i32* %12
%139 = add nsw i32 %138, 1
store i32 %139, i32* %12
br label %78
140: ; preds = %78
%141 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%142 = call i32 @from_hex(i8* %141, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
store i32 0, i32* %12
br label %143
143: ; preds = %153, %140
%144 = load i32, i32* %12
%145 = icmp slt i32 %144, 65
br i1 %145, label %146, label %156
146: ; preds = %143
%147 = load i32, i32* %12
%148 = add nsw i32 97, %147
%149 = trunc i32 %148 to i8
%150 = load i32, i32* %12
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 %151
store i8 %149, i8* %152
br label %153
153: ; preds = %146
%154 = load i32, i32* %12
%155 = add nsw i32 %154, 1
store i32 %155, i32* %12
br label %143
156: ; preds = %143
%157 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 66
store i8 0, i8* %157
%158 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%159 = call i32 @strlen(i8* %158)
store i32 %159, i32* %7
%160 = load i8*, i8** %11
%161 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%162 = getelementptr inbounds [72 x i8], [72 x i8]* %6, i64 0, i64 0
%163 = call i32 @ecryptfs_wrap_passphrase(i8* %160, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %161, i8* %162)
store i32 %163, i32* %14
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %156
%166 = load i32, i32* @stderr
%167 = load i32, i32* %14
%168 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0), i32 %167)
store i32 1, i32* %14
br label %170
169: ; preds = %156
store i32 0, i32* %14
br label %170
170: ; preds = %169, %165, %131, %118, %107, %97, %70, %59, %49, %39
%171 = load i32, i32* %14
ret i32 %171
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s path\0A\00"
@.str.1 = [17 x i8] c"0011223344556677\00"
@.str.2 = [18 x i8] c"012345679abcdef0\00\00"
@.str.3 = [11 x i8] c"testwrappw\00"
@.str.4 = [47 x i8] c"ecryptfs_wrap_passphrase() returned rc = [%d]\0A\00"
@.str.5 = [49 x i8] c"ecryptfs_unwrap_passphrase() returned rc = [%d]\0A\00"
@.str.6 = [44 x i8] c"Invalid decrypted size [%d]; expected [%d]\0A\00"
@.str.7 = [44 x i8] c"decrypted passphrase = [%s]; expected [%s]\0A\00"
@.str.8 = [75 x i8] c"ecryptfs_wrap_passphrase() returned rc = 0; expected error result instead\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [72 x i8]
%4 = alloca [65 x i8]
%5 = alloca [9 x i8]
%6 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @from_hex(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
%19 = call i32 @memcpy(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 17)
%20 = call i32 @strlen(i8* %6)
%21 = call i32 @ecryptfs_wrap_passphrase(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %6)
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %98
26: ; preds = %15
%27 = call i32 @ecryptfs_unwrap_passphrase(i8* %7, i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%28 = icmp eq i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %27)
br label %98
32: ; preds = %26
%33 = call i32 @strlen(i8* %7)
%34 = icmp eq i32 %33, %20
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %33, i32 %20)
br label %98
38: ; preds = %32
%39 = call i64 @memcmp(i8* %7, i8* %6, i32 %20)
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %7, i8* %6)
br label %98
44: ; preds = %38
%45 = call i32 @from_hex(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
br label %46
46: ; preds = %75, %44
%47 = phi i64 [ %53, %75 ], [ 0, %44 ]
%48 = icmp eq i64 %47, 64
br i1 %48, label %81, label %49
49: ; preds = %46
%50 = trunc i64 %47 to i8
%51 = add nuw i8 %50, 97
%52 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 %47
store i8 %51, i8* %52
%53 = add nuw nsw i64 %47, 1
%54 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 %53
store i8 0, i8* %54
%55 = call i32 @ecryptfs_wrap_passphrase(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %6)
%56 = icmp eq i32 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %49
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %55)
br label %98
60: ; preds = %49
%61 = call i32 @ecryptfs_unwrap_passphrase(i8* %7, i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%62 = icmp eq i32 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i32 %61)
br label %98
66: ; preds = %60
%67 = call i32 @strlen(i8* %7)
%68 = zext i32 %67 to i64
%69 = icmp eq i64 %53, %68
%70 = trunc i64 %53 to i32
br i1 %69, label %75, label %71
71: ; preds = %66
%72 = trunc i64 %53 to i32
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %67, i32 %72)
br label %98
75: ; preds = %66
%76 = call i64 @memcmp(i8* %7, i8* %6, i32 %70)
%77 = icmp eq i64 %76, 0
br i1 %77, label %46, label %78
78: ; preds = %75
%79 = load i32, i32* @stderr
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %7, i8* %6)
br label %98
81: ; preds = %46
%82 = call i32 @from_hex(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
%83 = bitcast [72 x i8]* %3 to <16 x i8>*
store <16 x i8> <i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111, i8 112>, <16 x i8>* %83
%84 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 16
%85 = bitcast i8* %84 to <16 x i8>*
store <16 x i8> <i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120, i8 121, i8 122, i8 123, i8 124, i8 125, i8 126, i8 127, i8 -128>, <16 x i8>* %85
%86 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 32
%87 = bitcast i8* %86 to <16 x i8>*
store <16 x i8> <i8 -127, i8 -126, i8 -125, i8 -124, i8 -123, i8 -122, i8 -121, i8 -120, i8 -119, i8 -118, i8 -117, i8 -116, i8 -115, i8 -114, i8 -113, i8 -112>, <16 x i8>* %87
%88 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 48
%89 = bitcast i8* %88 to <16 x i8>*
store <16 x i8> <i8 -111, i8 -110, i8 -109, i8 -108, i8 -107, i8 -106, i8 -105, i8 -104, i8 -103, i8 -102, i8 -101, i8 -100, i8 -99, i8 -98, i8 -97, i8 -96>, <16 x i8>* %89
%90 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 64
store i8 -95, i8* %90
%91 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 66
store i8 0, i8* %91
%92 = call i32 @strlen(i8* %6)
%93 = call i32 @ecryptfs_wrap_passphrase(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %6)
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %81
%96 = load i32, i32* @stderr
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0), i32 0)
br label %98
98: ; preds = %81, %95, %78, %71, %63, %57, %41, %35, %29, %23
%99 = phi i32 [ 1, %23 ], [ 1, %29 ], [ 1, %35 ], [ 1, %41 ], [ 1, %57 ], [ 1, %63 ], [ 1, %71 ], [ 1, %78 ], [ 1, %95 ], [ 0, %81 ]
ret i32 %99
}