#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int genprime_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';
  putc(c, stderr);
  fflush(stderr);
  return (1);
}


x86 assembly (clang, -O0):
<genprime_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 <genprime_cb+0x24>
movb   $0x2e,-0x11(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1152 <genprime_cb+0x32>
movb   $0x2b,-0x11(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    1160 <genprime_cb+0x40>
movb   $0x2a,-0x11(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    116e <genprime_cb+0x4e>
movb   $0xa,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    0x2e68(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genprime_cb>:
push   %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    0x2e8a(%rip),%rbx
mov    (%rbx),%esi
movzbl %cl,%edi
call   1030 <putc@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
define i32 @genprime_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 i8, i8* %7
%25 = load i32, i32* @stderr
%26 = call i32 @putc(i8 signext %24, i32 %25)
%27 = load i32, i32* @stderr
%28 = call i32 @fflush(i32 %27)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
define i32 @genprime_cb(i32 %0, i32 %1, i32* nocapture readnone %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8 46, i8 42
%6 = icmp eq i32 %0, 1
%7 = select i1 %6, i8 43, i8 %5
%8 = icmp eq i32 %0, 2
%9 = select i1 %8, i8 42, i8 %7
%10 = icmp eq i32 %0, 3
%11 = select i1 %10, i8 10, i8 %9
%12 = load i32, i32* @stderr
%13 = tail call i32 @putc(i8 signext %11, i32 %12)
%14 = load i32, i32* @stderr
%15 = tail call i32 @fflush(i32 %14)
ret i32 1
}