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

/* Variables and functions */
int /*<<< orphan*/ test_error(char *, int, char *);
int dsa_cb(int p, int n, BN_GENCB *arg) {
  static int ok = 0, num = 0;
  if (p == 0)
    num++;
  if (p == 2)
    ok++;
  if (!ok && (p == 0) && (num > 1)) {
    test_error("/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/dsatest.c",
               127, "dsa_cb error");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<dsa_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113b <dsa_cb+0x2b>
mov    0x2efe(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef5(%rip)
cmpl   $0x2,-0x8(%rbp)
jne    1154 <dsa_cb+0x44>
mov    0x2ee1(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ed8(%rip)
cmpl   $0x0,0x2ed1(%rip)
jne    119c <dsa_cb+0x8c>
cmpl   $0x0,-0x8(%rbp)
jne    119c <dsa_cb+0x8c>
cmpl   $0x1,0x2ebe(%rip)
jle    119c <dsa_cb+0x8c>
lea    0xe81(%rip),%rdi
mov    $0x7f,%esi
lea    0xf20(%rip),%rdx
call   1030 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <dsa_cb+0x93>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsa_cb>:
push   %rax
test   %edi,%edi
je     1123 <dsa_cb+0x13>
cmp    $0x2,%edi
jne    112d <dsa_cb+0x1d>
lea    0x2f0b(%rip),%rax
jmp    112a <dsa_cb+0x1a>
lea    0x2f06(%rip),%rax
addl   $0x1,(%rax)
or     0x2ef9(%rip),%edi
mov    $0x1,%eax
jne    115d <dsa_cb+0x4d>
cmpl   $0x2,0x2eef(%rip)
jl     115d <dsa_cb+0x4d>
lea    0xeb6(%rip),%rdi
lea    0xf5a(%rip),%rdx
mov    $0x7f,%esi
call   1030 <test_error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@dsa_cb.ok = internal global i32 0
@dsa_cb.num = internal global i32 0
@.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/dsatest.c\00"
@.str.1 = [13 x i8] c"dsa_cb error\00"
define i32 @dsa_cb(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* @dsa_cb.num
%12 = add nsw i32 %11, 1
store i32 %12, i32* @dsa_cb.num
br label %13
13: ; preds = %10, %3
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @dsa_cb.ok
%18 = add nsw i32 %17, 1
store i32 %18, i32* @dsa_cb.ok
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* @dsa_cb.ok
%21 = icmp ne i32 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* @dsa_cb.num
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @test_error(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 127, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %31
30: ; preds = %25, %22, %19
store i32 1, i32* %4
br label %31
31: ; preds = %30, %28
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
@dsa_cb.ok = internal unnamed_addr global i32 0
@dsa_cb.num = internal unnamed_addr global i32 0
@.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/dsatest.c\00"
@.str.1 = [13 x i8] c"dsa_cb error\00"
define i32 @dsa_cb(i32 %0, i32 %1, i32* nocapture readnone %2) {
switch i32 %0, label %9 [
i32 0, label %5
i32 2, label %4
]
4: ; preds = %3
br label %5
5: ; preds = %3, %4
%6 = phi i32* [ @dsa_cb.ok, %4 ], [ @dsa_cb.num, %3 ]
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
store i32 %8, i32* %6
br label %9
9: ; preds = %5, %3
%10 = load i32, i32* @dsa_cb.ok
%11 = or i32 %10, %0
%12 = icmp eq i32 %11, 0
%13 = load i32, i32* @dsa_cb.num
%14 = icmp sgt i32 %13, 1
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = tail call i32 @test_error(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 127, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %9, %16
%19 = phi i32 [ 0, %16 ], [ 1, %9 ]
ret i32 %19
}