#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 */
int /*<<< orphan*/ assert(int);
double get_dtime_by_row(const int row, const int hourly) {
  int i;
  double d;
  int row_per_day;
  int row_max;
  const double decimal_part_dtime[] = {
      0.02083, 0.04167, 0.0625,  0.08333, 0.10417, 0.125,   0.14583, 0.16667,
      0.1875,  0.20833, 0.22917, 0.25,    0.27083, 0.29167, 0.3125,  0.33333,
      0.35417, 0.375,   0.39583, 0.41667, 0.4375,  0.45833, 0.47917, 0.5,
      0.52083, 0.54167, 0.5625,  0.58333, 0.60417, 0.625,   0.64583, 0.66667,
      0.6875,  0.70833, 0.72917, 0.75,    0.77083, 0.79167, 0.8125,  0.83333,
      0.85417, 0.875,   0.89583, 0.91667, 0.9375,  0.95833, 0.97917, 1,
  };
  row_max = 17568;
  if (hourly) {
    row_max /= 2;
  }
  assert((row >= 0) && (row < row_max));
  row_per_day = hourly ? 24 : 48;
  d = (int)row / row_per_day + 1;
  i = row % row_per_day;
  if (hourly) {
    i *= 2;
    ++i;
  }
  return d + decimal_part_dtime[i];
}


x86 assembly (clang, -O0):
<get_dtime_by_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0x180,%edx
call   1040 <memcpy@plt>
movl   $0x44a0,-0x20(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1168 <get_dtime_by_row+0x48>
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x1a1(%rbp)
jl     1189 <get_dtime_by_row+0x69>
mov    -0x4(%rbp),%eax
cmp    -0x20(%rbp),%eax
setl   %al
mov    %al,-0x1a1(%rbp)
mov    -0x1a1(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%edx
mov    $0x30,%eax
mov    $0x18,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11e8 <get_dtime_by_row+0xc8>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsd  -0x18(%rbp),%xmm0
movslq -0xc(%rbp),%rax
addsd  -0x1a0(%rbp,%rax,8),%xmm0
ff ff
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dtime_by_row>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
mov    $0x30,%eax
mov    $0x18,%ebx
cmove  %eax,%ebx
mov    %edi,%ecx
mov    %edi,%eax
cltd
idiv   %ebx
mov    %eax,%ebx
test   %esi,%esi
mov    $0x44a0,%eax
mov    $0x2250,%esi
cmove  %eax,%esi
lea    0x1(%rdx,%rdx,1),%ebp
cmove  %edx,%ebp
xor    %edi,%edi
cmp    %ecx,%esi
seta   %dil
call   1030 <assert@plt>
add    $0x1,%ebx
cvtsi2sd %ebx,%xmm0
movslq %ebp,%rax
lea    0xea1(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.get_dtime_by_row.decimal_part_dtime = [48 x double] [double 2.083000e-02, double 4.167000e-02, double 6.250000e-02, double 8.333000e-02, double 1.041700e-01, double 1.250000e-01, double 1.458300e-01, double 1.666700e-01, double 1.875000e-01, double 2.083300e-01, double 2.291700e-01, double 2.500000e-01, double 2.708300e-01, double 2.916700e-01, double 3.125000e-01, double 3.333300e-01, double 3.541700e-01, double 3.750000e-01, double 3.958300e-01, double 4.166700e-01, double 4.375000e-01, double 4.583300e-01, double 4.791700e-01, double 5.000000e-01, double 5.208300e-01, double 5.416700e-01, double 5.625000e-01, double 5.833300e-01, double 6.041700e-01, double 6.250000e-01, double 6.458300e-01, double 6.666700e-01, double 6.875000e-01, double 7.083300e-01, double 7.291700e-01, double 7.500000e-01, double 7.708300e-01, double 7.916700e-01, double 8.125000e-01, double 8.333300e-01, double 8.541700e-01, double 8.750000e-01, double 8.958300e-01, double 9.166700e-01, double 9.375000e-01, double 9.583300e-01, double 0x3FEF555C52E72DA1, double 1.000000e+00]
define double @get_dtime_by_row(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca [48 x double]
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = bitcast [48 x double]* %9 to i8*
store i32 17568, i32* %8
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* %8
%15 = sdiv i32 %14, 2
store i32 %15, i32* %8
br label %16
16: ; preds = %13, %2
%17 = load i32, i32* %3
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %3
%21 = load i32, i32* %8
%22 = icmp slt i32 %20, %21
br label %23
23: ; preds = %19, %16
%24 = phi i1 [ false, %16 ], [ %22, %19 ]
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 24, i32 48
store i32 %30, i32* %7
%31 = load i32, i32* %3
%32 = load i32, i32* %7
%33 = sdiv i32 %31, %32
%34 = add nsw i32 %33, 1
%35 = sitofp i32 %34 to double
store double %35, double* %6
%36 = load i32, i32* %3
%37 = load i32, i32* %7
%38 = srem i32 %36, %37
store i32 %38, i32* %5
%39 = load i32, i32* %4
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %23
%42 = load i32, i32* %5
%43 = mul nsw i32 %42, 2
store i32 %43, i32* %5
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %46
46: ; preds = %41, %23
%47 = load double, double* %6
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [48 x double], [48 x double]* %9, i64 0, i64 %49
%51 = load double, double* %50
%52 = fadd double %47, %51
ret double %52
}

LLVM IR (-O2):
@__const.get_dtime_by_row.decimal_part_dtime = [48 x double] [double 2.083000e-02, double 4.167000e-02, double 6.250000e-02, double 8.333000e-02, double 1.041700e-01, double 1.250000e-01, double 1.458300e-01, double 1.666700e-01, double 1.875000e-01, double 2.083300e-01, double 2.291700e-01, double 2.500000e-01, double 2.708300e-01, double 2.916700e-01, double 3.125000e-01, double 3.333300e-01, double 3.541700e-01, double 3.750000e-01, double 3.958300e-01, double 4.166700e-01, double 4.375000e-01, double 4.583300e-01, double 4.791700e-01, double 5.000000e-01, double 5.208300e-01, double 5.416700e-01, double 5.625000e-01, double 5.833300e-01, double 6.041700e-01, double 6.250000e-01, double 6.458300e-01, double 6.666700e-01, double 6.875000e-01, double 7.083300e-01, double 7.291700e-01, double 7.500000e-01, double 7.708300e-01, double 7.916700e-01, double 8.125000e-01, double 8.333300e-01, double 8.541700e-01, double 8.750000e-01, double 8.958300e-01, double 9.166700e-01, double 9.375000e-01, double 9.583300e-01, double 0x3FEF555C52E72DA1, double 1.000000e+00]
define double @get_dtime_by_row(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 48, i32 24
%5 = select i1 %3, i32 17568, i32 8784
%6 = icmp ugt i32 %5, %0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = srem i32 %0, %4
%10 = shl nsw i32 %9, 1
%11 = or i32 %10, 1
%12 = select i1 %3, i32 %9, i32 %11
%13 = sdiv i32 %0, %4
%14 = add nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = sext i32 %12 to i64
%17 = getelementptr inbounds [48 x double], [48 x double]* @__const.get_dtime_by_row.decimal_part_dtime, i64 0, i64 %16
%18 = load double, double* %17
%19 = fadd double %18, %15
ret double %19
}