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

/* Variables and functions */
int /*<<< orphan*/ BIO_CLOSE;
int /*<<< orphan*/ BIO_FLAGS_MEM_RDONLY;
int /*<<< orphan*/ BIO_NOCLOSE;
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_get_mem_ptr(int /*<<< orphan*/ *, int /*<<< orphan*/ **);
int /*<<< orphan*/ *BIO_new(int /*<<< orphan*/);
int /*<<< orphan*/ *BIO_new_mem_buf(char *, int);
int /*<<< orphan*/ BIO_read(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ BIO_reset(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_s_mem();
int /*<<< orphan*/ BIO_set_close(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ BIO_set_flags(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ BIO_set_mem_buf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ test_int_eq(char *, int, char *, char *, int /*<<< orphan*/,
                               int);
int /*<<< orphan*/ test_int_gt(char *, int, char *, char *, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int /*<<< orphan*/ test_mem_eq(char *, int, char *, char *, char *, int, char *,
                               int);
int /*<<< orphan*/ test_ptr(char *, int, char *, int /*<<< orphan*/ *);
int test_bio_rdonly_mem_buf(void) {
  int ok = 0;
  BIO *bio, *bio2 = NULL;
  BUF_MEM *bufmem;
  char data[16];
  bio = BIO_new_mem_buf("Hello World\n", 12);
  if (!test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                "heads/master/vendor/openssl/test/bio_memleak_test.c",
                114, "bio", bio))
    goto finish;
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   116, "BIO_read(bio, data, 5)", "5", BIO_read(bio, data, 5),
                   5))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   118, "data", "\"Hello\"", data, 5, "Hello", 5))
    goto finish;
  if (!test_int_gt("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   120, "BIO_get_mem_ptr(bio, &bufmem)", "0",
                   BIO_get_mem_ptr(bio, &bufmem), 0))
    goto finish;
  (void)BIO_set_close(bio, BIO_NOCLOSE);
  bio2 = BIO_new(BIO_s_mem());
  if (!test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                "heads/master/vendor/openssl/test/bio_memleak_test.c",
                125, "bio2", bio2))
    goto finish;
  BIO_set_mem_buf(bio2, bufmem, BIO_CLOSE);
  BIO_set_flags(bio2, BIO_FLAGS_MEM_RDONLY);
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   130, "BIO_read(bio2, data, 16)", "7",
                   BIO_read(bio2, data, 16), 7))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   132, "data", "\" World\\n\"", data, 7, " World\n", 7))
    goto finish;
  if (!test_int_gt("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   134, "BIO_reset(bio2)", "0", BIO_reset(bio2), 0))
    goto finish;
  if (!test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   136, "BIO_read(bio2, data, 16)", "7",
                   BIO_read(bio2, data, 16), 7))
    goto finish;
  if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/"
                   "heads/master/vendor/openssl/test/bio_memleak_test.c",
                   138, "data", "\" World\\n\"", data, 7, " World\n", 7))
    goto finish;
  ok = 1;
finish:
  BIO_free(bio);
  BIO_free(bio2);
  return ok;
}


