#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 dummy;
};
typedef int /*<<< orphan*/ ftime;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ tzset();
int main(int argc, char *argv[]) {
  struct tm *mt;
  time_t now;
  char ftime[25];
  setenv("TZ", "std-2", 1);
  tzset();
  if ((now = time(NULL)) == (time_t)-1) {
    perror("time now");
    exit(EXIT_FAILURE);
  }
  if ((mt = localtime(&now)) == NULL) {
    perror("localtime");
    exit(EXIT_FAILURE);
  }
  strftime(ftime, sizeof(ftime), "%d.%m.%Y %H:%M:%S", mt);
  printf("%s\n", ftime);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe5f(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    $0x0,%al
call   1060 <tzset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    11e4 <main+0x64>
lea    0xe38(%rip),%rdi
call   1090 <perror@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1215 <main+0x95>
lea    0xe10(%rip),%rdi
call   1090 <perror@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x19,%esi
lea    0xdf3(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x40(%rbp),%rsi
lea    0xdf5(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xe74(%rip),%rdi
lea    0xe70(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
xor    %eax,%eax
call   1060 <tzset@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
je     11fd <main+0x7d>
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     1206 <main+0x86>
lea    0xe52(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x19,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
lea    0xe48(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
ret
lea    0xe05(%rip),%rdi
jmp    120d <main+0x8d>
lea    0xe05(%rip),%rdi
call   1090 <perror@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [3 x i8] c"TZ\00"
@.str.1 = [6 x i8] c"std-2\00"
@.str.2 = [9 x i8] c"time now\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [10 x i8] c"localtime\00"
@.str.4 = [18 x i8] c"%d.%m.%Y %H:%M:%S\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tm*
%7 = alloca i32
%8 = alloca [25 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = call i32 (...) @tzset()
%11 = call i32 @time(i32* null)
store i32 %11, i32* %7
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %18, %struct.tm** %6
%19 = icmp eq %struct.tm* %18, null
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %17
%25 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%26 = load %struct.tm*, %struct.tm** %6
%27 = call i32 @strftime(i8* %25, i32 25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %26)
%28 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [3 x i8] c"TZ\00"
@.str.1 = [6 x i8] c"std-2\00"
@.str.2 = [9 x i8] c"time now\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [10 x i8] c"localtime\00"
@.str.4 = [18 x i8] c"%d.%m.%Y %H:%M:%S\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [25 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = tail call i32 (...) @tzset()
%9 = tail call i32 @time(i32* null)
store i32 %9, i32* %3
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = call %struct.tm* @localtime(i32* %3)
%17 = icmp eq %struct.tm* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %15
%23 = call i32 @strftime(i8* %6, i32 25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %16)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}