#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*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double);
double random_value();
int main() {
  FILE *out = fopen("tests.pairs.10k", "w");
  for (int i = 0; i < 10 * 1024; i++) {
    double x = random_value();
    fprintf(out, "%.20g\t%a\n", x, x);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2800,-0x14(%rbp)
jge    119e <main+0x6e>
mov    $0x0,%al
call   1040 <random_value@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe87(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x2d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%rdi
lea    0xece(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x2800,%ebp
lea    0xebc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <random_value@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movaps %xmm0,%xmm1
call   1030 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1160 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"tests.pairs.10k\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"%.20g\09%a\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10240
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = call double (...) @random_value()
store double %10, double* %4
%11 = load i32*, i32** %2
%12 = load double, double* %4
%13 = load double, double* %4
%14 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %12, double %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [16 x i8] c"tests.pairs.10k\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"%.20g\09%a\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %3
2: ; preds = %3
ret i32 0
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %7, %3 ]
%5 = tail call double (...) @random_value()
%6 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %5, double %5)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 10240
br i1 %8, label %2, label %3
}