#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 {
  scalar_t__ tm_year;
  scalar_t__ tm_mon;
  int tm_mday;
};

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
struct tm *gmtime(int /*<<< orphan*/ *);
int solve(time_t actual, time_t expected) {
  struct tm a = *gmtime(&actual);
  struct tm e = *gmtime(&expected);
  if (difftime(actual, expected) <= 0.0) {
    return 0;
  }
  if (a.tm_year == e.tm_year) {
    if (a.tm_mon == e.tm_mon) {
      return (a.tm_mday - e.tm_mday) * 15;
    } else {
      return (a.tm_mon - e.tm_mon) * 500;
    }
  }
  return 10000;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <gmtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x28(%rbp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x20(%rbp)
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <gmtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x40(%rbp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x38(%rbp)
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <difftime@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1195 <solve+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11e0 <solve+0xc0>
mov    -0x28(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    11d9 <solve+0xb9>
mov    -0x20(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    11c2 <solve+0xa2>
mov    -0x18(%rbp),%eax
sub    -0x30(%rbp),%eax
imul   $0xf,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11e0 <solve+0xc0>
mov    -0x20(%rbp),%rax
sub    -0x38(%rbp),%rax
imul   $0x1f4,%rax,%rax
mov    %eax,-0x4(%rbp)
jmp    11e0 <solve+0xc0>
movl   $0x2710,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <gmtime@plt>
mov    (%rax),%rbx
mov    0x8(%rax),%r12
mov    0x10(%rax),%r14d
mov    %rsp,%rdi
call   1040 <gmtime@plt>
mov    (%rax),%rbp
mov    0x8(%rax),%r15
mov    0x10(%rax),%r13d
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1030 <difftime@plt>
xor    %eax,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1197 <solve+0x77>
mov    $0x2710,%eax
cmp    %rbp,%rbx
jne    1197 <solve+0x77>
cmp    %r15,%r12
jne    118d <solve+0x6d>
sub    %r13d,%r14d
lea    (%r14,%r14,4),%eax
lea    (%rax,%rax,2),%eax
jmp    1197 <solve+0x77>
sub    %r15d,%r12d
imul   $0x1f4,%r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i32 }
define i32 @solve(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.tm
%7 = alloca %struct.tm
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = call %struct.tm* @gmtime(i32* %4)
%9 = bitcast %struct.tm* %6 to i8*
%10 = bitcast %struct.tm* %8 to i8*
%11 = call %struct.tm* @gmtime(i32* %5)
%12 = bitcast %struct.tm* %7 to i8*
%13 = bitcast %struct.tm* %11 to i8*
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call double @difftime(i32 %14, i32 %15)
%17 = fcmp ole double %16, 0.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 0, i32* %3
br label %47
19: ; preds = %2
%20 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%21 = load i64, i64* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%23 = load i64, i64* %22
%24 = icmp eq i64 %21, %23
br i1 %24, label %25, label %46
25: ; preds = %19
%26 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%27 = load i64, i64* %26
%28 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%29 = load i64, i64* %28
%30 = icmp eq i64 %27, %29
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%35 = load i32, i32* %34
%36 = sub nsw i32 %33, %35
%37 = mul nsw i32 %36, 15
store i32 %37, i32* %3
br label %47
38: ; preds = %25
%39 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%40 = load i64, i64* %39
%41 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%42 = load i64, i64* %41
%43 = sub nsw i64 %40, %42
%44 = mul nsw i64 %43, 500
%45 = trunc i64 %44 to i32
store i32 %45, i32* %3
br label %47
46: ; preds = %19
store i32 10000, i32* %3
br label %47
47: ; preds = %46, %38, %31, %18
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i32 }
define i32 @solve(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call %struct.tm* @gmtime(i32* %3)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%7 = load i64, i64* %6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%9 = load i64, i64* %8
%10 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%11 = load i32, i32* %10
%12 = call %struct.tm* @gmtime(i32* %4)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 0
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 1
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 2
%18 = load i32, i32* %17
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call double @difftime(i32 %19, i32 %20)
%22 = fcmp ugt double %21, 0.000000e+00
br i1 %22, label %23, label %34
23: ; preds = %2
%24 = icmp eq i64 %7, %14
br i1 %24, label %25, label %34
25: ; preds = %23
%26 = icmp eq i64 %9, %16
br i1 %26, label %27, label %30
27: ; preds = %25
%28 = sub nsw i32 %11, %18
%29 = mul nsw i32 %28, 15
br label %34
30: ; preds = %25
%31 = sub nsw i64 %9, %16
%32 = trunc i64 %31 to i32
%33 = mul i32 %32, 500
br label %34
34: ; preds = %23, %2, %30, %27
%35 = phi i32 [ %29, %27 ], [ %33, %30 ], [ 0, %2 ], [ 10000, %23 ]
ret i32 %35
}