#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_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_get_mem_ptr(int /*<<< orphan*/ *, 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_write(int /*<<< orphan*/ *, char *, int);
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_int_lt(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_new_mem_buf(void) {
  int ok = 0;
  BIO *bio;
  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",
                79, "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",
                   81, "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",
                   83, "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",
                   85, "BIO_get_mem_ptr(bio, &bufmem)", "0",
                   BIO_get_mem_ptr(bio, &bufmem), 0))
    goto finish;
  if (!test_int_lt("/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",
                   87, "BIO_write(bio, \"test\", 4)", "0",
                   BIO_write(bio, "test", 4), 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",
                   89, "BIO_read(bio, data, 16)", "7", BIO_read(bio, 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",
                   91, "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",
                   93, "BIO_reset(bio)", "0", BIO_reset(bio), 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",
                   95, "BIO_read(bio, data, 16)", "12", BIO_read(bio, data, 16),
                   12))
    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",
                   97, "data", "\"Hello World\\n\"", data, 12, "Hello World\n",
                   12))
    goto finish;
  ok = 1;
finish:
  BIO_free(bio);
  return ok;
}


x86 assembly (clang, -O0):
<test_bio_new_mem_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe3a(%rip),%rdi
mov    $0xc,%esi
call   1070 <BIO_new_mem_buf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xe2e(%rip),%rdi
mov    $0x4f,%esi
lea    0xec9(%rip),%rdx
call   1050 <test_ptr@plt>
cmp    $0x0,%eax
jne    11fe <test_bio_new_mem_buf+0x4e>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x5,%edx
call   1040 <BIO_read@plt>
mov    %eax,%r8d
lea    0xdf3(%rip),%rdi
mov    $0x51,%esi
lea    0xe92(%rip),%rdx
lea    0xea2(%rip),%rcx
mov    $0x5,%r9d
call   1060 <test_int_eq@plt>
cmp    $0x0,%eax
jne    1246 <test_bio_new_mem_buf+0x96>
jmp    147f <test_bio_new_mem_buf+0x2cf>
lea    -0x30(%rbp),%r8
lea    0xdbc(%rip),%rdi
mov    $0x53,%esi
lea    0xe74(%rip),%rdx
lea    0xe72(%rip),%rcx
mov    $0x5,%r9d
lea    0xe6d(%rip),%rax
mov    %rax,(%rsp)
movl   $0x5,0x8(%rsp)
call   1090 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    1290 <test_bio_new_mem_buf+0xe0>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <BIO_get_mem_ptr@plt>
mov    %eax,%r8d
lea    0xd66(%rip),%rdi
mov    $0x55,%esi
lea    0xe31(%rip),%rdx
lea    0xe48(%rip),%rcx
xor    %r9d,%r9d
call   1030 <test_int_gt@plt>
cmp    $0x0,%eax
jne    12d0 <test_bio_new_mem_buf+0x120>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
lea    0xe43(%rip),%rsi
mov    $0x4,%edx
call   10c0 <BIO_write@plt>
mov    %eax,%r8d
lea    0xd1e(%rip),%rdi
mov    $0x57,%esi
lea    0xe09(%rip),%rdx
lea    0xe00(%rip),%rcx
xor    %r9d,%r9d
call   10d0 <test_int_lt@plt>
cmp    $0x0,%eax
jne    1318 <test_bio_new_mem_buf+0x168>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1040 <BIO_read@plt>
mov    %eax,%r8d
lea    0xcd9(%rip),%rdi
mov    $0x59,%esi
lea    0xde3(%rip),%rdx
lea    0xdf4(%rip),%rcx
mov    $0x7,%r9d
call   1060 <test_int_eq@plt>
cmp    $0x0,%eax
jne    1360 <test_bio_new_mem_buf+0x1b0>
jmp    147f <test_bio_new_mem_buf+0x2cf>
lea    -0x30(%rbp),%r8
lea    0xca2(%rip),%rdi
mov    $0x5b,%esi
lea    0xd5a(%rip),%rdx
lea    0xdbf(%rip),%rcx
mov    $0x7,%r9d
lea    0xc7a(%rip),%rax
mov    %rax,(%rsp)
movl   $0x7,0x8(%rsp)
call   1090 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    13aa <test_bio_new_mem_buf+0x1fa>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
call   10a0 <BIO_reset@plt>
mov    %eax,%r8d
lea    0xc50(%rip),%rdi
mov    $0x5d,%esi
lea    0xd7f(%rip),%rdx
lea    0xd32(%rip),%rcx
xor    %r9d,%r9d
call   1030 <test_int_gt@plt>
cmp    $0x0,%eax
jne    13e6 <test_bio_new_mem_buf+0x236>
jmp    147f <test_bio_new_mem_buf+0x2cf>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1040 <BIO_read@plt>
mov    %eax,%r8d
lea    0xc0b(%rip),%rdi
mov    $0x5f,%esi
lea    0xd15(%rip),%rdx
lea    0xd42(%rip),%rcx
mov    $0xc,%r9d
call   1060 <test_int_eq@plt>
cmp    $0x0,%eax
jne    142e <test_bio_new_mem_buf+0x27e>
jmp    147f <test_bio_new_mem_buf+0x2cf>
lea    -0x30(%rbp),%r8
lea    0xbd4(%rip),%rdi
mov    $0x61,%esi
lea    0xc8c(%rip),%rdx
lea    0xd0e(%rip),%rcx
mov    $0xc,%r9d
lea    0xba7(%rip),%rax
mov    %rax,(%rsp)
movl   $0xc,0x8(%rsp)
call   1090 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    1478 <test_bio_new_mem_buf+0x2c8>
jmp    147f <test_bio_new_mem_buf+0x2cf>
movl   $0x1,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <BIO_free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bio_new_mem_buf>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xe41(%rip),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   1070 <BIO_new_mem_buf@plt>
mov    %rax,%rbx
lea    0xe37(%rip),%rdi
lea    0xed7(%rip),%rdx
mov    $0x4f,%esi
mov    %rax,%rcx
call   1050 <test_ptr@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1040 <BIO_read@plt>
lea    0xe02(%rip),%rdi
lea    0xea6(%rip),%rdx
lea    0xeb6(%rip),%rcx
mov    $0x51,%esi
mov    %eax,%r8d
mov    $0x5,%r9d
call   1060 <test_int_eq@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
lea    0xea3(%rip),%rax
lea    0xdcb(%rip),%rdi
lea    0xe88(%rip),%rdx
lea    0xe86(%rip),%rcx
mov    %rsp,%r8
mov    $0x53,%esi
mov    $0x5,%r9d
push   $0x5
push   %rax
call   1090 <test_mem_eq@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   10b0 <BIO_get_mem_ptr@plt>
lea    0xd87(%rip),%rdi
lea    0xe57(%rip),%rdx
lea    0xe6e(%rip),%rcx
xor    %ebp,%ebp
mov    $0x55,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <test_int_gt@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   10c0 <BIO_write@plt>
lea    0xd44(%rip),%rdi
lea    0xe34(%rip),%rdx
lea    0xe2b(%rip),%rcx
xor    %ebp,%ebp
mov    $0x57,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   10d0 <test_int_lt@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1040 <BIO_read@plt>
lea    0xd05(%rip),%rdi
lea    0xe14(%rip),%rdx
lea    0xe25(%rip),%rcx
mov    $0x59,%esi
mov    %eax,%r8d
mov    $0x7,%r9d
call   1060 <test_int_eq@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
lea    0xccd(%rip),%rax
lea    0xcce(%rip),%rdi
lea    0xd8b(%rip),%rdx
lea    0xdf0(%rip),%rcx
mov    %rsp,%r8
mov    $0x5b,%esi
mov    $0x7,%r9d
push   $0x7
push   %rax
call   1090 <test_mem_eq@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
mov    %rbx,%rdi
call   10a0 <BIO_reset@plt>
lea    0xc8f(%rip),%rdi
lea    0xdc3(%rip),%rdx
lea    0xd76(%rip),%rcx
xor    %ebp,%ebp
mov    $0x5d,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <test_int_gt@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1040 <BIO_read@plt>
lea    0xc54(%rip),%rdi
lea    0xd63(%rip),%rdx
lea    0xd90(%rip),%rcx
mov    $0x5f,%esi
mov    %eax,%r8d
mov    $0xc,%r9d
call   1060 <test_int_eq@plt>
test   %eax,%eax
je     1416 <test_bio_new_mem_buf+0x266>
lea    0xc28(%rip),%rdi
lea    0xce5(%rip),%rdx
lea    0xd67(%rip),%rcx
mov    %rsp,%r8
mov    $0x61,%esi
mov    $0xc,%r9d
push   $0xc
push   %r14
call   1090 <test_mem_eq@plt>
add    $0x10,%rsp
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %rbx,%rdi
call   1080 <BIO_free@plt>
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
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"
@.str.10 = [26 x i8] c"BIO_write(bio, \22test\22, 4)\00"
@.str.11 = [5 x i8] c"test\00"
@.str.12 = [24 x i8] c"BIO_read(bio, data, 16)\00"
@.str.13 = [2 x i8] c"7\00"
@.str.14 = [11 x i8] c"\22 World\\n\22\00"
@.str.15 = [8 x i8] c" World\0A\00"
@.str.16 = [15 x i8] c"BIO_reset(bio)\00"
@.str.17 = [3 x i8] c"12\00"
@.str.18 = [16 x i8] c"\22Hello World\\n\22\00"
define i32 @test_bio_new_mem_buf() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [16 x i8]
store i32 0, i32* %1
%5 = call i32* @BIO_new_mem_buf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 @test_ptr(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %0
br label %65
10: ; preds = %0
%11 = load i32*, i32** %2
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%13 = call i32 @BIO_read(i32* %11, i8* %12, i32 5)
%14 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 81, 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 %13, i32 5)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %10
br label %65
17: ; preds = %10
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%19 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 83, 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* %18, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17
br label %65
22: ; preds = %17
%23 = load i32*, i32** %2
%24 = call i32 @BIO_get_mem_ptr(i32* %23, i32** %3)
%25 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 85, 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 %24, i32 0)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %22
br label %65
28: ; preds = %22
%29 = load i32*, i32** %2
%30 = call i32 @BIO_write(i32* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%31 = call i32 @test_int_lt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 87, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %30, i32 0)
%32 = icmp ne i32 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %28
br label %65
34: ; preds = %28
%35 = load i32*, i32** %2
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%37 = call i32 @BIO_read(i32* %35, i8* %36, i32 16)
%38 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 89, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 %37, i32 7)
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %34
br label %65
41: ; preds = %34
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%43 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 91, 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.14, i64 0, i64 0), i8* %42, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i32 7)
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %41
br label %65
46: ; preds = %41
%47 = load i32*, i32** %2
%48 = call i32 @BIO_reset(i32* %47)
%49 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %48, i32 0)
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %46
br label %65
52: ; preds = %46
%53 = load i32*, i32** %2
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%55 = call i32 @BIO_read(i32* %53, i8* %54, i32 16)
%56 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 %55, i32 12)
%57 = icmp ne i32 %56, 0
br i1 %57, label %59, label %58
58: ; preds = %52
br label %65
59: ; preds = %52
%60 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%61 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* %60, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%62 = icmp ne i32 %61, 0
br i1 %62, label %64, label %63
63: ; preds = %59
br label %65
64: ; preds = %59
store i32 1, i32* %1
br label %65
65: ; preds = %64, %63, %58, %51, %45, %40, %33, %27, %21, %16, %9
%66 = load i32*, i32** %2
%67 = call i32 @BIO_free(i32* %66)
%68 = load i32, i32* %1
ret i32 %68
}

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"
@.str.10 = [26 x i8] c"BIO_write(bio, \22test\22, 4)\00"
@.str.11 = [5 x i8] c"test\00"
@.str.12 = [24 x i8] c"BIO_read(bio, data, 16)\00"
@.str.13 = [2 x i8] c"7\00"
@.str.14 = [11 x i8] c"\22 World\\n\22\00"
@.str.15 = [8 x i8] c" World\0A\00"
@.str.16 = [15 x i8] c"BIO_reset(bio)\00"
@.str.17 = [3 x i8] c"12\00"
@.str.18 = [16 x i8] c"\22Hello World\\n\22\00"
define i32 @test_bio_new_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 79, 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 %42, 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 81, 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 %42, 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 83, 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 %42, 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 85, 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 %42, label %19
19: ; preds = %15
%20 = call i32 @BIO_write(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%21 = call i32 @test_int_lt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 87, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %20, i32 0)
%22 = icmp eq i32 %21, 0
br i1 %22, label %42, label %23
23: ; preds = %19
%24 = call i32 @BIO_read(i32* %5, i8* %4, i32 16)
%25 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 89, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 %24, i32 7)
%26 = icmp eq i32 %25, 0
br i1 %26, label %42, label %27
27: ; preds = %23
%28 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 91, 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.14, i64 0, i64 0), i8* %4, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i32 7)
%29 = icmp eq i32 %28, 0
br i1 %29, label %42, label %30
30: ; preds = %27
%31 = call i32 @BIO_reset(i32* %5)
%32 = call i32 @test_int_gt(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %31, i32 0)
%33 = icmp eq i32 %32, 0
br i1 %33, label %42, label %34
34: ; preds = %30
%35 = call i32 @BIO_read(i32* %5, i8* %4, i32 16)
%36 = call i32 @test_int_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 %35, i32 12)
%37 = icmp eq i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = call i32 @test_mem_eq(i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* %4, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i32
br label %42
42: ; preds = %38, %34, %30, %27, %23, %19, %15, %12, %8, %0
%43 = phi i32 [ 0, %34 ], [ 0, %30 ], [ 0, %27 ], [ 0, %23 ], [ 0, %19 ], [ 0, %15 ], [ 0, %12 ], [ 0, %8 ], [ 0, %0 ], [ %41, %38 ]
%44 = call i32 @BIO_free(i32* %5)
ret i32 %43
}