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

/* Variables and functions */
int daylight;
struct tm *gmtime(scalar_t__ *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ time(scalar_t__ *);
scalar_t__ timezone;
int /*<<< orphan*/ tzset();
int print_time() {
  struct tm *localtime;
  time_t rawtime;
  time_t offset;
  setenv("TZ", "EST5EDT", 1);
  tzset();
  time(&rawtime);
  offset = (rawtime - timezone + (daylight * 3600));
  localtime = gmtime(&offset);
  printf("%02d/%02d/%02d %2d:%02d:%02d\n", localtime->tm_year + 1900,
         localtime->tm_mon + 1, localtime->tm_mday, localtime->tm_hour,
         localtime->tm_min, localtime->tm_sec);
  return (0);
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    $0x0,%al
call   1050 <tzset@plt>
lea    -0x10(%rbp),%rdi
call   1060 <time@plt>
mov    -0x10(%rbp),%rax
mov    0x2e55(%rip),%rcx
sub    (%rcx),%rax
mov    0x2e3b(%rip),%rcx
imul   $0xe10,(%rcx),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <gmtime@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe1e(%rip),%rdi
mov    %eax,(%rsp)
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
sub    $0x18,%rsp
lea    0xea5(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
xor    %eax,%eax
call   1050 <tzset@plt>
lea    0x10(%rsp),%rdi
call   1060 <time@plt>
mov    0x10(%rsp),%rax
mov    0x2e57(%rip),%rcx
sub    (%rcx),%rax
mov    0x2e3d(%rip),%rcx
movslq (%rcx),%rcx
imul   $0xe10,%rcx,%rcx
add    %rax,%rcx
mov    %rcx,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1070 <gmtime@plt>
mov    $0x76c,%esi
add    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
mov    %eax,(%rsp)
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"TZ\00"
@.str.1 = [8 x i8] c"EST5EDT\00"
@timezone = global i64 0
@daylight = global i32 0
@.str.2 = [30 x i8] c"%02d/%02d/%02d %2d:%02d:%02d\0A\00"
define i32 @print_time() {
%1 = alloca %struct.tm*
%2 = alloca i64
%3 = alloca i64
%4 = call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = call i32 (...) @tzset()
%6 = call i32 @time(i64* %2)
%7 = load i64, i64* %2
%8 = load i64, i64* @timezone
%9 = sub nsw i64 %7, %8
%10 = load i32, i32* @daylight
%11 = mul nsw i32 %10, 3600
%12 = sext i32 %11 to i64
%13 = add nsw i64 %9, %12
store i64 %13, i64* %3
%14 = call %struct.tm* @gmtime(i64* %3)
store %struct.tm* %14, %struct.tm** %1
%15 = load %struct.tm*, %struct.tm** %1
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1900
%19 = load %struct.tm*, %struct.tm** %1
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
%23 = load %struct.tm*, %struct.tm** %1
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 2
%25 = load i32, i32* %24
%26 = load %struct.tm*, %struct.tm** %1
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 3
%28 = load i32, i32* %27
%29 = load %struct.tm*, %struct.tm** %1
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 4
%31 = load i32, i32* %30
%32 = load %struct.tm*, %struct.tm** %1
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 5
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %22, i32 %25, i32 %28, i32 %31, i32 %34)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"TZ\00"
@.str.1 = [8 x i8] c"EST5EDT\00"
@timezone = global i64 0
@daylight = global i32 0
@.str.2 = [30 x i8] c"%02d/%02d/%02d %2d:%02d:%02d\0A\00"
define i32 @print_time() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = tail call i32 (...) @tzset()
%7 = call i32 @time(i64* %1)
%8 = load i64, i64* %1
%9 = load i64, i64* @timezone
%10 = sub i64 %8, %9
%11 = load i32, i32* @daylight
%12 = mul nsw i32 %11, 3600
%13 = sext i32 %12 to i64
%14 = add nsw i64 %10, %13
store i64 %14, i64* %2
%15 = call %struct.tm* @gmtime(i64* %2)
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 0
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1900
%19 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 1
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 1
%22 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 2
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 3
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 4
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.tm, %struct.tm* %15, i64 0, i32 5
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %21, i32 %23, i32 %25, i32 %27, i32 %29)
ret i32 0
}