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

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ ec_double_sm2(int *, int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ hex_out(int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ mp_mod_sm2(int *, int *);
int /*<<< orphan*/ mp_mul_256(int *, int *, int *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  uint64_t a[4], b[4], c[8], r[4];
  uint64_t R[12], S[12];
  a[3] = 0x32C4AE2C1F198119;
  a[2] = 0x5F9904466A39C994;
  a[1] = 0x8FE30BBFF2660BE1;
  a[0] = 0x715A4589334C74C7;
  b[3] = 0xBC3736A2F4F6779C;
  b[2] = 0x59BDCEE36B692153;
  b[1] = 0xD0A9877CC62A4740;
  b[0] = 0x02DF32E52139F0A0;
  S[3] = 0x32C4AE2C1F198119;
  S[2] = 0x5F9904466A39C994;
  S[1] = 0x8FE30BBFF2660BE1;
  S[0] = 0x715A4589334C74C7;
  S[7] = 0xBC3736A2F4F6779C;
  S[6] = 0x59BDCEE36B692153;
  S[5] = 0xD0A9877CC62A4740;
  S[4] = 0x02DF32E52139F0A0;
  S[11] = 0x0;
  S[10] = 0x0;
  S[9] = 0x0;
  S[8] = 0x1;
  mp_mul_256(c, a, b);
  mp_mod_sm2(r, c);
  ec_double_sm2(R, S);
  hex_out(stdout, c, 8);
  fprintf(stdout, " c = a * b\n");
  hex_out(stdout, r, 4);
  fprintf(stdout, " r = c mod p\n");
  hex_out(stdout, R, 4);
  fprintf(stdout, " Rx\n");
  hex_out(stdout, R + 4, 4);
  fprintf(stdout, " Ry\n");
  hex_out(stdout, R + 8, 4);
  fprintf(stdout, " Rz\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1f198119,-0x14(%rbp)
movl   $0x6a39c994,-0x18(%rbp)
movl   $0xf2660be1,-0x1c(%rbp)
movl   $0x334c74c7,-0x20(%rbp)
movl   $0xf4f6779c,-0x24(%rbp)
movl   $0x6b692153,-0x28(%rbp)
movl   $0xc62a4740,-0x2c(%rbp)
movl   $0x2139f0a0,-0x30(%rbp)
movl   $0x1f198119,-0xb4(%rbp)
81 19 1f
movl   $0x6a39c994,-0xb8(%rbp)
c9 39 6a
movl   $0xf2660be1,-0xbc(%rbp)
0b 66 f2
movl   $0x334c74c7,-0xc0(%rbp)
74 4c 33
movl   $0xf4f6779c,-0xa4(%rbp)
77 f6 f4
movl   $0x6b692153,-0xa8(%rbp)
21 69 6b
movl   $0xc62a4740,-0xac(%rbp)
47 2a c6
movl   $0x2139f0a0,-0xb0(%rbp)
f0 39 21
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0x1,-0xa0(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <mp_mul_256@plt>
lea    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <mp_mod_sm2@plt>
lea    -0x90(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1080 <ec_double_sm2@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rsi
mov    $0x8,%edx
call   1040 <hex_out@plt>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
lea    0xd7f(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rsi
add    $0x10,%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    0x2cda(%rip),%rax
mov    (%rax),%edi
lea    0xd10(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rsi
add    $0x20,%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
lea    0xce2(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb8,%rsp
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8f(%rip),%xmm1
movaps %xmm1,(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm1,0x30(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x90(%rsp),%r12
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
mov    %r12,%rdi
call   1050 <mp_mul_256@plt>
lea    0x80(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <mp_mod_sm2@plt>
lea    0x50(%rsp),%r14
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1080 <ec_double_sm2@plt>
mov    0x2e01(%rip),%rbx
mov    (%rbx),%edi
mov    %r12,%rsi
mov    $0x8,%edx
call   1040 <hex_out@plt>
mov    (%rbx),%edi
lea    0xe39(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    (%rbx),%edi
lea    0xe28(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    (%rbx),%edi
lea    0xe19(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0x60(%rsp),%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    (%rbx),%edi
lea    0xdff(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0x70(%rsp),%rsi
mov    $0x4,%edx
call   1040 <hex_out@plt>
mov    (%rbx),%edi
lea    0xde5(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c" c = a * b\0A\00"
@.str.1 = [14 x i8] c" r = c mod p\0A\00"
@.str.2 = [5 x i8] c" Rx\0A\00"
@.str.3 = [5 x i8] c" Ry\0A\00"
@.str.4 = [5 x i8] c" Rz\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i32]
%7 = alloca [4 x i32]
%8 = alloca [8 x i32]
%9 = alloca [4 x i32]
%10 = alloca [12 x i32]
%11 = alloca [12 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 3
store i32 521765145, i32* %12
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 2
store i32 1782172052, i32* %13
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 1
store i32 -228193311, i32* %14
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
store i32 860648647, i32* %15
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
store i32 -185174116, i32* %16
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
store i32 1802051923, i32* %17
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
store i32 -970307776, i32* %18
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
store i32 557445280, i32* %19
%20 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 3
store i32 521765145, i32* %20
%21 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 2
store i32 1782172052, i32* %21
%22 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 1
store i32 -228193311, i32* %22
%23 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 0
store i32 860648647, i32* %23
%24 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 7
store i32 -185174116, i32* %24
%25 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 6
store i32 1802051923, i32* %25
%26 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 5
store i32 -970307776, i32* %26
%27 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 4
store i32 557445280, i32* %27
%28 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 11
store i32 0, i32* %28
%29 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 10
store i32 0, i32* %29
%30 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 9
store i32 0, i32* %30
%31 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 8
store i32 1, i32* %31
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%35 = call i32 @mp_mul_256(i32* %32, i32* %33, i32* %34)
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%37 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%38 = call i32 @mp_mod_sm2(i32* %36, i32* %37)
%39 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 0
%40 = getelementptr inbounds [12 x i32], [12 x i32]* %11, i64 0, i64 0
%41 = call i32 @ec_double_sm2(i32* %39, i32* %40)
%42 = load i32, i32* @stdout
%43 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%44 = call i32 @hex_out(i32 %42, i32* %43, i32 8)
%45 = load i32, i32* @stdout
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%47 = load i32, i32* @stdout
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%49 = call i32 @hex_out(i32 %47, i32* %48, i32 4)
%50 = load i32, i32* @stdout
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%52 = load i32, i32* @stdout
%53 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 0
%54 = call i32 @hex_out(i32 %52, i32* %53, i32 4)
%55 = load i32, i32* @stdout
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%57 = load i32, i32* @stdout
%58 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 0
%59 = getelementptr inbounds i32, i32* %58, i64 4
%60 = call i32 @hex_out(i32 %57, i32* %59, i32 4)
%61 = load i32, i32* @stdout
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32, i32* @stdout
%64 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 0
%65 = getelementptr inbounds i32, i32* %64, i64 8
%66 = call i32 @hex_out(i32 %63, i32* %65, i32 4)
%67 = load i32, i32* @stdout
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%69 = load i32, i32* @EXIT_SUCCESS
%70 = call i32 @exit(i32 %69)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c" c = a * b\0A\00"
@.str.1 = [14 x i8] c" r = c mod p\0A\00"
@.str.2 = [5 x i8] c" Rx\0A\00"
@.str.3 = [5 x i8] c" Ry\0A\00"
@.str.4 = [5 x i8] c" Rz\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca <4 x i32>
%4 = alloca <4 x i32>
%5 = alloca [8 x i32]
%6 = alloca [4 x i32]
%7 = alloca [12 x i32]
%8 = alloca [12 x i32]
%9 = bitcast <4 x i32>* %3 to i8*
%10 = bitcast <4 x i32>* %4 to i8*
%11 = bitcast [8 x i32]* %5 to i8*
%12 = bitcast [4 x i32]* %6 to i8*
%13 = bitcast [12 x i32]* %7 to i8*
%14 = bitcast [12 x i32]* %8 to i8*
%15 = getelementptr inbounds <4 x i32>, <4 x i32>* %3, i64 0, i64 0
store <4 x i32> <i32 860648647, i32 -228193311, i32 1782172052, i32 521765145>, <4 x i32>* %3
%16 = getelementptr inbounds <4 x i32>, <4 x i32>* %4, i64 0, i64 0
store <4 x i32> <i32 557445280, i32 -970307776, i32 1802051923, i32 -185174116>, <4 x i32>* %4
%17 = getelementptr inbounds [12 x i32], [12 x i32]* %8, i64 0, i64 0
%18 = bitcast [12 x i32]* %8 to <4 x i32>*
store <4 x i32> <i32 860648647, i32 -228193311, i32 1782172052, i32 521765145>, <4 x i32>* %18
%19 = getelementptr inbounds [12 x i32], [12 x i32]* %8, i64 0, i64 4
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 557445280, i32 -970307776, i32 1802051923, i32 -185174116>, <4 x i32>* %20
%21 = getelementptr inbounds [12 x i32], [12 x i32]* %8, i64 0, i64 8
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 1, i32 0, i32 0, i32 0>, <4 x i32>* %22
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%24 = call i32 @mp_mul_256(i32* %23, i32* %15, i32* %16)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%26 = call i32 @mp_mod_sm2(i32* %25, i32* %23)
%27 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 0
%28 = call i32 @ec_double_sm2(i32* %27, i32* %17)
%29 = load i32, i32* @stdout
%30 = call i32 @hex_out(i32 %29, i32* %23, i32 8)
%31 = load i32, i32* @stdout
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%33 = load i32, i32* @stdout
%34 = call i32 @hex_out(i32 %33, i32* %25, i32 4)
%35 = load i32, i32* @stdout
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%37 = load i32, i32* @stdout
%38 = call i32 @hex_out(i32 %37, i32* %27, i32 4)
%39 = load i32, i32* @stdout
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* @stdout
%42 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 4
%43 = call i32 @hex_out(i32 %41, i32* %42, i32 4)
%44 = load i32, i32* @stdout
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* @stdout
%47 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 8
%48 = call i32 @hex_out(i32 %46, i32* %47, i32 4)
%49 = load i32, i32* @stdout
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* @EXIT_SUCCESS
%52 = call i32 @exit(i32 %51)
unreachable
}