void grace_get_x_tick_major_minor(double *x_tick_major, int *x_tick_minor,
                                  int number_of_days) {
  if (number_of_days == 1) {
    *x_tick_major = 0.25;
    *x_tick_minor = 5;
  } else if (number_of_days == 2) {
    *x_tick_major = 0.50;
    *x_tick_minor = 11;
  } else if (number_of_days == 3) {
    *x_tick_major = 1.0;
    *x_tick_minor = 5;
  } else if (number_of_days <= 7) {
    *x_tick_major = 1.0;
    *x_tick_minor = 3;
  } else if (number_of_days <= 14) {
    *x_tick_major = 2.0;
    *x_tick_minor = 1;
  } else if (number_of_days <= 62) {
    *x_tick_major = 7.0;
    *x_tick_minor = 6;
  } else if (number_of_days <= 100) {
    *x_tick_major = 10.0;
    *x_tick_minor = 1;
  } else if (number_of_days <= 180) {
    *x_tick_major = 15.0;
    *x_tick_minor = 3;
  } else if (number_of_days <= 366) {
    *x_tick_major = 30.0;
    *x_tick_minor = 3;
  } else if (number_of_days <= (366 * 2)) {
    *x_tick_major = 90.0;
    *x_tick_minor = 4;
  } else if (number_of_days <= (366 * 3)) {
    *x_tick_major = 365.0;
    *x_tick_minor = 11;
  } else if (number_of_days <= 366 * 10) {
    *x_tick_major = 365.25;
    *x_tick_minor = 3;
  } else if (number_of_days <= (366 * 15)) {
    *x_tick_major = (365.0 * 2);
    *x_tick_minor = 1;
  } else if (number_of_days <= (366 * 20)) {
    *x_tick_major = (365.0 * 2);
    *x_tick_minor = 1;
  } else {
    *x_tick_major = (365 * 4);
    *x_tick_minor = 3;
  }
}


