#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
  int member_4;
  int member_5;
  int member_6;
};

/* Variables and functions */
int /*<<< orphan*/ DBL_MANT_DIG;
int /*<<< orphan*/ decompose(double, double, int, double *, double *);
scalar_t__ floor(double);
scalar_t__ getJuldayOrigin();
int /*<<< orphan*/ julianDayToGregorianDate(scalar_t__, int *, int *, int *);
double ldexp(double, int /*<<< orphan*/);
void ut_decode_time(double value, int *year, int *month, int *day, int *hour,
                    int *minute, double *second, double *resolution) {
  int days;
  int hours;
  int minutes;
  double seconds;
  double uncer;
  typedef union {
    double vec[7];
    struct {
      double days;
      double hours12;
      double hours;
      double minutes10;
      double minutes;
      double seconds10;
      double seconds;
    } ind;
  } Basis;
  Basis counts;
  static const Basis basis = {{86400, 43200, 3600, 600, 60, 10, 1}};
  uncer = ldexp(value < 0 ? -value : value, -DBL_MANT_DIG);
  days = (int)floor(value / basis.ind.days);
  value -= days * basis.ind.days;
  decompose(value, uncer, (int)(sizeof(basis.vec) / sizeof(basis.vec[0])),
            basis.vec, counts.vec);
  days += counts.ind.days;
  hours = (int)counts.ind.hours12 * 12 + (int)counts.ind.hours;
  minutes = (int)counts.ind.minutes10 * 10 + (int)counts.ind.minutes;
  seconds = (int)counts.ind.seconds10 * 10 + counts.ind.seconds;
  if (seconds >= 60) {
    seconds -= 60;
    ++minutes;
  }
  if (minutes >= 60) {
    minutes -= 60;
    ++hours;
  }
  if (hours >= 24) {
    hours -= 24;
    ++days;
  }
  *second = seconds;
  *minute = minutes;
  *hour = hours;
  *resolution = uncer;
  julianDayToGregorianDate(getJuldayOrigin() + days, year, month, day);
}


