#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 */
size_t InLeapYear(double);
double TimeFromYear(double);
double floor(double);
double pmod(double, int);
double MakeDay(double y, double m, double date) {
  static const double firstDayOfMonth[2][12] = {
      {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
      {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}};
  double yd, md;
  y += floor(m / 12);
  m = pmod(m, 12);
  yd = floor(TimeFromYear(y) / (((24.0 * 60.0) * 60.0) * 1000.0));
  md = firstDayOfMonth[InLeapYear(y)][(int)m];
  return yd + md + date - 1;
}


x86 assembly (clang, -O0):
<MakeDay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeac(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <floor@plt>
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0xc,%edi
call   1060 <pmod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <TimeFromYear@plt>
movsd  0xe6b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <floor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <InLeapYear@plt>
mov    %rax,%rcx
lea    0xe61(%rip),%rax
imul   $0x60,%rcx,%rcx
add    %rcx,%rax
cvttsd2si -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeDay>:
sub    $0x28,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
divsd  0xe9e(%rip),%xmm0
call   1050 <floor@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0xc,%edi
call   1060 <pmod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <TimeFromYear@plt>
divsd  0xe6c(%rip),%xmm0
call   1050 <floor@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <InLeapYear@plt>
cvttsd2si 0x10(%rsp),%ecx
movslq %ecx,%rcx
lea    (%rax,%rax,2),%rax
shl    $0x5,%rax
lea    0xe56(%rip),%rdx
add    %rax,%rdx
movsd  0x18(%rsp),%xmm0
addsd  (%rdx,%rcx,8),%xmm0
addsd  0x20(%rsp),%xmm0
addsd  0xe2a(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@MakeDay.firstDayOfMonth = internal constant [2 x [12 x double]] [[12 x double] [double 0.000000e+00, double 3.100000e+01, double 5.900000e+01, double 9.000000e+01, double 1.200000e+02, double 1.510000e+02, double 1.810000e+02, double 2.120000e+02, double 2.430000e+02, double 2.730000e+02, double 3.040000e+02, double 3.340000e+02], [12 x double] [double 0.000000e+00, double 3.100000e+01, double 6.000000e+01, double 9.100000e+01, double 1.210000e+02, double 1.520000e+02, double 1.820000e+02, double 2.130000e+02, double 2.440000e+02, double 2.740000e+02, double 3.050000e+02, double 3.350000e+02]]
define double @MakeDay(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %5
%10 = fdiv double %9, 1.200000e+01
%11 = call double @llvm.floor.f64(double %10)
%12 = load double, double* %4
%13 = fadd double %12, %11
store double %13, double* %4
%14 = load double, double* %5
%15 = call double @pmod(double %14, i32 12)
store double %15, double* %5
%16 = load double, double* %4
%17 = call double @TimeFromYear(double %16)
%18 = fdiv double %17, 8.640000e+07
%19 = call double @llvm.floor.f64(double %18)
store double %19, double* %7
%20 = load double, double* %4
%21 = call i64 @InLeapYear(double %20)
%22 = getelementptr inbounds [2 x [12 x double]], [2 x [12 x double]]* @MakeDay.firstDayOfMonth, i64 0, i64 %21
%23 = load double, double* %5
%24 = fptosi double %23 to i32
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [12 x double], [12 x double]* %22, i64 0, i64 %25
%27 = load double, double* %26
store double %27, double* %8
%28 = load double, double* %7
%29 = load double, double* %8
%30 = fadd double %28, %29
%31 = load double, double* %6
%32 = fadd double %30, %31
%33 = fsub double %32, 1.000000e+00
ret double %33
}

LLVM IR (-O2):
@MakeDay.firstDayOfMonth = internal unnamed_addr constant [2 x [12 x double]] [[12 x double] [double 0.000000e+00, double 3.100000e+01, double 5.900000e+01, double 9.000000e+01, double 1.200000e+02, double 1.510000e+02, double 1.810000e+02, double 2.120000e+02, double 2.430000e+02, double 2.730000e+02, double 3.040000e+02, double 3.340000e+02], [12 x double] [double 0.000000e+00, double 3.100000e+01, double 6.000000e+01, double 9.100000e+01, double 1.210000e+02, double 1.520000e+02, double 1.820000e+02, double 2.130000e+02, double 2.440000e+02, double 2.740000e+02, double 3.050000e+02, double 3.350000e+02]]
define double @MakeDay(double %0, double %1, double %2) {
%4 = fdiv double %1, 1.200000e+01
%5 = tail call double @llvm.floor.f64(double %4)
%6 = fadd double %5, %0
%7 = tail call double @pmod(double %1, i32 12)
%8 = tail call double @TimeFromYear(double %6)
%9 = fdiv double %8, 8.640000e+07
%10 = tail call double @llvm.floor.f64(double %9)
%11 = tail call i64 @InLeapYear(double %6)
%12 = fptosi double %7 to i32
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [2 x [12 x double]], [2 x [12 x double]]* @MakeDay.firstDayOfMonth, i64 0, i64 %11, i64 %13
%15 = load double, double* %14
%16 = fadd double %10, %15
%17 = fadd double %16, %2
%18 = fadd double %17, -1.000000e+00
ret double %18
}