#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 floor(int);
int getCenturyAnchorDay(int);
int getDoomsday(int year) {
  int digits = year % 100;
  int a = floor(digits / 12);
  int b = digits % 12;
  int c = floor(b / 4);
  int d = getCenturyAnchorDay(year);
  return (a + b + c + d) % 7;
}


x86 assembly (clang, -O0):
<getDoomsday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getCenturyAnchorDay@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDoomsday>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movslq %edi,%r14
imul   $0x51eb851f,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
mov    %r14d,%ebx
sub    %eax,%ebx
movsbl %bl,%eax
imul   $0x2b,%eax,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
shr    $0x9,%ecx
add    %al,%cl
movsbl %cl,%r15d
mov    %r15d,%edi
call   1040 <floor@plt>
mov    %eax,%ebp
movzbl %r15b,%eax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
sub    %al,%bl
movsbl %bl,%ebx
mov    %ebx,%eax
sar    $0x7,%al
shr    $0x6,%al
add    %bl,%al
sar    $0x2,%al
movsbl %al,%edi
call   1040 <floor@plt>
mov    %eax,%r15d
mov    %r14d,%edi
call   1030 <getCenturyAnchorDay@plt>
add    %ebx,%ebp
add    %r15d,%ebp
add    %eax,%ebp
movslq %ebp,%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    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getDoomsday(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = srem i32 %8, 100
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = sdiv i32 %10, 12
%12 = call i32 @floor(i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = srem i32 %13, 12
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = sdiv i32 %15, 4
%17 = call i32 @floor(i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %2
%19 = call i32 @getCenturyAnchorDay(i32 %18)
store i32 %19, i32* %7
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %6
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
%27 = srem i32 %26, 7
ret i32 %27
}

LLVM IR (-O2):
define i32 @getDoomsday(i32 %0) {
%2 = srem i32 %0, 100
%3 = trunc i32 %2 to i8
%4 = sdiv i8 %3, 12
%5 = sext i8 %4 to i32
%6 = tail call i32 @floor(i32 %5)
%7 = srem i8 %3, 12
%8 = sext i8 %7 to i32
%9 = sdiv i8 %7, 4
%10 = sext i8 %9 to i32
%11 = tail call i32 @floor(i32 %10)
%12 = tail call i32 @getCenturyAnchorDay(i32 %0)
%13 = add nsw i32 %6, %8
%14 = add nsw i32 %13, %11
%15 = add nsw i32 %14, %12
%16 = srem i32 %15, 7
ret i32 %16
}