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

/* Variables and functions */
int /*<<< orphan*/ Decrypt(char *, char *, int, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/, char **);
int /*<<< orphan*/ PrintError(char *);
int /*<<< orphan*/ ReadPrivateParameters(int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, char **);
int /*<<< orphan*/ ReadPublicParameters(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int, char **);
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    fprintf(stderr, "Usage: %s <identity> <l> <plaintext_file>\n", argv[0]);
    return 1;
  }
  int l = atoi(argv[2]), i;
  char *error;
  mpz_t r, n, u, p, q;
  mpz_init(n);
  mpz_init(u);
  mpz_init(p);
  mpz_init(q);
  mpz_init(r);
  ReadPublicParameters(n, u, l, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  ReadPrivateParameters(p, q, r, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  Decrypt(argv[3], argv[1], l, p, q, n, u, r, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  mpz_clear(n);
  mpz_clear(u);
  mpz_clear(p);
  mpz_clear(q);
  mpz_clear(r);
}


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)
cmpl   $0x4,-0x8(%rbp)
jge    11d8 <main+0x48>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe39(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1326 <main+0x196>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x2c(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x30(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x34(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x24(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1090 <ReadPublicParameters@plt>
mov    -0x20(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1251 <main+0xc1>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    1326 <main+0x196>
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1030 <ReadPrivateParameters@plt>
mov    -0x20(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1292 <main+0x102>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    1326 <main+0x196>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x14(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%r11d
mov    -0x24(%rbp),%r10d
lea    -0x20(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <Decrypt@plt>
mov    -0x20(%rbp),%rdi
lea    0xd51(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12fe <main+0x16e>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    1326 <main+0x196>
mov    -0x28(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x2c(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x30(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x34(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x24(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jg     11bd <main+0x2d>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe4d(%rip),%rsi
call   1060 <fprintf@plt>
jmp    125a <main+0xca>
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebp
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
lea    0x18(%rsp),%rcx
mov    %ebp,%edx
call   1090 <ReadPublicParameters@plt>
mov    0x18(%rsp),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1250 <main+0xc0>
lea    0x18(%rsp),%r14
mov    %r14,%rcx
call   1030 <ReadPrivateParameters@plt>
mov    0x18(%rsp),%rdi
lea    0xe0f(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1250 <main+0xc0>
mov    0x8(%rbx),%rsi
mov    0x18(%rbx),%rdi
mov    %r14,0x10(%rsp)
mov    %ebp,%edx
call   1070 <Decrypt@plt>
mov    0x18(%rsp),%rdi
lea    0xde5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1268 <main+0xd8>
mov    0x18(%rsp),%rdi
call   10b0 <PrintError@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
xor    %eax,%eax
jmp    125f <main+0xcf>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s <identity> <l> <plaintext_file>\0A\00"
@.str.1 = [8 x i8] c"success\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %89
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %6
%27 = load i32, i32* %10
%28 = call i32 @mpz_init(i32 %27)
%29 = load i32, i32* %11
%30 = call i32 @mpz_init(i32 %29)
%31 = load i32, i32* %12
%32 = call i32 @mpz_init(i32 %31)
%33 = load i32, i32* %13
%34 = call i32 @mpz_init(i32 %33)
%35 = load i32, i32* %9
%36 = call i32 @mpz_init(i32 %35)
%37 = load i32, i32* %10
%38 = load i32, i32* %11
%39 = load i32, i32* %6
%40 = call i32 @ReadPublicParameters(i32 %37, i32 %38, i32 %39, i8** %8)
%41 = load i8*, i8** %8
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %22
%45 = load i8*, i8** %8
%46 = call i32 @PrintError(i8* %45)
store i32 1, i32* %3
br label %89
47: ; preds = %22
%48 = load i32, i32* %12
%49 = load i32, i32* %13
%50 = load i32, i32* %9
%51 = call i32 @ReadPrivateParameters(i32 %48, i32 %49, i32 %50, i8** %8)
%52 = load i8*, i8** %8
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %47
%56 = load i8*, i8** %8
%57 = call i32 @PrintError(i8* %56)
store i32 1, i32* %3
br label %89
58: ; preds = %47
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 3
%61 = load i8*, i8** %60
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = load i32, i32* %6
%66 = load i32, i32* %12
%67 = load i32, i32* %13
%68 = load i32, i32* %10
%69 = load i32, i32* %11
%70 = load i32, i32* %9
%71 = call i32 @Decrypt(i8* %61, i8* %64, i32 %65, i32 %66, i32 %67, i32 %68, i32 %69, i32 %70, i8** %8)
%72 = load i8*, i8** %8
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %58
%76 = load i8*, i8** %8
%77 = call i32 @PrintError(i8* %76)
store i32 1, i32* %3
br label %89
78: ; preds = %58
%79 = load i32, i32* %10
%80 = call i32 @mpz_clear(i32 %79)
%81 = load i32, i32* %11
%82 = call i32 @mpz_clear(i32 %81)
%83 = load i32, i32* %12
%84 = call i32 @mpz_clear(i32 %83)
%85 = load i32, i32* %13
%86 = call i32 @mpz_clear(i32 %85)
%87 = load i32, i32* %9
%88 = call i32 @mpz_clear(i32 %87)
br label %89
89: ; preds = %78, %75, %55, %44, %16
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s <identity> <l> <plaintext_file>\0A\00"
@.str.1 = [8 x i8] c"success\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = icmp slt i32 %0, 4
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %54
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = bitcast i8** %3 to i8*
%14 = tail call i32 @mpz_init(i32 undef)
%15 = tail call i32 @mpz_init(i32 undef)
%16 = tail call i32 @mpz_init(i32 undef)
%17 = tail call i32 @mpz_init(i32 undef)
%18 = tail call i32 @mpz_init(i32 undef)
%19 = call i32 @ReadPublicParameters(i32 undef, i32 undef, i32 %12, i8** %3)
%20 = load i8*, i8** %3
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %9
%24 = load i8*, i8** %3
%25 = call i32 @PrintError(i8* %24)
br label %52
26: ; preds = %9
%27 = call i32 @ReadPrivateParameters(i32 undef, i32 undef, i32 undef, i8** %3)
%28 = load i8*, i8** %3
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %26
%32 = load i8*, i8** %3
%33 = call i32 @PrintError(i8* %32)
br label %52
34: ; preds = %26
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @Decrypt(i8* %36, i8* %38, i32 %12, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i8** %3)
%40 = load i8*, i8** %3
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %34
%44 = load i8*, i8** %3
%45 = call i32 @PrintError(i8* %44)
br label %52
46: ; preds = %34
%47 = call i32 @mpz_clear(i32 undef)
%48 = call i32 @mpz_clear(i32 undef)
%49 = call i32 @mpz_clear(i32 undef)
%50 = call i32 @mpz_clear(i32 undef)
%51 = call i32 @mpz_clear(i32 undef)
br label %52
52: ; preds = %46, %43, %31, %23
%53 = phi i32 [ 1, %23 ], [ 1, %31 ], [ 1, %43 ], [ 0, %46 ]
br label %54
54: ; preds = %52, %5
%55 = phi i32 [ 1, %5 ], [ %53, %52 ]
ret i32 %55
}