#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 /*<<< orphan*/ tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int EXIT_SUCCESS;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(void) {
  int i;
  struct timespec ts[50];
  for (i = 0; i < 50; i++)
    clock_gettime(CLOCK_REALTIME, &(ts[i]));
  for (i = 0; i < 50; i++)
    fprintf(stdout, "%ld.%09ld\n", ts[i].tv_sec, ts[i].tv_nsec);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    1171 <main+0x51>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
movslq -0x8(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    11bb <main+0x9b>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
movslq -0x8(%rbp),%rax
mov    -0x19c(%rbp,%rax,8),%edx
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,8),%ecx
lea    0xe58(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1178 <main+0x58>
mov    0x2e0e(%rip),%rax
mov    (%rax),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x190,%rsp
xor    %ebx,%ebx
mov    0x2ea3(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14),%edi
lea    (%rsp,%rbx,1),%rsi
call   1030 <clock_gettime@plt>
add    $0x8,%rbx
cmp    $0x190,%rbx
jne    1140 <main+0x20>
xor    %ebx,%ebx
mov    0x2e7e(%rip),%r15
lea    0xe97(%rip),%r14
nopl   0x0(%rax)
mov    (%r15),%edi
mov    (%rsp,%rbx,8),%ecx
mov    0x4(%rsp,%rbx,8),%edx
mov    %r14,%rsi
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1170 <main+0x50>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_REALTIME = global i32 0
@stdout = global i32 0
@.str = [11 x i8] c"%ld.%09ld\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [50 x %struct.timespec]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 50
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* @CLOCK_REALTIME
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %3, i64 0, i64 %10
%12 = call i32 @clock_gettime(i32 %8, %struct.timespec* %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %4
16: ; preds = %4
store i32 0, i32* %2
br label %17
17: ; preds = %33, %16
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 50
br i1 %19, label %20, label %36
20: ; preds = %17
%21 = load i32, i32* @stdout
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %3, i64 0, i64 %23
%25 = getelementptr inbounds %struct.timespec, %struct.timespec* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %3, i64 0, i64 %28
%30 = getelementptr inbounds %struct.timespec, %struct.timespec* %29, i32 0, i32 0
%31 = load i32, i32* %30
%32 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %31)
br label %33
33: ; preds = %20
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %17
36: ; preds = %17
%37 = load i32, i32* @EXIT_SUCCESS
ret i32 %37
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_REALTIME = global i32 0
@stdout = global i32 0
@.str = [11 x i8] c"%ld.%09ld\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [50 x %struct.timespec]
%2 = bitcast [50 x %struct.timespec]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %8, %3 ]
%5 = load i32, i32* @CLOCK_REALTIME
%6 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %1, i64 0, i64 %4
%7 = call i32 @clock_gettime(i32 %5, %struct.timespec* %6)
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 50
br i1 %9, label %10, label %3
10: ; preds = %3, %10
%11 = phi i64 [ %18, %10 ], [ 0, %3 ]
%12 = load i32, i32* @stdout
%13 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %1, i64 0, i64 %11, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds [50 x %struct.timespec], [50 x %struct.timespec]* %1, i64 0, i64 %11, i32 0
%16 = load i32, i32* %15
%17 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
%18 = add nuw nsw i64 %11, 1
%19 = icmp eq i64 %18, 50
br i1 %19, label %20, label %10
20: ; preds = %10
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}