#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 /*<<< orphan*/ obuf;
typedef int /*<<< orphan*/ d2;
typedef int /*<<< orphan*/ d1;

/* Variables and functions */
int UINT_MAX;
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ hmac_sha1(unsigned char const *, size_t, unsigned char *,
                             int, unsigned char *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *, size_t);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int pbkdf2_hmac_sha1(const unsigned char *password, size_t pwdLen,
                     const unsigned char *salt, size_t saltLen, size_t dkLen,
                     unsigned int rounds, unsigned char *derivedKey) {
  unsigned char *asalt;
  unsigned char obuf[(160 / 8)];
  unsigned char d1[(160 / 8)], d2[(160 / 8)];
  unsigned int i, j;
  unsigned int count;
  size_t range;
  if (rounds < 1 || dkLen == 0)
    return -1;
  if (saltLen == 0 || saltLen > UINT_MAX - 4)
    return -1;
  if ((asalt = (unsigned char *)malloc(saltLen + 4)) == NULL)
    return -1;
  memcpy(asalt, salt, saltLen);
  for (count = 1; dkLen > 0; count++) {
    asalt[saltLen + 0] = (count >> 24) & 0xff;
    asalt[saltLen + 1] = (count >> 16) & 0xff;
    asalt[saltLen + 2] = (count >> 8) & 0xff;
    asalt[saltLen + 3] = count & 0xff;
    hmac_sha1(password, pwdLen, asalt, saltLen + 4, d1);
    memcpy(obuf, d1, sizeof(obuf));
    for (i = 1; i < rounds; i++) {
      hmac_sha1(password, pwdLen, d1, sizeof(d1), d2);
      memcpy(d1, d2, sizeof(d1));
      for (j = 0; j < sizeof(obuf); j++)
        obuf[j] ^= d1[j];
    }
    range = dkLen < (160 / 8) ? dkLen : (160 / 8);
    memcpy(derivedKey, obuf, range);
    derivedKey += range;
    dkLen -= range;
  };
  memset(asalt, 0, saltLen + 4);
  free(asalt);
  memset(d1, 0, sizeof(d1));
  memset(d2, 0, sizeof(d2));
  memset(obuf, 0, sizeof(obuf));
  return 0;
}


