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

/* Variables and functions */
scalar_t__ date_mktime(struct tm *, int);
time_t date_tm_to_current_pre_1970(struct tm *tm, int utc_offset) {
  struct tm future_tm = {0};
  time_t future_time_t;
  struct tm current_tm = {0};
  future_tm.tm_year = 2026 - 1900;
  future_tm.tm_mon = 0;
  future_tm.tm_mday = 1;
  future_tm.tm_hour = 0;
  future_tm.tm_min = 0;
  future_tm.tm_sec = 0;
  future_time_t = date_mktime(&future_tm, utc_offset);
  current_tm.tm_year = tm->tm_year + 56;
  current_tm.tm_mon = tm->tm_mon;
  current_tm.tm_mday = tm->tm_mday;
  current_tm.tm_hour = tm->tm_hour;
  current_tm.tm_min = tm->tm_min;
  return date_mktime(&current_tm, utc_offset) - future_time_t;
}


x86 assembly (clang, -O0):
<date_tm_to_current_pre_1970>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    -0x78(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movl   $0x7e,-0x40(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x3c(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdi
call   1030 <date_mktime@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x38,%eax
mov    %eax,-0x78(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0xc(%rbp),%esi
lea    -0x78(%rbp),%rdi
call   1030 <date_mktime@plt>
sub    -0x48(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_tm_to_current_pre_1970>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
movq   $0x0,0x58(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movabs $0x10000007e,%rax
mov    %rax,0x30(%rsp)
movups %xmm0,0x48(%rsp)
movups %xmm0,0x38(%rsp)
lea    0x30(%rsp),%rdi
call   1030 <date_mktime@plt>
mov    %rax,%r14
mov    (%rbx),%eax
add    $0x38,%eax
mov    %eax,(%rsp)
mov    0x18(%rbx),%rax
mov    %rax,0x18(%rsp)
mov    0x4(%rbx),%eax
mov    %eax,0x4(%rsp)
movups 0x8(%rbx),%xmm0
movups %xmm0,0x8(%rsp)
mov    %rsp,%rdi
mov    %ebp,%esi
call   1030 <date_mktime@plt>
sub    %r14,%rax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i64, i64, i64, i64, i32 }
define i64 @date_tm_to_current_pre_1970(%struct.tm* nocapture %0, i32 %1) {
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = bitcast %struct.tm* %3 to i8*
%6 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 6
%7 = bitcast i32* %6 to i64*
store i64 0, i64* %7
%8 = bitcast %struct.tm* %4 to i8*
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%10 = bitcast i64* %9 to i8*
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
store i32 126, i32* %11
%12 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
store i32 1, i32* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%15 = bitcast i64* %12 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %15
%16 = bitcast i64* %14 to i8*
%17 = call i64 @date_mktime(%struct.tm* %3, i32 %1)
%18 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 56
%21 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%23 = load i64, i64* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
store i64 %23, i64* %24
%25 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
store i32 %26, i32* %27
%28 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%29 = bitcast i64* %28 to <2 x i64>*
%30 = load <2 x i64>, <2 x i64>* %29
%31 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%32 = bitcast i64* %31 to <2 x i64>*
store <2 x i64> %30, <2 x i64>* %32
%33 = call i64 @date_mktime(%struct.tm* %4, i32 %1)
%34 = sub nsw i64 %33, %17
ret i64 %34
}