#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*/ const BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_bin2bn(unsigned char *, int, int /*<<< orphan*/ const *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ const *);
int BN_kronecker(int /*<<< orphan*/ const *, int /*<<< orphan*/ const *,
                 int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_mod_add(int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_mod_inverse(int /*<<< orphan*/ const *,
                                  int /*<<< orphan*/ const *,
                                  int /*<<< orphan*/ const *,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_mod_mul(int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ const *BN_new();
int encrypt_component(int *c, int j, int kappa, const BIGNUM *R,
                      BIGNUM *const *us, BIGNUM *const *xs, BIGNUM *const *ys,
                      int bit, const BIGNUM *N, BN_CTX *ctx) {
  BIGNUM *one;
  BIGNUM *two;
  BIGNUM *hsqr;
  BIGNUM *tmp1;
  BIGNUM *tmp2;
  BIGNUM *tmp3;
  BIGNUM *tmp4;
  int j1;
  int j2;
  if ((bit != 1 && bit != -1) || kappa <= 0)
    return -1;
  one = BN_new();
  BN_bin2bn((unsigned char *)"\x1", 1, one);
  two = BN_new();
  BN_bin2bn((unsigned char *)"\x2", 1, two);
  tmp1 = BN_new();
  tmp2 = BN_new();
  tmp3 = BN_new();
  tmp4 = BN_new();
  if (j < kappa) {
    BN_mod_mul(tmp1, two, us[j], N, ctx);
    BN_mod_mul(tmp2, tmp1, ys[j], N, ctx);
    BN_mod_add(tmp3, tmp2, two, N, ctx);
    *c = bit * BN_kronecker(tmp3, N, ctx);
  } else {
    j1 = j / kappa;
    j2 = j % kappa;
    BN_mod_mul(tmp2, us[j1], us[j2], N, ctx);
    BN_mod_mul(tmp1, tmp2, two, N, ctx);
    BN_mod_mul(tmp2, ys[j1], ys[j2], N, ctx);
    BN_mod_mul(tmp3, xs[j1], xs[j2], N, ctx);
    BN_mod_mul(tmp4, R, tmp3, N, ctx);
    BN_mod_add(tmp3, tmp4, one, N, ctx);
    BN_mod_inverse(tmp4, tmp3, N, ctx);
    BN_mod_mul(tmp3, tmp2, tmp4, N, ctx);
    BN_mod_mul(tmp2, tmp3, tmp1, N, ctx);
    BN_mod_add(tmp3, tmp2, two, N, ctx);
    *c = bit * BN_kronecker(tmp3, N, ctx);
  }
  BN_free(tmp1);
  BN_free(tmp2);
  BN_free(tmp3);
  BN_free(tmp4);
  BN_free(one);
  BN_free(two);
}


x86 assembly (clang, -O0):
<encrypt_component>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x1,0x18(%rbp)
je     11b4 <encrypt_component+0x44>
cmpl   $0xffffffff,0x18(%rbp)
jne    11be <encrypt_component+0x4e>
cmpl   $0x0,-0x18(%rbp)
jg     11ca <encrypt_component+0x5a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1458 <encrypt_component+0x2e8>
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdx
lea    0xe20(%rip),%rdi
mov    $0x1,%esi
call   1060 <BN_bin2bn@plt>
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdx
lea    0xe02(%rip),%rdi
mov    $0x1,%esi
call   1060 <BN_bin2bn@plt>
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1050 <BN_new@plt>
mov    %rax,-0x68(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12c5 <encrypt_component+0x155>
mov    -0x50(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1090 <BN_mod_add@plt>
mov    0x18(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x60(%rbp),%rdi
mov    0x20(%rbp),%rsi
mov    0x28(%rbp),%rdx
call   1030 <BN_kronecker@plt>
mov    -0x74(%rbp),%ecx
imul   %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1422 <encrypt_component+0x2b2>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x6c(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x70(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x28(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x58(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x60(%rbp),%rdi
mov    -0x30(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x30(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x68(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1090 <BN_mod_add@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
call   1040 <BN_mod_inverse@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x68(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1080 <BN_mod_mul@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1090 <BN_mod_add@plt>
mov    0x18(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x60(%rbp),%rdi
mov    0x20(%rbp),%rsi
mov    0x28(%rbp),%rdx
call   1030 <BN_kronecker@plt>
mov    -0x78(%rbp),%ecx
imul   %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x50(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x58(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x60(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x68(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x38(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x40(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt_component>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%rbx
mov    0x78(%rsp),%ecx
cmp    $0x1,%ecx
setne  %al
cmp    $0xffffffff,%ecx
setne  %cl
test   %edx,%edx
jle    13cf <encrypt_component+0x25f>
and    %cl,%al
jne    13cf <encrypt_component+0x25f>
mov    %r8,%r13
mov    %edx,%ebp
mov    %esi,%r12d
mov    %r9,0x28(%rsp)
mov    %rdi,0x30(%rsp)
xor    %eax,%eax
call   1050 <BN_new@plt>
lea    0xe3f(%rip),%rdi
mov    $0x1,%esi
mov    %rax,0x18(%rsp)
mov    %rax,%rdx
call   1060 <BN_bin2bn@plt>
xor    %eax,%eax
call   1050 <BN_new@plt>
lea    0xe21(%rip),%rdi
mov    $0x1,%esi
mov    %rax,0x8(%rsp)
mov    %rax,%rdx
call   1060 <BN_bin2bn@plt>
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,(%rsp)
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1050 <BN_new@plt>
mov    %rax,0x10(%rsp)
cmp    %ebp,%r12d
jge    1276 <encrypt_component+0x106>
movslq %r12d,%r12
mov    0x0(%r13,%r12,8),%rdx
mov    (%rsp),%r13
mov    %r13,%rdi
mov    0x8(%rsp),%rsi
mov    0x80(%rsp),%rbx
mov    %rbx,%rcx
mov    0x88(%rsp),%rbp
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    0x70(%rsp),%rax
mov    (%rax,%r12,8),%rdx
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    0x10(%rsp),%r13
jmp    1369 <encrypt_component+0x1f9>
mov    %r12d,%eax
cltd
idiv   %ebp
mov    %edx,%r12d
mov    %rbx,0x20(%rsp)
mov    %eax,%ebx
mov    0x0(%r13,%rbx,8),%rsi
mov    0x0(%r13,%r12,8),%rdx
mov    %r14,%rdi
mov    0x80(%rsp),%r13
mov    %r13,%rcx
mov    0x88(%rsp),%rbp
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    (%rsp),%rdi
mov    %r14,%rsi
mov    0x8(%rsp),%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    0x70(%rsp),%rax
mov    (%rax,%rbx,8),%rsi
mov    (%rax,%r12,8),%rdx
mov    %r14,%rdi
mov    %r13,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    0x28(%rsp),%rax
mov    (%rax,%rbx,8),%rsi
mov    (%rax,%r12,8),%rdx
mov    %r13,%rbx
mov    %r15,%rdi
mov    %r13,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    0x10(%rsp),%r13
mov    %r13,%rdi
mov    0x20(%rsp),%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    0x18(%rsp),%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1090 <BN_mod_add@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <BN_mod_inverse@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    (%rsp),%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1080 <BN_mod_mul@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    0x8(%rsp),%r12
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1090 <BN_mod_add@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1030 <BN_kronecker@plt>
imul   0x78(%rsp),%eax
mov    0x30(%rsp),%rcx
mov    %eax,(%rcx)
mov    (%rsp),%rdi
call   1070 <BN_free@plt>
mov    %r14,%rdi
call   1070 <BN_free@plt>
mov    %r15,%rdi
call   1070 <BN_free@plt>
mov    %r13,%rdi
call   1070 <BN_free@plt>
mov    0x18(%rsp),%rdi
call   1070 <BN_free@plt>
mov    %r12,%rdi
call   1070 <BN_free@plt>
mov    $0xffffffff,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\01\00"
@.str.1 = [2 x i8] c"\02\00"
define i32 @encrypt_component(i32* %0, i32 %1, i32 %2, i32* %3, i32** %4, i32** %5, i32** %6, i32 %7, i32* %8, i32* %9) {
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32**
%17 = alloca i32**
%18 = alloca i32**
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32*
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca i32
%30 = alloca i32
store i32* %0, i32** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32* %3, i32** %15
store i32** %4, i32*** %16
store i32** %5, i32*** %17
store i32** %6, i32*** %18
store i32 %7, i32* %19
store i32* %8, i32** %20
store i32* %9, i32** %21
%31 = load i32, i32* %19
%32 = icmp ne i32 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %10
%34 = load i32, i32* %19
%35 = icmp ne i32 %34, -1
br i1 %35, label %39, label %36
36: ; preds = %33, %10
%37 = load i32, i32* %14
%38 = icmp sle i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %36, %33
store i32 -1, i32* %11
br label %198
40: ; preds = %36
%41 = call i32* (...) @BN_new()
store i32* %41, i32** %22
%42 = load i32*, i32** %22
%43 = call i32 @BN_bin2bn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32* %42)
%44 = call i32* (...) @BN_new()
store i32* %44, i32** %23
%45 = load i32*, i32** %23
%46 = call i32 @BN_bin2bn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %45)
%47 = call i32* (...) @BN_new()
store i32* %47, i32** %25
%48 = call i32* (...) @BN_new()
store i32* %48, i32** %26
%49 = call i32* (...) @BN_new()
store i32* %49, i32** %27
%50 = call i32* (...) @BN_new()
store i32* %50, i32** %28
%51 = load i32, i32* %13
%52 = load i32, i32* %14
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %88
54: ; preds = %40
%55 = load i32*, i32** %25
%56 = load i32*, i32** %23
%57 = load i32**, i32*** %16
%58 = load i32, i32* %13
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32*, i32** %57, i64 %59
%61 = load i32*, i32** %60
%62 = load i32*, i32** %20
%63 = load i32*, i32** %21
%64 = call i32 @BN_mod_mul(i32* %55, i32* %56, i32* %61, i32* %62, i32* %63)
%65 = load i32*, i32** %26
%66 = load i32*, i32** %25
%67 = load i32**, i32*** %18
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32*, i32** %67, i64 %69
%71 = load i32*, i32** %70
%72 = load i32*, i32** %20
%73 = load i32*, i32** %21
%74 = call i32 @BN_mod_mul(i32* %65, i32* %66, i32* %71, i32* %72, i32* %73)
%75 = load i32*, i32** %27
%76 = load i32*, i32** %26
%77 = load i32*, i32** %23
%78 = load i32*, i32** %20
%79 = load i32*, i32** %21
%80 = call i32 @BN_mod_add(i32* %75, i32* %76, i32* %77, i32* %78, i32* %79)
%81 = load i32, i32* %19
%82 = load i32*, i32** %27
%83 = load i32*, i32** %20
%84 = load i32*, i32** %21
%85 = call i32 @BN_kronecker(i32* %82, i32* %83, i32* %84)
%86 = mul nsw i32 %81, %85
%87 = load i32*, i32** %12
store i32 %86, i32* %87
br label %185
88: ; preds = %40
%89 = load i32, i32* %13
%90 = load i32, i32* %14
%91 = sdiv i32 %89, %90
store i32 %91, i32* %29
%92 = load i32, i32* %13
%93 = load i32, i32* %14
%94 = srem i32 %92, %93
store i32 %94, i32* %30
%95 = load i32*, i32** %26
%96 = load i32**, i32*** %16
%97 = load i32, i32* %29
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32*, i32** %96, i64 %98
%100 = load i32*, i32** %99
%101 = load i32**, i32*** %16
%102 = load i32, i32* %30
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32*, i32** %101, i64 %103
%105 = load i32*, i32** %104
%106 = load i32*, i32** %20
%107 = load i32*, i32** %21
%108 = call i32 @BN_mod_mul(i32* %95, i32* %100, i32* %105, i32* %106, i32* %107)
%109 = load i32*, i32** %25
%110 = load i32*, i32** %26
%111 = load i32*, i32** %23
%112 = load i32*, i32** %20
%113 = load i32*, i32** %21
%114 = call i32 @BN_mod_mul(i32* %109, i32* %110, i32* %111, i32* %112, i32* %113)
%115 = load i32*, i32** %26
%116 = load i32**, i32*** %18
%117 = load i32, i32* %29
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32*, i32** %116, i64 %118
%120 = load i32*, i32** %119
%121 = load i32**, i32*** %18
%122 = load i32, i32* %30
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i32*, i32** %121, i64 %123
%125 = load i32*, i32** %124
%126 = load i32*, i32** %20
%127 = load i32*, i32** %21
%128 = call i32 @BN_mod_mul(i32* %115, i32* %120, i32* %125, i32* %126, i32* %127)
%129 = load i32*, i32** %27
%130 = load i32**, i32*** %17
%131 = load i32, i32* %29
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32*, i32** %130, i64 %132
%134 = load i32*, i32** %133
%135 = load i32**, i32*** %17
%136 = load i32, i32* %30
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i32*, i32** %135, i64 %137
%139 = load i32*, i32** %138
%140 = load i32*, i32** %20
%141 = load i32*, i32** %21
%142 = call i32 @BN_mod_mul(i32* %129, i32* %134, i32* %139, i32* %140, i32* %141)
%143 = load i32*, i32** %28
%144 = load i32*, i32** %15
%145 = load i32*, i32** %27
%146 = load i32*, i32** %20
%147 = load i32*, i32** %21
%148 = call i32 @BN_mod_mul(i32* %143, i32* %144, i32* %145, i32* %146, i32* %147)
%149 = load i32*, i32** %27
%150 = load i32*, i32** %28
%151 = load i32*, i32** %22
%152 = load i32*, i32** %20
%153 = load i32*, i32** %21
%154 = call i32 @BN_mod_add(i32* %149, i32* %150, i32* %151, i32* %152, i32* %153)
%155 = load i32*, i32** %28
%156 = load i32*, i32** %27
%157 = load i32*, i32** %20
%158 = load i32*, i32** %21
%159 = call i32 @BN_mod_inverse(i32* %155, i32* %156, i32* %157, i32* %158)
%160 = load i32*, i32** %27
%161 = load i32*, i32** %26
%162 = load i32*, i32** %28
%163 = load i32*, i32** %20
%164 = load i32*, i32** %21
%165 = call i32 @BN_mod_mul(i32* %160, i32* %161, i32* %162, i32* %163, i32* %164)
%166 = load i32*, i32** %26
%167 = load i32*, i32** %27
%168 = load i32*, i32** %25
%169 = load i32*, i32** %20
%170 = load i32*, i32** %21
%171 = call i32 @BN_mod_mul(i32* %166, i32* %167, i32* %168, i32* %169, i32* %170)
%172 = load i32*, i32** %27
%173 = load i32*, i32** %26
%174 = load i32*, i32** %23
%175 = load i32*, i32** %20
%176 = load i32*, i32** %21
%177 = call i32 @BN_mod_add(i32* %172, i32* %173, i32* %174, i32* %175, i32* %176)
%178 = load i32, i32* %19
%179 = load i32*, i32** %27
%180 = load i32*, i32** %20
%181 = load i32*, i32** %21
%182 = call i32 @BN_kronecker(i32* %179, i32* %180, i32* %181)
%183 = mul nsw i32 %178, %182
%184 = load i32*, i32** %12
store i32 %183, i32* %184
br label %185
185: ; preds = %88, %54
%186 = load i32*, i32** %25
%187 = call i32 @BN_free(i32* %186)
%188 = load i32*, i32** %26
%189 = call i32 @BN_free(i32* %188)
%190 = load i32*, i32** %27
%191 = call i32 @BN_free(i32* %190)
%192 = load i32*, i32** %28
%193 = call i32 @BN_free(i32* %192)
%194 = load i32*, i32** %22
%195 = call i32 @BN_free(i32* %194)
%196 = load i32*, i32** %23
%197 = call i32 @BN_free(i32* %196)
br label %198
198: ; preds = %185, %39
%199 = load i32, i32* %11
ret i32 %199
}

LLVM IR (-O2):
@.str = [2 x i8] c"\01\00"
@.str.1 = [2 x i8] c"\02\00"
define i32 @encrypt_component(i32* nocapture writeonly %0, i32 %1, i32 %2, i32* %3, i32** nocapture %4, i32** nocapture %5, i32** nocapture %6, i32 %7, i32* %8, i32* %9) {
%11 = icmp ne i32 %7, 1
%12 = icmp ne i32 %7, -1
%13 = and i1 %11, %12
%14 = icmp slt i32 %2, 1
%15 = or i1 %14, %13
br i1 %15, label %70, label %16
16: ; preds = %10
%17 = tail call i32* (...) @BN_new()
%18 = tail call i32 @BN_bin2bn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32* %17)
%19 = tail call i32* (...) @BN_new()
%20 = tail call i32 @BN_bin2bn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %19)
%21 = tail call i32* (...) @BN_new()
%22 = tail call i32* (...) @BN_new()
%23 = tail call i32* (...) @BN_new()
%24 = tail call i32* (...) @BN_new()
%25 = icmp slt i32 %1, %2
br i1 %25, label %26, label %34
26: ; preds = %16
%27 = sext i32 %1 to i64
%28 = getelementptr inbounds i32*, i32** %4, i64 %27
%29 = load i32*, i32** %28
%30 = tail call i32 @BN_mod_mul(i32* %21, i32* %19, i32* %29, i32* %8, i32* %9)
%31 = getelementptr inbounds i32*, i32** %6, i64 %27
%32 = load i32*, i32** %31
%33 = tail call i32 @BN_mod_mul(i32* %22, i32* %21, i32* %32, i32* %8, i32* %9)
br label %60
34: ; preds = %16
%35 = sdiv i32 %1, %2
%36 = srem i32 %1, %2
%37 = zext i32 %35 to i64
%38 = getelementptr inbounds i32*, i32** %4, i64 %37
%39 = load i32*, i32** %38
%40 = zext i32 %36 to i64
%41 = getelementptr inbounds i32*, i32** %4, i64 %40
%42 = load i32*, i32** %41
%43 = tail call i32 @BN_mod_mul(i32* %22, i32* %39, i32* %42, i32* %8, i32* %9)
%44 = tail call i32 @BN_mod_mul(i32* %21, i32* %22, i32* %19, i32* %8, i32* %9)
%45 = getelementptr inbounds i32*, i32** %6, i64 %37
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32*, i32** %6, i64 %40
%48 = load i32*, i32** %47
%49 = tail call i32 @BN_mod_mul(i32* %22, i32* %46, i32* %48, i32* %8, i32* %9)
%50 = getelementptr inbounds i32*, i32** %5, i64 %37
%51 = load i32*, i32** %50
%52 = getelementptr inbounds i32*, i32** %5, i64 %40
%53 = load i32*, i32** %52
%54 = tail call i32 @BN_mod_mul(i32* %23, i32* %51, i32* %53, i32* %8, i32* %9)
%55 = tail call i32 @BN_mod_mul(i32* %24, i32* %3, i32* %23, i32* %8, i32* %9)
%56 = tail call i32 @BN_mod_add(i32* %23, i32* %24, i32* %17, i32* %8, i32* %9)
%57 = tail call i32 @BN_mod_inverse(i32* %24, i32* %23, i32* %8, i32* %9)
%58 = tail call i32 @BN_mod_mul(i32* %23, i32* %22, i32* %24, i32* %8, i32* %9)
%59 = tail call i32 @BN_mod_mul(i32* %22, i32* %23, i32* %21, i32* %8, i32* %9)
br label %60
60: ; preds = %34, %26
%61 = tail call i32 @BN_mod_add(i32* %23, i32* %22, i32* %19, i32* %8, i32* %9)
%62 = tail call i32 @BN_kronecker(i32* %23, i32* %8, i32* %9)
%63 = mul nsw i32 %62, %7
store i32 %63, i32* %0
%64 = tail call i32 @BN_free(i32* %21)
%65 = tail call i32 @BN_free(i32* %22)
%66 = tail call i32 @BN_free(i32* %23)
%67 = tail call i32 @BN_free(i32* %24)
%68 = tail call i32 @BN_free(i32* %17)
%69 = tail call i32 @BN_free(i32* %19)
br label %70
70: ; preds = %10, %60
ret i32 -1
}