#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_wday;
  int tm_mday;
  size_t tm_mon;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ getchar();
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  struct tm *t;
  time_t now;
  time(&now);
  t = localtime(&now);
  char *zile[] = {"Luni",   "Marti",   "Miercuri", "Joi",
                  "Vineri", "Sambata", "Duminica"};
  char *luna[] = {"Ja", "Fe", "Ma"};
  printf("Astazi este %s %02d/%s/%02d.\n", zile[t->tm_wday - 1], t->tm_mday,
         luna[t->tm_mon], t->tm_year - 100);
  if (t->tm_hour > 12) {
    printf("Iar ceasul este %02d:%02d:%02d PM.\n", t->tm_hour - 12, t->tm_min,
           t->tm_sec);
  } else {
    printf("Iar ceasul este %02d:%02d:%02d PM.\n", t->tm_hour, t->tm_min,
           t->tm_sec);
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rdi
call   1070 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c40(%rip),%rsi
mov    $0x38,%edx
call   1060 <memcpy@plt>
mov    0x2c6f(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c6c(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0x2c69(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,8),%rsi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x70(%rbp,%rax,8),%rcx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8d
sub    $0x64,%r8d
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0xc,0x14(%rax)
jle    1222 <main+0xd2>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
sub    $0xc,%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%ecx
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1245 <main+0xf5>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%ecx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
movslq (%rax),%rax
lea    0xf15(%rip),%rcx
movslq -0x4(%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%rax
lea    0xf1b(%rip),%rdi
movslq (%rdi,%rax,4),%rcx
add    %rdi,%rcx
mov    0x10(%rbx),%r8d
add    $0xffffff9c,%r8d
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rbx),%eax
mov    0x18(%rbx),%edx
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
mov    0x1c(%rbx),%ecx
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i64, i32, i32, i32, i32 }
@.str = [5 x i8] c"Luni\00"
@.str.1 = [6 x i8] c"Marti\00"
@.str.2 = [9 x i8] c"Miercuri\00"
@.str.3 = [4 x i8] c"Joi\00"
@.str.4 = [7 x i8] c"Vineri\00"
@.str.5 = [8 x i8] c"Sambata\00"
@.str.6 = [9 x i8] c"Duminica\00"
@__const.main.zile = [7 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [3 x i8] c"Ja\00"
@.str.8 = [3 x i8] c"Fe\00"
@.str.9 = [3 x i8] c"Ma\00"
@__const.main.luna = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [30 x i8] c"Astazi este %s %02d/%s/%02d.\0A\00"
@.str.11 = [36 x i8] c"Iar ceasul este %02d:%02d:%02d PM.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca [7 x i8*]
%5 = alloca [3 x i8*]
store i32 0, i32* %1
%6 = call i32 @time(i32* %3)
%7 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %7, %struct.tm** %2
%8 = bitcast [7 x i8*]* %4 to i8*
%9 = bitcast [3 x i8*]* %5 to i8*
%10 = load %struct.tm*, %struct.tm** %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = load %struct.tm*, %struct.tm** %2
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = load %struct.tm*, %struct.tm** %2
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 2
%22 = load i64, i64* %21
%23 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = load %struct.tm*, %struct.tm** %2
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 3
%27 = load i32, i32* %26
%28 = sub nsw i32 %27, 100
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %16, i32 %19, i8* %24, i32 %28)
%30 = load %struct.tm*, %struct.tm** %2
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 4
%32 = load i32, i32* %31
%33 = icmp sgt i32 %32, 12
br i1 %33, label %34, label %46
34: ; preds = %0
%35 = load %struct.tm*, %struct.tm** %2
%36 = getelementptr inbounds %struct.tm, %struct.tm* %35, i32 0, i32 4
%37 = load i32, i32* %36
%38 = sub nsw i32 %37, 12
%39 = load %struct.tm*, %struct.tm** %2
%40 = getelementptr inbounds %struct.tm, %struct.tm* %39, i32 0, i32 5
%41 = load i32, i32* %40
%42 = load %struct.tm*, %struct.tm** %2
%43 = getelementptr inbounds %struct.tm, %struct.tm* %42, i32 0, i32 6
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %38, i32 %41, i32 %44)
br label %57
46: ; preds = %0
%47 = load %struct.tm*, %struct.tm** %2
%48 = getelementptr inbounds %struct.tm, %struct.tm* %47, i32 0, i32 4
%49 = load i32, i32* %48
%50 = load %struct.tm*, %struct.tm** %2
%51 = getelementptr inbounds %struct.tm, %struct.tm* %50, i32 0, i32 5
%52 = load i32, i32* %51
%53 = load %struct.tm*, %struct.tm** %2
%54 = getelementptr inbounds %struct.tm, %struct.tm* %53, i32 0, i32 6
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %49, i32 %52, i32 %55)
br label %57
57: ; preds = %46, %34
%58 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i64, i32, i32, i32, i32 }
@.str = [5 x i8] c"Luni\00"
@.str.1 = [6 x i8] c"Marti\00"
@.str.2 = [9 x i8] c"Miercuri\00"
@.str.3 = [4 x i8] c"Joi\00"
@.str.4 = [7 x i8] c"Vineri\00"
@.str.5 = [8 x i8] c"Sambata\00"
@.str.6 = [9 x i8] c"Duminica\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
@.str.7 = [3 x i8] c"Ja\00"
@.str.8 = [3 x i8] c"Fe\00"
@.str.9 = [3 x i8] c"Ma\00"
@reltable.main.12 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([3 x i32]* @reltable.main.12 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([3 x i32]* @reltable.main.12 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.9 to i64), i64 ptrtoint ([3 x i32]* @reltable.main.12 to i64)) to i32)]
@.str.10 = [30 x i8] c"Astazi este %s %02d/%s/%02d.\0A\00"
@.str.11 = [36 x i8] c"Iar ceasul este %02d:%02d:%02d PM.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(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 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %9)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%14 = load i64, i64* %13
%15 = shl i64 %14, 2
%16 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main.12 to i8*), i64 %15)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%18 = load i32, i32* %17
%19 = add nsw i32 %18, -100
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %10, i32 %12, i8* %16, i32 %19)
%21 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%22 = load i32, i32* %21
%23 = icmp sgt i32 %22, 12
%24 = add nsw i32 %22, -12
%25 = select i1 %23, i32 %24, i32 %22
%26 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 6
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %25, i32 %27, i32 %29)
%31 = call i32 (...) @getchar()
ret i32 0
}