#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*/ asprintf(char **, char *, int, int, int, int, ...);
int getDayOfWeek(int, int, int);
int /*<<< orphan*/ statusFailed(char *);
int /*<<< orphan*/ statusOK(char *);
void checkGetDayOfWeek(int day, int month, int year, int expected) {
  int actual = getDayOfWeek(day, month, year);
  char *message;
  if (actual == expected) {
    asprintf(&message, "getDayOfWeek: %d %d %d -> %d", day, month, year,
             actual);
    statusOK(message);
  } else {
    asprintf(&message, "getDayOfWeek: %d %d %d -> %d expecting %d", day, month,
             year, actual, expected);
    statusFailed(message);
  }
}


x86 assembly (clang, -O0):
<checkGetDayOfWeek>:
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    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <getDayOfWeek@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    119f <checkGetDayOfWeek+0x5f>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    -0x20(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <statusOK@plt>
jmp    11ce <checkGetDayOfWeek+0x8e>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x10(%rbp),%eax
lea    -0x20(%rbp),%rdi
lea    0xe62(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <statusFailed@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkGetDayOfWeek>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
call   1030 <getDayOfWeek@plt>
cmp    %ebp,%eax
jne    1187 <checkGetDayOfWeek+0x47>
lea    0xe9c(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    0x10(%rsp),%rdi
call   1060 <statusOK@plt>
jmp    11b2 <checkGetDayOfWeek+0x72>
mov    %ebp,(%rsp)
lea    0xe8c(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    0x10(%rsp),%rdi
call   1040 <statusFailed@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"getDayOfWeek: %d %d %d -> %d\00"
@.str.1 = [42 x i8] c"getDayOfWeek: %d %d %d -> %d expecting %d\00"
define void @checkGetDayOfWeek(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 i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @getDayOfWeek(i32 %11, i32 %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* %8
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %4
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %9
%23 = call i32 (i8**, i8*, i32, i32, i32, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i32 %22)
%24 = load i8*, i8** %10
%25 = call i32 @statusOK(i8* %24)
br label %35
26: ; preds = %4
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = call i32 (i8**, i8*, i32, i32, i32, i32, ...) @asprintf(i8** %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30, i32 %31)
%33 = load i8*, i8** %10
%34 = call i32 @statusFailed(i8* %33)
br label %35
35: ; preds = %26, %18
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"getDayOfWeek: %d %d %d -> %d\00"
@.str.1 = [42 x i8] c"getDayOfWeek: %d %d %d -> %d expecting %d\00"
define void @checkGetDayOfWeek(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = tail call i32 @getDayOfWeek(i32 %0, i32 %1, i32 %2)
%7 = bitcast i8** %5 to i8*
%8 = icmp eq i32 %6, %3
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = call i32 (i8**, i8*, i32, i32, i32, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
%11 = load i8*, i8** %5
%12 = call i32 @statusOK(i8* %11)
br label %17
13: ; preds = %4
%14 = call i32 (i8**, i8*, i32, i32, i32, i32, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %6, i32 %3)
%15 = load i8*, i8** %5
%16 = call i32 @statusFailed(i8* %15)
br label %17
17: ; preds = %13, %9
ret void
}