#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 *, unsigned long, unsigned long, unsigned long,
                          long, unsigned long, ...);
scalar_t__ test(unsigned long, unsigned long, unsigned long, long,
                unsigned long, long);
int dotest(unsigned long target, unsigned long source, unsigned long mult,
           long add, unsigned long shift, long delta, int print) {
  if (test(target, source, mult, add, shift, delta)) {
    if (print & 4)
      printf("      {%11lu,%6ld /* >>%lu */ }, /* %lu/%lu */\n", mult, add,
             shift, target, source);
    else if (print & 2)
      printf("      {%11lu,%6ld,%3lu }, /* %lu/%lu */\n", mult, add, shift,
             target, source);
    else if (print)
      printf("number * %lu/%lu = (number * %lu + %ld) >> %lu [delta %ld]\n",
             target, source, mult, add, shift, delta);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dotest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
call   1040 <test@plt>
cmp    $0x0,%rax
je     1220 <dotest+0x100>
mov    0x10(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11a0 <dotest+0x80>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1214 <dotest+0xf4>
mov    0x10(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11d6 <dotest+0xb6>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <dotest+0xef>
cmpl   $0x0,0x10(%rbp)
je     120a <dotest+0xea>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%rax
lea    0xe5a(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <dotest+0xef>
jmp    1214 <dotest+0xf4>
movl   $0x1,-0x4(%rbp)
jmp    1227 <dotest+0x107>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,%rbp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r13
call   1040 <test@plt>
test   %rax,%rax
je     1180 <dotest+0x60>
mov    0x40(%rsp),%eax
test   $0x4,%al
jne    1185 <dotest+0x65>
test   $0x2,%al
jne    118e <dotest+0x6e>
mov    %r14,%rdx
mov    $0x1,%r14d
test   %eax,%eax
je     11b1 <dotest+0x91>
mov    %r12,(%rsp)
lea    0xeee(%rip),%rdi
mov    %r13,%rsi
mov    %r15,%rcx
mov    %rbp,%r8
mov    %rbx,%r9
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b1 <dotest+0x91>
xor    %r14d,%r14d
jmp    11b1 <dotest+0x91>
lea    0xe74(%rip),%rdi
jmp    1195 <dotest+0x75>
lea    0xe9b(%rip),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %r13,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c" {%11lu,%6ld /* >>%lu */ }, /* %lu/%lu */\0A\00"
@.str.1 = [41 x i8] c" {%11lu,%6ld,%3lu }, /* %lu/%lu */\0A\00"
@.str.2 = [60 x i8] c"number * %lu/%lu = (number * %lu + %ld) >> %lu [delta %ld]\0A\00"
define i32 @dotest(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
store i64 %0, i64* %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i32 %6, i32* %15
%16 = load i64, i64* %9
%17 = load i64, i64* %10
%18 = load i64, i64* %11
%19 = load i64, i64* %12
%20 = load i64, i64* %13
%21 = load i64, i64* %14
%22 = call i64 @test(i64 %16, i64 %17, i64 %18, i64 %19, i64 %20, i64 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %60
24: ; preds = %7
%25 = load i32, i32* %15
%26 = and i32 %25, 4
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load i64, i64* %11
%30 = load i64, i64* %12
%31 = load i64, i64* %13
%32 = load i64, i64* %9
%33 = load i64, i64* %10
%34 = call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 %29, i64 %30, i64 %31, i64 %32, i64 %33)
br label %59
35: ; preds = %24
%36 = load i32, i32* %15
%37 = and i32 %36, 2
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = load i64, i64* %11
%41 = load i64, i64* %12
%42 = load i64, i64* %13
%43 = load i64, i64* %9
%44 = load i64, i64* %10
%45 = call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i64 %40, i64 %41, i64 %42, i64 %43, i64 %44)
br label %58
46: ; preds = %35
%47 = load i32, i32* %15
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = load i64, i64* %9
%51 = load i64, i64* %10
%52 = load i64, i64* %11
%53 = load i64, i64* %12
%54 = load i64, i64* %13
%55 = load i64, i64* %14
%56 = call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i64 %50, i64 %51, i64 %52, i64 %53, i64 %54, i64 %55)
br label %57
57: ; preds = %49, %46
br label %58
58: ; preds = %57, %39
br label %59
59: ; preds = %58, %28
store i32 1, i32* %8
br label %61
60: ; preds = %7
store i32 0, i32* %8
br label %61
61: ; preds = %60, %59
%62 = load i32, i32* %8
ret i32 %62
}

LLVM IR (-O2):
@.str = [48 x i8] c" {%11lu,%6ld /* >>%lu */ }, /* %lu/%lu */\0A\00"
@.str.1 = [41 x i8] c" {%11lu,%6ld,%3lu }, /* %lu/%lu */\0A\00"
@.str.2 = [60 x i8] c"number * %lu/%lu = (number * %lu + %ld) >> %lu [delta %ld]\0A\00"
define i32 @dotest(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i32 %6) {
%8 = tail call i64 @test(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %7
%11 = and i32 %6, 4
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 %2, i64 %3, i64 %4, i64 %0, i64 %1)
br label %24
15: ; preds = %10
%16 = and i32 %6, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i64 %2, i64 %3, i64 %4, i64 %0, i64 %1)
br label %24
20: ; preds = %15
%21 = icmp eq i32 %6, 0
br i1 %21, label %24, label %22
22: ; preds = %20
%23 = tail call i32 (i8*, i64, i64, i64, i64, i64, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
br label %24
24: ; preds = %7, %13, %20, %22, %18
%25 = phi i32 [ 1, %18 ], [ 1, %22 ], [ 1, %20 ], [ 1, %13 ], [ 0, %7 ]
ret i32 %25
}