#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 */
struct timespec {
  int tv_sec;
  long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ nanosleep(struct timespec *, struct timespec *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  struct timespec interval, remainder;
  struct timespec *intervals;
  double time = 1.0;
  int count = 0, inputSize = 100;
  count = 0;
  int seconds = 0;
  long nanoseconds = 0.0;
  scanf("%d", &inputSize);
  intervals = (struct timespec *)(malloc(sizeof(struct timespec) * inputSize));
  while (count < inputSize) {
    scanf("%lf", &time);
    count = count + 1;
    seconds = (int)time;
    nanoseconds = (time - (double)seconds) * 1000000000;
    intervals[count].tv_sec = seconds;
    intervals[count].tv_nsec = nanoseconds;
  }
  interval.tv_sec = 60;
  interval.tv_nsec = 0;
  nanosleep(&interval, &remainder);
  count = 0;
  while (count < inputSize) {
    printf("a");
    fflush(stdout);
    count = count + 1;
    nanosleep(&intervals[count], &remainder);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe92(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x64,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x4c(%rbp)
movq   $0x0,-0x58(%rbp)
lea    0xe72(%rip),%rdi
lea    -0x48(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movslq -0x48(%rbp),%rax
shl    $0x4,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    123e <main+0xee>
lea    0xe44(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
cvttsd2si -0x40(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x4c(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe07(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x58(%rbp)
mov    -0x4c(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rcx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
jmp    11bc <main+0x6c>
movl   $0x3c,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <nanosleep@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    12ad <main+0x15d>
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
call   1040 <nanosleep@plt>
jmp    1261 <main+0x111>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsp)
movl   $0x64,0x4(%rsp)
lea    0xe8d(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
cmpl   $0x0,0x4(%rsp)
jle    1208 <main+0xb8>
lea    0x18(%r12),%rbx
lea    0xe62(%rip),%r14
lea    0x8(%rsp),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%eax
cvttpd2dq %xmm0,%xmm1
add    $0x1,%r13
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xe11(%rip),%xmm0
cvttsd2si %xmm0,%rcx
mov    %eax,-0x8(%rbx)
mov    %rcx,(%rbx)
movslq 0x4(%rsp),%rax
add    $0x10,%rbx
cmp    %rax,%r13
jl     11c0 <main+0x70>
movl   $0x3c,0x10(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1040 <nanosleep@plt>
cmpl   $0x0,0x4(%rsp)
jle    127f <main+0x12f>
add    $0x10,%r12
xor    %ebx,%ebx
mov    0x2da4(%rip),%r15
lea    0x20(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
add    $0x1,%rbx
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <nanosleep@plt>
movslq 0x4(%rsp),%rax
add    $0x10,%r12
cmp    %rax,%rbx
jl     1250 <main+0x100>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [2 x i8] c"a\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timespec
%7 = alloca %struct.timespec
%8 = alloca %struct.timespec*
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e+00, double* %9
store i32 0, i32* %10
store i32 100, i32* %11
store i32 0, i32* %10
store i32 0, i32* %12
store i64 0, i64* %13
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%15 = load i32, i32* %11
%16 = sext i32 %15 to i64
%17 = mul i64 16, %16
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to %struct.timespec*
store %struct.timespec* %20, %struct.timespec** %8
br label %21
21: ; preds = %25, %2
%22 = load i32, i32* %10
%23 = load i32, i32* %11
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %49
25: ; preds = %21
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
%27 = load i32, i32* %10
%28 = add nsw i32 %27, 1
store i32 %28, i32* %10
%29 = load double, double* %9
%30 = fptosi double %29 to i32
store i32 %30, i32* %12
%31 = load double, double* %9
%32 = load i32, i32* %12
%33 = sitofp i32 %32 to double
%34 = fsub double %31, %33
%35 = fmul double %34, 1.000000e+09
%36 = fptosi double %35 to i64
store i64 %36, i64* %13
%37 = load i32, i32* %12
%38 = load %struct.timespec*, %struct.timespec** %8
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds %struct.timespec, %struct.timespec* %38, i64 %40
%42 = getelementptr inbounds %struct.timespec, %struct.timespec* %41, i32 0, i32 0
store i32 %37, i32* %42
%43 = load i64, i64* %13
%44 = load %struct.timespec*, %struct.timespec** %8
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds %struct.timespec, %struct.timespec* %44, i64 %46
%48 = getelementptr inbounds %struct.timespec, %struct.timespec* %47, i32 0, i32 1
store i64 %43, i64* %48
br label %21
49: ; preds = %21
%50 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
store i32 60, i32* %50
%51 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
store i64 0, i64* %51
%52 = call i32 @nanosleep(%struct.timespec* %6, %struct.timespec* %7)
store i32 0, i32* %10
br label %53
53: ; preds = %57, %49
%54 = load i32, i32* %10
%55 = load i32, i32* %11
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %68
57: ; preds = %53
%58 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%59 = load i32, i32* @stdout
%60 = call i32 @fflush(i32 %59)
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
store i32 %62, i32* %10
%63 = load %struct.timespec*, %struct.timespec** %8
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds %struct.timespec, %struct.timespec* %63, i64 %65
%67 = call i32 @nanosleep(%struct.timespec* %66, %struct.timespec* %7)
br label %53
68: ; preds = %53
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca double
%6 = alloca i32
%7 = bitcast %struct.timespec* %3 to i8*
%8 = bitcast %struct.timespec* %4 to i8*
%9 = bitcast double* %5 to i8*
store double 1.000000e+00, double* %5
%10 = bitcast i32* %6 to i8*
store i32 100, i32* %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%12 = load i32, i32* %6
%13 = shl i32 %12, 4
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to %struct.timespec*
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %33
18: ; preds = %2, %18
%19 = phi i64 [ %21, %18 ], [ 0, %2 ]
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%21 = add nuw nsw i64 %19, 1
%22 = load double, double* %5
%23 = fptosi double %22 to i32
%24 = sitofp i32 %23 to double
%25 = fsub double %22, %24
%26 = fmul double %25, 1.000000e+09
%27 = fptosi double %26 to i64
%28 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i64 %21, i32 0
store i32 %23, i32* %28
%29 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i64 %21, i32 1
store i64 %27, i64* %29
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %21, %31
br i1 %32, label %18, label %33
33: ; preds = %18, %2
%34 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i32 60, i32* %34
%35 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
store i64 0, i64* %35
%36 = call i32 @nanosleep(%struct.timespec* %3, %struct.timespec* %4)
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %50
39: ; preds = %33, %39
%40 = phi i64 [ %44, %39 ], [ 0, %33 ]
%41 = call i32 @putchar(i32 97)
%42 = load i32, i32* @stdout
%43 = call i32 @fflush(i32 %42)
%44 = add nuw nsw i64 %40, 1
%45 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i64 %44
%46 = call i32 @nanosleep(%struct.timespec* %45, %struct.timespec* %4)
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = icmp slt i64 %44, %48
br i1 %49, label %39, label %50
50: ; preds = %39, %33
ret i32 0
}