#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 uint32_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
void print_leap_positive_timestamp(struct timeval *tv) {
  time_t t2 = (time_t)(tv->tv_sec + 1);
  uint32_t milliseconds = (uint32_t)(tv->tv_usec / 1);
  struct tm *tm_info;
  tm_info = localtime(&t2);
  char b1[200];
  char b2[100];
  char b3[100];
  sprintf(b2, "%u", milliseconds);
  strftime(b1, 50, "%Y-%m-%d %H:%M:%S.", tm_info);
  strftime(b3, 10, " (%z)", tm_info);
  strcat(b1, b2);
  strcat(b1, b3);
  printf("%s ", b1);
}


x86 assembly (clang, -O0):
<print_leap_positive_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
add    $0x1,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xe63(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x32,%esi
lea    0xe4a(%rip),%rdx
call   1050 <strftime@plt>
lea    -0x1c0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0xa,%esi
lea    0xe41(%rip),%rdx
call   1050 <strftime@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_leap_positive_timestamp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1b8,%rsp
mov    0x8(%rdi),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
mov    (%rdi),%ebp
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe83(%rip),%rsi
lea    0x80(%rsp),%r15
mov    %r15,%rdi
mov    %ebp,%edx
call   1070 <sprintf@plt>
lea    0xe6d(%rip),%rdx
lea    0xf0(%rsp),%r14
mov    %r14,%rdi
mov    $0x32,%esi
mov    %rbx,%rcx
call   1050 <strftime@plt>
lea    0xe61(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
mov    %rbx,%rcx
call   1050 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <strcat@plt>
lea    0xe35(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
add    $0x1b8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.tm = type { i32 }
@.str = [3 x i8] c"%u\00"
@.str.1 = [19 x i8] c"%Y-%m-%d %H:%M:%S.\00"
@.str.2 = [6 x i8] c" (%z)\00"
@.str.3 = [4 x i8] c"%s \00"
define void @print_leap_positive_timestamp(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tm*
%6 = alloca [200 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
store %struct.timeval* %0, %struct.timeval** %2
%9 = load %struct.timeval*, %struct.timeval** %2
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%11 = load i64, i64* %10
%12 = add nsw i64 %11, 1
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
%14 = load %struct.timeval*, %struct.timeval** %2
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = sdiv i32 %16, 1
store i32 %17, i32* %4
%18 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %18, %struct.tm** %5
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%20 = load i32, i32* %4
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%23 = load %struct.tm*, %struct.tm** %5
%24 = call i32 @strftime(i8* %22, i32 50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%26 = load %struct.tm*, %struct.tm** %5
%27 = call i32 @strftime(i8* %25, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %26)
%28 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%30 = call i32 @strcat(i8* %28, i8* %29)
%31 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%33 = call i32 @strcat(i8* %31, i8* %32)
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %34)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.tm = type { i32 }
@.str = [3 x i8] c"%u\00"
@.str.1 = [19 x i8] c"%Y-%m-%d %H:%M:%S.\00"
@.str.2 = [6 x i8] c" (%z)\00"
@.str.3 = [4 x i8] c"%s \00"
define void @print_leap_positive_timestamp(%struct.timeval* nocapture %0) {
%2 = alloca i32
%3 = alloca [200 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = add i32 %9, 1
store i32 %10, i32* %2
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%12 = load i32, i32* %11
%13 = call %struct.tm* @localtime(i32* %2)
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%17 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%18 = call i32 @strftime(i8* %14, i32 50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %13)
%19 = call i32 @strftime(i8* %16, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %13)
%20 = call i32 @strcat(i8* %14, i8* %15)
%21 = call i32 @strcat(i8* %14, i8* %16)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %14)
ret void
}