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


x86 assembly (clang, -O0):
<checkGetDoomsday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <getDoomsday@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    118b <checkGetDoomsday+0x4b>
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    -0x18(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <statusOK@plt>
jmp    11b0 <checkGetDoomsday+0x70>
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    -0x18(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <statusFailed@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkGetDoomsday>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <getDoomsday@plt>
cmp    %ebx,%eax
jne    1170 <checkGetDoomsday+0x30>
lea    0xea9(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    (%rsp),%rdi
call   1060 <statusOK@plt>
jmp    1191 <checkGetDoomsday+0x51>
lea    0xe9f(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    (%rsp),%rdi
call   1030 <statusFailed@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"getDoomsday: %d -> %d\00"
@.str.1 = [35 x i8] c"getDoomsday: %d -> %d expecting %d\00"
define void @checkGetDoomsday(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @getDoomsday(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = call i32 (i8**, i8*, i32, i32, ...) @asprintf(i8** %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i8*, i8** %6
%17 = call i32 @statusOK(i8* %16)
br label %25
18: ; preds = %2
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = call i32 (i8**, i8*, i32, i32, ...) @asprintf(i8** %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
%23 = load i8*, i8** %6
%24 = call i32 @statusFailed(i8* %23)
br label %25
25: ; preds = %18, %12
ret void
}

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