// File: /workspace/github_c_makefile_star2_O3/ioerror[P]csidh-reference-implementation/main.c
// Function: main
int main()
{
    clock_t t0, t1;

    private_key priv_alice, priv_bob;
    public_key pub_alice, pub_bob;
    public_key shared_alice, shared_bob;

    printf("\n");


    t0 = clock();
    csidh_private(&priv_alice);
    t1 = clock();

    printf("Alice's private key   (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    for (size_t i = 0; i < sizeof(priv_alice); ++i)
        printf("%02hhx", i[(uint8_t *) &priv_alice]);
    printf("\n\n");

    t0 = clock();
    csidh_private(&priv_bob);
    t1 = clock();

    printf("Bob's private key     (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    for (size_t i = 0; i < sizeof(priv_bob); ++i)
        printf("%02hhx", i[(uint8_t *) &priv_bob]);
    printf("\n\n");


    t0 = clock();
    assert(csidh(&pub_alice, &base, &priv_alice));
    t1 = clock();

    printf("Alice's public key    (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    fp_print(&pub_alice.A);
    printf("\n\n");

    t0 = clock();
    assert(csidh(&pub_bob, &base, &priv_bob));
    t1 = clock();

    printf("Bob's public key      (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    fp_print(&pub_bob.A);
    printf("\n\n");


    t0 = clock();
    assert(csidh(&shared_alice, &pub_bob, &priv_alice));
    t1 = clock();

    printf("Alice's shared secret (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    fp_print(&shared_alice.A);
    printf("\n\n");

    t0 = clock();
    assert(csidh(&shared_bob, &pub_alice, &priv_bob));
    t1 = clock();

    printf("Bob's shared secret   (%7.3lf ms):\n  ", 1000. * (t1 - t0) / CLOCKS_PER_SEC);
    fp_print(&shared_bob.A);
    printf("\n\n");

    printf("    ");
    if (memcmp(&shared_alice, &shared_bob, sizeof(public_key)))
        printf("\x1b[31mNOT EQUAL!\x1b[0m\n");
    else
        printf("\x1b[32mequal.\x1b[0m\n");
    printf("\n");

    printf("\n");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl $0xa, %edi
callq 0x1030
callq 0x1050
movq %rax, %rbx
leaq 0x33(%rsp), %rdi
callq 0x30c0
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm0, %xmm0
vmulsd 0x978(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x978(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x980(%rip), %rdi       # 0x44c7
movb $0x1, %al
callq 0x1060
leaq 0x96b(%rip), %rbx       # 0x44c0
xorl %r14d, %r14d
movzbl 0x33(%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
cmpq $0x25, %r14
jne 0x3b58
leaq 0xae8(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xe(%rsp), %rdi
callq 0x30c0
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x90c(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x90c(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x93a(%rip), %rdi       # 0x44ed
movb $0x1, %al
callq 0x1060
leaq 0x8ff(%rip), %rbx       # 0x44c0
xorl %r14d, %r14d
movzbl 0xe(%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
cmpq $0x25, %r14
jne 0x3bc4
leaq 0xa7c(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x688(%rip), %rsi       # 0x4280
leaq 0x98(%rsp), %rdi
leaq 0x33(%rsp), %rdx
callq 0x3a46
testb %al, %al
je 0x3e00
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x889(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x889(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x915(%rip), %rdi       # 0x454b
movb $0x1, %al
callq 0x1060
leaq 0x98(%rsp), %rdi
callq 0x3abb
leaq 0xa0f(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x61b(%rip), %rsi       # 0x4280
leaq 0x118(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x3a46
testb %al, %al
je 0x3e1f
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x81c(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x81c(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x8f0(%rip), %rdi       # 0x4593
movb $0x1, %al
callq 0x1060
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0x3abb
leaq 0x99f(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
leaq 0x33(%rsp), %rdx
movq %r14, %rsi
callq 0x3a46
testb %al, %al
je 0x3e3e
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x7b3(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x7b3(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x8d9(%rip), %rdi       # 0x45e5
movb $0x1, %al
callq 0x1060
leaq 0x58(%rsp), %rdi
callq 0x3abb
leaq 0x93c(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xe(%rsp), %rdx
callq 0x3a46
testb %al, %al
je 0x3e5d
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x748(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x748(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x8be(%rip), %rdi       # 0x4635
movb $0x1, %al
callq 0x1060
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3abb
leaq 0x8cb(%rip), %rdi       # 0x4660
callq 0x1040
leaq 0x8ba(%rip), %rdi       # 0x465b
xorl %eax, %eax
callq 0x1060
vmovdqu 0x58(%rsp), %ymm0
vmovdqu 0x78(%rsp), %ymm1
vpxor (%rbx), %ymm0, %ymm0
vpternlogq $0xf6, 0x20(%rbx), %ymm1, %ymm0
vptest %ymm0, %ymm0
leaq 0x896(%rip), %rax       # 0x4662
leaq 0x89f(%rip), %rdi       # 0x4672
cmoveq %rax, %rdi
vzeroupper
callq 0x1040
movl $0xa, %edi
callq 0x1030
movl $0xa, %edi
callq 0x1030
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
retq
leaq 0x70c(%rip), %rdi       # 0x4513
leaq 0x72b(%rip), %rsi       # 0x4539
leaq 0x72b(%rip), %rcx       # 0x4540
movl $0x38, %edx
callq 0x1070
leaq 0x74b(%rip), %rdi       # 0x4571
leaq 0x70c(%rip), %rsi       # 0x4539
leaq 0x70c(%rip), %rcx       # 0x4540
movl $0x40, %edx
callq 0x1070
leaq 0x774(%rip), %rdi       # 0x45b9
leaq 0x6ed(%rip), %rsi       # 0x4539
leaq 0x6ed(%rip), %rcx       # 0x4540
movl $0x49, %edx
callq 0x1070
leaq 0x7a7(%rip), %rdi       # 0x460b
leaq 0x6ce(%rip), %rsi       # 0x4539
leaq 0x6ce(%rip), %rcx       # 0x4540
movl $0x51, %edx
callq 0x1070