#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 time_t;
typedef int /*<<< orphan*/ CT_POLICY_EVAL_CTX;

/* Variables and functions */
int /*<<< orphan*/ CT_POLICY_EVAL_CTX_free(int /*<<< orphan*/ *);
int CT_POLICY_EVAL_CTX_get_time(int /*<<< orphan*/ *);
int /*<<< orphan*/ *CT_POLICY_EVAL_CTX_new();
int /*<<< orphan*/ abs(int);
scalar_t__ difftime(int /*<<< orphan*/, int const);
int /*<<< orphan*/ test_time_t_le(char *, int, char *, char *,
                                  int /*<<< orphan*/, int const);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int test_default_ct_policy_eval_ctx_time_is_now(void) {
  int success = 0;
  CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();
  const time_t default_time =
      (time_t)(CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) / 1000);
  const time_t time_tolerance = 600;
  if (!test_time_t_le(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/ct_test.c",
          487, "abs((int)difftime(time(NULL), default_time))", "time_tolerance",
          abs((int)difftime(time(NULL), default_time)), time_tolerance))
    goto end;
  success = 1;
end:
  CT_POLICY_EVAL_CTX_free(ct_policy_ctx);
  return success;
}


x86 assembly (clang, -O0):
<test_default_ct_policy_eval_ctx_time_is_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <CT_POLICY_EVAL_CTX_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <CT_POLICY_EVAL_CTX_get_time@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movl   $0x258,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%esi
call   1050 <difftime@plt>
mov    %eax,%edi
call   1040 <abs@plt>
mov    %eax,%r8d
lea    0xe37(%rip),%rdi
mov    $0x1e7,%esi
lea    0xed6(%rip),%rdx
lea    0xefc(%rip),%rcx
mov    $0x258,%r9d
call   1060 <test_time_t_le@plt>
cmp    $0x0,%eax
jne    11f5 <test_default_ct_policy_eval_ctx_time_is_now+0x85>
jmp    11fc <test_default_ct_policy_eval_ctx_time_is_now+0x8c>
movl   $0x1,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <CT_POLICY_EVAL_CTX_free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_default_ct_policy_eval_ctx_time_is_now>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1080 <CT_POLICY_EVAL_CTX_new@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <CT_POLICY_EVAL_CTX_get_time@plt>
cltq
imul   $0x10624dd3,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x26,%rbx
add    %eax,%ebx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <difftime@plt>
mov    %eax,%r8d
neg    %r8d
cmovs  %eax,%r8d
lea    0xe53(%rip),%rdi
lea    0xef7(%rip),%rdx
lea    0xf1d(%rip),%rcx
mov    $0x1e7,%esi
mov    $0x258,%r9d
call   1050 <test_time_t_le@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %r14,%rdi
call   1030 <CT_POLICY_EVAL_CTX_free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/ct_test.c\00"
@.str.1 = [45 x i8] c"abs((int)difftime(time(NULL), default_time))\00"
@.str.2 = [15 x i8] c"time_tolerance\00"
define i32 @test_default_ct_policy_eval_ctx_time_is_now() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32* (...) @CT_POLICY_EVAL_CTX_new()
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 @CT_POLICY_EVAL_CTX_get_time(i32* %6)
%8 = sdiv i32 %7, 1000
store i32 %8, i32* %3
store i32 600, i32* %4
%9 = call i32 @time(i32* null)
%10 = load i32, i32* %3
%11 = call i64 @difftime(i32 %9, i32 %10)
%12 = trunc i64 %11 to i32
%13 = call i32 @abs(i32 %12)
%14 = call i32 @test_time_t_le(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 487, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 600)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %0
br label %18
17: ; preds = %0
store i32 1, i32* %1
br label %18
18: ; preds = %17, %16
%19 = load i32*, i32** %2
%20 = call i32 @CT_POLICY_EVAL_CTX_free(i32* %19)
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/ct_test.c\00"
@.str.1 = [45 x i8] c"abs((int)difftime(time(NULL), default_time))\00"
@.str.2 = [15 x i8] c"time_tolerance\00"
define i32 @test_default_ct_policy_eval_ctx_time_is_now() {
%1 = tail call i32* (...) @CT_POLICY_EVAL_CTX_new()
%2 = tail call i32 @CT_POLICY_EVAL_CTX_get_time(i32* %1)
%3 = sdiv i32 %2, 1000
%4 = tail call i32 @time(i32* null)
%5 = tail call i64 @difftime(i32 %4, i32 %3)
%6 = trunc i64 %5 to i32
%7 = tail call i32 @llvm.abs.i32(i32 %6, i1 true)
%8 = tail call i32 @test_time_t_le(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 487, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 600)
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @CT_POLICY_EVAL_CTX_free(i32* %1)
ret i32 %10
}