#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*/ printf(char *, ...);
int main(void) {
  void flmoon(int n, int nph, long *jd, float *frac);
  long julday(int mm, int id, int iyyy);
  int ic, icon, idwk, im, iyyy, n;
  float timzon = -5.0 / 24.0, frac;
  long jd, jday;
  printf("\nFull moons on Friday the 13th from %5d to %5d\n", 1900, 2000);
  for (iyyy = 1900; iyyy <= 2000; iyyy++) {
    for (im = 1; im <= 12; im++) {
      jday = julday(im, 13, iyyy);
      idwk = (int)((jday + 1) % 7);
      if (idwk == 5) {
        n = (int)(12.37 * (iyyy - 1900 + (im - 0.5) / 12.0));
        icon = 0;
        for (;;) {
          flmoon(n, 2, &jd, &frac);
          frac = 24.0 * (frac + timzon);
          if (frac < 0.0) {
            --jd;
            frac += 24.0;
          }
          if (frac > 12.0) {
            ++jd;
            frac -= 12.0;
          } else
            frac += 12.0;
          if (jd == jday) {
            printf("\n%2d/13/%4d\n", im, iyyy);
            printf("%s %5.1f %s\n", "Full moon", frac,
                   " hrs after midnight (EST)");
            break;
          } else {
            ic = (jday >= jd ? 1 : -1);
            if (ic == (-icon))
              break;
            icon = ic;
            n += ic;
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xeb9(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x76c,%esi
mov    $0x7d0,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x76c,-0x18(%rbp)
cmpl   $0x7d0,-0x18(%rbp)
jg     13a0 <main+0x270>
movl   $0x1,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jg     138d <main+0x25d>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
mov    $0xd,%esi
call   1030 <julday@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    $0x7,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jne    137a <main+0x24a>
mov    -0x18(%rbp),%eax
sub    $0x76c,%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe41(%rip),%xmm2
subsd  %xmm2,%xmm0
movsd  0xe2d(%rip),%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  0xe15(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
lea    -0x30(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1050 <flmoon@plt>
movss  -0x24(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf0(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    127d <main+0x14d>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd82(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c7 <main+0x197>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd5b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    12e5 <main+0x1b5>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd38(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1331 <main+0x201>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd4e(%rip),%rdi
lea    0xd54(%rip),%rsi
lea    0xd57(%rip),%rdx
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1375 <main+0x245>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rsi
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmovge %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1361 <main+0x231>
jmp    1375 <main+0x245>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1205 <main+0xd5>
jmp    137a <main+0x24a>
jmp    137f <main+0x24f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117f <main+0x4f>
jmp    1392 <main+0x262>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116b <main+0x3b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeef(%rip),%rdi
mov    $0x76c,%ebp
mov    $0x76c,%esi
mov    $0x7d0,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
jmp    117f <main+0x4f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x7d1,%ebp
je     1344 <main+0x214>
lea    -0x76c(%rbp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    $0x1,%r13d
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %rbp,0x18(%rsp)
jmp    1213 <main+0xe3>
nopl   (%rax)
lea    0xead(%rip),%rdi
mov    %r13d,%esi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9a(%rip),%rdi
lea    0xea0(%rip),%rsi
lea    0xea3(%rip),%rdx
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xe06(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%r13d
cmp    $0xd,%r13d
mov    0x18(%rsp),%rbp
je     1170 <main+0x40>
mov    %r13d,%edi
mov    $0xd,%esi
mov    %ebp,%edx
call   1030 <julday@plt>
mov    %rax,%rbp
lea    0x1(%rax),%rcx
mov    %rcx,%rax
movabs $0x4924924924924925,%rdx
92 24 49
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    %rdx
add    %eax,%edx
lea    0x0(,%rdx,8),%eax
sub    %eax,%edx
add    %edx,%ecx
cmp    $0x5,%ecx
jne    11ec <main+0xbc>
movsd  0x10(%rsp),%xmm0
addsd  0xda5(%rip),%xmm0
divsd  0xda5(%rip),%xmm0
addsd  0x20(%rsp),%xmm0
mulsd  0xd9f(%rip),%xmm0
cvttsd2si %xmm0,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    $0x2,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1050 <flmoon@plt>
movss  0x4(%rsp),%xmm0
addss  0xd6f(%rip),%xmm0
movss  0xd6b(%rip),%xmm1
mulss  %xmm1,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
jbe    12cf <main+0x19f>
addq   $0xffffffffffffffff,0x8(%rsp)
addss  %xmm1,%xmm0
movss  0xd51(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1300 <main+0x1d0>
mov    0x8(%rsp),%rax
add    $0x1,%rax
mov    %rax,0x8(%rsp)
addss  0xd3a(%rip),%xmm0
jmp    1309 <main+0x1d9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addss  %xmm1,%xmm0
mov    0x8(%rsp),%rax
movss  %xmm0,0x4(%rsp)
cmp    %rbp,%rax
je     11b0 <main+0x80>
setle  %cl
movzbl %cl,%ecx
add    %ecx,%ecx
add    $0xffffffff,%ecx
cmp    %r14d,%ecx
je     11ec <main+0xbc>
xor    %edx,%edx
cmp    %rax,%rbp
setl   %dl
lea    (%rdx,%rdx,1),%r14d
add    $0xffffffff,%r14d
add    %ecx,%r12d
jmp    1290 <main+0x160>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"\0AFull moons on Friday the 13th from %5d to %5d\0A\00"
@.str.1 = [13 x i8] c"\0A%2d/13/%4d\0A\00"
@.str.2 = [13 x i8] c"%s %5.1f %s\0A\00"
@.str.3 = [10 x i8] c"Full moon\00"
@.str.4 = [26 x i8] c" hrs after midnight (EST)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %1
store float 0xBFCAAAAAA0000000, float* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 1900, i32 2000)
store i32 1900, i32* %6
br label %13
13: ; preds = %109, %0
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 2000
br i1 %15, label %16, label %112
16: ; preds = %13
store i32 1, i32* %5
br label %17
17: ; preds = %105, %16
%18 = load i32, i32* %5
%19 = icmp sle i32 %18, 12
br i1 %19, label %20, label %108
20: ; preds = %17
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i64 @julday(i32 %21, i32 13, i32 %22)
store i64 %23, i64* %11
%24 = load i64, i64* %11
%25 = add nsw i64 %24, 1
%26 = srem i64 %25, 7
%27 = trunc i64 %26 to i32
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %104
30: ; preds = %20
%31 = load i32, i32* %6
%32 = sub nsw i32 %31, 1900
%33 = sitofp i32 %32 to double
%34 = load i32, i32* %5
%35 = sitofp i32 %34 to double
%36 = fsub double %35, 5.000000e-01
%37 = fdiv double %36, 1.200000e+01
%38 = fadd double %33, %37
%39 = fmul double 1.237000e+01, %38
%40 = fptosi double %39 to i32
store i32 %40, i32* %7
store i32 0, i32* %3
br label %41
41: ; preds = %102, %30
%42 = load i32, i32* %7
%43 = load float, float* %9
%44 = load float, float* %8
%45 = fadd float %43, %44
%46 = fpext float %45 to double
%47 = fmul double 2.400000e+01, %46
%48 = fptrunc double %47 to float
store float %48, float* %9
%49 = load float, float* %9
%50 = fpext float %49 to double
%51 = fcmp olt double %50, 0.000000e+00
br i1 %51, label %52, label %59
52: ; preds = %41
%53 = load i64, i64* %10
%54 = add nsw i64 %53, -1
store i64 %54, i64* %10
%55 = load float, float* %9
%56 = fpext float %55 to double
%57 = fadd double %56, 2.400000e+01
%58 = fptrunc double %57 to float
store float %58, float* %9
br label %59
59: ; preds = %52, %41
%60 = load float, float* %9
%61 = fpext float %60 to double
%62 = fcmp ogt double %61, 1.200000e+01
br i1 %62, label %63, label %70
63: ; preds = %59
%64 = load i64, i64* %10
%65 = add nsw i64 %64, 1
store i64 %65, i64* %10
%66 = load float, float* %9
%67 = fpext float %66 to double
%68 = fsub double %67, 1.200000e+01
%69 = fptrunc double %68 to float
store float %69, float* %9
br label %75
70: ; preds = %59
%71 = load float, float* %9
%72 = fpext float %71 to double
%73 = fadd double %72, 1.200000e+01
%74 = fptrunc double %73 to float
store float %74, float* %9
br label %75
75: ; preds = %70, %63
%76 = load i64, i64* %10
%77 = load i64, i64* %11
%78 = icmp eq i64 %76, %77
br i1 %78, label %79, label %86
79: ; preds = %75
%80 = load i32, i32* %5
%81 = load i32, i32* %6
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %80, i32 %81)
%83 = load float, float* %9
%84 = fpext float %83 to double
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %84, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %103
86: ; preds = %75
%87 = load i64, i64* %11
%88 = load i64, i64* %10
%89 = icmp sge i64 %87, %88
%90 = zext i1 %89 to i64
%91 = select i1 %89, i32 1, i32 -1
store i32 %91, i32* %2
%92 = load i32, i32* %2
%93 = load i32, i32* %3
%94 = sub nsw i32 0, %93
%95 = icmp eq i32 %92, %94
br i1 %95, label %96, label %97
96: ; preds = %86
br label %103
97: ; preds = %86
%98 = load i32, i32* %2
store i32 %98, i32* %3
%99 = load i32, i32* %2
%100 = load i32, i32* %7
%101 = add nsw i32 %100, %99
store i32 %101, i32* %7
br label %102
102: ; preds = %97
br label %41
103: ; preds = %96, %79
br label %104
104: ; preds = %103, %20
br label %105
105: ; preds = %104
%106 = load i32, i32* %5
%107 = add nsw i32 %106, 1
store i32 %107, i32* %5
br label %17
108: ; preds = %17
br label %109
109: ; preds = %108
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %13
112: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"\0AFull moons on Friday the 13th from %5d to %5d\0A\00"
@.str.1 = [13 x i8] c"\0A%2d/13/%4d\0A\00"
@.str.2 = [13 x i8] c"%s %5.1f %s\0A\00"
@.str.3 = [10 x i8] c"Full moon\00"
@.str.4 = [26 x i8] c" hrs after midnight (EST)\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i64
%3 = bitcast float* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 1900, i32 2000)
br label %6
6: ; preds = %0, %64
%7 = phi i32 [ 1900, %0 ], [ %65, %64 ]
%8 = add nsw i32 %7, -1900
%9 = sitofp i32 %8 to double
br label %10
10: ; preds = %6, %61
%11 = phi i32 [ 1, %6 ], [ %62, %61 ]
%12 = call i64 @julday(i32 %11, i32 13, i32 %7)
%13 = add nsw i64 %12, 1
%14 = srem i64 %13, 7
%15 = trunc i64 %14 to i32
%16 = icmp eq i32 %15, 5
br i1 %16, label %17, label %61
17: ; preds = %10
%18 = sitofp i32 %11 to double
%19 = fadd double %18, -5.000000e-01
%20 = fdiv double %19, 1.200000e+01
%21 = fadd double %20, %9
%22 = fmul double %21, 1.237000e+01
%23 = fptosi double %22 to i32
br label %24
24: ; preds = %58, %17
%25 = phi i32 [ %23, %17 ], [ %60, %58 ]
%26 = phi i32 [ 0, %17 ], [ %59, %58 ]
%27 = load float, float* %1
%28 = fadd float %27, 0xBFCAAAAAA0000000
%29 = fmul float %28, 2.400000e+01
%30 = fcmp olt float %29, 0.000000e+00
br i1 %30, label %31, label %35
31: ; preds = %24
%32 = load i64, i64* %2
%33 = add nsw i64 %32, -1
store i64 %33, i64* %2
%34 = fadd float %29, 2.400000e+01
br label %35
35: ; preds = %31, %24
%36 = phi float [ %34, %31 ], [ %29, %24 ]
%37 = fcmp ogt float %36, 1.200000e+01
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i64, i64* %2
%40 = add nsw i64 %39, 1
store i64 %40, i64* %2
%41 = fadd float %36, -1.200000e+01
br label %45
42: ; preds = %35
%43 = fadd float %36, 1.200000e+01
%44 = load i64, i64* %2
br label %45
45: ; preds = %42, %38
%46 = phi i64 [ %44, %42 ], [ %40, %38 ]
%47 = phi float [ %43, %42 ], [ %41, %38 ]
store float %47, float* %1
%48 = icmp eq i64 %46, %12
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %7)
%51 = load float, float* %1
%52 = fpext float %51 to double
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %52, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %61
54: ; preds = %45
%55 = icmp slt i64 %12, %46
%56 = select i1 %55, i32 -1, i32 1
%57 = icmp eq i32 %56, %26
br i1 %57, label %61, label %58
58: ; preds = %54
%59 = select i1 %55, i32 1, i32 -1
%60 = add nsw i32 %56, %25
br label %24
61: ; preds = %54, %10, %49
%62 = add nuw nsw i32 %11, 1
%63 = icmp eq i32 %62, 13
br i1 %63, label %64, label %10
64: ; preds = %61
%65 = add nuw nsw i32 %7, 1
%66 = icmp eq i32 %65, 2001
br i1 %66, label %67, label %6
67: ; preds = %64
ret i32 0
}