#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_d(int /*<<< orphan*/, double);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
scalar_t__ mpz_probab_prime_p(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ mpz_sub_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_tdiv_q_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  fprintf(stderr, "Generating list of multipliers for mod(2^32) MWC RNG\n");
  mpz_t candidate, twotothethirtytwo;
  mpz_init(candidate);
  mpz_init_set_d(twotothethirtytwo, (double)(4294967296L));
  char bytes[5];
  bytes[4] = 0;
  unsigned int i, found = 0;
  for (i = 4294967295L; i > 2147483648; i--) {
    mpz_set_ui(candidate, i);
    mpz_mul(candidate, candidate, twotothethirtytwo);
    mpz_sub_ui(candidate, candidate, 1);
    if (mpz_probab_prime_p(candidate, 200)) {
      mpz_sub_ui(candidate, candidate, 1);
      mpz_tdiv_q_ui(candidate, candidate, 2);
      if (mpz_probab_prime_p(candidate, 200)) {
        bytes[0] = (i >> 24) & 0xff;
        bytes[1] = (i >> 16) & 0xff;
        bytes[2] = (i >> 8) & 0xff;
        bytes[3] = i & 0xff;
        fwrite(bytes, 4, 1, stdout);
        found++;
        if (!(found & 0xff))
          fprintf(stderr, ".");
      }
    }
  }
  fprintf(stderr, "\nFound %d multipliers.\n", found);
  mpz_clear(candidate);
  mpz_clear(twotothethirtytwo);
}


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    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x18(%rbp),%edi
movsd  0xe20(%rip),%xmm0
call   1050 <mpz_init_set_d@plt>
movb   $0x0,-0x19(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x80000000,%ecx
cmp    %rcx,%rax
jle    131e <main+0x17e>
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%esi
call   10a0 <mpz_set_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1080 <mpz_mul@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1090 <mpz_sub_ui@plt>
mov    -0x14(%rbp),%edi
mov    $0xc8,%esi
call   1030 <mpz_probab_prime_p@plt>
cmp    $0x0,%rax
je     130b <main+0x16b>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1090 <mpz_sub_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x2,%edx
call   1040 <mpz_tdiv_q_ui@plt>
mov    -0x14(%rbp),%edi
mov    $0xc8,%esi
call   1030 <mpz_probab_prime_p@plt>
cmp    $0x0,%rax
je     1306 <main+0x166>
mov    -0x24(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x1d(%rbp)
mov    -0x24(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x1b(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x1a(%rbp)
lea    -0x1d(%rbp),%rdi
mov    0x2d19(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
jne    1301 <main+0x161>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1306 <main+0x166>
jmp    130b <main+0x16b>
jmp    1310 <main+0x170>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    11f7 <main+0x57>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x18(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e2e(%rip),%r12
mov    (%r12),%edi
lea    0xe4b(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
call   1060 <mpz_init@plt>
movsd  0xe2f(%rip),%xmm0
call   1050 <mpz_init_set_d@plt>
movb   $0x0,0x7(%rsp)
mov    $0xffffffff,%ebp
mov    0x2df1(%rip),%r13
lea    0x3(%rsp),%r14
lea    0xe4b(%rip),%r15
xor    %ebx,%ebx
jmp    120f <main+0x6f>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
cmp    $0x80000000,%ebp
je     128f <main+0xef>
mov    %ebp,%esi
call   10a0 <mpz_set_ui@plt>
call   1080 <mpz_mul@plt>
mov    $0x1,%edx
call   1090 <mpz_sub_ui@plt>
mov    $0xc8,%esi
call   1030 <mpz_probab_prime_p@plt>
test   %rax,%rax
je     1200 <main+0x60>
mov    $0x1,%edx
call   1090 <mpz_sub_ui@plt>
mov    $0x2,%edx
call   1040 <mpz_tdiv_q_ui@plt>
mov    $0xc8,%esi
call   1030 <mpz_probab_prime_p@plt>
test   %rax,%rax
je     1200 <main+0x60>
mov    %ebp,%eax
bswap  %eax
mov    %eax,0x3(%rsp)
mov    0x0(%r13),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
add    $0x1,%ebx
test   %bl,%bl
jne    1200 <main+0x60>
mov    (%r12),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1200 <main+0x60>
mov    (%r12),%edi
lea    0xda6(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"Generating list of multipliers for mod(2^32) MWC RNG\0A\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c".\00"
@.str.2 = [24 x i8] c"\0AFound %d multipliers.\0A\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 [5 x i8]
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = call i32 @mpz_init(i32 %13)
%15 = load i32, i32* %7
%16 = call i32 @mpz_init_set_d(i32 %15, double 0x41F0000000000000)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 4
store i8 0, i8* %17
store i32 0, i32* %10
store i32 -1, i32* %9
br label %18
18: ; preds = %80, %2
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = icmp sgt i64 %20, 2147483648
br i1 %21, label %22, label %83
22: ; preds = %18
%23 = load i32, i32* %6
%24 = load i32, i32* %9
%25 = call i32 @mpz_set_ui(i32 %23, i32 %24)
%26 = load i32, i32* %6
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i32 @mpz_mul(i32 %26, i32 %27, i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = call i32 @mpz_sub_ui(i32 %30, i32 %31, i32 1)
%33 = load i32, i32* %6
%34 = call i64 @mpz_probab_prime_p(i32 %33, i32 200)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %79
36: ; preds = %22
%37 = load i32, i32* %6
%38 = load i32, i32* %6
%39 = call i32 @mpz_sub_ui(i32 %37, i32 %38, i32 1)
%40 = load i32, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @mpz_tdiv_q_ui(i32 %40, i32 %41, i32 2)
%43 = load i32, i32* %6
%44 = call i64 @mpz_probab_prime_p(i32 %43, i32 200)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %78
46: ; preds = %36
%47 = load i32, i32* %9
%48 = lshr i32 %47, 24
%49 = and i32 %48, 255
%50 = trunc i32 %49 to i8
%51 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
store i8 %50, i8* %51
%52 = load i32, i32* %9
%53 = lshr i32 %52, 16
%54 = and i32 %53, 255
%55 = trunc i32 %54 to i8
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 1
store i8 %55, i8* %56
%57 = load i32, i32* %9
%58 = lshr i32 %57, 8
%59 = and i32 %58, 255
%60 = trunc i32 %59 to i8
%61 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 2
store i8 %60, i8* %61
%62 = load i32, i32* %9
%63 = and i32 %62, 255
%64 = trunc i32 %63 to i8
%65 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 3
store i8 %64, i8* %65
%66 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%67 = load i32, i32* @stdout
%68 = call i32 @fwrite(i8* %66, i32 4, i32 1, i32 %67)
%69 = load i32, i32* %10
%70 = add i32 %69, 1
store i32 %70, i32* %10
%71 = load i32, i32* %10
%72 = and i32 %71, 255
%73 = icmp ne i32 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %46
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %77
77: ; preds = %74, %46
br label %78
78: ; preds = %77, %36
br label %79
79: ; preds = %78, %22
br label %80
80: ; preds = %79
%81 = load i32, i32* %9
%82 = add i32 %81, -1
store i32 %82, i32* %9
br label %18
83: ; preds = %18
%84 = load i32, i32* @stderr
%85 = load i32, i32* %10
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %6
%88 = call i32 @mpz_clear(i32 %87)
%89 = load i32, i32* %7
%90 = call i32 @mpz_clear(i32 %89)
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"Generating list of multipliers for mod(2^32) MWC RNG\0A\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c".\00"
@.str.2 = [24 x i8] c"\0AFound %d multipliers.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i8]
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @mpz_init(i32 undef)
%7 = tail call i32 @mpz_init_set_d(i32 undef, double 0x41F0000000000000)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %9
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
br label %13
13: ; preds = %2, %42
%14 = phi i32 [ 0, %2 ], [ %43, %42 ]
%15 = phi i32 [ -1, %2 ], [ %44, %42 ]
%16 = call i32 @mpz_set_ui(i32 undef, i32 %15)
%17 = call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%18 = call i32 @mpz_sub_ui(i32 undef, i32 undef, i32 1)
%19 = call i64 @mpz_probab_prime_p(i32 undef, i32 200)
%20 = icmp eq i64 %19, 0
br i1 %20, label %42, label %21
21: ; preds = %13
%22 = call i32 @mpz_sub_ui(i32 undef, i32 undef, i32 1)
%23 = call i32 @mpz_tdiv_q_ui(i32 undef, i32 undef, i32 2)
%24 = call i64 @mpz_probab_prime_p(i32 undef, i32 200)
%25 = icmp eq i64 %24, 0
br i1 %25, label %42, label %26
26: ; preds = %21
%27 = lshr i32 %15, 24
%28 = trunc i32 %27 to i8
store i8 %28, i8* %8
%29 = lshr i32 %15, 16
%30 = trunc i32 %29 to i8
store i8 %30, i8* %10
%31 = lshr i32 %15, 8
%32 = trunc i32 %31 to i8
store i8 %32, i8* %11
%33 = trunc i32 %15 to i8
store i8 %33, i8* %12
%34 = load i32, i32* @stdout
%35 = call i32 @fwrite(i8* %8, i32 4, i32 1, i32 %34)
%36 = add i32 %14, 1
%37 = and i32 %36, 255
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %26
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %13, %26, %39, %21
%43 = phi i32 [ %36, %26 ], [ %36, %39 ], [ %14, %21 ], [ %14, %13 ]
%44 = add nsw i32 %15, -1
%45 = icmp eq i32 %44, -2147483648
br i1 %45, label %46, label %13
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%49 = call i32 @mpz_clear(i32 undef)
%50 = call i32 @mpz_clear(i32 undef)
ret i32 0
}