#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 /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void initmsg() {
  time_t t = time(NULL);
  struct tm tm = *localtime(&t);
  int i;
  for (i = 0; i < sizeof("3Treloaded") - 1; i++)
    putchar('*');
  printf("****\n");
  printf("* %s *\n", "3Treloaded");
  i = 0;
  for (i = 0; i < sizeof("3Treloaded") - 1; i++)
    putchar('*');
  printf("****\n");
  printf("Copyright (C) %d %s <zeboneyo@gmail.com>\n", tm.tm_year + 1900,
         "Rafael Romao");
}


x86 assembly (clang, -O0):
<initmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0xa,%rax
jae    118f <initmsg+0x4f>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <initmsg+0x29>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe62(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0xa,%rax
jae    11e6 <initmsg+0xa6>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <initmsg+0x80>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0x76c,%esi
lea    0xe15(%rip),%rdi
lea    0xe38(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initmsg>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <localtime@plt>
mov    $0x76c,%ebx
add    (%rax),%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
lea    0xe6f(%rip),%r14
mov    %r14,%rdi
call   1050 <puts@plt>
lea    0xe16(%rip),%rdi
lea    0xe17(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
lea    0xda8(%rip),%rdi
lea    0xdcb(%rip),%rdx
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [6 x i8] c"****\0A\00"
@.str.1 = [8 x i8] c"* %s *\0A\00"
@.str.2 = [11 x i8] c"3Treloaded\00"
@.str.3 = [42 x i8] c"Copyright (C) %d %s <zeboneyo@gmail.com>\0A\00"
@.str.4 = [13 x i8] c"Rafael Romao\00"
define void @initmsg() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca i32
%4 = call i32 @time(i32* null)
store i32 %4, i32* %1
%5 = call %struct.tm* @localtime(i32* %1)
%6 = bitcast %struct.tm* %2 to i8*
%7 = bitcast %struct.tm* %5 to i8*
store i32 0, i32* %3
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 10
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = call i32 @putchar(i8 signext 42)
br label %14
14: ; preds = %12
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %8
17: ; preds = %8
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %3
br label %20
20: ; preds = %26, %17
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = icmp ult i64 %22, 10
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = call i32 @putchar(i8 signext 42)
br label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %20
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%31 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1900
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str.1 = [8 x i8] c"* %s *\0A\00"
@.str.2 = [11 x i8] c"3Treloaded\00"
@.str.3 = [42 x i8] c"Copyright (C) %d %s <zeboneyo@gmail.com>\0A\00"
@.str.4 = [13 x i8] c"Rafael Romao\00"
@str.5 = [5 x i8] c"****\00"
define void @initmsg() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @putchar(i8 signext 42)
%8 = call i32 @putchar(i8 signext 42)
%9 = call i32 @putchar(i8 signext 42)
%10 = call i32 @putchar(i8 signext 42)
%11 = call i32 @putchar(i8 signext 42)
%12 = call i32 @putchar(i8 signext 42)
%13 = call i32 @putchar(i8 signext 42)
%14 = call i32 @putchar(i8 signext 42)
%15 = call i32 @putchar(i8 signext 42)
%16 = call i32 @putchar(i8 signext 42)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @putchar(i8 signext 42)
%20 = call i32 @putchar(i8 signext 42)
%21 = call i32 @putchar(i8 signext 42)
%22 = call i32 @putchar(i8 signext 42)
%23 = call i32 @putchar(i8 signext 42)
%24 = call i32 @putchar(i8 signext 42)
%25 = call i32 @putchar(i8 signext 42)
%26 = call i32 @putchar(i8 signext 42)
%27 = call i32 @putchar(i8 signext 42)
%28 = call i32 @putchar(i8 signext 42)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
%30 = add nsw i32 %6, 1900
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
ret void
}