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

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ lcg_get_params(unsigned int *, unsigned int *,
                                  unsigned long *);
int /*<<< orphan*/ lcg_initialize(int);
int lcg_rand();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  printf("Starting the LCG without TestU01\n");
  unsigned int C, seed;
  unsigned long M;
  unsigned long numbers_count = 10;
  lcg_initialize(10);
  lcg_get_params(&seed, &C, &M);
  printf("C = %u M (period) = %lu seed = %u\n\n", C, M, seed);
  unsigned long i;
  printf("My lcg_rand()\n");
  for (i = 1; i <= numbers_count; i++) {
    printf("%u ", lcg_rand());
    if (i % M == 0)
      printf("| \n");
  }
  printf("\n\n");
  return (EXIT_SUCCESS);
}


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)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0xa,-0x28(%rbp)
mov    $0xa,%edi
call   1060 <lcg_initialize@plt>
lea    -0x18(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <lcg_get_params@plt>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%ecx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     1214 <main+0xd4>
mov    $0x0,%al
call   1040 <lcg_rand@plt>
mov    %eax,%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x20(%rbp)
cmp    $0x0,%rdx
jne    11fe <main+0xbe>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1203 <main+0xc3>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11b5 <main+0x75>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1070 <lcg_initialize@plt>
lea    0x10(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1060 <lcg_get_params@plt>
mov    0x14(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xe71(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x1,0x8(%rsp)
jne    11d0 <main+0x80>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xe46(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x2,%edx
cmp    $0x2,%rcx
ja     1200 <main+0xb0>
mov    $0x2,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1211 <main+0xc1>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xe05(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x3,%edx
cmp    $0x3,%rcx
ja     1241 <main+0xf1>
mov    $0x3,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1252 <main+0x102>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xdc4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x4,%edx
cmp    $0x4,%rcx
ja     1282 <main+0x132>
mov    $0x4,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1293 <main+0x143>
lea    0xdc9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xd83(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x5,%edx
cmp    $0x5,%rcx
ja     12c3 <main+0x173>
mov    $0x5,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    12d4 <main+0x184>
lea    0xd88(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xd42(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x6,%edx
cmp    $0x6,%rcx
ja     1304 <main+0x1b4>
mov    $0x6,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1315 <main+0x1c5>
lea    0xd47(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xd01(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x7,%edx
cmp    $0x7,%rcx
ja     1345 <main+0x1f5>
mov    $0x7,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1356 <main+0x206>
lea    0xd06(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xcc0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x8,%edx
cmp    $0x8,%rcx
ja     1386 <main+0x236>
mov    $0x8,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1397 <main+0x247>
lea    0xcc5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xc7f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0x9,%edx
cmp    $0x9,%rcx
ja     13c7 <main+0x277>
mov    $0x9,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    13d8 <main+0x288>
lea    0xc84(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcg_rand@plt>
lea    0xc3e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rcx
mov    $0xa,%edx
cmp    $0xa,%rcx
ja     1408 <main+0x2b8>
mov    $0xa,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1419 <main+0x2c9>
lea    0xc43(%rip),%rdi
call   1030 <puts@plt>
lea    0xc02(%rip),%rdi
call   1030 <puts@plt>
mov    0x2bb4(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Starting the LCG without TestU01\0A\00"
@.str.1 = [36 x i8] c"C = %u M (period) = %lu seed = %u\0A\0A\00"
@.str.2 = [15 x i8] c"My lcg_rand()\0A\00"
@.str.3 = [4 x i8] c"%u \00"
@.str.4 = [4 x i8] c"| \0A\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i64 10, i64* %9
%12 = call i32 @lcg_initialize(i32 10)
%13 = call i32 @lcg_get_params(i32* %7, i32* %6, i64* %8)
%14 = load i32, i32* %6
%15 = load i64, i64* %8
%16 = load i32, i32* %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %14, i64 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i64 1, i64* %10
br label %19
19: ; preds = %33, %2
%20 = load i64, i64* %10
%21 = load i64, i64* %9
%22 = icmp ule i64 %20, %21
br i1 %22, label %23, label %36
23: ; preds = %19
%24 = call i32 (...) @lcg_rand()
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i64, i64* %10
%27 = load i64, i64* %8
%28 = urem i64 %26, %27
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %23
br label %33
33: ; preds = %32
%34 = load i64, i64* %10
%35 = add i64 %34, 1
store i64 %35, i64* %10
br label %19
36: ; preds = %19
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"C = %u M (period) = %lu seed = %u\0A\0A\00"
@.str.3 = [4 x i8] c"%u \00"
@EXIT_SUCCESS = global i32 0
@str = [33 x i8] c"Starting the LCG without TestU01\00"
@str.6 = [14 x i8] c"My lcg_rand()\00"
@str.7 = [2 x i8] c"\0A\00"
@str.8 = [3 x i8] c"| \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = tail call i32 @lcg_initialize(i32 10)
%11 = call i32 @lcg_get_params(i32* %4, i32* %3, i64* %5)
%12 = load i32, i32* %3
%13 = load i64, i64* %5
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %12, i64 %13, i32 %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%17 = call i32 (...) @lcg_rand()
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = load i64, i64* %5
%20 = icmp eq i64 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %23
23: ; preds = %2, %21
%24 = call i32 (...) @lcg_rand()
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i64, i64* %5
%27 = urem i64 2, %26
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = call i32 (...) @lcg_rand()
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = load i64, i64* %5
%35 = urem i64 3, %34
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %39
39: ; preds = %37, %31
%40 = call i32 (...) @lcg_rand()
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i64, i64* %5
%43 = urem i64 4, %42
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %39
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %47
47: ; preds = %45, %39
%48 = call i32 (...) @lcg_rand()
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = load i64, i64* %5
%51 = urem i64 5, %50
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %47
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %55
55: ; preds = %53, %47
%56 = call i32 (...) @lcg_rand()
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = load i64, i64* %5
%59 = urem i64 6, %58
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %63
63: ; preds = %61, %55
%64 = call i32 (...) @lcg_rand()
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = load i64, i64* %5
%67 = urem i64 7, %66
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %63
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %71
71: ; preds = %69, %63
%72 = call i32 (...) @lcg_rand()
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %72)
%74 = load i64, i64* %5
%75 = urem i64 8, %74
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %71
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %79
79: ; preds = %77, %71
%80 = call i32 (...) @lcg_rand()
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %80)
%82 = load i64, i64* %5
%83 = urem i64 9, %82
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %87
87: ; preds = %85, %79
%88 = call i32 (...) @lcg_rand()
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %88)
%90 = load i64, i64* %5
%91 = urem i64 10, %90
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %87
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %95
95: ; preds = %93, %87
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%97 = load i32, i32* @EXIT_SUCCESS
ret i32 %97
}