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

/* Variables and functions */
int /*<<< orphan*/ BIO_flush(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/ *, char *, int);
void cb(int p, int n, void *arg) {
  char c = '*';
  if (p == 0)
    c = '.';
  if (p == 1)
    c = '+';
  if (p == 2)
    c = '*';
  if (p == 3)
    c = '\n';
  BIO_write((BIO *)arg, &c, 1);
  (void)BIO_flush((BIO *)arg);
}


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    1144 <cb+0x24>
movb   $0x2e,-0x11(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1152 <cb+0x32>
movb   $0x2b,-0x11(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    1160 <cb+0x40>
movb   $0x2a,-0x11(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    116e <cb+0x4e>
movb   $0xa,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1030 <BIO_write@plt>
mov    -0x10(%rbp),%rdi
call   1040 <BIO_flush@plt>
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)
lea    0xf(%rsp),%rsi
mov    %rdx,%rdi
mov    $0x1,%edx
call   1030 <BIO_write@plt>
mov    %rbx,%rdi
call   1040 <BIO_flush@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @cb(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %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 i8*, i8** %6
%25 = bitcast i8* %24 to i32*
%26 = call i32 @BIO_write(i32* %25, i8* %7, i32 1)
%27 = load i8*, i8** %6
%28 = bitcast i8* %27 to i32*
%29 = call i32 @BIO_flush(i32* %28)
ret void
}

LLVM IR (-O2):
define void @cb(i32 %0, i32 %1, i8* %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 = bitcast i8* %2 to i32*
%14 = call i32 @BIO_write(i32* %13, i8* %4, i32 1)
%15 = call i32 @BIO_flush(i32* %13)
ret void
}