x86 assembly (clang, -O0):
<pbkdf2_hmac_sha1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jb     118c <pbkdf2_hmac_sha1+0x3c>
cmpq   $0x0,-0x30(%rbp)
jne    1198 <pbkdf2_hmac_sha1+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    143e <pbkdf2_hmac_sha1+0x2ee>
cmpq   $0x0,-0x28(%rbp)
je     11bf <pbkdf2_hmac_sha1+0x6f>
mov    -0x28(%rbp),%rax
mov    0x2e3a(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    11cb <pbkdf2_hmac_sha1+0x7b>
movl   $0xffffffff,-0x4(%rbp)
jmp    143e <pbkdf2_hmac_sha1+0x2ee>
mov    -0x28(%rbp),%rdi
add    $0x4,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    11f2 <pbkdf2_hmac_sha1+0xa2>
movl   $0xffffffff,-0x4(%rbp)
jmp    143e <pbkdf2_hmac_sha1+0x2ee>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <memcpy@plt>
movl   $0x1,-0xac(%rbp)
cmpq   $0x0,-0x30(%rbp)
jbe    13e6 <pbkdf2_hmac_sha1+0x296>
mov    -0xac(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xac(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,0x1(%rax,%rcx,1)
mov    -0xac(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,0x2(%rax,%rcx,1)
mov    -0xac(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,0x3(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %eax,%ecx
lea    -0x80(%rbp),%r8
call   1070 <hmac_sha1@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x14,%edx
call   1050 <memcpy@plt>
movl   $0x1,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    1363 <pbkdf2_hmac_sha1+0x213>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0xa0(%rbp),%r8
mov    $0x14,%ecx
call   1070 <hmac_sha1@plt>
lea    -0x80(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x14,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
cmp    $0x14,%rax
jae    134a <pbkdf2_hmac_sha1+0x1fa>
mov    -0xa8(%rbp),%eax
movzbl -0x80(%rbp,%rax,1),%edx
mov    -0xa8(%rbp),%eax
movzbl -0x60(%rbp,%rax,1),%ecx
xor    %edx,%ecx
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    130a <pbkdf2_hmac_sha1+0x1ba>
jmp    134f <pbkdf2_hmac_sha1+0x1ff>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    12bf <pbkdf2_hmac_sha1+0x16f>
cmpq   $0x14,-0x30(%rbp)
jae    137e <pbkdf2_hmac_sha1+0x22e>
mov    -0x30(%rbp),%rax
mov    %rax,-0xc0(%rbp)
jmp    138f <pbkdf2_hmac_sha1+0x23f>
mov    $0x14,%eax
mov    %rax,-0xc0(%rbp)
jmp    138f <pbkdf2_hmac_sha1+0x23f>
mov    -0xc0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0xb8(%rbp),%rax
add    0x10(%rbp),%rax
mov    %rax,0x10(%rbp)
mov    -0xb8(%rbp),%rcx
mov    -0x30(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    120d <pbkdf2_hmac_sha1+0xbd>
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbkdf2_hmac_sha1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,(%rsp)
mov    $0xffffffff,%r12d
test   %rcx,%rcx
je     1355 <pbkdf2_hmac_sha1+0x205>
mov    %r8,%rbx
test   %r8,%r8
je     1355 <pbkdf2_hmac_sha1+0x205>
cmpl   $0x0,(%rsp)
je     1355 <pbkdf2_hmac_sha1+0x205>
mov    %rcx,%rbp
mov    0x2e54(%rip),%rax
movslq (%rax),%rax
add    $0xfffffffffffffffc,%rax
cmp    %rcx,%rax
jb     1355 <pbkdf2_hmac_sha1+0x205>
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r14
lea    0x4(%rbp),%rdi
mov    %rdi,0x38(%rsp)
call   1060 <malloc@plt>
test   %rax,%rax
je     1355 <pbkdf2_hmac_sha1+0x205>
mov    %r13,0x58(%rsp)
mov    0xc0(%rsp),%r13
mov    %rax,0x30(%rsp)
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbp,0x60(%rsp)
mov    %rbp,%rdx
call   1050 <memcpy@plt>
mov    (%rsp),%rax
add    $0xffffffff,%eax
mov    %eax,0x8(%rsp)
mov    $0x1,%eax
lea    0x40(%rsp),%r15
lea    0x70(%rsp),%rbp
jmp    1246 <pbkdf2_hmac_sha1+0xf6>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x68(%rsp),%rbx
cmp    $0x14,%rbx
mov    $0x14,%r12d
cmovb  %rbx,%r12
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
mov    %r12,%rdx
call   1050 <memcpy@plt>
add    %r12,%r13
mov    0xc(%rsp),%eax
add    $0x1,%eax
sub    %r12,%rbx
je     1303 <pbkdf2_hmac_sha1+0x1b3>
mov    %rbx,0x68(%rsp)
mov    %eax,0xc(%rsp)
bswap  %eax
mov    0x60(%rsp),%rcx
mov    0x30(%rsp),%rdx
mov    %eax,(%rdx,%rcx,1)
mov    %r14,%rdi
mov    0x58(%rsp),%r12
mov    %r12,%rsi
mov    0x38(%rsp),%rcx
mov    %r15,%r8
call   1070 <hmac_sha1@plt>
mov    $0x14,%edx
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1050 <memcpy@plt>
cmpl   $0x2,(%rsp)
jb     1210 <pbkdf2_hmac_sha1+0xc0>
mov    0x8(%rsp),%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x14,%ecx
mov    %rbp,%r8
call   1070 <hmac_sha1@plt>
mov    $0x14,%edx
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <memcpy@plt>
movaps 0x10(%rsp),%xmm0
xorps  0x40(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
movzbl 0x50(%rsp),%eax
movzbl 0x51(%rsp),%ecx
xor    %al,0x20(%rsp)
xor    %cl,0x21(%rsp)
movzbl 0x52(%rsp),%eax
xor    %al,0x22(%rsp)
movzbl 0x53(%rsp),%eax
xor    %al,0x23(%rsp)
add    $0xffffffff,%ebx
jne    12a0 <pbkdf2_hmac_sha1+0x150>
jmp    1210 <pbkdf2_hmac_sha1+0xc0>
xor    %r12d,%r12d
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    0x38(%rsp),%rdx
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    0x70(%rsp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
mov    %r12d,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UINT_MAX = global i32 0
define i32 @pbkdf2_hmac_sha1(i8* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca [20 x i8]
%18 = alloca [20 x i8]
%19 = alloca [20 x i8]
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i64
store i8* %0, i8** %9
store i64 %1, i64* %10
store i8* %2, i8** %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i32 %5, i32* %14
store i8* %6, i8** %15
%24 = load i32, i32* %14
%25 = icmp ult i32 %24, 1
br i1 %25, label %29, label %26
26: ; preds = %7
%27 = load i64, i64* %13
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26, %7
store i32 -1, i32* %8
br label %170
30: ; preds = %26
%31 = load i64, i64* %12
%32 = icmp eq i64 %31, 0
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = load i64, i64* %12
%35 = load i32, i32* @UINT_MAX
%36 = sub nsw i32 %35, 4
%37 = sext i32 %36 to i64
%38 = icmp ugt i64 %34, %37
br i1 %38, label %39, label %40
39: ; preds = %33, %30
store i32 -1, i32* %8
br label %170
40: ; preds = %33
%41 = load i64, i64* %12
%42 = add i64 %41, 4
%43 = call i64 @malloc(i64 %42)
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %16
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %47
46: ; preds = %40
store i32 -1, i32* %8
br label %170
47: ; preds = %40
%48 = load i8*, i8** %16
%49 = load i8*, i8** %11
%50 = load i64, i64* %12
%51 = call i32 @memcpy(i8* %48, i8* %49, i64 %50)
store i32 1, i32* %22
br label %52
52: ; preds = %153, %47
%53 = load i64, i64* %13
%54 = icmp ugt i64 %53, 0
br i1 %54, label %55, label %156
55: ; preds = %52
%56 = load i32, i32* %22
%57 = lshr i32 %56, 24
%58 = and i32 %57, 255
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %16
%61 = load i64, i64* %12
%62 = add i64 %61, 0
%63 = getelementptr inbounds i8, i8* %60, i64 %62
store i8 %59, i8* %63
%64 = load i32, i32* %22
%65 = lshr i32 %64, 16
%66 = and i32 %65, 255
%67 = trunc i32 %66 to i8
%68 = load i8*, i8** %16
%69 = load i64, i64* %12
%70 = add i64 %69, 1
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8 %67, i8* %71
%72 = load i32, i32* %22
%73 = lshr i32 %72, 8
%74 = and i32 %73, 255
%75 = trunc i32 %74 to i8
%76 = load i8*, i8** %16
%77 = load i64, i64* %12
%78 = add i64 %77, 2
%79 = getelementptr inbounds i8, i8* %76, i64 %78
store i8 %75, i8* %79
%80 = load i32, i32* %22
%81 = and i32 %80, 255
%82 = trunc i32 %81 to i8
%83 = load i8*, i8** %16
%84 = load i64, i64* %12
%85 = add i64 %84, 3
%86 = getelementptr inbounds i8, i8* %83, i64 %85
store i8 %82, i8* %86
%87 = load i8*, i8** %9
%88 = load i64, i64* %10
%89 = load i8*, i8** %16
%90 = load i64, i64* %12
%91 = add i64 %90, 4
%92 = trunc i64 %91 to i32
%93 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%94 = call i32 @hmac_sha1(i8* %87, i64 %88, i8* %89, i32 %92, i8* %93)
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %17, i64 0, i64 0
%96 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%97 = call i32 @memcpy(i8* %95, i8* %96, i64 20)
store i32 1, i32* %20
br label %98
98: ; preds = %132, %55
%99 = load i32, i32* %20
%100 = load i32, i32* %14
%101 = icmp ult i32 %99, %100
br i1 %101, label %102, label %135
102: ; preds = %98
%103 = load i8*, i8** %9
%104 = load i64, i64* %10
%105 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%106 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%107 = call i32 @hmac_sha1(i8* %103, i64 %104, i8* %105, i32 20, i8* %106)
%108 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%109 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%110 = call i32 @memcpy(i8* %108, i8* %109, i64 20)
store i32 0, i32* %21
br label %111
111: ; preds = %128, %102
%112 = load i32, i32* %21
%113 = zext i32 %112 to i64
%114 = icmp ult i64 %113, 20
br i1 %114, label %115, label %131
115: ; preds = %111
%116 = load i32, i32* %21
%117 = zext i32 %116 to i64
%118 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 %117
%119 = load i8, i8* %118
%120 = zext i8 %119 to i32
%121 = load i32, i32* %21
%122 = zext i32 %121 to i64
%123 = getelementptr inbounds [20 x i8], [20 x i8]* %17, i64 0, i64 %122
%124 = load i8, i8* %123
%125 = zext i8 %124 to i32
%126 = xor i32 %125, %120
%127 = trunc i32 %126 to i8
store i8 %127, i8* %123
br label %128
128: ; preds = %115
%129 = load i32, i32* %21
%130 = add i32 %129, 1
store i32 %130, i32* %21
br label %111
131: ; preds = %111
br label %132
132: ; preds = %131
%133 = load i32, i32* %20
%134 = add i32 %133, 1
store i32 %134, i32* %20
br label %98
135: ; preds = %98
%136 = load i64, i64* %13
%137 = icmp ult i64 %136, 20
br i1 %137, label %138, label %140
138: ; preds = %135
%139 = load i64, i64* %13
br label %141
140: ; preds = %135
br label %141
141: ; preds = %140, %138
%142 = phi i64 [ %139, %138 ], [ 20, %140 ]
store i64 %142, i64* %23
%143 = load i8*, i8** %15
%144 = getelementptr inbounds [20 x i8], [20 x i8]* %17, i64 0, i64 0
%145 = load i64, i64* %23
%146 = call i32 @memcpy(i8* %143, i8* %144, i64 %145)
%147 = load i64, i64* %23
%148 = load i8*, i8** %15
%149 = getelementptr inbounds i8, i8* %148, i64 %147
store i8* %149, i8** %15
%150 = load i64, i64* %23
%151 = load i64, i64* %13
%152 = sub i64 %151, %150
store i64 %152, i64* %13
br label %153
153: ; preds = %141
%154 = load i32, i32* %22
%155 = add i32 %154, 1
store i32 %155, i32* %22
br label %52
156: ; preds = %52
%157 = load i8*, i8** %16
%158 = load i64, i64* %12
%159 = add i64 %158, 4
%160 = trunc i64 %159 to i32
%161 = call i32 @memset(i8* %157, i32 0, i32 %160)
%162 = load i8*, i8** %16
%163 = call i32 @free(i8* %162)
%164 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%165 = call i32 @memset(i8* %164, i32 0, i32 20)
%166 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%167 = call i32 @memset(i8* %166, i32 0, i32 20)
%168 = getelementptr inbounds [20 x i8], [20 x i8]* %17, i64 0, i64 0
%169 = call i32 @memset(i8* %168, i32 0, i32 20)
store i32 0, i32* %8
br label %170
170: ; preds = %156, %46, %39, %29
%171 = load i32, i32* %8
ret i32 %171
}

LLVM IR (-O2):
@UINT_MAX = global i32 0
define i32 @pbkdf2_hmac_sha1(i8* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5, i8* %6) {
%8 = alloca [20 x i8]
%9 = alloca [20 x i8]
%10 = alloca [20 x i8]
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%14 = icmp eq i32 %5, 0
%15 = icmp eq i64 %4, 0
%16 = or i1 %15, %14
%17 = icmp eq i64 %3, 0
%18 = or i1 %17, %16
br i1 %18, label %99, label %19
19: ; preds = %7
%20 = load i32, i32* @UINT_MAX
%21 = add nsw i32 %20, -4
%22 = sext i32 %21 to i64
%23 = icmp ult i64 %22, %3
br i1 %23, label %99, label %24
24: ; preds = %19
%25 = add i64 %3, 4
%26 = tail call i64 @malloc(i64 %25)
%27 = inttoptr i64 %26 to i8*
%28 = icmp eq i64 %26, 0
br i1 %28, label %99, label %29
29: ; preds = %24
%30 = tail call i32 @memcpy(i8* %27, i8* %2, i64 %3)
%31 = getelementptr inbounds i8, i8* %27, i64 %3
%32 = add i64 %3, 1
%33 = getelementptr inbounds i8, i8* %27, i64 %32
%34 = add i64 %3, 2
%35 = getelementptr inbounds i8, i8* %27, i64 %34
%36 = add i64 %3, 3
%37 = getelementptr inbounds i8, i8* %27, i64 %36
%38 = trunc i64 %25 to i32
%39 = icmp ugt i32 %5, 1
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 16
%41 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 16
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 17
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 17
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 18
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 18
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 19
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 19
%48 = bitcast [20 x i8]* %9 to <16 x i8>*
%49 = bitcast [20 x i8]* %8 to <16 x i8>*
%50 = bitcast [20 x i8]* %8 to <16 x i8>*
br label %51
51: ; preds = %29, %85
%52 = phi i32 [ 1, %29 ], [ %91, %85 ]
%53 = phi i64 [ %4, %29 ], [ %90, %85 ]
%54 = phi i8* [ %6, %29 ], [ %89, %85 ]
%55 = lshr i32 %52, 24
%56 = trunc i32 %55 to i8
store i8 %56, i8* %31
%57 = lshr i32 %52, 16
%58 = trunc i32 %57 to i8
store i8 %58, i8* %33
%59 = lshr i32 %52, 8
%60 = trunc i32 %59 to i8
store i8 %60, i8* %35
%61 = trunc i32 %52 to i8
store i8 %61, i8* %37
%62 = call i32 @hmac_sha1(i8* %0, i64 %1, i8* %27, i32 %38, i8* %12)
%63 = call i32 @memcpy(i8* %11, i8* %12, i64 20)
br i1 %39, label %64, label %85
64: ; preds = %51, %64
%65 = phi i32 [ %83, %64 ], [ 1, %51 ]
%66 = call i32 @hmac_sha1(i8* %0, i64 %1, i8* %12, i32 20, i8* %13)
%67 = call i32 @memcpy(i8* %12, i8* %13, i64 20)
%68 = load <16 x i8>, <16 x i8>* %48
%69 = load <16 x i8>, <16 x i8>* %49
%70 = xor <16 x i8> %69, %68
store <16 x i8> %70, <16 x i8>* %50
%71 = load i8, i8* %40
%72 = load i8, i8* %41
%73 = xor i8 %72, %71
store i8 %73, i8* %41
%74 = load i8, i8* %42
%75 = load i8, i8* %43
%76 = xor i8 %75, %74
store i8 %76, i8* %43
%77 = load i8, i8* %44
%78 = load i8, i8* %45
%79 = xor i8 %78, %77
store i8 %79, i8* %45
%80 = load i8, i8* %46
%81 = load i8, i8* %47
%82 = xor i8 %81, %80
store i8 %82, i8* %47
%83 = add nuw i32 %65, 1
%84 = icmp eq i32 %83, %5
br i1 %84, label %85, label %64
85: ; preds = %64, %51
%86 = icmp ult i64 %53, 20
%87 = select i1 %86, i64 %53, i64 20
%88 = call i32 @memcpy(i8* %54, i8* %11, i64 %87)
%89 = getelementptr inbounds i8, i8* %54, i64 %87
%90 = sub i64 %53, %87
%91 = add i32 %52, 1
%92 = icmp eq i64 %90, 0
br i1 %92, label %93, label %51
93: ; preds = %85
%94 = call i32 @memset(i8* %27, i32 0, i32 %38)
%95 = call i32 @free(i8* %27)
%96 = call i32 @memset(i8* %12, i32 0, i32 20)
%97 = call i32 @memset(i8* %13, i32 0, i32 20)
%98 = call i32 @memset(i8* %11, i32 0, i32 20)
br label %99
99: ; preds = %24, %19, %7, %93
%100 = phi i32 [ 0, %93 ], [ -1, %7 ], [ -1, %19 ], [ -1, %24 ]
ret i32 %100
}