#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 argon2i();
int authenticated();
int blake2b();
int chacha20();
int edDSA_check();
int edDSA_sign();
int poly1305();
int /*<<< orphan*/ print(char *, int, char *);
int /*<<< orphan*/ printf(char *);
int sha512();
int x25519();
int x25519_inverse();
int x25519_sp_fast();
int x25519_sp_small();
int main() {
  print("Chacha20            ", chacha20() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("Poly1305            ", poly1305() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("Auth'd encryption   ", authenticated() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("Blake2b             ", blake2b() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("Sha512              ", sha512() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("Argon2i, 3 passes   ", argon2i() * (1024 * 1024 / (256 * 1024)),
        "megabytes  per second");
  print("x25519              ", x25519(), "exchanges  per second");
  print("EdDSA(sign)         ", edDSA_sign(), "signatures per second");
  print("EdDSA(check)        ", edDSA_check(), "checks     per second");
  print("x25519 inverse      ", x25519_inverse(), "scalar inv per second");
  print("x25519 dirty fast   ", x25519_sp_fast(), "scalar inv per second");
  print("x25519 dirty small  ", x25519_sp_small(), "scalar inv per second");
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1100 <chacha20@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xdfe(%rip),%rdi
lea    0xe0c(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   1080 <poly1305@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xe0a(%rip),%rdi
lea    0xded(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10f0 <authenticated@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xe00(%rip),%rdi
lea    0xdce(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   1050 <blake2b@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xdf6(%rip),%rdi
lea    0xdaf(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10b0 <sha512@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xdec(%rip),%rdi
lea    0xd90(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   1060 <argon2i@plt>
mov    %eax,%esi
shl    $0x2,%esi
lea    0xde2(%rip),%rdi
lea    0xd71(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10e0 <x25519@plt>
mov    %eax,%esi
lea    0xddb(%rip),%rdi
lea    0xde9(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   1030 <edDSA_sign@plt>
mov    %eax,%esi
lea    0xdea(%rip),%rdi
lea    0xdf8(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10d0 <edDSA_check@plt>
mov    %eax,%esi
lea    0xdf9(%rip),%rdi
lea    0xe07(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10a0 <x25519_inverse@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
lea    0xe16(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   1040 <x25519_sp_fast@plt>
mov    %eax,%esi
lea    0xe17(%rip),%rdi
lea    0xdfa(%rip),%rdx
call   1090 <print@plt>
mov    $0x0,%al
call   10c0 <x25519_sp_small@plt>
mov    %eax,%esi
lea    0xe10(%rip),%rdi
lea    0xdde(%rip),%rdx
call   1090 <print@plt>
lea    0xe12(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1100 <chacha20@plt>
lea    0x0(,%rax,4),%esi
lea    0xe0a(%rip),%rdi
lea    0xe18(%rip),%rbx
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   1080 <poly1305@plt>
lea    0x0(,%rax,4),%esi
lea    0xe11(%rip),%rdi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   10f0 <authenticated@plt>
lea    0x0(,%rax,4),%esi
lea    0xe09(%rip),%rdi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   1060 <blake2b@plt>
lea    0x0(,%rax,4),%esi
lea    0xe01(%rip),%rdi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   10b0 <sha512@plt>
lea    0x0(,%rax,4),%esi
lea    0xdf9(%rip),%rdi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   1070 <argon2i@plt>
lea    0x0(,%rax,4),%esi
lea    0xdf1(%rip),%rdi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   10e0 <x25519@plt>
lea    0xdf0(%rip),%rdi
lea    0xdfe(%rip),%rdx
mov    %eax,%esi
call   1090 <print@plt>
xor    %eax,%eax
call   1030 <edDSA_sign@plt>
lea    0xdff(%rip),%rdi
lea    0xe0d(%rip),%rdx
mov    %eax,%esi
call   1090 <print@plt>
xor    %eax,%eax
call   10d0 <edDSA_check@plt>
lea    0xe0e(%rip),%rdi
lea    0xe1c(%rip),%rdx
mov    %eax,%esi
call   1090 <print@plt>
xor    %eax,%eax
call   10a0 <x25519_inverse@plt>
lea    0xe1d(%rip),%rdi
lea    0xe2b(%rip),%rbx
mov    %eax,%esi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   1050 <x25519_sp_fast@plt>
lea    0xe29(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1090 <print@plt>
xor    %eax,%eax
call   10c0 <x25519_sp_small@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1090 <print@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Chacha20 \00"
@.str.1 = [22 x i8] c"megabytes per second\00"
@.str.2 = [21 x i8] c"Poly1305 \00"
@.str.3 = [21 x i8] c"Auth'd encryption \00"
@.str.4 = [21 x i8] c"Blake2b \00"
@.str.5 = [21 x i8] c"Sha512 \00"
@.str.6 = [21 x i8] c"Argon2i, 3 passes \00"
@.str.7 = [21 x i8] c"x25519 \00"
@.str.8 = [22 x i8] c"exchanges per second\00"
@.str.9 = [21 x i8] c"EdDSA(sign) \00"
@.str.10 = [22 x i8] c"signatures per second\00"
@.str.11 = [21 x i8] c"EdDSA(check) \00"
@.str.12 = [22 x i8] c"checks per second\00"
@.str.13 = [21 x i8] c"x25519 inverse \00"
@.str.14 = [22 x i8] c"scalar inv per second\00"
@.str.15 = [21 x i8] c"x25519 dirty fast \00"
@.str.16 = [21 x i8] c"x25519 dirty small \00"
@.str.17 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @chacha20()
%3 = mul nsw i32 %2, 4
%4 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @poly1305()
%6 = mul nsw i32 %5, 4
%7 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @authenticated()
%9 = mul nsw i32 %8, 4
%10 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (...) @blake2b()
%12 = mul nsw i32 %11, 4
%13 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (...) @sha512()
%15 = mul nsw i32 %14, 4
%16 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (...) @argon2i()
%18 = mul nsw i32 %17, 4
%19 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 (...) @x25519()
%21 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 (...) @edDSA_sign()
%23 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%24 = call i32 (...) @edDSA_check()
%25 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
%26 = call i32 (...) @x25519_inverse()
%27 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%28 = call i32 (...) @x25519_sp_fast()
%29 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%30 = call i32 (...) @x25519_sp_small()
%31 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Chacha20 \00"
@.str.1 = [22 x i8] c"megabytes per second\00"
@.str.2 = [21 x i8] c"Poly1305 \00"
@.str.3 = [21 x i8] c"Auth'd encryption \00"
@.str.4 = [21 x i8] c"Blake2b \00"
@.str.5 = [21 x i8] c"Sha512 \00"
@.str.6 = [21 x i8] c"Argon2i, 3 passes \00"
@.str.7 = [21 x i8] c"x25519 \00"
@.str.8 = [22 x i8] c"exchanges per second\00"
@.str.9 = [21 x i8] c"EdDSA(sign) \00"
@.str.10 = [22 x i8] c"signatures per second\00"
@.str.11 = [21 x i8] c"EdDSA(check) \00"
@.str.12 = [22 x i8] c"checks per second\00"
@.str.13 = [21 x i8] c"x25519 inverse \00"
@.str.14 = [22 x i8] c"scalar inv per second\00"
@.str.15 = [21 x i8] c"x25519 dirty fast \00"
@.str.16 = [21 x i8] c"x25519 dirty small \00"
define i32 @main() {
%1 = tail call i32 (...) @chacha20()
%2 = shl nsw i32 %1, 2
%3 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @poly1305()
%5 = shl nsw i32 %4, 2
%6 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @authenticated()
%8 = shl nsw i32 %7, 2
%9 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (...) @blake2b()
%11 = shl nsw i32 %10, 2
%12 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 (...) @sha512()
%14 = shl nsw i32 %13, 2
%15 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 (...) @argon2i()
%17 = shl nsw i32 %16, 2
%18 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 (...) @x25519()
%20 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%21 = tail call i32 (...) @edDSA_sign()
%22 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%23 = tail call i32 (...) @edDSA_check()
%24 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
%25 = tail call i32 (...) @x25519_inverse()
%26 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%27 = tail call i32 (...) @x25519_sp_fast()
%28 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%29 = tail call i32 (...) @x25519_sp_small()
%30 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %29, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%31 = tail call i32 @putchar(i32 10)
ret i32 0
}