x86 assembly (clang, -O0):
<ut_decode_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%rax
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11b3 <ut_decode_time+0x63>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    11c0 <ut_decode_time+0x70>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
xor    %edi,%edi
mov    0x2e17(%rip),%rax
sub    (%rax),%edi
call   1030 <ldexp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  0xe1e(%rip),%xmm0
call   1070 <floor@plt>
mov    %eax,-0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp),%xmm0
movsd  0xe09(%rip),%xmm2
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
lea    -0x90(%rbp),%rdx
mov    $0x7,%edi
lea    0xdc3(%rip),%rsi
call   1060 <decompose@plt>
movsd  -0x90(%rbp),%xmm1
ff
cvtsi2sdl -0x3c(%rbp),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x3c(%rbp)
cvttsd2si -0x88(%rbp),%eax
ff
imul   $0xc,%eax,%eax
cvttsd2si -0x80(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
cvttsd2si -0x78(%rbp),%eax
imul   $0xa,%eax,%eax
cvttsd2si -0x70(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
cvttsd2si -0x68(%rbp),%eax
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xd54(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12d5 <ut_decode_time+0x185>
movsd  -0x50(%rbp),%xmm0
movsd  0xd3d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x3c,-0x44(%rbp)
jl     12f1 <ut_decode_time+0x1a1>
mov    -0x44(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x18,-0x40(%rbp)
jl     130d <ut_decode_time+0x1bd>
mov    -0x40(%rbp),%eax
sub    $0x18,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x44(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    $0x0,%al
call   1040 <getJuldayOrigin@plt>
mov    %rax,%rdi
movslq -0x3c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <julianDayToGregorianDate@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ut_decode_time>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,%rbp
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,0x18(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
movapd %xmm0,%xmm3
movapd %xmm0,0x20(%rsp)
movapd 0xe7c(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
mov    0x2e44(%rip),%rax
xor    %edi,%edi
sub    (%rax),%edi
call   1030 <ldexp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
divsd  0xe4f(%rip),%xmm0
call   1070 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe35(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd 0x20(%rsp),%xmm0
subsd  %xmm1,%xmm0
lea    0xe38(%rip),%rsi
lea    0x30(%rsp),%rdx
movsd  0x8(%rsp),%xmm1
mov    $0x7,%edi
call   1060 <decompose@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
cvttsd2si %xmm0,%eax
cvttsd2si 0x38(%rsp),%ecx
cvttsd2si 0x40(%rsp),%edx
lea    (%rcx,%rcx,2),%ecx
cvttsd2si 0x48(%rsp),%esi
lea    (%rdx,%rcx,4),%ecx
cvttsd2si 0x50(%rsp),%edx
lea    (%rsi,%rsi,4),%esi
cvttsd2si 0x58(%rsp),%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edi
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
lea    (%rdx,%rsi,2),%edx
addsd  0x60(%rsp),%xmm1
movsd  0xdbf(%rip),%xmm0
ucomisd %xmm0,%xmm1
movsd  0xdbb(%rip),%xmm2
addsd  %xmm1,%xmm2
sbb    $0xffffffff,%edx
cmpnlesd %xmm1,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
lea    -0x3c(%rdx),%esi
xor    %edi,%edi
cmp    $0x3c,%edx
setge  %dil
cmovl  %edx,%esi
lea    (%rcx,%rdi,1),%edx
xor    %r14d,%r14d
cmp    $0x18,%edx
setge  %r14b
lea    -0x18(%rdi,%rcx,1),%ecx
cmovl  %edx,%ecx
add    %eax,%r14d
movlpd %xmm0,0x0(%rbp)
mov    %esi,0x0(%r13)
mov    %ecx,(%rbx)
mov    0xa0(%rsp),%rax
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rax)
xor    %eax,%eax
call   1040 <getJuldayOrigin@plt>
movslq %r14d,%rdi
add    %rax,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    0x18(%rsp),%rcx
call   1050 <julianDayToGregorianDate@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%union.Basis = type { [7 x double] }
%struct.anon = type { double, double, double, double, double, double, double }
@ut_decode_time.basis = internal constant %union.Basis { [7 x double] [double 8.640000e+04, double 4.320000e+04, double 3.600000e+03, double 6.000000e+02, double 6.000000e+01, double 1.000000e+01, double 1.000000e+00] }
@DBL_MANT_DIG = global i32 0
define void @ut_decode_time(double %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, double* %6, double* %7) {
%9 = alloca double
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca %union.Basis
store double %0, double* %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store double* %6, double** %15
store double* %7, double** %16
%23 = load double, double* %9
%24 = fcmp olt double %23, 0.000000e+00
br i1 %24, label %25, label %28
25: ; preds = %8
%26 = load double, double* %9
%27 = fneg double %26
br label %30
28: ; preds = %8
%29 = load double, double* %9
br label %30
30: ; preds = %28, %25
%31 = phi double [ %27, %25 ], [ %29, %28 ]
%32 = load i32, i32* @DBL_MANT_DIG
%33 = sub nsw i32 0, %32
%34 = call double @ldexp(double %31, i32 %33)
store double %34, double* %21
%35 = load double, double* %9
%36 = load double, double* getelementptr inbounds (%struct.anon, %struct.anon* bitcast (%union.Basis* @ut_decode_time.basis to %struct.anon*), i32 0, i32 0)
%37 = fdiv double %35, %36
%38 = call i64 @floor(double %37)
%39 = trunc i64 %38 to i32
store i32 %39, i32* %17
%40 = load i32, i32* %17
%41 = sitofp i32 %40 to double
%42 = load double, double* getelementptr inbounds (%struct.anon, %struct.anon* bitcast (%union.Basis* @ut_decode_time.basis to %struct.anon*), i32 0, i32 0)
%43 = load double, double* %9
%44 = fneg double %41
%45 = call double @llvm.fmuladd.f64(double %44, double %42, double %43)
store double %45, double* %9
%46 = load double, double* %9
%47 = load double, double* %21
%48 = bitcast %union.Basis* %22 to [7 x double]*
%49 = getelementptr inbounds [7 x double], [7 x double]* %48, i64 0, i64 0
%50 = call i32 @decompose(double %46, double %47, i32 7, double* getelementptr inbounds (%union.Basis, %union.Basis* @ut_decode_time.basis, i32 0, i32 0, i64 0), double* %49)
%51 = bitcast %union.Basis* %22 to %struct.anon*
%52 = getelementptr inbounds %struct.anon, %struct.anon* %51, i32 0, i32 0
%53 = load double, double* %52
%54 = load i32, i32* %17
%55 = sitofp i32 %54 to double
%56 = fadd double %55, %53
%57 = fptosi double %56 to i32
store i32 %57, i32* %17
%58 = bitcast %union.Basis* %22 to %struct.anon*
%59 = getelementptr inbounds %struct.anon, %struct.anon* %58, i32 0, i32 1
%60 = load double, double* %59
%61 = fptosi double %60 to i32
%62 = mul nsw i32 %61, 12
%63 = bitcast %union.Basis* %22 to %struct.anon*
%64 = getelementptr inbounds %struct.anon, %struct.anon* %63, i32 0, i32 2
%65 = load double, double* %64
%66 = fptosi double %65 to i32
%67 = add nsw i32 %62, %66
store i32 %67, i32* %18
%68 = bitcast %union.Basis* %22 to %struct.anon*
%69 = getelementptr inbounds %struct.anon, %struct.anon* %68, i32 0, i32 3
%70 = load double, double* %69
%71 = fptosi double %70 to i32
%72 = mul nsw i32 %71, 10
%73 = bitcast %union.Basis* %22 to %struct.anon*
%74 = getelementptr inbounds %struct.anon, %struct.anon* %73, i32 0, i32 4
%75 = load double, double* %74
%76 = fptosi double %75 to i32
%77 = add nsw i32 %72, %76
store i32 %77, i32* %19
%78 = bitcast %union.Basis* %22 to %struct.anon*
%79 = getelementptr inbounds %struct.anon, %struct.anon* %78, i32 0, i32 5
%80 = load double, double* %79
%81 = fptosi double %80 to i32
%82 = mul nsw i32 %81, 10
%83 = sitofp i32 %82 to double
%84 = bitcast %union.Basis* %22 to %struct.anon*
%85 = getelementptr inbounds %struct.anon, %struct.anon* %84, i32 0, i32 6
%86 = load double, double* %85
%87 = fadd double %83, %86
store double %87, double* %20
%88 = load double, double* %20
%89 = fcmp oge double %88, 6.000000e+01
br i1 %89, label %90, label %95
90: ; preds = %30
%91 = load double, double* %20
%92 = fsub double %91, 6.000000e+01
store double %92, double* %20
%93 = load i32, i32* %19
%94 = add nsw i32 %93, 1
store i32 %94, i32* %19
br label %95
95: ; preds = %90, %30
%96 = load i32, i32* %19
%97 = icmp sge i32 %96, 60
br i1 %97, label %98, label %103
98: ; preds = %95
%99 = load i32, i32* %19
%100 = sub nsw i32 %99, 60
store i32 %100, i32* %19
%101 = load i32, i32* %18
%102 = add nsw i32 %101, 1
store i32 %102, i32* %18
br label %103
103: ; preds = %98, %95
%104 = load i32, i32* %18
%105 = icmp sge i32 %104, 24
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = load i32, i32* %18
%108 = sub nsw i32 %107, 24
store i32 %108, i32* %18
%109 = load i32, i32* %17
%110 = add nsw i32 %109, 1
store i32 %110, i32* %17
br label %111
111: ; preds = %106, %103
%112 = load double, double* %20
%113 = load double*, double** %15
store double %112, double* %113
%114 = load i32, i32* %19
%115 = load i32*, i32** %14
store i32 %114, i32* %115
%116 = load i32, i32* %18
%117 = load i32*, i32** %13
store i32 %116, i32* %117
%118 = load double, double* %21
%119 = load double*, double** %16
store double %118, double* %119
%120 = call i64 (...) @getJuldayOrigin()
%121 = load i32, i32* %17
%122 = sext i32 %121 to i64
%123 = add nsw i64 %120, %122
%124 = load i32*, i32** %10
%125 = load i32*, i32** %11
%126 = load i32*, i32** %12
%127 = call i32 @julianDayToGregorianDate(i64 %123, i32* %124, i32* %125, i32* %126)
ret void
}

LLVM IR (-O2):
%union.Basis = type { [7 x double] }
@ut_decode_time.basis = internal constant %union.Basis { [7 x double] [double 8.640000e+04, double 4.320000e+04, double 3.600000e+03, double 6.000000e+02, double 6.000000e+01, double 1.000000e+01, double 1.000000e+00] }
@DBL_MANT_DIG = global i32 0
define void @ut_decode_time(double %0, i32* %1, i32* %2, i32* %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = alloca %union.Basis
%10 = bitcast %union.Basis* %9 to i8*
%11 = fcmp olt double %0, 0.000000e+00
%12 = fneg double %0
%13 = select i1 %11, double %12, double %0
%14 = load i32, i32* @DBL_MANT_DIG
%15 = sub nsw i32 0, %14
%16 = tail call double @ldexp(double %13, i32 %15)
%17 = fdiv double %0, 8.640000e+04
%18 = tail call i64 @floor(double %17)
%19 = trunc i64 %18 to i32
%20 = sitofp i32 %19 to double
%21 = fneg double %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 8.640000e+04, double %0)
%23 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 0
%24 = call i32 @decompose(double %22, double %16, i32 7, double* getelementptr inbounds (%union.Basis, %union.Basis* @ut_decode_time.basis, i64 0, i32 0, i64 0), double* %23)
%25 = load double, double* %23
%26 = fadd double %25, %20
%27 = fptosi double %26 to i32
%28 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 1
%29 = load double, double* %28
%30 = fptosi double %29 to i32
%31 = mul nsw i32 %30, 12
%32 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 2
%33 = load double, double* %32
%34 = fptosi double %33 to i32
%35 = add nsw i32 %31, %34
%36 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 3
%37 = load double, double* %36
%38 = fptosi double %37 to i32
%39 = mul nsw i32 %38, 10
%40 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 4
%41 = load double, double* %40
%42 = fptosi double %41 to i32
%43 = add nsw i32 %39, %42
%44 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 5
%45 = load double, double* %44
%46 = fptosi double %45 to i32
%47 = mul nsw i32 %46, 10
%48 = sitofp i32 %47 to double
%49 = getelementptr inbounds %union.Basis, %union.Basis* %9, i64 0, i32 0, i64 6
%50 = load double, double* %49
%51 = fadd double %50, %48
%52 = fcmp ult double %51, 6.000000e+01
%53 = fadd double %51, -6.000000e+01
%54 = xor i1 %52, true
%55 = zext i1 %54 to i32
%56 = add nsw i32 %43, %55
%57 = select i1 %52, double %51, double %53
%58 = icmp sgt i32 %56, 59
%59 = add nsw i32 %56, -60
%60 = zext i1 %58 to i32
%61 = add nsw i32 %35, %60
%62 = select i1 %58, i32 %59, i32 %56
%63 = icmp sgt i32 %61, 23
%64 = add nsw i32 %61, -24
%65 = select i1 %63, i32 %64, i32 %61
%66 = zext i1 %63 to i32
%67 = add nsw i32 %66, %27
store double %57, double* %6
store i32 %62, i32* %5
store i32 %65, i32* %4
store double %16, double* %7
%68 = call i64 (...) @getJuldayOrigin()
%69 = sext i32 %67 to i64
%70 = add nsw i64 %68, %69
%71 = call i32 @julianDayToGregorianDate(i64 %70, i32* %1, i32* %2, i32* %3)
ret void
}