#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;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/);
scalar_t__ glome_generate_key(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int genkey(int argc, char **argv) {
  uint8_t private_key[32] = {0};
  if (glome_generate_key(private_key, NULL)) {
    fprintf(stderr, "unable to generate a new key\n");
    return EXIT_FAILURE;
  }
  if (fwrite(private_key, 1, sizeof private_key, stdout) !=
      sizeof private_key) {
    perror("unable to write the private key to stdout");
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<genkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <glome_generate_key@plt>
cmp    $0x0,%rax
je     11b5 <genkey+0x65>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120b <genkey+0xbb>
lea    -0x90(%rbp),%rdi
mov    0x2e0d(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x80,%edx
call   1070 <fwrite@plt>
cltq
cmp    $0x80,%rax
je     11ff <genkey+0xaf>
lea    0xe35(%rip),%rdi
call   1060 <perror@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120b <genkey+0xbb>
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genkey>:
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <glome_generate_key@plt>
test   %rax,%rax
je     119e <genkey+0x5e>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e3c(%rip),%rax
jmp    11c7 <genkey+0x87>
mov    0x2e2b(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x80,%edx
call   1060 <fwrite@plt>
cmp    $0x80,%eax
jne    11d1 <genkey+0x91>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
ret
lea    0xe46(%rip),%rdi
call   1050 <perror@plt>
jmp    1195 <genkey+0x55>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"unable to generate a new key\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [42 x i8] c"unable to write the private key to stdout\00"
@EXIT_SUCCESS = global i32 0
define i32 @genkey(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i32]
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [32 x i32]* %6 to i8*
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%9 = call i64 @glome_generate_key(i32* %8, i32* null)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
store i32 %14, i32* %3
br label %26
15: ; preds = %2
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%17 = load i32, i32* @stdout
%18 = call i32 @fwrite(i32* %16, i32 1, i32 128, i32 %17)
%19 = sext i32 %18 to i64
%20 = icmp ne i64 %19, 128
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %3
br label %26
24: ; preds = %15
%25 = load i32, i32* @EXIT_SUCCESS
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %21, %11
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"unable to generate a new key\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [42 x i8] c"unable to write the private key to stdout\00"
@EXIT_SUCCESS = global i32 0
define i32 @genkey(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %3 to i8*
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%6 = call i64 @glome_generate_key(i32* %5, i32* null)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %17
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = call i32 @fwrite(i32* %5, i32 1, i32 128, i32 %12)
%14 = icmp eq i32 %13, 128
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %11, %15, %8
%18 = phi i32* [ @EXIT_FAILURE, %8 ], [ @EXIT_FAILURE, %15 ], [ @EXIT_SUCCESS, %11 ]
%19 = load i32, i32* %18
ret i32 %19
}