#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_min;
  int tm_hour;
  int tm_yday;
  int tm_year;
  scalar_t__ tm_sec;
};

/* Variables and functions */
time_t mktime(struct tm *ptr) {
  time_t timer;
  timer = 0;
  timer += ptr->tm_sec;
  timer += ptr->tm_min * 60;
  timer += ptr->tm_hour * 3600;
  timer += ptr->tm_yday * 86400;
  timer += (ptr->tm_year - 70) * 31536000;
  timer += ((ptr->tm_year - 69) / 4) * 86400;
  timer -= ((ptr->tm_year - 1) / 100) * 86400;
  timer += ((ptr->tm_year + 299) / 400) * 86400;
  return timer;
}


x86 assembly (clang, -O0):
<mktime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3c,(%rax),%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xe10,0x4(%rax),%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x15180,0x8(%rax),%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
sub    $0x46,%eax
imul   $0x1e13380,%eax,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
sub    $0x45,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
imul   $0x15180,%eax,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
sub    $0x1,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x15180,%eax,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
add    $0x12b,%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
imul   $0x15180,%eax,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mktime>:
movslq (%rdi),%rax
imul   $0x3c,%rax,%rax
add    0x10(%rdi),%rax
movslq 0x4(%rdi),%rcx
imul   $0xe10,%rcx,%rcx
add    %rax,%rcx
movslq 0x8(%rdi),%rax
imul   $0x15180,%rax,%rdx
add    %rcx,%rdx
mov    0xc(%rdi),%eax
imul   $0x1e13380,%eax,%ecx
add    $0x7c6beb00,%ecx
movslq %ecx,%rsi
add    %rdx,%rsi
lea    -0x45(%rax),%ecx
lea    -0x42(%rax),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
sar    $0x2,%edx
imul   $0x15180,%edx,%ecx
movslq %ecx,%rcx
add    %rsi,%rcx
lea    -0x1(%rax),%edx
movslq %edx,%rdx
imul   $0x51eb851f,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
imul   $0x15180,%edx,%edx
movslq %edx,%rdx
sub    %rdx,%rcx
add    $0x12b,%eax
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x27,%rax
add    %edx,%eax
imul   $0x15180,%eax,%eax
cltq
add    %rcx,%rax
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64 }
define i64 @mktime(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i64
store %struct.tm* %0, %struct.tm** %2
store i64 0, i64* %3
%4 = load %struct.tm*, %struct.tm** %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 4
%6 = load i64, i64* %5
%7 = load i64, i64* %3
%8 = add nsw i64 %7, %6
store i64 %8, i64* %3
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = mul nsw i32 %11, 60
%13 = sext i32 %12 to i64
%14 = load i64, i64* %3
%15 = add nsw i64 %14, %13
store i64 %15, i64* %3
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = mul nsw i32 %18, 3600
%20 = sext i32 %19 to i64
%21 = load i64, i64* %3
%22 = add nsw i64 %21, %20
store i64 %22, i64* %3
%23 = load %struct.tm*, %struct.tm** %2
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 2
%25 = load i32, i32* %24
%26 = mul nsw i32 %25, 86400
%27 = sext i32 %26 to i64
%28 = load i64, i64* %3
%29 = add nsw i64 %28, %27
store i64 %29, i64* %3
%30 = load %struct.tm*, %struct.tm** %2
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 3
%32 = load i32, i32* %31
%33 = sub nsw i32 %32, 70
%34 = mul nsw i32 %33, 31536000
%35 = sext i32 %34 to i64
%36 = load i64, i64* %3
%37 = add nsw i64 %36, %35
store i64 %37, i64* %3
%38 = load %struct.tm*, %struct.tm** %2
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 3
%40 = load i32, i32* %39
%41 = sub nsw i32 %40, 69
%42 = sdiv i32 %41, 4
%43 = mul nsw i32 %42, 86400
%44 = sext i32 %43 to i64
%45 = load i64, i64* %3
%46 = add nsw i64 %45, %44
store i64 %46, i64* %3
%47 = load %struct.tm*, %struct.tm** %2
%48 = getelementptr inbounds %struct.tm, %struct.tm* %47, i32 0, i32 3
%49 = load i32, i32* %48
%50 = sub nsw i32 %49, 1
%51 = sdiv i32 %50, 100
%52 = mul nsw i32 %51, 86400
%53 = sext i32 %52 to i64
%54 = load i64, i64* %3
%55 = sub nsw i64 %54, %53
store i64 %55, i64* %3
%56 = load %struct.tm*, %struct.tm** %2
%57 = getelementptr inbounds %struct.tm, %struct.tm* %56, i32 0, i32 3
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 299
%60 = sdiv i32 %59, 400
%61 = mul nsw i32 %60, 86400
%62 = sext i32 %61 to i64
%63 = load i64, i64* %3
%64 = add nsw i64 %63, %62
store i64 %64, i64* %3
%65 = load i64, i64* %3
ret i64 %65
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64 }
define i64 @mktime(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%3 = load i64, i64* %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 60
%7 = sext i32 %6 to i64
%8 = add nsw i64 %3, %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 3600
%12 = sext i32 %11 to i64
%13 = add nsw i64 %8, %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 86400
%17 = sext i32 %16 to i64
%18 = add nsw i64 %13, %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%20 = load i32, i32* %19
%21 = mul i32 %20, 31536000
%22 = add i32 %21, 2087447296
%23 = sext i32 %22 to i64
%24 = add nsw i64 %18, %23
%25 = add nsw i32 %20, -69
%26 = sdiv i32 %25, 4
%27 = mul nsw i32 %26, 86400
%28 = sext i32 %27 to i64
%29 = add nsw i64 %24, %28
%30 = add nsw i32 %20, -1
%31 = sdiv i32 %30, 100
%32 = mul nsw i32 %31, 86400
%33 = sext i32 %32 to i64
%34 = sub i64 %29, %33
%35 = add nsw i32 %20, 299
%36 = sdiv i32 %35, 400
%37 = mul nsw i32 %36, 86400
%38 = sext i32 %37 to i64
%39 = add nsw i64 %34, %38
ret i64 %39
}