#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  int tm_mon;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int its_birthday(FILE *firmware) {
  int day = 0;
  int month = 0;
  time_t t = 0;
  struct tm *tm = NULL;
  t = time(NULL);
  tm = localtime(&t);
  fseek(firmware, 0x03FE03, SEEK_SET);
  fread(&month, 1, 1, firmware);
  fread(&day, 1, 1, firmware);
  return ((day == tm->tm_mday) && (month - 1 == tm->tm_mon));
}


x86 assembly (clang, -O0):
<its_birthday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e53(%rip),%rax
mov    (%rax),%edx
mov    $0x3fe03,%esi
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rcx
lea    -0x10(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
jne    11e8 <its_birthday+0xa8>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    -0x20(%rbp),%rcx
cmp    0x4(%rcx),%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<its_birthday>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r15
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x3fe03,%esi
call   1060 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
lea    0x8(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    0x8(%rsp),%eax
cmp    (%r15),%eax
jne    11d6 <its_birthday+0x96>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
xor    %r14d,%r14d
cmp    0x4(%r15),%eax
sete   %r14b
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@SEEK_SET = global i32 0
define i32 @its_birthday(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.tm*
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store %struct.tm* null, %struct.tm** %6
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 261635, i32 %10)
%12 = load i32*, i32** %2
%13 = call i32 @fread(i32* %4, i32 1, i32 1, i32* %12)
%14 = load i32*, i32** %2
%15 = call i32 @fread(i32* %3, i32 1, i32 1, i32* %14)
%16 = load i32, i32* %3
%17 = load %struct.tm*, %struct.tm** %6
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = icmp eq i32 %16, %19
br i1 %20, label %21, label %28
21: ; preds = %1
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = load %struct.tm*, %struct.tm** %6
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = icmp eq i32 %23, %26
br label %28
28: ; preds = %21, %1
%29 = phi i1 [ false, %1 ], [ %27, %21 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@SEEK_SET = global i32 0
define i32 @its_birthday(i32* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %4
%9 = call %struct.tm* @localtime(i32* %4)
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %0, i32 261635, i32 %10)
%12 = call i32 @fread(i32* %3, i32 1, i32 1, i32* %0)
%13 = call i32 @fread(i32* %2, i32 1, i32 1, i32* %0)
%14 = load i32, i32* %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%16 = load i32, i32* %15
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %25
18: ; preds = %1
%19 = load i32, i32* %3
%20 = add nsw i32 %19, -1
%21 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 1
%22 = load i32, i32* %21
%23 = icmp eq i32 %20, %22
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %18, %1
%26 = phi i32 [ 0, %1 ], [ %24, %18 ]
ret i32 %26
}