#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ HMACBlock(unsigned char const *, int);
int /*<<< orphan*/ HMACDone();
int /*<<< orphan*/ HMACInit(unsigned char const *, int /*<<< orphan*/ const);
void HMACOnce(const unsigned char *key, const uint8_t klen,
              const unsigned char *data, int len) {
  HMACInit(key, klen);
  while (len >= 0) {
    HMACBlock(data, len > 64 ? 64 : len);
    len -= 64;
    data += 64;
  }
  HMACDone();
}


x86 assembly (clang, -O0):
<HMACOnce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <HMACInit@plt>
cmpl   $0x0,-0x1c(%rbp)
jl     11a7 <HMACOnce+0x77>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x40,-0x1c(%rbp)
jle    117b <HMACOnce+0x4b>
mov    $0x40,%eax
mov    %eax,-0x2c(%rbp)
jmp    1181 <HMACOnce+0x51>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1050 <HMACBlock@plt>
mov    -0x1c(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <HMACOnce+0x22>
mov    $0x0,%al
call   1030 <HMACDone@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HMACOnce>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r15
call   1040 <HMACInit@plt>
test   %ebp,%ebp
js     116f <HMACOnce+0x3f>
mov    $0x40,%r14d
mov    %ebp,%ebx
nopl   (%rax)
sub    $0x40,%ebx
cmovae %r14d,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
call   1050 <HMACBlock@plt>
add    $0x40,%r15
lea    0x40(%rbx),%eax
mov    %ebx,%ebp
cmp    $0x3f,%eax
ja     1150 <HMACOnce+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <HMACDone@plt>

LLVM IR (-O0):
define void @HMACOnce(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @HMACInit(i8* %9, i32 %10)
br label %12
12: ; preds = %22, %4
%13 = load i32, i32* %8
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %29
15: ; preds = %12
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = icmp sgt i32 %17, 64
br i1 %18, label %19, label %20
19: ; preds = %15
br label %22
20: ; preds = %15
%21 = load i32, i32* %8
br label %22
22: ; preds = %20, %19
%23 = phi i32 [ 64, %19 ], [ %21, %20 ]
%24 = call i32 @HMACBlock(i8* %16, i32 %23)
%25 = load i32, i32* %8
%26 = sub nsw i32 %25, 64
store i32 %26, i32* %8
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 64
store i8* %28, i8** %7
br label %12
29: ; preds = %12
%30 = call i32 (...) @HMACDone()
ret void
}

LLVM IR (-O2):
define void @HMACOnce(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @HMACInit(i8* %0, i32 %1)
%6 = icmp sgt i32 %3, -1
br i1 %6, label %7, label %16
7: ; preds = %4, %7
%8 = phi i32 [ %13, %7 ], [ %3, %4 ]
%9 = phi i8* [ %14, %7 ], [ %2, %4 ]
%10 = icmp ult i32 %8, 64
%11 = select i1 %10, i32 %8, i32 64
%12 = tail call i32 @HMACBlock(i8* %9, i32 %11)
%13 = add nsw i32 %8, -64
%14 = getelementptr inbounds i8, i8* %9, i64 64
%15 = icmp ugt i32 %8, 63
br i1 %15, label %7, label %16
16: ; preds = %7, %4
%17 = tail call i32 (...) @HMACDone()
ret void
}