#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 DayWithinYear(double);
int InLeapYear(double);
int MonthFromTime(double t) {
  int day = DayWithinYear(t);
  int leap = InLeapYear(t);
  if (day < 31)
    return 0;
  if (day < 59 + leap)
    return 1;
  if (day < 90 + leap)
    return 2;
  if (day < 120 + leap)
    return 3;
  if (day < 151 + leap)
    return 4;
  if (day < 181 + leap)
    return 5;
  if (day < 212 + leap)
    return 6;
  if (day < 243 + leap)
    return 7;
  if (day < 273 + leap)
    return 8;
  if (day < 304 + leap)
    return 9;
  if (day < 334 + leap)
    return 10;
  return 11;
}


x86 assembly (clang, -O0):
<MonthFromTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <DayWithinYear@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <InLeapYear@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1f,-0x14(%rbp)
jge    115d <MonthFromTime+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x3b,%ecx
cmp    %ecx,%eax
jge    117a <MonthFromTime+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x5a,%ecx
cmp    %ecx,%eax
jge    1197 <MonthFromTime+0x77>
movl   $0x2,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x78,%ecx
cmp    %ecx,%eax
jge    11b4 <MonthFromTime+0x94>
movl   $0x3,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x97,%ecx
cmp    %ecx,%eax
jge    11d4 <MonthFromTime+0xb4>
movl   $0x4,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0xb5,%ecx
cmp    %ecx,%eax
jge    11f4 <MonthFromTime+0xd4>
movl   $0x5,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0xd4,%ecx
cmp    %ecx,%eax
jge    1214 <MonthFromTime+0xf4>
movl   $0x6,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0xf3,%ecx
cmp    %ecx,%eax
jge    1234 <MonthFromTime+0x114>
movl   $0x7,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x111,%ecx
cmp    %ecx,%eax
jge    1254 <MonthFromTime+0x134>
movl   $0x8,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x130,%ecx
cmp    %ecx,%eax
jge    1274 <MonthFromTime+0x154>
movl   $0x9,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x14e,%ecx
cmp    %ecx,%eax
jge    1294 <MonthFromTime+0x174>
movl   $0xa,-0x4(%rbp)
jmp    129b <MonthFromTime+0x17b>
movl   $0xb,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MonthFromTime>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <DayWithinYear@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1030 <InLeapYear@plt>
xor    %ecx,%ecx
cmp    $0x1f,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x3b(%rax),%edx
mov    $0x1,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x5a(%rax),%edx
mov    $0x2,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x78(%rax),%edx
mov    $0x3,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x97(%rax),%edx
mov    $0x4,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0xb5(%rax),%edx
mov    $0x5,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0xd4(%rax),%edx
mov    $0x6,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0xf3(%rax),%edx
mov    $0x7,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x111(%rax),%edx
mov    $0x8,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
lea    0x130(%rax),%edx
mov    $0x9,%ecx
cmp    %edx,%ebx
jl     11d9 <MonthFromTime+0xb9>
add    $0x14e,%eax
xor    %ecx,%ecx
cmp    %eax,%ebx
setl   %cl
xor    $0xb,%ecx
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @MonthFromTime(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store double %0, double* %3
%6 = load double, double* %3
%7 = call i32 @DayWithinYear(double %6)
store i32 %7, i32* %4
%8 = load double, double* %3
%9 = call i32 @InLeapYear(double %8)
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 31
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 0, i32* %2
br label %74
13: ; preds = %1
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = add nsw i32 59, %15
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 1, i32* %2
br label %74
19: ; preds = %13
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 90, %21
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 2, i32* %2
br label %74
25: ; preds = %19
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = add nsw i32 120, %27
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 3, i32* %2
br label %74
31: ; preds = %25
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = add nsw i32 151, %33
%35 = icmp slt i32 %32, %34
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 4, i32* %2
br label %74
37: ; preds = %31
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = add nsw i32 181, %39
%41 = icmp slt i32 %38, %40
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 5, i32* %2
br label %74
43: ; preds = %37
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = add nsw i32 212, %45
%47 = icmp slt i32 %44, %46
br i1 %47, label %48, label %49
48: ; preds = %43
store i32 6, i32* %2
br label %74
49: ; preds = %43
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = add nsw i32 243, %51
%53 = icmp slt i32 %50, %52
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 7, i32* %2
br label %74
55: ; preds = %49
%56 = load i32, i32* %4
%57 = load i32, i32* %5
%58 = add nsw i32 273, %57
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %61
60: ; preds = %55
store i32 8, i32* %2
br label %74
61: ; preds = %55
%62 = load i32, i32* %4
%63 = load i32, i32* %5
%64 = add nsw i32 304, %63
%65 = icmp slt i32 %62, %64
br i1 %65, label %66, label %67
66: ; preds = %61
store i32 9, i32* %2
br label %74
67: ; preds = %61
%68 = load i32, i32* %4
%69 = load i32, i32* %5
%70 = add nsw i32 334, %69
%71 = icmp slt i32 %68, %70
br i1 %71, label %72, label %73
72: ; preds = %67
store i32 10, i32* %2
br label %74
73: ; preds = %67
store i32 11, i32* %2
br label %74
74: ; preds = %73, %72, %66, %60, %54, %48, %42, %36, %30, %24, %18, %12
%75 = load i32, i32* %2
ret i32 %75
}

LLVM IR (-O2):
define i32 @MonthFromTime(double %0) {
%2 = tail call i32 @DayWithinYear(double %0)
%3 = tail call i32 @InLeapYear(double %0)
%4 = icmp slt i32 %2, 31
br i1 %4, label %36, label %5
5: ; preds = %1
%6 = add nsw i32 %3, 59
%7 = icmp slt i32 %2, %6
br i1 %7, label %36, label %8
8: ; preds = %5
%9 = add nsw i32 %3, 90
%10 = icmp slt i32 %2, %9
br i1 %10, label %36, label %11
11: ; preds = %8
%12 = add nsw i32 %3, 120
%13 = icmp slt i32 %2, %12
br i1 %13, label %36, label %14
14: ; preds = %11
%15 = add nsw i32 %3, 151
%16 = icmp slt i32 %2, %15
br i1 %16, label %36, label %17
17: ; preds = %14
%18 = add nsw i32 %3, 181
%19 = icmp slt i32 %2, %18
br i1 %19, label %36, label %20
20: ; preds = %17
%21 = add nsw i32 %3, 212
%22 = icmp slt i32 %2, %21
br i1 %22, label %36, label %23
23: ; preds = %20
%24 = add nsw i32 %3, 243
%25 = icmp slt i32 %2, %24
br i1 %25, label %36, label %26
26: ; preds = %23
%27 = add nsw i32 %3, 273
%28 = icmp slt i32 %2, %27
br i1 %28, label %36, label %29
29: ; preds = %26
%30 = add nsw i32 %3, 304
%31 = icmp slt i32 %2, %30
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = add nsw i32 %3, 334
%34 = icmp slt i32 %2, %33
%35 = select i1 %34, i32 10, i32 11
br label %36
36: ; preds = %32, %29, %26, %23, %20, %17, %14, %11, %8, %5, %1
%37 = phi i32 [ 0, %1 ], [ 1, %5 ], [ 2, %8 ], [ 3, %11 ], [ 4, %14 ], [ 5, %17 ], [ 6, %20 ], [ 7, %23 ], [ 8, %26 ], [ 9, %29 ], [ %35, %32 ]
ret i32 %37
}