// File: /workspace/github_c_makefile_star2_O1/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 0x30b4
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm0, %xmm0
vmulsd 0x9b8(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x9b8(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x9c0(%rip), %rdi       # 0x44c7
movb $0x1, %al
callq 0x1060
leaq 0x9ab(%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 0x3b18
leaq 0xb28(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xe(%rsp), %rdi
callq 0x30b4
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x94c(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x94c(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x97a(%rip), %rdi       # 0x44ed
movb $0x1, %al
callq 0x1060
leaq 0x93f(%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 0x3b84
leaq 0xabc(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x6c8(%rip), %rsi       # 0x4280
leaq 0x98(%rsp), %rdi
leaq 0x33(%rsp), %rdx
callq 0x3a06
testb %al, %al
je 0x3dc0
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x8c9(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x8c9(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x955(%rip), %rdi       # 0x454b
movb $0x1, %al
callq 0x1060
leaq 0x98(%rsp), %rdi
callq 0x3a7b
leaq 0xa4f(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x65b(%rip), %rsi       # 0x4280
leaq 0x118(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x3a06
testb %al, %al
je 0x3ddf
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x85c(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x85c(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x930(%rip), %rdi       # 0x4593
movb $0x1, %al
callq 0x1060
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0x3a7b
leaq 0x9df(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
leaq 0x33(%rsp), %rdx
movq %r14, %rsi
callq 0x3a06
testb %al, %al
je 0x3dfe
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x7f3(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x7f3(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x919(%rip), %rdi       # 0x45e5
movb $0x1, %al
callq 0x1060
leaq 0x58(%rsp), %rdi
callq 0x3a7b
leaq 0x97c(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xe(%rsp), %rdx
callq 0x3a06
testb %al, %al
je 0x3e1d
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x788(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x788(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x8fe(%rip), %rdi       # 0x4635
movb $0x1, %al
callq 0x1060
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3a7b
leaq 0x90b(%rip), %rdi       # 0x4660
callq 0x1040
leaq 0x8fa(%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 0x8d6(%rip), %rax       # 0x4662
leaq 0x8df(%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 0x74c(%rip), %rdi       # 0x4513
leaq 0x76b(%rip), %rsi       # 0x4539
leaq 0x76b(%rip), %rcx       # 0x4540
movl $0x38, %edx
callq 0x1070
leaq 0x78b(%rip), %rdi       # 0x4571
leaq 0x74c(%rip), %rsi       # 0x4539
leaq 0x74c(%rip), %rcx       # 0x4540
movl $0x40, %edx
callq 0x1070
leaq 0x7b4(%rip), %rdi       # 0x45b9
leaq 0x72d(%rip), %rsi       # 0x4539
leaq 0x72d(%rip), %rcx       # 0x4540
movl $0x49, %edx
callq 0x1070
leaq 0x7e7(%rip), %rdi       # 0x460b
leaq 0x70e(%rip), %rsi       # 0x4539
leaq 0x70e(%rip), %rcx       # 0x4540
movl $0x51, %edx
callq 0x1070