#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 */
struct goldilocks_public_key_t {
  int dummy;
};
struct goldilocks_private_key_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int goldilocks_init();
int goldilocks_keygen(struct goldilocks_private_key_t *,
                      struct goldilocks_public_key_t *);
void keypair(unsigned char sk[(2 * (448 / 8) + 32)], unsigned long long *sklen,
             unsigned char pk[(448 / 8)], unsigned long long *pklen) {
  int ret = goldilocks_init();
  if (ret)
    abort();
  ret = goldilocks_keygen((struct goldilocks_private_key_t *)sk,
                          (struct goldilocks_public_key_t *)pk);
  if (ret)
    abort();
  *sklen = (2 * (448 / 8) + 32);
  *pklen = (448 / 8);
}


x86 assembly (clang, -O0):
<keypair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <goldilocks_init@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1163 <keypair+0x33>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <goldilocks_keygen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1184 <keypair+0x54>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
movq   $0x90,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x38,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keypair>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <goldilocks_init@plt>
test   %eax,%eax
jne    1178 <keypair+0x48>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <goldilocks_keygen@plt>
test   %eax,%eax
jne    1178 <keypair+0x48>
movq   $0x90,(%r15)
movq   $0x38,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
%struct.goldilocks_private_key_t = type { i32 }
%struct.goldilocks_public_key_t = type { i32 }
define void @keypair(i8* %0, i64* %1, i8* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i32
store i8* %0, i8** %5
store i64* %1, i64** %6
store i8* %2, i8** %7
store i64* %3, i64** %8
%10 = call i32 (...) @goldilocks_init()
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %4
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to %struct.goldilocks_private_key_t*
%18 = load i8*, i8** %7
%19 = bitcast i8* %18 to %struct.goldilocks_public_key_t*
%20 = call i32 @goldilocks_keygen(%struct.goldilocks_private_key_t* %17, %struct.goldilocks_public_key_t* %19)
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = call i32 (...) @abort()
unreachable
25: ; preds = %15
%26 = load i64*, i64** %6
store i64 144, i64* %26
%27 = load i64*, i64** %8
store i64 56, i64* %27
ret void
}

LLVM IR (-O2):
%struct.goldilocks_private_key_t = type { i32 }
%struct.goldilocks_public_key_t = type { i32 }
define void @keypair(i8* %0, i64* nocapture writeonly %1, i8* %2, i64* nocapture writeonly %3) {
%5 = tail call i32 (...) @goldilocks_init()
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %4
%10 = bitcast i8* %0 to %struct.goldilocks_private_key_t*
%11 = bitcast i8* %2 to %struct.goldilocks_public_key_t*
%12 = tail call i32 @goldilocks_keygen(%struct.goldilocks_private_key_t* %10, %struct.goldilocks_public_key_t* %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i32 (...) @abort()
unreachable
16: ; preds = %9
store i64 144, i64* %1
store i64 56, i64* %3
ret void
}