// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x178, %rsp            # imm = 0x178
movl $0x0, 0x174(%rsp)
leaq 0x1255(%rip), %rdi      # 0x54ee
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0x13b(%rsp), %rdi
callq 0x34c0
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0x11d4(%rip), %xmm0     # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0x11c0(%rip), %xmm1     # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x11cc(%rip), %rdi      # 0x54c7
movb $0x1, %al
callq 0x1040
movq $0x0, 0x8(%rsp)
cmpq $0x25, 0x8(%rsp)
jae 0x433e
movq 0x8(%rsp), %rax
movzbl 0x13b(%rsp,%rax), %esi
leaq 0x1199(%rip), %rdi      # 0x54c0
movb $0x0, %al
callq 0x1040
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x430b
leaq 0x11a8(%rip), %rdi      # 0x54ed
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0x116(%rsp), %rdi
callq 0x34c0
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0x1128(%rip), %xmm0     # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0x1114(%rip), %xmm1     # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x1149(%rip), %rdi      # 0x54f0
movb $0x1, %al
callq 0x1040
movq $0x0, (%rsp)
cmpq $0x25, (%rsp)
jae 0x43e5
movq (%rsp), %rax
movzbl 0x116(%rsp,%rax), %esi
leaq 0x10f0(%rip), %rdi      # 0x54c0
movb $0x0, %al
callq 0x1040
movq (%rsp), %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0x43b6
leaq 0x1101(%rip), %rdi      # 0x54ed
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xe71(%rip), %rsi       # 0x5280
leaq 0x13b(%rsp), %rdx
callq 0x41a0
testb $0x1, %al
jne 0x4422
jmp 0x4424
jmp 0x4443
leaq 0x10eb(%rip), %rdi      # 0x5516
leaq 0x110a(%rip), %rsi      # 0x553c
movl $0x38, %edx
leaq 0x1105(%rip), %rcx      # 0x5543
callq 0x1050
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0x104b(%rip), %xmm0     # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0x1037(%rip), %xmm1     # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x10ca(%rip), %rdi      # 0x554e
movb $0x1, %al
callq 0x1040
leaq 0xd0(%rsp), %rdi
callq 0x4250
leaq 0x104e(%rip), %rdi      # 0x54ed
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0xdbe(%rip), %rsi       # 0x5280
leaq 0x116(%rsp), %rdx
callq 0x41a0
testb $0x1, %al
jne 0x44d5
jmp 0x44d7
jmp 0x44f6
leaq 0x1096(%rip), %rdi      # 0x5574
leaq 0x1057(%rip), %rsi      # 0x553c
movl $0x40, %edx
leaq 0x1052(%rip), %rcx      # 0x5543
callq 0x1050
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0xf98(%rip), %xmm0      # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0xf84(%rip), %xmm1      # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x105f(%rip), %rdi      # 0x5596
movb $0x1, %al
callq 0x1040
leaq 0x90(%rsp), %rdi
callq 0x4250
leaq 0xf9b(%rip), %rdi       # 0x54ed
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x13b(%rsp), %rdx
callq 0x41a0
testb $0x1, %al
jne 0x4586
jmp 0x4588
jmp 0x45a7
leaq 0x102d(%rip), %rdi      # 0x55bc
leaq 0xfa6(%rip), %rsi       # 0x553c
movl $0x49, %edx
leaq 0xfa1(%rip), %rcx       # 0x5543
callq 0x1050
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0xee7(%rip), %xmm0      # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0xed3(%rip), %xmm1      # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0x1000(%rip), %rdi      # 0x55e8
movb $0x1, %al
callq 0x1040
leaq 0x50(%rsp), %rdi
callq 0x4250
leaq 0xeed(%rip), %rdi       # 0x54ed
movb $0x0, %al
callq 0x1040
callq 0x1030
movq %rax, 0x168(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x116(%rsp), %rdx
callq 0x41a0
testb $0x1, %al
jne 0x4634
jmp 0x4636
jmp 0x4655
leaq 0xfd1(%rip), %rdi       # 0x560e
leaq 0xef8(%rip), %rsi       # 0x553c
movl $0x51, %edx
leaq 0xef3(%rip), %rcx       # 0x5543
callq 0x1050
callq 0x1030
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rax
subq 0x168(%rsp), %rax
vcvtsi2sd %rax, %xmm0, %xmm1
vmovsd 0xe39(%rip), %xmm0      # 0x54b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd 0xe25(%rip), %xmm1      # 0x54b0
vdivsd %xmm1, %xmm0, %xmm0
leaq 0xfa2(%rip), %rdi       # 0x5638
movb $0x1, %al
callq 0x1040
leaq 0x10(%rsp), %rdi
callq 0x4250
leaq 0xe3f(%rip), %rdi       # 0x54ed
movb $0x0, %al
callq 0x1040
leaq 0xfa2(%rip), %rdi       # 0x565e
movb $0x0, %al
callq 0x1040
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x40, %edx
callq 0x1080
cmpl $0x0, %eax
je 0x46ec
leaq 0xf80(%rip), %rdi       # 0x5663
movb $0x0, %al
callq 0x1040
jmp 0x46fa
leaq 0xf85(%rip), %rdi       # 0x5678
movb $0x0, %al
callq 0x1040
leaq 0xded(%rip), %rdi       # 0x54ee
movb $0x0, %al
callq 0x1040
leaq 0xddf(%rip), %rdi       # 0x54ee
movb $0x0, %al
callq 0x1040
movl 0x174(%rsp), %eax
addq $0x178, %rsp            # imm = 0x178
retq