#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 */
scalar_t__ EVP_PBE_find(int, int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                        int /*<<< orphan*/);
scalar_t__ EVP_PBE_get(int *, int *, int);
int /*<<< orphan*/ OBJ_nid2sn(int);
int /*<<< orphan*/ test_note(char *, int, int, int, ...);
int /*<<< orphan*/ test_true(char *, int, char *, int);
int test_pbelu(void) {
  int i, failed = 0;
  int pbe_type, pbe_nid, last_type = -1, last_nid = -1;
  for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
    if (!test_true("/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/pbelutest.c",
                   24, "EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0)",
                   (EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0)) != 0)) {
      test_note("i=%d, pbe_type=%d, pbe_nid=%d", i, pbe_type, pbe_nid);
      failed = 1;
      break;
    }
  }
  if (!failed)
    return 1;
  for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
    failed =
        pbe_type < last_type || (pbe_type == last_type && pbe_nid < last_nid);
    test_note("PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
              OBJ_nid2sn(pbe_nid), failed ? "ERROR" : "OK");
    last_type = pbe_type;
    last_nid = pbe_nid;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_pbelu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <EVP_PBE_get@plt>
cmp    $0x0,%rax
je     1206 <test_pbelu+0xb6>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
mov    %rcx,%rdx
call   1030 <EVP_PBE_find@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe4a(%rip),%rdi
mov    $0x18,%esi
lea    0xf01(%rip),%rdx
call   1040 <test_true@plt>
cmp    $0x0,%eax
jne    11f3 <test_pbelu+0xa3>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1070 <test_note@plt>
movl   $0x1,-0xc(%rbp)
jmp    1206 <test_pbelu+0xb6>
jmp    11f8 <test_pbelu+0xa8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <test_pbelu+0x24>
cmpl   $0x0,-0xc(%rbp)
jne    121c <test_pbelu+0xcc>
movl   $0x1,-0x4(%rbp)
jmp    12df <test_pbelu+0x18f>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <EVP_PBE_get@plt>
cmp    $0x0,%rax
je     12d8 <test_pbelu+0x188>
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x18(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jl     1271 <test_pbelu+0x121>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x1e(%rbp)
jne    126b <test_pbelu+0x11b>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <OBJ_nid2sn@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
mov    -0xc(%rbp),%edi
lea    0xe8d(%rip),%r8
lea    0xe80(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1070 <test_note@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1223 <test_pbelu+0xd3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pbelu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
xor    %ebp,%ebp
xor    %edx,%edx
call   1060 <EVP_PBE_get@plt>
mov    $0x1,%r13d
test   %rax,%rax
je     12b2 <test_pbelu+0x162>
lea    0xe7e(%rip),%r14
lea    0xf3a(%rip),%r12
lea    0x4(%rsp),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <EVP_PBE_find@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %r14,%rdi
mov    $0x18,%esi
mov    %r12,%rdx
call   1040 <test_true@plt>
test   %eax,%eax
je     11e9 <test_pbelu+0x99>
add    $0x1,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <EVP_PBE_get@plt>
test   %rax,%rax
jne    11a0 <test_pbelu+0x50>
jmp    12b2 <test_pbelu+0x162>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
lea    0xefb(%rip),%rdi
xor    %r13d,%r13d
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <test_note@plt>
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1060 <EVP_PBE_get@plt>
test   %rax,%rax
je     12b2 <test_pbelu+0x162>
mov    $0xffffffff,%r15d
mov    $0x1,%ebp
mov    $0xffffffff,%r12d
xor    %r13d,%r13d
jmp    1288 <test_pbelu+0x138>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%r14d
mov    %r14d,%edi
call   1050 <OBJ_nid2sn@plt>
mov    %eax,%ecx
lea    0xed4(%rip),%r8
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <test_note@plt>
mov    0x4(%rsp),%r12d
mov    (%rsp),%r15d
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    %ebp,%edx
call   1060 <EVP_PBE_get@plt>
add    $0x1,%ebp
test   %rax,%rax
je     12b2 <test_pbelu+0x162>
mov    0x4(%rsp),%ebx
cmp    %r12d,%ebx
jl     1240 <test_pbelu+0xf0>
mov    (%rsp),%r14d
mov    %r14d,%edi
call   1050 <OBJ_nid2sn@plt>
mov    %eax,%ecx
lea    0xe89(%rip),%r8
cmp    %r12d,%ebx
jne    1255 <test_pbelu+0x105>
cmp    %r15d,%r14d
jl     124e <test_pbelu+0xfe>
jmp    1255 <test_pbelu+0x105>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [195 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/pbelutest.c\00"
@.str.1 = [47 x i8] c"EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0)\00"
@.str.2 = [30 x i8] c"i=%d, pbe_type=%d, pbe_nid=%d\00"
@.str.3 = [25 x i8] c"PBE type=%d %d (%s): %s\0A\00"
@.str.4 = [6 x i8] c"ERROR\00"
@.str.5 = [3 x i8] c"OK\00"
define i32 @test_pbelu() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 -1, i32* %6
store i32 -1, i32* %7
store i32 0, i32* %2
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %2
%10 = call i64 @EVP_PBE_get(i32* %4, i32* %5, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i64 @EVP_PBE_find(i32 %13, i32 %14, i32* null, i32* null, i32 0)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @test_true(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %12
%21 = load i32, i32* %2
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 (i8*, i32, i32, i32, ...) @test_note(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
store i32 1, i32* %3
br label %29
25: ; preds = %12
br label %26
26: ; preds = %25
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %8
29: ; preds = %20, %8
%30 = load i32, i32* %3
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %29
store i32 1, i32* %1
br label %70
33: ; preds = %29
store i32 0, i32* %2
br label %34
34: ; preds = %66, %33
%35 = load i32, i32* %2
%36 = call i64 @EVP_PBE_get(i32* %4, i32* %5, i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %69
38: ; preds = %34
%39 = load i32, i32* %4
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
br i1 %41, label %52, label %42
42: ; preds = %38
%43 = load i32, i32* %4
%44 = load i32, i32* %6
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* %5
%48 = load i32, i32* %7
%49 = icmp slt i32 %47, %48
br label %50
50: ; preds = %46, %42
%51 = phi i1 [ false, %42 ], [ %49, %46 ]
br label %52
52: ; preds = %50, %38
%53 = phi i1 [ true, %38 ], [ %51, %50 ]
%54 = zext i1 %53 to i32
store i32 %54, i32* %3
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = load i32, i32* %5
%58 = call i32 @OBJ_nid2sn(i32 %57)
%59 = load i32, i32* %3
%60 = icmp ne i32 %59, 0
%61 = zext i1 %60 to i64
%62 = select i1 %60, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%63 = call i32 (i8*, i32, i32, i32, ...) @test_note(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56, i32 %58, i8* %62)
%64 = load i32, i32* %4
store i32 %64, i32* %6
%65 = load i32, i32* %5
store i32 %65, i32* %7
br label %66
66: ; preds = %52
%67 = load i32, i32* %2
%68 = add nsw i32 %67, 1
store i32 %68, i32* %2
br label %34
69: ; preds = %34
store i32 0, i32* %1
br label %70
70: ; preds = %69, %32
%71 = load i32, i32* %1
ret i32 %71
}

LLVM IR (-O2):
@.str = [195 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/pbelutest.c\00"
@.str.1 = [47 x i8] c"EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0)\00"
@.str.2 = [30 x i8] c"i=%d, pbe_type=%d, pbe_nid=%d\00"
@.str.3 = [25 x i8] c"PBE type=%d %d (%s): %s\0A\00"
@.str.4 = [6 x i8] c"ERROR\00"
@.str.5 = [3 x i8] c"OK\00"
define i32 @test_pbelu() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @EVP_PBE_get(i32* %1, i32* %2, i32 0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %54, label %7
7: ; preds = %0, %22
%8 = phi i32 [ %23, %22 ], [ 0, %0 ]
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i64 @EVP_PBE_find(i32 %9, i32 %10, i32* null, i32* null, i32 0)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @test_true(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %7
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 (i8*, i32, i32, i32, ...) @test_note(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %17, i32 %18)
%20 = call i64 @EVP_PBE_get(i32* %1, i32* %2, i32 0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %54, label %26
22: ; preds = %7
%23 = add nuw nsw i32 %8, 1
%24 = call i64 @EVP_PBE_get(i32* %1, i32* %2, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %54, label %7
26: ; preds = %16, %44
%27 = phi i32 [ %50, %44 ], [ -1, %16 ]
%28 = phi i32 [ %49, %44 ], [ -1, %16 ]
%29 = phi i32 [ %51, %44 ], [ 0, %16 ]
%30 = load i32, i32* %1
%31 = icmp slt i32 %30, %28
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i32, i32* %2
%34 = call i32 @OBJ_nid2sn(i32 %33)
br label %41
35: ; preds = %26
%36 = icmp eq i32 %30, %28
%37 = load i32, i32* %2
%38 = icmp slt i32 %37, %27
%39 = select i1 %36, i1 %38, i1 false
%40 = call i32 @OBJ_nid2sn(i32 %37)
br i1 %39, label %41, label %44
41: ; preds = %32, %35
%42 = phi i32 [ %34, %32 ], [ %40, %35 ]
%43 = phi i32 [ %33, %32 ], [ %37, %35 ]
br label %44
44: ; preds = %35, %41
%45 = phi i32 [ %42, %41 ], [ %40, %35 ]
%46 = phi i32 [ %43, %41 ], [ %37, %35 ]
%47 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %41 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %35 ]
%48 = call i32 (i8*, i32, i32, i32, ...) @test_note(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %46, i32 %45, i8* %47)
%49 = load i32, i32* %1
%50 = load i32, i32* %2
%51 = add nuw nsw i32 %29, 1
%52 = call i64 @EVP_PBE_get(i32* %1, i32* %2, i32 %51)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %26
54: ; preds = %22, %44, %0, %16
%55 = phi i32 [ 0, %16 ], [ 1, %0 ], [ 0, %44 ], [ 1, %22 ]
ret i32 %55
}