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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init2(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_inp_str(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ mpz_out_str(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_powm(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_str(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int cipherRSA() {
  printf("         File Encryption\n");
  printf("--------------------------------------\n");
  FILE *publicFile = fopen("out/public.rsa", "r");
  FILE *clearFile = fopen("source/Clair.txt", "r");
  FILE *cipheredFile = fopen("out/cipherFile.txt", "w");
  if (publicFile == NULL || clearFile == NULL || cipheredFile == NULL) {
    printf("Error while opening one of the 3 files required in cipherRSA\n");
    return -1;
  }
  mpz_t n;
  mpz_t e;
  mpz_t m;
  mpz_t c;
  char buffer[128];
  int i = 0;
  char caract;
  mpz_init2(n, 2048);
  mpz_init2(e, 2048);
  mpz_init2(m, 2048);
  mpz_init2(c, 2048);
  mpz_inp_str(n, publicFile, 16);
  mpz_inp_str(e, publicFile, 16);
  printf("-> (n,e) has been imported from public.rsa\n\n");
  do {
    caract = fgetc(clearFile);
    if (caract != '\0' && caract != '\n') {
      buffer[i % 128] = caract;
      if (i % 128 == 126) {
        buffer[127] = '\0';
        mpz_set_str(m, buffer, 62);
        mpz_powm(c, m, e, n);
        mpz_out_str(cipheredFile, 62, c);
        fputc('\n', cipheredFile);
      }
    } else {
      if (i % 127 != 0) {
        buffer[i % 128] = '\0';
      }
      mpz_set_str(m, buffer, 62);
      mpz_powm(c, m, e, n);
      mpz_out_str(cipheredFile, 62, c);
      fputc('\n', cipheredFile);
    }
    i++;
  } while (caract != '\0' && caract != '\n');
  printf("-> End of encryption. %d caracters have been encrypted in "
         "cipherFile.txt\n",
         i);
  printf("--------------------------------------\n");
  mpz_clear(n);
  mpz_clear(e);
  mpz_clear(m);
  mpz_clear(c);
  fclose(publicFile);
  fclose(clearFile);
  fclose(cipheredFile);
  return 0;
}


x86 assembly (clang, -O0):
<cipherRSA>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe64(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe5e(%rip),%rdi
lea    0xe55(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe58(%rip),%rdi
lea    0xe64(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     123d <cipherRSA+0x8d>
cmpq   $0x0,-0x18(%rbp)
je     123d <cipherRSA+0x8d>
cmpq   $0x0,-0x20(%rbp)
jne    1257 <cipherRSA+0xa7>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1496 <cipherRSA+0x2e6>
movl   $0x0,-0xb4(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x800,%esi
call   10d0 <mpz_init2@plt>
mov    -0x28(%rbp),%edi
mov    $0x800,%esi
call   10d0 <mpz_init2@plt>
mov    -0x2c(%rbp),%edi
mov    $0x800,%esi
call   10d0 <mpz_init2@plt>
mov    -0x30(%rbp),%edi
mov    $0x800,%esi
call   10d0 <mpz_init2@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   10a0 <mpz_inp_str@plt>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   10a0 <mpz_inp_str@plt>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0xb5(%rbp)
movsbl -0xb5(%rbp),%eax
cmp    $0x0,%eax
je     1376 <cipherRSA+0x1c6>
movsbl -0xb5(%rbp),%eax
cmp    $0xa,%eax
je     1376 <cipherRSA+0x1c6>
mov    -0xb5(%rbp),%cl
mov    -0xb4(%rbp),%eax
mov    $0x80,%esi
cltd
idiv   %esi
movslq %edx,%rax
mov    %cl,-0xb0(%rbp,%rax,1)
mov    -0xb4(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
cmp    $0x7e,%edx
jne    1371 <cipherRSA+0x1c1>
movb   $0x0,-0x31(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x3e,%edx
call   1090 <mpz_set_str@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1030 <mpz_powm@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    $0x3e,%esi
call   1080 <mpz_out_str@plt>
mov    -0x20(%rbp),%rsi
mov    $0xa,%edi
call   1070 <fputc@plt>
jmp    13ea <cipherRSA+0x23a>
mov    -0xb4(%rbp),%eax
mov    $0x7f,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     13a6 <cipherRSA+0x1f6>
mov    -0xb4(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
mov    -0x2c(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x3e,%edx
call   1090 <mpz_set_str@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1030 <mpz_powm@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    $0x3e,%esi
call   1080 <mpz_out_str@plt>
mov    -0x20(%rbp),%rsi
mov    $0xa,%edi
call   1070 <fputc@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
movsbl -0xb5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xb6(%rbp)
je     1424 <cipherRSA+0x274>
movsbl -0xb5(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xb6(%rbp)
mov    -0xb6(%rbp),%al
test   $0x1,%al
jne    12c5 <cipherRSA+0x115>
mov    -0xb4(%rbp),%esi
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x28(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x2c(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x30(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cipherRSA>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
lea    0xe10(%rip),%rdi
lea    0xe18(%rip),%rbx
mov    %rbx,%rsi
call   10d0 <fopen@plt>
mov    %rax,%r14
lea    0xe08(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <fopen@plt>
mov    %rax,%r15
lea    0xe07(%rip),%rdi
lea    0xe13(%rip),%rsi
call   10d0 <fopen@plt>
test   %r14,%r14
je     1390 <cipherRSA+0x1d0>
test   %r15,%r15
je     1390 <cipherRSA+0x1d0>
mov    %rax,%r12
test   %rax,%rax
je     1390 <cipherRSA+0x1d0>
mov    $0x800,%esi
call   10e0 <mpz_init2@plt>
mov    $0x800,%esi
call   10e0 <mpz_init2@plt>
mov    $0x800,%esi
call   10e0 <mpz_init2@plt>
mov    $0x800,%esi
call   10e0 <mpz_init2@plt>
mov    %r14,%rsi
mov    $0x10,%edx
call   10b0 <mpz_inp_str@plt>
mov    %r14,%rsi
mov    $0x10,%edx
call   10b0 <mpz_inp_str@plt>
lea    0xe0c(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %rsp,%r13
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
test   %al,%al
je     12b4 <cipherRSA+0xf4>
cmp    $0xa,%bpl
jne    12f0 <cipherRSA+0x130>
mov    %ebx,%eax
imul   $0x2040811,%rax,%rax
shr    $0x20,%rax
mov    %ebx,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x6,%ecx
mov    %ecx,%eax
shl    $0x7,%eax
sub    %ecx,%eax
cmp    %ebx,%eax
je     1306 <cipherRSA+0x146>
mov    %ebx,%eax
and    $0x7f,%eax
add    %rsp,%rax
jmp    1303 <cipherRSA+0x143>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%ecx
and    $0x7f,%ecx
mov    %bpl,(%rsp,%rcx,1)
lea    0x7f(%rsp),%rax
cmp    $0x7e,%ecx
jne    1332 <cipherRSA+0x172>
movb   $0x0,(%rax)
mov    %r13,%rsi
mov    $0x3e,%edx
call   10a0 <mpz_set_str@plt>
call   1030 <mpz_powm@plt>
mov    %r12,%rdi
mov    $0x3e,%esi
call   1090 <mpz_out_str@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1080 <fputc@plt>
add    $0x1,%ebx
cmp    $0xa,%bpl
je     1344 <cipherRSA+0x184>
test   %bpl,%bpl
jne    12a0 <cipherRSA+0xe0>
lea    0xcec(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd69(%rip),%rdi
call   1040 <puts@plt>
call   10c0 <mpz_clear@plt>
call   10c0 <mpz_clear@plt>
call   10c0 <mpz_clear@plt>
call   10c0 <mpz_clear@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
jmp    13a1 <cipherRSA+0x1e1>
lea    0xd56(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c" File Encryption\0A\00"
@.str.1 = [40 x i8] c"--------------------------------------\0A\00"
@.str.2 = [15 x i8] c"out/public.rsa\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [17 x i8] c"source/Clair.txt\00"
@.str.5 = [19 x i8] c"out/cipherFile.txt\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [62 x i8] c"Error while opening one of the 3 files required in cipherRSA\0A\00"
@.str.8 = [45 x i8] c"-> (n,e) has been imported from public.rsa\0A\0A\00"
@.str.9 = [74 x i8] c"-> End of encryption. %d caracters have been encrypted in cipherFile.txt\0A\00"
define i32 @cipherRSA() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [128 x i8]
%10 = alloca i32
%11 = alloca i8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%14 = 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* %14, i32** %2
%15 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %15, i32** %3
%16 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %16, i32** %4
%17 = load i32*, i32** %2
%18 = icmp eq i32* %17, null
br i1 %18, label %25, label %19
19: ; preds = %0
%20 = load i32*, i32** %3
%21 = icmp eq i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32*, i32** %4
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %27
25: ; preds = %22, %19, %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %1
br label %132
27: ; preds = %22
store i32 0, i32* %10
%28 = load i32, i32* %5
%29 = call i32 @mpz_init2(i32 %28, i32 2048)
%30 = load i32, i32* %6
%31 = call i32 @mpz_init2(i32 %30, i32 2048)
%32 = load i32, i32* %7
%33 = call i32 @mpz_init2(i32 %32, i32 2048)
%34 = load i32, i32* %8
%35 = call i32 @mpz_init2(i32 %34, i32 2048)
%36 = load i32, i32* %5
%37 = load i32*, i32** %2
%38 = call i32 @mpz_inp_str(i32 %36, i32* %37, i32 16)
%39 = load i32, i32* %6
%40 = load i32*, i32** %2
%41 = call i32 @mpz_inp_str(i32 %39, i32* %40, i32 16)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
br label %43
43: ; preds = %112, %27
%44 = load i32*, i32** %3
%45 = call signext i8 @fgetc(i32* %44)
store i8 %45, i8* %11
%46 = load i8, i8* %11
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %78
49: ; preds = %43
%50 = load i8, i8* %11
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 10
br i1 %52, label %53, label %78
53: ; preds = %49
%54 = load i8, i8* %11
%55 = load i32, i32* %10
%56 = srem i32 %55, 128
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 %57
store i8 %54, i8* %58
%59 = load i32, i32* %10
%60 = srem i32 %59, 128
%61 = icmp eq i32 %60, 126
br i1 %61, label %62, label %77
62: ; preds = %53
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 127
store i8 0, i8* %63
%64 = load i32, i32* %7
%65 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%66 = call i32 @mpz_set_str(i32 %64, i8* %65, i32 62)
%67 = load i32, i32* %8
%68 = load i32, i32* %7
%69 = load i32, i32* %6
%70 = load i32, i32* %5
%71 = call i32 @mpz_powm(i32 %67, i32 %68, i32 %69, i32 %70)
%72 = load i32*, i32** %4
%73 = load i32, i32* %8
%74 = call i32 @mpz_out_str(i32* %72, i32 62, i32 %73)
%75 = load i32*, i32** %4
%76 = call i32 @fputc(i8 signext 10, i32* %75)
br label %77
77: ; preds = %62, %53
br label %101
78: ; preds = %49, %43
%79 = load i32, i32* %10
%80 = srem i32 %79, 127
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %87
82: ; preds = %78
%83 = load i32, i32* %10
%84 = srem i32 %83, 128
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 %85
store i8 0, i8* %86
br label %87
87: ; preds = %82, %78
%88 = load i32, i32* %7
%89 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%90 = call i32 @mpz_set_str(i32 %88, i8* %89, i32 62)
%91 = load i32, i32* %8
%92 = load i32, i32* %7
%93 = load i32, i32* %6
%94 = load i32, i32* %5
%95 = call i32 @mpz_powm(i32 %91, i32 %92, i32 %93, i32 %94)
%96 = load i32*, i32** %4
%97 = load i32, i32* %8
%98 = call i32 @mpz_out_str(i32* %96, i32 62, i32 %97)
%99 = load i32*, i32** %4
%100 = call i32 @fputc(i8 signext 10, i32* %99)
br label %101
101: ; preds = %87, %77
%102 = load i32, i32* %10
%103 = add nsw i32 %102, 1
store i32 %103, i32* %10
br label %104
104: ; preds = %101
%105 = load i8, i8* %11
%106 = sext i8 %105 to i32
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %104
%109 = load i8, i8* %11
%110 = sext i8 %109 to i32
%111 = icmp ne i32 %110, 10
br label %112
112: ; preds = %108, %104
%113 = phi i1 [ false, %104 ], [ %111, %108 ]
br i1 %113, label %43, label %114
114: ; preds = %112
%115 = load i32, i32* %10
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.9, i64 0, i64 0), i32 %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%118 = load i32, i32* %5
%119 = call i32 @mpz_clear(i32 %118)
%120 = load i32, i32* %6
%121 = call i32 @mpz_clear(i32 %120)
%122 = load i32, i32* %7
%123 = call i32 @mpz_clear(i32 %122)
%124 = load i32, i32* %8
%125 = call i32 @mpz_clear(i32 %124)
%126 = load i32*, i32** %2
%127 = call i32 @fclose(i32* %126)
%128 = load i32*, i32** %3
%129 = call i32 @fclose(i32* %128)
%130 = load i32*, i32** %4
%131 = call i32 @fclose(i32* %130)
store i32 0, i32* %1
br label %132
132: ; preds = %114, %25
%133 = load i32, i32* %1
ret i32 %133
}

LLVM IR (-O2):
@.str.2 = [15 x i8] c"out/public.rsa\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [17 x i8] c"source/Clair.txt\00"
@.str.5 = [19 x i8] c"out/cipherFile.txt\00"
@.str.6 = [2 x i8] c"w\00"
@.str.9 = [74 x i8] c"-> End of encryption. %d caracters have been encrypted in cipherFile.txt\0A\00"
@str = [25 x i8] c" File Encryption\00"
@str.11 = [44 x i8] c"-> (n,e) has been imported from public.rsa\0A\00"
@str.12 = [39 x i8] c"--------------------------------------\00"
@str.13 = [61 x i8] c"Error while opening one of the 3 files required in cipherRSA\00"
define i32 @cipherRSA() {
%1 = alloca [128 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%4 = 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))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%7 = icmp eq i32* %4, null
%8 = icmp eq i32* %5, null
%9 = or i1 %7, %8
%10 = icmp eq i32* %6, null
%11 = or i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.13, i64 0, i64 0))
br label %58
14: ; preds = %0
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%16 = tail call i32 @mpz_init2(i32 undef, i32 2048)
%17 = tail call i32 @mpz_init2(i32 undef, i32 2048)
%18 = tail call i32 @mpz_init2(i32 undef, i32 2048)
%19 = tail call i32 @mpz_init2(i32 undef, i32 2048)
%20 = tail call i32 @mpz_inp_str(i32 undef, i32* %4, i32 16)
%21 = tail call i32 @mpz_inp_str(i32 undef, i32* %4, i32 16)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 127
br label %24
24: ; preds = %46, %14
%25 = phi i32 [ 0, %14 ], [ %47, %46 ]
%26 = call signext i8 @fgetc(i32* %5)
switch i8 %26, label %27 [
i8 10, label %32
i8 0, label %32
]
27: ; preds = %24
%28 = and i32 %25, 127
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %29
store i8 %26, i8* %30
%31 = icmp eq i32 %28, 126
br i1 %31, label %39, label %46
32: ; preds = %24, %24
%33 = urem i32 %25, 127
%34 = icmp eq i32 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %32
%36 = and i32 %25, 127
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %37
br label %39
39: ; preds = %27, %35
%40 = phi i8* [ %38, %35 ], [ %23, %27 ]
store i8 0, i8* %40
br label %41
41: ; preds = %39, %32
%42 = call i32 @mpz_set_str(i32 undef, i8* %15, i32 62)
%43 = call i32 @mpz_powm(i32 undef, i32 undef, i32 undef, i32 undef)
%44 = call i32 @mpz_out_str(i32* %6, i32 62, i32 undef)
%45 = call i32 @fputc(i8 signext 10, i32* %6)
br label %46
46: ; preds = %41, %27
%47 = add nuw nsw i32 %25, 1
switch i8 %26, label %24 [
i8 10, label %48
i8 0, label %48
]
48: ; preds = %46, %46
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.9, i64 0, i64 0), i32 %47)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%51 = call i32 @mpz_clear(i32 undef)
%52 = call i32 @mpz_clear(i32 undef)
%53 = call i32 @mpz_clear(i32 undef)
%54 = call i32 @mpz_clear(i32 undef)
%55 = call i32 @fclose(i32* %4)
%56 = call i32 @fclose(i32* %5)
%57 = call i32 @fclose(i32* %6)
br label %58
58: ; preds = %48, %12
%59 = phi i32 [ -1, %12 ], [ 0, %48 ]
ret i32 %59
}