#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 EOF;
int /*<<< orphan*/ current_utc_timestamp(char *);
int getchar();
int /*<<< orphan*/ printf(char *, char *, ...);
int main(int argc, char **argv) {
  char line[1024], timestamp[50];
  int c, idx;
  idx = 0;
  while ((c = getchar()) != EOF) {
    line[idx++] = c;
    if (c == '\n' || idx == 1024) {
      line[idx] = '\0';
      if (!current_utc_timestamp(timestamp)) {
        printf("%s: Error formatting the timestamp\n", argv[0]);
        return 1;
      }
      printf("%s :: %s", timestamp, line);
      idx = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x458(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x454(%rbp)
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%eax
je     121e <main+0xee>
mov    -0x454(%rbp),%eax
mov    %al,%cl
mov    -0x458(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x458(%rbp)
cltq
mov    %cl,-0x410(%rbp,%rax,1)
cmpl   $0xa,-0x454(%rbp)
je     11ae <main+0x7e>
cmpl   $0x400,-0x458(%rbp)
jne    1219 <main+0xe9>
movslq -0x458(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
lea    -0x450(%rbp),%rdi
call   1040 <current_utc_timestamp@plt>
cmp    $0x0,%eax
jne    11f3 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1225 <main+0xf5>
lea    -0x450(%rbp),%rsi
lea    -0x410(%rbp),%rdx
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x458(%rbp)
jmp    1153 <main+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %rsi,0x8(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e92(%rip),%rbx
cmp    (%rbx),%eax
je     11e7 <main+0xb7>
xor    %r14d,%r14d
lea    0x10(%rsp),%r13
lea    0xeb7(%rip),%r15
lea    0x50(%rsp),%r12
xor    %ebp,%ebp
jmp    118b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11e7 <main+0xb7>
movslq %r14d,%r14
mov    %al,0x50(%rsp,%r14,1)
add    $0x1,%r14
cmp    $0xa,%eax
je     11a5 <main+0x75>
cmp    $0x400,%r14d
jne    1180 <main+0x50>
movb   $0x0,0x50(%rsp,%r14,1)
mov    %r13,%rdi
call   1040 <current_utc_timestamp@plt>
test   %eax,%eax
je     11cc <main+0x9c>
xor    %r14d,%r14d
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x50>
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [36 x i8] c"%s: Error formatting the timestamp\0A\00"
@.str.1 = [9 x i8] c"%s :: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [50 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
br label %10
10: ; preds = %42, %2
%11 = call i32 (...) @getchar()
store i32 %11, i32* %8
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %43
14: ; preds = %10
%15 = load i32, i32* %8
%16 = trunc i32 %15 to i8
%17 = load i32, i32* %9
%18 = add nsw i32 %17, 1
store i32 %18, i32* %9
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %19
store i8 %16, i8* %20
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, 10
br i1 %22, label %26, label %23
23: ; preds = %14
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 1024
br i1 %25, label %26, label %42
26: ; preds = %23, %14
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %28
store i8 0, i8* %29
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%31 = call i32 @current_utc_timestamp(i8* %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %26
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %36)
store i32 1, i32* %3
br label %44
38: ; preds = %26
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %39, i8* %40)
store i32 0, i32* %9
br label %42
42: ; preds = %38, %23
br label %10
43: ; preds = %10
store i32 0, i32* %3
br label %44
44: ; preds = %43, %33
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [36 x i8] c"%s: Error formatting the timestamp\0A\00"
@.str.1 = [9 x i8] c"%s :: %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%7 = call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %35, label %10
10: ; preds = %2, %30
%11 = phi i32 [ %32, %30 ], [ %7, %2 ]
%12 = phi i32 [ %31, %30 ], [ 0, %2 ]
%13 = trunc i32 %11 to i8
%14 = add nsw i32 %12, 1
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %15
store i8 %13, i8* %16
%17 = icmp eq i32 %11, 10
%18 = icmp eq i32 %14, 1024
%19 = select i1 %17, i1 true, i1 %18
br i1 %19, label %20, label %30
20: ; preds = %10
%21 = sext i32 %14 to i64
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
%23 = call i32 @current_utc_timestamp(i8* %6)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %1
%27 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %35
28: ; preds = %20
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %5)
br label %30
30: ; preds = %10, %28
%31 = phi i32 [ 0, %28 ], [ %14, %10 ]
%32 = call i32 (...) @getchar()
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %10
35: ; preds = %30, %2, %25
%36 = phi i32 [ 1, %25 ], [ 0, %2 ], [ 0, %30 ]
ret i32 %36
}