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

/* Variables and functions */
int /*<<< orphan*/ Output(int /*<<< orphan*/ *, char *, ...);
void CreateCounts(FILE *Out, unsigned Bpp) {
  ;
  if (32 != Bpp) {
    if (8 < Bpp) {
      Output(Out, "LeftCount = ((ULONG_PTR) DestBase >> 1) & 0x01;\n");
    } else {
      Output(Out, "LeftCount = (ULONG_PTR) DestBase & 0x03;\n");
      Output(Out,
             "if ((ULONG)(BltInfo->DestRect.right - BltInfo->DestRect.left) < "
             "LeftCount)\n");
      Output(Out, "{\n");
      Output(Out, "LeftCount = BltInfo->DestRect.right - "
                  "BltInfo->DestRect.left;\n");
      Output(Out, "}\n");
    }
    Output(
        Out,
        "CenterCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
    Output(Out, "               LeftCount) / %u;\n", 32 / Bpp);
    Output(
        Out,
        "RightCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
    Output(Out, "              LeftCount - %u * CenterCount);\n", 32 / Bpp);
  } else {
    Output(Out,
           "CenterCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\n");
  }
}


x86 assembly (clang, -O0):
<CreateCounts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x20,%eax
cmp    -0xc(%rbp),%eax
je     1211 <CreateCounts+0x101>
mov    $0x8,%eax
cmp    -0xc(%rbp),%eax
jae    1152 <CreateCounts+0x42>
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
jmp    11ac <CreateCounts+0x9c>
mov    -0x8(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xf26(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xf17(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xf44(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xf35(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,%edx
lea    0xf5a(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
lea    0xf69(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,%edx
lea    0xf8d(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
jmp    1223 <CreateCounts+0x113>
mov    -0x8(%rbp),%rdi
lea    0xfa4(%rip),%rsi
mov    $0x0,%al
call   1030 <Output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateCounts>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    $0x20,%esi
jne    1132 <CreateCounts+0x22>
lea    0x109e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <Output@plt>
mov    %esi,%ebp
cmp    $0x8,%esi
jbe    1142 <CreateCounts+0x32>
lea    0xec0(%rip),%rsi
jmp    118d <CreateCounts+0x7d>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf01(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf3c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf2e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf5c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf4e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
mov    $0x20,%eax
xor    %edx,%edx
div    %ebp
mov    %eax,%ebp
lea    0xf75(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xf83(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Output@plt>
lea    0xfb4(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <Output@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"LeftCount = ((ULONG_PTR) DestBase >> 1) & 0x01;\0A\00"
@.str.1 = [42 x i8] c"LeftCount = (ULONG_PTR) DestBase & 0x03;\0A\00"
@.str.2 = [76 x i8] c"if ((ULONG)(BltInfo->DestRect.right - BltInfo->DestRect.left) < LeftCount)\0A\00"
@.str.3 = [3 x i8] c"{\0A\00"
@.str.4 = [63 x i8] c"LeftCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
@.str.6 = [67 x i8] c"CenterCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\0A\00"
@.str.7 = [33 x i8] c" LeftCount) / %u;\0A\00"
@.str.8 = [66 x i8] c"RightCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\0A\00"
@.str.9 = [46 x i8] c" LeftCount - %u * CenterCount);\0A\00"
@.str.10 = [65 x i8] c"CenterCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\0A\00"
define void @CreateCounts(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 32, %5
br i1 %6, label %7, label %37
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ult i32 8, %8
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = call i32 (i32*, i8*, ...) @Output(i32* %11, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %24
13: ; preds = %7
%14 = load i32*, i32** %3
%15 = call i32 (i32*, i8*, ...) @Output(i32* %14, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @Output(i32* %16, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = call i32 (i32*, i8*, ...) @Output(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32*, i32** %3
%21 = call i32 (i32*, i8*, ...) @Output(i32* %20, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32*, i32** %3
%23 = call i32 (i32*, i8*, ...) @Output(i32* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %24
24: ; preds = %13, %10
%25 = load i32*, i32** %3
%26 = call i32 (i32*, i8*, ...) @Output(i32* %25, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = udiv i32 32, %28
%30 = call i32 (i32*, i8*, ...) @Output(i32* %27, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @Output(i32* %31, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%33 = load i32*, i32** %3
%34 = load i32, i32* %4
%35 = udiv i32 32, %34
%36 = call i32 (i32*, i8*, ...) @Output(i32* %33, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %35)
br label %40
37: ; preds = %2
%38 = load i32*, i32** %3
%39 = call i32 (i32*, i8*, ...) @Output(i32* %38, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
br label %40
40: ; preds = %37, %24
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"LeftCount = ((ULONG_PTR) DestBase >> 1) & 0x01;\0A\00"
@.str.1 = [42 x i8] c"LeftCount = (ULONG_PTR) DestBase & 0x03;\0A\00"
@.str.2 = [76 x i8] c"if ((ULONG)(BltInfo->DestRect.right - BltInfo->DestRect.left) < LeftCount)\0A\00"
@.str.3 = [3 x i8] c"{\0A\00"
@.str.4 = [63 x i8] c"LeftCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
@.str.6 = [67 x i8] c"CenterCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\0A\00"
@.str.7 = [33 x i8] c" LeftCount) / %u;\0A\00"
@.str.8 = [66 x i8] c"RightCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\0A\00"
@.str.9 = [46 x i8] c" LeftCount - %u * CenterCount);\0A\00"
@.str.10 = [65 x i8] c"CenterCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\0A\00"
define void @CreateCounts(i32* %0, i32 %1) {
%3 = icmp eq i32 %1, 32
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = icmp ugt i32 %1, 8
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
br label %11
11: ; preds = %4, %6
%12 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), %4 ]
%13 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* %12)
%14 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
%15 = udiv i32 32, %1
%16 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%18 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %15)
br label %21
19: ; preds = %2
%20 = tail call i32 (i32*, i8*, ...) @Output(i32* %0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
br label %21
21: ; preds = %19, %11
ret void
}