#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*/ b;
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_CTX_end(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_CTX_get(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_CTX_start(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_FLG_CONSTTIME;
scalar_t__ BN_get_flags(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ test_false(char *, int, char *, int);
int /*<<< orphan*/ test_ptr(char *, int, char *, int /*<<< orphan*/ *);
int test_ctx_check_ct_flag(BN_CTX *c) {
  int st = 0;
  size_t i;
  BIGNUM *b[30];
  BN_CTX_start(c);
  for (i = 0; i < (sizeof(b) / sizeof((b)[0])); i++) {
    if (!test_ptr(
            "/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/bntest.c",
            2296, "b[i] = BN_CTX_get(c)", b[i] = BN_CTX_get(c)))
      goto err;
    if (!test_false(
            "/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/bntest.c",
            2298, "BN_get_flags(b[i], BN_FLG_CONSTTIME)",
            (BN_get_flags(b[i], BN_FLG_CONSTTIME)) != 0))
      goto err;
  }
  st = 1;
err:
  BN_CTX_end(c);
  return st;
}


x86 assembly (clang, -O0):
<test_ctx_check_ct_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <BN_CTX_start@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x1e,-0x18(%rbp)
jae    1232 <test_ctx_check_ct_flag+0xd2>
mov    -0x8(%rbp),%rdi
call   1040 <BN_CTX_get@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0x110(%rbp,%rax,8)
ff
lea    0xe4f(%rip),%rdi
mov    $0x8f8,%esi
lea    0xeed(%rip),%rdx
call   1050 <test_ptr@plt>
cmp    $0x0,%eax
jne    11d0 <test_ctx_check_ct_flag+0x70>
jmp    1239 <test_ctx_check_ct_flag+0xd9>
mov    -0x18(%rbp),%rax
mov    -0x110(%rbp,%rax,8),%rdi
ff
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
call   1080 <BN_get_flags@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe03(%rip),%rdi
mov    $0x8fa,%esi
lea    0xeb6(%rip),%rdx
call   1030 <test_false@plt>
cmp    $0x0,%eax
jne    121c <test_ctx_check_ct_flag+0xbc>
jmp    1239 <test_ctx_check_ct_flag+0xd9>
jmp    1221 <test_ctx_check_ct_flag+0xc1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1187 <test_ctx_check_ct_flag+0x27>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <BN_CTX_end@plt>
mov    -0xc(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ctx_check_ct_flag>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
call   1070 <BN_CTX_start@plt>
mov    $0x1e,%r15d
lea    0xe80(%rip),%r14
lea    0xf38(%rip),%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r13,%rdi
call   1040 <BN_CTX_get@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x8f8,%esi
lea    0xf00(%rip),%rdx
mov    %rax,%rcx
call   1050 <test_ptr@plt>
test   %eax,%eax
je     11ee <test_ctx_check_ct_flag+0x8e>
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <BN_get_flags@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %r14,%rdi
mov    $0x8fa,%esi
mov    %r12,%rdx
call   1030 <test_false@plt>
test   %eax,%eax
je     11ee <test_ctx_check_ct_flag+0x8e>
add    $0xffffffffffffffff,%r15
jne    1190 <test_ctx_check_ct_flag+0x30>
mov    $0x1,%ebp
mov    %r13,%rdi
call   1060 <BN_CTX_end@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [170 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/bntest.c\00"
@.str.1 = [21 x i8] c"b[i] = BN_CTX_get(c)\00"
@.str.2 = [37 x i8] c"BN_get_flags(b[i], BN_FLG_CONSTTIME)\00"
@BN_FLG_CONSTTIME = global i32 0
define i32 @test_ctx_check_ct_flag(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i64
%5 = alloca [30 x i32*]
store i32* %0, i32** %2
store i32 0, i32* %3
%6 = load i32*, i32** %2
%7 = call i32 @BN_CTX_start(i32* %6)
store i64 0, i64* %4
br label %8
8: ; preds = %31, %1
%9 = load i64, i64* %4
%10 = icmp ult i64 %9, 30
br i1 %10, label %11, label %34
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = call i32* @BN_CTX_get(i32* %12)
%14 = load i64, i64* %4
%15 = getelementptr inbounds [30 x i32*], [30 x i32*]* %5, i64 0, i64 %14
store i32* %13, i32** %15
%16 = call i32 @test_ptr(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 2296, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %11
br label %35
19: ; preds = %11
%20 = load i64, i64* %4
%21 = getelementptr inbounds [30 x i32*], [30 x i32*]* %5, i64 0, i64 %20
%22 = load i32*, i32** %21
%23 = load i32, i32* @BN_FLG_CONSTTIME
%24 = call i64 @BN_get_flags(i32* %22, i32 %23)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @test_false(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 2298, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %19
br label %35
30: ; preds = %19
br label %31
31: ; preds = %30
%32 = load i64, i64* %4
%33 = add i64 %32, 1
store i64 %33, i64* %4
br label %8
34: ; preds = %8
store i32 1, i32* %3
br label %35
35: ; preds = %34, %29, %18
%36 = load i32*, i32** %2
%37 = call i32 @BN_CTX_end(i32* %36)
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [170 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/bntest.c\00"
@.str.1 = [21 x i8] c"b[i] = BN_CTX_get(c)\00"
@.str.2 = [37 x i8] c"BN_get_flags(b[i], BN_FLG_CONSTTIME)\00"
@BN_FLG_CONSTTIME = global i32 0
define i32 @test_ctx_check_ct_flag(i32* %0) {
%2 = tail call i32 @BN_CTX_start(i32* %0)
br label %6
3: ; preds = %11
%4 = add nuw nsw i64 %7, 1
%5 = icmp eq i64 %4, 30
br i1 %5, label %18, label %6
6: ; preds = %1, %3
%7 = phi i64 [ 0, %1 ], [ %4, %3 ]
%8 = tail call i32* @BN_CTX_get(i32* %0)
%9 = tail call i32 @test_ptr(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 2296, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %6
%12 = load i32, i32* @BN_FLG_CONSTTIME
%13 = tail call i64 @BN_get_flags(i32* %8, i32 %12)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @test_false(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 2298, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %3
18: ; preds = %3, %11, %6
%19 = phi i32 [ 0, %11 ], [ 0, %6 ], [ 1, %3 ]
%20 = tail call i32 @BN_CTX_end(i32* %0)
ret i32 %19
}