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

/* Variables and functions */
int /*<<< orphan*/ mktime(struct tm *);
time_t __unixtime(unsigned timestamp, unsigned datestamp) {
  struct tm tmbuf;
  register struct tm *tm = &tmbuf;
  tm->tm_sec = (timestamp & 31) << 1;
  tm->tm_min = (timestamp >> 5) & 63;
  tm->tm_hour = (timestamp >> 11) & 31;
  tm->tm_mday = datestamp & 31;
  tm->tm_mon = ((datestamp >> 5) & 15) - 1;
  tm->tm_year = 80 + ((datestamp >> 9) & 127);
  return mktime(tm);
}


x86 assembly (clang, -O0):
<__unixtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
shl    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
shr    $0x5,%ecx
and    $0x3f,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
shr    $0xb,%ecx
and    $0x1f,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%ecx
shr    $0x5,%ecx
and    $0xf,%ecx
sub    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%ecx
shr    $0x9,%ecx
and    $0x7f,%ecx
add    $0x50,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <mktime@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__unixtime>:
sub    $0x18,%rsp
lea    (%rdi,%rdi,1),%eax
and    $0x3e,%eax
mov    %eax,(%rsp)
mov    %edi,%eax
shr    $0x5,%eax
and    $0x3f,%eax
mov    %eax,0x4(%rsp)
shr    $0xb,%edi
and    $0x1f,%edi
mov    %edi,0x8(%rsp)
mov    %esi,%eax
and    $0x1f,%eax
mov    %eax,0xc(%rsp)
mov    %esi,%eax
shr    $0x5,%eax
and    $0xf,%eax
add    $0xffffffff,%eax
mov    %eax,0x10(%rsp)
shr    $0x9,%esi
and    $0x7f,%esi
add    $0x50,%esi
mov    %esi,0x14(%rsp)
mov    %rsp,%rdi
call   1030 <mktime@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @__unixtime(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tm
%6 = alloca %struct.tm*
store i32 %0, i32* %3
store i32 %1, i32* %4
store %struct.tm* %5, %struct.tm** %6
%7 = load i32, i32* %3
%8 = and i32 %7, 31
%9 = shl i32 %8, 1
%10 = load %struct.tm*, %struct.tm** %6
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
store i32 %9, i32* %11
%12 = load i32, i32* %3
%13 = lshr i32 %12, 5
%14 = and i32 %13, 63
%15 = load %struct.tm*, %struct.tm** %6
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
store i32 %14, i32* %16
%17 = load i32, i32* %3
%18 = lshr i32 %17, 11
%19 = and i32 %18, 31
%20 = load %struct.tm*, %struct.tm** %6
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 2
store i32 %19, i32* %21
%22 = load i32, i32* %4
%23 = and i32 %22, 31
%24 = load %struct.tm*, %struct.tm** %6
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 3
store i32 %23, i32* %25
%26 = load i32, i32* %4
%27 = lshr i32 %26, 5
%28 = and i32 %27, 15
%29 = sub i32 %28, 1
%30 = load %struct.tm*, %struct.tm** %6
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 4
store i32 %29, i32* %31
%32 = load i32, i32* %4
%33 = lshr i32 %32, 9
%34 = and i32 %33, 127
%35 = add i32 80, %34
%36 = load %struct.tm*, %struct.tm** %6
%37 = getelementptr inbounds %struct.tm, %struct.tm* %36, i32 0, i32 5
store i32 %35, i32* %37
%38 = load %struct.tm*, %struct.tm** %6
%39 = call i32 @mktime(%struct.tm* %38)
ret i32 %39
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @__unixtime(i32 %0, i32 %1) {
%3 = alloca %struct.tm
%4 = bitcast %struct.tm* %3 to i8*
%5 = shl i32 %0, 1
%6 = and i32 %5, 62
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
store i32 %6, i32* %7
%8 = lshr i32 %0, 5
%9 = and i32 %8, 63
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
store i32 %9, i32* %10
%11 = lshr i32 %0, 11
%12 = and i32 %11, 31
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
store i32 %12, i32* %13
%14 = and i32 %1, 31
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
store i32 %14, i32* %15
%16 = lshr i32 %1, 5
%17 = and i32 %16, 15
%18 = add nsw i32 %17, -1
%19 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
store i32 %18, i32* %19
%20 = lshr i32 %1, 9
%21 = and i32 %20, 127
%22 = add nuw nsw i32 %21, 80
%23 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
store i32 %22, i32* %23
%24 = call i32 @mktime(%struct.tm* %3)
ret i32 %24
}