#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 */
double genrand();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sgenrand(int);
main() {
  int j;
  sgenrand(4357);
  for (j = 0; j < 1000; j++) {
    printf("%5f ", genrand());
    if (j % 8 == 7)
      printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1105,%edi
call   1050 <sgenrand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11a7 <main+0x77>
mov    $0x0,%al
call   1030 <genrand@plt>
lea    0xe95(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    1194 <main+0x64>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x20>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1105,%edi
call   1060 <sgenrand@plt>
lea    0xeac(%rip),%rbx
xor    %ebp,%ebp
jmp    116b <main+0x2b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x3e8,%ebp
je     1190 <main+0x50>
xor    %eax,%eax
call   1030 <genrand@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1160 <main+0x20>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%5f \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @sgenrand(i32 4357)
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = call double (...) @genrand()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %8)
%10 = load i32, i32* %2
%11 = srem i32 %10, 8
%12 = icmp eq i32 %11, 7
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %7
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [5 x i8] c"%5f \00"
define i32 @main() {
%1 = tail call i32 @sgenrand(i32 4357)
br label %2
2: ; preds = %0, %10
%3 = phi i32 [ 0, %0 ], [ %11, %10 ]
%4 = tail call double (...) @genrand()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %4)
%6 = and i32 %3, 7
%7 = icmp eq i32 %6, 7
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @putchar(i32 10)
br label %10
10: ; preds = %2, %8
%11 = add nuw nsw i32 %3, 1
%12 = icmp eq i32 %11, 1000
br i1 %12, label %13, label %2
13: ; preds = %10
%14 = tail call i32 @putchar(i32 10)
ret i32 0
}