x86 assembly (clang, -O0):
<grace_get_x_tick_major_minor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1138 <grace_get_x_tick_major_minor+0x38>
mov    -0x8(%rbp),%rax
movsd  0xf3b(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
jmp    13bd <grace_get_x_tick_major_minor+0x2bd>
cmpl   $0x2,-0x14(%rbp)
jne    1161 <grace_get_x_tick_major_minor+0x61>
mov    -0x8(%rbp),%rax
movsd  0xf0a(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xb,(%rax)
jmp    13b8 <grace_get_x_tick_major_minor+0x2b8>
cmpl   $0x3,-0x14(%rbp)
jne    118a <grace_get_x_tick_major_minor+0x8a>
mov    -0x8(%rbp),%rax
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
jmp    13b3 <grace_get_x_tick_major_minor+0x2b3>
cmpl   $0x7,-0x14(%rbp)
jg     11b3 <grace_get_x_tick_major_minor+0xb3>
mov    -0x8(%rbp),%rax
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    13ae <grace_get_x_tick_major_minor+0x2ae>
cmpl   $0xe,-0x14(%rbp)
jg     11dc <grace_get_x_tick_major_minor+0xdc>
mov    -0x8(%rbp),%rax
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    13a9 <grace_get_x_tick_major_minor+0x2a9>
cmpl   $0x3e,-0x14(%rbp)
jg     1205 <grace_get_x_tick_major_minor+0x105>
mov    -0x8(%rbp),%rax
movsd  0xe4e(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x6,(%rax)
jmp    13a4 <grace_get_x_tick_major_minor+0x2a4>
cmpl   $0x64,-0x14(%rbp)
jg     122e <grace_get_x_tick_major_minor+0x12e>
mov    -0x8(%rbp),%rax
movsd  0xe1d(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    139f <grace_get_x_tick_major_minor+0x29f>
cmpl   $0xb4,-0x14(%rbp)
jg     125a <grace_get_x_tick_major_minor+0x15a>
mov    -0x8(%rbp),%rax
movsd  0xde9(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    139a <grace_get_x_tick_major_minor+0x29a>
cmpl   $0x16e,-0x14(%rbp)
jg     1286 <grace_get_x_tick_major_minor+0x186>
mov    -0x8(%rbp),%rax
movsd  0xdb5(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    1395 <grace_get_x_tick_major_minor+0x295>
cmpl   $0x2dc,-0x14(%rbp)
jg     12b2 <grace_get_x_tick_major_minor+0x1b2>
mov    -0x8(%rbp),%rax
movsd  0xd81(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    1390 <grace_get_x_tick_major_minor+0x290>
cmpl   $0x44a,-0x14(%rbp)
jg     12de <grace_get_x_tick_major_minor+0x1de>
mov    -0x8(%rbp),%rax
movsd  0xd4d(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xb,(%rax)
jmp    138b <grace_get_x_tick_major_minor+0x28b>
cmpl   $0xe4c,-0x14(%rbp)
jg     130a <grace_get_x_tick_major_minor+0x20a>
mov    -0x8(%rbp),%rax
movsd  0xd19(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    1386 <grace_get_x_tick_major_minor+0x286>
cmpl   $0x1572,-0x14(%rbp)
jg     1336 <grace_get_x_tick_major_minor+0x236>
mov    -0x8(%rbp),%rax
movsd  0xce5(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1381 <grace_get_x_tick_major_minor+0x281>
cmpl   $0x1c98,-0x14(%rbp)
jg     1362 <grace_get_x_tick_major_minor+0x262>
mov    -0x8(%rbp),%rax
movsd  0xcb9(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    137c <grace_get_x_tick_major_minor+0x27c>
mov    -0x8(%rbp),%rax
movsd  0xc92(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    1381 <grace_get_x_tick_major_minor+0x281>
jmp    1386 <grace_get_x_tick_major_minor+0x286>
jmp    138b <grace_get_x_tick_major_minor+0x28b>
jmp    1390 <grace_get_x_tick_major_minor+0x290>
jmp    1395 <grace_get_x_tick_major_minor+0x295>
jmp    139a <grace_get_x_tick_major_minor+0x29a>
jmp    139f <grace_get_x_tick_major_minor+0x29f>
jmp    13a4 <grace_get_x_tick_major_minor+0x2a4>
jmp    13a9 <grace_get_x_tick_major_minor+0x2a9>
jmp    13ae <grace_get_x_tick_major_minor+0x2ae>
jmp    13b3 <grace_get_x_tick_major_minor+0x2b3>
jmp    13b8 <grace_get_x_tick_major_minor+0x2b8>
jmp    13bd <grace_get_x_tick_major_minor+0x2bd>
pop    %rbp
ret

x86 assembly (clang, -O2):
<grace_get_x_tick_major_minor>:
lea    -0x1(%rdx),%eax
cmp    $0x3,%eax
jae    1125 <grace_get_x_tick_major_minor+0x25>
cltq
lea    0xf4f(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
lea    0xf5b(%rip),%rcx
mov    (%rcx,%rax,4),%eax
jmp    1220 <grace_get_x_tick_major_minor+0x120>
mov    $0x3,%eax
cmp    $0x8,%edx
jge    113c <grace_get_x_tick_major_minor+0x3c>
movsd  0xec9(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0xf,%edx
jae    1153 <grace_get_x_tick_major_minor+0x53>
movsd  0xebf(%rip),%xmm0
mov    $0x1,%eax
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x3f,%edx
jae    116a <grace_get_x_tick_major_minor+0x6a>
mov    $0x6,%eax
movsd  0xeab(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x65,%edx
jae    1181 <grace_get_x_tick_major_minor+0x81>
movsd  0xea1(%rip),%xmm0
mov    $0x1,%eax
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0xb5,%edx
jae    1196 <grace_get_x_tick_major_minor+0x96>
movsd  0xe8f(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x16f,%edx
jae    11a8 <grace_get_x_tick_major_minor+0xa8>
movsd  0xe82(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x2dd,%edx
jae    11bf <grace_get_x_tick_major_minor+0xbf>
mov    $0x4,%eax
movsd  0xe73(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x44b,%edx
jae    11d6 <grace_get_x_tick_major_minor+0xd6>
mov    $0xb,%eax
movsd  0xe64(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0xe4d,%edx
jae    11e8 <grace_get_x_tick_major_minor+0xe8>
movsd  0xe5a(%rip),%xmm0
jmp    1220 <grace_get_x_tick_major_minor+0x120>
cmp    $0x1573,%edx
jae    11ff <grace_get_x_tick_major_minor+0xff>
movsd  0xe50(%rip),%xmm0
mov    $0x1,%eax
jmp    1220 <grace_get_x_tick_major_minor+0x120>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    $0x1c99,%edx
setae  %al
setb   %cl
lea    0xe3a(%rip),%rdx
movsd  (%rdx,%rcx,8),%xmm0
add    %eax,%eax
add    $0x1,%eax
movsd  %xmm0,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @grace_get_x_tick_major_minor(double* %0, i32* %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32*
%6 = alloca i32
store double* %0, double** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load double*, double** %4
store double 2.500000e-01, double* %10
%11 = load i32*, i32** %5
store i32 5, i32* %11
br label %106
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double*, double** %4
store double 5.000000e-01, double* %16
%17 = load i32*, i32** %5
store i32 11, i32* %17
br label %105
18: ; preds = %12
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load double*, double** %4
store double 1.000000e+00, double* %22
%23 = load i32*, i32** %5
store i32 5, i32* %23
br label %104
24: ; preds = %18
%25 = load i32, i32* %6
%26 = icmp sle i32 %25, 7
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load double*, double** %4
store double 1.000000e+00, double* %28
%29 = load i32*, i32** %5
store i32 3, i32* %29
br label %103
30: ; preds = %24
%31 = load i32, i32* %6
%32 = icmp sle i32 %31, 14
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load double*, double** %4
store double 2.000000e+00, double* %34
%35 = load i32*, i32** %5
store i32 1, i32* %35
br label %102
36: ; preds = %30
%37 = load i32, i32* %6
%38 = icmp sle i32 %37, 62
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load double*, double** %4
store double 7.000000e+00, double* %40
%41 = load i32*, i32** %5
store i32 6, i32* %41
br label %101
42: ; preds = %36
%43 = load i32, i32* %6
%44 = icmp sle i32 %43, 100
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load double*, double** %4
store double 1.000000e+01, double* %46
%47 = load i32*, i32** %5
store i32 1, i32* %47
br label %100
48: ; preds = %42
%49 = load i32, i32* %6
%50 = icmp sle i32 %49, 180
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load double*, double** %4
store double 1.500000e+01, double* %52
%53 = load i32*, i32** %5
store i32 3, i32* %53
br label %99
54: ; preds = %48
%55 = load i32, i32* %6
%56 = icmp sle i32 %55, 366
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load double*, double** %4
store double 3.000000e+01, double* %58
%59 = load i32*, i32** %5
store i32 3, i32* %59
br label %98
60: ; preds = %54
%61 = load i32, i32* %6
%62 = icmp sle i32 %61, 732
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load double*, double** %4
store double 9.000000e+01, double* %64
%65 = load i32*, i32** %5
store i32 4, i32* %65
br label %97
66: ; preds = %60
%67 = load i32, i32* %6
%68 = icmp sle i32 %67, 1098
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load double*, double** %4
store double 3.650000e+02, double* %70
%71 = load i32*, i32** %5
store i32 11, i32* %71
br label %96
72: ; preds = %66
%73 = load i32, i32* %6
%74 = icmp sle i32 %73, 3660
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = load double*, double** %4
store double 3.652500e+02, double* %76
%77 = load i32*, i32** %5
store i32 3, i32* %77
br label %95
78: ; preds = %72
%79 = load i32, i32* %6
%80 = icmp sle i32 %79, 5490
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = load double*, double** %4
store double 7.300000e+02, double* %82
%83 = load i32*, i32** %5
store i32 1, i32* %83
br label %94
84: ; preds = %78
%85 = load i32, i32* %6
%86 = icmp sle i32 %85, 7320
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load double*, double** %4
store double 7.300000e+02, double* %88
%89 = load i32*, i32** %5
store i32 1, i32* %89
br label %93
90: ; preds = %84
%91 = load double*, double** %4
store double 1.460000e+03, double* %91
%92 = load i32*, i32** %5
store i32 3, i32* %92
br label %93
93: ; preds = %90, %87
br label %94
94: ; preds = %93, %81
br label %95
95: ; preds = %94, %75
br label %96
96: ; preds = %95, %69
br label %97
97: ; preds = %96, %63
br label %98
98: ; preds = %97, %57
br label %99
99: ; preds = %98, %51
br label %100
100: ; preds = %99, %45
br label %101
101: ; preds = %100, %39
br label %102
102: ; preds = %101, %33
br label %103
103: ; preds = %102, %27
br label %104
104: ; preds = %103, %21
br label %105
105: ; preds = %104, %15
br label %106
106: ; preds = %105, %9
ret void
}

LLVM IR (-O2):
@switch.table.grace_get_x_tick_major_minor = [3 x double] [double 2.500000e-01, double 5.000000e-01, double 1.000000e+00]
@switch.table.grace_get_x_tick_major_minor.1 = [3 x i32] [i32 5, i32 11, i32 5]
define void @grace_get_x_tick_major_minor(double* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2) {
%4 = add i32 %2, -1
%5 = icmp ult i32 %4, 3
br i1 %5, label %30, label %6
6: ; preds = %3
%7 = icmp slt i32 %2, 8
br i1 %7, label %37, label %8
8: ; preds = %6
%9 = icmp ult i32 %2, 15
br i1 %9, label %37, label %10
10: ; preds = %8
%11 = icmp ult i32 %2, 63
br i1 %11, label %37, label %12
12: ; preds = %10
%13 = icmp ult i32 %2, 101
br i1 %13, label %37, label %14
14: ; preds = %12
%15 = icmp ult i32 %2, 181
br i1 %15, label %37, label %16
16: ; preds = %14
%17 = icmp ult i32 %2, 367
br i1 %17, label %37, label %18
18: ; preds = %16
%19 = icmp ult i32 %2, 733
br i1 %19, label %37, label %20
20: ; preds = %18
%21 = icmp ult i32 %2, 1099
br i1 %21, label %37, label %22
22: ; preds = %20
%23 = icmp ult i32 %2, 3661
br i1 %23, label %37, label %24
24: ; preds = %22
%25 = icmp ult i32 %2, 5491
br i1 %25, label %37, label %26
26: ; preds = %24
%27 = icmp ult i32 %2, 7321
%28 = select i1 %27, double 7.300000e+02, double 1.460000e+03
%29 = select i1 %27, i32 1, i32 3
br label %37
30: ; preds = %3
%31 = sext i32 %4 to i64
%32 = getelementptr inbounds [3 x double], [3 x double]* @switch.table.grace_get_x_tick_major_minor, i64 0, i64 %31
%33 = load double, double* %32
%34 = sext i32 %4 to i64
%35 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.grace_get_x_tick_major_minor.1, i64 0, i64 %34
%36 = load i32, i32* %35
br label %37
37: ; preds = %30, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6
%38 = phi double [ 1.000000e+00, %6 ], [ 2.000000e+00, %8 ], [ 7.000000e+00, %10 ], [ 1.000000e+01, %12 ], [ 1.500000e+01, %14 ], [ 3.000000e+01, %16 ], [ 9.000000e+01, %18 ], [ 3.650000e+02, %20 ], [ 3.652500e+02, %22 ], [ 7.300000e+02, %24 ], [ %28, %26 ], [ %33, %30 ]
%39 = phi i32 [ 3, %6 ], [ 1, %8 ], [ 6, %10 ], [ 1, %12 ], [ 3, %14 ], [ 3, %16 ], [ 4, %18 ], [ 11, %20 ], [ 3, %22 ], [ 1, %24 ], [ %29, %26 ], [ %36, %30 ]
store double %38, double* %0
store i32 %39, i32* %1
ret void
}