#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 {
  void *tm_sec;
  void *tm_min;
  void *tm_hour;
  void *tm_year;
  void *tm_mon;
  void *tm_mday;
};

/* Variables and functions */
void *atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, unsigned long);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ tzset();
int main(int argc, char **argv) {
  struct tm timestruct;
  time_t time_in_seconds;
  if (argc != 7) {
    fprintf(stderr, "Usage: %s day month year  hour minute second\n", argv[0]);
    return (1);
  }
  timestruct.tm_sec = timestruct.tm_min = timestruct.tm_hour = 0;
  timestruct.tm_mday = atoi(argv[1]);
  timestruct.tm_mon = atoi(argv[2]) - 1;
  timestruct.tm_year = atoi(argv[3]) - 1900;
  timestruct.tm_hour = atoi(argv[4]);
  timestruct.tm_min = atoi(argv[5]);
  timestruct.tm_sec = atoi(argv[6]);
  time_in_seconds = mktime(&timestruct);
  if (time_in_seconds == (time_t)-1) {
    putenv("TZ=MET");
    tzset();
    time_in_seconds = mktime(&timestruct);
  }
  if (time_in_seconds == (time_t)-1)
    return 1;
  printf("%ldL\n", (unsigned long)time_in_seconds);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1296 <main+0x136>
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
add    $0xfffffffffffff894,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <atoi@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1080 <atoi@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1080 <atoi@plt>
mov    %rax,-0x40(%rbp)
lea    -0x40(%rbp),%rdi
call   1070 <mktime@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    1268 <main+0x108>
lea    0xddf(%rip),%rdi
call   1040 <putenv@plt>
mov    $0x0,%al
call   1060 <tzset@plt>
lea    -0x40(%rbp),%rdi
call   1070 <mktime@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    127f <main+0x11f>
movl   $0x1,-0x4(%rbp)
jmp    1296 <main+0x136>
mov    -0x48(%rbp),%rsi
lea    0xdab(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
cmp    $0x7,%edi
jne    1222 <main+0xc2>
mov    0x8(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,0x30(%rsp)
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,%r14
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
movq   %r14,%xmm0
movq   %rax,%xmm1
punpcklqdq %xmm0,%xmm1
paddq  0xe54(%rip),%xmm1
movdqu %xmm1,0x20(%rsp)
mov    0x20(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,0x18(%rsp)
mov    0x28(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,0x10(%rsp)
mov    0x30(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1070 <mktime@plt>
cmp    $0xffffffffffffffff,%rax
jne    120f <main+0xaf>
lea    0xe4b(%rip),%rdi
call   1040 <putenv@plt>
xor    %eax,%eax
call   1060 <tzset@plt>
lea    0x8(%rsp),%rdi
call   1070 <mktime@plt>
cmp    $0xffffffffffffffff,%rax
je     123a <main+0xda>
lea    0xe2f(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    123f <main+0xdf>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xddb(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i8*, i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s day month year hour minute second\0A\00"
@.str.1 = [7 x i8] c"TZ=MET\00"
@.str.2 = [6 x i8] c"%ldL\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tm
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 7
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %66
16: ; preds = %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
store i8* null, i8** %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
store i8* null, i8** %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
store i8* null, i8** %19
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i8* @atoi(i8* %22)
%24 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 5
store i8* %23, i8** %24
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i8* @atoi(i8* %27)
%29 = getelementptr i8, i8* %28, i64 -1
%30 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 4
store i8* %29, i8** %30
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call i8* @atoi(i8* %33)
%35 = getelementptr i8, i8* %34, i64 -1900
%36 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 3
store i8* %35, i8** %36
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 4
%39 = load i8*, i8** %38
%40 = call i8* @atoi(i8* %39)
%41 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
store i8* %40, i8** %41
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 5
%44 = load i8*, i8** %43
%45 = call i8* @atoi(i8* %44)
%46 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
store i8* %45, i8** %46
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 6
%49 = load i8*, i8** %48
%50 = call i8* @atoi(i8* %49)
%51 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
store i8* %50, i8** %51
%52 = call i64 @mktime(%struct.tm* %6)
store i64 %52, i64* %7
%53 = load i64, i64* %7
%54 = icmp eq i64 %53, -1
br i1 %54, label %55, label %59
55: ; preds = %16
%56 = call i32 @putenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%57 = call i32 (...) @tzset()
%58 = call i64 @mktime(%struct.tm* %6)
store i64 %58, i64* %7
br label %59
59: ; preds = %55, %16
%60 = load i64, i64* %7
%61 = icmp eq i64 %60, -1
br i1 %61, label %62, label %63
62: ; preds = %59
store i32 1, i32* %3
br label %66
63: ; preds = %59
%64 = load i64, i64* %7
%65 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %64)
store i32 0, i32* %3
br label %66
66: ; preds = %63, %62, %10
%67 = load i32, i32* %3
ret i32 %67
}

LLVM IR (-O2):
%struct.tm = type { i8*, i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s day month year hour minute second\0A\00"
@.str.1 = [7 x i8] c"TZ=MET\00"
@.str.2 = [6 x i8] c"%ldL\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.tm
%4 = bitcast %struct.tm* %3 to i8*
%5 = icmp eq i32 %0, 7
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %48
10: ; preds = %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i8* @atoi(i8* %15)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
store i8* %16, i8** %17
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i8* @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i8* @atoi(i8* %22)
%24 = insertelement <2 x i8*> poison, i8* %23, i64 0
%25 = insertelement <2 x i8*> %24, i8* %20, i64 1
%26 = getelementptr i8, <2 x i8*> %25, <2 x i64> <i64 -1900, i64 -1>
%27 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%28 = bitcast i8** %27 to <2 x i8*>*
store <2 x i8*> %26, <2 x i8*>* %28
%29 = getelementptr inbounds i8*, i8** %1, i64 4
%30 = load i8*, i8** %29
%31 = tail call i8* @atoi(i8* %30)
store i8* %31, i8** %11
%32 = getelementptr inbounds i8*, i8** %1, i64 5
%33 = load i8*, i8** %32
%34 = tail call i8* @atoi(i8* %33)
store i8* %34, i8** %12
%35 = getelementptr inbounds i8*, i8** %1, i64 6
%36 = load i8*, i8** %35
%37 = tail call i8* @atoi(i8* %36)
store i8* %37, i8** %13
%38 = call i64 @mktime(%struct.tm* %3)
%39 = icmp eq i64 %38, -1
br i1 %39, label %40, label %45
40: ; preds = %10
%41 = tail call i32 @putenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%42 = tail call i32 (...) @tzset()
%43 = call i64 @mktime(%struct.tm* %3)
%44 = icmp eq i64 %43, -1
br i1 %44, label %48, label %45
45: ; preds = %10, %40
%46 = phi i64 [ %43, %40 ], [ %38, %10 ]
%47 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %46)
br label %48
48: ; preds = %40, %45, %6
%49 = phi i32 [ 1, %6 ], [ 0, %45 ], [ 1, %40 ]
ret i32 %49
}