#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 */
double fRand(int /*<<< orphan*/, int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  FILE *out = fopen("entrada.txt", "w");
  char b1[10], b2[10];
  int n, i, j, v, e, h;
  double vv, ee;
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    for (i = 0; i < n; i++) {
      h = (rand() % 10000);
      fprintf(out, "%d\n", h);
      for (j = 0; j < h; j++) {
        vv = (fRand(0, 1000000));
        ee = (fRand(0, 1000000));
        fprintf(out, "%lf %lf\n", vv, ee);
      }
    }
  }
  fprintf(out, "0\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe91(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x28(%rbp)
jne    1195 <main+0x45>
jmp    1246 <main+0xf6>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1241 <main+0xf1>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    122e <main+0xde>
xor    %edi,%edi
mov    $0xf4240,%esi
call   1030 <fRand@plt>
movsd  %xmm0,-0x48(%rbp)
xor    %edi,%edi
mov    $0xf4240,%esi
call   1030 <fRand@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xdfc(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d6 <main+0x86>
jmp    1233 <main+0xe3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119c <main+0x4c>
jmp    1176 <main+0x26>
mov    -0x10(%rbp),%rdi
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe83(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     127e <main+0x11e>
lea    0xe69(%rip),%r14
lea    0xe66(%rip),%r15
lea    0xc(%rsp),%r13
jmp    11db <main+0x7b>
cs nopw 0x0(%rax,%rax,1)
lea    0xe47(%rip),%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     127e <main+0x11e>
test   %eax,%eax
jle    11c0 <main+0x60>
xor    %r12d,%r12d
jmp    11fb <main+0x9b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    11c0 <main+0x60>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbp
imul   $0x68db8bad,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebp,%ebp
jle    11f0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
mov    $0xf4240,%esi
call   1030 <fRand@plt>
movsd  %xmm0,0x10(%rsp)
xor    %edi,%edi
mov    $0xf4240,%esi
call   1030 <fRand@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
mov    %r15,%rsi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1240 <main+0xe0>
jmp    11f0 <main+0x90>
lea    0xd99(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"entrada.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [9 x i8] c"%lf %lf\0A\00"
@.str.5 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
store i32 0, i32* %1
%13 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %2
br label %14
14: ; preds = %0, %48
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
br label %49
19: ; preds = %14
store i32 0, i32* %6
br label %20
20: ; preds = %45, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %48
24: ; preds = %20
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 10000
store i32 %26, i32* %10
%27 = load i32*, i32** %2
%28 = load i32, i32* %10
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
store i32 0, i32* %7
br label %30
30: ; preds = %41, %24
%31 = load i32, i32* %7
%32 = load i32, i32* %10
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = call double @fRand(i32 0, i32 1000000)
store double %35, double* %11
%36 = call double @fRand(i32 0, i32 1000000)
store double %36, double* %12
%37 = load i32*, i32** %2
%38 = load double, double* %11
%39 = load double, double* %12
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %38, double %39)
br label %41
41: ; preds = %34
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %30
44: ; preds = %30
br label %45
45: ; preds = %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %20
48: ; preds = %20
br label %14
49: ; preds = %18
%50 = load i32*, i32** %2
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str = [12 x i8] c"entrada.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [9 x i8] c"%lf %lf\0A\00"
@.str.5 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %31, label %11
7: ; preds = %27, %11
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %0, %7
%12 = phi i32 [ %9, %7 ], [ %5, %0 ]
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %11, %27
%15 = phi i32 [ %28, %27 ], [ 0, %11 ]
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 10000
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %27
20: ; preds = %14, %20
%21 = phi i32 [ %25, %20 ], [ 0, %14 ]
%22 = call double @fRand(i32 0, i32 1000000)
%23 = call double @fRand(i32 0, i32 1000000)
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %22, double %23)
%25 = add nuw nsw i32 %21, 1
%26 = icmp eq i32 %25, %17
br i1 %26, label %27, label %20
27: ; preds = %20, %14
%28 = add nuw nsw i32 %15, 1
%29 = load i32, i32* %1
%30 = icmp slt i32 %28, %29
br i1 %30, label %14, label %7
31: ; preds = %7, %0
%32 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2, i64 1, i32* %2)
ret i32 0
}