#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*/ mpz_t;
typedef int /*<<< orphan*/ gmp_randstate_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ GetHash(unsigned char *, unsigned char **, int, char **);
int /*<<< orphan*/ GetHexHash(unsigned char *, unsigned char **, char **);
int /*<<< orphan*/ GetJnHash(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ Q(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char,
                           unsigned char);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ g(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/);
int /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ gmp_randinit_mt(int /*<<< orphan*/);
int /*<<< orphan*/ gmp_randseed_ui(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int mpz_jacobi(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mod(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_out_str(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_powm_ui(int /*<<< orphan*/, int /*<<< orphan*/, int,
                               int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_str(int /*<<< orphan*/, unsigned char *, int);
int /*<<< orphan*/ mpz_urandomm(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void Encrypt(char *filename, unsigned char *identity, int l, mpz_t n, mpz_t u,
             char **error) {
  int i, j, bit, ascii_code, c1, c2, crev;
  mpz_t *R, *uR, x, y, s, S, tmp;
  gmp_randstate_t r_state;
  FILE *fd, *fd_write;
  unsigned char *hash, *hex_hash, character, encrypted_character1,
      encrypted_character2;
  mpz_init(x);
  mpz_init(y);
  mpz_init(s);
  mpz_init(S);
  mpz_init(tmp);
  fd = fopen(filename, "r");
  if (fd == NULL) {
    *error = "file open failed";
    return;
  }
  fd_write = fopen("encrypted_text", "w");
  if (fd_write == NULL) {
    *error = "file open failed";
    return;
  }
  R = (mpz_t *)malloc(l * sizeof(mpz_t));
  if (R == NULL) {
    *error = "malloc failed";
    return;
  }
  uR = (mpz_t *)malloc(l * sizeof(mpz_t));
  if (uR == NULL) {
    *error = "malloc failed";
    return;
  }
  for (i = 0; i < l; i++) {
    mpz_init(R[i]);
    mpz_init(uR[i]);
    GetHash(identity, &hash, i, error);
    if (strcmp(*error, "success") != 0)
      return;
    GetHexHash(hash, &hex_hash, error);
    if (strcmp(*error, "success") != 0)
      return;
    mpz_set_str(R[i], hex_hash, 16);
    mpz_mod(R[i], R[i], n);
    GetJnHash(n, R[i]);
    mpz_mul(uR[i], R[i], u);
    mpz_mod(uR[i], uR[i], n);
  }
  gmp_randinit_mt(r_state);
  gmp_randseed_ui(r_state, time(NULL));
  i = 0;
  do {
    encrypted_character1 ^= encrypted_character1;
    encrypted_character2 ^= encrypted_character2;
    ascii_code = fgetc(fd);
    character = (unsigned char)ascii_code;
    if (ascii_code == EOF && i % l != 0)
      ascii_code = character = 0x20;
    if (ascii_code == EOF)
      break;
    if (i % l == 0) {
      i = 0;
      mpz_urandomm(s, r_state, n);
      mpz_powm_ui(S, s, 2, n);
      mpz_out_str(fd_write, 10, S);
    }
    for (j = 0; j < 8; j++, i++) {
      bit = ((1 << (7 - j)) & character) == 0 ? 1 : -1;
      Q(R[i], S, s, n, x, y, r_state);
      g(tmp, s, y, n);
      c1 = bit * mpz_jacobi(tmp, n);
      gmp_printf("\ng=%Zd\n\n", tmp);
      Q(uR[i], S, s, n, x, y, r_state);
      g(tmp, s, y, n);
      c2 = bit * mpz_jacobi(tmp, n);
      gmp_printf("\ng=%Zd\n\n", tmp);
      crev = (c1 == -1) ? 1 : 0;
      encrypted_character1 |= (crev << (7 - j));
      crev = (c2 == -1) ? 1 : 0;
      encrypted_character2 |= (crev << (7 - j));
    }
    fprintf(fd_write, " %c%c ", encrypted_character1, encrypted_character2);
  } while (ascii_code != EOF);
  for (i = 0; i < l; i++)
    mpz_clear(R[i]);
  for (i = 0; i < l; i++)
    mpz_clear(uR[i]);
  mpz_clear(x);
  mpz_clear(y);
  mpz_init(s);
  mpz_init(S);
  mpz_clear(tmp);
  free(R);
  free(uR);
  fclose(fd);
  fclose(fd_write);
}


x86 assembly (clang, -O0):
<Encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x5c(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x60(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x64(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x68(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x6c(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x8(%rbp),%rdi
lea    0xd1c(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    130b <Encrypt+0x7b>
mov    -0x28(%rbp),%rax
lea    0xcff(%rip),%rcx
mov    %rcx,(%rax)
jmp    1844 <Encrypt+0x5b4>
lea    0xd01(%rip),%rdi
lea    0xd09(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    1340 <Encrypt+0xb0>
mov    -0x28(%rbp),%rax
lea    0xcca(%rip),%rcx
mov    %rcx,(%rax)
jmp    1844 <Encrypt+0x5b4>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1371 <Encrypt+0xe1>
mov    -0x28(%rbp),%rax
lea    0xcbb(%rip),%rcx
mov    %rcx,(%rax)
jmp    1844 <Encrypt+0x5b4>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    13a2 <Encrypt+0x112>
mov    -0x28(%rbp),%rax
lea    0xc8a(%rip),%rcx
mov    %rcx,(%rax)
jmp    1844 <Encrypt+0x5b4>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14de <Encrypt+0x24e>
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1070 <mpz_init@plt>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1070 <mpz_init@plt>
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    -0x88(%rbp),%rsi
call   11a0 <GetHash@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xc38(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     140e <Encrypt+0x17e>
jmp    1844 <Encrypt+0x5b4>
mov    -0x88(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    -0x90(%rbp),%rsi
call   1060 <GetHexHash@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xbff(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1447 <Encrypt+0x1b7>
jmp    1844 <Encrypt+0x5b4>
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x90(%rbp),%rsi
mov    $0x10,%edx
call   1100 <mpz_set_str@plt>
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%edx
call   1120 <mpz_mod@plt>
mov    -0x18(%rbp),%edi
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1160 <GetJnHash@plt>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x1c(%rbp),%edx
call   10a0 <mpz_mul@plt>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%edx
call   1120 <mpz_mod@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13a9 <Encrypt+0x119>
mov    -0x70(%rbp),%edi
call   1180 <gmp_randinit_mt@plt>
mov    -0x70(%rbp),%eax
mov    %eax,-0x98(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    -0x98(%rbp),%edi
mov    %eax,%esi
call   1150 <gmp_randseed_ui@plt>
movl   $0x0,-0x2c(%rbp)
movzbl -0x92(%rbp),%ecx
movzbl -0x92(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x92(%rbp)
movzbl -0x93(%rbp),%ecx
movzbl -0x93(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x93(%rbp)
mov    -0x78(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %al,-0x91(%rbp)
mov    -0x38(%rbp),%eax
mov    0x2a91(%rip),%rcx
cmp    (%rcx),%eax
jne    157d <Encrypt+0x2ed>
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
je     157d <Encrypt+0x2ed>
movb   $0x20,-0x91(%rbp)
movl   $0x20,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    0x2a61(%rip),%rcx
cmp    (%rcx),%eax
jne    1594 <Encrypt+0x304>
jmp    1796 <Encrypt+0x506>
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    15dd <Encrypt+0x34d>
movl   $0x0,-0x2c(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x70(%rbp),%esi
mov    -0x18(%rbp),%edx
call   11b0 <mpz_urandomm@plt>
mov    -0x68(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x18(%rbp),%ecx
mov    $0x2,%edx
call   1110 <mpz_powm_ui@plt>
mov    -0x80(%rbp),%rdi
mov    -0x68(%rbp),%edx
mov    $0xa,%esi
call   10c0 <mpz_out_str@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0x8,-0x30(%rbp)
jge    1764 <Encrypt+0x4d4>
mov    $0x7,%ecx
sub    -0x30(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
movzbl -0x91(%rbp),%eax
and    %eax,%edx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x5c(%rbp),%r8d
mov    -0x60(%rbp),%r9d
mov    -0x70(%rbp),%eax
mov    %eax,(%rsp)
call   10e0 <Q@plt>
mov    -0x6c(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   10f0 <g@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1170 <mpz_jacobi@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x6c(%rbp),%esi
lea    0x9bd(%rip),%rdi
call   1190 <gmp_printf@plt>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x5c(%rbp),%r8d
mov    -0x60(%rbp),%r9d
mov    -0x70(%rbp),%eax
mov    %eax,(%rsp)
call   10e0 <Q@plt>
mov    -0x6c(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   10f0 <g@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1170 <mpz_jacobi@plt>
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x6c(%rbp),%esi
lea    0x954(%rip),%rdi
call   1190 <gmp_printf@plt>
mov    -0x3c(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x7,%ecx
sub    -0x30(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x92(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x92(%rbp)
mov    -0x40(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x7,%ecx
sub    -0x30(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x93(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x93(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    15e4 <Encrypt+0x354>
mov    -0x80(%rbp),%rdi
mov    -0x92(%rbp),%al
lea    0x8ce(%rip),%rsi
movzbl %al,%edx
movzbl -0x93(%rbp),%ecx
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%eax
mov    0x285a(%rip),%rcx
cmp    (%rcx),%eax
jne    150c <Encrypt+0x27c>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    17c7 <Encrypt+0x537>
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1130 <mpz_clear@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    179d <Encrypt+0x50d>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    17f8 <Encrypt+0x568>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1130 <mpz_clear@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    17ce <Encrypt+0x53e>
mov    -0x5c(%rbp),%edi
call   1130 <mpz_clear@plt>
mov    -0x60(%rbp),%edi
call   1130 <mpz_clear@plt>
mov    -0x64(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x68(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x6c(%rbp),%edi
call   1130 <mpz_clear@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x80(%rbp),%rdi
call   1040 <fclose@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%r13
mov    %r8d,0x30(%rsp)
mov    %ecx,0x14(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
lea    0xd2b(%rip),%rsi
mov    %rbx,%rdi
call   1140 <fopen@plt>
mov    %rax,0x40(%rsp)
test   %rax,%rax
je     1673 <Encrypt+0x3e3>
lea    0xd21(%rip),%rdi
lea    0xd29(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     1673 <Encrypt+0x3e3>
mov    0x8(%rsp),%rax
lea    0x0(,%rax,4),%ebx
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     167c <Encrypt+0x3ec>
mov    %ebx,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     167c <Encrypt+0x3ec>
cmpl   $0x0,0x8(%rsp)
mov    %rax,%r15
mov    %rax,0x48(%rsp)
mov    0x18(%rsp),%r12
jle    142d <Encrypt+0x19d>
mov    0x8(%rsp),%eax
mov    %rax,0x28(%rsp)
xor    %ebx,%ebx
mov    (%r12,%rbx,4),%edi
call   1070 <mpz_init@plt>
mov    (%r15,%rbx,4),%edi
call   1070 <mpz_init@plt>
mov    %r14,%rdi
lea    0x70(%rsp),%rsi
mov    %ebx,%edx
mov    %r13,%rcx
call   11a0 <GetHash@plt>
mov    0x0(%r13),%rdi
lea    0xca3(%rip),%rbp
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1687 <Encrypt+0x3f7>
mov    0x70(%rsp),%rdi
lea    0x68(%rsp),%rsi
mov    %r13,%rdx
call   1060 <GetHexHash@plt>
mov    0x0(%r13),%rdi
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1687 <Encrypt+0x3f7>
mov    0x18(%rsp),%r12
mov    (%r12,%rbx,4),%edi
mov    0x68(%rsp),%rsi
mov    $0x10,%edx
call   1100 <mpz_set_str@plt>
mov    (%r12,%rbx,4),%edi
mov    %edi,%esi
mov    0x14(%rsp),%ebp
mov    %ebp,%edx
call   1120 <mpz_mod@plt>
mov    (%r12,%rbx,4),%esi
mov    %ebp,%edi
call   1160 <GetJnHash@plt>
mov    0x48(%rsp),%r15
mov    (%r15,%rbx,4),%edi
mov    (%r12,%rbx,4),%esi
mov    0x30(%rsp),%edx
call   10a0 <mpz_mul@plt>
mov    (%r15,%rbx,4),%edi
mov    %edi,%esi
mov    %ebp,%edx
call   1120 <mpz_mod@plt>
add    $0x1,%rbx
cmp    %rbx,0x28(%rsp)
jne    1360 <Encrypt+0xd0>
call   1180 <gmp_randinit_mt@plt>
xor    %r14d,%r14d
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%esi
call   1150 <gmp_randseed_ui@plt>
mov    0x2b9e(%rip),%rbx
mov    0x14(%rsp),%ebp
xchg   %ax,%ax
mov    0x40(%rsp),%rdi
call   1050 <fgetc@plt>
mov    %eax,%esi
mov    (%rbx),%ecx
cmp    %ecx,%eax
jne    1474 <Encrypt+0x1e4>
mov    %r14d,%eax
cltd
idivl  0x8(%rsp)
test   %edx,%edx
mov    $0x20,%eax
cmovne %eax,%esi
cmp    %ecx,%esi
je     15ec <Encrypt+0x35c>
mov    %r14d,%eax
cltd
idivl  0x8(%rsp)
test   %edx,%edx
jne    14b1 <Encrypt+0x221>
mov    %ebp,%edx
mov    %esi,%ebx
call   11b0 <mpz_urandomm@plt>
mov    $0x2,%edx
mov    %ebp,%ecx
call   1110 <mpz_powm_ui@plt>
mov    0x20(%rsp),%rdi
mov    $0xa,%esi
call   10c0 <mpz_out_str@plt>
mov    %ebx,%esi
xor    %r14d,%r14d
mov    %esi,0x38(%rsp)
movzbl %sil,%eax
mov    %eax,0x3c(%rsp)
mov    %r14,0x50(%rsp)
movslq %r14d,%rax
lea    (%r12,%rax,4),%rcx
mov    %rcx,0x60(%rsp)
lea    (%r15,%rax,4),%rax
mov    %rax,0x58(%rsp)
mov    $0x7,%r13d
xor    %ebx,%ebx
xor    %ecx,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rdx,0x28(%rsp)
mov    %rcx,0x30(%rsp)
mov    0x3c(%rsp),%eax
bt     %r13d,%eax
mov    $0xffffffff,%r14d
mov    $0x1,%eax
cmovae %eax,%r14d
mov    0x60(%rsp),%rax
mov    (%rax,%rbx,4),%edi
mov    %ebp,%ecx
call   10e0 <Q@plt>
mov    %ebp,%ecx
call   10f0 <g@plt>
mov    %ebp,%esi
call   1170 <mpz_jacobi@plt>
mov    %eax,%r15d
imul   %r14d,%r15d
lea    0xafe(%rip),%rdi
call   1190 <gmp_printf@plt>
mov    0x58(%rsp),%rax
mov    (%rax,%rbx,4),%edi
mov    %ebp,%ecx
call   10e0 <Q@plt>
mov    %ebp,%ecx
call   10f0 <g@plt>
mov    %ebp,%esi
call   1170 <mpz_jacobi@plt>
mov    %eax,%r12d
imul   %r14d,%r12d
lea    0xace(%rip),%rdi
call   1190 <gmp_printf@plt>
mov    0x28(%rsp),%rdx
xor    %eax,%eax
cmp    $0xffffffff,%r15d
sete   %al
mov    %r13d,%ecx
shl    %cl,%eax
or     %al,%dl
xor    %eax,%eax
cmp    $0xffffffff,%r12d
mov    0x14(%rsp),%ebp
sete   %al
mov    %r13d,%ecx
shl    %cl,%eax
mov    0x30(%rsp),%rcx
or     %al,%cl
add    $0x1,%rbx
add    $0xffffffff,%r13d
cmp    $0x8,%ebx
jne    14f0 <Encrypt+0x260>
mov    0x50(%rsp),%r14
add    %ebx,%r14d
movzbl %dl,%edx
movzbl %cl,%ecx
mov    0x20(%rsp),%rdi
lea    0xa79(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2a12(%rip),%rbx
mov    0x38(%rsp),%eax
cmp    (%rbx),%eax
mov    0x18(%rsp),%r12
mov    0x48(%rsp),%r15
jne    1450 <Encrypt+0x1c0>
cmpl   $0x0,0x8(%rsp)
jle    1632 <Encrypt+0x3a2>
mov    0x8(%rsp),%r14d
xor    %ebp,%ebp
mov    0x18(%rsp),%rbx
nop
mov    (%rbx,%rbp,4),%edi
call   1130 <mpz_clear@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1600 <Encrypt+0x370>
cmpl   $0x0,0x8(%rsp)
jle    1632 <Encrypt+0x3a2>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,4),%edi
call   1130 <mpz_clear@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1620 <Encrypt+0x390>
call   1130 <mpz_clear@plt>
call   1130 <mpz_clear@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1130 <mpz_clear@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1040 <fclose@plt>
jmp    1687 <Encrypt+0x3f7>
lea    0x988(%rip),%rax
jmp    1683 <Encrypt+0x3f3>
lea    0x9a1(%rip),%rax
mov    %rax,0x0(%r13)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [17 x i8] c"file open failed\00"
@.str.2 = [15 x i8] c"encrypted_text\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [14 x i8] c"malloc failed\00"
@.str.5 = [8 x i8] c"success\00"
@EOF = global i32 0
@.str.6 = [9 x i8] c"\0Ag=%Zd\0A\0A\00"
@.str.7 = [7 x i8] c" %c%c \00"
define void @Encrypt(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i8** %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8**
%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 i8*
%31 = alloca i8*
%32 = alloca i8
%33 = alloca i8
%34 = alloca i8
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8** %5, i8*** %12
%35 = load i32, i32* %22
%36 = call i32 @mpz_init(i32 %35)
%37 = load i32, i32* %23
%38 = call i32 @mpz_init(i32 %37)
%39 = load i32, i32* %24
%40 = call i32 @mpz_init(i32 %39)
%41 = load i32, i32* %25
%42 = call i32 @mpz_init(i32 %41)
%43 = load i32, i32* %26
%44 = call i32 @mpz_init(i32 %43)
%45 = load i8*, i8** %7
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %46, i32** %28
%47 = load i32*, i32** %28
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %51
49: ; preds = %6
%50 = load i8**, i8*** %12
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %50
br label %372
51: ; preds = %6
%52 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %52, i32** %29
%53 = load i32*, i32** %29
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = load i8**, i8*** %12
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %56
br label %372
57: ; preds = %51
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 4
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i32*
store i32* %63, i32** %20
%64 = load i32*, i32** %20
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %68
66: ; preds = %57
%67 = load i8**, i8*** %12
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %67
br label %372
68: ; preds = %57
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = mul i64 %70, 4
%72 = trunc i64 %71 to i32
%73 = call i64 @malloc(i32 %72)
%74 = inttoptr i64 %73 to i32*
store i32* %74, i32** %21
%75 = load i32*, i32** %21
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %79
77: ; preds = %68
%78 = load i8**, i8*** %12
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %78
br label %372
79: ; preds = %68
store i32 0, i32* %13
br label %80
80: ; preds = %166, %79
%81 = load i32, i32* %13
%82 = load i32, i32* %9
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %169
84: ; preds = %80
%85 = load i32*, i32** %20
%86 = load i32, i32* %13
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i32, i32* %85, i64 %87
%89 = load i32, i32* %88
%90 = call i32 @mpz_init(i32 %89)
%91 = load i32*, i32** %21
%92 = load i32, i32* %13
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %91, i64 %93
%95 = load i32, i32* %94
%96 = call i32 @mpz_init(i32 %95)
%97 = load i8*, i8** %8
%98 = load i32, i32* %13
%99 = load i8**, i8*** %12
%100 = call i32 @GetHash(i8* %97, i8** %30, i32 %98, i8** %99)
%101 = load i8**, i8*** %12
%102 = load i8*, i8** %101
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %84
br label %372
106: ; preds = %84
%107 = load i8*, i8** %30
%108 = load i8**, i8*** %12
%109 = call i32 @GetHexHash(i8* %107, i8** %31, i8** %108)
%110 = load i8**, i8*** %12
%111 = load i8*, i8** %110
%112 = call i64 @strcmp(i8* %111, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%113 = icmp ne i64 %112, 0
br i1 %113, label %114, label %115
114: ; preds = %106
br label %372
115: ; preds = %106
%116 = load i32*, i32** %20
%117 = load i32, i32* %13
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %116, i64 %118
%120 = load i32, i32* %119
%121 = load i8*, i8** %31
%122 = call i32 @mpz_set_str(i32 %120, i8* %121, i32 16)
%123 = load i32*, i32** %20
%124 = load i32, i32* %13
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %123, i64 %125
%127 = load i32, i32* %126
%128 = load i32*, i32** %20
%129 = load i32, i32* %13
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
%132 = load i32, i32* %131
%133 = load i32, i32* %10
%134 = call i32 @mpz_mod(i32 %127, i32 %132, i32 %133)
%135 = load i32, i32* %10
%136 = load i32*, i32** %20
%137 = load i32, i32* %13
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i32, i32* %136, i64 %138
%140 = load i32, i32* %139
%141 = call i32 @GetJnHash(i32 %135, i32 %140)
%142 = load i32*, i32** %21
%143 = load i32, i32* %13
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i32, i32* %142, i64 %144
%146 = load i32, i32* %145
%147 = load i32*, i32** %20
%148 = load i32, i32* %13
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %147, i64 %149
%151 = load i32, i32* %150
%152 = load i32, i32* %11
%153 = call i32 @mpz_mul(i32 %146, i32 %151, i32 %152)
%154 = load i32*, i32** %21
%155 = load i32, i32* %13
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i32, i32* %154, i64 %156
%158 = load i32, i32* %157
%159 = load i32*, i32** %21
%160 = load i32, i32* %13
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i32, i32* %159, i64 %161
%163 = load i32, i32* %162
%164 = load i32, i32* %10
%165 = call i32 @mpz_mod(i32 %158, i32 %163, i32 %164)
br label %166
166: ; preds = %115
%167 = load i32, i32* %13
%168 = add nsw i32 %167, 1
store i32 %168, i32* %13
br label %80
169: ; preds = %80
%170 = load i32, i32* %27
%171 = call i32 @gmp_randinit_mt(i32 %170)
%172 = load i32, i32* %27
%173 = call i32 @time(i32* null)
%174 = call i32 @gmp_randseed_ui(i32 %172, i32 %173)
store i32 0, i32* %13
br label %175
175: ; preds = %319, %169
%176 = load i8, i8* %33
%177 = zext i8 %176 to i32
%178 = load i8, i8* %33
%179 = zext i8 %178 to i32
%180 = xor i32 %179, %177
%181 = trunc i32 %180 to i8
store i8 %181, i8* %33
%182 = load i8, i8* %34
%183 = zext i8 %182 to i32
%184 = load i8, i8* %34
%185 = zext i8 %184 to i32
%186 = xor i32 %185, %183
%187 = trunc i32 %186 to i8
store i8 %187, i8* %34
%188 = load i32*, i32** %28
%189 = call i32 @fgetc(i32* %188)
store i32 %189, i32* %16
%190 = load i32, i32* %16
%191 = trunc i32 %190 to i8
store i8 %191, i8* %32
%192 = load i32, i32* %16
%193 = load i32, i32* @EOF
%194 = icmp eq i32 %192, %193
br i1 %194, label %195, label %201
195: ; preds = %175
%196 = load i32, i32* %13
%197 = load i32, i32* %9
%198 = srem i32 %196, %197
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %201
200: ; preds = %195
store i8 32, i8* %32
store i32 32, i32* %16
br label %201
201: ; preds = %200, %195, %175
%202 = load i32, i32* %16
%203 = load i32, i32* @EOF
%204 = icmp eq i32 %202, %203
br i1 %204, label %205, label %206
205: ; preds = %201
br label %323
206: ; preds = %201
%207 = load i32, i32* %13
%208 = load i32, i32* %9
%209 = srem i32 %207, %208
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %223
211: ; preds = %206
store i32 0, i32* %13
%212 = load i32, i32* %24
%213 = load i32, i32* %27
%214 = load i32, i32* %10
%215 = call i32 @mpz_urandomm(i32 %212, i32 %213, i32 %214)
%216 = load i32, i32* %25
%217 = load i32, i32* %24
%218 = load i32, i32* %10
%219 = call i32 @mpz_powm_ui(i32 %216, i32 %217, i32 2, i32 %218)
%220 = load i32*, i32** %29
%221 = load i32, i32* %25
%222 = call i32 @mpz_out_str(i32* %220, i32 10, i32 %221)
br label %223
223: ; preds = %211, %206
store i32 0, i32* %14
br label %224
224: ; preds = %309, %223
%225 = load i32, i32* %14
%226 = icmp slt i32 %225, 8
br i1 %226, label %227, label %314
227: ; preds = %224
%228 = load i32, i32* %14
%229 = sub nsw i32 7, %228
%230 = shl i32 1, %229
%231 = load i8, i8* %32
%232 = zext i8 %231 to i32
%233 = and i32 %230, %232
%234 = icmp eq i32 %233, 0
%235 = zext i1 %234 to i64
%236 = select i1 %234, i32 1, i32 -1
store i32 %236, i32* %15
%237 = load i32*, i32** %20
%238 = load i32, i32* %13
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i32, i32* %237, i64 %239
%241 = load i32, i32* %240
%242 = load i32, i32* %25
%243 = load i32, i32* %24
%244 = load i32, i32* %10
%245 = load i32, i32* %22
%246 = load i32, i32* %23
%247 = load i32, i32* %27
%248 = call i32 @Q(i32 %241, i32 %242, i32 %243, i32 %244, i32 %245, i32 %246, i32 %247)
%249 = load i32, i32* %26
%250 = load i32, i32* %24
%251 = load i32, i32* %23
%252 = load i32, i32* %10
%253 = call i32 @g(i32 %249, i32 %250, i32 %251, i32 %252)
%254 = load i32, i32* %15
%255 = load i32, i32* %26
%256 = load i32, i32* %10
%257 = call i32 @mpz_jacobi(i32 %255, i32 %256)
%258 = mul nsw i32 %254, %257
store i32 %258, i32* %17
%259 = load i32, i32* %26
%260 = call i32 @gmp_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %259)
%261 = load i32*, i32** %21
%262 = load i32, i32* %13
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds i32, i32* %261, i64 %263
%265 = load i32, i32* %264
%266 = load i32, i32* %25
%267 = load i32, i32* %24
%268 = load i32, i32* %10
%269 = load i32, i32* %22
%270 = load i32, i32* %23
%271 = load i32, i32* %27
%272 = call i32 @Q(i32 %265, i32 %266, i32 %267, i32 %268, i32 %269, i32 %270, i32 %271)
%273 = load i32, i32* %26
%274 = load i32, i32* %24
%275 = load i32, i32* %23
%276 = load i32, i32* %10
%277 = call i32 @g(i32 %273, i32 %274, i32 %275, i32 %276)
%278 = load i32, i32* %15
%279 = load i32, i32* %26
%280 = load i32, i32* %10
%281 = call i32 @mpz_jacobi(i32 %279, i32 %280)
%282 = mul nsw i32 %278, %281
store i32 %282, i32* %18
%283 = load i32, i32* %26
%284 = call i32 @gmp_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %283)
%285 = load i32, i32* %17
%286 = icmp eq i32 %285, -1
%287 = zext i1 %286 to i64
%288 = select i1 %286, i32 1, i32 0
store i32 %288, i32* %19
%289 = load i32, i32* %19
%290 = load i32, i32* %14
%291 = sub nsw i32 7, %290
%292 = shl i32 %289, %291
%293 = load i8, i8* %33
%294 = zext i8 %293 to i32
%295 = or i32 %294, %292
%296 = trunc i32 %295 to i8
store i8 %296, i8* %33
%297 = load i32, i32* %18
%298 = icmp eq i32 %297, -1
%299 = zext i1 %298 to i64
%300 = select i1 %298, i32 1, i32 0
store i32 %300, i32* %19
%301 = load i32, i32* %19
%302 = load i32, i32* %14
%303 = sub nsw i32 7, %302
%304 = shl i32 %301, %303
%305 = load i8, i8* %34
%306 = zext i8 %305 to i32
%307 = or i32 %306, %304
%308 = trunc i32 %307 to i8
store i8 %308, i8* %34
br label %309
309: ; preds = %227
%310 = load i32, i32* %14
%311 = add nsw i32 %310, 1
store i32 %311, i32* %14
%312 = load i32, i32* %13
%313 = add nsw i32 %312, 1
store i32 %313, i32* %13
br label %224
314: ; preds = %224
%315 = load i32*, i32** %29
%316 = load i8, i8* %33
%317 = load i8, i8* %34
%318 = call i32 @fprintf(i32* %315, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8 zeroext %316, i8 zeroext %317)
br label %319
319: ; preds = %314
%320 = load i32, i32* %16
%321 = load i32, i32* @EOF
%322 = icmp ne i32 %320, %321
br i1 %322, label %175, label %323
323: ; preds = %319, %205
store i32 0, i32* %13
br label %324
324: ; preds = %335, %323
%325 = load i32, i32* %13
%326 = load i32, i32* %9
%327 = icmp slt i32 %325, %326
br i1 %327, label %328, label %338
328: ; preds = %324
%329 = load i32*, i32** %20
%330 = load i32, i32* %13
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds i32, i32* %329, i64 %331
%333 = load i32, i32* %332
%334 = call i32 @mpz_clear(i32 %333)
br label %335
335: ; preds = %328
%336 = load i32, i32* %13
%337 = add nsw i32 %336, 1
store i32 %337, i32* %13
br label %324
338: ; preds = %324
store i32 0, i32* %13
br label %339
339: ; preds = %350, %338
%340 = load i32, i32* %13
%341 = load i32, i32* %9
%342 = icmp slt i32 %340, %341
br i1 %342, label %343, label %353
343: ; preds = %339
%344 = load i32*, i32** %21
%345 = load i32, i32* %13
%346 = sext i32 %345 to i64
%347 = getelementptr inbounds i32, i32* %344, i64 %346
%348 = load i32, i32* %347
%349 = call i32 @mpz_clear(i32 %348)
br label %350
350: ; preds = %343
%351 = load i32, i32* %13
%352 = add nsw i32 %351, 1
store i32 %352, i32* %13
br label %339
353: ; preds = %339
%354 = load i32, i32* %22
%355 = call i32 @mpz_clear(i32 %354)
%356 = load i32, i32* %23
%357 = call i32 @mpz_clear(i32 %356)
%358 = load i32, i32* %24
%359 = call i32 @mpz_init(i32 %358)
%360 = load i32, i32* %25
%361 = call i32 @mpz_init(i32 %360)
%362 = load i32, i32* %26
%363 = call i32 @mpz_clear(i32 %362)
%364 = load i32*, i32** %20
%365 = call i32 @free(i32* %364)
%366 = load i32*, i32** %21
%367 = call i32 @free(i32* %366)
%368 = load i32*, i32** %28
%369 = call i32 @fclose(i32* %368)
%370 = load i32*, i32** %29
%371 = call i32 @fclose(i32* %370)
br label %372
372: ; preds = %353, %114, %105, %77, %66, %55, %49
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [17 x i8] c"file open failed\00"
@.str.2 = [15 x i8] c"encrypted_text\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [14 x i8] c"malloc failed\00"
@.str.5 = [8 x i8] c"success\00"
@EOF = global i32 0
@.str.6 = [9 x i8] c"\0Ag=%Zd\0A\0A\00"
@.str.7 = [7 x i8] c" %c%c \00"
define void @Encrypt(i8* nocapture %0, i8* %1, i32 %2, i32 %3, i32 %4, i8** %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = bitcast i8** %7 to i8*
%10 = bitcast i8** %8 to i8*
%11 = tail call i32 @mpz_init(i32 undef)
%12 = tail call i32 @mpz_init(i32 undef)
%13 = tail call i32 @mpz_init(i32 undef)
%14 = tail call i32 @mpz_init(i32 undef)
%15 = tail call i32 @mpz_init(i32 undef)
%16 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %6
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %171
19: ; preds = %6
%20 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %171
23: ; preds = %19
%24 = shl i32 %2, 2
%25 = tail call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to i32*
%27 = icmp eq i64 %25, 0
br i1 %27, label %28, label %29
28: ; preds = %23
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %171
29: ; preds = %23
%30 = tail call i64 @malloc(i32 %24)
%31 = inttoptr i64 %30 to i32*
%32 = icmp eq i64 %30, 0
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = icmp sgt i32 %2, 0
br i1 %34, label %35, label %72
35: ; preds = %33
%36 = zext i32 %2 to i64
br label %38
37: ; preds = %29
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %171
38: ; preds = %35, %57
%39 = phi i64 [ 0, %35 ], [ %70, %57 ]
%40 = getelementptr inbounds i32, i32* %26, i64 %39
%41 = load i32, i32* %40
%42 = call i32 @mpz_init(i32 %41)
%43 = getelementptr inbounds i32, i32* %31, i64 %39
%44 = load i32, i32* %43
%45 = call i32 @mpz_init(i32 %44)
%46 = trunc i64 %39 to i32
%47 = call i32 @GetHash(i8* %1, i8** %7, i32 %46, i8** %5)
%48 = load i8*, i8** %5
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %171
51: ; preds = %38
%52 = load i8*, i8** %7
%53 = call i32 @GetHexHash(i8* %52, i8** %8, i8** %5)
%54 = load i8*, i8** %5
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %171
57: ; preds = %51
%58 = load i32, i32* %40
%59 = load i8*, i8** %8
%60 = call i32 @mpz_set_str(i32 %58, i8* %59, i32 16)
%61 = load i32, i32* %40
%62 = call i32 @mpz_mod(i32 %61, i32 %61, i32 %3)
%63 = load i32, i32* %40
%64 = call i32 @GetJnHash(i32 %3, i32 %63)
%65 = load i32, i32* %43
%66 = load i32, i32* %40
%67 = call i32 @mpz_mul(i32 %65, i32 %66, i32 %4)
%68 = load i32, i32* %43
%69 = call i32 @mpz_mod(i32 %68, i32 %68, i32 %3)
%70 = add nuw nsw i64 %39, 1
%71 = icmp eq i64 %70, %36
br i1 %71, label %72, label %38
72: ; preds = %57, %33
%73 = call i32 @gmp_randinit_mt(i32 undef)
%74 = call i32 @time(i32* null)
%75 = call i32 @gmp_randseed_ui(i32 undef, i32 %74)
br label %76
76: ; preds = %136, %72
%77 = phi i32 [ 0, %72 ], [ %137, %136 ]
%78 = call i32 @fgetc(i32* %16)
%79 = load i32, i32* @EOF
%80 = icmp eq i32 %78, %79
br i1 %80, label %81, label %85
81: ; preds = %76
%82 = srem i32 %77, %2
%83 = icmp eq i32 %82, 0
%84 = select i1 %83, i32 %78, i32 32
br label %85
85: ; preds = %81, %76
%86 = phi i32 [ %78, %76 ], [ %84, %81 ]
%87 = icmp eq i32 %86, %79
br i1 %87, label %141, label %88
88: ; preds = %85
%89 = srem i32 %77, %2
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %88
%92 = call i32 @mpz_urandomm(i32 undef, i32 undef, i32 %3)
%93 = call i32 @mpz_powm_ui(i32 undef, i32 undef, i32 2, i32 %3)
%94 = call i32 @mpz_out_str(i32* %20, i32 10, i32 undef)
br label %95
95: ; preds = %91, %88
%96 = phi i32 [ 0, %91 ], [ %77, %88 ]
%97 = and i32 %86, 255
%98 = sext i32 %96 to i64
br label %99
99: ; preds = %95, %99
%100 = phi i64 [ %98, %95 ], [ %134, %99 ]
%101 = phi i8 [ 0, %95 ], [ %132, %99 ]
%102 = phi i8 [ 0, %95 ], [ %127, %99 ]
%103 = phi i32 [ 0, %95 ], [ %133, %99 ]
%104 = sub nuw nsw i32 7, %103
%105 = shl nuw nsw i32 1, %104
%106 = and i32 %97, %105
%107 = icmp eq i32 %106, 0
%108 = select i1 %107, i32 1, i32 -1
%109 = getelementptr inbounds i32, i32* %26, i64 %100
%110 = load i32, i32* %109
%111 = call i32 @Q(i32 %110, i32 undef, i32 undef, i32 %3, i32 undef, i32 undef, i32 undef)
%112 = call i32 @g(i32 undef, i32 undef, i32 undef, i32 %3)
%113 = call i32 @mpz_jacobi(i32 undef, i32 %3)
%114 = mul nsw i32 %113, %108
%115 = call i32 @gmp_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 undef)
%116 = getelementptr inbounds i32, i32* %31, i64 %100
%117 = load i32, i32* %116
%118 = call i32 @Q(i32 %117, i32 undef, i32 undef, i32 %3, i32 undef, i32 undef, i32 undef)
%119 = call i32 @g(i32 undef, i32 undef, i32 undef, i32 %3)
%120 = call i32 @mpz_jacobi(i32 undef, i32 %3)
%121 = mul nsw i32 %120, %108
%122 = call i32 @gmp_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 undef)
%123 = icmp eq i32 %114, -1
%124 = zext i1 %123 to i32
%125 = shl nuw nsw i32 %124, %104
%126 = trunc i32 %125 to i8
%127 = or i8 %102, %126
%128 = icmp eq i32 %121, -1
%129 = zext i1 %128 to i32
%130 = shl nuw nsw i32 %129, %104
%131 = trunc i32 %130 to i8
%132 = or i8 %101, %131
%133 = add nuw nsw i32 %103, 1
%134 = add nsw i64 %100, 1
%135 = icmp eq i32 %133, 8
br i1 %135, label %136, label %99
136: ; preds = %99
%137 = trunc i64 %134 to i32
%138 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8 zeroext %127, i8 zeroext %132)
%139 = load i32, i32* @EOF
%140 = icmp eq i32 %86, %139
br i1 %140, label %141, label %76
141: ; preds = %85, %136
br i1 %34, label %142, label %161
142: ; preds = %141
%143 = zext i32 %2 to i64
br label %147
144: ; preds = %147
br i1 %34, label %145, label %161
145: ; preds = %144
%146 = zext i32 %2 to i64
br label %154
147: ; preds = %142, %147
%148 = phi i64 [ 0, %142 ], [ %152, %147 ]
%149 = getelementptr inbounds i32, i32* %26, i64 %148
%150 = load i32, i32* %149
%151 = call i32 @mpz_clear(i32 %150)
%152 = add nuw nsw i64 %148, 1
%153 = icmp eq i64 %152, %143
br i1 %153, label %144, label %147
154: ; preds = %145, %154
%155 = phi i64 [ 0, %145 ], [ %159, %154 ]
%156 = getelementptr inbounds i32, i32* %31, i64 %155
%157 = load i32, i32* %156
%158 = call i32 @mpz_clear(i32 %157)
%159 = add nuw nsw i64 %155, 1
%160 = icmp eq i64 %159, %146
br i1 %160, label %161, label %154
161: ; preds = %154, %141, %144
%162 = call i32 @mpz_clear(i32 undef)
%163 = call i32 @mpz_clear(i32 undef)
%164 = call i32 @mpz_init(i32 undef)
%165 = call i32 @mpz_init(i32 undef)
%166 = call i32 @mpz_clear(i32 undef)
%167 = call i32 @free(i32* %26)
%168 = call i32 @free(i32* %31)
%169 = call i32 @fclose(i32* %16)
%170 = call i32 @fclose(i32* %20)
br label %171
171: ; preds = %51, %38, %161, %37, %28, %22, %18
ret void
}