#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_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
long mktime(struct tm *);
long diffsec(int year1, int mon1, int day1, int hour1, int min1, int sec1,
             int year2, int mon2, int day2, int hour2, int min2, int sec2) {
  struct tm t1 = {0}, t2 = {0};
  t1.tm_year = year1 - 1900;
  t1.tm_mon = mon1 - 1;
  t1.tm_mday = day1;
  t1.tm_hour = hour1;
  t1.tm_min = min1;
  t1.tm_sec = sec1;
  t2.tm_year = year2 - 1900;
  t2.tm_mon = mon2 - 1;
  t2.tm_mday = day2;
  t2.tm_hour = hour2;
  t2.tm_min = min2;
  t2.tm_sec = sec2;
  return (mktime(&t2) - mktime(&t1));
}


x86 assembly (clang, -O0):
<diffsec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1030 <memset@plt>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x10(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x58(%rbp)
mov    0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    0x20(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x28(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x58(%rbp),%rdi
call   1040 <mktime@plt>
mov    %rax,-0x60(%rbp)
lea    -0x38(%rbp),%rdi
call   1040 <mktime@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
sub    %rcx,%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffsec>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
mov    0x88(%rsp),%r10d
mov    0x80(%rsp),%r11d
mov    0x78(%rsp),%eax
mov    0x70(%rsp),%ebx
mov    0x68(%rsp),%ebp
movl   $0x0,0x40(%rsp)
movl   $0x0,0x20(%rsp)
add    $0xfffff894,%edi
mov    %edi,0x28(%rsp)
add    $0xffffffff,%esi
mov    %esi,0x2c(%rsp)
mov    %edx,0x30(%rsp)
mov    %ecx,0x34(%rsp)
mov    %r8d,0x38(%rsp)
mov    $0xfffff894,%ecx
add    0x60(%rsp),%ecx
mov    %r9d,0x3c(%rsp)
mov    %ecx,0x8(%rsp)
add    $0xffffffff,%ebp
mov    %ebp,0xc(%rsp)
mov    %ebx,0x10(%rsp)
mov    %eax,0x14(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x1c(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <mktime@plt>
mov    %rax,%rbx
lea    0x28(%rsp),%rdi
call   1030 <mktime@plt>
sub    %rax,%rbx
mov    %rbx,%rax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
define i64 @diffsec(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11) {
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca %struct.tm
%26 = alloca %struct.tm
store i32 %0, i32* %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i32 %3, i32* %16
store i32 %4, i32* %17
store i32 %5, i32* %18
store i32 %6, i32* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i32 %10, i32* %23
store i32 %11, i32* %24
%27 = bitcast %struct.tm* %25 to i8*
%28 = bitcast %struct.tm* %26 to i8*
%29 = load i32, i32* %13
%30 = sub nsw i32 %29, 1900
%31 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 0
store i32 %30, i32* %31
%32 = load i32, i32* %14
%33 = sub nsw i32 %32, 1
%34 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 1
store i32 %33, i32* %34
%35 = load i32, i32* %15
%36 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* %16
%38 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 3
store i32 %37, i32* %38
%39 = load i32, i32* %17
%40 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 4
store i32 %39, i32* %40
%41 = load i32, i32* %18
%42 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 5
store i32 %41, i32* %42
%43 = load i32, i32* %19
%44 = sub nsw i32 %43, 1900
%45 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 0
store i32 %44, i32* %45
%46 = load i32, i32* %20
%47 = sub nsw i32 %46, 1
%48 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 1
store i32 %47, i32* %48
%49 = load i32, i32* %21
%50 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 2
store i32 %49, i32* %50
%51 = load i32, i32* %22
%52 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 3
store i32 %51, i32* %52
%53 = load i32, i32* %23
%54 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 4
store i32 %53, i32* %54
%55 = load i32, i32* %24
%56 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 5
store i32 %55, i32* %56
%57 = call i64 @mktime(%struct.tm* %26)
%58 = call i64 @mktime(%struct.tm* %25)
%59 = sub nsw i64 %57, %58
ret i64 %59
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
define i64 @diffsec(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11) {
%13 = alloca %struct.tm
%14 = alloca %struct.tm
%15 = bitcast %struct.tm* %13 to i8*
%16 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 6
store i32 0, i32* %16
%17 = bitcast %struct.tm* %14 to i8*
%18 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 6
store i32 0, i32* %18
%19 = add nsw i32 %0, -1900
%20 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 0
store i32 %19, i32* %20
%21 = add nsw i32 %1, -1
%22 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 1
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 2
store i32 %2, i32* %23
%24 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 3
store i32 %3, i32* %24
%25 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 4
store i32 %4, i32* %25
%26 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 5
store i32 %5, i32* %26
%27 = add nsw i32 %6, -1900
%28 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 0
store i32 %27, i32* %28
%29 = add nsw i32 %7, -1
%30 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 1
store i32 %29, i32* %30
%31 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 2
store i32 %8, i32* %31
%32 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 3
store i32 %9, i32* %32
%33 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 4
store i32 %10, i32* %33
%34 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 5
store i32 %11, i32* %34
%35 = call i64 @mktime(%struct.tm* %14)
%36 = call i64 @mktime(%struct.tm* %13)
%37 = sub nsw i64 %35, %36
ret i64 %37
}