#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 /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_CTX_new();
char *BN_bn2hex(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_hex2bn(int /*<<< orphan*/ **, char *);
int /*<<< orphan*/ BN_mod(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_mod_inverse(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_mul(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_new();
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ OPENSSL_free(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  BIGNUM *a, *b, *c, *p, *r;
  BN_CTX *ctx;
  char *hex = NULL;
  a = BN_new();
  b = BN_new();
  c = BN_new();
  p = BN_new();
  r = BN_new();
  ctx = BN_CTX_new();
  BN_hex2bn(&a,
            "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296");
  BN_hex2bn(&b,
            "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5");
  BN_hex2bn(&p,
            "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff");
  BN_mul(c, a, b, ctx);
  BN_mod(r, c, p, ctx);
  BN_mod_inverse(r, a, p, ctx);
  hex = BN_bn2hex(c);
  fprintf(stdout, "%s\r\n", hex);
  OPENSSL_free(hex);
  hex = BN_bn2hex(r);
  fprintf(stdout, "%s\r\n", hex);
  OPENSSL_free(hex);
  BN_free(a);
  BN_free(b);
  BN_free(c);
  BN_free(p);
  BN_free(r);
  BN_CTX_free(ctx);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x48(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   10b0 <BN_CTX_new@plt>
mov    %rax,-0x40(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   1030 <BN_hex2bn@plt>
lea    -0x20(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1030 <BN_hex2bn@plt>
lea    -0x30(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1030 <BN_hex2bn@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1070 <BN_mul@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   10c0 <BN_mod@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1040 <BN_mod_inverse@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <BN_bn2hex@plt>
mov    %rax,-0x48(%rbp)
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0xe13(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   10d0 <OPENSSL_free@plt>
mov    -0x38(%rbp),%rdi
call   10a0 <BN_bn2hex@plt>
mov    %rax,-0x48(%rbp)
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0xde4(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   10d0 <OPENSSL_free@plt>
mov    -0x18(%rbp),%rdi
call   1080 <BN_free@plt>
mov    -0x20(%rbp),%rdi
call   1080 <BN_free@plt>
mov    -0x28(%rbp),%rdi
call   1080 <BN_free@plt>
mov    -0x30(%rbp),%rdi
call   1080 <BN_free@plt>
mov    -0x38(%rbp),%rdi
call   1080 <BN_free@plt>
mov    -0x40(%rbp),%rdi
call   1060 <BN_CTX_free@plt>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,0x8(%rsp)
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,(%rsp)
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,%r15
xor    %eax,%eax
call   10b0 <BN_CTX_new@plt>
mov    %rax,%r12
lea    0xdea(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <BN_hex2bn@plt>
lea    0xe1a(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <BN_hex2bn@plt>
lea    0xe4a(%rip),%rsi
mov    %rsp,%rdi
call   1030 <BN_hex2bn@plt>
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    %r14,%rdi
mov    %r12,%rcx
call   1070 <BN_mul@plt>
mov    (%rsp),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rcx
call   10c0 <BN_mod@plt>
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %r15,%rdi
mov    %r12,%rcx
call   1040 <BN_mod_inverse@plt>
mov    %r14,%rdi
call   10a0 <BN_bn2hex@plt>
mov    %rax,%rbx
mov    0x2d53(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe2c(%rip),%r13
mov    %r13,%rsi
mov    %rax,%rdx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   10d0 <OPENSSL_free@plt>
mov    %r15,%rdi
call   10a0 <BN_bn2hex@plt>
mov    %rax,%rbx
mov    0x0(%rbp),%edi
mov    %r13,%rsi
mov    %rax,%rdx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   10d0 <OPENSSL_free@plt>
mov    0x8(%rsp),%rdi
call   1080 <BN_free@plt>
mov    0x10(%rsp),%rdi
call   1080 <BN_free@plt>
mov    %r14,%rdi
call   1080 <BN_free@plt>
mov    (%rsp),%rdi
call   1080 <BN_free@plt>
mov    %r15,%rdi
call   1080 <BN_free@plt>
mov    %r12,%rdi
call   1060 <BN_CTX_free@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [65 x i8] c"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296\00"
@.str.1 = [65 x i8] c"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5\00"
@.str.2 = [65 x i8] c"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff\00"
@stdout = global i32 0
@.str.3 = [5 x i8] c"%s\0D\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 i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %12
%13 = call i32* (...) @BN_new()
store i32* %13, i32** %6
%14 = call i32* (...) @BN_new()
store i32* %14, i32** %7
%15 = call i32* (...) @BN_new()
store i32* %15, i32** %8
%16 = call i32* (...) @BN_new()
store i32* %16, i32** %9
%17 = call i32* (...) @BN_new()
store i32* %17, i32** %10
%18 = call i32* (...) @BN_CTX_new()
store i32* %18, i32** %11
%19 = call i32 @BN_hex2bn(i32** %6, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @BN_hex2bn(i32** %7, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @BN_hex2bn(i32** %9, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32*, i32** %8
%23 = load i32*, i32** %6
%24 = load i32*, i32** %7
%25 = load i32*, i32** %11
%26 = call i32 @BN_mul(i32* %22, i32* %23, i32* %24, i32* %25)
%27 = load i32*, i32** %10
%28 = load i32*, i32** %8
%29 = load i32*, i32** %9
%30 = load i32*, i32** %11
%31 = call i32 @BN_mod(i32* %27, i32* %28, i32* %29, i32* %30)
%32 = load i32*, i32** %10
%33 = load i32*, i32** %6
%34 = load i32*, i32** %9
%35 = load i32*, i32** %11
%36 = call i32 @BN_mod_inverse(i32* %32, i32* %33, i32* %34, i32* %35)
%37 = load i32*, i32** %8
%38 = call i8* @BN_bn2hex(i32* %37)
store i8* %38, i8** %12
%39 = load i32, i32* @stdout
%40 = load i8*, i8** %12
%41 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = load i8*, i8** %12
%43 = call i32 @OPENSSL_free(i8* %42)
%44 = load i32*, i32** %10
%45 = call i8* @BN_bn2hex(i32* %44)
store i8* %45, i8** %12
%46 = load i32, i32* @stdout
%47 = load i8*, i8** %12
%48 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %47)
%49 = load i8*, i8** %12
%50 = call i32 @OPENSSL_free(i8* %49)
%51 = load i32*, i32** %6
%52 = call i32 @BN_free(i32* %51)
%53 = load i32*, i32** %7
%54 = call i32 @BN_free(i32* %53)
%55 = load i32*, i32** %8
%56 = call i32 @BN_free(i32* %55)
%57 = load i32*, i32** %9
%58 = call i32 @BN_free(i32* %57)
%59 = load i32*, i32** %10
%60 = call i32 @BN_free(i32* %59)
%61 = load i32*, i32** %11
%62 = call i32 @BN_CTX_free(i32* %61)
%63 = load i32, i32* @EXIT_SUCCESS
%64 = call i32 @exit(i32 %63)
unreachable
}

LLVM IR (-O2):
@.str = [65 x i8] c"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296\00"
@.str.1 = [65 x i8] c"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5\00"
@.str.2 = [65 x i8] c"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff\00"
@stdout = global i32 0
@.str.3 = [5 x i8] c"%s\0D\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = bitcast i32** %3 to i8*
%7 = bitcast i32** %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = tail call i32* (...) @BN_new()
store i32* %9, i32** %3
%10 = tail call i32* (...) @BN_new()
store i32* %10, i32** %4
%11 = tail call i32* (...) @BN_new()
%12 = tail call i32* (...) @BN_new()
store i32* %12, i32** %5
%13 = tail call i32* (...) @BN_new()
%14 = tail call i32* (...) @BN_CTX_new()
%15 = call i32 @BN_hex2bn(i32** %3, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @BN_hex2bn(i32** %4, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @BN_hex2bn(i32** %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = load i32*, i32** %4
%20 = call i32 @BN_mul(i32* %11, i32* %18, i32* %19, i32* %14)
%21 = load i32*, i32** %5
%22 = call i32 @BN_mod(i32* %13, i32* %11, i32* %21, i32* %14)
%23 = load i32*, i32** %3
%24 = load i32*, i32** %5
%25 = call i32 @BN_mod_inverse(i32* %13, i32* %23, i32* %24, i32* %14)
%26 = call i8* @BN_bn2hex(i32* %11)
%27 = load i32, i32* @stdout
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%29 = call i32 @OPENSSL_free(i8* %26)
%30 = call i8* @BN_bn2hex(i32* %13)
%31 = load i32, i32* @stdout
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%33 = call i32 @OPENSSL_free(i8* %30)
%34 = load i32*, i32** %3
%35 = call i32 @BN_free(i32* %34)
%36 = load i32*, i32** %4
%37 = call i32 @BN_free(i32* %36)
%38 = call i32 @BN_free(i32* %11)
%39 = load i32*, i32** %5
%40 = call i32 @BN_free(i32* %39)
%41 = call i32 @BN_free(i32* %13)
%42 = call i32 @BN_CTX_free(i32* %14)
%43 = load i32, i32* @EXIT_SUCCESS
%44 = call i32 @exit(i32 %43)
unreachable
}