#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*/ X509_EXTENSION;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_get_mem_data(int /*<<< orphan*/ *, char **);
int /*<<< orphan*/ *BIO_new(int /*<<< orphan*/);
int /*<<< orphan*/ BIO_s_mem();
scalar_t__ BIO_write(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ X509V3_EXT_DEFAULT;
scalar_t__ X509V3_EXT_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ test_ptr(char *, int, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ test_str_eq(char *, int, char *, char *, char *,
                               char const *);
int /*<<< orphan*/ test_true(char *, int, char *, int);
int compare_extension_printout(X509_EXTENSION *extension,
                               const char *expected_output) {
  BIO *text_buffer = NULL;
  char *actual_output = NULL;
  int result = 0;
  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/ct_test.c",
                157, "text_buffer = BIO_new(BIO_s_mem())",
                text_buffer = BIO_new(BIO_s_mem())) ||
      !test_true(
          "/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",
          158,
          "X509V3_EXT_print(text_buffer, extension, X509V3_EXT_DEFAULT, 0)",
          (X509V3_EXT_print(text_buffer, extension, X509V3_EXT_DEFAULT, 0)) !=
              0))
    goto end;
  if (!test_true(
          "/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",
          163, "BIO_write(text_buffer, \"\\0\", 1)",
          (BIO_write(text_buffer, "\0", 1)) != 0))
    goto end;
  BIO_get_mem_data(text_buffer, &actual_output);
  if (!test_str_eq(
          "/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",
          167, "actual_output", "expected_output", actual_output,
          expected_output))
    goto end;
  result = 1;
end:
  BIO_free(text_buffer);
  return result;
}


