#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 crypto_aead_decrypt(unsigned char *, unsigned long long *, unsigned char *,
                        unsigned char *, unsigned long long, unsigned char *,
                        unsigned long long, unsigned char *, unsigned char *);
int /*<<< orphan*/ crypto_aead_encrypt(unsigned char *, unsigned long long *,
                                       unsigned char *, unsigned long long,
                                       unsigned char *, unsigned long long,
                                       unsigned char *, unsigned char *,
                                       unsigned char *);
int /*<<< orphan*/ print(char *, unsigned char *, unsigned long long);
int /*<<< orphan*/ printf(char *);
int strlen(unsigned char *);
int main() {
  unsigned long long alen = 0;
  unsigned long long mlen = 0;
  unsigned long long clen = 16;
  unsigned char a[] = "ASCON";
  unsigned char m[] = "ascon";
  unsigned char c[strlen(m) + 16];
  unsigned char nsec[0];
  unsigned char npub[16] = {0};
  unsigned char k[16] = {0};
  int r;
  alen = strlen(a);
  mlen = strlen(m);
  print("k", k, 16);
  printf(" ");
  print("n", npub, 16);
  printf("\n");
  print("a", a, alen);
  printf(" ");
  print("m", m, mlen);
  printf(" -> ");
  crypto_aead_encrypt(c, &clen, m, mlen, a, alen, nsec, npub, k);
  print("c", c, clen - 16);
  printf(" ");
  print("t", c + clen - 16, 16);
  printf(" -> ");
  r = crypto_aead_decrypt(m, &mlen, nsec, c, clen, a, alen, npub, k);
  print("a", a, alen);
  printf(" ");
  print("m", m, mlen);
  printf("\n");
  return r;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x10,-0x20(%rbp)
movw   $0x4e,-0x24(%rbp)
movl   $0x4f435341,-0x28(%rbp)
movw   $0x6e,-0x2c(%rbp)
movl   $0x6f637361,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x10,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
cltq
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
cltq
mov    %rax,-0x18(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xdf0(%rip),%rdi
mov    $0x10,%edx
call   1070 <print@plt>
lea    0xdea(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x10,%edx
call   1070 <print@plt>
lea    0xdc0(%rip),%rdi
call   1050 <printf@plt>
lea    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xdae(%rip),%rdi
call   1070 <print@plt>
lea    0xda9(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xd90(%rip),%rdi
call   1070 <print@plt>
lea    0xd86(%rip),%rdi
call   1050 <printf@plt>
mov    -0x80(%rbp),%rdi
lea    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x28(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    -0x41(%rbp),%r11
lea    -0x60(%rbp),%r10
lea    -0x70(%rbp),%rax
lea    -0x20(%rbp),%rsi
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1080 <crypto_aead_encrypt@plt>
mov    -0x80(%rbp),%rsi
add    $0x20,%rsp
mov    -0x20(%rbp),%rdx
sub    $0x10,%rdx
lea    0xd34(%rip),%rdi
call   1070 <print@plt>
lea    0xd26(%rip),%rdi
call   1050 <printf@plt>
mov    -0x80(%rbp),%rsi
add    -0x20(%rbp),%rsi
add    $0xfffffffffffffff0,%rsi
lea    0xd12(%rip),%rdi
mov    $0x10,%edx
call   1070 <print@plt>
lea    0xcfa(%rip),%rdi
call   1050 <printf@plt>
mov    -0x80(%rbp),%rcx
lea    -0x30(%rbp),%rdi
lea    -0x41(%rbp),%rdx
mov    -0x20(%rbp),%r8
lea    -0x28(%rbp),%r9
mov    -0x10(%rbp),%r11
lea    -0x60(%rbp),%r10
lea    -0x70(%rbp),%rax
lea    -0x18(%rbp),%rsi
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <crypto_aead_decrypt@plt>
add    $0x20,%rsp
mov    %eax,-0x74(%rbp)
lea    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xca0(%rip),%rdi
call   1070 <print@plt>
lea    0xc9b(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xc82(%rip),%rdi
call   1070 <print@plt>
lea    0xc72(%rip),%rdi
call   1050 <printf@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movq   $0x10,-0x40(%rbp)
movw   $0x4e,-0x2c(%rbp)
movl   $0x4f435341,-0x30(%rbp)
movw   $0x6e,-0x34(%rbp)
movl   $0x6f637361,-0x38(%rbp)
lea    -0x38(%rbp),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rsp,-0x50(%rbp)
add    $0x10,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,-0x70(%rbp)
movaps %xmm0,-0x60(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
movslq %eax,%r12
mov    %r14,%rdi
call   1050 <strlen@plt>
movslq %eax,%r13
mov    %r13,-0x48(%rbp)
lea    0xe28(%rip),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x10,%edx
call   1070 <print@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe07(%rip),%rdi
lea    -0x70(%rbp),%r15
mov    $0x10,%edx
mov    %r15,%rsi
call   1070 <print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde9(%rip),%rdi
lea    -0x30(%rbp),%rsi
mov    %r12,%rdx
call   1070 <print@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdce(%rip),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1070 <print@plt>
lea    0xdbe(%rip),%rdi
call   1060 <printf@plt>
sub    $0x8,%rsp
lea    -0x29(%rbp),%rax
lea    -0x40(%rbp),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r13,%rcx
lea    -0x30(%rbp),%r13
mov    %r13,%r8
mov    %r12,%r9
lea    -0x60(%rbp),%r14
push   %r14
push   %r15
push   %rax
call   1080 <crypto_aead_encrypt@plt>
add    $0x20,%rsp
mov    -0x40(%rbp),%rdx
add    $0xfffffffffffffff0,%rdx
lea    0xd7e(%rip),%rdi
mov    %rbx,%rsi
call   1070 <print@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x40(%rbp),%rax
lea    (%rax,%rbx,1),%rsi
add    $0xfffffffffffffff0,%rsi
lea    0xd5b(%rip),%rdi
mov    $0x10,%edx
call   1070 <print@plt>
lea    0xd43(%rip),%rdi
call   1060 <printf@plt>
mov    -0x40(%rbp),%r8
sub    $0x8,%rsp
lea    -0x48(%rbp),%rsi
lea    -0x38(%rbp),%r15
mov    %r15,%rdi
lea    -0x29(%rbp),%rdx
mov    %rbx,%rcx
mov    %r13,%r9
push   %r14
lea    -0x70(%rbp),%rax
push   %rax
push   %r12
call   1040 <crypto_aead_decrypt@plt>
add    $0x20,%rsp
mov    %eax,%ebx
lea    0xd02(%rip),%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1070 <print@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x48(%rbp),%rdx
lea    0xce4(%rip),%rdi
mov    %r15,%rsi
call   1070 <print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x50(%rbp),%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.a = [6 x i8] c"ASCON\00"
@__const.main.m = [6 x i8] c"ascon\00"
@.str = [2 x i8] c"k\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"n\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [2 x i8] c"m\00"
@.str.6 = [5 x i8] c" -> \00"
@.str.7 = [2 x i8] c"c\00"
@.str.8 = [2 x i8] c"t\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca [6 x i8]
%6 = alloca [6 x i8]
%7 = alloca i8*
%8 = alloca i64
%9 = alloca [0 x i8]
%10 = alloca [16 x i8]
%11 = alloca [16 x i8]
%12 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 16, i64* %4
%13 = bitcast [6 x i8]* %5 to i8*
%14 = bitcast [6 x i8]* %6 to i8*
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = add nsw i32 %16, 16
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %7
%20 = alloca i8, i64 %18
store i64 %18, i64* %8
%21 = bitcast [16 x i8]* %10 to i8*
%22 = bitcast [16 x i8]* %11 to i8*
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = sext i32 %24 to i64
store i64 %25, i64* %2
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = sext i32 %27 to i64
store i64 %28, i64* %3
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%30 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %29, i64 16)
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%33 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %32, i64 16)
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%36 = load i64, i64* %2
%37 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %35, i64 %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%40 = load i64, i64* %3
%41 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %39, i64 %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%43 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%44 = load i64, i64* %3
%45 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%46 = load i64, i64* %2
%47 = getelementptr inbounds [0 x i8], [0 x i8]* %9, i64 0, i64 0
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%50 = call i32 @crypto_aead_encrypt(i8* %20, i64* %4, i8* %43, i64 %44, i8* %45, i64 %46, i8* %47, i8* %48, i8* %49)
%51 = load i64, i64* %4
%52 = sub i64 %51, 16
%53 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* %20, i64 %52)
%54 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%55 = load i64, i64* %4
%56 = getelementptr inbounds i8, i8* %20, i64 %55
%57 = getelementptr inbounds i8, i8* %56, i64 -16
%58 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i8* %57, i64 16)
%59 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%60 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%61 = getelementptr inbounds [0 x i8], [0 x i8]* %9, i64 0, i64 0
%62 = load i64, i64* %4
%63 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%64 = load i64, i64* %2
%65 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%67 = call i32 @crypto_aead_decrypt(i8* %60, i64* %3, i8* %61, i8* %20, i64 %62, i8* %63, i64 %64, i8* %65, i8* %66)
store i32 %67, i32* %12
%68 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%69 = load i64, i64* %2
%70 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %68, i64 %69)
%71 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%72 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%73 = load i64, i64* %3
%74 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %72, i64 %73)
%75 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%76 = load i32, i32* %12
store i32 %76, i32* %1
%77 = load i8*, i8** %7
%78 = load i32, i32* %1
ret i32 %78
}

