#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ omac_noekeon_init(void *);
int /*<<< orphan*/ omac_noekeon_last(void const *, int, void const *, void *);
int /*<<< orphan*/ omac_noekeon_next(void const *, void const *, void *);
int /*<<< orphan*/ omac_noekeon_tweak(int, void const *, void *);
void omac_noekeon(void *dest, const void *msg, uint16_t msglength_b,
                  const void *key, uint8_t t) {
  omac_noekeon_init(dest);
  if (t != 0xff)
    omac_noekeon_tweak(t, key, dest);
  while (msglength_b > 128) {
    omac_noekeon_next(msg, key, dest);
    msg = (uint8_t *)msg + 16;
    msglength_b -= 128;
  }
  omac_noekeon_last(msg, msglength_b, key, dest);
}


x86 assembly (clang, -O0):
<omac_noekeon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <omac_noekeon_init@plt>
cmpl   $0xff,-0x24(%rbp)
je     1181 <omac_noekeon+0x41>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1060 <omac_noekeon_tweak@plt>
jmp    1186 <omac_noekeon+0x46>
cmpl   $0x80,-0x14(%rbp)
jle    11c0 <omac_noekeon+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <omac_noekeon_next@plt>
mov    -0x10(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <omac_noekeon+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1030 <omac_noekeon_last@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<omac_noekeon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rsi,%rbx
mov    %rdi,%r15
call   1050 <omac_noekeon_init@plt>
cmp    $0xff,%ebp
je     1171 <omac_noekeon+0x31>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <omac_noekeon_tweak@plt>
cmp    $0x81,%r12d
jl     11a5 <omac_noekeon+0x65>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <omac_noekeon_next@plt>
add    $0x40,%rbx
lea    -0x80(%r12),%esi
cmp    $0x100,%r12d
mov    %esi,%r12d
ja     1180 <omac_noekeon+0x40>
jmp    11a8 <omac_noekeon+0x68>
mov    %r12d,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <omac_noekeon_last@plt>

LLVM IR (-O0):
define void @omac_noekeon(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = call i32 @omac_noekeon_init(i8* %11)
%13 = load i32, i32* %10
%14 = icmp ne i32 %13, 255
br i1 %14, label %15, label %20
15: ; preds = %5
%16 = load i32, i32* %10
%17 = load i8*, i8** %9
%18 = load i8*, i8** %6
%19 = call i32 @omac_noekeon_tweak(i32 %16, i8* %17, i8* %18)
br label %20
20: ; preds = %15, %5
br label %21
21: ; preds = %24, %20
%22 = load i32, i32* %8
%23 = icmp sgt i32 %22, 128
br i1 %23, label %24, label %35
24: ; preds = %21
%25 = load i8*, i8** %7
%26 = load i8*, i8** %9
%27 = load i8*, i8** %6
%28 = call i32 @omac_noekeon_next(i8* %25, i8* %26, i8* %27)
%29 = load i8*, i8** %7
%30 = bitcast i8* %29 to i32*
%31 = getelementptr inbounds i32, i32* %30, i64 16
%32 = bitcast i32* %31 to i8*
store i8* %32, i8** %7
%33 = load i32, i32* %8
%34 = sub nsw i32 %33, 128
store i32 %34, i32* %8
br label %21
35: ; preds = %21
%36 = load i8*, i8** %7
%37 = load i32, i32* %8
%38 = load i8*, i8** %9
%39 = load i8*, i8** %6
%40 = call i32 @omac_noekeon_last(i8* %36, i32 %37, i8* %38, i8* %39)
ret void
}

LLVM IR (-O2):
define void @omac_noekeon(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @omac_noekeon_init(i8* %0)
%7 = icmp eq i32 %4, 255
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @omac_noekeon_tweak(i32 %4, i8* %3, i8* %0)
br label %10
10: ; preds = %8, %5
%11 = icmp sgt i32 %2, 128
br i1 %11, label %12, label %19
12: ; preds = %10, %12
%13 = phi i8* [ %16, %12 ], [ %1, %10 ]
%14 = phi i32 [ %17, %12 ], [ %2, %10 ]
%15 = tail call i32 @omac_noekeon_next(i8* %13, i8* %3, i8* %0)
%16 = getelementptr inbounds i8, i8* %13, i64 64
%17 = add nsw i32 %14, -128
%18 = icmp ugt i32 %14, 256
br i1 %18, label %12, label %19
19: ; preds = %12, %10
%20 = phi i32 [ %2, %10 ], [ %17, %12 ]
%21 = phi i8* [ %1, %10 ], [ %16, %12 ]
%22 = tail call i32 @omac_noekeon_last(i8* %21, i32 %20, i8* %3, i8* %0)
ret void
}