#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 /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i, j, c, len, num, temp, t, res, q;
  srand(time(NULL));
  int r;
  t = rand() % 10000 + 1;
  q = rand() % 10000 + 1;
  printf("%d ", t);
  printf("%d\n", q);
  while (t--) {
    len = rand() % 2 + 1;
    for (i = 0; i < len; i++) {
      r = rand() % 26;
      printf("%c", 'a' + r);
    }
    printf(" ");
    len = rand() % 2 + 1;
    for (i = 0; i < len; i++) {
      r = rand() % 26;
      printf("%c", 'a' + r);
    }
    printf("\n");
  }
  while (q--) {
    len = 1;
    for (i = 0; i < len; i++) {
      r = rand() % 26;
      printf("%c", 'a' + r);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x20(%rbp)
cmp    $0x0,%eax
je     1298 <main+0x158>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121b <main+0xdb>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
add    $0x61,%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0x9b>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1285 <main+0x145>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
add    $0x61,%esi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1245 <main+0x105>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <main+0x6b>
jmp    129d <main+0x15d>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
cmp    $0x0,%eax
je     1312 <main+0x1d2>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12ff <main+0x1bf>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
add    $0x61,%esi
lea    0xd1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12bf <main+0x17f>
lea    0xd00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <main+0x15d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%r14
imul   $0x68db8bad,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r14d
lea    0x1(%r14),%ebp
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
lea    0xe41(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe35(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%eax
inc    %eax
jne    1250 <main+0x100>
test   %ebx,%ebx
je     1231 <main+0xe1>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
neg    %edx
lea    (%rax,%rdx,1),%edi
add    $0x61,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xa0>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
sub    $0x1,%r14d
jb     11df <main+0x8f>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
shr    $0x1f,%eax
add    %ebp,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebp
js     12a7 <main+0x157>
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
neg    %edx
lea    (%rax,%rdx,1),%edi
add    $0x61,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1270 <main+0x120>
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
shr    $0x1f,%eax
add    %ebp,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebp
js     1240 <main+0xf0>
add    $0x1,%ebp
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
neg    %edx
lea    (%rax,%rdx,1),%edi
add    $0x61,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    12d0 <main+0x180>
jmp    1240 <main+0xf0>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [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 i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 10000
%16 = add nsw i32 %15, 1
store i32 %16, i32* %8
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 10000
%19 = add nsw i32 %18, 1
store i32 %19, i32* %10
%20 = load i32, i32* %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %63, %0
%25 = load i32, i32* %8
%26 = add nsw i32 %25, -1
store i32 %26, i32* %8
%27 = icmp ne i32 %25, 0
br i1 %27, label %28, label %65
28: ; preds = %24
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
store i32 0, i32* %2
br label %32
32: ; preds = %42, %28
%33 = load i32, i32* %2
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = call i32 (...) @rand()
%38 = srem i32 %37, 26
store i32 %38, i32* %11
%39 = load i32, i32* %11
%40 = add nsw i32 97, %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %36
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
br label %32
45: ; preds = %32
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 (...) @rand()
%48 = srem i32 %47, 2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
store i32 0, i32* %2
br label %50
50: ; preds = %60, %45
%51 = load i32, i32* %2
%52 = load i32, i32* %5
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %63
54: ; preds = %50
%55 = call i32 (...) @rand()
%56 = srem i32 %55, 26
store i32 %56, i32* %11
%57 = load i32, i32* %11
%58 = add nsw i32 97, %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %50
63: ; preds = %50
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %24
65: ; preds = %24
br label %66
66: ; preds = %84, %65
%67 = load i32, i32* %10
%68 = add nsw i32 %67, -1
store i32 %68, i32* %10
%69 = icmp ne i32 %67, 0
br i1 %69, label %70, label %86
70: ; preds = %66
store i32 1, i32* %5
store i32 0, i32* %2
br label %71
71: ; preds = %81, %70
%72 = load i32, i32* %2
%73 = load i32, i32* %5
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %84
75: ; preds = %71
%76 = call i32 (...) @rand()
%77 = srem i32 %76, 26
store i32 %77, i32* %11
%78 = load i32, i32* %11
%79 = add nsw i32 97, %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %75
%82 = load i32, i32* %2
%83 = add nsw i32 %82, 1
store i32 %83, i32* %2
br label %71
84: ; preds = %71
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %66
86: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 10000
%5 = add nsw i32 %4, 1
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 10000
%8 = add nsw i32 %7, 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%11 = icmp eq i32 %5, 0
br i1 %11, label %12, label %14
12: ; preds = %40, %0
%13 = icmp eq i32 %8, 0
br i1 %13, label %53, label %44
14: ; preds = %0, %40
%15 = phi i32 [ %42, %40 ], [ %4, %0 ]
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 2
%18 = icmp slt i32 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %14, %19
%20 = phi i32 [ %25, %19 ], [ 0, %14 ]
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 26
%23 = add nsw i32 %22, 97
%24 = tail call i32 @putchar(i32 %23)
%25 = add nuw nsw i32 %20, 1
%26 = icmp eq i32 %20, %17
br i1 %26, label %27, label %19
27: ; preds = %19, %14
%28 = tail call i32 @putchar(i32 32)
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 2
%31 = icmp slt i32 %30, 0
br i1 %31, label %40, label %32
32: ; preds = %27, %32
%33 = phi i32 [ %38, %32 ], [ 0, %27 ]
%34 = tail call i32 (...) @rand()
%35 = srem i32 %34, 26
%36 = add nsw i32 %35, 97
%37 = tail call i32 @putchar(i32 %36)
%38 = add nuw nsw i32 %33, 1
%39 = icmp eq i32 %33, %30
br i1 %39, label %40, label %32
40: ; preds = %32, %27
%41 = tail call i32 @putchar(i32 10)
%42 = add nsw i32 %15, -1
%43 = icmp eq i32 %15, 0
br i1 %43, label %12, label %14
44: ; preds = %12, %44
%45 = phi i32 [ %46, %44 ], [ %8, %12 ]
%46 = add nsw i32 %45, -1
%47 = tail call i32 (...) @rand()
%48 = srem i32 %47, 26
%49 = add nsw i32 %48, 97
%50 = tail call i32 @putchar(i32 %49)
%51 = tail call i32 @putchar(i32 10)
%52 = icmp eq i32 %46, 0
br i1 %52, label %53, label %44
53: ; preds = %44, %12
ret i32 0
}