#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 */
double date_from_time(double);
double hour_from_time(double);
double min_from_time(double);
double month_from_time(double);
double ms_from_time(double);
double sec_from_time(double);
double year_from_time(double);
double make_part(double t, int shift) {
  switch (shift) {
  case 0:
    return year_from_time(t);
  case 1:
    return month_from_time(t);
  case 2:
    return date_from_time(t);
  case 3:
    return hour_from_time(t);
  case 4:
    return min_from_time(t);
  case 5:
    return sec_from_time(t);
  default:
    return ms_from_time(t);
  }
}


x86 assembly (clang, -O0):
<make_part>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x5,%rax
ja     121d <make_part+0xad>
mov    -0x20(%rbp),%rax
lea    0xe64(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x10(%rbp),%xmm0
call   1080 <year_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1070 <month_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1050 <date_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1060 <hour_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1090 <min_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1040 <sec_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    122c <make_part+0xbc>
movsd  -0x10(%rbp),%xmm0
call   1030 <ms_from_time@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_part>:
cmp    $0x5,%edi
ja     118c <make_part+0x1c>
mov    %edi,%eax
lea    0xe82(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1080 <year_from_time@plt>
jmp    1030 <ms_from_time@plt>
jmp    1070 <month_from_time@plt>
jmp    1050 <date_from_time@plt>
jmp    1060 <hour_from_time@plt>
jmp    1090 <min_from_time@plt>
jmp    1040 <sec_from_time@plt>

LLVM IR (-O0):
define double @make_part(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %25 [
i32 0, label %7
i32 1, label %10
i32 2, label %13
i32 3, label %16
i32 4, label %19
i32 5, label %22
]
7: ; preds = %2
%8 = load double, double* %4
%9 = call double @year_from_time(double %8)
store double %9, double* %3
br label %28
10: ; preds = %2
%11 = load double, double* %4
%12 = call double @month_from_time(double %11)
store double %12, double* %3
br label %28
13: ; preds = %2
%14 = load double, double* %4
%15 = call double @date_from_time(double %14)
store double %15, double* %3
br label %28
16: ; preds = %2
%17 = load double, double* %4
%18 = call double @hour_from_time(double %17)
store double %18, double* %3
br label %28
19: ; preds = %2
%20 = load double, double* %4
%21 = call double @min_from_time(double %20)
store double %21, double* %3
br label %28
22: ; preds = %2
%23 = load double, double* %4
%24 = call double @sec_from_time(double %23)
store double %24, double* %3
br label %28
25: ; preds = %2
%26 = load double, double* %4
%27 = call double @ms_from_time(double %26)
store double %27, double* %3
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %7
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
define double @make_part(double %0, i32 %1) {
switch i32 %1, label %15 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
i32 5, label %13
]
3: ; preds = %2
%4 = tail call double @year_from_time(double %0)
br label %17
5: ; preds = %2
%6 = tail call double @month_from_time(double %0)
br label %17
7: ; preds = %2
%8 = tail call double @date_from_time(double %0)
br label %17
9: ; preds = %2
%10 = tail call double @hour_from_time(double %0)
br label %17
11: ; preds = %2
%12 = tail call double @min_from_time(double %0)
br label %17
13: ; preds = %2
%14 = tail call double @sec_from_time(double %0)
br label %17
15: ; preds = %2
%16 = tail call double @ms_from_time(double %0)
br label %17
17: ; preds = %15, %13, %11, %9, %7, %5, %3
%18 = phi double [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ]
ret double %18
}