#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*/ KeyGen(unsigned char *, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/, char **);
int /*<<< orphan*/ PrintError(char *);
int /*<<< orphan*/ ReadPrivateParameters(int /*<<< orphan*/, int /*<<< orphan*/,
                                         char **);
int /*<<< orphan*/ ReadPublicParameters(int /*<<< orphan*/, int /*<<< orphan*/,
                                        char **);
int /*<<< orphan*/ WritePrivateParametersToFile(int /*<<< orphan*/, 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 < 2) {
    fprintf(stderr, "Usage: %s <identity>\n", argv[0]);
    return 1;
  }
  int i;
  char *error;
  mpz_t n, u, p, q, rj;
  mpz_init(n);
  mpz_init(u);
  mpz_init(p);
  mpz_init(q);
  mpz_init(rj);
  ReadPublicParameters(n, u, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  ReadPrivateParameters(p, q, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  KeyGen((unsigned char *)argv[1], rj, n, u, p, q, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  WritePrivateParametersToFile(rj, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  mpz_clear(rj);
  mpz_clear(n);
  mpz_clear(u);
  mpz_clear(p);
  mpz_clear(q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-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   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x1ab>
mov    -0x24(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x28(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x2c(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x30(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x34(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
lea    -0x20(%rbp),%rdx
call   10a0 <ReadPublicParameters@plt>
mov    -0x20(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     123e <main+0xae>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x1ab>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
lea    -0x20(%rbp),%rdx
call   1030 <ReadPrivateParameters@plt>
mov    -0x20(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     127c <main+0xec>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x1ab>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
lea    -0x20(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <KeyGen@plt>
mov    -0x20(%rbp),%rdi
lea    0xd69(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     12d1 <main+0x141>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x1ab>
mov    -0x34(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1050 <WritePrivateParametersToFile@plt>
mov    -0x20(%rbp),%rdi
lea    0xd2e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     130c <main+0x17c>
mov    -0x20(%rbp),%rdi
call   10b0 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x1ab>
mov    -0x34(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x24(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x28(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x2c(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x30(%rbp),%edi
call   1090 <mpz_clear@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     11bc <main+0x2c>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe4e(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1265 <main+0xd5>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
lea    0x10(%rsp),%rdx
call   10a0 <ReadPublicParameters@plt>
mov    0x10(%rsp),%rdi
lea    0xe2b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    125b <main+0xcb>
lea    0x10(%rsp),%r14
mov    %r14,%rdx
call   1030 <ReadPrivateParameters@plt>
mov    0x10(%rsp),%rdi
lea    0xe08(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    125b <main+0xcb>
mov    0x8(%rbx),%rdi
mov    %r14,(%rsp)
call   1040 <KeyGen@plt>
mov    0x10(%rsp),%rdi
lea    0xde5(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    125b <main+0xcb>
lea    0x10(%rsp),%rsi
call   1050 <WritePrivateParametersToFile@plt>
mov    0x10(%rsp),%rdi
lea    0xdc5(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1272 <main+0xe2>
mov    0x10(%rsp),%rdi
call   10b0 <PrintError@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
call   1090 <mpz_clear@plt>
call   1090 <mpz_clear@plt>
call   1090 <mpz_clear@plt>
call   1090 <mpz_clear@plt>
call   1090 <mpz_clear@plt>
xor    %eax,%eax
jmp    126a <main+0xda>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <identity>\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, 2
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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %57
9: ; preds = %2
%10 = bitcast i8** %3 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 = call i32 @ReadPublicParameters(i32 undef, i32 undef, i8** %3)
%17 = load i8*, i8** %3
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %9
%21 = load i8*, i8** %3
%22 = call i32 @PrintError(i8* %21)
br label %55
23: ; preds = %9
%24 = call i32 @ReadPrivateParameters(i32 undef, i32 undef, i8** %3)
%25 = load i8*, i8** %3
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = call i32 @PrintError(i8* %29)
br label %55
31: ; preds = %23
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @KeyGen(i8* %33, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i8** %3)
%35 = load i8*, i8** %3
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %31
%39 = load i8*, i8** %3
%40 = call i32 @PrintError(i8* %39)
br label %55
41: ; preds = %31
%42 = call i32 @WritePrivateParametersToFile(i32 undef, i8** %3)
%43 = load i8*, i8** %3
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %41
%47 = load i8*, i8** %3
%48 = call i32 @PrintError(i8* %47)
br label %55
49: ; preds = %41
%50 = call i32 @mpz_clear(i32 undef)
%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)
br label %55
55: ; preds = %49, %46, %38, %28, %20
%56 = phi i32 [ 1, %20 ], [ 1, %28 ], [ 1, %38 ], [ 1, %46 ], [ 0, %49 ]
br label %57
57: ; preds = %55, %5
%58 = phi i32 [ 1, %5 ], [ %56, %55 ]
ret i32 %58
}