#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;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ curve25519(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ *);
scalar_t__ memcmp(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int, int);
int main() {
  uint8_t out[32], a[32], b[32];
  memset(a, 42, sizeof(a));
  memset(b, 64, sizeof(b));
  curve25519(out, a, b);
  return 0 != memcmp(out,
                     "\x0eY\xe5-\xdc|%AV\x9eR\xe0\xba!\xf1T]>"
                     "\xff\xca\xcaSS\x9c\xc4_\xec`O*\xd6\x03",
                     32);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0x2a,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    -0x190(%rbp),%rdi
mov    $0x40,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x190(%rbp),%rdx
call   1050 <curve25519@plt>
lea    -0x90(%rbp),%rdi
lea    0xe6a(%rip),%rsi
mov    $0x20,%edx
call   1040 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x180,%rsp
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    $0x2a,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x40,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <curve25519@plt>
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <memcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x180,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0EY\E5-\DC|%AV\9ER\E0\BA!\F1T]>\FF\CA\CASS\9C\C4_\EC`O*\D6\03\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i32]
%3 = alloca [32 x i32]
%4 = alloca [32 x i32]
store i32 0, i32* %1
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%6 = call i32 @memset(i32* %5, i32 42, i32 128)
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 64, i32 128)
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%12 = call i32 @curve25519(i32* %9, i32* %10, i32* %11)
%13 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%14 = call i64 @memcmp(i32* %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 32)
%15 = icmp ne i64 0, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0EY\E5-\DC|%AV\9ER\E0\BA!\F1T]>\FF\CA\CASS\9C\C4_\EC`O*\D6\03\00"
define i32 @main() {
%1 = alloca [32 x i32]
%2 = alloca [32 x i32]
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %1 to i8*
%5 = bitcast [32 x i32]* %2 to i8*
%6 = bitcast [32 x i32]* %3 to i8*
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 42, i32 128)
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%10 = call i32 @memset(i32* %9, i32 64, i32 128)
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%12 = call i32 @curve25519(i32* %11, i32* %7, i32* %9)
%13 = call i64 @memcmp(i32* %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 32)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
ret i32 %15
}