#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 /*<<< orphan*/ acorn128_enc_onebyte(unsigned char *, unsigned char,
                                        unsigned char *, unsigned char *, int,
                                        int);
void acorn128_tag_generation(unsigned long long msglen,
                             unsigned long long adlen, unsigned char maclen,
                             unsigned char *mac, unsigned char *state) {
  int i;
  unsigned char plaintextbyte = 0;
  unsigned char ciphertextbyte = 0;
  unsigned char ksbyte = 0;
  for (i = 0; i < 512 / 8; i++) {
    acorn128_enc_onebyte(state, plaintextbyte, &ciphertextbyte, &ksbyte, 0xff,
                         0xff);
    if (i >= (512 / 8 - 16)) {
      mac[i - (512 / 8 - 16)] = ksbyte;
    }
  }
}


x86 assembly (clang, -O0):
<acorn128_tag_generation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movb   $0x0,-0x2d(%rbp)
movb   $0x0,-0x2e(%rbp)
movb   $0x0,-0x2f(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x40,-0x2c(%rbp)
jge    1198 <acorn128_tag_generation+0x88>
mov    -0x28(%rbp),%rdi
lea    -0x2e(%rbp),%rdx
lea    -0x2f(%rbp),%rcx
mov    $0xff,%r9d
movzbl -0x2d(%rbp),%esi
mov    %r9d,%r8d
call   1030 <acorn128_enc_onebyte@plt>
cmpl   $0x30,-0x2c(%rbp)
jl     1185 <acorn128_tag_generation+0x75>
mov    -0x2f(%rbp),%dl
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x30,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    118a <acorn128_tag_generation+0x7a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1140 <acorn128_tag_generation+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acorn128_tag_generation>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r13
mov    %rcx,%r14
movb   $0x0,0xf(%rsp)
movb   $0x0,0xe(%rsp)
xor    %ebx,%ebx
lea    0xf(%rsp),%r15
lea    0xe(%rsp),%r12
jmp    114a <acorn128_tag_generation+0x3a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x40,%rbx
je     117a <acorn128_tag_generation+0x6a>
mov    %r13,%rdi
xor    %esi,%esi
mov    %r15,%rdx
mov    %r12,%rcx
mov    $0xff,%r8d
mov    $0xff,%r9d
call   1030 <acorn128_enc_onebyte@plt>
cmp    $0x30,%rbx
jb     1140 <acorn128_tag_generation+0x30>
movzbl 0xe(%rsp),%eax
lea    -0x30(%rbx),%ecx
mov    %al,(%r14,%rcx,1)
jmp    1140 <acorn128_tag_generation+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @acorn128_tag_generation(i64 %0, i64 %1, i8 zeroext %2, i8* %3, i8* %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
store i64 %0, i64* %6
store i64 %1, i64* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
store i8 0, i8* %12
store i8 0, i8* %13
store i8 0, i8* %14
store i32 0, i32* %11
br label %15
15: ; preds = %32, %5
%16 = load i32, i32* %11
%17 = icmp slt i32 %16, 64
br i1 %17, label %18, label %35
18: ; preds = %15
%19 = load i8*, i8** %10
%20 = load i8, i8* %12
%21 = call i32 @acorn128_enc_onebyte(i8* %19, i8 zeroext %20, i8* %13, i8* %14, i32 255, i32 255)
%22 = load i32, i32* %11
%23 = icmp sge i32 %22, 48
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = load i8, i8* %14
%26 = load i8*, i8** %9
%27 = load i32, i32* %11
%28 = sub nsw i32 %27, 48
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 %25, i8* %30
br label %31
31: ; preds = %24, %18
br label %32
32: ; preds = %31
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %15
35: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @acorn128_tag_generation(i64 %0, i64 %1, i8 zeroext %2, i8* nocapture writeonly %3, i8* %4) {
%6 = alloca i8
%7 = alloca i8
store i8 0, i8* %6
store i8 0, i8* %7
br label %8
8: ; preds = %5, %17
%9 = phi i64 [ 0, %5 ], [ %18, %17 ]
%10 = call i32 @acorn128_enc_onebyte(i8* %4, i8 zeroext 0, i8* %6, i8* %7, i32 255, i32 255)
%11 = icmp ugt i64 %9, 47
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8, i8* %7
%14 = add nuw i64 %9, 4294967248
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds i8, i8* %3, i64 %15
store i8 %13, i8* %16
br label %17
17: ; preds = %8, %12
%18 = add nuw nsw i64 %9, 1
%19 = icmp eq i64 %18, 64
br i1 %19, label %20, label %8
20: ; preds = %17
ret void
}