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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int i, j;
  FILE *outfp = stdout;
  const int nplaces = 1000 * (int)130.0;
  srand(time(NULL));
  fprintf(outfp, "%d\n%d\n%d\n", 10, 4000, 20);
  for (i = 0; i < 4000; i++) {
    fprintf(outfp, "%d", i);
    for (j = 0; j < 20; j++) {
      double d = (rand() % nplaces) / 1000.0;
      int point = rand() % 3;
      if (point == 0)
        fprintf(outfp, " %.1f", d);
      else if (point == 1)
        fprintf(outfp, " %.2f", d);
      else
        fprintf(outfp, " %.3f", d);
    }
    fprintf(outfp, "\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1fbd0,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x18(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0xa,%edx
mov    $0xfa0,%ecx
mov    $0x14,%r8d
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xfa0,-0x8(%rbp)
jge    12a1 <main+0x161>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    1281 <main+0x141>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1fbd0,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xe15(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    122c <main+0xec>
mov    -0x18(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
lea    0xdf5(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    126e <main+0x12e>
cmpl   $0x1,-0x2c(%rbp)
jne    1252 <main+0x112>
mov    -0x18(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
lea    0xdd5(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    1269 <main+0x129>
mov    -0x18(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
lea    0xdbf(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    126e <main+0x12e>
jmp    1273 <main+0x133>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c6 <main+0x86>
mov    -0x18(%rbp),%rdi
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119d <main+0x5d>
xor    %eax,%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    0x2e7e(%rip),%rax
mov    (%rax),%rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
mov    $0xfa0,%ecx
mov    $0x14,%r8d
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe80(%rip),%r12
lea    0xe7f(%rip),%r13
lea    0xe6c(%rip),%r14
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xe58(%rip),%rsi
mov    %edx,0x4(%rsp)
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x14,%r15d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%edx
sub    %ecx,%edx
cmp    $0x1,%edx
mov    %r13,%rsi
cmove  %r12,%rsi
cmp    %ecx,%eax
cmove  %r14,%rsi
movslq %ebp,%rax
imul   $0xffffffff810e35c1,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
imul   $0x1fbd0,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xdc2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0xffffffff,%r15d
jne    11d0 <main+0x80>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    0x4(%rsp),%edx
add    $0x1,%edx
cmp    $0xfa0,%edx
jne    11b0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32* null
@.str = [10 x i8] c"%d\0A%d\0A%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" %.1f\00"
@.str.3 = [6 x i8] c" %.2f\00"
@.str.4 = [6 x i8] c" %.3f\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32*, i32** @stdout
store i32* %8, i32** %4
store i32 130000, i32* %5
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
%11 = load i32*, i32** %4
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 4000, i32 20)
store i32 0, i32* %2
br label %13
13: ; preds = %55, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 4000
br i1 %15, label %16, label %58
16: ; preds = %13
%17 = load i32*, i32** %4
%18 = load i32, i32* %2
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %18)
store i32 0, i32* %3
br label %20
20: ; preds = %49, %16
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 20
br i1 %22, label %23, label %52
23: ; preds = %20
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 130000
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 1.000000e+03
store double %27, double* %6
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 3
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %23
%33 = load i32*, i32** %4
%34 = load double, double* %6
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %48
36: ; preds = %23
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32*, i32** %4
%41 = load double, double* %6
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %41)
br label %47
43: ; preds = %36
%44 = load i32*, i32** %4
%45 = load double, double* %6
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %45)
br label %47
47: ; preds = %43, %39
br label %48
48: ; preds = %47, %32
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %20
52: ; preds = %20
%53 = load i32*, i32** %4
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %55
55: ; preds = %52
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %13
58: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [10 x i8] c"%d\0A%d\0A%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" %.1f\00"
@.str.3 = [6 x i8] c" %.2f\00"
@.str.4 = [6 x i8] c" %.3f\00"
define i32 @main() {
%1 = load i32*, i32** @stdout
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 4000, i32 20)
br label %5
5: ; preds = %0, %23
%6 = phi i32 [ 0, %0 ], [ %25, %23 ]
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ 0, %5 ], [ %21, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 130000
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+03
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 3
%16 = icmp eq i32 %15, 1
%17 = select i1 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%18 = icmp eq i32 %15, 0
%19 = select i1 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %17
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* %19, double %13)
%21 = add nuw nsw i32 %9, 1
%22 = icmp eq i32 %21, 20
br i1 %22, label %23, label %8
23: ; preds = %8
%24 = tail call i32 @fputc(i32 10, i32* %1)
%25 = add nuw nsw i32 %6, 1
%26 = icmp eq i32 %25, 4000
br i1 %26, label %27, label %5
27: ; preds = %23
ret i32 0
}