#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 clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
int /*<<< orphan*/ printf(char *, int, char *, char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  int iMSec = 0;
  int iYear;
  int i;
  char aEvent[10 + 1];
  char aEvent2[10 + 1];
  clock_t tStart, tDiff;
  tStart = clock();
  do {
    iYear = (rand() % 2000);
    for (i = -1; ++i < 10;) {
      aEvent[i] = (rand() % 26) + 65;
      aEvent2[i] = (rand() % 26) + 97;
    }
    aEvent[10] = '\0';
    aEvent2[10] = '\0';
    printf("{year:%d,events:[{e1:'%s'},{e2:'%s'}]}\n", iYear, aEvent, aEvent2);
    tDiff = clock() - tStart;
    iMSec = tDiff * 1000 / CLOCKS_PER_SEC;
  } while ((iMSec * 0.001) < 1);
  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   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x7d0,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmp    $0xa,%eax
jge    11e8 <main+0x98>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x1b(%rbp,%rax,1)
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x26(%rbp,%rax,1)
jmp    1199 <main+0x49>
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
lea    -0x1b(%rbp),%rdx
lea    -0x26(%rbp),%rcx
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
imul   $0x3e8,-0x30(%rbp),%eax
mov    0x2dc6(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xdd3(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdbf(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1180 <main+0x30>
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
sub    $0x18,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebx
lea    0xd(%rsp),%r15
lea    0x2(%rsp),%r12
mov    0x2e62(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
xor    %r14d,%r14d
nopl   0x0(%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
sub    %edx,%eax
add    $0x41,%al
mov    %al,0xd(%rsp,%r14,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
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x2(%rsp,%r14,1)
add    $0x1,%r14
cmp    $0xa,%r14
jne    11a0 <main+0x50>
movslq %ebp,%rsi
imul   $0x10624dd3,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rax
add    %ecx,%eax
imul   $0x7d0,%eax,%eax
sub    %eax,%esi
movb   $0x0,0x17(%rsp)
movb   $0x0,0xc(%rsp)
lea    0xdda(%rip),%rdi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
cltd
idivl  0x0(%r13)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd9c(%rip),%xmm0
movsd  0xd9c(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1190 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"{year:%d,events:[{e1:'%s'},{e2:'%s'}]}\0A\00"
@CLOCKS_PER_SEC = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [11 x i8]
%6 = alloca [11 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %2
%11 = call i32 (...) @clock()
store i32 %11, i32* %7
br label %12
12: ; preds = %48, %0
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 2000
store i32 %14, i32* %3
store i32 -1, i32* %4
br label %15
15: ; preds = %19, %12
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 26
%22 = add nsw i32 %21, 65
%23 = trunc i32 %22 to i8
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 %25
store i8 %23, i8* %26
%27 = call i32 (...) @rand()
%28 = srem i32 %27, 26
%29 = add nsw i32 %28, 97
%30 = trunc i32 %29 to i8
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 %32
store i8 %30, i8* %33
br label %15
34: ; preds = %15
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 10
store i8 0, i8* %35
%36 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 10
store i8 0, i8* %36
%37 = load i32, i32* %3
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%40 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %37, i8* %38, i8* %39)
%41 = call i32 (...) @clock()
%42 = load i32, i32* %7
%43 = sub nsw i32 %41, %42
store i32 %43, i32* %8
%44 = load i32, i32* %8
%45 = mul nsw i32 %44, 1000
%46 = load i32, i32* @CLOCKS_PER_SEC
%47 = sdiv i32 %45, %46
store i32 %47, i32* %2
br label %48
48: ; preds = %34
%49 = load i32, i32* %2
%50 = sitofp i32 %49 to double
%51 = fmul double %50, 1.000000e-03
%52 = fcmp olt double %51, 1.000000e+00
br i1 %52, label %12, label %53
53: ; preds = %48
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"{year:%d,events:[{e1:'%s'},{e2:'%s'}]}\0A\00"
@CLOCKS_PER_SEC = global i32 0
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [11 x i8]
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = tail call i32 (...) @clock()
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 10
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
br label %10
10: ; preds = %26, %0
%11 = call i32 (...) @rand()
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %24, %12 ]
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 26
%16 = trunc i32 %15 to i8
%17 = add nsw i8 %16, 65
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 %13
store i8 %17, i8* %18
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 26
%21 = trunc i32 %20 to i8
%22 = add nsw i8 %21, 97
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %13
store i8 %22, i8* %23
%24 = add nuw nsw i64 %13, 1
%25 = icmp eq i64 %24, 10
br i1 %25, label %26, label %12
26: ; preds = %12
%27 = srem i32 %11, 2000
store i8 0, i8* %8
store i8 0, i8* %9
%28 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %27, i8* %5, i8* %6)
%29 = call i32 (...) @clock()
%30 = sub nsw i32 %29, %7
%31 = mul nsw i32 %30, 1000
%32 = load i32, i32* @CLOCKS_PER_SEC
%33 = sdiv i32 %31, %32
%34 = sitofp i32 %33 to double
%35 = fmul double %34, 1.000000e-03
%36 = fcmp olt double %35, 1.000000e+00
br i1 %36, label %10, label %37
37: ; preds = %26
ret i32 0
}