#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*/ BIO_flush(int /*<<< orphan*/);
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ BN_GENCB_get_arg(int /*<<< orphan*/ *);
int cb(int p, int n, BN_GENCB *arg) {
  char c = '*';
  if (p == 0)
    c = '.';
  if (p == 1)
    c = '+';
  if (p == 2)
    c = '*';
  if (p == 3)
    c = '\n';
  BIO_write(BN_GENCB_get_arg(arg), &c, 1);
  (void)BIO_flush(BN_GENCB_get_arg(arg));
  return 1;
}


x86 assembly (clang, -O0):
<cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movb   $0x2a,-0x11(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1154 <cb+0x24>
movb   $0x2e,-0x11(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1162 <cb+0x32>
movb   $0x2b,-0x11(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    1170 <cb+0x40>
movb   $0x2a,-0x11(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    117e <cb+0x4e>
movb   $0xa,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <BN_GENCB_get_arg@plt>
mov    %eax,%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1040 <BIO_write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <BN_GENCB_get_arg@plt>
mov    %eax,%edi
call   1050 <BIO_flush@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
test   %edi,%edi
sete   %al
shl    $0x2,%al
or     $0x2a,%al
cmp    $0x1,%edi
movzbl %al,%eax
mov    $0x2b,%ecx
cmovne %eax,%ecx
cmp    $0x2,%edi
mov    $0x2a,%eax
cmovne %ecx,%eax
cmp    $0x3,%edi
mov    $0xa,%ecx
cmovne %eax,%ecx
mov    %cl,0xf(%rsp)
mov    %rdx,%rdi
call   1030 <BN_GENCB_get_arg@plt>
lea    0xf(%rsp),%rsi
mov    %eax,%edi
mov    $0x1,%edx
call   1040 <BIO_write@plt>
mov    %rbx,%rdi
call   1030 <BN_GENCB_get_arg@plt>
mov    %eax,%edi
call   1050 <BIO_flush@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cb(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i8 42, i8* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i8 46, i8* %7
br label %11
11: ; preds = %10, %3
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %11
store i8 43, i8* %7
br label %15
15: ; preds = %14, %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %15
store i8 42, i8* %7
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %23
22: ; preds = %19
store i8 10, i8* %7
br label %23
23: ; preds = %22, %19
%24 = load i32*, i32** %6
%25 = call i32 @BN_GENCB_get_arg(i32* %24)
%26 = call i32 @BIO_write(i32 %25, i8* %7, i32 1)
%27 = load i32*, i32** %6
%28 = call i32 @BN_GENCB_get_arg(i32* %27)
%29 = call i32 @BIO_flush(i32 %28)
ret i32 1
}

LLVM IR (-O2):
define i32 @cb(i32 %0, i32 %1, i32* %2) {
%4 = alloca i8
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8 46, i8 42
%7 = icmp eq i32 %0, 1
%8 = select i1 %7, i8 43, i8 %6
%9 = icmp eq i32 %0, 2
%10 = select i1 %9, i8 42, i8 %8
%11 = icmp eq i32 %0, 3
%12 = select i1 %11, i8 10, i8 %10
store i8 %12, i8* %4
%13 = tail call i32 @BN_GENCB_get_arg(i32* %2)
%14 = call i32 @BIO_write(i32 %13, i8* %4, i32 1)
%15 = call i32 @BN_GENCB_get_arg(i32* %2)
%16 = call i32 @BIO_flush(i32 %15)
ret i32 1
}