#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 */
int /*<<< orphan*/ printf(char *, ...);
void callback(void *closure, int event, unsigned char *info_hash, void *data,
              size_t data_len) {
  if (event == 3)
    printf("Search done.\n");
  else if (event == 1)
    printf("Received %d values.\n", (int)(data_len / 6));
}


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x3,-0xc(%rbp)
jne    1148 <callback+0x38>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <callback+0x65>
cmpl   $0x1,-0xc(%rbp)
jne    1170 <callback+0x60>
mov    -0x28(%rbp),%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <callback+0x65>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback>:
cmp    $0x1,%esi
je     1136 <callback+0x16>
cmp    $0x3,%esi
jne    115a <callback+0x3a>
lea    0xee4(%rip),%rdi
jmp    1030 <puts@plt>
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mov    %r8,%rax
mul    %rcx
shr    $0x2,%rdx
lea    0xeaf(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
jmp    1040 <printf@plt>
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Search done.\0A\00"
@.str.1 = [21 x i8] c"Received %d values.\0A\00"
define void @callback(i8* %0, i32 %1, i8* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %24
15: ; preds = %5
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i64, i64* %10
%20 = udiv i64 %19, 6
%21 = trunc i64 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %18, %15
br label %24
24: ; preds = %23, %13
ret void
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"Received %d values.\0A\00"
@str = [13 x i8] c"Search done.\00"
define void @callback(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i64 %4) {
switch i32 %1, label %12 [
i32 3, label %6
i32 1, label %8
]
6: ; preds = %5
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %12
8: ; preds = %5
%9 = udiv i64 %4, 6
%10 = trunc i64 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %5, %8, %6
ret void
}