// File: /workspace/github_c_makefile_star2_O2/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
pushq $0xa
popq %rdi
callq 0x1030
callq 0x1050
movq %rax, %rbx
leaq 0x33(%rsp), %rdi
callq 0x3070
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm0, %xmm0
vmulsd 0xa83(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0xa83(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0xa8b(%rip), %rdi       # 0x44c7
movb $0x1, %al
callq 0x1060
leaq 0xa76(%rip), %rbx       # 0x44c0
xorl %r14d, %r14d
cmpq $0x25, %r14
je 0x3a68
movzbl 0x33(%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
jmp 0x3a4d
leaq 0xbf1(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xe(%rsp), %rdi
callq 0x3070
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0xa15(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0xa15(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0xa43(%rip), %rdi       # 0x44ed
movb $0x1, %al
callq 0x1060
leaq 0xa08(%rip), %rbx       # 0x44c0
xorl %r14d, %r14d
cmpq $0x25, %r14
je 0x3ad6
movzbl 0xe(%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
jmp 0x3abb
leaq 0xb83(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x78f(%rip), %rsi       # 0x4280
leaq 0x98(%rsp), %rdi
leaq 0x33(%rsp), %rdx
callq 0x395c
testb %al, %al
je 0x3ce8
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x990(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x990(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0xa1c(%rip), %rdi       # 0x454b
movb $0x1, %al
callq 0x1060
leaq 0x98(%rsp), %rdi
callq 0x39d3
leaq 0xb16(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x722(%rip), %rsi       # 0x4280
leaq 0x118(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x395c
testb %al, %al
je 0x3d01
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x923(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x923(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x9f7(%rip), %rdi       # 0x4593
movb $0x1, %al
callq 0x1060
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0x39d3
leaq 0xaa6(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
leaq 0x33(%rsp), %rdx
movq %r14, %rsi
callq 0x395c
testb %al, %al
je 0x3d1a
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x8ba(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x8ba(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x9e0(%rip), %rdi       # 0x45e5
movb $0x1, %al
callq 0x1060
leaq 0x58(%rsp), %rdi
callq 0x39d3
leaq 0xa43(%rip), %rdi       # 0x4660
callq 0x1040
callq 0x1050
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xe(%rsp), %rdx
callq 0x395c
testb %al, %al
je 0x3d33
callq 0x1050
subq %rbx, %rax
vcvtsi2sd %rax, %xmm1, %xmm0
vmulsd 0x84f(%rip), %xmm0, %xmm0 # 0x44b0
vdivsd 0x84f(%rip), %xmm0, %xmm0 # 0x44b8
leaq 0x9c5(%rip), %rdi       # 0x4635
movb $0x1, %al
callq 0x1060
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x39d3
leaq 0x9d2(%rip), %rdi       # 0x4660
callq 0x1040
leaq 0x9c1(%rip), %rdi       # 0x465b
xorl %eax, %eax
callq 0x1060
leaq 0x58(%rsp), %rdi
pushq $0x40
popq %rdx
movq %rbx, %rsi
callq 0x1090
testl %eax, %eax
leaq 0x9a8(%rip), %rax       # 0x4662
leaq 0x9b1(%rip), %rdi       # 0x4672
cmoveq %rax, %rdi
callq 0x1040
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x1030
movl %ebx, %edi
callq 0x1030
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
retq
leaq 0x824(%rip), %rdi       # 0x4513
leaq 0x843(%rip), %rsi       # 0x4539
leaq 0x843(%rip), %rcx       # 0x4540
pushq $0x38
jmp 0x3d4a
leaq 0x869(%rip), %rdi       # 0x4571
leaq 0x82a(%rip), %rsi       # 0x4539
leaq 0x82a(%rip), %rcx       # 0x4540
pushq $0x40
jmp 0x3d4a
leaq 0x898(%rip), %rdi       # 0x45b9
leaq 0x811(%rip), %rsi       # 0x4539
leaq 0x811(%rip), %rcx       # 0x4540
pushq $0x49
jmp 0x3d4a
leaq 0x8d1(%rip), %rdi       # 0x460b
leaq 0x7f8(%rip), %rsi       # 0x4539
leaq 0x7f8(%rip), %rcx       # 0x4540
pushq $0x51
popq %rdx
callq 0x1070