int time_to_int(long double time, int *T) {
  T[0] = (int)(time / 3600.);
  T[1] = (int)((time - T[0] * 3600.) / 60.);
  T[2] = (int)(time - T[0] * 3600. - T[1] * 60.);
  T[3] =
      (int)((time - T[0] * 3600. - T[1] * 60. - (long double)T[2]) * 1000000.);
  return 1;
}


x86 assembly (clang, -O0):
<time_to_int>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
flds   0xee9(%rip)
fdivrp %st,%st(1)
fnstcw -0x5a(%rbp)
movzwl -0x5a(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x5c(%rbp)
fldcw  -0x5c(%rbp)
fistpl -0x2c(%rbp)
fldcw  -0x5a(%rbp)
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,-0x38(%rbp)
fldl   -0x38(%rbp)
fsubrp %st,%st(1)
flds   0xea2(%rip)
fdivrp %st,%st(1)
fnstcw -0x5e(%rbp)
movzwl -0x5e(%rbp),%ecx
or     $0xc00,%ecx
mov    %cx,-0x60(%rbp)
fldcw  -0x60(%rbp)
fistpl -0x28(%rbp)
fldcw  -0x5e(%rbp)
mov    -0x28(%rbp),%ecx
mov    %ecx,0x4(%rax)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,-0x40(%rbp)
fldl   -0x40(%rbp)
fsubrp %st,%st(1)
cvtsi2sdl 0x4(%rax),%xmm0
movsd  0xe6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
fldl   -0x48(%rbp)
fsubrp %st,%st(1)
fnstcw -0x62(%rbp)
movzwl -0x62(%rbp),%ecx
or     $0xc00,%ecx
mov    %cx,-0x64(%rbp)
fldcw  -0x64(%rbp)
fistpl -0x24(%rbp)
fldcw  -0x62(%rbp)
mov    -0x24(%rbp),%ecx
mov    %ecx,0x8(%rax)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,-0x50(%rbp)
fldl   -0x50(%rbp)
fsubrp %st,%st(1)
cvtsi2sdl 0x4(%rax),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
fldl   -0x58(%rbp)
fsubrp %st,%st(1)
mov    0x8(%rax),%eax
mov    %eax,-0x20(%rbp)
fildl  -0x20(%rbp)
fsubrp %st,%st(1)
flds   0xdf3(%rip)
fmulp  %st,%st(1)
fnstcw -0x66(%rbp)
movzwl -0x66(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x68(%rbp)
fldcw  -0x68(%rbp)
fistpl -0x1c(%rbp)
fldcw  -0x66(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_to_int>:
fldt   0x8(%rsp)
fld    %st(0)
fdivs  0xef4(%rip)
fnstcw -0x2e(%rsp)
movzwl -0x2e(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x26(%rsp)
fldcw  -0x26(%rsp)
fistpl -0x24(%rsp)
fldcw  -0x2e(%rsp)
mov    -0x24(%rsp),%eax
cvtsi2sd %eax,%xmm0
mov    %eax,(%rdi)
mulsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x8(%rsp)
faddl  -0x8(%rsp)
fld    %st(0)
fdivs  0xeb5(%rip)
fnstcw -0x30(%rsp)
movzwl -0x30(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x28(%rsp)
fldcw  -0x28(%rsp)
fistpl -0x20(%rsp)
fldcw  -0x30(%rsp)
mov    -0x20(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe97(%rip),%xmm0
mov    %eax,0x4(%rdi)
movsd  %xmm0,-0x10(%rsp)
faddl  -0x10(%rsp)
fnstcw -0x32(%rsp)
movzwl -0x32(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x2a(%rsp)
fldcw  -0x2a(%rsp)
fistl  -0x1c(%rsp)
fldcw  -0x32(%rsp)
mov    -0x1c(%rsp),%eax
mov    %eax,0x8(%rdi)
mov    %eax,-0x18(%rsp)
fisubl -0x18(%rsp)
fmuls  0xe46(%rip)
fnstcw -0x34(%rsp)
movzwl -0x34(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x2c(%rsp)
fldcw  -0x2c(%rsp)
fistpl -0x14(%rsp)
fldcw  -0x34(%rsp)
mov    -0x14(%rsp),%eax
mov    %eax,0xc(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @time_to_int(x86_fp80 %0, i32* %1) {
%3 = alloca x86_fp80
%4 = alloca i32*
store x86_fp80 %0, x86_fp80* %3
store i32* %1, i32** %4
%5 = load x86_fp80, x86_fp80* %3
%6 = fdiv x86_fp80 %5, 0xK400AE100000000000000
%7 = fptosi x86_fp80 %6 to i32
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load x86_fp80, x86_fp80* %3
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 3.600000e+03
%16 = fpext double %15 to x86_fp80
%17 = fsub x86_fp80 %10, %16
%18 = fdiv x86_fp80 %17, 0xK4004F000000000000000
%19 = fptosi x86_fp80 %18 to i32
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 1
store i32 %19, i32* %21
%22 = load x86_fp80, x86_fp80* %3
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = load i32, i32* %24
%26 = sitofp i32 %25 to double
%27 = fmul double %26, 3.600000e+03
%28 = fpext double %27 to x86_fp80
%29 = fsub x86_fp80 %22, %28
%30 = load i32*, i32** %4
%31 = getelementptr inbounds i32, i32* %30, i64 1
%32 = load i32, i32* %31
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 6.000000e+01
%35 = fpext double %34 to x86_fp80
%36 = fsub x86_fp80 %29, %35
%37 = fptosi x86_fp80 %36 to i32
%38 = load i32*, i32** %4
%39 = getelementptr inbounds i32, i32* %38, i64 2
store i32 %37, i32* %39
%40 = load x86_fp80, x86_fp80* %3
%41 = load i32*, i32** %4
%42 = getelementptr inbounds i32, i32* %41, i64 0
%43 = load i32, i32* %42
%44 = sitofp i32 %43 to double
%45 = fmul double %44, 3.600000e+03
%46 = fpext double %45 to x86_fp80
%47 = fsub x86_fp80 %40, %46
%48 = load i32*, i32** %4
%49 = getelementptr inbounds i32, i32* %48, i64 1
%50 = load i32, i32* %49
%51 = sitofp i32 %50 to double
%52 = fmul double %51, 6.000000e+01
%53 = fpext double %52 to x86_fp80
%54 = fsub x86_fp80 %47, %53
%55 = load i32*, i32** %4
%56 = getelementptr inbounds i32, i32* %55, i64 2
%57 = load i32, i32* %56
%58 = sitofp i32 %57 to x86_fp80
%59 = fsub x86_fp80 %54, %58
%60 = fmul x86_fp80 %59, 0xK4012F424000000000000
%61 = fptosi x86_fp80 %60 to i32
%62 = load i32*, i32** %4
%63 = getelementptr inbounds i32, i32* %62, i64 3
store i32 %61, i32* %63
ret i32 1
}

LLVM IR (-O2):
define i32 @time_to_int(x86_fp80 %0, i32* nocapture %1) {
%3 = fdiv x86_fp80 %0, 0xK400AE100000000000000
%4 = fptosi x86_fp80 %3 to i32
store i32 %4, i32* %1
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 3.600000e+03
%7 = fpext double %6 to x86_fp80
%8 = fsub x86_fp80 %0, %7
%9 = fdiv x86_fp80 %8, 0xK4004F000000000000000
%10 = fptosi x86_fp80 %9 to i32
%11 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %10, i32* %11
%12 = sitofp i32 %10 to double
%13 = fmul double %12, 6.000000e+01
%14 = fpext double %13 to x86_fp80
%15 = fsub x86_fp80 %8, %14
%16 = fptosi x86_fp80 %15 to i32
%17 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %16, i32* %17
%18 = sitofp i32 %16 to x86_fp80
%19 = fsub x86_fp80 %15, %18
%20 = fmul x86_fp80 %19, 0xK4012F424000000000000
%21 = fptosi x86_fp80 %20 to i32
%22 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %21, i32* %22
ret i32 1
}