#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 */

/* Variables and functions */
long getfield(char *, int, int, int);
long unixtime(char *block, int wordoff) {
  long int t, s;
  t = getfield(block, wordoff, 0, 18);
  t -= 0117213;
  s = getfield(block, wordoff, 18, 18);
  s = s * (24. * 60. * 60.) / 0777777;
  s += t * 24 * 60 * 60;
  return (s);
}


x86 assembly (clang, -O0):
<unixtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
mov    $0x12,%ecx
call   1030 <getfield@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x9e8b,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x12,%ecx
mov    %ecx,%edx
call   1030 <getfield@plt>
mov    %rax,-0x20(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x20(%rbp)
imul   $0x18,-0x18(%rbp),%rax
imul   $0x3c,%rax,%rax
imul   $0x3c,%rax,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unixtime>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edx,%edx
mov    $0x12,%ecx
call   1030 <getfield@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x12,%edx
mov    $0x12,%ecx
call   1030 <getfield@plt>
cvtsi2sd %rax,%xmm0
mulsd  0xeb7(%rip),%xmm0
divsd  0xeb7(%rip),%xmm0
cvttsd2si %xmm0,%rax
imul   $0x15180,%r14,%rcx
add    %rax,%rcx
movabs $0xffffffff2efbbf80,%rax
ff ff ff
add    %rcx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i64 @unixtime(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i64 @getfield(i8* %7, i32 %8, i32 0, i32 18)
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = sub nsw i64 %10, 40587
store i64 %11, i64* %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = call i64 @getfield(i8* %12, i32 %13, i32 18, i32 18)
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = sitofp i64 %15 to double
%17 = fmul double %16, 8.640000e+04
%18 = fdiv double %17, 2.621430e+05
%19 = fptosi double %18 to i64
store i64 %19, i64* %6
%20 = load i64, i64* %5
%21 = mul nsw i64 %20, 24
%22 = mul nsw i64 %21, 60
%23 = mul nsw i64 %22, 60
%24 = load i64, i64* %6
%25 = add nsw i64 %24, %23
store i64 %25, i64* %6
%26 = load i64, i64* %6
ret i64 %26
}

LLVM IR (-O2):
define i64 @unixtime(i8* %0, i32 %1) {
%3 = tail call i64 @getfield(i8* %0, i32 %1, i32 0, i32 18)
%4 = tail call i64 @getfield(i8* %0, i32 %1, i32 18, i32 18)
%5 = sitofp i64 %4 to double
%6 = fmul double %5, 8.640000e+04
%7 = fdiv double %6, 2.621430e+05
%8 = fptosi double %7 to i64
%9 = mul i64 %3, 86400
%10 = add i64 %9, -3506716800
%11 = add nsw i64 %10, %8
ret i64 %11
}