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

/* Variables and functions */
int /*<<< orphan*/ f2m_is_equal(int, int *, int *);
int /*<<< orphan*/ f2m_print(int, int *);
int /*<<< orphan*/ f2m_rand(int, int, int *);
int /*<<< orphan*/ mult_scalar(int, int *, int *, int *, int *, int *, int *,
                               int *, int *);
int /*<<< orphan*/ printf(char *, ...);
uint32_t test_ecc_b163() {
  uint32_t m = 163, t = 6, i, xQ[6], yQ[6], d[6], xC[6], yC[6], k[6], xR[6],
           yR[6], xV[6], yV[6], f[6] = {0x000000C9, 0x00000000, 0x00000000,
                                        0x00000000, 0x00000000, 0x00000008},
           a[6] = {0x00000001, 0x00000000, 0x00000000,
                   0x00000000, 0x00000000, 0x00000000},
           b[6] = {0x4A3205FD, 0x512F7874, 0x1481EB10,
                   0xB8C953CA, 0x0A601907, 0x00000002},
           xP[6] = {0xE8343E36, 0xD4994637, 0xA0991168,
                    0x86A2D57E, 0xF0EBA162, 0x00000003},
           yP[6] = {0x797324F1, 0xB11C5C0C, 0xA2CDD545,
                    0x71A0094F, 0xD51FBC6C, 0x00000000},
           n[6] = {0xA4234C33, 0x77E70C12, 0x000292FE,
                   0x00000000, 0x00000000, 0x00000004};
  printf("\n************************************************************\n");
  printf("test: scalar multiplication of EC over GF(2^163)\n");
  printf("\nirreducible polynomial to generate GF(2^163)\n");
  printf("f  = ");
  f2m_print(t, f);
  printf("\n");
  printf("\nparameter b to determine elliptic curve E of GF(2^163)\n");
  printf("E: y^2 + xy = x^3 + ax^2 + b\n");
  printf("a  = ");
  f2m_print(t, a);
  printf("\n");
  printf("b  = ");
  f2m_print(t, b);
  printf("\n");
  printf("\nbase point P\n");
  printf("xP = ");
  f2m_print(t, xP);
  printf("\n");
  printf("yP = ");
  f2m_print(t, yP);
  printf("\n");
  printf("\norder of base point P\n");
  printf("n  = ");
  f2m_print(t, n);
  printf("\n");
  for (i = 0; i < 10; i++) {
    printf("************************************************************\n");
    printf("test %d\n", i);
    printf("************************************************************\n");
    printf("generate random private key d and corresponding\n");
    printf("public key Q with Q = d * P\n");
    f2m_rand(t, m, d);
    mult_scalar(m, f, a, b, d, xP, yP, xQ, yQ);
    printf("d  = ");
    f2m_print(t, d);
    printf("\n");
    printf("xQ = ");
    f2m_print(t, xQ);
    printf("\n");
    printf("yQ = ");
    f2m_print(t, yQ);
    printf("\n");
    printf("************************************************************\n");
    printf("generate random scalar d and challenge C\n");
    printf("with C = k * P\n");
    f2m_rand(t, m, k);
    mult_scalar(m, f, a, b, k, xP, yP, xC, yC);
    printf("k  = ");
    f2m_print(t, k);
    printf("\n");
    printf("xC = ");
    f2m_print(t, xC);
    printf("\n");
    printf("yC = ");
    f2m_print(t, yC);
    printf("\n");
    printf("************************************************************\n");
    printf("generate response R with R = d * C = d * k * P \n");
    mult_scalar(m, f, a, b, d, xC, yC, xR, yR);
    printf("xR = ");
    f2m_print(t, xR);
    printf("\n");
    printf("yR = ");
    f2m_print(t, yR);
    printf("\n");
    printf("************************************************************\n");
    printf("generate verification point V with V = k * Q = k * d * P\n");
    mult_scalar(m, f, a, b, k, xQ, yQ, xV, yV);
    printf("xV = ");
    f2m_print(t, xV);
    printf("\n");
    printf("yV = ");
    f2m_print(t, yV);
    printf("\n");
    if (!f2m_is_equal(t, xV, xR) || !f2m_is_equal(t, yV, yR))
      return 1;
  }
  printf("************************************************************\n");
  printf("test scalar multiplications...\n");
  for (i = 0; i < 10000; i++)
    mult_scalar(m, f, a, b, n, xP, yP, xQ, yQ);
  return 0;
}


