#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 */
struct tm {
  int tm_hour;
  int tm_min;
  int tm_sec;
};
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ gettimeofdayoriginal(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ printf(char *, int, int, int, int /*<<< orphan*/, int, int,
                          int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_time() {
  struct timeval later;
  struct timeval later1;
  struct tm localtm;
  struct tm origtm;
  gettimeofday(&later, NULL);
  gettimeofdayoriginal(&later1, NULL);
  localtime_r(&(later.tv_sec), &localtm);
  localtime_r(&(later1.tv_sec), &origtm);
  printf("curr : localtime: %d:%02d:%02d %ld, orig_time : %d:%02d:%02d %ld\n",
         localtm.tm_hour, localtm.tm_min, localtm.tm_sec, later.tv_usec,
         origtm.tm_hour, origtm.tm_min, origtm.tm_sec, later1.tv_usec);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofdayoriginal@plt>
lea    -0x8(%rbp),%rdi
add    $0x4,%rdi
lea    -0x20(%rbp),%rsi
call   1030 <localtime_r@plt>
lea    -0x10(%rbp),%rdi
add    $0x4,%rdi
lea    -0x30(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x2c(%rbp),%r11d
mov    -0x28(%rbp),%r10d
mov    -0x10(%rbp),%eax
lea    0xe49(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <printf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
sub    $0x38,%rsp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofdayoriginal@plt>
lea    0x14(%rsp),%rdi
lea    0x28(%rsp),%rsi
call   1030 <localtime_r@plt>
lea    0xc(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    0x28(%rsp),%esi
mov    0x2c(%rsp),%edx
mov    0x30(%rsp),%ecx
mov    0x10(%rsp),%r8d
mov    0x18(%rsp),%r9d
mov    0x1c(%rsp),%r10d
mov    0x20(%rsp),%r11d
mov    0x8(%rsp),%eax
sub    $0x8,%rsp
lea    0xe47(%rip),%rdi
push   %rax
push   %r11
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i32, i32, i32 }
@.str = [66 x i8] c"curr : localtime: %d:%02d:%02d %ld, orig_time : %d:%02d:%02d %ld\0A\00"
@stdout = global i32 0
define void @print_time() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%6 = call i32 @gettimeofdayoriginal(%struct.timeval* %2, i32* null)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = call i32 @localtime_r(i32* %7, %struct.tm* %3)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%10 = call i32 @localtime_r(i32* %9, %struct.tm* %4)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 1
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 2
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26)
%28 = load i32, i32* @stdout
%29 = call i32 @fflush(i32 %28)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i32, i32, i32 }
@.str = [66 x i8] c"curr : localtime: %d:%02d:%02d %ld, orig_time : %d:%02d:%02d %ld\0A\00"
@stdout = global i32 0
define void @print_time() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = bitcast %struct.timeval* %1 to i8*
%6 = bitcast %struct.timeval* %2 to i8*
%7 = bitcast %struct.tm* %3 to i8*
%8 = bitcast %struct.tm* %4 to i8*
%9 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%10 = call i32 @gettimeofdayoriginal(%struct.timeval* %2, i32* null)
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%12 = call i32 @localtime_r(i32* %11, %struct.tm* %3)
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%14 = call i32 @localtime_r(i32* %13, %struct.tm* %4)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28, i32 %30)
%32 = load i32, i32* @stdout
%33 = call i32 @fflush(i32 %32)
ret void
}