#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 */

/* Variables and functions */
int /*<<< orphan*/ CRYPTO_MEM_CHECK_ON;
int /*<<< orphan*/ CRYPTO_mem_ctrl(int /*<<< orphan*/);
int CRYPTO_mem_leaks_fp(int /*<<< orphan*/);
int /*<<< orphan*/ CRYPTO_set_mem_debug(int);
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ OPENSSL_free(char *);
char *OPENSSL_malloc(int);
char *getenv(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
scalar_t__ test_int_eq(char *, int, char *, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ test_int_ne(char *, int, char *, char *, int, int);
int /*<<< orphan*/ test_ptr(char *, int, char *, char *);
int main(int argc, char *argv[]) {
  char *p;
  char *lost;
  int noleak;
  p = getenv("OPENSSL_DEBUG_MEMORY");
  if (p != NULL && strcmp(p, "on") == 0)
    CRYPTO_set_mem_debug(1);
  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
  lost = OPENSSL_malloc(3);
  if (!test_ptr(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/"
          "humble-video-captive/src/main/gnu/openssl/csrc/test/memleaktest.c",
          39, "lost", lost))
    return EXIT_FAILURE;
  if (argv[1] && strcmp(argv[1], "freeit") == 0) {
    OPENSSL_free(lost);
    lost = NULL;
  }
  noleak = CRYPTO_mem_leaks_fp(stderr);
  if (!test_int_ne(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/"
          "humble-video-captive/src/main/gnu/openssl/csrc/test/memleaktest.c",
          49, "noleak", "-1", noleak, -1))
    return EXIT_FAILURE;
  return test_int_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/"
                     "refs/heads/master/humble-video-captive/src/main/gnu/"
                     "openssl/csrc/test/memleaktest.c",
                     52, "lost != NULL", "noleak == 0", lost != NULL,
                     noleak == 0)
             ? EXIT_SUCCESS
             : EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11f5 <main+0x55>
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11f5 <main+0x55>
mov    $0x1,%edi
call   10c0 <CRYPTO_set_mem_debug@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   10b0 <CRYPTO_mem_ctrl@plt>
mov    $0x3,%edi
call   1090 <OPENSSL_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
lea    0xdfc(%rip),%rdi
mov    $0x27,%esi
lea    0xeb5(%rip),%rdx
call   1050 <test_ptr@plt>
cmp    $0x0,%eax
jne    1247 <main+0xa7>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1340 <main+0x1a0>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1285 <main+0xe5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1285 <main+0xe5>
mov    -0x20(%rbp),%rdi
call   10a0 <OPENSSL_free@plt>
movq   $0x0,-0x20(%rbp)
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
call   1040 <CRYPTO_mem_leaks_fp@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%r8d
lea    0xd77(%rip),%rdi
mov    $0x31,%esi
lea    0xe3c(%rip),%rdx
lea    0xe3c(%rip),%rcx
mov    $0xffffffff,%r9d
call   1080 <test_int_ne@plt>
cmp    $0x0,%eax
jne    12d9 <main+0x139>
mov    0x2d01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1340 <main+0x1a0>
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%r8d
cmpl   $0x0,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%r9d
lea    0xd1d(%rip),%rdi
mov    $0x34,%esi
lea    0xdec(%rip),%rdx
lea    0xdf2(%rip),%rcx
call   1060 <test_int_eq@plt>
cmp    $0x0,%rax
je     132e <main+0x18e>
mov    0x2ca4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    133a <main+0x19a>
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
lea    0xe52(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11d6 <main+0x36>
lea    0xe56(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    11d6 <main+0x36>
mov    $0x1,%edi
call   10c0 <CRYPTO_set_mem_debug@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   10b0 <CRYPTO_mem_ctrl@plt>
mov    $0x3,%edi
call   1090 <OPENSSL_malloc@plt>
mov    %rax,%rbx
lea    0xe20(%rip),%rdi
lea    0xede(%rip),%rdx
mov    $0x27,%esi
mov    %rax,%rcx
call   1050 <test_ptr@plt>
test   %eax,%eax
je     12ab <main+0x10b>
mov    0x8(%r14),%rdi
test   %rdi,%rdi
je     1238 <main+0x98>
lea    0xebe(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1238 <main+0x98>
mov    %rbx,%rdi
call   10a0 <OPENSSL_free@plt>
xor    %ebx,%ebx
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
call   1040 <CRYPTO_mem_leaks_fp@plt>
mov    %eax,%ebp
lea    0xdc9(%rip),%rdi
lea    0xe93(%rip),%rdx
lea    0xe93(%rip),%rcx
mov    $0x31,%esi
mov    %eax,%r8d
mov    $0xffffffff,%r9d
call   1080 <test_int_ne@plt>
test   %eax,%eax
je     12ab <main+0x10b>
xor    %r8d,%r8d
test   %rbx,%rbx
setne  %r8b
xor    %r9d,%r9d
test   %ebp,%ebp
sete   %r9b
lea    0xd8a(%rip),%rdi
lea    0xe5e(%rip),%rdx
lea    0xe64(%rip),%rcx
mov    $0x34,%esi
call   1060 <test_int_eq@plt>
test   %rax,%rax
jne    12b9 <main+0x119>
mov    0x2d1e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2d08(%rip),%rax
jmp    12b2 <main+0x112>

LLVM IR (-O0):
@.str = [21 x i8] c"OPENSSL_DEBUG_MEMORY\00"
@.str.1 = [3 x i8] c"on\00"
@CRYPTO_MEM_CHECK_ON = global i32 0
@.str.2 = [197 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/memleaktest.c\00"
@.str.3 = [5 x i8] c"lost\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [7 x i8] c"freeit\00"
@stderr = global i32 0
@.str.5 = [7 x i8] c"noleak\00"
@.str.6 = [3 x i8] c"-1\00"
@.str.7 = [13 x i8] c"lost != NULL\00"
@.str.8 = [12 x i8] c"noleak == 0\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i8* @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @CRYPTO_set_mem_debug(i32 1)
br label %18
18: ; preds = %16, %12, %2
%19 = load i32, i32* @CRYPTO_MEM_CHECK_ON
%20 = call i32 @CRYPTO_mem_ctrl(i32 %19)
%21 = call i8* @OPENSSL_malloc(i32 3)
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @test_ptr(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %18
%26 = load i32, i32* @EXIT_FAILURE
store i32 %26, i32* %3
br label %64
27: ; preds = %18
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %41
32: ; preds = %27
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %32
%39 = load i8*, i8** %7
%40 = call i32 @OPENSSL_free(i8* %39)
store i8* null, i8** %7
br label %41
41: ; preds = %38, %32, %27
%42 = load i32, i32* @stderr
%43 = call i32 @CRYPTO_mem_leaks_fp(i32 %42)
store i32 %43, i32* %8
%44 = load i32, i32* %8
%45 = call i32 @test_int_ne(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %44, i32 -1)
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %41
%48 = load i32, i32* @EXIT_FAILURE
store i32 %48, i32* %3
br label %64
49: ; preds = %41
%50 = load i8*, i8** %7
%51 = icmp ne i8* %50, null
%52 = zext i1 %51 to i32
%53 = load i32, i32* %8
%54 = icmp eq i32 %53, 0
%55 = zext i1 %54 to i32
%56 = call i64 @test_int_eq(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %52, i32 %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %49
%59 = load i32, i32* @EXIT_SUCCESS
br label %62
60: ; preds = %49
%61 = load i32, i32* @EXIT_FAILURE
br label %62
62: ; preds = %60, %58
%63 = phi i32 [ %59, %58 ], [ %61, %60 ]
store i32 %63, i32* %3
br label %64
64: ; preds = %62, %47, %25
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [21 x i8] c"OPENSSL_DEBUG_MEMORY\00"
@.str.1 = [3 x i8] c"on\00"
@CRYPTO_MEM_CHECK_ON = global i32 0
@.str.2 = [197 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/memleaktest.c\00"
@.str.3 = [5 x i8] c"lost\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [7 x i8] c"freeit\00"
@stderr = global i32 0
@.str.5 = [7 x i8] c"noleak\00"
@.str.6 = [3 x i8] c"-1\00"
@.str.7 = [13 x i8] c"lost != NULL\00"
@.str.8 = [12 x i8] c"noleak == 0\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @CRYPTO_set_mem_debug(i32 1)
br label %10
10: ; preds = %8, %5, %2
%11 = load i32, i32* @CRYPTO_MEM_CHECK_ON
%12 = tail call i32 @CRYPTO_mem_ctrl(i32 %11)
%13 = tail call i8* @OPENSSL_malloc(i32 3)
%14 = tail call i32 @test_ptr(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = load i32, i32* @EXIT_FAILURE
br label %45
18: ; preds = %10
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @OPENSSL_free(i8* %13)
br label %27
27: ; preds = %25, %22, %18
%28 = phi i8* [ null, %25 ], [ %13, %22 ], [ %13, %18 ]
%29 = load i32, i32* @stderr
%30 = tail call i32 @CRYPTO_mem_leaks_fp(i32 %29)
%31 = tail call i32 @test_int_ne(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %30, i32 -1)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = load i32, i32* @EXIT_FAILURE
br label %45
35: ; preds = %27
%36 = icmp ne i8* %28, null
%37 = zext i1 %36 to i32
%38 = icmp eq i32 %30, 0
%39 = zext i1 %38 to i32
%40 = tail call i64 @test_int_eq(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %37, i32 %39)
%41 = icmp eq i64 %40, 0
%42 = load i32, i32* @EXIT_SUCCESS
%43 = load i32, i32* @EXIT_FAILURE
%44 = select i1 %41, i32 %43, i32 %42
br label %45
45: ; preds = %35, %33, %16
%46 = phi i32 [ %44, %35 ], [ %34, %33 ], [ %17, %16 ]
ret i32 %46
}