#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 time_t;
struct tm {
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
  scalar_t__ tm_mon;
  scalar_t__ tm_year;
};

/* Variables and functions */
struct tm *localtime(int *);
int printf(char *, scalar_t__, scalar_t__, int /*<<< orphan*/,
           int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/, int, int,
           int, int);
int t_stamp(int s, int ns, int c, int v) {
  time_t tt = s;
  struct tm *q = localtime(&tt);
  ns /= 1000;
  return printf("\n-------- %d.%02d.%02d/%02d:%02d:%02d.%06d %c:%d\n%06d " +
                    (c == 33),
                1900 + q->tm_year, q->tm_mon + 1, q->tm_mday, q->tm_hour,
                q->tm_min, q->tm_sec, ns, c, v, ns);
}


x86 assembly (clang, -O0):
<t_stamp>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
cmpl   $0x21,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
lea    0xe93(%rip),%rdi
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%rsi
add    $0x76c,%rsi
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rdx
add    $0x1,%rdx
mov    -0x30(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%r9d
mov    -0x30(%rbp),%rax
mov    (%rax),%r14d
mov    -0x18(%rbp),%ebx
mov    -0x1c(%rbp),%r11d
mov    -0x20(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_stamp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
movslq %ebp,%rcx
imul   $0x10624dd3,%rcx,%rbp
mov    %rbp,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rbp
add    %ecx,%ebp
xor    %ecx,%ecx
cmp    $0x21,%r15d
sete   %cl
lea    0xe9c(%rip),%rdi
add    %rcx,%rdi
mov    $0x76c,%esi
add    0x18(%rax),%rsi
mov    0x10(%rax),%rdx
add    $0x1,%rdx
mov    0xc(%rax),%ecx
mov    0x8(%rax),%r8d
mov    (%rax),%ebx
mov    0x4(%rax),%r9d
sub    $0x8,%rsp
push   %rbp
push   %r14
push   %r15
push   %rbp
push   %rbx
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64 }
@.str = [55 x i8] c"\0A-------- %d.%02d.%02d/%02d:%02d:%02d.%06d %c:%d\0A%06d \00"
define i32 @t_stamp(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.tm*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
store i32 %11, i32* %9
%12 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %12, %struct.tm** %10
%13 = load i32, i32* %6
%14 = sdiv i32 %13, 1000
store i32 %14, i32* %6
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 33
%17 = zext i1 %16 to i32
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i64 %18
%20 = load %struct.tm*, %struct.tm** %10
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 5
%22 = load i64, i64* %21
%23 = add nsw i64 1900, %22
%24 = load %struct.tm*, %struct.tm** %10
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 4
%26 = load i64, i64* %25
%27 = add nsw i64 %26, 1
%28 = load %struct.tm*, %struct.tm** %10
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 3
%30 = load i32, i32* %29
%31 = load %struct.tm*, %struct.tm** %10
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 2
%33 = load i32, i32* %32
%34 = load %struct.tm*, %struct.tm** %10
%35 = getelementptr inbounds %struct.tm, %struct.tm* %34, i32 0, i32 1
%36 = load i32, i32* %35
%37 = load %struct.tm*, %struct.tm** %10
%38 = getelementptr inbounds %struct.tm, %struct.tm* %37, i32 0, i32 0
%39 = load i32, i32* %38
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = load i32, i32* %6
%44 = call i32 @printf(i8* %19, i64 %23, i64 %27, i32 %30, i32 %33, i32 %36, i32 %39, i32 %40, i32 %41, i32 %42, i32 %43)
ret i32 %44
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64 }
@.str = [55 x i8] c"\0A-------- %d.%02d.%02d/%02d:%02d:%02d.%06d %c:%d\0A%06d \00"
define i32 @t_stamp(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 %0, i32* %5
%7 = call %struct.tm* @localtime(i32* %5)
%8 = sdiv i32 %1, 1000
%9 = icmp eq i32 %2, 33
%10 = zext i1 %9 to i64
%11 = getelementptr inbounds [55 x i8], [55 x i8]* @.str, i64 0, i64 %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1900
%15 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%16 = load i64, i64* %15
%17 = add nsw i64 %16, 1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* %11, i64 %14, i64 %17, i32 %19, i32 %21, i32 %23, i32 %25, i32 %8, i32 %2, i32 %3, i32 %8)
ret i32 %26
}