x86 assembly (clang, -O0):
<compare_extension_printout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0x0,%al
call   10a0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1070 <BIO_new@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xe2d(%rip),%rdi
mov    $0x9d,%esi
lea    0xecc(%rip),%rdx
call   1040 <test_ptr@plt>
cmp    $0x0,%eax
je     1232 <compare_extension_printout+0xa2>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    0x2de4(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1050 <X509V3_EXT_print@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xde8(%rip),%rdi
mov    $0x9e,%esi
lea    0xeaa(%rip),%rdx
call   1030 <test_true@plt>
cmp    $0x0,%eax
jne    1237 <compare_extension_printout+0xa7>
jmp    12c7 <compare_extension_printout+0x137>
mov    -0x18(%rbp),%rdi
lea    0xf0a(%rip),%rsi
mov    $0x1,%edx
call   1090 <BIO_write@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xda1(%rip),%rdi
mov    $0xa3,%esi
lea    0xea3(%rip),%rdx
call   1030 <test_true@plt>
cmp    $0x0,%eax
jne    127e <compare_extension_printout+0xee>
jmp    12c7 <compare_extension_printout+0x137>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10b0 <BIO_get_mem_data@plt>
mov    -0x20(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xd66(%rip),%rdi
mov    $0xa7,%esi
lea    0xe88(%rip),%rdx
lea    0xe8f(%rip),%rcx
call   1060 <test_str_eq@plt>
cmp    $0x0,%eax
jne    12c0 <compare_extension_printout+0x130>
jmp    12c7 <compare_extension_printout+0x137>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <BIO_free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_extension_printout>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
movq   $0x0,(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   10a0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1070 <BIO_new@plt>
mov    %rax,%rbx
lea    0xe41(%rip),%rdi
lea    0xee5(%rip),%rdx
mov    $0x9d,%esi
mov    %rax,%rcx
call   1040 <test_ptr@plt>
test   %eax,%eax
je     1288 <compare_extension_printout+0xf8>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edx
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1050 <X509V3_EXT_print@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xdfe(%rip),%rdi
lea    0xec5(%rip),%rdx
mov    $0x9e,%esi
call   1030 <test_true@plt>
test   %eax,%eax
je     1288 <compare_extension_printout+0xf8>
lea    0xf2e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1090 <BIO_write@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xdc6(%rip),%rdi
lea    0xecd(%rip),%rdx
mov    $0xa3,%esi
call   1030 <test_true@plt>
test   %eax,%eax
je     1288 <compare_extension_printout+0xf8>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   10b0 <BIO_get_mem_data@plt>
mov    (%rsp),%r8
lea    0xd9b(%rip),%rdi
lea    0xec2(%rip),%rdx
lea    0xec9(%rip),%rcx
mov    $0xa7,%esi
mov    %r14,%r9
call   1060 <test_str_eq@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %rbx,%rdi
call   1080 <BIO_free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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 = [35 x i8] c"text_buffer = BIO_new(BIO_s_mem())\00"
@.str.2 = [64 x i8] c"X509V3_EXT_print(text_buffer, extension, X509V3_EXT_DEFAULT, 0)\00"
@X509V3_EXT_DEFAULT = global i32 0
@.str.3 = [32 x i8] c"BIO_write(text_buffer, \22\\0\22, 1)\00"
@.str.4 = [2 x i8] zeroinitializer
@.str.5 = [14 x i8] c"actual_output\00"
@.str.6 = [16 x i8] c"expected_output\00"
define i32 @compare_extension_printout(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32* null, i32** %5
store i8* null, i8** %6
store i32 0, i32* %7
%8 = call i32 (...) @BIO_s_mem()
%9 = call i32* @BIO_new(i32 %8)
store i32* %9, i32** %5
%10 = call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 157, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %2
%13 = load i32*, i32** %5
%14 = load i32*, i32** %3
%15 = load i32, i32* @X509V3_EXT_DEFAULT
%16 = call i64 @X509V3_EXT_print(i32* %13, i32* %14, i32 %15, i32 0)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 158, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %12, %2
br label %39
22: ; preds = %12
%23 = load i32*, i32** %5
%24 = call i64 @BIO_write(i32* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 163, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %22
br label %39
30: ; preds = %22
%31 = load i32*, i32** %5
%32 = call i32 @BIO_get_mem_data(i32* %31, i8** %6)
%33 = load i8*, i8** %6
%34 = load i8*, i8** %4
%35 = call i32 @test_str_eq(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 167, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %33, i8* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %30
br label %39
38: ; preds = %30
store i32 1, i32* %7
br label %39
39: ; preds = %38, %37, %29, %21
%40 = load i32*, i32** %5
%41 = call i32 @BIO_free(i32* %40)
%42 = load i32, i32* %7
ret i32 %42
}

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 = [35 x i8] c"text_buffer = BIO_new(BIO_s_mem())\00"
@.str.2 = [64 x i8] c"X509V3_EXT_print(text_buffer, extension, X509V3_EXT_DEFAULT, 0)\00"
@X509V3_EXT_DEFAULT = global i32 0
@.str.3 = [32 x i8] c"BIO_write(text_buffer, \22\\0\22, 1)\00"
@.str.4 = [2 x i8] zeroinitializer
@.str.5 = [14 x i8] c"actual_output\00"
@.str.6 = [16 x i8] c"expected_output\00"
define i32 @compare_extension_printout(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = tail call i32 (...) @BIO_s_mem()
%6 = tail call i32* @BIO_new(i32 %5)
%7 = tail call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 157, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %2
%10 = load i32, i32* @X509V3_EXT_DEFAULT
%11 = tail call i64 @X509V3_EXT_print(i32* %6, i32* %0, i32 %10, i32 0)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 158, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %28, label %16
16: ; preds = %9
%17 = tail call i64 @BIO_write(i32* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%18 = icmp ne i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 163, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = call i32 @BIO_get_mem_data(i32* %6, i8** %3)
%24 = load i8*, i8** %3
%25 = call i32 @test_str_eq(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 167, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %24, i8* %1)
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i32
br label %28
28: ; preds = %22, %16, %2, %9
%29 = phi i32 [ 0, %16 ], [ 0, %9 ], [ 0, %2 ], [ %27, %22 ]
%30 = call i32 @BIO_free(i32* %6)
ret i32 %29
}