x86 assembly (clang, -O0):
<test_bio_rdonly_mem_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe02(%rip),%rdi
mov    $0xc,%esi
call   1090 <BIO_new_mem_buf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xdf6(%rip),%rdi
mov    $0x72,%esi
lea    0xe91(%rip),%rdx
call   1060 <test_ptr@plt>
cmp    $0x0,%eax
jne    1236 <test_bio_rdonly_mem_buf+0x56>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x5,%edx
call   1050 <BIO_read@plt>
mov    %eax,%r8d
lea    0xdbb(%rip),%rdi
mov    $0x74,%esi
lea    0xe5a(%rip),%rdx
lea    0xe6a(%rip),%rcx
mov    $0x5,%r9d
call   1070 <test_int_eq@plt>
cmp    $0x0,%eax
jne    127e <test_bio_rdonly_mem_buf+0x9e>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
lea    -0x30(%rbp),%r8
lea    0xd84(%rip),%rdi
mov    $0x76,%esi
lea    0xe3c(%rip),%rdx
lea    0xe3a(%rip),%rcx
mov    $0x5,%r9d
lea    0xe35(%rip),%rax
mov    %rax,(%rsp)
movl   $0x5,0x8(%rsp)
call   10c0 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    12c8 <test_bio_rdonly_mem_buf+0xe8>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10e0 <BIO_get_mem_ptr@plt>
mov    %eax,%r8d
lea    0xd2e(%rip),%rdi
mov    $0x78,%esi
lea    0xdf9(%rip),%rdx
lea    0xe10(%rip),%rcx
xor    %r9d,%r9d
call   1040 <test_int_gt@plt>
cmp    $0x0,%eax
jne    1308 <test_bio_rdonly_mem_buf+0x128>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x10(%rbp),%rdi
mov    0x2cd5(%rip),%rax
mov    (%rax),%esi
call   1030 <BIO_set_close@plt>
mov    $0x0,%al
call   10f0 <BIO_s_mem@plt>
mov    %eax,%edi
call   10a0 <BIO_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
lea    0xcd6(%rip),%rdi
mov    $0x7d,%esi
lea    0xdc1(%rip),%rdx
call   1060 <test_ptr@plt>
cmp    $0x0,%eax
jne    1356 <test_bio_rdonly_mem_buf+0x176>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
call   1100 <BIO_set_mem_buf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
call   1080 <BIO_set_flags@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1050 <BIO_read@plt>
mov    %eax,%r8d
lea    0xc73(%rip),%rdi
mov    $0x82,%esi
lea    0xd63(%rip),%rdx
lea    0xd75(%rip),%rcx
mov    $0x7,%r9d
call   1070 <test_int_eq@plt>
cmp    $0x0,%eax
jne    13c6 <test_bio_rdonly_mem_buf+0x1e6>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
lea    -0x30(%rbp),%r8
lea    0xc3c(%rip),%rdi
mov    $0x84,%esi
lea    0xcf4(%rip),%rdx
lea    0xd40(%rip),%rcx
mov    $0x7,%r9d
lea    0xc14(%rip),%rax
mov    %rax,(%rsp)
movl   $0x7,0x8(%rsp)
call   10c0 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    1410 <test_bio_rdonly_mem_buf+0x230>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x18(%rbp),%rdi
call   10d0 <BIO_reset@plt>
mov    %eax,%r8d
lea    0xbea(%rip),%rdi
mov    $0x86,%esi
lea    0xd00(%rip),%rdx
lea    0xccc(%rip),%rcx
xor    %r9d,%r9d
call   1040 <test_int_gt@plt>
cmp    $0x0,%eax
jne    144c <test_bio_rdonly_mem_buf+0x26c>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1050 <BIO_read@plt>
mov    %eax,%r8d
lea    0xba5(%rip),%rdi
mov    $0x88,%esi
lea    0xc95(%rip),%rdx
lea    0xca7(%rip),%rcx
mov    $0x7,%r9d
call   1070 <test_int_eq@plt>
cmp    $0x0,%eax
jne    1494 <test_bio_rdonly_mem_buf+0x2b4>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
lea    -0x30(%rbp),%r8
lea    0xb6e(%rip),%rdi
mov    $0x8a,%esi
lea    0xc26(%rip),%rdx
lea    0xc72(%rip),%rcx
mov    $0x7,%r9d
lea    0xb46(%rip),%rax
mov    %rax,(%rsp)
movl   $0x7,0x8(%rsp)
call   10c0 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    14de <test_bio_rdonly_mem_buf+0x2fe>
jmp    14e5 <test_bio_rdonly_mem_buf+0x305>
movl   $0x1,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <BIO_free@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <BIO_free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bio_rdonly_mem_buf>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe0e(%rip),%rdi
mov    $0xc,%esi
call   1090 <BIO_new_mem_buf@plt>
mov    %rax,%rbx
lea    0xe07(%rip),%rdi
lea    0xea7(%rip),%rdx
mov    $0x72,%esi
mov    %rax,%rcx
call   1060 <test_ptr@plt>
test   %eax,%eax
je     1476 <test_bio_rdonly_mem_buf+0x296>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <BIO_read@plt>
lea    0xdd4(%rip),%rdi
lea    0xe78(%rip),%rdx
lea    0xe88(%rip),%rcx
mov    $0x74,%esi
mov    %eax,%r8d
mov    $0x5,%r9d
call   1070 <test_int_eq@plt>
test   %eax,%eax
je     1476 <test_bio_rdonly_mem_buf+0x296>
lea    0xe75(%rip),%rax
lea    0xd9d(%rip),%rdi
lea    0xe5a(%rip),%rdx
lea    0xe58(%rip),%rcx
mov    %rsp,%r8
mov    $0x76,%esi
mov    $0x5,%r9d
push   $0x5
push   %rax
call   10c0 <test_mem_eq@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1476 <test_bio_rdonly_mem_buf+0x296>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10e0 <BIO_get_mem_ptr@plt>
lea    0xd59(%rip),%rdi
lea    0xe29(%rip),%rdx
lea    0xe40(%rip),%rcx
xor    %r14d,%r14d
mov    $0x78,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   1040 <test_int_gt@plt>
test   %eax,%eax
je     1479 <test_bio_rdonly_mem_buf+0x299>
mov    0x2d04(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <BIO_set_close@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   10f0 <BIO_s_mem@plt>
mov    %eax,%edi
call   10a0 <BIO_new@plt>
mov    %rax,%r15
lea    0xd04(%rip),%rdi
lea    0xdf4(%rip),%rdx
mov    $0x7d,%esi
mov    %rax,%rcx
call   1060 <test_ptr@plt>
test   %eax,%eax
je     147c <test_bio_rdonly_mem_buf+0x29c>
mov    0x10(%rsp),%rsi
mov    0x2c9f(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
call   1100 <BIO_set_mem_buf@plt>
mov    0x2c96(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1080 <BIO_set_flags@plt>
mov    %rsp,%rsi
mov    %r15,%rdi
mov    $0x10,%edx
call   1050 <BIO_read@plt>
lea    0xcaa(%rip),%rdi
lea    0xd9f(%rip),%rdx
lea    0xdb1(%rip),%rcx
mov    $0x82,%esi
mov    %eax,%r8d
mov    $0x7,%r9d
call   1070 <test_int_eq@plt>
test   %eax,%eax
je     147c <test_bio_rdonly_mem_buf+0x29c>
lea    0xc72(%rip),%r12
lea    0xc73(%rip),%rdi
lea    0xd30(%rip),%rdx
lea    0xd7c(%rip),%rcx
mov    %rsp,%r8
mov    $0x84,%esi
mov    $0x7,%r9d
push   $0x7
push   %r12
call   10c0 <test_mem_eq@plt>
add    $0x10,%rsp
test   %eax,%eax
je     147c <test_bio_rdonly_mem_buf+0x29c>
mov    %r15,%rdi
call   10d0 <BIO_reset@plt>
lea    0xc33(%rip),%rdi
lea    0xd4e(%rip),%rdx
lea    0xd1a(%rip),%rcx
xor    %r14d,%r14d
mov    $0x86,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   1040 <test_int_gt@plt>
test   %eax,%eax
je     147c <test_bio_rdonly_mem_buf+0x29c>
mov    %rsp,%rsi
mov    %r15,%rdi
mov    $0x10,%edx
call   1050 <BIO_read@plt>
lea    0xbf7(%rip),%rdi
lea    0xcec(%rip),%rdx
lea    0xcfe(%rip),%rcx
mov    $0x88,%esi
mov    %eax,%r8d
mov    $0x7,%r9d
call   1070 <test_int_eq@plt>
test   %eax,%eax
je     147c <test_bio_rdonly_mem_buf+0x29c>
lea    0xbcb(%rip),%rdi
lea    0xc88(%rip),%rdx
lea    0xcd4(%rip),%rcx
mov    %rsp,%r8
mov    $0x8a,%esi
mov    $0x7,%r9d
push   $0x7
push   %r12
call   10c0 <test_mem_eq@plt>
add    $0x10,%rsp
xor    %r14d,%r14d
test   %eax,%eax
setne  %r14b
jmp    147c <test_bio_rdonly_mem_buf+0x29c>
xor    %r14d,%r14d
xor    %r15d,%r15d
mov    %rbx,%rdi
call   10b0 <BIO_free@plt>
mov    %r15,%rdi
call   10b0 <BIO_free@plt>
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c\00"
@.str.2 = [4 x i8] c"bio\00"
@.str.3 = [23 x i8] c"BIO_read(bio, data, 5)\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [5 x i8] c"data\00"
@.str.6 = [8 x i8] c"\22Hello\22\00"
@.str.7 = [6 x i8] c"Hello\00"
@.str.8 = [30 x i8] c"BIO_get_mem_ptr(bio, &bufmem)\00"
@.str.9 = [2 x i8] c"0\00"
@BIO_NOCLOSE = global i32 0
@.str.10 = [5 x i8] c"bio2\00"
@BIO_CLOSE = global i32 0
@BIO_FLAGS_MEM_RDONLY = global i32 0
@.str.11 = [25 x i8] c"BIO_read(bio2, data, 16)\00"
@.str.12 = [2 x i8] c"7\00"
@.str.13 = [11 x i8] c"\22 World\\n\22\00"
@.str.14 = [8 x i8] c" World\0A\00"
@.str.15 = [16 x i8] c"BIO_reset(bio2)\00"
define i32 @test_bio_rdonly_mem_buf() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [16 x i8]
store i32 0, i32* %1
store i32* null, i32** %3
%6 = call i32* @BIO_new_mem_buf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 @test_ptr(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %0
br label %77
11: ; preds = %0
%12 = load i32*, i32** %2
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%14 = call i32 @BIO_read(i32* %12, i8* %13, i32 5)
%15 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 116, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 5)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %11
br label %77
18: ; preds = %11
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%20 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 118, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %19, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %18
br label %77
23: ; preds = %18
%24 = load i32*, i32** %2
%25 = call i32 @BIO_get_mem_ptr(i32* %24, i32** %4)
%26 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 120, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %25, i32 0)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %23
br label %77
29: ; preds = %23
%30 = load i32*, i32** %2
%31 = load i32, i32* @BIO_NOCLOSE
%32 = call i32 @BIO_set_close(i32* %30, i32 %31)
%33 = call i32 (...) @BIO_s_mem()
%34 = call i32* @BIO_new(i32 %33)
store i32* %34, i32** %3
%35 = load i32*, i32** %3
%36 = call i32 @test_ptr(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32* %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %39, label %38
38: ; preds = %29
br label %77
39: ; preds = %29
%40 = load i32*, i32** %3
%41 = load i32*, i32** %4
%42 = load i32, i32* @BIO_CLOSE
%43 = call i32 @BIO_set_mem_buf(i32* %40, i32* %41, i32 %42)
%44 = load i32*, i32** %3
%45 = load i32, i32* @BIO_FLAGS_MEM_RDONLY
%46 = call i32 @BIO_set_flags(i32* %44, i32 %45)
%47 = load i32*, i32** %3
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%49 = call i32 @BIO_read(i32* %47, i8* %48, i32 16)
%50 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 %49, i32 7)
%51 = icmp ne i32 %50, 0
br i1 %51, label %53, label %52
52: ; preds = %39
br label %77
53: ; preds = %39
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%55 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %54, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%56 = icmp ne i32 %55, 0
br i1 %56, label %58, label %57
57: ; preds = %53
br label %77
58: ; preds = %53
%59 = load i32*, i32** %3
%60 = call i32 @BIO_reset(i32* %59)
%61 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 134, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %60, i32 0)
%62 = icmp ne i32 %61, 0
br i1 %62, label %64, label %63
63: ; preds = %58
br label %77
64: ; preds = %58
%65 = load i32*, i32** %3
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%67 = call i32 @BIO_read(i32* %65, i8* %66, i32 16)
%68 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 136, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 %67, i32 7)
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %64
br label %77
71: ; preds = %64
%72 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%73 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 138, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %72, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%74 = icmp ne i32 %73, 0
br i1 %74, label %76, label %75
75: ; preds = %71
br label %77
76: ; preds = %71
store i32 1, i32* %1
br label %77
77: ; preds = %76, %75, %70, %63, %57, %52, %38, %28, %22, %17, %10
%78 = load i32*, i32** %2
%79 = call i32 @BIO_free(i32* %78)
%80 = load i32*, i32** %3
%81 = call i32 @BIO_free(i32* %80)
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World\0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmq20/ruby-compiler/refs/heads/master/vendor/openssl/test/bio_memleak_test.c\00"
@.str.2 = [4 x i8] c"bio\00"
@.str.3 = [23 x i8] c"BIO_read(bio, data, 5)\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [5 x i8] c"data\00"
@.str.6 = [8 x i8] c"\22Hello\22\00"
@.str.7 = [6 x i8] c"Hello\00"
@.str.8 = [30 x i8] c"BIO_get_mem_ptr(bio, &bufmem)\00"
@.str.9 = [2 x i8] c"0\00"
@BIO_NOCLOSE = global i32 0
@.str.10 = [5 x i8] c"bio2\00"
@BIO_CLOSE = global i32 0
@BIO_FLAGS_MEM_RDONLY = global i32 0
@.str.11 = [25 x i8] c"BIO_read(bio2, data, 16)\00"
@.str.12 = [2 x i8] c"7\00"
@.str.13 = [11 x i8] c"\22 World\\n\22\00"
@.str.14 = [8 x i8] c" World\0A\00"
@.str.15 = [16 x i8] c"BIO_reset(bio2)\00"
define i32 @test_bio_rdonly_mem_buf() {
%1 = alloca i32*
%2 = alloca [16 x i8]
%3 = bitcast i32** %1 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @BIO_new_mem_buf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%6 = tail call i32 @test_ptr(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %50, label %8
8: ; preds = %0
%9 = call i32 @BIO_read(i32* %5, i8* %4, i32 5)
%10 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 116, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %9, i32 5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %50, label %12
12: ; preds = %8
%13 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 118, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %4, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%14 = icmp eq i32 %13, 0
br i1 %14, label %50, label %15
15: ; preds = %12
%16 = call i32 @BIO_get_mem_ptr(i32* %5, i32** %1)
%17 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 120, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %16, i32 0)
%18 = icmp eq i32 %17, 0
br i1 %18, label %50, label %19
19: ; preds = %15
%20 = load i32, i32* @BIO_NOCLOSE
%21 = call i32 @BIO_set_close(i32* %5, i32 %20)
%22 = call i32 (...) @BIO_s_mem()
%23 = call i32* @BIO_new(i32 %22)
%24 = call i32 @test_ptr(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32* %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %50, label %26
26: ; preds = %19
%27 = load i32*, i32** %1
%28 = load i32, i32* @BIO_CLOSE
%29 = call i32 @BIO_set_mem_buf(i32* %23, i32* %27, i32 %28)
%30 = load i32, i32* @BIO_FLAGS_MEM_RDONLY
%31 = call i32 @BIO_set_flags(i32* %23, i32 %30)
%32 = call i32 @BIO_read(i32* %23, i8* %4, i32 16)
%33 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 %32, i32 7)
%34 = icmp eq i32 %33, 0
br i1 %34, label %50, label %35
35: ; preds = %26
%36 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %4, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%37 = icmp eq i32 %36, 0
br i1 %37, label %50, label %38
38: ; preds = %35
%39 = call i32 @BIO_reset(i32* %23)
%40 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 134, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %39, i32 0)
%41 = icmp eq i32 %40, 0
br i1 %41, label %50, label %42
42: ; preds = %38
%43 = call i32 @BIO_read(i32* %23, i8* %4, i32 16)
%44 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 136, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 %43, i32 7)
%45 = icmp eq i32 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %42
%47 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 138, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %4, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i32
br label %50
50: ; preds = %46, %42, %38, %35, %26, %19, %15, %12, %8, %0
%51 = phi i32 [ 0, %42 ], [ 0, %38 ], [ 0, %35 ], [ 0, %26 ], [ 0, %19 ], [ 0, %15 ], [ 0, %12 ], [ 0, %8 ], [ 0, %0 ], [ %49, %46 ]
%52 = phi i32* [ %23, %42 ], [ %23, %38 ], [ %23, %35 ], [ %23, %26 ], [ %23, %19 ], [ null, %15 ], [ null, %12 ], [ null, %8 ], [ null, %0 ], [ %23, %46 ]
%53 = call i32 @BIO_free(i32* %5)
%54 = call i32 @BIO_free(i32* %52)
ret i32 %51
}