x86 assembly (clang, -O0):
<test_ecc_b163>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0xa3,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    0xe90(%rip),%rax
mov    %rax,-0x170(%rbp)
mov    0xe8a(%rip),%rax
mov    %rax,-0x168(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x160(%rbp)
mov    0xe86(%rip),%rax
mov    %rax,-0x190(%rbp)
mov    0xe80(%rip),%rax
mov    %rax,-0x188(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x180(%rbp)
mov    0xe7c(%rip),%rax
mov    %rax,-0x1b0(%rbp)
mov    0xe76(%rip),%rax
mov    %rax,-0x1a8(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x1a0(%rbp)
mov    0xe72(%rip),%rax
mov    %rax,-0x1d0(%rbp)
mov    0xe6c(%rip),%rax
mov    %rax,-0x1c8(%rbp)
mov    0xe66(%rip),%rax
mov    %rax,-0x1c0(%rbp)
mov    0xe88(%rip),%rax
mov    %rax,-0x1f0(%rbp)
mov    0xe82(%rip),%rax
mov    %rax,-0x1e8(%rbp)
mov    0xe7c(%rip),%rax
mov    %rax,-0x1e0(%rbp)
mov    0xe3e(%rip),%rax
mov    %rax,-0x210(%rbp)
mov    0xe38(%rip),%rax
mov    %rax,-0x208(%rbp)
mov    0xe32(%rip),%rax
mov    %rax,-0x200(%rbp)
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x170(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0x102b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x190(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xfe4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x1b0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xfb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x1d0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xf80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x1f0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xf55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x210(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    17ce <test_ecc_b163+0x67e>
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x70(%rbp),%rdx
call   1040 <f2m_rand@plt>
mov    -0x8(%rbp),%edi
lea    -0x170(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x1b0(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    -0x1d0(%rbp),%r9
lea    -0x1f0(%rbp),%r11
lea    -0x30(%rbp),%r10
lea    -0x50(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <mult_scalar@plt>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x70(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0xd0(%rbp),%rdx
call   1040 <f2m_rand@plt>
mov    -0x8(%rbp),%edi
lea    -0x170(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x1b0(%rbp),%rcx
lea    -0xd0(%rbp),%r8
lea    -0x1d0(%rbp),%r9
lea    -0x1f0(%rbp),%r11
lea    -0x90(%rbp),%r10
lea    -0xb0(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <mult_scalar@plt>
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0xd0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0xb0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xab8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x170(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x1b0(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    -0xb0(%rbp),%r11
lea    -0xf0(%rbp),%r10
lea    -0x110(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <mult_scalar@plt>
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0xf0(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x110(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xc2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x9fb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x170(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x1b0(%rbp),%rcx
lea    -0xd0(%rbp),%r8
lea    -0x30(%rbp),%r9
lea    -0x50(%rbp),%r11
lea    -0x130(%rbp),%r10
lea    -0x150(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <mult_scalar@plt>
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x130(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xb9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x150(%rbp),%rsi
call   1060 <f2m_print@plt>
lea    0xb74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x130(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
call   1030 <f2m_is_equal@plt>
cmp    $0x0,%eax
je     17af <test_ecc_b163+0x65f>
mov    -0xc(%rbp),%edi
lea    -0x150(%rbp),%rsi
lea    -0x110(%rbp),%rdx
call   1030 <f2m_is_equal@plt>
cmp    $0x0,%eax
jne    17bb <test_ecc_b163+0x66b>
movl   $0x1,-0x4(%rbp)
jmp    185b <test_ecc_b163+0x70b>
jmp    17c0 <test_ecc_b163+0x670>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    13d0 <test_ecc_b163+0x280>
lea    0x8e4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x2710,-0x10(%rbp)
jge    1854 <test_ecc_b163+0x704>
mov    -0x8(%rbp),%edi
lea    -0x170(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x1b0(%rbp),%rcx
lea    -0x210(%rbp),%r8
lea    -0x1d0(%rbp),%r9
lea    -0x1f0(%rbp),%r11
lea    -0x30(%rbp),%r10
lea    -0x50(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <mult_scalar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    17f1 <test_ecc_b163+0x6a1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ecc_b163>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    0xe88(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xe6c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xe90(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe74(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xe98(%rip),%rax
mov    %rax,0x80(%rsp)
movaps 0xe79(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
mov    0xe9d(%rip),%rax
mov    %rax,0xa0(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
mov    0xebf(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0xe87(%rip),%rax
mov    %rax,0xc0(%rsp)
movaps 0xe68(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
lea    0xefa(%rip),%rdi
call   1040 <puts@plt>
lea    0xf2c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf51(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x30(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf78(%rip),%rdi
call   1040 <puts@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x10(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x70(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf3b(%rip),%rdi
call   1040 <puts@plt>
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x90(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x50(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeec(%rip),%rdi
call   1040 <puts@plt>
lea    0xd95(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb0(%rsp),%rsi
mov    $0x6,%edi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    0xdab(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xd56(%rip),%rdi
mov    %ebx,0xc(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xed9(%rip),%rdi
call   1040 <puts@plt>
mov    $0x6,%edi
mov    $0xa3,%esi
lea    0x110(%rsp),%rbx
mov    %rbx,%rdx
call   1060 <f2m_rand@plt>
sub    $0x8,%rsp
mov    $0xa3,%edi
lea    0x38(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x78(%rsp),%rcx
mov    %rbx,%r8
lea    0x98(%rsp),%r15
mov    %r15,%r9
lea    0x138(%rsp),%r14
push   %r14
lea    0xe0(%rsp),%rbp
push   %rbp
lea    0x68(%rsp),%r13
push   %r13
call   1090 <mult_scalar@plt>
add    $0x20,%rsp
lea    0xcc8(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xca9(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbp,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc8a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %r14,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc96(%rip),%rdi
call   1040 <puts@plt>
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe28(%rip),%rdi
call   1040 <puts@plt>
mov    $0x6,%edi
mov    $0xa3,%esi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdx
call   1060 <f2m_rand@plt>
sub    $0x8,%rsp
mov    $0xa3,%edi
lea    0x38(%rsp),%r13
mov    %r13,%rsi
lea    0x18(%rsp),%rdx
lea    0x78(%rsp),%r12
mov    %r12,%rcx
mov    %rbx,%r8
mov    %r15,%r9
lea    0x1d8(%rsp),%rbp
push   %rbp
lea    0x200(%rsp),%r15
push   %r15
lea    0x68(%rsp),%rax
push   %rax
call   1090 <mult_scalar@plt>
add    $0x20,%rsp
lea    0xbe7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xbc8(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %r15,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xba9(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbp,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xba3(%rip),%rdi
call   1040 <puts@plt>
lea    0xd50(%rip),%rdi
call   1040 <puts@plt>
sub    $0x8,%rsp
mov    $0xa3,%edi
mov    %r13,%rsi
lea    0x18(%rsp),%rdx
mov    %rdx,%rbx
mov    %r12,%rcx
lea    0x118(%rsp),%r8
mov    %r15,%r9
lea    0x198(%rsp),%r13
push   %r13
lea    0x1c0(%rsp),%r15
push   %r15
push   %rbp
call   1090 <mult_scalar@plt>
add    $0x20,%rsp
lea    0xb32(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %r15,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb13(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %r13,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb01(%rip),%rdi
call   1040 <puts@plt>
lea    0xcde(%rip),%rdi
call   1040 <puts@plt>
sub    $0x8,%rsp
mov    $0xa3,%edi
lea    0x38(%rsp),%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
lea    0xf8(%rsp),%r8
lea    0xd8(%rsp),%r9
lea    0x158(%rsp),%rbx
push   %rbx
lea    0x180(%rsp),%rbp
push   %rbp
push   %r14
call   1090 <mult_scalar@plt>
add    $0x20,%rsp
lea    0xa9b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbp,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xa7c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1080 <f2m_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x6,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1050 <f2m_is_equal@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1785 <test_ecc_b163+0x615>
mov    $0x6,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1050 <f2m_is_equal@plt>
test   %eax,%eax
je     1785 <test_ecc_b163+0x615>
mov    0xc(%rsp),%ebx
add    $0x1,%ebx
cmp    $0xa,%ebx
jne    1370 <test_ecc_b163+0x200>
lea    0xa19(%rip),%rdi
call   1040 <puts@plt>
lea    0xb23(%rip),%rdi
call   1040 <puts@plt>
lea    0x130(%rsp),%r15
mov    $0x2710,%r13d
lea    0xb0(%rsp),%rbp
lea    0x90(%rsp),%rbx
lea    0x50(%rsp),%r14
lea    0xd0(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
sub    $0x8,%rsp
mov    $0xa3,%edi
lea    0x38(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x78(%rsp),%rcx
mov    %rbp,%r8
mov    %rbx,%r9
push   %r15
push   %r12
push   %r14
call   1090 <mult_scalar@plt>
add    $0x20,%rsp
add    $0xffffffff,%r13d
jne    1750 <test_ecc_b163+0x5e0>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_ecc_b163.f = [6 x i32] [i32 201, i32 0, i32 0, i32 0, i32 0, i32 8]
@__const.test_ecc_b163.a = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@__const.test_ecc_b163.b = [6 x i32] [i32 1244792317, i32 1362065524, i32 344058640, i32 -1194765366, i32 174070023, i32 2]
@__const.test_ecc_b163.xP = [6 x i32] [i32 -399229386, i32 -728152521, i32 -1600581272, i32 -2036148866, i32 -252993182, i32 3]
@__const.test_ecc_b163.yP = [6 x i32] [i32 2037589233, i32 -1323541492, i32 -1563568827, i32 1906313551, i32 -719340436, i32 0]
@__const.test_ecc_b163.n = [6 x i32] [i32 -1541190605, i32 2011630610, i32 168702, i32 0, i32 0, i32 4]
@.str = [63 x i8] c"\0A************************************************************\0A\00"
@.str.1 = [50 x i8] c"test: scalar multiplication of EC over GF(2^163)\0A\00"
@.str.2 = [47 x i8] c"\0Airreducible polynomial to generate GF(2^163)\0A\00"
@.str.3 = [6 x i8] c"f = \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [57 x i8] c"\0Aparameter b to determine elliptic curve E of GF(2^163)\0A\00"
@.str.6 = [30 x i8] c"E: y^2 + xy = x^3 + ax^2 + b\0A\00"
@.str.7 = [6 x i8] c"a = \00"
@.str.8 = [6 x i8] c"b = \00"
@.str.9 = [15 x i8] c"\0Abase point P\0A\00"
@.str.10 = [6 x i8] c"xP = \00"
@.str.11 = [6 x i8] c"yP = \00"
@.str.12 = [24 x i8] c"\0Aorder of base point P\0A\00"
@.str.13 = [6 x i8] c"n = \00"
@.str.14 = [62 x i8] c"************************************************************\0A\00"
@.str.15 = [9 x i8] c"test %d\0A\00"
@.str.16 = [49 x i8] c"generate random private key d and corresponding\0A\00"
@.str.17 = [29 x i8] c"public key Q with Q = d * P\0A\00"
@.str.18 = [6 x i8] c"d = \00"
@.str.19 = [6 x i8] c"xQ = \00"
@.str.20 = [6 x i8] c"yQ = \00"
@.str.21 = [42 x i8] c"generate random scalar d and challenge C\0A\00"
@.str.22 = [16 x i8] c"with C = k * P\0A\00"
@.str.23 = [6 x i8] c"k = \00"
@.str.24 = [6 x i8] c"xC = \00"
@.str.25 = [6 x i8] c"yC = \00"
@.str.26 = [49 x i8] c"generate response R with R = d * C = d * k * P \0A\00"
@.str.27 = [6 x i8] c"xR = \00"
@.str.28 = [6 x i8] c"yR = \00"
@.str.29 = [58 x i8] c"generate verification point V with V = k * Q = k * d * P\0A\00"
@.str.30 = [6 x i8] c"xV = \00"
@.str.31 = [6 x i8] c"yV = \00"
@.str.32 = [32 x i8] c"test scalar multiplications...\0A\00"
define i32 @test_ecc_b163() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [6 x i32]
%6 = alloca [6 x i32]
%7 = alloca [6 x i32]
%8 = alloca [6 x i32]
%9 = alloca [6 x i32]
%10 = alloca [6 x i32]
%11 = alloca [6 x i32]
%12 = alloca [6 x i32]
%13 = alloca [6 x i32]
%14 = alloca [6 x i32]
%15 = alloca [6 x i32]
%16 = alloca [6 x i32]
%17 = alloca [6 x i32]
%18 = alloca [6 x i32]
%19 = alloca [6 x i32]
%20 = alloca [6 x i32]
store i32 163, i32* %2
store i32 6, i32* %3
%21 = bitcast [6 x i32]* %15 to i8*
%22 = bitcast [6 x i32]* %16 to i8*
%23 = bitcast [6 x i32]* %17 to i8*
%24 = bitcast [6 x i32]* %18 to i8*
%25 = bitcast [6 x i32]* %19 to i8*
%26 = bitcast [6 x i32]* %20 to i8*
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* %3
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%33 = call i32 @f2m_print(i32 %31, i32* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%38 = load i32, i32* %3
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%40 = call i32 @f2m_print(i32 %38, i32* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%43 = load i32, i32* %3
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%45 = call i32 @f2m_print(i32 %43, i32* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%49 = load i32, i32* %3
%50 = getelementptr inbounds [6 x i32], [6 x i32]* %18, i64 0, i64 0
%51 = call i32 @f2m_print(i32 %49, i32* %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%54 = load i32, i32* %3
%55 = getelementptr inbounds [6 x i32], [6 x i32]* %19, i64 0, i64 0
%56 = call i32 @f2m_print(i32 %54, i32* %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%60 = load i32, i32* %3
%61 = getelementptr inbounds [6 x i32], [6 x i32]* %20, i64 0, i64 0
%62 = call i32 @f2m_print(i32 %60, i32* %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %64
64: ; preds = %192, %0
%65 = load i32, i32* %4
%66 = icmp slt i32 %65, 10
br i1 %66, label %67, label %195
67: ; preds = %64
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%69 = load i32, i32* %4
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.16, i64 0, i64 0))
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.17, i64 0, i64 0))
%74 = load i32, i32* %3
%75 = load i32, i32* %2
%76 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%77 = call i32 @f2m_rand(i32 %74, i32 %75, i32* %76)
%78 = load i32, i32* %2
%79 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%80 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%81 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%82 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%83 = getelementptr inbounds [6 x i32], [6 x i32]* %18, i64 0, i64 0
%84 = getelementptr inbounds [6 x i32], [6 x i32]* %19, i64 0, i64 0
%85 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%86 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%87 = call i32 @mult_scalar(i32 %78, i32* %79, i32* %80, i32* %81, i32* %82, i32* %83, i32* %84, i32* %85, i32* %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%89 = load i32, i32* %3
%90 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%91 = call i32 @f2m_print(i32 %89, i32* %90)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%94 = load i32, i32* %3
%95 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%96 = call i32 @f2m_print(i32 %94, i32* %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0))
%99 = load i32, i32* %3
%100 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%101 = call i32 @f2m_print(i32 %99, i32* %100)
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.21, i64 0, i64 0))
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0))
%106 = load i32, i32* %3
%107 = load i32, i32* %2
%108 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 0
%109 = call i32 @f2m_rand(i32 %106, i32 %107, i32* %108)
%110 = load i32, i32* %2
%111 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%112 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%113 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%114 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 0
%115 = getelementptr inbounds [6 x i32], [6 x i32]* %18, i64 0, i64 0
%116 = getelementptr inbounds [6 x i32], [6 x i32]* %19, i64 0, i64 0
%117 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 0
%118 = getelementptr inbounds [6 x i32], [6 x i32]* %9, i64 0, i64 0
%119 = call i32 @mult_scalar(i32 %110, i32* %111, i32* %112, i32* %113, i32* %114, i32* %115, i32* %116, i32* %117, i32* %118)
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0))
%121 = load i32, i32* %3
%122 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 0
%123 = call i32 @f2m_print(i32 %121, i32* %122)
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i64 0, i64 0))
%126 = load i32, i32* %3
%127 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 0
%128 = call i32 @f2m_print(i32 %126, i32* %127)
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0))
%131 = load i32, i32* %3
%132 = getelementptr inbounds [6 x i32], [6 x i32]* %9, i64 0, i64 0
%133 = call i32 @f2m_print(i32 %131, i32* %132)
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.26, i64 0, i64 0))
%137 = load i32, i32* %2
%138 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%139 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%140 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%141 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%142 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 0
%143 = getelementptr inbounds [6 x i32], [6 x i32]* %9, i64 0, i64 0
%144 = getelementptr inbounds [6 x i32], [6 x i32]* %11, i64 0, i64 0
%145 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%146 = call i32 @mult_scalar(i32 %137, i32* %138, i32* %139, i32* %140, i32* %141, i32* %142, i32* %143, i32* %144, i32* %145)
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%148 = load i32, i32* %3
%149 = getelementptr inbounds [6 x i32], [6 x i32]* %11, i64 0, i64 0
%150 = call i32 @f2m_print(i32 %148, i32* %149)
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0))
%153 = load i32, i32* %3
%154 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%155 = call i32 @f2m_print(i32 %153, i32* %154)
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.29, i64 0, i64 0))
%159 = load i32, i32* %2
%160 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%161 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%162 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%163 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 0
%164 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%165 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%166 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%167 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 0
%168 = call i32 @mult_scalar(i32 %159, i32* %160, i32* %161, i32* %162, i32* %163, i32* %164, i32* %165, i32* %166, i32* %167)
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.30, i64 0, i64 0))
%170 = load i32, i32* %3
%171 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%172 = call i32 @f2m_print(i32 %170, i32* %171)
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i64 0, i64 0))
%175 = load i32, i32* %3
%176 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 0
%177 = call i32 @f2m_print(i32 %175, i32* %176)
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%179 = load i32, i32* %3
%180 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%181 = getelementptr inbounds [6 x i32], [6 x i32]* %11, i64 0, i64 0
%182 = call i32 @f2m_is_equal(i32 %179, i32* %180, i32* %181)
%183 = icmp ne i32 %182, 0
br i1 %183, label %184, label %190
184: ; preds = %67
%185 = load i32, i32* %3
%186 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 0
%187 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%188 = call i32 @f2m_is_equal(i32 %185, i32* %186, i32* %187)
%189 = icmp ne i32 %188, 0
br i1 %189, label %191, label %190
190: ; preds = %184, %67
store i32 1, i32* %1
br label %216
191: ; preds = %184
br label %192
192: ; preds = %191
%193 = load i32, i32* %4
%194 = add nsw i32 %193, 1
store i32 %194, i32* %4
br label %64
195: ; preds = %64
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.14, i64 0, i64 0))
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.32, i64 0, i64 0))
store i32 0, i32* %4
br label %198
198: ; preds = %212, %195
%199 = load i32, i32* %4
%200 = icmp slt i32 %199, 10000
br i1 %200, label %201, label %215
201: ; preds = %198
%202 = load i32, i32* %2
%203 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%204 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%205 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%206 = getelementptr inbounds [6 x i32], [6 x i32]* %20, i64 0, i64 0
%207 = getelementptr inbounds [6 x i32], [6 x i32]* %18, i64 0, i64 0
%208 = getelementptr inbounds [6 x i32], [6 x i32]* %19, i64 0, i64 0
%209 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%210 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%211 = call i32 @mult_scalar(i32 %202, i32* %203, i32* %204, i32* %205, i32* %206, i32* %207, i32* %208, i32* %209, i32* %210)
br label %212
212: ; preds = %201
%213 = load i32, i32* %4
%214 = add nsw i32 %213, 1
store i32 %214, i32* %4
br label %198
215: ; preds = %198
store i32 0, i32* %1
br label %216
216: ; preds = %215, %190
%217 = load i32, i32* %1
ret i32 %217
}

LLVM IR (-O2):
@__const.test_ecc_b163.f = [6 x i32] [i32 201, i32 0, i32 0, i32 0, i32 0, i32 8]
@__const.test_ecc_b163.a = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@__const.test_ecc_b163.b = [6 x i32] [i32 1244792317, i32 1362065524, i32 344058640, i32 -1194765366, i32 174070023, i32 2]
@__const.test_ecc_b163.xP = [6 x i32] [i32 -399229386, i32 -728152521, i32 -1600581272, i32 -2036148866, i32 -252993182, i32 3]
@__const.test_ecc_b163.yP = [6 x i32] [i32 2037589233, i32 -1323541492, i32 -1563568827, i32 1906313551, i32 -719340436, i32 0]
@__const.test_ecc_b163.n = [6 x i32] [i32 -1541190605, i32 2011630610, i32 168702, i32 0, i32 0, i32 4]
@.str.3 = [6 x i8] c"f = \00"
@.str.7 = [6 x i8] c"a = \00"
@.str.8 = [6 x i8] c"b = \00"
@.str.10 = [6 x i8] c"xP = \00"
@.str.11 = [6 x i8] c"yP = \00"
@.str.13 = [6 x i8] c"n = \00"
@.str.15 = [9 x i8] c"test %d\0A\00"
@.str.18 = [6 x i8] c"d = \00"
@.str.19 = [6 x i8] c"xQ = \00"
@.str.20 = [6 x i8] c"yQ = \00"
@.str.23 = [6 x i8] c"k = \00"
@.str.24 = [6 x i8] c"xC = \00"
@.str.25 = [6 x i8] c"yC = \00"
@.str.27 = [6 x i8] c"xR = \00"
@.str.28 = [6 x i8] c"yR = \00"
@.str.30 = [6 x i8] c"xV = \00"
@.str.31 = [6 x i8] c"yV = \00"
@str = [62 x i8] c"\0A************************************************************\00"
@str.33 = [49 x i8] c"test: scalar multiplication of EC over GF(2^163)\00"
@str.34 = [46 x i8] c"\0Airreducible polynomial to generate GF(2^163)\00"
@str.35 = [56 x i8] c"\0Aparameter b to determine elliptic curve E of GF(2^163)\00"
@str.36 = [29 x i8] c"E: y^2 + xy = x^3 + ax^2 + b\00"
@str.37 = [14 x i8] c"\0Abase point P\00"
@str.38 = [23 x i8] c"\0Aorder of base point P\00"
@str.40 = [31 x i8] c"test scalar multiplications...\00"
@str.43 = [48 x i8] c"generate random private key d and corresponding\00"
@str.44 = [28 x i8] c"public key Q with Q = d * P\00"
@str.46 = [41 x i8] c"generate random scalar d and challenge C\00"
@str.47 = [15 x i8] c"with C = k * P\00"
@str.49 = [48 x i8] c"generate response R with R = d * C = d * k * P \00"
@str.50 = [61 x i8] c"************************************************************\00"
@str.51 = [57 x i8] c"generate verification point V with V = k * Q = k * d * P\00"
define i32 @test_ecc_b163() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
%5 = alloca [6 x i32]
%6 = alloca [6 x i32]
%7 = alloca [6 x i32]
%8 = alloca [6 x i32]
%9 = alloca [6 x i32]
%10 = alloca [6 x i32]
%11 = alloca [6 x i32]
%12 = alloca [6 x i32]
%13 = alloca [6 x i32]
%14 = alloca [6 x i32]
%15 = alloca [6 x i32]
%16 = alloca [6 x i32]
%17 = bitcast [6 x i32]* %1 to i8*
%18 = bitcast [6 x i32]* %2 to i8*
%19 = bitcast [6 x i32]* %3 to i8*
%20 = bitcast [6 x i32]* %4 to i8*
%21 = bitcast [6 x i32]* %5 to i8*
%22 = bitcast [6 x i32]* %6 to i8*
%23 = bitcast [6 x i32]* %7 to i8*
%24 = bitcast [6 x i32]* %8 to i8*
%25 = bitcast [6 x i32]* %9 to i8*
%26 = bitcast [6 x i32]* %10 to i8*
%27 = bitcast [6 x i32]* %11 to i8*
%28 = bitcast [6 x i32]* %12 to i8*
%29 = bitcast [6 x i32]* %13 to i8*
%30 = bitcast [6 x i32]* %14 to i8*
%31 = bitcast [6 x i32]* %15 to i8*
%32 = bitcast [6 x i32]* %16 to i8*
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.33, i64 0, i64 0))
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.34, i64 0, i64 0))
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%37 = getelementptr inbounds [6 x i32], [6 x i32]* %11, i64 0, i64 0
%38 = call i32 @f2m_print(i32 6, i32* %37)
%39 = call i32 @putchar(i32 10)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.35, i64 0, i64 0))
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.36, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%43 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%44 = call i32 @f2m_print(i32 6, i32* %43)
%45 = call i32 @putchar(i32 10)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%47 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%48 = call i32 @f2m_print(i32 6, i32* %47)
%49 = call i32 @putchar(i32 10)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.37, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%52 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 0
%53 = call i32 @f2m_print(i32 6, i32* %52)
%54 = call i32 @putchar(i32 10)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%56 = getelementptr inbounds [6 x i32], [6 x i32]* %15, i64 0, i64 0
%57 = call i32 @f2m_print(i32 6, i32* %56)
%58 = call i32 @putchar(i32 10)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.38, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%61 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 0
%62 = call i32 @f2m_print(i32 6, i32* %61)
%63 = call i32 @putchar(i32 10)
%64 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%65 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%67 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%68 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%69 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%70 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%71 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 0
%72 = getelementptr inbounds [6 x i32], [6 x i32]* %9, i64 0, i64 0
%73 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 0
br label %77
74: ; preds = %129
%75 = add nuw nsw i32 %78, 1
%76 = icmp eq i32 %75, 10
br i1 %76, label %132, label %77
77: ; preds = %0, %74
%78 = phi i32 [ 0, %0 ], [ %75, %74 ]
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 %78)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.43, i64 0, i64 0))
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.44, i64 0, i64 0))
%84 = call i32 @f2m_rand(i32 6, i32 163, i32* %64)
%85 = call i32 @mult_scalar(i32 163, i32* %37, i32* %43, i32* %47, i32* %64, i32* %52, i32* %56, i32* %65, i32* %66)
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%87 = call i32 @f2m_print(i32 6, i32* %64)
%88 = call i32 @putchar(i32 10)
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%90 = call i32 @f2m_print(i32 6, i32* %65)
%91 = call i32 @putchar(i32 10)
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0))
%93 = call i32 @f2m_print(i32 6, i32* %66)
%94 = call i32 @putchar(i32 10)
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.46, i64 0, i64 0))
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.47, i64 0, i64 0))
%98 = call i32 @f2m_rand(i32 6, i32 163, i32* %67)
%99 = call i32 @mult_scalar(i32 163, i32* %37, i32* %43, i32* %47, i32* %67, i32* %52, i32* %56, i32* %68, i32* %69)
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0))
%101 = call i32 @f2m_print(i32 6, i32* %67)
%102 = call i32 @putchar(i32 10)
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i64 0, i64 0))
%104 = call i32 @f2m_print(i32 6, i32* %68)
%105 = call i32 @putchar(i32 10)
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0))
%107 = call i32 @f2m_print(i32 6, i32* %69)
%108 = call i32 @putchar(i32 10)
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.49, i64 0, i64 0))
%111 = call i32 @mult_scalar(i32 163, i32* %37, i32* %43, i32* %47, i32* %64, i32* %68, i32* %69, i32* %70, i32* %71)
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%113 = call i32 @f2m_print(i32 6, i32* %70)
%114 = call i32 @putchar(i32 10)
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0))
%116 = call i32 @f2m_print(i32 6, i32* %71)
%117 = call i32 @putchar(i32 10)
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.51, i64 0, i64 0))
%120 = call i32 @mult_scalar(i32 163, i32* %37, i32* %43, i32* %47, i32* %67, i32* %65, i32* %66, i32* %72, i32* %73)
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.30, i64 0, i64 0))
%122 = call i32 @f2m_print(i32 6, i32* %72)
%123 = call i32 @putchar(i32 10)
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i64 0, i64 0))
%125 = call i32 @f2m_print(i32 6, i32* %73)
%126 = call i32 @putchar(i32 10)
%127 = call i32 @f2m_is_equal(i32 6, i32* %72, i32* %70)
%128 = icmp eq i32 %127, 0
br i1 %128, label %140, label %129
129: ; preds = %77
%130 = call i32 @f2m_is_equal(i32 6, i32* %73, i32* %71)
%131 = icmp eq i32 %130, 0
br i1 %131, label %140, label %74
132: ; preds = %74
%133 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.50, i64 0, i64 0))
%134 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.40, i64 0, i64 0))
br label %135
135: ; preds = %132, %135
%136 = phi i32 [ 0, %132 ], [ %138, %135 ]
%137 = call i32 @mult_scalar(i32 163, i32* %37, i32* %43, i32* %47, i32* %61, i32* %52, i32* %56, i32* %65, i32* %66)
%138 = add nuw nsw i32 %136, 1
%139 = icmp eq i32 %138, 10000
br i1 %139, label %140, label %135
140: ; preds = %77, %129, %135
%141 = phi i32 [ 0, %135 ], [ 1, %129 ], [ 1, %77 ]
ret i32 %141
}