LLVM IR (-O2):
@__const.main.a = [6 x i8] c"ASCON\00"
@__const.main.m = [6 x i8] c"ascon\00"
@.str = [2 x i8] c"k\00"
@.str.2 = [2 x i8] c"n\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [2 x i8] c"m\00"
@.str.6 = [5 x i8] c" -> \00"
@.str.7 = [2 x i8] c"c\00"
@.str.8 = [2 x i8] c"t\00"
define i32 @main() {
%1 = alloca [0 x i8]
%2 = alloca i64
%3 = alloca i64
%4 = alloca [6 x i8]
%5 = alloca [6 x i8]
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = bitcast i64* %2 to i8*
%9 = bitcast i64* %3 to i8*
store i64 16, i64* %3
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = add nsw i32 %12, 16
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i8, i64 %14
%17 = getelementptr inbounds [0 x i8], [0 x i8]* %1, i64 0, i64 0
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%20 = call i32 @strlen(i8* %10)
%21 = sext i32 %20 to i64
%22 = call i32 @strlen(i8* %11)
%23 = sext i32 %22 to i64
store i64 %23, i64* %2
%24 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %19, i64 16)
%25 = call i32 @putchar(i32 32)
%26 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %18, i64 16)
%27 = call i32 @putchar(i32 10)
%28 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %10, i64 %21)
%29 = call i32 @putchar(i32 32)
%30 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %11, i64 %23)
%31 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 @crypto_aead_encrypt(i8* %16, i64* %3, i8* %11, i64 %23, i8* %10, i64 %21, i8* %17, i8* %18, i8* %19)
%33 = load i64, i64* %3
%34 = add i64 %33, -16
%35 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* %16, i64 %34)
%36 = call i32 @putchar(i32 32)
%37 = load i64, i64* %3
%38 = getelementptr inbounds i8, i8* %16, i64 %37
%39 = getelementptr inbounds i8, i8* %38, i64 -16
%40 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i8* %39, i64 16)
%41 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%42 = load i64, i64* %3
%43 = call i32 @crypto_aead_decrypt(i8* %11, i64* %2, i8* %17, i8* %16, i64 %42, i8* %10, i64 %21, i8* %18, i8* %19)
%44 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %10, i64 %21)
%45 = call i32 @putchar(i32 32)
%46 = load i64, i64* %2
%47 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %11, i64 %46)
%48 = call i32 @putchar(i32 10)
ret i32 %43
}