#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 */
scalar_t__ floor(int);
int zeller(int day, int month, int year, int julian) {
  int century, output;
  century = (int)floor(year / 100);
  year %= 100;
  output = (day + (int)floor((13 * (month + 1)) / 5) + year +
            (int)floor(year / 4) + (!julian ? (int)floor(century / 4) : 5) -
            (!julian ? (2 * century) : century)) %
           7;
  return output;
}


x86 assembly (clang, -O0):
<zeller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <floor@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
imul   $0xd,%eax,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <floor@plt>
mov    %rax,%rcx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <floor@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11b4 <zeller+0xa4>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <floor@plt>
mov    %eax,-0x28(%rbp)
jmp    11c1 <zeller+0xb1>
mov    $0x5,%eax
mov    %eax,-0x28(%rbp)
jmp    11c1 <zeller+0xb1>
mov    -0x1c(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11e4 <zeller+0xd4>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ea <zeller+0xda>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
sub    %ecx,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeller>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r12d
mov    %esi,%ebp
mov    %edi,0x4(%rsp)
movslq %edx,%r14
imul   $0x51eb851f,%r14,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
mov    %ebx,%edi
call   1030 <floor@plt>
mov    %rax,%r13
imul   $0x64,%ebx,%eax
sub    %eax,%r14d
lea    0x0(%rbp,%rbp,2),%eax
lea    0xd(%rbp,%rax,4),%eax
cltq
imul   $0x66666667,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x21,%rdi
add    %eax,%edi
call   1030 <floor@plt>
mov    %rax,%r15
mov    %r14d,%eax
sar    $0x7,%al
shr    $0x6,%al
add    %r14b,%al
sar    $0x2,%al
movsbl %al,%edi
call   1030 <floor@plt>
mov    %rax,%rbp
mov    $0x5,%eax
test   %r12d,%r12d
jne    11a8 <zeller+0x98>
lea    0x3(%r13),%edi
test   %r13d,%r13d
cmovns %r13d,%edi
sar    $0x2,%edi
call   1030 <floor@plt>
test   %r12d,%r12d
sete   %cl
shl    %cl,%r13d
add    0x4(%rsp),%r14d
add    %r15d,%r14d
sub    %r13d,%r14d
add    %ebp,%r14d
add    %eax,%r14d
movslq %r14d,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @zeller(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = sdiv i32 %11, 100
%13 = call i64 @floor(i32 %12)
%14 = trunc i64 %13 to i32
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = srem i32 %15, 100
store i32 %16, i32* %7
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
%20 = mul nsw i32 13, %19
%21 = sdiv i32 %20, 5
%22 = call i64 @floor(i32 %21)
%23 = trunc i64 %22 to i32
%24 = add nsw i32 %17, %23
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
%27 = load i32, i32* %7
%28 = sdiv i32 %27, 4
%29 = call i64 @floor(i32 %28)
%30 = trunc i64 %29 to i32
%31 = add nsw i32 %26, %30
%32 = load i32, i32* %8
%33 = icmp ne i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %4
%35 = load i32, i32* %9
%36 = sdiv i32 %35, 4
%37 = call i64 @floor(i32 %36)
%38 = trunc i64 %37 to i32
br label %40
39: ; preds = %4
br label %40
40: ; preds = %39, %34
%41 = phi i32 [ %38, %34 ], [ 5, %39 ]
%42 = add nsw i32 %31, %41
%43 = load i32, i32* %8
%44 = icmp ne i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %40
%46 = load i32, i32* %9
%47 = mul nsw i32 2, %46
br label %50
48: ; preds = %40
%49 = load i32, i32* %9
br label %50
50: ; preds = %48, %45
%51 = phi i32 [ %47, %45 ], [ %49, %48 ]
%52 = sub nsw i32 %42, %51
%53 = srem i32 %52, 7
store i32 %53, i32* %10
%54 = load i32, i32* %10
ret i32 %54
}

LLVM IR (-O2):
define i32 @zeller(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sdiv i32 %2, 100
%6 = tail call i64 @floor(i32 %5)
%7 = trunc i64 %6 to i32
%8 = srem i32 %2, 100
%9 = mul i32 %1, 13
%10 = add i32 %9, 13
%11 = sdiv i32 %10, 5
%12 = tail call i64 @floor(i32 %11)
%13 = trunc i32 %8 to i8
%14 = sdiv i8 %13, 4
%15 = sext i8 %14 to i32
%16 = tail call i64 @floor(i32 %15)
%17 = icmp eq i32 %3, 0
br i1 %17, label %18, label %22
18: ; preds = %4
%19 = sdiv i32 %7, 4
%20 = tail call i64 @floor(i32 %19)
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %4, %18
%23 = phi i32 [ %21, %18 ], [ 5, %4 ]
%24 = trunc i64 %12 to i32
%25 = trunc i64 %16 to i32
%26 = zext i1 %17 to i32
%27 = shl nsw i32 %7, %26
%28 = add i32 %8, %0
%29 = add i32 %28, %24
%30 = sub i32 %29, %27
%31 = add i32 %30, %25
%32 = add i32 %31, %23
%33 = srem i32 %32, 7
ret i32 %33
}