#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*/ GetParameters(int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ PrintError(char *);
int /*<<< orphan*/ WritePrivateParametersToFile(int /*<<< orphan*/,
                                                int /*<<< orphan*/, char **);
int /*<<< orphan*/ WritePublicParametersToFile(int /*<<< orphan*/,
                                               int /*<<< orphan*/, char **);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  mpz_t p, q, n, u;
  char *error;
  mpz_init(p);
  mpz_init(q);
  mpz_init(n);
  mpz_init(u);
  GetParameters(p, q, n, u);
  WritePrivateParametersToFile(p, q, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  WritePublicParametersToFile(n, u, &error);
  if (strcmp(error, "success") != 0) {
    PrintError(error);
    return 1;
  }
  mpz_clear(p);
  mpz_clear(q);
  mpz_clear(n);
  mpz_clear(u);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x18(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x20(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1080 <GetParameters@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1030 <WritePrivateParametersToFile@plt>
mov    -0x28(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11f5 <main+0x85>
mov    -0x28(%rbp),%rdi
call   1090 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    125a <main+0xea>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1060 <WritePublicParametersToFile@plt>
mov    -0x28(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1233 <main+0xc3>
mov    -0x28(%rbp),%rdi
call   1090 <PrintError@plt>
movl   $0x1,-0x4(%rbp)
jmp    125a <main+0xea>
mov    -0x14(%rbp),%edi
call   1070 <mpz_clear@plt>
mov    -0x18(%rbp),%edi
call   1070 <mpz_clear@plt>
mov    -0x1c(%rbp),%edi
call   1070 <mpz_clear@plt>
mov    -0x20(%rbp),%edi
call   1070 <mpz_clear@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1040 <mpz_init@plt>
call   1080 <GetParameters@plt>
mov    %rsp,%rdx
call   1030 <WritePrivateParametersToFile@plt>
mov    (%rsp),%rdi
lea    0xe63(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11c4 <main+0x54>
mov    %rsp,%rdx
call   1060 <WritePublicParametersToFile@plt>
mov    (%rsp),%rdi
lea    0xe46(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d4 <main+0x64>
mov    (%rsp),%rdi
call   1090 <PrintError@plt>
mov    $0x1,%eax
pop    %rcx
ret
call   1070 <mpz_clear@plt>
call   1070 <mpz_clear@plt>
call   1070 <mpz_clear@plt>
call   1070 <mpz_clear@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [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 i32
%9 = alloca i32
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %6
%12 = call i32 @mpz_init(i32 %11)
%13 = load i32, i32* %7
%14 = call i32 @mpz_init(i32 %13)
%15 = load i32, i32* %8
%16 = call i32 @mpz_init(i32 %15)
%17 = load i32, i32* %9
%18 = call i32 @mpz_init(i32 %17)
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = call i32 @GetParameters(i32 %19, i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @WritePrivateParametersToFile(i32 %24, i32 %25, i8** %10)
%27 = load i8*, i8** %10
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %2
%31 = load i8*, i8** %10
%32 = call i32 @PrintError(i8* %31)
store i32 1, i32* %3
br label %52
33: ; preds = %2
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = call i32 @WritePublicParametersToFile(i32 %34, i32 %35, i8** %10)
%37 = load i8*, i8** %10
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = load i8*, i8** %10
%42 = call i32 @PrintError(i8* %41)
store i32 1, i32* %3
br label %52
43: ; preds = %33
%44 = load i32, i32* %6
%45 = call i32 @mpz_clear(i32 %44)
%46 = load i32, i32* %7
%47 = call i32 @mpz_clear(i32 %46)
%48 = load i32, i32* %8
%49 = call i32 @mpz_clear(i32 %48)
%50 = load i32, i32* %9
%51 = call i32 @mpz_clear(i32 %50)
store i32 0, i32* %3
br label %52
52: ; preds = %43, %40, %30
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [8 x i8] c"success\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i32 @mpz_init(i32 undef)
%6 = tail call i32 @mpz_init(i32 undef)
%7 = tail call i32 @mpz_init(i32 undef)
%8 = tail call i32 @mpz_init(i32 undef)
%9 = tail call i32 @GetParameters(i32 undef, i32 undef, i32 undef, i32 undef)
%10 = call i32 @WritePrivateParametersToFile(i32 undef, i32 undef, i8** %3)
%11 = load i8*, i8** %3
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = call i32 @PrintError(i8* %15)
br label %30
17: ; preds = %2
%18 = call i32 @WritePublicParametersToFile(i32 undef, i32 undef, i8** %3)
%19 = load i8*, i8** %3
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = call i32 @PrintError(i8* %23)
br label %30
25: ; preds = %17
%26 = call i32 @mpz_clear(i32 undef)
%27 = call i32 @mpz_clear(i32 undef)
%28 = call i32 @mpz_clear(i32 undef)
%29 = call i32 @mpz_clear(i32 undef)
br label %30
30: ; preds = %25, %22, %14
%31 = phi i32 [ 1, %14 ], [ 1, %22 ], [ 0, %25 ]
ret i32 %31
}