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

/* Variables and functions */
int /*<<< orphan*/ mktime(struct tm *);
void date2nbsec(int j, int m, int a, time_t *n) {
  struct tm t;
  t.tm_sec = 0;
  t.tm_min = 0;
  t.tm_hour = 0;
  t.tm_mday = j;
  t.tm_mon = m - 1;
  t.tm_year = a - 1900;
  t.tm_isdst = -1;
  *n = mktime(&t);
}


x86 assembly (clang, -O0):
<date2nbsec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x38(%rbp)
movl   $0xffffffff,-0x34(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <mktime@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date2nbsec>:
push   %rbx
sub    $0x30,%rsp
mov    %rcx,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
movq   $0x0,0x28(%rsp)
mov    %edi,0x8(%rsp)
add    $0xffffffff,%esi
mov    %esi,0xc(%rsp)
add    $0xfffff894,%edx
mov    %edx,0x10(%rsp)
movl   $0xffffffff,0x14(%rsp)
ff
lea    0x8(%rsp),%rdi
call   1030 <mktime@plt>
mov    %eax,(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
define void @date2nbsec(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca %struct.tm
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 6
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 5
store i64 0, i64* %11
%12 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 4
store i64 0, i64* %12
%13 = load i32, i32* %5
%14 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
store i32 %13, i32* %14
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
store i32 %16, i32* %17
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1900
%20 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 2
store i32 %19, i32* %20
%21 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 3
store i32 -1, i32* %21
%22 = call i32 @mktime(%struct.tm* %9)
%23 = load i32*, i32** %8
store i32 %22, i32* %23
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
define void @date2nbsec(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca %struct.tm
%6 = bitcast %struct.tm* %5 to i8*
%7 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 4
%8 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%9 = bitcast i64* %7 to i8*
store i32 %0, i32* %8
%10 = add nsw i32 %1, -1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
store i32 %10, i32* %11
%12 = add nsw i32 %2, -1900
%13 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
store i32 %12, i32* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 3
store i32 -1, i32* %14
%15 = call i32 @mktime(%struct.tm* %5)
store i32 %15, i32* %3
ret void
}