#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 dummy;
};

/* Variables and functions */
int tm_diffseconds(struct tm, struct tm);
int /*<<< orphan*/ tm_getday(struct tm);
int /*<<< orphan*/ tm_getmonth(struct tm);
int /*<<< orphan*/ tm_getyear(struct tm);
int /*<<< orphan*/ tm_set(struct tm *, int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/);
int tm_getsecondsofday(struct tm date) {
  struct tm tmp = date;
  tm_set(&tmp, tm_getyear(date), tm_getmonth(date), tm_getday(date), 0, 0, 0);
  return tm_diffseconds(tmp, date);
}


x86 assembly (clang, -O0):
<tm_getsecondsofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <tm_getyear@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <tm_getmonth@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <tm_getday@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
lea    -0x10(%rbp),%rdi
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1040 <tm_set@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <tm_diffseconds@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_getsecondsofday>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %edi,0x8(%rsp)
call   1050 <tm_getyear@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1070 <tm_getmonth@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1060 <tm_getday@plt>
movl   $0x0,(%rsp)
lea    0x8(%rsp),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <tm_set@plt>
mov    0x8(%rsp),%edi
mov    %ebx,%esi
call   1030 <tm_diffseconds@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @tm_getsecondsofday(i32 %0) {
%2 = alloca %struct.tm
%3 = alloca %struct.tm
%4 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = bitcast %struct.tm* %3 to i8*
%6 = bitcast %struct.tm* %2 to i8*
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @tm_getyear(i32 %8)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @tm_getmonth(i32 %11)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @tm_getday(i32 %14)
%16 = call i32 @tm_set(%struct.tm* %3, i32 %9, i32 %12, i32 %15, i32 0, i32 0, i32 0)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i32 @tm_diffseconds(i32 %18, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @tm_getsecondsofday(i32 %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
store i32 %0, i32* %4
%5 = tail call i32 @tm_getyear(i32 %0)
%6 = tail call i32 @tm_getmonth(i32 %0)
%7 = tail call i32 @tm_getday(i32 %0)
%8 = call i32 @tm_set(%struct.tm* %2, i32 %5, i32 %6, i32 %7, i32 0, i32 0, i32 0)
%9 = load i32, i32* %4
%10 = call i32 @tm_diffseconds(i32 %9, i32 %0)
ret i32 %10
}